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

use cf to calculate 2d lat lon bounds #384

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jmineau
Copy link

@jmineau jmineau commented Jul 29, 2024

I just ran into this issue while trying to regrid a curvilinear grid to rectilinear with the conservative method. This is my first pull request into a public project, so apologies if I'm doing something incorrectly.

Previously, when lat or lon was a 2D array, xesmf would throw key error when attempting to calculate bounds if they were not present. At the time, cf-xarray had no method of calculating new bounds from 2D coordinates, see #180.

However, this is no longer the case via xarray-contrib/cf-xarray#71.

I have simply removed the conditional key error and updated the docs.

@aulemahal
Copy link
Collaborator

Hi @jmineau , thanks for the PR!

I think the main reason we were hesitant to use cf-xarray's automatic 2D bounds computation is that it is still bugged in some cases : xarray-contrib/cf-xarray#384 . I fear that in a regridding workflow this error would slide in completely silently and yield wrong weights, a bug that would be hard to diagnose or even detect after the fact.

What do the other maintainers think. @huard, @raphaeldussin ?

@huard
Copy link
Contributor

huard commented Aug 19, 2024

I agree with @aulemahal, I'd avoid silently using the 2D bound generation logic until it is hardened.

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 this pull request may close these issues.

3 participants