Hi,<div><br></div><div>Thanks again. Since i use GRASS 7.0, it will not work there. I do not think it can either be installed in GRASS for Windows through Add-on extensions. What about using grass.mapcalc to integrate each viewshed if there is a method of handling variables in it? If not how about using r.series with sum? Your advice is appreciated since i am</div>
<div>pretty new to GRASS.</div><div><br><div class="gmail_quote">On Tue, Jan 8, 2013 at 9:19 PM, Leonidas Liakos <span dir="ltr"><<a href="mailto:leonidas_liakos@yahoo.gr" target="_blank">leonidas_liakos@yahoo.gr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:10pt;font-family:Courier New,courier,monaco,monospace,sans-serif"><div><span><div style="font-size:10pt">
<span>Do you need cumulative viewshed analysis?</span></div><div style="background-color:transparent"><span>Maybe r.cva is for you:</span></div><div style="font-size:16px;background-color:transparent"><span><font><a href="http://www.ucl.ac.uk/~tcrnmar/GIS/r.cva.html" target="_blank">http://www.ucl.ac.uk/~tcrnmar/GIS/r.cva.html</a></font></span></div>
</span></div><div><br></div> <div style="font-family:'Courier New',courier,monaco,monospace,sans-serif;font-size:10pt"> <div style="font-family:'times new roman','new york',times,serif;font-size:12pt">
<div dir="ltr"> <font face="Arial"> <hr size="1"> <b><span style="font-weight:bold">Απο:</span></b> Brian Sanjeewa Rupasinghe <<a href="mailto:jinkabs@gmail.com" target="_blank">jinkabs@gmail.com</a>><br> <b><span style="font-weight:bold">Προς:</span></b> Anna Kratochvílová <<a href="mailto:kratochanna@gmail.com" target="_blank">kratochanna@gmail.com</a>>;
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a> <br> <b><span style="font-weight:bold">Στάλθηκε:</span></b> 2:45 μ.μ. Τρίτη, 8 Ιανουαρίου 2013<br> <b><span style="font-weight:bold">Θέμα:</span></b> Re: [GRASS-user] Using a variable inside GRASS commands with Python code/ grass.mapcalc<br>
</font> </div><div><div class="h5"> <br><div>Hi,<div><br></div><div>Many thanks. It worked for me. Then i have a similar problem in GRASS.mapcalc. What i need next is to add viewshed of each observer location cumulatively while looping through the observer locations in order to have final integrated viewshed analysis map. So i used the following command in Python (some code ommitted)</div>
<div><br></div><div>for i in:</div><div> grass.run_command('r.viewshed', input = rinput, output = 'viewshed', coordinate = [x,y], obs_elev = oelv, tgt_elev = th, memory = 4098, flags = 'b', overwrite = True, quiet = True)<span style="white-space:pre-wrap"> </span></div>
<div><br></div><div> grass.mapcalc("viewshed_cum = viewshed + viewshed_cum", overwrite = True, quiet = True)</div><div><br></div><div>It seems that expressions like sum = c + sum does not work inside <a rel="nofollow" href="http://grass.mapcalc.is/" target="_blank">grass.mapcalc.Is</a> there any alternative or other way around to get this done? I am using GRASS 7 in Windows 7.</div>
<div><br></div><div>Cheers, Brian<br><br><div>On Tue, Jan 8, 2013 at 1:25 PM, Anna Kratochvílová <span dir="ltr"><<a rel="nofollow" href="mailto:kratochanna@gmail.com" target="_blank">kratochanna@gmail.com</a>></span> wrote:<br>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Brian,<br>
<div><br>
On Tue, Jan 8, 2013 at 6:51 AM, Brian Sanjeewa Rupasinghe<br>
<<a rel="nofollow" href="mailto:jinkabs@gmail.com" target="_blank">jinkabs@gmail.com</a>> wrote:<br>
> Hi all<br>
><br>
> I am generating viewshed of each observer location by iterating through a<br>
> set of observer coordinate file through<br>
> Python code in Windows 7 . Below is the python command used in grass for<br>
> each iteration. According to this, each time<br>
> loop iterates, output is overwritten with the same name. Now what i need is<br>
> to keep each output of all the observer locations. For this, i need to<br>
> concatanate output name (i.e. 'viewshed' with loop index i which will be<br>
> 'viewshed' + str(i) ). How is that possible within<br>
> this grass.run_command?<br>
><br>
<br>
</div>just set a variable within each loop and use it in the run_command:<br>
for i in ... :<br>
out = 'viewshed' + str(i)<br>
grass.run_command('r.viewshed', input = rinput, output = out, ...)<br>
<br>
<br>
Regards,<br>
Anna<br>
<div><br>
> grass.run_command('r.viewshed', input = rinput, output = 'viewshed',<br>
> coordinate = [x,y], obs_elev = oelv, tgt_elev = th, memory = 4098, flags =<br>
> 'b', overwrite = True, quiet = True)<br>
><br>
> Cheers, Brian<br>
><br>
</div>> _______________________________________________<br>
> grass-user mailing list<br>
> <a rel="nofollow" href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
> <a rel="nofollow" href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
><br>
</blockquote></div><br></div>
</div><br>_______________________________________________<br>grass-user mailing list<br><a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
<br><br> </div></div></div> </div> </div></div></blockquote></div><br></div>