Skip to content

Commit

Permalink
Merge pull request #720 from MiraGeoscience/GEOPY-1778
Browse files Browse the repository at this point in the history
GEOPY-1778: point development to geoh5py release/0.10.0
  • Loading branch information
domfournier authored Oct 4, 2024
2 parents 4a7eda4 + 949911c commit f8b994a
Show file tree
Hide file tree
Showing 13 changed files with 1,799 additions and 1,651 deletions.
285 changes: 144 additions & 141 deletions environments/py-3.10-linux-64-dev.conda.lock.yml

Large diffs are not rendered by default.

263 changes: 133 additions & 130 deletions environments/py-3.10-linux-64.conda.lock.yml

Large diffs are not rendered by default.

243 changes: 122 additions & 121 deletions environments/py-3.10-win-64-dev.conda.lock.yml

Large diffs are not rendered by default.

221 changes: 111 additions & 110 deletions environments/py-3.10-win-64.conda.lock.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion geoapps/base/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def update_line_list(self, _):
if data and getattr(data[0], "values", None) is not None:
if isinstance(data[0], ReferencedData):
self.lines.options = [["", None]] + [
[v, k] for k, v in data[0].value_map.map.items()
[v, int(k)] for k, v in data[0].value_map().items()
]
else:
self.lines.options = [["", None]]
Expand Down
11 changes: 6 additions & 5 deletions geoapps/inversion/components/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import numpy as np
from geoh5py import Workspace
from geoh5py.data import Data, NumericData
from geoh5py.objects import Grid2D, ObjectBase, Points, PotentialElectrode
from geoh5py.objects import Curve, Grid2D, ObjectBase, Points, PotentialElectrode
from geoh5py.shared.utils import is_uuid

from geoapps.inversion.utils import calculate_2D_trend
Expand Down Expand Up @@ -111,11 +111,12 @@ def window_data(
name=data_object.name + "_processed",
)

if (
not isinstance(data_object, PotentialElectrode)
and getattr(data_object, "parts", None) is not None
if isinstance(data_object, Curve) and not isinstance(
data_object, PotentialElectrode
):
new_data_object.parts = data_object.parts[mask]
new_data_object._parts = data_object.parts[mask] # pylint: disable=protected-access
new_data_object._cells = None # pylint: disable=protected-access
new_data_object.cells = None

# Update data dict
for comp in components:
Expand Down
4 changes: 3 additions & 1 deletion geoapps/iso_surfaces/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from time import time
from uuid import UUID

from geoh5py.groups import UIJsonGroup
from geoh5py.objects import ObjectBase
from geoh5py.shared.utils import fetch_active_workspace
from geoh5py.ui_json import InputFile
Expand Down Expand Up @@ -144,7 +145,8 @@ def trigger_click(self, _):

param_dict["geoh5"] = new_workspace
param_dict["conda_environment"] = "geoapps"
param_dict["out_group"] = self.ga_group_name.value
group = UIJsonGroup.create(new_workspace, name=self.ga_group_name.value)
param_dict["out_group"] = group

if self.live_link.value:
param_dict["monitoring_directory"] = self.monitoring_directory
Expand Down
6 changes: 3 additions & 3 deletions geoapps/shared_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ def get_locations(workspace: Workspace, entity: UUID | Entity):
if isinstance(entity, UUID):
entity = workspace.get_entity(entity)[0]

if hasattr(entity, "centroids"):
locations = entity.centroids
elif hasattr(entity, "vertices"):
if hasattr(entity, "vertices"):
if isinstance(entity, BaseElectrode):
potentials = entity.potential_electrodes
locations = np.mean(
Expand All @@ -66,6 +64,8 @@ def get_locations(workspace: Workspace, entity: UUID | Entity):
)
else:
locations = entity.vertices
elif hasattr(entity, "centroids"):
locations = entity.centroids

elif getattr(entity, "parent", None) is not None and entity.parent is not None:
locations = get_locations(workspace, entity.parent)
Expand Down
6 changes: 3 additions & 3 deletions geoapps/triangulated_surfaces/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def trigger_click(self, _):

_, elevations = self.elevations.get_selected_entities()

if hasattr(obj, "centroids"):
locations = obj.centroids
else:
if hasattr(obj, "vertices"):
locations = obj.vertices
else:
locations = obj.centroids

if self.z_option.value == "depth":
if self.topography.options.value == "Object":
Expand Down
4 changes: 2 additions & 2 deletions geoapps/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def export_grid_2_geotiff(

dataset = driver.Create(
file_name,
grid2d.shape[0],
grid2d.shape[1],
int(grid2d.shape[0]),
int(grid2d.shape[1]),
num_bands,
encode_type,
)
Expand Down
Loading

0 comments on commit f8b994a

Please sign in to comment.