I want to select a region on a map and get the time series for NDVI based on Landsat 8 imagery. If possible, it would be better if I can get the image row and path through matching the Landsat tiles by my area of interest.
However, I need to select Landsat 8 C2L2 image, filter that for specific time and region with least cloud coverage then get image acquistion time to plot NDVI as a time series.
l8 = ee.ImageCollection("LANDSAT/LC08/C02/T1_L2");
var L8=l8.filterDate('2021-01-01', '2021-11-11')
.select(['SR_B[1-7]','ST_B10'])
.filter(ee.Filter.eq('WRS_PATH', 178))
.filter(ee.Filter.eq('WRS_ROW', 34))
// .copyProperties(l8, ['system:time_start']);
When the copyProperties
line is uncommented, most of the sequentional commands fail to run
print('L8 Mosaic',L8.mosaic())
I can sort images by time here:
var L8Sorted=L8.sort('system:time_start', false)//.limit(10)
print('L8Sorted Time',L8Sorted)
function applyScaleFactors(image) {
var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2);
var thermalBands = image.select('ST_B.*').multiply(0.00341802).add(149.0);
return image.addBands(opticalBands, null, true)
.addBands(thermalBands, null, true);
}
L8 = L8.map(applyScaleFactors);
I want to apply NDVI computation on each image on different dates for my area of interest to produce a time series.
I am unsure if mosaic
is right for this purpose.
var NDVI=L8.mosaic().normalizedDifference(['SR_B5','SR_B4'])
Above mentioned NDVI returns just one image.
And I can't get their time to use in ui.chart function.
How can I achieve my aim?