EDIT: My mistake was calling system:time_start 'day' at the very beginning of my script. So when I called 'system:time_start' later on, it didn't work. When I replaced that by 'day', it worked correctly.

After doing multiple operations on image collections, I lose the timestamp on the irr_d_corr image collection. So my last block of code, which aims to reduce daily values to monthly accumulated irrigation values, doesn't work and I get the error reduce.sum: Can't apply calendarRange filter to objects without a timestamp. My attempt at re-inserting the system:time_start property are below but doesn't work. Any thoughts?

var imageCollection = ee.ImageCollection("NASA/GLDAS/V021/NOAH/G025/T3H"),
    geometry = 
    /* color: #d63000 */
    /* displayProperties: [
        "type": "rectangle"
    ] */
        [[[20.817754866045995, 52.34077419473341],
          [20.817754866045995, 44.17282518184684],
          [40.593145491045995, 44.17282518184684],
          [40.593145491045995, 52.34077419473341]]], null, false);

var dataset = imageCollection.filterBounds(geometry).filterDate('2000-01-01', '2020-01-01');

var pcp = dataset.select('Rainf_tavg').filterDate('2019-01-01', '2020-01-01');
var et = dataset.select('Evap_tavg').filterDate('2019-01-01', '2020-01-01');
var rof = dataset.select('Qs_acc').filterDate('2019-01-01', '2020-01-01');

//Reduce precipitation, evapotranspiration and runoff to daily values and combine them into a single image collection.
var days = ee.List.sequence(1, 365);
var daily = ee.ImageCollection.fromImages(days.map(function(d) {
  var image = pcp.filter(ee.Filter.calendarRange({
    start: d,
    field: 'day_of_year'
    start: d,
    field: 'day_of_year'
    start: d,
    field: 'day_of_year'
  return image
        .set('day', d);

//Compute soil moisture derivative.
var s1 = (dataset.select('SoilMoi0_10cm_inst').filterDate('2000-01-01','2001-01-01').mean()).divide(10800);
var s2 = (dataset.select('SoilMoi0_10cm_inst').filterDate('2019-01-01','2020-01-01').mean()).divide(10800);
var dt = ee.Image(19);
var dsdt = (s2.subtract(s1)).divide(dt);

//Compute daily irrigation values.
var irrigation = daily.map(function(image){
  var test = image
  return test;

//Reduce soil moisture to daily values and compute mean, std dev, and anomalies.
var days = ee.List.sequence(1, 365);
var sm = dataset.select('SoilMoi0_10cm_inst').filterDate('2019-01-01', '2020-01-01');
var pcp = dataset.select('Rainf_tavg').filterDate('2019-01-01', '2020-01-01');

var bands = ee.ImageCollection.fromImages(days.map(function(d) {
      var image = sm.filter(ee.Filter.calendarRange({
            start: d,
            field: 'day_of_year'
            start: d,
            field: 'day_of_year'
      return image
        .set('day', d)

var sm_mean = bands.select('sm').mean();
var sm_stdev = bands.select('sm').reduce(ee.Reducer.stdDev());

//Compute SM anomalies and related irrigation events (0 or 1).
var irr_event = bands.map(function(image){
  var sm_anom = image
  return sm_anom.addBands(image


//Combine daily irrigation values and irrigation events into a single image collection.
var combined = irrigation.combine(irr_event);

//Only keep days where there was an irrigation event.
var irr_d_corr = combined.map(function(image) {
  var date = image.get('system:time_start');
  return image
  .set('system:time_start', date);
print(irr_d_corr);//This is where I lose system:time start property.

//Compute the accumulated irrigation quantities per month.
var months = ee.List.sequence(1, 12);
var irr_acc = ee.ImageCollection.fromImages(months.map(function(g) {
  var filtered = irr_d_corr.filter(ee.Filter.calendarRange({
        start: g,
        field: 'month'
  return filtered.sum().set('month', g);

  • Try adding .set('system:time_start', startDate.millis()) after the snippet you are returning in your mapped function, e.g. return sm_anom.addBands(...).set('system:time_start', startDate.millis()) Jan 20 at 20:05
  • I get the error "date.millis is not a function", here is my code: //Compute SM anomalies and related irrigation events (0 or 1). var irr_event = bands.map(function(image){ var sm_anom = image .addBands(image .select('sm') .subtract(sm_mean) .divide(sm_stdev) .rename('sm_anom') ); var date = image.get('system:time_start'); return sm_anom.addBands(image .select('pcp').lte(1) .and(sm_anom.select('sm_anom').gte(1)) .rename('irrigation_event') ).set('system:time_start', date); }); Feb 1 at 8:07
  • Finally I realized my mistake. My property system:time_start was called 'day', so when I used that to set system:time_start of my other image collections, it finally worked. Feb 1 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.