{ "cells": [ { "cell_type": "markdown", "id": "ddeeea4b-753f-4dc0-8427-5ed695d5790b", "metadata": { "id": "ddeeea4b-753f-4dc0-8427-5ed695d5790b" }, "source": [ "# Some very simple GlacierMIP3 data example use cases\n" ] }, { "cell_type": "markdown", "id": "f62b9987-26b9-4c59-b0d9-0286dc474fd1", "metadata": { "id": "f62b9987-26b9-4c59-b0d9-0286dc474fd1" }, "source": [ "\n", "**This notebook is part of the dataset: \"Data from Glacier Model Intercomparison Project Phase 3 (GlacierMIP3)\", that is published at [doi: 10.5281/zenodo.14045268](https://doi.org/10.5281/zenodo.14045268). More information can be found in the README_data and the related submitted manuscript.**\n", "\n", "----\n", "\n", "All code for the first GlacierMIP3 manuscript analysis and creation of the figures is available at: [https://github.com/GlacierMIP/GlacierMIP3](https://github.com/GlacierMIP/GlacierMIP3). Here we just describe a few example use cases of the data:\n", "\n", "- [1. I want to get the glacier model simulations from an individual glacier model and compare it with my study](#1.-I-want-to-get-the-glacier-model-simulations-from-an-individual-glacier-model-and-compare-it-with-my-study)\n", "- [2. I want to analyse the relationship of steady-state mass changes of a glacier model to global warming for a specific region](#2.-I-want-to-analyse-the-relationship-of-steady-state-mass-changes-of-a-glacier-model-to-global-warming-for-a-specific-region)\n", "- [3. I want to extract LOWESS fitted steady-state glacier mass estimates](#3.-I-want-to-extract-LOWESS-fitted-steady-state-glacier-mass-estimates)\n", "- [4. Ask us to get more use case examples! -> contact](mailto:lilian.schuster@uibk.ac.at,harry.zekollari@vub.be)\n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "6fcc4a11-541c-4a10-a782-79a07caf3e44", "metadata": { "id": "6fcc4a11-541c-4a10-a782-79a07caf3e44" }, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "import xarray as xr\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns" ] }, { "cell_type": "markdown", "id": "20d86f5c-90ca-4c41-b0fe-6ed12a9c3bc8", "metadata": { "id": "20d86f5c-90ca-4c41-b0fe-6ed12a9c3bc8" }, "source": [ "\n", "## 1. I want to get the glacier model simulations from an individual glacier model and compare it with my study\n", "" ] }, { "cell_type": "code", "execution_count": 2, "id": "J58NiJX8I-FF", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "J58NiJX8I-FF", "outputId": "7bab2a8b-14a8-432f-9030-0d1f547e7ac8" }, "outputs": [], "source": [ "\n", "try:\n", " import google.colab\n", " !pip install gdown # just to temporarily download specific data to your google colab\n", " import gdown\n", " google_colab=True\n", "except:\n", " google_colab = False\n", " # otherwise just make sure to download the data...\n", " pass\n" ] }, { "cell_type": "markdown", "id": "jAvNuagEREF9", "metadata": { "id": "jAvNuagEREF9" }, "source": [ "All data is available here: https://drive.google.com/drive/folders/1sDOXfxb-Gwfq_rzQNVkSVgI4KVeFCZjc . To directly temporarily download it and insert it in your google colab, we just use the \"file_id\"s. If you want to look at another dataset not presented here, you can extract this file_id. If not using google colab, you have to download the data locally.\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "891a039a-9838-4d87-b789-cb4afbcb3148", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "891a039a-9838-4d87-b789-cb4afbcb3148", "outputId": "f7cfffce-0a4a-4fcd-fda7-0dc3f6e3caa1" }, "outputs": [], "source": [ "if google_colab:\n", " # https://drive.google.com/file/d/1fFYP4cb-KRcTE0ql9EFhdy0KyeSfkxPS/view?usp=drive_link\n", " file_id = '1fFYP4cb-KRcTE0ql9EFhdy0KyeSfkxPS'\n", " file_url = f'https://drive.google.com/uc?id={file_id}'\n", " # Download the file\n", " # downloads 0.6GB to your temporary google colab folder\n", " # /tmp directory is a temporary location for storing files.\n", " # Anything saved in /tmp will be automatically deleted when your Colab session ends or times out.\n", " gdown.download(file_url, '/tmp/glacierMIP3_Feb12_2024_models_all_rgi_regions_sum.nc', quiet=False)\n", " ds = xr.open_dataset('/tmp/glacierMIP3_Feb12_2024_models_all_rgi_regions_sum.nc')\n", "else:\n", " ds = xr.open_dataset('GMIP3_reg_glacier_model_data/glacierMIP3_Feb12_2024_models_all_rgi_regions_sum.nc')" ] }, { "cell_type": "code", "execution_count": 6, "id": "dc0c6dd3-a17d-4ba2-97ae-50933c80c9ba", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 451 }, "id": "dc0c6dd3-a17d-4ba2-97ae-50933c80c9ba", "outputId": "beafa7da-cc9e-4903-ef24-f0db1be1ec42" }, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n",
"Dimensions: (model_author: 10, simulation_year: 5001, gcm: 5,\n",
" rgi_reg: 19, period_scenario: 16)\n",
"Coordinates:\n",
" * model_author (model_author) <U14 'CISM2' 'GO' ... 'GloGEMflow3D'\n",
" * simulation_year (simulation_year) int16 0 1 2 3 4 ... 4997 4998 4999 5000\n",
" * gcm (gcm) <U13 'gfdl-esm4' 'ipsl-cm6a-lr' ... 'ukesm1-0-ll'\n",
" * rgi_reg (rgi_reg) <U2 '01' '02' '03' '04' ... '16' '17' '18' '19'\n",
" * period_scenario (period_scenario) <U16 '1851-1870_hist' ... '2081-2100_s...\n",
"Data variables:\n",
" volume_m3 (model_author, gcm, rgi_reg, simulation_year, period_scenario) float32 ...\n",
" area_m2 (model_author, gcm, rgi_reg, simulation_year, period_scenario) float32 ...\n",
"Attributes:\n",
" description: Unprocessed regionally aggregated glacier model pr...\n",
" postprocessing_phase: Unprocessed dataset with the "raw" regional files ...<xarray.DataArray 'model_author' (model_author: 10)>\n",
"array(['CISM2', 'GO', 'PyGEM-OGGM_v13', 'GloGEMflow', 'Kraaijenbrink', 'GLIMB',\n",
" 'OGGM_v153', 'OGGM_v16', 'OGGM-VAS', 'GloGEMflow3D'], dtype='<U14')\n",
"Coordinates:\n",
" * model_author (model_author) <U14 'CISM2' 'GO' ... 'OGGM-VAS' 'GloGEMflow3D'"
],
"text/plain": [
"<xarray.DataArray 'gcm' (gcm: 5)>\n",
"array(['gfdl-esm4', 'ipsl-cm6a-lr', 'mpi-esm1-2-hr', 'mri-esm2-0',\n",
" 'ukesm1-0-ll'], dtype='<U13')\n",
"Coordinates:\n",
" * gcm (gcm) <U13 'gfdl-esm4' 'ipsl-cm6a-lr' ... 'ukesm1-0-ll'<xarray.DataArray 'period_scenario' (period_scenario: 16)>\n",
"array(['1851-1870_hist', '1901-1920_hist', '1951-1970_hist', '1995-2014_hist',\n",
" '2021-2040_ssp126', '2021-2040_ssp370', '2021-2040_ssp585',\n",
" '2041-2060_ssp126', '2041-2060_ssp370', '2041-2060_ssp585',\n",
" '2061-2080_ssp126', '2061-2080_ssp370', '2061-2080_ssp585',\n",
" '2081-2100_ssp126', '2081-2100_ssp370', '2081-2100_ssp585'],\n",
" dtype='<U16')\n",
"Coordinates:\n",
" * period_scenario (period_scenario) <U16 '1851-1870_hist' ... '2081-2100_s..."
],
"text/plain": [
"<xarray.DataArray 'experiments' (experiments: 80)>\n",
"array([('gfdl-esm4', '1851-1870_hist'), ('gfdl-esm4', '1901-1920_hist'),\n",
" ('gfdl-esm4', '1951-1970_hist'), ('gfdl-esm4', '1995-2014_hist'),\n",
" ('gfdl-esm4', '2021-2040_ssp126'), ('gfdl-esm4', '2021-2040_ssp370'),\n",
" ('gfdl-esm4', '2021-2040_ssp585'), ('gfdl-esm4', '2041-2060_ssp126'),\n",
" ('gfdl-esm4', '2041-2060_ssp370'), ('gfdl-esm4', '2041-2060_ssp585'),\n",
" ('gfdl-esm4', '2061-2080_ssp126'), ('gfdl-esm4', '2061-2080_ssp370'),\n",
" ('gfdl-esm4', '2061-2080_ssp585'), ('gfdl-esm4', '2081-2100_ssp126'),\n",
" ('gfdl-esm4', '2081-2100_ssp370'), ('gfdl-esm4', '2081-2100_ssp585'),\n",
" ('ipsl-cm6a-lr', '1851-1870_hist'), ('ipsl-cm6a-lr', '1901-1920_hist'),\n",
" ('ipsl-cm6a-lr', '1951-1970_hist'), ('ipsl-cm6a-lr', '1995-2014_hist'),\n",
" ('ipsl-cm6a-lr', '2021-2040_ssp126'),\n",
" ('ipsl-cm6a-lr', '2021-2040_ssp370'),\n",
" ('ipsl-cm6a-lr', '2021-2040_ssp585'),\n",
" ('ipsl-cm6a-lr', '2041-2060_ssp126'),\n",
" ('ipsl-cm6a-lr', '2041-2060_ssp370'),\n",
" ('ipsl-cm6a-lr', '2041-2060_ssp585'),\n",
" ('ipsl-cm6a-lr', '2061-2080_ssp126'),\n",
" ('ipsl-cm6a-lr', '2061-2080_ssp370'),\n",
" ('ipsl-cm6a-lr', '2061-2080_ssp585'),\n",
" ('ipsl-cm6a-lr', '2081-2100_ssp126'),\n",
" ('ipsl-cm6a-lr', '2081-2100_ssp370'),\n",
" ('ipsl-cm6a-lr', '2081-2100_ssp585'),\n",
" ('mpi-esm1-2-hr', '1851-1870_hist'),\n",
" ('mpi-esm1-2-hr', '1901-1920_hist'),\n",
" ('mpi-esm1-2-hr', '1951-1970_hist'),\n",
" ('mpi-esm1-2-hr', '1995-2014_hist'),\n",
" ('mpi-esm1-2-hr', '2021-2040_ssp126'),\n",
" ('mpi-esm1-2-hr', '2021-2040_ssp370'),\n",
" ('mpi-esm1-2-hr', '2021-2040_ssp585'),\n",
" ('mpi-esm1-2-hr', '2041-2060_ssp126'),\n",
" ('mpi-esm1-2-hr', '2041-2060_ssp370'),\n",
" ('mpi-esm1-2-hr', '2041-2060_ssp585'),\n",
" ('mpi-esm1-2-hr', '2061-2080_ssp126'),\n",
" ('mpi-esm1-2-hr', '2061-2080_ssp370'),\n",
" ('mpi-esm1-2-hr', '2061-2080_ssp585'),\n",
" ('mpi-esm1-2-hr', '2081-2100_ssp126'),\n",
" ('mpi-esm1-2-hr', '2081-2100_ssp370'),\n",
" ('mpi-esm1-2-hr', '2081-2100_ssp585'), ('mri-esm2-0', '1851-1870_hist'),\n",
" ('mri-esm2-0', '1901-1920_hist'), ('mri-esm2-0', '1951-1970_hist'),\n",
" ('mri-esm2-0', '1995-2014_hist'), ('mri-esm2-0', '2021-2040_ssp126'),\n",
" ('mri-esm2-0', '2021-2040_ssp370'), ('mri-esm2-0', '2021-2040_ssp585'),\n",
" ('mri-esm2-0', '2041-2060_ssp126'), ('mri-esm2-0', '2041-2060_ssp370'),\n",
" ('mri-esm2-0', '2041-2060_ssp585'), ('mri-esm2-0', '2061-2080_ssp126'),\n",
" ('mri-esm2-0', '2061-2080_ssp370'), ('mri-esm2-0', '2061-2080_ssp585'),\n",
" ('mri-esm2-0', '2081-2100_ssp126'), ('mri-esm2-0', '2081-2100_ssp370'),\n",
" ('mri-esm2-0', '2081-2100_ssp585'), ('ukesm1-0-ll', '1851-1870_hist'),\n",
" ('ukesm1-0-ll', '1901-1920_hist'), ('ukesm1-0-ll', '1951-1970_hist'),\n",
" ('ukesm1-0-ll', '1995-2014_hist'), ('ukesm1-0-ll', '2021-2040_ssp126'),\n",
" ('ukesm1-0-ll', '2021-2040_ssp370'),\n",
" ('ukesm1-0-ll', '2021-2040_ssp585'),\n",
" ('ukesm1-0-ll', '2041-2060_ssp126'),\n",
" ('ukesm1-0-ll', '2041-2060_ssp370'),\n",
" ('ukesm1-0-ll', '2041-2060_ssp585'),\n",
" ('ukesm1-0-ll', '2061-2080_ssp126'),\n",
" ('ukesm1-0-ll', '2061-2080_ssp370'),\n",
" ('ukesm1-0-ll', '2061-2080_ssp585'),\n",
" ('ukesm1-0-ll', '2081-2100_ssp126'),\n",
" ('ukesm1-0-ll', '2081-2100_ssp370'),\n",
" ('ukesm1-0-ll', '2081-2100_ssp585')], dtype=object)\n",
"Coordinates:\n",
" * experiments (experiments) object MultiIndex\n",
" * gcm (experiments) <U13 'gfdl-esm4' ... 'ukesm1-0-ll'\n",
" * period_scenario (experiments) <U16 '1851-1870_hist' ... '2081-2100_ssp585'\n",
" temp_ch_ipcc (experiments) float64 0.2314 0.4783 0.3923 ... 5.84 6.884<xarray.Dataset>\n",
"Dimensions: (simulation_year: 5001, experiments: 80)\n",
"Coordinates:\n",
" model_author <U14 'Kraaijenbrink'\n",
" * simulation_year (simulation_year) int16 0 1 2 3 4 ... 4997 4998 4999 5000\n",
" rgi_reg <U2 '13'\n",
" * experiments (experiments) object MultiIndex\n",
" * gcm (experiments) <U13 'gfdl-esm4' ... 'ukesm1-0-ll'\n",
" * period_scenario (experiments) <U16 '1851-1870_hist' ... '2081-2100_ssp585'\n",
" temp_ch_ipcc (experiments) float64 0.2314 0.4783 0.3923 ... 5.84 6.884\n",
"Data variables:\n",
" volume_m3 (simulation_year, experiments) float32 3.271e+12 ... nan\n",
" area_m2 (simulation_year, experiments) float32 4.93e+10 ... nan"
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: (model_author: 8, year_after_2020: 5051,\n",
" period_scenario: 16, gcm: 5, rgi_reg: 19)\n",
"Coordinates:\n",
" * model_author (model_author) <U14 'CISM2' ... 'PyGEM-...\n",
" * year_after_2020 (year_after_2020) float32 -50.0 ... 5e+03\n",
" * period_scenario (period_scenario) <U16 '1851-1870_hist'...\n",
" * gcm (gcm) <U13 'gfdl-esm4' ... 'ukesm1-0-ll'\n",
" * rgi_reg (rgi_reg) <U2 '01' '02' '03' ... '18' '19'\n",
"Data variables:\n",
" simulation_year (model_author, rgi_reg, year_after_2020, period_scenario, gcm) float64 ...\n",
" temp_ch_ipcc (period_scenario, gcm) float64 ...\n",
" yrs_w_most_similar_state_to_2020 (model_author, rgi_reg, period_scenario, gcm) float32 ...\n",
" volume_rel_2020_% (model_author, rgi_reg, year_after_2020, period_scenario, gcm) float64 ...\n",
" volume_m3 (model_author, rgi_reg, year_after_2020, period_scenario, gcm) float64 ...| \n", " | 0.83 | \n", "0.5 | \n", "0.17 | \n", "
|---|---|---|---|
| 2762 | \n", "81.9 | \n", "90.9 | \n", "95.5 | \n", "
| \n", " | temp_ch | \n", "0.05 | \n", "0.17 | \n", "0.25 | \n", "0.5 | \n", "0.75 | \n", "0.83 | \n", "0.95 | \n", "frac | \n", "region | \n", "year | \n", "it | \n", "N | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1726 | \n", "2.2 | \n", "18.448355 | \n", "22.158413 | \n", "24.513387 | \n", "35.15934 | \n", "59.677833 | \n", "63.699423 | \n", "69.69257 | \n", "0.21 | \n", "13 | \n", "5000 | \n", "2 | \n", "500 | \n", "