oggm.tasks.run_dynamic_mu_star_calibration
oggm.tasks.run_dynamic_mu_star_calibration#
- oggm.tasks.run_dynamic_mu_star_calibration(gdir, ref_dmdtda=None, err_ref_dmdtda=None, err_dmdtda_scaling_factor=1, ref_period='', ignore_hydro_months=False, min_mu_star=None, max_mu_star=None, mu_star_max_step_length=5, maxiter=20, ignore_errors=False, output_filesuffix='_dynamic_mu_star', ys=None, ye=None, run_function=<function dynamic_mu_star_run_with_dynamic_spinup>, kwargs_run_function=None, fallback_function=<function dynamic_mu_star_run_with_dynamic_spinup_fallback>, kwargs_fallback_function=None, init_model_filesuffix=None, init_model_yr=None, init_model_fls=None, first_guess_diagnostic_msg='dynamic spinup only')[source]#
Calibrate mu_star to match a geodetic mass balance incorporating a dynamic model run.
This task iteratively search for a mu_star to match a provided geodetic mass balance. How one model run looks like is defined in the ‘run_function’. This function should take a new mu_star guess, conducts a dynamic run and calculate the geodetic mass balance. The goal is to match the geodetic mass blanance ‘ref_dmdtda’ inside the provided error ‘err_ref_dmdtda’. If the minimisation of the mismatch between the provided and modeled geodetic mass balance is not working the ‘fallback_function’ is called. In there it is decided what run should be conducted in such a failing case. Further if ‘ignore_error’ is set to True and we could not find a satisfying mismatch the best run so far is saved (if not one successful run with ‘run_function’ the ‘fallback_function’ is called).
- Parameters
- gdir
oggm.GlacierDirectory
the glacier directory to process
- ref_dmdtdafloat or None
The reference geodetic mass balance to match (units: kg m-2 yr-1). If None the data from Hugonnet 2021 is used. Default is None
- err_ref_dmdtdafloat or None
The error of the reference geodetic mass balance to match (unit: kg m-2 yr-1). Must always be a positive number. If None the data from Hugonett 2021 is used. Default is None
- err_dmdtda_scaling_factorfloat
The error of the geodetic mass balance is multiplied by this factor. When looking at more glaciers you should set this factor smaller than 1 (Default), but the smaller this factor the more glaciers will fail during calibration. The factor is only used if ref_dmdtda = None and err_ref_dmdtda = None. The idea is that we reduce the uncertainty of individual observations to count for correlated uncertainties when looking at regional or global scales. If err_scaling_factor is 1 (Default) and you look at the results of more than one glacier this equals that all errors are uncorrelated. Therefore the result will be outside the uncertainty boundaries given in Hugonett 2021 e.g. for the global estimate, because some correlation of the individual errors is assumed during aggregation of glaciers to regions (for more details see paper Hugonett 2021).
- ref_periodstr
If ref_dmdtda is None one of ‘2000-01-01_2010-01-01’, ‘2010-01-01_2020-01-01’, ‘2000-01-01_2020-01-01’. If ref_dmdtda is set, this should still match the same format but can be any date. Default is ‘’ (-> PARAMS[‘geodetic_mb_period’])
- ignore_hydro_monthsbool
Do not raise an error if we are working on calendar years. Default is False
- min_mu_starfloat or None
Lower absolute limit for mu*. Default is None (-> cfg.PARAMS[‘min_mu_star’])
- max_mu_starfloat or None
Upper absolute limit for mu* Default is None (-> cfg.PARAMS[‘max_mu_star’])
- mu_star_max_step_lengthfloat
Defines the maximum allowed change of mu_star between two iterations. Is needed to avoid to large changes. Default is 5
- maxiterint
Maximum number of minimisation iterations of minimising mismatch to dmdtda by changing mu_star. Each of this iterations conduct a complete run defined in the ‘run_function’. If maxiter_mu_star reached and ‘ignore_errors=False’ an error is raised. Default is 20
- ignore_errorsbool
If True and the ‘run_function’ with mu* star calibration is not working to match dmdtda inside the provided uncertainty first, if their where some successful runs with the ‘run_function’ they are saved as part success, and if not a single run was successful the ‘fallback_function’ is called. If False and the ‘run_function’ with mu* star calibration is not working an Error is raised. Default is True
- output_filesuffixstr
For the output file. Default is ‘_historical_dynamic_mu_star’
- ysint or None
The start year of the conducted run. If None the first year of the provided climate file. Default is None
- yeint or None
The end year of the conducted run. If None the last year of the provided climate file. Default is None
- run_functionfunction
This function defines how a new defined mu_star is used to conduct the next model run. This function must contain the arguments ‘gdir’, ‘mu_star’, ‘yr0_ref_mb’, ‘yr1_ref_mb’, ‘fls_init’, ‘ys’, ‘ye’ and ‘output_filesuffix’. Further this function must return the final model and the calculated geodetic mass balance dmdtda in kg m-2 yr-1.
- kwargs_run_functionNone or dict
Can provide additional keyword arguments to the run_function as a dictionary.
- fallback_functionfunction
This is a fallback function if the calibration is not working using ‘run_function’ it is called. This function must contain the arguments ‘gdir’, ‘mu_star’, ‘fls_init’, ‘ys’, ‘ye’, ‘local_variables’ and ‘output_filesuffix’. Further this function should return the final model.
- kwargs_fallback_functionNone or dict
Can provide additional keyword arguments to the fallback_function as a dictionary.
- 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. Default is None
- 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.
- first_guess_diagnostic_msgstr
This message will be added to the glacier diagnostics if only the default mu* resulted in a successful ‘run_function’ run. Default is ‘dynamic spinup only’
- gdir
- Returns
oggm.core.flowline.evolution_model
The final dynamically spined-up model. Type depends on the selected evolution_model, by default a FluxBasedModel.
Notes
- Files written to the glacier directory:
- inversion_flowlines.pkl
A “better” version of the Centerlines, now on a regular spacing i.e., not on the gridded (i, j) indices. The tails of the tributaries are cut out to make more realistic junctions. They are now “1.5D” i.e., with a width.