16
Python and Java API / Re: Automated PS script to process single or multiple chunks - opinions please
« on: February 12, 2019, 04:52:05 AM »
Hey mks_gis,
What do you think of the following code structure, for instance, to range from a value to another of filter levels and try to remove points if a condition is True? It also can restart searching through the same range values if one is found. I'm working on still, just thought of sharing this idea to implement filtering for the USGS workflow (thinking of reconstruction uncertainty running more than once till no points are selected based on the chosen range). This of course would rapidly decrease points in point cloud.
Looking forward to see your new version of the code!
What do you think of the following code structure, for instance, to range from a value to another of filter levels and try to remove points if a condition is True? It also can restart searching through the same range values if one is found. I'm working on still, just thought of sharing this idea to implement filtering for the USGS workflow (thinking of reconstruction uncertainty running more than once till no points are selected based on the chosen range). This of course would rapidly decrease points in point cloud.
Code: [Select]
threshold = range(0, 11, 1) # here would be the filter levels range
listx = [] # throwing a list just for the exemple
for i in threshold:
listx.append(i)
restart = 0
restartLoop = True
while restartLoop:
restartLoop = False
for idx, i in enumerate(listx):
print("do something as printing i:", i)
if i > 5: # if this condition: remove points and restart loop to search again in range
print("found value for condition: ", i)
del listx[idx] # simulates removing points for a certain i value
# optimization would happen here
restartLoop = True
print("RESTARTING LOOP\n")
restart += 1
break # break inner while and restart for loop
else:
# continue if the inner loop wasn't broken
continue
else:
continue
print("restart - outer while", restart)
Looking forward to see your new version of the code!