Class PointOperator
- java.lang.Object
-
- org.esa.snap.core.gpf.Operator
-
- org.esa.snap.core.gpf.pointop.PointOperator
-
- Direct Known Subclasses:
PixelOperator,SampleOperator
public abstract class PointOperator extends Operator
ThePointOperatorclass serves as a base class for operators- that compute single pixels independently of their neighbours and
- whose target product and all source products share the same grid and coordinate reference system.
GeoCoding.- Since:
- BEAM 4.9, revised in SNAP 2.0
-
-
Constructor Summary
Constructors Constructor Description PointOperator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckRasterSize()Checks if all source products share the same raster size, otherwise throws an exception.protected abstract voidconfigureSourceSamples(SourceSampleConfigurer sampleConfigurer)Configures all source samples that this operator requires for the computation of target samples.protected voidconfigureTargetProduct(ProductConfigurer productConfigurer)Configures the target product via the givenProductConfigurer.protected abstract voidconfigureTargetSamples(TargetSampleConfigurer sampleConfigurer)Configures all target samples computed by this operator.protected ProductcreateTargetProduct()Creates the target product instance.voiddispose()Releases the resources the operator has acquired during its lifetime.voidinitialize()Configures thisPointOperatorby performing a number of initialisation steps in the given order:prepareInputs()createTargetProduct()configureTargetProduct(ProductConfigurer)configureSourceSamples(SourceSampleConfigurer)configureTargetSamples(TargetSampleConfigurer)This method cannot be overridden by intention (template method).protected voidprepareInputs()Prepares the inputs for this operator.-
Methods inherited from class org.esa.snap.core.gpf.Operator
canComputeTile, canComputeTileStack, checkForCancellation, computeTile, computeTileStack, 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
-
initialize
public final void initialize() throws OperatorExceptionConfigures thisPointOperatorby performing a number of initialisation steps in the given order: This method cannot be overridden by intention (template method). Instead clients may wish to override the methods that are called during the initialisation sequence.- Specified by:
initializein classOperator- Throws:
OperatorException- If the configuration cannot be performed.- See Also:
Operator.getTargetProduct()
-
prepareInputs
protected void prepareInputs() throws OperatorExceptionPrepares the inputs for this operator. Called byinitialize().Clients may override to perform some extra validation of parameters and source products and/or to load external, auxiliary resources. External resources that may be opened by this method and that must remain open during the
Operator's lifetime shall be closed by a dedicated override of thedispose()method.Failures of input preparation shall be indicated by throwing an
OperatorException.The default implementation checks whether all source products have the same raster size. Clients that require a similar behaviour in their operator shall first call the
supermethod in their implementation.- Throws:
OperatorException- If the validation of input fails.
-
dispose
public void dispose()
Description copied from class:OperatorReleases the resources the operator has acquired during its lifetime. The default implementation does nothing.Overrides should make sure to call
super.dispose()as well.
-
createTargetProduct
protected Product createTargetProduct() throws OperatorException
Creates the target product instance. Called byinitialize().The default implementation creates a target product instance given the raster size of the (first) source product.
- Returns:
- A new target product instance.
- Throws:
OperatorException- If the target product cannot be created.
-
configureTargetProduct
protected void configureTargetProduct(ProductConfigurer productConfigurer)
Configures the target product via the givenProductConfigurer. Called byinitialize().Client implementations of this method usually add product components to the given target product, such as
bandsto be computed by this operator,virtual bands,masksorsample codings.The default implementation retrieves the (first) source product and copies to the target product
- the start and stop time by calling
ProductConfigurer.copyTimeCoding(), - all tie-point grids by calling
ProductConfigurer.copyTiePointGrids(String...), - the geo-coding by calling
ProductConfigurer.copyGeoCoding().
Clients that require a similar behaviour in their operator shall first call the
supermethod in their implementation.- Parameters:
productConfigurer- The target product configurer.- Throws:
OperatorException- If the target product cannot be configured.- See Also:
Product.addBand(Band),Product.addBand(String, String),Product.addTiePointGrid(TiePointGrid),Product.getMaskGroup()
- the start and stop time by calling
-
configureSourceSamples
protected abstract void configureSourceSamples(SourceSampleConfigurer sampleConfigurer) throws OperatorException
Configures all source samples that this operator requires for the computation of target samples. Source sample are defined by using the providedSourceSampleConfigurer.The method is called by
initialize().- Parameters:
sampleConfigurer- The configurer that defines the layout of a pixel.- Throws:
OperatorException- If the source samples cannot be configured.
-
configureTargetSamples
protected abstract void configureTargetSamples(TargetSampleConfigurer sampleConfigurer) throws OperatorException
Configures all target samples computed by this operator. Target samples are defined by using the providedTargetSampleConfigurer.The method is called by
initialize().- Parameters:
sampleConfigurer- The configurer that defines the layout of a pixel.- Throws:
OperatorException- If the target samples cannot be configured.
-
checkRasterSize
protected final void checkRasterSize() throws OperatorExceptionChecks if all source products share the same raster size, otherwise throws an exception. Called byinitialize().- Throws:
OperatorException- If the source product's raster sizes are not equal.
-
-