This notebook produces the “What the Data Looks Like” plots for the CHIRPS data source page: the mean annual rainfall map for Southern Africa, and the monthly climatology and daily time series for Tete.
Inputs (from ../data/, produced by CHIRPS_Download&Process.ipynb): - Fig1_PRCPTOT_daily_CHIRPS-3.0-0p05-rnl_199101-202012_SouthernAfrica.nc - Fig2_PRCPTOT_mon_CHIRPS-3.0-0p05-rnl_199101-202012_climatology_Tete.csv - Fig3_PRCPTOT_daily_CHIRPS-3.0-0p05-rnl_19810101-20260430_Tete.csv
Outputs:Fig1_CHIRPS_MeanAnnualRainfall_1991-2020.png, Fig2_CHIRPS_Climatology_Tete_1991-2020.png, Fig3_CHIRPS_TimeSeries_Rainfall_1981-2026.png, saved to ../images/ - numbered to match their order on the data source page, mirroring the Vis1-Vis6 convention used in the Visualisations section.
Step 1: Setup
Show the code
import osimport pandas as pdimport xarray as xrimport cartopy.crs as ccrsimport cartopy.feature as cfeatureimport matplotlib.pyplot as plt# Southern Africa map extent, used to frame the first plotlat_min, lat_max =-35, 0lon_min, lon_max =10, 42# Make sure the output folder exists before we try to save anything into itos.makedirs('../images', exist_ok=True)
Mean Annual Rainfall - Southern Africa
Spatial map of mean annual rainfall across Southern Africa, averaged over the 1991-2020 climatology period.