Package org.esa.snap.core.dataio
Class ProductSubsetDef
java.lang.Object
org.esa.snap.core.dataio.ProductSubsetDef
The
ProductSubsetDef class describes a subset or portion of a remote sensing data product.
Subsets can be spatial or spectral or both. A spatial subset is given through a rectangular region in pixels or by geometry. The pixel and geometry regions are mutually exclusive. The spectral subset as a list of band (or channel) names.
- Version:
- $Revision$ $Date$
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new and empty subset info.ProductSubsetDef(String subsetName) Constructs a new and empty subset info. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNodeName(String name) Adds a new product node name to this subset.voidaddNodeNames(String[] names) Adds the given product node names to this subset.voidaddNodeNames(Set<String> names) Adds the given product node names to this subset.booleancontainsNodeName(String name) Checks whether or not a node name is already contained in this subset.String[]Gets the names of all product nodes contained in this subset.Deprecated.getSceneRasterSize(int maxWidth, int maxHeight) Gets the required size for a raster required to hold all pixels for the spatial subset for the given maximum raster width and height.getSceneRasterSize(int maxWidth, int maxHeight, String bandName) intGets the sub-sampling in X-direction (horizontal).intGets the sub-sampling in Y-direction (vertical).org.locationtech.jts.geom.PolygonbooleanbooleanChecks whether or not this subset definition select the entire product.booleanGets the ignore metadata informationbooleanisNodeAccepted(String name) Checks whether or not a node (a band, a tie-point grid or metadata element) with the given name will be part of the product subset.booleanremoveNodeName(String name) Removes a band from the spectral subset.voidsetIgnoreMetadata(boolean ignoreMetadata) Sets the ignore metadata informationvoidsetNodeNames(String[] names) Sets the names of all product nodes contained in this subset.voidsetRegion(int x, int y, int w, int h) Deprecated.UsesetSubsetRegion(AbstractSubsetRegion)instead.voidDeprecated.UsesetSubsetRegion(AbstractSubsetRegion)instead.voidsetRegionMap(HashMap<String, SubsetRegionInfo> regionMap) voidsetSubSampling(int subSamplingX, int subSamplingY) Gets the sub-sampling in X- and Y-direction (vertical and horizontal).voidsetSubsetName(String subsetName) voidsetSubsetPolygon(org.locationtech.jts.geom.Polygon subsetPolygon) voidsetSubsetRegion(AbstractSubsetRegion subsetRegion) voidsetTreatVirtualBandsAsRealBands(boolean flag) voidRemove regions from non overlapping bands for multi-size products
-
Constructor Details
-
ProductSubsetDef
public ProductSubsetDef()Constructs a new and empty subset info. -
ProductSubsetDef
Constructs a new and empty subset info.- Parameters:
subsetName- The name of the subset to be created.
-
-
Method Details
-
getSubsetName
-
setSubsetName
-
setTreatVirtualBandsAsRealBands
public void setTreatVirtualBandsAsRealBands(boolean flag) -
getTreatVirtualBandsAsRealBands
public boolean getTreatVirtualBandsAsRealBands() -
getNodeNames
Gets the names of all product nodes contained in this subset. A return value ofnullmeans all nodes are selected.- Returns:
- an array of names, or
nullif the no node subset is given
-
setNodeNames
Sets the names of all product nodes contained in this subset. A value ofnullmeans all nodes are selected.- Parameters:
names- the band names, can benullin order to reset the node subset
-
addNodeName
Adds a new product node name to this subset.- Parameters:
name- the node's name, must not be empty ornull
-
addNodeNames
Adds the given product node names to this subset.- Parameters:
names- the nodename's to be added
-
addNodeNames
Adds the given product node names to this subset.- Parameters:
names- the nodename's to be added
-
removeNodeName
Removes a band from the spectral subset. If the band is not contained in this subset, the method returnsfalse.- Parameters:
name- the band's name- Returns:
truefor success,falseotherwise
-
containsNodeName
Checks whether or not a node name is already contained in this subset.- Parameters:
name- the node name- Returns:
- true if so
-
isNodeAccepted
Checks whether or not a node (a band, a tie-point grid or metadata element) with the given name will be part of the product subset.- Parameters:
name- the node name- Returns:
- true if so
-
getRegion
Deprecated.UsegetSubsetRegion()instead.Gets the spatial subset as a rectangular region. Creates a new rectangle each time it is called. This prevents from modifying this subset by modifying the returned region. TODO TO BE removed in future- Returns:
- the spatial subset as a rectangular region, or
nullif no spatial region was defined
-
getRegionMap
-
setRegion
Deprecated.UsesetSubsetRegion(AbstractSubsetRegion)instead.Sets the spatial subset as a rectangular region. TODO TO BE removed in future- Parameters:
region- the spatial subset as a rectangular region,nullif no spatial region shall be defined
-
setRegionMap
-
setRegion
Deprecated.UsesetSubsetRegion(AbstractSubsetRegion)instead.Sets the spatial subset as a rectangular region. TODO TO BE removed in future- Parameters:
x- the X-offset in pixelsy- the Y-offset in pixelsw- the width of the subset in pixelsh- the height of the subset in pixels
-
setSubSampling
public void setSubSampling(int subSamplingX, int subSamplingY) Gets the sub-sampling in X- and Y-direction (vertical and horizontal).- Parameters:
subSamplingX- sub-sampling in X-direction, must always be greater than zerosubSamplingY- sub-sampling in Y-direction, must always be greater than zero
-
getSubSamplingX
public int getSubSamplingX()Gets the sub-sampling in X-direction (horizontal).- Returns:
- the sub-sampling in X-direction which is always greater than zero
-
getSubSamplingY
public int getSubSamplingY()Gets the sub-sampling in Y-direction (vertical).- Returns:
- the sub-sampling in Y-direction which is always greater than zero
-
getSceneRasterSize
Gets the required size for a raster required to hold all pixels for the spatial subset for the given maximum raster width and height.- Parameters:
maxWidth- the maximum raster widthmaxHeight- the maximum raster height- Returns:
- the required raster size, never
null
-
getSceneRasterSize
-
setIgnoreMetadata
public void setIgnoreMetadata(boolean ignoreMetadata) Sets the ignore metadata information- Parameters:
ignoreMetadata- iftrue, metadata may be ignored during write or read a product.
-
isIgnoreMetadata
public boolean isIgnoreMetadata()Gets the ignore metadata information -
isEntireProductSelected
public boolean isEntireProductSelected()Checks whether or not this subset definition select the entire product. -
getSubsetRegion
-
setSubsetRegion
-
setValidSubsetRegionMaps
public void setValidSubsetRegionMaps()Remove regions from non overlapping bands for multi-size products -
getSubsetPolygon
public org.locationtech.jts.geom.Polygon getSubsetPolygon() -
setSubsetPolygon
public void setSubsetPolygon(org.locationtech.jts.geom.Polygon subsetPolygon)
-
getSubsetRegion()instead.