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

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

    sys.argv = [
        "ecl2csv",
        "compdat",
        DATAFILE,
        "--initvectors",
        "FIPNUM",
        "-o",
        str(tmpcsvfile),
    ]
    ecl2csv.main()
github equinor / ecl2df / tests / test_wcon.py View on Github external
def test_main_subparsers(tmpdir):
    """Test command line interface"""
    tmpcsvfile = tmpdir.join(".TMP-wcondf.csv")
    sys.argv = ["ecl2csv", "wcon", DATAFILE, "-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_faults.py View on Github external
def test_main_subparser(tmpdir):
    """Test command line interface with subparsers"""
    tmpcsvfile = tmpdir.join(".TMP-faultsdf.csv")
    sys.argv = ["ecl2csv", "faults", DATAFILE, "-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_grid.py View on Github external
"-o",
        str(tmpcsvfile),
        "--rstdates",
        "2001-02-01",
        "--init",
        "PORO",
    ]
    ecl2csv.main()
    assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    assert not disk_df.empty
    os.remove(str(tmpcsvfile))

    # Test with constants dropping
    sys.argv = ["ecl2csv", "grid", DATAFILE, "-o", str(tmpcsvfile), "--dropconstants"]
    ecl2csv.main()
    assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    # That PVTNUM is constant is a particular feature
    # of the test dataset.
    assert "PVTNUM" not in disk_df
    assert not disk_df.empty
github equinor / ecl2df / tests / test_summary.py View on Github external
def test_main_subparser(tmpdir):
    """Test command line interface"""
    tmpcsvfile = tmpdir.join(".TMP-sum.csv")
    sys.argv = ["ecl2csv", "summary", DATAFILE, "-o", str(tmpcsvfile)]
    ecl2csv.main()

    assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    assert not disk_df.empty
    assert "FOPT" in disk_df
github equinor / ecl2df / tests / test_nnc.py View on Github external
def test_main(tmpdir):
    """Test command line interface"""
    tmpcsvfile = tmpdir.join(".TMP-nnc.csv")
    sys.argv = ["ecl2csv", "nnc", "-v", DATAFILE, "-o", str(tmpcsvfile)]
    ecl2csv.main()

    assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    assert not disk_df.empty
    assert "I1" in disk_df
    assert "TRAN" in disk_df
github equinor / ecl2df / tests / test_summary.py View on Github external
assert sumdf.index.dtype == "datetime64[ns]" or sumdf.index.dtype == "datetime64"

    tmpcsvfile = tmpdir.join(".TMP-sum.csv")
    sys.argv = [
        "ecl2csv",
        "summary",
        "-v",
        DATAFILE,
        "-o",
        str(tmpcsvfile),
        "--start_date",
        "2002-01-02",
        "--end_date",
        "2003-01-02",
    ]
    ecl2csv.main()
    disk_df = pd.read_csv(tmpcsvfile)
    assert len(disk_df) == 97  # Includes timestamps
    assert str(disk_df["DATE"].values[0]) == "2002-01-02 00:00:00"
    assert str(disk_df["DATE"].values[-1]) == "2003-01-02 00:00:00"

    tmpcsvfile = tmpdir.join(".TMP-sum.csv")
    sys.argv = [
        "ecl2csv",
        "summary",
        DATAFILE,
        "-o",
        str(tmpcsvfile),
        "--time_index",
        "daily",
        "--start_date",
        "2002-01-02",
github equinor / ecl2df / tests / test_equil.py View on Github external
def test_main_subparser(tmpdir):
    """Test command line interface"""
    tmpcsvfile = tmpdir.join(".TMP-equil.csv")
    sys.argv = ["ecl2csv", "equil", "-v", DATAFILE, "-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_compdat.py View on Github external
assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    assert "FIPNUM" in disk_df
    assert not disk_df.empty

    sys.argv = [
        "ecl2csv",
        "compdat",
        DATAFILE,
        "--initvectors",
        "FIPNUM",
        "EQLNUM",
        "-o",
        str(tmpcsvfile),
    ]
    ecl2csv.main()

    assert os.path.exists(str(tmpcsvfile))
    disk_df = pd.read_csv(str(tmpcsvfile))
    assert "FIPNUM" in disk_df
    assert "EQLNUM" in disk_df
    assert not disk_df.empty
github equinor / ecl2df / tests / test_pillars.py View on Github external
# Test stacked dates:
    sys.argv = [
        "ecl2csv",
        "pillars",
        DATAFILE,
        "--region",
        "",
        "--group",
        "--rstdates",
        "all",
        "--stackdates",
        "-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 region averaging
    assert "FIPNUM" not in disk_df
    assert "WATVOL@2001-08-01" not in disk_df
    assert "WATVOL@2000-07-01" not in disk_df
    assert "WATVOL@2000-01-01" not in disk_df
    assert "WATVOL@2001-02-01" not in disk_df
    assert "WATVOL" in disk_df
    assert "DATE" in disk_df
    assert len(disk_df) == 4

    # Test stacked dates, no grouping:
    sys.argv = [
        "ecl2csv",
        "pillars",