-1

I've been trying to use LT-GEE in study for restoration area. But, I get some error

Required argument (timeSeries) missing to function: TemporalSegmentation.LandTrendr(timeSeries, maxSegments, spikeThreshold, vertexCountOvershoot, preventOneYearRecovery, recoveryThreshold, pvalThreshold, bestModelProportion, minObservationsNeeded)

Even when I used the correct module from LT-GEE:

var ltgee = require('users/emaprlab/public:Modules/LandTrendr.js');

1

It seems you are not providing the required argument timeSeries into the function. Also, you should use the provided ee.Algorithms.TemporalSegementation.LandTrendr() to get you result. This function is provided by the Earth Engine and LandTrendr teams on the platform (here is the article describing it).

I have provided example code that uses yearly Landsat 8 as an input into the algorithm:

// get a landsat collection with cloud masked data
var landsat = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR").map(function(img){
  var qa = img.select('pixel_qa');
  var cloudMask = qa.bitwiseAnd(Math.pow(5,2)).eq(0);
  var ndvi = img.normalizedDifference(['B5','B4']).rename('ndvi');
  return img.addBands(ndvi).updateMask(cloudMask);
});
print('Landsat Collection:',landsat.limit(100));

// specify start and end year
var startYear = 2013;
var endYear = 2018;

// map over each year to get a composite
var yearlyComp = ee.ImageCollection(ee.List.sequence(startYear,endYear).map(function(i){
  var t1 = ee.Date.fromYMD(ee.Number(i),1,1);
  var t2 = t1.advance(1,'year');
  return landsat.filterDate(t1,t2).qualityMosaic('ndvi').set('system:time_start',t1.millis());
})).sort('system:time_start');

// display one composite on map
Map.addLayer(ee.Image(yearlyComp.first()),{min:50,max:5500,bands:'B7,B5,B3',gamma:1.5},'Composite Image');

// specify parameters for LandTrendr algorithm
var run_params = { 
  maxSegments:            6,
  spikeThreshold:         0.9,
  vertexCountOvershoot:   3,
  preventOneYearRecovery: true,
  recoveryThreshold:      0.25,
  pvalThreshold:          0.05,
  bestModelProportion:    0.75,
  minObservationsNeeded:  6
};
// add timeSeries key and variable to dict
run_params.timeSeries = yearlyComp.select('ndvi');

// run the algorithm
var result = ee.Algorithms.TemporalSegmentation.LandTrendr(run_params);

// print results and add to Map
print('LandTrendr Result:',result);
Map.addLayer(result,{min:startYear,max:endYear},'LandTrendr Result');

This code gets a result but needs extra post processing to access what you probably need. Please see the documentation for full examples: https://emapr.github.io/LT-GEE/

  • Thanks for help me, mr.Market, specially for send the article. I' trying to understand what axactly each parametrer does for the targets I wish better understand, which are restoration areas. – Lilian Guimarães Apr 15 at 14:47
  • Hello. I'm trying to use LT-GEE with LANDSAT-07/SR images collection, watching vegetation and silviculture targets with NDVI INDEX. The returned values are really incompatibles, demonstrating negative numbers Can you guide me if the is about how I filtering the collecction? Heres is the code link – Lilian Guimarães Apr 17 at 20:23

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.