ContinuumIO / elm

Phase I & part of Phase II of NASA SBIR - Parallel Machine Learning on Satellite Data
http://ensemble-learning-models.readthedocs.io
44 stars 24 forks source link

Zonal statistics #209

Open PeterDSteinberg opened 6 years ago

PeterDSteinberg commented 6 years ago

Create zonal statistics tools for xarray.* data structures to allow summaries of input rasters and cubes or of predictions (or inputs), where zones are defined by grids or polygon

I think the best term for those is "zonal_mask" (correct me if I'm wrong) and where the zonal mask sets the grouping regions for spatial statistics.

Consider (for each of the files' above typical data structures), how to use the polygons from file. For example, geojson and shapefiles have typically >1 polygon, so some things to think about are:

Note in xarray_filters.polygon_tools there is some numba related point-in-polygon code that will be helpful for zonal stats on scattered datasets, but this issue should focus on raster or spatial ND arrays (regular grids not scattered points) that are masked by polygon layers.