Exemple #1
0
def test_import_restart():
    """Import Restart"""

    g = Grid()
    g.from_file(GFILE1, fformat="egrid")

    x = GridProperties()

    names = ["PRESSURE", "SWAT"]
    dates = [19991201, 20010101]
    x.from_file(RFILE1, fformat="unrst", names=names, dates=dates, grid=g)

    # get the object
    pr = x.get_prop_by_name("PRESSURE_19991201")

    swat = x.get_prop_by_name("SWAT_19991201")

    logger.info(x.names)

    logger.info(swat.values3d.mean())
    logger.info(pr.values3d.mean())

    txt = "Average PRESSURE_19991201"
    assert pr.values.mean() == pytest.approx(334.52327, abs=0.0001), txt

    txt = "Average SWAT_19991201"
    assert swat.values.mean() == pytest.approx(0.87, abs=0.01), txt

    pr = x.get_prop_by_name("PRESSURE_20010101")
    logger.info(pr.values3d.mean())
    txt = "Average PRESSURE_20010101"
    assert pr.values.mean() == pytest.approx(304.897, abs=0.01), txt
def test_avg02():
    """Make average map from Reek Eclipse."""
    grd = Grid()
    grd.from_file(GFILE2, fformat="egrid")

    # get the poro
    po = GridProperty()
    po.from_file(IFILE2, fformat="init", name="PORO", grid=grd)

    # get the dz and the coordinates
    dz = grd.get_dz(mask=False)
    xc, yc, _zc = grd.get_xyz(mask=False)

    # get actnum
    actnum = grd.get_actnum()

    # convert from masked numpy to ordinary
    xcuse = np.copy(xc.values3d)
    ycuse = np.copy(yc.values3d)
    dzuse = np.copy(dz.values3d)
    pouse = np.copy(po.values3d)

    # dz must be zero for undef cells
    dzuse[actnum.values3d < 0.5] = 0.0
    pouse[actnum.values3d < 0.5] = 0.0

    # make a map... estimate from xc and yc
    zuse = np.ones((xcuse.shape))

    avgmap = RegularSurface(
        nx=200,
        ny=250,
        xinc=50,
        yinc=50,
        xori=457000,
        yori=5927000,
        values=np.zeros((200, 250)),
    )

    avgmap.avg_from_3dprop(
        xprop=xcuse,
        yprop=ycuse,
        zoneprop=zuse,
        zone_minmax=(1, 1),
        mprop=pouse,
        dzprop=dzuse,
        truncate_le=None,
    )

    # add the faults in plot
    fau = Polygons(FFILE1, fformat="zmap")
    fspec = {"faults": fau}

    avgmap.quickplot(filename="TMP/tmp_poro2.png",
                     xlabelrotation=30,
                     faults=fspec)
    avgmap.to_file("TMP/tmp.poro.gri", fformat="irap_ascii")

    logger.info(avgmap.values.mean())
    assert avgmap.values.mean() == pytest.approx(0.1653, abs=0.01)
Exemple #3
0
def test_import_should_fail():
    """Import INIT and UNRST Reek but ask for wrong name or date"""

    g = Grid()
    g.from_file(GFILE1, fformat="egrid")

    x = GridProperties()

    names = ["PORO", "NOSUCHNAME"]
    with pytest.raises(ValueError) as e_info:
        logger.warning(e_info)
        x.from_file(IFILE1, fformat="init", names=names, grid=g)

    rx = GridProperties()
    names = ["PRESSURE"]
    dates = [19991201, 19991212]  # last date does not exist

    rx.from_file(
        RFILE1, fformat="unrst", names=names, dates=dates, grid=g, strict=(True, False)
    )

    with pytest.raises(ValueError) as e_info:
        rx.from_file(
            RFILE1,
            fformat="unrst",
            names=names,
            dates=dates,
            grid=g,
            strict=(True, True),
        )
