-
Notifications
You must be signed in to change notification settings - Fork 0
metadata oops updates #190
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,7 +30,7 @@ def limb_altitude(self, event_key, zmin=None, zmax=None, scaled=False): | |||||||
| radius = body.surface.radii.max() | ||||||||
| if zmin is not None: | ||||||||
| zmin = zmin * radius | ||||||||
| if zmin is not None: | ||||||||
| if zmax is not None: | ||||||||
| zmax = zmax * radius | ||||||||
|
|
||||||||
| key = ('limb_altitude', event_key, zmin, zmax) | ||||||||
|
|
@@ -159,7 +159,7 @@ def limb_latitude(self, event_key, lat_type='centric'): | |||||||
| return self.register_backplane(key, latitude) | ||||||||
|
|
||||||||
| #=============================================================================== | ||||||||
| def limb_clock_angle(self, event_key): | ||||||||
| def limb_clock_angle(self, event_key, zmin=None, zmax=None, scaled=False): | ||||||||
| """Angular location around the limb, measured clockwise from the projected | ||||||||
| north pole. | ||||||||
|
|
||||||||
|
|
@@ -168,8 +168,16 @@ def limb_clock_angle(self, event_key): | |||||||
| limb_altitude backplane key, in which case this | ||||||||
| backplane inherits the mask of the given backplane | ||||||||
| array. | ||||||||
| zmin lower limit on altitude; lower values are masked. | ||||||||
jnspitale marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| zmax upper limit on altitude. | ||||||||
| scaled if True, zmin and zmax are in units of the maximum body radius. | ||||||||
| """ | ||||||||
|
|
||||||||
| # Get the altitude backplane | ||||||||
| altitude_key = ('limb_altitude', event_key, zmin, zmax) | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused variable. The Apply this diff: - # Get the altitude backplane
- altitude_key = ('limb_altitude', event_key, zmin, zmax)
- altitude = limb_altitude(self, event_key, zmin=zmin, zmax=zmax, scaled=scaled)
+ # Get the altitude backplane
+ altitude = limb_altitude(self, event_key, zmin=zmin, zmax=zmax, scaled=scaled)📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.14.8)177-177: Local variable Remove assignment to unused variable (F841) 🤖 Prompt for AI Agents |
||||||||
| altitude = limb_altitude(self, event_key, zmin=zmin, zmax=zmax, scaled=scaled) | ||||||||
|
|
||||||||
| # Create the clock angle backplane | ||||||||
| (event_key, | ||||||||
| backplane_key) = self._event_and_backplane_keys(event_key, LIMB_BACKPLANES, | ||||||||
| default='LIMB') | ||||||||
|
|
@@ -194,8 +202,13 @@ def limb_clock_angle(self, event_key): | |||||||
| event = polar_surface.apply_coords_to_event(event, obs=self.obs_event, | ||||||||
| axes=2, | ||||||||
| derivs=self.ALL_DERIVS) | ||||||||
| clock_angle = event.coord2 | ||||||||
|
|
||||||||
| # copy altitude mask | ||||||||
| if np.any(altitude.mask): | ||||||||
| clock_angle = clock_angle.remask_or(altitude.mask) | ||||||||
|
|
||||||||
| return self.register_backplane(key, event.coord2) | ||||||||
| return self.register_backplane(key, clock_angle) | ||||||||
|
|
||||||||
| ################################################################################ | ||||||||
|
|
||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ | |
| import pdsparser | ||
| import oops | ||
|
|
||
| from oops.hosts import pds3 | ||
| from oops.hosts.galileo import Galileo | ||
|
|
||
| from filecache import FCPath | ||
|
|
@@ -42,7 +41,7 @@ def from_file(filespec, | |
| filespec = FCPath(filespec) | ||
|
|
||
| # Load the PDS label | ||
| label = pds3.get_label(filespec) | ||
| label = pdsparser.PdsLabel.from_file(filespec).as_dict() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should change this to: I think this is cleaner because it makes the Also,
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I disagree. The code is indeed bad here, as the very next line retrieves the file into local_path prior to calling vicar.VicarImage.from_file(), but I would argue for removing that and not even referencing a local file. I view filecache as allowing our code to access local and remote files seamlessly, and the only reason for explicitly retrieving a file in the calling code is because it is intended to be used with a package that doesn't support filecache. We could have simply converted file specs to FCPaths and the original code would have worked fine if the Vicar and various pds modules had supported filecache at the time. I would prefer to remove all explicit retrieve() operations that are no longer necessary.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. Except in unusual circumstances the goal is to never have a "retrieve" in any code. It's always handled by the libraries. Otherwise there's no point in having made all of our libraries FCPath-compatible. |
||
|
|
||
| # Load the data array | ||
| local_path = filespec.retrieve() | ||
|
|
@@ -211,6 +210,8 @@ def __init__(self, meta_dict): | |
| self.target = meta_dict['TARGET_NAME'] | ||
|
|
||
| # Telemetry mode | ||
| if 'TELEMETRY_FORMAT_ID' not in meta_dict: | ||
| meta_dict['TELEMETRY_FORMAT_ID'] = 'NONE' | ||
| self.mode = meta_dict['TELEMETRY_FORMAT_ID'] | ||
|
|
||
| # Window | ||
|
|
@@ -366,9 +367,12 @@ def initialize(planets=None, asof=None, | |
| SSI.fovs['HCM'] = fov_full # Inference based on inspection | ||
| # hmmm, actually C0248807700R.img is 800x200 | ||
| # maybe this is just a cropped full fov | ||
| SSI.fovs['NONE'] = fov_full # Inference based on inspection | ||
|
|
||
| # Construct the SpiceFrame | ||
| _ = oops.frame.SpiceFrame("GLL_SCAN_PLATFORM") | ||
| # SSI images are spaced as closely as 1 unit in the file name, which | ||
| # corresponds to 80 clock ticks. Therefore, we use a tolerance of +/-40 | ||
| _ = oops.frame.SpiceType1Frame("GLL_SCAN_PLATFORM", -77, 40) | ||
|
|
||
| # Load kernels | ||
| Galileo.load_kernels() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider keyword-only parameters for boolean flags.
The
scaledparameter is a boolean flag with a default value. Python style guidelines suggest making such parameters keyword-only to improve call-site clarity and prevent accidental positional boolean arguments.Apply this diff:
This change would also apply to
limb_altitudeat line 16 for consistency:📝 Committable suggestion
🧰 Tools
🪛 Ruff (0.14.8)
162-162: Boolean default positional argument in function definition
(FBT002)
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeRabbit's proposed change will not work, because
evaluateneeds to be able to take a backplane key, which is a tuple, and pass its values as inputs to this function. As a result, backplane functions can only take positional arguments.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markshowalter, thank you for the clarification! I understand now—since
evaluateunpacks backplane keys (tuples) as positional arguments when calling these functions, keyword-only parameters would break that mechanism. I've noted this constraint for future reviews.✏️ Learnings added