I am still new to the Google Earth Engine and try to calculate the daily precipitation based on the hourly GSMaP data over a longer period of time. I know, that there are already a couple of questions about that topic, so I put an eye on this and this. However, as I need to calculate the daily precipitation over several years, I use a list of Dates. It seems to work in general, but the first image of the image collection is always empty and it seems like, the daily sum of the precipitation data for the other images is not calculated properly. When I compare my results with the GSMaP webmap, my image seems not to cover all raining events of that day. Has somebody an idea why the first image has no band and the rest might not be calculated correctly?
//Add Dates
var iniDate = ee.Date('2019-05-01')
var endDate = ee.Date('2020-05-19')
//Add ImageCollection
var filterGSMAP = GSMAP.filterDate(iniDate, endDate).select(['hourlyPrecipRateGC']);
//print(filterGSMAP)
var difdate = endDate.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
var gsmapImageCollection = ee.ImageCollection.fromImages(listdates.map(function(summarize_day){
var year = ee.Date(summarize_day).get('year'); //get the year of the list entry
var doy = ee.Date(summarize_day).getRelative('day', 'year'); //get the "day of year" of list entry
var filteredYear = filterGSMAP.filter(ee.Filter.calendarRange({ //filter the Image collection for the year
start: year,
field: 'year'
}));
var filterDay = filteredYear.filter(ee.Filter.calendarRange({ //filter the Image Collection for DOY
start: doy,
field: 'day_of_year'
}));
var currentDate = ee.Date(summarize_day)
return filterDay.sum().copyProperties(filterDay).setMulti({
Date: currentDate
});
}))
print(gsmapImageCollection)
Map.addLayer(filterGSMAP.first(), GSMAPvis, 'GSMap');