I want to extract a random sample of pixel values from each image of an image collection and then create a time series from the output. I have created a function to collect an sample of 1000 point from each image as follows.
function sampleImage(image) {
var param = {numPoints: 1000,
classBand: 'LST',
region:polygonCoordList,
scale:30,
tileScale: 4
};
var SamPix = image.stratifiedSample(param);
return SamPix;
}
var training = yearlyCol.map(sampleImage);
print(training)
When running the code I get this error:
mageCollection (Error) Error in map(ID=0): Image.stratifiedSample: The class band must be integer typed.
From the documentation class band should be a string.
https://developers.google.com/earth-engine/apidocs/ee-image-stratifiedsample
I've also tried to go about it by sample random points (code bellow), but it times out after 5min or so
var randomPoints = ee.FeatureCollection.randomPoints(
{region: meanTemp.geometry(), points: 1000});
function sampleImage(image) {
var param = { collection: randomPoints,
scale:30,
tileScale: 4
};
var SamPix = image.sampleRegions(param);
return SamPix;
}
var training = yearlyCol.map(sampleImage);
print(training);
Do you have any recommendations for fixing this error, or maybe an alternative route to get my desire output?