# Chart Problem Time series on Land Surface Temperature in Google Earth Engine

In Google Earth Engine, I am having a trouble with my chart. Gets only one value as photo below. Is there any solution?

My code is as follows:

``````//cloud mask
// Bits 3 and 5 are cloud shadow and cloud, respectively.
var cloudsBitMask = (1 << 5);
// Get the pixel QA band.
var qa = col.select('pixel_qa');
// Both flags should be set to zero, indicating clear conditions.
}

//vis params
var vizParams = {
bands: ['B5', 'B6', 'B4'],
min: 0,
max: 4000,
gamma: [1, 0.9, 1.1]
};

var vizParams2 = {
bands: ['B4', 'B3', 'B2'],
min: 0,
max: 3000,
gamma: 1.4,
};

var col = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('2020-07-01','2020-08-1')
.filterBounds(geometry)
.map(function(image){return image.clip(geometry)});

print(col, 'coleccion');

//imagen reduction
{
var image = col.median();
print(image, 'image');
}

//median
{
var ndvi = image.normalizedDifference(['B5',
'B4']).rename('NDVI');
var ndviParams = {min: -1, max: 1, palette: ['blue', 'white',
'green']};
print(ndvi,'ndvi');
}

//select thermal band 10(with brightness tempereature), no calculation
var thermal= image.select('B10').multiply(0.1);
var b10Params = {min: 291.918, max: 302.382, palette: ['blue',
'white', 'green']};

// find the min and max of NDVI
{
var min = ee.Number(ndvi.reduceRegion({
reducer: ee.Reducer.min(),
geometry: geometry,
scale: 30,
maxPixels: 1e9
}).values().get(0));
print(min, 'min');
var max = ee.Number(ndvi.reduceRegion({
reducer: ee.Reducer.max(),
geometry: geometry,
scale: 30,
maxPixels: 1e9
}).values().get(0));
print(max, 'max')
}

//fractional vegetation
{
var fv =(ndvi.subtract(min).divide(max.subtract(min))).pow(ee.Number(2)).rename('FV');
print(fv, 'fv');
}

//Emissivity

var a= ee.Number(0.004);
var b= ee.Number(0.986);
var imageVisParam3 = {min: 0.9865619146722164, max:0.989699971371314};

//LST in Celsius Degree bring -273.15
//NB: In Kelvin don't bring -273.15
var LST = col.map(function(image){
'(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
'Tb': thermal.select('B10'),
'Ep':EM.select('EMM')
}).float()).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');

print(
ui.Chart.image.series({
imageCollection: LST,
region: geometry,
reducer: ee.Reducer.mean(), // default
scale: 30, // nominal scale Landsat imagery
xProperty: 'system:time_start' // default
}));
``````

It looks like you are reusing code in a wrong way. You need individual values for ndvi, thermal and fv images and, ndvi minimums and ndvi maximums values for each ndvi image. You get only one value because you are computing each LST value by using the same image (col.median). You need to map your collection by using a function that computes all differences. Following code snippet does the job (complete code here).

``````//individual LST images

var col_list = col.toList(col.size());

var LST_col = col_list.map(function (ele) {

var date = ee.Image(ele).get('system:time_start');

var ndvi = ee.Image(ele).normalizedDifference(['B5', 'B4']).rename('NDVI');

// find the min and max of NDVI
var min = ee.Number(ndvi.reduceRegion({
reducer: ee.Reducer.min(),
geometry: geometry,
scale: 30,
maxPixels: 1e9
}).values().get(0));

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

var fv = (ndvi.subtract(min).divide(max.subtract(min))).pow(ee.Number(2)).rename('FV');

var a= ee.Number(0.004);
var b= ee.Number(0.986);

var image = ee.Image(ele);

var LST = image.expression(
'(Tb/(1 + (0.00115* (Tb / 1.438))*log(Ep)))-273.15', {
'Tb': image.select('B10').multiply(0.1),
});

return LST.set('system:time_start', date).float().rename('LST');

});

LST_col = ee.ImageCollection(LST_col);

print("LST_col", LST_col);

/////////////////
``````

By using a particular very hot area in Mexico (I also used a different dates range), I got following result after running above code in GEE editor.

If you don't get a result in your area, it can be due to nulls in minimum and maximum values for some ndvi images. It needs to be handle appropriately before getting whatever result.

Editing Note:

I slightly modified my code for printing min and max ndvi values in your roi. It can be observed in the following image that there are several nulls y for this reason you get "ImageCollection (Error) Number.subtract: Parameter 'left' is required" error message. Where nulls are produced, there is not ndvi image (I corroborated that returning ndvi images instead min and max values).

So, for avoiding null values, you need an If statement in return of function as follows:

``````.
.
.
return ee.Algorithms.If(min, LST.set('system:time_start', date).float().rename('LST'), 0);

}).removeAll([0]);
``````

Complete code is in this new link.

After running this code in GEE editor, it can be observed in following image, printed desired chart without any error.

• thank you for your great response! Commented Dec 12, 2021 at 18:18
• when I run my code i get an error "ImageCollection (Error) Number.subtract: Parameter 'left' is required." The code is code.earthengine.google.com/69220b4399113e1cf12bc902783507cb Commented Dec 12, 2021 at 19:25
• Share your ROI geometry. Commented Dec 12, 2021 at 19:27
• I slightly modified my code for printing min and max ndvi values in your roi. It can be observed in the image of my Editing Note. There are several nulls y for this reason you get "ImageCollection (Error) Number.subtract: Parameter 'left' is required" error message. It must be fixed. I will try it later. Commented Dec 12, 2021 at 21:50
• Please, see my Edit Note again. I fixed code for avoiding error message printing chart. Commented Dec 13, 2021 at 2:47