Hi Soeren, list
I need some help with t.rast.algebra. Well, if it is that my problem is really a t.rast.algebra problem…
I have 2 strds with different granularities. A is an annual time series that contains the min annual temperature, B is a monthly time series containing the min monthly temperature. I want to compare the two of them, and when a pixel of B equals that of A, I need to get the start_month(B) but with the temporal resolution of A. So, what I want as output is a yearly time series containing the month in which the minimum temperature of each year occurs. Does that make any sense??
I been studying t.rast.algebra all morning now and trying different kind of relationships (with no success), and I got lost in the different relationships and the different ways to express them.
Can someone point me to the right way of using t.rast.algebra for this problem?
Thanks so much in advance! 
Cheers,
Vero
On 18/09/15 17:38, Veronica Andreo wrote:
Hi Soeren, list
I need some help with t.rast.algebra. Well, if it is that my problem is
really a t.rast.algebra problem...
I have 2 strds with different granularities. A is an annual time series
that contains the min annual temperature, B is a monthly time series
containing the min monthly temperature. I want to compare the two of
them, and when a pixel of B equals that of A, I need to get the
start_month(B) but with the temporal resolution of A. So, what I want as
output is a yearly time series containing the month in which the minimum
temperature of each year occurs. Does that make any sense??
I been studying t.rast.algebra all morning now and trying different kind
of relationships (with no success), and I got lost in the different
relationships and the different ways to express them.
Can someone point me to the right way of using t.rast.algebra for this
problem?
No help for t.rast.algebra, but wouldn't looping over the years and applying t.rast.series with method=min_raster get you what you want ?
Moritz
Hi Moritz,
I eventually solved it like this:
t.rast.aggregate -s input=cla granularity=“1 years” method=minimum output=yearly_min basename=yearly_min
t.rast.aggregate -s input=cla granularity=“1 months” method=minimum output=monthly_min basename=monthly_min
YEAR_I=2003 ; YEAR_F=2013
MONTH_I=1 ;MONTH_F=12
for YEAR in seq $YEAR_I $YEAR_F
; do
for MONTH in seq -w $MONTH_I $MONTH_F
; do
r.mapcalc expression=“month_min_${YEAR}${MONTH} = if(monthly_min${YEAR}${MONTH} == yearly_min${YEAR}, ${MONTH}, null())” --o
done
done
r.series input=g.list type=raster pattern=*_ag sep=,
output=month_of_min_mode method=mode
Alternatively,
-
t.rast.aggregate -s input=cla granularity=“1 months” method=minimum output=monthly_min basename=monthly_min
-
t.rast.aggregate -s input=monthly_min granularity=“1 years” method=min_rast output=yearly_min_index
-
r.series input=g.list rast pat=yearly_min_ind* sep=,
method=mode
-
r.reclass with
0 = 1
1 = 2
2 = 3
3 = 4
4 = 5
5 = 6
6 = 7
7 = 8
8 = 9
9 = 10
10 = 11
11 = 12
Meanwhile, I still think t.rast.algebra should do the job in one command… I just cannot
figure it out (yet) from the manual page: https://grass.osgeo.org/grass71/manuals/t.rast.algebra.html
I keep studying it, though
Thanks a lot!
Vero
···
2015-09-24 3:58 GMT-03:00 Moritz Lennert <mlennert@club.worldonline.be>:
On 18/09/15 17:38, Veronica Andreo wrote:
Hi Soeren, list
I need some help with t.rast.algebra. Well, if it is that my problem is
really a t.rast.algebra problem…
I have 2 strds with different granularities. A is an annual time series
that contains the min annual temperature, B is a monthly time series
containing the min monthly temperature. I want to compare the two of
them, and when a pixel of B equals that of A, I need to get the
start_month(B) but with the temporal resolution of A. So, what I want as
output is a yearly time series containing the month in which the minimum
temperature of each year occurs. Does that make any sense??
I been studying t.rast.algebra all morning now and trying different kind
of relationships (with no success), and I got lost in the different
relationships and the different ways to express them.
Can someone point me to the right way of using t.rast.algebra for this
problem?
No help for t.rast.algebra, but wouldn’t looping over the years and applying t.rast.series with method=min_raster get you what you want ?
Moritz
Hi,
Sorry, i am unable to help here, since the algebra is a deep mistery for me as well. I think that after i have finished a paper about it, the algebra will be much better documented.
Ciao
Sören
···
2015-09-24 3:58 GMT-03:00 Moritz Lennert <mlennert@club.worldonline.be>:
On 18/09/15 17:38, Veronica Andreo wrote:
Hi Soeren, list
I need some help with t.rast.algebra. Well, if it is that my problem is
really a t.rast.algebra problem…
I have 2 strds with different granularities. A is an annual time series
that contains the min annual temperature, B is a monthly time series
containing the min monthly temperature. I want to compare the two of
them, and when a pixel of B equals that of A, I need to get the
start_month(B) but with the temporal resolution of A. So, what I want as
output is a yearly time series containing the month in which the minimum
temperature of each year occurs. Does that make any sense??
I been studying t.rast.algebra all morning now and trying different kind
of relationships (with no success), and I got lost in the different
relationships and the different ways to express them.
Can someone point me to the right way of using t.rast.algebra for this
problem?
No help for t.rast.algebra, but wouldn’t looping over the years and applying t.rast.series with method=min_raster get you what you want ?
Moritz
Thanks, Sören!
I anxiously await for that paper 
Cheers,
Vero
···
2015-09-24 3:58 GMT-03:00 Moritz Lennert <mlennert@club.worldonline.be>:
On 18/09/15 17:38, Veronica Andreo wrote:
Hi Soeren, list
I need some help with t.rast.algebra. Well, if it is that my problem is
really a t.rast.algebra problem…
I have 2 strds with different granularities. A is an annual time series
that contains the min annual temperature, B is a monthly time series
containing the min monthly temperature. I want to compare the two of
them, and when a pixel of B equals that of A, I need to get the
start_month(B) but with the temporal resolution of A. So, what I want as
output is a yearly time series containing the month in which the minimum
temperature of each year occurs. Does that make any sense??
I been studying t.rast.algebra all morning now and trying different kind
of relationships (with no success), and I got lost in the different
relationships and the different ways to express them.
Can someone point me to the right way of using t.rast.algebra for this
problem?
No help for t.rast.algebra, but wouldn’t looping over the years and applying t.rast.series with method=min_raster get you what you want ?
Moritz