Skip to content

TongLi-97/Global_regional_attribution_Dec2025

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code for "How close are IPCC regions to their 1.5° and 2°C equivalent warming limits?"

Python code for the paper “Li, T., F. Zwiers, X. Zhang, Q. Sun: How close are IPCC regions to their 1.5° and 2°C equivalent warming limits?, submitted to Nature Climate Change"

Author

Tong Li

Overview

This repository contains the Python code and example data used in the analysis for the manuscript submitted to Nature Climate Change.

The analysis is implemented using Jupyter Notebooks and standard scientific Python libraries.

The code is intended to support transparency and reproducibility of the results presented in the manuscript.

1. System requirements

Operating systems

The code has been tested on:

  • macOS Tahoe (26.1)

It is expected to run on other modern Linux, Windows and macOS systems.

Software requirements

  • Python 3.9–3.13 (Python 3.13.2, tested)
  • Jupyter Notebook or JupyterLab

Python package dependencies

The required Python packages are listed in requirements.txt and include:

  • numpy (≥1.23)
  • scipy (≥1.9)
  • pandas (≥1.5)
  • xarray (≥2023.1)
  • netCDF4 (≥1.6)
  • cftime (≥1.6)
  • matplotlib (≥3.6)
  • cartopy (≥0.21)
  • shapely (≥2.0)
  • pyproj (≥3.5)
  • regionmask (≥0.12)
  • dask (≥2023.1)
  • distributed (≥2023.1)
  • intake (≥0.7)
  • intake-esm (≥2023.1)
  • cf_xarray (≥0.9)
  • xesmf (≥0.8)

Hardware requirements

No non-standard hardware is required.
All analyses can be run on a standard desktop or laptop computer.

Additional notes

Some packages (e.g. cartopy, xesmf) require system-level libraries such as PROJ, GEOS, and ESMF.
These dependencies are commonly available via standard package managers and conda distributions.


2. Installation guide

Instructions

  1. Clone or download this repository:

    git clone <rhttps://github.com/TongLi-97/Global_regional_attribution_Dec2025>
    cd <Global_regional_attribution>
  2. (Recommended) Create and activate a virtual environment:

     python -m venv venv
     source venv/bin/activate
  3. Install the required Python packages:

    pip install -r requirements.txt
  4. Launch Jupyter Notebook:

    jupyter notebook

3. Typical installation time

Approximately 5–10 minutes on a normal desktop computer with an existing Python installation.

4. Input data

This study uses monthly values of observed temperature (HadCRUT5.0.2) available at https://www.metoffice.gov.uk/hadobs/hadcrut5/, and the monthly temperature simulated by CMIP6 climate models available at https://esgf-node.llnl.gov/search/cmip6/. These monthly values have been converted to annual mean temperature for the subsequent analyses.

Only the HadCRUT ensemble mean data was stored in the ./input_file folder, as the other data are too large.

5. Folder: ./saved_data

All intermediate and processed data files are stored in the ./saved_data directory.
Files named 0.*.pkl, which are generated by the corresponding scripts 0.*.ipynb, are the files used in the analyses presented in this paper.

6. Folder ./functions

All the defined functions used in the scripts are saved in the ./functions directory.

7. Usage of scripts

Part 1: Data pre-processing

0.0_HadCRUT5.ipynb

This notebook processes HadCRUT5 observational data to compute annual mean surface air temperature anomalies for AR6 regions, continental-scale means, and the global land mean. It also generates the corresponding figures used in the analysis.

Input
  • ./input_file/HadCRUT.5.0.2.0.non-infilled.anomalies.ensemble_mean.nc
Output
  • ./saved_data/0.1.HadCRUT5.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
Typical run time

Approximately 1 minute on a normal desktop computer.


0.1_HadCRUT5_200runs.ipynb

This notebook performs the same processing as 0.0_HadCRUT5.ipynb, but for the 200-member HadCRUT5 ensemble.

Input
  • 200 ensemble member files located in ~/non-infilled_ensemble_grid/
Output
  • ./saved_data/0.2.HadCRUT5.200runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
