HDF4¶
pansat.formats.hdf4¶
This module provides a wrapper for the pyhdf package to simplify reading
of HDF4 files. The main interface to read a HDF4 file is implemented by the
HDF4File class. The Dataset and VData classes represent the types
of variables that a HDF4 file contains.
Example
With the HDF4File class reading HDF4 files and accessing their variables is
as simple as shown below:
file = HDF4File("file.hdf")
print(file.variables) # Print all variables in file.
data = file.variable_1[:] # Read data from variable named `variable_1`
-
class
pansat.formats.hdf4.Dataset(file, name, dimensions, shape, hdf_type, index)¶ Class representing HDF4 Datasets, i.e. numeric data that is stored as multi-dimensional array and accessed through the SD interface.
-
file¶ Weak reference to file object required for data access.
- Type
weakref
-
name¶ The name of the dataset.
- Type
str
-
dimensions¶ Tuple containing the variable names of the dimensions holding the dimensions of the dataset.
- Type
tuple
-
shape¶ Tuple containing the shape of the dataset.
- Type
tuple
-
hdf_type¶ Integer representing the HDF-internal type of the dataset
- Type
int
-
index¶ Integer representing the HDF-internal index of the dataset.
- Type
int
-
__getitem__(*args)¶ Selects datasets from file and forwards call to the returned dataset object.
-
__init__(file, name, dimensions, shape, hdf_type, index)¶ Initialize self. See help(type(self)) for accurate signature.
-
__repr__()¶ Return repr(self).
-
__str__()¶ Return str(self).
-
__weakref__¶ list of weak references to the object (if defined)
-
-
class
pansat.formats.hdf4.HDF4File(path)¶ Simplified interface for reading HDF4 files. It combines the SD and VS low-level interfaces.
-
__getattribute__(name)¶ Return getattr(self, name).
-
__init__(path)¶ Initialize self. See help(type(self)) for accurate signature.
-
__repr__()¶ Return repr(self).
-
__weakref__¶ list of weak references to the object (if defined)
-
property
variables¶ Names of the variables available in this file.
-
-
class
pansat.formats.hdf4.VData(file, name, cls, reference, n_records, n_fields, n_attributes, size, tag, interlace)¶ Class representing VData objects, i.e. numeric data that is stored in table format in an HDF file and accessed through the VS interface.
-
file¶ Weak reference to file object required for data access.
- Type
weakref
-
name¶ The name of the attribute
- Type
str
-
cls¶ The attribute class
- Type
str
-
reference¶ Reference number identifying the vdata object.
- Type
int
-
n_records¶ The number of records, i.e. rows, of the data table.
- Type
int
-
n_fields¶ The number of fields, i.e. columns, of the data table.
- Type
int
-
n_attributes¶ The number of attributes.
- Type
int
-
size¶ Size of a single record (row) in bytes.
- Type
int
-
tag¶ The vdata tag number.
- Type
int
-
interlace¶ The vdata interlace mode.
- Type
int
-
__getitem__(*args)¶ Selects datasets from file and forwards call to the returned vdata object.
-
__init__(file, name, cls, reference, n_records, n_fields, n_attributes, size, tag, interlace)¶ Initialize self. See help(type(self)) for accurate signature.
-
__repr__()¶ Return repr(self).
-
__str__()¶ Return str(self).
-
__weakref__¶ list of weak references to the object (if defined)
-