def eaton_calculation(obp_object, vel_object, output_object, a, b, n): obp_seisegy = ppp.SeiSEGY(str(obp_object.path)) vel_seisegy = ppp.SeiSEGY(str(vel_object.path)) output_seisegy = ppp.SeiSEGY(str(output_object.path)) # preparation depth = np.array(list(obp_seisegy.depths())) vn = ppp.normal(depth, a, b) hydrostatic = ppp.hydrostatic_trace(depth) # actual calcualtion for il in obp_seisegy.inlines(): obp_data_inline = obp_seisegy.inline(il) vel_data_inline = vel_seisegy.inline(il) output_data_inline = np.copy(obp_data_inline) for idx in range(obp_seisegy.nNorth): output_data_inline[idx] = ppp.eaton( vel_data_inline[idx], vn, hydrostatic, obp_data_inline[idx], n=n) output_seisegy.update(ppp.InlineIndex(il), output_data_inline)
def predict(self): # get log well_name = self.well_comboBox.currentText() well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name))) obp_log = well.get_log(str(self.obp_comboBox.currentText())) vel_log = well.get_log(str(self.velocity_comboBox.currentText())) pres_log = well.get_pressure_measured() nct = well.params[str(self.nct_comboBox.currentText())] a, b = nct['a'], nct['b'] # calculate normal velocity and normal stress vnormal = ppp.normal(np.array(vel_log.depth), a, b) hydrostatic = ppp.hydrostatic_pressure( np.array(obp_log.depth), kelly_bushing=well.kelly_bushing, depth_w=well.water_depth, rho_f=1.01) pressure = ppp.eaton( np.array(vel_log.data), vnormal, hydrostatic, np.array(obp_log.data), float(self.n_lineEdit.text())) pp = [] depth = np.array(vel_log.depth) for dp in pres_log.depth: idx = np.searchsorted(depth, dp) pp.append(pressure[idx]) mp = np.array(pres_log.data) pp = np.array(pp) RRMSE = ppp.rmse(mp, pp) self.ax.cla() # self.ax.invert_yaxis() self.ax.plot(pressure, obp_log.depth, color='blue') self.ax.plot(obp_log.data, obp_log.depth, color='green') self.ax.scatter(pres_log.data, pres_log.depth, color='red') self.ax.plot(hydrostatic, obp_log.depth, 'g--') self.ax.set_title('{}'.format(obp_log.name.upper().replace('_', '-')[4:])) self.ax.set_ylabel("Depth(m)") self.ax.set_xlabel("Pressure(mPa)") self.ax.set_xlim(xmin=0) self.ax.set_ylim(ymax=0) self.matplotlib_widget.fig.canvas.draw()
def test__eaton(): assert ppp.eaton(2112, 2112, 500, 1000) == 500