Wednesday, 7 March 2018

spatial analyst - Problems with Reclassify and RemapRange in ArcPy?


I'm having a bit of trouble with a script that uses ArcPy. I keep getting the following error:




ExecuteError: ERROR 000622: Failed to execute (Reclassify). Parameters are not valid. ERROR 000628: Cannot set input into parameter remap.



This would seem simple to fix, but I've reached the edge of my knowledge without making headway. The most frustrating thing is that RemapRange isn't throwing any errors at all, so I don't know why Reclassify seems to have a problem with the type of parameter I'm giving it. Relevant portion of my code is below.


# Set the output raster name
out = "MMRWFS__for" + str(forestValue) + "__gra" + str(grassValue) + "__agr" + str(agricultureValue)+ "__dev" + str(developedValue) + ".asc"
outASCII = "Resistance Surfaces\\" + out

# Set the reclassify ranges
arcpy.CheckOutExtension("Spatial")
reclassifyValues = RemapRange([[11,12,"NODATA"], [21,24,developedValue],[41,43,forestValue],[71,81,grassValue],[82,82,agricultureValue],[90,95,wetlandValue]])


# 11 Open Water
# 12 Perennial Ice/Snow
# 21 Developed, Open Space $
# 22 Developed, Low Intensity $
# 23 Developed, Medium Intensity $
# 24 Developed, High Intensity $
# 31 Barren Land
# 41 Deciduous Forest *
# 42 Evergreen Forest *

# 43 Mixed Forest *
# 52 Shrub/Scrub
# 71 Grassland/Herbaceous **
# 81 Pasture Hay **
# 82 Cultivated Crops ***
# 90 Woody Wetlands 000
# 95 Emergent Herbaceous Wetlands 000

# PROCESS: Reclassify and Convert to ASCII
print "Creating " + out

arcpy.RasterToASCII_conversion(Reclassify(inRaster, reclassField, reclassifyValues, "NODATA"),env.workspace + "\\" + outASCII)

All the importing, etc. is correct. I'm sure there's something obvious here that I'm just missing as a novice.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...