[GRASS-dev] TGRASS: best practice management of aggregated data

Veronica Andreo veroandreo at gmail.com
Sun Sep 27 18:18:58 PDT 2015


Hi again

2015-09-27 9:58 GMT-03:00 Markus Neteler <neteler at osgeo.org>:

> On Sun, Sep 27, 2015 at 2:35 PM, Veronica Andreo <veroandreo at gmail.com>
> wrote:
> ...
> > Have you noticed the -s flag in t.rast.aggregate? It adds date to file
> names
> > according to granularity of aggregation. I've discovered it recently and
> it
> > is very useful for me.
>
> Oh, I didn't. Can you please post an example for the resulting map name(s)?
> Then I add that to the manual.
>
> Sure! Please, find it attached as txt and modify as you like :)

Cheers,
Vero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20150927/8b3f9ad3/attachment-0001.html>
-------------- next part --------------
# Examples of resulting naming schemes for different aggregations when using -s flag

#### weekly aggregation ####

t.rast.aggregate -s input=daily_temp output=weekly_avg_temp \
basename=weekly_avg_temp method=average granularity="1 weeks"

t.rast.list weekly_avg_temp

GRASS 7.1.svn (latlong_wgs84):~ > t.rast.list weekly_avg_temp
name|mapset|start_time|end_time
weekly_avg_temp_2003_01_03|pruebas|2003-01-03 00:00:00|2003-01-10 00:00:00
weekly_avg_temp_2003_01_10|pruebas|2003-01-10 00:00:00|2003-01-17 00:00:00
weekly_avg_temp_2003_01_17|pruebas|2003-01-17 00:00:00|2003-01-24 00:00:00
weekly_avg_temp_2003_01_24|pruebas|2003-01-24 00:00:00|2003-01-31 00:00:00
weekly_avg_temp_2003_01_31|pruebas|2003-01-31 00:00:00|2003-02-07 00:00:00
weekly_avg_temp_2003_02_07|pruebas|2003-02-07 00:00:00|2003-02-14 00:00:00
weekly_avg_temp_2003_02_14|pruebas|2003-02-14 00:00:00|2003-02-21 00:00:00

#### 8day aggregation ####

t.rast.aggregate -s input=daily_temp output=8day_avg_temp \
basename=8day_avg_temp method=average granularity="8 days"

t.rast.list 8day_avg_temp

GRASS 7.1.svn (latlong_wgs84):~ > t.rast.list 8day_avg_temp
name|mapset|start_time|end_time
8day_avg_temp_2003_01_01|pruebas|2003-01-01 00:00:00|2003-01-09 00:00:00
8day_avg_temp_2003_01_09|pruebas|2003-01-09 00:00:00|2003-01-17 00:00:00
8day_avg_temp_2003_01_17|pruebas|2003-01-17 00:00:00|2003-01-25 00:00:00
8day_avg_temp_2003_01_25|pruebas|2003-01-25 00:00:00|2003-02-02 00:00:00
8day_avg_temp_2003_02_02|pruebas|2003-02-02 00:00:00|2003-02-10 00:00:00
8day_avg_temp_2003_02_10|pruebas|2003-02-10 00:00:00|2003-02-18 00:00:00

# Note that to make this aggregation comparable with 8day MODIS products, for example,
# you should loop over years, and maybe merge resulting strds afterwards

for YEAR in "2003 2004" "2004 2005" ; do
set -- $YEAR ; echo $1 $2
t.rast.aggregate -s input=daily_temp output=8day_avg_temp_${1} \
basename=8day_avg_temp method=average granularity="8 days" \
where="start_time >='${1}-01-01' and end_time < '${2}-01-01'" --o
done

GRASS 7.1.svn (latlong_wgs84):~ > t.list
----------------------------------------------
Space time raster datasets with absolute time available in mapset <pruebas>:
8day_avg_temp_2003 at pruebas
8day_avg_temp_2004 at pruebas
daily_temp at pruebas

GRASS 7.1.svn (latlong_wgs84):~ > t.rast.list 8day_avg_temp_2003
name|mapset|start_time|end_time
8day_avg_temp_2003_01_01|pruebas|2003-01-01 00:00:00|2003-01-09 00:00:00
8day_avg_temp_2003_01_09|pruebas|2003-01-09 00:00:00|2003-01-17 00:00:00
8day_avg_temp_2003_01_17|pruebas|2003-01-17 00:00:00|2003-01-25 00:00:00
8day_avg_temp_2003_01_25|pruebas|2003-01-25 00:00:00|2003-02-02 00:00:00
...
8day_avg_temp_2003_12_03|pruebas|2003-12-03 00:00:00|2003-12-11 00:00:00
8day_avg_temp_2003_12_11|pruebas|2003-12-11 00:00:00|2003-12-19 00:00:00
8day_avg_temp_2003_12_19|pruebas|2003-12-19 00:00:00|2003-12-27 00:00:00
8day_avg_temp_2003_12_27|pruebas|2003-12-27 00:00:00|2004-01-04 00:00:00

#### monthly aggregation ####

t.rast.aggregate -s input=daily_temp output=monthly_avg_temp \
basename=monthly_avg_temp method=average granularity="1 months"

t.rast.list monthly_avg_temp

GRASS 7.1.svn (latlong_wgs84):~ > t.rast.list monthly_avg_temp
name|mapset|start_time|end_time
monthly_avg_temp_2003_01|pruebas|2003-01-01 00:00:00|2003-02-01 00:00:00
monthly_avg_temp_2003_02|pruebas|2003-02-01 00:00:00|2003-03-01 00:00:00
monthly_avg_temp_2003_03|pruebas|2003-03-01 00:00:00|2003-04-01 00:00:00
monthly_avg_temp_2003_04|pruebas|2003-04-01 00:00:00|2003-05-01 00:00:00
monthly_avg_temp_2003_05|pruebas|2003-05-01 00:00:00|2003-06-01 00:00:00
monthly_avg_temp_2003_06|pruebas|2003-06-01 00:00:00|2003-07-01 00:00:00

#### yearly aggregation ####

t.rast.aggregate -s input=daily_temp output=yearly_avg_temp \
basename=yearly_avg_temp method=average granularity="1 years"

t.rast.list yearly_avg_temp

GRASS 7.1.svn (latlong_wgs84):~ > t.rast.list yearly_avg_temp
name|mapset|start_time|end_time
yearly_avg_temp_2003|pruebas|2003-01-01 00:00:00|2004-01-01 00:00:00
yearly_avg_temp_2004|pruebas|2004-01-01 00:00:00|2005-01-01 00:00:00


More information about the grass-dev mailing list