## DESCRIPTION

t.rast.aggregate temporally aggregates space time raster datasets by a specific temporal granularity. This module support absolute and relative time. The temporal granularity of absolute time can be seconds, minutes, hours, days, weeks, months or years. Mixing of granularities is not supported. In case of relative time the temporal unit of the input space time raster dataset is used. The granularity must be specified with an integer value.

This module is sensitive to the current region and mask settings, hence spatial extent and spatial resolution. In case the registered raster maps of the input space time raster dataset have different spatial resolutions, the default nearest neighbor resampling method is used for runtime spatial aggregation.

## NOTES

The raster module r.series is used internally. Hence all aggregate methods of r.series are supported. See the r.series manpage for details.

This module will shift the start date for each aggregation process depending on the provided temporal granularity. The following shifts will performed:

- granularity years: will start at the first of January, hence 14-08-2012 00:01:30 will be shifted to 01-01-2012 00:00:00
- granularity months: will start at the first day of a month, hence 14-08-2012 will be shifted to 01-08-2012 00:00:00
- granularity weeks: will start at the first day of a week (Monday), hence 14-08-2012 01:30:30 will be shifted to 13-08-2012 01:00:00
- granularity days: will start at the first hour of a day, hence 14-08-2012 00:01:30 will be shifted to 14-08-2012 00:00:00
- granularity hours: will start at the first minute of a hour, hence 14-08-2012 01:30:30 will be shifted to 14-08-2012 01:00:00
- granularity minutes: will start at the first second of a minute, hence 14-08-2012 01:30:30 will be shifted to 14-08-2012 01:30:00

## EXAMPLE

In this example we create 7 raster maps that will be registered in a single space time raster dataset named precipitation_daily using a daily temporal granularity. The names of the raster maps are stored in a text file that is used for raster map registration.

The space time raster dataset precipitation_daily with daily temporal granularity will be aggregated to weekly precipitation resulting in the output space time raster dataset precipitation_weekly. The base name of the new generated raster maps is prec_weekly, the granularity is 1 week. The aggregation method is set to sum to accumulate the precipitation values of all raster maps in a week. The sampling option assures that only raster maps that are temporally during a week will be considered for computation:

    MAPS="map_1 map_2 map_3 map_4 map_5 map_6 map_7"

    for map in ${MAPS} ; do
        r.mapcalc --o expr="${map} = 1"
        echo ${map} >> map_list.txt
    done

    t.create type=strds temporaltype=absolute \
             output=precipitation_daily \
             title="Daily precipitation" \
             description="Test dataset with daily precipitation"

    t.register -i type=rast input=precipitation_daily \
               file=map_list.txt start="2012-08-20" increment="1 days"

    t.info type=strds input=precipitation_daily

    t.rast.aggregate input=precipitation_daily \
                     output=precipitation_weekly \
                     base=prec_weekly granularity="1 weeks" \
                     method=sum sampling=during

    t.support input=precipitation_weekly \
              title="Weekly precipitation" \
              description="Aggregated precipitation dataset with weekly resolution"

    t.info type=strds input=precipitation_weekly

## SEE ALSO

t.rast.aggregate.ds
t.rast.extract
t.info
r.series
g.region
r.mask

## AUTHOR

Sören Gebbert

Last changed: $Date$