xarray-contrib / xarray-contrib/xvec
creating geometry variables from bounds
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 139
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
I wonder if it would be in scope for the xvec accessor to have a method that can be used to convert two bounds coordinates to shapely geometry columns?
I'd imagine something like this:
import xarray as xr
import cf_xarray
import xvec
ds = (
xr.tutorial.open_dataset("air_temperature", chunks={})
.cf.add_bounds(["lat", "lon"])
.xvec.bounds_to_shapely(["lat_bounds", "lon_bounds"])
)
That would require xvec to broadcast or stack lat and lon, so we might also require doing that first (but ideally, we'd support 2D geometry variables):
ds = (
xr.tutorial.open_dataset("air_temperature", chunks={})
.cf.add_bounds(["lat", "lon"])
.stack(cells=["lat", "lon"])
.xvec.bounds_to_shapely(["lat_bounds", "lon_bounds"])
)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the xvec accessor and evaluate the proposed bounds_to_shapely entry point using the examples in the issue. Compare the unstacked and stacked lat/lon cases, including the requirement to broadcast or stack bounds and the possibility of 2D geometry variables. Done means the supported input shape and conversion behavior are specified and implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100