diff --git a/docs/conf.py b/docs/conf.py index b760ce158..873d9b097 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,6 +18,7 @@ from datetime import datetime from pathlib import Path from importlib.metadata import version +from packaging.version import Version sys.path.append(str(Path("_ext").resolve())) sys.path.append(str(Path().parent.resolve())) @@ -44,8 +45,8 @@ # The full version, including alpha/beta/rc tags. release = version("geoh5py") -# The short X.Y.Z version. -version = ".".join(release.split(".")[:3]) +# The shorter X.Y.Z version. +version = Version(release).base_version # If your documentation needs a minimal Sphinx version, state it here. needs_sphinx = "2.2.1" diff --git a/geoh5py/__init__.py b/geoh5py/__init__.py index e261d30ee..625def52c 100644 --- a/geoh5py/__init__.py +++ b/geoh5py/__init__.py @@ -20,7 +20,7 @@ # flake8: noqa -__version__ = "0.10.0" +__version__ = "0.10.1" import inspect diff --git a/geoh5py/objects/drillhole.py b/geoh5py/objects/drillhole.py index f82bf0df4..4e7bddab6 100644 --- a/geoh5py/objects/drillhole.py +++ b/geoh5py/objects/drillhole.py @@ -811,12 +811,10 @@ def compute_intervals(survey: np.ndarray, collar, end_of_hole) -> dict: norm[norm == 0.0] = INFINITE_RADIUS tangential /= norm[:, None] alpha = np.abs(0.5 * np.pi - np.arctan2(dot, vr)) + alpha[alpha == 0.0] = INFINITE_RADIUS**-1.0 delta_depth = np.diff(full_survey[:, 0]) radius = delta_depth / alpha - radius[alpha == 0.0] = delta_depth[alpha == 0.0] * INFINITE_RADIUS - alpha[alpha == 0.0] = delta_depth[alpha == 0.0] / radius[alpha == 0.0] - intervals = { "depths": np.r_[full_survey[:, 0]], "rad": np.r_[radius, INFINITE_RADIUS], diff --git a/geoh5py/objects/grid_object.py b/geoh5py/objects/grid_object.py index 19430efb8..25665bf05 100644 --- a/geoh5py/objects/grid_object.py +++ b/geoh5py/objects/grid_object.py @@ -120,12 +120,11 @@ def origin(self, values: np.ndarray | list | tuple): raise ValueError(f"Array of 'origin' must be of dtype = {ORIGIN_TYPE}") self._centroids = None + self._origin = values - if getattr(self, "_origin", None) is not None and self.on_file: + if self.on_file: self.workspace.update_attribute(self, "attributes") - self._origin = values - @property @abstractmethod def shape(self) -> np.ndarray: diff --git a/geoh5py/objects/octree.py b/geoh5py/objects/octree.py index d3f6b26ab..6d37292d4 100644 --- a/geoh5py/objects/octree.py +++ b/geoh5py/objects/octree.py @@ -223,6 +223,9 @@ def u_cell_size(self, value: Real): raise TypeError("Attribute 'u_cell_size' must be type(float).") self._u_cell_size = float(value) + self._centroids = None + if self.on_file: + self.workspace.update_attribute(self, "attributes") @property def u_count(self) -> int: @@ -244,6 +247,9 @@ def v_cell_size(self, value: Real): raise TypeError("Attribute 'v_cell_size' must be type(float).") self._v_cell_size = float(value) + self._centroids = None + if self.on_file: + self.workspace.update_attribute(self, "attributes") @property def v_count(self) -> int: @@ -323,6 +329,9 @@ def w_cell_size(self, value: Real): raise TypeError("Attribute 'w_cell_size' must be type(float).") self._w_cell_size = float(value) + self._centroids = None + if self.on_file: + self.workspace.update_attribute(self, "attributes") @property def w_count(self) -> int: diff --git a/meta.yaml b/meta.yaml index b4dd2037f..5fb5ca04c 100644 --- a/meta.yaml +++ b/meta.yaml @@ -1,5 +1,5 @@ {% set name = "geoh5py" %} -{% set version = "0.10.0" %} +{% set version = "0.10.1" %} package: name: {{ name|lower }} diff --git a/pyproject.toml b/pyproject.toml index fcd09401e..6c56c3e0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "geoh5py" -version = "0.10.0" +version = "0.10.1" license = "LGPL-3.0-or-later" description = "Python API for geoh5, an open file format for geoscientific data"