Developer documentation

Workflow

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_histalp_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.mass_conservation_inversion
tasks.filter_inversion_output Filters the last few grid point whilst conserving total volume.
tasks.distribute_thickness_per_altitude Compute a thickness map by redistributing mass along altitudinal bands.
tasks.distribute_thickness_interp Compute a thickness map by interpolating between centerlines and border.
tasks.init_present_time_glacier First task after inversion.
tasks.run_random_climate Runs the random mass-balance model for a given number of years.
tasks.run_constant_climate Runs the constant mass-balance model for a given number of years.
tasks.run_from_climate_data Runs glacier with climate input from CRU or a GCM.

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.crossval_t_stars Cross-validate the interpolation of tstar to each individual glacier.

Classes

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

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:

Units

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.PARAMS['ice_density'] (currently: 900 kg m-3).

Time

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 floatyear_to_date, date_to_floatyear

In [2]: date_to_floatyear(1982, 12)
Out[2]: 1982.9166666666667

In [3]: floatyear_to_date(1.2)
Out[3]: (1, 3)

Interface

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.get_ela Compute the equilibrium line altitude for this year

Models

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.
UncertainMassBalance Adding uncertainty to a mass balance model.