Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hourly precipitation from GPM to daily #50

Closed
evmpython opened this issue May 25, 2022 · 1 comment
Closed

Hourly precipitation from GPM to daily #50

evmpython opened this issue May 25, 2022 · 1 comment

Comments

@evmpython
Copy link

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

@aazuspan
Copy link
Owner

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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants