def test_gasoil_normalization(swl, sgcr, sorg, h, tag): """Check that normalization (sgn and son) is correct for all possible saturation endpoints""" gasoil = GasOil( swirr=0.0, swl=swl, sgcr=sgcr, sorg=sorg, h=h, krgendanchor="sorg", tag=tag ) assert not gasoil.table.empty assert not gasoil.table.isnull().values.any() # Check that son is 1 at sgcr assert float_df_checker(gasoil.table, "sg", gasoil.sgcr, "son", 1) # Check that son is 0 at sorg with this krgendanchor assert float_df_checker(gasoil.table, "sg", 1 - gasoil.sorg - gasoil.swl, "son", 0) # Check that sgn is 0 at sgcr assert float_df_checker(gasoil.table, "sg", gasoil.sgcr, "sgn", 0) # Check that sgn is 1 at sorg assert float_df_checker(gasoil.table, "sg", 1 - gasoil.sorg - gasoil.swl, "sgn", 1) # Redo with different krgendanchor gasoil = GasOil( swirr=0.0, swl=swl, sgcr=sgcr, sorg=sorg, h=h, krgendanchor="", tag=tag ) assert float_df_checker(gasoil.table, "sg", 1 - gasoil.swl, "sgn", 1) assert float_df_checker(gasoil.table, "sg", gasoil.sgcr, "sgn", 0)
def test_sgfn(): """Test that we can call SGFN without oil relperm defined""" gasoil = GasOil() gasoil.add_corey_gas() sgfn_str = gasoil.SGFN() assert "SGFN" in sgfn_str assert len(sgfn_str) > 15
def test_linear_input(h, sw_mid): """Linear input creates difficulties with sorw, which is used in add_fromtable(). The intention of the test is to avoid crashes when add_fromtable(). estimate_sorw() is unreliable on linear input, and returns 0 or 1 on the given test dataset. Correctness of sorw should not be needed for add_fromtable(). This tests fails in pyscal v0.7.7""" dframe = pd.DataFrame( columns=["SW", "KRW", "KROW", "PC"], data=[[sw, sw, 1 - sw, 1 - sw] for sw in [0, sw_mid, 1.0]], ) wateroil = WaterOil(h=h, swl=0) wateroil.add_fromtable(dframe) assert wateroil.selfcheck() # GasOil did not fail in v0.7.7, but test anyway: gasoil = GasOil(h=h, swl=0) gasoil.add_fromtable(dframe, sgcolname="SW", krgcolname="KRW", krogcolname="KROW", pccolname="PCOW") assert gasoil.selfcheck()
def test_errors(): """Test some error situations for the constructor""" with pytest.raises(ValueError, match="No saturation range left"): GasOil(swl=0.3, sorg=0.8) with pytest.warns(DeprecationWarning): gasoil = GasOil(tag=dict()) assert gasoil.tag == ""
def test_errors(): """Test some error situations for the constructor""" with pytest.raises(ValueError, match="No saturation range left"): GasOil(swl=0.3, sorg=0.8) with pytest.raises(ValueError, match="No saturation range left"): GasOil(swl=0.3, sgro=0.88, sgcr=0.88) with pytest.raises(ValueError, match="No saturation range left"): GasOil(swl=0.3, sgcr=0.88) with pytest.raises(ValueError, match="sgro must be zero or equal to sgcr"): GasOil(swl=0.3, sgcr=0.1, sgro=0.2)
def test_go_fromtable_simple(): df1 = pd.DataFrame(columns=["SG", "KRG", "KROG", "PC"], data=[[0, 0, 1, 2], [1, 1, 0, 0]]) go = GasOil(h=0.1) go.add_fromtable(df1, sgcolname="SG", krgcolname="KRG", krogcolname="KROG", pccolname="PC") check_go_table(go.table)
def test_go_fromtable_simple(): """Test reading of a simple gasoil table""" df1 = pd.DataFrame(columns=["SG", "KRG", "KROG", "PC"], data=[[0, 0, 1, 2], [1, 1, 0, 0]]) gasoil = GasOil(h=0.1) gasoil.add_fromtable(df1, sgcolname="SG", krgcolname="KRG", krogcolname="KROG", pccolname="PC") check_table(gasoil.table)
def test_go_fromtable_simple(): """Test reading of a simple gasoil table""" df1 = pd.DataFrame(columns=["SG", "KRG", "KROG", "PC"], data=[[0, 0, 1, 0], [1, 1, 0, 2]]) gasoil = GasOil(h=0.1) gasoil.add_fromtable(df1, sgcolname="SG", krgcolname="KRG", krogcolname="KROG", pccolname="PC") assert sum(gasoil.table["krg"]) > 0 assert sum(gasoil.table["krog"]) > 0 assert np.isclose(sum(gasoil.table["pc"]), 11) # Linearly increasing PCOG check_table(gasoil.table)
def test_pyscallist_basic(): """Test that the class acts like a list""" p_list = PyscalList() assert isinstance(p_list, PyscalList) assert not p_list p_list.append(None) assert not p_list p_list.append([]) assert not p_list with pytest.raises(ValueError): p_list.append(1) with pytest.raises(ValueError): p_list.append("foo") p_list.append(WaterOil()) assert len(p_list) == 1 assert isinstance(p_list[1], WaterOil) with pytest.raises(IndexError): # pylint: disable=W0104 p_list[0] with pytest.raises(IndexError): # pylint: disable=W0104 p_list[2] with pytest.raises(ValueError): p_list.append(GasOil()) assert len(p_list) == 1 p_list.append(WaterOil()) assert len(p_list) == 2
def test_gasoil_tag(tag): """Test tagging of GasOil objects, that we are not able to produce something that can crash Eclipse""" gasoil = GasOil(h=0.5, tag=tag) gasoil.add_corey_gas() gasoil.add_corey_oil() sat_table_str_ok(gasoil.SGOF()) sat_table_str_ok(gasoil.SGFN())
def test_sgof_generation() -> None: """ Testing if the FlowNet code and pyscal generate the same SGOF table - test tolerance set to 4 decimals """ parameter_dict = {} parameter_dict["swirr"] = 0.01 parameter_dict["swl"] = 0.05 parameter_dict["sgcr"] = 0.055 parameter_dict["sorg"] = 0.15 parameter_dict["krgend"] = 0.95 parameter_dict["kroend"] = 0.95 parameter_dict["ng"] = 2.25 parameter_dict["nog"] = 2.25 gasoil = GasOil( swirr=parameter_dict["swirr"], swl=parameter_dict["swl"], sgcr=parameter_dict["sgcr"], sorg=parameter_dict["sorg"], h=H_CONSTANT, ) gasoil.add_corey_oil(nog=parameter_dict["nog"], kroend=parameter_dict["kroend"]) gasoil.add_corey_gas(ng=parameter_dict["ng"], krgend=parameter_dict["krgend"]) pyscal_sgof_string = gasoil.SGOF(header=False, dataincommentrow=False).splitlines()[ 3:-1 ] numpy_sgof_string = sgof_from_parameters(parameter_dict).splitlines() for i, line in enumerate(pyscal_sgof_string): assert [round(float(elem), 4) for elem in line.split()] == [ round(float(elem), 4) for elem in numpy_sgof_string[i].split() ]
def test_slgof_hypo(swl, sorg, sgcr, h): """Shotgun-testing of slgof""" gasoil = GasOil(swl=swl, sorg=sorg, sgcr=sgcr, h=h) gasoil.add_corey_gas() gasoil.add_corey_oil() assert gasoil.selfcheck() slgof = gasoil.slgof_df() check_table(slgof) # Eclipse 100 requirement from manual: assert np.isclose(slgof["sl"].values[0], gasoil.swl + gasoil.sorg) # Eclipse 100 requirement from manual: assert np.isclose(slgof["sl"].values[-1], 1.0) slgof_str = gasoil.SLGOF() assert isinstance(slgof_str, str) assert slgof_str
def test_not_threephase_consistency(): wog = WaterOilGas() # To trigger this, we need to hack the WaterOilGas object # by overriding the effect of its __init__ wog.wateroil = WaterOil(swl=0.4) wog.gasoil = GasOil(swl=0.2) wog.wateroil.add_corey_water(nw=2) wog.wateroil.add_corey_oil(now=2, kroend=0.9) wog.gasoil.add_corey_gas(ng=2) wog.gasoil.add_corey_oil(nog=2, kroend=1) assert not wog.threephaseconsistency()
def test_fromtable_types(): """Test loading from a table with incorrect types""" # This frame is valid, but the type was wrong. This # can happen if data is via CSV files, and some other rows # ruin the numerical interpretation of a column. df1 = pd.DataFrame( columns=["SW", "KRW", "KROW", "PC"], data=[["0", "0", "1", "2"], ["1", "1", "0", "0"]], ) wateroil = WaterOil(h=0.1) wateroil.add_fromtable(df1, swcolname="SW", krwcolname="KRW", krowcolname="KROW", pccolname="PC") assert "krw" in wateroil.table.columns assert "krow" in wateroil.table.columns assert "pc" in wateroil.table.columns check_table(wateroil.table) gasoil = GasOil(h=0.1) gasoil.add_fromtable(df1, sgcolname="SW", krgcolname="KRW", krogcolname="KROW", pccolname="PC") assert "krg" in gasoil.table.columns assert "krog" in gasoil.table.columns assert "pc" in gasoil.table.columns check_table(gasoil.table) # But this should not make sense. df2 = pd.DataFrame( columns=["SW", "KRW", "KROW", "PC"], data=[["0", dict(foo="bar"), "1", "2"], ["1", "1", "0", "0"]], ) wateroil = WaterOil(h=0.1) with pytest.raises((ValueError, TypeError)): wateroil.add_fromtable(df2, swcolname="SW", krwcolname="KRW", krowcolname="KROW", pccolname="PC") gasoil = GasOil(h=0.1) with pytest.raises((ValueError, TypeError)): gasoil.add_fromtable(df2, sgcolname="SW", krgcolname="KRW", krogcolname="KROW", pccolname="PC")
def gen_og(parameters: pd.DataFrame, fast_pyscal: bool = False) -> GasOil: """ Creates a PyScal GasOil object based on the input parameters supplied. Args: parameters: A dataframe consisting of all specified parameters. fast_pyscal: Run pyscal in fast-mode skipping checks. Useful for large models/ensembles. Returns: A PyScal GasOil object """ og_relperm = GasOil( swirr=parameters["swirr"], swl=parameters["swl"], sorg=parameters["sorg"], sgcr=parameters["sgcr"], h=H_CONSTANT, fast=fast_pyscal, ) og_relperm.add_corey_gas(ng=parameters["ng"], krgend=parameters["krgend"]) og_relperm.add_corey_oil(nog=parameters["nog"], kroend=parameters["kroend"]) return og_relperm
def test_linearsegments(): """Made for testing the linear segments during the resolution of issue #163""" gasoil = GasOil(h=0.01, swl=0.1, sgcr=0.3, sorg=0.3) gasoil.add_corey_oil(nog=10, kroend=0.5) gasoil.add_corey_gas(ng=10, krgend=0.5) check_table(gasoil.table) check_linear_sections(gasoil)
def test_gasoil_corey1(ng, nog): """Test the Corey formulation for gasoil""" gasoil = GasOil() try: gasoil.add_corey_oil(nog=nog) gasoil.add_corey_gas(ng=ng) except AssertionError: # This happens for "invalid" input return assert "krog" in gasoil.table assert "krg" in gasoil.table assert isinstance(gasoil.krgcomment, str) check_table(gasoil.table) sgofstr = gasoil.SGOF() assert len(sgofstr) > 100 assert sat_table_str_ok(sgofstr) gasoil.resetsorg() check_table(gasoil.table) sgofstr = gasoil.SGOF() assert len(sgofstr) > 100 assert sat_table_str_ok(sgofstr)
def test_gasoil_let1(l, e, t, krgend, krgmax): go = GasOil() try: go.add_LET_oil(l, e, t, krgend) go.add_LET_gas(l, e, t, krgend, krgmax) except AssertionError: # This happens for negative values f.ex. return assert "krog" in go.table assert "krg" in go.table assert isinstance(go.krgcomment, str) check_table(go.table) sgofstr = go.SGOF() assert len(sgofstr) > 100
def test_gasoil_corey1(ng, nog): go = GasOil() try: go.add_corey_oil(nog=nog) go.add_corey_gas(ng=ng) except AssertionError: # This happens for "invalid" input return assert "krog" in go.table assert "krg" in go.table assert isinstance(go.krgcomment, str) check_table(go.table) sgofstr = go.SGOF() assert len(sgofstr) > 100
def test_gasoil_let1(l, e, t, krgend, krgmax): """Test the LET formulation, take 1""" gasoil = GasOil() try: gasoil.add_LET_oil(l, e, t, krgend) gasoil.add_LET_gas(l, e, t, krgend, krgmax) except AssertionError: # This happens for negative values f.ex. return assert "krog" in gasoil.table assert "krg" in gasoil.table assert isinstance(gasoil.krgcomment, str) check_table(gasoil.table) sgofstr = gasoil.SGOF() assert len(sgofstr) > 100 assert sat_table_str_ok(sgofstr)
def main(): """Entry point for interactive tests, will run some tests where the intention is that the user will look at what is displayed, and potentially see if something looks really bad""" print("-- **********************************") print("-- Manual check of output") swof = WaterOil(tag="Good sand, SATNUM 1", h=0.1, swl=0.1) swof.add_corey_water() swof.add_LET_water() swof.add_corey_oil() swof.add_simple_J() print(swof.SWOF()) sgof = GasOil(tag="Good sand, SATNUM 1", h=0.1) sgof.add_corey_gas() sgof.add_corey_oil() print(sgof.SGOF()) print("") print("-- ******************************************") print("-- Manual visual check of interpolation in LET-space") print("-- Check:") print("-- * green curves are between red and blue blue line") print("-- (close plot window to continue)") for _ in range(0, 5): test_interpolate_wo() test_interpolate_go() test_interpolate_gw() print("") print("-- ******************************************") print("-- Manual visual check of interpolation in LET-space") print("-- Check:") print("-- * Red curves are between dotted and solid blue line") print("-- * Green curves are between solid blue and dashed") print("-- (close plot window to continue)") interpolateplottest() print("") print("-- ***********************************************") print("-- Span of LET curves when LET parameters are varied") print("-- within the bounds of the parameters of the red curves") print( "-- Blue dim curves are allowed to go outside the red boundary curves") print("-- (close plot window to continue)") letspan()
def test_numerical_problems(swl, sorg, sgcr): """Test fine-tuned numerics for slgof, this function should trigger the code path in slgof_df() where slgof_sl_mismatch is small. Note: The code path taken may depend on hardware/OS etc. """ # Because we cut away some saturation points due to SWINTEGERS, we easily # end in a situation where the wrong saturation point of to "equal" ones # is removed (because in SLGOF, sg is flipped to sl) # Unrounded, this represents a numerical difficulty, when h is low enough, # but there is special code in slgof_df() to workaround this. gasoil = GasOil(swl=swl, sorg=sorg, sgcr=sgcr, h=0.001) gasoil.add_corey_gas() gasoil.add_corey_oil() assert gasoil.selfcheck() slgof = gasoil.slgof_df() assert np.isclose(slgof["SL"].values[0], gasoil.swl + gasoil.sorg) assert np.isclose(slgof["SL"].values[-1], 1.0) check_table(slgof)
def test_gasoil_slgof(): """Test fine-tuned numerics for slgof""" # Parameter set found by hypothesis swl = 0.029950000000000105 sorg = 0.0 sgcr = 0.01994999999999992 # Because we cut away some saturation points due to SWINTEGERS, we easily # end in a situation where the wrong saturation point of to "equal" ones # is removed (because in SLGOF, sg is flipped to sl) # Unrounded, this represents a numerical difficulty, when h is low enough, # but there is special code in slgof_df() to workaround this. gasoil = GasOil(swl=swl, sorg=sorg, sgcr=sgcr, h=0.001) gasoil.add_corey_gas() gasoil.add_corey_oil() assert gasoil.selfcheck() slgof = gasoil.slgof_df() assert np.isclose(slgof["sl"].values[0], gasoil.swl + gasoil.sorg) assert np.isclose(slgof["sl"].values[-1], 1.0) check_table(slgof)
def test_comments(): """Test that the outputters include endpoints in comments""" gasoil = GasOil(h=0.3) gasoil.add_corey_gas() gasoil.add_corey_oil() sgfn = gasoil.SGFN() assert "--" in sgfn assert "pyscal: " in sgfn # part of version string assert "swirr=0" in sgfn assert "sgcr=0" in sgfn assert "swl=0" in sgfn assert "sorg=0" in sgfn assert "ng=2" in sgfn assert "krgend=1" in sgfn assert "Corey" in sgfn assert "krg = krog @ sg=0.5" in sgfn assert "Zero capillary pressure" in sgfn assert "SG" in sgfn assert "KRG" in sgfn assert "PC" in sgfn sgof = gasoil.SGOF() assert "--" in sgof assert "pyscal: " in sgof # part of version string assert "swirr=0" in sgof assert "sgcr=0" in sgof assert "swl=0" in sgof assert "sorg=0" in sgof assert "ng=2" in sgof assert "nog=2" in sgof assert "krgend=1" in sgof assert "Corey" in sgof assert "krg = krog @ sg=0.5" in sgof assert "Zero capillary pressure" in sgof assert "SG" in sgof assert "KRG" in sgof assert "KROG" in sgof assert "PC" in sgof
def test_nexus(): """Test the Nexus export""" gasoil = GasOil(h=0.01, swl=0.1, sgcr=0.3, sorg=0.3) gasoil.add_corey_oil(nog=10, kroend=0.5) gasoil.add_corey_gas(ng=10, krgend=0.5) nexus_lines = gasoil.GOTABLE().splitlines() non_comments = [ line for line in nexus_lines if not line.startswith("!") or not len(line) ] assert non_comments[0] == "GOTABLE" assert non_comments[1] == "SG KRG KROG PC" df = pd.read_table( io.StringIO("\n".join(non_comments[2:])), engine="python", sep=r"\s+", header=None, ) assert (df.values <= 1.0).all() assert (df.values >= 0.0).all()
def test_roundoff(): """Test robustness to monotonicity issues arising from representation errors https://docs.python.org/3/tutorial/floatingpoint.html#representation-error The dataframe injected in this function has occured in the wild, and caused fatal errors in Eclipse100. The error lies in pd.dataframe.to_csv(float_format=".7f") which does truncation of floating points instead of rounding (intentional). Since we have a strict dependency on monotonicity properties for Eclipse to work, the data must be rounded before being sent to to_csv(). This is being done in the .SGOF() and SWOF() as it is a representation issue, not a numerical issues in the objects themselves. """ gasoil = GasOil() # Inject a custom dataframe that has occured in the wild, # and given monotonicity issues in GasOil.SGOF(). gasoil.table = pd.DataFrame( columns=["sg", "krg", "krog", "pc"], data=[ [0.02, 0, 0.19524045000000001, 0], [0.040000000000000001, 0, 0.19524044999999998, 0], [0.059999999999999998, 0, 0.19524045000000004, 0], [0.080000000000000002, 0, 0.19524045000000001, 0], [0.10000000000000001, 0, 0.19524045000000001, 0], [0.16, 0, 0.19524045000000001, 0], [0.17999999999999999, 0, 0.19524045000000001, 0], [0.19999999999999998, 0, 0.19524044999999998, 0], [0.22, 0, 0.19524045000000001, 0], [1, 1, 0, 0], ], ) gasoil.table["sgn"] = gasoil.table["sg"] gasoil.table["son"] = 1 - gasoil.table["sg"] # If this value (as string) occurs, then we are victim of floating point truncation # in float_format=".7f": assert "0.1952404" not in gasoil.SGOF() assert "0.1952405" in gasoil.SGOF() check_table(gasoil.table) # This function allows this monotonicity hiccup.
def main(): print("-- **********************************") print("-- Manual check of output") swof = WaterOil(tag="Good sand, SATNUM 1", h=0.1, swl=0.1) swof.add_corey_water() swof.add_LET_water() swof.add_corey_oil() swof.add_simple_J() print(swof.SWOF()) sgof = GasOil(tag="Good sand, SATNUM 1", h=0.1) sgof.add_corey_gas() sgof.add_corey_oil() print(sgof.SGOF()) print("") print("-- ***************************************") print("-- Test of one Corey curve set") print("-- Check that all the defined endpoints are correct") print("-- (close plot window to continue)") testplot() print("") print("-- ******************************************") print("-- Manual visual check of interpolation in LET-space") print("-- Check:") print("-- * Red curves are between dotted and solid blue line") print("-- * Green curves are between solid blue and dashed") print("-- (close plot window to continue)") interpolateplottest() print("") print("-- ***********************************************") print("-- Span of LET curves when LET parameters are varied") print("-- within the bounds of the parameters of the red curves") print("-- Blue dim curves are allowed to go outside the red boundary curves") print("-- (close plot window to continue)") letspan()
def test_go_fromtable_problems(): """Test loading from a table where there should be problems""" df1 = pd.DataFrame(columns=["Sg", "KRG", "KROG", "PCOG"], data=[[0.1, 0, 1, 2], [0.9, 1, 0, 0]]) # Now sgcr and swl is wrong: gasoil = GasOil(h=0.1) with pytest.raises(ValueError): # Should say sg must start at zero. gasoil.add_fromtable(df1, pccolname="PCOG") df2 = pd.DataFrame(columns=["Sg", "KRG", "KROG", "PCOG"], data=[[0.0, 0, 1, 2], [0.9, 0.8, 0, 0]]) with pytest.raises(ValueError): # should say too large swl for pcog interpolation gasoil = GasOil(h=0.1) gasoil.add_fromtable(df2, pccolname="PCOG") gasoil = GasOil(h=0.1, swl=0.1) gasoil.add_fromtable(df2, pccolname="PCOG") assert np.isclose(gasoil.table["pc"].max(), 2.0) assert np.isclose(gasoil.table["pc"].min(), 0.0) assert np.isclose(gasoil.table["sg"].max(), 0.9) gasoil = GasOil(h=0.1) with pytest.raises(ValueError): # sg must start at zero gasoil.add_fromtable(df1, krgcolname="KRG", krogcolname="KROG") # This works fine, but we get warnings on swl not seemingly correct gasoil.add_fromtable(df2, krgcolname="KRG", krogcolname="KROG") # krg will be extrapolated to sg=1 float_df_checker(gasoil.table, "sg", 1.0, "krg", 0.8) float_df_checker(gasoil.table, "sg", 1.0, "krog", 0.0) gasoil = GasOil(h=0.1, swl=0.1) gasoil.add_fromtable(df2, krgcolname="KRG", krogcolname="KROG")
def test_interpolations_go_fromtable(): """Test based on bug exposed in pyscal 0.6.1, where sgcr was underestimated in interpolations following add_fromtable(). """ base = pd.DataFrame( columns=["Sg", "krg", "krog"], data=[ [0.0, 0.0, 1.0], [0.1, 0.0, 1.0], [0.2, 0.0, 1.0], # sgcr [0.3, 0.1, 0.9], [0.8, 0.8, 0.0], # sorg [0.9, 0.9, 0.0], [1.0, 1.0, 0.0], ], ) opt = pd.DataFrame( columns=["Sg", "krg", "krog"], data=[ [0.0, 0.0, 1.0], [0.1, 0.0, 1.0], [0.3, 0.0, 1.0], [0.4, 0.1, 0.2], # sgcr [0.9, 0.9, 0.0], # sorg [0.95, 0.95, 0.0], [1.0, 1.0, 0.0], ], ) go_base = GasOil(h=0.01) go_base.add_fromtable(base) assert np.isclose(go_base.estimate_sgcr(), 0.2) assert np.isclose(go_base.estimate_sorg(), 0.2) go_opt = GasOil(h=0.01) go_opt.add_fromtable(opt) assert np.isclose(go_opt.estimate_sgcr(), 0.3) assert np.isclose(go_opt.estimate_sorg(), 0.1) go_ip = interpolate_go(go_base, go_opt, 0.5, h=0.01) assert np.isclose(go_ip.estimate_sgcr(), 0.25) assert np.isclose(go_ip.estimate_sorg(), 0.15)
def test_go_invalidcurves(): """Test fromtable on invalid gasoil data""" # Sw data not ordered: krg1 = pd.DataFrame(columns=["Sg", "krg"], data=[[0.15, 0], [0.1, 1], [1, 1]]) gasoil = GasOil(h=0.1) with pytest.raises(ValueError): # pchip-interpolator raises this error; # x coordinates are not in increasing order gasoil.add_fromtable(krg1, krgcolname="krg") krg2 = pd.DataFrame(columns=["Sg", "krg"], data=[[0.15, 0], [0.4, 0.6], [0.6, 0.4], [1, 1]]) gasoil = GasOil(h=0.1) with pytest.raises(ValueError): # Should get notified that krg is not monotonous gasoil.add_fromtable(krg2, krgcolname="krg") krog2 = pd.DataFrame(columns=["Sg", "krog"], data=[[0.15, 1], [0.4, 0.4], [0.6, 0.6], [1, 0]]) gasoil = GasOil(h=0.1) with pytest.raises(ValueError): # Should get notified that krog is not monotonous gasoil.add_fromtable(krog2, krogcolname="krog") pc2 = pd.DataFrame(columns=["Sg", "pc"], data=[[0.15, 1], [0.4, 0.4], [0.6, 0.6], [1, 0]]) gasoil = GasOil(h=0.1) with pytest.raises(ValueError): # Should get notified that pc is not monotonous gasoil.add_fromtable(pc2, pccolname="pc")