Fix NaN issue in Zarr to NetCDF conversion for Gaussian grids #1140
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1113
This PR addresses the NaN issue when converting Zarr data to NetCDF for reduced Gaussian grids.
Problem
The original code assumed a regular lat/lon grid and used
unstack()to create rectangular dimensions. For reduced Gaussian grids (where longitude points vary by latitude), this created a rectangular grid filled with NaNs for non-existent grid points.Solution
ncellsdimension with auxiliarylat/lonvariables (CF-1.12 compliant)Changes
packages/evaluate/src/weathergen/evaluate/export_inference.py: Core conversion logicTesting
Results:
Before: Most grid points showed as
NaNor_After: All valid data points preserved
Note
This PR implements native Gaussian grid preservation as discussed in the issue.
Checklist before asking for review
./scripts/actions.sh lint./scripts/actions.sh unit-test./scripts/actions.sh integration-testlaunch-slurm.py --time 60