zonal_stats function returns 'infinity' value
zonal_stats function returns infinity when calculating mean for some geometries.
zonal_stats function returns infinity when calculating mean for some geometries.
If there's an inf within the portion of the raster delineated by the polygon, that seems mathematically correct.
zonal_stats function returns infinity when calculating mean for some geometries.
If there's an
infwithin the portion of the raster delineated by the polygon, that seems mathematically correct.
There is no inf value in the raster.Also, I think inside the main script of rasterstats where mean is being calculated as float(masked.mean()), if it is changed to np.mean(masked.astype('float64')) (as the data type of my raster is float32, the problem vanishes). So, I think this limitation of numpy should be taken careof in the versions to come.
@shubhamsharma1609 can you provide a minimal example with code and data to reproduce this?