<p>Hi.</p><p>I am attempting to create a&nbsp;method to forensically assign migratory birds to their geographic origins (on a GIS layer from <a href="http://wateriso.eas.purdue.edu/waterisotopes/pages/data_access/ArcGrids.html">http://wateriso.eas.purdue.edu/waterisotopes/pages/data_access/ArcGrids.html</a>)&nbsp;based on stable-istope analyses of the feathers.</p><p>I am trying to use Bayes' Theorem to assign birds, one at a time to the aforementioned surface (after calibration&nbsp;of the surface into values expected for bird feathers). I am having some success with the following script.....</p><p>#####ASSIGN BIRDS using Bayes' Theorem for a Normal Probability density##################################<br />birds&lt;- c(-121.07,-112.56)<br />SD&lt;-12.56587<br />for (i in 1:length(birds)){<br />&nbsp;&nbsp;&nbsp;&nbsp; rsaga.grid.calculus(in.grids = c(&quot;wtspddf.sgrd&quot;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out.grid = paste(&quot;wtspassignment&quot;,i,&quot;.sgrd&quot;,sep=&quot;&quot;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; formula = paste(&quot;(1/(sqrt(2*&quot;,pi,&quot;)*&quot;,SD,&quot;))*exp(-(1/(2*(&quot;,SD,&quot;)^2))&quot;,&quot;*(&quot;,birds[i],&quot;-a)^2)&quot;,sep=&quot;&quot;))<br />}<br />&nbsp;</p><p>However, I wish to multiply this&nbsp;with&nbsp;another surface representing&nbsp;prior probabilities, but the results from the above script have so&nbsp;many decimal&nbsp;places (e.g. max 0.03141 min 0.000006) &nbsp;that&nbsp;&nbsp;applying the prior probabilities&nbsp;appears to exceed the number&nbsp;of digits allowed for a grid, resulting in all&nbsp;zeros). I want to&nbsp;normalize the above by dividing by the maximum value of the result, but see no way to calculate the maximum&nbsp;value for a surface. Does anyone know of a way I could do this? Or is it possible to reset the number of digits? I suppose that ther disadvantage to changing the number of digits would expand the file sizes enormously....</p><p>I suppose I could also consider multiplying by an arbitrary amount first (before applying priors) as an alternative, but wanted to normalize by dividing by max. Suggestions would be most appreciated.</p><p>&nbsp;</p><p>Cheers</p><p>&nbsp;</p><p>-Steve</p><p>&nbsp;</p><p>&nbsp;</p>