Welcome to the Environmental Scientist’s Introduction to Python Course

This course is is an open source training course to give environmental scientists the foundation they need to begin learning and using the scientific tools that have been developed for python. The course focuses on simplifying python language into two buckets: the must haves and the nice to haves. The course is far from comprehensive, but we believe that it’s better for people to get cracking, and fill in the gaps as they develop their skills.

Expected course duration: 1-2 days

Practice Exercises

We have developed a set of practice exercises to give you a taste of doing your own scripting. These exercises are facillitated through Github Classroom, so we recommend that you wait until you have finished the lesson on version control before you begin to explore the exercises. If you want to get on to the exercises, this link will create a new repository with a copy of the exercises for you to begin working.

exercise prerequisites / associated lessons
exercise 1
exercise 2
exercise 3

Handy Builtin modules

There are a number of handy builtin modules in python. Rather than trying to cover them all in detail here, below is a a table of the most useful tools, what they do, and a link to some good learning materials:

Module with link General description
time Functions for manipulating clock time
math Provides functions for specialized mathematical operations.
datetime The datetime module includes functions and classes for doing date and time parsing, formatting, and arithmetic.
itertools The itertools module includes a set of functions for working with sequence data sets.
glob Use Unix shell rules to find filenames matching a pattern
os and os.path portable access to operating system specific features and work on filenames and paths.
shutil High-level file operations
pickle Object serialization
timeit Time the execution of small bits of Python code