Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zonal_stats function returns 'infinity' value #215

Open
shubham-scisar opened this issue May 6, 2020 · 3 comments
Open

zonal_stats function returns 'infinity' value #215

shubham-scisar opened this issue May 6, 2020 · 3 comments

Comments

@shubham-scisar
Copy link

zonal_stats function returns infinity when calculating mean for some geometries.

@ircwaves
Copy link

ircwaves commented May 6, 2020

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.

@shubham-scisar
Copy link
Author

shubham-scisar commented May 6, 2020

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.

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.

@perrygeo
Copy link
Owner

@shubhamsharma1609 can you provide a minimal example with code and data to reproduce this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants