Closed clarype closed 3 years ago
Peter, what file did you change?
Oops that should not be closed. I am looking around to make sure that a change wont break anything. So I have not change anything yet.
I think that makeRGBcomposite
would need to change too. The inputs for redYear
, greenYear
, blueYear
are used to select the bands by year. In the return line https://github.com/eMapR/LT-GEE/blob/de1f5f4c3bcf4c90872bafda584318e98f34ee75/LandTrendr.js#L915 I think you could add 'ftv_' +
to e.g. redYear.toString()
to fix it: 'ftv_' + redYear.toString()
.
Not sure about other places.
Ok. So the easiest edit is adding a hard coded prefix string in getYearBandName() at i.toString()
on the line below
https://github.com/eMapR/LT-GEE/blob/de1f5f4c3bcf4c90872bafda584318e98f34ee75/LandTrendr.js#L1188
The hard coded string could be anything like yrs_
, ftv_
, etc. But the change should be structured to what getYeatBandName() is currently being used for. This function is currently being used in functions: TScollectionToStack()
(directly), makeRGBcomposite()
(indirectly via getFittedData()
), and getFittedRGBcol()
(indirectly via getFittedData()
, getFittedData()
. Since the TScollectionToStack() does not typically use fitted data the prefix should not use reference fitting. So something like yr_
should be used since it is giving the band a year value anyway.
changes to each function getYearBandName()
, getFittedRGBcol()
, TScollectionToStack()
, makeRGBcomposite()
, getFittedData()
.
getYearBandName()
// FROM
for (var i = startYear; i <= endYear; ++i) years.push(i.toString());
// TO
for (var i = startYear; i <= endYear; ++i) years.push("yr_"+i.toString());
getFittedRGBcol()
// FROM
var years = ee.List.sequence(startYear, endYear);
var yearsStr = years.map(function(year){
return ee.Algorithms.String(year).slice(0,4);
});
// TO
var yearsStr = ee.List(getYearBandNames(startYear, endYear))
TScollectionToStack()
no change needed
makeRGBcomposite()
// FROM
return ftvStack.select([redYear.toString(),greenYear.toString(),blueYear.toString()]);
//TO
return ftvStack.select(["yr_"+redYear.toString(),"yr_"+greenYear.toString(),"yr_"+blueYear.toString()]);
No changes have been made yet.
Tested changed functions and the functions that call the changed functions. Everything looks good.
The output from getFittedData() can not be save as an asset in GEE do to its band naming syntax, that leads the band name with a numerical character. The error meassage can be seen below.
I am pretty sure the these bands are named like "1999_ftv" or something like that. So the easiest solution I see would be to just flip the name to something like "ftv_1999".
I'll go ahead and look into it.