eMapR/LT-GEE

Logic for filtering change map by year is wrong

jdbcode opened this issue · 1 comments

In the getChangeMap function, the LandTrendr results image array is first subset to the segment that is either hi/lo limit case for start year, magnitude, or duration. Later, the selected segments are filtered by year, duration, etc.

Problem: in this flow the selected segment might be e.g. outside of the year range filter when someone wants to know what is the greatest disturbance between 2010 and 2020. There could have been a disturbance that occurred in that year range, but if it is not the greatest in the time series, no results will be returned.

Proposed solution: apply all of the filters to the segments array first and do the segment selection by first/last, least/greatest, fastest/slowest last.

Breaking changes: I don't think this will break anything. Results before and after the change could be different. Would argue that the results from the proposed change is what people are expecting but not getting right now and are unaware.

The proposed solution is drafted in this testing script that compares the results of the old and new version. The segments array is also added to the map. Show/hide the layers with the alpha slider to compare, as well as clicking locations and comparing values among the two change maps and the source segments layer. Test various changeParams.

https://code.earthengine.google.com/ce762790bf9354c5b5c0234f1e96d66a