https://code.earthengine.google.com/18914d58d2f193bf206e108774902ce5
var months = ee.List.sequence(1, 12)
...
var monthlyRainfall = months.map(function(month) {
var filtered = monthlyCol.filter(ee.Filter.eq('month', month))
var monthlyMean = filtered.mean()
return monthlyMean.set('month', month)
})
...
var deviation = months.map(function(month) {
var longTermMean = ee.Image(monthlyRainfall
.filter(ee.Filter.eq('month', month)).first())
var monthlyObserved = ee.Image(observedRainfall
.filter(ee.Filter.eq('month', month)).first())
var deviation = (monthlyObserved.subtract(longTermMean)
.divide(longTermMean)).multiply(100)
.set('month', month)
return deviation
})
I am getting an error or line no. 88 in the link that I have mentioned above.
Line 88: monthlyRainfall.filter(...).first is not a function
the solution which i found for this problem is to use ee.Image. But even after using it, I am facing the same error. Please help me how to get through it.