Class GPF
- java.lang.Object
-
- org.esa.snap.core.gpf.GPF
-
public class GPF extends Object
The facade for the Graph Processing Framework.
The Graph Processing Framework makes extensive use of Java Advanced Imaging (JAI). Therefore, configuring the JAI
TileCache
andTileScheduler
will also affect the overall performance of the Graph Processing Framework.This class may be overridden in order to alter product creation behaviour of the static
createProduct
methods of the GPF instance. The current instance can be set bysetDefaultInstance(GPF)
.- Since:
- 4.1
-
-
Field Summary
Fields Modifier and Type Field Description static String
BEEP_AFTER_PROCESSING_PROPERTY
static String
DISABLE_TILE_CACHE_PROPERTY
static RenderingHints.Key
KEY_TILE_SIZE
Key for GPF tile sizeRenderingHints
.static Map<String,Object>
NO_PARAMS
An unmodifiable emptyMap
.static Map<String,Product>
NO_SOURCES
An unmodifiable emptyMap
.static String
SNAP_GPF_ALLOW_AUXDATA_DOWNLOAD
static String
SOURCE_PRODUCT_FIELD_NAME
static String
TARGET_PRODUCT_FIELD_NAME
static String
TILE_COMPUTATION_OBSERVER_PROPERTY
static String
USE_FILE_TILE_CACHE_PROPERTY
-
Constructor Summary
Constructors Modifier Constructor Description protected
GPF()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Operator
createOperator(String operatorName, Map<String,Object> parameters, Map<String,Product> sourceProducts, RenderingHints renderingHints)
Creates an operator instance by using the given operator (alias) name.static Product
createProduct(String operatorName, Map<String,Object> parameters)
Creates a product by using the operator specified by the given name.static Product
createProduct(String operatorName, Map<String,Object> parameters, RenderingHints renderingHints)
Creates a product by using the operator specified by the given name.static Product
createProduct(String operatorName, Map<String,Object> parameters, Map<String,Product> sourceProducts)
Creates a product by using the operator specified by the given name.static Product
createProduct(String operatorName, Map<String,Object> parameters, Map<String,Product> sourceProducts, RenderingHints renderingHints)
Creates a product by using the operator specified by the given name.static Product
createProduct(String operatorName, Map<String,Object> parameters, Product sourceProduct)
Creates a product by using the operator specified by the given name.static Product
createProduct(String operatorName, Map<String,Object> parameters, Product... sourceProducts)
Creates a product by using the operator specified by the given name.static Product
createProduct(String operatorName, Map<String,Object> parameters, Product[] sourceProducts, RenderingHints renderingHints)
Creates a product by using the operator specified by the given name.static Product
createProduct(String operatorName, Map<String,Object> parameters, Product sourceProduct, RenderingHints renderingHints)
Creates a product by using the operator specified by the given name.Product
createProductNS(String operatorName, Map<String,Object> parameters, Map<String,Product> sourceProducts, RenderingHints renderingHints)
Creates a product by using the operator specified by the given name.void
executeOperator(Operator operator)
Calls the execute method of an operator and sets an appropriate progress monitor.static GPF
getDefaultInstance()
Gets the default GPF instance.DownsamplerSpiRegistry
getDownsamplerSpiRegistry()
Gets the registry for downsampler SPIs.OperatorSpiRegistry
getOperatorSpiRegistry()
Gets the registry for operator SPIs.ProductManager
getProductManager()
Gets the context product manager which can be used to exchange product instances across operators or allow (reading) operators to check if a given product is already opened.UpsamplerSpiRegistry
getUpsamplerSpiRegistry()
Gets the registry for upsampler SPIs.static void
setDefaultInstance(GPF defaultInstance)
Sets the default GPF instance.void
setOperatorSpiRegistry(OperatorSpiRegistry spiRegistry)
Sets the registry for operator SPIs.void
setProductManager(ProductManager productManager)
Sets the context product manager which can be used to exchange product instances across operators or allow (reading) operators to check if a given product is already opened.void
setProgressMonitoredOperatorExecutor(ProgressMonitoredOperatorExecutor operatorExecutor)
static void
writeProduct(Product product, File file, String formatName, boolean clearCacheAfterRowWrite, boolean incremental, ProgressMonitor pm)
Writes a product with the specified format to the given file.static void
writeProduct(Product product, File file, String formatName, boolean incremental, ProgressMonitor pm)
Writes a product with the specified format to the given file.
-
-
-
Field Detail
-
DISABLE_TILE_CACHE_PROPERTY
public static final String DISABLE_TILE_CACHE_PROPERTY
- See Also:
- Constant Field Values
-
USE_FILE_TILE_CACHE_PROPERTY
public static final String USE_FILE_TILE_CACHE_PROPERTY
- See Also:
- Constant Field Values
-
TILE_COMPUTATION_OBSERVER_PROPERTY
public static final String TILE_COMPUTATION_OBSERVER_PROPERTY
- See Also:
- Constant Field Values
-
BEEP_AFTER_PROCESSING_PROPERTY
public static final String BEEP_AFTER_PROCESSING_PROPERTY
- See Also:
- Constant Field Values
-
SNAP_GPF_ALLOW_AUXDATA_DOWNLOAD
public static final String SNAP_GPF_ALLOW_AUXDATA_DOWNLOAD
- See Also:
- Constant Field Values
-
SOURCE_PRODUCT_FIELD_NAME
public static final String SOURCE_PRODUCT_FIELD_NAME
- See Also:
- Constant Field Values
-
TARGET_PRODUCT_FIELD_NAME
public static final String TARGET_PRODUCT_FIELD_NAME
- See Also:
- Constant Field Values
-
KEY_TILE_SIZE
public static final RenderingHints.Key KEY_TILE_SIZE
Key for GPF tile sizeRenderingHints
.The value for this key must be an instance of
Dimension
with both width and height positive.
-
NO_PARAMS
public static final Map<String,Object> NO_PARAMS
An unmodifiable emptyMap
.Can be used for convenience as a parameter for
createProduct()
if no parameters are needed for the operator.
-
NO_SOURCES
public static final Map<String,Product> NO_SOURCES
An unmodifiable emptyMap
.Can be used for convenience as a parameter for
createProduct(String, Map, Map)
if no source products are needed for the operator.- See Also:
createProduct(String, Map, Map)
-
-
Method Detail
-
createProduct
public static Product createProduct(String operatorName, Map<String,Object> parameters) throws OperatorException
Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String,Object> parameters, RenderingHints renderingHints) throws OperatorException
Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.renderingHints
- the rendering hints may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String,Object> parameters, Product sourceProduct) throws OperatorException
Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProduct
- a source product.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String,Object> parameters, Product sourceProduct, RenderingHints renderingHints) throws OperatorException
Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProduct
- the source product.renderingHints
- the rendering hints may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String,Object> parameters, Product... sourceProducts) throws OperatorException
Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the source products.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String,Object> parameters, Product[] sourceProducts, RenderingHints renderingHints) throws OperatorException
Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the source products.renderingHints
- the rendering hints may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String,Object> parameters, Map<String,Product> sourceProducts) throws OperatorException
Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the map of named source products.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProduct
public static Product createProduct(String operatorName, Map<String,Object> parameters, Map<String,Product> sourceProducts, RenderingHints renderingHints) throws OperatorException
Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the map of named source products.renderingHints
- the rendering hints, may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
createProductNS
public Product createProductNS(String operatorName, Map<String,Object> parameters, Map<String,Product> sourceProducts, RenderingHints renderingHints)
Creates a product by using the operator specified by the given name. The resulting product can be used as input product for a further call tocreateProduct()
. By concatenating multiple calls it is possible to set up a processing graph.All static
createProduct
methods delegate to this non-static (= NS) version. It can be overriden by clients in order to alter product creation behaviour of the staticcreateProduct
methods of the current GPF instance.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the map of named source products.renderingHints
- the rendering hints, may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.
-
executeOperator
public void executeOperator(Operator operator)
Calls the execute method of an operator and sets an appropriate progress monitor.- Parameters:
operator
- The operator on which the execute method shall be called
-
createOperator
public Operator createOperator(String operatorName, Map<String,Object> parameters, Map<String,Product> sourceProducts, RenderingHints renderingHints)
Creates an operator instance by using the given operator (alias) name.- Parameters:
operatorName
- the name of the operator to use.parameters
- the named parameters needed by the operator.sourceProducts
- the map of named source products.renderingHints
- the rendering hints, may benull
.- Returns:
- the product created by the operator.
- Throws:
OperatorException
- if the product could not be created.- Since:
- BEAM 4.9
-
getOperatorSpiRegistry
public OperatorSpiRegistry getOperatorSpiRegistry()
Gets the registry for operator SPIs.- Returns:
- the registry for operator SPIs.
-
getUpsamplerSpiRegistry
public UpsamplerSpiRegistry getUpsamplerSpiRegistry()
Gets the registry for upsampler SPIs.- Returns:
- the registry for upsampler SPIs.
-
getDownsamplerSpiRegistry
public DownsamplerSpiRegistry getDownsamplerSpiRegistry()
Gets the registry for downsampler SPIs.- Returns:
- the registry for downsampler SPIs.
-
setOperatorSpiRegistry
public void setOperatorSpiRegistry(OperatorSpiRegistry spiRegistry)
Sets the registry for operator SPIs.- Parameters:
spiRegistry
- the registry for operator SPIs.
-
getDefaultInstance
public static GPF getDefaultInstance()
Gets the default GPF instance.- Returns:
- the singelton instance.
-
setDefaultInstance
public static void setDefaultInstance(GPF defaultInstance)
Sets the default GPF instance.- Parameters:
defaultInstance
- the GPF default instance.
-
writeProduct
public static void writeProduct(Product product, File file, String formatName, boolean incremental, ProgressMonitor pm)
Writes a product with the specified format to the given file.- Parameters:
product
- the productfile
- the product fileformatName
- the name of a supported product format, e.g. "HDF5". Ifnull
, the default format "BEAM-DIMAP" will be usedincremental
- switch the product writer in incremental mode or not.pm
- a monitor to inform the user about progress
-
writeProduct
public static void writeProduct(Product product, File file, String formatName, boolean clearCacheAfterRowWrite, boolean incremental, ProgressMonitor pm)
Writes a product with the specified format to the given file.- Parameters:
product
- the productfile
- the product fileformatName
- the name of a supported product format, e.g. "HDF5". Ifnull
, the default format "BEAM-DIMAP" will be usedclearCacheAfterRowWrite
- if true, the internal tile cache is cleared after a tile row has been written.incremental
- switch the product writer in incremental mode or not.pm
- a monitor to inform the user about progress
-
getProductManager
public ProductManager getProductManager()
Gets the context product manager which can be used to exchange product instances across operators or allow (reading) operators to check if a given product is already opened.- Returns:
- The context product manager.
- Since:
- SNAP 3.0
-
setProductManager
public void setProductManager(ProductManager productManager)
Sets the context product manager which can be used to exchange product instances across operators or allow (reading) operators to check if a given product is already opened.- Parameters:
productManager
- The new context product manager.- Since:
- SNAP 3.0
-
setProgressMonitoredOperatorExecutor
public void setProgressMonitoredOperatorExecutor(ProgressMonitoredOperatorExecutor operatorExecutor)
-
-