Step-by-Step Tutorial for Analyzing Monthly Mean Land Surface Temperature with Google Earth Engine
- Subhadip Datta
- Jul 17, 2024
- 2 min read
This tutorial will guide you through the process of collecting and analyzing land surface temperature (LST) data from Landsat series 5, 8, and 9 using Google Earth Engine (GEE).
Step 1: Define the Area of Interest (AOI)
The AOI is defined using a rectangle polygon.
var geometry = ee.Geometry.Polygon( [[[88.03963647930536, 22.851881331795603], [88.03963647930536, 22.351093553146885], [88.60817895977411, 22.351093553146885], [88.60817895977411, 22.851881331795603]]], null, false);
Step 2: Define the Function to Apply Scale Factors
The applyScaleFactors function converts the raw thermal band values to temperature in Celsius.
function applyScaleFactors(image) { var thermalBand = image.multiply(0.00341802).add(149.0).subtract(273.15); return image.addBands(thermalBand, null, true).rename('LST'); }
Step 3: Set Visualization Parameters
Set the visualization parameters for displaying the LST data.
var imageVisParam = {"opacity":1,"bands":["LST"],"min":27.479629221374058,"max":43.46826575343513,"gamma":1};
Step 4: Define Parameters for Data Collection
Define the parameters such as cloud cover threshold, date range, and AOI.
var cloudcover = 10; // Cloud cover percentage
var startDate = ee.Date('1980-01-01'); // Start date
var endDate = ee.Date('2024-01-01'); // End date
var dstart = 2003; // Start year for monthly mean calculation
var dstop = 2023; // End year for monthly mean calculation
var AOI = geometry; // Area of Interest
var pti = 'Land Surface Temperature -20% Cloud'; // Plot title
Step 5: Filter and Process Landsat 5 Images
Filter Landsat 5 images based on the defined parameters and apply the scale factors.
var l5 = ee.ImageCollection('LANDSAT/LT05/C02/T1_L2') .filterBounds(geometry) .filterDate(startDate, ee.Date('2015')) .filter(ee.Filter.lte('CLOUD_COVER', cloudcover)) .select('ST_B.*'); var l5lst = l5.map(applyScaleFactors);
Step 6: Filter and Process Landsat 8 Images
Filter Landsat 8 images and apply the scale factors.
var l8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') .filterBounds(geometry)
.filterDate(ee.Date('2011'), endDate)
.filter(ee.Filter.lte('CLOUD_COVER', cloudcover))
.select('ST_B.*');
var l8lst = l8.map(applyScaleFactors);
Step 7: Filter and Process Landsat 9 Images
Filter Landsat 9 images and apply the scale factors.
var l9 = ee.ImageCollection('LANDSAT/LC09/C02/T1_L2') .filterBounds(geometry)
.filterDate(ee.Date('2011'), endDate)
.filter(ee.Filter.lte('CLOUD_COVER', cloudcover))
.select('ST_B.*');
var l9lst = l9.map(applyScaleFactors);
Step 8: Merge the Processed Landsat Collections
Merge the processed Landsat 5, 8, and 9 collections and sort them by acquisition date.
var lm1 = l5lst.merge(l8lst);
var FinalLST = lm1.merge(l9lst).sort('DATE_ACQUIRED', true);
var mlst = FinalLST.mean().clip(geometry);
Step 9: Calculate Monthly Mean LST
Calculate the monthly mean LST for the defined date range.
var listi = [];
for (var y = dstart; y <= dstop; y++) { for (var m = 1; m <= 12; m++) { var time = ee.Date(ee.Number(y).format().cat('-').cat(ee.Number(m).format()).cat('-').cat(ee.Number(15).format())).millis();
var imgo = FinalLST.filter(ee.Filter.calendarRange(y, y, 'year')) .filter(ee.Filter.calendarRange(m, m, 'month')) .mean() .set('Date', ee.Date.fromYMD(y, m, 1).format('YYYY-MM')).rename('LST') .set('system:time_start', time, 'system:time_end', time);
var imgL = imgo.bandNames().length(); listi.push(imgo.set('nBands', imgL)); } }
var monmean = ee.ImageCollection.fromImages(listi).filter(ee.Filter.eq('nBands', 1));
Step 10: Print Results
Print the base LST images and the monthly mean LST.
print('Base LST Images', FinalLST); print('Monthly mean LST', monmean);
Step 11: Create and Display the Chart
Create a time series chart for the monthly mean LST and add it to the map.
var chart = ui.Chart.image.series({ imageCollection: monmean, region: geometry, scale: 30, reducer: ee.Reducer.mean(), }) .setSeriesNames(['LST']) .setOptions({ title: pti, lineWidth: 1.2, colors: ['e37d05'], curveType: 'function' }); chart.style().set({ position: 'bottom-right', width: '800px', height: '250px' });
Map.add(chart);
The chart depicts the monthly mean Land Surface Temperature (LST) from 2004 to 2023, ranging from 20°C to 45°C. It shows a clear seasonal pattern, with higher temperatures in summer and lower in winter, but no long-term trend of increasing or decreasing temperatures. Notable anomalies include extreme peaks around 2010 and 2014, and dips around 2011 and 2016, suggesting unusual weather events or variations in cloud cover. Overall, the data indicates stable long-term LST, useful for studying climate change, urbanization impacts, and validating climate models. The consistent seasonal variations affirm the reliability of the dataset.
Comments