def plot_decline_curves(self): """Plots the selected curves on the plot""" # Checks whether to use oil, gas, or both curves use_oil = self.ui.checkBoxUseOil.isChecked() use_gas = self.ui.checkBoxUseGas.isChecked() oil_curve = self.ui.comboBoxOilDeclineCurves.currentText() gas_curve = self.ui.comboBoxGasDeclineCurves.currentText() if use_oil and use_gas: model_plot_decline_curve(self, oil_curve, reset=False) model_plot_decline_curve(self, gas_curve, reset=False) elif use_oil: model_plot_decline_curve(self, oil_curve, reset=False) elif use_gas: model_plot_decline_curve(self, gas_curve, reset=False) else: msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText( f"Use the two checkboxes to use the decline curves 👀") msg.setWindowTitle("No Decline Curves Used") msg.exec_()
def plot_decline_curve(self, parent): model_plot_decline_curve(self, parent)
def create_decline_curve(parent, curve_name=None): """Creates decline curve from widget curve inputs""" if curve_name is None: curve_name = parent.ui.lineEditDeclineCurveName.text() if curve_name == "": QMessageBox.warning( parent, "Error", "You need to enter a name for the decline curve 👀") parent.ui.lineEditDeclineCurveName.setFocus() return curve_start_date = parent.ui.dateEditCurveStart.date().toPython() # Calculated time for 50 years unit_time = parent.ui.comboBoxUnits.currentText() if unit_time == "BOPM/MCFPM": unit_time_factor = 1 freq = "M" else: unit_time_factor = 12 freq = "D" time = pd.date_range(curve_start_date, periods=600 * unit_time_factor, freq=freq) # Gets delta time by taking the date (day) - initial date (day) and divide by 365 delta_time_yrs = [(date - time[0]).days / 365 for date in time] df_curve = pd.DataFrame(delta_time_yrs, columns=["delta_time_yrs"], index=time) di_secant = float(parent.ui.doubleSpinBoxDi.value() / 100) b_factor = float(parent.ui.doubleSpinBoxBFactor.value()) min_decline = float(parent.ui.doubleSpinBoxMinDecline.value() / 100) qi = int(parent.ui.spinBoxRate.value()) curve_phase = parent.ui.comboBoxPhase.currentText() nominal_di = petrolpy.convert_secant_di_to_nominal(di_secant, b_factor) df_curve[curve_name] = petrolpy.arps_decline_rate_q( qi, b_factor, nominal_di, delta_time_yrs, min_decline) if curve_name in parent.decline_curves_dict: del parent.decline_curves_dict[curve_name] parent.decline_curves_dict[curve_name] = df_curve if curve_phase == "Oil": parent.model_oil_curves.add(curve_name) else: parent.model_gas_curves.add(curve_name) model_plot_decline_curve(parent, curve_name=curve_name)