Skip to content

Commit a6a977a

Browse files
committed
add special cases for Mars Odyssey ancillary experimenter notebook products
1 parent 34b2bd9 commit a6a977a

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

pdr/formats/checkers.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,13 @@ def check_special_table_reader(
318318
and name == "TABLE"
319319
):
320320
return True, formats.lp.ancillary_table_loader(fn, fmtdef_dt)
321+
if (
322+
identifiers["DATA_SET_ID"] == "ODY-M-GRS-2-EDR-V1.0"
323+
and identifiers["PRODUCT_TYPE"] == "E_KERNEL"
324+
and ".txt" in fn.lower()
325+
):
326+
return formats.odyssey.grs_e_kernel_loader(name, fn)
327+
321328
return False, None
322329

323330

@@ -501,6 +508,12 @@ def check_special_structure(
501508
return formats.galileo.ssi_redr_structure(
502509
block, name, fn, data, identifiers
503510
)
511+
if (
512+
identifiers["DATA_SET_ID"] == "ODY-M-GRS-2-EDR-V1.0"
513+
and identifiers["PRODUCT_TYPE"] == "E_KERNEL"
514+
and ".txt" in fn.lower()
515+
):
516+
return formats.odyssey.grs_e_kernel_structure()
504517
return False, None
505518

506519

pdr/formats/odyssey.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,34 @@ def map_table_loader(filename, fmtdef_dt):
1414
assert len(table.columns) == len(names), "Mismatched column count"
1515
table.columns = names
1616
return table
17+
18+
def grs_e_kernel_loader(name, fn):
19+
"""
20+
The GRS Experimenter's Notebook products have two "FILE" objects with one
21+
"TIME_SERIES" pointer each. The first object/pointer is for the time series
22+
table, the other is for a .TXT notes file. Because the text file's pointer
23+
has "SERIES" in it, pointer_to_loader() sends it to ReadTable().
24+
25+
This special case reads it with read_text() instead.
26+
27+
HITS
28+
* mars_odyssey
29+
* edr_e_kernel
30+
"""
31+
from pdr.loaders.text import read_text
32+
33+
return True, read_text(name, fn)
34+
35+
def grs_e_kernel_structure():
36+
"""
37+
Handles the same files as grs_e_kernel_loader() above, and is needed to
38+
avoid an error thrown before that special case can be called. Because the
39+
second TIME_SERIES pointer is not actually a table, parse_table_structure()
40+
fails when trying to make a fmtdef.
41+
42+
HITS
43+
* mars_odyssey
44+
* edr_e_kernel
45+
"""
46+
return True, None
47+

0 commit comments

Comments
 (0)