org.geotoolkit.image.io.plugin
Class NetcdfTranscoder

Object
  extended by MetadataTranscoder<Metadata>
      extended by NetcdfTranscoder
All Implemented Interfaces:
WarningProducer, Localized

public class NetcdfTranscoder
extends MetadataTranscoder<Metadata>

Mapping from NetCDF metadata to ISO 19115-2 metadata. The mapping is defined in the following web pages:

The String constants declared in this class are the name of attributes examined by this class. The attribute values are extracted using the NetcdfFile.findGlobalAttributeIgnoreCase(String) or Group.findAttributeIgnoreCase(String) methods. The current implementation searches the attribute values in the following places, in that order:

  1. "NCISOMetadata" group
  2. "CFMetadata" group
  3. Global attributes
  4. "THREDDSMetadata" group

The "CFMetadata" group has precedence over the global attributes because the longitude and latitude resolutions are often more accurate in that group.


NetCDF attributes
The NetCDF attributes parsed by this class are "acces_constraint", "acknowledgment", "comment", "contributor_email", "contributor_name", "contributor_role", "contributor_url", "creator_email", "creator_name", "creator_url", "cdm_data_type", "date_created", "date_issued", "date_modified", "flag_masks", "flag_meanings", "flag_names", "flag_values", "full_name", "geographic_identifier", "geospatial_lat_max", "geospatial_lat_min", "geospatial_lat_resolution", "geospatial_lat_units", "geospatial_lon_max", "geospatial_lon_min", "geospatial_lon_resolution", "geospatial_lon_units", "geospatial_vertical_max", "geospatial_vertical_min", "geospatial_vertical_positive", "geospatial_vertical_resolution", "geospatial_vertical_units", "history", "id", "institution", "keywords", "license", "metadata_creation", "name", "naming_authority", "processing_level", "project", "publisher_email", "publisher_name", "publisher_url", "purpose", "references", "standard_name", "standard_name_vocabulary", "summary", "time_coverage_duration", "time_coverage_end", "time_coverage_resolution", "time_coverage_start", "time_coverage_units", "title", "topic_category" and "keywords_vocabulary".


Known limitations

Since:
3.20
Version:
3.20
Author:
Martin Desruisseaux (Geomatys)
Module:
coverage/geotk-coverageio-netcdf (download)    View source code for this class

Nested Class Summary
static class NetcdfTranscoder.Dimension
          Holds the attribute names describing a simple latitude, longitude, and vertical bounding box.
static class NetcdfTranscoder.Responsible
          Holds the attribute names describing a responsible party.
 
Field Summary
static String ACCESS_CONSTRAINT
          The "acces_constraint" attribute name for the access constraints applied to assure the protection of privacy or intellectual property.
static String ACKNOWLEDGMENT
          The "acknowledgment" attribute name for a place to acknowledge various type of support for the project that produced this data (Recommended).
static String COMMENT
          The "comment" attribute name for miscellaneous information about the data (Recommended).
static NetcdfTranscoder.Responsible CONTRIBUTOR
          The set of attribute names for the contributor (Suggested).
static NetcdfTranscoder.Responsible CREATOR
          The set of attribute names for the creator (Recommended).
static String DATA_TYPE
          The "cdm_data_type" attribute name for the THREDDS data type appropriate for this dataset (Recommended).
static String DATE_CREATED
          The "date_created" attribute name for the date on which the data was created (Recommended).
static String DATE_ISSUED
          The "date_issued" attribute name for a date on which this data was formally issued (Suggested).
static String DATE_MODIFIED
          The "date_modified" attribute name for the date on which this data was last modified (Suggested).
protected  NetcdfFile file
          The NetCDF file from which to extract ISO metadata.
static String FLAG_MASKS
          The "flag_masks" attribute name for bitmask to apply on sample values before to compare them to the flag values.
static String FLAG_MEANINGS
          The "flag_meanings" attribute name for the meaning of flag values.
