I'm having a bit of trouble with the syntax and some of the parameters for some functions in ArcPy (I'm completely new to it and struggle with the documentation quite a bit). Specifically, I'm trying to use the arcpy.Reclassify_3d() method in a Python script to change all of the range values in a slope map to a specific amount. I have 6 classes for each raster.

The idea I have is to create a function in Python called change_Range(raster) which will take in an object as a parameter, which will be the raster. Have the rasters appended into an array and then use a for loop in which the function is called for each object in that array.

Here's an example code I did in VSC to test my idea out. Think of it as pseudo code since it doesn't use the Reclassify method.

#import all necessary modules

#Represents the DEM raster/tile
class Raster:
    def __init__(self, range):
        self.range = range

ras1 = Raster(5)
ras2 = Raster(90)
ras3 = Raster(156)
ras4 = Raster(77)

#Array to store each raster
arr = []

#Append each raster

#Create function to set or reclassify ranges
def changeRange(ras_elem):
    #Reclassify ranges using arcpy.Reclassify_3d
    ras_elem.range = 3

for raster in arr:

#This is just to show that it is working

This sounds easy in my head but executing it with ArcPy is giving me a bit of trouble.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.