Skip to content

Commit

Permalink
bugfix/asdf-handler (#1012)
Browse files Browse the repository at this point in the history
* try/except asdf setval to isolate errors

* comment out getval and setval methods entirely

* uncomment asdf methods, fix get_observatory call

* update changelog

* fix pr number
  • Loading branch information
alphasentaurii authored Nov 8, 2023
1 parent 7e39e77 commit d1b6ab5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
11.17.9 (unreleased)
====================

General
-------

- bugfix: get observatory metadata inside asdf file handler [#1012]


11.17.8 (2023-11-07)
====================

Expand Down
9 changes: 4 additions & 5 deletions crds/io/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,12 @@ def get_observatory(filepath, original_name=None):
except KeyError:
pass
elif original_name.endswith(".asdf"):
try:
import asdf
with asdf.open(filepath) as handle:
observatory = handle["meta"]["telescope"]
except KeyError:
import asdf
with asdf.open(filepath) as handle:
if "roman" in handle.keys():
observatory = "roman"
else:
observatory = handle["meta"]["telescope"]
elif original_name.endswith((".yaml", ".json", ".text", ".txt")):
return "jwst"
return observatory.lower()
Expand Down

0 comments on commit d1b6ab5

Please sign in to comment.