Skip to content

Instantly share code, notes, and snippets.

@tastatham
Created March 1, 2020 13:52
Show Gist options
  • Save tastatham/f21520a5f6dcb1e67ced8fe93d79d5cb to your computer and use it in GitHub Desktop.
Save tastatham/f21520a5f6dcb1e67ced8fe93d79d5cb to your computer and use it in GitHub Desktop.
Zonal statistics using dask_geomodeling
# Import modules
from dask_geomodeling.raster import RasterBlock
from dask_geomodeling.raster import base
from dask_geomodeling.geometry import base
# Define paths
arg_rast_path = 'raster.tif'
arg_vec_path = 'vector.shp'
"""
# How do we define the blocks?
arg_ras = base.RasterBlock(arg_rast_path)
arg_vec = base.GeometryBlock(arg_vec_path)
"""
# Apply zonal statistics
geometry.aggregate.AggregateRaster(source=arg_vec,raster=arg_rast, column_name='sum', statistic='sum')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment