Hello,
I just noticed that las2las throws an exit code of 1 on some warnings. In particular, it throws an exit code of 1 when it changes the offsets due to a change in scale request.
WARNING: i changed y_offset from 0 to 3.74075e+06 to accommodate enlarged bounding box
WARNING: rescaling from 0.01 to 0.001 and reoffsetting from 3.7e+06 to 3.74075e+06 causes LAS integer overflow for min_y
WARNING: rescaling from 0.01 to 0.001 and reoffsetting from 3.7e+06 to 3.74075e+06 causes LAS integer overflow for max_y
WARNING: rescaling from 0.01 to 0.001 and reoffsetting from 500000 to 0 causes LAS integer overflow for min_x
WARNING: rescaling from 0.01 to 0.001 and reoffsetting from 500000 to 0 causes LAS integer overflow for max_x
WARNING: rescaling from 0.01 to 0.001 and reoffsetting from 500000 to 0 causes LAS integer overflow for min_x
WARNING: rescaling from 0.01 to 0.001 and reoffsetting from 500000 to 0 causes LAS integer overflow for max_x
WARNING: rescaling from 0.01 to 0.001 and reoffsetting from 500000 to 0 causes LAS integer overflow for min_x
WARNING: rescaling from 0.01 to 0.001 and reoffsetting from 500000 to 0 causes LAS integer overflow for max_x
In this case, the program changed the offsets as required, finished processing the file and then threw an exit code of 1. Is this intended behaviour? Other programs such as "laszip -check -i some_corrupt_file.laz" exit with 0 even if the file is corrupt.
When lastools exits with 1 even though it successfully competed, it makes it tough to separate a critical failure (malloc, bad options, bug) from general information that I might want to be aware of. I capture exit code's, stdout and stderr, but generally treat anything other than 0 as an indication that the workflow needs to stop for that file immediately.
Structured exit codes (0 - I'm happy and all is good, 1 - Warnings, 2 - Bad CLI Parameters, 3 - Critical Failure, 4 - No license, etc) would be useful for those of us that do heavy scripting with lastools. But in that absence, I think 0 should mean "I finished" and 1 should mean "I failed".
Cheers,
Mike