xoa.regrid.regrid1d
- xoa.regrid.regrid1d(da, coord, method=None, dim=None, coord_in_name=None, edges=None, conserv=False, extrap='no', bias=0.0, tension=0.0, dask='parallelized')[source]
Regrid along a single dimension
The input and output coordinates may vary along other dimensions, which useful for instance for vertical interpolation in coastal ocean models. Since it uses func:xarray.apply_ufunc, it support dask features. The core computation is performed by the numba-accelerated routines of
xoa.interp
.- Parameters:
da (xarray.DataArray) – Array to interpolate
coord (xarray.DataArray) – Output coordinate
method (str, int) – Regridding method as one of the following:
1|"linear"|"interp"
,0|"nearest"
,2|"cubic"
,3|"hermit"|"hermitian"
,-1|"cellave"
,-2|"cellerr"
dim (str, tuple(str), None) – Dimension on which to operate. If a string, it is expected to be the same dimension for both input and output coordinates. Else, provide a two-element tuple:
(dim_in, dim_out)
. It is inferred by default from output coordinate et input data array.coord_in_name (str, None) – Name of the input coordinate array, which must be known of
da
. It is inferred from the input dara array and dimension name by default.edges (dict, None) – Grid edge coordinates along the interpolation dimension, for the conservative regridding. When not provided, edges are computed with
xoa.grid.get_edges()
. Keys are “in” and/or “out” and values are arrays with the same shape as coordinates except along the interpolation dimension on which 1 is added.conserv (bool) – Use conservative regridding when using
cellave
method.extrap (str, int) – Extrapolation mode as one of the following:
0|"no"|"none"|"false"
,1|"top"|"above"|"after"
,-1|"bottom"|"below"
,2|"both"|"all"|"yes"|"true"
dask (str) – See
xarray.apply_ufunc()
.
- Returns:
xarray.DataArray – Regridded array with
coord
as new coordinate array.
See also
xoa.interp.nearest1d
,xoa.interp.linear2d
,xoa.interp.cubic2d
,xoa.interp.hermit1d
,xoa.interp.cellave1d
,xoa.interp.extrap1d
,xarray.apply_ufunc