By user3591836


2015-05-29 06:14:49 8 Comments

I'm computing some zonal statistics, and was comparing the results obtained using the GDAL cookbook example code here with the rasterstats zonal_stats function.

I want to compute the mean value per polygon, as well as the number of raster pixels that contributed to that calculation. I think rasterstats gives you the number of contributing pixels with their 'count' statistic.

I'm not sure how to get that with the GDAL code, though. I first thought that's what their 'numpoints' variable was counting, but their numpoints corresponds to the number of points within a ring, and I think that means the number of vertices of the ring (please correct me if I'm wrong).

Can anyone explain how to compute the number of raster pixels contributing to the GDAL cookbook calculation? Counting the number of pixels of their 'zoneraster' array variable doesn't come close to agreeing with the rasterstats count, either.

0 comments

Related Questions

Sponsored Content

0 Answered Questions

3 Answered Questions

1 Answered Questions

[SOLVED] Losing information using Zonal Statistics?

0 Answered Questions

Unexpected results when reclassifying raster using GDAL/numpy

0 Answered Questions

Using zonal statistics code from Python GDAL Cookbook?

1 Answered Questions

3 Answered Questions

[SOLVED] Per-pixel (statistical) calculations on a raster stack using GDAL

0 Answered Questions

Zonal Statistics using Gdal and Python

Sponsored Content