<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Combination: Map Algebra and SciPy functions in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/combination-map-algebra-and-scipy-functions/m-p/356129#M12351</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A quick example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from osgeo import gdal, gdal_array
from scipy import stats
import numpy

dataset=gdal.Open(someraster)
x=dataset.GetRasterBand(1).ReadAsArray()
func = stats.norm.pdf(x, loc=m, scale=(s)) #you need to define m &amp;amp; s
sqrtx = numpy.sqrt(x)

#Write the result out - see http://www.gdal.org/formats_list.html for formats you can write to
newdataset=gdal_array.SaveArray(sqrtx,newrasterpath,'GTIFF',prototype=dataset)
newdataset.SetProjection(dataset.GetProjectionRef())
newdataset.SetGeoTransform(dataset.GetGeoTransform())
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:40:22 GMT</pubDate>
    <dc:creator>Luke_Pinner</dc:creator>
    <dc:date>2021-12-11T16:40:22Z</dc:date>
    <item>
      <title>Combination: Map Algebra and SciPy functions</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/combination-map-algebra-and-scipy-functions/m-p/356127#M12349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hej....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am successfully used various pyhton scripts with map algebra (multipliyng rasters etc.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but now its getting a little bit more complex and therefore I want use the math and scipy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;module in python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My questions: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(how) can I replace map algebra function by the math functions? Is it possible to replace Squareroot by math.sqrt??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to use to use e.g following scipy function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;func = stats.norm.pdf(x, loc=m, scale=(s)) where the variable x is actually Raster('x')? If yes, how do I do it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/j&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jan 2011 09:51:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/combination-map-algebra-and-scipy-functions/m-p/356127#M12349</guid>
      <dc:creator>JohannesRadinger</dc:creator>
      <dc:date>2011-01-06T09:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Combination: Map Algebra and SciPy functions</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/combination-map-algebra-and-scipy-functions/m-p/356128#M12350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It can be done. Start looking into GDAL and NumPy. The math module is only for scalars not for arrays/rasters though (NumPy has its own versions though). You won't even need ArcGIS &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I'll try and remember to post some examples when I'm back at work next week.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just be aware that if you have large rasters, you will need to implement your own tiling process (which ArcGIS does behind the scenes for you) as NumPy holds the entire array (raster) in memory.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jan 2011 21:16:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/combination-map-algebra-and-scipy-functions/m-p/356128#M12350</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2011-01-07T21:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Combination: Map Algebra and SciPy functions</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/combination-map-algebra-and-scipy-functions/m-p/356129#M12351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A quick example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;from osgeo import gdal, gdal_array
from scipy import stats
import numpy

dataset=gdal.Open(someraster)
x=dataset.GetRasterBand(1).ReadAsArray()
func = stats.norm.pdf(x, loc=m, scale=(s)) #you need to define m &amp;amp; s
sqrtx = numpy.sqrt(x)

#Write the result out - see http://www.gdal.org/formats_list.html for formats you can write to
newdataset=gdal_array.SaveArray(sqrtx,newrasterpath,'GTIFF',prototype=dataset)
newdataset.SetProjection(dataset.GetProjectionRef())
newdataset.SetGeoTransform(dataset.GetGeoTransform())
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:40:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/combination-map-algebra-and-scipy-functions/m-p/356129#M12351</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-12-11T16:40:22Z</dc:date>
    </item>
  </channel>
</rss>

