[GRASS-user] Loop - How To? R.sun manual?
Jerry Nelson
gnelson at uiuc.edu
Mon Nov 12 13:38:49 EST 2007
Dylan, Could you stick that in the faq? I might find that very useful some
day and it would be better for me not to clutter up my local directory?
Thanks, Jerry
-----Original Message-----
From: grassuser-bounces at grass.itc.it [mailto:grassuser-bounces at grass.itc.it]
On Behalf Of Dylan Beaudette
Sent: Monday, November 12, 2007 12:19 PM
To: grassuser at grass.itc.it
Subject: Re: [GRASS-user] Loop - How To? R.sun manual?
On Monday 12 November 2007 10:08:40 am RolandPape wrote:
> Hallo,
>
> I am a quite novice user of GRASS and therefore my question might be
rather
> simple: I would like to calculate global radiation for each day of the
year
> by using r.sun. Instead of doing so day by day I thought about using a
> script defining a loop - but as common Windows user I am not familiar
with
> writing Unix-shell scripts. I appreciate any suggestions!
>
> In one post Dylan and Hamish discussed about a r.sun manual - is it
already
> available? I did not found it except the one at
> http://grass.itc.it/grass62/manuals/html62_user/r.sun.html
>
> Many thanks!
>
> Kind regards,
>
> Roland Pape
> ----------------
> Department of Geography
> University of Bonn
Hi,
Not sure how to do this on windows, but on a linux / unix machine the
construct is like this:
for x in `seq 1 365`
do
echo "Running r.sun for day $x: Linke turbidity factor= ${linke[$x]}"
r.sun --q --o -s elevin=$elev aspin=$aspect slopein=$slope \
diff_rad=diffuse_0$x beam_rad=beam_0$x insol_time=time_0$x \
day=$x \
lin=${linke[$x]}
done & # run in the background
note that i am using a variable to store the map names:
elev=elev_meters at solar
aspect=aspect at solar
slope=slope at solar
also note that i am specifying a daily TL value, from an array like this:
linke[1]=4.1175
linke[2]=4.1108
linke[3]=4.104
...
linke[365]=4.2324
specify a smaller range of days, and run multiple instances of the above to
use multiple cores/ processors on such a machine. You may need to do some
googling to convert the above for-loop construct into a windows-compatible
version.
cheers,
Dylan
_______________________________________________
grassuser mailing list
grassuser at grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser
More information about the grass-user
mailing list