Run with a long spinup and GCM data

Contents

Run with a long spinup and GCM data#

The initial state of glaciers play a large role for the model output. In this example we illustrate how to “spinup” a glacier (e.g.: make them grow) before running over the period of interest. For this example we use climate data from the CESM Last Millennium Ensemble.

# Libs
import matplotlib.pyplot as plt

# Locals
import oggm.cfg as cfg
from oggm import tasks, utils, workflow
from oggm.workflow import execute_entity_task
from oggm.utils import get_demo_file
# Initialize OGGM and set up the default run parameters
cfg.initialize()

# Local working directory (where OGGM will write its output)
cfg.PATHS['working_dir'] = utils.gettempdir('OGGM_spinup_run')

# Use multiprocessing?
cfg.PARAMS['use_multiprocessing'] = False

# This is necessary for spinup runs!
cfg.PARAMS['store_model_geometry'] = True
2026-07-20 13:39:25: oggm.cfg: Reading default parameters from the OGGM `params.cfg` configuration file.
2026-07-20 13:39:25: oggm.cfg: Multiprocessing switched OFF according to the parameter file.
2026-07-20 13:39:25: oggm.cfg: Multiprocessing: using all available processors (N=4)
2026-07-20 13:39:25: oggm.cfg: PARAMS['store_model_geometry'] changed from `False` to `True`.

Pre-processed directories are being used here.

# How many grid points around the glacier?
# Make it large if you expect your glaciers to grow large
cfg.PARAMS['border'] = 80

# Go - initialize glacier directories
# in OGGM v1.6 you have to explicitly indicate the url from where you want to start from
# we will use here the elevation band flowlines which are much simpler than the centerlines
base_url = 'https://cluster.klima.uni-bremen.de/~oggm/gdirs/oggm_v1.6/L3-L5_files/2025.6/elev_bands/W5E5/per_glacier/'
gdirs = workflow.init_glacier_directories(['RGI60-11.00897'], from_prepro_level=5,
                                          prepro_base_url=base_url)
2026-07-20 13:39:26: oggm.workflow: init_glacier_directories from prepro level 5 on 1 glaciers.
2026-07-20 13:39:26: oggm.workflow: Execute entity tasks [gdir_from_prepro] on 1 glaciers
2026-07-20 13:39:26: oggm.utils: Downloading https://cluster.klima.uni-bremen.de/~oggm/gdirs/oggm_v1.6/L3-L5_files/2025.6/elev_bands/W5E5/per_glacier/RGI62/b_080/L5/RGI60-11/RGI60-11.008.tar to /github/home/OGGM/download_cache/cluster.klima.uni-bremen.de/~oggm/gdirs/oggm_v1.6/L3-L5_files/2025.6/elev_bands/W5E5/per_glacier/RGI62/b_080/L5/RGI60-11/RGI60-11.008.tar...

Here the paths to the CESM-LME files are set. (The demo files that are being used in this example don’t contain the whole last millennium, neither do they have the global coverage that they original files have. These demo files have been made for test purposes and to reduce the time it takes to run the example. If you use the demo files for a glacier outside the domain, you won’t get an error. Instead, the climate of the nearest point to the glacier that is available in the demo files will be used, which could be thousands of kilometers away.)

# Additional climate file (CESM)
cfg.PATHS['cesm_temp_file'] = get_demo_file('cesm.TREFHT.160001-200512'
                                            '.selection.nc')
cfg.PATHS['cesm_precc_file'] = get_demo_file('cesm.PRECC.160001-200512'
                                             '.selection.nc')
cfg.PATHS['cesm_precl_file'] = get_demo_file('cesm.PRECL.160001-200512'
                                             '.selection.nc')
execute_entity_task(tasks.process_cesm_data, gdirs);
2026-07-20 13:39:27: oggm.workflow: Execute entity tasks [process_cesm_data] on 1 glaciers
2026-07-20 13:39:27: oggm.shop.gcm_climate: (RGI60-11.00897) process_cesm_data
2026-07-20 13:39:27: oggm.shop.gcm_climate: (RGI60-11.00897) process_gcm_data

Here the CESM-LME data is being pre-processed. This process makes use of the delta method and uses scaled temperature anomalies by default (it is strongly recommended to use this default setting of scaling the temperature anomalies, unless you have very good reasons not to do so).

