Developer documentation


Tools to set-up and run OGGM.

workflow.init_glacier_regions Very first task to do (always).
workflow.execute_entity_task Execute a task on gdirs.
workflow.gis_prepro_tasks Helper function: run all flowlines tasks.
workflow.climate_tasks Helper function: run all climate tasks.
workflow.inversion_tasks Helper function: run all bed inversion tasks.

Entity tasks

Entity tasks are tasks which are applied on single glaciers individually and do not require information from other glaciers (this encompasses the majority of OGGM’s tasks). They are parallelizable.

tasks.define_glacier_region Very first task: define the glacier’s local grid.
tasks.glacier_masks Makes a gridded mask of the glacier outlines.
tasks.compute_centerlines Compute the centerlines following Kienholz et al., (2014).
tasks.initialize_flowlines Transforms the geometrical Centerlines in the more “physical” “Inversion Flowlines”.
tasks.compute_downstream_line Compute the line continuing the glacier.
tasks.compute_downstream_bedshape The bedshape obtained by fitting a parabola to the line’s normals.
tasks.catchment_area Compute the catchment areas of each tributary line.
tasks.catchment_intersections Computes the intersections between the catchments.
tasks.catchment_width_geom Compute geometrical catchment widths for each point of the flowlines.
tasks.catchment_width_correction Corrects for NaNs and inconsistencies in the geometrical widths.
tasks.process_cru_data Processes and writes the climate data for this glacier.
tasks.process_custom_climate_data Processes and writes the climate data from a user-defined climate file.
tasks.process_cesm_data Processes and writes the climate data for this glacier.
tasks.local_mustar Compute the local mustar from interpolated tstars.
tasks.apparent_mb Compute the apparent mb from the calibrated mustar.
tasks.apparent_mb_from_linear_mb Compute apparent mb from a linear mass-balance assumption (for testing).
tasks.mu_candidates Computes the mu candidates.
tasks.prepare_for_inversion Prepares the data needed for the inversion.
tasks.volume_inversion Computes the inversion the glacier.
tasks.distribute_thickness Compute a thickness map of the glacier using the nearest centerlines.
tasks.init_present_time_glacier First task after inversion.
tasks.random_glacier_evolution Random glacier dynamics for benchmarking purposes.
tasks.iterative_initial_glacier_search Iterative search for the glacier in year y0.
tasks.run_from_climate_data Runs glacier with climate input from a general circulation model.
tasks.run_constant_climate Run a glacier under a constant climate for a given climate period.

Global tasks

Global tasks are tasks which are run on a set of glaciers (most often: all glaciers in the current run). They are not parallelizable.

tasks.compute_ref_t_stars Detects the best t* for the reference glaciers.
tasks.distribute_t_stars After the computation of the reference tstars, apply the interpolation to each individual glacier.
tasks.crossval_t_stars Cross-validate the interpolation of tstar to each individual glacier.
tasks.optimize_inversion_params Optimizes fs and fd based on GlaThiDa thicknesses.


Listed here are the classes which are relevant at the API level (i.e. classes which are used and re-used across modules and tasks).

TODO: add the model classes, etc.

GlacierDirectory Organizes read and write access to the glacier’s files.
Centerline A Centerline has geometrical and flow rooting properties.
Flowline The is the input flowline for the model.


Mass-balance models found in the core.massbalance module.

They follow the MassBalanceModel() interface. Here is a quick summary of the units and conventions used by all models:


The computed mass-balance is in units of [m ice s-1] (“meters of ice per second”), unless otherwise specified (e.g. for the utility function get_specific_mb). The conversion from the climatic mass-balance ([kg m-2 s-1] ) therefore assumes an ice density given by cfg.RHO (currently: 900 kg m-3).


The time system used by OGGM is a simple “fraction of year” system, where the floating year can be used for conversion to months and years:

In [1]: from oggm.utils import year_to_date, date_to_year
ImportError                               Traceback (most recent call last)
<ipython-input-1-34749d82ec5d> in <module>()
----> 1 from oggm.utils import year_to_date, date_to_year

ImportError: cannot import name 'year_to_date'

In [2]: date_to_year(1982, 12)
NameError                                 Traceback (most recent call last)
<ipython-input-2-5149da2a75b4> in <module>()
----> 1 date_to_year(1982, 12)

NameError: name 'date_to_year' is not defined

In [3]: year_to_date(1.2)
NameError                                 Traceback (most recent call last)
<ipython-input-3-bb51cf23ff70> in <module>()
----> 1 year_to_date(1.2)

NameError: name 'year_to_date' is not defined


MassBalanceModel Common logic for the mass balance models.
MassBalanceModel.get_monthly_mb Monthly mass-balance at given altitude(s) for a moment in time.
MassBalanceModel.get_annual_mb Like self.get_monthly_mb(), but for annual MB.
MassBalanceModel.get_specific_mb Specific mb for this year and a specific glacier geometry.
MassBalanceModel.temp_bias Temperature bias to add to the original series.


LinearMassBalance Constant mass-balance as a linear function of altitude.
PastMassBalance Mass balance during the climate data period.
ConstantMassBalance Constant mass-balance during a chosen period.
RandomMassBalance Random shuffle of all MB years within a given time period.