3

I'm new to GEE and I'm trying to create time series of MODIS LST for a selected point. I first chose a point on the map and my script is:

var POI = geometry;
// Get  temperature data for 1 year.
var modis = ee.ImageCollection('MODIS/006/MOD11A1');
var modisLST = modis.filterBounds(POI)
    .filterDate('2003-12-25', '2004-02-25')
    .select('LST_Day_1km');

// Convert temperature to Celsius.
modisLST = modisLST.map(function(image) {
  return image.multiply(0.02).subtract(273.15);
});

var tempTimeSeries = ui.Chart.image.seriesByRegion({
  imageCollection: modisLST,
  regions: POI,
  reducer: ee.Reducer.mean(),
  xProperty: 'system:time_start',
  seriesProperty: 'label'
});

When I run this script, nothing happens and after 2 minutes I get:

Too many concurrent aggregations

How do I export the time series from here to csv or xlsx files? and also (but not super important) how do I display it on the GEE platform.

1 Answer 1

1

Here is a working script (https://code.earthengine.google.com/ea82c9501fb736f3f615741620f4875a):

// Get  temperature data for 1 year.
var modis = ee.ImageCollection('MODIS/006/MOD11A1');
var modisLST = modis.filterBounds(POI)
                    .filterDate('2003-12-25', '2004-02-25')
                    .select('LST_Day_1km');


// Convert temperature to Celsius.
modisLST = modisLST.map(function(img){
  var date = img.get('system:time_start');
  return img.multiply(0.02).subtract(273.15).set('system_time_start', date);
});

// Create a function that takes an image, calculates the mean over a
// geometry and returns the value and the corresponding date as a 
// feature.
var createTS = function(img){
  var date = img.get('system_time_start');
  var value = img.reduceRegion(ee.Reducer.mean(), POI).get('LST_Day_1km');
  var ft = ee.Feature(null, {'system:time_start': date, 
                             'date': ee.Date(date).format('Y/M/d'), 
                             'value': value});
  return ft;
};

// Apply the function to each image in modisLST.
var TS = modisLST.map(createTS);

// Create a graph of the time-series.
var graph = ui.Chart.feature.byFeature(TS, 'system:time_start', 'value');

print(graph.setChartType("ColumnChart")
           .setOptions({vAxis: {title: 'LST [deg. C]'},
                        hAxis: {title: 'Date'}}));

// Export the time-series as a csv.
Export.table.toDrive({collection: TS, selectors: 'date, value'});

Basically what's happening is that we map over the images in the image-collection, and create a feature for each image (without a geometry). Then we use the feature-collection to export a csv and plot a graph.

3
  • Thanks, works great. What do I need to change if I want more than 1 point\polygon? I tried to change the POI (1 point) to a layer with 3 polygons (1 layer with 3 polygons) and I got the average for these polygons altogether. How can I get the data per polygon\per point?
    – user88484
    Oct 20, 2018 at 8:18
  • 1
    Cant test it now, but I think you need to use “.reduceRegions” instead of “.reduceRegion”. Oct 20, 2018 at 8:21
  • Just tested it and I get 2 errors: Error generating chart: Failed to decode JSON. Error: Field 'value' of object '{"type":"ArgumentRef","value":null}' is missing or null. Object: {"type":"ArgumentRef","value":null}. and Failed to decode JSON. Error: Field 'value' of object '{"type":"ArgumentRef","value":null}' is missing or null. Object: {"type":"ArgumentRef","value":null}.
    – user88484
    Oct 20, 2018 at 8:26

Your Answer

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

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