org.esa.beam.framework.dataop.barithm
Class BandArithmetic

java.lang.Object
  extended by org.esa.beam.framework.dataop.barithm.BandArithmetic

public class BandArithmetic
extends Object

Provides band arithmetic utility methods.


Nested Class Summary
static interface BandArithmetic.NamespaceExtender
           
static interface BandArithmetic.ProductPrefixProvider
           
 
Field Summary
static String PIXEL_X_NAME
           
static String PIXEL_Y_NAME
           
 
Method Summary
static void addNamespaceExtender(BandArithmetic.NamespaceExtender ne)
           
static int computeBand(String expression, String validMaskExpression, Product[] sourceProducts, int defaultProductIndex, boolean checkInvalids, boolean noDataValueUsed, double noDataValue, int offsetX, int offsetY, int width, int height, ProductData targetRasterData, Scaling scaling, com.bc.ceres.core.ProgressMonitor pm)
          Deprecated. Since BEAM 4.10. Use VirtualBand or VirtualBandOpImage.
static int computeBand(Term term, Term validMaskTerm, boolean checkInvalids, boolean noDataValueUsed, double noDataValue, int offsetX, int offsetY, int width, int height, ProductData targetRasterData, Scaling scaling, com.bc.ceres.core.ProgressMonitor pm)
          Deprecated. Since BEAM 4.10. Use VirtualBand or VirtualBandOpImage.
static WritableNamespace createDefaultNamespace(Product[] products, int defaultProductIndex)
          Creates a default namespace for the product(s) given in an array.
static WritableNamespace createDefaultNamespace(Product[] products, int defaultProductIndex, BandArithmetic.ProductPrefixProvider prefixProvider)
          Creates a default namespace for the product(s) given in an array.
static String createExternalName(String name)
          Create an external name from the given name.
static void deregisterFunction(Function f)
          De-registers an existing function
static void deregisterSymbol(Symbol s)
          De-registers an existing symbol
static String getProductNodeNamePrefix(Product product)
          Gets a symbol name prefix for the names of bands, tie point grids, flags, etc. of the given product.
static RasterDataSymbol[] getRefRasterDataSymbols(Term term)
          Utility method which returns all raster data symbols references in a given term.
static RasterDataSymbol[] getRefRasterDataSymbols(Term[] terms)
          Utility method which returns all raster data symbols references in a given term array.
static RasterDataNode[] getRefRasters(RasterDataSymbol[] rasterDataSymbols)
          Utility method which returns all raster data nodes referenced in a given array of raster data symbols.
static RasterDataNode[] getRefRasters(String expression, Product... products)
           
static RasterDataNode[] getRefRasters(String expression, Product[] products, int defaultProductNamePrefix)
           
static String getValidMaskExpression(String expression, Product[] products, int defaultProductIndex, String validMaskExpression)
           
static Term parseExpression(String expression, Product[] products, int defaultProductIndex)
          Parses the given expression.
static void registerFunction(Function f)
          Registers a new function
static void registerSymbol(Symbol s)
          Registers a new symbol
static void removeNamespaceExtender(BandArithmetic.NamespaceExtender ne)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PIXEL_X_NAME

public static final String PIXEL_X_NAME
See Also:
Constant Field Values

PIXEL_Y_NAME

public static final String PIXEL_Y_NAME
See Also:
Constant Field Values
Method Detail

addNamespaceExtender

public static void addNamespaceExtender(BandArithmetic.NamespaceExtender ne)

removeNamespaceExtender

public static void removeNamespaceExtender(BandArithmetic.NamespaceExtender ne)

registerSymbol

public static void registerSymbol(Symbol s)
Registers a new symbol

Parameters:
s - the symbol

deregisterSymbol

public static void deregisterSymbol(Symbol s)
De-registers an existing symbol

Parameters:
s - the symbol

registerFunction

public static void registerFunction(Function f)
Registers a new function

Parameters:
f - the function

deregisterFunction

public static void deregisterFunction(Function f)
De-registers an existing function

Parameters:
f - the function

parseExpression

public static Term parseExpression(String expression,
                                   Product[] products,
                                   int defaultProductIndex)
                            throws ParseException
Parses the given expression.

Parameters:
expression - the expression
products - the array of input products
defaultProductIndex - the index of the product for which also symbols without the product prefix $ref-no are registered in the namespace
Returns:
the compiled expression
Throws:
ParseException - if a parse error occurs

createDefaultNamespace

public static WritableNamespace createDefaultNamespace(Product[] products,
                                                       int defaultProductIndex)
