isciences / exactextract

Fast and accurate raster zonal statistics
Apache License 2.0
255 stars 33 forks source link

ERROR: min and max statistics are not working #8

Closed mhabets closed 4 years ago

mhabets commented 4 years ago

Under Windows, with the following command:

exactextract ^
-r mm:d:\tmp\chirps\yem_chirps-v2.0.2019.10.tif ^
-p adm1.shp ^
-f adm1_en ^
-s max(mm) ^
-s mean(mm) ^
-s min(mm) ^
-s sum(mm) ^
-o d:\tmp\chirps\yem_chirps-v2.0.2019.10_adm1_mm.csv

I get an error message Error: Unknown stat: 'max'

Indeed, I can't find the related operation in operation.h.

Is it a bug or am I doing something wrong?

dbaston commented 4 years ago

It's a bug. I guess I hadn't supported those stats with the command-line tool because I hadn't decided what to do in the case where they have no defined result (e.g., "min" within a polygon that touches no defined raster cells.) But I think a pretty safe behavior is to output NaN in that case, so I've pushed a commit that does that. Please give it a shot and let me know how it works for you.

mhabets commented 4 years ago

Amazing! Works like a charm now! Thank you a lot.