From e9028b68c8fb37004e834cfa4a457b4147d90308 Mon Sep 17 00:00:00 2001 From: Charles Gauthier <85585494+charlesgauthier-udm@users.noreply.github.com> Date: Thu, 1 Feb 2024 09:56:19 -0500 Subject: [PATCH] add fix for parallel regridder merge error with xarray (#332) * add fix for parallel regridder merge error with xarray * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- xesmf/frontend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xesmf/frontend.py b/xesmf/frontend.py index 267ed3d9..6100ff52 100644 --- a/xesmf/frontend.py +++ b/xesmf/frontend.py @@ -1030,6 +1030,10 @@ def _init_para_regrid(self, ds_in, ds_out, kwargs): ) out_chunks = [ds_out.chunks.get(k) for k in ['y_out', 'x_out']] + # Rename coords to avoid issues in xr.map_blocks + for coord in list(self.out_coords.keys()): + ds_out = ds_out.rename({coord: coord + '_out'}) + weights_dims = ('y_out', 'x_out', 'y_in', 'x_in') templ = sps.zeros((self.shape_out + self.shape_in)) w_templ = xr.DataArray(templ, dims=weights_dims).chunk(