How to use the ecl2df.inferdims.guess_dim function in ecl2df

To help you get started, we’ve selected a few ecl2df examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github equinor / ecl2df / tests / test_satfunc.py View on Github external
sgofstr = """
SGOF
  0 0 1 1
  1 1 0 0
/
  0 0 1 1
  0.5 0.5 0.5 0.5
  1 1 0 0
/
  0 0 1 0
  0.1 0.1 0.1 0.1
  1 1 0 0
/
"""
    tmpdir.chdir()
    assert inferdims.guess_dim(sgofstr, "TABDIMS", 0) == 3
    sgofdf = satfunc.df(sgofstr)
    assert "SATNUM" in sgofdf
    assert len(sgofdf["SATNUM"].unique()) == 3
    assert len(sgofdf) == 8
    inc = satfunc.df2ecl(sgofdf)
    df_from_inc = satfunc.df(inc)
    pd.testing.assert_frame_equal(sgofdf, df_from_inc)

    # Write to file and try to parse it with command line:
    sgoffile = "__sgof_tmp.txt"
    with open(sgoffile, "w") as sgof_f:
        sgof_f.write(sgofstr)

    sys.argv = ["ecl2csv", "satfunc", "-v", sgoffile, "-o", sgoffile + ".csv"]
    ecl2csv.main()
    parsed_sgof = pd.read_csv(sgoffile + ".csv")
github equinor / ecl2df / tests / test_inferdims.py View on Github external
def test_guess_satnumcount():
    """Test that we are able to guess the SATUM count in difficult cases"""
    # We always require a newline after a "/" in the Eclipse syntax
    # (anything between a / and \n is ignored)
    assert inferdims.guess_dim("SWOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SWOF\n0/\n0/ \n0/\n", "TABDIMS", 0) == 3
    assert inferdims.guess_dim("SWFN\n0/\n\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n", "TABDIMS", 0) == 1
    assert inferdims.guess_dim("SGOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n0/\n0/\n", "TABDIMS", 0) == 3
    assert (
        inferdims.guess_dim("SGOF\n0 0 0 0/\n0 0 0 0/\n0 0 0 0/\n", "TABDIMS", 0) == 3
    )
    assert (
        inferdims.guess_dim(
            "SGOF\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1/\n", "TABDIMS", 0
        )
        == 3
    )
github equinor / ecl2df / tests / test_inferdims.py View on Github external
def test_guess_satnumcount():
    """Test that we are able to guess the SATUM count in difficult cases"""
    # We always require a newline after a "/" in the Eclipse syntax
    # (anything between a / and \n is ignored)
    assert inferdims.guess_dim("SWOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SWOF\n0/\n0/ \n0/\n", "TABDIMS", 0) == 3
    assert inferdims.guess_dim("SWFN\n0/\n\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n", "TABDIMS", 0) == 1
    assert inferdims.guess_dim("SGOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n0/\n0/\n", "TABDIMS", 0) == 3
    assert (
        inferdims.guess_dim("SGOF\n0 0 0 0/\n0 0 0 0/\n0 0 0 0/\n", "TABDIMS", 0) == 3
    )
    assert (
        inferdims.guess_dim(
            "SGOF\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1/\n", "TABDIMS", 0
        )
        == 3
    )
github equinor / ecl2df / tests / test_inferdims.py View on Github external
def test_guess_ntequil():
    """Test inferring the correct NTEQUIL"""
    assert inferdims.guess_dim("EQUIL\n200 2000/\n2000 2000/\n", "EQLDIMS", 0) == 2
    assert inferdims.guess_dim("EQUIL\n200 2000/\n", "EQLDIMS", 0) == 1
    assert inferdims.guess_dim("EQUIL\n200 2000 333/\n0 0/\n1 1/\n", "EQLDIMS", 0) == 3
