Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regridding error with non-sequence output #343

Closed
angus-g opened this issue Feb 21, 2024 · 1 comment · Fixed by #344
Closed

Regridding error with non-sequence output #343

angus-g opened this issue Feb 21, 2024 · 1 comment · Fixed by #344

Comments

@angus-g
Copy link

angus-g commented Feb 21, 2024

The recent release of xESMF 0.8.3 incorporates #332, which seems to have a bit of a logic bug in the case of a non-sequence output. With reference to the following code, the horizontal/vertical dimensions get renamed to x_out and y_out respectively. This means they differ from the original values in the out_coords dictionary, so the newly-added rename operation fails (ValueError: cannot rename 'lon' because it is not a variable or dimension in this dataset)

xESMF/xesmf/frontend.py

Lines 1023 to 1034 in d32b5f4

if self.sequence_out:
ds_out = ds_out.rename({self.out_horiz_dims[1]: 'x_out'})
out_chunks = ds_out.chunks.get('x_out')
else:
ds_out = ds_out.rename(
{self.out_horiz_dims[0]: 'y_out', self.out_horiz_dims[1]: 'x_out'}
)
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'})

@huard
Copy link
Contributor

huard commented Feb 21, 2024

@charlesgauthier-udm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants