“Instructed OGGM”: running IGM within the OGGM workflow#

This tutorial gives you the tools to run IGM within OGGM and also compare it with OGGM runs.

This is very much work in progress. You’ll need an IGM installation for this to run. The notebook currently does not run on OGGM Hub or is not displayed on the website, because of the Tensorflow depedency. We are working on it!

from oggm import cfg
from oggm import tasks, utils, workflow, graphics, DEFAULT_BASE_URL
from oggm.core import massbalance
from oggm.shop import gcm_climate
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
import igm

import warnings
warnings.filterwarnings(action='ignore', category=UserWarning)

## Initialize OGGM and set up the default run parameters
cfg.initialize(logging_level='WARNING')

## Local working directory (where OGGM will write its output)
# WORKING_DIR = utils.gettempdir('OGGM_distr4')
cfg.PATHS['working_dir'] = utils.get_temp_dir('OGGM_distributed_', reset=True)

## Pick a glacier
rgi_ids = ['RGI60-11.01450']  # This is Aletsch
# rgi_ids = ['RGI60-11.00897']  # This is Hintereisferner
# rgi_ids = ['RGI60-11.03638']  # This is Argentiere
# base_url = 'https://cluster.klima.uni-bremen.de/~oggm/gdirs/oggm_v1.6/exps/igm_v2' # not used currently, data is taken from oggm.DEFAULT_BASE_URL

gdir = workflow.init_glacier_directories(rgi_ids, 
                                         prepro_base_url=DEFAULT_BASE_URL, 
                                         from_prepro_level=4, 
                                         )[0]
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 9
      7 import xarray as xr
      8 import matplotlib.pyplot as plt
----> 9 import igm
     11 import warnings
     12 warnings.filterwarnings(action='ignore', category=UserWarning)

ModuleNotFoundError: No module named 'igm'

Add consensus and cook thickness product to the gdir#

# add consensus now as well, as we use a different prepro
from oggm.shop import bedtopo
workflow.execute_entity_task(bedtopo.add_consensus_thickness, gdir);
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[2], line 3
      1 # add consensus now as well, as we use a different prepro
      2 from oggm.shop import bedtopo
----> 3 workflow.execute_entity_task(bedtopo.add_consensus_thickness, gdir);

NameError: name 'gdir' is not defined
from oggm.shop import cook23
cook23.cook23_to_gdir(gdir)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[3], line 2
      1 from oggm.shop import cook23
----> 2 cook23.cook23_to_gdir(gdir)

NameError: name 'gdir' is not defined

Activate the 3 lines of code in the following code block to match the starting volume with the consensus volume (Farinotti et al. 2019)#

Note: the consensus volume is used as a reference volume for OGGM’s dynamic spinup during the bed inversion as a reference volume, but in the further workflow only the RGI-area is matched and not the consensus volume.#

# match of consensus
# ### Recompute the volume to match Farinotti et al. 2019 (for consistency with IGM later) 
# from oggm.global_tasks import calibrate_inversion_from_consensus
# calibrate_inversion_from_consensus([gdir])
# get ready for modelling
# tasks.init_present_time_glacier(gdir)

Running OGGM Flowline with a GCM Climate#

# you can choose one of these 5 different GCMs:
# 'gfdl-esm4_r1i1p1f1', 'mpi-esm1-2-hr_r1i1p1f1', 'mri-esm2-0_r1i1p1f1' ("low sensitivity" models, within typical ranges from AR6)
# 'ipsl-cm6a-lr_r1i1p1f1', 'ukesm1-0-ll_r1i1p1f2' ("hotter" models, especially ukesm1-0-ll)
member = 'mri-esm2-0_r1i1p1f1' 

for ssp in ['ssp126', 'ssp370','ssp585']:
    # bias correct them
    workflow.execute_entity_task(gcm_climate.process_monthly_isimip_data, gdir, 
                                 ssp = ssp,
                                 # gcm member -> you can choose another one
                                 member=member,
                                 # recognize the climate file for later
                                 output_filesuffix=f'_ISIMIP3b_{member}_{ssp}',
                                 );
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[5], line 8
      4 member = 'mri-esm2-0_r1i1p1f1' 
      6 for ssp in ['ssp126', 'ssp370','ssp585']:
      7     # bias correct them
----> 8     workflow.execute_entity_task(gcm_climate.process_monthly_isimip_data, gdir, 
      9                                  ssp = ssp,
     10                                  # gcm member -> you can choose another one
     11                                  member=member,
     12                                  # recognize the climate file for later
     13                                  output_filesuffix=f'_ISIMIP3b_{member}_{ssp}',
     14                                  );

NameError: name 'gdir' is not defined
for ssp in ['ssp126', 'ssp370', 'ssp585']:
    rid = f'_ISIMIP3b_{member}_{ssp}'
    workflow.execute_entity_task(tasks.run_from_climate_data, gdir,
                                 climate_filename='gcm_data',  # use gcm_data, not climate_historical
                                 climate_input_filesuffix=rid,  # use the chosen scenario
                                 init_model_filesuffix='_spinup_historical',  # this is important! Start from 2020 glacier
                                 output_filesuffix=rid, 
                                 store_fl_diagnostics = True # recognize the run for later
                                );
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[6], line 3
      1 for ssp in ['ssp126', 'ssp370', 'ssp585']:
      2     rid = f'_ISIMIP3b_{member}_{ssp}'
----> 3     workflow.execute_entity_task(tasks.run_from_climate_data, gdir,
      4                                  climate_filename='gcm_data',  # use gcm_data, not climate_historical
      5                                  climate_input_filesuffix=rid,  # use the chosen scenario
      6                                  init_model_filesuffix='_spinup_historical',  # this is important! Start from 2020 glacier
      7                                  output_filesuffix=rid, 
      8                                  store_fl_diagnostics = True # recognize the run for later
      9                                 );

NameError: name 'gdir' is not defined

create the corresponding mass balance model(MB model) of the run above, so that the iOGGM run can be forced with same MB model#

(using this MB model with the instructed-oggm doesn’t work yet)#

mb_gcm = massbalance.MultipleFlowlineMassBalance(gdir, 
                                                   filename='gcm_data',
                                                   bias=0,
                                                   input_filesuffix=f'_ISIMIP3b_{member}_ssp370')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[7], line 1
----> 1 mb_gcm = massbalance.MultipleFlowlineMassBalance(gdir, 
      2                                                    filename='gcm_data',
      3                                                    bias=0,
      4                                                    input_filesuffix=f'_ISIMIP3b_{member}_ssp370')

NameError: name 'gdir' is not defined

Running OGGM Flowline with a Random Climate#

this run is forced with climate data from 1999-2019 randomly sampled#

# Do a random run with a bit of warming
tasks.run_random_climate(gdir, nyears=100, 
                         y0=2009, halfsize=10, # Climate of 1999-2019
                         seed=1,  # Change for another randomness 
                         temperature_bias=0,  # casual warming - change for other scenarios
                         store_fl_diagnostics=True,  # important! This will be needed for the redistribution
                         output_filesuffix='_rdn_1',  # name the run
                         init_model_filesuffix='_spinup_historical',
                        );
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[8], line 2
      1 # Do a random run with a bit of warming
----> 2 tasks.run_random_climate(gdir, nyears=100, 
      3                          y0=2009, halfsize=10, # Climate of 1999-2019
      4                          seed=1,  # Change for another randomness 
      5                          temperature_bias=0,  # casual warming - change for other scenarios
      6                          store_fl_diagnostics=True,  # important! This will be needed for the redistribution
      7                          output_filesuffix='_rdn_1',  # name the run
      8                          init_model_filesuffix='_spinup_historical',
      9                         );

NameError: name 'gdir' is not defined

create the corresponding random mass balance model(MB model) of the run above, so that the iOGGM run can be forced with same random MB model#

mb_rand = massbalance.RandomMassBalance(gdir,
                                   y0=2009, halfsize=10, # Climate of 1999-2019
                                   seed=1,  # Change for another randomness
                                   )
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[9], line 1
----> 1 mb_rand = massbalance.RandomMassBalance(gdir,
      2                                    y0=2009, halfsize=10, # Climate of 1999-2019
      3                                    seed=1,  # Change for another randomness
      4                                    )

