[GRASS-user] Interpolate a huge time-series with looping
Richard Chirgwin
rchirgwin at ozemail.com.au
Fri Feb 22 15:51:21 PST 2013
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 at lists.osgeo.org wrote:
> Message: 3
> Date: Thu, 21 Feb 2013 19:56:46 -0300
> From: Marcello Benigno<benigno.marcello at gmail.com>
> To:grass-user at lists.osgeo.org
> Subject: [GRASS-user] Interpolate a huge time-series with a looping
> Message-ID:
> <CAKPVhYKNBGMsUE73JcXKcFB5uz-Fe=vWUkr9WB0mHHD_C1pGuQ at 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
More information about the grass-user
mailing list