Package noaa.coastwatch.io
Class CommonDataModelNCReader
java.lang.Object
noaa.coastwatch.io.EarthDataReader
noaa.coastwatch.io.NCReader
noaa.coastwatch.io.CommonDataModelNCReader
- All Implemented Interfaces:
GridSubsetReader,NCSD
The
CommonDataModelNCReader class reads Java NetCDF API
accessible datasets and attempts to use any metadata and
geographic referencing information that the NetCDF layer
provides. If a data variable is found that has two geographic
axes but also time and/or level axes, the variable data is
expanded to a series of 2D variables by extending the variable
name for each non-geographic axis. Datasets must:
- have the same earth transform for all grids, and
- use either a geographic map projection with equally spaced lat/lon intervals, or a swath-style map projection with lat/lon data variables provided (since 3.3.1).
- Since:
- 3.2.0
- Author:
- Peter Hollemans
-
Field Summary
Fields inherited from class noaa.coastwatch.io.EarthDataReader
dataProjection, info, rawMetadataMap, variables -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new reader from the specified file. -
Method Summary
Modifier and TypeMethodDescriptionprotected DataVariablegetActualVariable(int index) Gets the actual variable with data.getChunkProducer(String name) Creates a chunk producer for the specified variable.Gets the data format description.getGridSubset(String varName, int[] start, int[] stride, int[] length) Reads a subset of a data grid.protected DataVariablegetPreviewImpl(int index) Implementation for the subclass.getRawMetadata(int index) Gets the detailed raw metadata for a variable.protected voidPerforms reader initialization after the dataset has been opened.Methods inherited from class noaa.coastwatch.io.NCReader
close, convertAttributeValue, getAttribute, getAttribute, getAttribute, getAttributeAsArray, getAttributeAsArray, getAttributeAsArray, getCoordinateSystems, getDataset, getFilename, getReferencedFile, getVariable, getVariablesForSystem, isNetworkMethods inherited from class noaa.coastwatch.io.EarthDataReader
canUpdateNavigation, containsVariable, finalize, findVariable, getAllGrids, getAllVariables, getIndex, getInfo, getName, getPreview, getPreview, getRawMetadata, getSceneTime, getSource, getStatistics, getStatisticsVariables, getVariable, getVariables, putStatistics, setDataProjection, setUnitsMap, updateNavigation
-
Constructor Details
-
CommonDataModelNCReader
Creates a new reader from the specified file.- Parameters:
name- the file name or URL to read.- Throws:
IOException- if an error occurred reading the metadata.
-
-
Method Details
-
getDataFormat
Gets the data format description.- Specified by:
getDataFormatin classEarthDataReader
-
initializeReader
Description copied from class:NCReaderPerforms reader initialization after the dataset has been opened.- Overrides:
initializeReaderin classNCReader- Throws:
IOException- if an error occurred on initialization.
-
getRawMetadata
Description copied from class:EarthDataReaderGets the detailed raw metadata for a variable.- Overrides:
getRawMetadatain classNCReader- Parameters:
index- the index of the variable for raw metadata.- Returns:
- the map of attribute name to attribute value.
- Throws:
IOException- if the data source had I/O errors.- See Also:
-
getPreviewImpl
Description copied from class:EarthDataReaderImplementation for the subclass.- Specified by:
getPreviewImplin classEarthDataReader- Throws:
IOException- See Also:
-
getChunkProducer
Description copied from class:EarthDataReaderCreates a chunk producer for the specified variable.- Overrides:
getChunkProducerin classEarthDataReader- Parameters:
name- the variable name.- Returns:
- a chunk producer for the specified variable.
- Throws:
IOException
-
getActualVariable
Description copied from class:NCReaderGets the actual variable with data. This method should be implemented in the child class and is only called if the variable is not already in the cache. SeeNCReader.getVariable(int)for the required behaviour.- Specified by:
getActualVariablein classNCReader- Throws:
IOException
-
getGridSubset
public Grid getGridSubset(String varName, int[] start, int[] stride, int[] length) throws IOException Description copied from interface:GridSubsetReaderReads a subset of a data grid. This is similar to theEarthDataReader.getVariable(String)method except that it reads only grid variables and is capable of returning just a subset of the data values. In some cases, such as across a network connection, it may be more efficient to access only a subset or subsampling of data in a variable.- Specified by:
getGridSubsetin interfaceGridSubsetReader- Overrides:
getGridSubsetin classNCReader- Parameters:
varName- the variable name to access.start- the 2D starting data coordinates.stride- the 2D data stride.length- the total number of values to read in each dimension.- Returns:
- the subset and/or subsampled grid variable.
- Throws:
IOException- if the data source had I/O errors.
-