NameError: name 'gdir' is not defined
with xr.open_dataset(gdir.get_filepath('gridded_data')) as gd:
    gd = gd.load()

# set values outside the glacier to np.nan
# using the glacier mask, as otherwise there is more ice from surrounding glaciers in the domain, 
# which shouldn't accumulate more ice, still adds to the total volume/area of the domain.. either mask it out beforehand or before doing plots.
# experiment with it: does the mass outside of the mask only decrease? => ?
gd['cook23_thk_masked'] = xr.where(gd.glacier_mask, gd.cook23_thk, np.nan)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[10], line 1
----> 1 with xr.open_dataset(gdir.get_filepath('gridded_data')) as gd:
      2     gd = gd.load()
      4 # set values outside the glacier to np.nan
      5 # using the glacier mask, as otherwise there is more ice from surrounding glaciers in the domain, 
      6 # which shouldn't accumulate more ice, still adds to the total volume/area of the domain.. either mask it out beforehand or before doing plots.
      7 # experiment with it: does the mass outside of the mask only decrease? => ?

NameError: name 'gdir' is not defined
bed_con = gd.topo - gd.consensus_ice_thickness.fillna(0)
bed_cook_masked = gd.topo - gd.cook23_thk_masked.fillna(0)
bed_cook = gd.topo - gd.cook23_thk
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[11], line 1
----> 1 bed_con = gd.topo - gd.consensus_ice_thickness.fillna(0)
      2 bed_cook_masked = gd.topo - gd.cook23_thk_masked.fillna(0)
      3 bed_cook = gd.topo - gd.cook23_thk

NameError: name 'gd' is not defined

Running the iOGGM from the consensus ice thickness (Farinotti et al. 2019)#

once with random and once with the same GCM climate as above#

############################### OGGM-IGM - CONSENSUS - RANDOM CLIMATE
from igm.instructed_oggm import IGM_Model2D

sdmodel_igm_con_rnd = IGM_Model2D(bed_con.values, init_ice_thick=gd.consensus_ice_thickness.fillna(0).values, 
                     dx=gdir.grid.dx, dy=gdir.grid.dy, x=bed_con.x, y=bed_con.y, mb_model=mb_rand, 
                        y0=0., mb_filter=gd.glacier_mask.values==1)

dsr_igm_con_rnd = sdmodel_igm_con_rnd.run_until_and_store(100, grid=gdir.grid)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[12], line 2
      1 ############################### OGGM-IGM - CONSENSUS - RANDOM CLIMATE
----> 2 from igm.instructed_oggm import IGM_Model2D
      4 sdmodel_igm_con_rnd = IGM_Model2D(bed_con.values, init_ice_thick=gd.consensus_ice_thickness.fillna(0).values, 
      5                      dx=gdir.grid.dx, dy=gdir.grid.dy, x=bed_con.x, y=bed_con.y, mb_model=mb_rand, 
      6                         y0=0., mb_filter=gd.glacier_mask.values==1)
      8 dsr_igm_con_rnd = sdmodel_igm_con_rnd.run_until_and_store(100, grid=gdir.grid)

ModuleNotFoundError: No module named 'igm'
############################### OGGM-IGM - CONSENSUS - GCM CLIMATE
from igm.instructed_oggm import IGM_Model2D

sdmodel_igm_con_gcm = IGM_Model2D(bed_con.values, init_ice_thick=gd.consensus_ice_thickness.fillna(0).values, 
                                    dx=gdir.grid.dx, dy=gdir.grid.dy, x=bed_con.x, y=bed_con.y, mb_model=mb_gcm, 
                                    y0=gdir.rgi_date, mb_filter=gd.glacier_mask.values==1)
dsr_igm_con_gcm = sdmodel_igm_con_gcm.run_until_and_store(2100, grid=gdir.grid)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[13], line 2
      1 ############################### OGGM-IGM - CONSENSUS - GCM CLIMATE
----> 2 from igm.instructed_oggm import IGM_Model2D
      4 sdmodel_igm_con_gcm = IGM_Model2D(bed_con.values, init_ice_thick=gd.consensus_ice_thickness.fillna(0).values, 
      5                                     dx=gdir.grid.dx, dy=gdir.grid.dy, x=bed_con.x, y=bed_con.y, mb_model=mb_gcm, 
      6                                     y0=gdir.rgi_date, mb_filter=gd.glacier_mask.values==1)
      7 dsr_igm_con_gcm = sdmodel_igm_con_gcm.run_until_and_store(2100, grid=gdir.grid)

