BERATools 0.2.0__py3-none-any.whl → 0.2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. beratools/__init__.py +1 -7
  2. beratools/core/algo_centerline.py +491 -351
  3. beratools/core/algo_common.py +497 -0
  4. beratools/core/algo_cost.py +192 -0
  5. beratools/core/{dijkstra_algorithm.py → algo_dijkstra.py} +503 -460
  6. beratools/core/algo_footprint_rel.py +577 -0
  7. beratools/core/algo_line_grouping.py +944 -0
  8. beratools/core/algo_merge_lines.py +214 -0
  9. beratools/core/algo_split_with_lines.py +304 -0
  10. beratools/core/algo_tiler.py +428 -0
  11. beratools/core/algo_vertex_optimization.py +469 -0
  12. beratools/core/constants.py +52 -86
  13. beratools/core/logger.py +76 -85
  14. beratools/core/tool_base.py +196 -133
  15. beratools/gui/__init__.py +11 -15
  16. beratools/gui/{beratools.json → assets/beratools.json} +2185 -2300
  17. beratools/gui/batch_processing_dlg.py +513 -463
  18. beratools/gui/bt_data.py +481 -487
  19. beratools/gui/bt_gui_main.py +710 -691
  20. beratools/gui/main.py +26 -0
  21. beratools/gui/map_window.py +162 -146
  22. beratools/gui/tool_widgets.py +725 -493
  23. beratools/tools/Beratools_r_script.r +1120 -1120
  24. beratools/tools/Ht_metrics.py +116 -116
  25. beratools/tools/__init__.py +7 -7
  26. beratools/tools/batch_processing.py +136 -132
  27. beratools/tools/canopy_threshold_relative.py +672 -670
  28. beratools/tools/canopycostraster.py +222 -222
  29. beratools/tools/centerline.py +136 -176
  30. beratools/tools/common.py +857 -885
  31. beratools/tools/fl_regen_csf.py +428 -428
  32. beratools/tools/forest_line_attributes.py +408 -408
  33. beratools/tools/line_footprint_absolute.py +213 -363
  34. beratools/tools/line_footprint_fixed.py +436 -282
  35. beratools/tools/line_footprint_functions.py +733 -720
  36. beratools/tools/line_footprint_relative.py +73 -64
  37. beratools/tools/line_grouping.py +45 -0
  38. beratools/tools/ln_relative_metrics.py +615 -615
  39. beratools/tools/r_cal_lpi_elai.r +24 -24
  40. beratools/tools/r_generate_pd_focalraster.r +100 -100
  41. beratools/tools/r_interface.py +79 -79
  42. beratools/tools/r_point_density.r +8 -8
  43. beratools/tools/rpy_chm2trees.py +86 -86
  44. beratools/tools/rpy_dsm_chm_by.py +81 -81
  45. beratools/tools/rpy_dtm_by.py +63 -63
  46. beratools/tools/rpy_find_cellsize.py +43 -43
  47. beratools/tools/rpy_gnd_csf.py +74 -74
  48. beratools/tools/rpy_hummock_hollow.py +85 -85
  49. beratools/tools/rpy_hummock_hollow_raster.py +71 -71
  50. beratools/tools/rpy_las_info.py +51 -51
  51. beratools/tools/rpy_laz2las.py +40 -40
  52. beratools/tools/rpy_lpi_elai_lascat.py +466 -466
  53. beratools/tools/rpy_normalized_lidar_by.py +56 -56
  54. beratools/tools/rpy_percent_above_dbh.py +80 -80
  55. beratools/tools/rpy_points2trees.py +88 -88
  56. beratools/tools/rpy_vegcoverage.py +94 -94
  57. beratools/tools/tiler.py +48 -206
  58. beratools/tools/tool_template.py +69 -54
  59. beratools/tools/vertex_optimization.py +61 -620
  60. beratools/tools/zonal_threshold.py +144 -144
  61. beratools-0.2.2.dist-info/METADATA +108 -0
  62. beratools-0.2.2.dist-info/RECORD +74 -0
  63. {beratools-0.2.0.dist-info → beratools-0.2.2.dist-info}/WHEEL +1 -1
  64. {beratools-0.2.0.dist-info → beratools-0.2.2.dist-info}/licenses/LICENSE +22 -22
  65. beratools/gui/cli.py +0 -18
  66. beratools/gui/gui.json +0 -8
  67. beratools/gui_tk/ASCII Banners.txt +0 -248
  68. beratools/gui_tk/__init__.py +0 -20
  69. beratools/gui_tk/beratools_main.py +0 -515
  70. beratools/gui_tk/bt_widgets.py +0 -442
  71. beratools/gui_tk/cli.py +0 -18
  72. beratools/gui_tk/img/BERALogo.png +0 -0
  73. beratools/gui_tk/img/closed.gif +0 -0
  74. beratools/gui_tk/img/closed.png +0 -0
  75. beratools/gui_tk/img/open.gif +0 -0
  76. beratools/gui_tk/img/open.png +0 -0
  77. beratools/gui_tk/img/tool.gif +0 -0
  78. beratools/gui_tk/img/tool.png +0 -0
  79. beratools/gui_tk/main.py +0 -14
  80. beratools/gui_tk/map_window.py +0 -144
  81. beratools/gui_tk/runner.py +0 -1481
  82. beratools/gui_tk/tooltip.py +0 -55
  83. beratools/third_party/pyqtlet2/__init__.py +0 -9
  84. beratools/third_party/pyqtlet2/leaflet/__init__.py +0 -26
  85. beratools/third_party/pyqtlet2/leaflet/control/__init__.py +0 -6
  86. beratools/third_party/pyqtlet2/leaflet/control/control.py +0 -59
  87. beratools/third_party/pyqtlet2/leaflet/control/draw.py +0 -52
  88. beratools/third_party/pyqtlet2/leaflet/control/layers.py +0 -20
  89. beratools/third_party/pyqtlet2/leaflet/core/Parser.py +0 -24
  90. beratools/third_party/pyqtlet2/leaflet/core/__init__.py +0 -2
  91. beratools/third_party/pyqtlet2/leaflet/core/evented.py +0 -180
  92. beratools/third_party/pyqtlet2/leaflet/layer/__init__.py +0 -5
  93. beratools/third_party/pyqtlet2/leaflet/layer/featuregroup.py +0 -34
  94. beratools/third_party/pyqtlet2/leaflet/layer/icon/__init__.py +0 -1
  95. beratools/third_party/pyqtlet2/leaflet/layer/icon/icon.py +0 -30
  96. beratools/third_party/pyqtlet2/leaflet/layer/imageoverlay.py +0 -18
  97. beratools/third_party/pyqtlet2/leaflet/layer/layer.py +0 -105
  98. beratools/third_party/pyqtlet2/leaflet/layer/layergroup.py +0 -45
  99. beratools/third_party/pyqtlet2/leaflet/layer/marker/__init__.py +0 -1
  100. beratools/third_party/pyqtlet2/leaflet/layer/marker/marker.py +0 -91
  101. beratools/third_party/pyqtlet2/leaflet/layer/tile/__init__.py +0 -2
  102. beratools/third_party/pyqtlet2/leaflet/layer/tile/gridlayer.py +0 -4
  103. beratools/third_party/pyqtlet2/leaflet/layer/tile/tilelayer.py +0 -16
  104. beratools/third_party/pyqtlet2/leaflet/layer/vector/__init__.py +0 -5
  105. beratools/third_party/pyqtlet2/leaflet/layer/vector/circle.py +0 -15
  106. beratools/third_party/pyqtlet2/leaflet/layer/vector/circlemarker.py +0 -18
  107. beratools/third_party/pyqtlet2/leaflet/layer/vector/path.py +0 -5
  108. beratools/third_party/pyqtlet2/leaflet/layer/vector/polygon.py +0 -14
  109. beratools/third_party/pyqtlet2/leaflet/layer/vector/polyline.py +0 -18
  110. beratools/third_party/pyqtlet2/leaflet/layer/vector/rectangle.py +0 -14
  111. beratools/third_party/pyqtlet2/leaflet/map/__init__.py +0 -1
  112. beratools/third_party/pyqtlet2/leaflet/map/map.py +0 -220
  113. beratools/third_party/pyqtlet2/mapwidget.py +0 -45
  114. beratools/third_party/pyqtlet2/web/custom.js +0 -43
  115. beratools/third_party/pyqtlet2/web/map.html +0 -23
  116. beratools/third_party/pyqtlet2/web/modules/leaflet_193/images/layers-2x.png +0 -0
  117. beratools/third_party/pyqtlet2/web/modules/leaflet_193/images/layers.png +0 -0
  118. beratools/third_party/pyqtlet2/web/modules/leaflet_193/images/marker-icon-2x.png +0 -0
  119. beratools/third_party/pyqtlet2/web/modules/leaflet_193/images/marker-icon.png +0 -0
  120. beratools/third_party/pyqtlet2/web/modules/leaflet_193/images/marker-shadow.png +0 -0
  121. beratools/third_party/pyqtlet2/web/modules/leaflet_193/leaflet.css +0 -656
  122. beratools/third_party/pyqtlet2/web/modules/leaflet_193/leaflet.js +0 -6
  123. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/.codeclimate.yml +0 -14
  124. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/.editorconfig +0 -4
  125. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/.gitattributes +0 -22
  126. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/.travis.yml +0 -43
  127. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/LICENSE +0 -20
  128. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/images/layers-2x.png +0 -0
  129. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/images/layers.png +0 -0
  130. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/images/marker-icon-2x.png +0 -0
  131. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/images/marker-icon.png +0 -0
  132. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/images/marker-shadow.png +0 -0
  133. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/images/spritesheet-2x.png +0 -0
  134. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/images/spritesheet.png +0 -0
  135. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/images/spritesheet.svg +0 -156
  136. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/leaflet.draw.css +0 -10
  137. beratools/third_party/pyqtlet2/web/modules/leaflet_draw_414/leaflet.draw.js +0 -10
  138. beratools/third_party/pyqtlet2/web/modules/leaflet_rotatedMarker_020/LICENSE +0 -22
  139. beratools/third_party/pyqtlet2/web/modules/leaflet_rotatedMarker_020/leaflet.rotatedMarker.js +0 -57
  140. beratools/tools/forest_line_ecosite.py +0 -216
  141. beratools/tools/lapis_all.py +0 -103
  142. beratools/tools/least_cost_path_from_chm.py +0 -152
  143. beratools-0.2.0.dist-info/METADATA +0 -63
  144. beratools-0.2.0.dist-info/RECORD +0 -142
  145. /beratools/gui/{img → assets}/BERALogo.png +0 -0
  146. /beratools/gui/{img → assets}/closed.gif +0 -0
  147. /beratools/gui/{img → assets}/closed.png +0 -0
  148. /beratools/{gui_tk → gui/assets}/gui.json +0 -0
  149. /beratools/gui/{img → assets}/open.gif +0 -0
  150. /beratools/gui/{img → assets}/open.png +0 -0
  151. /beratools/gui/{img → assets}/tool.gif +0 -0
  152. /beratools/gui/{img → assets}/tool.png +0 -0
  153. {beratools-0.2.0.dist-info → beratools-0.2.2.dist-info}/entry_points.txt +0 -0
@@ -1,81 +1,81 @@
1
- import os
2
- import time
3
-
4
- from beratools.tools.common import *
5
- from beratools.tools.r_interface import *
6
-
7
- def chm_by(callback, in_las_folder, is_normalized, out_folder, cell_size, style, processes, verbose):
8
- rprocesses = r_processes(processes)
9
-
10
- # assign R script file to local variable
11
- Beratools_R_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Beratools_r_script.r')
12
- # Defining the R script and loading the instance in Python
13
- r['source'](Beratools_R_script)
14
- # Loading the function defined in R script.
15
- if style == "tin":
16
- r_chm_by_algorithm = robjects.globalenv['chm_by_dsmtin']
17
- else:
18
- r_chm_by_algorithm = robjects.globalenv['chm_by_pitfree']
19
-
20
- # Invoking the R function
21
- r_chm_by_algorithm(in_las_folder, out_folder, cell_size, is_normalized, rprocesses)
22
-
23
-
24
-
25
- if __name__ == '__main__':
26
- start_time = time.time()
27
- print('Normalize Lidar data processing\n @ {}'
28
- .format(time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())))
29
-
30
- packages = ['lidR', 'future', 'terra']
31
- check_r_packages_installation(packages)
32
-
33
- print("Checking input parameters....")
34
- in_args, in_verbose = check_arguments()
35
- try:
36
- cell_size = float(in_args.input["cell_size"])
37
- in_args.input["cell_size"] = cell_size
38
- except ValueError:
39
- print("Invalid input of cell size, default value is used")
40
- in_args.input["DSMcell_size"] = 1.0
41
-
42
- try:
43
- is_normalized = bool(in_args.input["is_normalized"])
44
-
45
- except ValueError:
46
- print("Invalid input of checking normalized data box, DSM will be created")
47
- in_args.input["is_normalized"] = False
48
-
49
- in_las_folder = in_args.input["in_las_folder"]
50
-
51
- out_folder = in_args.input["out_folder"]
52
-
53
- if not os.path.exists(in_las_folder):
54
- print("Error! Cannot locate Las folder, please check.")
55
- exit()
56
- else:
57
- found = False
58
- for files in os.listdir(in_las_folder):
59
- if files.endswith(".las") or files.endswith(".laz"):
60
- found = True
61
- break
62
- if not found:
63
- print("Error! Cannot locate input LAS file(s), please check!")
64
- exit()
65
-
66
- if in_args.input["style"] in ["tin", "pitfree"]:
67
- style = in_args.input["style"]
68
- else:
69
- print("Warning! invalid alogrithm, default algorthim will be used.")
70
- in_args.input["style"] = "tin"
71
-
72
- if not os.path.exists(out_folder):
73
- print("Warning! Cannot locate output folder, It will be created.")
74
- os.makedirs(out_folder)
75
-
76
- print("Checking input parameters....Done")
77
-
78
- chm_by(print, **in_args.input, processes=int(in_args.processes), verbose=in_verbose)
79
-
80
- print('Normalize Lidar data processing is done in {} seconds)'
81
- .format(round(time.time() - start_time, 5)))
1
+ import os
2
+ import time
3
+
4
+ from beratools.tools.common import *
5
+ from beratools.tools.r_interface import *
6
+
7
+ def chm_by(callback, in_las_folder, is_normalized, out_folder, cell_size, style, processes, verbose):
8
+ rprocesses = r_processes(processes)
9
+
10
+ # assign R script file to local variable
11
+ Beratools_R_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Beratools_r_script.r')
12
+ # Defining the R script and loading the instance in Python
13
+ r['source'](Beratools_R_script)
14
+ # Loading the function defined in R script.
15
+ if style == "tin":
16
+ r_chm_by_algorithm = robjects.globalenv['chm_by_dsmtin']
17
+ else:
18
+ r_chm_by_algorithm = robjects.globalenv['chm_by_pitfree']
19
+
20
+ # Invoking the R function
21
+ r_chm_by_algorithm(in_las_folder, out_folder, cell_size, is_normalized, rprocesses)
22
+
23
+
24
+
25
+ if __name__ == '__main__':
26
+ start_time = time.time()
27
+ print('Normalize Lidar data processing\n @ {}'
28
+ .format(time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())))
29
+
30
+ packages = ['lidR', 'future', 'terra']
31
+ check_r_packages_installation(packages)
32
+
33
+ print("Checking input parameters....")
34
+ in_args, in_verbose = check_arguments()
35
+ try:
36
+ cell_size = float(in_args.input["cell_size"])
37
+ in_args.input["cell_size"] = cell_size
38
+ except ValueError:
39
+ print("Invalid input of cell size, default value is used")
40
+ in_args.input["DSMcell_size"] = 1.0
41
+
42
+ try:
43
+ is_normalized = bool(in_args.input["is_normalized"])
44
+
45
+ except ValueError:
46
+ print("Invalid input of checking normalized data box, DSM will be created")
47
+ in_args.input["is_normalized"] = False
48
+
49
+ in_las_folder = in_args.input["in_las_folder"]
50
+
51
+ out_folder = in_args.input["out_folder"]
52
+
53
+ if not os.path.exists(in_las_folder):
54
+ print("Error! Cannot locate Las folder, please check.")
55
+ exit()
56
+ else:
57
+ found = False
58
+ for files in os.listdir(in_las_folder):
59
+ if files.endswith(".las") or files.endswith(".laz"):
60
+ found = True
61
+ break
62
+ if not found:
63
+ print("Error! Cannot locate input LAS file(s), please check!")
64
+ exit()
65
+
66
+ if in_args.input["style"] in ["tin", "pitfree"]:
67
+ style = in_args.input["style"]
68
+ else:
69
+ print("Warning! invalid alogrithm, default algorthim will be used.")
70
+ in_args.input["style"] = "tin"
71
+
72
+ if not os.path.exists(out_folder):
73
+ print("Warning! Cannot locate output folder, It will be created.")
74
+ os.makedirs(out_folder)
75
+
76
+ print("Checking input parameters....Done")
77
+
78
+ chm_by(print, **in_args.input, processes=int(in_args.processes), verbose=in_verbose)
79
+
80
+ print('Normalize Lidar data processing is done in {} seconds)'
81
+ .format(round(time.time() - start_time, 5)))
@@ -1,63 +1,63 @@
1
- import os
2
- import time
3
-
4
- from beratools.tools.common import *
5
- from beratools.tools.r_interface import *
6
-
7
- def dtm_by(callback, in_las_folder, out_folder, cell_size, style, processes, verbose):
8
- rprocesses = r_processes(processes)
9
-
10
- # assign R script file to local variable
11
- Beratools_R_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Beratools_r_script.r')
12
- # Defining the R script and loading the instance in Python
13
- r['source'](Beratools_R_script)
14
-
15
- # Loading the function defined in R script.
16
- if style == "tin":
17
- r_chm_by_algorithm = robjects.globalenv['dtm_by_tin']
18
- elif style == "idw":
19
- r_chm_by_algorithm = robjects.globalenv['dtm_by_knnidw ']
20
- else:
21
- r_chm_by_algorithm = robjects.globalenv['dtm_by_kriging']
22
- # Invoking the R function
23
- r_chm_by_algorithm(in_las_folder, out_folder, cell_size, rprocesses)
24
-
25
-
26
- if __name__ == '__main__':
27
- start_time = time.time()
28
- print('Normalize Lidar data processing\n @ {}'
29
- .format(time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())))
30
-
31
- packages = ['lidR', 'rgrass', 'rlas', 'future', 'terra', 'sp']
32
- check_r_packages_installation(packages)
33
-
34
- print("Checking input parameters....")
35
- in_args, in_verbose = check_arguments()
36
-
37
- try:
38
- cell_size = float(in_args.input["cell_size"])
39
- in_args.input["cell_size"] = cell_size
40
- except ValueError:
41
- print("Invalid input of cell size, default value is used")
42
- in_args.input["DSMcell_size"] = 1.0
43
-
44
- in_las_folder = in_args.input["in_las_folder"]
45
- out_folder = in_args.input["out_folder"]
46
- check_las_files_existence(in_las_folder)
47
-
48
- if in_args.input["style"] in ["tin", "idw", "kriging"]:
49
- style = in_args.input["style"]
50
- else:
51
- print("Warning! invalid alogrithm, default algorthim will be used.")
52
- in_args.input["style"] = "tin"
53
-
54
- if not os.path.exists(out_folder):
55
- print("Warning! Cannot locate output folder, It will be created.")
56
- os.makedirs(out_folder)
57
-
58
- print("Checking input parameters....Done")
59
-
60
- dtm_by(print, **in_args.input, processes=int(in_args.processes), verbose=in_verbose)
61
-
62
- print('Normalize Lidar data processing is done in {} seconds)'
63
- .format(round(time.time() - start_time, 5)))
1
+ import os
2
+ import time
3
+
4
+ from beratools.tools.common import *
5
+ from beratools.tools.r_interface import *
6
+
7
+ def dtm_by(callback, in_las_folder, out_folder, cell_size, style, processes, verbose):
8
+ rprocesses = r_processes(processes)
9
+
10
+ # assign R script file to local variable
11
+ Beratools_R_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Beratools_r_script.r')
12
+ # Defining the R script and loading the instance in Python
13
+ r['source'](Beratools_R_script)
14
+
15
+ # Loading the function defined in R script.
16
+ if style == "tin":
17
+ r_chm_by_algorithm = robjects.globalenv['dtm_by_tin']
18
+ elif style == "idw":
19
+ r_chm_by_algorithm = robjects.globalenv['dtm_by_knnidw ']
20
+ else:
21
+ r_chm_by_algorithm = robjects.globalenv['dtm_by_kriging']
22
+ # Invoking the R function
23
+ r_chm_by_algorithm(in_las_folder, out_folder, cell_size, rprocesses)
24
+
25
+
26
+ if __name__ == '__main__':
27
+ start_time = time.time()
28
+ print('Normalize Lidar data processing\n @ {}'
29
+ .format(time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())))
30
+
31
+ packages = ['lidR', 'rgrass', 'rlas', 'future', 'terra', 'sp']
32
+ check_r_packages_installation(packages)
33
+
34
+ print("Checking input parameters....")
35
+ in_args, in_verbose = check_arguments()
36
+
37
+ try:
38
+ cell_size = float(in_args.input["cell_size"])
39
+ in_args.input["cell_size"] = cell_size
40
+ except ValueError:
41
+ print("Invalid input of cell size, default value is used")
42
+ in_args.input["DSMcell_size"] = 1.0
43
+
44
+ in_las_folder = in_args.input["in_las_folder"]
45
+ out_folder = in_args.input["out_folder"]
46
+ check_las_files_existence(in_las_folder)
47
+
48
+ if in_args.input["style"] in ["tin", "idw", "kriging"]:
49
+ style = in_args.input["style"]
50
+ else:
51
+ print("Warning! invalid alogrithm, default algorthim will be used.")
52
+ in_args.input["style"] = "tin"
53
+
54
+ if not os.path.exists(out_folder):
55
+ print("Warning! Cannot locate output folder, It will be created.")
56
+ os.makedirs(out_folder)
57
+
58
+ print("Checking input parameters....Done")
59
+
60
+ dtm_by(print, **in_args.input, processes=int(in_args.processes), verbose=in_verbose)
61
+
62
+ print('Normalize Lidar data processing is done in {} seconds)'
63
+ .format(round(time.time() - start_time, 5)))
@@ -1,43 +1,43 @@
1
- import os
2
- import sys
3
- import time
4
-
5
- from beratools.tools.common import *
6
- from beratools.tools.r_interface import *
7
-
8
-
9
- def find_cell_size(callback, in_las_folder, processes, verbose):
10
- rprocesses = r_processes(processes)
11
-
12
- # assign R script file to local variable
13
- Beratools_R_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Beratools_r_script.r')
14
- # Defining the R script and loading the instance in Python
15
- r['source'](Beratools_R_script)
16
- # Loading the function defined in R script.
17
- r_pd2cellsize = robjects.globalenv['pd2cellsize']
18
-
19
- # Invoking the R function
20
- cell_size = r_pd2cellsize(in_las_folder, rprocesses)
21
- print("The recommended cell size for the input liDAR data(set) is {}.".format(cell_size))
22
-
23
-
24
- if __name__ == '__main__':
25
- start_time = time.time()
26
- print('Calculate cell size from liDAR data point density processing..\n @ {}'
27
- .format(time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())))
28
-
29
- packages = ['lidR', 'future']
30
- check_r_packages_installation(packages)
31
-
32
- print("Checking input parameters....")
33
- in_args, in_verbose = check_arguments()
34
-
35
- in_las_folder = in_args.input["in_las_folder"]
36
- check_las_files_existence(in_las_folder)
37
-
38
- print("Checking input parameters....Done")
39
-
40
- find_cell_size(print, **in_args.input, processes=int(in_args.processes), verbose=in_verbose)
41
-
42
- print('Calculate cell size from liDAR data point density processing is done in {} seconds)'
43
- .format(round(time.time() - start_time, 5)))
1
+ import os
2
+ import sys
3
+ import time
4
+
5
+ from beratools.tools.common import *
6
+ from beratools.tools.r_interface import *
7
+
8
+
9
+ def find_cell_size(callback, in_las_folder, processes, verbose):
10
+ rprocesses = r_processes(processes)
11
+
12
+ # assign R script file to local variable
13
+ Beratools_R_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Beratools_r_script.r')
14
+ # Defining the R script and loading the instance in Python
15
+ r['source'](Beratools_R_script)
16
+ # Loading the function defined in R script.
17
+ r_pd2cellsize = robjects.globalenv['pd2cellsize']
18
+
19
+ # Invoking the R function
20
+ cell_size = r_pd2cellsize(in_las_folder, rprocesses)
21
+ print("The recommended cell size for the input liDAR data(set) is {}.".format(cell_size))
22
+
23
+
24
+ if __name__ == '__main__':
25
+ start_time = time.time()
26
+ print('Calculate cell size from liDAR data point density processing..\n @ {}'
27
+ .format(time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())))
28
+
29
+ packages = ['lidR', 'future']
30
+ check_r_packages_installation(packages)
31
+
32
+ print("Checking input parameters....")
33
+ in_args, in_verbose = check_arguments()
34
+
35
+ in_las_folder = in_args.input["in_las_folder"]
36
+ check_las_files_existence(in_las_folder)
37
+
38
+ print("Checking input parameters....Done")
39
+
40
+ find_cell_size(print, **in_args.input, processes=int(in_args.processes), verbose=in_verbose)
41
+
42
+ print('Calculate cell size from liDAR data point density processing is done in {} seconds)'
43
+ .format(round(time.time() - start_time, 5)))
@@ -1,74 +1,74 @@
1
- import os
2
- import time
3
-
4
- from beratools.tools.common import *
5
- from beratools.tools.r_interface import *
6
-
7
- def gnd_csf(callback, in_las_folder, out_folder, slope, class_threshold, cloth_resolution, rigidness, processes,
8
- verbose):
9
- # assign R script file to local variable
10
- Beratools_R_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Beratools_r_script.r')
11
- # Defining the R script and loading the instance in Python
12
- r['source'](Beratools_R_script)
13
- # Loading the function defined in R script.
14
- r_classify_gnd = robjects.globalenv['classify_gnd']
15
- # Invoking the R function
16
- r_classify_gnd(in_las_folder, out_folder, slope, class_threshold, cloth_resolution, rigidness)
17
-
18
-
19
- if __name__ == '__main__':
20
- start_time = time.time()
21
- print('Ground Classification (Cloth Simulation Filter) processing\n @ {}'
22
- .format(time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())))
23
-
24
- packages = ['lidR', 'RCSF']
25
- check_r_packages_installation(packages)
26
-
27
- print("Checking input parameters....")
28
- in_args, in_verbose = check_arguments()
29
- try:
30
- slope = bool(in_args.input["slope"])
31
- in_args.input["slope"] = slope
32
- except ValueError:
33
- print("Invalid input of indicate slope exists, default value is used")
34
- in_args.input["slope"] = False
35
-
36
- try:
37
- class_threshold = float(in_args.input["class_threshold"])
38
- in_args.input["class_threshold"] = class_threshold
39
- except ValueError:
40
- print("Invalid input of ground threshold, default value is used")
41
- in_args.input["class_threshold"] = 0.5
42
-
43
- try:
44
- cloth_resolution = float(in_args.input["cloth_resolution"])
45
- in_args.input["cloth_resolution"] = cloth_resolution
46
- except ValueError:
47
- print("Invalid input of distance between particles in the cloth, default value is used")
48
- in_args.input["cloth_resolution"] = 0.5
49
-
50
- try:
51
- rigidness = int(in_args.input["rigidness"])
52
- if rigidness in [1, 2, 3]:
53
- in_args.input["rigidness"] = rigidness
54
- else:
55
- raise ValueError
56
- except ValueError:
57
- print("Invalid input of rigidness of the cloth, default value is used")
58
- in_args.input["rigidness"] = 1
59
-
60
- in_las_folder = in_args.input["in_las_folder"]
61
- out_folder = in_args.input["out_folder"]
62
-
63
- check_las_files_existence(in_las_folder)
64
-
65
- if not os.path.exists(out_folder):
66
- print("Warning! Cannot locate output folder, It will be created.")
67
- os.makedirs(out_folder)
68
-
69
- print("Checking input parameters....Done")
70
-
71
- gnd_csf(print, **in_args.input, processes=int(in_args.processes), verbose=in_verbose)
72
-
73
- print('Ground Classification (Cloth Simulation Filter) processing is done in {} seconds)'
74
- .format(round(time.time() - start_time, 5)))
1
+ import os
2
+ import time
3
+
4
+ from beratools.tools.common import *
5
+ from beratools.tools.r_interface import *
6
+
7
+ def gnd_csf(callback, in_las_folder, out_folder, slope, class_threshold, cloth_resolution, rigidness, processes,
8
+ verbose):
9
+ # assign R script file to local variable
10
+ Beratools_R_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Beratools_r_script.r')
11
+ # Defining the R script and loading the instance in Python
12
+ r['source'](Beratools_R_script)
13
+ # Loading the function defined in R script.
14
+ r_classify_gnd = robjects.globalenv['classify_gnd']
15
+ # Invoking the R function
16
+ r_classify_gnd(in_las_folder, out_folder, slope, class_threshold, cloth_resolution, rigidness)
17
+
18
+
19
+ if __name__ == '__main__':
20
+ start_time = time.time()
21
+ print('Ground Classification (Cloth Simulation Filter) processing\n @ {}'
22
+ .format(time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())))
23
+
24
+ packages = ['lidR', 'RCSF']
25
+ check_r_packages_installation(packages)
26
+
27
+ print("Checking input parameters....")
28
+ in_args, in_verbose = check_arguments()
29
+ try:
30
+ slope = bool(in_args.input["slope"])
31
+ in_args.input["slope"] = slope
32
+ except ValueError:
33
+ print("Invalid input of indicate slope exists, default value is used")
34
+ in_args.input["slope"] = False
35
+
36
+ try:
37
+ class_threshold = float(in_args.input["class_threshold"])
38
+ in_args.input["class_threshold"] = class_threshold
39
+ except ValueError:
40
+ print("Invalid input of ground threshold, default value is used")
41
+ in_args.input["class_threshold"] = 0.5
42
+
43
+ try:
44
+ cloth_resolution = float(in_args.input["cloth_resolution"])
45
+ in_args.input["cloth_resolution"] = cloth_resolution
46
+ except ValueError:
47
+ print("Invalid input of distance between particles in the cloth, default value is used")
48
+ in_args.input["cloth_resolution"] = 0.5
49
+
50
+ try:
51
+ rigidness = int(in_args.input["rigidness"])
52
+ if rigidness in [1, 2, 3]:
53
+ in_args.input["rigidness"] = rigidness
54
+ else:
55
+ raise ValueError
56
+ except ValueError:
57
+ print("Invalid input of rigidness of the cloth, default value is used")
58
+ in_args.input["rigidness"] = 1
59
+
60
+ in_las_folder = in_args.input["in_las_folder"]
61
+ out_folder = in_args.input["out_folder"]
62
+
63
+ check_las_files_existence(in_las_folder)
64
+
65
+ if not os.path.exists(out_folder):
66
+ print("Warning! Cannot locate output folder, It will be created.")
67
+ os.makedirs(out_folder)
68
+
69
+ print("Checking input parameters....Done")
70
+
71
+ gnd_csf(print, **in_args.input, processes=int(in_args.processes), verbose=in_verbose)
72
+
73
+ print('Ground Classification (Cloth Simulation Filter) processing is done in {} seconds)'
74
+ .format(round(time.time() - start_time, 5)))