Skip to content

Commit

Permalink
Merge pull request #52 from frank1010111/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
frank1010111 authored Oct 2, 2024
2 parents 0a60f73 + cdf59ce commit 7118063
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
additional_dependencies: [black==23.7.0]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.7"
rev: "v0.6.8"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
8 changes: 2 additions & 6 deletions docs/bayesian_fitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@
"tau_test = 2\n",
"M_test = 300\n",
"true_prod = M_test * derivative(rf_func, time_on_production / tau_test, dx=0.01)\n",
"production = true_prod * np.random.default_rng(42).normal(\n",
" 1, 0.1, size=len(time_on_production)\n",
")\n",
"production = true_prod * np.random.default_rng(42).normal(1, 0.1, size=len(time_on_production))\n",
"cum_production = cumulative_trapezoid(production, time_on_production, initial=0)\n",
"\n",
"fig, ax = plt.subplots()\n",
Expand Down Expand Up @@ -246,9 +244,7 @@
"\n",
"ax2.plot(\n",
" time_on_production,\n",
" az.extract(posterior_predictive, group=\"posterior_predictive\", num_samples=100)[\n",
" \"cum\"\n",
" ],\n",
" az.extract(posterior_predictive, group=\"posterior_predictive\", num_samples=100)[\"cum\"],\n",
" color=\"steelblue\",\n",
")\n",
"ax2.plot(time_on_production, cum_production, color=\"peru\")\n",
Expand Down
4 changes: 1 addition & 3 deletions docs/flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@
],
"source": [
"fig, ax = plt.subplots()\n",
"ax.plot(\n",
" time, res_realgas.recovery_factor(density=True), \"-.\", label=\"Rate from density\"\n",
")\n",
"ax.plot(time, res_realgas.recovery_factor(density=True), \"-.\", label=\"Rate from density\")\n",
"ax.plot(time, rf2, \"--\", label=\"Recovery factor from frac face\")\n",
"ax.legend()\n",
"ax.set(\n",
Expand Down
5 changes: 1 addition & 4 deletions docs/fluids.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@
"from bluebonnet.fluids.water import compressibility_water_McCain\n",
"\n",
"c_g = [compressibility_DAK(200, p, *pseudocritical_point) for p in pressure]\n",
"c_o = [\n",
" oil_compressibility_Standing(200, p, 35, 0.8, 800, *pseudocritical_point)\n",
" for p in pressure\n",
"]\n",
"c_o = [oil_compressibility_Standing(200, p, 35, 0.8, 800, *pseudocritical_point) for p in pressure]\n",
"c_w = compressibility_water_McCain(200, pressure, 0.0)\n",
"\n",
"fig, ax = plt.subplots()\n",
Expand Down
10 changes: 4 additions & 6 deletions docs/forecast.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@
"time_on_production = np.linspace(1e-2, t_end, 500) * fake_tau\n",
"\n",
"# Add some randomness to make this interesting\n",
"randomness = np.random.default_rng(42).normal(\n",
" 0, 2e-3, size=len(time_on_production)\n",
") / np.sqrt(time_on_production + 0.1)\n",
"randomness = np.random.default_rng(42).normal(0, 2e-3, size=len(time_on_production)) / np.sqrt(\n",
" time_on_production + 0.1\n",
")\n",
"fake_rf = rf_func(time_on_production / fake_tau)\n",
"fake_rate = m_factor * np.maximum(np.gradient(fake_rf) + randomness, 0)\n",
"cum_production = cumulative_trapezoid(fake_rate, time_on_production, initial=0)\n",
Expand Down Expand Up @@ -453,9 +453,7 @@
}
],
"source": [
"rf_func = interp1d(\n",
" time, rf_twophase, bounds_error=False, fill_value=(0, rf_twophase[-1])\n",
")\n",
"rf_func = interp1d(time, rf_twophase, bounds_error=False, fill_value=(0, rf_twophase[-1]))\n",
"scaling_curve = ForecasterOnePhase(rf_func)\n",
"scaling_curve.fit(time_on_production, fake_cum)\n",
"print(\n",
Expand Down
5 changes: 1 addition & 4 deletions docs/forecast_varying.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,7 @@
"# This file contains an estimate of initial pressure. That's all I need it for here.\n",
"well_file = f\"https://media.githubusercontent.com/media/frank1010111/bluebonnet/main/data/WellData_{well_number}.csv\"\n",
"pressure_initial = float(\n",
" pd.read_csv(well_file)\n",
" .set_index(\"Field\")\n",
" .loc[\"Initial Pressure Estimate (psi)\"]\n",
" .iloc[0]\n",
" pd.read_csv(well_file).set_index(\"Field\").loc[\"Initial Pressure Estimate (psi)\"].iloc[0]\n",
")\n",
"\n",
"result = fit_production_pressure(\n",
Expand Down
10 changes: 4 additions & 6 deletions docs/oil_flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@
}
],
"source": [
"pvt_oil.plot(x=\"pressure\", y=[\"Bo\", \"z-factor\", \"viscosity\"]).set(\n",
" ylabel=\"value\", xlim=(0, 9000)\n",
");"
"pvt_oil.plot(x=\"pressure\", y=[\"Bo\", \"z-factor\", \"viscosity\"]).set(ylabel=\"value\", xlim=(0, 9000));"
]
},
{
Expand Down Expand Up @@ -276,9 +274,9 @@
"\n",
"# scale pseudopressure\n",
"pseudopressure = interp1d(df_pvt.pressure, df_pvt.pseudopressure)\n",
"df_pvt_mp[\"pseudopressure\"] = (\n",
" pseudopressure(df_pvt_mp[\"pressure\"]) - pseudopressure(p_frac)\n",
") / (pseudopressure(p_res) - pseudopressure(p_frac))\n",
"df_pvt_mp[\"pseudopressure\"] = (pseudopressure(df_pvt_mp[\"pressure\"]) - pseudopressure(p_frac)) / (\n",
" pseudopressure(p_res) - pseudopressure(p_frac)\n",
")\n",
"\n",
"fig, ax = plt.subplots()\n",
"df_pvt_mp.plot(x=\"pressure\", y=\"pseudopressure\", ax=ax)\n",
Expand Down

0 comments on commit 7118063

Please sign in to comment.