File: split_las.py

package info (click to toggle)
hinge 0.5.0-8
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,972 kB
  • sloc: cpp: 9,480; ansic: 8,826; python: 5,023; sh: 340; makefile: 10
file content (21 lines) | stat: -rwxr-xr-x 634 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python3

import os
import argparse

ap = argparse.ArgumentParser(description="run LAsplit by splitting las into sizes of less than specified length")
ap.add_argument("las", help="path to las file to be split. assumed to be sorted.")
ap.add_argument("max_size", help="max size of any split file.", type=int, default=4, nargs='?')

args = ap.parse_args()

laspath = args.las
max_las_size = args.max_size


x = os.path.getsize(laspath)
num_divisions = (x/10**9)/max_las_size + 1
out_las_name = laspath.split('.las')[0]+'.# '

LAsplit_cmd = 'LAsplit -v '+out_las_name+ str(num_divisions) +' < ' + laspath
os.system(LAsplit_cmd)