コード例 #1
0
    def handleItemChecked(self):
        well_names = []
        for idx in range(self.well_listWidget.count()):
            item = self.well_listWidget.item(idx)
            if item.checkState() == Qt.Checked:
                well_names.append(item.text())
        # first well
        if well_names:
            vlog_list = []
            obp_log_list = []
            nct_list = []
            n_list = []
            first_well = ppp.Well(str(CONF.well_dir / ".{}".format(well_names[0])))
            for log in first_well.logs:
                if "Velocity" in log:
                    vlog_list.append(log)
                if "Overburden" in log:
                    obp_log_list.append(log)
            # for key in first_well.params.keys():
            #     if "nct" in key:
            #         nct_list.append(key)
            #     if "eaton" in key:
            #         n_list.append(key)
            pres_list = ["DST", "MDT", "EMW", "loading", "unloading", "MP"]
            for w_name in well_names:
                well = ppp.Well(str(CONF.well_dir / ".{}".format(w_name)))
                for log in vlog_list:
                    if log not in well.logs:
                        vlog_list.remove(log)
                for log in obp_log_list:
                    if log not in well.logs:
                        obp_log_list.remove(log)
                key_to_remove = []
                for key in pres_list:
                    if key not in well.params.keys():
                        key_to_remove.append(key)
                for key in key_to_remove:
                    pres_list.remove(key)

            self.velocity_comboBox.clear()
            self.velocity_comboBox.addItems(vlog_list)
            self.obp_comboBox.clear()
            self.obp_comboBox.addItems(obp_log_list)
            # self.nct_comboBox.clear()
            # self.nct_comboBox.addItems(nct_list)
            # self.n_comboBox.clear()
            # self.n_comboBox.addItems(n_list)

            self.pres_listWidget.clear()
            for name in pres_list:
                new_item = QListWidgetItem(name, self.pres_listWidget)
                new_item.setFlags(new_item.flags() | Qt.ItemIsUserCheckable)
                new_item.setCheckState(Qt.Unchecked)
        else:
            self.pres_listWidget.clear()
コード例 #2
0
    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()))
        A = float(self.a_lineEdit.text())
        B = float(self.b_lineEdit.text())
        U = float(self.u_lineEdit.text())
        v_max = float(self.vmax_lineEdit.text())
        idx = obp_log.get_depth_idx(float(self.start_lineEdit.text()))
        if self.buffer_checkBox.checkState() == Qt.Checked:
            pressure = ppp.bowers_varu(
                np.array(vel_log.data), np.array(obp_log.data), U, idx,
                a=A, b=B, vmax=v_max, buf=int(self.buffer_lineEdit.text()),
                end_idx=obp_log.get_depth_idx(float(self.end_lineEdit.text())))
        else:
            pressure = ppp.bowers(
                np.array(vel_log.data), np.array(obp_log.data), U, idx,
                a=A, b=B, vmax=v_max,
                end_idx=obp_log.get_depth_idx(float(self.end_lineEdit.text())))
        # pressure = ppp.bowers(
        #     average_data, np.array(obp_log.data), U, idx,
        #     a=A, b=B, vmax=v_max,
        #     end_idx=obp_log.get_depth_idx(float(self.end_lineEdit.text())))
        # pressure = ppp.bowers_varu(
        #     average_data, np.array(obp_log.data), U, idx,
        #     a=A, b=B, vmax=v_max, buf=int(self.buffer_lineEdit.text()),
        #     end_idx=obp_log.get_depth_idx(float(self.end_lineEdit.text())))
        self.plot_pressure(pressure)
コード例 #3
0
    def draw_horizon(self):
        while self.horizon_line:
            self.horizon_line[-1].remove()
            del self.horizon_line[-1]

        well_name = self.well_comboBox.currentText()
        well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))

        for idx in range(self.horizon_listWidget.count()):
            item = self.horizon_listWidget.item(idx)
            if item.checkState() == Qt.Checked:
                key = str(item.text())
                try:
                    color = self.color_dict[key]
                except KeyError:
                    color = 'black'
                self.horizon_line.append(
                    self.ax.axhline(y=well.params['horizon'][key],
                                    color=color, linewidth=0.5, zorder=0))
                if 'T' in key:
                    import matplotlib.transforms as transforms
                    trans = transforms.blended_transform_factory(
                        self.ax.transAxes, self.ax.transData)
                    self.horizon_line.append(self.ax.text(
                        s=key, x=0.8, y=well.params['horizon'][key],
                        color=color, transform=trans, size=9))
            self.matplotlib_widget.fig.canvas.draw()
