Exerciseschevron_rightChapter 4chevron_right4.6
fitness_center

Exercise 4.6

Cumulative Production & EUR

Level 2
Chapter 4: NumPy & Pandas
descriptionProblem

Given a daily oil rate sampled monthly over 12 months:

t_days  = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360]
q_bopd  = [1000, 860, 740, 640, 560, 490, 430, 380, 335, 295, 260, 230, 200]

Using NumPy:

  1. Compute cum_stb, cumulative production over 360 days using the

trapezoidal rule (np.trapz).

  1. Fit an exponential decline q(t)=qieDitq(t) = q_i \cdot e^{-D_i \cdot t}

by linear regression on ln(q)\ln(q) vs tt. Store the decline constant in Di_per_day (units: 1/day).

  1. Use that fit + an economic limit of 30 bopd to compute EUR

in stock-tank barrels:

EUR=qiqeconDiEUR = \frac{q_i - q_{econ}}{D_i}

Store the answer in eur_stb.

lightbulbHints (0/3)

Stuck? Reveal hints one at a time — they progress from nudge to near-solution.

codeYour solution
main.py
visibilityReveal reference solutionexpand_more

Try solving it yourself first — the hints walk you through it. The solution below is one valid approach; yours may differ and still be correct.

import numpy as np

t_days = np.array([0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360])
q_bopd = np.array([1000, 860, 740, 640, 560, 490, 430, 380, 335, 295, 260, 230, 200])

cum_stb = float(np.trapz(q_bopd, t_days))

slope, intercept = np.polyfit(t_days, np.log(q_bopd), 1)
Di_per_day = -float(slope)
qi = float(np.exp(intercept))

q_econ = 30
eur_stb = (qi - q_econ) / Di_per_day

print(f"Cumulative (360 d):  {cum_stb:>10,.0f} STB")
print(f"Di:                  {Di_per_day:.5f} /day")
print(f"qi (fit):            {qi:.1f} bopd")
print(f"EUR (q_econ=30):     {eur_stb:>10,.0f} STB")

lockCopying code is a Full Access feature.