BERATools 0.7.0__tar.gz → 0.7.1__tar.gz
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.
- {beratools-0.7.0 → beratools-0.7.1}/PKG-INFO +1 -1
- beratools-0.7.1/beratools/__init__.py +23 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/pipeline.py +11 -1
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/bt_data.py +2 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/main.py +5 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/tools.json +1 -1
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/r_common.py +28 -5
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/r_interface.py +68 -13
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/tools.json +2 -2
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/raster2products/tools.json +1 -1
- beratools-0.7.0/beratools/__init__.py +0 -11
- {beratools-0.7.0 → beratools-0.7.1}/.gitignore +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/LICENSE +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/README.md +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/cli/__init__.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/cli/entry.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/__init__.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_astar.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_canopy_footprint_absolute.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_centerline.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_check_seed_line.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_check_seed_line_validate.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_common.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_cost.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_dijkstra.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_footprint_plots.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_geometry.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_line_grouping.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_merge_lines.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_raster_smoothing.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_seed_line_correction.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_split_with_lines.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_vertex_optimization.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/algo_vertex_preclean.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/alt_spatial_common.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/canopy_threshold_relative.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/constants.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/line_footprint_functions.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/logger.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/registry.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/tool_base.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/tool_geo_simplify.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/core/tool_template.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/external/__init__.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/external/geo_simplify/geo-simplify-linux-x64 +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/external/geo_simplify/geo-simplify-win-x64.exe +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/external/polygon_centerline/LICENSE.md +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/external/polygon_centerline/UPSTREAM.md +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/external/polygon_centerline/__init__.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/external/polygon_centerline/_src.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/external/polygon_centerline/exceptions.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/BERALogo.ico +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/BERALogo.png +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/BERA_GUI_Main.png +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/BERA_Splash.gif +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/BERA_WizardImage.png +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/closed.gif +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/closed.png +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/gui.json +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/module.schema.json +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/open.gif +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/open.png +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/tool.gif +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/assets/tool.png +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/bt_gui_main.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/geometry_types.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/pipeline_panel.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/gui/tool_widgets.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/__init__.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/__init__.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_astar.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_canopy_footprint_absolute.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_centerline.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_check_seed_line.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_check_seed_line_validate.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_common.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_cost.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_dijkstra.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_footprint_plots.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_geometry.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_line_grouping.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_merge_lines.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_seed_line_correction.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_split_with_lines.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_vertex_optimization.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_vertex_preclean.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/alt_spatial_common.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/canopy_footprint_absolute.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/canopy_threshold_relative.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/centerline.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/check_seed_line.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/common.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/footprint_plots.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/ground_footprint.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/line_footprint_functions.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/line_footprint_relative.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/smooth_centerline.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/tool_geo_simplify.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/vertex_optimization.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/__init__.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/r_scripts_collection.r +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_CHM_DSM_by.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_PC2hummock_hollow.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_dtm_by.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_dtw.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_find_cellsize.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_gnd_csf.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_las_info.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_lidar_index.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_lidar_tile.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_normalized_PC.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_seismic_line_analysis.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_surface_water.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/raster2products/__init__.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/raster2products/algo_raster_smoothing.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/modules/raster2products/ndtm_fr_dtmraster.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/__init__.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/canopy_footprint_absolute.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/centerline.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/check_seed_line.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/common.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/footprint_plots.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/ground_footprint.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/line_footprint_relative.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/ndtm_fr_dtmraster.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/r_common.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/r_interface.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_CHM_DSM_by.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_PC2hummock_hollow.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_dtm_by.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_dtw.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_find_cellsize.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_gnd_csf.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_las_info.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_lidar_index.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_lidar_tile.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_normalized_PC.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_seismic_line_analysis.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/rpy_surface_water.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/smooth_centerline.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/tools/vertex_optimization.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/utility/env_checks.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/utility/faulthandler_pause.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/utility/field_checks.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/utility/spatial_common.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/utility/tool_args.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/beratools/utility/unit_conversion.py +0 -0
- {beratools-0.7.0 → beratools-0.7.1}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: BERATools
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: An advanced forest line feature analysis platform
|
|
5
5
|
Project-URL: Homepage, https://github.com/BERATool/beratools
|
|
6
6
|
Author-email: AppliedGRG <appliedgrg@gmail.com>, Richard Zeng <richardqzeng@gmail.com>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import os as _os
|
|
2
|
+
|
|
3
|
+
# numba (cache=True, as in xarray-spatial) caches compiled functions in __pycache__ beside their code
|
|
4
|
+
# and first checks it can write a temporary file there. Under Program Files (the Windows installer)
|
|
5
|
+
# it can't, and on Windows Python's tempfile takes the PermissionError for a name already taken and
|
|
6
|
+
# retries up to TMP_MAX (2**31 - 1) times, so a tool hangs while importing. Cache in the user's
|
|
7
|
+
# folder instead. Here, as every tool, the GUI and the CLI import beratools before numba.
|
|
8
|
+
if _os.name == "nt" and "NUMBA_CACHE_DIR" not in _os.environ:
|
|
9
|
+
_os.environ["NUMBA_CACHE_DIR"] = _os.path.join(
|
|
10
|
+
_os.environ.get("LOCALAPPDATA") or _os.path.expanduser("~"), "BERA Tools", "numba_cache"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__author__ = """Applied Geospatial Research Group"""
|
|
14
|
+
__email__ = 'appliedgrg@gmail.com'
|
|
15
|
+
# The one place the version is set: the packages, the GUI's About box and each module's
|
|
16
|
+
# requires_frame check read it. Bump it for each release (see the maintainer guide), and set
|
|
17
|
+
# "version" in every module's tools.json to the same (tests/test_registry.py checks it).
|
|
18
|
+
__version__ = "0.7.1"
|
|
19
|
+
__license__ = "GPL-3.0-or-later"
|
|
20
|
+
__copyright__ = "Copyright (c) AppliedGRG"
|
|
21
|
+
__status__ = "Pre-Alpha"
|
|
22
|
+
__url__ = "https://github.com/BERATool/beratools"
|
|
23
|
+
__all__ = ["tools", "gui"]
|
|
@@ -38,6 +38,15 @@ from beratools.core.registry import get_registry, tool_script
|
|
|
38
38
|
PIPELINE_FORMAT = 2
|
|
39
39
|
PACKAGE_ROOT = Path(__file__).resolve().parents[2]
|
|
40
40
|
|
|
41
|
+
# Python options a tool process starts with. Options, not PYTHONUTF8 or PYTHONUNBUFFERED: the
|
|
42
|
+
# Windows installer's Python has a ._pth file, which makes it ignore the PYTHON* environment variables.
|
|
43
|
+
# -u: write output at once. To a pipe (the GUI reads one) Python otherwise holds back what isn't
|
|
44
|
+
# flushed, and a tool shows nothing for minutes while it works.
|
|
45
|
+
# -X utf8: the tools print symbols such as ✓; a Python outside conda (the installer's) writes to a
|
|
46
|
+
# pipe in the Windows code page (cp1252), which can't encode them, and the tool stops with
|
|
47
|
+
# UnicodeEncodeError.
|
|
48
|
+
TOOL_PYTHON_OPTIONS = ["-u", "-X", "utf8"]
|
|
49
|
+
|
|
41
50
|
|
|
42
51
|
@functools.lru_cache(maxsize=None)
|
|
43
52
|
def _tool_params():
|
|
@@ -235,7 +244,8 @@ def run_pipeline(steps, processes=0):
|
|
|
235
244
|
print(f"Step {i + 1}/{len(steps)}: {step['tool_api']}")
|
|
236
245
|
print("-" * 50, flush=True)
|
|
237
246
|
args = resolve_step_args(steps, i)
|
|
238
|
-
|
|
247
|
+
command = [sys.executable, *TOOL_PYTHON_OPTIONS, *tool_command(step["tool_api"], args, processes)]
|
|
248
|
+
result = subprocess.run(command, env=env)
|
|
239
249
|
if result.returncode != 0:
|
|
240
250
|
raise RuntimeError(f"Step {i + 1} ({step['tool_api']}) failed with exit code {result.returncode}")
|
|
241
251
|
|
|
@@ -24,6 +24,7 @@ from pathlib import Path
|
|
|
24
24
|
import pyogrio
|
|
25
25
|
|
|
26
26
|
import beratools.core.constants as bt_const
|
|
27
|
+
from beratools.core.pipeline import TOOL_PYTHON_OPTIONS
|
|
27
28
|
from beratools.core.registry import get_registry, tool_script
|
|
28
29
|
from beratools.gui.geometry_types import (
|
|
29
30
|
format_expected_families,
|
|
@@ -450,6 +451,7 @@ class BTData(object):
|
|
|
450
451
|
|
|
451
452
|
if tool_type == "python":
|
|
452
453
|
tool_args = [
|
|
454
|
+
*TOOL_PYTHON_OPTIONS,
|
|
453
455
|
tool_script(tool_api).as_posix(),
|
|
454
456
|
"-i", args_string,
|
|
455
457
|
"-p", str(self.get_selected_cpu_cores()),
|
|
@@ -35,6 +35,11 @@ from beratools.utility.env_checks import put_conda_dlls_on_path # noqa: E402
|
|
|
35
35
|
|
|
36
36
|
put_conda_dlls_on_path()
|
|
37
37
|
|
|
38
|
+
# GDAL before Qt. The PyQt5 wheel ships its own, older msvcp140.dll (PyQt5/Qt5/bin); loaded first,
|
|
39
|
+
# it is the one GDAL gets, and the GDAL wheel of the Windows installer then crashes on import
|
|
40
|
+
# (access violation, 0xC0000005). Loaded first, GDAL gets the system's current runtime.
|
|
41
|
+
from osgeo import gdal # noqa: E402, F401
|
|
42
|
+
|
|
38
43
|
# Import after environment variables are set
|
|
39
44
|
from beratools.gui.bt_gui_main import runner # noqa: E402
|
|
40
45
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../../gui/assets/module.schema.json",
|
|
3
3
|
"module": "mapping",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.1",
|
|
5
5
|
"requires_frame": ">=0.7",
|
|
6
6
|
"category": "Mapping",
|
|
7
7
|
"description": "Tools used to map centerlines and footprint polygons of linear disturbances in forests using a Canopy Height Model (CHM) as reference.",
|
|
@@ -304,6 +304,31 @@ def check_las_out_folder_existence(folder):
|
|
|
304
304
|
OPTIONAL_WORKER_PACKAGES = ['future.mirai']
|
|
305
305
|
|
|
306
306
|
|
|
307
|
+
def r_install_library():
|
|
308
|
+
"""
|
|
309
|
+
The R library the tools install missing R packages into.
|
|
310
|
+
|
|
311
|
+
An R inside the conda/pixi environment: that R's own library, which keeps the packages in the
|
|
312
|
+
environment. A standalone R (one from CRAN, as the Windows installer users have): the user's
|
|
313
|
+
library (R_LIBS_USER, such as %LOCALAPPDATA%/R/win-library/4.5), as R itself does, since a user
|
|
314
|
+
can't write to an R in Program Files. It is created if missing and put first in .libPaths(),
|
|
315
|
+
as R only adds it at startup when it exists.
|
|
316
|
+
"""
|
|
317
|
+
initialize_r()
|
|
318
|
+
from beratools.modules.pc2products import r_interface
|
|
319
|
+
|
|
320
|
+
if r_interface.R_IN_ENV:
|
|
321
|
+
return str(r('normalizePath(file.path(R.home(), "library"), winslash = "/")')[0])
|
|
322
|
+
return str(r(
|
|
323
|
+
"""local({
|
|
324
|
+
lib <- path.expand(strsplit(Sys.getenv("R_LIBS_USER"), .Platform$path.sep)[[1]][1])
|
|
325
|
+
dir.create(lib, recursive = TRUE, showWarnings = FALSE)
|
|
326
|
+
.libPaths(c(lib, .libPaths()))
|
|
327
|
+
normalizePath(lib, winslash = "/")
|
|
328
|
+
})"""
|
|
329
|
+
)[0])
|
|
330
|
+
|
|
331
|
+
|
|
307
332
|
def check_r_packages_installation(packages, optional=()):
|
|
308
333
|
"""
|
|
309
334
|
Install the R packages in packages that are missing, stopping if one can't be installed.
|
|
@@ -331,9 +356,7 @@ def check_r_packages_installation(packages, optional=()):
|
|
|
331
356
|
|
|
332
357
|
utils.chooseCRANmirror(ind=12) # select the 12th mirror in the list: Canada
|
|
333
358
|
|
|
334
|
-
|
|
335
|
-
# (not a user library) to keep the packages inside the conda/pixi environment.
|
|
336
|
-
r_lib = str(r('normalizePath(file.path(R.home(), "library"), winslash = "/")')[0])
|
|
359
|
+
r_lib = r_install_library()
|
|
337
360
|
print(f"Installing missing R packages into {r_lib}: {', '.join(cran_names_to_install)}")
|
|
338
361
|
|
|
339
362
|
need_fasterRaster = False
|
|
@@ -359,11 +382,11 @@ def check_r_packages_installation(packages, optional=()):
|
|
|
359
382
|
|
|
360
383
|
|
|
361
384
|
def _install_optional_r_packages(packages):
|
|
362
|
-
"""Install optional R packages
|
|
385
|
+
"""Install optional R packages (see r_install_library), only warning on failure."""
|
|
363
386
|
from rpy2.robjects import StrVector
|
|
364
387
|
from rpy2.robjects.packages import importr, isinstalled
|
|
365
388
|
|
|
366
|
-
r_lib =
|
|
389
|
+
r_lib = r_install_library()
|
|
367
390
|
print(f"Installing optional R packages into {r_lib}: {', '.join(packages)}")
|
|
368
391
|
try:
|
|
369
392
|
utils = importr('utils')
|
|
@@ -27,6 +27,65 @@ os.environ.setdefault("OPENBLAS_NUM_THREADS", "1")
|
|
|
27
27
|
os.environ.setdefault("OMP_NUM_THREADS", "1")
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
def _version_key(r_home):
|
|
31
|
+
"""(4, 5, 10) for R-4.5.10, so that 4.5.10 sorts after 4.5.3."""
|
|
32
|
+
parts = Path(r_home).name.removeprefix("R-").split(".")
|
|
33
|
+
return tuple(int(part) if part.isdigit() else -1 for part in parts)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _registry_r_homes():
|
|
37
|
+
"""The InstallPath of each R that R's Windows installer registered, for all users or this one."""
|
|
38
|
+
if os.name != "nt":
|
|
39
|
+
return []
|
|
40
|
+
import winreg
|
|
41
|
+
|
|
42
|
+
homes = []
|
|
43
|
+
for hive in (winreg.HKEY_LOCAL_MACHINE, winreg.HKEY_CURRENT_USER):
|
|
44
|
+
for base in (r"SOFTWARE\R-core\R", r"SOFTWARE\R-core\R64"):
|
|
45
|
+
try:
|
|
46
|
+
key = winreg.OpenKey(hive, base, 0, winreg.KEY_READ | winreg.KEY_WOW64_64KEY)
|
|
47
|
+
except OSError:
|
|
48
|
+
continue
|
|
49
|
+
# the current version's InstallPath, and one subkey per installed version
|
|
50
|
+
keys = [key]
|
|
51
|
+
i = 0
|
|
52
|
+
while True:
|
|
53
|
+
try:
|
|
54
|
+
keys.append(winreg.OpenKey(key, winreg.EnumKey(key, i)))
|
|
55
|
+
except OSError:
|
|
56
|
+
break
|
|
57
|
+
i += 1
|
|
58
|
+
for k in keys:
|
|
59
|
+
with k:
|
|
60
|
+
try:
|
|
61
|
+
homes.append(winreg.QueryValueEx(k, "InstallPath")[0])
|
|
62
|
+
except OSError:
|
|
63
|
+
pass
|
|
64
|
+
return homes
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def windows_r_homes():
|
|
68
|
+
"""
|
|
69
|
+
The R installs from CRAN's Windows installer, newest first.
|
|
70
|
+
|
|
71
|
+
From the registry, and from the installer's default folders: Program Files for all users, and
|
|
72
|
+
%LOCALAPPDATA%/Programs for one user (installed without administrator rights).
|
|
73
|
+
"""
|
|
74
|
+
candidates = [Path(home) for home in _registry_r_homes()]
|
|
75
|
+
roots = [Path(os.environ.get("ProgramFiles", r"C:\Program Files")) / "R"]
|
|
76
|
+
if os.environ.get("LOCALAPPDATA"):
|
|
77
|
+
roots.append(Path(os.environ["LOCALAPPDATA"]) / "Programs" / "R")
|
|
78
|
+
for root in roots:
|
|
79
|
+
if root.is_dir():
|
|
80
|
+
candidates.extend(root.glob("R-*"))
|
|
81
|
+
|
|
82
|
+
homes = {}
|
|
83
|
+
for candidate in candidates:
|
|
84
|
+
if (candidate / "bin" / "R.exe").exists():
|
|
85
|
+
homes.setdefault(os.path.normcase(str(candidate.resolve())), candidate)
|
|
86
|
+
return sorted(homes.values(), key=_version_key, reverse=True)
|
|
87
|
+
|
|
88
|
+
|
|
30
89
|
def configure_r_environment():
|
|
31
90
|
"""Locate and configure R before importing rpy2."""
|
|
32
91
|
# --------------------------------------------------
|
|
@@ -85,17 +144,12 @@ def configure_r_environment():
|
|
|
85
144
|
return str(candidate)
|
|
86
145
|
|
|
87
146
|
# --------------------------------------------------
|
|
88
|
-
# 4.
|
|
147
|
+
# 4. R from CRAN's Windows installer, newest first
|
|
89
148
|
# --------------------------------------------------
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
versions = sorted(r_root.glob("R-*"), reverse=True)
|
|
149
|
+
for r_home in windows_r_homes():
|
|
150
|
+
os.environ["R_HOME"] = str(r_home)
|
|
151
|
+
return str(r_home)
|
|
94
152
|
|
|
95
|
-
for version in versions:
|
|
96
|
-
if (version / "bin" / "R.exe").exists():
|
|
97
|
-
os.environ["R_HOME"] = str(version)
|
|
98
|
-
return str(version)
|
|
99
153
|
# --------------------------------------------------
|
|
100
154
|
# 5. Diagnostics
|
|
101
155
|
# --------------------------------------------------
|
|
@@ -108,10 +162,11 @@ def configure_r_environment():
|
|
|
108
162
|
raise RuntimeError(
|
|
109
163
|
"\n"
|
|
110
164
|
"R installation not found.\n\n"
|
|
111
|
-
"
|
|
112
|
-
"https://cran.r-project.org
|
|
113
|
-
"
|
|
114
|
-
"
|
|
165
|
+
"The PC2Products (LiDAR) tools need R 4.5:\n"
|
|
166
|
+
"- Windows: install R 4.5 from https://cran.r-project.org/bin/windows/base/ with the default\n"
|
|
167
|
+
" options, then start BERA Tools again.\n"
|
|
168
|
+
"- Other systems: install R 4.5 from https://cran.r-project.org/\n"
|
|
169
|
+
"- In a conda or pixi environment: conda install -c conda-forge r-base rpy2\n"
|
|
115
170
|
)
|
|
116
171
|
|
|
117
172
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../../gui/assets/module.schema.json",
|
|
3
3
|
"module": "pc2products",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.1",
|
|
5
5
|
"requires_frame": ">=0.7",
|
|
6
6
|
"category": "PC2Products",
|
|
7
7
|
"description": "Tools used to work with LiDAR point cloud data to produce different results. e.g. DTM, DSM and CHM.",
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
},
|
|
177
177
|
{
|
|
178
178
|
"name": "Ground Classify Using CSF",
|
|
179
|
-
"info": "It implements an algorithm for segmentation of ground points base on a Cloth Simulation Filter. This method is a strict implementation of the CSF algorithm made by Zhang et al. (2016) that relies on the authors
|
|
179
|
+
"info": "It implements an algorithm for segmentation of ground points base on a Cloth Simulation Filter. This method is a strict implementation of the CSF algorithm made by Zhang et al. (2016) that relies on the authors' original source code written and exposed to R via the the RCSF package from the R package LidR.",
|
|
180
180
|
"batch_processing": false,
|
|
181
181
|
"tool_type": "python",
|
|
182
182
|
"tool_api": "rpy_gnd_csf",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../../gui/assets/module.schema.json",
|
|
3
3
|
"module": "raster2products",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.1",
|
|
5
5
|
"requires_frame": ">=0.7",
|
|
6
6
|
"category": "Raster2Products",
|
|
7
7
|
"description": "Tools used to work with raster data, such as a DTM, to produce other rasters, e.g. a normalized DTM.",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
__author__ = """Applied Geospatial Research Group"""
|
|
2
|
-
__email__ = 'appliedgrg@gmail.com'
|
|
3
|
-
# The one place the version is set: the packages, the GUI's About box and each module's
|
|
4
|
-
# requires_frame check read it. Bump it for each release (see the maintainer guide), and set
|
|
5
|
-
# "version" in every module's tools.json to the same (tests/test_registry.py checks it).
|
|
6
|
-
__version__ = "0.7.0"
|
|
7
|
-
__license__ = "GPL-3.0-or-later"
|
|
8
|
-
__copyright__ = "Copyright (c) AppliedGRG"
|
|
9
|
-
__status__ = "Pre-Alpha"
|
|
10
|
-
__url__ = "https://github.com/BERATool/beratools"
|
|
11
|
-
__all__ = ["tools", "gui"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{beratools-0.7.0 → beratools-0.7.1}/beratools/external/geo_simplify/geo-simplify-win-x64.exe
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_canopy_footprint_absolute.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{beratools-0.7.0 → beratools-0.7.1}/beratools/modules/mapping/algo_check_seed_line_validate.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{beratools-0.7.0 → beratools-0.7.1}/beratools/modules/pc2products/rpy_seismic_line_analysis.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{beratools-0.7.0 → beratools-0.7.1}/beratools/modules/raster2products/algo_raster_smoothing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|