execute_entity_task(tasks.process_cesm_data, gdirs);
2026-07-20 13:39:27: oggm.workflow: Execute entity tasks [process_cesm_data] on 1 glaciers
2026-07-20 13:39:27: oggm.shop.gcm_climate: (RGI60-11.00897) process_cesm_data
2026-07-20 13:39:27: oggm.shop.gcm_climate: (RGI60-11.00897) process_gcm_data
# Run the last 200 years with the default starting point (current glacier)
# and CESM data as input
execute_entity_task(tasks.run_from_climate_data, gdirs,
                    climate_filename='gcm_data',
                    ys=1801, ye=2000,
                    output_filesuffix='_no_spinup');
2026-07-20 13:39:27: oggm.workflow: Execute entity tasks [run_from_climate_data] on 1 glaciers
2026-07-20 13:39:27: oggm.core.flowline: (RGI60-11.00897) run_from_climate_data_no_spinup
2026-07-20 13:39:27: oggm.core.flowline: You are attempting to run_with_climate_data at dates prior to the RGI inventory date. This may indicate some problem in your workflow. Consider using `fixed_geometry_spinup_yr` for example.
2026-07-20 13:39:27: oggm.core.flowline: InvalidWorkflowError occurred during task run_from_climate_data_no_spinup on RGI60-11.00897: You seem to have calibrated with the GSWP3_W5E5 climate data while this gdir was calibrated with . Set `check_calib_params=False` to ignore this warning.
---------------------------------------------------------------------------
InvalidWorkflowError                      Traceback (most recent call last)
Cell In[6], line 3
      1 # Run the last 200 years with the default starting point (current glacier)
      2 # and CESM data as input
----> 3 execute_entity_task(tasks.run_from_climate_data, gdirs,
      4                     climate_filename='gcm_data',
      5                     ys=1801, ye=2000,
      6                     output_filesuffix='_no_spinup');

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/workflow.py:208, in execute_entity_task(task, gdirs, **kwargs)
    204     if ng > 3:
    205         log.workflow('WARNING: you are trying to run an entity task on '
    206                      '%d glaciers with multiprocessing turned off. OGGM '
    207                      'will run faster with multiprocessing turned on.', ng)
--> 208     out = [pc(gdir) for gdir in gdirs]
    210 return out

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/workflow.py:125, in _pickle_copier.__call__(self, arg)
    123 for func in self.call_func:
    124     func, kwargs = func
--> 125     res = self._call_internal(func, arg, kwargs)
    126 return res

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/workflow.py:119, in _pickle_copier._call_internal(self, call_func, gdir, kwargs)
    116     gdir, gdir_kwargs = gdir
    117     kwargs.update(gdir_kwargs)
--> 119 return call_func(gdir, **kwargs)

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/utils/_workflow.py:522, in entity_task.__call__.<locals>._entity_task(gdir, reset, print_log, return_value, continue_on_error, add_to_log_file, **kwargs)
    520     signal.alarm(gdir.settings['task_timeout'])
    521 ex_t = time.time()
--> 522 out = task_func(gdir, **kwargs)
    523 ex_t = time.time() - ex_t
    524 if gdir.settings['task_timeout'] > 0:

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/core/flowline.py:4480, in run_from_climate_data(gdir, settings_filesuffix, ys, ye, min_ys, max_ys, fixed_geometry_spinup_yr, store_monthly_step, store_model_geometry, store_fl_diagnostics, climate_filename, mb_model, mb_model_class, climate_input_filesuffix, output_filesuffix, init_model_filesuffix, init_model_yr, init_model_fls, zero_initial_glacier, bias, temperature_bias, precipitation_factor, mb_diagnostics_filesuffix, save_mb_diagnostics_filesuffix, **kwargs)
   4473         mb_model = MultipleFlowlineMassBalance.load_from_file(
   4474             gdir,
   4475             filesuffix=mb_diagnostics_filesuffix,
   4476             climate_filename=_branch_fn,
   4477             climate_input_filesuffix=_branch_isuf,
   4478         )
   4479     else:
