Skip to content

Surrogate model and Bayesian calibration for the Parallel Ice Sheet Model.

License

Notifications You must be signed in to change notification settings

pism/pism-emulator

Repository files navigation

pism-emulator

DOI License: GPL-3.0 Code style: black flake8 Checked with mypy

Introduction

pism-emulator is the codebase for the two-step Bayesian calibration process proposed by Aschwanden and Brinkerhoff [1]. The goal is to condition ensemble predictions of Greenland's contribution to future sea-level on contemporary surface speeds and cumulative mass loss. However, the method is model-agnostic and instead of surface speeds and mass loss, one can use other calibration targets.

Installation

Get pism-emulator source from GitHub:

$ git clone git@github.com:pism/pism-emulator.git
$ cd pism-emulator

Optionally create Conda environment named pism-emulator:

$ conda env create -f environment.yml
$ conda activate pism-emulator

Install pism-emulator:

$ pip install .

Methods

  1. We first calibrate ice dynamics parameters using artificial neural network to act as a surrogate for the ice flow model, which provides a mapping from ice flow parameters to surface speeds at a fraction of PISM's computational cost. This method also provides us the means to employ efficient statistical methods that rely on the gradients of model outputs with respect to its input. We then find the joint marginal distributions given surface speed observations using the Metropolis-adjusted Langevin algorithm (MALA), a Markov-chain Monte Carlo Method. Both the surrogate model and the MALA sampler are implemented in PyTorch and PyTorch-Lightning and can be run on GPUs.

  2. In the second step, we use Bayesian calibration, also known as Importance Sampling to condition ensemble members on observations of cumulative mass change.

Basic usage: Bayesian calibration

To perform the Bayesian calibration and reproduce the probability plots from the manuscript, run python calibrate-as19.py in calibration. No need to download additional data or install the repository.

Installation

  1. Download the repository with git clone https://github.com/pism/pism-emulator.

  2. Install repository and dependecies (see above).

  3. Download observations of surface speeds to data/observed_speeds by running 01_download_nsidc_0670.py and 02_convert.sh.

Procedure

The first six eigen-glaciers

The two-step Bayesian calibration requires requires running the high-fidelity ice sheet model twice, first to create the training data, and second to perform the calibrated projections. Below we lay out the steps required to reproduce the results.

  1. Generate training data for flow calibration. The current implementation uses training data generated by the Parallel Ice Sheet Model although it can be adapted to work with other ice sheet models as well. Generating training data may require access to an HPC system as running the high-fidelity model is computationally. Here you can download the training data from arcticdata.io.

  2. In speedemulator, run python train_emulator.py. python train_emulator.py -h lists options available. python train_emulator.py --gpus 1 --data_dir dir-with-training-data --emulator_dir dir-where-emulator-goes --target_file ../data/observed_speeds/greenland_vel_mosaic250_v1_g1800m.nc trains model 0 on 1 GPU, with training data in dir-with-training-data and writes the trained emulator to dir-where-emulator-goes.

2a (optional). To evaluate the emulator, run python evaluate_emulator.py in speedemulator, python evaluate_emulator.py -h lists options available. This will produce several metrics and the figure below:

PISM vs Emulator

  1. In speedemulator, run sample_posterior.py --device cuda --emulator_dir dir-where-emulator-goes --target_file ../data/observed_speeds/greenland_vel_mosaic250_v1_g1800m.nc to run the sampler on a GPU.

  2. (optional) Plot the posterior distributions with plot_posterior.py.

  3. Sample from posterior to create new ensemble for the high fidelilty model.

  4. Run high-fidelity model on HPC system, generate csv file with timeseries of cumulative mass, discharge and smb rates.

  5. In calibration run python calibrate-as19.py to perform the importance sampling.

Minimal Example

No need to download large data sets. A low-resolution working example is provided as a notebook minimal_example.ipynb

Extending pism-emulator

The surrogate model is ice sheet-model agnostic. If you wish to use a training data from an ice sheet model other than PISM, you need to implement your own Dataset and DataModule classes, see class PISMDataset(torch.utils.data.Dataset) and class PISMDataModule(pl.LightningDataModule) for reference.

References

Aschwanden, A., & Brinkerhoff, D. J. (2022). Calibrated mass loss predictions for the Greenland Ice Sheet. Geophysical Research Letters, 49, e2022GL099058. https://doi.org/10.1029/2022GL099058

@article{https://doi.org/10.1029/2022GL099058, author = {Aschwanden, A. and Brinkerhoff, D. J.}, title = {Calibrated Mass Loss Predictions for the Greenland Ice Sheet}, journal = {Geophysical Research Letters}, volume = {49}, number = {19}, pages = {e2022GL099058}, keywords = {ice sheet modeling, Bayesian calibration, data assimilation, sea level rise, Greenland, uncertainty quantification}, doi = {https://doi.org/10.1029/2022GL099058}, year = {2022} }