static String FLAG_NAMES
          The "flag_names" attribute name for the designation associated with a range element.
static String FLAG_VALUES
          The "flag_values" attribute name for sample values to be flagged.
static String GEOGRAPHIC_IDENTIFIER
          The "geographic_identifier" attribute name for an identifier of the geographic area.
static String HISTORY
          The "history" attribute name for providing an audit trail for modifications to the original data (Recommended).
static String IDENTIFIER
          The "id" attribute name for an identifier (Recommended).
static String KEYWORDS
          The "keywords" attribute name for a comma separated list of key words and phrases (Highly Recommended).
static NetcdfTranscoder.Dimension LATITUDE
          The set of attribute names for the minimal and maximal latitudes of the bounding box, resolution and units.
static String LICENSE
          The "license" attribute name for a description of the restrictions to data access and distribution (Recommended).
static NetcdfTranscoder.Dimension LONGITUDE
          The set of attribute names for the minimal and maximal longitudes of the bounding box, resolution and units.
static String METADATA_CREATION
          The "metadata_creation" attribute name for the date on which the metadata was created (Suggested).
static String NAMING_AUTHORITY
          The "naming_authority" attribute name for the identifier authority (Recommended).
static String PROCESSING_LEVEL
          The "processing_level" attribute name for a textual description of the processing (or quality control) level of the data.
static String PROJECT
          The "project" attribute name for the scientific project that produced the data (Recommended).
static NetcdfTranscoder.Responsible PUBLISHER
          The set of attribute names for the publisher (Suggested).
static String PURPOSE
          The "purpose" attribute name for the summary of the intentions with which the resource(s) was developed.
static String REFERENCES
          The "references" attribute name for bibliographical references.
static String STANDARD_NAME
          The "standard_name" attribute name for a long descriptive name for the variable taken from a controlled vocabulary of variable names.
static String STANDARD_NAME_VOCABULARY
          The "standard_name_vocabulary" attribute name for indicating which controlled list of variable names has been used in the "standard_name" attribute.
static String SUMMARY
          The "summary" attribute name for a paragraph describing the dataset (Highly Recommended).
static NetcdfTranscoder.Dimension TIME
          The set of attribute names for the start and end times of the bounding box, resolution and units.
static String TITLE
          The "title" attribute name for a short description of the dataset (Highly Recommended).
static String TOPIC_CATEGORY
          The "topic_category" attribute name for a high-level geographic data thematic classification.
static NetcdfTranscoder.Dimension VERTICAL
          The set of attribute names for the minimal and maximal elevations of the bounding box, resolution and units.
static String VOCABULARY
          The "keywords_vocabulary" attribute name for the guideline for the words/phrases in the "keywords" attribute (Recommended).
 
Fields inherited from interface WarningProducer
LOGGER
 
Constructor Summary
NetcdfTranscoder(NetcdfFile file, WarningProducer owner)
          Creates a new NetCDF to ISO mapper for the given file.
 
Method Summary
protected  Band createSampleDimension(VariableSimpleIF variable)
          Creates a <gmd:dimension> element from the given NetCDF variable.
protected  GridSpatialRepresentation createSpatialRepresentationInfo(CoordinateSystem cs)
          Creates a <gmd:spatialRepresentationInfo> element from the given NetCDF coordinate system.
protected  Attribute getAttribute(Group group, String name)
          Returns the NetCDF attribute of the given name in the given group, or null if none.
 Identifier getFileIdentifier()
          Returns a globally unique identifier for the current NetCDF file.
protected  String getKeywordSeparator(Group group)
          Returns the string to use as a keyword separator.
 Metadata readMetadata()
          Creates an ISO Metadata object from the information found in the NetCDF file.
 
Methods inherited from class MetadataTranscoder
getLocale, warningOccurred
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TITLE

public static final String TITLE
The "title" attribute name for a short description of the dataset (Highly Recommended). If no "title" attribute is provided, then NetcdfTranscoder will look for "full_name" and "name".

Path:

