I have uploaded 35 images (annual maximum NDVI) to GEE and put them manually (drag and drop) together to an image collection. There is no time band, but for the ee.Reducer.linearFit()
function, I need to add the year of each image as a time band to each image.
I found this image.addBands(image.metadata('system:time_start')
but since there is no system:time_start, this can not be used.
This is another way of doing it:
var Maxyears = ee.List.sequence(1981, 2015);
var NDVIMax35 = ee.ImageCollection.fromImages(
ee.List.sequence(0, NDVI_Max_Stack.bandNames().length().subtract(1))
.map(function(i) {
return NDVI_Max_Stack.select(ee.Number(i))
.rename('Max35')
.set('year', Maxyears.get(i));
})
);
But I have the image collection already, so I need a different function than fromImages()
https://code.earthengine.google.com/?scriptPath=users%2Fwelp1992%2FMaster%3AClimate%20Data