def test_pvt_reek(): """Test that the Reek PVT input can be parsed individually""" eclfiles = EclFiles(DATAFILE) pvto_df = pvt.pvto_fromdeck(eclfiles.get_ecldeck()) assert "PVTNUM" in pvto_df assert "PRESSURE" in pvto_df assert "VOLUMEFACTOR" in pvto_df assert "VISCOSITY" in pvto_df assert max(pvto_df["PVTNUM"]) == 1 assert max(pvto_df["PRESSURE"]) == 700.1 # Check count of undersaturated lines pr. RS: # (nb: double brackets in .loc to ensure dataframe is returned) assert len(pvto_df.set_index("RS").loc[[0]]) == 2 assert len(pvto_df.set_index("RS").loc[[15.906]]) == 1 assert len(pvto_df.set_index("RS").loc[[105.5]]) == 15 assert len(pvto_df["RS"].unique()) == 20 assert pvto_df["VOLUMEFACTOR"].max() == 2.851 assert pvto_df["VISCOSITY"].max() == 1.0001 dframe_via_string = pvt.pvto_fromdeck(pvt.df2ecl_pvto(pvto_df)) pd.testing.assert_frame_equal(dframe_via_string, pvto_df) density_df = pvt.density_fromdeck(eclfiles.get_ecldeck()) assert "PVTNUM" in density_df assert "OILDENSITY" in density_df assert "WATERDENSITY" in density_df assert "GASDENSITY" in density_df assert len(density_df) == 1 assert density_df["WATERDENSITY"].values[0] == 999.04 dframe_via_string = pvt.density_fromdeck(pvt.df2ecl_density(density_df)) pd.testing.assert_frame_equal(dframe_via_string, density_df) rock_df = pvt.rock_fromdeck(eclfiles.get_ecldeck()) assert "PVTNUM" in rock_df assert len(rock_df) == 1 assert "PRESSURE" in rock_df assert "COMPRESSIBILITY" in rock_df assert rock_df["PRESSURE"].values[0] == 327.3 pvtw_df = pvt.pvtw_fromdeck(eclfiles.get_ecldeck()) assert "PVTNUM" in pvtw_df assert pvtw_df["PVTNUM"].values[0] == 1 assert len(pvtw_df) == 1 assert "PRESSURE" in pvtw_df assert "VOLUMEFACTOR" in pvtw_df assert "COMPRESSIBILITY" in pvtw_df assert "VISCOSITY" in pvtw_df assert "VISCOSIBILITY" in pvtw_df assert pvtw_df["VISCOSITY"].values[0] == 0.25 pvdg_df = pvt.pvdg_fromdeck(eclfiles.get_ecldeck()) assert "PVTNUM" in pvdg_df assert "PRESSURE" in pvdg_df assert "VOLUMEFACTOR" in pvdg_df assert "VISCOSITY" in pvdg_df assert len(pvdg_df["PVTNUM"].unique()) == 1 assert pvdg_df["PVTNUM"].max() == 1 assert len(pvdg_df) == 15
def test_pvdg_string(): """Test that PVDG can be parsed from a string""" string = """ PVDG 400 6 0.01 600 3 0.012 1000 1.3 0.15 / 200 8 0.013 300 4 0.014 8000 1.8 0.16 / """ dframe = pvt.pvdg_fromdeck(string) assert len(dframe) == 6 assert "PVTNUM" in dframe assert len(dframe["PVTNUM"].unique()) == 2 assert "PRESSURE" in dframe assert "VOLUMEFACTOR" in dframe assert "VISCOSITY" in dframe
def test_pvdg_string(): """Test that PVDG can be parsed from a string""" string = """ PVDG 400 6 0.01 600 3 0.012 1000 1.3 0.15 / 200 8 0.013 300 4 0.014 8000 1.8 0.16 / """ dframe = pvt.pvdg_fromdeck(string) assert len(dframe) == 6 assert "PVTNUM" in dframe assert len(dframe["PVTNUM"].unique()) == 2 assert "PRESSURE" in dframe assert "VOLUMEFACTOR" in dframe assert "VISCOSITY" in dframe # Test emtpy data: inc = pvt.df2ecl_pvdg(pvt.df("")) assert "No data" in inc assert pvt.df(inc).empty