Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/187.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fix metadata key mismatch between ``SpectrogramFactory`` and ``RFSSpectrogram``.
The factory stored CDF global attributes under ``"cdf_globals"`` but ``RFSSpectrogram.level``
and ``RFSSpectrogram.version`` expected ``"cdf_meta"``, causing a ``KeyError`` when accessing
these properties on spectrograms created from real CDF files.
8 changes: 4 additions & 4 deletions radiospectra/spectrogram/spectrogram_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def _read_cdf(file):
freqs = freqs[0, :] << u.Hz
data = data.T << u.Unit("Volt**2/Hz")
meta = {
"cdf_globals": cdf_globals,
"cdf_meta": cdf_globals,
"detector": detector,
"instrument": "FIELDS/RFS",
"observatory": "PSP",
Expand Down Expand Up @@ -458,7 +458,7 @@ def _read_cdf(file):
data = np.squeeze(data).T << sfu
detector = cdf_globals.get("Instrument", [""])[0].split(">")[0]
meta = {
"cdf_globals": cdf_globals,
"cdf_meta": cdf_globals,
"detector": detector,
"instrument": "RPW",
"observatory": "SOLO",
Expand Down Expand Up @@ -561,7 +561,7 @@ def _read_cdf(file):
res = []
if np.any(agc1):
meta1 = {
"cdf_globals": cdf_globals,
"cdf_meta": cdf_globals,
"detector": "RPW-AGC1",
"instrument": "RPW",
"observatory": "SOLO",
Expand All @@ -574,7 +574,7 @@ def _read_cdf(file):
res.append((specs[0].T, meta1))
if np.any(agc2):
meta2 = {
"cdf_globals": cdf_globals,
"cdf_meta": cdf_globals,
"detector": "RPW-AGC2",
"instrument": "RPW",
"observatory": "SOLO",
Expand Down