See Also:
NetcdfFile.getTitle(), UCAR reference, Constant Field Values

SUMMARY

public static final String SUMMARY
The "summary" attribute name for a paragraph describing the dataset (Highly Recommended).

Path:

See Also:
UCAR reference, Constant Field Values

IDENTIFIER

public static final String IDENTIFIER
The "id" attribute name for an identifier (Recommended). The combination of the "naming_authority" and the "id" should be a globally unique identifier for the dataset.

Path:

See Also:
getFileIdentifier(), NetcdfFile.getId(), UCAR reference, Constant Field Values

NAMING_AUTHORITY

public static final String NAMING_AUTHORITY
The "naming_authority" attribute name for the identifier authority (Recommended). The combination of the "naming_authority" and the "id" should be a globally unique identifier for the dataset.

Path:

See Also:
IDENTIFIER, getFileIdentifier(), UCAR reference, Constant Field Values

STANDARD_NAME

public static final String STANDARD_NAME
The "standard_name" attribute name for a long descriptive name for the variable taken from a controlled vocabulary of variable names. This is actually a variable attribute, but sometime appears also in global attributes.

Path:

See Also:
STANDARD_NAME_VOCABULARY, KEYWORDS, UCAR reference, Constant Field Values

STANDARD_NAME_VOCABULARY

public static final String STANDARD_NAME_VOCABULARY
The "standard_name_vocabulary" attribute name for indicating which controlled list of variable names has been used in the "standard_name" attribute.

Path:

See Also:
STANDARD_NAME, VOCABULARY, UCAR reference, Constant Field Values

KEYWORDS

public static final String KEYWORDS
The "keywords" attribute name for a comma separated list of key words and phrases (Highly Recommended).

Path:

See Also:
VOCABULARY, STANDARD_NAME, getKeywordSeparator(Group), UCAR reference, Constant Field Values

VOCABULARY

public static final String VOCABULARY
The "keywords_vocabulary" attribute name for the guideline for the words/phrases in the "keywords" attribute (Recommended).

Path:

See Also:
KEYWORDS, STANDARD_NAME_VOCABULARY, UCAR reference, Constant Field Values

TOPIC_CATEGORY

public static final String TOPIC_CATEGORY
The "topic_category" attribute name for a high-level geographic data thematic classification. Typical values are "farming", "biota", "boundaries", "climatology meteorology atmosphere", "economy", "elevation", "environment", "geoscientific information", "health", "imagery base maps earth cover", "intelligence military", "inland waters", "location", "oceans", "planning cadastre", "society", "structure", "transportation" and "utilitiesCommunication".

Path:

See Also:
TopicCategory, Constant Field Values

DATA_TYPE

public static final String DATA_TYPE
The "cdm_data_type" attribute name for the THREDDS data type appropriate for this dataset (Recommended). Examples: "Vector", "TextTable", "Grid", "Image", "Video", "Tin", "StereoModel", "Station", "Swath" or "Trajectory".

Path:

See Also:
SpatialRepresentationType, UCAR reference, Constant Field Values

HISTORY

public static final String HISTORY
The "history" attribute name for providing an audit trail for modifications to the original data (Recommended).

Path:

See Also:
UCAR reference, Constant Field Values

COMMENT

public static final String COMMENT
The "comment" attribute name for miscellaneous information about the data (Recommended).

Path:

See Also:
UCAR reference, Constant Field Values

METADATA_CREATION

public static final String METADATA_CREATION
The "metadata_creation" attribute name for the date on which the metadata was created (Suggested). This is actually defined in the "NCISOMetadata" subgroup.

Path:

See Also:
Constant Field Values

DATE_CREATED

public static final String DATE_CREATED
The "date_created" attribute name for the date on which the data was created (Recommended).

Path:

See Also:
UCAR reference, Constant Field Values

DATE_MODIFIED

public static final String DATE_MODIFIED
The "date_modified" attribute name for the date on which this data was last modified (Suggested).

Path:

