Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Try including some vectors:
trans_df = trans.df(eclfiles, vectors="FIPNUM")
assert "FIPNUM" not in trans_df
assert "FIPNUM1" in trans_df
assert "EQLNUM2" not in trans_df
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"])
assert "FIPNUM1" in trans_df
assert "EQLNUM2" in trans_df
trans_df = trans.df(eclfiles, vectors="BOGUS")
assert "BOGUS1" not in trans_df
assert "TRAN" in trans_df # (we should have gotten a warning only)
assert "K" not in trans.df(eclfiles, onlyijdir=True)["DIR"]
assert "I" not in trans.df(eclfiles, onlykdir=True)["DIR"]
transnnc_df = trans.df(eclfiles, addnnc=True)
assert len(transnnc_df) > trans_full_length
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"], boundaryfilter=True)
assert trans_df.empty
trans_df = trans.df(eclfiles, vectors="FIPNUM", boundaryfilter=True)
assert len(trans_df) < trans_full_length
trans_df = trans.df(eclfiles, coords=True)
assert "X" in trans_df
assert "Y" in trans_df
"""
eclfiles = ecl2df.EclFiles(DATAFILE)
compdatdf = ecl2df.compdat.df(eclfiles)
equil = ecl2df.equil.df(eclfiles)
faults = ecl2df.faults.df(eclfiles)
fipreports = ecl2df.fipreports.df(eclfiles)
grid_df = ecl2df.grid.df(eclfiles)
grst_df = ecl2df.grid.df(eclfiles, rstdates="last")
gruptree = ecl2df.gruptree.df(eclfiles)
nnc = ecl2df.nnc.df(eclfiles)
pillars = ecl2df.pillars.df(eclfiles)
rft = ecl2df.rft.df(eclfiles)
satfund = ecl2df.satfunc.df(eclfiles)
smry = ecl2df.summary.df(eclfiles)
trans = ecl2df.trans.df(eclfiles)
wcon = ecl2df.wcon.df(eclfiles)
assert "PORV" in grid_df
assert "SOIL" not in grid_df
assert "SOIL" in grst_df
assert "PORV" in grst_df
# Make some HCPV calculations
grst_df["OILPV"] = grst_df["SOIL"] * grst_df["PORV"]
grst_df["HCPV"] = (1 - grst_df["SWAT"]) * grst_df["PORV"]
hcpv_table = grst_df.groupby("FIPNUM").sum()[["OILPV", "HCPV"]]
assert not hcpv_table.empty
# Print the HCPV table by FIPNUM:
print()
# Try including some vectors:
trans_df = trans.df(eclfiles, vectors="FIPNUM")
assert "FIPNUM" not in trans_df
assert "FIPNUM1" in trans_df
assert "EQLNUM2" not in trans_df
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"])
assert "FIPNUM1" in trans_df
assert "EQLNUM2" in trans_df
trans_df = trans.df(eclfiles, vectors="BOGUS")
assert "BOGUS1" not in trans_df
assert "TRAN" in trans_df # (we should have gotten a warning only)
assert "K" not in trans.df(eclfiles, onlyijdir=True)["DIR"]
assert "I" not in trans.df(eclfiles, onlykdir=True)["DIR"]
transnnc_df = trans.df(eclfiles, addnnc=True)
assert len(transnnc_df) > trans_full_length
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"], boundaryfilter=True)
assert trans_df.empty
trans_df = trans.df(eclfiles, vectors="FIPNUM", boundaryfilter=True)
assert len(trans_df) < trans_full_length
trans_df = trans.df(eclfiles, coords=True)
assert "X" in trans_df
assert "Y" in trans_df
def test_grouptrans():
"""Test grouping of transmissibilities"""
eclfiles = EclFiles(DATAFILE)
trans_df = trans.df(eclfiles, vectors="FIPNUM", group=True, coords=True)
assert "FIPNUMPAIR" in trans_df
assert "FIPNUM1" in trans_df
assert "FIPNUM2" in trans_df
assert (trans_df["FIPNUM1"] < trans_df["FIPNUM2"]).all()
assert len(trans_df) == 7
assert "X" in trans_df # (average X coord for that FIPNUM interface)
assert "FIPNUM" not in trans_df
assert "FIPNUM1" in trans_df
assert "EQLNUM2" not in trans_df
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"])
assert "FIPNUM1" in trans_df
assert "EQLNUM2" in trans_df
trans_df = trans.df(eclfiles, vectors="BOGUS")
assert "BOGUS1" not in trans_df
assert "TRAN" in trans_df # (we should have gotten a warning only)
assert "K" not in trans.df(eclfiles, onlyijdir=True)["DIR"]
assert "I" not in trans.df(eclfiles, onlykdir=True)["DIR"]
transnnc_df = trans.df(eclfiles, addnnc=True)
assert len(transnnc_df) > trans_full_length
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"], boundaryfilter=True)
assert trans_df.empty
trans_df = trans.df(eclfiles, vectors="FIPNUM", boundaryfilter=True)
assert len(trans_df) < trans_full_length
trans_df = trans.df(eclfiles, coords=True)
assert "X" in trans_df
assert "Y" in trans_df
def test_trans():
"""Test that we can build a dataframe of transmissibilities"""
eclfiles = EclFiles(DATAFILE)
trans_df = trans.df(eclfiles)
assert "TRAN" in trans_df
assert "DIR" in trans_df
assert set(trans_df["DIR"].unique()) == set(["I", "J", "K"])
assert trans_df["TRAN"].sum() > 0
trans_full_length = len(trans_df)
# Try including some vectors:
trans_df = trans.df(eclfiles, vectors="FIPNUM")
assert "FIPNUM" not in trans_df
assert "FIPNUM1" in trans_df
assert "EQLNUM2" not in trans_df
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"])
assert "FIPNUM1" in trans_df
assert "EQLNUM2" in trans_df
trans_df = trans.df(eclfiles, vectors="BOGUS")
assert "BOGUS1" not in trans_df
assert "TRAN" in trans_df # (we should have gotten a warning only)
assert "K" not in trans.df(eclfiles, onlyijdir=True)["DIR"]
assert "I" not in trans.df(eclfiles, onlykdir=True)["DIR"]
transnnc_df = trans.df(eclfiles, addnnc=True)
assert "EQLNUM2" in trans_df
trans_df = trans.df(eclfiles, vectors="BOGUS")
assert "BOGUS1" not in trans_df
assert "TRAN" in trans_df # (we should have gotten a warning only)
assert "K" not in trans.df(eclfiles, onlyijdir=True)["DIR"]
assert "I" not in trans.df(eclfiles, onlykdir=True)["DIR"]
transnnc_df = trans.df(eclfiles, addnnc=True)
assert len(transnnc_df) > trans_full_length
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"], boundaryfilter=True)
assert trans_df.empty
trans_df = trans.df(eclfiles, vectors="FIPNUM", boundaryfilter=True)
assert len(trans_df) < trans_full_length
trans_df = trans.df(eclfiles, coords=True)
assert "X" in trans_df
assert "Y" in trans_df
def test_trans():
"""Test that we can build a dataframe of transmissibilities"""
eclfiles = EclFiles(DATAFILE)
trans_df = trans.df(eclfiles)
assert "TRAN" in trans_df
assert "DIR" in trans_df
assert set(trans_df["DIR"].unique()) == set(["I", "J", "K"])
assert trans_df["TRAN"].sum() > 0
trans_full_length = len(trans_df)
# Try including some vectors:
trans_df = trans.df(eclfiles, vectors="FIPNUM")
assert "FIPNUM" not in trans_df
assert "FIPNUM1" in trans_df
assert "EQLNUM2" not in trans_df
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"])
assert "FIPNUM1" in trans_df
assert "EQLNUM2" in trans_df
assert set(trans_df["DIR"].unique()) == set(["I", "J", "K"])
assert trans_df["TRAN"].sum() > 0
trans_full_length = len(trans_df)
# Try including some vectors:
trans_df = trans.df(eclfiles, vectors="FIPNUM")
assert "FIPNUM" not in trans_df
assert "FIPNUM1" in trans_df
assert "EQLNUM2" not in trans_df
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"])
assert "FIPNUM1" in trans_df
assert "EQLNUM2" in trans_df
trans_df = trans.df(eclfiles, vectors="BOGUS")
assert "BOGUS1" not in trans_df
assert "TRAN" in trans_df # (we should have gotten a warning only)
assert "K" not in trans.df(eclfiles, onlyijdir=True)["DIR"]
assert "I" not in trans.df(eclfiles, onlykdir=True)["DIR"]
transnnc_df = trans.df(eclfiles, addnnc=True)
assert len(transnnc_df) > trans_full_length
trans_df = trans.df(eclfiles, vectors=["FIPNUM", "EQLNUM"], boundaryfilter=True)
assert trans_df.empty
trans_df = trans.df(eclfiles, vectors="FIPNUM", boundaryfilter=True)
assert len(trans_df) < trans_full_length
trans_df = trans.df(eclfiles, coords=True)