-> 4480         mb_model = MultipleFlowlineMassBalance(
   4481             gdir,
   4482             mb_model_class=mb_model_class,
   4483             filename=climate_filename,
   4484             bias=bias,
   4485             input_filesuffix=climate_input_filesuffix,
   4486             settings_filesuffix=settings_filesuffix,
   4487         )
   4489 if temperature_bias is not None:
   4490     mb_model.temp_bias += temperature_bias

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/core/massbalance.py:3494, in MultipleFlowlineMassBalance.__init__(self, gdir, settings_filesuffix, fls, mb_model_class, use_inversion_flowlines, flowlines_filesuffix, input_filesuffix, **kwargs)
   3490     if rgi_filesuffix is not None:
   3491         kwargs['input_filesuffix'] = rgi_filesuffix
   3493     self.flowline_mb_models.append(
-> 3494         mb_model_class(
   3495             gdir=gdir,
   3496             settings_filesuffix=settings_filesuffix,
   3497             **kwargs,
   3498         )
   3499     )
   3501 self.valid_bounds = self.flowline_mb_models[-1].valid_bounds
   3502 self.hemisphere = gdir.hemisphere

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/core/massbalance.py:594, in MonthlyTIModel.__init__(self, gdir, filename, input_filesuffix, settings_filesuffix, fl_id, melt_f, temp_bias, prcp_fac, bias, temp_melt, ys, ye, repeat, check_calib_params, check_climate_data, use_leap_years)
    589     if src != src_calib:
    590         msg = (f'You seem to have calibrated with the {src} '
    591                f"climate data while this gdir was calibrated with "
    592                f"{src_calib}. Set `check_calib_params=False` to "
    593                f"ignore this warning.")
--> 594         raise InvalidWorkflowError(msg)
    596 self.melt_f = melt_f
    597 self.bias = bias

InvalidWorkflowError: You seem to have calibrated with the GSWP3_W5E5 climate data while this gdir was calibrated with . Set `check_calib_params=False` to ignore this warning.
# Run the spinup simulation: a rather "cold" climate with a cold temperature bias
execute_entity_task(tasks.run_constant_climate, gdirs, y0 = 1965,
                    nyears=100, bias=0, 
                    output_filesuffix='_spinup')
# Run a past climate run based on this spinup
execute_entity_task(tasks.run_from_climate_data, gdirs,
                    climate_filename='gcm_data',
                    ys=1801, ye=2000,
                    init_model_filesuffix='_spinup',
                    output_filesuffix='_with_spinup');
2026-07-20 13:39:28: oggm.workflow: Execute entity tasks [run_constant_climate] on 1 glaciers
2026-07-20 13:39:28: oggm.core.flowline: (RGI60-11.00897) run_constant_climate_spinup
2026-07-20 13:39:28: oggm.core.flowline: (RGI60-11.00897) flowline_model_run_spinup
2026-07-20 13:39:29: oggm.workflow: Execute entity tasks [run_from_climate_data] on 1 glaciers
2026-07-20 13:39:29: oggm.core.flowline: (RGI60-11.00897) run_from_climate_data_with_spinup
2026-07-20 13:39:29: oggm.core.flowline: InvalidWorkflowError occurred during task run_from_climate_data_with_spinup on RGI60-11.00897: You seem to have calibrated with the GSWP3_W5E5 climate data while this gdir was calibrated with . Set `check_calib_params=False` to ignore this warning.
---------------------------------------------------------------------------
InvalidWorkflowError                      Traceback (most recent call last)
Cell In[7], line 6
      2 execute_entity_task(tasks.run_constant_climate, gdirs, y0 = 1965,
      3                     nyears=100, bias=0,
      4                     output_filesuffix='_spinup')
      5 # Run a past climate run based on this spinup
