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.
Get pism-emulator source from GitHub:
$ git clone [email protected]: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 .
-
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.
-
In the second step, we use Bayesian calibration, also known as Importance Sampling to condition ensemble members on observations of cumulative mass change.
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.
-
Download the repository with
git clone https://github.com/pism/pism-emulator
. -
Install repository and dependecies (see above).
-
Download observations of surface speeds to
data/observed_speeds
by running01_download_nsidc_0670.py
and02_convert.sh
.
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.
-
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.
-
In
speedemulator
, runpython 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 indir-with-training-data
and writes the trained emulator todir-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:
-
In
speedemulator
, runsample_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. -
(optional) Plot the posterior distributions with
plot_posterior.py
. -
Sample from posterior to create new ensemble for the high fidelilty model.
-
Run high-fidelity model on HPC system, generate csv file with timeseries of cumulative mass, discharge and smb rates.
-
In
calibration
runpython calibrate-as19.py
to perform the importance sampling.
No need to download large data sets. A low-resolution working example is provided as a notebook minimal_example.ipynb
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.
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} }