POST
|
Thank you very much, that worked marvelously. I thought it would be something stupidly simple.
... View more
07-11-2013
05:39 AM
|
0
|
0
|
341
|
POST
|
I am writing some code that will automate the construction of 30 year monthly average gridded climate data in the United States. Recently, I've finished a draft but am tied up in an error that I cannot unravel. The code is in the grey box below. The error I am receiving (Error 000732) is below that. I ran the erroneous line in question on its own in the Python Script in ArcGIS 10.1 and it worked which has led me to even more confusion. CODE: # IMPORT SYSTEM MODULES import arcpy from arcpy import env from arcpy.sa import * # CHECK OUT ANY NECESSARY LICENSES arcpy.CheckOutExtension("spatial") MonthDay = ["1/16/", "2/16/", "3/15/", "4/15/", "5/15/", "6/15/", "7/15/", "8/15/", "9/15/", "10/15/", "11/15/", "12/15/"] # LOOP THROUGH MONTH AND DAYS for month in MonthDay: LIST = [] NoBackslashMonth = month.replace("/", "") # LOOP THROUGH THE YEAR 1970 AND 1999 for year in range(1970, 2000): arcpy.MakeNetCDFRasterLayer_md(r"E:\Documents\Data\Climate\United States\1970-1999 (OBSERVED)\1970-1999CodePlayground.gdb\Extraction_Tavg.nc", "Tavg", "longitude", "latitude", NoBackslashMonth + str(year), "", [["time", month+str(year)]],"BY_VALUE") LIST.append(NoBackslashMonth + str(year)) # ADDS RASTER DATA FOR THE YEAR "year" TO "LIST" DATE = " " # CREATES/RESETS "DATE" VARIABLE # IF STATEMENT THAT WILL PUT ABBREVIATED MONTH VALUES IN FOR THEIR CORRESPONDING NUMERIC ORDER if month == '1/16/': DATE = "jan" elif month == '2/16/': DATE = "feb" elif month == '3/15/': DATE = "march" elif month == '4/15/': DATE = "april" elif month == '5/15/': DATE = "may" elif month == '6/15/': DATE = "june" elif month == '7/15/': DATE = "july" elif month == '8/15/': DATE = "aug" elif month == '9/15/': DATE = "sep" elif month == '10/15/': DATE = "oct" elif month == '11/15/': DATE = "nov" elif month == '12/15/': DATE = "dec" else: print "no date" output = arcpy.sa.CellStatistics(LIST, "MEAN", "NODATA") # CALCULATES THE 30 YEAR AVERAGE FOR "DATE" arcpy.CopyRaster_management("output", "E:\\Documents\\Data\\Climate\\United States\\1970-1999 (OBSERVED)\\MonthlyTemperatureData.gdb\\" + DATE, "", "", "", "", "", "", "", "") # COPY'S "output" RASTER DATA SET as "DATE" in "MonthlyTemperatureData" GEODATABASE # Clears the Table of Contents ###################### mxd = arcpy.mapping.MapDocument("CURRENT") for df in arcpy.mapping.ListDataFrames(mxd): for lyr in arcpy.mapping.ListLayers(mxd, "", df): arcpy.mapping.RemoveLayer(df, lyr) # Clears the Table of Contents ###################### ERROR: Traceback (most recent call last): File "E:/Documents/Code/TestCode", line 53, in <module> arcpy.CopyRaster_management("output", "E:\\Documents\\Data\\Climate\\United States\\1970-1999 (OBSERVED)\\MonthlyTemperatureData.gdb\\" + DATE, "", "", "", "", "", "", "", "") # COPY'S "output" RASTER DATA SET as "DATE" in "MonthlyTemperatureData" GEODATABASE File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 11034, in CopyRaster raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Raster: Dataset output does not exist or is not supported Failed to execute (CopyRaster). Thank you very much.
... View more
07-11-2013
05:15 AM
|
0
|
2
|
492
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|