Class SubsetOp
- java.lang.Object
-
- org.esa.snap.core.gpf.Operator
-
- org.esa.snap.core.gpf.common.SubsetOp
-
@OperatorMetadata(alias="Subset", category="Raster", authors="SNAP Developers", version="1.3", copyright="(c) 2011 by Brockmann Consult", description="Create a spatial and/or spectral subset of a data product.") public class SubsetOp extends Operator
This operator is used to create either spatial and/or spectral subsets of a data product. Spatial subset may be given by pixel positions (parameterregion) or a geographical polygon (parametergeoRegion). Subsets of band and tie-point grid are given by name lists (parametersbandNamesandtiePointGridNames).- Since:
- BEAM 4.9
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSubsetOp.Spi
-
Constructor Summary
Constructors Constructor Description SubsetOp()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RectanglecomputePixelRegion(Product product, org.locationtech.jts.geom.Geometry geometryRegion, int numBorderPixels)Non-API (yet).static HashMap<String,Rectangle>computeRegionMap(Rectangle region, String referenceBandName, Product product, String[] rasterNames)static HashMap<String,Rectangle>computeRegionMap(Rectangle region, Product product, String[] rasterNames)static HashMap<String,Rectangle>computeRegionMap(org.locationtech.jts.geom.Geometry geoRegion, Product product, String[] rasterNames)voidcomputeTile(Band band, Tile targetTile, ProgressMonitor pm)Called by the framework in order to compute a tile for the given target band.String[]getBandNames()org.locationtech.jts.geom.GeometrygetGeoRegion()RectanglegetRegion()String[]getTiePointGridNames()voidinitialize()Initializes this operator and sets the one and only target product.voidsetBandNames(String[] bandNames)voidsetCopyMetadata(boolean copyMetadata)voidsetGeoRegion(org.locationtech.jts.geom.Geometry geoRegion)voidsetRegion(Rectangle region)voidsetSubSamplingX(int subSamplingX)voidsetSubSamplingY(int subSamplingY)voidsetTiePointGridNames(String[] tiePointGridNames)-
Methods inherited from class org.esa.snap.core.gpf.Operator
canComputeTile, canComputeTileStack, checkForCancellation, computeTileStack, dispose, doExecute, ensureSceneGeoCoding, ensureSingleRasterSize, ensureSingleRasterSize, execute, finalize, getId, getLogger, getParameter, getParameter, getProductManager, getSourceProduct, getSourceProduct, getSourceProductId, getSourceProducts, getSourceTile, getSourceTile, getSpi, getTargetProduct, getTargetProperty, setLogger, setParameter, setParameterDefaultValues, setRequiresAllBands, setSourceProduct, setSourceProduct, setSourceProducts, setSpi, setTargetProduct, stopTileComputationObservation, update
-
-
-
-
Method Detail
-
getTiePointGridNames
public String[] getTiePointGridNames()
-
setTiePointGridNames
public void setTiePointGridNames(String[] tiePointGridNames)
-
getBandNames
public String[] getBandNames()
-
setBandNames
public void setBandNames(String[] bandNames)
-
setCopyMetadata
public void setCopyMetadata(boolean copyMetadata)
-
getRegion
public Rectangle getRegion()
-
setRegion
public void setRegion(Rectangle region)
-
setSubSamplingX
public void setSubSamplingX(int subSamplingX)
-
setSubSamplingY
public void setSubSamplingY(int subSamplingY)
-
getGeoRegion
public org.locationtech.jts.geom.Geometry getGeoRegion()
-
setGeoRegion
public void setGeoRegion(org.locationtech.jts.geom.Geometry geoRegion)
-
initialize
public void initialize() throws OperatorExceptionDescription copied from class:OperatorInitializes this operator and sets the one and only target product.The target product can be either defined by a field of type
Productannotated with theTargetProductannotation or by callingOperator.setTargetProduct(org.esa.snap.core.datamodel.Product)method.This method shall never be called directly. The framework calls this method after it has created an instance of this
Operator. This will occur only once durting the lifetime of anOperatorinstance. If not already done, calling theOperator.getTargetProduct()will always trigger a call to theinitialize()method.Any client code that must be performed before computation of tile data should be placed here.
- Specified by:
initializein classOperator- Throws:
OperatorException- If an error occurs during operator initialisation.- See Also:
Operator.getTargetProduct()
-
computeTile
public void computeTile(Band band, Tile targetTile, ProgressMonitor pm) throws OperatorException
Description copied from class:OperatorCalled by the framework in order to compute a tile for the given target band.The default implementation throws a runtime exception with the message "not implemented".
This method shall never be called directly.
- Overrides:
computeTilein classOperator- Parameters:
band- The target band.targetTile- The current tile associated with the target band to be computed.pm- A progress monitor which should be used to determine computation cancellation requests.- Throws:
OperatorException- If an error occurs during computation of the target raster.
-
computePixelRegion
public static Rectangle computePixelRegion(Product product, org.locationtech.jts.geom.Geometry geometryRegion, int numBorderPixels)
Non-API (yet).
-
computeRegionMap
public static HashMap<String,Rectangle> computeRegionMap(Rectangle region, Product product, String[] rasterNames)
-
computeRegionMap
public static HashMap<String,Rectangle> computeRegionMap(Rectangle region, String referenceBandName, Product product, String[] rasterNames)
-
-