def test_rescale_well_tvdrange_coarsen_upper(): """Rescale (resample) a well to a coarser increment in top part""" mywell = Well(WELL1) mywell.rescale(delta=20, tvdrange=(0, 1200)) mywell.to_file(join(TMPD, "wll1_rescale_coarsen.w")) tsetup.assert_almostequal(mywell.dataframe.iat[10, 3], 365.8254, 0.1)
def test_import_export_many(): """Import and export many wells (test speed).""" logger.debug(WFILES) for filename in sorted(glob.glob(WFILES)): mywell = Well(filename) logger.info(mywell.nrow) logger.info(mywell.ncol) logger.info(mywell.lognames) wname = join(TMPD, mywell.xwellname + ".w") mywell.to_file(wname)
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_rescale_well_tvdrange(): """Rescale (resample) a well to a finer increment within a TVD range""" mywell = Well(WELL1) mywell.to_file(join(TMPD, "wll1_pre_rescale.w")) gr_avg1 = mywell.dataframe["GR"].mean() mywell.rescale(delta=2, tvdrange=(1286, 1333)) mywell.to_file(join(TMPD, "wll1_post_rescale.w")) gr_avg2 = mywell.dataframe["GR"].mean() tsetup.assert_almostequal(gr_avg1, gr_avg2, 0.9) mywell1 = Well(WELL1) mywell1.rescale(delta=2) mywell2 = Well(WELL1) mywell2.rescale(delta=2, tvdrange=(0, 9999)) assert mywell1.dataframe["GR"].mean() == mywell2.dataframe["GR"].mean() assert mywell1.dataframe["GR"].all() == mywell2.dataframe["GR"].all()