0

I'm trying to calculate GPM v6 annual precipitation using the google earth engine. but show this error: Line 11: ee.ImageCollection(...).select(...).filterDate(...).filterBounds(...).clip is not a function

enter image description here

I'm using this code:

Map.addLayer(geometry);
Map.centerObject(geometry);

var ano_inicial = 2000
var ano_final = 2020
var mes = ee.List.sequence(1,12)
var intervalo = ee.List.sequence(ano_inicial,ano_final)
var inicio =  ee.Date.fromYMD(ano_inicial,1,1);
var fim = ee.Date.fromYMD(ano_final,12,31);

var GPM = ee.ImageCollection('NASA/GPM_L3/IMERG_V06')
    .select('IRprecipitation')
    .filterDate(inicio,fim)
    .filterBounds(geometry)
    .clip(geometry);
    
var GPM_Anual = ee.ImageCollection.fromImages(
  intervalo.map(function (ano) {
    var annual = GPM.filter(ee.Filter.calendarRange(ano,ano,'year'))
    .sum()
    .multiply(24*30*12)
    .clip(table)
    return annual
    .set('year',ano)
    .set('system:time_start',ee.Date.fromYMD(ano,1,1))
    }))

Export.image.toDrive({
  image : GPM_Anual,
  description : 'GPM_annual_2000_2020',
  scale : 1000,
  region : geometry,
  maxPixels : 1e9
});

what is wrong?

1
  • Don't clip, you can only clip Images not Image Collections. Either map over the collection and clip everything or just leave it out if it's not completely necessary
    – JonasV
    Sep 10 at 11:15
0

clip is a function you can apply to images only, you are now trying to apply to the entire imageCollection. Instead you need to map over the entire collection (=select individual images) and clip it.

.map(function(img){
      return img.clip(geometry)
    })

https://code.earthengine.google.com/9ad4f0384def03fafe12fc94a3ab5f5d

4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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