Marcello -
That's not so hard. In Grass-GIS 6.4 (the version I'm on ATM) the general form would be:
for i in `echo "select distinct id from rainfall_time_series" | db.select -c`; do
## get year / month / day to use in output map name
year=`echo "select year from rainfall_time_series where id=$i" | db.select -c`;
month=`echo "select month from rainfall_time_series where id=$i" | db.select -c`;
day=`echo "select day from rainfall_time_series where id=$i" | db.select -c`;
outmap="map_"$year"_"$month"_"$day";
## then run your command
<command> input=rainfall_time_series output=$outmap;
done
That will step through each entry in the table.
If you're on a different version, check the db.select command format - I think it changed in Grass-GIS 7.0?
Cheers,
Richard Chirgwin
On 22/02/13 10:21 PM, grass-user-request@lists.osgeo.org wrote:
Message: 3
Date: Thu, 21 Feb 2013 19:56:46 -0300
From: Marcello Benigno<benigno.marcello@gmail.com>
To:grass-user@lists.osgeo.org
Subject: [GRASS-user] Interpolate a huge time-series with a looping
Message-ID:
<CAKPVhYKNBGMsUE73JcXKcFB5uz-Fe=vWUkr9WB0mHHD_C1pGuQ@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
In my dataset I have access to a table in PostgreSQL Database with this
structure:
Table Name: rainfall_time_series
Columns: id | year | month | day | value_mm | x | y | gauge_code
Setting g.region to the Watershed limits, I need create for each day one
interpolated raster, representing the rainfall. This times-series is very
huge, has 17 years, my question is: is it possible to do this operation
with a looping? it is probably easier in R, but I'm newbie in this software.
Thanks in advance,
--
Marcello Benigno B. de Barros Filho
Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB
Mestre em Ci?ncias Geod?sicas e Tecnologias da Geoinforma??o - UFPE
Doutorando em Tecnologia Ambiental e Recursos H?dricos - UFPE
http://profmarcello.blogspot.com
http://about.me/marcello.benigno
Richard
Thank you very much, is exactly what I was looking for.
Cheers
2013/2/22 Richard Chirgwin <rchirgwin@ozemail.com.au>
Marcello -
That’s not so hard. In Grass-GIS 6.4 (the version I’m on ATM) the general form would be:
for i in echo "select distinct id from rainfall_time_series" | db.select -c
; do
get year / month / day to use in output map name
year=echo "select year from rainfall_time_series where id=$i" | db.select -c
;
month=echo "select month from rainfall_time_series where id=$i" | db.select -c
;
day=echo "select day from rainfall_time_series where id=$i" | db.select -c
;
outmap=“map_”$year"“$month”“$day”;
then run your command
input=rainfall_time_series output=$outmap;
done
That will step through each entry in the table.
If you’re on a different version, check the db.select command format - I think it changed in Grass-GIS 7.0?
Cheers,
Richard Chirgwin
On 22/02/13 10:21 PM, grass-user-request@lists.osgeo.org wrote:
Message: 3
Date: Thu, 21 Feb 2013 19:56:46 -0300
From: Marcello Benigno<benigno.marcello@gmail.com>
To:grass-user@lists.osgeo.org
Subject: [GRASS-user] Interpolate a huge time-series with a looping
Message-ID:
<CAKPVhYKNBGMsUE73JcXKcFB5uz-Fe=vWUkr9WB0mHHD_C1pGuQ@mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”
In my dataset I have access to a table in PostgreSQL Database with this
structure:
Table Name: rainfall_time_series
Columns: id | year | month | day | value_mm | x | y | gauge_code
Setting g.region to the Watershed limits, I need create for each day one
interpolated raster, representing the rainfall. This times-series is very
huge, has 17 years, my question is: is it possible to do this operation
with a looping? it is probably easier in R, but I’m newbie in this software.
Thanks in advance,
Marcello Benigno B. de Barros Filho
Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB
Mestre em Ci?ncias Geod?sicas e Tecnologias da Geoinforma??o - UFPE
Doutorando em Tecnologia Ambiental e Recursos H?dricos - UFPE
http://profmarcello.blogspot.com
http://about.me/marcello.benigno
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
–
Marcello Benigno B. de Barros Filho
Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB
Mestre em Ciências Geodésicas e Tecnologias da Geoinformação - UFPE
Doutorando em Tecnologia Ambiental e Recursos Hídricos - UFPE
http://profmarcello.blogspot.com
http://about.me/marcello.benigno