-
Notifications
You must be signed in to change notification settings - Fork 15
[Bug]: CF compliance issues when regridding #747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This issue is likely related to this issue and I think @jasonb5 understands what is going on and is working on a fix. I'll try to summarize (based on my recollection/understanding of what @jasonb5 found): Latitude and longitude for curvilinear grids are stored in 2d arrays (e.g., This works in I think we will end up doing something similar (and maybe something like this was implemented in v0.5). This could be a problem if data is stored as something other than I couldn't actually read the data in your comment ( |
I was able to reproduce the error using the example code in the description. I re-ran the code using the fix in #736 and successfully produced the regridded output. We're good to go once #736 is merged and v0.8.1 is released (probably soon!). Example Codeimport numpy as np
import xcdat as xc
ds = xc.open_dataset(
"https://thredds.nci.org.au/thredds/dodsC/zz63/NARCliM2-0/output/CMIP6/DD/AUS-18/NSW-Government/ACCESS-ESM1-5/historical/r6i1p1f1/NARCliM2-0-WRF412R3/v1-r1/day/tas/latest/tas_AUS-18_ACCESS-ESM1-5_historical_r6i1p1f1_NSW-Government_NARCliM2-0-WRF412R3_v1-r1_day_19510101-19511231.nc"
)
lats = xc.create_axis("lat", np.round(np.arange(-44.5, -9.99, 0.05), decimals=2))
lons = xc.create_axis("lon", np.round(np.arange(112, 156.26, 0.05), decimals=2))
grid = xc.create_grid(lats, lons)
ds_out = ds.regridder.horizontal("tas", grid, tool="xesmf", method="bilinear")
print(ds_out) Output<xarray.Dataset> Size: 894MB
Dimensions: (time: 365, lat: 691, lon: 886, bnds: 2)
Coordinates:
height float64 8B 2.0
* time (time) object 3kB 1951-01-01 12:00:00 ... 1951-12-31 12:00:00
* lat (lat) float64 6kB -44.5 -44.45 -44.4 ... -10.1 -10.05 -10.0
* lon (lon) float64 7kB 112.0 112.0 112.1 112.2 ... 156.2 156.2 156.2
Dimensions without coordinates: bnds
Data variables:
tas (time, lat, lon) float32 894MB 286.0 286.0 286.0 ... 302.7 302.7
lon_bnds (lon, bnds) float64 14kB 112.0 112.0 112.0 ... 156.2 156.2 156.3
lat_bnds (lat, bnds) float64 11kB -44.52 -44.48 -44.48 ... -10.03 -9.975
time_bnds (time, bnds) object 6kB ...
Attributes: (12/43)
project_id: CORDEX
comment: DPIE version of WRF4.1.2
DPIE_WRF_HASH: a051fdc73749349fd244ce8e596088a372bdb0c5
wrf_options: sst_update & tmn_update
frequency: day
git_url_postprocessing: git@bitbucket.org:oehcas/cordex_postproc...
... ...
wrf_schemes_sf_sfclay_physics: Revised_MM5; Jimenez et al. (2012, MWR)
wrf_schemes_sf_surface_physics: Niu, Guo-Yue, Zong-Liang Yang, Kenneth E...
wrf_schemes_mp_physics: Thompson, Gregory, Paul R. Field, Roy M....
wrf_schemes_bl_pbl_physics: Nakanishi, M., and H. Niino, 2006: An im...
wrf_schemes_cu_physics: Betts-Miller-Janjic; Janjic (1994, MWR; ...
history: Tue May 7 20:01:44 2024: ncrename -a gl... Grid inspection (sanity check)print(ds_out.regridder.grid) <xarray.Dataset> Size: 38kB
Dimensions: (lon: 886, bnds: 2, lat: 691)
Coordinates:
height float64 8B 2.0
* lon (lon) float64 7kB 112.0 112.0 112.1 112.2 ... 156.2 156.2 156.2
* lat (lat) float64 6kB -44.5 -44.45 -44.4 -44.35 ... -10.1 -10.05 -10.0
Dimensions without coordinates: bnds
Data variables:
lon_bnds (lon, bnds) float64 14kB 112.0 112.0 112.0 ... 156.2 156.2 156.3
lat_bnds (lat, bnds) float64 11kB -44.52 -44.48 -44.48 ... -10.03 -9.975
Attributes: (12/43)
project_id: CORDEX
comment: DPIE version of WRF4.1.2
DPIE_WRF_HASH: a051fdc73749349fd244ce8e596088a372bdb0c5
wrf_options: sst_update & tmn_update
frequency: day
git_url_postprocessing: git@bitbucket.org:oehcas/cordex_postproc...
... ...
wrf_schemes_sf_sfclay_physics: Revised_MM5; Jimenez et al. (2012, MWR)
wrf_schemes_sf_surface_physics: Niu, Guo-Yue, Zong-Liang Yang, Kenneth E...
wrf_schemes_mp_physics: Thompson, Gregory, Paul R. Field, Roy M....
wrf_schemes_bl_pbl_physics: Nakanishi, M., and H. Niino, 2006: An im...
wrf_schemes_cu_physics: Betts-Miller-Janjic; Janjic (1994, MWR; ...
history: Tue May 7 20:01:44 2024: ncrename -a gl... |
What happened?
When I updated from an older version (0.5.0) of xcdat to the latest version (0.8.0) regridding of a particular (standard CORDEX-CMIP6) rotated pole grid stopped working.
What did you expect to happen? Are there are possible answers you came across?
I expected it to run successfully as it has in the past.
Minimal Complete Verifiable Example (MVCE)
Relevant log output
Anything else we need to know?
If I run it directly with xesmf it works...
Environment
The text was updated successfully, but these errors were encountered: