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

conversion between different bounds conventions #380

Open
keewis opened this issue Dec 6, 2022 · 0 comments
Open

conversion between different bounds conventions #380

keewis opened this issue Dec 6, 2022 · 0 comments

Comments

@keewis
Copy link
Contributor

keewis commented Dec 6, 2022

Bounds can be stored in different ways, and it would be great to have methods to convert between each of them.

Here's the ones I'm familiar with:

  • bounds variables: additional bounds dimension for upper / lower bounds
  • vertex variables: store the breaks in a n + 1 array (needs a new dimension)
  • IntervalIndex: dedicated pandas object for intervals (might need some more integration)

The advantage of IntervalIndex is that it has the same dimensions and size as the cell center coordinate and thus can be attached to DataArray objects.

For spatial, there's a few more, but since they combine 2 coordinates they require stacking the spatial coordinates or need to be broadcast to 2D coordinates. For example:

  • array of bounding boxes: left, bottom, right, top for each grid cell
  • array of bounding coordinates: list of coordinates of arbitrary length for each grid cell (not a good fit for xarray's data model, but the limited awkward objects might work?)
  • array of shapely polygons: one polygon of arbitrary length for each grid cell

cf_xarray already has conversion functions between bounds and vertices, so as far as I can tell conversion to and from IntervalIndex seem to be in scope. For the grid cell representation conversions I'm not sure, maybe put them into xvec?

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

No branches or pull requests

1 participant