AnsweredAssumed Answered

Arcpy NetCDF cache problems

Question asked by cwstrother on Jul 11, 2012
Latest reply on Jul 16, 2012 by philmorefield
I am processing 9 tiles (.nc files) with 27 years of records each. This modified script runs fine for a while and then gives a Failure to Execute. I assume that the arcpy cache is reaching a limit of some sort. I have searched the forums and most point me to numpy or netcdf4 modules that I can't understand. Can someone tell me a simpler way to modify this code to address the problem?

#Convert NetCDF files to Imagine img files #Jason Geck jgeck@alaskapacific.edu #Make a separate raster *.img file for each dimension value (time) in a netcdf file # 2012.07.03 Modified by Sergio Bernardes/Chris Strother  import arcpy, os, time, datetime, calendar  # Set local variables arcpy.env.overwriteOutput = True arcpy.env.scratchWorkspace = "C:\\Scratch\\"   path = "C:\\PRCP\\" path_rasters = "C:\\PRCPRasters\\"  extension = ".nc"  dirList=os.listdir(path)  #Loops thru all days of year (including leap days) #Year info Yr = range (1982,2008) #Month info allmnths = range(1,13)  for fname in dirList:     if fname.lower().endswith(extension):          tile, Yr, datatype = fname.split("_")         intYr = int(Yr)                  #print tile, yr, datatype              for mnths in allmnths:             Lastday = calendar.monthrange(intYr, mnths)[1]             MRange = range(1,Lastday+1)             for dyy in MRange:                 dyys =int(dyy)                 mnthsss = int(mnths)                 yrs = int(Yr)                 stringMonth = str(mnthsss)                 stringDays = str(dyys)                                  a = stringMonth.zfill(2) + "/" + stringDays.zfill(3)+"/"+Yr                 b =  stringMonth.zfill(2) + "_" + stringDays.zfill(3) +"_"+Yr                                  print a,b                                  inDate = "time " + a                 prcp_nc = path + fname                  prcp_Layer = "prcp_Layer" + b                 test_img = path_rasters + tile + "_" + b + ".img"                  # Process: Make NetCDF Raster Layer                 arcpy.MakeNetCDFRasterLayer_md(prcp_nc, "prcp", "x", "y", prcp_Layer, "", inDate, "BY_VALUE")                 print "Created NetCDF Layer for " + prcp_Layer                                              # Process: Copy Raster                 arcpy.CopyRaster_management(prcp_Layer, test_img, "", "", "", "NONE", "NONE", "")                 print "Created Raster for " + prcp_Layer                   print "------------- finished"

Outcomes