Skip to content

Commit

Permalink
Merge pull request #663 from MiraGeoscience/GEOPY-1371
Browse files Browse the repository at this point in the history
  • Loading branch information
domfournier authored Feb 29, 2024
2 parents 1363ed0 + 6ac84fd commit 43fe802
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions geoapps/driver_base/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def geoh5(self, val):
if val is None:
self._geoh5 = val
return

self.setter_validator(
"geoh5",
val,
Expand Down
1 change: 0 additions & 1 deletion geoapps/octree_creation/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ def workspace(self, workspace):
), f"Workspace must be of class {Workspace}"
self.base_workspace_changes(workspace)
self.update_objects_choices()
self.params.geoh5 = workspace

def update_objects_choices(self):
# Refresh the list of objects for all
Expand Down
39 changes: 39 additions & 0 deletions tests/run_tests/octree_creation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,42 @@ def test_octree_diagonal_balance(

assert (values == np.array(exp_values)).all()
assert (counts == np.array(exp_counts)).all()


def test_app_change_geoh5(tmp_path: Path, setup_test_octree):
(
cell_sizes,
depth_core,
horizontal_padding,
locations,
minimum_level,
refinement,
_,
vertical_padding,
) = setup_test_octree

with Workspace.create(tmp_path / "testOctree.geoh5") as workspace:
points = Points.create(workspace, vertices=locations)
refinements = {
"Refinement A object": points.uid,
"Refinement A levels": refinement,
"Refinement A type": "surface",
"Refinement B object": None,
"minimum_level": minimum_level,
}
app = OctreeMesh(
geoh5=workspace,
objects=str(points.uid),
u_cell_size=cell_sizes[0],
v_cell_size=cell_sizes[1],
w_cell_size=cell_sizes[2],
horizontal_padding=horizontal_padding,
vertical_padding=vertical_padding,
diagonal_balance=False,
depth_core=depth_core,
**refinements,
)
new_workspace = Workspace.create(tmp_path / "testOctree_new.geoh5")
new_workspace.close()

app.h5file = new_workspace.h5file

0 comments on commit 43fe802

Please sign in to comment.