oggm.cli.prepro_levels.run_prepro_levels

On this page

oggm.cli.prepro_levels.run_prepro_levels#

oggm.cli.prepro_levels.run_prepro_levels(rgi_version=None, rgi_reg=None, border=None, output_folder='', working_dir='', dem_source='', is_test=False, test_ids=None, rgi_file=None, intersects_file=None, test_topofile=None, disable_mp=False, params_file=None, elev_bands=False, centerlines=False, override_params=None, skip_inversion=False, inversion_volume_dataset='iceboost', mb_model_class='MonthlyTIModel', mb_calibration_strategy='informed_threestep', geodetic_mb_file_path=None, temp_bias_file_path=None, select_source_from_dir=None, keep_dem_folders=False, add_consensus_thickness=False, add_itslive_velocity=False, add_millan_thickness=False, add_millan_velocity=False, add_hugonnet_dhdt=False, add_bedmachine=False, add_glathida=False, add_distributed_thickness=False, add_export_thickness_geotiff=False, compute_hypsometry=False, custom_climate_task=None, custom_climate_task_kwargs=None, start_level=None, start_base_url=None, start_from_dir=None, max_level=5, chunk_idx=None, chunk_size=1000, glen_a_factor=None, inversion_fs=0, logging_level='WORKFLOW', dynamic_spinup=False, ref_mb_err_scaling_factor=0.2, dynamic_spinup_start_year=1979, dynamic_spinup_extra_years_to_try=None, dynamic_spinup_allow_shorter=True, continue_on_error=True, store_fl_diagnostics=False, store_hydro_output=False, store_monthly_hydro=False, ref_area_yr=None, temp_bias_run=False)[source]#

Generate the preprocessed OGGM glacier directories for this OGGM version

Parameters:
rgi_versionstr

the RGI version to use (defaults to cfg.PARAMS)

rgi_regstr

the RGI region to process

borderint

the number of pixels at the maps border

output_folderstr

path to the output folder (where to put the preprocessed tar files)

dem_sourcestr

which DEM source to use: default, SOURCE_NAME, STANDARD or ALL ALL is to generate RGITOPO “STANDARD” is doina small RGITOPO using COPDEM + NASADEM default is the current default lookup tables found at https://cluster.klima.uni-bremen.de/~oggm/gdirs/oggm_v1.6/rgitopo/2025.4/

working_dirstr

path to the OGGM working directory

params_filestr

path to the OGGM parameter file (to override defaults)

is_testbool

to test on a couple of glaciers only! Picks 4 glaciers, always the same ones (see test_ids to choose them): a chunked run needs every job to select the same glaciers.

test_idslist

if is_test: list of ids to process

rgi_filestr or geopandas.GeoDataFrame, optional

path to an RGI shapefile or a GeoDataFrame to use instead of the default RGI region file. Useful to override the default RGI files for custom runs as well as for testing.

intersects_filestr or geopandas.GeoDataFrame, optional

path to an intersects shapefile or a GeoDataFrame to use instead of the default RGI intersects file. Can also be None to skip setting the intersects database.

test_topofilestr

for testing purposes only

test_crudirstr

for testing purposes only

disable_mpbool

disable multiprocessing

elev_bandsbool

compute all flowlines based on the Huss & Farinotti 2012 method.

centerlinesbool

compute all flowlines based on the OGGM centerline(s) method.

mb_model_classstr

The mb_model_class to use. Options are ‘MonthlyTIModel’ (default) and ‘SfcTypeTIModel’.

mb_calibration_strategystr

how to calibrate the massbalance. Currently one of: - ‘informed_threestep’ (default) - ‘melt_temp’ - ‘temp_melt’

geodetic_mb_file_pathstr

optional path or URL to a custom geodetic MB file, passed to utils.get_geodetic_mb_dataframe and tasks.mb_calibration_from_geodetic_mb.

temp_bias_file_pathstr

path or URL to the temperature-bias prior file, passed to tasks.mb_calibration_from_geodetic_mb. Required by the ‘informed_threestep’ calibration strategy (and unused otherwise): there is no default, the file has to match the setup it is used with (climate dataset, RGI version, …). It is created with a temp_bias_run and the oggm_temp_bias command (see utils.get_temp_bias_dataframe).

select_source_from_dirstr

if starting from a level 1 “ALL” or “STANDARD” DEM sources directory, select the chosen DEM source here. If you set it to “BY_RES” here, COPDEM will be used and its resolution chosen based on the gdir’s map resolution (COPDEM30 for dx < 60 m, COPDEM90 elsewhere).

keep_dem_foldersbool

if select_source_from_dir is used, wether to keep the original DEM folders in or not.

add_consensus_thicknessbool

adds (reprojects) the consensus estimates thickness to the glacier directories. With elev_bands=True, the data will also be binned.

add_itslive_velocitybool

adds (reprojects) the ITS_LIVE velocity to the glacier directories. With elev_bands=True, the data will also be binned.

add_millan_thicknessbool

adds (reprojects) the millan thickness to the glacier directories. With elev_bands=True, the data will also be binned.

add_millan_velocitybool

adds (reprojects) the millan velocity to the glacier directories. With elev_bands=True, the data will also be binned.

add_hugonnet_dhdtbool

adds (reprojects) the hugonnet dhdt maps to the glacier directories. With elev_bands=True, the data will also be binned.

add_bedmachinebool

adds (reprojects) the bedmachine ice thickness maps to the glacier directories. With elev_bands=True, the data will also be binned.

add_glathidabool

adds (reprojects) the glathida thickness data to the glacier directories. Data points are stored as csv files.

add_distributed_thicknessbool

adds a thickness field to gridded_data using distribute_thickness_per_altitude.

add_export_thickness_geotiffbool

exports the distributed thickness field to GeoTIFF files in a subfolder of the L3 summary directory.

compute_hypsometrybool

Compute the hypsometry tables for all glaciers, added to the glacier directory and compiled in the summary folder.

custom_climate_taskstr

optional import path to a custom climate task in the form “module_path:function_name”. If provided, it will be called instead of the default process_climate_data.

custom_climate_task_kwargsdict

optional kwargs passed to the custom climate task when it is executed.

start_levelstr or int

the pre-processed level to start from (default is to start from scratch). If set, you’ll need to indicate start_base_url or start_from_dir as well. One of 0, 1, 2, ‘3a’, 3, ‘4a’, 4 - see max_level for what the half levels are.

start_base_urlstr

the pre-processed base-url to fetch the data from.

start_from_dirstr

like start_base_url, but for glacier directory tar files which are already on disk (a url can only be fetched over http). This is what chains the stages of a chunked run together: it points at the folder which contains the RGI{version}/b_{border}/L{level}/ tree, and the directories are read from there instead of being downloaded. It can be combined with start_base_url, and often has to be: the directories then come from disk, while the summary files which are only carried forward are still fetched from the url. That is the normal case when the previous stage made the directories without writing any summary file (max_level ‘3a’ or ‘4a’).

max_levelstr or int

the maximum pre-processing level before stopping. Besides 1 to 5, two half levels split L3 and L4 where the work stops being per-glacier and starts needing the whole RGI region at once: - ‘3a’: L3 up to and including the apparent mass balance, i.e. no

inversion and no summary files. This is the chunkable part of L3.

  • ‘4a’: the L4 runs, without the summary files. This is the chunkable part of L4.

A chunked cluster run is then 2 -> ‘3a’ (chunks), ‘3a’ -> 3 (whole region), 3 -> ‘4a’ (chunks), ‘4a’ -> 5 (whole region).

chunk_idxint

process only the glaciers of this chunk (see chunk_size). Chunks are blocks of the RGI id space, so that several chunk jobs writing into the same output folder produce disjoint, complete tar files. Use oggm.workflow.count_rgi_chunks() to know how many chunks a region has. Default is to process all glaciers.

chunk_sizeint

the number of glaciers per chunk: 100 or 1000 (default). These are the only two allowed, because they are the bundle sizes the glacier directory tars are written and read with.

glen_a_factorfloat

skip the Glen A calibration and invert with this factor instead (and with inversion_fs). The values of a previous calibration are written to L3/summary/inversion_glen_a_{rgi_reg}.json by the run which did it, so they can be given back here.

inversion_fsfloat

the sliding parameter to use together with glen_a_factor. Ignored if glen_a_factor is not set.

skip_inversionbool

do not run the inversion (level 3 files). This is a temporary workaround for workflows that wont run that far into level 3.

inversion_volume_datasetstr

which reference volume dataset to calibrate the ice thickness inversion (Glen A) against. One of: - ‘iceboost’ (default): the IceBoost v2 product, auto-selected by RGI

version. Supported for RGI62, RGI70G and RGI70C.

  • ‘consensus’: the Farinotti et al. (2019) consensus (ITMIX) estimate. Only supported for RGI62.

logging_levelstr

the logging level to use (DEBUG, INFO, WARNING, WORKFLOW)

override_paramsdict

a dict of parameters to override.

dynamic_spinupstr

include a dynamic spinup matching ‘area/dmdtda’ OR ‘volume/dmdtda’ at the RGI-date

ref_mb_err_scaling_factorfloat

scaling factor to reduce individual geodetic mass balance uncertainty

dynamic_spinup_start_yearint

if dynamic_spinup is set, define the starting year for the simulation. The default is 1979, unless the climate data starts later.

dynamic_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 dynamic_spinup_start_year (e.g. [10, 20] means the start years ‘dynamic_spinup_start_year - 10’ and ‘dynamic_spinup_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. Default is None

dynamic_spinup_allow_shorterbool

If True, and the spinup starting at dynamic_spinup_start_year was not successful, shorter spinup periods are tried first (down to the start year of the geodetic mass balance period), before the dynamic_spinup_extra_years_to_try. If False, the dynamic spinup never starts after dynamic_spinup_start_year. Default is True

continue_on_errorbool

if True the workflow continues if a task raises an error. For operational runs it should be set to True (the default).

store_fl_diagnosticsbool

if True, also compute and store flowline diagnostics during preprocessing. This can increase data usage quite a bit.

store_hydro_outputbool

if True, also store the hydrological model output.

store_monthly_hydrobool

if True and store_hydro_output is True, the hydrological model output is also stored at monthly resolution (see flowline.run_with_hydro). This increases data usage quite a bit, hence the False default.

ref_area_yrint

the hydrological output is computed over a reference area, which per default is the largest area covered by the glacier in the simulation period. Use this kwarg to force a specific area to the state of the glacier at the provided simulation year.

temp_bias_runbool

set to True to run the preprocessing needed to create the temperature bias prior file used by the informed_threestep calibration. This is a preset which forces max_level=3 and skip_inversion=True, and skips everything which is of no use for this purpose: the glacier directory tar files, the climate statistics and the fixed geometry mass balance. mb_calibration_strategy has to be set explicitly to temp_melt, an error is raised otherwise. The only output is the L3 glacier_statistics file, which is then turned into the temperature bias file with the oggm_temp_bias command (the grouping of climate grid points crosses RGI region borders, so this has to be done over all the regions at once).