Class Product
- All Implemented Interfaces:
Extensible,Closeable,AutoCloseable
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 demand. 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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.opengis.referencing.crs.ImageCRSThe default BEAM image coordinate reference system.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.esa.snap.core.datamodel.ProductNode
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new product with the given name and type.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. -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptVisitor(ProductVisitor visitor) Accepts the given visitor.Creates a new band with the given name and data type and adds it to this product and returns it.Creates a new band with the given name and adds it to this product and returns it.Creates a new band with the given name and data type and adds it to this product and returns it.voidAdds the given band to this product.Creates a new mask using a band arithmetic expression and adds it to this product and returns it.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.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.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.voidAdds the given mask to this product.booleanaddProductNodeListener(ProductNodeListener listener) Adds aProductNodeListenerto this product.voidaddTiePointGrid(TiePointGrid tiePointGrid) Adds the given tie-point grid to this product.booleanChecks whether or not this product can be orthorectified.voidclose()voidcloseIO()Closes the file I/O for this product.voidCloses and clears this product's reader (if any).voidCloses and clears this product's writer (if any).booleancontainsBand(String name) Tests if a band with the given name is contained in this product.booleancontainsPixel(double x, double y) Tests if the given pixel position is within the product pixel bounds.booleancontainsPixel(PixelPos pixelPos) Tests if the given pixel position is within the product pixel bounds.booleancontainsRasterDataNode(String name) Tests if a raster data node with the given name is contained in this product.booleancontainsTiePointGrid(String name) Tests if a tie-point grid with the given name is contained in this product.Creates a namespace to be used by parsers for band arithmetic expressions.Creates a parser for band arithmetic expressions.createPixelInfoString(int pixelX, int pixelY) Creates a string containing all available information at the given pixel position.createPixelInfoString(int pixelX, int pixelY, RasterDataNode raster) Creates a string containing all available information at the given pixel position in the given raster.createSubset(ProductSubsetDef subsetDef, String name, String desc) Creates a subset of this product.voiddispose()Releases all of the resources used by this object instance and all of its owned children.static AffineTransformfindImageToModelTransform(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.CoordinateReferenceSystemfindModelCRS(GeoCoding geoCoding) Finds a coordinate reference system (CRS) that is appropriate as a scene CRS.protected voidfireNodeAdded(ProductNode childNode, ProductNodeGroup nodeGroup) protected voidfireNodeChanged(ProductNode sourceNode, String propertyName, Object oldValue, Object newValue) protected voidfireNodeDataChanged(DataNode sourceNode) protected voidfireNodeRemoved(ProductNode childNode, ProductNodeGroup nodeGroup) String[]Returns the names of all flags of all flag datasets contained this product.eu.esa.snap.core.datamodel.group.BandGroupGets the auto-grouping applicable to product nodes contained in this product.Returns the band with the given name.getBandAt(int index) Returns the band at the given index.Gets the band group of this product.intgetBandIndex(String name) Returns the index for the band with the given name.String[]Returns a string array containing the names of the bands contained in this productBand[]getBands()Returns an array of bands contained in this productGets the (sensing) stop time associated with the last raster data line.Retrieves the disk location of this product.Gets the group of ground-control points (GCPs).getMaskImage(String expression, RasterDataNode associatedRaster) Gets a multi-level mask image for the given band maths expression and an optional associated raster.Gets the root element of the associated metadata.intintintReturns the number of tie-point grids contained in this productGets the group of pins.getPixelForBand(PixelPos pixelPosRef, RasterDataNode referenceRaster, RasterDataNode currentRaster) Convert the pixel X and Y read in a reference raster into another rasterGets the pointing factory associated with this data product.Gets the preferred tile size which may be used for a therendered imagecreated for aRasterDataNodeof this product.Returns the product manager for this product.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.Gets the product type string.Returns the writer which will be used to write modifications of this product's in-memory represention to an external destination.getQuicklook(String name) Returns the Quicklook with the given name.Gets the name of the band suitable for quicklook generation.getRasterDataNode(String name) Gets the raster data node with the given name.Gets all raster data nodes contained in this product including bands, masks and tie-point grids.longgetRawStorageSize(ProductSubsetDef subsetDef) Gets an estimated, raw storage size in bytes of this product node.intgetRefNo()getRefRasterDataNodes(String expression) Gets all raster data nodes referenced by the given band maths expression.org.opengis.referencing.crs.CoordinateReferenceSystemGets the scene coordinate reference system (scene CRS).Gets the geo-coding associated with the scene raster.final intfinal Dimensionfinal intGets the time-coding for the associated scene raster.Gets the (sensing) start time associated with the first raster data line.getTiePointGrid(String name) Returns the tie-point grid with the given name.getTiePointGridAt(int index) Returns the tie-point grid at the given index.Gets the tie-point grid group of this product.String[]Returns a string array containing the names of the tie-point grids contained in this productReturns an array of tie-point grids contained in this productprotected booleanbooleanisCompatibleBandArithmeticExpression(String expression) Tests if the given band arithmetic expression can be computed using this product.booleanisCompatibleBandArithmeticExpression(String expression, Parser parser) Tests if the given band arithmetic expression can be computed using this product and a given expression parser.booleanisCompatibleProduct(Product product, float eps) Checks whether or not the given product is compatible with this product.booleanTest if this product's raster data nodes are all of the same size (in pixels).booleanTests 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.booleanisSceneCrsEqualToModelCrsOf(RasterDataNode rasterDataNode) Tests if the given raster data node uses this product's scene coordinate reference system as model coordinate reference system.booleanTests if all bands of this product are using a single, uniform geo-coding.parseExpression(String expression) Parses a mathematical expression given as a text string.booleanremoveBand(Band band) Removes the given band from this product.voidremoveProductNodeListener(ProductNodeListener listener) Removes aProductNodeListenerfrom this product.booleanremoveTiePointGrid(TiePointGrid tiePointGrid) Removes the tie-point grid from this product.voidvoidsetAutoGrouping(eu.esa.snap.core.datamodel.group.BandGroup autoGrouping) Sets the auto-grouping applicable to product nodes contained in this product.voidsetAutoGrouping(String pattern) Sets the auto-grouping applicable to product nodes contained in this product.voidsetEndTime(ProductData.UTC endTime) Sets the (sensing) stop time associated with the first raster data line.voidsetFileLocation(File fileLocation) Sets the file location for this product.voidsetModified(boolean modified) Sets this node's modified flag.voidSets this product's name.voidsetNumResolutionsMax(int numResolutionsMax) voidsetOwner(ProductNode owner) Overwrites theProductNode.setOwner(ProductNode)method in order to throw anIllegalStateException, since products currently cannot have an owner.voidsetPointingFactory(PointingFactory pointingFactory) Sets the pointing factory for this data product.voidsetPreferredTileSize(int tileWidth, int tileHeight) Sets the preferred tile size which may be used for a therendered imagecreated for aRasterDataNodeof this product.voidsetPreferredTileSize(Dimension preferredTileSize) Sets the preferred tile size which may be used for a therendered imagecreated for aRasterDataNodeof this product.voidsetProductReader(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.voidsetProductType(String productType) Sets the product type of this product.voidsetProductWriter(ProductWriter writer) Sets the writer which will be used to write modifications of this product's in-memory represention to an external destination.voidsetQuicklookBandName(String quicklookBandName) Sets the name of the band suitable for quicklook generation.voidsetRefNo(int refNo) Sets the reference number.voidsetSceneCRS(org.opengis.referencing.crs.CoordinateReferenceSystem sceneCRS) Sets the scene coordinate reference system.voidsetSceneGeoCoding(GeoCoding sceneGeoCoding) Sets the geo-coding to be associated with the scene raster.voidsetSceneTimeCoding(TimeCoding sceneTimeCoding) Sets the time-coding for the associated scene raster.voidsetStartTime(ProductData.UTC startTime) Sets the (sensing) start time of this product.booleantransferGeoCodingTo(Product destProduct, ProductSubsetDef subsetDef) Transfers the geo-coding of this product instance to thedestProductwith respect to the givensubsetDef.voidwriteHeader(Object output) Writes the header of a data product.Methods inherited from class org.esa.snap.core.datamodel.ProductNode
fireProductNodeChanged, fireProductNodeChanged, getDescription, getDisplayName, getName, getOwner, getProduct, getProductReaderSafe, getProductRefString, getProductSafe, getProductWriterSafe, getRawStorageSize, isModified, isPartOfSubset, isValidNodeName, removeFromFile, setDescription, setNodeName, toString, updateExpressionMethods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
-
Field Details
-
METADATA_ROOT_NAME
- See Also:
-
HISTORY_ROOT_NAME
- See Also:
-
PROPERTY_NAME_SCENE_CRS
- See Also:
-
PROPERTY_NAME_SCENE_GEO_CODING
- See Also:
-
PROPERTY_NAME_SCENE_TIME_CODING
- See Also:
-
PROPERTY_NAME_PRODUCT_TYPE
- See Also:
-
PROPERTY_NAME_FILE_LOCATION
- See Also:
-
GEOMETRY_FEATURE_TYPE_NAME
- See Also:
-
DEFAULT_IMAGE_CRS
public static final org.opengis.referencing.crs.ImageCRS DEFAULT_IMAGE_CRSThe default BEAM image coordinate reference system.
-
-
Constructor Details
-
Product
Creates a new product without any reader (in-memory product)- Parameters:
name- the product nametype- the product typesceneRasterWidth- the scene width in pixels for this data productsceneRasterHeight- the scene height in pixels for this data product
-
Product
public Product(String name, String type, int sceneRasterWidth, int sceneRasterHeight, ProductReader reader) Constructs a new product with the given name and the given reader.- Parameters:
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.- See Also:
-
Product
Constructs a new product with the given name and type.- Parameters:
name- the product identifiertype- the product type
-
Product
Constructs a new product with the given name, type and the reader.- Parameters:
name- the product identifiertype- the product typereader- the reader used to create this product and read data from it.- See Also:
-
-
Method Details
-
findImageToModelTransform
Finds an appropriate transformation from image coordinates used by the given geo-coding (if any) into "model" coordinates used to render (e.g. display, print or otherwise visualise) the image together with other features such as geometric shapes or other images. Model coordinates are different from image coordinates for rectified images where model coordinate units are defined by a geodetic/geographic coordinate reference system (map CRS, map-projected images). In this case the model CRS equals the map CRS in use. Model coordinates are also different from image coordinates for images in satellite view that use a linearily downsampled or upsampled version of a common reference grid. WARNING: Note that this method is only useful, if it can be ensured that the given geo-coding'simage-to-map transformis 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.- Parameters:
geoCoding- The geo-coding ornull.- Returns:
- An affine image-to-map transformation derived from the given geo-coding. If
geoCodingisnullor an affine image-to-map transformation cannot be derived the identity transform is returned. - Since:
- SNAP 2.0
- See Also:
-
findModelCRS
public static org.opengis.referencing.crs.CoordinateReferenceSystem findModelCRS(GeoCoding geoCoding) Finds a coordinate reference system (CRS) that is appropriate as a scene CRS.Finds a "model" coordinate reference system for the given geo-coding (if any) that provides the units for ccordinates to be rendered (e.g. display, print or otherwise visualise) a geo-coded image together with other features such as geometric shapes or other images. Model coordinates are different from image coordinates for rectified images where model coordinate units are defined by a geodetic/geographic coordinate reference system (map CRS, map-projected images). In this case the model CRS equals the map CRS in use. Model coordinates are also different from image coordinates for images in satellite view that use a linearily downsampled or upsampled version of a common reference grid.
If the geo-coding's
image-to-map transformis an affine transform, then the returned CRS is the geo-coding'smap CRS, otherwise it is itsimage CRS. If the geo-coding isnull, a default image CRS is returned (DEFAULT_IMAGE_CRS).- Parameters:
geoCoding- The geo-coding ornull.- Returns:
- An appropriate "model" coordinate reference system.
- Since:
- SNAP 2.0
- See Also:
-
getSceneCRS
public org.opengis.referencing.crs.CoordinateReferenceSystem getSceneCRS()Gets the scene coordinate reference system (scene CRS). It provides a common coordinate system- for the geometries used by all vector data;
- to which all raster data can be transformed using a raster data node's
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'simage-to-map transformis an affine transform, then the scene CRS returned is themap CRS, otherwise it is theimage CRS. If the product doesn't have any scene geo-coding, a default image CRS is returned.- Returns:
- The scene coordinate reference system.
- Since:
- SNAP 2.0
- See Also:
-
setSceneCRS
public void setSceneCRS(org.opengis.referencing.crs.CoordinateReferenceSystem sceneCRS) Sets the scene coordinate reference system.- Parameters:
sceneCRS- The scene coordinate reference system.- Since:
- SNAP 2.0
- See Also:
-
isSceneCrsEqualToModelCrsOf
Tests if the given raster data node uses this product's scene coordinate reference system as model coordinate reference system. WARNING: This method belongs to a preliminary API and may change in an incompatible way or may even be removed in a next SNAP release.- Parameters:
rasterDataNode- A raster data node.- Returns:
true, if so.- Since:
- SNAP 2.0
-
getFileLocation
Retrieves the disk location of this product. The return value can benullwhen the product has no disk location (pure virtual memory product)- Returns:
- the file location, may be
null
-
setFileLocation
Sets the file location for this product.- Parameters:
fileLocation- the file location, may benull
-
setOwner
Overwrites theProductNode.setOwner(ProductNode)method in order to throw anIllegalStateException, since products currently cannot have an owner.- Overrides:
setOwnerin classProductNode- Parameters:
owner- the new owner
-
getProductType
Gets the product type string.- Returns:
- the product type string
-
setProductType
Sets the product type of this product.- Parameters:
productType- the product type.
-
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.- Overrides:
getProductReaderin classProductNode- Returns:
- the product reader, can be
null
-
setProductReader
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.- Parameters:
reader- the product reader.- Throws:
IllegalArgumentException- if the given reader is null.
-
getProductWriter
Returns the writer which will be used to write modifications of this product's in-memory represention to an external destination.- Overrides:
getProductWriterin classProductNode- Returns:
- the product writer, can be
null
-
setProductWriter
Sets the writer which will be used to write modifications of this product's in-memory represention to an external destination.- Parameters:
writer- the product writer, can benull
-
writeHeader
Writes the header of a data product.
- Parameters:
output- an object representing a valid output for this writer, might be aImageOutputStreamor aFileor otherObjectto use for future decoding.- Throws:
IllegalArgumentException- ifoutputisnullor it's type is none of the supported output types.IOException- if an I/O error occurs
-
closeProductReader
Closes and clears this product's reader (if any).- Throws:
IOException- if an I/O error occurs- See Also:
-
closeProductWriter
Closes and clears this product's writer (if any).- Throws:
IOException- if an I/O error occurs- See Also:
-
closeIO
Closes the file I/O for this product. Calls in sequenceandcloseProductReader(). ThecloseProductWriter()method is not called, but should be called if the product instance is no longer in use.dispose()- Throws:
IOException- if an I/O error occurs- See Also:
-
dispose
public void dispose()Releases all of the resources used by this object instance and all of its owned children. Its primary use is to allow the garbage collector to perform a vanilla job.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
closeIOin order to release all open I/O resources.- Overrides:
disposein classProductNode
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getSceneTimeCoding
Gets the time-coding for the associated scene raster.- Returns:
- the time-coding, or
nullif not available. - Since:
- SNAP 2.0
- See Also:
-
setSceneTimeCoding
Sets the time-coding for the associated scene raster.- Parameters:
sceneTimeCoding- The new time-coding, ornull.- Since:
- SNAP 2.0
- See Also:
-
getPointingFactory
Gets the pointing factory associated with this data product.- Returns:
- the pointing factory or null, if none
-
setPointingFactory
Sets the pointing factory for this data product.- Parameters:
pointingFactory- the pointing factory
-
getSceneGeoCoding
Gets the geo-coding associated with the scene raster.- Returns:
- the geo-coding, can be
nullif this product is not geo-coded.
-
setSceneGeoCoding
Sets the geo-coding to be associated with the scene raster.- Parameters:
sceneGeoCoding- the geo-coding, ornull
-
isUsingSingleGeoCoding
public boolean isUsingSingleGeoCoding()Tests if all bands of this product are using a single, uniform geo-coding. Uniformity is tested by comparing the band's geo-coding against the geo-coding of this product using theObject.equals(Object)method. If this product does not have a geo-coding, the method returns false.- Returns:
- true, if so
-
transferGeoCodingTo
Transfers the geo-coding of this product instance to thedestProductwith respect to the givensubsetDef.- Parameters:
destProduct- the destination productsubsetDef- the definition of the subset, may benull- Returns:
- true, if the geo-coding could be transferred.
-
getSceneRasterWidth
public final int getSceneRasterWidth()- Returns:
- The scene raster width in pixels.
- Throws:
IllegalStateException- if the scene size wasn't specified yet and cannot be derived
-
getSceneRasterHeight
public final int getSceneRasterHeight()- Returns:
- The scene raster height in pixels
- Throws:
IllegalStateException- if the scene size wasn't specified yet and cannot be derived
-
isMultiSize
public boolean isMultiSize()Test if this product's raster data nodes are all of the same size (in pixels).- Returns:
true, if so.- Since:
- SNAP 2.0
-
getSceneRasterSize
- Returns:
- The scene size in pixels.
- Throws:
IllegalStateException- if the scene size wasn't specified yet and cannot be derived
-
getStartTime
Gets the (sensing) start time associated with the first raster data line.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.
- Returns:
- the sensing start time, can be null e.g. for non-swath products
-
setStartTime
Sets the (sensing) start time of this product.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.
- Parameters:
startTime- the sensing start time, can be null
-
getEndTime
Gets the (sensing) stop time associated with the last raster data line.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.
- Returns:
- the stop time , can be null e.g. for non-swath products
-
setEndTime
Sets the (sensing) stop time associated with the first raster data line.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.
- Parameters:
endTime- the sensing stop time, can be null
-
getMetadataRoot
Gets the root element of the associated metadata.- Returns:
- the metadata root element
-
getGroups
- Returns:
- The group which contains all other product node groups.
- Since:
- BEAM 5.0
-
getGroup
- Parameters:
name- The group name.- Returns:
- The group with the given name, or
nullif no such group exists. - Since:
- BEAM 5.0
-
getTiePointGridGroup
Gets the tie-point grid group of this product.- Returns:
- The group of all tie-point grids.
- Since:
- BEAM 4.7
-
addTiePointGrid
Adds the given tie-point grid to this product.- Parameters:
tiePointGrid- the tie-point grid to added, ignored ifnull
-
removeTiePointGrid
Removes the tie-point grid from this product.- Parameters:
tiePointGrid- the tie-point grid to be removed, ignored ifnull- Returns:
trueif node could be removed
-
getNumTiePointGrids
public int getNumTiePointGrids()Returns the number of tie-point grids contained in this product- Returns:
- the number of tie-point grids
-
getTiePointGridAt
Returns the tie-point grid at the given index.- Parameters:
index- the tie-point grid index- Returns:
- the tie-point grid at the given index
- Throws:
IndexOutOfBoundsException- if the index is out of bounds
-
getTiePointGridNames
Returns a string array containing the names of the tie-point grids contained in this product- Returns:
- a string array containing the names of the tie-point grids contained in this product. If this product has no tie-point grids a zero-length-array is returned.
-
getTiePointGrids
Returns an array of tie-point grids contained in this product- Returns:
- an array of tie-point grids contained in this product. If this product has no tie-point grids a zero-length-array is returned.
-
getTiePointGrid
Returns the tie-point grid with the given name.- Parameters:
name- the tie-point grid name- Returns:
- the tie-point grid with the given name or
nullif a tie-point grid with the given name is not contained in this product.
-
containsTiePointGrid
Tests if a tie-point grid with the given name is contained in this product.- Parameters:
name- the name, must not benull- Returns:
trueif a tie-point grid with the given name is contained in this product,falseotherwise
-
getBandGroup
Gets the band group of this product.- Returns:
- The group of all bands.
- Since:
- BEAM 4.7
-
addBand
Adds the given band to this product.- Parameters:
band- the band to added, must not benull
-
addBand
Creates a new band with the given name and data type and adds it to this product and returns it.- Parameters:
bandName- the new band's namedataType- the raster data type, must be one of the multipleProductData.TYPE_Xconstants- Returns:
- the new band which has just been added
-
addBand
Creates a new band with the given name and adds it to this product and returns it. The new band's data type isfloatand it's samples are computed from the given band maths expression.- Parameters:
bandName- the new band's nameexpression- the band maths expression- Returns:
- the new band which has just been added
- Since:
- BEAM 4.9
-
addBand
Creates a new band with the given name and data type and adds it to this product and returns it. The new band's samples are computed from the given band maths expression.- Parameters:
bandName- the new band's nameexpression- the band maths expressiondataType- the raster data type, must be one of the multipleProductData.TYPE_Xconstants- Returns:
- the new band which has just been added
- Since:
- BEAM 4.9
-
removeBand
Removes the given band from this product.- Parameters:
band- the band to be removed, ignored ifnull- Returns:
trueif removed succesfully, otherwisefalse- Throws:
IllegalStateException- if the band is referenced by a virtual band
-
getNumBands
public int getNumBands()- Returns:
- the number of bands contained in this product.
-
getBandAt
Returns the band at the given index.- Parameters:
index- the band index- Returns:
- the band at the given index
- Throws:
IndexOutOfBoundsException- if the index is out of bounds
-
getBandNames
Returns a string array containing the names of the bands contained in this product- Returns:
- a string array containing the names of the bands contained in this product. If this product has no bands a zero-length-array is returned.
-
getBands
Returns an array of bands contained in this product- Returns:
- an array of bands contained in this product. If this product has no bands a zero-length-array is returned.
-
getBand
Returns the band with the given name.- Parameters:
name- the band name- Returns:
- the band with the given name or
nullif a band with the given name is not contained in this product. - Throws:
IllegalArgumentException- if the given name isnullor empty.
-
getBandIndex
Returns the index for the band with the given name.- Parameters:
name- the band name- Returns:
- the band index or
-1if a band with the given name is not contained in this product. - Throws:
IllegalArgumentException- if the given name isnullor empty.
-
containsBand
Tests if a band with the given name is contained in this product.- Parameters:
name- the name, must not benull- Returns:
trueif a band with the given name is contained in this product,falseotherwise- Throws:
IllegalArgumentException- if the given name isnullor empty.
-
containsRasterDataNode
Tests if a raster data node with the given name is contained in this product. Raster data nodes can be bands or tie-point grids.- Parameters:
name- the name, must not benull- Returns:
trueif a raster data node with the given name is contained in this product,falseotherwise
-
getRasterDataNode
Gets the raster data node with the given name. The method first searches for bands with the given name, then for tie-point grids. If neither bands nor tie-point grids exist with the given name,nullis returned.- Parameters:
name- the name, must not benull- Returns:
- the raster data node with the given name or
nullif a raster data node with the given name is not contained in this product.
-
getRasterDataNodes
Gets all raster data nodes contained in this product including bands, masks and tie-point grids.- Returns:
- List of all raster data nodes which may be empty.
- Since:
- SNAP 2.0
-
getQuicklookGroup
-
getDefaultQuicklook
-
getQuicklook
Returns the Quicklook with the given name.- Parameters:
name- the quicklook name- Returns:
- the quicklook with the given name or
nullif a quicklook with the given name is not contained in this product. - Throws:
IllegalArgumentException- if the given name isnullor empty.
-
getQuicklookBandName
Gets the name of the band suitable for quicklook generation.- Returns:
- the name of the quicklook band, or null if none has been defined
-
setQuicklookBandName
Sets the name of the band suitable for quicklook generation.- Parameters:
quicklookBandName- the name of the quicklook band, or null
-
getMaskGroup
-
getVectorDataGroup
-
getFlagCodingGroup
-
getIndexCodingGroup
-
containsPixel
public boolean containsPixel(double x, double y) Tests if the given pixel position is within the product pixel bounds.- Parameters:
x- the x coordinate of the pixel positiony- the y coordinate of the pixel position- Returns:
- true, if so
- See Also:
-
containsPixel
Tests if the given pixel position is within the product pixel bounds.- Parameters:
pixelPos- the pixel position, must not be null- Returns:
- true, if so
- See Also:
-
getGcpGroup
Gets the group of ground-control points (GCPs).- Returns:
- the GCP group.
-
getPinGroup
Gets the group of pins.- Returns:
- the pin group.
-
getNumResolutionsMax
public int getNumResolutionsMax()- Returns:
- 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.
- Since:
- BEAM 5.0
-
setNumResolutionsMax
public void setNumResolutionsMax(int numResolutionsMax) - Parameters:
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.- Since:
- BEAM 5.0
-
isCompatibleProduct
Checks whether or not the given product is compatible with this product.- Parameters:
product- the product to compare witheps- the maximum lat/lon error in degree- Returns:
falseif the scene dimensions or geocoding are different,trueotherwise.
-
parseExpression
Parses a mathematical expression given as a text string.- Parameters:
expression- a expression given as a text string, e.g. "radiance_4 / (1.0 + radiance_11)".- Returns:
- a term parsed from the given expression string
- Throws:
ParseException- if the expression could not successfully be parsed
-
getRefRasterDataNodes
Gets all raster data nodes referenced by the given band maths expression.- Parameters:
expression- The expression.- Returns:
- all raster data nodes referenced by the given band maths expression.
- Throws:
ParseException- If the expression contains errors.- Since:
- SNAP 2
-
acceptVisitor
Accepts the given visitor. This method implements the well known 'Visitor' design pattern of the gang-of-four. The visitor pattern allows to define new operations on the product data model without the need to add more code to it. The new operation is implemented by the visitor.The method subsequentially visits (calls
acceptVisitorfor) all bands, tie-point grids and flag codings. Finally it visits product metadata root element and callsvisitor.visit(this).- Specified by:
acceptVisitorin classProductNode- Parameters:
visitor- the visitor, must not benull
-
addProductNodeListener
Adds aProductNodeListenerto this product. TheProductNodeListeneris informed each time a node in this product changes.- Parameters:
listener- the listener to be added- Returns:
- boolean if listener was added or not
-
removeProductNodeListener
Removes aProductNodeListenerfrom this product.- Parameters:
listener- the listener to be removed.
-
getProductNodeListeners
-
hasProductNodeListeners
protected boolean hasProductNodeListeners() -
fireNodeChanged
protected void fireNodeChanged(ProductNode sourceNode, String propertyName, Object oldValue, Object newValue) -
fireNodeDataChanged
-
fireNodeAdded
-
fireNodeRemoved
-
getRefNo
public int getRefNo()- Returns:
- The reference number of this product.
-
setRefNo
public void setRefNo(int refNo) Sets the reference number.- Parameters:
refNo- the reference number to set must be in the range 1 .. Integer.MAX_VALUE- Throws:
IllegalArgumentException- if the refNo is out of range
-
resetRefNo
public void resetRefNo() -
getProductManager
Returns the product manager for this product.- Returns:
- this product's manager, can be
null
-
isCompatibleBandArithmeticExpression
Tests if the given band arithmetic expression can be computed using this product.- Parameters:
expression- the mathematical expression- Returns:
- true, if the band arithmetic is compatible with this product
- See Also:
-
isCompatibleBandArithmeticExpression
Tests if the given band arithmetic expression can be computed using this product and a given expression parser.- Parameters:
expression- the band arithmetic expressionparser- the expression parser to be used- Returns:
- true, if the band arithmetic is compatible with this product
- See Also:
-
createBandArithmeticParser
Creates a parser for band arithmetic expressions. The parser created will use a namespace comprising all tie-point grids, bands and flags of this product.- Returns:
- a parser for band arithmetic expressions for this product, never null
-
createBandArithmeticDefaultNamespace
Creates a namespace to be used by parsers for band arithmetic expressions. The namespace created comprises all tie-point grids, bands and flags of this product.- Returns:
- a namespace, never null
-
createSubset
public Product createSubset(ProductSubsetDef subsetDef, String name, String desc) throws IOException Creates a subset of this product. The returned product represents a true spatial and spectral subset of this product, but it has not loaded any bands into memory. If name or desc are null or empty, the name and the description from this product was used.- Parameters:
subsetDef- the product subset definitionname- the name for the new productdesc- the description for the new product- Returns:
- the product subset, or
nullif the product/subset combination is not valid - Throws:
IOException- if an I/O error occurs
-
setModified
public void setModified(boolean modified) Description copied from class:ProductNodeSets this node's modified flag.If the modified flag changes to true and this node has an owner, the owner's modified flag is also set to true.
- Overrides:
setModifiedin classProductNode- Parameters:
modified- whether or not this node is beeing marked as modified.- See Also:
-
getRawStorageSize
Gets an estimated, raw storage size in bytes of this product node.- Specified by:
getRawStorageSizein classProductNode- Parameters:
subsetDef- if notnullthe subset may limit the size returned- Returns:
- the size in bytes.
-
createPixelInfoString
Creates a string containing all available information at the given pixel position. The string returned is a line separated text with each line containing a key/value pair.- Parameters:
pixelX- the pixel X co-ordinatepixelY- the pixel Y co-ordinate- Returns:
- the info string at the given position
-
createPixelInfoString
Creates a string containing all available information at the given pixel position in the given raster. The string returned is a line separated text with each line containing a key/value pair.- Parameters:
pixelX- the pixel X co-ordinate in the given rasterpixelY- the pixel Y co-ordinate in the given rasterraster- raster reference for the pixel position- Returns:
- the info string at the given position
-
getPixelForBand
public PixelPos getPixelForBand(PixelPos pixelPosRef, RasterDataNode referenceRaster, RasterDataNode currentRaster) Convert the pixel X and Y read in a reference raster into another raster- Parameters:
pixelPosRef- the pixel X and Y co-ordinate read in the reference rasterreferenceRaster- reference raster where the pixel X and Y co-ordinate where readcurrentRaster- current raster where we want the pixel X and Y to be expressed- Returns:
- the pixel X and Y co-ordinate in current raster
-
getRemovedChildNodes
- Returns:
- All removed child nodes. Array may be empty.
-
canBeOrthorectified
public boolean canBeOrthorectified()Checks whether or not this product can be orthorectified.- Returns:
- true if
RasterDataNode.canBeOrthorectified()returns true for all bands, false otherwise
-
getPreferredTileSize
Gets the preferred tile size which may be used for a therendered imagecreated for aRasterDataNodeof this product.- Returns:
- the preferred tile size, may be
nullif not specified - See Also:
-
setPreferredTileSize
Sets the preferred tile size which may be used for a therendered imagecreated for aRasterDataNodeof this product.- Parameters:
preferredTileSize- the preferred tile size, may benullif not specified- See Also:
-
setPreferredTileSize
public void setPreferredTileSize(int tileWidth, int tileHeight) Sets the preferred tile size which may be used for a therendered imagecreated for aRasterDataNodeof this product.- Parameters:
tileWidth- the preferred tile widthtileHeight- the preferred tile height- See Also:
-
getAllFlagNames
Returns the names of all flags of all flag datasets contained this product.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.
- Returns:
- the array of all flag names. If this product does not support flags, an empty array is returned, but
never
null. - See Also:
-
getAutoGrouping
public eu.esa.snap.core.datamodel.group.BandGroup getAutoGrouping()Gets the auto-grouping applicable to product nodes contained in this product.- Returns:
- The auto-grouping or
null. - Since:
- BEAM 4.8
-
setAutoGrouping
Sets the auto-grouping applicable to product nodes contained in this product. A givenpatternparameter 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 forpatternapplicable to Envisat AATSR data isnadir/reflec:nadir/btemp:fward/reflec:fward/btemp:nadir:fward
- Parameters:
pattern- The auto-grouping pattern.- Since:
- BEAM 4.8
-
setAutoGrouping
public void setAutoGrouping(eu.esa.snap.core.datamodel.group.BandGroup autoGrouping) Sets the auto-grouping applicable to product nodes contained in this product.- Parameters:
autoGrouping- The auto-grouping ornull.- Since:
- BEAM 4.8
-
addMask
Creates a new mask with the given name and image type and adds it to this product and returns it. The new mask's samples are computed from the given image type.- Parameters:
maskName- the new mask's nameimageType- the image data type used to compute the mask samples- Returns:
- the new mask which has just been added
- Since:
- BEAM 4.10
-
addMask
public 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.- Parameters:
maskName- the new mask's nameexpression- the band arithmetic expressiondescription- the mask's descriptioncolor- the display colortransparency- the display transparency- Returns:
- the new mask which has just been added
- Throws:
IllegalArgumentException- when the expression references rasters of different sizes- Since:
- BEAM 4.10
-
addMask
public 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.- Parameters:
maskName- the new mask's namevectorDataNode- the vector data nodedescription- the mask's descriptioncolor- the display colortransparency- the display transparency- Returns:
- the new mask which has just been added
- Since:
- BEAM 4.10
-
addMask
public 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.- Parameters:
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 benull.- Returns:
- the new mask which has just been added
- Since:
- SNAP 2.0
-
addMask
Adds the given mask to this product.- Parameters:
mask- the mask to be added, must not benull
-
getMaskImage
Gets a multi-level mask image for the given band maths expression and an optional associated raster. The associated raster is used to infer the target mask's image (tile) layout.If the associated raster is
null, the mask's tile size is this product'spreferred tile size(if any) while other image layout settings are derived fromcreateMultiLevelModel().- Parameters:
expression- The expressionassociatedRaster- The associated raster ornull.- Returns:
- A multi-level mask image.
-
createMultiLevelModel
-
setName
Sets this product's name.The name can be identical to a band name.
- Overrides:
setNamein classProductNode- Parameters:
name- The name.
-