<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 8, 2013 at 8:14 AM, Glynn Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"><br>
Gabriel Zorello Laporta wrote:<br>
<br>
> I am using ArcInfo Workstation and Grid in order to to produce Gaussian<br>
> functions of elevation from a DEM with minimum value at 800m, as follow:<br>
><br>
> elev_x800 = elev90 - 800<br>
> elev_x800sq = pow(elev_x800, 2)<br>
> elev_x800sqn = -1 * elev_x800sq<br>
> elev_x800sqnd = elev_x800sqn / 500000<br>
> elev_x800exp = exp(elev_x800sqnd)<br>
> elev_x800gaus = elev_x800exp * 0.000798<br>
> elev_x800gi = (elev_x800gaus * -11330) + 10.044<br>
><br>
> I was wondering how to apply that in GRASS (because I want to move towards<br>
> Open Software). Can you help me?<br>
<br>
</div>You should be able to use those exact same expressions in r.mapcalc,<br>
e.g.<br>
<br>
r.mapcalc <<EOF<br>
<div class="im"> elev_x800 = elev90 - 800<br>
elev_x800sq = pow(elev_x800, 2)<br>
elev_x800sqn = -1 * elev_x800sq<br>
elev_x800sqnd = elev_x800sqn / 500000<br>
elev_x800exp = exp(elev_x800sqnd)<br>
elev_x800gaus = elev_x800exp * 0.000798<br>
elev_x800gi = (elev_x800gaus * -11330) + 10.044<br>
</div> EOF<br>
<br>
The above will write out each step as a map; if you only need the<br>
final result (elev_x800gi), you can omit all of the intermediate steps<br>
and use e.g.:<br>
<br>
r.mapcalc "elev_x800gi = (exp(-((elev90 - 800)^2) / 500000) * 0.000798 * -11330) + 10.044"<br>
<br>
Or, if you want to keep the expressions in the above form but only<br>
want the last one written out as a map, use eval(), e.g.:<br>
<br>
r.mapcalc <<EOF<br>
eval(elev_x800 = elev90 - 800,\<br>
elev_x800sq = pow(elev_x800, 2),\<br>
elev_x800sqn = -1 * elev_x800sq,\<br>
elev_x800sqnd = elev_x800sqn / 500000,\<br>
elev_x800exp = exp(elev_x800sqnd),\<br>
elev_x800gaus = elev_x800exp * 0.000798)<br>
<div class="im"> elev_x800gi = (elev_x800gaus * -11330) + 10.044<br>
</div> EOF<br>
<span class=""><font color="#888888"><br></font></span></blockquote><div>This is an interesting feature. I added this example to r.mapcalc manual in G7 [r58173].</div><div><br></div><div>It is in Notes section. I was not sure where to put it and it is only a dummy example. Maybe, it would be helpful to have this "<span style="font-family:arial,sans-serif;font-size:13px">Gaussian functions" example in examples but I don't know what it is, so I don't want to write about it.</span></div>
<div> </div><div>It is bit unfortunate that this example does not work in mapcalc in wxGUI. I'm not sure if it is a serious issue and where to mention it (manual/gui/...).</div><div><br></div><div>Vaclav</div><div><br>
</div><div><a href="https://trac.osgeo.org/grass/changeset/58173">https://trac.osgeo.org/grass/changeset/58173</a><br></div><div><br></div><div>PS: MarkusN, I've tried to do it I passive voice this time.<br></div><div>
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><font color="#888888">
--<br>
Glynn Clements <<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>><br>
</font></span><div class=""><div class="h5">_______________________________________________<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" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
</div></div></blockquote></div><br></div></div>