-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix nodata retrieval logic to ensure compatibility with rioxarray #192
base: develop
Are you sure you want to change the base?
Fix nodata retrieval logic to ensure compatibility with rioxarray #192
Conversation
@lbferreira thanks for this, but I'd prefer a different fix here, instead of I also think Another nitpick: when adding commits please use following template:
Having commit message as a long single line text makes it much harder to review changelog. |
In your specific case you can work-around the current issue by using da.odc.nodata = float("nan")
# OR
da.rio.write_nodata(float("nan"), encoded=False, inplace=True) @lbferreira can you please report what version of EDIT: it's a numpy 2 issue triggered by use of |
@Kirill888 Sorry for the long commit message. Using float("nan") hasn`t solved the problem. Actually, any value that I set as nodata using rioxarray (int or float) is not correctly retrieved by odc-geo. I am providing a full example below. However, replacing the operator "==" with "is" solves the problem, as you have mentioned. Thus, I will make this change. Please let me know if it looks good to you. Full example
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #192 +/- ##
========================================
Coverage 95.44% 95.44%
========================================
Files 31 31
Lines 5534 5534
========================================
Hits 5282 5282
Misses 252 252 ☔ View full report in Codecov by Sentry. |
no worries, we can fix it. To replace last three commits with one please do: git reset --soft HEAD~3 Then you can make new commit instead of the last three with whatever tool you use. You can then push it to github with: git push --force-with-lease to replace last three commits with one. |
Glad to see this is being addressed! Causing me problems as well! |
@rosepearson this is |
ac2ff81
to
ab46b06
Compare
@Kirill888 All done! |
@Kirill888 I have noted that after this fix, when you have errors, the stack trace comes with a warning... Although it is only a warning, it`s a little annoying. Do you have any suggestions to handle this? In the example below a forced an error, just to show the warning related to nodata... |
@lbferreira thanks, yep, that's a fair warning. We are using |
ab46b06
to
fa4a84c
Compare
@Kirill888 Now everything is working fine without warnings. |
@Kirill888 mypy and pylint tests are not passing because we are accessing a protected class/variable. Any thoughts? |
Currently, if we set nodata using rioxarray, odc-geo fails to retrieve the nodata value.
This PR changes nodata retrieval logic to ensure compatibility with nodata values set using rioxarray.
Before the proposed changes, we have the problem shown in the screenshot below. After the proposed changes, no errors were observed.
Before fix
After fix