Menu


Python Codes for Statistics and Data Visualization in Climate Science

Download the Python code for the entire book:

1. Click Python to download the file named PythonforClimStatsV1_2024.zip, the zipped Python code for the entire book.
2. Go to your Downloads folder to find the PythonforClimStatsV1_2024.zip file.
3. Unzip the PythonforClimStatsV1_2024.zip file to obtain nine .ipynb files corresponding to the nine chapters of the book.
4. Run the .ipynb files in your preferred environment, such as Jupyter Notebook, Colab, or Visual Studio Python. Some parts of the computer code need to read datasets. Thus, you have to download the data.zip file before you run that part of the code. Unzip the file to obtain the data folder, which contains all the datasets needed to run the computer code. You also need to place the data folder in your working directory, which may be named climstats. Accordingly, you need to enter your correct working directory path in your R code, e.g., os.chdir("/Users/sshen/climstats").


Chapter-by-chapter Python code in html files for copy-and-paste into your Jupyter Notebook, Colab, or Visual Studio Python:
(Matthew Meier produced the html files below. He also updated this website.)

Chapter 1: Basics of Climate Data Arrays, Statistics, and Visualization
Chapter 2: Elementary Probability and Statistics
Chapter 3: Estimation and Decision Making
Chapter 4: Regression Models and Methods
Chapter 5: Matrices for Climate Data
Chapter 6: Covariance Matrices, EOFs, and PCs
Chapter 7: Introduction to Time Series
Chapter 8: Spectral Analysis of Time Series
Chapter 9: Introduction to Machine Learning



Citation: Shen, S.S.P., and G.R. North, 2023: Statistics and Data Visualization in Climate Science with R and Python, Cambridge University Press, Cambridge, United Kingdom, 391pp.