public class Product extends ProductNode
Product
instances are an in-memory representation of a remote sensing data product. The product is more
an abstract hull containing references to the data of the product or readers to retrieve the data on demant. The
product itself does not hold the remote sensing data. Data products can contain multiple geophysical parameters
stored as bands and can also have multiple metadata attributes. Also, a Product
can contain any number
of TiePointGrids
holding the tie point data.
Every product can also have a product reader and writer assigned to it. The reader represents the data source from which a product was created, whereas the writer represents the data sink. Both, the source and the sink must not necessarily store data in the same format. Furthermore, it is not mandatory for a product to have both of them.
Modifier and Type | Class and Description |
---|---|
static interface |
Product.AutoGrouping
AutoGrouping can be used by an application to auto-group a long list of product nodes (e.g.
|
Modifier and Type | Field and Description |
---|---|
static org.opengis.referencing.crs.ImageCRS |
DEFAULT_IMAGE_CRS
The default BEAM image coordinate reference system.
|
static String |
GEOMETRY_FEATURE_TYPE_NAME |
static String |
HISTORY_ROOT_NAME |
static String |
METADATA_ROOT_NAME |
static String |
PROPERTY_NAME_FILE_LOCATION |
static String |
PROPERTY_NAME_PRODUCT_TYPE |
static String |
PROPERTY_NAME_SCENE_CRS |
static String |
PROPERTY_NAME_SCENE_GEO_CODING |
static String |
PROPERTY_NAME_SCENE_TIME_CODING |
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
Constructor and Description |
---|
Product(String name,
String type)
Constructs a new product with the given name and type.
|
Product(String name,
String type,
int sceneRasterWidth,
int sceneRasterHeight)
Creates a new product without any reader (in-memory product)
|
Product(String name,
String type,
int sceneRasterWidth,
int sceneRasterHeight,
ProductReader reader)
Constructs a new product with the given name and the given reader.
|
Product(String name,
String type,
ProductReader reader)
Constructs a new product with the given name, type and the reader.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptVisitor(ProductVisitor visitor)
Accepts the given visitor.
|
void |
addBand(Band band)
Adds the given band to this product.
|
Band |
addBand(String bandName,
int dataType)
Creates a new band with the given name and data type and adds it to this product and returns it.
|
Band |
addBand(String bandName,
String expression)
Creates a new band with the given name and adds it to this product and returns it.
|
Band |
addBand(String bandName,
String expression,
int dataType)
Creates a new band with the given name and data type and adds it to this product and returns it.
|
void |
addMask(Mask mask)
Adds the given mask to this product.
|
Mask |
addMask(String maskName,
Mask.ImageType imageType)
Creates a new mask with the given name and image type and adds it to this product and returns it.
|
Mask |
addMask(String maskName,
String expression,
String description,
Color color,
double transparency)
Creates a new mask using a band arithmetic expression
and adds it to this product and returns it.
|
Mask |
addMask(String maskName,
VectorDataNode vectorDataNode,
String description,
Color color,
double transparency)
Creates a new mask based on the geometries contained in a vector data node,
adds it to this product and returns it.
|
Mask |
addMask(String maskName,
VectorDataNode vectorDataNode,
String description,
Color color,
double transparency,
RasterDataNode prototypeRasterDataNode)
Creates a new mask based on the geometries contained in a vector data node,
adds it to this product and returns it.
|
boolean |
addProductNodeListener(ProductNodeListener listener)
Adds a
ProductNodeListener to this product. |
void |
addTiePointGrid(TiePointGrid tiePointGrid)
Adds the given tie-point grid to this product.
|
boolean |
canBeOrthorectified()
Checks whether or not this product can be orthorectified.
|
void |
closeIO()
Closes the file I/O for this product.
|
void |
closeProductReader()
Closes and clears this product's reader (if any).
|
void |
closeProductWriter()
Closes and clears this product's writer (if any).
|
boolean |
containsBand(String name)
Tests if a band with the given name is contained in this product.
|
boolean |
containsPixel(double x,
double y)
Tests if the given pixel position is within the product pixel bounds.
|
boolean |
containsPixel(PixelPos pixelPos)
Tests if the given pixel position is within the product pixel bounds.
|
boolean |
containsRasterDataNode(String name)
Tests if a raster data node with the given name is contained in this product.
|
boolean |
containsTiePointGrid(String name)
Tests if a tie-point grid with the given name is contained in this product.
|
WritableNamespace |
createBandArithmeticDefaultNamespace()
Creates a namespace to be used by parsers for band arithmetic expressions.
|
Parser |
createBandArithmeticParser()
Creates a parser for band arithmetic expressions.
|
MultiLevelModel |
createMultiLevelModel() |
String |
createPixelInfoString(int pixelX,
int pixelY)
Creates a string containing all available information at the given pixel position.
|
Product |
createSubset(ProductSubsetDef subsetDef,
String name,
String desc)
Creates a subset of this product.
|
BitRaster |
createValidMask(String expression,
ProgressMonitor pm)
Deprecated.
since BEAM 4.7, use
getMaskGroup() instead |
BitRaster |
createValidMask(Term term,
ProgressMonitor pm)
Deprecated.
since BEAM 4.7, use
Mask.BandMathsType.create()
and getMaskGroup() ) instead |
void |
dispose()
Releases all of the resources used by this object instance and all of its owned children.
|
static AffineTransform |
findImageToModelTransform(GeoCoding geoCoding)
Finds an appropriate transformation from image coordinates used by the given
geo-coding (if any) into "model" coordinates used to render
(e.g.
|
static org.opengis.referencing.crs.CoordinateReferenceSystem |
findModelCRS(GeoCoding geoCoding)
Finds a coordinate reference system (CRS) that is appropriate as a scene CRS.
|
protected void |
fireNodeAdded(ProductNode childNode,
ProductNodeGroup nodeGroup) |
protected void |
fireNodeChanged(ProductNode sourceNode,
String propertyName,
Object oldValue,
Object newValue) |
protected void |
fireNodeDataChanged(DataNode sourceNode) |
protected void |
fireNodeRemoved(ProductNode childNode,
ProductNodeGroup nodeGroup) |
String[] |
getAllFlagNames()
Returns the names of all flags of all flag datasets contained this product.
|
Product.AutoGrouping |
getAutoGrouping()
Gets the auto-grouping applicable to product nodes contained in this product.
|
Band |
getBand(String name)
Returns the band with the given name.
|
Band |
getBandAt(int index)
Returns the band at the given index.
|
ProductNodeGroup<Band> |
getBandGroup()
Gets the band group of this product.
|
int |
getBandIndex(String name)
Returns the index for the band with the given name.
|
String[] |
getBandNames()
Returns a string array containing the names of the bands contained in this product
|
Band[] |
getBands()
Returns an array of bands contained in this product
|
Quicklook |
getDefaultQuicklook() |
ProductData.UTC |
getEndTime()
Gets the (sensing) stop time associated with the last raster data line.
|
File |
getFileLocation()
Retrieves the disk location of this product.
|
ProductNodeGroup<FlagCoding> |
getFlagCodingGroup() |
PlacemarkGroup |
getGcpGroup()
Gets the group of ground-control points (GCPs).
|
ProductNodeGroup |
getGroup(String name) |
ProductNodeGroup<ProductNodeGroup> |
getGroups() |
ProductNodeGroup<IndexCoding> |
getIndexCodingGroup() |
ProductNodeGroup<Mask> |
getMaskGroup() |
MultiLevelImage |
getMaskImage(String expression,
RasterDataNode associatedRaster)
Gets a multi-level mask image for the given band maths expression and an optional associated raster.
|
MetadataElement |
getMetadataRoot()
Gets the root element of the associated metadata.
|
int |
getNumBands() |
int |
getNumResolutionsMax() |
int |
getNumTiePointGrids()
Returns the number of tie-point grids contained in this product
|
PlacemarkGroup |
getPinGroup()
Gets the group of pins.
|
PointingFactory |
getPointingFactory()
Gets the pointing factory associated with this data product.
|
Dimension |
getPreferredTileSize()
Gets the preferred tile size which may be used for a the
rendered image
created for a RasterDataNode of this product. |
ProductManager |
getProductManager()
Returns the product manager for this product.
|
ProductNodeListener[] |
getProductNodeListeners() |
ProductReader |
getProductReader()
Returns the reader which was used to create this product in-memory represention from an external source and which
will be used to (re-)load band rasters.
|
String |
getProductType()
Gets the product type string.
|
ProductWriter |
getProductWriter()
Returns the writer which will be used to write modifications of this product's in-memory represention to an
external destination.
|
Quicklook |
getQuicklook(String name)
Returns the Quicklook with the given name.
|
String |
getQuicklookBandName()
Gets the name of the band suitable for quicklook generation.
|
ProductNodeGroup<Quicklook> |
getQuicklookGroup() |
RasterDataNode |
getRasterDataNode(String name)
Gets the raster data node with the given name.
|
List<RasterDataNode> |
getRasterDataNodes()
Gets all raster data nodes contained in this product including bands, masks and tie-point grids.
|
long |
getRawStorageSize(ProductSubsetDef subsetDef)
Gets an estimated, raw storage size in bytes of this product node.
|
int |
getRefNo() |
RasterDataNode[] |
getRefRasterDataNodes(String expression)
Gets all raster data nodes referenced by the given band maths expression.
|
ProductNode[] |
getRemovedChildNodes() |
org.opengis.referencing.crs.CoordinateReferenceSystem |
getSceneCRS()
Gets the scene coordinate reference system (scene CRS).
|
GeoCoding |
getSceneGeoCoding()
Gets the geo-coding associated with the scene raster.
|
int |
getSceneRasterHeight() |
Dimension |
getSceneRasterSize() |
int |
getSceneRasterWidth() |
TimeCoding |
getSceneTimeCoding()
Gets the time-coding for the associated scene raster.
|
ProductData.UTC |
getStartTime()
Gets the (sensing) start time associated with the first raster data line.
|
TiePointGrid |
getTiePointGrid(String name)
Returns the tie-point grid with the given name.
|
TiePointGrid |
getTiePointGridAt(int index)
Returns the tie-point grid at the given index.
|
ProductNodeGroup<TiePointGrid> |
getTiePointGridGroup()
Gets the tie-point grid group of this product.
|
String[] |
getTiePointGridNames()
Returns a string array containing the names of the tie-point grids contained in this product
|
TiePointGrid[] |
getTiePointGrids()
Returns an array of tie-point grids contained in this product
|
BitRaster |
getValidMask(String id)
Deprecated.
since BEAM 4.7, use
getMaskGroup() instead |
ProductNodeGroup<VectorDataNode> |
getVectorDataGroup() |
protected boolean |
hasProductNodeListeners() |
boolean |
isCompatibleBandArithmeticExpression(String expression)
Tests if the given band arithmetic expression can be computed using this product.
|
boolean |
isCompatibleBandArithmeticExpression(String expression,
Parser parser)
Tests if the given band arithmetic expression can be computed using this product and a given expression parser.
|
boolean |
isCompatibleProduct(Product product,
float eps)
Checks whether or not the given product is compatible with this product.
|
boolean |
isMultiSize()
Test if this product's raster data nodes are all of the same size (in pixels).
|
boolean |
isSceneCrsASharedModelCrs()
Tests if all the raster data nodes contained in this product share the same model
coordinate reference system which is equal to the scene coordinate reference system
used by this product.
|
boolean |
isSceneCrsEqualToModelCrsOf(RasterDataNode rasterDataNode)
Tests if the given raster data node uses this product's scene coordinate reference system
as model coordinate reference system.
|
boolean |
isUsingSingleGeoCoding()
Tests if all bands of this product are using a single, uniform geo-coding.
|
Term |
parseExpression(String expression)
Parses a mathematical expression given as a text string.
|
void |
readBitmask(int offsetX,
int offsetY,
int width,
int height,
Term bitmaskTerm,
boolean[] bitmask,
ProgressMonitor pm)
Deprecated.
since BEAM 4.7, add a new mask to product
(see
Mask.BandMathsType.create()
and getMaskGroup() ) and use its source image instead |
void |
readBitmask(int offsetX,
int offsetY,
int width,
int height,
Term bitmaskTerm,
byte[] bitmask,
byte trueValue,
byte falseValue,
ProgressMonitor pm)
Deprecated.
since BEAM 4.7, add a new mask to product
(see
Mask.BandMathsType.create()
and getMaskGroup() ) and use its source image instead |
boolean |
removeBand(Band band)
Removes the given band from this product.
|
void |
removeProductNodeListener(ProductNodeListener listener)
Removes a
ProductNodeListener from this product. |
boolean |
removeTiePointGrid(TiePointGrid tiePointGrid)
Removes the tie-point grid from this product.
|
void |
resetRefNo() |
void |
setAutoGrouping(Product.AutoGrouping autoGrouping)
Sets the auto-grouping applicable to product nodes contained in this product.
|
void |
setAutoGrouping(String pattern)
Sets the auto-grouping applicable to product nodes contained in this product.
|
void |
setEndTime(ProductData.UTC endTime)
Sets the (sensing) stop time associated with the first raster data line.
|
void |
setFileLocation(File fileLocation)
Sets the file location for this product.
|
void |
setModified(boolean modified)
Sets this node's modified flag.
|
void |
setNumResolutionsMax(int numResolutionsMax) |
void |
setOwner(ProductNode owner)
Overwrites the
ProductNode.setOwner(ProductNode) method in order to
throw an IllegalStateException ,
since products currently cannot have an owner. |
void |
setPointingFactory(PointingFactory pointingFactory)
Sets the pointing factory for this data product.
|
void |
setPreferredTileSize(Dimension preferredTileSize)
Sets the preferred tile size which may be used for a the
rendered image
created for a RasterDataNode of this product. |
void |
setPreferredTileSize(int tileWidth,
int tileHeight)
Sets the preferred tile size which may be used for a the
rendered image
created for a RasterDataNode of this product. |
void |
setProductReader(ProductReader reader)
Sets the product reader which will be used to create this product in-memory represention from an external source
and which will be used to (re-)load band rasters.
|
void |
setProductType(String productType)
Sets the product type of this product.
|
void |
setProductWriter(ProductWriter writer)
Sets the writer which will be used to write modifications of this product's in-memory represention to an external
destination.
|
void |
setQuicklookBandName(String quicklookBandName)
Sets the name of the band suitable for quicklook generation.
|
void |
setRefNo(int refNo)
Sets the reference number.
|
void |
setSceneCRS(org.opengis.referencing.crs.CoordinateReferenceSystem sceneCRS)
Sets the scene coordinate reference system.
|
void |
setSceneGeoCoding(GeoCoding sceneGeoCoding)
Sets the geo-coding to be associated with the scene raster.
|
void |
setSceneTimeCoding(TimeCoding sceneTimeCoding)
Sets the time-coding for the associated scene raster.
|
void |
setStartTime(ProductData.UTC startTime)
Sets the (sensing) start time of this product.
|
void |
setValidMask(String id,
BitRaster validMask)
Deprecated.
since BEAM 4.7, use
getMaskGroup() instead |
boolean |
transferGeoCodingTo(Product destProduct,
ProductSubsetDef subsetDef)
Transfers the geo-coding of this product instance to the
destProduct with respect to
the given subsetDef . |
void |
writeHeader(Object output)
Writes the header of a data product.
|
fireProductNodeChanged, fireProductNodeChanged, getDescription, getDisplayName, getName, getOwner, getProduct, getProductReaderSafe, getProductRefString, getProductSafe, getProductWriterSafe, getRawStorageSize, isModified, isPartOfSubset, isValidNodeName, removeFromFile, setDescription, setName, toString, updateExpression
getExtension
public static final String METADATA_ROOT_NAME
public static final String HISTORY_ROOT_NAME
public static final String PROPERTY_NAME_SCENE_CRS
public static final String PROPERTY_NAME_SCENE_GEO_CODING
public static final String PROPERTY_NAME_SCENE_TIME_CODING
public static final String PROPERTY_NAME_PRODUCT_TYPE
public static final String PROPERTY_NAME_FILE_LOCATION
public static final String GEOMETRY_FEATURE_TYPE_NAME
public static final org.opengis.referencing.crs.ImageCRS DEFAULT_IMAGE_CRS
public Product(String name, String type, int sceneRasterWidth, int sceneRasterHeight)
name
- the product nametype
- the product typesceneRasterWidth
- the scene width in pixels for this data productsceneRasterHeight
- the scene height in pixels for this data productpublic Product(String name, String type, int sceneRasterWidth, int sceneRasterHeight, ProductReader reader)
name
- the product identifiertype
- the product typesceneRasterWidth
- the scene width in pixels for this data productsceneRasterHeight
- the scene height in pixels for this data productreader
- the reader used to create this product and read data from it.ProductReader
public Product(String name, String type)
name
- the product identifiertype
- the product typepublic Product(String name, String type, ProductReader reader)
name
- the product identifiertype
- the product typereader
- the reader used to create this product and read data from it.ProductReader
public org.opengis.referencing.crs.CoordinateReferenceSystem getSceneCRS()
RasterDataNode.getSceneToModelTransform()
sceneToModelTransform}.
If no scene CRS has been set so far, the method will use the product's
scene geo-coding
, if any.
If the scene geo-coding's image-to-map transform
is an affine
transform, then the scene CRS returned is the map CRS
, otherwise it is the
image CRS
. If the product doesn't have any scene geo-coding, a default image
CRS is returned.
setSceneCRS(CoordinateReferenceSystem)
public void setSceneCRS(org.opengis.referencing.crs.CoordinateReferenceSystem sceneCRS)
sceneCRS
- The scene coordinate reference system.getSceneCRS()
public static AffineTransform findImageToModelTransform(GeoCoding geoCoding)
WARNING: Note that this method is only useful, if it can be ensured that the given geo-coding's
image-to-map transform
is an affine transformation.
In all other cases, the method returns the identity transformation which might not
be what you expect and what might not be even correct.
geoCoding
- The geo-coding or null
.geoCoding
is null
or an affine image-to-map transformation cannot be derived the identity transform
is returned.findModelCRS(org.esa.snap.core.datamodel.GeoCoding)
,
GeoCoding.getImageToMapTransform()
,
RasterDataNode.getImageToModelTransform()
,
MultiLevelModel.getImageToModelTransform(int)
public static org.opengis.referencing.crs.CoordinateReferenceSystem findModelCRS(GeoCoding geoCoding)
If the geo-coding's image-to-map transform
is an affine transform,
then the returned CRS is the geo-coding's map CRS
, otherwise it is its
image CRS
. If the geo-coding is null
, a default image CRS is returned
(DEFAULT_IMAGE_CRS
).
geoCoding
- The geo-coding or null
.findImageToModelTransform(org.esa.snap.core.datamodel.GeoCoding)
,
RasterDataNode.getImageToModelTransform()
,
MultiLevelModel.getImageToModelTransform(int)
public boolean isSceneCrsASharedModelCrs()
true
, if so.public boolean isSceneCrsEqualToModelCrsOf(RasterDataNode rasterDataNode)
rasterDataNode
- A raster data node.true
, if so.public File getFileLocation()
null
when the product has no
disk location (pure virtual memory product)null
public void setFileLocation(File fileLocation)
fileLocation
- the file location, may be null
public void setOwner(ProductNode owner)
ProductNode.setOwner(ProductNode)
method in order to
throw an IllegalStateException
,
since products currently cannot have an owner.setOwner
in class ProductNode
owner
- the new ownerpublic String getProductType()
public void setProductType(String productType)
productType
- the product type.public void setProductReader(ProductReader reader)
reader
- the product reader.IllegalArgumentException
- if the given reader is null.public ProductReader getProductReader()
getProductReader
in class ProductNode
null
public void setProductWriter(ProductWriter writer)
writer
- the product writer, can be null
public ProductWriter getProductWriter()
getProductWriter
in class ProductNode
null
public void writeHeader(Object output) throws IOException
Writes the header of a data product.
output
- an object representing a valid output for this writer, might be a ImageOutputStream
or a File
or other Object
to use for future decoding.IllegalArgumentException
- if output
is null
or it's type is none of the
supported output types.IOException
- if an I/O error occurspublic void closeProductReader() throws IOException
IOException
- if an I/O error occurscloseIO()
public void closeProductWriter() throws IOException
IOException
- if an I/O error occurscloseIO()
public void closeIO() throws IOException
closeProductReader()
and
closeProductWriter()
. The dispose()
method is not called, but
should be called if the product instance is no longer in use.IOException
- if an I/O error occurscloseProductReader()
,
closeProductWriter()
,
dispose()
public void dispose()
This method should be called only if it is for sure that this object instance will never be used again. The
results of referencing an instance of this class after a call to dispose()
are undefined.
Overrides of this method should always call super.dispose();
after disposing this instance.
This implementation also calls the closeIO
in order to release all open I/O resources.
dispose
in class ProductNode
public TimeCoding getSceneTimeCoding()
null
if not available.RasterDataNode.getTimeCoding()
public void setSceneTimeCoding(TimeCoding sceneTimeCoding)
sceneTimeCoding
- The new time-coding, or null
.RasterDataNode.setTimeCoding(TimeCoding)
public PointingFactory getPointingFactory()
public void setPointingFactory(PointingFactory pointingFactory)
pointingFactory
- the pointing factorypublic void setSceneGeoCoding(GeoCoding sceneGeoCoding)
sceneGeoCoding
- the geo-coding, or null
IllegalArgumentException
- GeoCoding
is a TiePointGeoCoding
and latGrid
or lonGrid
are not instances of tie point
grids in this product. GeoCoding
is a
MapGeoCoding
and its MapInfo
is null
GeoCoding
is a MapGeoCoding
and the
sceneWith
or sceneHeight
of its MapInfo
is not equal to this products sceneRasterWidth
or
sceneRasterHeight
public GeoCoding getSceneGeoCoding()
null
if this product is not geo-coded.public boolean isUsingSingleGeoCoding()
Object.equals(Object)
method.
If this product does not have a geo-coding, the method returns false.public boolean transferGeoCodingTo(Product destProduct, ProductSubsetDef subsetDef)
destProduct
with respect to
the given subsetDef
.destProduct
- the destination productsubsetDef
- the definition of the subset, may be null
public final int getSceneRasterWidth()
IllegalStateException
- if the scene size wasn't specified yet and cannot be derivedpublic final int getSceneRasterHeight()
IllegalStateException
- if the scene size wasn't specified yet and cannot be derivedpublic boolean isMultiSize()
true
, if so.public final Dimension getSceneRasterSize()
IllegalStateException
- if the scene size wasn't specified yet and cannot be derivedpublic ProductData.UTC getStartTime()
For Level-1/2 products this is the data-take time associated with the first raster data line. For Level-3 products, this could be the start time of first input product contributing data.
public void setStartTime(ProductData.UTC startTime)
For Level-1/2 products this is the data-take time associated with the first raster data line. For Level-3 products, this could be the start time of first input product contributing data.
startTime
- the sensing start time, can be nullpublic ProductData.UTC getEndTime()
For Level-1/2 products this is the data-take time associated with the last raster data line. For Level-3 products, this could be the end time of last input product contributing data.
public void setEndTime(ProductData.UTC endTime)
For Level-1/2 products this is the data-take time associated with the last raster data line. For Level-3 products, this could be the end time of last input product contributing data.
endTime
- the sensing stop time, can be nullpublic MetadataElement getMetadataRoot()
public ProductNodeGroup<ProductNodeGroup> getGroups()
public ProductNodeGroup getGroup(String name)
name
- The group name.null
if no such group exists.public ProductNodeGroup<TiePointGrid> getTiePointGridGroup()
public void addTiePointGrid(TiePointGrid tiePointGrid)
tiePointGrid
- the tie-point grid to added, ignored if null
public boolean removeTiePointGrid(TiePointGrid tiePointGrid)
tiePointGrid
- the tie-point grid to be removed, ignored if null
true
if node could be removedpublic int getNumTiePointGrids()
public TiePointGrid getTiePointGridAt(int index)
index
- the tie-point grid indexIndexOutOfBoundsException
- if the index is out of boundspublic String[] getTiePointGridNames()
public TiePointGrid[] getTiePointGrids()
public TiePointGrid getTiePointGrid(String name)
name
- the tie-point grid namenull
if a tie-point grid with the given name is
not contained in this product.public boolean containsTiePointGrid(String name)
name
- the name, must not be null
true
if a tie-point grid with the given name is contained in this product,
false
otherwisepublic ProductNodeGroup<Band> getBandGroup()
public void addBand(Band band)
band
- the band to added, must not be null
public Band addBand(String bandName, int dataType)
bandName
- the new band's namedataType
- the raster data type, must be one of the multiple ProductData.TYPE_X
constantspublic Band addBand(String bandName, String expression)
float
and it's samples are computed from the given band maths expression.bandName
- the new band's nameexpression
- the band maths expressionpublic Band addBand(String bandName, String expression, int dataType)
bandName
- the new band's nameexpression
- the band maths expressiondataType
- the raster data type, must be one of the multiple ProductData.TYPE_X
constantspublic boolean removeBand(Band band)
band
- the band to be removed, ignored if null
true
if removed succesfully, otherwise false
public int getNumBands()
public Band getBandAt(int index)
index
- the band indexIndexOutOfBoundsException
- if the index is out of boundspublic String[] getBandNames()
public Band[] getBands()
public Band getBand(String name)
name
- the band namenull
if a band with the given name is not contained in this
product.IllegalArgumentException
- if the given name is null
or empty.public int getBandIndex(String name)
name
- the band name-1
if a band with the given name is not contained in this product.IllegalArgumentException
- if the given name is null
or empty.public boolean containsBand(String name)
name
- the name, must not be null
true
if a band with the given name is contained in this product, false
otherwiseIllegalArgumentException
- if the given name is null
or empty.public boolean containsRasterDataNode(String name)
name
- the name, must not be null
true
if a raster data node with the given name is contained in this product,
false
otherwisepublic RasterDataNode getRasterDataNode(String name)
null
is returned.name
- the name, must not be null
null
if a raster data node with the given name
is not contained in this product.public List<RasterDataNode> getRasterDataNodes()
public ProductNodeGroup<Quicklook> getQuicklookGroup()
public Quicklook getDefaultQuicklook()
public Quicklook getQuicklook(String name)
name
- the quicklook namenull
if a quicklook with the given name is not contained in this
product.IllegalArgumentException
- if the given name is null
or empty.public String getQuicklookBandName()
public void setQuicklookBandName(String quicklookBandName)
quicklookBandName
- the name of the quicklook band, or nullpublic ProductNodeGroup<Mask> getMaskGroup()
public ProductNodeGroup<VectorDataNode> getVectorDataGroup()
public ProductNodeGroup<FlagCoding> getFlagCodingGroup()
public ProductNodeGroup<IndexCoding> getIndexCodingGroup()
public boolean containsPixel(double x, double y)
x
- the x coordinate of the pixel positiony
- the y coordinate of the pixel positioncontainsPixel(PixelPos)
public boolean containsPixel(PixelPos pixelPos)
pixelPos
- the pixel position, must not be nullcontainsPixel(double, double)
public PlacemarkGroup getGcpGroup()
public PlacemarkGroup getPinGroup()
public int getNumResolutionsMax()
public void setNumResolutionsMax(int numResolutionsMax)
numResolutionsMax
- The maximum number of resolution levels common to all band images.
If less than or equal to zero, the number of resolution levels is considered to be unknown.public boolean isCompatibleProduct(Product product, float eps)
product
- the product to compare witheps
- the maximum lat/lon error in degreefalse
if the scene dimensions or geocoding are different, true
otherwise.public Term parseExpression(String expression) throws ParseException
expression
- a expression given as a text string, e.g. "radiance_4 / (1.0 + radiance_11)".ParseException
- if the expression could not successfully be parsedpublic RasterDataNode[] getRefRasterDataNodes(String expression) throws ParseException
expression
- The expression.ParseException
- If the expression contains errors.public void acceptVisitor(ProductVisitor visitor)
The method subsequentially visits (calls acceptVisitor
for) all bands, tie-point grids and flag
codings. Finally it visits product metadata root element and calls visitor.visit(this)
.
acceptVisitor
in class ProductNode
visitor
- the visitor, must not be null
public boolean addProductNodeListener(ProductNodeListener listener)
ProductNodeListener
to this product. The ProductNodeListener
is informed each
time a node in this product changes.listener
- the listener to be addedpublic void removeProductNodeListener(ProductNodeListener listener)
ProductNodeListener
from this product.listener
- the listener to be removed.public ProductNodeListener[] getProductNodeListeners()
protected boolean hasProductNodeListeners()
protected void fireNodeChanged(ProductNode sourceNode, String propertyName, Object oldValue, Object newValue)
protected void fireNodeDataChanged(DataNode sourceNode)
protected void fireNodeAdded(ProductNode childNode, ProductNodeGroup nodeGroup)
protected void fireNodeRemoved(ProductNode childNode, ProductNodeGroup nodeGroup)
public int getRefNo()
public void setRefNo(int refNo)
refNo
- the reference number to set must be in the range 1 .. Integer.MAX_VALUEIllegalArgumentException
- if the refNo is out of rangepublic void resetRefNo()
public ProductManager getProductManager()
null
public boolean isCompatibleBandArithmeticExpression(String expression)
expression
- the mathematical expressionisCompatibleBandArithmeticExpression(String, org.esa.snap.core.jexp.Parser)
public boolean isCompatibleBandArithmeticExpression(String expression, Parser parser)
expression
- the band arithmetic expressionparser
- the expression parser to be usedcreateBandArithmeticParser()
public Parser createBandArithmeticParser()
public WritableNamespace createBandArithmeticDefaultNamespace()
public Product createSubset(ProductSubsetDef subsetDef, String name, String desc) throws IOException
subsetDef
- the product subset definitionname
- the name for the new productdesc
- the description for the new productnull
if the product/subset combination is not validIOException
- if an I/O error occurspublic void setModified(boolean modified)
ProductNode
If the modified flag changes to true and this node has an owner, the owner's modified flag is also set to true.
setModified
in class ProductNode
modified
- whether or not this node is beeing marked as modified.fireNodeChanged(org.esa.snap.core.datamodel.ProductNode, java.lang.String, java.lang.Object, java.lang.Object)
public long getRawStorageSize(ProductSubsetDef subsetDef)
getRawStorageSize
in class ProductNode
subsetDef
- if not null
the subset may limit the size returnedpublic String createPixelInfoString(int pixelX, int pixelY)
pixelX
- the pixel X co-ordinatepixelY
- the pixel Y co-ordinatepublic ProductNode[] getRemovedChildNodes()
public boolean canBeOrthorectified()
RasterDataNode.canBeOrthorectified()
returns true for all bands, false otherwisepublic Dimension getPreferredTileSize()
rendered image
created for a RasterDataNode
of this product.null
if not specifiedRasterDataNode.getSourceImage()
,
RasterDataNode.setSourceImage(java.awt.image.RenderedImage)
public void setPreferredTileSize(int tileWidth, int tileHeight)
rendered image
created for a RasterDataNode
of this product.tileWidth
- the preferred tile widthtileHeight
- the preferred tile heightsetPreferredTileSize(java.awt.Dimension)
public void setPreferredTileSize(Dimension preferredTileSize)
rendered image
created for a RasterDataNode
of this product.preferredTileSize
- the preferred tile size, may be null
if not specifiedRasterDataNode.getSourceImage()
,
RasterDataNode.setSourceImage(java.awt.image.RenderedImage)
public String[] getAllFlagNames()
A flag name contains the dataset (a band of this product) and the actual flag name as defined in the
flag-coding associated with the dataset. The general format for the flag name strings returned is therefore
"dataset.flag_name"
.
The method is used to find out which flags a product has in order to use them in bit-mask expressions.
null
.parseExpression(String)
public Product.AutoGrouping getAutoGrouping()
null
.public void setAutoGrouping(Product.AutoGrouping autoGrouping)
autoGrouping
- The auto-grouping or null
.public void setAutoGrouping(String pattern)
pattern
parameter is a textual representation of the auto-grouping.
The syntax for the pattern is:
pattern := <groupPath> {':' <groupPath>} | "" (empty string) groupPath := <groupName> {'/' <groupName>} groupName := any non-empty string without characters ':' and '/'An example for
pattern
applicable to Envisat AATSR data is
nadir/reflec:nadir/btemp:fward/reflec:fward/btemp:nadir:fward
pattern
- The auto-grouping pattern.public Mask addMask(String maskName, Mask.ImageType imageType)
maskName
- the new mask's nameimageType
- the image data type used to compute the mask samplespublic Mask addMask(String maskName, String expression, String description, Color color, double transparency)
maskName
- the new mask's nameexpression
- the band arithmetic expressiondescription
- the mask's descriptioncolor
- the display colortransparency
- the display transparencypublic Mask addMask(String maskName, VectorDataNode vectorDataNode, String description, Color color, double transparency)
maskName
- the new mask's namevectorDataNode
- the vector data nodedescription
- the mask's descriptioncolor
- the display colortransparency
- the display transparencypublic Mask addMask(String maskName, VectorDataNode vectorDataNode, String description, Color color, double transparency, RasterDataNode prototypeRasterDataNode)
maskName
- the new mask's namevectorDataNode
- the vector data nodedescription
- the mask's descriptioncolor
- the display colortransparency
- the display transparencyprototypeRasterDataNode
- a raster data node used to serve as a prototypeRasterDataNode for image layout and geo-coding. May be null
.public void addMask(Mask mask)
mask
- the mask to be added, must not be null
@Deprecated public BitRaster getValidMask(String id)
getMaskGroup()
insteadid
- the IDcreateValidMask(String, com.bc.ceres.core.ProgressMonitor)
@Deprecated public void setValidMask(String id, BitRaster validMask)
getMaskGroup()
insteadid
- the IDvalidMask
- the pixel maskcreateValidMask(String, com.bc.ceres.core.ProgressMonitor)
@Deprecated public BitRaster createValidMask(String expression, ProgressMonitor pm) throws IOException
getMaskGroup()
insteadtrue
the related bit in the mask is set.expression
- the boolean expression, e.g. "l2_flags.LAND && reflec_10 >= 0.0"pm
- a progress monitorIOException
- if an I/O error occursparseExpression(String)
@Deprecated public BitRaster createValidMask(Term term, ProgressMonitor pm) throws IOException
Mask.BandMathsType.create()
and getMaskGroup()
) insteadtrue
the related bit in the mask is set.term
- the boolean term, e.g. "l2_flags.LAND && reflec_10 >= 0.0"pm
- a progress monitorIOException
- if an I/O error occurscreateValidMask(String, com.bc.ceres.core.ProgressMonitor)
@Deprecated public void readBitmask(int offsetX, int offsetY, int width, int height, Term bitmaskTerm, boolean[] bitmask, ProgressMonitor pm) throws IOException
Mask.BandMathsType.create()
and getMaskGroup()
) and use its source image instead The method first creates an evaluation context for the given bit-mask term and the specified region and then
evaluates the term for each pixel in the subset (line-by-line, X varies fastest). The result of each evaluation -
the resulting bitmask - is stored in the given boolean array buffer bitmask
in the same order as
pixels appear in the given region. The buffer must at least have a length equal to width * height
elements.
If flag providing datasets are referenced in the given bit-mask expression which are currently not completely loaded, the method reloads the spatial subset from the data source in order to create the evaluation context.
The parseExpression(String)
method can be used to create a bit-mask
term from a textual bit-mask expression.
offsetX
- the X-offset of the spatial subset in pixel co-ordinatesoffsetY
- the Y-offset of the spatial subset in pixel co-ordinateswidth
- the width of the spatial subset in pixel co-ordinatesheight
- the height of the spatial subset in pixel co-ordinatesbitmaskTerm
- a bit-mask term, as returned by the parseExpression(String)
methodbitmask
- a buffer used to hold the results of the bit-mask evaluations for each pixel in the given
spatial subsetpm
- a monitor to inform the user about progressIOException
- if an I/O error occurs, when referenced flag datasets are reloadedparseExpression(String)
@Deprecated public void readBitmask(int offsetX, int offsetY, int width, int height, Term bitmaskTerm, byte[] bitmask, byte trueValue, byte falseValue, ProgressMonitor pm) throws IOException
Mask.BandMathsType.create()
and getMaskGroup()
) and use its source image instead The method first creates an evaluation context for the given bit-mask term and the specified region and then
evaluates the term for each pixel in the subset (line-by-line, X varies fastest). The result of each evaluation -
the resulting bitmask - is stored in the given boolean array buffer bitmask
in the same order as
pixels appear in the given region. The buffer must at least have a length equal to width * height
elements.
If flag providing datasets are referenced in the given bit-mask expression which are currently not completely loaded, the method reloads the spatial subset from the data source in order to create the evaluation context.
The parseExpression(String)
method can be used to create a bit-mask
term from a textual bit-mask expression.
offsetX
- the X-offset of the spatial subset in pixel co-ordinatesoffsetY
- the Y-offset of the spatial subset in pixel co-ordinateswidth
- the width of the spatial subset in pixel co-ordinatesheight
- the height of the spatial subset in pixel co-ordinatesbitmaskTerm
- a bit-mask term, as returned by the parseExpression(String)
methodbitmask
- a byte buffer used to hold the results of the bit-mask evaluations for each pixel in the given
spatial subsettrueValue
- the byte value to be set if the bitmask-term evauates to true
falseValue
- the byte value to be set if the bitmask-term evauates to false
IOException
- if an I/O error occurs, when referenced flag datasets are reloadedparseExpression(String)
public MultiLevelImage getMaskImage(String expression, RasterDataNode associatedRaster)
If the associated raster is null
, the mask's tile size is
this product's preferred tile size
(if any) while other image layout settings
are derived from createMultiLevelModel()
.
expression
- The expressionassociatedRaster
- The associated raster or null
.public MultiLevelModel createMultiLevelModel()
Copyright © 2014–2016 European Space Agency (ESA). All rights reserved.