<?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: Linear regression between every 3×3 pixels of two rasters in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/linear-regression-between-every-3-3-pixels-of-two/m-p/729466#M56560</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pro can use R if you have the distribution installed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Aug 2020 16:28:11 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2020-08-07T16:28:11Z</dc:date>
    <item>
      <title>Linear regression between every 3×3 pixels of two rasters</title>
      <link>https://community.esri.com/t5/python-questions/linear-regression-between-every-3-3-pixels-of-two/m-p/729463#M56557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two raster with same resolution and dimension: rainfall (mm) and water-occurrence (%). I want to create a new raster of SLOPE (a) and INTERCEPT (b)&amp;nbsp;by performing linear regression between every 3×3 pixels of the two rasters (rainfall and water-occurrence), such that each pixel of the SLOPE and INTERCEPT will hold the regression slope and intercept value obtained from linear regression of the corresponding 3×3 pixels in rainfall&amp;nbsp;and water-occurrence&amp;nbsp;that surround that pixel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any example solution using ArcGIS or python/arcpy related above problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example data in the attachment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2020 07:16:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/linear-regression-between-every-3-3-pixels-of-two/m-p/729463#M56557</guid>
      <dc:creator>BennyIstanto</dc:creator>
      <dc:date>2020-08-07T07:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Linear regression between every 3×3 pixels of two rasters</title>
      <link>https://community.esri.com/t5/python-questions/linear-regression-between-every-3-3-pixels-of-two/m-p/729464#M56558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how about covariance&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://numpy.org/doc/stable/reference/generated/numpy.cov.html" title="https://numpy.org/doc/stable/reference/generated/numpy.cov.html"&gt;https://numpy.org/doc/stable/reference/generated/numpy.cov.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;will give you some&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html" title="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html"&gt;scipy.stats.linregress — SciPy v1.5.2 Reference Guide&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;perhaps if implemented through a sliding/rolling windows approach using a 3x3 kernel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would the purpose be for such an analysis given `n` is extremely small?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2020 09:27:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/linear-regression-between-every-3-3-pixels-of-two/m-p/729464#M56558</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-08-07T09:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Linear regression between every 3×3 pixels of two rasters</title>
      <link>https://community.esri.com/t5/python-questions/linear-regression-between-every-3-3-pixels-of-two/m-p/729465#M56559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the final output, I am would like to have a raster with information on SLOPE, INTERCEPT, and Maximum rainfall threshold that could trigger a flood.&lt;/P&gt;&lt;P&gt;So if I have rainfall forecast in a raster, then I could use above mentioned data to calculate the probability if each pixel will flooded or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I am still preparing all the data requirement for that, in the question above I have attached example data (rainfall and percent of water occurrence). As the pixel size is 0.05 deg ~ to 5.6km/pixels&amp;nbsp;and&amp;nbsp;by doing 3x3 or 5x5 group of cells, in my opinion is enough to see the correlation between both data.&lt;/P&gt;&lt;P&gt;Most of extreme rainfall followed by&amp;nbsp;flood event are occurred locally, then 3x3 ~ 282.24 sqkm or 5x5 ~ 784 sqkm is a good start to analyse it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any script that ready to use?&lt;/P&gt;&lt;P&gt;I also review some script related to regression written by you and/or &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌ in other thread, but doesn't consider 3x3 or 5x5 neighbour value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found similar problem that already answered using R approach:&amp;nbsp;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/278979/linear-regression-between-every-3×3-pixels-between-two-rasters-using-r" title="https://gis.stackexchange.com/questions/278979/linear-regression-between-every-3×3-pixels-between-two-rasters-using-r"&gt;https://gis.stackexchange.com/questions/278979/linear-regression-between-every-3×3-pixels-between-two-rasters-using-r&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2020 10:20:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/linear-regression-between-every-3-3-pixels-of-two/m-p/729465#M56559</guid>
      <dc:creator>BennyIstanto</dc:creator>
      <dc:date>2020-08-07T10:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Linear regression between every 3×3 pixels of two rasters</title>
      <link>https://community.esri.com/t5/python-questions/linear-regression-between-every-3-3-pixels-of-two/m-p/729466#M56560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pro can use R if you have the distribution installed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2020 16:28:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/linear-regression-between-every-3-3-pixels-of-two/m-p/729466#M56560</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-08-07T16:28:11Z</dc:date>
    </item>
  </channel>
</rss>

