{ "cells": [ { "cell_type": "markdown", "id": "9ae10408-1a4c-4e34-bde6-5d0509fc8082", "metadata": {}, "source": [ "# Extract the CMIP6 and CMIP5 climate\n", "- and save the global climate in 2100 (using the same definition as Rounce et al., 2023)\n", "- attention: that means we assume here in this notebook a warming of 0.63°C between 1850-1900 and 1986-2005 (as done in the SROCC report)\n", " - in the IPCC AR6 WG1 report, the methods have changed and instead 0.69°C of warming is assumed to occur .... \n", " - the same notebook using this approach is here: `global_gcm_climate_cmip6_cmip5_ipcc_ar6_def.ipynb`\n", " (with updated figures with extended names of *_ipcc_ar6_def)" ] }, { "cell_type": "code", "execution_count": 3, "id": "84cff628-8de1-4c57-a2f9-405dd4605c64", "metadata": {}, "outputs": [], "source": [ "from oggm import utils\n", "import sys\n", "import xarray as xr\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import os\n", "import json\n", "import seaborn as sns\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "1cf06be8-8712-46b1-b0e1-3ec390e69536", "metadata": {}, "outputs": [], "source": [ "gcms_cmip6_2300 = pd.read_csv('/home/www/oggm/cmip6/all_gcm_list_2300.csv', index_col=0) \n", "gcms_cmip6 = pd.read_csv('/home/www/oggm/cmip6/all_gcm_list.csv', index_col=0) \n", "\n", "gcms_ssps = []\n", "for ind in gcms_cmip6.loc[gcms_cmip6['var']=='pr'].index:\n", " gcms_ssps.append(f'{gcms_cmip6.loc[ind].gcm}_{gcms_cmip6.loc[ind].ssp}')\n", "gcm_c = {}\n", "for e,gcm in enumerate(['CanESM5', 'IPSL-CM6A-LR', 'CESM2-WACCM', 'MRI-ESM2-0',\n", " 'ACCESS-CM2', 'ACCESS-ESM1-5']):\n", " gcm_c[gcm] = f'C{e}'" ] }, { "cell_type": "code", "execution_count": 3, "id": "4b4c6a6b-7ddc-419b-80a6-5d73149688b0", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "73.0\n" ] } ], "source": [ "print(len(gcms_cmip6)/2)" ] }, { "cell_type": "code", "execution_count": 4, "id": "c0d938f6-071a-458f-bc3c-6f6df278eaed", "metadata": {}, "outputs": [], "source": [ "extract_cmip6_climate = False\n", "if extract_cmip6_climate:\n", " pd_temp_ch_2100_2300 = pd.DataFrame(columns=['gcm', 'ssp','global_temp_ch_2081-2100_preindustrial',\n", " 'global_temp_ch_2071-2100_preindustrial',\n", " 'global_temp_ch_2281-2300_preindustrial'])\n", " for ssp in gcms_cmip6.ssp.unique():\n", " gcms_cmip6_sel = gcms_cmip6.loc[(gcms_cmip6.ssp ==ssp) & (gcms_cmip6['var'] =='tas')]\n", " for f in gcms_cmip6_sel.index:\n", " gcm = gcms_cmip6_sel.loc[f].gcm\n", " dtas_annual = xr.open_dataset(gcms_cmip6_sel.loc[f]['path'],\n", " use_cftime=True).sel(time=slice('1986','2300')).tas.groupby('time.year').mean()\n", " weight = np.cos(np.deg2rad(dtas_annual.lat))\n", " weight = weight/weight.sum()\n", " global_dtas_per_year = (dtas_annual.mean(dim='lon') * weight).sum(dim='lat')\n", " avg_1986_2005 = global_dtas_per_year.sel(year=slice('1986','2005')).mean().values\n", " avg_2081_2100 = global_dtas_per_year.sel(year=slice('2081','2100')).mean().values\n", " avg_2071_2100 = global_dtas_per_year.sel(year=slice('2071','2100')).mean().values\n", " avg_2271_2300 = global_dtas_per_year.sel(year=slice('2271','2300')).mean().values\n", " avg_2281_2300 = global_dtas_per_year.sel(year=slice('2281','2300')).mean().values\n", "\n", " temperature_increase_2081_2100_rel_preindustrial = avg_2081_2100- avg_1986_2005 + 0.63\n", " temperature_increase_2071_2100_rel_preindustrial = avg_2071_2100- avg_1986_2005 + 0.63\n", " temperature_increase_2271_2300_rel_preindustrial = avg_2271_2300- avg_1986_2005 + 0.63\n", " temperature_increase_2281_2300_rel_preindustrial = avg_2281_2300- avg_1986_2005 + 0.63\n", "\n", " pd_temp_ch_2100_2300.loc[f'{gcm.upper()}_{ssp}', 'global_temp_ch_2081-2100_preindustrial'] = temperature_increase_2081_2100_rel_preindustrial\n", " pd_temp_ch_2100_2300.loc[f'{gcm.upper()}_{ssp}', 'global_temp_ch_2071-2100_preindustrial'] = temperature_increase_2071_2100_rel_preindustrial\n", " pd_temp_ch_2100_2300.loc[f'{gcm.upper()}_{ssp}', 'global_temp_ch_2281-2300_preindustrial'] = temperature_increase_2281_2300_rel_preindustrial\n", " pd_temp_ch_2100_2300.loc[f'{gcm.upper()}_{ssp}', 'global_temp_ch_2271-2300_preindustrial'] = temperature_increase_2271_2300_rel_preindustrial\n", "\n", " pd_temp_ch_2100_2300.loc[f'{gcm.upper()}_{ssp}', 'gcm'] = gcm.upper()\n", " pd_temp_ch_2100_2300.loc[f'{gcm.upper()}_{ssp}', 'ssp'] = ssp\n", " \n", " for j in pd_temp_ch_2100_2300.index:\n", " temp_ch_2081_2100_rel_preind = pd_temp_ch_2100_2300.loc[j, 'global_temp_ch_2081-2100_preindustrial'] \n", " if (temp_ch_2081_2100_rel_preind <=1.75) and ((temp_ch_2081_2100_rel_preind >=1.25)):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2081-2100_preindustrial_+1.5°C'] = True\n", " if (temp_ch_2081_2100_rel_preind <=2.5) and ((temp_ch_2081_2100_rel_preind >=1.5)):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2081-2100_preindustrial_+2.0°C'] = True\n", " if (temp_ch_2081_2100_rel_preind <=3.5) and ((temp_ch_2081_2100_rel_preind >=2.5)):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2081-2100_preindustrial_+3.0°C'] = True\n", " if (temp_ch_2081_2100_rel_preind <=4.5) and ((temp_ch_2081_2100_rel_preind >=3.5)):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2081-2100_preindustrial_+4.0°C'] = True\n", " if (temp_ch_2081_2100_rel_preind <=5.5) and ((temp_ch_2081_2100_rel_preind >=4.5)):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2081-2100_preindustrial_+5.0°C'] = True\n", " if (temp_ch_2081_2100_rel_preind <=6.5) and ((temp_ch_2081_2100_rel_preind >=5.5)):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2081-2100_preindustrial_+6.0°C'] = True\n", " pd_temp_ch_2100_2300.to_csv('Global_mean_temp_deviation_2071_2100_2081_2100_2281_2300_rel_1850_1900_cmip6_gcms.csv')\n", " \n", " for j in pd_temp_ch_2100_2300.index:\n", " temp_ch_2071_2100_rel_preind = pd_temp_ch_2100_2300.loc[j, 'global_temp_ch_2071-2100_preindustrial'] \n", " if (temp_ch_2071_2100_rel_preind <=1.5):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2071-2100_preindustrial_<=+1.5°C'] = True\n", " elif (temp_ch_2071_2100_rel_preind<=2.0):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2071-2100_preindustrial_<=+2.0°C'] = True\n", " elif (temp_ch_2071_2100_rel_preind<=3.0):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2071-2100_preindustrial_<=+3.0°C'] = True\n", " elif (temp_ch_2071_2100_rel_preind<=4.0):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2071-2100_preindustrial_<=+4.0°C'] = True\n", " elif (temp_ch_2071_2100_rel_preind>4.0):\n", " pd_temp_ch_2100_2300.loc[j,'global_temp_ch_level_2071-2100_preindustrial_>4.0°C'] = True\n", " pd_temp_ch_2100_2300.to_csv('Global_mean_temp_deviation_2071_2100_2081_2100_2271_2300_2281_2300_rel_1850_1900_cmip6_gcms.csv')\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "cfe8ca20-91e0-4522-906a-306fde841812", "metadata": {}, "outputs": [], "source": [ "pd_temp_ch_2100_2300 = pd.read_csv('Global_mean_temp_deviation_2071_2100_2081_2100_2281_2300_rel_1850_1900_cmip6_gcms.csv', index_col=0)" ] }, { "cell_type": "code", "execution_count": 6, "id": "78c897eb-1c9b-4442-89fc-0378a13a21ca", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | gcm | \n", "ssp | \n", "global_temp_ch_2081-2100_preindustrial | \n", "global_temp_ch_2071-2100_preindustrial | \n", "global_temp_ch_2281-2300_preindustrial | \n", "global_temp_ch_2271-2300_preindustrial | \n", "global_temp_ch_level_2081-2100_preindustrial_+2.0°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+1.5°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+3.0°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+6.0°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+4.0°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+5.0°C | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
CESM2-WACCM_ssp126 | \n", "CESM2-WACCM | \n", "ssp126 | \n", "2.420132 | \n", "2.396573 | \n", "2.468365 | \n", "2.429928 | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
MPI-ESM1-2-HR_ssp126 | \n", "MPI-ESM1-2-HR | \n", "ssp126 | \n", "1.598791 | \n", "1.609876 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
GFDL-ESM4_ssp126 | \n", "GFDL-ESM4 | \n", "ssp126 | \n", "1.625247 | \n", "1.632323 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
NORESM2-MM_ssp126 | \n", "NORESM2-MM | \n", "ssp126 | \n", "1.644489 | \n", "1.660226 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
ACCESS-ESM1-5_ssp126 | \n", "ACCESS-ESM1-5 | \n", "ssp126 | \n", "2.195797 | \n", "2.199496 | \n", "1.986320 | \n", "1.986842 | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
MRI-ESM2-0_ssp119 | \n", "MRI-ESM2-0 | \n", "ssp119 | \n", "1.519363 | \n", "1.559736 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
EC-EARTH3-VEG_ssp119 | \n", "EC-EARTH3-VEG | \n", "ssp119 | \n", "1.673200 | \n", "1.651997 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
CAMS-CSM1-0_ssp119 | \n", "CAMS-CSM1-0 | \n", "ssp119 | \n", "1.055980 | \n", "1.075359 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
MRI-ESM2-0_ssp434 | \n", "MRI-ESM2-0 | \n", "ssp434 | \n", "2.576543 | \n", "2.549334 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
MRI-ESM2-0_ssp460 | \n", "MRI-ESM2-0 | \n", "ssp460 | \n", "3.180410 | \n", "3.081511 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
73 rows × 12 columns
\n", "\n", " | gcm | \n", "ssp | \n", "global_temp_ch_2081-2100_preindustrial | \n", "global_temp_ch_2071-2100_preindustrial | \n", "global_temp_ch_2281-2300_preindustrial | \n", "global_temp_ch_2271-2300_preindustrial | \n", "global_temp_ch_level_2081-2100_preindustrial_+2.0°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+1.5°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+3.0°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+6.0°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+4.0°C | \n", "global_temp_ch_level_2081-2100_preindustrial_+5.0°C | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
CESM2-WACCM_ssp126 | \n", "CESM2-WACCM | \n", "ssp126 | \n", "2.420132 | \n", "2.396573 | \n", "2.468365 | \n", "2.429928 | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
MPI-ESM1-2-HR_ssp126 | \n", "MPI-ESM1-2-HR | \n", "ssp126 | \n", "1.598791 | \n", "1.609876 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
GFDL-ESM4_ssp126 | \n", "GFDL-ESM4 | \n", "ssp126 | \n", "1.625247 | \n", "1.632323 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
NORESM2-MM_ssp126 | \n", "NORESM2-MM | \n", "ssp126 | \n", "1.644489 | \n", "1.660226 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
ACCESS-ESM1-5_ssp126 | \n", "ACCESS-ESM1-5 | \n", "ssp126 | \n", "2.195797 | \n", "2.199496 | \n", "1.986320 | \n", "1.986842 | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
MRI-ESM2-0_ssp119 | \n", "MRI-ESM2-0 | \n", "ssp119 | \n", "1.519363 | \n", "1.559736 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
EC-EARTH3-VEG_ssp119 | \n", "EC-EARTH3-VEG | \n", "ssp119 | \n", "1.673200 | \n", "1.651997 | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
CAMS-CSM1-0_ssp119 | \n", "CAMS-CSM1-0 | \n", "ssp119 | \n", "1.055980 | \n", "1.075359 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
MRI-ESM2-0_ssp434 | \n", "MRI-ESM2-0 | \n", "ssp434 | \n", "2.576543 | \n", "2.549334 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
MRI-ESM2-0_ssp460 | \n", "MRI-ESM2-0 | \n", "ssp460 | \n", "3.180410 | \n", "3.081511 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
73 rows × 12 columns
\n", "MinMaxScaler()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
MinMaxScaler()