Published February 18, 2026 | Version v2
Dataset Open

Code for generating main figures in the paper of "Abrupt surface water decline during 2023–2024 record warming"

Description

Overview

This repository contains the Jupyter Notebook (Main_figure.ipynb) used to analyze global water balance anomalies and generate the figures for the associated research paper. The notebook is self-contained, with output figures displayed immediately following their respective code blocks to facilitate reproducibility and visualization.

Contents
The notebook covers the following analyses:

  • Figure 1: Global time series analysis (1991-2024) of streamflow, surface water storage, precipitation, and temperature, including uncertainty quantification.
  • Figure 2: Continental-scale spatial analysis of hydrological anomalies, featuring basin-level maps and contribution bar charts.
  • Figure 3: SHAP (SHapley Additive exPlanations) attribution analysis identifying dominant climatic drivers (Precipitation, Temperature, LAI) using ternary color mapping.
  • Figure 4: Regional precipitation anomaly analysis across CORDEX domains using a multi-product ensemble (JRA-3Q, ERA5, MSWEP).
Workflow & Data Integration

This notebook represents the final visualization stage of our study's analytical pipeline. It integrates the outputs from the previous machine learning and data processing steps:

  1. Data Ingestion: The notebook reads the consolidated datasets generated from our prior steps, specifically:
    • Simulated monthly streamflow data (from the ML framework).
    • Satellite-derived surface water storage and hydroclimatic variables (from this dataset).
    • Basin-level SHAP attribution values (from this dataset).
  2. Anomaly Calculation & Aggregation: The code processes the raw time-series data to calculate baseline climatology (e.g., 1991–2022 averages) and computes the abrupt anomalies observed during the 2023–2024 record warming period. It aggregates basin-level data (HydroSHEDS Level 4) to continental and global scales for macroscopic analysis.
  3. Spatial & Statistical Rendering: Utilizing geospatial libraries (geopandascartopy), the notebook maps the basin-level anomalies and SHAP dominant drivers onto global projections. It also calculates and plots the uncertainty bounds (standard deviations) across the multi-product ensembles.

Technical Details

  • Language: Python 3.12
  • Key Dependencies: pandas, numpy, matplotlib, geopandas, cartopy, xarray, rioxarray, py-cordex.
  • Installing the required dependencies via `pip` or `conda` typically takes 10–15 minutes on a standard desktop computer. 
  • Expected Run Time: Executing the entire notebook cell-by-cell takes less than 15 minutes on a standard desktop computer.

Files

Main_figure.ipynb

Files (12.9 MB)

Name Size Download all
md5:1b077dcbbe5c85ae1adb15ad9ececff0
12.9 MB Preview Download