1

I want to create a layer of surface temperature for SEBAL model. I am using the standard model for LST for Landsat 8. When I run the code the following error occurs: Temperature: Layer error: ImageCollection.mosaic: Error in map(ID=LC08_159042_20210106): Number.log, argument 'input': Invalid type. Expected type: Number. Actual type: Image<[Enb]>.

function addLST(image) {
  var Rc = image.select('ST_B10').multiply(0.00341802).add(149.0);
  var K1 = ee.Image.constant(774.8853);
  var K2 = ee.Image.constant(1321.0789);
  var t0 = ee.Number(image.select('Enb').multiply(K1).divide(Rc).add(1)).log();
  var t1 = K1.divide(t0).rename('Temperature');
  return image.addBands(t1);
  
} 
var filtered=filtered.map(addLST);  
Map.addLayer(filtered.select('Temperature'), {palette : ['blue','pink','brown','orange','yellow','green']}, 'Temperature');

1 Answer 1

0

I used the 'system:index' of image in error message and, I found out the exact product id that you are using: LANDSAT/LC08/C02/T1/LC08_159042_20210106. If you didn't rename band for obtaining LST, this is 'B10'; not 'ST_B10'. On the other hand, RADIANCE_ADD_BAND_10 is 0.1; not 149 as it is in your code snippet.

Taking above considerations, I modified your code as follows by using a more intuitive approach with expressions.

var dataset = ee.ImageCollection('LANDSAT/LC08/C02/T1')
  .filterMetadata('system:index', 'equals', 'LC08_159042_20210106');

var image = dataset.first();

print(image);

print('RADIANCE_MULT_BAND_10',image.get('RADIANCE_MULT_BAND_10'));
print('RADIANCE_ADD_BAND_10',image.get('RADIANCE_ADD_BAND_10'));
print('K1_CONSTANT_BAND_10',image.get('K1_CONSTANT_BAND_10'));
print('K2_CONSTANT_BAND_10',image.get('K2_CONSTANT_BAND_10'));

Map.centerObject(image);
Map.addLayer(image);

function addLST(image) {
  var Rc = image.expression(
    'L*0.0003342 + 0.1', 
    {'L': image.select('B10')});

  var t1 = image.expression(
    '(1321.0789 / log (774.8853 / Rc + 1)) - 273.15',
    {'Rc': Rc}).rename('Temperature');

  return image.addBands(t1);
  
}

var parVis = {"opacity":1,
                 "bands":["Temperature"],
                 "min":12.563630937215294,
                 "max":29.057135926564285,
                 "palette":['blue','pink','brown','orange','yellow','green']};

var filtered = dataset.map(addLST); 

print(filtered);

Map.addLayer(filtered.select('Temperature'), parVis, 'Temperature');

After running above code in GEE code editor, I got result of following picture without any problem:

enter image description here

4
  • Thanks a lot for your elaborate answer. I wanted to use this for the whole image collection for UAE to create SEBAL model for the year 2021. I used aforementioned scaling factors taken from this place: developers.google.com/earth-engine/datasets/catalog/…. And regarding the t1 formula: why are you subtracted 273.15? because for LST for outgoing radiation there is a different formula. Commented Jul 27, 2022 at 4:56
  • 1) Above code can map whatever image collection for obtaining LST in each image. Only use adequate name. 2) Document in the link has add factor wrong. I corroborated that in other sources and printed all factors involved in my question code. RADIANCE_ADD_BAND_10 is 0.1; not 149.0. 3) The number 273.15 is for converting ºK to ºC. If you want temperatures in Kelvin degrees only delete it.
    – xunilk
    Commented Jul 27, 2022 at 11:45
  • You missed Enb and put log instead of ln. Is it deliberately? Commented Jul 27, 2022 at 12:15
  • I didn't miss Enb because I 'm calculating brightness temperature, You missed the formula for calculating Enb so, you should adapt that for LST calculation. On the other hand, you should know that in GEE natural logarithm is log; not ln (you used it in your question). Logarithm with base 10 is log10.
    – xunilk
    Commented Jul 27, 2022 at 17:00

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.