See Also:
UCAR reference, Constant Field Values

DATE_ISSUED

public static final String DATE_ISSUED
The "date_issued" attribute name for a date on which this data was formally issued (Suggested).

Path:

See Also:
UCAR reference, Constant Field Values

CREATOR

public static final NetcdfTranscoder.Responsible CREATOR
The set of attribute names for the creator (Recommended).

Path:

See Also:
CONTRIBUTOR, PUBLISHER, UCAR reference

CONTRIBUTOR

public static final NetcdfTranscoder.Responsible CONTRIBUTOR
The set of attribute names for the contributor (Suggested).

Path:

See Also:
CREATOR, PUBLISHER, UCAR reference

PUBLISHER

public static final NetcdfTranscoder.Responsible PUBLISHER
The set of attribute names for the publisher (Suggested).

Path:

See Also:
CREATOR, CONTRIBUTOR, UCAR reference

PROJECT

public static final String PROJECT
The "project" attribute name for the scientific project that produced the data (Recommended).

Path:

See Also:
UCAR reference, Constant Field Values

PURPOSE

public static final String PURPOSE
The "purpose" attribute name for the summary of the intentions with which the resource(s) was developed.

Path:

See Also:
Constant Field Values

REFERENCES

public static final String REFERENCES
The "references" attribute name for bibliographical references.

Path:

See Also:
Constant Field Values

PROCESSING_LEVEL

public static final String PROCESSING_LEVEL
The "processing_level" attribute name for a textual description of the processing (or quality control) level of the data.

Path:

See Also:
UCAR reference, Constant Field Values

ACKNOWLEDGMENT

public static final String ACKNOWLEDGMENT
The "acknowledgment" attribute name for a place to acknowledge various type of support for the project that produced this data (Recommended).

Path:

See Also:
UCAR reference, Constant Field Values

LICENSE

public static final String LICENSE
The "license" attribute name for a description of the restrictions to data access and distribution (Recommended).

Path:

See Also:
UCAR reference, Constant Field Values

ACCESS_CONSTRAINT

public static final String ACCESS_CONSTRAINT
The "acces_constraint" attribute name for the access constraints applied to assure the protection of privacy or intellectual property. Typical values are "copyright", "patent", "patent pending", "trademark", "license", "intellectual property rights" or "restricted".

Path:

See Also:
Restriction, Constant Field Values

GEOGRAPHIC_IDENTIFIER

public static final String GEOGRAPHIC_IDENTIFIER
The "geographic_identifier" attribute name for an identifier of the geographic area.

Path:

See Also:
Constant Field Values

LATITUDE

public static final NetcdfTranscoder.Dimension LATITUDE
The set of attribute names for the minimal and maximal latitudes of the bounding box, resolution and units. Latitudes are assumed to be in decimal degrees north, unless a units attribute is specified.

Path:

See Also:
LONGITUDE, VERTICAL, TIME, UCAR reference

LONGITUDE

public static final NetcdfTranscoder.Dimension LONGITUDE
The set of attribute names for the minimal and maximal longitudes of the bounding box, resolution and units. Longitudes are assumed to be in decimal degrees east, unless a units attribute is specified.

Path:

See Also:
LATITUDE, VERTICAL, TIME, UCAR reference

VERTICAL

public static final NetcdfTranscoder.Dimension VERTICAL
The set of attribute names for the minimal and maximal elevations of the bounding box, resolution and units. Elevations are assumed to be in metres above the ground, unless a units attribute is specified.

Path:

See Also:
LATITUDE, LONGITUDE, TIME, UCAR reference

TIME

public static final NetcdfTranscoder.Dimension TIME
The set of attribute names for the start and end times of the bounding box, resolution and units.

Path:

See Also:
LATITUDE, LONGITUDE, VERTICAL, UCAR reference

FLAG_NAMES

public static final String FLAG_NAMES
The "flag_names" attribute name for the designation associated with a range element. This attribute can be associated to variables. If specified, they shall be one flag name for each flag mask, flag value and flag meaning.

