I am trying to find the mean precipitation of a watershed. When I print the feature collection BasinMean, I can see the mean precipitation in the console. A lot of them are zeros but the first two rows have non-zero precipitation.
When I export the table in to a drive, I expect a CSV file which is a timeseries with 3 columns - Station, date(timestamp) and mean precipitation. However, with the below code, the generated CSV has empty cells for mean precipitation. Any idea why the export function does not work?
Link to the workspace : https://code.earthengine.google.co.in/7f21f81224e88bed21e2db64fb7fda30
// Filter the image colelction for a certain timeframe
var filtered = Chirps_daily.filterDate('1981-01-01', '2016-12-31');
// Display the basin
Map.addLayer(Basin,{color:"#008080"},"Basin");
print(Basin,"Basin");
// Load the first image of the collection
var Chirps_first = ee.Image(filtered.first());
print(Chirps_first,'Chirps_first');
// Load the scale of the chirps image
var Chirp_scale = Chirps_first.projection().nominalScale();
var BasinMean = Basin.map(function(f) {
return filtered.map(function(i) {
var mean = i.reduceRegion({
geometry: f.geometry(),
reducer: ee.Reducer.mean(),
});
return f.setMulti(mean).set({date: i.date()})
})
})
// flatten
BasinMean = BasinMean.flatten()
print(BasinMean.limit(20))
Export.table.toDrive({
collection:BasinMean.limit(20),
folder: "Google EE results",
selectors:(["Station","date","precipitation"]),
});
No comments:
Post a Comment