I have a collection of 457 images, where each image is the total precip in a month, 1981-present.
I want to find the total precip in each quarter i.e. reduce three consecutive images by sum thereby producing another image collection of sie ~ 152
I have the below code, but I am unable to iterate it through all the images
var listofmonthlyprecip = collection.toList(collection.size());// convert collection of 457 images into a list
print (listofmonthlyprecip);
var trial1 = ee.Image(listofmonthlyprecip.get(0));// Jan 1981
var trial2 = ee.Image(listofmonthlyprecip.get(1));// Feb 1981
var trial3 = ee.Image(listofmonthlyprecip.get(2));// Mar 1981
var imgcollection = ee.ImageCollection([trial1, trial2, trial3]); //make collection of first three months
var quarter_trial = imgcollection.reduce(ee.Reducer.sum());// add values
print (quarter_trial);
Map.addLayer (quarter,{min:0, max: 1143}, 'first quarter'); map
How do I iterate through all images to get sum of values for groups of 3 consecutive images?