Skip to content

refactor: move pairwise alignment ops out of accessors/ - #39

Merged
mpvginde merged 1 commit into
mlwp-tools:refactor/alignmentfrom
leifdenby:refactor/accessor-ops-to-align
Oct 27, 2026
Merged

mpvginde merged 1 commit into
mlwp-tools:refactor/alignmentfrom
leifdenby:refactor/accessor-ops-to-align

Conversation

@leifdenby

Copy link
Copy Markdown
Member

Addresses bullet 3 of my notes on #30: "put accessor operation modules into submodules".

This is the first PR in a stack against refactor/alignment (#30). The next PRs rename the packages to accessor / alignment / pipeline and add an explicit config schema.

Changes

  • Move the pairwise time ops (align_forecast_to_observation, align_observation_to_forecast, align_observation_to_observation, align_forecast_to_forecast, _add_valid_time, _parse_lead_times) from accessors/time.py into align/time.py.
  • Move the pairwise space ops (align_grid_grid, align_grid_point, COORD_TOLERANCE) from accessors/space.py into align/space.py.
  • accessors/mx.py imports these from ..align. The accessors package now holds only the accessor itself.
  • align/time.py no longer imports from accessors.

The code is moved unchanged, so there is no behaviour change, and all 93 tests pass.

🤖 Generated with Claude Code

accessors/time.py and accessors/space.py held alignment operations
rather than accessor code. Move them into align/time.py and
align/space.py next to the multi-dataset align_time/align_space, and
have the mx accessor import them from there. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

It is a pure code move with imports and all call sites correctly repointed, no remaining references to the old paths, and no circular imports introduced.

No open issues 🎉

What changed in this PR

This PR is a mechanical refactor that relocates pairwise alignment operations out of the accessors/ package and into the align/ package, so that accessors/ holds only the mx accessor itself. It is the first in a stack against refactor/alignment (#30) that will later rename packages and add a config schema. The move also removes the prior circular dependency where align/time.py imported from accessors/time.py.

Changes:

  • Moved pairwise time ops (align_forecast_to_observation, align_observation_to_forecast, align_observation_to_observation, align_forecast_to_forecast, _add_valid_time, _parse_lead_times) into align/time.py.
  • Moved pairwise space ops (align_grid_grid, align_grid_point, COORD_TOLERANCE) into align/space.py.
  • Updated accessors/mx.py to import _time/_space from ..align, and emptied accessors/time.py / accessors/space.py.
File Description
src/​mxalign/​align/​time.py Adds the pairwise time-alignment functions and the numpy/pandas/mlwp_data_specs imports they need; drops the old accessors import.
src/​mxalign/​align/​space.py Adds COORD_TOLERANCE and the grid/point pairwise space-alignment functions.
src/​mxalign/​accessors/​time.py Removes all relocated time-alignment code.
src/​mxalign/​accessors/​space.py Removes all relocated space-alignment code.
src/​mxalign/​accessors/​mx.py Repoints _time/_space imports from . to ..align.

Review effort: Balanced

@leifdenby
leifdenby requested a review from mpvginde October 27, 2026 11:45
@mpvginde
mpvginde merged commit bc025a5 into mlwp-tools:refactor/alignment Oct 27, 2026
2 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.

3 participants