Skip to content

use cf to calculate 2d lat lon bounds #384

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions xesmf/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ def _get_lon_lat_bounds(ds):
lon_bnds = ds.cf.get_bounds('longitude')
lat_bnds = ds.cf.get_bounds('latitude')
except KeyError: # bounds are not already present
if ds.cf['longitude'].ndim > 1:
# We cannot infer 2D bounds, raise KeyError as custom "lon_b" is missing.
raise KeyError('lon_b')
lon_name = ds.cf['longitude'].name
lat_name = ds.cf['latitude'].name
ds = ds.cf.add_bounds([lon_name, lat_name])
Expand Down Expand Up @@ -795,7 +792,7 @@ def __init__(
where masked values are identified by 0, and non-masked values by 1.

For conservative methods, if bounds are not present, they will be
computed using `cf-xarray` (only 1D coordinates are currently supported).
computed using `cf-xarray`.

Shape can be 1D (n_lon,) and (n_lat,) for rectilinear grids,
or 2D (n_y, n_x) for general curvilinear grids.
Expand Down