[GRASS-user] t.rast.aggregate help

Veronica Andreo veroandreo at gmail.com
Mon May 18 12:01:38 PDT 2015


Ciao, Maria Elena

> Hallo everybody,
> I am trying to aggregate some time-stamped raster (placed in
> an initial space-time dataset) but I have some problems; each raster represents
> a 1h-cumulated rainfall, so I have something like this:
>
> raster1 | start_time 2014-09-04  12:00:00 | end_time 2014-09-04  13:00:00
> raster2 | start_time 2014-09-04  13:00:00 | end_time 2014-09-04  14:00:00
> etc
>
> I would like to aggregate from a certain datetime backward adopting
> different granularities (2 hours, 3 hours, 4 hours, 5hours and 6 hours) but not
> in a ?massive? way, I  just need the first aggregation for each granularity. I
> came up with something like this:
>
> for i in `seq 2 1 6` ;
>
> do t.rast.aggregate -- o input=initial_dataset  output=${i}h_aggregate  method=sum basename=${i}h_aggregate   granularity="$i hours"   sampling=contains   where="start_time = datetime('2014-09-04
>  14:00:00','-$i hours') and end_time
> <= '2014-09-04  12:00:00'");
>

Sorry for late response.
Luca has come with this (probable) solution for your problem...

for i in `seq 2 1 6` ;
do
    end_time=12;
    start_time=`expr $end_time - $i`;
    t.rast.aggregate --o input=initial_dataset  output=${i}h_aggregate
 method=sum basename=${i}h_aggregate   granularity="$i hours"
sampling=contains   where="start_time >= "2014-09-04
${start_time}:00:00" and end_time <= "2014-09-04  ${end_time}:00:00";
done

We did not test, so please let us know if it works :)
Cheers,

Vero


More information about the grass-user mailing list