Exemple #4
0
def test_roffbin_import_v2():
    """Test roff binary import ROFF using new API"""

    grd1 = Grid()
    grd1.from_file(REEKFIL4, _roffapiv=1)
    cell1 = np.array(grd1.get_xyz_cell_corners(ijk=(12, 13, 4)))

    grd2 = Grid()
    grd2.from_file(REEKFIL4, _roffapiv=2)
    cell2 = np.array(grd2.get_xyz_cell_corners(ijk=(12, 13, 4)))

    assert np.allclose(cell1, cell2)

    grd3 = Grid()
    grd3.from_file(DUALFIL1, _roffapiv=2)

    grd4 = Grid()
    grd4.from_file(DUALFIL2, _roffapiv=2)

    grd5 = Grid()
    grd5.from_file(DUALFIL1, _roffapiv=1)

    cell3 = np.array(grd3.get_xyz_cell_corners(ijk=(2, 1, 0), zerobased=True))
    cell4 = np.array(grd4.get_xyz_cell_corners(ijk=(2, 1, 0), zerobased=True))
    cell5 = np.array(grd5.get_xyz_cell_corners(ijk=(2, 1, 0), zerobased=True))

    assert np.allclose(cell3, cell5)
    assert np.allclose(cell3, cell4)
Exemple #5
0
def test_roffbin_import_v2stress():
    """Test roff binary import ROFF using new API, comapre timing etc."""
    t0 = xtg.timer()
    for _ino in range(100):
        grd1 = Grid()
        grd1.from_file(REEKFIL4)
    t1 = xtg.timer(t0)
    print("100 loops with ROXAPIV 2 took: ", t1)
Exemple #6
0
def test_import_should_warn():
    """Import INIT and UNRST Reek but ask for wrong name or date"""
    g = Grid()
    g.from_file(GFILE1, fformat="egrid")

    rx = GridProperties()
    names = ['PRESSURE']
    dates = [19991201, 19991212]  # last date does not exist

    rx.from_file(RFILE1, fformat='unrst', names=names, dates=dates, grid=g)
Exemple #7
0
def test_roffbin_import_v2_wsubgrids():
    """Test roff binary import ROFF using new API, now with subgrids"""

    grd1 = Grid()
    grd1.from_file(REEKFIL5, _roffapiv=1)
    print(grd1.subgrids)

    grd2 = Grid()
    grd2.from_file(REEKFIL5, _roffapiv=2)
    print(grd2.subgrids)
Exemple #8
0
def test_ecl_run_all():
    """Test import an eclrun with all dates and props."""
    gg = Grid()
    gg.from_file(
        REEKROOT,
        fformat="eclipserun",
        initprops="all",
        restartdates="all",
        restartprops="all",
    )

    assert len(gg.gridprops.names) == 287
Exemple #9
0
def test_pathlib(tmp_path):
    """Import and export via pathlib."""
    pfile = pathlib.Path(DUALFIL1)
    grd = Grid()
    grd.from_file(pfile)

    assert grd.dimensions == (5, 3, 1)

    out = tmp_path / "grdpathtest.roff"
    grd.to_file(out, fformat="roff")

    with pytest.raises(OSError):
        out = pathlib.Path() / "nosuchdir" / "grdpathtest.roff"
        grd.to_file(out, fformat="roff")
def test_avg03():
    """Make average map from Reek Eclipse, speed up by zone_avg."""
    g = Grid()
    g.from_file(gfile2, fformat="egrid")

    # get the poro
    po = GridProperty()
    po.from_file(ifile2, fformat='init', name='PORO', grid=g)

    # get the dz and the coordinates
    dz = g.get_dz(mask=False)
    xc, yc, zc = g.get_xyz(mask=False)

    # get actnum
    actnum = g.get_actnum()
    actnum = actnum.get_npvalues3d()

    # convert from masked numpy to ordinary
    xcuse = xc.get_npvalues3d()
    ycuse = yc.get_npvalues3d()
    dzuse = dz.get_npvalues3d(fill_value=0.0)
    pouse = po.get_npvalues3d(fill_value=0.0)

    # dz must be zero for undef cells
    dzuse[actnum < 0.5] = 0.0
    pouse[actnum < 0.5] = 0.0

    # make a map... estimate from xc and yc
    zuse = np.ones((xcuse.shape))

    avgmap = RegularSurface(nx=200, ny=250, xinc=50, yinc=50,
                            xori=457000, yori=5927000,
                            values=np.zeros((200, 250)))

    avgmap.avg_from_3dprop(xprop=xcuse, yprop=ycuse, zoneprop=zuse,
                           zone_minmax=(1, 1),
                           mprop=pouse, dzprop=dzuse,
                           truncate_le=None, zone_avg=True)

    # add the faults in plot
    fau = Polygons(ffile1, fformat='zmap')
    fspec = {'faults': fau}

    avgmap.quickplot(filename='TMP/tmp_poro3.png', xlabelrotation=30,
                     faults=fspec)
    avgmap.to_file('TMP/tmp.poro3.gri', fformat='irap_ascii')

    logger.info(avgmap.values.mean())
    assert avgmap.values.mean() == pytest.approx(0.1653, abs=0.01)
