Preface
- Acknowledgements
1Introduction
- 1.1Overview and Objective
- 1.2Concept of Local and Remote Machines
- 1.3Software
2Climate Data
- 2.1Climate Data Overview
- 2.2Data Use Licences
- 2.3Data Quality
- 2.4Accessing Climate Data
- 2.5Types of Climate Data
- 2.5.1Analyses and Reanalyses Products
- 2.5.2Climate and NWP Model Output
- 2.5.3Point observations
- 2.6Data File Formats
- 2.6.1Plain Text and ASCII
- 2.6.2Binary
- 2.6.3GRIB
- 2.6.4netCDF
- 2.6.5PP
3Unix
- 3.1Introduction to Unix
- 3.1.1Linux Distributions
- 3.1.2Desktop versus Server
- 3.1.3High Performance Computing on a Server
- 3.2Accessing a Remote Server
- 3.2.1Remote Server Login Details
- 3.2.2Virtual Private Network (VPN)
- 3.2.3X Window System (X11 forwarding)
- 3.2.4Connecting to a Remote Server
- 3.3First Steps on the Unix server
- 3.3.1The Terminal Window
- 3.3.2The Shell
- 3.3.3Linux Directory Structure and Home Directory
- 3.3.4Quota
- 3.3.5File Transfer to and from the Server
- 3.3.6Mapping the Linux Home Directory as a Remote Network Drive
- 3.4Some More Unix Server Basics
- 3.4.1Unix Command Syntax}
- 3.4.2Manual Pages
- 3.4.3Editing Text Files
- 3.4.4Full versus Relative Paths
- 3.4.5Special Characters
- 3.5Working with Files and Directories
- 3.5.1Creating Text Files and Directories
- 3.5.2Listing Files and Directories
- 3.5.3Moving Around in the Directory Tree
- 3.5.4Copying, Moving, Renaming and Deleting Files and Directories
- 3.6Advanced Unix Commands
- 3.6.1Examining Text Files
- 3.6.2File and Directory Properties
- 3.6.3File Permissions
- 3.6.4Changing File Permissions and Ownership
- 3.6.5Changing the Unix Account Password
- 3.6.6Redirecting Command Output
- 3.6.7Finding Files
- 3.6.8File Compression and Archives
- 3.6.9Download Files from the Command Line
- 3.7Long-running Jobs
- 3.7.1GNU Screen (recommended)
4Multi-dimensional Gridded Datasets
- 4.1The Earth’s Coordinate System and Realms
- 4.2The Model Grid
- 4.3Grid Indexing and Geographical Referencing of Data Points
- 4.4The Time Dimension
- 4.5Horizontal Resolutions and Grid Types
- 4.5.1Spectral Resolution
- 4.5.2Full and Reduced Gaussian Grid
- 4.5.3Regular latitude-longitude Grid
- 4.6Vertical Level Types
- 4.6.1Pressure, Potential Temperature and Potential Vorticity Levels
- 4.6.2Sigma (Model) Levels
- 4.6.3Sigma-Hybrid Levels
5The netCDF File Format
- 5.1Introduction to the netCDF File Format
- 5.2netCDF File Headers
- 5.2.1Exploring netCDF File Headers with ncdump
- 5.2.2Exploring netCDF File Headers with CDO
- 5.2.3Exploring netCDF File Headers with ncview
- 5.3Packed netCDF Files
- 5.4netCDF File Format Conventions
6Python - Concepts and Work Environment
- 6.1Python Overview
- 6.2Python Concepts
- 6.2.1Python Modules and Packages
- 6.2.2Package Dependencies
- 6.2.3Package Managers, Repositories and Channels
- 6.2.4Virtual Environments for Python
- 6.2.5Conda, Mamba or Micromamba?
- 6.2.6Micromamba
- 6.2.7Conda
- 6.3Python Code Development Solutions
- 6.3.1Python Code Editors
- 6.3.2Python IDEs
- 6.3.3Browser-based Python Code Editing
- 6.3.4The IPython Command Line
7Python - Programming Basics
- 7.1Basic Python Programming Building Blocks
- 7.1.1Declaring Variables
- 7.1.2Variable Types and Conversion Between them
- 7.1.3Functions
- 7.1.4Methods and Attributes
- 7.1.5Controlling the Code Flow
- 7.2Applying Python in Climate Data Analysis
- 7.2.1Error Messages when Running Code
- 7.2.2Looping Through Input Files
- 7.2.3Reading Data Files Into NumPy Variables
- 7.2.4Executing Unix System Commands from Within Python
- 7.3A Brief Introduction to Numpy
- 7.3.1Creating Numpy Arrays
- 7.3.2Indexing NumPy Arrays
- 7.3.3Saving and Loading NumPy Variables
- 7.3.4Some NumPy Solutions
- 7.4Working with Dates and Times
- 7.4.1Creating Date Objects
- 7.4.2Converting Datetime Objects to Strings (
strftime) - 7.4.3Creating a NumPy Array with Datetime Objects
- 7.5Tips and Solutions
- 7.5.1Managing Paths and Filenames Using
pathlib - 7.5.2String Formatting of Numbers
- 7.5.3Zero-padding Integer Values in Filenames
- 7.5.4Calculate Height from Geopotential with MetPy
8Python - Data Analysis with Xarray
- 8.1What is Xarray?
- 8.2Xarray Basics
- 8.2.1Xarray Terminology
- 8.2.2Import Xarray into Python Script
- 8.3Reading in netCDF Files Using Xarray
- 8.3.1Reading in a Single netCDF File
- 8.3.2Reading in Multiple netCDF Files
- 8.3.3Reading in Very Large (memory-intensive) netCDF Files
- 8.3.4Additional Considerations for Reading in netCDF Files
- 8.4DataSets vs DataArrays
- 8.5Exploring File Content
- 8.5.1Print DataSet
- 8.5.2Print DataArray
- 8.5.3Accessing DataArray Elements
- 8.6Dates and Times in Xarray
- 8.6.1Retrieving Date/Time Information Using Datetime Accessors
- 8.6.2Passing Date/Time Information to DataArray Methods
- 8.7Selections
- 8.7.1Selecting Variables
- 8.7.2sel() vs isel()
- 8.7.3Selecting Spatial Subsets (Geographical Regions)
- 8.7.4Selecting Vertical Levels
- 8.7.5Selecting Timesteps
- 8.8Resampling - Downsampling the Time Dimension
- 8.8.1Resampling to Daily Statistics
- 8.8.2Resampling to Monthly Statistics
- 8.8.3Resampling to Yearly Statistics
- 8.9Aggregation - Calculating Statistics Over Dimensions
- 8.9.1Aggregation Over the Time Domain
- 8.9.2Aggregation Over the Spatial Domain
- 8.9.3Aggregation Over the Vertical Domain
- 8.9.4Aggregation Over the Zonal Domain
- 8.9.5Aggregation Over the Meridional Domain
- 8.9.6Aggregation for Hovmöller Plots
- 8.10The Split-Apply-Combine Concept
- 8.10.1Group by Hour
- 8.10.2Group by Month
- 8.10.3Group by Season
- 8.11Interpolation
- 8.11.1Simple Interpolation Example
- 8.11.2Spatial Interpolation
- 8.11.3Interpolation Between two Geographical Points
- 8.12Xarray Computations
- 8.12.1Direct Application of Arithmetic Operation
- 8.12.2NumPy Universial Functions - ufunc()
- 8.12.3Xarray Universal Functions - apply_ufunc()
- 8.13Xarray MetPy Integration
- 8.14More Xarray Methods and Attributes to Explore
- 8.14.1Some Useful Xarray Methods
- 8.14.2Some Useful Xarray Attributes
- 8.15Xarray Plotting
- 8.16Applying Xarray in Climate Computations
- 8.16.1The 1997 Indian Ocean Dipole Event
- 8.16.2Rainfall Variability in the Sahel
- 8.16.3Winds at In Salah (Algeria)
9Python - Creating Plots
- 9.1Matplotlib
- 9.1.1Setting up a Plotting Page (Figure and Axes)
- 9.1.2Main Plotting Commands
- 9.1.3Colour Names and Colour Maps
- 9.2Line Plots
- 9.2.1Line Plot with Labels
- 9.2.2Line Plot with Arrows
- 9.2.3Multiple Lines Plot with Markers and Legend
- 9.2.4Multiple Lines Plot with two Scales
- 9.2.5Multiple Lines Plot with Standard Deviation
- 9.3Scatter Plots
- 9.3.1Scatter Plot with a Legend
- 9.3.2Scatter Plot with Divergent Colour Bar
- 9.3.3Scatter Plot on a Map with Colour Bar and Legend
- 9.3.4Adding Trend Line Based on Linear Regression
- 9.4Map Plots
- 9.4.1Cartopy Map Projections
- 9.4.2Cartopy Data Transformations
- 9.4.3High-Resolution Map Features
- 9.4.4Simple Map of SST Anomalies
- 9.4.5Map with Stipples for Statistical Significance
- 9.5Bar Graphs
- 9.5.1Anomalies Bar Graph
- 9.6Hovmöller Plots
- 9.6.1Hovmöller Plot with Time as a Function of Latitude
- 9.6.2Hovmöller Plot with Time as a Function of Pressure
- 9.7Vertical Cross-Section Plots
- 9.7.1Meridional Cross-Section
- 9.7.2Vertical Cross-Section Between two Points
- 9.8Skew-T Plots
- 9.8.1Brief Introduction to Skew-T Plots
- 9.8.2Simple Skew-T Plot
- 9.8.3Multiple Skew-T Plots
- 9.9Vector and Streamline Plots
- 9.9.1Black Wind Vectors on Filled Colour Contours
- 9.9.2Coloured Wind Vectors
- 9.9.3Streamline Plot
- 9.10Looping Through Multiple Panels
- 9.10.1Multiple Line Plots (
axes.flatmethod) - 9.10.2Multiple Line Plots (
pop()function) - 9.10.3Multiple Map Plots (
axes.flatmethod)
10Data Analysis with CDO
- 10.1What is CDO?
- 10.2Useful CDO Resources
- 10.3Basic Syntax of CDO Commands
- 10.3.1CDO Options
- 10.3.2CDO Operator Categories
- 10.3.3Using Multiple CDO Operators
- 10.3.4CDO Operator Parameters
- 10.3.5CDO Command Input and Output Files
- 10.4Merging Files
- 10.5Selections
- 10.5.1Selecting Variables
- 10.5.2Selecting Spatial Subsets (Geographical Regions)
- 10.5.3Selecting Vertical Levels
- 10.5.4Selecting Time Subsets
- 10.6Basic Statistics
- 10.6.1Statistics over the Time Domain
- 10.6.2Statistics over the Spatial Domain
- 10.6.3Statistics over the Vertical Domain
- 10.6.4Statistics over the Zonal Domain
- 10.6.5Statistics over the Meridional Domain
- 10.6.6Statistics over Ensembles
- 10.7Interpolations
- 10.7.1Interpolation to a new horizontal grid (remapping)
- 10.7.2Interpolation in the Vertical Domain
- 10.7.3Interpolation in the Time Domain
- 10.8Basic Arithmetic
- 10.8.1Artithmetic Between Two Files
- 10.8.2Arithmetic Using a Constant Value
- 10.9Applying CDO in Climate Computations
- 10.9.1Indian Ocean Dipole Example
- 10.9.2Sahel Rainfall Variability Example
- 10.9.3Creating a Land-Sea Mask File
- 10.10Using CDO with Python
Appendix
- List of Acronyms