<?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 Calculating diversity on a raster via a moving window in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculating-diversity-on-a-raster-via-a-moving/m-p/61094#M846</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a raster data file of 18 different land cover classifications. I would like to calculate the land cover diversity using the Simpson diversity index:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Diversity = 1 - ??? sqr(P_i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where, "P" is the proportion of each land cover type within the neighbourhood and "i" is the different types of land cover.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The land cover data is displayed as unique values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to use a moving window of a specific neighbourhood size to calculate the diversity index.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far, I have used focal statistics to calculate the variety (which I understand can represent the different number of land cover types within the area, or richness).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was wondering, how do I determine the proportion (evenness) of &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;each&lt;/SPAN&gt;&lt;SPAN&gt; different land cover type within the same neighbourhoods? I was hoping I could calculate this and then use both results (variety and evenness) in the raster calculator to output the diversity model.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone knows what I am talking about and can point me in the right direction, it would be VERY much appreciated!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tayler&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Mar 2011 20:17:54 GMT</pubDate>
    <dc:creator>TaylerHamilton</dc:creator>
    <dc:date>2011-03-01T20:17:54Z</dc:date>
    <item>
      <title>Calculating diversity on a raster via a moving window</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculating-diversity-on-a-raster-via-a-moving/m-p/61094#M846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a raster data file of 18 different land cover classifications. I would like to calculate the land cover diversity using the Simpson diversity index:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Diversity = 1 - ??? sqr(P_i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where, "P" is the proportion of each land cover type within the neighbourhood and "i" is the different types of land cover.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The land cover data is displayed as unique values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to use a moving window of a specific neighbourhood size to calculate the diversity index.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far, I have used focal statistics to calculate the variety (which I understand can represent the different number of land cover types within the area, or richness).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was wondering, how do I determine the proportion (evenness) of &lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;each&lt;/SPAN&gt;&lt;SPAN&gt; different land cover type within the same neighbourhoods? I was hoping I could calculate this and then use both results (variety and evenness) in the raster calculator to output the diversity model.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone knows what I am talking about and can point me in the right direction, it would be VERY much appreciated!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tayler&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2011 20:17:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculating-diversity-on-a-raster-via-a-moving/m-p/61094#M846</guid>
      <dc:creator>TaylerHamilton</dc:creator>
      <dc:date>2011-03-01T20:17:54Z</dc:date>
    </item>
    <item>
      <title>Calculating diversity on a raster via a moving window</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculating-diversity-on-a-raster-via-a-moving/m-p/61095#M847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Taylor,&lt;BR /&gt;I'm trying to do the same thing. Did you ever sort it out?&lt;BR /&gt;Aimee&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a raster data file of 18 different land cover classifications. I would like to calculate the land cover diversity using the &lt;A href="http://en.wikipedia.org/wiki/Diversity_index#Simpson_index"&gt;Simpson diversity index&lt;/A&gt;:&lt;BR /&gt;&lt;BR /&gt;Diversity = 1 - �?? sqr(P_i)&lt;BR /&gt;&lt;BR /&gt;Where, "P" is the proportion of each land cover type within the neighbourhood and "i" is the different types of land cover.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;UPDATE: Moved thread to the Spatial Analyst forum.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Jun 2013 08:28:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculating-diversity-on-a-raster-via-a-moving/m-p/61095#M847</guid>
      <dc:creator>AimeeSalstead</dc:creator>
      <dc:date>2013-06-16T08:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating diversity on a raster via a moving window</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculating-diversity-on-a-raster-via-a-moving/m-p/61096#M848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are a couple of ways to approach this. Probably the easiest is to stick with a pure Spatial Analyst approach to get what you're looking for, but another approach would be to convert your data into numpy arrays with &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000023000000"&gt;RasterToNumpyArrays&lt;/A&gt;&lt;SPAN&gt;, which will give you access to each cell in a fine-grained way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just using Spatial Analyst, I've put together a script which makes the required calculations. The key trick is doing separate calculations for each class in your input raster, and then summing those results to convert the counts of each type into a proportion of the total. I've committed a script which computes all three on Github:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;A href="https://github.com/EsriOceans/support/blob/master/simpson_index.py"&gt;Compute Simpson Diversity Indicies: simspon_index.py&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried to include both the equations via LaTeX and comments where possible. The current script is verbose, and performance could be improved (it takes about 90s on a 1m cell raster with 4 classes), but hopefully this gets you the landscape measurements you need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Shaun&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 03:24:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/calculating-diversity-on-a-raster-via-a-moving/m-p/61096#M848</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2013-06-19T03:24:02Z</dc:date>
    </item>
  </channel>
</rss>

