Skip to content

Dimension refactor; work with --unit, --display#21

Merged
JamesMcClung merged 17 commits intomainfrom
dim-cleanup
Apr 17, 2026
Merged

Dimension refactor; work with --unit, --display#21
JamesMcClung merged 17 commits intomainfrom
dim-cleanup

Conversation

@JamesMcClung
Copy link
Copy Markdown
Owner

Dimensions are tracked in metadata, and can thus be manipulated directly by adaptors.

JamesMcClung and others added 17 commits April 16, 2026 20:53
Pure mechanical rename ahead of moving dim display/unit info onto Metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Empty dict by default. Not populated or read anywhere yet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Helper for loaders to seed metadata.dims with a default Dimension per data dim,
falling back to a minimal linear Dimension for unknown keys.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Populate metadata.dims from DIM_DEFAULTS (with fallback) for every coord/column
on the loaded data. Nothing reads the field yet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Axis labels now come from the per-instance metadata.dims populated at load time.
Falls back to DIM_DEFAULTS for dims created by adaptors (Fourier, transforms)
which don't yet populate metadata.dims; the fallback will be removed once
Tasks 7-9 migrate those adaptors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Last reads of DIM_DEFAULTS from plotting code routed through metadata.dims
via a shared plt_util.get_dim helper (with DIM_DEFAULTS fallback for dims
not yet populated by adaptors; removed in later tasks).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fourier takes str|list[str] keys instead of Dimension objects, reads the current
Dimension from metadata.dims at apply time, writes the toggled dim back. versus
and derived_field_variables adjusted to the new signature. The Fourier display-
latex modification is done inside apply_field (where the pre-transform dim
latex is still available) rather than via get_modified_display_latex (which
runs post-apply).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reads input dims from metadata.dims; builds output polar dims on the fly;
writes new dims back into metadata.dims. Drops CartesianToPolar use.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ruction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Last apply-time read of DIM_DEFAULTS routed through per-instance metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dim existence is checked at apply time against metadata.dims; parse-time
validation is now restricted to "is this a valid identifier?".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
-register method; -CartesianToPolar; -CartesianToSpherical; -Transform2D/3D.
-Fourier pre-seeding in DIM_DEFAULTS. DIM_DEFAULTS populated directly by a
module-private helper. Fourier and transform adaptors now construct their
output dims on the fly. get_default_dim synthesizes Fourier-space dims from
the k_ prefix to preserve behavior for data that stores Fourier-space coords
directly (e.g. the hhat2 derived variable).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Override apply directly so dim targets route through metadata.dims
instead of the var-only display_latex hook. Unknown targets raise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mirror display: override apply directly and route dim targets through
metadata.dims. Unknown targets raise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
make sure Fourier is actually working by invoking it directly
@JamesMcClung JamesMcClung added enhancement New feature or request refactor Internal simplifications or generalizations labels Apr 17, 2026
@JamesMcClung JamesMcClung merged commit cd71823 into main Apr 17, 2026
1 check passed
@JamesMcClung JamesMcClung deleted the dim-cleanup branch April 17, 2026 01:00
@JamesMcClung JamesMcClung added the testing Adds or improves tests label Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactor Internal simplifications or generalizations testing Adds or improves tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant