I would like to get the CSV file of rain daily data from GSMAP for a specified polygon (mean in geometry).
I succeed in getting into it on a chart, but now I want to download the data and I'm having some trouble
Could you help me?
//Add Dates range, with las date available
var iniDate = ee.Date('2018-03-01')
var endDate = ee.Date(ee.List(GSMAP.get('date_range')).get(1)) //last date
print('lastDay available', ee.Date(ee.List(GSMAP.get('date_range')).get(1)))
//Add ImageCollection
var filterGSMAP = GSMAP.filterDate(iniDate, endDate).select(['hourlyPrecipRateGC']);
//Initiate the date list with a day less than the availability,
//as the last day available does not contain images:
var difdate = endDate.advance(-1, 'day').difference(iniDate, 'day'); //calculate steps/days in between
var createList = ee.List.sequence(0, difdate) //make list with the needed number of entries
var listdates = createList.map(function(day){ //change list into list of dates
return iniDate.advance(day, 'day')})
print(listdates)
//Summarize hourly precipitation data to daily precipitation data
//Then filter the image collection using the filterDate, which is (I think) easier than filtering
//on year and doy consecutively:
var gsmapImageCollection = ee.ImageCollection.fromImages(listdates.map(function(summarize_day){
var filterCol = filterGSMAP.filterDate(ee.Date(summarize_day), ee.Date(summarize_day).advance(1, 'day'))
return filterCol.sum().select(['hourlyPrecipRateGC'], ['dailyPrecipRateGC'])
.copyProperties(filterCol.first()).setMulti({
Date: ee.Date(summarize_day), 'system:time_start': ee.Date(summarize_day).millis()});}))
print(gsmapImageCollection)
print(ui.Chart.image.series(gsmapImageCollection, geometry, ee.Reducer.mean(), 5000)
.setChartType('ColumnChart'));
//Set a system:time_start property,
//so you can easily plot/filter etc the resulting image collection.
//Add the resulting image collection to the map
var VIS = {palette: ['1621a2','ffffff', '03ffff','13ff03','efff00','ffb103', 'ff2300'], min: 0, max: 50}
//Map.addLayer(gsmapImageCollection.first(), VIS, 'GSMap');
// Here is my doubt, how can i get the CSV file with two columns, day and acumulated rain.
//Export the time-series as a csv.
Export.table.toDrive({
collection: gsmapImageCollection,
description: 'rain',
selectors: 'day, value',
fileFormat: 'CSV'
});