use cf to calculate 2d lat lon bounds
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 https://github.com/xarray-contrib/cf-xarray/issues/71.
I have simply removed the conditional key error and updated the docs.
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 : https://github.com/xarray-contrib/cf-xarray/issues/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 ?
I agree with @aulemahal, I'd avoid silently using the 2D bound generation logic until it is hardened.
closing this PR until a fix is implemented in cf-xarray