Practice Exercises
Every exercise runs in your browser with Python. Use progressive hints when you get stuck, click Check answer to validate your work, and your progress is saved locally.
Chapter 1: Python Setup for Petroleum Engineering
(5 exercises)1.1 Install and Verify
1.2 Mud Weight Window
1.3 Unit Converter
1.4 Bottomhole Pressure Report
1.5 Comparing Mud-Weight Options
Chapter 2: Python Essentials
(6 exercises)2.1 Formation Pressure Gradient
2.2 Productivity Index
2.3 Temperature Gradient
2.4 Production Alert System
2.5 Unit Consistency Checker
2.6 Daily Production Report Cleaner
Chapter 3: Data Structures
(10 exercises)3.1 Casing String Inventory
3.2 Well Header Builder
3.3 Production Data Reconciliation
3.4 JSON Well Completion Report
3.5 LAS File Explorer
3.6 Water Cut Trend Classifier
3.7 Drilling Fluid Inventory
3.8 Multi-Well Production Comparison
3.9 Formation Tops Database
3.10 Data Format Converter
Chapter 4: NumPy & Pandas
(10 exercises)4.1 Vectorized PVT Calculations
4.2 Production Data Loader
4.3 Decline Rate Calculator
4.4 Data Cleaning Pipeline
4.5 Multi-Well Comparison Dashboard
4.6 Cumulative Production & EUR
4.7 Allocation Reconciliation
4.8 Well Ranking System
4.9 Pressure Survey Analysis
4.10 Field Summary Dashboard
Chapter 5: Data Visualization & Plotting
(10 exercises)5.1 Decline Rate Comparison
5.2 Waterflood Surveillance Dashboard
5.3 Extended Well Log Display
5.4 Regional Comparison with Seaborn
5.5 Multi-Well Production Overlay
5.6 Porosity-Permeability Crossplot
5.7 Production Ranking Bar Chart
5.8 Field Bubble Map
5.9 Cumulative Production with Milestones
5.10 Field Report Multi-Panel Capstone
Chapter 6: Petroleum Data Sources
(10 exercises)6.1 LAS File Inspection
6.2 Null Value Detection
6.3 Production Data Loader
6.4 Unit Converter for Log Data
6.5 Multi-Well Data Merge
6.6 Data Gap Analysis
6.7 Outlier Detection by Well
6.8 LAS to DataFrame Pipeline
6.9 Multi-Well Production Analysis
6.10 Data Quality Dashboard
Chapter 7: Well Log Analysis
(10 exercises)7.1 GR Endpoint Sensitivity
7.2 Non-Linear Vshale (Larionov Tertiary)
7.3 Density-Neutron Crossplot
7.4 Archie Parameter Sensitivity
7.5 Net Pay Cutoff Sensitivity
7.6 Multi-Well Comparison
7.7 Pay Zone Statistics + HPT Ranking
7.8 LAS-Driven Petrophysics on OD-007
7.9 Shaly-Sand Sw: Simandoux vs Archie
7.10 Automated Petrophysical Report
Chapter 8: PVT Correlations
(10 exercises)8.1 Standing vs. Vasquez-Beggs Rs
8.2 Bo vs Pressure - Bubble-Point Peak
8.3 Viscosity Profile by API Gravity
8.4 Z-Factor Table via Dranchuk-Abou-Kassem
8.5 Gas Volume & Expansion
8.6 Correlation Tuning
8.7 Build a PVT Report
8.8 Bubble Point vs. Temperature
8.9 Heavy-Oil Dead Viscosity vs API
8.10 Complete Fluid Characterization
Chapter 9: Decline Curve Analysis
(10 exercises)9.1 Exponential vs Hyperbolic
9.2 The b-Factor
9.3 Forecasting with Limited Data
9.4 Abandonment Rate Sensitivity
9.5 Modified Hyperbolic - Bounding a b>1 Shale Well
9.6 Rate-Cumulative (q vs Np)
9.7 Detecting a Decline-Regime Change
9.8 Portfolio DCA
9.9 DCA vs Volumetric Reserves
9.10 Probabilistic P10/P50/P90 EUR
Chapter 10: Material Balance
(10 exercises)10.1 MBE Term Identification
10.2 Undersaturated Reservoir OOIP (Havlena-Odeh)
10.3 Drive-Mechanism Diagnosis
10.4 Solution Gas Drive Below the Bubble Point
10.5 Gas-Cap Effect on OOIP
10.6 Schilthuis Water Influx
10.7 OOIP Sensitivity Tornado
10.8 Campbell Plot - Flat Means Depletion
10.9 Recovery Factor So Far
10.10 Complete Material Balance Study
Chapter 11: Reservoir Simulation
(10 exercises)11.1 Grid-Refinement Study - When Does the Answer Stop Moving?
11.2 Permeability Heterogeneity - A Low-k Streak Throttles the Flow
11.3 Injection-Production Pair - Pressure Support & Mass Balance
11.4 The CFL Condition - Why Explicit Time-Stepping Pays the Price
11.5 Time-Step Sensitivity of the Implicit Simulator
11.6 Fractional Flow vs Mobility Ratio
11.7 Analytical Validation - Simulator vs the Ei Line-Source
11.8 Boundary Conditions - No-Flow vs Aquifer Support
11.9 Corey Exponent Sensitivity
11.10 Capstone - A 2D Quarter-Five-Spot Pressure Solver
Chapter 12: Nodal Analysis
(10 exercises)12.1 Linear IPR - Straight-Line Inflow for an Undersaturated Reservoir
12.2 Vogel IPR from Test Data - Back-Solving Absolute Open Flow
12.3 Composite IPR Construction - Bubble-Point Transition Rate
12.4 Fetkovich from Multi-Rate Test - Log-Log Deliverability Fit
12.5 Tubing Size Comparison - TPR Curves Across Tubing IDs
12.6 Operating Point Determination - IPR/TPR Intersection
12.7 Wellhead Pressure Sensitivity - When the Well Dies
12.8 Gas Lift Optimization - Operating Point, Incremental Oil & Economics
12.9 Declining Reservoir Pressure - Stable-Limb Operating Point & Artificial-Lift Trigger
12.10 Full Nodal Analysis Report - Operating Point, Sensitivity & Recommendation
Chapter 13: Production Optimization
(10 exercises)13.1 Basic Rate Allocation - Pipeline-Constrained Oil & Profit LP
13.2 Adding a Gas Constraint - When Gas Handling Bites Before the Pipeline
13.3 Water Disposal Cost - Net-Revenue Allocation
13.4 Gas Lift Marginal Analysis - Diminishing Returns
13.5 Multi-Well Gas Lift - Constrained Compressor Allocation
13.6 Choke Size Optimization - Nodal Sizing at the Separator Floor
13.7 Anomaly Detection Tuning - Surveillance Window & Sigma Sweep
13.8 Decline-Aware Allocation - 12-Month Re-Optimization
13.9 ESP vs. Gas Lift Economic Comparison
13.10 Full Field Optimization Report - Constrained Oil & Profit Allocation
Chapter 14: Drilling Analytics
(10 exercises)14.1 Drilling Data Cleanup - Filter to Active Drilling Intervals
14.2 MSE Calculation - Drilling Efficiency from Mechanical Specific Energy
14.3 Bit Run Analysis - Footage, ROP, MSE & Cost per Foot
14.4 Stick-Slip Severity Index - Torque CV & ROP Loss
14.5 Optimal WOB and RPM - Mining the Drilling Sweet Spot
14.6 ROP Model with Domain Features - Engineering Beats Raw Channels
14.7 Non-Productive Time Analysis - Productive vs NPT & Invisible Lost Time
14.8 Offset Well Comparison - Composite Best Time-Depth Curve
14.9 Cost per Foot Optimization - When to Trip for a Fresh Bit
14.10 Drilling Performance Dashboard - One-Page Well Summary
Chapter 15: Gas Engineering
(10 exercises)15.1 Z-Factor Sensitivity - Gas Gravity & the DAK Dip
15.2 Gas Property Module - Z, Bg, Density, Viscosity & Compressibility Table
15.3 Gas Material Balance - P/Z Plot & Original Gas In Place
15.4 Gas Well Deliverability - Backpressure & Forchheimer AOF
15.5 Pipeline Pressure Profile - P² is Linear, Pressure is Not
15.6 Looped Pipeline - Debottlenecking with a Parallel Line
15.7 Compression Staging - Horsepower & Discharge Temperature vs. Stages
15.8 Gas Gathering System - Pipeline Sizing & Station Compression
15.9 Gas Dehydration - Water Content & Dew-Point Spec
15.10 Integrated Gas Field Development - Wells, Pipeline, Compression & Reserves
Chapter 16: ML Fundamentals
(4 exercises)16.1 Predict Water Saturation - Random Forest & Archie's Resistivity
16.2 Feature Engineering Bake-Off - Does It Help the Linear Model or the Forest?
16.3 The Overfitting Curve - Tree Depth and the Bias-Variance Sweet Spot
16.4 Honest vs. Dishonest Evaluation - Data Leakage, Held-Out Test, and Cross-Validation
Chapter 17: Supervised Learning
(4 exercises)17.1 The Cost-Weighted Threshold - Pricing Missed Gas vs False Alarms
17.2 Reading a Confusion Matrix - The Most-Confused Facies Pair
17.3 Does More Data Beat a Better Threshold?
17.4 A Fifth Facies - Why a Distinct Rare Class Is Easy
Chapter 18: Unsupervised Learning
(4 exercises)18.1 Force the Gas Sand to Separate - A Physics Feature for Clustering
18.2 The Cost of Choosing k Wrong - ARI vs k for Electrofacies
18.3 Tuning the QC Sensitivity - Recall/Precision vs Contamination
18.4 Catch the Flatline - Contextual vs. Magnitude Anomaly Detection
Chapter 19: Real-World Projects
(6 exercises)19.1 Tune the QC Net - Precision vs Recall on a Logging Run
19.2 Does the Stress Case Still Clear? - Break-even Oil Price
19.3 The Over-Booking Trap - Capped vs Uncapped EUR
19.4 Blind-Well Honesty - Leave-One-Well-Out vs a Leaky Split
19.5 Find the Real Underperformer - Difficulty-Normalised Drilling Cost
19.6 What Is the Appraisal Well Worth? - Value of Information