Self-contained Python reader for NASA CDF file format
Uses standard and extended Fortran CDF interfaces to load Common Data Format (CDF) files into Python.
import pysatCDF
with pysatCDF.CDF(filename) as cdf:
# All variable data loaded into dictionary in .data
cdf.data
data = cdf.data[name]
# Attributes dictionary
cdf.meta
attribute = cdf.meta[name][attr_name]
# CDF variable information available by name
cdf[name]
# Data access similar to other packages
data = cdf[name][...]
attribute = cdf[name].attrs[attr_name]
# Export data to pysat data and metadata format
data, meta = cdf.to_pysat()
pysatCDF has been tested on Mac OS X and Ubuntu 15.04. Support is included for building on windows via Windows Subsystem for Linux.
Provide simple, robust access to CDF data in Python and simplify adding instruments to pysat.
Actual CDF loading is performed by the NASA CDF libraries which are included with pysatCDF.
To install pysatCDF
git clone https://github.com/rstoneback/pysatCDF.git
cd pysatCDF
python setup.py install
MacOS does not ship with a Fortran compiler. One method for getting a suitable build environment is to use brew.
brew install gcc
and then install pysatCDF as normal.
Install the Windows Subsytem for Linux and proceed as per POSIX installation.