NOAA-ORR-ERD / gridded

A single API for accessing / working with gridded model results on multiple grid types
https://noaa-orr-erd.github.io/gridded/index.html
The Unlicense
64 stars 14 forks source link

add simple way to get bounds of a grid #67

Open ChrisBarker-NOAA opened 2 years ago

ChrisBarker-NOAA commented 2 years ago

It would be nice if the Grid objects has a get_bounds() method to provide at least the bounding box, if not a bounding polygon.

(bounding polygon would be nice, but they can be VERY large and complex)

zklaus commented 2 years ago

Just leaving this as a possible pointer: https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.ConvexHull.html

ChrisBarker-NOAA commented 2 years ago

yeah, that's an option, thanks -- and easy enough that we should probably do it.

But some model domains are far from convex -- so a concave hull would be better:

https://pypi.org/project/alphashape/

may be an option for that.

ChrisBarker-NOAA commented 2 years ago

One other note:

This is also complicated by the fact that often structured grid models have masked parts of the grid that should be considered when defining the bounds.