0

The original code was for MODIS data, but I would like to do a time series with Landsat8 Tier 2 Level 2, which already has the LST values, you just have to apply the scalling factor. I modified the code to use Landsat8 collection, however, I get absurd numbers for the LST, like negative hundreds. I don't understand what I'm doing wrong with this code.

// Import image collection
var landsat = ee.ImageCollection('LANDSAT/LC08/C02/T2_L2');
// A start date is defined and the end date is determined by advancing years from the start date.
var start = ee.Date('2025-08-04');
var dateRange = ee.DateRange(start, start.advance(10, 'year'));

// Filter the LST collection to include only images from time frame and select day time temperature band

var modLSTday = landsat.filterDate(dateRange).select('ST_B10');

// Scale to Kelvin and convert to Celsius, set image acquisition time.
var modC = modLSTday.map(function(image) {
  return image
    .multiply(0.00341802)
    .add(149.0)
    .subtract(273.15)
    .copyProperties(image, ['system:time_start']);
});
// Chart the time-series
var temp_trend = ui.Chart.image.series({
  imageCollection: modC,
  region: roi,
  reducer: ee.Reducer.mean(),
  scale: 30,
  xProperty: 'system:time_start'})
  .setOptions({
    lineWidth: 1,
    pointSize: 3,
    trendlines: {0: {
        color: 'CC0000'
      }},
     title: 'LST  Time Series',
     vAxis: {title: 'LST Celsius'}});
print(temp_trend);

//Clip to roi
var LSTclip = modC.mean().clip(roi);

// Add clipped image layer to the map.
Map.addLayer(LSTclip, {
  min: 0, max: 40,
  palette: ['blue', 'limegreen', 'yellow', 'darkorange', 'red']},
  'Mean temperature');

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.