pyiem.grid package

Submodules

pyiem.grid.zs module

Utility class to help with fast zonal_stats work

class pyiem.grid.zs.CachingZonalStats(affine)

Bases: object

Implements a cache to speed up zonal_stats computation

compute_gridnav(geometries, grid)

Figure out how these geometries map to our grid

Parameters:
  • grid (numpy.ndarray) – the array to sample values for

  • geometries (geopandas.GeoSeries) – geometries to compute over, this should not change over the lifetime of this object

gen_stats(grid, geometries=None, stat=<numpy.ma.core._frommethod object>)

Compute the zonal_stats for the provided geometries and grid

Note: the passed grid should have (0,0) in upper-left, np.flipud()

Parameters:
  • grid (numpy.ndarray) – the array to sample values for

  • geometries (geopandas.GeoSeries) – geometries to compute over, this should not change over the lifetime of this object

  • stat (function) – the function to compute over the masked grid

Returns:

the ordered results of our work

Return type:

tuple(dict)

pyiem.grid.zs.GRIDINFO

alias of GridInfo

Module contents