ModuleNotFoundError: No module named 'igm'

Running the iOGGM from the Cook et al. 2023 ice thickness product#

once with random and once with the same GCM climate as above#

############################### OGGM-IGM - COOK_23 - RANDOM CLIMATE
sdmodel_igm_cook_rnd = IGM_Model2D(bed_cook_masked.values, init_ice_thick=gd.cook23_thk_masked.fillna(0).values, 
                     dx=gdir.grid.dx, dy=gdir.grid.dy, x=bed_cook_masked.x, y=bed_cook_masked.y, mb_model=mb_rand, 
                        y0=0., mb_filter=gd.glacier_mask.values==1)

dsr_igm_cook_rnd = sdmodel_igm_cook_rnd.run_until_and_store(100, grid=gdir.grid)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[14], line 2
      1 ############################### OGGM-IGM - COOK_23 - RANDOM CLIMATE
----> 2 sdmodel_igm_cook_rnd = IGM_Model2D(bed_cook_masked.values, init_ice_thick=gd.cook23_thk_masked.fillna(0).values, 
      3                      dx=gdir.grid.dx, dy=gdir.grid.dy, x=bed_cook_masked.x, y=bed_cook_masked.y, mb_model=mb_rand, 
      4                         y0=0., mb_filter=gd.glacier_mask.values==1)
      6 dsr_igm_cook_rnd = sdmodel_igm_cook_rnd.run_until_and_store(100, grid=gdir.grid)

NameError: name 'IGM_Model2D' is not defined
############################### OGGM-IGM - COOK_23 - GCM CLIMATE
sdmodel_igm_cook_gcm = IGM_Model2D(bed_cook_masked.values, init_ice_thick=gd.cook23_thk_masked.fillna(0).values, 
                     dx=gdir.grid.dx, dy=gdir.grid.dy, x=bed_cook_masked.x, y=bed_cook_masked.y, mb_model=mb_gcm, 
                        y0=gdir.rgi_date, mb_filter=gd.glacier_mask.values==1)

dsr_igm_cook_gcm = sdmodel_igm_cook_gcm.run_until_and_store(2100, grid=gdir.grid)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[15], line 2
      1 ############################### OGGM-IGM - COOK_23 - GCM CLIMATE
----> 2 sdmodel_igm_cook_gcm = IGM_Model2D(bed_cook_masked.values, init_ice_thick=gd.cook23_thk_masked.fillna(0).values, 
      3                      dx=gdir.grid.dx, dy=gdir.grid.dy, x=bed_cook_masked.x, y=bed_cook_masked.y, mb_model=mb_gcm, 
      4                         y0=gdir.rgi_date, mb_filter=gd.glacier_mask.values==1)
      6 dsr_igm_cook_gcm = sdmodel_igm_cook_gcm.run_until_and_store(2100, grid=gdir.grid)

NameError: name 'IGM_Model2D' is not defined

load the data from disk for plotting#

with xr.open_dataset(gdir.get_filepath('fl_diagnostics', filesuffix='_ISIMIP3b_mri-esm2-0_r1i1p1f1_ssp370'), group=f'fl_0') as ds_gcm:
    ds_gcm = ds_gcm.load()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[16], line 1
----> 1 with xr.open_dataset(gdir.get_filepath('fl_diagnostics', filesuffix='_ISIMIP3b_mri-esm2-0_r1i1p1f1_ssp370'), group=f'fl_0') as ds_gcm:
      2     ds_gcm = ds_gcm.load()

NameError: name 'gdir' is not defined
with xr.open_dataset(gdir.get_filepath('fl_diagnostics', filesuffix='_rdn_1'), group=f'fl_0') as ds_rnd:
    ds_rnd = ds_rnd.load()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[17], line 1
----> 1 with xr.open_dataset(gdir.get_filepath('fl_diagnostics', filesuffix='_rdn_1'), group=f'fl_0') as ds_rnd:
      2     ds_rnd = ds_rnd.load()

