Skip to content
Snippets Groups Projects
Commit ea5a3205 authored by Bruce Flynn's avatar Bruce Flynn
Browse files

jpssrdr: support both CrIS and CRIS SCIENCE SDS name

parent 9f921b65
No related branches found
Tags 0.12.1
No related merge requests found
......@@ -131,7 +131,8 @@ def _packets_for_apid(buf, header, apid):
"""
Generate tuples of (PacketTracker, Packet)
"""
t_off = header.pkt_tracker_offset + apid.pkt_tracker_start_idx * c.sizeof(PacketTracker)
t_off = header.pkt_tracker_offset + \
apid.pkt_tracker_start_idx * c.sizeof(PacketTracker)
for idx in range(apid.pkts_received):
tracker = PacketTracker.from_buffer(buf, t_off)
t_off += c.sizeof(PacketTracker)
......@@ -171,10 +172,18 @@ def _generate_packet_datasets(group):
def _find_data_group(fobj, name, sensors=None):
sensors = sensors or ['viirs', 'cris', 'atms']
for sensor in sensors:
group = fobj.get('/All_Data/{}-{}-RDR_All'.format(sensor.upper(), name.upper()))
group = fobj.get(
'/All_Data/{}-{}-RDR_All'.format(sensor.upper(), name.upper()))
if group:
return group
# Some files have CrIS rather than CRIS
if sensor == 'cris':
group = fobj.get(
'/All_Data/{}-{}-RDR_All'.format('CrIS', name.upper()))
if group:
return group
def _find_science_group(fobj):
return _find_data_group(fobj, 'SCIENCE')
......@@ -391,11 +400,12 @@ def spacecraft_to_l0(satellite, rdrs, start, end):
def rdr_to_l0(satellite, rdrs, start, end):
filepaths = []
for product, filepath in {f.split('_', 1)[0]:f for f in rdrs}.items():
for product, filepath in {f.split('_', 1)[0]: f for f in rdrs}.items():
if 'RNSCA' in product:
filepaths += spacecraft_to_l0(satellite, [filepath], start, end)
if 'RVIRS' in product:
filepaths.append(viirs_sci_to_l0(satellite, [filepath], start, end))
filepaths.append(viirs_sci_to_l0(
satellite, [filepath], start, end))
if 'RCRIS' in product:
filepaths.append(cris_sci_to_l0(satellite, [filepath], start, end))
if 'RATMS' in product:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment