Skip to main content
https://img.shields.io/pypi/v/pyistp.svg Documentation Status

An easy to use loader for ISTP-compliant CDF and NetCDF files, as commonly distributed by CDAWeb, AMDA and other space-physics data archives.

Rather than exposing raw variables, PyISTP reads the ISTP metadata conventions (VAR_TYPE, DEPEND_n, *_PTR, LABLAXIS, …) and hands you each data variable together with its resolved axes (time and other support variables), labels and attributes.

Features

  • Loads ISTP-compliant CDF files (via pycdfpp by default, or spacepy).

  • Loads ISTP-compliant NetCDF files (via netCDF4).

  • Reads from a file path or directly from an in-memory bytes buffer (handy for data fetched over HTTP).

  • Supports a separate master/skeleton file holding the metadata while the values come from the data file.

  • Automatically resolves DEPEND_n support variables into axes, with fallback to the master file.

  • Converts CDF epoch types and NetCDF CF/Unix time variables to numpy.datetime64[ns].

  • Lazily materializes variable values (the array is read on first access).

  • Tolerates many non-ISTP-compliant files (CDAWeb, Cluster/CSA) with warnings rather than failures.

Installation

pip install pyistp

The default CDF backend is pycdfpp; spacepy is used as a fallback if available. NetCDF support requires netCDF4. To force a specific CDF backend, set the PYISTP_CDFLIB environment variable to pycdfpp or spacepy.

Usage

Load a file and inspect its data variables:

import pyistp

istp = pyistp.load(file="wi_k0_mfi_20220101_v01.cdf")

istp.data_variables()          # -> ['BGSEc', 'BF1', 'PGSM', ...]
istp.attributes()              # global attribute names

var = istp.data_variable("BGSEc")
var.values                     # numpy array of values (read lazily)
var.axes[0].values             # the time axis (numpy.datetime64[ns])
var.attributes                 # variable attributes
var.labels                     # component labels, if any

Load directly from a buffer, for instance data fetched over HTTP:

import requests, pyistp

raw = requests.get(
    "https://spdf.gsfc.nasa.gov/pub/data/themis/thc/l2/efi/2020/"
    "thc_l2_efi_20200101_v01.cdf").content
istp = pyistp.load(buffer=raw)

var = istp.data_variable("thc_eff_dot0_gsm")
import matplotlib.pyplot as plt
plt.plot(var.axes[0].values, var.values)

Use a separate master/skeleton file for the metadata:

istp = pyistp.load(file="data.cdf", master_file="skeleton.cdf")
# or from buffers:
istp = pyistp.load(buffer=data_bytes, master_buffer=skeleton_bytes)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyistp-0.9.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyistp-0.9.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file pyistp-0.9.0.tar.gz.

File metadata

  • Download URL: pyistp-0.9.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.21

File hashes

Hashes for pyistp-0.9.0.tar.gz
Algorithm Hash digest
SHA256 30712fa0bf832d108d4bb0a015950c17e735a3747ecf3b44be4796e9a7162a16
MD5 8d7191494f219a3d5faf3f48d3d68d62
BLAKE2b-256 b396183f8ee806fa8bbe96eab4b60f62a60a33f6c536e4f7e8e28a92b82f1679

See more details on using hashes here.

File details

Details for the file pyistp-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: pyistp-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.21

File hashes

Hashes for pyistp-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb5e8df2d067aa9f3d6dfbf99b98cecf4b766cedf1273b732d824a3ac5961e14
MD5 bb079ac63b5e7a5495d12745100e696f
BLAKE2b-256 216a14c83523ab6c33a3f150ecbc2705717d175c0d9004ab374fc994b8e69822

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.3

2 files

0.7.2

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page