This module expects several parameter. All space time raster datasets that are referenced in the mapcalc expression must be listed in the input option. The first space time raster dataset that is listed as input will be used to temporally sample all other space time raster datasets. The temporal sampling method can be chosen using the method option. The order of the STRDS's in the mapcalc expression can be different to the order of the STRDS's in the input option. The resulting space time raster dataset must be specified in the output option together with the base name of generated raster maps that are registered in the resulting STRDS. Empty maps resulting from map-calculation are not registered by default. This behavior can be changed with the -n flag. The flag -s can be used to assure that only spatial related maps in the STRDS's are processed. Spatial related means that temporally related maps overlap in their spatial extent.
The module t.rast.mapcalc supports parallel processing. The option nprocs specifies the number of processes that can be started in parallel.
A mapcalc expression must be provided to process the temporal sampled maps. Temporal internal variables are available in addition to the r.mapcalc spatial operators and functions:
Supported internal variables for relative and absolute time:
Supported internal variables for absolute time of the current sample interval or instance:
t.rast.mapcalc input=A,B output=C base=c method=equal \ expr="if(start_month() == 5 || start_month() == 6, (A + B), (A * B))"
The resulting raster maps in dataset C can be listed with t.rast.list:
name start_time min max c_1 2001-03-01 00:00:00 9.0 9.0 c_2 2001-04-01 00:00:00 16.0 16.0 c_3 2001-05-01 00:00:00 10.0 10.0 c_4 2001-06-01 00:00:00 12.0 12.0 c_5 2001-07-01 00:00:00 49.0 49.0 c_6 2001-08-01 00:00:00 64.0 64.0
Internally the spatio-temporal expression will be analyzed for each time interval of the sample dataset A, the temporal functions will be replaced by numerical values, the names of the space time raster datasets will be replaced by the corresponding raster maps. The final expression will be passed to r.mapcalc, resulting in 6 runs:
r.mapcalc expr="c_1 = if(3 == 5 || 3 == 6, (a3 + b3), (a3 * b3))" r.mapcalc expr="c_2 = if(4 == 5 || 4 == 6, (a4 + b4), (a4 * b4))" r.mapcalc expr="c_3 = if(5 == 5 || 5 == 6, (a5 + b5), (a5 * b5))" r.mapcalc expr="c_4 = if(6 == 5 || 6 == 6, (a6 + b6), (a6 * b6))" r.mapcalc expr="c_5 = if(7 == 5 || 7 == 6, (a7 + b7), (a7 * b7))" r.mapcalc expr="c_6 = if(8 == 5 || 8 == 6, (a8 + b8), (a8 * b8))"
t.rast.mapcalc input=tempmean_monthly output=january_under_0 base=january_under_0 \ expr="if(start_month() == 1 && tempmean_monthly > 0, null(), tempmean_monthly)" # printing the minimum or maximum values only for January t.rast.list january_under_0 columns=name,start_time,min,max | grep 01-01 name|start_time|min|max january_under_0_01|2009-01-01 00:00:00|-3.380823|-7e-06 january_under_0_13|2010-01-01 00:00:00|-5.266929|-0.000154 january_under_0_25|2011-01-01 00:00:00|-4.968747|-6.1e-05 january_under_0_37|2012-01-01 00:00:00|-0.534994|-0.014581 # these are the original data, you can see that the maximum is different t.rast.list tempmean_monthly columns=name,start_time,min,max | grep 01-01 2009_01_tempmean|2009-01-01 00:00:00|-3.380823|7.426054 2010_01_tempmean|2010-01-01 00:00:00|-5.266929|5.71131 2011_01_tempmean|2011-01-01 00:00:00|-4.968747|4.967295 2012_01_tempmean|2012-01-01 00:00:00|-0.534994|9.69511
Last changed: $Date$