I am trying to change the classification of all points in my las file above a certain height (z value) from 2 (ground) to 1 (unclassified). I wrote the following code to do this:
las = laspy.read("filtered plots/plot_37.las")
height_threshold = 333 # Replace with your desired Z value threshold
# Loop through the points, check their classification and height, and modify as needed
for point in las:
if point.classification == 2 and point.z > height_threshold:
point.classification = 1
las.write('plot_37.las')
However, upon reaching the line "point.classification = 1", I get the following error:
TypeError: object of type 'int' has no len()
I do not understand why the code is trying to check length instead of simply reassigning the value of the classification field. How can I find a solution?