/niazi-etal_2024_nature-sustainability

Meta repository containing data and code for the groundwater peak and decline paper

Primary LanguageRBSD 2-Clause "Simplified" LicenseBSD-2-Clause

DOI DOI

niazi-etal_2024_nature-sustainability

Global Peak Water Limit of Future Groundwater Withdrawals

Hassan Niazi1,*, Thomas Wild1, Sean Turner2, Neal Graham1, Mohamad Hejazi3, Siwa Msangi4, Son Kim1, Jonathan Lamontagne5, and Mengqi Zhao6

1 Joint Global Change Research Institute, Pacific Northwest National Laboratory (JGCRI-PNNL), College Park, MD, USA. 2 Oak Ridge National Laboratory (ORNL), TN, USA. 3 King Abdullah Petroleum Studies and Research Center (KAPSARC), Riyadh, Saudi Arabia. 4 Economic Research Service, United States Department of Agriculture, Washington DC, USA. 5 Tufts University, Boston, MA, USA. 6 Pacific Northwest National Laboratory (PNNL), Richland, WA, USA.

* corresponding author: hassan.niazi@pnnl.gov

Abstract

Using GCAM, we simulate groundwater withdrawals across 235 water basins under 900 scenarios covering a variety of global change drivers over the 21st century. We find that global groundwater withdrawals robustly peak around mid-century, followed by a consistent decline through 21st century, exposing about half of the population living in one-third of basins to groundwater stress. This first-ever robust, quantitative confirmation of the peak-and-decline pattern for groundwater, previously only known for fossil fuels and minerals, raises concerns for basins heavily dependent on groundwater for food production and meeting other water demands.

Journal reference

Niazi, H., Wild, T., Turner, S., Graham, N., Hejazi, M., Msangi, S., Kim, S., Lamontagne, J., & Zhao, M. (2024). Global Peak Water Limit of Future Groundwater Withdrawals. Nature Sustainability. (Accepted)

Repository Overview

Item Purpose Key folders and files
model/ Contains data and scripts required for reproducing the experiment ranging from steps related to setting up the model to running batch simulations to querying relevant outputs from 900 GCAM runs water-data/, combined_impacts/, xml-creation/, xml-batch/, config_files/, gcam-5/, batch-scripts/, queries/, and outputs/ folders
processing/ Contains scripts and files required to reproduce the analysis and visualizations as presented in the paper inputs/ and ouputs/ folders along with *.R scripts for analysis
figures/ Contains major figures presented in the manuscript figures and shape files to plot maps
data Associated data repository to host larger files and folders. This code repository must be complemented with data from data repository DOI

Reproduce the Experiment

The files and scripts presented in the model/ folder along with data from the data repository DOI such as version of the model (gcam-5) could be used to reproduce the experiment.

For first-time users of GCAM, please follow the guidance on GCAM wiki to setup GCAM or for background knowledge.

Generally, running GCAM has three major steps:

  1. preparing the scenario-specific input data and formatted *.xml files as inputs to GCAM
  2. running GCAM using configuration files. In the context of this project running GCAM 900 times in parallel on cluster also requires batch-scripts
  3. quering the databases for outputs of interest to be later used in post-processing and analysis scripts

Overview of the model/ folder:

Folder name Description
water-data/ This folder contains assumptions and data specific to water system, such as runoff, groundwater supply, water demands, accessible water fractions etc, that are used to represent dynamics within water system and its connections with other sectors.
combined_impacts/ This folder supplies scenario-specific information related to the climate impacts on energy, water, land systems. These scenario-specific climate impacts input files (*.XML) are the read in at the end of the configuration files as inputs to the model, representing the effect of changes in climate and it's representation in models on water supply, hydropower, crop yields, and building energy demand.
xml-creation/ This folder contains scripts and files used to systematically list and create 900 configuration files for each scenario. Each configuration file specifies which scenario-specific inputs would be read-in.
xml-batch/ This folder provides batch input *.XML files for water system that are required in each of the 900 simulation runs.
config_files/ This folder contains 900 configuration files for each simulation, containing simulation specific model settings and paths to files containing scenario-specific input conditions.
gcam-5/ This folder, currently empty, would contain the version of the GCAM model used for this study. The model folder (gcam-5.7z) could be downloaded from DOI and extracted here as gcam-5/.
batch-scripts/ This folder contains shell scripts (*.sh) used to run multiple GCAM scenario simulations on cluster in parallel.
queries/ This folder contains structure for main queries used to extract the relevant outputs from 900 GCAM runs. The queries are provided in *.XML format along with *.R scripts that describe how the query would interact with 900 output databases. Shell *.sh scripts are also provided to run these queries on cluster.
outputs/ This folder contains key outputs queried and collated from 900 GCAM runs. Some of the files of this folder are hosted in the data repository here DOI. outputs folder contains further information on each of the key output files.

