ccplot

CloudSat and CALIPSO plotting tool

API Reference

ccplot.hdf

class HDF

This is a class for reading HDF files. The class supports reading of:

The constructor accepts the filename as its argument:

from ccplot.hdf import HDF
product = HDF('CAL_LID_L1-ValStage1-V3-02.2013-01-01T11-55-23ZN.hdf')

The file can be closed with HDF.close(), but the class also provides Context Manager interface:

with HDF('CAL_LID_L1-ValStage1-V3-02.2013-01-01T11-55-23ZN.hdf') as product:
    # Work with product.

Reading datasets and Vdata

Datasets and Vdata are available as dictionary items of the class instance:

lat = product['Latitude']
print lat[0]
--> [ 72.14601898]
metadata = product['metadata']
print metadata['Product_ID']
--> L1_LIDAR_Science

When accessing datasets, an instance of Dataset class is returned. This instance is turned into a numpy array on index subsetting:

type(lat)
--> <class 'hdf.Dataset'>
type(lat[::])
--> <type 'numpy.ndarray'>

Listing datasets

A list of datasets can retrieved with HDF.keys():

print "\n".join(product.keys())
--> Profile_Time
    Profile_UTC_Time
    Profile_ID
    Land_Water_Mask
    [...]
    Subsolar_Longitude
    metadata

Attributes

Attributes are available as HDF.attributes and Dataset.attributes:

print lat.attributes
--> {u'units': u'degrees', u'valid_range': u'-90.0 ... 90.0', u'fillvalue': -9999.0, u'format': u'Float_32'}
print product.attributes.keys()
--> [u'coremetadata', u'archivemetadata']
print product.attributes['coremetadata']
--> GROUP                  = INVENTORYMETADATA
    [...]
    END_GROUP              = INVENTORYMETADATA

    END

ccplot.hdfeos

class HDFEOS

This is a class for reading HDFEOS-2 files. The class supports reading of:

The constructor accepts the filename as its argument:

from ccplot.hdfeos import HDFEOS
product = HDFEOS('2013119200420_37263_CS_2B-GEOPROF_GRANULE_P_R04_E06.hdf')

The file can be closed with HDFEOS.close(), but the class also provides Context Manager interface:

with HDFEOS('2013119200420_37263_CS_2B-GEOPROF_GRANULE_P_R04_E06.hdf') as product:
    # Work with product.

Reading swath and datasets

Swaths are available as dictionary items of the HDFEOS instance:

sw = product['2B-GEOPROF']

Datasets are available as dictionary items of a swath:

lat = sw['lat']
print lat[0]
--> -64.9139

When accessing datasets, an instance of Dataset class is returned. This instance is turned into a numpy array on index subsetting:

type(lat)
--> <class 'hdfeos.Dataset'>
type(lat[::])
--> <type 'numpy.ndarray'>

Attributes

Attributes are available as HDFEOS.attributes, Swath.attributes and Dataset.attributes:

print product.attributes.keys()
--> [u'HDFEOSVersion', u'StructMetadata.0']
print sw.attributes['start_time']
--> 20130429203541
print sw['Radar_Reflectivity'].attributes['long_name']
--> Radar Reflectivity Factor

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).

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:

RGBA values are represented as integers between 0 and 255.