[GRASS-user] help t.rast.algebra

Veronica Andreo veroandreo at gmail.com
Fri Sep 25 07:40:52 PDT 2015


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,

1. t.rast.aggregate -s input=cla granularity="1 months" method=minimum
output=monthly_min basename=monthly_min

2. t.rast.aggregate -s input=monthly_min granularity="1 years"
method=min_rast output=yearly_min_index

3. r.series input=`g.list rast pat=yearly_min_ind* sep=,` method=mode

4. 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 at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150925/3c7aa471/attachment.html>


More information about the grass-user mailing list