Completely reproducing the experiment would require a cluster for efficiency. Some of the paths specific to your respective cluster (e.g., /pic/ in this case) must be changed to the home directory of your cluster.

In case of any errors or questions, feel free to get in touch at hassan.niazi@pnnl.gov for debugging details.

Reproduce the Analysis

The files and scrpts in the processing folder could be used to reproduce the analysis and the core versions of the figures presented in the paper. Please feel free to reach out at hassan.niazi@pnnl.gov in case of technical difficulties or if the analysis output is found to be different from those presented in the paper.

Overview of the processing folder:

Script Description
plot_basins.R This creates a map of all 235 basins represented in GCAM
groundwater_irr_production.R Function to calculate and process irrigated agriculture output across all scenarios
function_geom_splitviolin.R Function to split the probability distribution (aka violins) of the main y-axis variable into half, resulting in two asymmetric distributions on each side of the median of x-axis variable
function_multiplot.R Function to plot panels across all ensemble members of the experiments. This is used in splot density plots.R to plot probability distributions in Figure S18 and cumulative probability distributions in Figure S19 in the SI
dataprep.R Script to clean and prepare the groundwater withdrawals model output from 900 runs for post-processing. groundwater withdrawals is the key file for analysis
allbasins.R This script is used to analyze peak and decline from GCAM simulations for each basin across all scenarios
allscenarios.R This script is used to analyze peak and decline from GCAM simulations for each scenario across all basins (i.e. globally)
analysis_pnd.R Key analysis script generating key insights about groundwater peak and decline across all regions, basins, and scenarios. It analyzes raw groundwater withdrawals as well as peak groundwater withdrawals in each scenario. It also calculates peak water value and peak year along with total groundwater withdrawals by region, basin, and scenario
globalpnd_main.R This scripts plots Figure 1 of the main text highlighting global peak and decline of groundwater withdrawals, along with marginal distributions, and validation data from previous studies
groundwater.R Analysis and visualization script that processes model outputs, plots probability density of instantaneous and cumulative groundwater withdrawals across all ensemble groups (presented in Figure S12), and plots agricultural production in basins that are going to peak and decline
groundwater_pdf_gen.R Script for calculating agricultural production in 2100 and it's probability density form the basins that show peak and decline in groundwater withdrawals
gw depletion with double density peaks.R Script for plotting groundwater depletion trajectories with densities on top and side as presented in Figure S9, and for highlighting trajectories by categories on top of all trajectories as presented in Figure S10.
interpolation.R Script to interpolate withdrawals between GCAM years i.e., to produce yearly withdrawals from withdrawals on 5-year timestep
map plot.R Key analysis script calculating which scenario peaked, it's probability, and related statistics which were used to produce Figure 2 in the main text and all five map figures in the SI. This takes in the shape files provided in the figures folder to plot maps.
depletion spark plots.R Script to calculate and plot key statistics for smaller basin-specific plots shown around the main Figure 2 map in the main text. This scripts also plots trajectories of groundwater withdrawals for each basin with bands showing uncertainty all scenarios.
peak bubble plot.R This script plots multiple variations of representing uncertainty of peak water and peak year across SSP and RCP ensemble groups, one of which is shown in Figure S11
pop and ag histograms.R This script analyzes population and GDP in peak and decline basins. It is also used to calculate the fraction of population living in basins that are going to peak and decline as presented in Figure S14 and irrigated production (% of global total) from basins that will face peak groundwater depletion in the 21st century as presented in Figure S15
splot density plots.R This script is used to plot probability densities and cumulative probability distributions of peak water and peak year across all ensemble groups as shown in Figure S18 and S19 respectively
synthesisviolins.R This script is used for plotting Figure 3 in the manuscript which has uncertainty representation across SSPs and RCPs for peak water and peak year across all scenarios
violins_synthesis.R This script is an earlier version of the synthesisviolins.R script which is used for plotting Figure 3 in the manuscript
wg gl checks.R This script analyzes initial results to check sensitivity of groundwater withdrawals to historical depletion trends (Gleeson vs WaterGap). It also plots 3 different kinds of sensitivity-type plots, one of which is shown in Figure S11

Data reference

Niazi, H., Wild, T., Turner, S., Graham, N., Hejazi, M., Msangi, S., Kim, S., Lamontagne, J., & Zhao, M. (2022). Large Ensemble Dataset for Discovering Global Peak Water Limit of Future Groundwater Withdrawals Using 900 GCAM Runs [Data set]. Zenodo. https://doi.org/10.5281/zenodo.6480465

Contribute

In case of any questions or suggestions, please reach out to Hassan Niazi via email or issues section of this repository.