def test_perflog_vs_grid_asfiles(): """ Testing the perforation log as zonelog filter vs grid functionality using files. When a perflog is present, it means in this example that all intervals within a PERFLOG range will have a zonelog vs grid check, i.e. the PERFLOG acts a contrain/filter. In intervals with missing PERFLOG, or if PERFLOG is outside range, then zonelog vs grid checks is ignored. """ mydata = DATA1.copy() mydata["perflog"] = {"name": PERFLOGNAME, "range": [1, 5]} wellcheck = qcf.WellZonationVsGrid() wellcheck.run(mydata) dfr = pd.read_csv(REPORT, index_col="WELL") print(dfr) assert dfr.loc["OP_1_PERF", "MATCH%"] == pytest.approx(80.701, 0.01) pathlib.Path(REPORT).unlink() pathlib.Path(SOMEYAML).unlink()
def test_qcforward_wzonation_vs_grid_stops(tmp_path): """Test wzonation vs grid inside RMS, and here it will STOP.""" # ================================================================================== # qcforward well vs grid (mimic python inside RMS input!) # pylint: disable=invalid-name from fmu.tools import qcforward PRJ1 = PRJ WELLS = ["OP.*"] ZONELOGNAME = "Zonelog" TRAJ = "My trajectory" LOGRUN = "log" GRIDNAME = "Simgrid" ZONEGRIDNAME = "Zone" DRANGE = [1300, 3200] ZLOGRANGE = [1, 3] ZLOGSHIFT = 0 REPORTPATH = tmp_path / "well_vs_grid.csv" ACT = [ { "warn": "any < 90", "stop": "any < 70" }, { "warn": "all < 95", "stop": "all < 80" }, ] qcjob = qcforward.WellZonationVsGrid() def check(): usedata = { "wells": { "names": WELLS, "logrun": LOGRUN, "trajectory": TRAJ }, "zonelog": { "name": ZONELOGNAME, "range": ZLOGRANGE, "shift": ZLOGSHIFT }, "grid": GRIDNAME, "depthrange": DRANGE, "gridprops": [ZONEGRIDNAME], "actions": ACT, "report": REPORTPATH, "nametag": "ZONELOG", } qcjob.run(usedata, project=PRJ1) with pytest.raises(SystemExit): check()
def test_zonelog_vs_grid_asfiles_reuse_instance(): """Testing reusing the instance""" newdata = DATA1.copy() newdata["actions"] = [{"warn": "anywell < 33%", "stop": "anywell < 22%"}] job = qcf.WellZonationVsGrid() job.run(DATA1) job.run(newdata, reuse=True) pathlib.Path(REPORT).unlink() pathlib.Path(SOMEYAML).unlink()
def test_qcforward_wzonation_vs_grid_runs_ok(tmp_path): """Test wzonation vs grid inside RMS, and here it will run OK.""" # ================================================================================== # qcforward well vs grid (mimic python inside RMS input!) # pylint: disable=invalid-name from fmu.tools import qcforward PRJ1 = PRJ WELLS = ["OP.*"] ZONELOGNAME = "Zonelog" TRAJ = "My trajectory" LOGRUN = "log" GRIDNAME = "Simgrid" ZONEGRIDNAME = "Zone" DRANGE = [1300, 3200] ZLOGRANGE = [1, 3] ZLOGSHIFT = 0 REPORTPATH = tmp_path / "well_vs_grid.csv" ACT = [ { "warn": "any < 80", "stop": "any < 50" }, { "warn": "all < 85", "stop": "all < 40" }, ] qcjob = qcforward.WellZonationVsGrid() def check(): usedata = { "wells": { "names": WELLS, "logrun": LOGRUN, "trajectory": TRAJ }, "zonelog": { "name": ZONELOGNAME, "range": ZLOGRANGE, "shift": ZLOGSHIFT }, "grid": GRIDNAME, "depthrange": DRANGE, "gridprops": [ZONEGRIDNAME], "actions": ACT, "report": REPORTPATH, "nametag": "ZONELOG", } qcjob.run(usedata, project=PRJ1) check() result = pd.read_csv(REPORTPATH).set_index("WELL") assert result.loc["OP_1_PERF", "MATCH%"] == pytest.approx(70.588235) assert result.loc["all", "MATCH%"] == pytest.approx(67.207573)