<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div></div><div><br></div>

<br><div><div>On Apr 17, 2012, at 12:21 PM, Collin Bode wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Lee,<div><br></div><div>I tried the same thing, trying to integrate a full workflow in Python for r.sun (see attached code). &nbsp; I am using a 2x2 meter lidar elevation map with about 120 million cells, so automation is pretty necessary. &nbsp;The whole thing takes 3 weeks to run using 8 CPU cores and 12GB ram. &nbsp;&nbsp;</div><div><br></div><div>However, r.horizon does not work properly on Grass 6.4.2. &nbsp; I can only get it to run on one core in sequence. &nbsp;I cannot get it to accept a single angle and run properly. &nbsp; The output is always for angle 0, both in name and output data. &nbsp;Bug? &nbsp; I was planning to post this to the dev list if no one responds here.</div><div><br></div><div>It would be worthwhile to find out if your version is simply overwriting the previous, similarly named map. &nbsp; If it is, and the maps are actually different (<a href="http://r.info/">r.info</a>), then you can change your code to run r.horizon for a single angle, then rename the map. &nbsp; Something like this:</div><div><br></div><div><div>&nbsp; &nbsp; &nbsp; &nbsp;for azimuth in range(0,361,step_size):</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;grass.run_command("r.horizon", elevin=dem, \</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;direction=angle, maxdistance=maxdistance, \</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;horizon=prefhor, dist=dist, overwrite = 1)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;az = str(azimuth).zfill(3)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tempmap = prefhor+'_0'</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;horizonmap = prefhor+'_'+az</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cmd = tempmap+","+horizonmap</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;grass.run_command("g.rename",rast=cmd) &nbsp; &nbsp; &nbsp; &nbsp;</div></div><div><br></div><div>r.sun does work in multiple cores. &nbsp; &nbsp; &nbsp;&nbsp;<br><div><br class="webkit-block-placeholder"></div><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Collin Bode</div><div>Project Manager, Desktop Watershed Integrated Program</div><div>National Center for Earth-surface Dynamics</div><div>University of California, Berkeley</div></div></span></div></span></div></span></div><span class="Apple-style-span" style="font-size: 12px; "><a href="http://www.nced.umn.edu/">http://www.nced.umn.edu</a></span><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><a href="http://ib.berkeley.edu/labs/power">http://ib.berkeley.edu/labs/power</a></span></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><a href="http://angelo.berkeley.edu/">http://angelo.berkeley.edu</a></span></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br></div></span></div></span></div></span></span></div></div></div><span>&lt;2_rsun_mp.py&gt;</span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>
</div>

<br><div><div>On Apr 1, 2012, at 5:10 AM, Daniel Lee wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi list,<br><br>I've got a large area I'm running r.horizon on. Since the process takes quite a while but it only runs on one processor core and I've got plenty of RAM, I've decided to script it in Python and use run_command and start_command in order to create multiple horizon maps in parallel. Another reason I'm doing it that way is that I only need certain horizons, so I don't want GRASS to do all 360°.<br>

<br>The problem is, when I run the script, all of the maps that I want made seem to be made and I can see in top that there are several instances of r.horizon. But only the instance to be finished last is actually saved. Here's the output:<br>

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 0.000000, raster map &lt;horizon0_0&gt;)<br>&nbsp;100%<br>Calculating map 1 of 1 (angle 12.500000, raster map &lt;horizon12.5_0&gt;)<br>

Calculating map 1 of 1 (angle 7.500000, raster map &lt;horizon7.5_0&gt;)<br>Calculating map 1 of 1 (angle 42.500000, raster map &lt;horizon42.5_0&gt;)<br>Calculating map 1 of 1 (angle 150.000000, raster map &lt;horizon150.0_0&gt;)<br>

&nbsp;100%<br>Calculating map 1 of 1 (angle 162.500000, raster map &lt;horizon162.5_0&gt;)<br>&nbsp;100%<br>Calculating map 1 of 1 (angle 175.000000, raster map &lt;horizon175.0_0&gt;)<br>Calculating map 1 of 1 (angle 167.500000, raster map &lt;horizon167.5_0&gt;)<br>

Calculating map 1 of 1 (angle 197.500000, raster map &lt;horizon197.5_0&gt;)<br>Calculating map 1 of 1 (angle 205.000000, raster map &lt;horizon205.0_0&gt;)<br>Calculating map 1 of 1 (angle 225.000000, raster map &lt;horizon225.0_0&gt;)<br>

&nbsp;100%<br>Calculating map 1 of 1 (angle 257.500000, raster map &lt;horizon257.5_0&gt;)<br>Calculating map 1 of 1 (angle 262.500000, raster map &lt;horizon262.5_0&gt;)<br>&nbsp;100%<br>Calculating map 1 of 1 (angle 275.000000, raster map &lt;horizon275.0_0&gt;)<br>

&nbsp;100%<br>Calculating map 1 of 1 (angle 295.000000, raster map &lt;horizon295.0_0&gt;)<br>Calculating map 1 of 1 (angle 300.000000, raster map &lt;horizon300.0_0&gt;)<br>&nbsp;100%<br>Calculating map 1 of 1 (angle 322.500000, raster map &lt;horizon322.5_0&gt;)<br>

