Skip to content

add lo pivot attitude kernel file type - #358

Merged
tmplummer merged 5 commits into
IMAP-Science-Operations-Center:mainfrom
tmplummer:copilot/add-lo-pivot-attitude-kernel-file-type
Oct 1, 2026
Merged

tmplummer merged 5 commits into
IMAP-Science-Operations-Center:mainfrom
tmplummer:copilot/add-lo-pivot-attitude-kernel-file-type

Conversation

@tmplummer

Copy link
Copy Markdown
Contributor

imap_processing generates SPICE attitude kernels for the IMAP-Lo pivot platform (IMAP_LO frame, -43101). This PR enables imap-data-access to recognize, validate, parse, and serve these kernels with the new imap_lopivot file type.

Changes

File validation and metadata extraction

  • Added regex pattern for imap_lopivot-repoint#####_YYYY_DOY_YYYY_DOY_NNN.bc format
  • Files route to imap/spice/ck/ directory (attitude kernel subdirectory)
  • Implemented repointing field extraction as integer (e.g., 125 from repoint00125)
  • Properly rejects malformed filenames (missing repoint, wrong date format, wrong extension)

Type system

  • Added imap_lopivot → lo_pivot_attitude mapping
  • Registered lo_pivot_attitude in directory structure mapping

CLI and discovery

  • Updated --type help text to include lo_pivot_attitude as a valid query type

Example filename parsing

from imap_data_access.file_validation import SPICEFilePath

fp = SPICEFilePath("imap_lopivot-repoint00125_2026_013_2026_014_001.bc")
assert fp.spice_metadata["type"] == "lo_pivot_attitude"
assert fp.spice_metadata["repointing"] == 125  # extracted as int
assert fp.construct_path().name == "imap_lopivot-repoint00125_2026_013_2026_014_001.bc"

Testing

  • Verified filename parsing extracts all components correctly
  • Validated path construction routes to correct subdirectory
  • Confirmed only lo_pivot pattern matches the filename format
  • Validated rejection of malformed variants
  • Confirmed SPICEInput accepts lo_pivot files

Fixes #357

Copilot AI and others added 2 commits October 1, 2026 16:23
Co-authored-by: tmplummer <16110870+tmplummer@users.noreply.github.com>
@tmplummer
tmplummer requested review from bryan-harter and laspsandoval and a balanced review from Copilot October 1, 2026 16:50
@tmplummer

Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new regex accepts filenames containing trailing content after the .bc extension.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds support for IMAP-Lo pivot attitude kernels throughout validation and processing.

Changes:

  • Adds filename parsing, metadata extraction, and CK routing.
  • Exposes repointing IDs and updates CLI query help.
  • Adds parsing, validation, path, and SPICEInput tests.
File Description
imap_data_access/​file_validation.py Registers and parses Lo pivot kernels.
imap_data_access/​cli.py Documents the new query type.
tests/​test_file_validation.py Tests parsing and malformed filenames.
tests/​test_processing_input.py Tests SPICEInput integration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread imap_data_access/file_validation.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@laspsandoval

Copy link
Copy Markdown
Contributor

You will need to update sds-data-manager, spice_utilities.py.

@laspsandoval laspsandoval left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

return components

@staticmethod
def extract_filename_components(filename: Path | str) -> dict | None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update docstring.

Comment thread imap_data_access/file_validation.py
@tmplummer
tmplummer merged commit 266d623 into IMAP-Science-Operations-Center:main Oct 1, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Lo pivot attitude kernel (imap_lopivot) file type

4 participants