BindingsOggmModel#
- class dtcg.integration.oggm_bindings.BindingsOggmModel(
- base_url='https://cluster.klima.uni-bremen.de/~dtcg/gdirs/v2026.1/',
- rgi_id=None,
- working_dir=None,
- oggm_params=None,
- datacube_l1=None,
- use_multiprocessing=True,
- continue_on_error=True,
- add_default_values_to_settings=False,
- **kwargs,
Bases:
objectBindings for interacting with OGGM and web repositories.
- Parameters:
base_url (str)
rgi_id (str | list[str])
working_dir (str)
oggm_params (dict | None)
datacube_l1 (Dataset)
use_multiprocessing (bool)
continue_on_error (bool)
add_default_values_to_settings (bool)
- DEFAULT_BASE_URL#
Base URL for OGGM data.
- Type:
str
- SHAPEFILE_PATH#
Base URL for shapefile data.
- Type:
str
- WORKING_DIR#
Temporary working directory.
- Type:
str, default None
- oggm_params#
OGGM configuration parameters.
- Type:
dict, default None
Methods
__init__([base_url, rgi_id, working_dir, ...])add_data_to_datacube_l1(datacube_manager, ...)add_rgi_id_to_dataset(dataset)get_glacier_directories(rgi_ids[, ...])Get OGGM glacier directories.
get_matching_region_codes([region_name, ...])Get region and subregion codes matching a given subregion name.
get_oggm_datacube(gdir)get_outline_source_date(glacier_data)Get the date for an outline's source.
get_rgi_files_from_subregion([region_name, ...])Get RGI shapefile from a subregion name.
get_rgi_metadata([path, from_web])Get RGI metadata.
get_rgi_region_codes([region_name, ...])Get RGI region and subregion codes from a subregion name.
init_oggm([working_dir, ...])Initialise OGGM run parameters.
set_flowlines(gdir)Compute glacier flowlines if missing from glacier directory.
Set OGGM configuration.
set_oggm_params(**new_params)Define OGGM configuration parameters.
- __init__(
- base_url='https://cluster.klima.uni-bremen.de/~dtcg/gdirs/v2026.1/',
- rgi_id=None,
- working_dir=None,
- oggm_params=None,
- datacube_l1=None,
- use_multiprocessing=True,
- continue_on_error=True,
- add_default_values_to_settings=False,
- **kwargs,
- Parameters:
base_url (str)
rgi_id (str | list[str])
working_dir (str)
oggm_params (dict | None)
datacube_l1 (Dataset)
use_multiprocessing (bool)
continue_on_error (bool)
add_default_values_to_settings (bool)
- get_glacier_directories(
- rgi_ids,
- prepro_base_url='',
- from_prepro_level=3,
- prepro_border=80,
- add_daily_w5e5=True,
- **kwargs,
Get OGGM glacier directories.
- Parameters:
rgi_ids (list) – RGI IDs of glaciers.
prepro_base_url (str, optional) – URL to OGGM data. If empty, uses the
DEFAULT_BASE_URLattribute.prepro_level (int, default 4) – File preprocessing level.
prepro_border (int, default 80) – Grid border buffer around the glacier.
add_daily_w5e5 (bool, default True) – Add daily W5E5 data.
**kwargs – Extra arguments to
workflow.init_glacier_directories.from_prepro_level (int)
- Returns:
Glacier directories for the given RGI IDs.
- Return type:
list[GlacierDirectory]
- get_matching_region_codes(
- region_name='',
- subregion_name='',
Get region and subregion codes matching a given subregion name.
Subregion names take priority over region names.
- Parameters:
region_name (str) – The full name of a region.
subregion_name (str) – The full name of a subregion.
- Returns:
All pairs of region and subregion codes matching the given subregion or region’s name.
- Return type:
set[str]
- Raises:
KeyError – If the region or subregion name is not found.
ValueError – If no valid region or subregion name is supplied.
- get_outline_source_date(glacier_data)[source]#
Get the date for an outline’s source.
- Parameters:
glacier_data (gpd.GeoDataFrame) – Outline data for a glacier. Must conform to RGI60 specifications.
- Returns:
The year the outline’s source data was published.
- Return type:
int
- get_rgi_files_from_subregion(
- region_name='',
- subregion_name='',
Get RGI shapefile from a subregion name.
- Parameters:
region_name (str, optional) – Name of RGI region.
subregion_name (str, optional) – Name of RGI subregion.
- Returns:
RGI shapefiles.
- Return type:
list
- Raises:
KeyError – If no glaciers are found for the given subregion.
- get_rgi_metadata(
- path='rgi_subregions_V6.csv',
- from_web=False,
Get RGI metadata.
TODO: Replace with call to
oggm.utils.parse_rgi_meta.- Parameters:
path (str, default "rgi_subregions_V6.csv".) – Path to database with subregion names and O1/O2 codes.
from_web (bool, default False) – Use data from oggm-sample-data.
- Returns:
RGI metadata for all glaciers.
- Return type:
list
- get_rgi_region_codes(
- region_name='',
- subregion_name='',
Get RGI region and subregion codes from a subregion name.
This can be replaced with OGGM backend if available.
- Parameters:
region_name (str, optional) – Name of RGI region.
subregion_name (str, optional) – Name of RGI subregion.
- Returns:
RGI region (O1) and subregion (O2) codes.
- Return type:
set[str]
- Raises:
KeyError – If the subregion name is not available.
TypeError – If subregion name is not a string.
- init_oggm(
- working_dir='',
- use_multiprocessing=True,
- continue_on_error=True,
- **kwargs,
Initialise OGGM run parameters.
TODO: Add kwargs for cfg.PATH.
- Parameters:
working_dir (str) – Name of temporary directory
**kwargs – Extra arguments passed to OGGM’s configuration.
use_multiprocessing (bool)
continue_on_error (bool)
- Return type:
None
- set_flowlines(gdir)[source]#
Compute glacier flowlines if missing from glacier directory.
- Parameters:
gdir (GlacierDirectory) – Glacier directory.
- Return type:
None
