jblindsay / whitebox-tools

An advanced geospatial data analysis platform
https://www.whiteboxgeo.com/
MIT License
967 stars 161 forks source link

Ensure consistent pit cells ordering before breaching #419

Open jfbourdon opened 4 months ago

jfbourdon commented 4 months ago

Fix #418

Make sure that each run of the tool gives the same output. This is needed because the stack is built using parallel processing meaning that the values aren't always in the same order. This isn't an issue as long as their is no height ties... which happen quite often. Sorting first by X and Y ensure consistent ordering as this XY tuple is unique for each cell.

My PR use three consecutive sort_by() but I'm sure there is an more elegant or concise way to do it. An alternative might be to build the stack while keeping track of each row.