Skip to main content

Python ISTP loader

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.

Metadata

Release files for pyistp 0.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyistp 0.9.3
File Size Uploaded Provenance Actions
pyistp-0.9.3.tar.gz 13.2 kB Without provenance Details for pyistp-0.9.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyistp 0.9.3
File Interpreter ABI Platform Actions
pyistp-0.9.3-py3-none-any.whl Python 3 none any Details for pyistp-0.9.3-py3-none-any.whl

Total release size: 28.8 kB

Release files / pyistp-0.9.3.tar.gz

Download URL pyistp-0.9.3.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0a6960591f5f225191978b765f21c192d4a53e8f6363f184e2ea6646b98bfc56
BLAKE2b-256 checksum
How to use checksums
3baa0b62a1fe11ed6712c707cd4989cc7060bed3cf67a4fdb9535797aeb82edd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / pyistp-0.9.3-py3-none-any.whl

Download URL pyistp-0.9.3-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54e970f42a3aa07443579dc44e43f1dea3a528f79e7f7512cc74bb60f37aabb4
BLAKE2b-256 checksum
How to use checksums
d1ffa4fe7a9a8b9f06ee3a9a025fbd647789ae816628174ee7e176ac340cb9b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for pyistp 0.9.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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