Typical run time

Approximately 5 minutes on a normal desktop computer.

Note

The input data required for this script are too large to be included in the repository.


0.2_large_ensembles.ipynb

This notebook performs similar processing to 0.0_HadCRUT5.ipynb, but for 320 ensemble members from six large-ensemble climate models.

Input
  • 0.6large_ensembles.320runs.1850-2100.2.5deg.Grids.Anom.1961-1990.pkl
Output
  • ./saved_data/0.2.HadCRUT5.200runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
Typical run time

Approximately 5 minutes on a normal desktop computer.

Note

The input data required for this script are too large to be included in the repository.


0.3_model_ALL_nat_GHG.ipynb

This notebook processes performs similar processing to 0.0_HadCRUT5.ipynb, but for simulations of ALL, NAT, and GHG from all models used in this study. Summary datasets for all simulations used in this study, along with diagnostic figures, are generated in this step.

Input
  • Model simulation data for all models and forcings used in this study
Output
  • ./saved_data/0.4.His-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.4.His-ANT.NAT.GHG.OA.10mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.4.His-Fu-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_251years_1850-2100.pkl
  • ./saved_data/0.5.pseudo-model.15mod.run1-3.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_176years_1850-2025.pkl
Typical run time

Approximately 8 minutes on a normal desktop computer.

Note

The input data required for this script are too large to be included in the repository.


0.4_his_mod_smooth_5forcings.ipynb

This notebook applies temporal smoothing to the processed simulations for all models and forcings.

Input
  • ./saved_data/0.4.His-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.4.His-ANT.NAT.GHG.OA.10mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.4.His-Fu-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_251years_1850-2100.pkl
Output
  • ./saved_data/0.4.Smoothed_His-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.4.Smoothed_His-ANT.NAT.GHG.OA.10mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.4.Smoothed_His-Fu-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_251years_1850-2100.pkl
Typical run time

Approximately 10 minutes on a normal desktop computer.


Part 2: Imperfect model test

1.0.0_IPM_46reg_calculate.ipynb

This notebook performs the imperfect model test (IPM) analysis. Constraint results are calculated under the imperfect model world using six constrained schemes for all AR6 regions.

Input
  • ./saved_data/0.1.HadCRUT5.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
  • ./saved_data/0.2.HadCRUT5.200runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
  • ./saved_data/0.3.Large_ensembles.320runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_251years_1850-2100.pkl
  • ./saved_data/0.4.Smoothed_His-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.5.pseudo-model.15mod.run1-3.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_176years_1850-2025.pkl
Output
  • ./saved_data/1.0_IPM_Prior_posterior_Pseudo_warming_period_2016-2025_ref1850-1900.pkl
Typical run time

Approximately 15 minutes on a normal desktop computer.


1.1_IPM_Fig.4_compare_plot.ipynb

This notebook computes three evaluation metrics—confidence ratio, uncertainty interval width, and uncertainty interval coverage for all AR6 regions, and generates Fig. 4 in the paper.

Input
  • ./saved_data/1.0_IPM_Prior_posterior_Pseudo_warming_period_2016-2025_ref1850-1900.pkl
Output
  • Figure 4 and related supplementary figures
Typical run time

Approximately 1 minute on a normal desktop computer.


1.2_IPM_Fig.2_confidence_plot.ipynb

This notebook computes the confidence ratio for all AR6 regions and the global land mean, and generates Fig. 2 in the paper.

Input
  • ./saved_data/1.0_IPM_Prior_posterior_Pseudo_warming_period_2016-2025_ref1850-1900.pkl
Output
  • Figure 2 and related supplementary figures
Typical run time

Approximately 1 minute on a normal desktop computer.


Part 3: Constraint on real observations

2.0_real_constrain_result_46reg_lsat.ipynb

This notebook applies the best-performing constraint scheme to real observational data to estimate constrained responses for ALL, NAT, ANT, GHG, and OA forcings. Related supplementary figures are also generated.

