I did not receive any data from change temperature CSV from my code. How can I correct it?

I need to export monthly yearly change temperature in single CSV but I did not receive any data in my CSV.

How can I solve it?

//var regions = table.filterBounds(geometry);
var regionNames = ee.List([
var regions = table.filterBounds(geometry)
  .map(function (region) {
    var index = region.getNumber('FID_1');
    return ee.Feature(region.geometry(), {
      'Region ID': index,
      'Region Name': regionNames.get(index)
var clipToCol = function(image){
  return image.clip(regions);
var change_c = ee.ImageCollection('MODIS/061/MOD11A2')
.filterDate(ee.Date('2001-01-01'), ee.Date('2022-01-01'))

var months = ee.List.sequence(1, 12);
var years = ee.List.sequence(2001, 2022);

var change= change_c.map(function(image) {
  return image.multiply(0.02).copyProperties(image,['system:time_start']);

var changeByMonthYear = ee.ImageCollection.fromImages(
  years.map(function(y) {
    return months.map(function (m) {
       var median = change
      return change
        .filter(ee.Filter.calendarRange(y, y, 'year'))
        .filter(ee.Filter.calendarRange(m, m, 'month'))
        .set('month', m).set('year', y);
         return median
        .set('empty',  median.bandNames().size().eq(0));
var selectors = ['Region ID', 'Region Name', 'year', 'month', 'ndvi'];

var byRegion = changeByMonthYear
  .filter(ee.Filter.eq('empty', 0)) // Remove year/month without imagery
  .map(function(yearMonthchange) {
    return yearMonthchange
        collection: regions,
        reducer: ee.Reducer.median().setOutputs(['changetemp']), 
        scale: 500
      .map(function (feature) {
        return feature
          .copyProperties(yearMonthchange, yearMonthchange.propertyNames());
  collection: byRegion,
  description: 'changetemp',
  selectors: ['region', 'year', 'month', 'changetemp']

This is my link code: https://code.earthengine.google.com/13515dc5d295ecd2a3e3bdf2e495adab

1 Answer 1


The problem is that the empty property isn't set on the median images, but it's still used to filter out images. That leads to all images being filtered out. You probably want it to look like this:

  var median = change
    .filter(ee.Filter.calendarRange(y, y, 'year'))
    .filter(ee.Filter.calendarRange(m, m, 'month'))
    .set('month', m).set('year', y)
  return median
    .set('empty', median.bandNames().size().eq(0))


  • @ Daniel Wiell thank you for your answer but again this code doesen't have any data in this CSV
    – sadaf
    Commented Sep 20, 2022 at 12:07
  • selectors in your export doesn't name the actual properties in byRegion. Run print(byRegion.first().propertyNames()) and include the property names you want to include in your CSV in selectors. Commented Sep 20, 2022 at 13:42
  • @ Daniel Wiell i got another error where is my mistake sir?code.earthengine.google.com/79d986b36035815b510bf025b27aa04b
    – sadaf
    Commented Sep 20, 2022 at 18:04

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.