API reference
ccplot.hdf
class HDF(filename, encoding=’utf-8’, mode=None)
This is a class for reading HDF files. The class supports reading of:
- datasets (SDS)
- attributes
- VData
The constructor accepts a filename, text encoding and mode. Mode signifies
if the file should be opened in a binary or text mode: None (automatic),
binary
(binary mode) or text
(text mode). If mode is None, it is equivalent
to binary
if the type of filename is bytes and text
if the type is str.
The file can be closed with HDF.close(), or by using the Context Manager interface:
Reading datasets and Vdata
Datasets and Vdata are accessible as dictionary items of the HDF class instance:
When accessing datasets, an instance of Dataset class is returned. This instance is turned into a numpy array on index subsetting:
Listing datasets
A list of datasets can retrieved with HDF.keys():
Attributes
File and dataset attributes are accessible as HDF.attributes and Dataset.attributes, respectively:
ccplot.hdfeos
class HDFEOS(filename, encoding=’utf-8’, mode=None)
This is a class for reading HDFEOS-2 files. The class supports reading of:
- swaths
- datasets
- attributes
The constructor accepts a filename, text encoding and mode. Mode signifies
if the file should be opened in a binary or text mode: None (automatic),
binary
(binary mode) or text
(text mode). If mode is None, it is equivalent
to binary
if the type of filename is bytes and text
if the type is str.
The file can be closed with HDFEOS.close(), or by using the Context Manager interface:
Reading swath and datasets
Swaths are available as dictionary items of the HDFEOS instance:
When accessing swaths, an instance of Swath class is returned.
Datasets are available as dictionary items of a swath:
When accessing datasets, an instance of Dataset class is returned. This instance is turned into a numpy array on index subsetting:
Listing swaths and datasets
A list of swaths can retrieved with HDFEOS.keys():
A list of datasets can be retrieved with Swath.keys():
Attributes
Attributes are accessible as HDFEOS.attributes, Swath.attributes and Dataset.attributes:
ccplot.algorithms
interp2d_12(data, X, Z, x1, x2, nx, z1, z2, nz)
Interpolate 2D data array distributed on coordinates X and Z on a regular grid given by (x1, x2, nx) and (z1, z2, nz).
data(N, M)
is a 2D float32 array of data values.X(N)
is a 1D float32 array of x-coorinates of data points.Z(N, M)
is a 2D float32 array of z-coordinates of data points.(x1, x2, nx)
define start, end and spacing of the regular grid in the x-direction.(z1, x2, nz)
define start, end and spacing of the regular grid in the z-direction.
The interpolation is done by averaging all data points affecting a single element of the regular grid. When the resolution of the regular grid is greater than the resolution of data, this is equivalent to nearest-neighbor interpolation.
ccplot.utils
calipso_time2dt(time)
Convert float in format yymmdd.ffffffff
to datetime.
cloudsat_time2dt(time, start_time)
Convert time
in seconds since start_time
(datetime instance) to datetime.
cmap(filename)
Load ccplot colormap from file filename
. Return a dictionary with keys:
colors(N, 4)
- array of RGBA values of colorsbounds(M)
- array of data value boundariesticks(K)
- array of tick valuesunder(4)
- color of values below low threshold (RGBA)over(4)
- color of values above high threshold (RGBA)bad(4)
- color of missing or bad values (RGBA)
RGBA values are represented as integers between 0 and 255.