Skip to content

Commit ad3a5b7

Browse files
roman/ssc-yaml-bugfix (#1192)
* revise ssc yaml header prefix expectations with catch-all * revise ssc yaml header prefix expectations with catch-all * add newsfrag
1 parent dc3a536 commit ad3a5b7

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

changes/1192.roman.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bugfix for ssc yaml header translations

crds/roman/locate.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,11 @@ def ssc_reference_translations(pfx):
376376
def modified_ssc_yaml_header(header):
377377
"""Modify header dictionary loaded from an SSC YAML reference file
378378
to match CRDS expectations for Roman reference file headers."""
379+
# Identify SSC YAML files by ORIGIN and FILE_FORMAT
379380
if header.get('ROMAN.META.ORIGIN', header.get('META.ORIGIN', None)) == 'IPAC/SSC':
380-
if header.get('FILE_FORMAT', None) == 'YAML':
381-
return {'ROMAN.'+k:v for k, v in header.items() if k.startswith('META.')}, True
382-
return header, True
381+
meta_header = {k:v for k, v in header.items() if k.startswith('ROMAN.META')}
382+
meta_header.update({'ROMAN.'+k:v for k, v in header.items() if k.startswith('META.')})
383+
return meta_header, True
383384
return header, False
384385

385386

@@ -391,7 +392,7 @@ def apply_ssc_conversions(header):
391392
if instr and optelem:
392393
header[f"{pfx}.EXPOSURE.TYPE"] = "_".join([instr.upper(), optelem.upper()])
393394
detector = header.get(f"{pfx}.INSTRUMENT.DETECTOR")
394-
if len(detector.split(",")) == 18:
395+
if instr.lower() == "wfi" and len(detector.split(",")) == 18:
395396
header[f"{pfx}.INSTRUMENT.DETECTOR"] = "N/A" # All detectors
396397
return header
397398

0 commit comments

Comments
 (0)