0

I used the code that is from gee-ccdc-tools.Now I know the actual time of change. I just change "getLandsat" to "getS2" for the change detection.And the result of change detection using Landsat data is right, the result of change detection using sentintl-2 data is wrong.They are about a year apart, like this:

enter image description here

The Landsat code:


// Define parameters
// Change detection parameters
var changeDetection = {
  breakpointBands: ['GREEN','RED','NIR','SWIR1','SWIR2'],
  tmaskBands: ['GREEN','SWIR2'],
  minObservations: 6,
  chiSquareProbability: .99,
  minNumOfYearsScaler: 1.33,
  dateFormat: 1,
  lambda: 20/10000,
  maxIterations: 25000
}

var studyRegion = table2.geometry();

var params = {
  start: '2015-01-01',
  end: '2021-01-01',
  ChangeDetection: changeDetection,
  // Classification: classification,
  StudyRegion: studyRegion
}

// Filter by date and a location in Brazil
var filteredLandsat = utils.Inputs.getLandsat()
    .filterBounds(params.StudyRegion)
    .filterDate(params.start, params.end)
print(filteredLandsat.size())

params.ChangeDetection['collection'] = filteredLandsat
var results = ee.Algorithms.TemporalSegmentation.Ccdc(params.ChangeDetection)
print(results)

Export.image.toAsset({
  image: results,
  description: "CCDC_Landsat",
  assetId: "CCDC_Landsat",
  scale: 30,
  region: studyRegion,
  maxPixels: 1e13
});

link of landsat: https://code.earthengine.google.com/b250c48be94b9e6cc824aca9e18dd1f6

The sentinel-2 code:


// Define parameters
// Change detection parameters
var changeDetection = {
  breakpointBands: ['GREEN','RED','NIR','SWIR1','SWIR2'],
  tmaskBands: ['GREEN','SWIR2'],
  minObservations: 6,
  chiSquareProbability: .99,
  minNumOfYearsScaler: 1.33,
  dateFormat: 1,
  lambda: 20/10000,
  maxIterations: 25000
};

var studyRegion = table2.geometry();

var params = {
  start: '2015-01-01',
  end: '2021-01-01',
  ChangeDetection: changeDetection,
  // Classification: classification,
  StudyRegion: studyRegion
};

// Filter by date and a location 
var filteredsentinel_2 = utils.Inputs.getS2()
    .filterBounds(params.StudyRegion)
    .filterDate(params.start, params.end)
    // .map(function(img){
    //   return img.addBands(img.normalizedDifference(['NIR','RED']).rename('NDVI'))})
    ;
print(filteredsentinel_2);

params.ChangeDetection['collection'] = filteredsentinel_2;
var results = ee.Algorithms.TemporalSegmentation.Ccdc(params.ChangeDetection);
print(results);

Export.image.toAsset({
  image: results,
  description: "CCDC_results",
  assetId: "CCDC_results",
  scale: 10,
  region: studyRegion,
  maxPixels: 1e13
});

link of sentinel-2: enter link description here

link of gee-ccdc-tools API: https://code.earthengine.google.com/?accept_repo=users/parevalo_bu/gee-ccdc-tools

What is wrong?

3
  • Why do you believe something is wrong? You are looking at two different sensor systems so it is safe to assume that both the outputs will not be the same...
    – Jobbo90
    Sep 20 at 12:49
  • Have you contacted the author of the GEE code? Rather than this community taking a guess at issues (other than obvious code issues) the original author of the code should have insight as to the differences, or perhaps even a coding error on their end. Sep 22 at 16:15
  • thank you!I'll try.As soon as I get the results, I'll explain it here.
    – 陈大光
    Sep 27 at 8:59

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.