<?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 Select subset of raster within a polygon and use only selected cells (raster layer?) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/select-subset-of-raster-within-a-polygon-and-use/m-p/272655#M21054</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm relatively new to python and arcpy, and was recently working to create a tool that performs calculations of raster values within an area defined by input polygons (a la zonal stats). Currently, I make a feature layer out of the polygon, select polygons within that layer that have a certain attribute, use that selection as a clip on the input raster, and then input the clipped raster into a numpy array to perform calculations. At the end of the process, I delete the clipped raster. This all works well enough, but it's definitely not as fast (about 3x-4x slower) as the built in zonal stats functions, and most of that extra time seems to be coming from the process of clipping and creating a whole new raster, and subsequently deleting it at the end. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm curious if it's possible to do a "select by location" style operation on a raster or raster layer, in the same fashion that I can select certain features in a feature layer and have various tools use only those selected features. So instead of actually creating a new raster, I simply create some sort of selection or mask so that when I dump the raster into a numpy array, only those selected cells show up. The actual 'select by location' doesn't accept raster layers as input, only mosaics or catalogs. At the moment, I don't care if the output retains spatial relationships - I just want a list of values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The ultimate goal is to be able to perform zonal calculations quickly - so if my specific idea above is misguided, I'm very open to alternate ideas!&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jun 2014 19:06:51 GMT</pubDate>
    <dc:creator>ScottAnderson</dc:creator>
    <dc:date>2014-06-10T19:06:51Z</dc:date>
    <item>
      <title>Select subset of raster within a polygon and use only selected cells (raster layer?)</title>
      <link>https://community.esri.com/t5/python-questions/select-subset-of-raster-within-a-polygon-and-use/m-p/272655#M21054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm relatively new to python and arcpy, and was recently working to create a tool that performs calculations of raster values within an area defined by input polygons (a la zonal stats). Currently, I make a feature layer out of the polygon, select polygons within that layer that have a certain attribute, use that selection as a clip on the input raster, and then input the clipped raster into a numpy array to perform calculations. At the end of the process, I delete the clipped raster. This all works well enough, but it's definitely not as fast (about 3x-4x slower) as the built in zonal stats functions, and most of that extra time seems to be coming from the process of clipping and creating a whole new raster, and subsequently deleting it at the end. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm curious if it's possible to do a "select by location" style operation on a raster or raster layer, in the same fashion that I can select certain features in a feature layer and have various tools use only those selected features. So instead of actually creating a new raster, I simply create some sort of selection or mask so that when I dump the raster into a numpy array, only those selected cells show up. The actual 'select by location' doesn't accept raster layers as input, only mosaics or catalogs. At the moment, I don't care if the output retains spatial relationships - I just want a list of values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The ultimate goal is to be able to perform zonal calculations quickly - so if my specific idea above is misguided, I'm very open to alternate ideas!&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 19:06:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-subset-of-raster-within-a-polygon-and-use/m-p/272655#M21054</guid>
      <dc:creator>ScottAnderson</dc:creator>
      <dc:date>2014-06-10T19:06:51Z</dc:date>
    </item>
  </channel>
</rss>

