diff --git a/geoapps/driver_base/params.py b/geoapps/driver_base/params.py index c3413ca2a..e1a2d2c9e 100644 --- a/geoapps/driver_base/params.py +++ b/geoapps/driver_base/params.py @@ -280,6 +280,7 @@ def geoh5(self, val): if val is None: self._geoh5 = val return + self.setter_validator( "geoh5", val, diff --git a/geoapps/octree_creation/application.py b/geoapps/octree_creation/application.py index 6c0ee4ff7..277515e12 100644 --- a/geoapps/octree_creation/application.py +++ b/geoapps/octree_creation/application.py @@ -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 diff --git a/tests/run_tests/octree_creation_test.py b/tests/run_tests/octree_creation_test.py index 60885478f..f4eb3d311 100644 --- a/tests/run_tests/octree_creation_test.py +++ b/tests/run_tests/octree_creation_test.py @@ -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