0

I´m trying to end this script. It has worked perfectly for other two time range, but for Landsat 5 and Landsat8.

When i tried do the same for LANDSAT7 this error occurred:

Layer error: reduce.median: 'Can't apply calendarRange filter to objects without a timestamp'.

PART OF MY SCRIPT:

var L7coll = ee.ImageCollection('LANDSAT/LE07/C01/T1_TOA')
  .filterBounds(region)
  .filterDate(startDateL7,endDateL7)
  .map(fDeleteClouds)
  .map(landMask)

//Corrigindo as imagens do Landsat5 a partir de 2003 (que são "riscadas")
  .map(function(image){
                var filled1a = image.focal_mean(2, 'square', 'pixels', 1)
                return filled1a.blend(image);
}) 

...

var wet_2001 = L7coll.filter(ee.Filter.calendarRange(10,3,'month'));
var wet_2001_median= wet_2001.median();
var dry_2001 = L7coll.filter(ee.Filter.calendarRange(4,9,'month'));
var dry_2001_median= dry_2001.median();

...

Map.addLayer(wet_2001[1],vizParams,'2001_dry_1');
Map.addLayer(dry_2001[1],vizParams,'2001_wet_1');

Any ideas?

1

Normally, when a function is applied, the result lost its properties. The solution is to copy image properties to the new file. In this case, system:time_start:

var fill = function(image){
                var filled1a = image.focal_mean(2, 'square', 'pixels', 1).blend(image);
                return filled1a.set('system:time_start',image.get('system:time_start'));
};

var L7coll = ee.ImageCollection('LANDSAT/LE07/C01/T1_TOA')
  .filterBounds(region)
  .filterDate(startDateL7,endDateL7)
  .map(fDeleteClouds)
  .map(landMask)
  .map(fill);
  • Thank you, it works perfectly!! – DEA Jun 5 at 13:47

Your Answer

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

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