Closed AustinSanders closed 2 months ago
@AustinSanders What issues are you seeing w.r.t. "deserializing from JSON / ISD". I think we could change this to only write the velocities out if they exist. Basically moving instrument_position['velocities'] = velocities
into the if
block and remove the else
section.
Since USGSCSM uses ALE for reading, and ALE already has code to adjust for missing velocities (https://github.com/DOI-USGS/ale/blob/main/src/Util.cpp#L582), I think this isn't API breaking.
@AustinSanders What issues are you seeing w.r.t. "deserializing from JSON / ISD". I think we could change this to only write the velocities out if they exist. Basically moving
instrument_position['velocities'] = velocities
into theif
block and remove theelse
section.
Specifying an empty array for velocities results in a json error along the lines of "requires data type of 'array,' but got 'null.'" The driver succeeds and prints an ISD (with verbose on), but the camera instantiation fails later in the process.
I think excluding velocities from the ISD will work (by removing the 'else' as you suggested), I just wasn't sure what would be a better solution to represent "no velocities."
-- edit --
Tested with no velocities key written, and it works fine with the Apollo Pan driver, which was the test case that was failing previously.
That makes sense! Most of the cases for "no velocities" in ISIS and USGSCSM/ALE expects there to be no "velocities" keyword in the ISD
@AustinSanders Could this also get a changelog entry?
Overview
ISIS allows states to be created with no velocities. This can be seen in InstrumentPosition and SunPosition tables, and there exists a "hasVelocity" function to test if velocities are present.
The ALE formatter does not currently allow states without velocities. This precludes the creation of drivers for ApolloPan, because ApolloPanInit creates tables that do not contain velocities.
Potential Issue
Ideally, the velocities that are written to the ISD would be empty lists, but this causes issues when deserializing from JSON / ISD. The current workaround is to create np.zeros arrays that match the shape of the positions in the table. I'm not sure if specifying velocity of 0 will have side effects. I suspect that, since this was not previously supported, it won't break anything that exists, but I'm not sure of the validity of any results using the new output.
Licensing
This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words: