Preserve LLC grid metadata for area weights - #864
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73c1626834
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| _LLC_CENTER_LON_CANDIDATES = ("XC", "longitude", "lon") | ||
| _LLC_CENTER_LAT_CANDIDATES = ("YC", "latitude", "lat") |
There was a problem hiding this comment.
Preserve lon/lat metadata before renaming axes
When an LLC source uses the advertised lon/lat candidate names for its 2-D geographic coordinates instead of XC/YC, canonicalize_llc_datasets later attempts to rename the existing i/j dimensions to those same names. Xarray rejects that name collision before _assign_llc_grid_metadata can consume the coordinates, so these fallback candidates cannot actually be loaded. Rename or extract the 2-D metadata before renaming the model-space axes.
Useful? React with 👍 / 👎.
|
@fomo-bot will you address the issues that Codex raised in its review? |
|
Addressed and pushed in I changed LLC canonicalization to extract the fallback Validation:
Fresh GitHub checks on Debug info
|
|
The remaining external checks have completed on Debug info
|
|
@codex will you review this PR once more? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66860615c4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| raw_metadata_vars = [ | ||
| source | ||
| for source in {lon_source, lat_source, area_source} | ||
| if source not in coords and source in out.variables | ||
| ] |
There was a problem hiding this comment.
Remove all raw LLC axis aliases before renaming
When an input exposes both the preferred metadata name and its fallback alias—for example, XC together with a 2-D lon, or YC together with lat—this cleanup drops only the selected XC/YC source. The unused lon/lat variable therefore remains, and the subsequent i -> lon or j -> lat rename still fails with a name collision. The new pre-rename extraction fixes single-alias inputs, but inputs carrying redundant aliases require dropping every raw candidate after the canonical coordinates have been assigned.
Useful? React with 👍 / 👎.
|
@codex, will you review this PR once more? |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Summary
XC/YC/rAthrough canonicalization aslon_2d/lat_2d/areacellocoordinates.areacellofor canonical and standalone area weights, with cosine-latitude fallback only when no cell area exists.Closes #801
Validation
465 passed, 2 skipped, 68 deselected, 10 xfailed.uvx pre-commit run --all-filespassed.Note: the first broad CPU-hidden run against the existing local
.data_cachefailed only in two compact fixture tests because that cache was stale; rerunning those failures and the full suite with a freshSAMUDRA_TEST_DATA_CACHEpassed.