Repository navigation
CLI: fix SPICE table print issue - #370
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Add regression coverage for path-valued table output and move normalization outside the per-column loop to avoid repeated work.
1 open issue
What changed in this PR
This pull request fixes CLI table rendering for SPICE query results by normalizing returned paths to filenames before output.
Changes:
- Falls back from
file_pathtofile_name. - Uses
Path(...).nameto display filename-only values. - Applies normalized filenames consistently across query table types.
| File | Description |
|---|---|
imap_data_access/cli.py |
Normalizes query result paths and renders consistent filename-only values. |
Review effort: Lite
40afc37 to
132aebb
Compare
|
This looks good to me, but I wonder whether the existing behavior (showing the category of spice kernel via the parent directory) is at all desired. Curious to hear from @tmplummer. |
|
I remember bringing this up during a telecon and someone said it was a bug, which is why I had it in my radar to fix it at some point. But I don't recall who it was, so I'll wait for some input from other developers before merging. |
I don't see a reason to report the parent directory. We don't do that for any of the science products and I would think if someone is versed enough in SPICE to understand what the type of kernel means, they will be able to identify the kernel type from the extension. I think the current behavior was causing issues being able to use the result to download files from |
I'm not sure there is an issue downloading the file, at least not one I'm aware of. I'm able to download using both: rm -f $IMAP_DATA_DIR/imap/spice/lsk/naif0012.tls
imap-data-access download lsk/naif0012.tlsand rm -f $IMAP_DATA_DIR/imap/spice/lsk/naif0012.tls
imap-data-access download naif0012.tlsWhen scripting I can do: import imap_data_access
query_results = imap_data_access.spice_query(type="leapseconds")
for result in query_results:
if not result:
raise ValueError("Got empty result.")
print(f"Downloading {result['file_name']!r}... ", end="")
filepath = imap_data_access.download(result["file_name"])
if filepath.exists():
print("OK")
filepath.unlink()
else:
print("Something went wrong")and I get the message: All of this is in the current |
jaredclaypoole
left a comment
There was a problem hiding this comment.
Sounds like the change is desirable. Looks good.
5079acb
into
IMAP-Science-Operations-Center:main

Change Summary
Closes #369.
Overview
Fix issue when printing results from a SPICE table query.
File changes
imap_data_access/cli.py: replacedstr()withos.path.basename()when printing SPICE filename.tests/test_cli.py: added regression test.Testing
Running:
produces the expected output:
Other tables continue to work. Running:
results in:
and
results in: