def test_import_as_rms_export_as_hdf_many(): """Import RMS and export as HDF5 and RMS asc, many, and compare timings.""" mywell = Well(WELL1) nmax = 50 t0 = xtg.timer() wlist = [] for _ in range(nmax): wname = (TMPDX / "$random").with_suffix(".hdf") wuse = mywell.to_hdf(wname, compression=None) wlist.append(wuse) print("Time for save HDF: ", xtg.timer(t0)) t0 = xtg.timer() for wll in wlist: wname = (TMPDX / "$random").with_suffix(".hdf") wuse = mywell.from_hdf(wll) print("Time for load HDF: ", xtg.timer(t0)) t0 = xtg.timer() wlist = [] for _ in range(nmax): wname = (TMPDX / "$random").with_suffix(".rmsasc") wuse = mywell.to_file(wname) wlist.append(wuse) print("Time for save RMSASC: ", xtg.timer(t0)) t0 = xtg.timer() for wll in wlist: wuse = mywell.from_file(wll) print("Time for load RMSASC: ", xtg.timer(t0))
def test_import_well_selected_logs(): """Import a well but restrict on lognames""" mywell = Well() mywell.from_file(WELL1, lognames="all") assert "ZONELOG" in mywell.dataframe mywell.from_file(WELL1, lognames="GR") assert "ZONELOG" not in mywell.dataframe mywell.from_file(WELL1, lognames=["GR"]) assert "ZONELOG" not in mywell.dataframe mywell.from_file(WELL1, lognames=["DUMMY"]) assert "ZONELOG" not in mywell.dataframe assert "GR" not in mywell.dataframe with pytest.raises(ValueError) as msg: logger.info(msg) mywell.from_file(WELL1, lognames=["DUMMY"], lognames_strict=True) mywell.from_file(WELL1, mdlogname="GR") assert mywell.mdlogname == "GR" with pytest.raises(ValueError) as msg: mywell.from_file(WELL1, mdlogname="DUMMY", strict=True) logger.info(msg) mywell.from_file(WELL1, mdlogname="DUMMY", strict=False) assert mywell.mdlogname is None