Calculating map 1 of 1 (angle 325.000000, raster map &lt;horizon325.0_0&gt;)<br>&nbsp;100%<br>Calculating map 1 of 1 (angle 337.500000, raster map &lt;horizon337.5_0&gt;)<br>Calculating map 1 of 1 (angle 335.000000, raster map &lt;horizon335.0_0&gt;)<br>

Calculating map 1 of 1 (angle 345.000000, raster map &lt;horizon345.0_0&gt;)<br>Calculating map 1 of 1 (angle 350.000000, raster map &lt;horizon350.0_0&gt;)<br>&nbsp;100%<br>Calculating map 1 of 1 (angle 352.500000, raster map &lt;horizon352.5_0&gt;)<br>

&nbsp;100%<br>Calculating map 1 of 1 (angle 355.000000, raster map &lt;horizon355.0_0&gt;)<br>&nbsp;100%<br>Calculating map 1 of 1 (angle 357.500000, raster map &lt;horizon357.5_0&gt;)<br>&nbsp;100%<br>Calculating map 1 of 1 (angle 257.500000, raster map &lt;horizon257.5_0&gt;)</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 262.500000, raster map &lt;horizon262.5_0&gt;)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">&nbsp;100%</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 275.000000, raster map &lt;horizon275.0_0&gt;)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">&nbsp;100%</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 295.000000, raster map &lt;horizon295.0_0&gt;)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 300.000000, raster map &lt;horizon300.0_0&gt;)</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">&nbsp;100%</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 322.500000, raster map &lt;horizon322.5_0&gt;)</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 325.000000, raster map &lt;horizon325.0_0&gt;)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">&nbsp;100%</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 337.500000, raster map &lt;horizon337.5_0&gt;)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 335.000000, raster map &lt;horizon335.0_0&gt;)</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 345.000000, raster map &lt;horizon345.0_0&gt;)</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 350.000000, raster map &lt;horizon350.0_0&gt;)</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">&nbsp;100%</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 352.500000, raster map &lt;horizon352.5_0&gt;)</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">&nbsp;100%</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 355.000000, raster map &lt;horizon355.0_0&gt;)</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">&nbsp;100%</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Calculating map 1 of 1 (angle 357.500000, raster map &lt;horizon357.5_0&gt;)</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">&nbsp;100%</span><br><br>But when I do g.list rast at the end of it all I only have these maps:<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">raster files available in mapset &lt;Cloppenburg&gt;:</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">dom_aspect&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; horizon162.5_0&nbsp; horizon325.0_0</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">dom_complete&nbsp;&nbsp;&nbsp; horizon225.0_0&nbsp; horizon350.0_0</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">dom_slope&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; horizon262.5_0&nbsp; horizon352.5_0</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">horizon0_0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; horizon275.0_0&nbsp; horizon355.0_0</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">horizon150.0_0&nbsp; horizon300.0_0&nbsp; horizon357.5_0</span><br><br>As you can see, the only horizon maps saved are the last ones made. Does anybody know why this is the case and, if so, what would be a good workaround? Finding the horizons serially on only one processor means that my computer does a lot of sitting around twiddling thumbs. Thanks a bunch!<br>

<br>Daniel<br clear="all"><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"></span></p><p>--<br></p><p>B.Sc. Daniel Lee<br>

Geschäftsführung für Forschung und Entwicklung<br>ISIS - International Solar Information Solutions GbR<br>Vertreten durch: Daniel Lee, Nepomuk Reinhard und Nils Räder<br></p><p>Deutschhausstr. 10<br>35037 Marburg<br>Festnetz:&nbsp;<a value="+4964213796256" style="color:rgb(28,81,168)">+49 6421 379 6256</a><br>

Mobil:&nbsp;<a value="+4917661277269" style="color:rgb(28,81,168)">+49 176 6127 7269</a><br>E-Mail:&nbsp;<a href="mailto:Lee@isi-solutions.org" style="color:rgb(28,81,168)" target="_blank">Lee@isi-solutions.org</a><br>Web:&nbsp;<a href="http://www.isi-solutions.org/" style="color:rgb(28,81,168)" target="_blank">http://www.isi-solutions.org</a></p><p>ISIS wird gefördert durch die Bundesrepublik Deutschland, Zuwendungsgeber: Bundesministerium für Wirtschaft und Technologie aufgrund eines Beschlusses des Deutschen Bundestages, sowie durch die Europäische Union, Zuwendungsgeber: Europäischer Sozialfonds.<br>

Zusätzliche Unterstützung erhält ISIS von dem Entrepreneurship Cluster Mittelhessen, der Universität Marburg, dem Laboratory for Climatology and Remote Sensing und dem GIS-Lab Marburg.</p><div><br class="webkit-block-placeholder"></div>
_______________________________________________<br>grass-user mailing list<br><a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br></blockquote></div><br></div></div>_______________________________________________<br>grass-user mailing list<br><a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>http://lists.osgeo.org/mailman/listinfo/grass-user<br></blockquote></div><br></div></body></html>