Practical Python Programming for Engineers

The 21st century petroleum engineer faces new and extraordinary challenges. They must learn to do more with less, solving ever-more-difficult problems with limited resources, in the face of a highly dynamic industry and market. The skillful use of our era's most defining invention---the general-purpose computer---is the most powerful force multiplier an individual engineer can bring to bear. This means embracing computer programming as an engineering discipline and a core competency.

Engineers and other petroleum technical professionals are uniquely well-equipped to learn programming skills, the same way as any other engineering discipline: from the fundamentals. In addition to empowering the individual engineer, programming is also the first step on the path to learning data science, machine learning, AI, and other emergent disciplines at the intersection of engineering, statistics, and computing.

In this course, students will advance their existing programming skills to a more sophisticated level by tackling challenging real-world case studies, in which we'll solve engineering and business problems together by designing and building useful and robust software systems. This is a course about programming as an engineering discipline. Students will learn how to translate business challenges into programming problems, and in turn solve these as engineering problems. This is not a Python language class or a theoretical computer science class, but students will learn some advanced skills in these areas along the way.

This is a practical, goal-oriented class. The overall objective is to teach engineers how to take their software design and development skills to the next level, working the way professional programmers work, primarily through case studies and instructor-led coding sessions. Among other case studies, we'll automate tedious engineering calculations, develop flexible tools for decline-curve analysis, and construct a sophisticated system for probabilistic assessment of project economics.

Content duration: (13:32 hours)

Subscribe now to gain access to all SAGA Wisdom Training Content Subscribe

    Chapter 1 – Philosophy and Praxis

    In this chapter, we'll open by discussing the course objectives.

    We'll then learn about the pragmatics of programming, exploring useful tools like text editors, version-control systems, and command-line shells.

    Finally, we'll introduce the Python programming language, then walk through the process of installing the Python interpreter in a live-coding session which culminates in the (in)famous "hello world" program.

    1.01 Philosophy (8 min.)  Sample Lesson

    1.02 Praxis I: The Command Line (14 min.) Quiz

    1.03 Praxis II: Version Control (25 min.) Quiz

    1.04 Praxis III: Text Editors (13 min.) Quiz

    1.05 Praxis IV: Python (20 min.) Quiz

    1.06 Praxis V: Python II (14 min.) Quiz

    Chapter 2 – Python Review & Programming Like an Engineer

    In this chapter, we'll quickly review the semantics of the Python language, using an "abstract machine" model to build our intuitions.

    Then, we'll discuss the ongoing and long-running "software crisis", and consider how we might take an engineering approach to programming, using tools like type systems and automated testing.

    2.01 Python Review (12 min.) Quiz

    2.02 Functional Python (19 min.) Quiz

    2.03 Programming Like An Engineer I: Games For Computers (19 min.) Quiz

    2.04 Programming Like An Engineer II: Types in Python (17 min.) Quiz

    2.05 Programming Like An Engineer III: Testing in Python (17 min.) Quiz

    Chapter 3- Functional Decomposition

    In this chapter, we'll (re-)introduce a key skill of engineering - and of software design.

    We'll apply the technique of functional decomposition to a case study about volumetric estimation of petroleum reserves, and build our first "real-world" Python program.

    Along the way, we'll also cover some Python paraphernalia including error handling, input and output, lazy evaluation, "code sandwiches", and how to parse CSV files without pandas or any other kind of bear.

    3.01 Case study introduction: volumetric reserves estimation (8 min.) Quiz

    3.02 Functional decomposition (8 min.) Quiz

    3.03 Case study live coding I (42 min.)

    3.04 Python miscellany: I/O, iterators, "code sandwiches" (20 min.) Quiz

    3.05 Case study live coding II (33 min.) Quiz

    Chapter 4 – Data-Driven Design

    This chapter introduces the concept of "data-driven design" through a case study about using Monte Carlo simulation for economic modeling.

    In data-driven design, we move repetitive program logic from code into data structures, simplifying our programs.

    Along the way, we'll discuss some of Python's various data structures, learn about trees, pass the coding interview, and work out how to accommodate it all in a static type system.

    4.01 Case Study - Monte Carlo Economic Evaluation (5 min.) Quiz

    4.02 Dumb Code, Smart Data (42 min.) Quiz

    4.03 Arboriculture 101 and Intro to Fake Randomness (24 min.) Quiz

    4.04 Python Fukubukuro II (18 min.) Quiz

    4.05 Case Study - Live Coding (20 min.)

    Chapter 5 – Numerical Python

    There's no denying it: Python is slow. For various reasons, we're stuck with the language, but not stuck with the speed!

    In this chapter, we'll learn why Python is slow, why it matters for engineering and technical applications, and introduce the NumPy library and other tools for getting more speed out of Python.

    Along the way, we'll also learn a very little bit about how modern computers actually work, a subject Python takes great efforts to obscure.

    5.01 Batteries Not Included (20 min.) Quiz

    5.02 NumPy in a Numpshell (19 min.) Quiz

    5.03 Monte Carlo with NumPy (24 min.)

    Chapter 6 - Interfaces Over Implementations

    We've arrived at the core of Python: object-oriented programming.

    But what on earth does "object-oriented" actually mean - and do any two programmers agree about it?

    In this chapter, we'll explore the separation of interface from implementation through a case study about petroleum decline curve analysis.

    We'll learn how - properly applied - object-oriented techniques can make our programs more flexible and future-proof.

    Along the way we'll also complain, a lot, about Python.

    6.01 Case Study: Decline Curve Analysis (6 min.) Quiz

    6.02 The Essence of Object-Oriented Programming (26 min.) Quiz

    6.03 Abstracting Over Declines (42 min.)

    6.04 Putting Re-Use to the Test (32 min.) Quiz

    6.05 Against Chaos (10 min.) Quiz

    Chapter 7 - Parting Thoughts

    If you're reading this description, you've either made it through six fairly heavy chapters, or skipped ahead to the end to see what happens.

    Either way, we salute you!

    In this chapter, we'll conclude the course by summarizing what we've learned and provide some hints for next steps in the world of Python programming.

    We'll also examine programming beyond Python through a survey of several languages with very different semantics.

    Along the way, we'll beat dead memes into the ground, insult the memory of Galileo, and understand the true value of Python by considering a bucket of mussels.

    7.01 What Have We Done? (6 min.)

    7.02 The Wide World of Python (22 min.) Quiz

    7.03 Programming Beyond Python I (20 min.) Quiz

    7.04 Programming Beyond Python II (19 min.) Quiz

    7.05 Programming Beyond Python III (9 min.) Quiz