Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Xitermelon opened this issue Mar 16, 2023 · 0 comments

Comments

@Xitermelon
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant