# [GRASS-user] Temporal framework: calculating annual 5-day extremes

Thu Apr 6 02:31:24 PDT 2017

```Hi,

2017-04-06 11:09 GMT+02:00 RichardCooper <richtcooper at hotmail.com>:
> I have a time series of rainfall data, and for each year I want to calculate
> the five-day period with maximum rainfall. So I would need to calculate the
> sum of day1 to day5, then day2 to day6, then day3 to day7 etc for the whole
> year, and then output the maximum grid cell 5-day values for each year into
> a single raster.

What you need is a temporal moving window with the size of 5 days to
compute for each day the 5 day aggregate of the future.
You can convert your time series into a voxel dataset (3d raster) and
use r3.mapcalc with the neighbor index operator map[x][y][z] (if i
remember correctly):

agg_map3d = map3d[0][0][0] + map3d[0][0][1] + ... map3d[0][0][4]

Or you use t.rast.algebra [1] and the temporal neighbor operator strds[t]:

agg_strds = prec_strds[0] + prec_strds[1] + ... prec_strds[4]

Best regards
Soeren

[1] https://grass.osgeo.org/grass73/manuals/t.rast.algebra.html

>
> To do this in t.rast.accumulate, I can see how to set a temporal cycle of 1
> year (cycle= "12 months"), but not sure how to specify such a rolling sum
> calculation of 5 days as described above. The default method is the 'mean'
> as indicated in r.series.accumulation? I'm not too sure how the accumulation
> is applied in the module.
>
> Best regards,
> Richard
>
>
>
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/Temporal-framework-calculating-annual-5-day-extremes-tp5316014p5316076.html
> Sent from the Grass - Users mailing list archive at Nabble.com.
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
```