public abstract class HDFReader extends EarthDataReader implements HDFSD
Modifier and Type | Field and Description |
---|---|
protected int |
sdid
HDF file id.
|
dataProjection, info, rawMetadataMap, variables
Modifier | Constructor and Description |
---|---|
protected |
HDFReader(HDFWriter writer)
Constructs an HDF reader from the specified HDF writer.
|
protected |
HDFReader(java.lang.String file)
Constructs an HDF reader from the specified file.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the reader and frees any resources.
|
static java.lang.Object |
getAttribute(int sdid,
int index)
Gets an HDF attribute value.
|
static java.lang.Object |
getAttribute(int sdid,
java.lang.String name)
Gets an HDF attribute value.
|
static java.lang.Object |
getAttributeAsArray(int sdid,
int index)
Gets an HDF attribute value.
|
static java.lang.Object |
getAttributeAsArray(int sdid,
java.lang.String name)
Gets an HDF attribute value.
|
static void |
getAttributes(int sdid,
java.util.List attList,
java.util.Map attMap)
Gets a number of attributes specified by a list of name and
stores them in a map.
|
static void |
getAttributes(int sdid,
java.util.Map map,
boolean global)
Gets all attributes and stores them in a map.
|
static int[] |
getChunkLengths(int sdsid)
Gets the chunk lengths for a chunked SDS HDF variable.
|
static java.lang.Class |
getClass(int type)
Gets the Java primitive class associated with an HDF type.
|
java.lang.String |
getFilename()
Gets the HDF scientific dataset file name.
|
protected abstract EarthDataInfo |
getGlobalInfo()
Reads the earth data info metadata.
|
protected DataVariable |
getPreviewImpl(int index)
Implementation for the subclass.
|
int |
getSDID()
Gets the HDF scientific dataset ID.
|
static boolean |
getUnsigned(int type)
Determines if the HDF datatype is unsigned.
|
DataVariable |
getVariable(int index)
Creates a data variable object.
|
static int[] |
getVariableDimensions(int sdid,
java.lang.String varName) |
static java.lang.String[] |
getVariableNames(int sdid)
Gets an array of HDF dataset variable names.
|
protected boolean |
readAllMetadata()
Determines if the full set of attributes should be read into the
global EarthDataInfo object and DataVariable objects.
|
canUpdateNavigation, finalize, getAllGrids, getAllVariables, getCoordinateSystems, getDataFormat, getIndex, getInfo, getName, getPreview, getPreview, getRawMetadata, getSceneTime, getSource, getStatistics, getStatisticsVariables, getVariable, getVariables, getVariablesForSystem, putStatistics, setDataProjection, setUnitsMap, updateNavigation
protected HDFReader(HDFWriter writer) throws hdf.hdflib.HDFException, java.io.IOException, java.awt.geom.NoninvertibleTransformException, java.lang.ClassNotFoundException
writer
- the writer to use for reading.hdf.hdflib.HDFException
- if an error occurred in an HDF routine.java.io.IOException
- if an error occurred reading the file metadata.java.awt.geom.NoninvertibleTransformException
- if the earth transform object
could not be initialized.java.lang.ClassNotFoundException
- if the HDF attribute type is unknown.protected HDFReader(java.lang.String file) throws java.io.IOException
file
- the file name to read.java.io.IOException
- if an error opening or reading the file
metadata.public int getSDID()
HDFSD
public java.lang.String getFilename()
HDFSD
getFilename
in interface HDFSD
public static java.lang.String[] getVariableNames(int sdid) throws hdf.hdflib.HDFException, java.lang.ClassNotFoundException
sdid
- the HDF dataset to read.hdf.hdflib.HDFException
- if an error occurred in an HDF routine.java.lang.ClassNotFoundException
- if the HDF attribute type is unknown.protected abstract EarthDataInfo getGlobalInfo() throws hdf.hdflib.HDFException, java.io.IOException, java.awt.geom.NoninvertibleTransformException, java.lang.ClassNotFoundException
hdf.hdflib.HDFException
- if an error occurred in an HDF routine.java.io.IOException
- if an error occurred reading the file metadata.java.awt.geom.NoninvertibleTransformException
- if the earth transform object
could not be initialized.java.lang.ClassNotFoundException
- if the HDF attribute type is unknown.protected boolean readAllMetadata()
public static java.lang.Class getClass(int type) throws java.lang.ClassNotFoundException
type
- the HDF data type.java.lang.ClassNotFoundException
- if a class cannot be found that
matches the HDF type.public static boolean getUnsigned(int type)
type
- the HDF type.public static java.lang.Object getAttribute(int sdid, java.lang.String name) throws hdf.hdflib.HDFException, java.lang.ClassNotFoundException
sdid
- the HDF scientific dataset ID.name
- the attribute name.String
is returned. If the attribute
has one value only, a Java object will be returned wrapping the
primitive type. If the attribute has more than one value, a Java
primitive array is returned.hdf.hdflib.HDFException
- if an error occurred in an HDF routine.java.lang.ClassNotFoundException
- if the HDF attribute type is unknown.public static java.lang.Object getAttributeAsArray(int sdid, java.lang.String name) throws hdf.hdflib.HDFException, java.lang.ClassNotFoundException
sdid
- the HDF scientific dataset ID.name
- the attribute name.hdf.hdflib.HDFException
- if an error occurred in an HDF routine.java.lang.ClassNotFoundException
- if the HDF attribute type is unknown.public static java.lang.Object getAttributeAsArray(int sdid, int index) throws hdf.hdflib.HDFException, java.lang.ClassNotFoundException
sdid
- the HDF scientific dataset ID.index
- the attribute index.hdf.hdflib.HDFException
- if an error occurred in an HDF routine.java.lang.ClassNotFoundException
- if the HDF attribute type is unknown.public static java.lang.Object getAttribute(int sdid, int index) throws hdf.hdflib.HDFException, java.lang.ClassNotFoundException
sdid
- the HDF scientific dataset ID.index
- the attribute index.String
is returned. If the attribute
has one value only, a Java object will be returned wrapping the
primitive type. If the attribute has more than one value, a Java
primitive array is returned.hdf.hdflib.HDFException
- if an error occurred in an HDF routine.java.lang.ClassNotFoundException
- if the HDF attribute type is unknown.public static void getAttributes(int sdid, java.util.List attList, java.util.Map attMap) throws hdf.hdflib.HDFException, java.lang.ClassNotFoundException
sdid
- the HDF scientific dataset or variable ID for reading.attList
- the list of attribute names to store.attMap
- the attribute map for storing attribute values
(modified). If an attribute value cannot be found for the
attribute name, no attribute value is stored.hdf.hdflib.HDFException
- if an error occurred in an HDF routine.java.lang.ClassNotFoundException
- if the HDF attribute type is unknown.public static void getAttributes(int sdid, java.util.Map map, boolean global) throws hdf.hdflib.HDFException, java.lang.ClassNotFoundException
sdid
- the HDF scientific dataset or variable ID for reading.map
- the attribute map.global
- set to true if the HDF attributes are global. If false,
it is assumed that the attributes belong to an HDF variable.hdf.hdflib.HDFException
- if an error occurred in an HDF routine.java.lang.ClassNotFoundException
- if the HDF attribute type is unknown.protected DataVariable getPreviewImpl(int index) throws java.io.IOException
EarthDataReader
getPreviewImpl
in class EarthDataReader
java.io.IOException
EarthDataReader.getPreview(int)
public DataVariable getVariable(int index) throws java.io.IOException
EarthDataReader
getVariable
in class EarthDataReader
index
- the index of the variable to get. Indexing
starts at 0.java.io.IOException
- if the data source had I/O errors.EarthDataReader.getPreview(int)
public static int[] getChunkLengths(int sdsid) throws hdf.hdflib.HDFException
sdsid
- the HDF SDS variable ID.hdf.hdflib.HDFException
- if an HDF error occurred.public void close() throws java.io.IOException
EarthDataReader
close
in class EarthDataReader
java.io.IOException
- if the data source had I/O errors.public static int[] getVariableDimensions(int sdid, java.lang.String varName) throws hdf.hdflib.HDFException
hdf.hdflib.HDFException