Input
  • ./saved_data/0.1.HadCRUT5.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
  • ./saved_data/0.2.HadCRUT5.200runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
  • ./saved_data/0.3.Large_ensembles.320runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_251years_1850-2100.pkl
  • ./saved_data/0.4.Smoothed_His-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.5.pseudo-model.15mod.run1-3.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_176years_1850-2025.pkl
Output
  • ./saved_data/2.0.real_obs_constrain_prior_post_warming_2016-2025_ref1850-1900.nc
  • ./saved_data/2.1.real_obs_constrain_prior_post_smoothed_series_1850-2025_ref1850-1900.nc
  • Related supplementary figures
Typical run time

Approximately 5 minutes on a normal desktop computer.


2.1_constraint_budget_1.5_2_deg_46reg_lsat.ipynb

This notebook calculates constrained warming outcomes under 1.5 °C and 2 °C global warming thresholds.

Input
  • ./saved_data/0.1.HadCRUT5.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
  • ./saved_data/0.2.HadCRUT5.200runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
  • ./saved_data/0.3.Large_ensembles.320runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_251years_1850-2100.pkl
  • ./saved_data/0.4.Smoothed_His-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.5.pseudo-model.15mod.run1-3.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_176years_1850-2025.pkl
Output
  • ./saved_data/2.2_constrained_46reg_lsat_smoothed_warming_ref2025_1850-2100.pkl
  • ./saved_data/2.2_constrained_46reg_lsat_smoothed_warming_ref1850_1850-2100.pkl
Typical run time

Approximately 2 minutes on a normal desktop computer.


2.2_plot_budget_1.5_2_deg_46reg_lsat.ipynb

This notebook constrains global mean temperature and conducts regional analyses under 1.5 °C and 2 °C global warming thresholds. Detailed methods are described in the manuscript section “Regional warming at Paris thresholds”. This notebook generates Fig. 1b–c and related supplementary figures.

Input
  • ./saved_data/2.2_constrained_46reg_lsat_smoothed_warming_ref2025_1850-2100.pkl
  • ./saved_data/2.2_constrained_46reg_lsat_smoothed_warming_ref1850_1850-2100.pkl
  • Additional data required for the global mean temperature constraint (not included in this repository)
Output
  • Fig. 1b–c and related supplementary figures
Typical run time

Approximately 2 minutes on a normal desktop computer.


2.3_real_constraint_plot.ipynb

This notebook visualizes the constrained results and generates Fig. 1a, Fig. 3, and related supplementary figures.

Input
  • ./saved_data/2.0.real_obs_constrain_prior_post_warming_2016-2025_ref1850-1900.nc
  • ./saved_data/2.1.real_obs_constrain_prior_post_smoothed_series_1850-2025_ref1850-1900.nc
Output
  • Fig. 1a, Fig. 3, and related supplementary figures
Typical run time

Approximately 1 minute on a normal desktop computer.


Part 4: Illustration of covariance matrix structure

3.0_constraint_case.ipynb

This notebook corresponds to the implementation case “Attribution of responses to GHG and OANT forcing over north-western North America”. It illustrates the structure of the covariance matrix used in the global and regional constraint scheme.

Input
  • ./saved_data/0.1.HadCRUT5.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
  • ./saved_data/0.2.HadCRUT5.200runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_175years_1850-2024.pkl
  • ./saved_data/0.3.Large_ensembles.320runs.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_251years_1850-2100.pkl
  • ./saved_data/0.4.Smoothed_His-ALL.25mods.mean.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_171years_1850-2020.pkl
  • ./saved_data/0.5.pseudo-model.15mod.run1-3.nonmasked.Tas.anomalies.46AR6regions_7cont_1glob_176years_1850-2025.pkl
Output
  • Maps illustrating the structure of the covariance matrix, used in Fig. S13 (Schematic of the implementation structure for the global and regional constraint scheme)
Typical run time

Approximately 1 minute on a normal desktop computer.


Acknowledgments

Portions of the KCC code are converted from R package of Saïd Qasmi and Aurélien Ribes https://zenodo.org/records/5233947.


License

This code is released under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors