diff --git a/py-3.10.conda-lock.yml b/py-3.10.conda-lock.yml index 52978cb..97e689c 100644 --- a/py-3.10.conda-lock.yml +++ b/py-3.10.conda-lock.yml @@ -778,7 +778,7 @@ package: dependencies: hpack: '>=4.1,<5' hyperframe: '>=6.1,<7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda hash: md5: 164fc43f0b53b6e3a7bc7dce5e4f1dc9 @@ -1107,7 +1107,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.9' zipp: '>=3.20' url: https://repo.prefix.dev/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda hash: @@ -2543,7 +2543,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/networkx-3.4.2-pyh267e887_2.conda hash: md5: fd40bf7f7f4bc4b647dc8512053d9873 @@ -2667,7 +2667,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.8' url: https://repo.prefix.dev/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda hash: md5: 58335b26c38bf4a20f399384c33cbcf9 @@ -2767,7 +2767,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/platformdirs-4.5.0-pyhcf101f3_0.conda hash: md5: 5c7a868f8241e64e1cf5fdf4962f23e2 @@ -2842,7 +2842,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.9' url: https://repo.prefix.dev/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda hash: md5: 12c566707c80111f9799308d9e265aef @@ -2971,7 +2971,7 @@ package: isort: '>=5,<8,!=5.13' mccabe: '>=0.6,<0.8' platformdirs: '>=2.2' - python: '' + python: '>=3.10' tomli: '>=1.1.0' tomlkit: '>=0.10.1' url: https://repo.prefix.dev/conda-forge/noarch/pylint-4.0.2-pyhcf101f3_0.conda @@ -3037,7 +3037,7 @@ package: packaging: '>=22' pluggy: '>=1.5,<2' pygments: '>=2.7.2' - python: '' + python: '>=3.10' tomli: '>=1' url: https://repo.prefix.dev/conda-forge/noarch/pytest-9.0.0-pyhcf101f3_0.conda hash: @@ -3068,7 +3068,7 @@ package: coverage: '>=7.10.6' pluggy: '>=1.2' pytest: '>=7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/pytest-cov-7.0.0-pyhcf101f3_1.conda hash: md5: 6891acad5e136cb62a8c2ed2679d6528 @@ -3914,7 +3914,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda hash: md5: d2732eb636c264dc9aa4cbee404b1a53 @@ -4038,7 +4038,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda hash: md5: 0caa1af407ecff61170c9437a808404d diff --git a/py-3.11.conda-lock.yml b/py-3.11.conda-lock.yml index 981c949..c777d22 100644 --- a/py-3.11.conda-lock.yml +++ b/py-3.11.conda-lock.yml @@ -762,7 +762,7 @@ package: dependencies: hpack: '>=4.1,<5' hyperframe: '>=6.1,<7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda hash: md5: 164fc43f0b53b6e3a7bc7dce5e4f1dc9 @@ -776,7 +776,7 @@ package: dependencies: hpack: '>=4.1,<5' hyperframe: '>=6.1,<7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda hash: md5: 164fc43f0b53b6e3a7bc7dce5e4f1dc9 @@ -1092,7 +1092,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.9' zipp: '>=3.20' url: https://repo.prefix.dev/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda hash: @@ -1105,7 +1105,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.9' zipp: '>=3.20' url: https://repo.prefix.dev/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda hash: @@ -1428,7 +1428,7 @@ package: manager: conda platform: linux-64 dependencies: - libopenblas: '>=0.3.30,<1.0a0' + libopenblas: '>=0.3.30,<0.3.31.0a0' url: https://repo.prefix.dev/conda-forge/linux-64/libblas-3.9.0-38_h4a7cf45_openblas.conda hash: md5: 3509b5e2aaa5f119013c8969fdd9a905 @@ -2529,7 +2529,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.11' url: https://repo.prefix.dev/conda-forge/noarch/networkx-3.5-pyhe01879c_0.conda hash: md5: 16bff3d37a4f99e3aa089c36c2b8d650 @@ -2541,7 +2541,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.11' url: https://repo.prefix.dev/conda-forge/noarch/networkx-3.5-pyhe01879c_0.conda hash: md5: 16bff3d37a4f99e3aa089c36c2b8d650 @@ -2653,7 +2653,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.8' url: https://repo.prefix.dev/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda hash: md5: 58335b26c38bf4a20f399384c33cbcf9 @@ -2665,7 +2665,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.8' url: https://repo.prefix.dev/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda hash: md5: 58335b26c38bf4a20f399384c33cbcf9 @@ -2753,7 +2753,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/platformdirs-4.5.0-pyhcf101f3_0.conda hash: md5: 5c7a868f8241e64e1cf5fdf4962f23e2 @@ -2765,7 +2765,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/platformdirs-4.5.0-pyhcf101f3_0.conda hash: md5: 5c7a868f8241e64e1cf5fdf4962f23e2 @@ -2828,7 +2828,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.9' url: https://repo.prefix.dev/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda hash: md5: 12c566707c80111f9799308d9e265aef @@ -2840,7 +2840,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.9' url: https://repo.prefix.dev/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda hash: md5: 12c566707c80111f9799308d9e265aef @@ -2949,7 +2949,7 @@ package: isort: '>=5,<8,!=5.13' mccabe: '>=0.6,<0.8' platformdirs: '>=2.2' - python: '' + python: '>=3.10' tomli: '>=1.1.0' tomlkit: '>=0.10.1' url: https://repo.prefix.dev/conda-forge/noarch/pylint-4.0.2-pyhcf101f3_0.conda @@ -2969,7 +2969,7 @@ package: isort: '>=5,<8,!=5.13' mccabe: '>=0.6,<0.8' platformdirs: '>=2.2' - python: '' + python: '>=3.10' tomli: '>=1.1.0' tomlkit: '>=0.10.1' url: https://repo.prefix.dev/conda-forge/noarch/pylint-4.0.2-pyhcf101f3_0.conda @@ -3016,7 +3016,7 @@ package: packaging: '>=22' pluggy: '>=1.5,<2' pygments: '>=2.7.2' - python: '' + python: '>=3.10' tomli: '>=1' url: https://repo.prefix.dev/conda-forge/noarch/pytest-9.0.0-pyhcf101f3_0.conda hash: @@ -3035,7 +3035,7 @@ package: packaging: '>=22' pluggy: '>=1.5,<2' pygments: '>=2.7.2' - python: '' + python: '>=3.10' tomli: '>=1' url: https://repo.prefix.dev/conda-forge/noarch/pytest-9.0.0-pyhcf101f3_0.conda hash: @@ -3051,7 +3051,7 @@ package: coverage: '>=7.10.6' pluggy: '>=1.2' pytest: '>=7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/pytest-cov-7.0.0-pyhcf101f3_1.conda hash: md5: 6891acad5e136cb62a8c2ed2679d6528 @@ -3066,7 +3066,7 @@ package: coverage: '>=7.10.6' pluggy: '>=1.2' pytest: '>=7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/pytest-cov-7.0.0-pyhcf101f3_1.conda hash: md5: 6891acad5e136cb62a8c2ed2679d6528 @@ -3397,7 +3397,7 @@ package: libgfortran5: '>=13.3.0' liblapack: '>=3.9.0,<4.0a0' libstdcxx: '>=13' - numpy: '>=1.23.5' + numpy: <2.3 python: '>=3.11,<3.12.0a0' python_abi: 3.11.* url: https://repo.prefix.dev/conda-forge/linux-64/scipy-1.14.1-py311he9a78e4_2.conda @@ -3414,7 +3414,7 @@ package: libblas: '>=3.9.0,<4.0a0' libcblas: '>=3.9.0,<4.0a0' liblapack: '>=3.9.0,<4.0a0' - numpy: '>=1.23.5' + numpy: <2.3 python: '>=3.11,<3.12.0a0' python_abi: 3.11.* ucrt: '>=10.0.20348.0' @@ -3924,7 +3924,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda hash: md5: d2732eb636c264dc9aa4cbee404b1a53 @@ -3936,7 +3936,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda hash: md5: d2732eb636c264dc9aa4cbee404b1a53 @@ -4048,7 +4048,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda hash: md5: 0caa1af407ecff61170c9437a808404d @@ -4060,7 +4060,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda hash: md5: 0caa1af407ecff61170c9437a808404d @@ -4390,7 +4390,7 @@ package: libgcc: '>=14' python: '' python_abi: 3.11.* - zstd: '>=1.5.7,<1.6.0a0' + zstd: '>=1.5.7,<1.5.8.0a0' url: https://repo.prefix.dev/conda-forge/linux-64/zstandard-0.25.0-py311haee01d2_1.conda hash: md5: ca45bfd4871af957aaa5035593d5efd2 @@ -4408,7 +4408,7 @@ package: ucrt: '>=10.0.20348.0' vc: '>=14.3,<15' vc14_runtime: '>=14.44.35208' - zstd: '>=1.5.7,<1.6.0a0' + zstd: '>=1.5.7,<1.5.8.0a0' url: https://repo.prefix.dev/conda-forge/win-64/zstandard-0.25.0-py311hf893f09_1.conda hash: md5: b2d90bca78b57c17205ce3ca1c427813 diff --git a/py-3.12.conda-lock.yml b/py-3.12.conda-lock.yml index 72ec561..f3be0b2 100644 --- a/py-3.12.conda-lock.yml +++ b/py-3.12.conda-lock.yml @@ -762,7 +762,7 @@ package: dependencies: hpack: '>=4.1,<5' hyperframe: '>=6.1,<7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda hash: md5: 164fc43f0b53b6e3a7bc7dce5e4f1dc9 @@ -776,7 +776,7 @@ package: dependencies: hpack: '>=4.1,<5' hyperframe: '>=6.1,<7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/h2-4.3.0-pyhcf101f3_0.conda hash: md5: 164fc43f0b53b6e3a7bc7dce5e4f1dc9 @@ -1092,7 +1092,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.9' zipp: '>=3.20' url: https://repo.prefix.dev/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda hash: @@ -1105,7 +1105,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.9' zipp: '>=3.20' url: https://repo.prefix.dev/conda-forge/noarch/importlib-metadata-8.7.0-pyhe01879c_1.conda hash: @@ -1428,7 +1428,7 @@ package: manager: conda platform: linux-64 dependencies: - libopenblas: '>=0.3.30,<1.0a0' + libopenblas: '>=0.3.30,<0.3.31.0a0' url: https://repo.prefix.dev/conda-forge/linux-64/libblas-3.9.0-38_h4a7cf45_openblas.conda hash: md5: 3509b5e2aaa5f119013c8969fdd9a905 @@ -2529,7 +2529,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.11' url: https://repo.prefix.dev/conda-forge/noarch/networkx-3.5-pyhe01879c_0.conda hash: md5: 16bff3d37a4f99e3aa089c36c2b8d650 @@ -2541,7 +2541,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.11' url: https://repo.prefix.dev/conda-forge/noarch/networkx-3.5-pyhe01879c_0.conda hash: md5: 16bff3d37a4f99e3aa089c36c2b8d650 @@ -2653,7 +2653,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.8' url: https://repo.prefix.dev/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda hash: md5: 58335b26c38bf4a20f399384c33cbcf9 @@ -2665,7 +2665,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.8' url: https://repo.prefix.dev/conda-forge/noarch/packaging-25.0-pyh29332c3_1.conda hash: md5: 58335b26c38bf4a20f399384c33cbcf9 @@ -2753,7 +2753,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/platformdirs-4.5.0-pyhcf101f3_0.conda hash: md5: 5c7a868f8241e64e1cf5fdf4962f23e2 @@ -2765,7 +2765,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/platformdirs-4.5.0-pyhcf101f3_0.conda hash: md5: 5c7a868f8241e64e1cf5fdf4962f23e2 @@ -2828,7 +2828,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.9' url: https://repo.prefix.dev/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda hash: md5: 12c566707c80111f9799308d9e265aef @@ -2840,7 +2840,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.9' url: https://repo.prefix.dev/conda-forge/noarch/pycparser-2.22-pyh29332c3_1.conda hash: md5: 12c566707c80111f9799308d9e265aef @@ -2949,7 +2949,7 @@ package: isort: '>=5,<8,!=5.13' mccabe: '>=0.6,<0.8' platformdirs: '>=2.2' - python: '' + python: '>=3.10' tomli: '>=1.1.0' tomlkit: '>=0.10.1' url: https://repo.prefix.dev/conda-forge/noarch/pylint-4.0.2-pyhcf101f3_0.conda @@ -2969,7 +2969,7 @@ package: isort: '>=5,<8,!=5.13' mccabe: '>=0.6,<0.8' platformdirs: '>=2.2' - python: '' + python: '>=3.10' tomli: '>=1.1.0' tomlkit: '>=0.10.1' url: https://repo.prefix.dev/conda-forge/noarch/pylint-4.0.2-pyhcf101f3_0.conda @@ -3016,7 +3016,7 @@ package: packaging: '>=22' pluggy: '>=1.5,<2' pygments: '>=2.7.2' - python: '' + python: '>=3.10' tomli: '>=1' url: https://repo.prefix.dev/conda-forge/noarch/pytest-9.0.0-pyhcf101f3_0.conda hash: @@ -3035,7 +3035,7 @@ package: packaging: '>=22' pluggy: '>=1.5,<2' pygments: '>=2.7.2' - python: '' + python: '>=3.10' tomli: '>=1' url: https://repo.prefix.dev/conda-forge/noarch/pytest-9.0.0-pyhcf101f3_0.conda hash: @@ -3051,7 +3051,7 @@ package: coverage: '>=7.10.6' pluggy: '>=1.2' pytest: '>=7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/pytest-cov-7.0.0-pyhcf101f3_1.conda hash: md5: 6891acad5e136cb62a8c2ed2679d6528 @@ -3066,7 +3066,7 @@ package: coverage: '>=7.10.6' pluggy: '>=1.2' pytest: '>=7' - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/pytest-cov-7.0.0-pyhcf101f3_1.conda hash: md5: 6891acad5e136cb62a8c2ed2679d6528 @@ -3397,7 +3397,7 @@ package: libgfortran5: '>=13.3.0' liblapack: '>=3.9.0,<4.0a0' libstdcxx: '>=13' - numpy: '>=1.23.5' + numpy: <2.3 python: '>=3.12,<3.13.0a0' python_abi: 3.12.* url: https://repo.prefix.dev/conda-forge/linux-64/scipy-1.14.1-py312h62794b6_2.conda @@ -3414,7 +3414,7 @@ package: libblas: '>=3.9.0,<4.0a0' libcblas: '>=3.9.0,<4.0a0' liblapack: '>=3.9.0,<4.0a0' - numpy: '>=1.23.5' + numpy: <2.3 python: '>=3.12,<3.13.0a0' python_abi: 3.12.* ucrt: '>=10.0.20348.0' @@ -3924,7 +3924,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda hash: md5: d2732eb636c264dc9aa4cbee404b1a53 @@ -3936,7 +3936,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/tomli-2.3.0-pyhcf101f3_0.conda hash: md5: d2732eb636c264dc9aa4cbee404b1a53 @@ -4048,7 +4048,7 @@ package: manager: conda platform: linux-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda hash: md5: 0caa1af407ecff61170c9437a808404d @@ -4060,7 +4060,7 @@ package: manager: conda platform: win-64 dependencies: - python: '' + python: '>=3.10' url: https://repo.prefix.dev/conda-forge/noarch/typing_extensions-4.15.0-pyhcf101f3_0.conda hash: md5: 0caa1af407ecff61170c9437a808404d @@ -4390,7 +4390,7 @@ package: libgcc: '>=14' python: '' python_abi: 3.12.* - zstd: '>=1.5.7,<1.6.0a0' + zstd: '>=1.5.7,<1.5.8.0a0' url: https://repo.prefix.dev/conda-forge/linux-64/zstandard-0.25.0-py312h5253ce2_1.conda hash: md5: 02738ff9855946075cbd1b5274399a41 @@ -4408,7 +4408,7 @@ package: ucrt: '>=10.0.20348.0' vc: '>=14.3,<15' vc14_runtime: '>=14.44.35208' - zstd: '>=1.5.7,<1.6.0a0' + zstd: '>=1.5.7,<1.5.8.0a0' url: https://repo.prefix.dev/conda-forge/win-64/zstandard-0.25.0-py312he5662c2_1.conda hash: md5: e9e25949b682e95535068bae33153ba6 diff --git a/pylintrc b/pylintrc index cdc7761..7b8334d 100644 --- a/pylintrc +++ b/pylintrc @@ -88,10 +88,6 @@ py-version=3.9 # Discover python modules and packages in the file system subtree. recursive=no -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no diff --git a/surface_apps/driver.py b/surface_apps/driver.py index 29f06f3..b7a690d 100644 --- a/surface_apps/driver.py +++ b/surface_apps/driver.py @@ -13,30 +13,28 @@ import sys import tempfile from abc import abstractmethod -from json import load from pathlib import Path -from geoapps_utils.driver.data import BaseData -from geoapps_utils.driver.driver import BaseDriver +from geoapps_utils.base import Driver, Options from geoh5py.groups import UIJsonGroup from geoh5py.objects import ObjectBase -from geoh5py.shared.utils import fetch_active_workspace +from geoh5py.shared.utils import fetch_active_workspace, stringify from geoh5py.ui_json import InputFile logger = logging.getLogger(__name__) -class BaseSurfaceDriver(BaseDriver): +class BaseSurfaceDriver(Driver): """ Driver for the surface application. :param parameters: Application parameters. """ - _parameter_class: type[BaseData] + _parameter_class: type[Options] - def __init__(self, parameters: BaseData | InputFile): + def __init__(self, parameters: Options | InputFile): self._out_group: UIJsonGroup | None = None if isinstance(parameters, InputFile): @@ -59,9 +57,7 @@ def out_group(self) -> UIJsonGroup | None: workspace=workspace, name=self.params.title, ) - self._out_group.options = InputFile.stringify( # type: ignore - InputFile.demote(self.params.input_file.ui_json) - ) + self._out_group.options = stringify(self.params.input_file.ui_json) return self._out_group @@ -91,27 +87,16 @@ def run(self): self.store() @property - def params(self) -> BaseData: + def params(self) -> Options: """Application parameters.""" return self._params @params.setter - def params(self, val: BaseData): - if not isinstance(val, BaseData): - raise TypeError("Parameters must be a BaseData subclass.") + def params(self, val: Options): + if not isinstance(val, Options): + raise TypeError("Parameters must be an Options subclass.") self._params = val - @classmethod - def start(cls, filepath: str | Path, driver_class=None, **kwargs): - with open(filepath, encoding="utf-8") as jsonfile: - uijson = load(jsonfile) - - if driver_class is None: - module = __import__(uijson["run_command"], fromlist=["Driver"]) - driver_class = module.Driver - - super().start(filepath, driver_class=driver_class, **kwargs) - def add_ui_json(self, entity: ObjectBase | UIJsonGroup) -> None: """ Add ui.json file to entity. diff --git a/surface_apps/iso_surfaces/params.py b/surface_apps/iso_surfaces/params.py index ebf392c..959ce0a 100644 --- a/surface_apps/iso_surfaces/params.py +++ b/surface_apps/iso_surfaces/params.py @@ -13,19 +13,19 @@ from typing import ClassVar import numpy as np -from geoapps_utils.driver.data import BaseData +from geoapps_utils.base import Options from geoh5py.data import Data from geoh5py.groups import UIJsonGroup -from geoh5py.objects import Points, Surface +from geoh5py.objects import BlockModel, Points, Surface from geoh5py.objects.cell_object import CellObject from geoh5py.objects.grid_object import GridObject from geoh5py.ui_json.utils import str2list -from pydantic import ConfigDict, field_validator +from pydantic import BaseModel, ConfigDict, field_validator from surface_apps import assets_path -class IsoSurfaceSourceParameters(BaseData): +class IsoSurfaceSourceParameters(BaseModel): """ Source parameters providing input data to the driver. @@ -41,8 +41,22 @@ class IsoSurfaceSourceParameters(BaseData): data: Data horizon: Surface | None = None + @field_validator("objects", mode="before") + @classmethod + def no_single_layer_grids(cls, value): + """Ensure a grid has more than a single layer in any dimension.""" + + if isinstance(value, BlockModel): + n_cells = [len(getattr(value, f"{k}_cell_delimiters")) - 1 for k in "uvz"] + if any(n == 1 for n in n_cells): + raise ValueError( + "Grid source cannot be a single layer in any dimension." + ) + + return value + -class IsoSurfaceDetectionParameters(BaseData): +class IsoSurfaceDetectionParameters(BaseModel): """ Contour specification parameters. @@ -123,7 +137,7 @@ def contours(self) -> list[float]: return contours -class IsoSurfaceParameters(BaseData): +class IsoSurfaceParameters(Options): """ Contour parameters for use with `contours.driver`. diff --git a/tests/run_tests/iso_surfaces_test.py b/tests/run_tests/iso_surfaces_test.py index 49351ca..900a90a 100644 --- a/tests/run_tests/iso_surfaces_test.py +++ b/tests/run_tests/iso_surfaces_test.py @@ -12,10 +12,13 @@ from pathlib import Path import numpy as np +import pytest +from geoapps_utils.utils.importing import GeoAppsError from geoh5py.objects import BlockModel, Points, Surface from geoh5py.workspace import Workspace from surface_apps.iso_surfaces.driver import Driver as IsoSurfacesDriver +from surface_apps.iso_surfaces.params import IsoSurfaceParameters # pylint: disable=too-many-locals @@ -215,3 +218,38 @@ def test_clipping_horizon(tmp_path: Path): ) assert np.all(surface.vertices[:, -1] <= 30) + + +def test_single_layer_grid(tmp_path): + with Workspace(tmp_path / "iso_test.geoh5") as ws: + grid = BlockModel.create( + ws, + name="single_layer_grid", + u_cell_delimiters=np.linspace(0, 10, 11), + v_cell_delimiters=np.linspace(0, 10, 11), + z_cell_delimiters=np.array([0.0, 1.0]), + origin=[0, 0, 0], + ) + data = grid.add_data( + { + "elevation": { + "values": np.random.rand(grid.n_cells) * 100, + "data_type": "Float", + "association": "Cell", + } + } + ) + + with pytest.raises(GeoAppsError, match="cannot be a single layer"): + IsoSurfaceParameters.build( + { + "geoh5": ws, + "objects": grid, + "data": data, + "interval_min": 0.0, + "interval_max": 100.0, + "interval_spacing": 20.0, + "max_distance": 50.0, + "resolution": 5.0, + } + )