I want to calculate the mean NDVI with the EthNdvi.tif file for each zone (there are around 650 admin zones) in the the woreda shapefile. I'm having some issues with running the following lines of code:
from rasterstats import zonal_stats stats = zonal_stats("Eth_Woreda_2013.shp", "EthNdvi.tif")
Specifically it gives me a memory error. I tried to do zonal statistics in QGIS and this works fine. However when I code this in a python script it results in memory errors.
I've uploaded the two files in a google link: https://drive.google.com/open?id=1go78VkkH8MdAyfpGr4Sg6CvI-WU3WgrC if you want to replicate it.
My laptop has 8gb of ram.
Could anybody explain me why this doesn't work in a python script, but it does in QGIS?
Moreover does anyone have a tip how I could still script this in python; should I buy more memory for my laptop or should I do something else?