Exemple #11
0
def test_import_should_pass():
    """Import INIT and UNRST but ask for wrong name or date , using strict=False"""
    g = Grid()
    g.from_file(GFILE1, fformat="egrid")

    rx = GridProperties()
    names = ["PRESSURE", "DUMMY"]  # dummy should exist
    dates = [19991201, 19991212]  # last date does not exist

    rx.from_file(
        RFILE1, fformat="unrst", names=names, dates=dates, grid=g, strict=(False, False)
    )

    assert "PRESSURE_19991201" in rx
    assert "PRESSURE_19991212" not in rx
    assert "DUMMY_19991201" not in rx
def test_report_zlog_mismatch():
    """Report zone log mismatch grid and well."""
    logger.info("Name is {}".format(__name__))
    g1 = Grid()
    g1.from_file(GRIDFILE)

    g2 = Grid()
    g2.from_file(GRIDFILE)

    g2.reduce_to_one_layer()
    g2.to_file(os.path.join(TDMP, "test.roff"), fformat="roff")

    z = GridProperty()
    z.from_file(ZONEFILE, name="Zone")

    w1 = Well(WELL1)
    w2 = Well(WELL2)
    w3 = Well(WELL3)
    w4 = Well(WELL4)
    w5 = Well(WELL5)
    w6 = Well(WELL6)
    w7 = Well(WELL7)

    wells = [w1, w2, w3, w4, w5, w6, w7]

    resultd = {}
    # matchd = {'WI_1': 69, 'WI_3': 70, 'OP_4': 74, 'OP_5': 75, 'OP_1': 75,
    #           'OP_2': 74, 'OP_3': 70}

    for w in wells:
        response = g1.report_zone_mismatch(
            well=w,
            zonelogname="Zonelog",
            zoneprop=z,
            onelayergrid=g2,
            zonelogrange=(1, 3),
            option=0,
            depthrange=[1300, 9999],
        )

        if response is None:
            continue
        else:
            logger.info(response)
            match = int(float("{0:.4f}".format(response[0])))
            logger.info(match)
            resultd[w.wellname] = match
def test_report_zlog_mismatch():
    """Report zone log mismatch grid and well."""
    logger.info('Name is {}'.format(__name__))
    g1 = Grid()
    g1.from_file(gridfile)

    g2 = Grid()
    g2.from_file(gridfile)

    g2.reduce_to_one_layer()
    g2.to_file('/tmp/test.roff', fformat='roff')

    z = GridProperty()
    z.from_file(zonefile, name='Zone')

    w1 = Well(well1)
    w2 = Well(well2)
    w3 = Well(well3)
    w4 = Well(well4)
    w5 = Well(well5)
    w6 = Well(well6)
    w7 = Well(well7)

    wells = [w1, w2, w3, w4, w5, w6, w7]

    resultd = {}
    # matchd = {'WI_1': 69, 'WI_3': 70, 'OP_4': 74, 'OP_5': 75, 'OP_1': 75,
    #           'OP_2': 74, 'OP_3': 70}

    for w in wells:
        response = g1.report_zone_mismatch(well=w,
                                           zonelogname='Zonelog',
                                           zoneprop=z,
                                           onelayergrid=g2,
                                           zonelogrange=(1, 3),
                                           option=0,
                                           depthrange=[1300, 9999])

        if response is None:
            continue
        else:
            logger.info(response)
            match = int(float("{0:.4f}".format(response[0])))
            logger.info(match)
            resultd[w.wellname] = match
Exemple #14
0
def test_roffbin_banal6():
    """Test roff binary for banal no. 6 case"""

    grd1 = Grid()
    grd1.from_file(BANAL6)

    grd2 = Grid()
    grd2.from_file(BANAL6, _xtgformat=2)

    assert grd1.get_xyz_cell_corners() == grd2.get_xyz_cell_corners()

    assert grd1.get_xyz_cell_corners((4, 2, 3)) == grd2.get_xyz_cell_corners(
        (4, 2, 3))

    grd2._convert_xtgformat2to1()

    assert grd1.get_xyz_cell_corners((4, 2, 3)) == grd2.get_xyz_cell_corners(
        (4, 2, 3))
Exemple #15
0
def test_import_init():
    """Import INIT Reek"""

    g = Grid()
    g.from_file(GFILE1, fformat="egrid")

    x = GridProperties()

    names = ["PORO", "PORV"]
    x.from_file(IFILE1, fformat="init", names=names, grid=g)

    # get the object
    poro = x.get_prop_by_name("PORO")
    logger.info("PORO avg {}".format(poro.values.mean()))

    porv = x.get_prop_by_name("PORV")
    logger.info("PORV avg {}".format(porv.values.mean()))
    assert poro.values.mean() == pytest.approx(0.1677402, abs=0.00001)
Exemple #16
0
def test_report_zlog_mismatch_perflog():
    """Report zone log mismatch grid and well filter on PERF"""
    g1 = Grid()
    g1.from_file(GRIDFILE)

    zo = GridProperty()
    zo.from_file(ZONEFILE, name="Zone")

    w1 = Well(PWELL1)

    w1.dataframe.to_csv("TMP/testw1.csv")

    res = g1.report_zone_mismatch(
        well=w1,
        zonelogname="Zonelog",
        zoneprop=zo,
        zonelogrange=(1, 3),
        depthrange=[1580, 9999],
        perflogname="PERF",
        resultformat=2,
    )
    mywell = res["WELLINTV"]
    logger.info("\n%s", mywell.dataframe.to_string())
    mywell.to_file(join(TMPD, "w1_perf_report.rmswell"))

    assert res["MATCH2"] == pytest.approx(81, 1.5)
    assert res["TCOUNT2"] == 57
    assert res["MCOUNT2"] == 46

    w1 = Well(WELL1)

    # well is missing perflog; hence result shall be None
    res = g1.report_zone_mismatch(
        well=w1,
        zonelogname="Zonelog",
        zoneprop=zo,
        zonelogrange=(1, 3),
        depthrange=[1580, 9999],
        perflogname="PERF",
        resultformat=2,
    )

    # ask for perflogname but no such present
    assert res is None
def test_report_zlog_mismatch():
    """Report zone log mismatch grid and well."""
    g1 = Grid()
    g1.from_file(GRIDFILE)

    zo = GridProperty()
    zo.from_file(ZONEFILE, name="Zone")

    w1 = Well(WELL1)
    w2 = Well(WELL2)
    w3 = Well(WELL3)
    w4 = Well(WELL4)
    w5 = Well(WELL5)
    w6 = Well(WELL6)
    w7 = Well(WELL7)

    wells = [w1, w2, w3, w4, w5, w6, w7]

    for wll in wells:
        response = g1.report_zone_mismatch(
            well=wll,
            zonelogname="Zonelog",
            zoneprop=zo,
            zonelogrange=(1, 3),
            depthrange=[1300, 9999],
        )

        match = int(float("{0:.4f}".format(response[0])))
        logger.info("Match for %s is %s", wll.wellname, match)
        assert match == MATCHD1[wll.name]

        # check also with resultformat=2
        res = g1.report_zone_mismatch(
            well=wll,
            zonelogname="Zonelog",
            zoneprop=zo,
            zonelogrange=(1, 3),
            depthrange=[1300, 9999],
            resultformat=2,
        )

        match = int(float("{0:.4f}".format(res["MATCH2"])))
        logger.info("Match for %s is %s", wll.wellname, match)
        assert match == MATCHD2[wll.name]
Exemple #18
0
def test_grid_layer_slice():
    """Test grid slice coordinates."""
    grd = Grid()
    grd.from_file(REEKFILE)

    sarr1, _ibarr = grd.get_layer_slice(1)
    sarrn, _ibarr = grd.get_layer_slice(grd.nlay, top=False)

    cell1 = grd.get_xyz_cell_corners(ijk=(1, 1, 1))
    celln = grd.get_xyz_cell_corners(ijk=(1, 1, grd.nlay))
    celll = grd.get_xyz_cell_corners(ijk=(grd.ncol, grd.nrow, grd.nlay))

    assert sarr1[0, 0, 0] == cell1[0]
    assert sarr1[0, 0, 1] == cell1[1]

    assert sarrn[0, 0, 0] == celln[12]
    assert sarrn[0, 0, 1] == celln[13]

    assert sarrn[-1, 0, 0] == celll[12]
    assert sarrn[-1, 0, 1] == celll[13]
Exemple #19
0
def test_report_zlog_mismatch_resultformat3():
    """Report zone log mismatch grid and well, export updated wellsegment"""
    g1 = Grid()
    g1.from_file(GRIDFILE)

    zo = GridProperty()
    zo.from_file(ZONEFILE, name="Zone")

    w1 = Well(WELL1)

    res = g1.report_zone_mismatch(
        well=w1,
        zonelogname="Zonelog",
        zoneprop=zo,
        zonelogrange=(1, 3),
        depthrange=[1300, 9999],
        resultformat=3,
    )
    mywell = res["WELLINTV"]
    logger.info("\n%s", mywell.dataframe.to_string())
    mywell.to_file(join(TMPD, "w1_zlog_report.rmswell"))
Exemple #20
0
def test_import_soil():
    """SOIL need to be computed in code from SWAT and SGAS"""

    g = Grid()
    g.from_file(GFILE1, fformat="egrid")

    x = GridProperties()

    names = ["SOIL", "SWAT", "PRESSURE"]
    dates = [19991201]
    x.from_file(RFILE1, fformat="unrst", names=names, dates=dates, grid=g)

    logger.info(x.names)

    # get the object instance
    soil = x.get_prop_by_name("SOIL_19991201")
    logger.info(soil.values3d.mean())

    logger.debug(x.names)
    txt = "Average SOIL_19850101"
    assert soil.values.mean() == pytest.approx(0.121977, abs=0.001), txt
Exemple #21
0
def test_import_restart_gull():
    """Import Restart Reek"""

    g = Grid()
    g.from_file(GFILE1, fformat="egrid")

    x = GridProperties()

    names = ["PRESSURE", "SWAT"]
    dates = [19991201]
    x.from_file(RFILE1, fformat="unrst", names=names, dates=dates, grid=g)

    # get the object
    pr = x.get_prop_by_name("PRESSURE_19991201")

    swat = x.get_prop_by_name("SWAT_19991201")

    logger.info(x.names)

    logger.info(swat.values3d.mean())
    logger.info(pr.values3d.mean())
Exemple #22
0
def test_eclgrid_import2():
    """Eclipse EGRID import, also change ACTNUM."""
    grd = Grid()
    logger.info("Import Eclipse GRID...")
    grd.from_file(REEKFILE, fformat="egrid")

    tsetup.assert_equal(grd.ncol, 40, txt="EGrid NX from Eclipse")
    tsetup.assert_equal(grd.nrow, 64, txt="EGrid NY from Eclipse")
    tsetup.assert_equal(grd.nactive, 35838, txt="EGrid NTOTAL from Eclipse")
    tsetup.assert_equal(grd.ntotal, 35840, txt="EGrid NACTIVE from Eclipse")

    actnum = grd.get_actnum()
    print(actnum.values[12:13, 22:24, 5:6])
    tsetup.assert_equal(actnum.values[12, 22, 5], 0, txt="ACTNUM 0")

    actnum.values[:, :, :] = 1
    actnum.values[:, :, 4:6] = 0
    grd.set_actnum(actnum)
    newactive = grd.ncol * grd.nrow * grd.nlay - 2 * (grd.ncol * grd.nrow)
    tsetup.assert_equal(grd.nactive, newactive, txt="Changed ACTNUM")
    grd.to_file(join(TMPDIR, "reek_new_actnum.roff"))
