Beispiel #1
0
def test_zonbud_active_areas_zone_zero(rtol=1e-2):
    try:
        import pandas as pd
    except ImportError:
        "Pandas is not available"

    # Read ZoneBudget executable output and reformat
    zbud_f = os.path.join(loadpth, "zonef_mlt_active_zone_0.2.csv")
    zbud = pd.read_csv(zbud_f)
    zbud.columns = [c.strip() for c in zbud.columns]
    zbud.columns = ["_".join(c.split()) for c in zbud.columns]
    zbud.index = pd.Index(["ZONE_{}".format(z) for z in zbud.ZONE.values],
                          name="name")
    cols = [c for c in zbud.columns if "ZONE_" in c]
    zbud = zbud[cols]

    # Run ZoneBudget utility and reformat output
    zon_f = os.path.join(loadpth, "zonef_mlt_active_zone_0.zbr")
    zon = ZoneBudget.read_zone_file(zon_f)
    zb = ZoneBudget(cbc_f, zon, kstpkper=(0, 1096))
    fpbud = zb.get_dataframes().reset_index()
    fpbud = fpbud[["name"] + [c for c in fpbud.columns if "ZONE" in c]]
    fpbud = fpbud.set_index("name").T
    fpbud = fpbud[[c for c in fpbud.columns if "ZONE" in c]]
    fpbud = fpbud.loc[["ZONE_{}".format(z) for z in range(1, 4)]]

    # Test for equality
    allclose = np.allclose(zbud, fpbud, rtol)
    s = "Zonebudget arrays do not match."
    assert allclose, s

    return
Beispiel #2
0
def test_zonbud_active_areas_zone_zero(rtol=1e-2):
    try:
        import pandas as pd
    except ImportError:
        'Pandas is not available'

    # Read ZoneBudget executable output and reformat
    zbud_f = os.path.join(loadpth, 'zonef_mlt_active_zone_0.2.csv')
    zbud = pd.read_csv(zbud_f)
    zbud.columns = [c.strip() for c in zbud.columns]
    zbud.columns = ['_'.join(c.split()) for c in zbud.columns]
    zbud.index = pd.Index(['ZONE_{}'.format(z) for z in zbud.ZONE.values],
                          name='name')
    cols = [c for c in zbud.columns if 'ZONE_' in c]
    zbud = zbud[cols]

    # Run ZoneBudget utility and reformat output
    zon_f = os.path.join(loadpth, 'zonef_mlt_active_zone_0.zbr')
    zon = read_zbarray(zon_f)
    zb = ZoneBudget(cbc_f, zon, kstpkper=(0, 1096))
    fpbud = zb.get_dataframes().reset_index()
    fpbud = fpbud[['name'] + [c for c in fpbud.columns if 'ZONE' in c]]
    fpbud = fpbud.set_index('name').T
    fpbud = fpbud[[c for c in fpbud.columns if 'ZONE' in c]]
    fpbud = fpbud.loc[['ZONE_{}'.format(z) for z in range(1, 4)]]

    # Test for equality
    allclose = np.allclose(zbud, fpbud, rtol)
    s = 'Zonebudget arrays do not match.'
    assert allclose, s

    return
Beispiel #3
0
def test_dataframes():
    try:
        import pandas
        zon = read_zbarray(zon_f)
        cmd = ZoneBudget(cbc_f, zon, totim=1095.)
        df = cmd.get_dataframes()
        assert len(df) > 0, 'Output DataFrames empty.'
    except ImportError as e:
        print('Skipping DataFrames test, pandas not installed.')
        print(e)
    return
def test_dataframes():
    try:
        import pandas
        zon = read_zbarray(zon_f)
        cmd = ZoneBudget(cbc_f, zon, totim=1095.)
        df = cmd.get_dataframes()
        assert len(df) > 0, 'Output DataFrames empty.'
    except ImportError as e:
        print('Skipping DataFrames test, pandas not installed.')
        print(e)
    return
Beispiel #5
0
def test_dataframes():
    try:
        import pandas

        zon = ZoneBudget.read_zone_file(zon_f)
        cmd = ZoneBudget(cbc_f, zon, totim=1095.0)
        df = cmd.get_dataframes()
        assert len(df) > 0, "Output DataFrames empty."
    except ImportError as e:
        print("Skipping DataFrames test, pandas not installed.")
        print(e)
    return