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
nodata_value for zonal_stats doesn't appear to work #597
Comments
Thanks for reaching out. I guess the error happened because, in the In the meanwhile, can you try to replace all |
thanks, yep, from looking through the code we noticed that. We also ran with a positive value of 99999 and that worked fine so something with negative sign is causing a bug |
Did the 2 datasets you run are exactly the same except for the nodata value? It could happen that the dataset with a positive value of 99999 does not have a zone that only filled by nodata. If this is not the case, can you please add a minimal reproducible example where positive works and negative doesn't? Off the top of my head, I don't find any reason that it behaves differently with negative sign. |
Good point, I don't think there were any positive values in the array with
99999 so maybe that's why the case worked. I haven't had a chance to swap
out for Nan but I will test both cases when I'm back from the holidays.
…On Thu, Dec 16, 2021, 09:24 thuydotm ***@***.***> wrote:
Did the 2 datasets you run are exactly the same except for the nodata
value? It could happen that the dataset with a positive value of 99999 does
not have a zone that only filled by nodata. If this is not the case, can
you please add a minimal reproducible example where positive works and
negative doesn't? Off the top of my head, I don't find any reason that it
behaves differently with negative sign.
—
Reply to this email directly, view it on GitHub
<#597 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSPPNFMWGM5GVCEK6QM2MTURIODDANCNFSM5KDCMMEA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Fixed in #581 |
Describe the bug
Running zonal_stats and passing in the argument
nodata_values = -99999
results in aValueError: All arrays must be of the same length
stack trace with method and line number
zonal.py line 519
zonal.py 335
python3.7/site-packages/pandas/core/frame.py 614
python3.7/site-packages/pandas/core/internals/construction.py 465
When i run zonal_stats without the
nodata_values
argument it runs fine and computesnodata_values = -99999
ornodata_values = -99999.0
Expected behavior
Would expect the method zonal_stats to return statistics computed ignoring pixels with nodata_values
Screenshots
Unable to provide screenshots, running this in a classified environment
Desktop (please complete the following information):
Running this in Databricks 7.3LTS with Python 3.7.5, xarray-spatial 0.3.0
The text was updated successfully, but these errors were encountered: