aggregate raster data to polygons with area-weighting #671
Replies: 3 comments 4 replies
-
For this sort of problem I would use |
Beta Was this translation helpful? Give feedback.
-
That is what I meant, yes, but I realise now that doesn't give you the area weighting that you want. |
Beta Was this translation helpful? Give feedback.
-
Hello, I wanted to hop onto this discussion and ask if xarray-spatial had implemented any area weighted methods since this post? |
Beta Was this translation helpful? Give feedback.
-
A very common use case for USGS (and others in hydrology) is to aggregate raster data over some polygon (e.g. total precipitation over a watershed).
xagg is a package to aggregate gridded data in xarray to polygons in geopandas using area-weighting from the relative area overlaps between pixels and polygons. A raster of weights is generated for each polygon, then the weight raster is multiplied by the data raster and summed to get the value for the polygon.
Could xarray-spatial do this kind of calculation?
Beta Was this translation helpful? Give feedback.
All reactions