An introduction to the Python language and to the most commonly used Python plotting and analysis libraries in the sciences, including MatPlotLib and NumPy.
Note that there are two editions of this book: 1) spiral-bound 8.5″x11″ student edition (available only through this website); and 2) a standard paperback 7″x10″ edition (available on Amazon and overseas).
View an excerpt, including table of contents, index, and the first two chapters, here.
Python has rapidly become a dominant language in the scientific community for analyzing and visualizing data, in part due to its concise, intuitive syntax and free availability without the purchase of an expensive license. The syntax of the language itself is easy to pick up, but learning how to plot, visualize, and analyze scientific data has required more effort in the past, as the relevant resources are spread across the Internet. Hence, the idea for this book. Specifically, the author wrote it from the perspective of “What book would I have wanted to have when I was transitioning to Python?”
This book will be useful not only as a classroom text but also as a guide and reference for students, educators, and researchers who have some programming experience already and want to start creating plots and analyzing data using Python. It is not meant for the person who is completely new to programming, nor is it an introductory computer science textbook. The author’s assumption is that the reader has some experience programming, though not necessarily with Python.
Although the new Python programmer may wish to read the book cover to cover, the book is organized such that the experienced Python programmer who wants to get started in plotting data can readily jump to the appropriate chapter. The last few chapters include topics that are more advanced, such as using regular expressions for matching text patterns, performing spectral analysis of data, and solving systems of linear equations.
I. Basic Python programming
- Getting started
- Syntax and data types
- Mathematical operators and functions
- Flow control
- File I/O
- Numpy arrays
- Functions and modules
- Defining classes and methods
II. Plotting and visualization with Matplotlib
- 1-D plotting
- Multi-panel plots
- 2-D plotting
- Reading scientific data sets
- 3-D plotting
III. A few advanced topics
- Regular expressions
- Fourier analysis
- Interpolation, linear regression, and simple statistics
- Smoothing of data
- Numerical differentiation and integration
- Physical constants
- Solving systems of linear equations
- Special mathematical functions
- Speed and optimization of code
The book includes numerous figures (many in color), tables, and executable example programs.
Alex J. DeCaria is a professor of meteorology at Millersville University, where among other courses he teaches a class in Python programming and visualization for undergraduate meteorology and ocean sciences majors. He has also taught a Short Course on Introductory Python for the American Meteorological Society. He is lead author as well of A First Course in Atmospheric Numerical Modeling. His other courses at Millersville University include atmospheric dynamics, thermodynamics, physical meteorology, tropical meteorology, and geographic information systems. He is also a former meteorology and oceanography officer with the U.S. Navy.
This document lists all known errors that have been found in early printings of this book. They will be corrected in later printings.
2. Sample data files
The following files are required for certain exercises in the book. On most systems, you will need to right-click (Windows) or control-click (Mac OSX) to “save as” a local file.
- samplesounding.txt (p. 69)
- uandv.npz (p. 149)
- heights.npy (p. 149)
- hgt.mon.1981-2010.ltm.nc (p. 169)
- GMI_sample.HDF5 (p. 178)
- jan1000mb.npz (p. 187)
- Alex J. DeCaria
- Sundog Publishing
- Publication Date:
- Spiral bound 8.5″ x 11″
- 63 (26 color)