interp_across_chunks¶
- HSTB.kluster.xarray_helpers.interp_across_chunks(xarr, new_times, dimname='time', daskclient=None)¶
Takes in xarr and interpolates to new_times. Ideally we could use xarray interp_like or interp, but neither of these are implemented with support for chunked dask arrays. Therefore, we have to determine the times of each chunk and interpolate individually. To allow for the case where a value is between chunks or right on the boundary, we extend the chunk time to buffer the gap.
- Parameters
xarr (
Union[Dataset,DataArray]) – xarray DataArray or Dataset, object to be interpolatednew_times (
DataArray) – xarray DataArray, times for the array to be interpolated todimname (
str) – dimension name to interpolatedaskclient (
Optional[Client]) – dask.distributed.client or None, if running outside of dask cluster
- Returns
xarray DataArray or Dataset, interpolated xarr
- Return type
Union[xr.Dataset, xr.DataArray]