oggm.tasks.run_dynamic_spinup(gdir, init_model_filesuffix=None, init_model_yr=None, init_model_fls=None, climate_input_filesuffix='', evolution_model=None, mb_model_historical=None, mb_model_spinup=None, spinup_period=20, spinup_start_yr=None, min_spinup_period=10, spinup_start_yr_max=None, target_yr=None, target_value=None, minimise_for='area', precision_percent=1, precision_absolute=1, min_ice_thickness=None, first_guess_t_bias=-2, t_bias_max_step_length=2, maxiter=30, output_filesuffix='_dynamic_spinup', store_model_geometry=True, store_fl_diagnostics=None, store_model_evolution=True, ignore_errors=False, return_t_bias_best=False, ye=None, model_flowline_filesuffix='', add_fixed_geometry_spinup=False, **kwargs)[source]#

Dynamically spinup the glacier to match area or volume at the RGI date.

This task allows to do simulations in the recent past (before the glacier inventory date), when the state of the glacier was unknown. This is a very difficult task the longer further back in time one goes (see publications by Eis et al. for a theoretical background), but can work quite well for short periods. Note that the solution is not unique.


the glacier directory to process

init_model_filesuffixstr or None

if you want to start from a previous model run state. This state should be at time yr_rgi_date.

init_model_yrint or None

the year of the initial run you want to start from. The default is to take the last year of the simulation.


list of flowlines to use to initialise the model (the default is the present_time_glacier file from the glacier directory). Ignored if init_model_filesuffix is set


filesuffix for the input climate file


which evolution model to use. Default: cfg.PARAMS[‘evolution_model’] Not all models work in all circumstances!


User-povided MassBalanceModel instance for the historical run. Default is to use a MonthlyTIModel model together with the provided parameter climate_input_filesuffix.


User-povided MassBalanceModel instance for the spinup before the historical run. Default is to use a ConstantMassBalance model together with the provided parameter climate_input_filesuffix and during the period of spinup_start_yr until rgi_year (e.g. 1979 - 2000).


The period how long the spinup should run. Start date of historical run is defined “target_yr - spinup_period”. Minimum allowed value is 10. If the provided climate data starts at year later than (target_yr - spinup_period) the spinup_period is set to (target_yr - yr_climate_start). Caution if spinup_start_yr is set the spinup_period is ignored. Default is 20

spinup_start_yrint or None

The start year of the dynamic spinup. If the provided year is before the provided climate data starts the year of the climate data is used. If set it overrides the spinup_period. Default is None


If the dynamic spinup function fails with the initial ‘spinup_period’ a shorter period is tried. Here you can define the minimum period to try. Default is 10

spinup_start_yr_maxint or None

Possibility to provide a maximum year where the dynamic spinup must start from at least. If set, this overrides the min_spinup_period if target_yr - spinup_start_yr_max > min_spinup_period. Default is None

target_yrint or None

The year at which we want to match area or volume. If None, gdir.rgi_date + 1 is used (the default). Default is None

target_valuefloat or None

The value we want to match at target_yr. Depending on minimise_for this value is interpreted as an area in km2 or a volume in km3. If None the total area or volume from the provided initial flowlines is used. Default is None


The variable we want to match at target_yr. Options are ‘area’ or ‘volume’. Default is ‘area’


Gives the precision we want to match in percent. The algorithm makes sure that the resulting relative mismatch is smaller than precision_percent, but also that the absolute value is smaller than precision_absolute. Default is 1., meaning the difference must be within 1% of the given value (area or volume).


Gives an minimum absolute value to match. The algorithm makes sure that the resulting relative mismatch is smaller than precision_percent, but also that the absolute value is smaller than precision_absolute. The unit of precision_absolute depends on minimise_for (if ‘area’ in km2, if ‘volume’ in km3) Default is 1.


Gives an minimum ice thickness for model grid points which are counted to the total model value. This could be useful to filter out seasonal ‘glacier growth’, as OGGM do not differentiate between snow and ice in the forward model run. Therefore you could see quite fast changes (spikes) in the time-evolution (especially visible in length and area). If you set this value to 0 the filtering can be switched off. Default is 10.


The initial guess for the temperature bias for the spinup MassBalanceModel in °C. Default is -2.


Defines the maximums allowed change of t_bias between two iterations. Is needed to avoid to large changes. Default is 2.


Maximum number of minimisation iterations per spinup period. If reached and ‘ignore_errors=False’ an error is raised. Default is 30


for the output file


whether to store the full model geometry run file to disk or not. Default is True

store_fl_diagnosticsbool or None

whether to store the model flowline diagnostics to disk or not. Default is None


if True the complete dynamic spinup run is saved (complete evolution of the model during the dynamic spinup), if False only the final model state after the dynamic spinup run is saved. (Hint: if store_model_evolution = True and ignore_errors = True and an Error during the dynamic spinup occurs the stored model evolution is only one year long) Default is True


If True the function saves the model without a dynamic spinup using the ‘output_filesuffix’, if an error during the dynamic spinup occurs. This is useful if you want to keep glaciers for the following tasks. Default is True


If True the used temperature bias for the spinup is returned in addition to the final model. If an error occurs and ignore_error=True, the returned value is np.nan. Default is False


end year of the model run, must be larger than target_yr. If nothing is given it is set to target_yr. It is not recommended to use it if only data until target_yr is needed for calibration as this increases the run time of each iteration during the iterative minimisation. Instead use run_from_climate_data afterwards and merge both outputs using merge_consecutive_run_outputs. Default is None


suffix to the model_flowlines filename to use (if no other flowlines are provided with init_model_filesuffix or init_model_fls). Default is ‘’


If True and the original spinup_period must be shortened (due to ice-free or out-of-boundary error) a fixed geometry spinup is added at the beginning so that the resulting model run always starts from the defined start year (could be defined through spinup_period or spinup_start_yr). Only has an effect if store_model_evolution is True. Default is False


kwargs to pass to the evolution_model instance


The final dynamically spined-up model. Type depends on the selected evolution_model.


Files written to the glacier directory: