Skip to content

Apply dimension renaming without requiring new variables - #45

Open
sylvesterkaczmarek wants to merge 1 commit into
nasa:mainfrom
sylvesterkaczmarek:fix/rename-existing-variable-dimensions
Open

sylvesterkaczmarek wants to merge 1 commit into
nasa:mainfrom
sylvesterkaczmarek:fix/rename-existing-variable-dimensions

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Description

Fixes #44.

Run configured dimension renaming independently of missing-variable creation. The current nesting under if variables_to_create skips renaming whenever a rule applies only to existing variables. This writes the requested dimensions attribute but leaves the variable's actual dimension names unchanged, and bypasses the existing dimension-count check.

Move the existing renaming condition outside that block. Missing-variable creation retains its reference filtering, and the existing dimension helper continues to handle renaming and validation. No coordinate-generation formula, metadata precedence, dependency, deployment, or release-version changes are included. This does not overlap the history changes in #43 or exception-message changes in #40.

Jira Issue ID

Not assigned. External contribution tracked by GitHub issue #44.

Local Test Steps

Added ten file-based regression cases exercising annotate_granule with real VarInfo configurations. Coverage includes root/nested groups, one/two dimensions, existing or absent target coordinate variables, invalid dimension counts, and a metadata-only control. They verify numerical values, dtype, fill value, compression, coordinate values, unrelated variables, and byte-for-byte input preservation.

  • New tests against unchanged production code in a separate worktree: 9 failed, 1 passed. All failures reproduce the skipped rename or skipped validation.
  • Unchanged repository suite: 74 passed.
  • python -m pytest tests -q --disable-warnings --cov=metadata_annotator --cov=harmony_service --cov-report=term-missing: 84 passed, 92% combined package/service statement coverage.
  • ruff check .: passed.
  • Ruff formatting checks on both changed Python files, Python compilation, and git diff --check: passed.

Tested on macOS with Python 3.12.11 and the repository's Xarray 2025.9.0 requirement, against main at 33addf50c4176961769dbfdc5436e28202ebaaf8. Tests use synthetic NetCDF files and existing repository fixtures. No deployed Harmony service, remote granules, or other operating systems were tested.

PR Acceptance Checklist

  • Jira ticket acceptance criteria met. No Jira ticket assigned.
  • CHANGELOG.md updated.
  • Service version and Jira fix version updated if publishing a release. This PR does not publish a release.
  • Tests added and passing.
  • Implementation comment explains the independent renaming condition.

@sylvesterkaczmarek

Copy link
Copy Markdown
Author

Any feedback on the metadata annotation change? Let me know what needs changing before review.

This branch has not been deployed

No deployments
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.

Dimension renaming is skipped when no missing variables need creation

1 participant