https://github.com/pysat/pysatcdf
Python reader for NASA CDF file format
https://github.com/pysat/pysatcdf
cdf nasa-cdf python python-reader
Last synced: 9 months ago
JSON representation
Python reader for NASA CDF file format
- Host: GitHub
- URL: https://github.com/pysat/pysatcdf
- Owner: pysat
- License: bsd-3-clause
- Created: 2016-02-15T15:23:16.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2024-10-30T20:16:25.000Z (over 1 year ago)
- Last Synced: 2025-01-06T03:36:56.501Z (over 1 year ago)
- Topics: cdf, nasa-cdf, python, python-reader
- Language: C
- Homepage:
- Size: 11 MB
- Stars: 10
- Watchers: 6
- Forks: 8
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# pysatCDF
[](https://pypi.python.org/pypi/pysatcdf)
[](https://github.com/pysat/pysatCDF/actions/workflows/main.yml/badge.svg)
[](https://coveralls.io/github/pysat/pysatCDF?branch=main)
[](https://zenodo.org/badge/latestdoi/51764432)
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.
# Example
```
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()
```
# Testing
pysatCDF has been tested on Mac OS X and Ubuntu 15.04. Support is included
for building on windows via Windows Subsystem for Linux.
# Motivation
Provide simple, robust access to CDF data in Python and simplify
adding instruments to [pysat](https://github.com/pysat/pysat).
# Installation in POSIX compatible environments
Actual CDF loading is performed by the [NASA CDF libraries](http://cdf.gsfc.nasa.gov/html/sw_and_docs.html)
which are included with pysatCDF.
To install pysatCDF
```
git clone https://github.com/rstoneback/pysatCDF.git
cd pysatCDF
python setup.py install
```
# Installing pysatCDF in MacOS
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.
# Installing pysatCDF in Windows
Install the Windows Subsytem for Linux and proceed as per POSIX installation.