コード例 #4
0
    def extrapolate(self):
        # get well log
        well_name = self.well_comboBox.currentText()
        well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
        log = well.get_log(str(self.log_comboBox.currentText()))
        sm_log = well.get_log(str(self.sm_log_comboBox.currentText()))
        # get a, b
        a, b = float(self.a_lineEdit.text()), float(self.b_lineEdit.text())
        shift = well.kelly_bushing + well.water_depth
        shift_depth = np.array(log.depth)
        mask = shift_depth >= shift
        shift_depth = shift_depth[mask]
        new_den = np.full_like(np.array(log.data), np.nan)
        new_den[mask] = ppp.traugott(shift_depth, a, b)

        old_den = np.array(sm_log.data)
        old_mask = np.isfinite(old_den)
        new_den[old_mask] = old_den[old_mask]

        self.extraploated_log = ppp.Log()
        self.extraploated_log.depth = sm_log.depth
        self.extraploated_log.data = new_den
        self.extraploated_log.units = sm_log.units
        # self.fit_line_ax.append(self.ax.plot(new_den, log.depth)[0])
        self.fit_line_ax2.append(self.ax2.plot(new_den, log.depth)[0])
        self.matplotlib_widget.fig.canvas.draw()
コード例 #5
0
 def import_logs(self):
     # get the well into which logs will be imported
     well_name = self.wells_comboBox.currentText()
     well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
     hdf_file = CONF.well_dir / "well_data.h5"
     # get logs to be imported
     # columns_to_import = ['Depth({})'.format(self.las_object.depth_unit),]
     columns_to_import = [
         'Depth(m)',
     ]
     for irow in range(self.tableWidget.rowCount()):
         descr = self.tableWidget.item(irow, 0)
         if descr.checkState() == Qt.Checked:
             unit = self.tableWidget.item(irow, 1)
             columns_to_import.append("{}({})".format(
                 descr.text(), unit.text()))
     df_import = self.data_frame[columns_to_import]
     try:
         # write to storage
         if well.in_hdf is False:
             storage = ppp.WellStorage(str(hdf_file))
             storage.add_well(str(well_name), df_import)
         else:
             storage = ppp.WellStorage(str(hdf_file))
             storage.logs_into_well(str(well_name), df_import)
         QMessageBox.information(self, "Message", "{}".format("Succeed!"))
     except Exception as ex:
         QMessageBox.warning(self, "Message", "{}".format(ex.message))
コード例 #6
0
 def update_log_comboBox(self):
     self.log_comboBox.clear()
     well_name = self.well_comboBox.currentText()
     if well_name != "":
         well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
         for log_name in well.logs:
             if "Density" in log_name:
                 self.log_comboBox.addItem(log_name)
コード例 #7
0
 def export_log(self):
     if self.logs_listWidget.currentItem() is not None:
         well = ppp.Well(
             str(CONF.well_dir /
                 ".{}".format(self.wells_listWidget.currentItem().text())))
         well_log = well.get_log(
             str(self.logs_listWidget.currentItem().text()))
         export_dialog = WellLogExportDialog(well_log)
         export_dialog.exec_()
コード例 #8
0
 def on_clicked_view_log_Button(self):
     if self.logs_listWidget.currentItem() is not None:
         well = ppp.Well(
             str(CONF.well_dir /
                 ".{}".format(self.wells_listWidget.currentItem().text())))
         well_log = well.get_log(
             str(self.logs_listWidget.currentItem().text()))
         viewer = WellLogViewDialog(well_log)
         viewer.exec_()
コード例 #9
0
    def plot_pressure(self, pressure):
        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()))

        hydrostatic = ppp.hydrostatic_pressure(
            np.array(obp_log.depth), kelly_bushing=well.kelly_bushing,
            depth_w=well.water_depth, rho_f=1.01)

        self.ax.cla()

        # Plot hydrostatic
        if self.hydro_checkBox.checkState() == Qt.Checked:
            self.ax.plot(hydrostatic, obp_log.depth, 'g--')
        # Plot lithostatic
        if self.litho_checkBox.checkState() == Qt.Checked:
            self.ax.plot(obp_log.data, obp_log.depth, color='green')
        # Plot predicted pressure
        self.ax.plot(pressure, obp_log.depth, color='blue')
        # Plot meassure pressure
        pres_names = []
        for idx in range(self.pres_listWidget.count()):
            item = self.pres_listWidget.item(idx)
            if item.checkState() == Qt.Checked:
                pres_names.append(str(item.text()))
        for pres_name in pres_names:
            if pres_name == "MP":
                pres_log = well.get_pressure_normal()
            else:
                pres_log = well._get_pressure(pres_name)

            if pres_name == "MP":
                self.ax.scatter(
                    pres_log.data, pres_log.depth, color='green', marker='d',
                    facecolors='none', zorder=10)
            elif pres_name == "loading":
                self.ax.scatter(
                    pres_log.data, pres_log.depth, color='yellow', marker='o',
                    facecolors='none', zorder=10)
            elif pres_name == "unloading":
                self.ax.scatter(
                    pres_log.data, pres_log.depth, color='red', marker='*',
                    zorder=10)
            else:
                self.ax.scatter(
                    pres_log.data, pres_log.depth, color='red', marker='*',
                    zorder=10)

        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, ymin=obp_log.depth[-1])

        self.matplotlib_widget.fig.canvas.draw()
コード例 #10
0
    def scatter_Button_on_clicked(self):
        well_names = []
        for idx in range(self.well_listWidget.count()):
            item = self.well_listWidget.item(idx)
            if item.checkState() == Qt.Checked:
                well_names.append(str(item.text()))

        vel_name = str(self.velocity_comboBox.currentText())
        obp_name = str(self.obp_comboBox.currentText())

        pres_names = []
        for idx in range(self.pres_listWidget.count()):
            item = self.pres_listWidget.item(idx)
            if item.checkState() == Qt.Checked:
                pres_names.append(str(item.text()))

        self.ax.cla()
        for well_name in well_names:
            well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
            obp_log = well.get_log(obp_name)
            vel_log = well.get_log(vel_name)
            co2 = random.choice(self.colors)
            for pres_name in  pres_names:
                if pres_name == "MP":
                    pres_log = well.get_pressure_normal()
                else:
                    pres_log = well._get_pressure(pres_name)
                vel = list()
                obp = list()
                pres = list()

                depth = np.array(vel_log.depth)
                for dp in pres_log.depth:
                    idx = np.searchsorted(depth, dp)
                    vel.append(vel_log.data[idx])
                    obp.append(obp_log.data[idx])
                vel, obp, pres = \
                    np.array(vel), np.array(obp), np.array(pres_log.data)
                es = obp - pres

                if pres_name == "MP":
                    self.ax.scatter(
                        es, vel, color=co2, marker='d', facecolors='none')
                elif pres_name == "loading":
                    self.ax.scatter(
                        es, vel, color=co2, marker='o', facecolors='none')
                elif pres_name == "unloading":
                    self.ax.scatter(
                        es, vel, color=co2, marker='*')

        self.ax.set_ylim(ymin=1500, ymax=6000)
        self.ax.set_xlim(xmin=0, xmax=80)
        self.ax.set(xlabel="Pressure (MPa)", ylabel="Velocity (m/s)",
                    title="Velocity Variation with Effective Stress")

        self.matplotlib_widget.fig.canvas.draw()
コード例 #11
0
    def fit_unloading(self):
        well_names = []
        for idx in range(self.well_listWidget.count()):
            item = self.well_listWidget.item(idx)
            if item.checkState() == Qt.Checked:
                well_names.append(str(item.text()))

        vel_name = str(self.velocity_comboBox.currentText())
        obp_name = str(self.obp_comboBox.currentText())

        vel = list()
        obp = list()
        pres = list()
        for well_name in well_names:
            well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
            obp_log = well.get_log(obp_name)
            vel_log = well.get_log(vel_name)
            # get data
            for pres_name in ["unloading"]:
                if pres_name not in well.params.keys():
                    continue
                if pres_name == "MP":
                    pres_log = well.get_pressure_normal()
                else:
                    pres_log = well._get_pressure(pres_name)
                depth = np.array(vel_log.depth)
                for dp, val in zip(pres_log.depth, pres_log.data):
                    idx = np.searchsorted(depth, dp)
                    vel.append(vel_log.data[idx])
                    obp.append(obp_log.data[idx])
                    pres.append(val)
        vel, obp, pres = \
            np.array(vel), np.array(obp), np.array(pres)
        es = obp - pres
        # fit
        v_max = float(self.vmax_lineEdit.text())
        A = float(self.a_lineEdit.text())
        B = float(self.b_lineEdit.text())

        sigma_max = ((v_max - 1524)/A)**(1/B)
        temp_dict = {"A": A, "B": B, "sigma_max": sigma_max}
        def unloading_curve(sigma, u):
            independent = temp_dict["sigma_max"]*(sigma/temp_dict["sigma_max"])**(1/u)
            return 1524 + temp_dict['A'] * independent**temp_dict['B']

        popt, pcov = curve_fit(unloading_curve, es, vel)
        U, = popt
        self.u_lineEdit.setText("{}".format(U))

        RRMSE = ppp.rmse(vel, ppp.unloading_curve(es, A, B, U, v_max))
        R_squared = r2_score(vel, ppp.unloading_curve(es, A, B, U, v_max))
        string_output = 'RRMSE={}\n'.format(RRMSE) + \
            "R-squared={}".format(R_squared)
        self.unloading_textEdit.setText(string_output)

        self.draw_unloading_line()
コード例 #12
0
 def update_log_comboBox(self):
     self.log_comboBox.clear()
     self.sm_log_comboBox.clear()
     self.sh_log_comboBox.clear()
     well_name = self.well_comboBox.currentText()
     if well_name != "":
         well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
         self.log_comboBox.addItems(well.logs)
         self.sm_log_comboBox.addItems(well.logs)
         self.sh_log_comboBox.addItems(well.logs)
コード例 #13
0
 def populate_log_listWidget(self):
     self.logs_listWidget.clear()
     well = ppp.Well(
         str(CONF.well_dir /
             ".{}".format(self.well_comboBox.currentText())))
     # self.logs_listWidget.addItems(well.logs)
     for name in well.logs:
         new_item = QListWidgetItem(name, self.logs_listWidget)
         new_item.setFlags(new_item.flags() | Qt.ItemIsUserCheckable)
         new_item.setCheckState(Qt.Unchecked)
コード例 #14
0
    def __init__(self, current_well_name, current_log_name):
        super(WellLogEditDialog, self).__init__()
        self.well = ppp.Well(
            str(CONF.well_dir / ".{}".format(current_well_name)))
        self.current_log_name = current_log_name
        self.well_log = self.well.get_log(current_log_name)

        self.resize(300, 400)
        self.initUI()
        self.button_box.accepted.connect(self.save_edit)
        self.button_box.rejected.connect(self.close)
コード例 #15
0
 def handleItemChecked(self):
     # self.statusBar().showMessage("evoked", msecs=50)
     x, y, well_names = [], [], []
     for idx in range(self.data_listWidget.count()):
         item = self.data_listWidget.item(idx)
         if item.checkState() == Qt.Checked:
             well = ppp.Well(str(CONF.well_dir / ".{}".format(item.text())))
             x.append(well.loc[0])
             y.append(well.loc[1])
             well_names.append(item.text())
     self.map_view.draw_well_loc(x, y, well_names)
コード例 #16
0
 def write_info(self, current_row):
     current_item = self.wells_listWidget.item(current_row)
     well = ppp.Well(str(CONF.well_dir / ".{}".format(current_item.text())))
     info_string = \
         "Surface coordinate: ({}, {})\n".format(
             well.loc[0], well.loc[1]) + \
         "Reference Datum Elevation [KB]: {}m\n".format(
             well.kelly_bushing) + \
         "Total Depth [TD]: {}m\n".format(well.total_depth) + \
         "Replacement velocity [from KB to SRD]: 2000m/s"
     self.info_textEdit.setPlainText(info_string)
     self.show_more_info(well)
コード例 #17
0
    def plot_button_on_clicked(self):
        self.reset_pick_points()
        # get logs
        well_name = self.well_comboBox.currentText()
        well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))

        vlog = well.get_log(str(self.log_comboBox.currentText()))
        sm_log = well.get_log(str(self.sm_log_comboBox.currentText()))
        sh_log = well.get_log(str(self.sh_log_comboBox.currentText()))

        depth = np.array(vlog.depth)
        vel = np.array(vlog.data)
        dt = vel**(-1)
        log_dt = np.log(dt)
        vel_sm = np.array(sm_log.data)
        dt_sm = 1 / vel_sm
        log_dt_sm = np.log(dt_sm)
        vsh = np.array(sh_log.data)
        sand_mask = vsh < 0.35  # non-shale interval
        if self.shale_checkBox.checkState() == Qt.Unchecked:
            sand_mask = vsh > -99999
        # Loose Points -------------------------------------
        shale_vel_log = ppp.shale(vlog, vsh_log=sh_log, thresh=0.4)
        average_log = ppp.local_average(shale_vel_log)
        average_log = ppp.smooth_log(average_log)
        average_log = ppp.smooth_log(average_log)
        # smooth for two times
        average_data = np.array(average_log.data)
        average_dt = average_data**(-1)
        log_av_dt = np.log(average_dt)

        # Plot ----------------------------------------------------
        self.ax.cla()
        self.ax.plot(log_dt, depth, color='lightgray', zorder=0, linewidth=0.2)
        log_dt[sand_mask] = np.nan
        self.ax.plot(log_dt, depth, color='gray', linewidth=0.2, zorder=1)
        self.ax.plot(log_dt_sm, depth, zorder=2)
        # Shale Velocity
        self.ax.set(title=well.well_name,
                    xlabel=u"$\ln dt$",
                    ylabel="Depth(MD) (m)")
        self.ax.set_ylim((5000, 0))
        # axis 2 -------------------------------------------------------
        self.ax2.cla()
        self.ax2.plot(vel, depth, color='lightgray', zorder=0, linewidth=0.2)
        vel[sand_mask] = np.nan
        self.ax2.plot(vel, depth, color='gray', linewidth=0.2, zorder=1)
        self.ax2.plot(vel_sm, depth, zorder=2)
        # Shale Velocity
        self.ax2.set(title=well.well_name, xlabel="Interval Velocity(m/s)")

        self.ax2.set_ylim((5000, 0))
        self.matplotlib_widget.fig.canvas.draw()
コード例 #18
0
 def update_log_comboBox(self):
     well_name = self.well_comboBox.currentText()
     if well_name != "":
         well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
         for log in well.logs:
             if "Velocity" in log:
                 self.velocity_comboBox.addItem(log)
             if "Overburden" in log:
                 self.obp_comboBox.addItem(log)
         for key in well.params.keys():
             if "bowers" in key:
                 self.param_comboBox.addItem(key)
コード例 #19
0
 def update_horizon_listWidget(self):
     self.horizon_listWidget.clear()
     well_name = self.well_comboBox.currentText()
     well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
     try:
         horizons = well.params['horizon'].keys()
         for name in horizons:
             new_item = QListWidgetItem(name, self.horizon_listWidget)
             new_item.setFlags(new_item.flags() | Qt.ItemIsUserCheckable)
             new_item.setCheckState(Qt.Unchecked)
     except KeyError as e:
         print(e.message)
コード例 #20
0
    def save_nct(self):
        # get well
        well_name = str(self.well_comboBox.currentText())
        well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))

        new_name = str(self.new_name_lineEdit.text())
        well.params[new_name] = {
            "a": float(self.a_lineEdit.text()),
            "b": float(self.b_lineEdit.text())
        }
        well.save_params()
        self.update_nct_tableWidget()
コード例 #21
0
    def upscale(self):
        # get log
        well_name = self.well_comboBox.currentText()
        well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
        log = well.get_log(str(self.log_comboBox.currentText()))

        freq = int(self.freq_spinBox.value())

        upscaled_log = ppp.upscale_log(log, freq=freq)

        self.ax.plot(upscaled_log.data, upscaled_log.depth, linewidth=0.5)
        self.matplotlib_widget.fig.canvas.draw()
コード例 #22
0
 def save(self):
     if self.obp_log is not None:
         well_name = self.well_comboBox.currentText()
         well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
         try:
             well.add_log(self.obp_log,
                          name="Overburden_Pressure",
                          unit="mPa")
             well.save_well()
             QMessageBox.information(self, "Message",
                                     "{}".format("Succeed!"))
         except Exception as ex:
             QMessageBox.warning(self, "Message", "{}".format(ex.message))
コード例 #23
0
    def save(self):
        if self.smoothed_log is not None:
            well_name = self.well_comboBox.currentText()
            well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
            log_name = str(self.log_comboBox.currentText())
            log = well.get_log(log_name)

            window_size = int(self.window_lineEdit.text())

            well.add_log(self.smoothed_log,
                         name=log_name + "_smooth{}".format(window_size),
                         unit=log.units)
            well.save_well()
コード例 #24
0
    def fit_loading(self):
        well_names = []
        for idx in range(self.well_listWidget.count()):
            item = self.well_listWidget.item(idx)
            if item.checkState() == Qt.Checked:
                well_names.append(str(item.text()))

        vel_name = str(self.velocity_comboBox.currentText())
        obp_name = str(self.obp_comboBox.currentText())

        vel = list()
        obp = list()
        pres = list()
        for well_name in well_names:
            well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
            obp_log = well.get_log(obp_name)
            vel_log = well.get_log(vel_name)
            # get data

            for pres_name in ["MP", "loading"]:
                if pres_name not in well.params.keys():
                    continue
                if pres_name == "MP":
                    pres_log = well.get_pressure_normal()
                else:
                    pres_log = well._get_pressure(pres_name)
                depth = np.array(vel_log.depth)
                for dp, val in zip(pres_log.depth, pres_log.data):
                    idx = np.searchsorted(depth, dp)
                    vel.append(vel_log.data[idx])
                    obp.append(obp_log.data[idx])
                    pres.append(val)
        vel, obp, pres = \
            np.array(vel), np.array(obp), np.array(pres)
        es = obp - pres
        # fit
        popt, pcov = curve_fit(ppp.virgin_curve, es, vel)
        a, b = popt
        self.a_lineEdit.setText("{}".format(a))
        self.b_lineEdit.setText("{}".format(b))
        #     RRMSE = rrmse(vel, ppp.virgin_curve(es, a, b))
        RRMSE = ppp.rmse(vel, ppp.virgin_curve(es, a, b))
        #     print('RRMSE={}'.format())
        #     print('R-squared={}'.format())
        R_squared = r2_score(vel, ppp.virgin_curve(es, a, b))
        string_output = 'RRMSE={}\n'.format(RRMSE) + \
            "R-squared={}".format(R_squared)
        self.loading_textEdit.setText(string_output)
        self.line_loading.append(self.plot_with_a_b(a, b))

        self.matplotlib_widget.fig.canvas.draw()
コード例 #25
0
    def draw_line_with_a_b(self):
        # get well log
        well_name = self.well_comboBox.currentText()
        well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
        log = well.get_log(str(self.log_comboBox.currentText()))
        # get a, b
        a, b = float(self.a_lineEdit.text()), float(self.b_lineEdit.text())
        new_dt_log = a - b * np.array(log.depth)
        new_dt = np.exp(new_dt_log)
        new_vel = 1 / new_dt
        self.norm_line_ax.append(self.ax.plot(new_dt_log, log.depth, '--')[0])
        self.norm_line_ax2.append(self.ax2.plot(new_vel, log.depth, '--')[0])

        self.matplotlib_widget.fig.canvas.draw()
コード例 #26
0
 def update_parameters(self):
     param_name = str(self.param_comboBox.currentText())
     well_name = self.well_comboBox.currentText()
     well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
     param_dict = well.params[param_name]
     try:
         self.a_lineEdit.setText(str(param_dict["A"]))
         self.b_lineEdit.setText(str(param_dict["B"]))
         self.u_lineEdit.setText(str(param_dict["U"]))
         self.vmax_lineEdit.setText(str(param_dict["vmax"]))
         self.start_lineEdit.setText(str(param_dict["start_depth"]))
         self.end_lineEdit.setText(str(param_dict["end_depth"]))
     except KeyError:
         pass
コード例 #27
0
    def save(self):
        """Save upscaled log to well"""
        well_name = self.well_comboBox.currentText()
        well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
        log_name = str(self.log_comboBox.currentText())
        log = well.get_log(log_name)

        freq = int(self.freq_spinBox.value())

        upscaled_log = ppp.upscale_log(log, freq=freq)

        well.add_log(upscaled_log,
                     name=log_name + "_filter{}".format(freq),
                     unit=log.units)
        well.save_well()
コード例 #28
0
 def save(self):
     if self.extraploated_log is not None:
         well_name = self.well_comboBox.currentText()
         well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
         log_name = str(self.log_comboBox.currentText())
         log = well.get_log(log_name)
         try:
             well.add_log(self.extraploated_log,
                          name=log_name + "_extra",
                          unit=log.units)
             well.save_well()
             QMessageBox.information(self, "Message",
                                     "{}".format("Succeed!"))
         except Exception as ex:
             QMessageBox.warning(self, "Message", "{}".format(ex.message))
コード例 #29
0
    def obp_button_on_clicked(self):
        # get well log
        well_name = self.well_comboBox.currentText()
        well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
        den_log = well.get_log(str(self.log_comboBox.currentText()))

        depth = np.array(den_log.depth)
        rho = np.array(den_log.data)
        # insert missing density value with 2.4 g/cm3
        mask = np.isnan(depth)
        mask[den_log.start_idx:den_log.stop_idx] = True
        mask_nan = np.isnan(rho)
        mask = mask * mask_nan
        rho[mask] = 2.4

        kb = float(self.kb_lineEdit.text())
        wd = float(self.wd_lineEdit.text())
        rho_w = float(self.rho_lineEdit.text())
        obp = ppp.overburden_pressure(depth,
                                      rho,
                                      kelly_bushing=kb,
                                      depth_w=wd,
                                      rho_w=rho_w)

        self.obp_log = ppp.Log()
        self.obp_log.depth = depth
        self.obp_log.data = obp

        self.ax2.cla()
        self.ax2.plot(obp, depth)
        self.ax2.plot(
            ppp.hydrostatic_pressure(np.array(depth),
                                     kelly_bushing=kb,
                                     depth_w=wd,
                                     rho_f=rho_w), depth, 'g--')
        self.ax2.set_xlabel("Overburden Pressure (MPa)")
        self.ax2.set_title("Overburden Pressure")
        y = well.kelly_bushing + well.water_depth
        self.ax2.axhline(y=y, color='brown')
        self.ax2.annotate('KB+WD',
                          xy=(40, y),
                          xytext=(40, y + 500),
                          arrowprops=dict(facecolor='black',
                                          shrink=0.05,
                                          width=0.1,
                                          headwidth=8))

        self.matplotlib_widget.fig.canvas.draw()
コード例 #30
0
 def draw_line_with_a_b(self):
     # get well log
     well_name = self.well_comboBox.currentText()
     well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name)))
     log = well.get_log(str(self.log_comboBox.currentText()))
     # get a, b
     a, b = float(self.a_lineEdit.text()), float(self.b_lineEdit.text())
     shift = well.kelly_bushing + well.water_depth
     shift_depth = np.array(log.depth)
     mask = shift_depth >= shift
     shift_depth = shift_depth[mask]
     new_den = np.full_like(np.array(log.data), np.nan)
     new_den[mask] = ppp.traugott(shift_depth, a, b)
     self.fit_line_ax.append(self.ax.plot(new_den, log.depth)[0])
     self.fit_line_ax2.append(self.ax2.plot(new_den, log.depth)[0])
     self.matplotlib_widget.fig.canvas.draw()