I am new to coding in python and specifically Arcpy. Through trial and error I was able to piece together this code that was working fine yesterday until I installed service pack 5 for ArcGIs Desktop 10.0, on a 64 bit Windows machine. The reason I decided to install this service pack is because the code was incapable of doing more than ~60 iterations of the loop without stopping unless everything on my machine was closed except ArcCatalog. I saw on a discussion board that updating to a new service pack might solve my problem. Now my problems is the machine crashing halfway through one loop.
Through trial and error I have determined that using the line of my code which calls on the FeatureClassToFeatureClass_conversion crashes ArcCatalog. The only thing that I can trace the problem back to is upgrading to service pack 5.
Through trial and error I have determined that using the line of my code which calls on the FeatureClassToFeatureClass_conversion crashes ArcCatalog. The only thing that I can trace the problem back to is upgrading to service pack 5.
Code:
import arcpy
arcpy.env.scratchWorkspace=r'C:\Users\fk128474\Documents\Freds_Bitterroot_Model\wrf_data\Scratch'
arcpy.env.workspace=r'C:\Users\fk128474\Documents\Freds_Bitterroot_Model\wrf_data\2001_LW'
import os
xcelFiles = arcpy.ListFiles('*.xls')
count =1
while count < 140:
arcpy.env.workspace=r'C:\Users\fk128474\Documents\Freds_Bitterroot_Model\wrf_data\2001_LW'
fileName = xcelFiles[count]
tableName = fileName[:-4] + '_Table_View'
layerName = fileName[:-4] + 'Point_Layer'
xyName = fileName[:-4] + '_pts'
tempName = 'LW' + fileName[11:-4]
shpPath = r'C:\Users\fk128474\Documents\Freds_Bitterroot_Model\wrf_data\2001_LW\Shape'
spRef = r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj"
points=arcpy.MakeTableView_management(fileName + '\\sheet1$', tableName)
b=arcpy.MakeXYEventLayer_management(points,"F2","F3",tempName, spRef, "F4")
fullshppath = shpPath +'/' + tempName + '.shp'
arcpy.env.mask = "C:/Users/fk128474/Documents/Freds_Bitterroot_Model/MODIS/Projected_FSCA/2000/2000_FSCA_070.hdf"
arcpy.env.cellsize = 463.312717
arcpy.env.extent = "C:/Users/fk128474/Documents/Freds_Bitterroot_Model/MODIS/Projected_FSCA/2000/2000_FSCA_070.hdf"
arcpy.FeatureClassToFeatureClass_conversion (b, shpPath, tempName)
shpname = "C:/Users/fk128474/Documents/Freds_Bitterroot_Model/wrf_data/2001_LW/Shape/" + tempName +'.shp'
rstname = "C:/Users/fk128474/Documents/Freds_Bitterroot_Model/wrf_data/2001_LW/Raster/" +tempName
arcpy.PointToRaster_conversion(shpname, "F4", rstname,"","",463.312717)
arcpy.env.workspace=r'C:/Users/fk128474/Documents/Freds_Bitterroot_Model/wrf_data/2001_LW/Raster/'
from arcpy.sa import *
rasterName = ExtractByMask(rstname, "C:/Users/fk128474/Documents/Freds_Bitterroot_Model/MODIS/Projected_FSCA/2000/2000_FSCA_070.hdf")
arcpy.env.workspace= r'C:/Users/fk128474/Documents/Freds_Bitterroot_Model/wrf_data/2001_LW/ASCII'
asciiName = "C:/Users/fk128474/Documents/Freds_Bitterroot_Model/wrf_data/2001_LW/ASCII/" + 'Temp' + fileName[:4] + '_' + fileName[11:-4] + '.txt'
arcpy.RasterToASCII_conversion(rasterName, asciiName)
arcpy.Delete_management(tableName)
arcpy.Delete_management(tempName)
count =count+1