Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
600 3 0.012
1000 1.3 0.15 /
200 8 0.013
300 4 0.014
8000 1.8 0.16 /
"""
dframe = pvt.pvdo_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_pvdo(pvt.df(""))
assert "No data" in inc
assert pvt.df(inc).empty
/
"""
dframe = pvt.pvto_fromdeck(pvto_deck)
assert len(dframe) == 6
assert "PVTNUM" in dframe
assert set(dframe["PVTNUM"].astype(int).unique()) == {1, 2}
assert len(dframe["RS"].unique()) == 4
assert len(dframe["PRESSURE"].unique()) == 6
assert len(dframe["VOLUMEFACTOR"].unique()) == 3
dframe_via_string = pvt.pvto_fromdeck(pvt.df2ecl_pvto(dframe))
pd.testing.assert_frame_equal(dframe_via_string, dframe)
# Test emtpy data:
inc = pvt.df2ecl_pvto(pvt.df(""))
assert "No data" in inc
assert pvt.df(inc).empty
assert os.path.exists(tmpcsvfile)
disk_df = pd.read_csv(tmpcsvfile)
assert "PVTNUM" in disk_df
assert "KEYWORD" in disk_df
assert not disk_df.empty
# Write back to include file:
incfile = str(tmpdir.join("pvt.inc"))
sys.argv = ["csv2ecl", "pvt", "-v", str(tmpcsvfile), "-o", incfile]
csv2ecl.main()
# Reparse the include file on disk back to dataframe
# and check dataframe equality
assert os.path.exists(incfile)
disk_inc_df = pvt.df(open(incfile).read())
pd.testing.assert_frame_equal(disk_df, disk_inc_df)
"""
pvtg_df = pvt.pvtg_fromdeck(string)
assert "PRESSURE" in pvtg_df
assert "OGR" in pvtg_df
assert "PVTNUM" in pvtg_df
assert "VOLUMEFACTOR" in pvtg_df
assert "VISCOSITY" in pvtg_df
assert len(pvtg_df["PVTNUM"].unique()) == 2
assert len(pvtg_df["PRESSURE"].unique()) == 14
assert max(pvtg_df["VOLUMEFACTOR"]) == 0.0523
assert max(pvtg_df["VISCOSITY"]) == 0.0393
# Test emtpy data:
inc = pvt.df2ecl_pvtg(pvt.df(""))
assert "No data" in inc
assert pvt.df(inc).empty
"""
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
333 1.000 1.001 /
19 30 1.14 0.59 /
/
"""
dframe = pvt.pvto_fromdeck(pvto_deck)
assert len(dframe) == 6
assert "PVTNUM" in dframe
assert set(dframe["PVTNUM"].astype(int).unique()) == {1, 2}
assert len(dframe["RS"].unique()) == 4
assert len(dframe["PRESSURE"].unique()) == 6
assert len(dframe["VOLUMEFACTOR"].unique()) == 3
dframe_via_string = pvt.pvto_fromdeck(pvt.df2ecl_pvto(dframe))
pd.testing.assert_frame_equal(dframe_via_string, dframe)
# Test emtpy data:
inc = pvt.df2ecl_pvto(pvt.df(""))
assert "No data" in inc
assert pvt.df(inc).empty
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
def test_df():
"""Test that aggregate dataframes are produced"""
eclfiles = EclFiles(DATAFILE) # Reek dataset
pvtdf = pvt.df(eclfiles)
assert not pvtdf.empty
assert set(pvtdf["KEYWORD"]) == {"PVTO", "PVDG", "DENSITY", "ROCK", "PVTW"}
assert "PVTNUM" in pvtdf
assert "PRESSURE" in pvtdf
assert "RS" in pvtdf
assert "COMPRESSIBILITY" in pvtdf
assert "VISCOSITY" in pvtdf
assert len(pvtdf["PVTNUM"].unique()) == 1
0 0.00360 0.0359 / undersaturated data for Pg=560
/ null record to terminate table 2
"""
pvtg_df = pvt.pvtg_fromdeck(string)
assert "PRESSURE" in pvtg_df
assert "OGR" in pvtg_df
assert "PVTNUM" in pvtg_df
assert "VOLUMEFACTOR" in pvtg_df
assert "VISCOSITY" in pvtg_df
assert len(pvtg_df["PVTNUM"].unique()) == 2
assert len(pvtg_df["PRESSURE"].unique()) == 14
assert max(pvtg_df["VOLUMEFACTOR"]) == 0.0523
assert max(pvtg_df["VISCOSITY"]) == 0.0393
# Test emtpy data:
inc = pvt.df2ecl_pvtg(pvt.df(""))
assert "No data" in inc
assert pvt.df(inc).empty
200 8 0.013
300 4 0.014
8000 1.8 0.16 /
"""
dframe = pvt.pvdo_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_pvdo(pvt.df(""))
assert "No data" in inc
assert pvt.df(inc).empty