An introduction to Python for non-programmers using oceanography data.
If you cannot install Anaconda/Python on your computer, then you can launch a Jupyter Lab instance online using MyBinder. Click on the Launch Binder icon below to do this.
This lesson teaches novice programmers to write modular code to perform data analysis using Python. The emphasis, however, is on teaching language-agnostic principles of programming such as automation with loops and encapsulation with functions, see Best Practices for Scientific Computing and Good enough practices in scientific computing to learn more.
The example used in this lesson analyses some model-generated waveheight data. Learners are shown how it is better to automate analysis using functions instead of repeating analysis steps manually.
The rendered version of the lesson is available at: https://edcarp.github.io/python-novice-esces/.
This lesson is derived from the Analaysis of Inflammation Data lesson. Neil Chue Hong, Chris Wood, Lucy Bricheno, and Daniel Barker were awarded a NERC Advanced Short Training Course Grant to run Software Carpentry Courses specifically for NERC domain scientists, to include providing domain-specific examples. The wave-height data was taken from. Bricheno & Wolf (2018) 'Future wave conditions of Europe, in response to high‐end climate change scenarios.' Journal of Geophysical Research: Oceans.
# | Episode | Time | Question(s) |
---|---|---|---|
1 | Python Fundamentals | 30 | What basic data types can I work with in Python? How can I create a new variable in Python? Can I change the value associated with a variable after I create it? |
2 | Analyzing Waveheight Data | 60 | How can I process tabular data files in Python? |
3 | Visualizing Tabular Data | 50 | How can I visualize tabular data in Python? How can I group several plots together? |
4 | Storing Multiple Values in Lists | 30 | How can I store many values together? |
5 | Repeating Actions with Loops | 30 | How can I do the same operations on many different values? |
6 | Analyzing Data from Multiple Files | 20 | How can I do the same operations on many different files? |
7 | Making Choices | 30 | How can my programs do different things based on data values? |
8 | Creating Functions | 30 | How can I define new functions? What’s the difference between defining and calling a function? What happens when I call a function? |
9 | Errors and Exceptions | 30 | How does Python report errors? How can I handle errors in Python programs? |
10 | Defensive Programming | 30 | How can I make my programs more reliable? |
11 | Debugging | 30 | How can I debug my program? |
12 | Command-Line Programs | 30 | How can I write Python programs that will work like Unix command-line tools? |
We welcome all contributions to improve the lesson! Maintainers will do their best to help you if you have any questions, concerns, or experience any difficulties along the way.
We'd like to ask you to familiarize yourself with our Contribution Guide and have a look at the more detailed guidelines on proper formatting, ways to render the lesson locally, and even how to write new episodes!
The lesson maintainer is Chris Wood.
Instructional material from this lesson is made available under the Creative Commons Attribution (CC BY 4.0) license. Except where otherwise noted, example programs and software included as part of this lesson are made available under the MIT license. For more information, see LICENSE.md.
To cite this lesson, please consult with CITATION.
Software Carpentry is a volunteer project that teaches basic computing skills to researchers since 1998. More information about Software Carpentry can be found here.
The Carpentries is a fiscally sponsored project of Community Initiatives, a registered 501(c)3 non-profit organisation based in California, USA. We are a global community teaching foundational computational and data science skills to researchers in academia, industry and government. More information can be found here.