Exemple #23
0
def test_roffbin_export_v2_banal6():
    """Test roff binary export v2 for banal no. 6 case"""
    # export
    grd1 = Grid()
    grd1._xtgformat = 2
    grd1.from_file(BANAL6)

    logger.info("EXPORT")
    grd1.to_file(join(TMPDIR, "b6_export.roffasc"), fformat="roff_asc")
    grd1.to_file(join(TMPDIR, "b6_export.roffbin"), fformat="roff_bin")

    grd2 = Grid(join(TMPDIR, "b6_export.roffbin"))
    cell1 = grd1.get_xyz_cell_corners((2, 2, 2))
    cell2 = grd2.get_xyz_cell_corners((2, 2, 2))

    assert cell1 == cell2

    reek = Grid()
    reek._xtgformat = 2
    reek.from_file(REEKFIL4)
    reek.to_file("TMP/reek_xtgformat2", fformat="roff_ascii")
Exemple #24
0
def test_roffbin_bigbox(tmpdir):
    """Test roff binary for bigbox, to monitor performance"""

    bigbox = os.path.join(tmpdir, "bigbox.roff")
    if not os.path.exists(bigbox):
        logger.info("Create tmp big roff grid file...")
        grd0 = Grid()
        grd0.create_box(dimension=(500, 500, 100))
        grd0.to_file(bigbox)

    grd1 = Grid()
    t0 = xtg.timer()
    grd1._xtgformat = 1
    grd1.from_file(bigbox)
    t_old = xtg.timer(t0)
    logger.info("Reading bigbox xtgeformat=1 took %s seconds", t_old)
    cell1 = grd1.get_xyz_cell_corners((13, 14, 15))

    grd2 = Grid()
    t0 = xtg.timer()
    t1 = xtg.timer()
    grd2._xtgformat = 2
    grd2.from_file(bigbox)
    t_new = xtg.timer(t0)
    logger.info("Reading bigbox xtgformat=2 took %s seconds", t_new)
    cell2a = grd2.get_xyz_cell_corners((13, 14, 15))

    t0 = xtg.timer()
    grd2._convert_xtgformat2to1()
    cell2b = grd2.get_xyz_cell_corners((13, 14, 15))
    logger.info("Conversion to xtgformat1 took %s seconds", xtg.timer(t0))
    t_newtot = xtg.timer(t1)
    logger.info("Total run time xtgformat=2 + conv took %s seconds", t_newtot)

    logger.info("Speed gain new vs old: %s", t_old / t_new)
    logger.info("Speed gain new incl conv vs old: %s", t_old / t_newtot)

    assert cell1 == cell2a
    assert cell1 == cell2b
Exemple #25
0
def test_roffbin_import_v2_banal():
    """Test roff binary import ROFF using new API, banal case"""

    t0 = xtg.timer()
    grd1 = Grid()
    grd1._xtgformat = 1
    grd1.from_file(BANAL6)
    print("V1: ", xtg.timer(t0))

    t0 = xtg.timer()

    grd2 = Grid()
    grd2._xtgformat = 2
    grd2.from_file(BANAL6)
    print("V2: ", xtg.timer(t0))

    t0 = xtg.timer()
    grd3 = Grid()
    grd3._xtgformat = 2
    grd3.from_file(BANAL6)
    grd3._convert_xtgformat2to1()
    print("V3: ", xtg.timer(t0))

    t0 = xtg.timer()
    grd4 = Grid()
    grd4._xtgformat = 1
    grd4.from_file(BANAL6)
    grd4._convert_xtgformat1to2()
    print("V4: ", xtg.timer(t0))

    for irange in range(grd1.ncol):
        for jrange in range(grd1.nrow):
            for krange in range(grd1.nlay):
                cell = (irange + 1, jrange + 1, krange + 1)

                xx1 = grd1.get_xyz_cell_corners(cell, activeonly=False)
                xx2 = grd2.get_xyz_cell_corners(cell, activeonly=False)
                xx3 = grd3.get_xyz_cell_corners(cell, activeonly=False)
                xx4 = grd4.get_xyz_cell_corners(cell, activeonly=False)

                assert np.allclose(np.array(xx1), np.array(xx2)) is True
                assert np.allclose(np.array(xx1), np.array(xx3)) is True
                assert np.allclose(np.array(xx1), np.array(xx4)) is True
