Skip to content

Instantly share code, notes, and snippets.

@jtniehof
Last active July 1, 2022 13:29
Show Gist options
  • Save jtniehof/fad5948563fddd28c0f56fbee956643c to your computer and use it in GitHub Desktop.
Save jtniehof/fad5948563fddd28c0f56fbee956643c to your computer and use it in GitHub Desktop.
Example of loading CDF file into a SpaceData object
# Download a file from http://research.ssl.berkeley.edu/data/psp/data/sci/fields/l2/mag_SC_1min/
import spacepy.pycdf
with spacepy.pycdf.CDF('psp_fld_l2_mag_SC_1min_20200801_v01.cdf') as f:
alldata = f.copy()
print(alldata.keys())
print(alldata.attrs)
print(alldata['psp_fld_l2_mag_SC_1min'][:5])
print(alldata['psp_fld_l2_mag_SC_1min'].attrs)
alldata.tree()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment