In the below code I was going to do classification process for time series data but in training data collection returned this error: enter image description here

code link: https://code.earthengine.google.com/b81fe0a02ece289b3c788a5ccba67ac9


var start = '2018-01-01';
var end = '2019-01-01';

var persiannData = function(img){
  return img.clip(table)
  .multiply(255 / 2.0).toInt()

var persiann25km = ee.ImageCollection("NOAA/PERSIANN-CDR")
.filterDate(start, end)


/// ancillary data

var dem = ee.Image("USGS/GTOPO30")

var ndvi = function(img){
  return img.clip(table).addBands(dem)

var evi = function(img){
  return img.clip(table)

var lst = function(img){
  return img.clip(table).select('LST_Day_1km').multiply(0.02)

var modisNDVI = ee.ImageCollection("MODIS/MOD09GA_006_NDVI")
.filterDate(start, end)

var modisEVI = ee.ImageCollection("MODIS/MOD09GA_006_EVI")
.filterDate(start, end)

var modisLST = ee.ImageCollection("MODIS/006/MOD11A1")
.filterDate(start, end)

// data integration

var modisDataset = modisNDVI.combine(modisEVI).combine(modisLST);


var innerJoin = ee.Join.inner();

var filterTimeEq = ee.Filter.equals({
  leftField:'system:time_start' ,
  rightField: 'system:time_start'

var innerJoinModis = innerJoin.apply(modisDataset, persiann25km, filterTimeEq);

print('persiann & modis', innerJoinModis);

var datasetMap = ee.ImageCollection(innerJoinModis.map(function(feature){
  return ee.Image.cat(feature.get('primary'), feature.get('secondary'));


// modelling process

var classificationProcess = datasetMap.map(function(img){
  var bandNames = img.select('NDVI','EVI','elevation','LST_Day_1km')
  var trainingData = img.stratifiedSample({
    numPoints: 100,
    classBand: 'precipitation',
    region: table,
    scale: 1000,
  var classifier = ee.Classifier.smileRandomForest(80)
    features: trainingData,
    classProperty: 'precipitation',
    inputProperties: bandNames
  var classified = img.select('NDVI','EVI','elevation','LST_Day_1km')
  return classified



1 Answer 1


Some of your inputs don't exist on all days. (Specifically, there is no LST on day 42 and others). You can't train a classifier with missing points in your data, so the classifiers for those days fail.

print(ee.Image(datasetMap.toList(1, 42).get(0))
    .reduceRegion(ee.Reducer.count(), table.geometry()))

That said, Creating a new classifier for each day doesn't sound like a good plan. You won't have any way to judge their quality. Some of them will be good and some will be bad (and some wont work at all, like this one). So you wont know if the classification results on any particular day are due to a good/bad classifier or good/bad training from that day.

  • Great. Nevertheless, what is the best plan for classification time series in GEE? Commented May 30, 2021 at 8:39
  • Build 1 classifier and use it on all days. Commented May 30, 2021 at 11:18
  • Good Idea. Could you show an example, please? I know how to do classification process but I don't know how can I use one classifier for all days. Commented May 30, 2021 at 12:16
  • It's unclear what you're really trying to do, since you're doing a classification using precipitation as a categorical class, but you just need to move the training out of the map to produce a classifier you can reuse: code.earthengine.google.com/9b79bf4231c57b2f95466407ec1604ce Commented May 31, 2021 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.