def test_xyz_cell_corners(): """Test xyz variations.""" grd = Grid(DUALFIL1) allcorners = grd.get_xyz_corners() assert len(allcorners) == 24 assert allcorners[0].get_npvalues1d()[0] == 0.0 assert allcorners[23].get_npvalues1d()[-1] == 1001.0
def test_grid_to_from_grdecl_file_is_identity(tmp_path, grid): filepath = tmp_path / "grid.grdecl" grid.to_file(filepath, fformat="grdecl") grid_from_file = Grid().from_file(filepath, fformat="grdecl") assert grid.dimensions == grid_from_file.dimensions assert np.array_equal(grid.actnum_array, grid_from_file.actnum_array) for prop1, prop_from_file in zip(grid.get_xyz_corners(), grid_from_file.get_xyz_corners()): assert_allclose(prop1.get_npvalues1d(), prop_from_file.get_npvalues1d(), atol=1e-3)
def test_get_all_corners(): """Get X Y Z for all corners as XTGeo GridProperty objects""" grid = Grid(TESTFILE8A) allc = grid.get_xyz_corners() x0 = allc[0] y0 = allc[1] z0 = allc[2] x1 = allc[3] y1 = allc[4] z1 = allc[5] # top of cell layer 2 in cell 5 5 (if 1 index start as RMS) assert x0.values3d[4, 4, 1] == pytest.approx(457387.718, abs=0.5) assert y0.values3d[4, 4, 1] == pytest.approx(5935461.29790, abs=0.5) assert z0.values3d[4, 4, 1] == pytest.approx(1728.9429, abs=0.1) assert x1.values3d[4, 4, 1] == pytest.approx(457526.55367, abs=0.5) assert y1.values3d[4, 4, 1] == pytest.approx(5935542.02467, abs=0.5) assert z1.values3d[4, 4, 1] == pytest.approx(1728.57898, abs=0.1)