I need to chart/download a list of 14-day summed precipitation values, and I was not able to get this script to run. I seem to be running into an error related to the 'system:time_start' property. I'm not sure how to proceed.

var Park = ee.Geometry.Polygon(
        [[[-42.602889166173824, -19.690269395136024],
          [-42.602889166173824, -19.75910638120446],
          [-42.5081320860957, -19.75910638120446],
          [-42.5081320860957, -19.690269395136024]]], null, false);

var roi = Park.geometry()

var START_DATE = "2016-01-01"; 
var STOP_DATE = "2022-01-01";

var rainfall = ee.ImageCollection('NASA/GPM_L3/IMERG_V06')
                  .filterDate(START_DATE, STOP_DATE)

var list_dataset = rainfall.toList(ee.ImageCollection(rainfall.select('precipitationCal')).size());

var len = list_dataset.size();

var n = 14;

var list = ee.List.sequence(0, len.subtract(1), n);

var slicing_list = list.map(function(ele){
  var start = ee.Number(ele).int(); 
  var end = ee.Number(ele).add(n).int(); 
  var new_list = ee.List([]);
  var element = list_dataset.slice(start, end);
  element = ee.ImageCollection(ee.List(element)).sum();
  new_list = new_list.add(element);
  return new_list;


var raincol = ee.ImageCollection(slicing_list.get(0))

var chart = ui.Chart.image.series({
  imageCollection: raincol,
  region: roi,
  reducer: ee.Reducer.median(),
  scale: 100,
  xProperty: 'system:time_start'


1 Answer 1


I'm just getting memory errors. This is probably because you're turning your image collection into a list, something you should try to avoid. Something like this should work:

var windowDays = 14
var startDate = ee.Date('2016-01-01')
var stopDate = ee.Date('2022-01-01')

var rainfall = ee.ImageCollection('NASA/GPM_L3/IMERG_V06')
  .filterDate(startDate, stopDate)

var numberOfDays = stopDate.difference(startDate, 'days')
var rainfallAggregates = ee.ImageCollection(
  ee.List.sequence(0, numberOfDays.subtract(1), windowDays)
    .map(function (dayOffset) {
      var date = startDate.advance(ee.Number(dayOffset), 'days')
      return rainfall
        .filterDate(date, date.advance(14, 'days'))
        .set('system:time_start', date.millis())



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.