Package org.esa.snap.core.metadata
Class XmlMetadata
java.lang.Object
org.esa.snap.core.metadata.GenericXmlMetadata
org.esa.snap.core.metadata.XmlMetadata
Base metadata class that exposes helper methods for easier access of interesting metadata values.
-
Field Summary
FieldsFields inherited from class org.esa.snap.core.metadata.GenericXmlMetadata
attributeMap, logger, MISSING_ELEMENT_WARNING, name, NO_SUCH_PATH_WARNING, path, rootElement
-
Constructor Summary
ConstructorsConstructorDescriptionXmlMetadata
(String name) Constructs an instance of metadata class and assigns a name to the rootMetadataElement
. -
Method Summary
Modifier and TypeMethodDescriptionprotected float
Silently converts a string to a float (i.e.protected float[]
asFloatArray
(String value, String separator) Converts the value to a float array.protected int
Silently converts a string to a int (i.e.abstract ProductData.UTC
Returns the product center time in UTC format.abstract String
Returns the name of the raster format (for example: TIFF, NITF, etc).abstract int
Returns the number of bands of the product.abstract String
Returns the product description, preferably from metadataabstract ProductData.UTC
Returns the product end time in UTC format.abstract String
Returns the name of the product, as found in metadata.abstract ProductData.UTC
Returns the product start time in UTC format.abstract String[]
Returns the names of raster files for the product.abstract int
Returns the height of the product, in pixels.abstract int
Returns the width of the product, in pixels.void
Sets the name of this metadata (and also the name of the root element).Methods inherited from class org.esa.snap.core.metadata.GenericXmlMetadata
CopyChildElements, create, create, create, ensureAttributeTagPresent, getAttributeSiblingValue, getAttributeValue, getAttributeValue, getAttributeValues, getFileName, getMetadataProfile, getPath, getRootElement, indexAttribute, loadMetadata, setFileName, setPath, warn
-
Field Details
-
width
protected int width -
height
protected int height -
numBands
protected int numBands
-
-
Constructor Details
-
XmlMetadata
Constructs an instance of metadata class and assigns a name to the rootMetadataElement
.- Parameters:
name
- The name of this instance, and also the initial name of the root element.
-
-
Method Details
-
getNumBands
public abstract int getNumBands()Returns the number of bands of the product. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.- Returns:
- the number of bands
-
getProductName
Returns the name of the product, as found in metadata. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.- Returns:
- The name of the product
-
getFormatName
Returns the name of the raster format (for example: TIFF, NITF, etc).This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.
- Returns:
- The raster format name/code.
-
getRasterWidth
public abstract int getRasterWidth()Returns the width of the product, in pixels. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.- Returns:
- The width (in pixels) of the product.
-
getRasterHeight
public abstract int getRasterHeight()Returns the height of the product, in pixels. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.- Returns:
- The height (in pixels) of the product.
-
getRasterFileNames
Returns the names of raster files for the product. This getter should be overridden in all derived classes because each metadata type may have a different hierarchy of nodes for getting this value.- Returns:
- An array of raster file names.
-
setName
Sets the name of this metadata (and also the name of the root element).- Overrides:
setName
in classGenericXmlMetadata
- Parameters:
value
- The name of the metadata file.
-
getProductStartTime
Returns the product start time in UTC format. This method has to be implemented by subclasses since the value may be or may not be present in metadata, or may be in different formats for different products.- Returns:
- the product start time
-
getProductEndTime
Returns the product end time in UTC format. This method has to be implemented by subclasses since the value may be or may not be present in metadata, or may be in different formats for different products.- Returns:
- the product end time
-
getCenterTime
Returns the product center time in UTC format. This method has to be implemented by subclasses since the value may be or may not be present in metadata, or may be in different formats for different products.- Returns:
- the product center time.
-
getProductDescription
Returns the product description, preferably from metadata- Returns:
- the product description
-
asFloatArray
Converts the value to a float array.- Parameters:
value
- The string list of valuesseparator
- The items separator- Returns:
- An array of float values
-
asFloat
Silently converts a string to a float (i.e. without throwing exception for unconvertible values)- Parameters:
value
- The value to be converted- Returns:
- The float value or
Float.NaN
if the conversion cannot be performed.
-
asInt
Silently converts a string to a int (i.e. without throwing exception for unconvertible values)- Parameters:
value
- The value to be converted- Returns:
- The int value or
0
if the conversion cannot be performed.
-