xcdat icon indicating copy to clipboard operation
xcdat copied to clipboard

[Feature]: Consider implementing the SCRIP or libcf regridder

Open pochedls opened this issue 1 year ago • 7 comments

Is your feature request related to a problem?

Some non-rectangular grids do not provide the cell bounds, which are needed for xESMF to regrid the data. I think the SCRIP regridder may handle these situations.

Example:

import xcdat
import numpy as np

fn='/p/css03/scratch/cmip6/CMIP/CAS/FGOALS-f3-L/historical/r1i1p1f1/SImon/siconc/gn/v20191031/siconc_SImon_FGOALS-f3-L_historical_r1i1p1f1_gn_185001-201412.nc'

nlat = np.arange(-88.75, 90, 2.5)
nlon = np.arange(1.25, 360, 2.5)
ngrid = xcdat.regridder.grid.create_grid(nlat, nlon)

ds = xcdat.open_dataset(fn)
ds = ds.isel(time=[0])
ds2 = ds.regridder.horizontal('siconc', ngrid, tool='xesmf', method='conservative_normed', periodic=True)

KeyError: 'lon_b'

See related issue here.

When I try to regrid this file using CDAT it works and provides the following output:

Warning: avariable.regrid: regridTool = 'esmf' requires bounds for source grid, will switch to regridTool = 'libcf'

This dataset appears to have the same issue: /p/css03/esgf_publish/CMIP6/CMIP/CAS/CAS-ESM2-0/historical/r1i1p1f1/SImon/siconc/gn/v20201225/.

Describe the solution you'd like

Consider providing an interface to the SCRIP regridder (and switching to SCRIP under some conditions, as CDAT does).

Describe alternatives you've considered

No response

Additional context

No response

pochedls avatar Sep 28 '22 04:09 pochedls