Python script for comparing "zonal statistics" implementations/algorithms

bash_rasterize.sh 910B

1
  1. resX=$(pkinfo -i "/home/thomas/tmp/zonalbenchmark/test_data/wc2.0_10m_tavg_07.tif" -ns | cut -d ' ' -f 2);echo $resX; resY=$(pkinfo -i "/home/thomas/tmp/zonalbenchmark/test_data/wc2.0_10m_tavg_07.tif" -nl | cut -d ' ' -f 2);echo $resY;xmin=$(pkinfo -i "/home/thomas/tmp/zonalbenchmark/test_data/wc2.0_10m_tavg_07.tif" -ulx | cut -d '=' -f 2);echo $xmin;xmax=$(pkinfo -i "/home/thomas/tmp/zonalbenchmark/test_data/wc2.0_10m_tavg_07.tif" -lrx | cut -d '=' -f 2);echo $xmax;ymax=$(pkinfo -i "/home/thomas/tmp/zonalbenchmark/test_data/wc2.0_10m_tavg_07.tif" -uly | cut -d '=' -f 2);echo $ymax;ymin=$(pkinfo -i "/home/thomas/tmp/zonalbenchmark/test_data/wc2.0_10m_tavg_07.tif" -lry | cut -d '=' -f 2);echo $ymin;gdal_rasterize -ts $resX $resY -te $xmin $ymin $xmax $ymax -a_nodata 0 -ot Byte -burn 1 -l "mask" "/home/thomas/tmp/zonalbenchmark/test_data/mask.shp" "/home/thomas/tmp/zonalbenchmark/test_data/mask.tif"