----> 6 execute_entity_task(tasks.run_from_climate_data, gdirs,
      7                     climate_filename='gcm_data',
      8                     ys=1801, ye=2000,
      9                     init_model_filesuffix='_spinup',

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/workflow.py:208, in execute_entity_task(task, gdirs, **kwargs)
    204     if ng > 3:
    205         log.workflow('WARNING: you are trying to run an entity task on '
    206                      '%d glaciers with multiprocessing turned off. OGGM '
    207                      'will run faster with multiprocessing turned on.', ng)
--> 208     out = [pc(gdir) for gdir in gdirs]
    210 return out

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/workflow.py:125, in _pickle_copier.__call__(self, arg)
    123 for func in self.call_func:
    124     func, kwargs = func
--> 125     res = self._call_internal(func, arg, kwargs)
    126 return res

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/workflow.py:119, in _pickle_copier._call_internal(self, call_func, gdir, kwargs)
    116     gdir, gdir_kwargs = gdir
    117     kwargs.update(gdir_kwargs)
--> 119 return call_func(gdir, **kwargs)

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/utils/_workflow.py:522, in entity_task.__call__.<locals>._entity_task(gdir, reset, print_log, return_value, continue_on_error, add_to_log_file, **kwargs)
    520     signal.alarm(gdir.settings['task_timeout'])
    521 ex_t = time.time()
--> 522 out = task_func(gdir, **kwargs)
    523 ex_t = time.time() - ex_t
    524 if gdir.settings['task_timeout'] > 0:

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/core/flowline.py:4480, in run_from_climate_data(gdir, settings_filesuffix, ys, ye, min_ys, max_ys, fixed_geometry_spinup_yr, store_monthly_step, store_model_geometry, store_fl_diagnostics, climate_filename, mb_model, mb_model_class, climate_input_filesuffix, output_filesuffix, init_model_filesuffix, init_model_yr, init_model_fls, zero_initial_glacier, bias, temperature_bias, precipitation_factor, mb_diagnostics_filesuffix, save_mb_diagnostics_filesuffix, **kwargs)
   4473         mb_model = MultipleFlowlineMassBalance.load_from_file(
   4474             gdir,
   4475             filesuffix=mb_diagnostics_filesuffix,
   4476             climate_filename=_branch_fn,
   4477             climate_input_filesuffix=_branch_isuf,
   4478         )
   4479     else:
-> 4480         mb_model = MultipleFlowlineMassBalance(
   4481             gdir,
   4482             mb_model_class=mb_model_class,
   4483             filename=climate_filename,
   4484             bias=bias,
   4485             input_filesuffix=climate_input_filesuffix,
   4486             settings_filesuffix=settings_filesuffix,
   4487         )
   4489 if temperature_bias is not None:
   4490     mb_model.temp_bias += temperature_bias

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/core/massbalance.py:3494, in MultipleFlowlineMassBalance.__init__(self, gdir, settings_filesuffix, fls, mb_model_class, use_inversion_flowlines, flowlines_filesuffix, input_filesuffix, **kwargs)
   3490     if rgi_filesuffix is not None:
   3491         kwargs['input_filesuffix'] = rgi_filesuffix
   3493     self.flowline_mb_models.append(
-> 3494         mb_model_class(
   3495             gdir=gdir,
   3496             settings_filesuffix=settings_filesuffix,
   3497             **kwargs,
   3498         )
   3499     )
   3501 self.valid_bounds = self.flowline_mb_models[-1].valid_bounds
   3502 self.hemisphere = gdir.hemisphere

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/core/massbalance.py:594, in MonthlyTIModel.__init__(self, gdir, filename, input_filesuffix, settings_filesuffix, fl_id, melt_f, temp_bias, prcp_fac, bias, temp_melt, ys, ye, repeat, check_calib_params, check_climate_data, use_leap_years)
    589     if src != src_calib:
    590         msg = (f'You seem to have calibrated with the {src} '
    591                f"climate data while this gdir was calibrated with "
    592                f"{src_calib}. Set `check_calib_params=False` to "
    593                f"ignore this warning.")
--> 594         raise InvalidWorkflowError(msg)
    596 self.melt_f = melt_f
    597 self.bias = bias

InvalidWorkflowError: You seem to have calibrated with the GSWP3_W5E5 climate data while this gdir was calibrated with . Set `check_calib_params=False` to ignore this warning.

When starting from a spin-up, by default the last year of the spin-up is being used to initialize a glacier. With init_model_yr, you can select any other year from the spin-up as initial year. An important parameter here is cfg.PARAMS['store_model_geometry'] = True set above, which told OGGM to store these “restart files” during the run.

# Run a past climate run based on this spinup
execute_entity_task(tasks.run_from_climate_data, gdirs,
                    climate_filename='gcm_data',
                    ys=1801, ye=2000, init_model_yr=50,
                    init_model_filesuffix='_spinup',
                    output_filesuffix='_with_spinup_50yr');
2026-07-20 13:39:29: oggm.workflow: Execute entity tasks [run_from_climate_data] on 1 glaciers
2026-07-20 13:39:29: oggm.core.flowline: (RGI60-11.00897) run_from_climate_data_with_spinup_50yr
2026-07-20 13:39:29: oggm.core.flowline: InvalidWorkflowError occurred during task run_from_climate_data_with_spinup_50yr on RGI60-11.00897: You seem to have calibrated with the GSWP3_W5E5 climate data while this gdir was calibrated with . Set `check_calib_params=False` to ignore this warning.
---------------------------------------------------------------------------
InvalidWorkflowError                      Traceback (most recent call last)
Cell In[8], line 2
      1 # Run a past climate run based on this spinup
----> 2 execute_entity_task(tasks.run_from_climate_data, gdirs,
      3                     climate_filename='gcm_data',
      4                     ys=1801, ye=2000, init_model_yr=50,
      5                     init_model_filesuffix='_spinup',

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/workflow.py:208, in execute_entity_task(task, gdirs, **kwargs)
    204     if ng > 3:
    205         log.workflow('WARNING: you are trying to run an entity task on '
    206                      '%d glaciers with multiprocessing turned off. OGGM '
    207                      'will run faster with multiprocessing turned on.', ng)
--> 208     out = [pc(gdir) for gdir in gdirs]
    210 return out

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/workflow.py:125, in _pickle_copier.__call__(self, arg)
    123 for func in self.call_func:
    124     func, kwargs = func
--> 125     res = self._call_internal(func, arg, kwargs)
    126 return res

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/workflow.py:119, in _pickle_copier._call_internal(self, call_func, gdir, kwargs)
    116     gdir, gdir_kwargs = gdir
    117     kwargs.update(gdir_kwargs)
--> 119 return call_func(gdir, **kwargs)

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/utils/_workflow.py:522, in entity_task.__call__.<locals>._entity_task(gdir, reset, print_log, return_value, continue_on_error, add_to_log_file, **kwargs)
    520     signal.alarm(gdir.settings['task_timeout'])
    521 ex_t = time.time()
--> 522 out = task_func(gdir, **kwargs)
    523 ex_t = time.time() - ex_t
    524 if gdir.settings['task_timeout'] > 0:

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/core/flowline.py:4480, in run_from_climate_data(gdir, settings_filesuffix, ys, ye, min_ys, max_ys, fixed_geometry_spinup_yr, store_monthly_step, store_model_geometry, store_fl_diagnostics, climate_filename, mb_model, mb_model_class, climate_input_filesuffix, output_filesuffix, init_model_filesuffix, init_model_yr, init_model_fls, zero_initial_glacier, bias, temperature_bias, precipitation_factor, mb_diagnostics_filesuffix, save_mb_diagnostics_filesuffix, **kwargs)
   4473         mb_model = MultipleFlowlineMassBalance.load_from_file(
   4474             gdir,
   4475             filesuffix=mb_diagnostics_filesuffix,
   4476             climate_filename=_branch_fn,
   4477             climate_input_filesuffix=_branch_isuf,
   4478         )
   4479     else:
-> 4480         mb_model = MultipleFlowlineMassBalance(
   4481             gdir,
   4482             mb_model_class=mb_model_class,
   4483             filename=climate_filename,
   4484             bias=bias,
   4485             input_filesuffix=climate_input_filesuffix,
   4486             settings_filesuffix=settings_filesuffix,
   4487         )
   4489 if temperature_bias is not None:
   4490     mb_model.temp_bias += temperature_bias

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/core/massbalance.py:3494, in MultipleFlowlineMassBalance.__init__(self, gdir, settings_filesuffix, fls, mb_model_class, use_inversion_flowlines, flowlines_filesuffix, input_filesuffix, **kwargs)
   3490     if rgi_filesuffix is not None:
   3491         kwargs['input_filesuffix'] = rgi_filesuffix
   3493     self.flowline_mb_models.append(
-> 3494         mb_model_class(
   3495             gdir=gdir,
   3496             settings_filesuffix=settings_filesuffix,
   3497             **kwargs,
   3498         )
   3499     )
   3501 self.valid_bounds = self.flowline_mb_models[-1].valid_bounds
   3502 self.hemisphere = gdir.hemisphere

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/core/massbalance.py:594, in MonthlyTIModel.__init__(self, gdir, filename, input_filesuffix, settings_filesuffix, fl_id, melt_f, temp_bias, prcp_fac, bias, temp_melt, ys, ye, repeat, check_calib_params, check_climate_data, use_leap_years)
    589     if src != src_calib:
    590         msg = (f'You seem to have calibrated with the {src} '
    591                f"climate data while this gdir was calibrated with "
    592                f"{src_calib}. Set `check_calib_params=False` to "
    593                f"ignore this warning.")
--> 594         raise InvalidWorkflowError(msg)
    596 self.melt_f = melt_f
    597 self.bias = bias

InvalidWorkflowError: You seem to have calibrated with the GSWP3_W5E5 climate data while this gdir was calibrated with . Set `check_calib_params=False` to ignore this warning.
# Compile output
utils.compile_glacier_statistics(gdirs)
ds1 = utils.compile_run_output(gdirs, input_filesuffix='_no_spinup')
ds2 = utils.compile_run_output(gdirs, input_filesuffix='_with_spinup')
ds3 = utils.compile_run_output(gdirs, input_filesuffix='_with_spinup_50yr')
2026-07-20 13:39:29: oggm.utils: Applying global task compile_glacier_statistics on 1 glaciers
2026-07-20 13:39:29: oggm.workflow: Execute entity tasks [glacier_statistics] on 1 glaciers
2026-07-20 13:39:29: oggm.utils: (RGI60-11.00897) glacier_statistics
2026-07-20 13:39:29: oggm.utils: Applying global task compile_run_output on 1 glaciers
2026-07-20 13:39:29: oggm.utils: Applying compile_run_output on 1 gdirs.
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[9], line 3
      1 # Compile output
      2 utils.compile_glacier_statistics(gdirs)
----> 3 ds1 = utils.compile_run_output(gdirs, input_filesuffix='_no_spinup')
      4 ds2 = utils.compile_run_output(gdirs, input_filesuffix='_with_spinup')
      5 ds3 = utils.compile_run_output(gdirs, input_filesuffix='_with_spinup_50yr')

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/utils/_workflow.py:584, in global_task.__call__.<locals>._global_task(gdirs, **kwargs)
    580 self.log.workflow('Applying global task %s on %s glaciers',
    581                   task_func.__name__, len(gdirs))
    583 # Run the task
--> 584 return task_func(gdirs, **kwargs)

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/utils/_workflow.py:1014, in compile_to_netcdf.__call__.<locals>._compile_to_netcdf(gdirs, input_filesuffix, output_filesuffix, path, tmp_file_size, **kwargs)
   1011 # Run the task
   1012 # If small gdir size, no need for temporary files
   1013 if len(gdirs) < tmp_file_size or not path:
-> 1014     return task_func(gdirs, input_filesuffix=input_filesuffix,
   1015                      path=path, **kwargs)
   1017 # Otherwise, divide and conquer
   1018 sub_gdirs = [gdirs[i: i + tmp_file_size] for i in
   1019              range(0, len(gdirs), tmp_file_size)]

File /usr/local/pyenv/versions/3.13.13/lib/python3.13/site-packages/oggm/utils/_workflow.py:1278, in compile_run_output(gdirs, path, input_filesuffix, use_compression)
   1275         pass
   1277 if 'time' not in time_info:
-> 1278     raise RuntimeError('Found no valid glaciers!')
   1280 # OK found it, open it and prepare the output
   1281 with xr.open_dataset(ppath) as ds_diag:
   1282 
   1283     # Prepare output

RuntimeError: Found no valid glaciers!
# Plot
f, ax = plt.subplots(figsize=(9, 4))
(ds1.volume.sum(dim='rgi_id') * 1e-9).plot(ax=ax, label='No spinup')
(ds2.volume.sum(dim='rgi_id') * 1e-9).plot(ax=ax, label='With 100-yr spinup')
(ds3.volume.sum(dim='rgi_id') * 1e-9).plot(ax=ax, label='With 50-yr spinup')
ax.set_ylabel('Volume (km$^3$)')
ax.set_xlabel('Year')
ax.set_title('Hintereisferner volume under CESM-LME forcing')
plt.legend()
plt.tight_layout()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[10], line 3
      1 # Plot
      2 f, ax = plt.subplots(figsize=(9, 4))
----> 3 (ds1.volume.sum(dim='rgi_id') * 1e-9).plot(ax=ax, label='No spinup')
      4 (ds2.volume.sum(dim='rgi_id') * 1e-9).plot(ax=ax, label='With 100-yr spinup')
      5 (ds3.volume.sum(dim='rgi_id') * 1e-9).plot(ax=ax, label='With 50-yr spinup')
      6 ax.set_ylabel('Volume (km$^3$)')

NameError: name 'ds1' is not defined
../../_images/fb3723a0b8ecfe5253dadca57ff28dbd6f8076a5098b2f8965b6a87994628d77.png

What’s next?#