Skip to content

Solution GOR

Calculating gas-oil ratio and converting between unit systems.

Building GOR from tagged units

import quantia as qu

# scf/STB
gas = qu.Q(1000.0, 'cf_res')
oil = qu.Q(1.0,    'STB')
gor = gas / oil

print(gor.si_value())   # 178.107...  m³/m³

# Also possible by doing the following
gor = qu.Q(1000.0, 'cf_res/STB')
print(gor.si_value())   # 178.107...  m³/m³

Converting GOR between unit systems

The SI value is the universal exchange rate:

# 1000 scf/STB expressed as m3/m3
gor_si = gor.si_value()       # 178.107 m³/m³

# Verify: build same GOR in m3 units
gas_m3 = qu.Q(1000.0 * 0.3048**3, 'm3_res')     # convert scf → m3
oil_m3 = qu.Q(0.158987294928,      'm3_sc')     # 1 STB in m3
gor_m3 = gas_m3 / oil_m3
print(gor_m3.si_value())   # 178.107... ✓

Probabilistic GOR

with qu.config(seed=1, n_samples=3000):
    gor = qu.ProbUnitFloat.triangular(800.0, 1000.0, 1300.0, 'scf/STB')

print(f"GOR P50: {gor.percentile(50).si_value():.1f} m3/m3")
lo, hi = gor.interval(0.80)
print(f"GOR P10–P90: {lo.si_value():.1f}{hi.si_value():.1f} m3/m3")