dea-notebooks
dea-notebooks copied to clipboard
Excessive warnings from `calculate_indices` function on normalised data
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
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...