fix: don't rename the output names for multi output reducers #435
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #432
overview
This is trying to solve the multi-output reducer problem without breaking everything that already exists. The issues linked to this PR shows that we went one step to far in this function by renaming all the bands in the image as if the reducer used to aggregate the images has multiple outputs then .... it's obviously impossible to keep only the band name.
Earth engine is enoying for this matter because he behaves differently depending on the reducer image combination:
What I decided to set up as a default behaviour in our
reduceInterval
method is : whatever the number of band or reducer the outputs will always be named <band_name>_<reducer_name>.So I included the following piece of code outside the reducer to make an inventory of the band/reducer combination:
Open question how to avoid breaking everything that is already existing ?
My solution is to set a new temporary parameter in the function
keep_original_names
that enforce the previous behaviour (rename everything as the bands). This is triggered only when the outputs are single and will systematically send a warning to the user.Long term evolution
side quest
As i was there I regenerated the tests files with the new ee_dictionary_regression fixture, it's easier to read and cost me 0 time.