I have this code that extracts the monthly time series of soil moisture, on radius defined by the buffer function:
function bufferPoints(radius, bounds) {
return function(pt) {
pt = ee.Feature(pt);
return bounds ? pt.buffer(radius).bounds() : pt.buffer(radius);
};
}
var ptsbuff = ee.FeatureCollection(point).map(bufferPoints(500, false));
// Create a chart for SoilMoi100_200cm_inst trend in point 1.
var dataset = ee.ImageCollection('NASA/GLDAS/V021/NOAH/G025/T3H')
.filterBounds(point)
.filterDate('2006-01-01', '2016-12-31')
.select('SoilMoi100_200cm_inst');
var months = ee.List.sequence(1, 12);
var start_year = 2006;
var start_date = '2006-01-01';
var end_year = 2016;
var end_date = '2016-12-31';
var years = ee.List.sequence( start_year, end_year);
var byMonthYear = ee.FeatureCollection(
years.map(function (y) {
return months.map(function(m) {
var w = dataset.filter(ee.Filter.calendarRange(y, y, 'year'))
.filter(ee.Filter.calendarRange(m, m, 'month'))
.mean();
var pointMean = w.reduceRegion({reducer:ee.Reducer.first(), geometry:ptsbuff,scale:500});
// set the dictionary as property and cast to an ee.Image, as setMulti returns an ee.Element.
return ee.Feature(null).set("value",pointMean.get("SoilMoi100_200cm_inst")).set("year",y).set("month",m);
});
}).flatten()
);
// print the collection, point information
//print("feature collection",byMonthYear);
Export.table.toDrive({collection:byMonthYear,description:"csvExport"})
Since I am doing extractions on several radius (For example 250, 500, 1000, 1500, 2000...), I have to re-execute the code each time.
Is there a way to modify the code to extract the data simultaneously and automatically with several buffer radius.