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

Excessive warnings from calculate_indices function on normalised data #1072

Open
robbibt opened this issue Jun 9, 2023 · 1 comment
Open
Labels
bug Something isn't working discussion

Comments

@robbibt
Copy link
Collaborator

robbibt commented Jun 9, 2023

Describe the bug/issue
The calculate_indices function currently provides a warning if normalise is set to False, but an index is requested that needs normalisation. This prevents users from running an index that assumes values in the range of 0-1 on data with values in the range of 0-10,000.
https://github.com/GeoscienceAustralia/dea-notebooks/blob/develop/Tools/dea_tools/bandindices.py#L316-L324

However, sometimes a user may wish to pass in data that is already normalised between 0-1, and therefore set normalise to False. However, this still raises the warning, which can produce a lot of spammy messages.

Solution
This line should include a check to see if values are not in the range 0-1, and only raise the warning if that is the case.
https://github.com/GeoscienceAustralia/dea-notebooks/blob/develop/Tools/dea_tools/bandindices.py#L316-L324

@robbibt robbibt added the bug Something isn't working label Jun 9, 2023
@robbibt
Copy link
Collaborator Author

robbibt commented Jun 9, 2023

Hmm, this is complicated by the fact that ds can be Dask, and we don't want to trigger computation early to work out if its values are outside the 0-1.0 range...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discussion
Projects
None yet
Development

No branches or pull requests

2 participants