<?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: ESRI grid and &amp;quot;info&amp;quot; folder inside the working directory in ArcGIS Spatial Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/esri-grid-and-quot-info-quot-folder-inside-the/m-p/630694#M9161</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In short, there is only one info folder per folder.&amp;nbsp; For example, 10 grids in a folder will all share the same info folder.&amp;nbsp; If you want separate info folder for each grid, then you have to copy/export (not using your operating system!!!) each grid to its own folder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jul 2014 15:40:58 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2014-07-24T15:40:58Z</dc:date>
    <item>
      <title>ESRI grid and "info" folder inside the working directory</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/esri-grid-and-quot-info-quot-folder-inside-the/m-p/630693#M9160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a silly question to ask. Using the below code, I want to extract a new raster from an original raster using value field and I want to automate the process for 70 more rasters. However, for testing purpose, I 'm using only 3 rasters.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Out of 3 rasters inside the working directory, this code works only for one raster which has both " ESRI grid" and "info" folder inside the working directory. I was not able to keep the "info" folders of other two raster inside the working directory as the "info" folder of 1st raster is already in the working directory.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know it is stupid question. But could you please let me know how can i keep the "info" folders of other two rasters inside the working directory, so that code will work and I can automate the process?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your time and help!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import arcpy,os&amp;nbsp; &lt;/P&gt;&lt;P&gt;from arcpy import env&amp;nbsp; &lt;/P&gt;&lt;P&gt;from arcpy.sa import *&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;#To overwrite output&amp;nbsp; &lt;/P&gt;&lt;P&gt;arcpy.env.overwriteOutput = True&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;#Set environment settings&amp;nbsp; &lt;/P&gt;&lt;P&gt;env.workspace = "C:/Subhasis/Test/Neshanic_Python"&amp;nbsp; &lt;/P&gt;&lt;P&gt;outws="C:/Subhasis/Test/Neshanic_Python/extract"&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;#checkout ArcGIS spatial analyst extension license&amp;nbsp; &lt;/P&gt;&lt;P&gt;arcpy.CheckOutExtension("Spatial")&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;# create a list of all rasters in current workspace&amp;nbsp; &lt;/P&gt;&lt;P&gt;lst_ras = arcpy.ListRasters()&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;threshold = 0.75&amp;nbsp; &lt;/P&gt;&lt;P&gt;for ras in lst_ras:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; flds = ("VALUE", "COUNT")&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dct = {row[0]:row[1] for row in arcpy.da.SearchCursor(ras, flds)}&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sumcnt = sum(dct.values())&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; threscnt = sumcnt * threshold&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt, result = 0, 0&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for k in sorted(dct):&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt += dct&lt;K&gt;&amp;nbsp; &lt;/K&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # print " - Value = {0}, Sum = {1}".format(k, cnt)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if cnt &amp;lt; threscnt:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = int(k)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Threshold = {0}".format(result)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attExtract = ExtractByAttributes(ras, "VALUE&amp;gt;={0}".format(result))&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outname = os.path.join(outws,"{0}{1}".format(ras, result))&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; attExtract.save(outname)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;arcpy.CheckInExtension("Spatial")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 14:31:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/esri-grid-and-quot-info-quot-folder-inside-the/m-p/630693#M9160</guid>
      <dc:creator>InceptionWoznicki</dc:creator>
      <dc:date>2014-07-24T14:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: ESRI grid and "info" folder inside the working directory</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/esri-grid-and-quot-info-quot-folder-inside-the/m-p/630694#M9161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In short, there is only one info folder per folder.&amp;nbsp; For example, 10 grids in a folder will all share the same info folder.&amp;nbsp; If you want separate info folder for each grid, then you have to copy/export (not using your operating system!!!) each grid to its own folder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 15:40:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/esri-grid-and-quot-info-quot-folder-inside-the/m-p/630694#M9161</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-07-24T15:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: ESRI grid and "info" folder inside the working directory</title>
      <link>https://community.esri.com/t5/arcgis-spatial-analyst-questions/esri-grid-and-quot-info-quot-folder-inside-the/m-p/630695#M9162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Mr Patterson!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 16:04:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-spatial-analyst-questions/esri-grid-and-quot-info-quot-folder-inside-the/m-p/630695#M9162</guid>
      <dc:creator>InceptionWoznicki</dc:creator>
      <dc:date>2014-07-24T16:04:38Z</dc:date>
    </item>
  </channel>
</rss>

