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:
After running it in GEE code editor, chart was printed as follows.