Zonal Statistics#

This module supports you in computing statistics over spatial zones. A typical application would be to compute mean areal precipitation for a catchment by using precipitation estimates from a radar grid in polar coordinates or from precipitation estimates in a Cartesian grid.

The general usage is similar to the wradlib.ipol and wradlib.adjust:

You have to create an instance of a class (derived from ZonalDataBase) by using the spatial information of your source and target objects (e.g. radar bins and catchment polygons). The Zonal Data within this object can be saved eg. as an ESRI Shapefile.

This object is then called with another class to compute zonal statistics for your target objects by calling the class instance with an array of values (one for each source object).

Typically, creating the instance of the ZonalData class will be computationally expensive, but only has to be done once (as long as the geometries do not change).

Calling the objects with actual data, however, will be very fast.


Right now we only support a limited set of 2-dimensional zonal statistics. In the future, we plan to extend this to three dimensions.


Base class for managing 2-dimensional zonal data.


ZonalData object for source points


ZonalData object for source polygons


Base class for all 2-dimensional zonal statistics.


Compute weighted average for target polygons based on areal weights.


Compute zonal average from all points in or close to the target polygon.


Return 2-d index array based on spatial selection from a bounding box.


Return bbox dictionary that represents the extent of the points.


Produces array of vertices from grid's center point coordinates.


Returns boolean mask of points coords inside polygon clippoly