0

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

asked Oct 19, 2023 at 14:06

1 Answer 1

0

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.

answered Oct 20, 2023 at 22:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.