Skip to content

Commit

Permalink
add fix for parallel regridder merge error with xarray (#332)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
charlesgauthier-udm and pre-commit-ci[bot] authored Feb 1, 2024
1 parent c86857b commit e9028b6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions xesmf/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit e9028b6

Please sign in to comment.