{ "cells": [ { "cell_type": "markdown", "id": "7fd24661-92af-445c-b309-80bc4a3417de", "metadata": {}, "source": [ "# How to open/load the GloGEM per-glacier files\n", "\n", "there are 1520 files in `netcdf_output_dyn_glogemflow` and 1520 files in `netcdf_output_dyn_glogem`. You can either download them individually or download the .zip files within the two folders. \n", "\n", "- In `netcdf_output_dyn_glogem`, all (or almost all glaciers are simulated) using a simplified model version (GloGEM)\n", "- In `netcdf_output_dyn_glogemflow`, only those glaciers above 1km² that were run dynamically with GloGEMFlow are included\n", "\n", "**Attention**:\n", "- To get aggregated GloGEMflow estimates, you have to use all simulations from `netcdf_output_dyn_glogemflow`, and then in addition select all glacers within `netcdf_output_dyn_glogem` that were not yet simulated in `netcdf_output_dyn_glogemflow`. An example workflow is shown below. \n", "- simulation_year =1 corresponds to simulation_year 0 in other experiments: make sure to shift the values if you are interested at a specifc time period (and not just in steady states)\n", "- there are some files named \"psl_cm6a-lr\", but they should actually be \"ipsl_cm6a-lr\". " ] }, { "cell_type": "code", "execution_count": 10, "id": "690810e1-498b-4930-9046-73812f0072ae", "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "import numpy as np" ] }, { "cell_type": "markdown", "id": "ffe835ac-a338-496b-9bf5-f0098c35171a", "metadata": {}, "source": [ "### GloGEMflow files" ] }, { "cell_type": "code", "execution_count": 2, "id": "5f57f42a-ce85-4269-af2a-74624958ab9f", "metadata": {}, "outputs": [], "source": [ "### these are just the ones above 1km2 (that were run via GloGEMflow)\n", "path = '/home/www/lschuster/gmip3_glogem_flow_per_glacier_data/netcdf_output_dyn_glogemflow/netcdf_output_dyn/'\n", "testfile = 'VanTricht_rgi11_dyn_1851-1870_mri-esm2-0_hist.nc'\n", "ds_gf = xr.open_dataset(path+testfile)" ] }, { "cell_type": "code", "execution_count": 18, "id": "9cb05bf5-004f-4563-b516-5bac09087ca9", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'volume_m3' ()> Size: 8B\n",
       "array(1.39689564e+10)
" ], "text/plain": [ " Size: 8B\n", "array(1.39689564e+10)" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ds_gf.volume_m3.max()" ] }, { "cell_type": "code", "execution_count": 3, "id": "bd051121-105a-414a-af88-6c6e9d0f9368", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.Dataset> Size: 17MB\n",
       "Dimensions:          (simulation_year: 5000, rgi_id: 216)\n",
       "Coordinates:\n",
       "  * simulation_year  (simulation_year) float64 40kB 1.0 2.0 ... 4.999e+03 5e+03\n",
       "  * rgi_id           (rgi_id) <U14 12kB 'RGI60-11.00047' ... 'RGI60-11.03760'\n",
       "Data variables:\n",
       "    area_m2          (simulation_year, rgi_id) float64 9MB ...\n",
       "    volume_m3        (simulation_year, rgi_id) float64 9MB ...\n",
       "Attributes:\n",
       "    contributor:       VanTricht\n",
       "    contributor_mail:  vantricht@vaw.baug.ethz.ch\n",
       "    creation_date:     26-Apr-2024 15:37:01\n",
       "    reg_region:        rgi11\n",
       "    period:            1851-1870\n",
       "    gcm:               mri-esm2-0\n",
       "    ssp:               hist\n",
       "    information:       no info
" ], "text/plain": [ " Size: 17MB\n", "Dimensions: (simulation_year: 5000, rgi_id: 216)\n", "Coordinates:\n", " * simulation_year (simulation_year) float64 40kB 1.0 2.0 ... 4.999e+03 5e+03\n", " * rgi_id (rgi_id) \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'rgi_id' (rgi_id: 216)> Size: 12kB\n",
       "array(['RGI60-11.00047', 'RGI60-11.00054', 'RGI60-11.00067', ...,\n",
       "       'RGI60-11.03701', 'RGI60-11.03740', 'RGI60-11.03760'], dtype='<U14')\n",
       "Coordinates:\n",
       "  * rgi_id   (rgi_id) <U14 12kB 'RGI60-11.00047' ... 'RGI60-11.03760'
" ], "text/plain": [ " Size: 12kB\n", "array(['RGI60-11.00047', 'RGI60-11.00054', 'RGI60-11.00067', ...,\n", " 'RGI60-11.03701', 'RGI60-11.03740', 'RGI60-11.03760'], dtype='\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'rgi_id' (rgi_id: 3644)> Size: 204kB\n",
       "array(['RGI60-11.00013', 'RGI60-11.00014', 'RGI60-11.00015', ...,\n",
       "       'RGI60-11.03922', 'RGI60-11.03923', 'RGI60-11.03924'], dtype='<U14')\n",
       "Coordinates:\n",
       "  * rgi_id   (rgi_id) <U14 204kB 'RGI60-11.00013' ... 'RGI60-11.03924'
" ], "text/plain": [ " Size: 204kB\n", "array(['RGI60-11.00013', 'RGI60-11.00014', 'RGI60-11.00015', ...,\n", " 'RGI60-11.03922', 'RGI60-11.03923', 'RGI60-11.03924'], dtype=' to get per-glacier files you should take all glaciers that exist from GloGEMflow, andthen takethose that do not exist in GloGEMflow from GLoGEM ... " ] }, { "cell_type": "code", "execution_count": 8, "id": "4591cea2-9975-4d95-92ff-5e17b874e05a", "metadata": {}, "outputs": [], "source": [ "# drop those glaciers from the GLoGEM file that are available from GloGEMflow\n", "ds_g_without_common_glaciers = ds_g.drop_sel(rgi_id= common_glaciers)" ] }, { "cell_type": "code", "execution_count": 20, "id": "f3af0a86-bfb4-4c44-9f06-77c49993db67", "metadata": {}, "outputs": [], "source": [ "ds_combined_volume = xr.concat(\n", " [\n", " ds_g_without_common_glaciers.volume_m3.load(),\n", " ds_gf.volume_m3.load()\n", " ],\n", " dim=\"rgi_id\", join='outer'\n", ")\n" ] }, { "cell_type": "code", "execution_count": 21, "id": "a8e6c3c6-c609-40f4-9f7e-26b76aa9d589", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'volume_m3' (simulation_year: 5000, rgi_id: 3644)> Size: 146MB\n",
       "array([[1.11000000e+06, 2.87900000e+07, 1.59000000e+06, ...,\n",
       "        1.14262751e+08, 1.11945292e+08, 7.54012036e+07],\n",
       "       [1.10000000e+06, 2.85900000e+07, 1.58000000e+06, ...,\n",
       "        1.13695921e+08, 1.09081411e+08, 7.37605543e+07],\n",
       "       [1.10000000e+06, 2.84100000e+07, 1.58000000e+06, ...,\n",
       "        1.12166925e+08, 1.04519736e+08, 7.05637441e+07],\n",
       "       ...,\n",
       "       [           nan,            nan,            nan, ...,\n",
       "        5.24551296e+07, 5.34348286e+05, 1.38502444e+07],\n",
       "       [           nan,            nan,            nan, ...,\n",
       "        5.17504680e+07, 5.28105862e+05, 1.35843721e+07],\n",
       "       [           nan,            nan,            nan, ...,\n",
       "        5.07816183e+07, 5.29741761e+05, 1.37612858e+07]])\n",
       "Coordinates:\n",
       "  * simulation_year  (simulation_year) float64 40kB 1.0 2.0 ... 4.999e+03 5e+03\n",
       "  * rgi_id           (rgi_id) <U14 204kB 'RGI60-11.00013' ... 'RGI60-11.03760'\n",
       "Attributes:\n",
       "    units:      m3\n",
       "    long_name:  Glacier volume at timestam
" ], "text/plain": [ " Size: 146MB\n", "array([[1.11000000e+06, 2.87900000e+07, 1.59000000e+06, ...,\n", " 1.14262751e+08, 1.11945292e+08, 7.54012036e+07],\n", " [1.10000000e+06, 2.85900000e+07, 1.58000000e+06, ...,\n", " 1.13695921e+08, 1.09081411e+08, 7.37605543e+07],\n", " [1.10000000e+06, 2.84100000e+07, 1.58000000e+06, ...,\n", " 1.12166925e+08, 1.04519736e+08, 7.05637441e+07],\n", " ...,\n", " [ nan, nan, nan, ...,\n", " 5.24551296e+07, 5.34348286e+05, 1.38502444e+07],\n", " [ nan, nan, nan, ...,\n", " 5.17504680e+07, 5.28105862e+05, 1.35843721e+07],\n", " [ nan, nan, nan, ...,\n", " 5.07816183e+07, 5.29741761e+05, 1.37612858e+07]])\n", "Coordinates:\n", " * simulation_year (simulation_year) float64 40kB 1.0 2.0 ... 4.999e+03 5e+03\n", " * rgi_id (rgi_id)