Path:

See Also:
Constant Field Values

FLAG_MASKS

public static final String FLAG_MASKS
The "flag_masks" attribute name for bitmask to apply on sample values before to compare them to the flag values.

Path:

See Also:
Constant Field Values

FLAG_VALUES

public static final String FLAG_VALUES
The "flag_values" attribute name for sample values to be flagged. The flag masks, flag values and flag meaning attributes, used together, describe a blend of independent boolean conditions and enumerated status codes. A flagged condition is identified by a bitwise AND of the variable value and each flag masks value; a result that matches the flag values value indicates a true condition.

Path:

See Also:
Constant Field Values

FLAG_MEANINGS

public static final String FLAG_MEANINGS
The "flag_meanings" attribute name for the meaning of flag values. Each flag values and flag masks must coincide with a flag meanings.

Path:

See Also:
Constant Field Values

file

protected final NetcdfFile file
The NetCDF file from which to extract ISO metadata. This file is set at construction time.

Constructor Detail

NetcdfTranscoder

public NetcdfTranscoder(NetcdfFile file,
                        WarningProducer owner)
Creates a new NetCDF to ISO mapper for the given file. While this constructor accepts arbitrary NetcdfFile instance, the NetcdfDataset subclass is necessary in order to get coordinate system information.

Parameters:
file - The NetCDF file from which to parse metadata.
owner - Typically the SpatialImageReader or SpatialImageWriter object using this transcoder, or null.
Method Detail

getAttribute

protected Attribute getAttribute(Group group,
                                 String name)
Returns the NetCDF attribute of the given name in the given group, or null if none. This method is invoked for every global and group attributes to be read by this class (but not variable attributes), thus providing a single point where subclasses can filter the attributes to be read. The name argument is typically (but is not restricted too) one of the constants defined in this class.

Parameters:
group - The group in which to search the attribute, or null for global attributes.
name - The name of the attribute to search (can not be null).
Returns:
The attribute, or null if none.

getFileIdentifier

public Identifier getFileIdentifier()
                             throws IOException
Returns a globally unique identifier for the current NetCDF file. The default implementation builds the identifier from the following attributes:

Subclasses can override this method if they need to complete the information.

Returns:
The globally unique identifier, or null if none.
Throws:
IOException - If an I/O operation was necessary but failed.

getKeywordSeparator

protected String getKeywordSeparator(Group group)
                              throws IOException
Returns the string to use as a keyword separator. This separator is used for parsing the "keywords" attribute value. The default implementation returns ",". Subclasses can override this method in an other separator (possibly determined from the file content) is desired.

Parameters:
group - The NetCDF group from which keywords are read.
Returns:
The string to use as a keyword separator, as a regular expression.
Throws:
IOException - If an I/O operation was necessary but failed.

createSpatialRepresentationInfo

protected GridSpatialRepresentation createSpatialRepresentationInfo(CoordinateSystem cs)
                                                             throws IOException
Creates a <gmd:spatialRepresentationInfo> element from the given NetCDF coordinate system. Subclasses can override this method if they need to complete the information provided in the returned object.

Parameters:
cs - The NetCDF coordinate system.
Returns:
The grid spatial representation info.
Throws:
IOException - If an I/O operation was necessary but failed.

createSampleDimension

protected Band createSampleDimension(VariableSimpleIF variable)
                              throws IOException
Creates a <gmd:dimension> element from the given NetCDF variable. Subclasses can override this method if they need to complete the information provided in the returned object.

Parameters:
variable - The NetCDF variable.
Returns:
The sample dimension information.
Throws:
IOException - If an I/O operation was necessary but failed.

readMetadata

public Metadata readMetadata()
                      throws IOException
Creates an ISO Metadata object from the information found in the NetCDF file.

Specified by:
readMetadata in class MetadataTranscoder<Metadata>
Returns:
The ISO metadata object.
Throws:
IOException - If an I/O operation was necessary but failed.


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.