<div dir="ltr"><div><div><div><div><div><div><div>I understand I should use GRASS with Ubuntu to get the best results, but I'm not only new with GRASS and Python but also with Ubuntu ;)<br></div>Ubuntu server I know a little and I have learned to appreciate it very much, but Ubuntu desktop is completely new for me.<br>
</div>That is the reason I wanted to start on Window, because I feel more comfortable with it.<br><br></div>It seems getting the annual solar radiation is working now. I need to update my script for using r.series.<br></div>
I'm going to run a full year now. I have the ArcMap results for the same area as well and I first want to compare those.<br></div>After that I'm going to look at the rest of the ArcMap model, since the solar radiation is only one of the steps I need to convert to GRASS/Python.<br>
<br></div>When I have reproduced all steps in GRASS I'm going to create a Python script of it and then I can run the complete area on my Ubuntu server.<br><br></div>Thanks all for now and I will be back ;)<br><div><div>
<br></div></div></div><div class="gmail_extra"><br clear="all"><div><br>
<br>
Paul<br>
<br>
<div style="font-size:13.3px;font-family:Verdana,Arial,Helvetica,sans-serif"><div style="border:1px solid #e5e5e5;background-color:#f8f8f8;padding:0.8em 0.8em 0.3em 0.8em"><div style="margin:0 0 8px 0"><p style="margin:0">
<span><b><img style="float:left;margin-left:5px;margin-right:5px" src="http://www.bontepaarden.nl/bontepaarden/images/newButton.png" alt="" height="120" width="160">Paul Meems </b><br><span>Release manager, configuration manager</span><br>
<span>and forum moderator of MapWindow GIS.</span><br><a href="http://www.mapwindow.org/" target="_blank"><span>www.mapwindow.org</span></a><br><br><span>Owner of MapWindow.nl - Support for</span><br><span>Dutch speaking users.</span><br>
<a href="http://www.mapwindow.nl/" target="_blank"><span>www.mapwindow.nl</span></a><br></span></p>
<p style="margin:0"><b><br></b></p></div></div><img src="http://p1.wisestamp.com/pixel.png?p=mozilla&v=3.9.12&t=1322134056890&u=482737fd0c4ca423" height="1" width="1"></div>
</div>
<br><br><div class="gmail_quote">2012/12/28 Daniel Lee <span dir="ltr"><<a href="mailto:lee@isi-solutions.org" target="_blank">lee@isi-solutions.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p>Hi Paul,</p>
<p>I think one of your problems is... using windows ;) I have heard that the Windows version of GRASS works a LOT better than it used to, but GRASS was actually the reason I switched to Linux a couple of years ago. Back then it just ran better in Linux - a lot better. Since then, I've never gone back to Windows because I'm very satisfied with Linux, not just with GRASS but with everything else I do with the computer. Of course, Linux vs. Windows is a whole different story and doesn't belong in this list, but that was my experience.</p>
<p>If you're wanting to use GRASS in a headless Ubuntu server anyway, why don't you set up a Linux machine or at least a Linux installation in a virtual machine and play around with it there? There everything should work well and the development environment would match your production environment. OSGeo has a great live installation including all of the latest Geo software, Python, etc. - everything the;heart could desire. since I'm out and about at the moment I can't send you the address, but just Google for an OSGeo live installation and you'll see it right away.</p>
<p>Hope that helps,<br>
Daniel</p>
<div class="gmail_quote">Am <a href="tel:28.12.2012%2015" value="+12812201215" target="_blank">28.12.2012 15</a>:28 schrieb "Paul Meems" <<a href="mailto:bontepaarden@gmail.com" target="_blank">bontepaarden@gmail.com</a>>:<div>
<div class="h5"><br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div>Hi Sotiris,<br><br></div>Thanks for your help.<br></div>I will have a look at the r.series.<br></div><br>Meanwhile I've discovered the graphical modeler. It is not working 100% in all cases but it does generates a Python script with all the necessary parameters.<br>
<br></div>This is my script so far, which seems to be working:<br><span style="font-family:courier new,monospace">for x in range(1, 10, 1):<br> print "Working on day %d" % (x)<br> # Create radiation for each day:<br>
glob_rad = 'global' + str(x)<br> grass.run_command('r.sun', flags = 's', overwrite = True, elevin = 'w001001@temp', aspin = 'aspect@</span><span style="font-family:courier new,monospace">temp', slopein = 'slope@temp', glob_rad = glob_rad, day = x)<br>
<br> # Combine the radiation file with the previous one:<br> if x == 2:<br> grass.run_command("r.mapcalculator", overwrite = True, amap = "global1", bmap = "global2", formula = "A+B",<br>
outfile = "suntemp2") <br> elif x > 2: <br> # Use temp name or else it won't work:<br> amap = "suntemp" + str(x-1)<br> bmap = "global" + str(x) + "@temp"<br>
outfile = "suntemp" + str(x) <br> grass.run_command("r.mapcalculator", overwrite = True, amap = amap, bmap = bmap, formula = "A+B",<br> outfile = outfile)<br>
<br># Finalize:<br>grass.mapcalc('sun=' + outfile, quiet=False, verbose=True, overwrite=True)<br># Clean up: <br>grass.run_command('g.mremove', flags = 'f', rast = "suntemp*") <br>
grass.run_command('g.mremove', flags = 'f', rast = "global*")<br>print "Done"</span><br><br></div>Thanks<br clear="all"><div class="gmail_extra"><div>
<br>
Paul<br></div><br><div class="gmail_quote">2012/12/28 S. Koukoulas (lists) <span dir="ltr"><<a href="mailto:sotkouklistes@gmail.com" target="_blank">sotkouklistes@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Dear Paul,<br>
<br>
having said all that for r.mapcalc, I wonder whether you really need<br>
mapcalc. In your case,<br>
couldn't you just use the * r.series * command with Sum (and perhaps<br>
g.mlist can help you make a list of all the daily maps).<br>
<br>
I think that it might be faster as well.<br>
best,<br>
sotiris<br>
<div><div><br>
On 12/28/2012 03:08 PM, Paul Meems wrote:<br>
> Thanks Sotiris,<br>
><br>
> I've tried your suggestion but converted it to Python because I'm on<br>
> Windows.<br>
> This is my script:<br>
> grass.run_command('g.mremove', rast = ('out*'))<br>
> grass.mapcalc('sun=global1', quiet=False, verbose=False, overwrite=True)<br>
> for x in range(2, 10, 1):<br>
> exp = 'out=sun+global' + str(x)<br>
> print exp<br>
> grass.mapcalc(exp, quiet=False, verbose=False, overwrite=True)<br>
> grass.run_command('g.rename', flag='o', rast = ('out','sun'))<br>
><br>
> This doesn't result in the expected outcome.<br>
> sun is equal to global1 and no values are added<br>
> out is global1+global2 but is no more values are added. But mapcalc is<br>
> called several times.<br>
> I've tested this with:<br>
> r.what --v -f -n input=global1 east_north=156287.225281,383024.737026<br>
> r.what --v -f -n input=sun east_north=156287.225281,383024.737026<br>
> r.what --v -f -n input=out east_north=156287.225281,383024.737026<br>
><br>
> Not only am I a new user to GRASS but I'm also still a novice in<br>
> Python. Most likely it is something in my script.<br>
><br>
> If somebody has a different approach to get the solar radiation of a<br>
> whole year I'm happy to try that.<br>
><br>
> Thanks,<br>
><br>
> Paul<br>
><br>
><br>
><br>
> Date: Fri, 28 Dec 2012 14:36:15 +0200<br>
> From: "S. Koukoulas (lists)" <<a href="mailto:sotkouklistes@gmail.com" target="_blank">sotkouklistes@gmail.com</a><br>
</div></div>> <mailto:<a href="mailto:sotkouklistes@gmail.com" target="_blank">sotkouklistes@gmail.com</a>>><br>
> To: <a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a> <mailto:<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>><br>
<div>> Subject: Re: [GRASS-user] Grass, Python, mapcalc<br>
</div>> Message-ID: <<a href="mailto:50DD923F.806@gmail.com" target="_blank">50DD923F.806@gmail.com</a> <mailto:<a href="mailto:50DD923F.806@gmail.com" target="_blank">50DD923F.806@gmail.com</a>>><br>
<div>> Content-Type: text/plain; charset=windows-1252<br>
><br>
> To my experience with r.mapcalc you cannot do what yo do with<br>
> programming languages... e.g. i=i+1 will not work directly.<br>
> Instead you<br>
> could try a more indirect way, something like (here is an example with<br>
> bash shell script):<br>
><br>
> #g.mremove rast=out* (to remove previous stuff, if needed)<br>
> r.mapcalc sun=global1<br>
> for a in ?seq 2 10?; do<br>
> r.mapcalc out = sun + global$a<br>
> g.rename --o rast=out,sun<br>
> done<br>
><br>
> basically the main idea is to use an intermediate map and then before<br>
> the loop ends, pass it (with g.rename) to the map variable you want.<br>
> There might be a more elegant way with python, but hopefully this<br>
> shell<br>
> script example might help you.<br>
> HTH,<br>
> sotiris<br>
><br>
><br>
><br>
><br>
</div><div><div>> _______________________________________________<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>
</div></div></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></blockquote></div></div></div>
</blockquote></div><br></div>