TransWikia.com

Writing code to add calculated image to display in Google Earth Engine?

Geographic Information Systems Asked by Anuruddha Marambe on September 8, 2020

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)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP