1

I have this code below for creating an LST for my region. Then, I create a chart with the mean values. But code gives the LST values in the chart in negative from the range -250 to -293. Now I do not know how and what in the code to change for correct results. Code Link https://code.earthengine.google.com/49dac1b33557fee0afb0c8d1c0ae31cb

//vis params
var vizParams = {
  bands: ['B5', 'B6', 'B4'],
  min: 642,
  max: 3307,
  gamma: [1, 0.9, 1.1]
};

var vizParams2 = {
  bands: ['B4', 'B3', 'B2'],
  min: 0,
  max: 3000,
  gamma: 1.4,
};

//load the collection:
var col = ee.ImageCollection('LANDSAT/LE07/C01/T1').filterMetadata ('CLOUD_COVER', 'less_than', 5)
    .filterDate('2011-01-01','2011-12-31')
    .filterBounds(geometry)
    .map(function(image){return image.clip(geometry)});

print('collection', col);
Map.centerObject(geometry)
//imagen reduction

var image = col.median();
//print('image', image);

Map.addLayer(image, vizParams2);

//median
var ndvi1 = image.normalizedDifference(['B4', 'B3']).rename('NDVI');
var ndviParams = {min: 0.10554729676864096, max: 0.41295681063122924, palette: ['blue', 'white', 'green']};

//print('ndvi1', ndvi1);

//individual LST images

var col_list = col.toList(col.size());

var LST_col = col_list.map(function (ele) {
  
  var date = ee.Image(ele).get('system:time_start');

  var ndvi = ee.Image(ele).normalizedDifference(['B4', 'B3']).rename('NDVI');
  
  // find the min and max of NDVI
  var min = ee.Number(ndvi.reduceRegion({
    reducer: ee.Reducer.min(),
    geometry: geometry,
    scale: 30,
    maxPixels: 1e9
  }).values().get(0));
  
  var max = ee.Number(ndvi.reduceRegion({
    reducer: ee.Reducer.max(),
    geometry: geometry,
    scale: 30,
    maxPixels: 1e9
  }).values().get(0));
  
  var fv = (ndvi.subtract(min).divide(max.subtract(min))).pow(ee.Number(2)).rename('FV');
  
  var a= ee.Number(0.004);
  var b= ee.Number(0.986);
  
  var EM = fv.multiply(a).add(b).rename('EMM');

  var image = ee.Image(ele);

  var LST = image.expression(
    '(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
      'Tb': image.select('B6_VCID_2').multiply(0.1),
      'Ep': fv.multiply(a).add(b)
  });

  return ee.Algorithms.If(min, LST.set('system:time_start', date).float().rename('LST'), 0);

}).removeAll([0]);

LST_col = ee.ImageCollection(LST_col);

print("LST_col", LST_col);

/////////////////

Map.addLayer(ndvi1, ndviParams, 'ndvi');

//select thermal band 10(with brightness tempereature), no calculation 
var thermal= image.select('B6_VCID_2').multiply(0.1);

var b10Params = {min: 200, max: 400, palette: ['blue', 'white', 'green']};

Map.addLayer(thermal, b10Params, 'thermal');

// find the min and max of NDVI
var min = ee.Number(ndvi1.reduceRegion({
  reducer: ee.Reducer.min(),
  geometry: geometry,
  scale: 30,
  maxPixels: 1e9
}).values().get(0));

//print('min', min );

var max = ee.Number(ndvi1.reduceRegion({
  reducer: ee.Reducer.max(),
  geometry: geometry,
  scale: 30,
  maxPixels: 1e9
}).values().get(0));

//print('max', max);

//fractional vegetation
var fv = (ndvi1.subtract(min).divide(max.subtract(min))).pow(ee.Number(2)).rename('FV'); 

//print('fv', fv);

//Map.addLayer(fv);

//Emissivity
var a= ee.Number(0.004);
var b= ee.Number(0.986);
var EM = fv.multiply(a).add(b).rename('EMM');

var imageVisParam3 = {min: 0.9865619146722164, max:0.989699971371314};

//Map.addLayer(EM, imageVisParam3,'EMM');

//LST in Celsius Degree bring -273.15
//NB: In Kelvin don't bring -273.15
var LST = col.map(function (image){

  var date = image.get('system:time_start');
  
  var LST = image.expression(
    '(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
    'Tb': thermal.select('B6_VCID_2'),
    'Ep':EM.select('EMM')
  }).float().rename('LST');
  
  return LST.set('system:time_start', date);
  
});

//print(LST);

Map.addLayer(LST, {min: 22, max: 40, palette: [
'040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6',
'0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef',
'3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f',
'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d',
'ff0000', 'de0101', 'c21301', 'a71001', '911003'
]},'LST');

print(
      ui.Chart.image.series({
        imageCollection: LST_col, 
        region: geometry, 
        reducer: ee.Reducer.mean(),
        scale: 30, // nominal scale Landsat imagery 
        xProperty: 'system:time_start' // default
      }));

//export NDMI
/* 
var export_Collection = LST_col.select (['LST']).toBands();
// As a "flattened" image
print("export_Collection map", export_Collection);
Export.image.toDrive ({
   image: export_Collection, 
   description: 'LST_collection', 
   scale: 30,
   region: geometry,
  maxPixels:1e13
}); 
*/
// As a reduced Image
var export_Image = LST_col.reduce(ee.Reducer.mean());
print("export_Image map", export_Image);
Export.image.toDrive ({
   image: export_Image, 
   description: 'LST_image', 
   scale: 30,
   region: geometry,
  maxPixels:1e13
  
}); 
2
  • " If you have not applied for Earth Engine access, you can submit an application here. Note: the registration process may take several days and not all applications are approved. " when I click that link Jun 13, 2022 at 14:14
  • Your brightness temperatures are wrong calculated. However, you also need other corrections for adequate visualization. Please, see my answer.
    – xunilk
    Jun 13, 2022 at 15:16

1 Answer 1

2

Your brightness temperatures are wrong calculated (see "Conversion to Top of Atmosphere Brightness Temperature" in this document). You need following correction (parameters were obtained from metadata of images; see properties in whatever image of image collection) for getting correct results (K1 = 666.0900268554688, K2 = 1282.7099609375, RADIANCE_MULT_BAND_B6_VCID_2 = 0.03720499947667122, RADIANCE_ADD_BAND_B6_VCID_2 = 3.1628000736236572):

  var Tb = image.expression(
    '1282.7099609375 / log ((666.0900268554688/(0.03720499947667122*L + 3.1628000736236572)) + 1 )', {
    'L': image.select('B6_VCID_2')
  });

  var LST = image.expression(
    '(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
      'Tb': Tb,
      'Ep': fv.multiply(a).add(b)
  });

Above correction was included in complete code and, after running it in GEE code editor, I got following result for an arbitrary area including Islamabad.

enter image description here

However, you also need other corrections for adequate visualization.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.