Zonal Statistics - categorical values

Set directory

Set parameters

Set filenames

Check if raster and vector are projected to the same CRS

Check if raster and vector file are intersecting

Build category map

rasterstats will report using the pixel values as keys. To associate the pixel values with their appropriate meaning, you can use a category_map

Compute zonal statistics

Plot histogram