Hi,
I am trying to build pyramid for NED DEM 30 meter raster files (and eventually mosaic them). I have a main directory and many subfolders. Please see the file attached.
The problem is that I can't set it up so the program can read the raster files in the subfolders. I think I am missing a command line or something here.
Any help would be very appreciated. Here is the code that I wrote so far. Note that I used lots of 'print' coz I wanted to know if the program reads the files.
and here is the output:
Thank you very much,
Risa
I am trying to build pyramid for NED DEM 30 meter raster files (and eventually mosaic them). I have a main directory and many subfolders. Please see the file attached.
The problem is that I can't set it up so the program can read the raster files in the subfolders. I think I am missing a command line or something here.
Any help would be very appreciated. Here is the code that I wrote so far. Note that I used lots of 'print' coz I wanted to know if the program reads the files.
Code:
# Import system modules
import sys, arcpy, os, time, os.path
from time import time, ctime
from arcpy import env
from arcpy.sa import *
print "The START time is:",ctime(time())
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Main Directory
arcpy.env.workspace = "Y:/Work/NED30M"
inputDirectory = os.listdir(arcpy.env.workspace)
# Loop through directory & files
#Local variables:
for inputFolder in inputDirectory:
print "<<<----------------------------------------->>>"
print "Input Directory is: " + str(inputDirectory)
print "Input Fodler 01 is: " + str(inputFolder)
inputFolderFiles = arcpy.ListFiles(inputFolder)
RasterFiles = arcpy.ListRasters()
for inputFiles in inputFolderFiles:
print "Input FolderFiles are: " + str(inputFolderFiles)
print "Input files are: " + str(inputFiles)
print str(RasterFiles) + " ... Why Can't Read? ... "
for filename in RasterFiles:
arcpy.env.workspace = os.path.join (inputFolder, filename)
print "Filename is: " + str(filename)
print("\n Processing: " + filename)
print "Input Raster is: " + str(filename)
## # Process: Build pyramid
## arcpy.BuildPyramids_management(filename)
print "***"
print "DONE!!"
print "The FINISH time is:",ctime(time())
Code:
IDLE 2.6.5
>>> ================================ RESTART ================================
>>>
The START time is: Fri Feb 15 16:22:08 2013
<<<----------------------------------------->>>
Input Directory is: [u'n35w090', u'n35w091', u'n35w092']
Input Fodler 01 is: n35w090
Input FolderFiles are: [u'n35w090']
Input files are: n35w090
[] ... Why Can't Read? ...
<<<----------------------------------------->>>
Input Directory is: [u'n35w090', u'n35w091', u'n35w092']
Input Fodler 01 is: n35w091
Input FolderFiles are: [u'n35w091']
Input files are: n35w091
[] ... Why Can't Read? ...
<<<----------------------------------------->>>
Input Directory is: [u'n35w090', u'n35w091', u'n35w092']
Input Fodler 01 is: n35w092
Input FolderFiles are: [u'n35w092']
Input files are: n35w092
[] ... Why Can't Read? ...
***
DONE!!
The FINISH time is: Fri Feb 15 16:22:13 2013
>>>
Risa