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

Allow ale formatter to proceed with no velocities specified for instrument/sun position #614

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ release.
- Apollo Metric drivers, tests, and data [#533](https://github.com/DOI-USGS/ale/pull/533)
- Rosetta Virtis drivers, tests, and data [#520](https://github.com/DOI-USGS/ale/pull/520)
- Added compress and decompress ISD functions and added --compress flag to isd_generate[#604](https://github.com/DOI-USGS/ale/issues/604)
- Added the ability to generate ISDs with no velocities specified for instrument/sun position [#614](https://github.com/DOI-USGS/ale/issues/614)

### Changed
- Changed how push frame sensor drivers compute the `ephemeris_time` property [#595](https://github.com/DOI-USGS/ale/pull/595)
Expand Down
13 changes: 9 additions & 4 deletions ale/formatters/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ def to_isd(driver):
instrument_position['spk_table_original_size'] = len(times)
instrument_position['ephemeris_times'] = times
# Rotate positions and velocities into J2000 then scale into kilometers
velocities = j2000_rotation.rotate_velocity_at(positions, velocities, times)/1000
# If velocities are provided, then rotate and add to ISD
if velocities is not None:
velocities = j2000_rotation.rotate_velocity_at(positions, velocities, times)/1000
instrument_position['velocities'] = velocities
positions = j2000_rotation.apply_at(positions, times)/1000
instrument_position['positions'] = positions
instrument_position['velocities'] = velocities
instrument_position["reference_frame"] = j2000_rotation.dest

meta_data['instrument_position'] = instrument_position
Expand All @@ -191,10 +193,13 @@ def to_isd(driver):
sun_position['spk_table_original_size'] = len(times)
sun_position['ephemeris_times'] = times
# Rotate positions and velocities into J2000 then scale into kilometers
velocities = j2000_rotation.rotate_velocity_at(positions, velocities, times)/1000
# If velocities are provided, then rotate and add to ISD
if velocities is not None:
velocities = j2000_rotation.rotate_velocity_at(positions, velocities, times)/1000
sun_position['velocities'] = velocities

positions = j2000_rotation.apply_at(positions, times)/1000
sun_position['positions'] = positions
sun_position['velocities'] = velocities
sun_position["reference_frame"] = j2000_rotation.dest

meta_data['sun_position'] = sun_position
Expand Down
Loading