-
Notifications
You must be signed in to change notification settings - Fork 1
/
lidar_processing_functions.py
700 lines (559 loc) · 23 KB
/
lidar_processing_functions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
from tkinter import *
from file_functions import *
import os
import shutil
import numpy as np
import logging
import gc
gc.collect()
##########################
# first let's define some functions that will be helpful
def las_files(
directory: str,
) -> List[str]:
"""returns list of all .las/.laz files in directory (at top level)"""
l = []
for name in os.listdir(directory):
if name.endswith('.las') or name.endswith('.laz'):
l.append(directory + name)
return l
def lof_text(
pwd: str,
src: str,
) -> str:
"""Creates a .txt file in pwd (LAStools bin) containing a list of .las/.laz filenames from src directory
Args:
pwd: LAStools bin path
src: working directory path for LAStools and directory containing .las/.laz files
Returns:
The name of the .txt file.
"""
filename = pwd + 'file_list.txt'
f = open(filename, 'w+')
if type(src) == str:
for i in las_files(src):
f.write('%s\n' % i)
else:
# this is the case when there are multiple source folders
for i in [name for source in src for name in las_files(source)]:
f.write('%s\n' % i)
f.close()
return filename
def point_density(
filename: str,
) -> float:
"""Returns point density from lasinfo output .txt file via the .las/.laz filename"""
# name of txt output file from lasinfo
filename = filename[:-4] + '.txt'
f = open(filename, 'r')
text = f.readlines()
for line in text:
if line.startswith('point density:'):
d = line.split(' ')
d = d[d.index('returns') + 1]
return float(d)
def get_largest(
directory: str,
) -> str:
"""returns name of largest file in directory"""
largest_so_far = 0
filename = ''
for name in os.listdir(directory):
size = os.path.getsize(os.path.join(directory, name))
if size > largest_so_far:
largest_so_far = size
filename = name
return os.path.join(directory, filename)
def pts(
filename: str,
lastoolsdir: str,
) -> int:
"""returns number of points in las file"""
# call lasinfo on the file
cmd('%slasinfo.exe -i %s -otxt -histo number_of_returns 1' %
(lastoolsdir, filename))
# name of txt output file from lasinfo
txt = filename[:-4] + '.txt'
f = open(txt, 'r')
text = f.readlines()
for line in text:
if line.endswith('element(s)\n'):
d = line.split(' ')
d = d[d.index('for') + 1]
return int(d)
@err_info
def process_lidar(
lastoolsdir,
lidardir,
ground_poly,
cores,
units_code,
keep_orig_pts,
coarse_step,
coarse_bulge,
coarse_spike,
coarse_down_spike,
coarse_offset,
fine_step,
fine_bulge,
fine_spike,
fine_down_spike,
fine_offset,
) -> None:
"""Executes main LAStools processing workflow. See readme for more info."""
classes = [
'01-Default',
'02-Ground',
'05-Vegetation',
'06-Building',
]
if (ground_poly != '') and (keep_orig_pts == True):
# run on coarse and fine settings, need to clip and remove duplicates after merging
outdirs = [
'00_separated',
'00_declassified',
'01_tiled',
'02a_lasground_new_coarse',
'02b_lasground_new_fine',
'03a_lasheight_coarse',
'03b_lasheight_fine',
'04a_lasclassify_coarse',
'04b_lasclassify_fine',
'05a_lastile_rm_buffer_coarse',
'05b_lastile_rm_buffer_fine',
'06a_separated_coarse',
'06b_separated_fine',
'07a_ground_clipped_coarse',
'07b_ground_clipped_fine',
'08_ground_merged',
'09_ground_rm_duplicates',
'10_veg_new_merged',
'11_veg_new_clipped',
'12_veg_merged',
'13_veg_rm_duplicates',
]
elif (ground_poly == '') and (keep_orig_pts == True):
# only classify with coarse settings, no clipping, but need to remove duplicates
outdirs = [
'00_separated',
'00_declassified',
'01_tiled',
'02_lasground_new',
'03_lasheight',
'04_lasclassify',
'05_lastile_rm_buffer',
'06_separated',
'08_ground_merged',
'09_ground_rm_duplicates',
'12_veg_merged',
'13_veg_rm_duplicates',
]
elif (ground_poly == '') and (keep_orig_pts == False):
# only classify with coarse setting, no clipping or removing duplicates necessary
outdirs = [
'00_separated',
'00_declassified',
'01_tiled',
'02_lasground_new',
'03_lasheight',
'04_lasclassify',
'05_lastile_rm_buffer',
'06_separated',
]
elif (ground_poly != '') and (keep_orig_pts == False):
# run on coarse and fine settings, clip, but no removing duplicates needed
outdirs = [
'00_separated',
'00_declassified',
'01_tiled',
'02a_lasground_new_coarse',
'02b_lasground_new_fine',
'03a_lasheight_coarse',
'03b_lasheight_fine',
'04a_lasclassify_coarse',
'04b_lasclassify_fine',
'05a_lastile_rm_buffer_coarse',
'05b_lastile_rm_buffer_fine',
'06a_separated_coarse',
'06b_separated_fine',
'07a_ground_clipped_coarse',
'07b_ground_clipped_fine',
'08_ground_merged',
'10_veg_new_merged',
'11_veg_new_clipped',
'12_veg_merged',
]
# make new directories for output from each step in processing
for ind, outdir in enumerate(outdirs):
if os.path.isdir(lidardir + outdir) == False:
os.mkdir(lidardir + outdir)
if len(os.listdir(lidardir + outdirs[0])) != 0:
msg = 'Output directories must initially be empty. Move or delete the data currently in output directories.'
logging.error(msg)
raise Exception(msg)
# in each 'separated' folder, create subdirs for each class type
if ground_poly != '':
sepdirs = [
lidardir + '00_separated',
lidardir + '06a_separated_coarse',
lidardir + '06b_separated_fine',
]
else:
sepdirs = [
lidardir + '00_separated',
lidardir + '06_separated',
]
for sepdir in sepdirs:
for class_type in classes:
class_dir = sepdir + '/' + class_type
if os.path.isdir(class_dir) == False:
os.mkdir(class_dir)
logging.info('Created directories for output data')
##################################
# create declassified points
logging.info('Declassifying copy of original point cloud...')
# get list of filenames for original LiDAR data (all .las and .laz files in lidardir)
lidar_files = []
for path, subdirs, files in os.walk(lidardir):
for name in files:
if name.endswith('.las') or name.endswith('.laz'):
# Used to have a '/' added between path and name
lidar_files.append(path + name)
if lidar_files == []:
msg = 'No .las or .laz files in %s or its subdirectories' % lidardir
logging.error(msg)
raise Exception(msg)
# remove duplicate files already copied to declassified in re-run scenarios
for name in lidar_files:
if '00_declassified' in name:
lidar_files.remove(name)
# copy original files into '00_declassified' folder
out_fol = lidardir + '00_declassified/'
for name in lidar_files:
name_base = os.path.basename(name)
if name_base not in os.listdir(out_fol):
shutil.copyfile(name, out_fol + name_base)
# make list of files for LASTools to process, which is output
lof = lof_text(lastoolsdir, lidardir + '00_declassified/')
# call LAStools command to declassify points and get point density
cmd('%slasinfo.exe -lof %s -set_classification 1 -otxt -cd' %
(lastoolsdir, lof))
logging.info('OK')
# separate original data by class type
logging.info('Separating original data by class type...')
filename = lastoolsdir + 'file_list.txt'
f = open(filename, 'w+')
for i in lidar_files:
f.write('%s\n' % i)
f.close()
lof = filename
for class_type in classes:
odir = lidardir + '00_separated' + '/' + class_type + '/'
class_code = int(class_type.split('-')[0])
cmd('%slas2las.exe -lof %s -cores %i -keep_classification %i -odir %s -olas' % (
lastoolsdir, lof, cores, class_code, odir))
logging.info('OK')
########################
# create tiling (max 1.5M pts per tile)
logging.info('Creating tiling...')
# get point density for each .las file
ds = []
for filename in las_files(lidardir + '00_declassified/'):
ds.append(point_density(filename))
# use max point density out of all files to determine tile size
max_d = max(ds)
# width of square tile so we have max of 1.5M pts per tile (assuming same number of points per tile)
# throw in another factor of 0.5 to make sure tiles will be small enough, round to nearest 10
tile_size = round(0.5 * np.sqrt((1.5 * 10 ** 6) / max_d), -1)
logging.info('Using tile size of %i' % tile_size)
odir = (lidardir + '01_tiled/')
# call LAStools command to create tiling
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slastile.exe -lof %s -cores %i -tile_size %i -buffer 5 -faf -odir %s -o tile.las -olas' % (
lastoolsdir, lof, cores, tile_size, odir))
logging.info('OK')
# check to make sure tiles are small enough
logging.info(
'Checking if largest file has < 1.5M pts (to avoid licensing restrictions)...')
largest_file = get_largest(odir)
num = pts(largest_file, lastoolsdir)
if num < 1500000:
logging.info('Largest file has %i points, tiles small enough.' % num)
else:
logging.info(
'Tile size not small enough. Retrying with a smaller tile size...')
while num >= 1500000:
# delete original set of tiles
folder = odir
for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
except:
logging.warning('Couldn\'nt delete %s' % file_path)
# redo tiling
tile_size = int(tile_size * num * 1.0 / 1500000)
logging.info('Using tile size of %i' % tile_size)
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slastile.exe -lof %s -cores %i -o tile.las -tile_size %i -buffer 5 -faf -odir %s -olas' % (
lastoolsdir, lof, cores, tile_size, odir))
# recheck largest tile number of points
logging.info(
'Checking if largest file has < 1.5M pts (to avoid licensing restrictions)...')
largest_file = get_largest(odir)
num = pts(largest_file, lastoolsdir)
if num >= 1500000:
logging.info(
'Tile size not small enough. Retrying with a smaller tile size...')
logging.info('OK')
########################
# run lasground_new on coarse and fine settings
logging.info('Running ground classification on coarse setting...')
lof = lof_text(lastoolsdir, lidardir + '01_tiled/')
if ground_poly != '':
odir = lidardir + '02a_lasground_new_coarse/'
else:
odir = lidardir + '02_lasground_new'
cmd(
'%slasground_new.exe -lof %s -cores %i %s -step %s -bulge %s -spike %s -down_spike %s -offset %s -hyper_fine -odir %s -olas' % (
lastoolsdir,
lof,
cores,
units_code,
coarse_step,
coarse_bulge,
coarse_spike,
coarse_down_spike,
coarse_offset,
odir
)
)
logging.info('OK')
if ground_poly != '':
logging.info('Running ground classification on fine setting...')
odir = lidardir + '02b_lasground_new_fine/'
cmd(
'%slasground_new.exe -lof %s -cores %i %s -step %s -bulge %s -spike %s -down_spike %s -offset %s -hyper_fine -odir %s -olas' % (
lastoolsdir,
lof,
cores,
units_code,
fine_step,
fine_bulge,
fine_spike,
fine_down_spike,
fine_offset,
odir,
)
)
logging.info('OK')
##########################
# run lasheight on each data set
logging.info('Measuring height above ground for non-ground points...')
if ground_poly != '':
lof = lof_text(lastoolsdir, lidardir + '02a_lasground_new_coarse/')
odir = lidardir + '03a_lasheight_coarse/'
else:
lof = lof_text(lastoolsdir, lidardir + '02_lasground_new/')
odir = lidardir + '03_lasheight/'
cmd('%slasheight.exe -lof %s -cores %i -odir %s -olas' %
(lastoolsdir, lof, cores, odir))
if ground_poly != '':
lof = lof_text(lastoolsdir, lidardir + '02b_lasground_new_fine/')
odir = lidardir + '03b_lasheight_fine/'
cmd('%slasheight.exe -lof %s -cores %i -odir %s -olas' %
(lastoolsdir, lof, cores, odir))
logging.info('OK')
##########################
# run lasclassify on each data set
logging.info('Classifying non-ground points on coarse setting...')
if ground_poly != '':
lof = lof_text(lastoolsdir, lidardir + '03a_lasheight_coarse/')
odir = lidardir + '04a_lasclassify_coarse/'
else:
lof = lof_text(lastoolsdir, lidardir + '03_lasheight/')
odir = lidardir + '04_lasclassify/'
cmd('%slasclassify.exe -lof %s -cores %i %s -odir %s -olas' %
(lastoolsdir, lof, cores, units_code, odir))
logging.info('OK')
if ground_poly != '':
logging.info('Classifying non-ground points on fine setting...')
lof = lof_text(lastoolsdir, lidardir + '03b_lasheight_fine/')
odir = lidardir + '04b_lasclassify_fine/'
cmd('%slasclassify.exe -lof %s -cores %i %s -odir %s -olas' %
(lastoolsdir, lof, cores, units_code, odir))
logging.info('OK')
##########################
# remove tile buffers on each data set
logging.info('Removing tile buffers...')
if ground_poly != '':
lof = lof_text(lastoolsdir, lidardir + '04a_lasclassify_coarse/')
odir = lidardir + '05a_lastile_rm_buffer_coarse/'
else:
lof = lof_text(lastoolsdir, lidardir + '04_lasclassify/')
odir = lidardir + '05_lastile_rm_buffer/'
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slastile.exe -lof %s -cores %i -remove_buffer -odir %s -olas' %
(lastoolsdir, lof, cores, odir))
if ground_poly != '':
lof = lof_text(lastoolsdir, lidardir + '04b_lasclassify_fine/')
odir = lidardir + '05b_lastile_rm_buffer_fine/'
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slastile.exe -lof %s -cores %i -remove_buffer -odir %s -olas' %
(lastoolsdir, lof, cores, odir))
logging.info('OK')
##########################
# separate into files for each class type
logging.info('Separating points by class type on coarse setting...')
# coarse
if ground_poly != '':
lof = lof_text(lastoolsdir, lidardir + '05a_lastile_rm_buffer_coarse/')
podir = lidardir + '06a_separated_coarse'
else:
lof = lof_text(lastoolsdir, lidardir + '05_lastile_rm_buffer/')
podir = lidardir + '06_separated'
for class_type in classes:
odir = podir + '/' + class_type + '/'
class_code = int(class_type.split('-')[0])
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slas2las.exe -lof %s -cores %i -keep_classification %i -odir %s -olas' % (
lastoolsdir, lof, cores, class_code, odir))
logging.info('OK')
if (ground_poly) == '' and (keep_orig_pts == False):
ground_results = podir + '/' + '02-Ground' + '/'
veg_results = podir + '/' + '05-Vegetation' + '/'
if ground_poly != '':
logging.info('Separating points by class type on fine setting...')
# fine
lof = lof_text(lastoolsdir, lidardir + '05b_lastile_rm_buffer_fine/')
for class_type in classes:
odir = lidardir + '06b_separated_fine' + '/' + class_type + '/'
class_code = int(class_type.split('-')[0])
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slas2las.exe -lof %s -cores %i -keep_classification %i -odir %s -olas' % (
lastoolsdir, lof, cores, class_code, odir))
logging.info('OK')
##########################
# clip ground data sets with ground polygon
if ground_poly != '':
logging.info(
'Clipping ground points to inverse ground polygon on coarse setting...')
# keep points outside ground polygon for coarse setting (-interior flag)
lof = lof_text(lastoolsdir, lidardir +
'06a_separated_coarse' + '/' + '02-Ground' + '/')
odir = lidardir + '07a_ground_clipped_coarse/'
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slasclip.exe -lof %s -cores %i -poly %s -interior -donuts -odir %s -olas' % (
lastoolsdir, lof, cores, ground_poly, odir))
logging.info('OK')
logging.info(
'Clipping ground points to ground polygon on fine setting...')
# keep points inside ground polygon for fine setting
lof = lof_text(lastoolsdir, lidardir +
'06b_separated_fine' + '/' + '02-Ground' + '/')
odir = lidardir + '07b_ground_clipped_fine/'
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slasclip.exe -lof %s -cores %i -poly %s -donuts -odir %s -olas' % (
lastoolsdir, lof, cores, ground_poly, odir))
logging.info('OK')
##########################
# merge
# merge processed ground points with original data set ground points
if keep_orig_pts:
logging.info('Merging new and original ground points...')
if ground_poly != '':
sources = [lidardir + '07a_ground_clipped_coarse/', lidardir + '07b_ground_clipped_fine/',
lidardir + '00_separated' + '/' + '02-Ground' + '/']
else:
sources = [lidardir + '06_separated' + '/' + '02-Ground' + '/',
lidardir + '00_separated' + '/' + '02-Ground' + '/']
# just use new points
elif ground_poly != '':
logging.info('Merging new ground points...')
sources = [lidardir + '07a_ground_clipped_coarse/',
lidardir + '07b_ground_clipped_fine/']
if (keep_orig_pts == True) or (ground_poly != ''):
lof = lof_text(lastoolsdir, sources)
odir = lidardir + '08_ground_merged/'
ground_results = odir # will be overwritten if rm_duplicates block runs
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slastile.exe -lof %s -cores %i -o tile.las -tile_size %i -faf -odir %s -olas' % (
lastoolsdir, lof, cores, tile_size, odir))
logging.info('OK')
##########################
# remove duplicate ground points
if keep_orig_pts:
logging.info('Removing duplicate ground points...')
lof = lof_text(lastoolsdir, lidardir + '08_ground_merged/')
odir = lidardir + '09_ground_rm_duplicates/'
ground_results = odir
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slasduplicate.exe -lof %s -cores %i -lowest_z -odir %s -olas' %
(lastoolsdir, lof, cores, odir))
logging.info('OK')
##########################
# merge new veg points
if ground_poly != '':
logging.info(
'Merging new vegetation points from coarse and fine run...')
sources = [lidardir + '06a_separated_coarse' + '/' + '05-Vegetation' + '/',
lidardir + '06b_separated_fine' + '/' + '05-Vegetation' + '/']
lof = lof_text(lastoolsdir, sources)
odir = lidardir + '10_veg_new_merged/'
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slastile.exe -lof %s -cores %i -o tile.las -tile_size %i -faf -odir %s -olas' % (
lastoolsdir, lof, cores, tile_size, odir))
logging.info('OK')
#########################
# clip new veg points
# keeping points outside the ground polygon
logging.info('Clipping new vegetation points...')
lof = lof_text(lastoolsdir, lidardir + '10_veg_new_merged/')
odir = lidardir + '11_veg_new_clipped/'
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slasclip.exe -lof %s -cores %i -poly %s -interior -donuts -odir %s -olas' % (
lastoolsdir, lof, cores, ground_poly, odir))
logging.info('OK')
#########################
# merge with original veg points
if (keep_orig_pts == True):
logging.info('Merging new and original vegetation points...')
if ground_poly != '':
sources = [
lidardir + '11_veg_new_clipped/',
lidardir + '00_separated' + '/' + '05-Vegetation' + '/',
]
else:
sources = [
lidardir + '06_separated' + '/' + '05-Vegetation' + '/',
lidardir + '00_separated' + '/' + '05-Vegetation' + '/',
]
elif ground_poly != '':
logging.info('Retiling new vegetation points...')
sources = [lidardir + '11_veg_new_clipped/']
if (keep_orig_pts == True) or (ground_poly != ''):
lof = lof_text(lastoolsdir, sources)
odir = lidardir + '12_veg_merged/'
veg_results = odir # will be overwritten if rm_duplicates block runs
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slastile.exe -lof %s -cores %i -o tile.las -tile_size %i -faf -odir %s -olas' % (
lastoolsdir, lof, cores, tile_size, odir))
logging.info('OK')
#########################
# remove duplicate veg points
if keep_orig_pts:
logging.info('Removing duplicate vegetation points...')
lof = lof_text(lastoolsdir, lidardir + '12_veg_merged/')
odir = lidardir + '13_veg_rm_duplicates/'
veg_results = odir
cmd('%slasindex.exe -lof %s -cores %i' % (lastoolsdir, lof, cores))
cmd('%slasduplicate.exe -lof %s -cores %i -lowest_z -odir %s -olas' %
(lastoolsdir, lof, cores, odir))
logging.info('OK')
logging.info('Processing finished.')
logging.info('Outputs in:')
logging.info(ground_results)
logging.info('')
logging.info(veg_results)
return