eMapR / LT-GEE

Google Earth Engine implementation of the LandTrendr spectral-temporal segmentation algorithm. For documentation see:
https://emapr.github.io/LT-GEE
Apache License 2.0
193 stars 65 forks source link

Computed Image is too large when try to extract information from getSegmentData #34

Open Xitermelon opened 1 year ago

Xitermelon commented 1 year ago

Hello,

Thank you for providing this powerful tool! It's a wonderful tool that helps me get vegetation cover change. However, I met some problems with "getSegmentData" function. After I get the segment information by calling getSegmentData, I tried to extract them like max magnitude as training data for my feature collection using sampleRegions. However, it will always return "FetureCollection error: Computed Image is too large". I've tried to clip my study area but it doesn't work.

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

// define parameters var startYear = 2000; var endYear = 2019; var startDay = '06-01'; var endDay = '09-30'; var aoi = ee.Geometry.Point(-67.9527,49.2603);

var index = 'NBR'; var ftvList = ['NBR']; var runParams = { maxSegments: 6, spikeThreshold: 0.9, vertexCountOvershoot: 3, preventOneYearRecovery: true, recoveryThreshold: 0.25, pvalThreshold: 0.05, bestModelProportion: 0.75, minObservationsNeeded: 6 }; var maskThese = ['cloud', 'shadow', 'snow'];

// center and zoom the display in case outputs are to be mapped Map.centerObject(aoi,10); Map.addLayer(aoi);

// apply LandTrendr.js functions var lt = ltgee.runLT(startYear, endYear, startDay, endDay, aoi, index, ftvList, runParams);

// get Segmentation data var segInfo = ltgee.getSegmentData(lt, index, 'all'); var segDelta = segInfo.arraySlice(0, 4, 5).toArray(0);

var sortByThis = segDelta.toArray(0).multiply(-1); var segInfoSorted = segInfo.arraySort(sortByThis); var bigDelta = segInfoSorted.arraySlice(1,0,1); var segMax = bigDelta.arraySlice(0,4,5);

var segMax2 = segMax.arrayProject([0]).arrayFlatten([['segMax']]);

// import traning data var plots_with_class = ee.FeatureCollection('users/xichun_project/point_select_with_class'); print(plots_with_class);

var bands = ['segMax'] var training = segMax2.select(bands).sampleRegions({ collection: plots_with_class, properties: ['Class'], scale: 30 }); print(training);

Thank you in advance :)