NameError: name 'gdir' is not defined
with xr.open_dataset(gdir.get_filepath('fl_diagnostics', filesuffix='_spinup_historical'), group=f'fl_0') as spinup:
    spinup = spinup.load()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[18], line 1
----> 1 with xr.open_dataset(gdir.get_filepath('fl_diagnostics', filesuffix='_spinup_historical'), group=f'fl_0') as spinup:
      2     spinup = spinup.load()

NameError: name 'gdir' is not defined

adapt starting date for the random runs#

for df in [ds_rnd, dsr_igm_con_rnd, dsr_igm_cook_rnd]:
    df.coords['time'] = df.coords['time'] + gdir.rgi_date
ds_rnd.coords['time'] =  ds_rnd.coords['time'] + (int(spinup.coords['time'][-1])-gdir.rgi_date) 
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[19], line 1
----> 1 for df in [ds_rnd, dsr_igm_con_rnd, dsr_igm_cook_rnd]:
      2     df.coords['time'] = df.coords['time'] + gdir.rgi_date
      3 ds_rnd.coords['time'] =  ds_rnd.coords['time'] + (int(spinup.coords['time'][-1])-gdir.rgi_date) 

NameError: name 'ds_rnd' is not defined

Comparison plots#

Volume plot - both scenarios#

