I've wrot below code for time series processing via modis LST product, but it shows this error:

ImageCollection (Error) Error in map(ID=2018_06_02): Image.constant: Parameter 'value' is required.

Google Earth Engine Code: https://code.earthengine.google.com/69da688a94c65e05e3cac421d5bbd938


// test for tci
var modis = ee.ImageCollection('MODIS/006/MOD11A2')
  return img.multiply(0.02)

var tci = modis.map(function(img){

  var min = img.reduceRegion(ee.Reducer.min(),table,1000).get('LST_Day_1km');
  var max = img.reduceRegion(ee.Reducer.max(),table,1000).get('LST_Day_1km');

  var index = img.expression(
      'LST': img,
      'min': ee.Number(min),
      'max': ee.Number(max),
  return index;


1 Answer 1


That is because in that image there are only masked pixels. Thus, your reduceRegion for the min and max value do not return values. Your image expression therefore doesn't work and throws an error.

You can filter out images that do not contain any data inside your area of interest using:

  var mulitplied = img.multiply(0.02)
  var unmasked = img.gt(-999).reduceRegion(ee.Reducer.count(),table,1000);
  return mulitplied.set('count', unmasked.get('LST_Day_1km'))
// filter images not containing data in the study area 'table'
var filtered = modis.filter(ee.Filter.neq('count', 0));

Then you can continue working with the filtered image collection.

You can anlyse the image not working in any study area by:

var notWorking= modis.filter(ee.Filter.eq('count', 0));

Link script


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.