BindingsCryotempo#
- class dtcg.integration.oggm_bindings.BindingsCryotempo(
- base_url='https://cluster.klima.uni-bremen.de/~dtcg/gdirs/v2026.1',
- working_dir='',
- oggm_params={'border': 160, 'store_model_geometry': True},
- hydro_location='_spinup_historical_hydro',
Bases:
BindingsOggmWranglerBindings for interacting with CryoTEMPO-EOLIS data.
- Parameters:
base_url (str)
working_dir (str)
oggm_params (dict)
hydro_location (str)
- hydro_location#
Output directory name.
- Type:
str
Methods
__init__([base_url, working_dir, ...])add_data_to_datacube_l1(datacube_manager, ...)add_rgi_id_to_dataset(dataset)get_aggregate_runoff(gdir)Get the computed runoff from OGGM.
get_annual_runoff(ds)get_cached_data(rgi_id[, cache])get_cached_eolis_data(cache_path)get_cached_gdir_data(cache_path)get_cached_l1_data(rgi_id[, cache])get_cached_metadata([index, cache])get_cached_outline_data(cache_path)Get glacier outlines.
get_cached_runoff_data(cache_path[, suffix])get_cached_smb_data(cache_path)get_climatology(gdir[, name])Get climatological data for a glacier.
get_compiled_run_output(gdir[, keys, ...])get_eolis_data(gdir)Get gridded data enhanced with CryoTEMPO-EOLIS data.
get_gdir_by_name(data, name, **kwargs)Get glacier directory from a glacier's name or RGI ID.
get_glacier_by_name(data, name)Get glacier data by full name or RGI ID.
get_glacier_by_rgi_id(data, rgi_id)Get glacier data by RGI ID.
get_glacier_data(gdirs[, dem])Add velocity data, monthly and daily W5E5 data.
get_glacier_directories(rgi_ids[, ...])Get OGGM glacier directories.
get_glaciers_in_subregion(region, subregion)Get only the glaciers in a given subregion.
get_hydro_climatology(gdir[, nyears])get_matching_region_codes([region_name, ...])Get region and subregion codes matching a given subregion name.
get_min_max_runoff_years(annual_runoff[, nyears])Get the years with minimum and maximum runoff.
get_monthly_runoff(ds[, nyears])Get the monthly glacier runoff.
get_named_glaciers(glaciers)Get all glaciers with a full name.
get_oggm_datacube(gdir)get_outline_details(polygon)get_outline_source_date(glacier_data)Get the date for an outline's source.
get_polygon_difference(frame)Get the difference of overlapping polygons.
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.
get_shapefile(path)Get shapefile from user path.
get_shapefile_from_web(shapefile_name)Placeholder for getting shapefiles from an online repository.
get_shapefile_metadata(shapefile)Get metadata from a catchment shapefile.
get_specific_mass_balance(ds, rgi_id)get_user_subregion([region_name, ...])Get user-selected subregion in a catchment area.
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.
set_polygon_overlap(frame)Set overlapping boundaries.
set_subregion_constraints(region, subregion)Reproject subregional data to match regional data, and optionally mask by subregion name.
- __init__(
- base_url='https://cluster.klima.uni-bremen.de/~dtcg/gdirs/v2026.1',
- working_dir='',
- oggm_params={'border': 160, 'store_model_geometry': True},
- hydro_location='_spinup_historical_hydro',
- Parameters:
base_url (str)
working_dir (str)
oggm_params (dict)
hydro_location (str)
- add_rgi_id_to_dataset(dataset)#
- Parameters:
dataset
- get_cached_outline_data(cache_path)#
Get glacier outlines.
This is identical to
gdir.read_shapefile, so the CRS should later be converted to EPSG:4236- Parameters:
cache_path (Path)
- Return type:
GeoDataFrame
- get_climatology(gdir, name='')[source]#
Get climatological data for a glacier.
- Parameters:
data (gpd.GeoDataFrame) – Contains data for one or more glaciers.
name (str, optional) – Name of glacier.
- Returns:
Climatological data and specific mass balance for a glacier.
- Return type:
tuple[xr.Dataset,np.ndarray]
- get_gdir_by_name(data, name, **kwargs)#
Get glacier directory from a glacier’s name or RGI ID.
- Parameters:
data (gpd.GeoDataFrame) – Glacier data.
name (str) – Name or RGI ID of glacier.
**kwargs – Additional arguments passed to
workflow.init_glacier_directories.
- get_glacier_by_name(data, name)#
Get glacier data by full name or RGI ID.
- Parameters:
data (gpd.GeoDataFrame) – Glacier data.
name (str) – Full name or RGI ID of glacier.
- Returns:
Glacier with matching name or RGI ID.
- Return type:
gpd.GeoDataFrame
- get_glacier_by_rgi_id(data, rgi_id)#
Get glacier data by RGI ID.
- Parameters:
data (gpd.GeoDataFrame) – Glacier data.
rgi_id (str) – RGI ID of glacier.
- Returns:
Glacier with matching RGI ID.
- Return type:
gpd.GeoDataFrame
- get_glacier_data(gdirs, dem=False)[source]#
Add velocity data, monthly and daily W5E5 data.
- Parameters:
gdirs (list)
- Return type:
None
- 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_glaciers_in_subregion(
- region,
- subregion,
Get only the glaciers in a given subregion.
- Parameters:
region (gpd.GeoDataFrame) – Contains all glaciers in a region.
subregion (gpd.GeoDataFrame) – Subregion shapefile.
- Returns:
Only glaciers inside the given subregion.
- Return type:
gpd.GeoDataFrame
- 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_min_max_runoff_years(
- annual_runoff,
- nyears=20,
Get the years with minimum and maximum runoff.
- Parameters:
annual_runoff (pd.Series) – Time series of annual runoff.
nyears (int, default 20) – Time period in years. The end date is always the most recent available year.
- Returns:
The years with minimum and maximum runoff.
- Return type:
tuple[int]
- get_monthly_runoff(ds, nyears=20)[source]#
Get the monthly glacier runoff.
- Parameters:
ds (xr.Dataset) – Glacier climatology.
nyears (int, default 20) – Time period in years. The end date is always the most recent available year.
- Returns:
Monthly runoff.
- Return type:
xr.Dataset
- get_named_glaciers(glaciers)#
Get all glaciers with a full name.
- Parameters:
glaciers (gpd.GeoDataFrame) – Glacier data.
- Returns:
All named glaciers.
- Return type:
gpd.GeoDataFrame
- get_outline_source_date(glacier_data)#
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_polygon_difference(frame)#
Get the difference of overlapping polygons.
Note
GPD’s overlay() only acts on GeoDataFrames, but this function manipulates GeoSeries.
- Parameters:
frame (gpd.GeoDataFrame) – Overlapping polygons.
- Returns:
Polygon geometries adjusted so no areas overlap.
- Return type:
gpd.GeoSeries
- 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.
- get_shapefile(path)#
Get shapefile from user path.
- Parameters:
path (str) – Path to shapefile.
- Return type:
GeoDataFrame
- get_shapefile_from_web(shapefile_name)#
Placeholder for getting shapefiles from an online repository.
- Parameters:
shapefile_name (str) – Name of file in
oggm-sample-datarepository.- Return type:
GeoDataFrame
- get_shapefile_metadata(shapefile)#
Get metadata from a catchment shapefile.
- Parameters:
shapefile (GeoDataFrame)
- Return type:
dict
- get_user_subregion(
- region_name='',
- subregion_name='',
- shapefile_path='',
- **oggm_params,
Get user-selected subregion in a catchment area.
This should be called via gateway.
- Parameters:
region_name (str, optional) – Name of RGI region.
subregion_name (str, optional) – Name of RGI subregion.
shapefile_path (str, optional) – Path to shapefile with catchment area outlines.
**oggm_params – Additional OGGM configuration parameters.
- Return type:
dict
- 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)#
Compute glacier flowlines if missing from glacier directory.
- Parameters:
gdir (GlacierDirectory) – Glacier directory.
- Return type:
None
- set_oggm_kwargs()#
Set OGGM configuration.
Note
This may eventually be moved to
api.internal._parse_oggm.- Parameters:
oggm_params (dict) – Key/value pairs corresponding to valid OGGM configuration parameters.
- Return type:
None
- set_oggm_params(**new_params)#
Define OGGM configuration parameters.
This will overwrite existing values that have the same key. To configure OGGM, use
set_oggm_kwargs().- Parameters:
**new_params (dict) – Parameters passed to OGGM’s configuration.
- Return type:
None
- set_polygon_overlap(frame)#
Set overlapping boundaries.
If two polygons overlap, the overlapping area is removed from the second polygon.
- Parameters:
frame (gpd.GeoDataFrame) – Contains overlapping polygons.
- Returns:
Polygon geometries adjusted so no areas overlap.
- Return type:
gpd.GeoDataFrame
- set_subregion_constraints(
- region,
- subregion,
- subregion_id='',
Reproject subregional data to match regional data, and optionally mask by subregion name.
- Parameters:
region (gpd.GeoDataFrame) – Shapefile data for region.
subregion (gpd.GeoDataFrame) – Shapefile data for subregion.
subregion_id (str, optional) – Subregion id.
- Returns:
Reprojected subregion data, optionally masked to a specific subregion name.
- Return type:
gpd.GeoDataFrame
