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

orbit type when orbit_file_path is a list #71

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Changes from all 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
33 changes: 23 additions & 10 deletions src/rtc/h5_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def create_hdf5_file(product_id, output_hdf5_file, orbit, burst, cfg,

# save orbit
orbit_group = hdf5_obj.require_group('/metadata/orbit')
save_orbit(orbit, orbit_group, os.path.basename(cfg.orbit_file_path))
save_orbit(orbit, orbit_group, cfg.orbit_file_path)
return hdf5_obj


Expand All @@ -301,15 +301,28 @@ def save_orbit(orbit, orbit_group, orbit_file_path):
'referenceEpoch',
data=np.string_(orbit.reference_epoch.isoformat()))

# Orbit source/type
if 'RESORB' in orbit_file_path:
orbit_type = 'RES restituted orbit'
elif 'POEORB' in orbit_file_path:
orbit_type = 'POE precise orbit'
else:
orbit_type = 'Undefined'

d = orbit_group.require_dataset("orbitType", (), "S25",
# Orbit source/type
orbit_type = 'Undefined'
if isinstance(orbit_file_path, str):
orbit_file_basename = os.path.basename(orbit_file_path)
if 'RESORB' in orbit_file_basename:
orbit_type = 'RES restituted orbit'
elif 'POEORB' in orbit_file_basename:
orbit_type = 'POE precise orbit'

elif isinstance(orbit_file_path, list):
orbit_type_list = []
for individual_orbit_file in orbit_file_path:
if 'RESORB' in individual_orbit_file:
orbit_type_individual = 'RES restituted orbit'
elif 'POEORB' in individual_orbit_file:
orbit_type_individual = 'POE precise orbit'
else:
orbit_type_individual = 'Undefined'
orbit_type_list.append(orbit_type_individual)
orbit_type = '; '.join(orbit_type_list)

d = orbit_group.require_dataset("orbitType", (), "S64",
data=np.string_(orbit_type))
d.attrs["description"] = np.string_(
"Type of orbit file used in processing")
Expand Down
Loading