Skip to content

Support multidimensional coordinates for bounds and regridding#820

Open
tomvothecoder wants to merge 8 commits intomainfrom
bug/816-multidim-coords
Open

Support multidimensional coordinates for bounds and regridding#820
tomvothecoder wants to merge 8 commits intomainfrom
bug/816-multidim-coords

Conversation

@tomvothecoder
Copy link
Collaborator

@tomvothecoder tomvothecoder commented Dec 3, 2025

Description

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

If applicable:

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass with my changes (locally and CI/CD build)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have noted that this is a breaking change for a major release (fix or feature that would cause existing functionality to not work as expected)

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.94%. Comparing base (baf02ae) to head (36aa432).

Files with missing lines Patch % Lines
xcdat/regridder/regrid2.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main     #820      +/-   ##
===========================================
- Coverage   100.00%   99.94%   -0.06%     
===========================================
  Files           18       18              
  Lines         1989     1999      +10     
===========================================
+ Hits          1989     1998       +9     
- Misses           0        1       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tomvothecoder tomvothecoder marked this pull request as ready for review February 25, 2026 18:12
@tomvothecoder
Copy link
Collaborator Author

Notes

  • Add guard for regrid2 since it not supported

@pochedls
Copy link
Collaborator

Thanks for pushing this forward @jasonb5! This PR seems to work for the example in #816, but I think it is failing for a related case (curvilinear->rectilinear):

wget https://esgf-node.ornl.gov/thredds/fileServer/css03_data/CMIP6/CMIP/CNRM-CERFACS/CNRM-CM6-1/historical/r1i1p1f2/Amon/tas/gr/v20180917/tas_Amon_CNRM-CM6-1_historical_r1i1p1f2_gr_185001-201412.nc
wget https://esgf-node.ornl.gov/thredds/fileServer/css03_data/CMIP6/CMIP/CNRM-CERFACS/CNRM-CM6-1/historical/r1i1p1f2/SImon/siconc/gn/v20180917/siconc_SImon_CNRM-CM6-1_historical_r1i1p1f2_gn_185001-201412.nc
# %% imports
import xcdat as xc

# %% parameters
fn_source = 'siconc_SImon_CNRM-CM6-1_historical_r1i1p1f2_gn_185001-201412.nc'
fn_target = 'tas_Amon_CNRM-CM6-1_historical_r1i1p1f2_gr_185001-201412.nc'

# %% get source / target grids
ds = xc.open_dataset(fn_source)
ngrid = xc.open_dataset(fn_target)

# %% try regridding with xcdat
dsr = ds.regridder.horizontal('tmp2m', ngrid, tool="xesmf", method="conservative_normed", periodic=True)

KeyError: "No 'X' axis dimension coordinate variables were found in the xarray object. Make sure dimension coordinate variables exist, they are one dimensional, and their CF 'axis' or 'standard_name' attrs are correctly set."

I can get this to work with:

import xesmf as xe

regridder = xe.Regridder(ds, ngrid, "conservative_normed", periodic=True, ignore_degenerate=True)                                            
dsr = regridder(ds)

@jasonb5 jasonb5 force-pushed the bug/816-multidim-coords branch from 27ee94b to 36aa432 Compare March 14, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

[Bug]: Metadata regridding issues related to multidimensional coords

3 participants