How to use the ecl2df.ecl2csv.main 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_pvt.py View on Github external
def test_main(tmpdir):
    """Test command line interface"""
    tmpcsvfile = str(tmpdir.join("pvt.csv"))
    sys.argv = ["ecl2csv", "pvt", "-v", DATAFILE, "-o", tmpcsvfile]
    ecl2csv.main()

    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())
github equinor / ecl2df / tests / test_pillars.py View on Github external
assert "FIPNUM" in disk_df
    assert "EQLNUM" not in disk_df
    assert len(disk_df) == 7675

    # Group pr. FIPNUM:
    sys.argv = [
        "ecl2csv",
        "pillars",
        DATAFILE,
        "--region",
        "FIPNUM",
        "--group",
        "-o",
        str(tmpcsvfile),
    ]
    ecl2csv.main()
    assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    assert "PILLAR" not in disk_df  # because of grouping
    assert "FIPNUM" in disk_df  # grouped by this.
    assert len(disk_df) == 6

    # Test dates:
    sys.argv = [
        "ecl2csv",
        "pillars",
        DATAFILE,
        "--region",
        "",
        "--group",
        "--rstdates",
        "first",
github equinor / ecl2df / tests / test_gruptree.py View on Github external
def test_prettyprint():
    """Test pretty printing via command line interface"""
    sys.argv = ["ecl2csv", "gruptree", DATAFILE, "--prettyprint"]
    ecl2csv.main()
github equinor / ecl2df / tests / test_equil2df.py View on Github external
def test_main_subparser():
    """Test command line interface"""
    tmpcsvfile = ".TMP-equil.csv"
    sys.argv = ["ecl2csv", "equil", DATAFILE, "-o", tmpcsvfile]
    ecl2csv.main()

    assert os.path.exists(tmpcsvfile)
    disk_df = pd.read_csv(tmpcsvfile)
    assert not disk_df.empty
    os.remove(tmpcsvfile)
github equinor / ecl2df / tests / test_rft.py View on Github external
assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    assert not disk_df.empty

    tmpcsvfile = tmpdir.join(".TMP-rft2.csv")
    # Test with RFT file as argument:
    sys.argv = [
        "ecl2cvsv",
        "rft",
        "-v",
        DATAFILE.replace(".DATA", ".RFT"),
        "-o",
        str(tmpcsvfile),
    ]
    ecl2csv.main()
    assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    assert not disk_df.empty
github equinor / ecl2df / tests / test_satfunc.py View on Github external
def test_main_subparsers(tmpdir):
    """Test command line interface"""
    tmpcsvfile = tmpdir.join(".TMP-satfunc.csv")
    sys.argv = ["ecl2csv", "satfunc", DATAFILE, "-o", str(tmpcsvfile)]
    ecl2csv.main()

    assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    assert not disk_df.empty

    tmpcsvfile2 = tmpdir.join(".TMP-satfunc-swof.csv")
    print(tmpcsvfile2)
    sys.argv = [
        "ecl2csv",
        "satfunc",
        DATAFILE,
        "--keywords",
        "SWOF",
        "--output",
        str(tmpcsvfile2),
    ]