Exemple #26
0
def test_import_wrong():
    """Importing wrong fformat, etc"""
    with pytest.raises(ValueError):
        grd = Grid()
        grd.from_file(EMEGFILE, fformat="stupid_wrong_name")
        tsetup.assert_equal(grd.ncol, 70)
Exemple #27
0
def test_hcpvfz1():
    """HCPV thickness map."""

    # It is important that input are pure numpies, not masked

    logger.info("Name is %s", __name__)
    grd = Grid()
    logger.info("Import roff...")
    grd.from_file(ROFF1_GRID, fformat="roff")

    # get the hcpv
    st = GridProperty()
    to = GridProperty()

    st.from_file(ROFF1_PROPS, name="Oil_HCPV")

    to.from_file(ROFF1_PROPS, name="Oil_bulk")

    # get the dz and the coordinates, with no mask (ie get value for outside)
    dz = grd.get_dz(mask=False)
    xc, yc, _zc = grd.get_xyz(mask=False)

    xcv = ma.filled(xc.values3d)
    ycv = ma.filled(yc.values3d)
    dzv = ma.filled(dz.values3d)

    hcpfz = ma.filled(st.values3d, fill_value=0.0)
    tov = ma.filled(to.values3d, fill_value=10)
    tov[tov < 1.0e-32] = 1.0e-32
    hcpfz = hcpfz * dzv / tov

    # make a map... estimate from xc and yc
    xmin = xcv.min()
    xmax = xcv.max()
    ymin = ycv.min()
    ymax = ycv.max()
    xinc = (xmax - xmin) / 50
    yinc = (ymax - ymin) / 50

    logger.debug(
        "xmin xmax ymin ymax, xinc, yinc: %s %s %s %s %s %s",
        xmin,
        xmax,
        ymin,
        ymax,
        xinc,
        yinc,
    )

    hcmap = RegularSurface(
        nx=50,
        ny=50,
        xinc=xinc,
        yinc=yinc,
        xori=xmin,
        yori=ymin,
        values=np.zeros((50, 50)),
    )

    hcmap2 = RegularSurface(
        nx=50,
        ny=50,
        xinc=xinc,
        yinc=yinc,
        xori=xmin,
        yori=ymin,
        values=np.zeros((50, 50)),
    )

    zp = np.ones((grd.ncol, grd.nrow, grd.nlay))
    # now make hcpf map

    t1 = xtg.timer()
    hcmap.hc_thickness_from_3dprops(
        xprop=xcv,
        yprop=ycv,
        dzprop=dzv,
        hcpfzprop=hcpfz,
        zoneprop=zp,
        zone_minmax=(1, 1),
    )

    assert hcmap.values.mean() == pytest.approx(1.447, abs=0.1)

    t2 = xtg.timer(t1)

    logger.info("Speed basic is %s", t2)

    t1 = xtg.timer()
    hcmap2.hc_thickness_from_3dprops(
        xprop=xcv,
        yprop=ycv,
        dzprop=dzv,
        hcpfzprop=hcpfz,
        zoneprop=zp,
        coarsen=2,
        zone_avg=True,
        zone_minmax=(1, 1),
        mask_outside=True,
    )
    t2 = xtg.timer(t1)

    logger.info("Speed zoneavg coarsen 2 is %s", t2)

    hcmap.quickplot(filename="TMP/quickplot_hcpv.png")
    hcmap2.quickplot(filename="TMP/quickplot_hcpv_zavg_coarsen.png")
    logger.debug(hcmap.values.mean())