# comparison plots
# OGGM Flowline
(ds_gcm.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - ISIMIP - ssp370');
(ds_rnd.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - RAND_CLIM');
(spinup.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - SPINUP', color='navy');

# IGM (from consensus volume)
(dsr_igm_con_rnd.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - CONSENSUS - RAND_CLIM');
(dsr_igm_con_gcm.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - CONSENSUS - ISIMIP - ssp370');

# IGM (from cook23 volume)
(dsr_igm_cook_rnd.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - COOK - RAND_CLIM');
(dsr_igm_cook_gcm.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - COOK - ISIMIP - ssp370');

plt.ylabel('VOLUME in km^3')
plt.xlabel('YEAR')
plt.title('Volume evolution comparison of different model runs\n OGGM(+dynamic spinup) and IGM');
plt.legend();
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[20], line 3
      1 # comparison plots
      2 # OGGM Flowline
----> 3 (ds_gcm.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - ISIMIP - ssp370');
      4 (ds_rnd.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - RAND_CLIM');
      5 (spinup.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - SPINUP', color='navy');

NameError: name 'ds_gcm' is not defined

volume plot cropped - GCM only#

# comparison plots
# OGGM Flowline
(ds_gcm.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - ISIMIP - ssp370');
# (ds_rnd.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - RAND_CLIM');
(spinup.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - SPINUP', color='navy');

# IGM (from consensus volume)
# (dsr_igm_con_rnd.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - CONSENSUS - RAND_CLIM');
(dsr_igm_con_gcm.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - CONSENSUS - ISIMIP - ssp370');

# IGM (from cook23 volume)
# (dsr_igm_cook_rnd.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - COOK - RAND_CLIM');
(dsr_igm_cook_gcm.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - COOK - ISIMIP - ssp370');

# rgi date
plt.axvline(x=2003, color='navy', linestyle=':', label='RGI-date')
plt.text(2003.1, 7, 'RGI-date', rotation=90, verticalalignment='bottom', color='navy')

# 2020
plt.axvline(x=2020, color='navy', linestyle=':', label='2020')
plt.text(2020.1, 7, '2020', rotation=90, verticalalignment='bottom', color='navy')

plt.ylabel('VOLUME in km^3')
plt.xlabel('YEAR')

plt.xlim(1995, 2030)
# plt.ylim()
plt.title('Volume evolution comparison of different model runs\n OGGM(+dynamic spinup) and IGM\n'
            'highlighting spinup time');
# plt.xlim(2000, 2030)
# plt.ylim(8, 15)
plt.legend();
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[21], line 3
      1 # comparison plots
      2 # OGGM Flowline
----> 3 (ds_gcm.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - ISIMIP - ssp370');
      4 # (ds_rnd.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - RAND_CLIM');
      5 (spinup.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - SPINUP', color='navy');

NameError: name 'ds_gcm' is not defined

gcm climate only - volume plot#

(ds_gcm.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - ISIMIP - ssp370');
(spinup.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - SPINUP FROM CONSENSUS', color='navy');
(dsr_igm_con_gcm.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - CONSENSUS - ISIMIP - ssp370');
(dsr_igm_cook_gcm.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - COOK - ISIMIP - ssp370');
plt.ylabel('VOLUME in km^3')
plt.xlabel('YEAR')
plt.title('Volume evolution comparison of different model runs\n OGGM(+dynamic spinup) and IGM\n \" climate\"');
plt.legend();
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[22], line 1
----> 1 (ds_gcm.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - ISIMIP - ssp370');
      2 (spinup.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - SPINUP FROM CONSENSUS', color='navy');
      3 (dsr_igm_con_gcm.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - CONSENSUS - ISIMIP - ssp370');

NameError: name 'ds_gcm' is not defined

random climate only - volume plot#

(ds_rnd.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - RAND_CLIM');
(spinup.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - SPINUP', color='navy');
(dsr_igm_con_rnd.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - CONSENSUS - RAND_CLIM');
(dsr_igm_cook_rnd.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - COOK - RAND_CLIM');
plt.ylabel('VOLUME in km^3')
plt.xlabel('YEAR')
plt.title('Volume evolution comparison of different model runs\n OGGM(+dynamic spinup) and IGM\n \"random climate\"');
plt.legend();
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[23], line 1
----> 1 (ds_rnd.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - RAND_CLIM');
      2 (spinup.volume_m3.sum(dim=['dis_along_flowline'])*1e-9).plot(label='OGGM-Flowline - SPINUP', color='navy');
      3 (dsr_igm_con_rnd.ice_thickness.sum(dim=['x', 'y'])*gdir.grid.dx**2*1e-9).plot(label='OGGM-IGM - CONSENSUS - RAND_CLIM');

NameError: name 'ds_rnd' is not defined
(spinup.area_m2.sum(dim=['dis_along_flowline'])*1e-6).plot(label='OGGM-Flowline - SPINUP', color='navy');
(ds_gcm.area_m2.sum(dim=['dis_along_flowline'])*1e-6).plot(label='OGGM-Flowline - ISIMIP - ssp370');
# (ds_rnd.area_m2.sum(dim=['dis_along_flowline'])*1e-6).plot(label='OGGM-Flowline - RAND_CLIM');


# ((dsr_igm_con_rnd.ice_thickness > 1).sum(dim=['x', 'y']) *gdir.grid.dx**2*1e-6).plot(label='OGGM-IGM - CONSENSUS- RAND_CLIM');
((dsr_igm_con_gcm.ice_thickness > 1).sum(dim=['x', 'y']) *gdir.grid.dx**2*1e-6).plot(label='OGGM-IGM - CONSENSUS - ISIMIP - ssp370');
# ((dsr_igm_cook_rnd.ice_thickness > 1).sum(dim=['x', 'y']) *gdir.grid.dx**2*1e-6).plot(label='OGGM-IGM - COOK - RAND_CLIM');
((dsr_igm_cook_gcm.ice_thickness > 1).sum(dim=['x', 'y']) *gdir.grid.dx**2*1e-6).plot(label='OGGM-IGM - COOK - ISIMIP - ssp370');
plt.ylabel('AREA in km^2')
plt.xlabel('YEAR')
# plt.xlim(2000, 2030)
# plt.ylim(75, 90)
plt.legend();
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[24], line 1
----> 1 (spinup.area_m2.sum(dim=['dis_along_flowline'])*1e-6).plot(label='OGGM-Flowline - SPINUP', color='navy');
      2 (ds_gcm.area_m2.sum(dim=['dis_along_flowline'])*1e-6).plot(label='OGGM-Flowline - ISIMIP - ssp370');
      3 # (ds_rnd.area_m2.sum(dim=['dis_along_flowline'])*1e-6).plot(label='OGGM-Flowline - RAND_CLIM');
      4 
      5 
      6 # ((dsr_igm_con_rnd.ice_thickness > 1).sum(dim=['x', 'y']) *gdir.grid.dx**2*1e-6).plot(label='OGGM-IGM - CONSENSUS- RAND_CLIM');

NameError: name 'spinup' is not defined