The Entire Book Python Code for Climate Mathematics
The latest version of the Python code in .ipynb:
Download the Python Version 3.0 code .ipynb in a zip file. This version was released in July 2022.
Unzip the .zip file to obtain the .ipynb file. You can then open this file using Jupyter Notebook or Colab.
To run the code completely, you also need to
download the data.zip file.
Unzip the file to obtain the data folder, which contains all the datasets needed to run the .ipynb file.
You also need to place the data folder in your working directory, which may be
named climmath. Accordingly, you need to enter your correct working directory path in the
Python code, e.g., os.chdir("/Users/sshen/climmath").
The Python code release history for climate mathematics in .thml:
- 1. Jupyter Notebook, Version 1.0.
This original version was released in 2018 and its map plotting uses the Basemap module.
- 2. Jupyter Notebook: Version 2.0.
This version uses Cartopy module for map plotting.
- 3. Jupyter Notebook: Version 3.0.
This version features the use of both Basemap and Cartopy modules,
and allows a user to choose either Basemap or Cartopy to plot maps.
The Chapter-by-Chapter Python Code
for Climate Mathematics
Version 3.0, July 2022
(.ipynb file displayed in html. You can copy and paste the code cell-by-cell into your Jupyter Note book or Colab,
and run the code. )
- Chapter 1. Dimensional Analysis for Climate Science: This chapter has no code.
- Chapter 2. Basics of Python Programming
- Chapter 3: Basic Statistical Methods for Climate Data Analysis
- Chapter 4: Climate Data Matrices and Linear Algebra
- Chapter 5: Energy Balance Models for Climate
- Chapter 6: Calculus Applications to Climate Science I: Derivatives
- Chapter 7. Calculus Applications to Climate Science II: Integrals: This chapter has no code.
- Chapter 8. Conservation Laws in Climate Dynamics: This chapter has no code.
- Chapter 9: Python Graphics for Climate Science
- Chapter 9: Basemap Version: Python Graphics for Climate Science
Some computers may not run the newer map tool Cartopy due to software conflicts.
We thus have a Basemap version of the code using the older map tool Basemap.
In the Basemap version, you may comment out Cartopy when the Cartopy package causes problems for you.
- Chapter 10: Advanced R Analysis and Plotting: EOFs, Trends, and Global Data
- Chapter 10 Basemap Version: Advanced R Analysis and Plotting: EOFs, Trends, and Global Data
- Chapter 11: Python Analysis of Incomplete Climate Data
- Chapter 11: Basemap Version: Python Analysis of Incomplete Climate Data
Citation: Shen, S.S.P., and R.C.J. Somerville, 2019:
Climate Mathematics: Theory and Applications,
Cambridge University Press, Cambridge, United Kingdom, 391pp.