public abstract class EarthDataReader
extends java.lang.Object
EarthDataInfo
object DataVariable
objects DataVariable
, which
consists of all attributes but no actual data values DataVariable
object with data info
and
variables
variables and fills the rawMetadataMap
map.Modifier and Type | Field and Description |
---|---|
protected static boolean |
dataProjection
The data projection flag, true if reading explicit lat/lon data
should return a
DataProjection rather than a
SwathProjection . |
protected EarthDataInfo |
info
Earth data info object.
|
protected java.util.Map |
rawMetadataMap
The raw metadata map.
|
protected java.lang.String[] |
variables
Earth data variable names.
|
Modifier | Constructor and Description |
---|---|
protected |
EarthDataReader(java.lang.String source)
Creates a new earth data reader.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canUpdateNavigation()
Determines the ability of the file format to have its navigation
updated.
|
abstract void |
close()
Closes the reader and frees any resources.
|
protected void |
finalize()
Closes the resources associated with the data source.
|
java.util.List<java.lang.String> |
getAllGrids()
Gets a list of all 2D grid variable names in this reader.
|
java.util.List<java.lang.String> |
getAllVariables()
Gets a list of all variable names in this reader.
|
java.util.List<ucar.nc2.dataset.CoordinateSystem> |
getCoordinateSystems()
Gets the NetCDF CDM style coordinate systems accessed by
this reader.
|
abstract java.lang.String |
getDataFormat()
Gets the data format description.
|
int |
getIndex(java.lang.String name)
Retrieves a variable index based on the name.
|
EarthDataInfo |
getInfo()
Gets the earth data info object.
|
java.lang.String |
getName(int index)
Gets the variable name at the specified index.
|
DataVariable |
getPreview(int index)
Creates a data variable preview.
|
DataVariable |
getPreview(java.lang.String name)
Creates a data variable preview.
|
protected abstract DataVariable |
getPreviewImpl(int index)
Implementation for the subclass.
|
java.util.Map |
getRawMetadata()
Gets the detailed raw metadata.
|
java.lang.String |
getSceneTime()
Gets the scene time based on the first grid variable.
|
java.lang.String |
getSource()
Get the earth data source.
|
Statistics |
getStatistics(java.lang.String name)
Gets the statistics data stored for the specified variable name.
|
java.util.List<java.lang.String> |
getStatisticsVariables()
Gets the list of all variable names that have associated
statistics.
|
abstract DataVariable |
getVariable(int index)
Creates a data variable object.
|
DataVariable |
getVariable(java.lang.String name)
Creates a data variable object.
|
int |
getVariables()
Gets the total count of data variables.
|
java.util.List<java.lang.String> |
getVariablesForSystem(ucar.nc2.dataset.CoordinateSystem system)
Gets the variable names for the specified NetCDF CDM style
coordinate systems accessed by this reader.
|
void |
putStatistics(java.lang.String name,
Statistics stats)
Associates statistics with the specified variable name.
|
static void |
setDataProjection(boolean flag)
Sets the data projection flag.
|
static void |
setUnitsMap(java.util.Map map)
Sets the variable name to units map.
|
void |
updateNavigation(java.util.List variableNames,
java.awt.geom.AffineTransform affine)
Updates the navigation transform for the specified list of
variables (optional operation).
|
protected EarthDataInfo info
protected java.lang.String[] variables
protected static boolean dataProjection
DataProjection
rather than a
SwathProjection
.protected java.util.Map rawMetadataMap
protected EarthDataReader(java.lang.String source)
source
- the data source.public static void setUnitsMap(java.util.Map map)
getPreview(int)
and getVariable(int)
will
automatically have their units converted to the new units before
being passed to the caller.map
- the new map of variable name to units string.public static void setDataProjection(boolean flag)
DataProjection
object for the
earth transform when reading explicit latitude and longitude
data, rather than interpolating the data and returning a
SwathProjection
. The main difference is that a
DataProjection
cannot be used to transform an
EarthLocation
object into a
DataLocation
object. Generally, setting this flag
is only desirable if there are inherent problems with
interpolating the earth location data. By default, the reader is
set to return a SwathProjection
.flag
- the data projection flag.public java.util.List<java.lang.String> getStatisticsVariables()
public Statistics getStatistics(java.lang.String name)
name
- the variable name.putStatistics(java.lang.String, noaa.coastwatch.util.Statistics)
public void putStatistics(java.lang.String name, Statistics stats)
name
- the variable name.stats
- the statistics data.public EarthDataInfo getInfo()
public int getVariables()
public java.lang.String getName(int index)
public abstract java.lang.String getDataFormat()
public java.lang.String getSource()
public java.lang.String getSceneTime()
unknown
if the scene time
cannot be determined.public int getIndex(java.lang.String name)
name
- the variable name to search for.public DataVariable getPreview(int index) throws java.io.IOException
index
- the index of the variable to preview. Indexing
starts at 0.java.io.IOException
- if the data source had I/O errors.getVariable(int)
protected abstract DataVariable getPreviewImpl(int index) throws java.io.IOException
java.io.IOException
getPreview(int)
public DataVariable getPreview(java.lang.String name) throws java.io.IOException
name
- the name of the variable to get.java.io.IOException
- if the data source had I/O errors, or the
variable was not found.getVariable(int)
public abstract DataVariable getVariable(int index) throws java.io.IOException
index
- the index of the variable to get. Indexing
starts at 0.java.io.IOException
- if the data source had I/O errors.getPreview(int)
public DataVariable getVariable(java.lang.String name) throws java.io.IOException
name
- the name of the variable to get.java.io.IOException
- if the data source had I/O errors, or the
variable was not found.getPreview(int)
public abstract void close() throws java.io.IOException
java.io.IOException
- if the data source had I/O errors.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.util.List<java.lang.String> getAllGrids() throws java.io.IOException
java.io.IOException
- if an error occurred getting the list of grids.public java.util.List<java.lang.String> getAllVariables()
public void updateNavigation(java.util.List variableNames, java.awt.geom.AffineTransform affine) throws java.io.IOException
canUpdateNavigation()
.variableNames
- the list of variable names to update.affine
- the navigation transform to apply. If null, the
navigation is reset to the identity.java.io.IOException
- if an error occurred writing the file metadata.java.lang.UnsupportedOperationException
- if the class does not
support navigation transform updates.canUpdateNavigation()
public boolean canUpdateNavigation()
updateNavigation(java.util.List, java.awt.geom.AffineTransform)
should
also override this method.updateNavigation(java.util.List, java.awt.geom.AffineTransform)
public java.util.Map getRawMetadata()
public java.util.List<ucar.nc2.dataset.CoordinateSystem> getCoordinateSystems()
public java.util.List<java.lang.String> getVariablesForSystem(ucar.nc2.dataset.CoordinateSystem system)