Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue 202 - Allow SPICE FITS files with missing telemetry #205

Merged
merged 5 commits into from
Jun 8, 2022
Merged
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
1 change: 1 addition & 0 deletions changelog/205.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Allow SPICE FITS reader to handle files with missing telemetry. (`#205 <https://github.com/sunpy/sunraster/pull/205>`__)
nabobalis marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 8 additions & 2 deletions sunraster/instr/spice.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,18 @@ def _read_single_spice_l2_fits(
# Derive names of windows to be read.
if windows is None:
if read_dumbbells:
windows = [hdu.header["EXTNAME"] for hdu in hdulist if dumbbell_label in hdu.header["EXTNAME"]]
windows = [
hdu.header["EXTNAME"]
for hdu in hdulist
if (isinstance(hdu, fits.hdu.image.PrimaryHDU) or isinstance(hdu, fits.hdu.image.ImageHDU))
and dumbbell_label in hdu.header["EXTNAME"]
EdBehn marked this conversation as resolved.
Show resolved Hide resolved
]
else:
windows = [
hdu.header["EXTNAME"]
for hdu in hdulist
if (hdu.header["EXTNAME"] != "VARIABLE_KEYWORDS" and dumbbell_label not in hdu.header["EXTNAME"])
if (isinstance(hdu, fits.hdu.image.PrimaryHDU) or isinstance(hdu, fits.hdu.image.ImageHDU))
and dumbbell_label not in hdu.header["EXTNAME"]
]
dumbbells_requested = [dumbbell_label in window for window in windows]
if any(dumbbells_requested) and not all(dumbbells_requested):
Expand Down