{ "cells": [ { "cell_type": "markdown", "id": "53611111-53e4-400d-a4cf-2e164578622b", "metadata": {}, "source": [ "# Combine monthly and annual runoff and other information into merged per-glacier data-files for every basin\n", "\n", "- The annual or monthly glacier runoff that is computed here is the sum of annual melt and liquid precipitation on and off the glacier using a fixed-gauge with a glacier minimum reference area from year 2000.\n", "\n", "- Attention, no filling is done, those glaciers that did not run have np.NaN values\n", "- two options:\n", " - `gcm_from_2000` : gcm directly from 2000 (results in differences between GCMs from 2000-2019) \n", " - `w5e5_gcm_merged` : W5E5 from 2000-2019 and GCM from 2020 runoff\n", "\n", "(the data got updated in March 2025, because some basins were accidentally missing)" ] }, { "cell_type": "code", "execution_count": 1, "id": "330447d8-5af9-4e1f-878d-31dc6565aa30", "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "import numpy as np\n", "import pandas as pd\n", "from time import gmtime, strftime\n", "import oggm.cfg\n", "from oggm import utils, workflow, tasks, graphics\n", "import json\n", "import geopandas as gpd\n", "\n", "# let's also do some visualisations ...\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "\n", "gcms_cmip6 = pd.read_csv('/home/www/oggm/cmip6/all_gcm_list.csv', index_col=0) \n", "all_GCM = gcms_cmip6.gcm.unique()\n", "all_scenario = gcms_cmip6.ssp.unique()\n", "\n", "# get the dataset where coordinates of glaciers are stored\n", "frgi = utils.file_downloader('https://cluster.klima.uni-bremen.de/~oggm/rgi/rgi62_stats.h5')\n", "#frgi = '/home/users/lschuster/glacierMIP/rgi62_stats.h5'\n", "odf = pd.read_hdf(frgi, index_col=0)\n", "\n", "# get the RGI ids of the glaciers of the chosen basin\n", "pd_basin_num = gpd.read_file('/home/www/fmaussion/misc/magicc/basins_shape/glacier_basins.shp')" ] }, { "cell_type": "code", "execution_count": 2, "id": "2003ba28-35f4-498e-af6b-3457962cfd51", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "73.0" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "### all available gcm_scenario combinations ... \n", "len(gcms_cmip6)/2" ] }, { "cell_type": "code", "execution_count": 3, "id": "5209d22b-bcd2-4854-b4b0-e52f30a08b97", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | MRBID | \n", "RIVER_BASI | \n", "CONTINENT | \n", "OCEAN | \n", "SEA | \n", "AREA_CALC | \n", "Shape_Leng | \n", "Shape_Area | \n", "RGI_AREA | \n", "geometry | \n", "
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "2103 | \n", "INDIGIRKA | \n", "Asia | \n", "Arctic Ocean | \n", "East Siberian Sea | \n", "341234.0 | \n", "85.604051 | \n", "70.212499 | \n", "171.941 | \n", "POLYGON ((151.725 70.975, 151.725 70.97083, 15... | \n", "
| 1 | \n", "2108 | \n", "OB | \n", "Asia | \n", "Arctic Ocean | \n", "Kara Sea | \n", "3040606.1 | \n", "168.355250 | \n", "448.342075 | \n", "763.493 | \n", "POLYGON ((91.75 57.70417, 91.74542 57.70299, 9... | \n", "
| 2 | \n", "2302 | \n", "BRAHMAPUTRA | \n", "Asia | \n", "Indian Ocean | \n", "Bay of Bengal | \n", "540782.5 | \n", "66.054440 | \n", "49.686611 | \n", "10528.496 | \n", "POLYGON ((97.76667 28.77083, 97.76335 28.77168... | \n", "
| 3 | \n", "2306 | \n", "GANGES | \n", "Asia | \n", "Indian Ocean | \n", "Bay of Bengal | \n", "1006558.6 | \n", "122.349983 | \n", "90.946880 | \n", "7906.081 | \n", "MULTIPOLYGON (((88.02555 21.5715, 88.02361 21.... | \n", "
| 4 | \n", "2309 | \n", "INDUS | \n", "Asia | \n", "Indian Ocean | \n", "Arabian Sea | \n", "865012.6 | \n", "81.286291 | \n", "82.852275 | \n", "27206.546 | \n", "MULTIPOLYGON (((67.44167 23.97006, 67.44028 23... | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 70 | \n", "6241 | \n", "PO | \n", "Europe | \n", "Atlantic Ocean | \n", "Adriatic Sea | \n", "73289.5 | \n", "21.576098 | \n", "8.425867 | \n", "313.417 | \n", "POLYGON ((9.68333 46.425, 9.68418 46.42168, 9.... | \n", "
| 71 | \n", "6242 | \n", "RHINE | \n", "Europe | \n", "Atlantic Ocean | \n", "North Sea | \n", "163122.3 | \n", "48.247612 | \n", "20.200160 | \n", "336.922 | \n", "POLYGON ((4.45638 52.14527, 4.46175 52.1411, 4... | \n", "
| 72 | \n", "6243 | \n", "RHONE | \n", "Europe | \n", "Atlantic Ocean | \n", "Mediterranean Sea | \n", "96637.6 | \n", "28.004916 | \n", "11.197342 | \n", "917.302 | \n", "POLYGON ((6.84167 47.82083, 6.84167 47.81667, ... | \n", "
| 73 | \n", "6254 | \n", "THJORSA | \n", "Europe | \n", "Atlantic Ocean | \n", "North Atlantic | \n", "8277.8 | \n", "9.270847 | \n", "1.545336 | \n", "972.419 | \n", "POLYGON ((-17.5 64.625, -17.50035 64.60591, -1... | \n", "
| 74 | \n", "6255 | \n", "TORNEALVEN (also TORNIONJOKI, also TORNIONVAYLA) | \n", "Europe | \n", "Atlantic Ocean | \n", "Baltic Sea | \n", "40545.2 | \n", "28.919025 | \n", "8.685652 | \n", "34.257 | \n", "POLYGON ((23.69167 68.84167, 23.70214 68.84102... | \n", "
75 rows × 10 columns
\n", "