<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div>
<div dir="ltr">
<div dir="ltr">Hi Anna, thank you for responding!</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">No I haven't tried running r.walk using negative values, I guess I could give it a try. But, if I remember correctly, didn't Michael Barton inquired about the use of negative values and r.walk previously. I can't remember the outcome of that
 discussion, and I don't seem to have kept the emails unfortunately. I'll give the negative values a try, if it works, then that will at least be less distorted as opposed to removing negative values by addition.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">/Victor</div>
</div>
</div>
<div id="ms-outlook-mobile-signature">
<div><br>
</div>
Skickat från <a href="https://aka.ms/o0ukef">Outlook för iOS</a></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Från:</b> Anna Petrášová <kratochanna@gmail.com><br>
<b>Skickat:</b> Thursday, December 21, 2023 5:18:03 AM<br>
<b>Till:</b> Victor Lundström <Victor.Lundstrom@uib.no><br>
<b>Kopia:</b> grass-user@lists.osgeo.org <grass-user@lists.osgeo.org><br>
<b>Ämne:</b> Re: [GRASS-user] re-setting bathymetry data using the raster calculator.</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi Victor,
<div><br>
</div>
<div>I am not sure I understand your concern. Have you tried running r.walk with the original raster with negative values? Theoretically, I don't see why r.walk couldn't work with negative elevation, although I haven't tried it. It should work the same if you
 add a constant value as you suggest. Perhaps you want to e.g. use an absolute value of the elevation? </div>
<div><br>
</div>
<div>Anna</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Wed, Dec 20, 2023 at 5:59 PM Victor Lundström via grass-user <<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div class="x_msg-6963051822920881581">
<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi everyone,</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
I've run in to a problem that I hope to get some help with.</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I'm preparing a set of rasters to perform species distribution modelling. For one</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
of my predictors, I have chosen to use r.walk in order to record how far away my occurrence</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
records are to the nearest shoreline. Here's the catch though.. I will be generating my walk-distance</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
rasters by using the GEBCO bathymetry data set. Here in lies the problem. Seeing as it is bathymetry, my raster will have negative values. My initial thought was simply to run the bathymetry raster through r.mapcalc in this way: </div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
r.mapcalc "expression=prehist_dem = bathymetry + 866"<br>
<br>
</div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">In this example, "866" references the lowest depth recorded (i.e. -866m). Using the expression above, I have</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">now removed any negative value in the raster so that min = 0. However, while doing this I have now also added</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">"866" to every other cell in the raster, and not only will this be incorrect for places inland where a cell that originally</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">was 5 m.a.s.l. now is 871m, but it will probably affect the cells close to the sea in the same way (which in most cases
 should probalby be close to, or slightly above, 0m). More importantly, if I would just stick to this approach, I can't help but imagine that it won't produce inaccurate results for r.walk further down the line as well.<br>
<br>
I can't help but think that there is some clever work-around to this using the mapcalculator, but I'm simply stuck</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">and don't know how to proceed. Hope any of you can provide some advice!<br>
<br>
Best,<br>
Victor</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)"><br>
</span></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="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
</div>
</blockquote>
</div>
<br>
<table border="0" cellspacing="0" cellpadding="0" align="left" width="100%">
<tbody>
<tr>
<td style="background:#ffb900; padding:5pt 2pt 5pt 2pt"></td>
<td width="100%" cellpadding="7px 6px 7px 15px" style="background:#fff8e5; padding:5pt 4pt 5pt 12pt; word-wrap:break-word; font-size:11pt">
<div style="color:#222222"><span style="color:#222; font-weight:bold">[External email]</span> Make sure you recognize the sender's email address before you click links, open attachments, or get involved in financial transactions. Contact IT-support BRITA if
 you have any questions. </div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>