I try to compute the mean value of a band on each image of an imageCollection and store all the values in a Array to compute the RMSE with another dataset that I will also store in an Array (not sure about this part, do I have to store them in array to be able to calculate the RMSE between the two ?). I try to use the .map() logic but got this error : A mapped algorithm must return a Feature or Image. Here is the function I made :
function meanChloaM(img){
var mean = img.reduceRegion(ee.Reducer.mean(), ROI)
var MeanModis = ee.Feature(mean)
return MeanModis
}
You can see my full code here : https://code.earthengine.google.com/e101fc2c9eabed8b04688569b1255888
1 Answer 1
ReduceRegion returns a dictionary. You can't just turn that into a Feature by wrapping it in a Feature constructor. You use set()
to set properties on a feature. If you don't have a geometry, you use null.
var MeanModis = ee.Feature(null).set(mean)
Or, better, just set this as metadata on the image, and treat the image collection as a feature collection.