<?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 Help with Raster Processing in Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/help-with-raster-processing-in-python/m-p/161663#M12361</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Deal All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would someone out here help me in understanding what this code does? I am finding it difficult to understand being a newbie. Thank you - Naresh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcgisscripting, os, sys

gp = arcgisscripting.create(9.3)

# Arguments
topfolder = sys.argv[1]
outCSV = sys.argv[2]

# Local Variables
openCSV = open(outCSV, 'w')
openCSV.write("File Name,File Size (KB),Spatial Reference,YMax,XMin,XMax,YMin,Cell Size\n")
rasters = []

# Collect all rasters in list
for root, dirs, files in os.walk(topfolder):
 for f in files:
&amp;nbsp; if '.ECW' in f.upper():
&amp;nbsp;&amp;nbsp; rasters.append(os.path.join(root, f))

gp.AddMessage("\n" + str(len(rasters)) + " raster datasets found\n")

# Loop through rasters and describe file, spatial reference, and cell size
for raster in rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddMessage(raster)
 size = str(os.path.getsize(raster) / 1000.0)
 desc = gp.Describe(os.path.join(raster, "Band_1"))
 openCSV.write(raster + "," + size + "," + str(desc.SpatialReference.Name) + "," + str(desc.Extent.YMax) + "," + str(desc.Extent.XMin) + "," + str(desc.Extent.XMax) + "," + str(desc.Extent.YMin) + "," + str(desc.MeanCellHeight) + "\n")

 gp.AddMessage(raster + " has been checked")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 May 2012 18:48:06 GMT</pubDate>
    <dc:creator>NARESHALIGETI</dc:creator>
    <dc:date>2012-05-30T18:48:06Z</dc:date>
    <item>
      <title>Help with Raster Processing in Python</title>
      <link>https://community.esri.com/t5/python-questions/help-with-raster-processing-in-python/m-p/161663#M12361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Deal All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would someone out here help me in understanding what this code does? I am finding it difficult to understand being a newbie. Thank you - Naresh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcgisscripting, os, sys

gp = arcgisscripting.create(9.3)

# Arguments
topfolder = sys.argv[1]
outCSV = sys.argv[2]

# Local Variables
openCSV = open(outCSV, 'w')
openCSV.write("File Name,File Size (KB),Spatial Reference,YMax,XMin,XMax,YMin,Cell Size\n")
rasters = []

# Collect all rasters in list
for root, dirs, files in os.walk(topfolder):
 for f in files:
&amp;nbsp; if '.ECW' in f.upper():
&amp;nbsp;&amp;nbsp; rasters.append(os.path.join(root, f))

gp.AddMessage("\n" + str(len(rasters)) + " raster datasets found\n")

# Loop through rasters and describe file, spatial reference, and cell size
for raster in rasters:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.AddMessage(raster)
 size = str(os.path.getsize(raster) / 1000.0)
 desc = gp.Describe(os.path.join(raster, "Band_1"))
 openCSV.write(raster + "," + size + "," + str(desc.SpatialReference.Name) + "," + str(desc.Extent.YMax) + "," + str(desc.Extent.XMin) + "," + str(desc.Extent.XMax) + "," + str(desc.Extent.YMin) + "," + str(desc.MeanCellHeight) + "\n")

 gp.AddMessage(raster + " has been checked")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 18:48:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-raster-processing-in-python/m-p/161663#M12361</guid>
      <dc:creator>NARESHALIGETI</dc:creator>
      <dc:date>2012-05-30T18:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Raster Processing in Python</title>
      <link>https://community.esri.com/t5/python-questions/help-with-raster-processing-in-python/m-p/161664#M12362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It looks like it is searching through a directory tree (rooted at topfolder), gathering statistics about all of the .ecw files it finds in the tree, and writing the statistics out to a text file (outCSV) as a comma-separated table.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 19:14:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-raster-processing-in-python/m-p/161664#M12362</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2012-05-30T19:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Raster Processing in Python</title>
      <link>https://community.esri.com/t5/python-questions/help-with-raster-processing-in-python/m-p/161665#M12363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Bruce! Would you mind to also give me a line-by-line explanation of the code above or an alternate method to write the code during your free time. Thanks in advance for the quick turn around. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Naresh&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LiDAR Analyst&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 09:04:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-raster-processing-in-python/m-p/161665#M12363</guid>
      <dc:creator>NARESHALIGETI</dc:creator>
      <dc:date>2012-05-31T09:04:53Z</dc:date>
    </item>
  </channel>
</rss>

