question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

xESMF regridding showing repeated values at latitude poles

See original GitHub issue

I am experiencing problems when regridding on a global grid in xesmf. Everything is working as it should, except for at the poles (latitudes -90 and 90), where it shows repeated values (2.58851004e+00, 2.58851004e+00, 2.58851004e+00, …) for each variable. I have also compared it with the CDO regridder to verify, and it showed differences of 0 at every lat/lon point, save for lats -90 and 90. Is there a fix for this?

I have attatched sample netCDF input data via zip file: test_input.zip Code:

import xarray as xr
import xesmf as xe

ds = xr.open_dataset('./test_input.nc4') 
ds = ds.transpose("time", "lat", "lon")
output_grid = xr.Dataset({'lat': (['lat'], np.arange(-90, 94, 4)),
                    'lon': (['lon'], np.arange(0, 360, 5)),
                    }
                )

regridder = xe.Regridder(ds, output_grid, 'bilinear',  periodic=True) #same problem for nearest neighbor regridding
ds_out = regridder(ds,keep_attrs=True)

print(ds_out)

You will notice, once ds_out is generated, evaluating ds_out[‘ZLCL’][:,0,:] or ds_out[‘ZLCL’][:,45,:] Will show all repeated values. These values correspond to lat = -90 and lat = 90.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
huardcommented, Nov 16, 2021

Thanks for the report, the example and test file. We’ve a bit of a backlog at the moment, will try to look into it next week.

0reactions
mtrimp2commented, Jan 31, 2022

It is also worth noting, that when regridding the entire dataset, many variables yield different results. I tried to find a correlation to see if there is a sole issue (for example, the northward wind at 50m), but I do not believe it to be the case. Here is a complete output from nccmp diagnostics showing the differing variables, if that is helpful lears-mini_grass_global_regrid.json_comparison_regrid_global_all_vars.txt

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · JiaweiZhuang/xESMF
ImportError: The ESMF shared library did not load properly. ... xESMF regridding showing repeated values at latitude poles? ... Can I regrid between...
Read more >
Solving large problems using HPC - xESMF - Read the Docs
For conservative regridding, the units of the longitude and latitude arrays at the cell corners have to be grid_corner_lon and grid_corner_lat.
Read more >
xESMF Documentation
xESMF is a Python package for regridding. It is. • Powerful: It uses ESMF/ESMPy as backend and can regrid between general curvilinear grids ......
Read more >
Working with output from general circulation models using ...
What we should rather do in this case is average values around the wider target grid. This can be achieved by using a...
Read more >
How do I resample a high-resolution GRIB grid to a coarser ...
Regridder docs: https://xesmf.readthedocs.io/en/latest/user_api.html? ... latMax = np.nanmax(arr["lat"].values) sizeLon = len(arr["lon"]) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found