Ejemplo n.º 1
0
def test_density():
    """Test that DENSITY can be parsed from files and from strings"""
    eclfiles = EclFiles(DATAFILE)
    density_df = pvt.density_fromdeck(eclfiles.get_ecldeck())
    assert len(density_df) == 1
    assert "PVTNUM" in density_df
    assert "OILDENSITY" in density_df
    assert "WATERDENSITY" in density_df
    assert "GASDENSITY" in density_df

    dframe_via_string = pvt.density_fromdeck(pvt.df2ecl_density(density_df))
    pd.testing.assert_frame_equal(dframe_via_string, density_df)

    two_pvtnum_deck = """DENSITY
        860      999.04       1.1427 /
        800      950     1.05
        /
        """
    density_df = pvt.density_fromdeck(EclFiles.str2deck(two_pvtnum_deck))
    # (a warning will be printed that we cannot guess)
    assert len(density_df) == 1
    density_df = pvt.density_fromdeck(two_pvtnum_deck)
    assert "PVTNUM" in density_df
    assert density_df["PVTNUM"].max() == 2
    assert density_df["PVTNUM"].min() == 1
    assert "OILDENSITY" in density_df
    dframe_via_string = pvt.density_fromdeck(pvt.df2ecl_density(density_df))
    pd.testing.assert_frame_equal(dframe_via_string, density_df)

    # Test emtpy data:
    inc = pvt.df2ecl_density(pvt.df(""))
    assert "No data" in inc
    assert pvt.df(inc).empty
Ejemplo n.º 2
0
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