[GRASS-user] t.rast.list use

Hi list!

I have a strds with 506 maps that correspond to 8-day composite products (11 years).

I want to get the list of maps where start_month is january, february and so on… to use as input in r.series (or t.rast.series), but i’m not finding the way to do that…

i don’t want to aggregate maps by month, i need to use the original maps belonging to each month… is there a way to obtain that (aside from manually :P)??

Till now the only query that has worked in the desired direction is:

t.rast.list input=cla_null_mayor65 where=“start_time >= ‘2003-01’ and start_time <= ‘2003-02’”

cla_null_mayor65_1|clorofila|2003-01-01 00:00:00|2003-01-09 00:00:00
cla_null_mayor65_2|clorofila|2003-01-09 00:00:00|2003-01-17 00:00:00
cla_null_mayor65_3|clorofila|2003-01-17 00:00:00|2003-01-25 00:00:00
cla_null_mayor65_4|clorofila|2003-01-25 00:00:00|2003-02-02 00:00:00

but that’s only for january 2003… and i would need january 2004, 2005… 2013 in the same list… when i add more clauses to the “where” query it stops working…

What would be the right approach here?

THANKS MUCH IN ADVANCE!

Best,
Vero

Hi Veronica,
sorry for the late response.

You can use the datetime[1] functionality of sqlite to perform this
task, this should work for Jannuary:

t.rast.list input=cla_null_mayor65 where='start_time >=
datetime(start_time, "start of year") and start_time <=
datetime(start_time, "start of year", "1 month")'

[1] https://www.sqlite.org/lang_datefunc.html

Best regards
Soeren

2014-06-17 20:40 GMT+02:00 Veronica Andreo <veroandreo@gmail.com>:

Hi list!

I have a strds with 506 maps that correspond to 8-day composite products (11
years).

I want to get the list of maps where start_month is january, february and so
on... to use as input in r.series (or t.rast.series), but i'm not finding
the way to do that...

i don't want to aggregate maps by month, i need to use the original maps
belonging to each month... is there a way to obtain that (aside from
manually :P)??

Till now the only query that has worked in the desired direction is:

t.rast.list input=cla_null_mayor65 where="start_time >= '2003-01' and
start_time <= '2003-02'"

cla_null_mayor65_1|clorofila|2003-01-01 00:00:00|2003-01-09 00:00:00
cla_null_mayor65_2|clorofila|2003-01-09 00:00:00|2003-01-17 00:00:00
cla_null_mayor65_3|clorofila|2003-01-17 00:00:00|2003-01-25 00:00:00
cla_null_mayor65_4|clorofila|2003-01-25 00:00:00|2003-02-02 00:00:00

but that's only for january 2003... and i would need january 2004, 2005...
2013 in the same list... when i add more clauses to the "where" query it
stops working...

What would be the right approach here?

THANKS MUCH IN ADVANCE!

Best,
Vero

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Hi Sören, everyone!

Thanks for the answer!

Eventually (after having done it in much more “artisanal” manner, of course! :)), I found a way of doing what I wanted by means of “strftime” in a link Anna posted once [1].

This is more or less what I did, maybe useful for someone else or as examples in manuals:

check maps i was using as inputs

for a single month

t.rast.list input=my_strds where=“strftime(‘%m’, start_time)=‘01’”

loop for all months

for i in 01 02 03 04 05 06 07 08 09 10 11 12 ; do
t.rast.list input=my_strds where=“strftime(‘%m’, start_time)=‘${i}’” > list_${i}
done

then, applied the selection in t.rast.series

t.rast.series input=my_strds method=average output=average_01
where=“strftime(‘%m’, start_time)=‘01’”

and loop over for different months and methods

for i in 01 02 03 04 05 06 07 08 09 10 11 12 ; do

for m in average median stddev range minimum maximum ; do
t.rast.series input=my_strds method=${m} where=“strftime(‘%m’, start_time)=‘${i}’” output=${m}_${i}
done
done

Best,
Vero

[1] http://courses.ncsu.edu/mea592/common/Assign_GISmdmodel/a_temporal.html

···

2014-07-25 17:45 GMT-03:00 Sören Gebbert <soerengebbert@googlemail.com>:

Hi Veronica,
sorry for the late response.

You can use the datetime[1] functionality of sqlite to perform this
task, this should work for Jannuary:

t.rast.list input=cla_null_mayor65 where='start_time >=

datetime(start_time, “start of year”) and start_time <=
datetime(start_time, “start of year”, “1 month”)’

[1] https://www.sqlite.org/lang_datefunc.html

Best regards
Soeren

2014-06-17 20:40 GMT+02:00 Veronica Andreo <veroandreo@gmail.com>:

Hi list!

I have a strds with 506 maps that correspond to 8-day composite products (11
years).

I want to get the list of maps where start_month is january, february and so
on… to use as input in r.series (or t.rast.series), but i’m not finding
the way to do that…

i don’t want to aggregate maps by month, i need to use the original maps
belonging to each month… is there a way to obtain that (aside from
manually :P)??

Till now the only query that has worked in the desired direction is:

t.rast.list input=cla_null_mayor65 where=“start_time >= ‘2003-01’ and
start_time <= ‘2003-02’”

cla_null_mayor65_1|clorofila|2003-01-01 00:00:00|2003-01-09 00:00:00
cla_null_mayor65_2|clorofila|2003-01-09 00:00:00|2003-01-17 00:00:00
cla_null_mayor65_3|clorofila|2003-01-17 00:00:00|2003-01-25 00:00:00
cla_null_mayor65_4|clorofila|2003-01-25 00:00:00|2003-02-02 00:00:00

but that’s only for january 2003… and i would need january 2004, 2005…
2013 in the same list… when i add more clauses to the “where” query it
stops working…

What would be the right approach here?

THANKS MUCH IN ADVANCE!

Best,
Vero


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user