Creates a default namespace for the product(s) given in an array. The resulting namespace contains symbols for all tie-point grids, bands and single flag values. if the array contains more then one product, the symbol's name will have a prefix according to each product's reference number.

Parameters:
products - the array of input products
defaultProductIndex - the index of the product for which also symbols without the product prefix $ref-no are registered in the namespace
Returns:
a default namespace, never null

createDefaultNamespace

public static WritableNamespace createDefaultNamespace(Product[] products,
                                                       int defaultProductIndex,
                                                       BandArithmetic.ProductPrefixProvider prefixProvider)
Creates a default namespace for the product(s) given in an array. The resulting namespace contains symbols for all tie-point grids, bands and single flag values. if the array contains more then one product, the symbol's name will have a prefix according to each product's reference number.

Parameters:
products - the array of input products
defaultProductIndex - the index of the product for which also symbols without the product prefix $ref-no are registered in the namespace
prefixProvider - a product prefix provider
Returns:
a default namespace, never null

computeBand

@Deprecated
public static int computeBand(String expression,
                                         String validMaskExpression,
                                         Product[] sourceProducts,
                                         int defaultProductIndex,
                                         boolean checkInvalids,
                                         boolean noDataValueUsed,
                                         double noDataValue,
                                         int offsetX,
                                         int offsetY,
                                         int width,
                                         int height,
                                         ProductData targetRasterData,
                                         Scaling scaling,
                                         com.bc.ceres.core.ProgressMonitor pm)
                       throws ParseException,
                              IOException
Deprecated. Since BEAM 4.10. Use VirtualBand or VirtualBandOpImage.

Throws:
ParseException
IOException

computeBand

@Deprecated
public static int computeBand(Term term,
                                         Term validMaskTerm,
                                         boolean checkInvalids,
                                         boolean noDataValueUsed,
                                         double noDataValue,
                                         int offsetX,
                                         int offsetY,
                                         int width,
                                         int height,
                                         ProductData targetRasterData,
                                         Scaling scaling,
                                         com.bc.ceres.core.ProgressMonitor pm)
                       throws IOException
Deprecated. Since BEAM 4.10. Use VirtualBand or VirtualBandOpImage.

Throws:
IOException

getValidMaskExpression

public static String getValidMaskExpression(String expression,
                                            Product[] products,
                                            int defaultProductIndex,
                                            String validMaskExpression)
                                     throws ParseException
Throws:
ParseException

getRefRasters

public static RasterDataNode[] getRefRasters(String expression,
                                             Product... products)
                                      throws ParseException
Throws:
ParseException

getRefRasters

public static RasterDataNode[] getRefRasters(String expression,
                                             Product[] products,
                                             int defaultProductNamePrefix)
                                      throws ParseException
Throws:
ParseException

getRefRasters

public static RasterDataNode[] getRefRasters(RasterDataSymbol[] rasterDataSymbols)
Utility method which returns all raster data nodes referenced in a given array of raster data symbols. The given rasterDataSymbols argument can contain multiple references to the same raster data node, e.g. if multilple SingleFlagSymbols refer to the same raster.

Parameters:
rasterDataSymbols - the array to be analysed
Returns:
the array of raster data nodes, never null but may be empty

getRefRasterDataSymbols

public static RasterDataSymbol[] getRefRasterDataSymbols(Term term)
Utility method which returns all raster data symbols references in a given term.

Parameters:
term - the term to be analysed
Returns:
the array of raster data symbols, never null but may be empty

getRefRasterDataSymbols

public static RasterDataSymbol[] getRefRasterDataSymbols(Term[] terms)
Utility method which returns all raster data symbols references in a given term array. The order of the returned rasters is the order they appear in the given terms.

Parameters:
terms - the term array to be analysed
Returns:
the array of raster data symbols, never null but may be empty

createExternalName

public static String createExternalName(String name)
Create an external name from the given name. If the given name contains character which are not valid in an external name the name is escaped with single quotes.

The method simply delgates to Tokenizer.createExternalName(String).

Parameters:
name - the name
Returns:
a valid external name

getProductNodeNamePrefix

public static String getProductNodeNamePrefix(Product product)
Gets a symbol name prefix for the names of bands, tie point grids, flags, etc. of the given product. The prefix is of the general form "$refNo." where refNo is the product's reference number returned by Product.getRefNo().

Parameters:
product - the product, must not be null
Returns:
a node name prefix, never null.


Copyright © 2002-2013 Brockmann Consult GmbH. All Rights Reserved.