oggm.tasks.run_dynamic_spinup

On this page

oggm.tasks.run_dynamic_spinup#

oggm.tasks.run_dynamic_spinup(gdir, settings_filesuffix='', observations_filesuffix='', overwrite_observations=False, target_yr=None, target_value=None, minimise_for='area', init_model_filesuffix=None, init_model_yr=None, init_model_fls=None, climate_input_filesuffix='', evolution_model=None, mb_model_class=None, save_mb_diagnostics_filesuffix=None, mb_model_historical=None, mb_model_spinup=None, spinup_period_initial=20, spinup_start_yr=None, min_spinup_period=10, spinup_start_yr_max=None, spinup_extra_years_to_try=None, allow_shorter_spinup=True, spinup_period_first_try=None, precision_percent=1, precision_absolute=1, min_ice_thickness=None, first_guess_t_spinup=-2, t_spinup_max_step_length=2, maxiter=30, output_filesuffix=None, store_model_geometry=True, store_fl_diagnostics=None, store_model_evolution=True, ignore_errors=False, return_t_spinup_best=False, ye=None, model_flowlines_filesuffix='', add_fixed_geometry_spinup=False, allow_calving=False, store_monthly_step=None, **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.

Parameters:
gdiroggm.GlacierDirectory

the glacier directory to process

settings_filesuffix: str

You can use a different set of settings by providing a filesuffix. This is useful for sensitivity experiments. Code-wise the settings_filesuffix is set in the @entity-task decorater.

observations_filesuffix: str

The observations filesuffix, from where the reference calibration data ‘ref_area_m2’ or ‘ref_volume_m3’ (depending on ‘minimise_for’) should be used. Code-wise the observations_filesuffix is set in the @entity-task decorater.

overwrite_observationsbool

If you want to overwrite already existing observation values in the provided observations file set this to True. Default is False.

target_yrint or None

The year at which we want to match area or volume. If None and target_value is provided gdir.rgi_date + 1 is used. 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 values from the observation files are used. Default is None

minimise_forstr

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

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.

init_model_fls[]

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

climate_input_filesuffixstr

filesuffix for the input climate file

evolution_model:class:oggm.core.FlowlineModel

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

mb_model_classMassBalanceModel, default MonthlyTIModel

The MassBalanceModel class to use.

save_mb_diagnostics_filesuffixstr, optional

if provided, the mass balance model state is saved to mb_diagnostics{save_mb_diagnostics_filesuffix}.nc after the run completes, via MultipleFlowlineMassBalance.save_to_file(). Useful for saving a historical run before branching into multiple projection scenarios.

mb_model_historicalcore.MassBalanceModel

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

mb_model_spinupcore.MassBalanceModel

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).

spinup_period_initialint

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

min_spinup_periodint

If the dynamic spinup function fails with the initial ‘spinup_period’ a shorter period is tried (only if allow_shorter_spinup is True). Here you can define the minimum period to try. It is also the shortest period which is used at all, so a shorter ‘spinup_period_initial’ results in a spinup which starts before the requested start year. 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

spinup_extra_years_to_trylist or None

As a last resort, if all other spinup periods failed, you can provide here a list of years to try to start the spinup before the requested start year (defined by spinup_start_yr or spinup_period_initial). E.g. [10, 20] means the start years ‘requested start year - 10’ and ‘requested start year - 20’ are tried, in this order, so the longest spinup is tried last. Start years before the start of the climate data are clipped to it, and start years which are not earlier than an already tried one are ignored. Default is None

allow_shorter_spinupbool

If True, and the spinup starting at the requested start year was not successful, shorter spinup periods are tried first (down to min_spinup_period, respectively spinup_start_yr_max), before the spinup_extra_years_to_try. If False, the spinup never starts after the requested start year. Note that the spinup can still start before the requested start year (e.g. if min_spinup_period or spinup_start_yr_max force a longer period). Default is True

spinup_period_first_tryfloat or None

Possibility to provide a spinup period which is tried first, before the one defined by the requested start year. This is used for optimisation during the dynamic melt_f calibration, where we can reuse the spinup period which was successful in the previous iteration. Default is None

precision_percentfloat

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).

precision_absolutefloat

Gives a 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.

min_ice_thicknessfloat

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 gdir.settings[‘min_ice_thick_for_area’].

first_guess_t_spinupfloat

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

t_spinup_max_step_lengthfloat

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

maxiterint

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

output_filesuffixstr

for the output file. If None the settings_filesuffix will be used.

store_model_geometrybool

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

store_model_evolutionbool

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

ignore_errorsbool

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

return_t_spinup_bestbool

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

yeint

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

model_flowlines_filesuffixstr

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

add_fixed_geometry_spinupbool

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

allow_calvingbool

If True you can use the dynamic spinup with calving. So far this is not tested and you need to know what you are doing when switching it on. Default is False

store_monthly_stepBool

If True (False) model diagnostics will be stored monthly (yearly). If unspecified, we follow the update of the MB model, which defaults to yearly (see __init__).

kwargsdict

kwargs to pass to the evolution_model instance

Returns:
oggm.core.flowline.evolution_model

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

Notes

Files written to the glacier directory: