Google Earth Engine – Troubleshooting Image Time Series Chart and Band Name Property

bandgoogle-earth-engineland-surface-temperaturetime series

Here is part of my code for creating a time series chart in GEE.

 var addLST = function(image) {
  var LST = thermal.expression(
'(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
 'Tb': thermal.select('B10'),
'Ep': EM.select('EMM')
}).rename('LST');
Map.addLayer(LST, {min: 20.569706944223423, max:29.328077233404645, 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');
  return image.addBands(LST);
};
 
var withLST = imageCollection.map(addLST);

 // Create an image time series chart.
var chart = ui.Chart.image.doySeriesByRegion
({imageCollection: imageCollection, 
bandName: "LST", 
regions: geometry,
//regionReducer: geometry, 
scale: 200, 
yearReducer: ee.Reducer.mean(), 
//seriesProperty, 
startDay: 153, 
endDay: 244});

// Add the chart to the map.
chart.style().set({
  position: 'bottom-right',
  width: '500px',
  height: '300px'
});
Map.add(chart);

I have created the variable called 'LST' and added it to the whole collection so that each image in the collection should have a band called 'LST'. I hope I am correct in that. Then, I want to create the time series chart where it only shows the 'LST' band and not all 11 bands in the chart. However the bandName: 'LST' code is not working. I get this error:

Collection.first: Error in map(ID=LC08_026029_20130520): Image.select:
Pattern 'LST' did not match any bands.

and this error:

Cannot read properties of null (reading 'awa')

Best Answer

Your code has some issues but the part corresponding to print chart works well. Problem is in imageCollection used. I think you have to use withLST collection where 'LST' band is. As your code is incomplete, I arbitrarily assumed a wrong way for estimating 'LST' bands (by using 'B1' band instead 'EMM') but, it was correctly added to withLST collection for printing a chart without any error.

Complete code is:

var geometry = ee.Geometry.Polygon(
        [[[-1.9540705233485922, 40.29915610852847],
          [-1.9540705233485922, 40.27296656861284],
          [-1.9156183749110922, 40.27296656861284],
          [-1.9156183749110922, 40.29915610852847]]]);

Map.centerObject(geometry);

var imageCollection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
  .filterDate('2020-05-01','2020-08-1')
  .filterBounds(geometry);

print('imageCollection', imageCollection);

function addLST (image) {
  var LST = image.expression(
  '(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
  'Tb': image.select('B10'),
  'Ep': image.select('B1') //I assumed 'B1' as 'Ep'
  }).rename('LST');
  
  return image.addBands(LST);
  
}

var withLST = imageCollection.map(addLST);

print('withLST', withLST);

 // Create an image time series chart.
var chart = ui.Chart.image.doySeriesByRegion
  ({imageCollection: withLST, 
  bandName: "LST", 
  regions: geometry,
  //regionReducer: geometry, 
  scale: 200, 
  yearReducer: ee.Reducer.mean(), 
  //seriesProperty, 
  startDay: 153, 
  endDay: 244});

// Add the chart to the map.
chart.style().set({
  position: 'bottom-right',
  width: '500px',
  height: '300px'
});

Map.add(chart);

After running it in GEE code editor, chart was printed as follows.

enter image description here