spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
147 stars 58 forks source link

Read master CDFs in pytplot/cdf_to_tplot #349

Closed jameswilburlewis closed 1 year ago

jameswilburlewis commented 1 year ago

This will probably fix some cases where data cdfs are missing attributes, but the master cdfs at SPDF are corrected. See issue https://github.com/spedas/pyspedas/issues/346, for example.

Master CDFs for SPDF holdings are at https://cdaweb.gsfc.nasa.gov/pub/software/cdawlib/0MASTERS/ (all in one directory). Naming convention at the filename level follows the data CDFs, but with '00000000' in the date/time field.

The cleanest implementation is probably for each load routine to download the master CDF (if requested by keyword), then prepend the master CDF file path to the list of filenames to be passed to cdf_to_tplot. cdf_to_tplot may not need any changes at all for this to work.

In certain cases, e.g. Cluster, the master CDFs might need to be downloaded from a different source than the data CDFs.

jameswilburlewis commented 1 year ago

Sadly, the "prepend master CDF trick' doesn't appear to work in pytplot, see https://github.com/MAVENSDC/PyTplot/issues/170 . cdf_to_tplot should probably have a lot more info/debug logging.

jameswilburlewis commented 1 year ago

cdf_to_tplot now takes a mastercdf keyword, which is a local path to the appropriate master CDF file.