CDFHandler¶
- class swxsoc.util.io.CDFHandler[source]¶
Bases:
SWXIOHandlerA concrete implementation of SWXIOHandler for handling heliophysics data in CDF format.
This class provides methods to load and save heliophysics data from/to a CDF file.
Methods Summary
load_data(file_path)Load heliophysics data from a CDF file.
save_data(data, file_path[, filename])Save heliophysics data to a CDF file.
Methods Documentation
- load_data(file_path: Path) Tuple[dict, dict, NDCollection, dict][source]¶
Load heliophysics data from a CDF file.
- Parameters:
file_path (
pathlib.Path) – A fully specified file path to the CDF file to load.- Returns:
timeseries (
dict[~astropy.time.TimeSeries]) – An instance ofTimeSeriescontaining the loaded data.support (
dict[astropy.nddata.NDData]) – Non-record-varying data contained in the filespectra (
ndcube.NDCollection) – Spectral or High-dimensional measurements in the loaded data.meta (
dict) – Global metadata attributes.
- save_data(data, file_path: Path, filename: str = None)[source]¶
Save heliophysics data to a CDF file.
- Parameters:
data (
swxsoc.swxdata.SWXData) – An instance ofSWXDatacontaining the data to be saved.file_path (
pathlib.Path) – A fully specified path to the directory where the CDF file is to be saved.filename (
str, optional) – Custom filename for the output file (including .cdf extension). If not provided, uses the Logical_file_id from metadata.
- Returns:
path (
pathlib.Path) – A path to the saved file.