def test_octree(): name = "MyTestOctree" with tempfile.TemporaryDirectory() as tempdir: h5file_path = Path(tempdir) / r"octree.geoh5" # Create a workspace workspace = Workspace(h5file_path) # Create an octree mesh with variable dimensions mesh = Octree.create( workspace, name=name, origin=[0, 0, 0], u_count=32, v_count=16, w_count=8, u_cell_size=1.0, v_cell_size=1.0, w_cell_size=2.0, rotation=45, ) assert mesh.n_cells == 8, "Number of octree cells after base_refine is wrong" # Refine workspace.save_entity(mesh) workspace.finalize() # Read the mesh back in new_workspace = Workspace(h5file_path) rec_obj = new_workspace.get_entity(name)[0] compare_entities(mesh, rec_obj)
def test_create_group(): group_name = "MyTestContainer" with tempfile.TemporaryDirectory() as tempdir: h5file_path = Path(tempdir) / r"testGroup.geoh5" # Create a workspace workspace = Workspace(h5file_path) group = ContainerGroup.create(workspace, name=group_name) workspace.save_entity(group) workspace.finalize() # Read the group back in rec_obj = workspace.get_entity(group_name)[0] compare_entities(group, rec_obj)