Skip to content

Fix three latent bugs in Grid construction and mode regridders#68

Open
thodson-usgs wants to merge 1 commit into
xarray-contrib:mainfrom
thodson-usgs:fix/latent-bugs
Open

Fix three latent bugs in Grid construction and mode regridders#68
thodson-usgs wants to merge 1 commit into
xarray-contrib:mainfrom
thodson-usgs:fix/latent-bugs

Conversation

@thodson-usgs
Copy link
Copy Markdown

@thodson-usgs thodson-usgs commented Apr 17, 2026

Three small, independent bug fixes spotted while reading the code.

  1. utils.create_lat_lon_coords — the longitude-span check uses resolution_lat instead of resolution_lon, so non-square grids can overshoot east.
  2. Grid.__post_init__ — the south > north branch reports the wrong bound name, and the two checks use if/if so the second overwrites the first. Switched to elif and fixed the wording. Drops a stray pass.
  3. regrid.most_common / regrid.least_common — the Dataset-input error message has a stray comma making msg a tuple, so ValueError(msg) renders unreadably.

- utils.create_lat_lon_coords: check remainder against resolution_lon (not
  resolution_lat) for the longitude span, so non-square grids no longer
  overshoot `east`.
- Grid.__post_init__: the `south > north` branch now reports the correct
  bound in the error message, and the second check uses `elif` so the
  first failure isn't silently overwritten. Drops a stray `pass`.
- regrid.most_common / regrid.least_common: the Dataset-input error message
  was a tuple (trailing comma on the first string literal), so ValueError
  printed unreadably. Remove the comma so the message is a single string.
@thodson-usgs thodson-usgs marked this pull request as ready for review April 18, 2026 00:52
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.

1 participant