AnsweredAssumed Answered

Reclassify based on text field

Question asked by bslip082 on Sep 14, 2017
Latest reply on Sep 14, 2017 by bslip082

I'm trying to reclassify a large amount of rasters. They contain a wide set of values that I want to get to numbers. I'm trying to reclassifying by using the RemapValue, but I can't get it to work.


import arcpy
import os
from import *

arcpy.env.workspace = r'C:\Users\...\Arbeidsdata.gdb'

rasList = arcpy.ListRasters()
for raster in rasList:
    inRaster = raster
    remap = RemapValue([["A1BE", 2],["A1BR", 1],["A1EN", 2],["A1GR", 2],["A1IN", 2],["A1KO", 2],["A1NA", 2],["A1NY", 2],["A1PL", 2],["A1UB", 0],["A2AL", 2],["A2BU", 2],["A2FR", 2],["A2JO", 2],["A2UB", 0],["A2VE", 2],["A3BE", 1],["A3EN", 2],["A3IN", 2],["A3KR", 1],["A3PL", 2],["A3SB", 1],["A4BE", 1],["A4EN", 2],["A4KR", 1],["A4KR", 1],["A4PL", 2],["A4SB", 1],["B1BL", 1],["B1FJ", 1],["B1GR", 1],["B2DY", 1],["B2FI", 1],["B2JO", 1],["B2TI", 1],["B2TO", 1],["F1KR", 1],["F1PL", 2],["F1SB", 1],["F1VI", 1],["F2EI", 1],["F1GR", 1],["F2LA", 1],["F2PL", 2],["F2RA", 1],["F2RI", 1],["F2VI", 1],["F3DR", 1],["F3ST", 1],["F4BR", 1],["F4GA", 1],["F3HO", 1],["F4VI", 1],["M1BU", 1],["M1GR", 1],["M1RI", 1],["M1SU", 1],["M2BU", 1],["M2SU", 1],["S1LA", 1],["S2BL", 1],["S3BA", 1],["U1BI", 1],["U1FL", 2],["U1GR", 1],["U1JE", 2],["U1MO", 2],["U1PA", 1],["U1PA", 1],["U1SY", 1],["U1TR", 1],["U2BG", 3],["U2BO", 3],["U2FG", 1],["U2FO", 1],["U2IG", 3],["U2IN", 3],["U2TG", 3],["U2TU", 3],["U3GJ", 2],["U3LA", 2],["U3SK", 1],["U3TI", 1],["U3TO", 1],["U4CA", 1],["U4GO", 1],["U4HA", 3],["U4ID", 1],["U4KI", 1],["U4TR", 3],["U5BR", 1],["U5BY", 2],["U5DA", 1],["U5GR", 1],["U5HA", 1],["U4KI", 1],["U4TR", 3],["U5BR", 1],["U5BY", 2],["U5DA", 1],["U5GR", 1],["U5HA", 1],["U5KL", 2],["U5LE", 1],["U5NA", 1],["U5RO", 1],["U5SO", 1],["U5TO", 1],["V1EL", 2],["V1KA", 2],["V1TJ", 2],["V1IS", 1],["V2SN", 1],["V3SA", 2],["F2SK", 1]])

outReclassify = Reclassify(inRaster, "q_atype1", remap, "NODATA")

outputReclass = r'C:\Users\...\Output\Reclassified.gdb'
outputFileName = "reclass"

outRasterName = '{}{}'.format(inRaster, outputFileName), outRasterName))



These are the errors I get:


Runtime error  Traceback (most recent call last):   File "<string>", line 6, in <module>   File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\sa\", line 5753, in Reclassify     missing_values)   File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\sa\", line 53, in swapper     result = wrapper(*args, **kwargs)   File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\sa\", line 5747, in Wrapper     missing_values)   File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\geoprocessing\", line 510, in <lambda>     return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 000622: Failed to execute (Reclassify). Parameters are not valid.
ERROR 000628: Cannot set input into parameter remap.