aazuspan/wxee

Hourly precipitation from GPM to daily

Closed this issue · 1 comments

Dear Aaron,

I would like to transform hourly precipitation from GPM to daily. As GPM images of precipitation (mm/h) are every 30 min, I have divide by 2. But my code have apponted an error as "Date: Parameter 'value' is required". Could you helpe me? See the example of my code bellow:

vamos filtrar o conjunto de shapefiles com a função .filter() e escolher apenas a área de MG:

regiao = ee.FeatureCollection('FAO/GAUL/2015/level1').filter(ee.Filter.eq('ADM1_NAME', 'Minas Gerais'))

**# carrega os dados
gpm = ee.ImageCollection('NASA/GPM_L3/IMERG_V06')
.select('precipitationCal')
.filterDate('2021-01-01', '2021-03-11')
.filterBounds(regiao)

transforma de mm/h para mm/0.5h

gpm = gpm.map(lambda img: img.multiply(0.5))

carrega os dados em formato de serie temporal

ts = gpm.wx.to_time_series()

agrupa para diário

daily = ts.aggregate_time(frequency='day', reducer=ee.Reducer.sum())

transforma para DataSet do Xarray**

ds = daily.wx.to_xarray(region=regiao.geometry(), scale=7000)

Thank you very much.

Best Regards,
Enrique

Hi @evmpython, when you run img.multiply(0.5), the properties of img are lost. It's an unfortunately confusing behavior in Earth Engine. wxee requires a system:time_start property to work, so that caused the error.

You can fix this by using copyProperties after you multiply. The example below should work!

gpm = gpm.map(lambda img: img.multiply(0.5).copyProperties(img, img.propertyNames))