github equinor / ecl2df / tests / test_inferdims.py View on Github external
def test_guess_satnumcount():
    """Test that we are able to guess the SATUM count in difficult cases"""
    # We always require a newline after a "/" in the Eclipse syntax
    # (anything between a / and \n is ignored)
    assert inferdims.guess_dim("SWOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SWOF\n0/\n0/ \n0/\n", "TABDIMS", 0) == 3
    assert inferdims.guess_dim("SWFN\n0/\n\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n", "TABDIMS", 0) == 1
    assert inferdims.guess_dim("SGOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n0/\n0/\n", "TABDIMS", 0) == 3
    assert (
        inferdims.guess_dim("SGOF\n0 0 0 0/\n0 0 0 0/\n0 0 0 0/\n", "TABDIMS", 0) == 3
    )
    assert (
        inferdims.guess_dim(
            "SGOF\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1/\n", "TABDIMS", 0
        )
        == 3
    )
github equinor / ecl2df / tests / test_inferdims.py View on Github external
def test_guess_satnumcount():
    """Test that we are able to guess the SATUM count in difficult cases"""
    # We always require a newline after a "/" in the Eclipse syntax
    # (anything between a / and \n is ignored)
    assert inferdims.guess_dim("SWOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SWOF\n0/\n0/ \n0/\n", "TABDIMS", 0) == 3
    assert inferdims.guess_dim("SWFN\n0/\n\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n", "TABDIMS", 0) == 1
    assert inferdims.guess_dim("SGOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n0/\n0/\n", "TABDIMS", 0) == 3
    assert (
        inferdims.guess_dim("SGOF\n0 0 0 0/\n0 0 0 0/\n0 0 0 0/\n", "TABDIMS", 0) == 3
    )
    assert (
        inferdims.guess_dim(
            "SGOF\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1/\n", "TABDIMS", 0
        )
        == 3
    )
github equinor / ecl2df / tests / test_inferdims.py View on Github external
def test_guess_satnumcount():
    """Test that we are able to guess the SATUM count in difficult cases"""
    # We always require a newline after a "/" in the Eclipse syntax
    # (anything between a / and \n is ignored)
    assert inferdims.guess_dim("SWOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SWOF\n0/\n0/ \n0/\n", "TABDIMS", 0) == 3
    assert inferdims.guess_dim("SWFN\n0/\n\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n", "TABDIMS", 0) == 1
    assert inferdims.guess_dim("SGOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n0/\n0/\n", "TABDIMS", 0) == 3
    assert (
        inferdims.guess_dim("SGOF\n0 0 0 0/\n0 0 0 0/\n0 0 0 0/\n", "TABDIMS", 0) == 3
    )
    assert (
        inferdims.guess_dim(
            "SGOF\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1/\n", "TABDIMS", 0
        )
        == 3
    )
github equinor / ecl2df / tests / test_inferdims.py View on Github external
def test_guess_ntequil():
    """Test inferring the correct NTEQUIL"""
    assert inferdims.guess_dim("EQUIL\n200 2000/\n2000 2000/\n", "EQLDIMS", 0) == 2
    assert inferdims.guess_dim("EQUIL\n200 2000/\n", "EQLDIMS", 0) == 1
    assert inferdims.guess_dim("EQUIL\n200 2000 333/\n0 0/\n1 1/\n", "EQLDIMS", 0) == 3
github equinor / ecl2df / tests / test_inferdims.py View on Github external
def test_guess_satnumcount():
    """Test that we are able to guess the SATUM count in difficult cases"""
    # We always require a newline after a "/" in the Eclipse syntax
    # (anything between a / and \n is ignored)
    assert inferdims.guess_dim("SWOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SWOF\n0/\n0/ \n0/\n", "TABDIMS", 0) == 3
    assert inferdims.guess_dim("SWFN\n0/\n\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n", "TABDIMS", 0) == 1
    assert inferdims.guess_dim("SGOF\n0/\n0/\n", "TABDIMS", 0) == 2
    assert inferdims.guess_dim("SGOF\n0/\n0/\n0/\n", "TABDIMS", 0) == 3
    assert (
        inferdims.guess_dim("SGOF\n0 0 0 0/\n0 0 0 0/\n0 0 0 0/\n", "TABDIMS", 0) == 3
    )
    assert (
        inferdims.guess_dim(
            "SGOF\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1 1/\n0 0 0 0 1 1 1/\n", "TABDIMS", 0
        )
        == 3
    )