0

I wrote a code for Land Surface Temperature (LST) from Landsat 8 images in google earth engine. I have successfully calculated the following steps, NDVI, fractional vegetation (fv), emissivity (EM), Brightness temperature (BT) is already a calculated band in Landsat image. I wrote an equation for LST. It was successfully executed. However, I can not add the image to display. It gives an error called "LST: Layer error: Parameter 'value' is required." How to fix this error? My code is,

//Take the landsat image
var bands=['B2', 'B3', 'B4', 'B5', 'B10']
var image= ee.Image(l8
    .filterBounds(point)
    .filterDate('2018-02-01', '2018-02-05')
    .sort('CLOUD_COVER')
    .first())
    .select(bands).multiply(0.0001); 


//Display the image
//Map.addLayer(image, {bands: ['B5', 'B4', 'B3'], max:0.9}, 'image');


//NDVI
var red=image.select('B4');
var nir=image.select('B5');

var ndvi= nir.subtract(red).divide(nir.add(red)).rename('NDVI');
print(ndvi);

var ndviparas={min:-1, max:1, palette:['blue', 'white', 'green']};
//Map.addLayer(ndvi, ndviparas, 'NDVI image');

// clip the NDVI image
var ndviClip = ndvi.clip(table);
Map.addLayer(ndviClip, {min: -1, max: 1, palette: ['FF0000', '00FF00']});

/*Export the image to an Earth Engine asset.
Export.image.toAsset({
image: ndviClip,
description: 'imageToAssetExample',
 assetId: 'ndvi_kandy',
 scale: 30
 });
  */

 //select thermal band 10(with brightness tempereature), no BT calculation 
 needed
 var thermal10= image.select('B10').multiply(1000);
 var thermal=thermal10.clip(table);

 Map.addLayer(thermal, {min: 270, max: 400, palette: ['FF0000', '00FF00']});



 // find the min of NDVI

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

   print(min)

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

   print(max)

   //fractional vegetation


  var fv = ndviClip.subtract(min).divide(max.subtract(min)).rename('FV'); 
  print(fv)
  Map.addLayer(fv, {min: 0, max: 1.5, palette: ['FF0000', '00FF00']},'FV');


  //Emissivity

  var a= Number('0.004');
  var b= Number('0.986');
  var EM=fv.multiply(a).add(b).rename('EMM');
  Map.addLayer(EM, {min: 0, max: 1.5, palette: ['FF0000', '00FF00']},'EMM');


  //LST c,d,f, p1, p2, p3 are assigned variables to write equaton easily
  var c=Number('1');
  var d=Number('0.00115');
  var f=Number('1.4388');

  var p1= thermal.multiply(d).divide(f);
  var p2= Math.log(EM);
  var p3= (p1.multiply(p2)).add(c);

  var LST= (thermal.divide(p3)).rename('LST');
  Map.addLayer(LST, {min: 0, max: 350, palette: ['FF0000', 
  '00FF00']},'LST');


 /* R code 
 LST=(BT/(1+(0.00115*BT/1.4388)*log(EM)))
 print(LST)
 plot(LST)
  • Cast all your values to ee.Numbers and ee.Images and I think you will be fine. Note that you will need the server side log() to calculate the log of your image EM. It is easier to get help if you would share the link of the code and scale the script down to the actual problem. – Kuik Jan 13 at 22:14
  • Code worked. your answer was helpful to debug. – Anuruddha Marambe Jan 24 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.