Class ProductSubsetDef

java.lang.Object
org.esa.snap.core.dataio.ProductSubsetDef

public class ProductSubsetDef extends Object
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 Details

    • ProductSubsetDef

      public ProductSubsetDef()
      Constructs a new and empty subset info.
    • ProductSubsetDef

      public ProductSubsetDef(String subsetName)
      Constructs a new and empty subset info.
      Parameters:
      subsetName - The name of the subset to be created.
  • Method Details

    • getSubsetName

      public String getSubsetName()
    • setSubsetName

      public void setSubsetName(String subsetName)
    • setTreatVirtualBandsAsRealBands

      public void setTreatVirtualBandsAsRealBands(boolean flag)
    • getTreatVirtualBandsAsRealBands

      public boolean getTreatVirtualBandsAsRealBands()
    • getNodeNames

      public String[] getNodeNames()
      Gets the names of all product nodes contained in this subset. A return value of null means all nodes are selected.
      Returns:
      an array of names, or null if the no node subset is given
    • setNodeNames

      public void setNodeNames(String[] names)
      Sets the names of all product nodes contained in this subset. A value of null means all nodes are selected.
      Parameters:
      names - the band names, can be null in order to reset the node subset
    • addNodeName

      public void addNodeName(String name)
      Adds a new product node name to this subset.
      Parameters:
      name - the node's name, must not be empty or null
    • addNodeNames

      public void addNodeNames(String[] names)
      Adds the given product node names to this subset.
      Parameters:
      names - the nodename's to be added
    • addNodeNames

      public void addNodeNames(Set<String> names)
      Adds the given product node names to this subset.
      Parameters:
      names - the nodename's to be added
    • removeNodeName

      public boolean removeNodeName(String name)
      Removes a band from the spectral subset. If the band is not contained in this subset, the method returns false.
      Parameters:
      name - the band's name
      Returns:
      true for success, false otherwise
    • containsNodeName

      public boolean containsNodeName(String name)
      Checks whether or not a node name is already contained in this subset.
      Parameters:
      name - the node name
      Returns:
      true if so
    • isNodeAccepted

      public boolean isNodeAccepted(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.
      Parameters:
      name - the node name
      Returns:
      true if so
    • getRegion

      @Deprecated public Rectangle getRegion()
      Deprecated.
      Use getSubsetRegion() 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 null if no spatial region was defined
    • getRegionMap

      public HashMap<String,SubsetRegionInfo> getRegionMap()
    • setRegion

      @Deprecated public void setRegion(Rectangle region)
      Deprecated.
      Sets the spatial subset as a rectangular region. TODO TO BE removed in future
      Parameters:
      region - the spatial subset as a rectangular region, null if no spatial region shall be defined
    • setRegionMap

      public void setRegionMap(HashMap<String,SubsetRegionInfo> regionMap)
    • setRegion

      @Deprecated public void setRegion(int x, int y, int w, int h)
      Deprecated.
      Sets the spatial subset as a rectangular region. TODO TO BE removed in future
      Parameters:
      x - the X-offset in pixels
      y - the Y-offset in pixels
      w - the width of the subset in pixels
      h - 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 zero
      subSamplingY - 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

      public Dimension 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.
      Parameters:
      maxWidth - the maximum raster width
      maxHeight - the maximum raster height
      Returns:
      the required raster size, never null
    • getSceneRasterSize

      public Dimension getSceneRasterSize(int maxWidth, int maxHeight, String bandName)
    • setIgnoreMetadata

      public void setIgnoreMetadata(boolean ignoreMetadata)
      Sets the ignore metadata information
      Parameters:
      ignoreMetadata - if true, 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

      public AbstractSubsetRegion getSubsetRegion()
    • setSubsetRegion

      public void setSubsetRegion(AbstractSubsetRegion subsetRegion)
    • 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)