How to Call LP360 Command Line Executable Programs in a Python Script

LP360 has several command line executable style programs that assist with productivity for different tasks, particularly when working with large amounts of data or repeating processes. One way of using these commands is by incorporating them into MS-DOS style batch scripts. Another is by configuring corresponding commands and checklist steps within the GeoCue workflow software to take advantage of the command and dispatch system on top of the workflow management tools contain therein. A third method would be to call these programs as part of your standard Python processing scripts. The Python scripts may also be integrated within GeoCue to take advantage of the workflow management toolset.

Integrating these executables into the Python script would be accomplished using the SubProcess module. Below are some examples of how to wrote the integration, although I’m sure there are other variants that will work as well, or perhaps even better.

Examples

For example, to Pyramid a file using a thin factor of 16 one may elect to do the following.

MS-DOS

[code language="text" gutter="false"]
"C:\Program Files\Common Files\LP360\LDPyramid.exe" "D:\Cases\Python\test.las" -f 16
[/code]

Python

[code language="python" gutter="false"]
import subprocess

subprocess.call(["C:\Program Files\Common Files\LP360\LDPyramid.exe", "D:\Cases\Python\\test.las", "-f", "16"])
[/code]

For example, to execute a point class task on a directory of LAS files one may elect to do the following.

MS-DOS

[code language="text" gutter="false"]
"C:\Program Files\Common Files\LP360\LPRunPCT.exe" -t D:\Cases\Python\all2unclassified.xml -d D:\Cases\Python
[/code]

Python

[code language="python" gutter="false"]
import subprocess

subprocess.call(["C:\Program Files\Common Files\LP360\LPRunPCT.exe", "-t", "D:\Cases\Python\\all2unclassified.xml", "-d", "D:\Cases\Python"])
[/code]

Return Codes

Proper structure of the command line arguments is necessary to get the sub process call to work. The following are the return codes that can be expected from the LP360 command line executables.

Return CodeMeaning
0Success
-1Bad command line arguments
1Bad command line arguments

Tips

  • When specifying a path to a file be sure to use two backslashes instead of just one. Only use one between directories (“folder\subfolder\\file.txt”) .
  • Command line arguments that contain spaces need to be entered separately.
Share

GeoCue Support has written 723 articles