CalibratorCryotempo#
- class dtcg.integration.calibration.CalibratorCryotempo(
- model_matrix=None,
- datacube_l1=None,
- gdir=None,
Bases:
CalibratorMethods
__init__([model_matrix, datacube_l1, gdir])add_annual_cumulative(ds, var[, year_coord, ...])add_snowline_attrs(ds[, inf_values])add_specific_mb(ds, mb_model, fls, ...)Get specific mass-balance in mm w.e.
add_specific_mb_attrs(ds, unit)Get total annual and monthly runoff from runoff components.
calibrate(gdir[, model_matrix, datacube_l1, ...])Calibrate the mass balance model and create L2 datacubes using a model matrix.
get_calibrated_datacubes(mb_model_class, ...)Calibrate models and generate datacubes.
get_eolis_dates(ds)Get time index from CryoTEMPO-EOLIS dataset.
Get mean elevation change from EOLIS data.
get_geodetic_mb_from_dataset(dataset[, ...])Get the geodetic mass balance in kg m-2 from enhanced gridded data.
get_mcs_parameter_sample(gdir, ...[, ...])Defines the distribution of the observation and model parameters and create a sample for the Monte Carlo simulation.
get_nearest_datetime(dates, target_date)Get the nearest datetime.
get_ref_mb([gdir, ref_mb_period, ...])Get observed mass balance for a specific reference period.
get_temporal_bounds(dates, date_start, date_end)Get start and end dates of geodetic and observational periods.
set_model_matrix([name, model, geo_period, ...])Set model parameters for calibration.
- Parameters:
model_matrix (dict)
- __init__(
- model_matrix=None,
- datacube_l1=None,
- gdir=None,
- Parameters:
model_matrix (dict)
- add_annual_cumulative(
- ds,
- var,
- year_coord='calendar_year',
- cumulative_suffix='calendar_cum',
- Parameters:
ds
var
year_coord
cumulative_suffix
- add_snowline_attrs(ds, inf_values=None)#
- Parameters:
ds
inf_values
- add_specific_mb(
- ds,
- mb_model,
- fls,
- time_resolution,
- unit,
Get specific mass-balance in mm w.e. from a volume change time series.
- Parameters:
ds
mb_model
fls
time_resolution
unit
- add_specific_mb_attrs(ds, unit)#
- Parameters:
ds
unit
- calculate_and_add_total_runoff(ds)#
Get total annual and monthly runoff from runoff components.
- Parameters:
ds
- calibrate(
- gdir,
- model_matrix=None,
- datacube_l1=None,
- ignore_errors=False,
- **kwargs,
Calibrate the mass balance model and create L2 datacubes using a model matrix.
- Parameters:
gdir (GlacierDirectory) – Glacier directory.
model_matrix (dict) – Model parameters for various calibration runs.
datacube_l1 (xr.Dataset) – If the reference mass balance should be derived from an observation data, which is available in a L1 datacube.
ignore_errors (bool) – If True any exception raised during the calibration is ignored.
kwargs (dict) – kwargs passed on to Calibrator.get_calibrated_datacubes
- Returns:
Containing the created L2 datacubes for each set of configuration parameters in
model_matrix- Return type:
dict
- get_calibrated_datacubes(
- mb_model_class,
- ref_mb,
- ref_mb_err,
- ref_mb_unit='kg m-2 yr-1',
- ref_mb_period='',
- gdir=None,
- first_guess_settings='',
- datacube_types='monthly',
- calibration_filesuffix='',
- calibration_strategy='',
- mcs_sampling_settings=None,
- calibration_parameters_control=None,
- calibration_parameters_mcs=None,
- quantiles=None,
- climate_input_filesuffix=None,
- show_log=False,
- multiprocessing_during_datacube_creation=True,
- **kwargs,
Calibrate models and generate datacubes.
Uses the provided reference mass balance to calibrate models and generate model datacubes. These also include an uncertainty propagation through a Monte Carlo simulation.
- Parameters:
gdir (GlacierDirectory) – OGGM glacier directory.
mb_model_class (oggm.core.massbalance.MassBalanceModel) – OGGM mass balance model class.
ref_mb (float) – Reference mass balance.
ref_mb_err (float) – Reference mass balance uncertainty.
ref_mb_unit (str, default "kg m-2 yr-1") – Unit used for the reference mass balance.
ref_mb_period (str, optional) – Measurement period for the reference mass balance.
first_guess_settings (str, optional) – the mb parameters which should be used as a first guess
datacube_types (str or list[str], default "monthly") –
Desired datacube types. Select one or provide a list. Options are:
monthly: monthly volume, area, length and mass balance.annual_hydro: annual volume, area, length and mass balance, and annual and monthly runoff components.daily_smb: daily mass balance.
calibration_filesuffix (str) – The filesuffix used for all outputs of this method.
calibration_strategy (str) – Text describing the current calibration strategy, e.g. “OGGM model X calibrated with data from Y over the period Z.”
mcs_sampling_settings (dict, default None) – Settings for Monte Carlo simulation parameter sampling. For default values look at signature of
Calibrator.get_mcs_parameter_sample.calibration_parameters_control (dict, default None) –
The order of calibration parameters for the control run. If None, defaults to:
{ "calibrate_param1": "melt_f", "calibrate_param2": "prcp_fac", "calibrate_param3": "temp_bias", }
calibration_parameters_mcs (dict, default None) –
The order of calibration parameters for the Monte Carlo simulation runs. If None, defaults to:
{ "calibrate_param1": "prcp_fac", "calibrate_param2": "melt_f", "calibrate_param3": "temp_bias", }
quantiles (list, default None) – The quantiles used for the aggregation of the Monte Carlo simulation results, including labels for the final datacube. If None, defaults to [0.05, 0.15, 0.25, 0.50, 0.75, 0.85, 0.95].
climate_input_filesuffix (str, optional) – The filesuffix of the climate input file.
show_log (bool, default False) – Show some basic logs during execution if True.
kwargs (dict) – kwargs to pass to the mb_model_class instance.
multiprocessing_during_datacube_creation (bool)
- Returns:
The model datacubes generated by using the provided data for calibration, including uncertainties.
- Return type:
dict
- get_eolis_dates(ds)[source]#
Get time index from CryoTEMPO-EOLIS dataset.
- Parameters:
ds (xr.Dataset) – CryoTEMPO-EOLIS dataset.
- Returns:
Time index adjusted to UTC.
- Return type:
np.ndarray
- get_eolis_mean_dh(ds)[source]#
Get mean elevation change from EOLIS data.
- Parameters:
ds (xr.Dataset) – CryoTEMPO-EOLIS dataset.
- Returns:
Time series of spatial mean of elevation change.
- Return type:
np.ndarray
- get_geodetic_mb_from_dataset(
- dataset,
- date_start='2011-01-01',
- date_end='2020-01-01',
Get the geodetic mass balance in kg m-2 from enhanced gridded data.
- Parameters:
dataset (xr.Dataset) – CryoTEMPO-EOLIS dataset.
date_start (str, default "2011-01-01") – Start of reference period.
date_end (str, default "2020-01-01") – End of reference period.
- Returns:
ref_mb, ref_mb_unit, ref_mb_err: the reference mass balance to match with unit and associated uncertainty.
- Return type:
tuple
- get_mcs_parameter_sample(
- gdir,
- control_filesuffix,
- nr_samples=16,
- ref_mb_err_sample_interval=1.0,
- prcp_fac_sample_interval=0.5,
- temp_bias_sample_interval=0.5,
- melt_f_sample_interval=0.25,
Defines the distribution of the observation and model parameters and create a sample for the Monte Carlo simulation.
- Parameters:
gdir (GlacierDirectory)
control_filesuffix (str) – The filesuffix for the control run’s settings, which used only the most likely values of the default calibration.
nr_samples (int, default 2^4.) – Number of samples. Must be a multiple of 2. The total number of generated samples equals
nr_samples * (4 + 2), where 4 is the number of variables used for sampling (ref_mb,prcp_fac,melt_f,temp_bias).ref_mb_err_sample_interval (float, default 1.0) – Multiplication factor applied to
ref_mb_err. It assumesref_mbhas a normal distribution.prcp_fac_sample_interval (float, default 0.5) –
The width of the bounds which are added and subtracted from the
prcp_facof the control run. A uniform distributionis used for sampling.
temp_bias_sample_interval (float, default 0.5) –
The width of the bounds which are added and subtracted from the
temp_biasof the control run. A uniform distributionis used for sampling.
melt_f_sample_interval (float, default 0.5) –
The width of the bounds which are added and subtracted from the
melt_fof the control run. A uniform distributionis used for sampling.
- Return type:
tuple
- get_nearest_datetime(dates, target_date)#
Get the nearest datetime.
- Parameters:
dates (array_like) – A range of dates that can be converted to
datetime64.target_date (str) – Date in the ISO-8601 format “YYYY-MM-DD”.
- get_ref_mb(
- gdir=None,
- ref_mb_period=None,
- datacube_l1=None,
- source='Hugonnet',
Get observed mass balance for a specific reference period.
- Parameters:
gdir (GlacierDirectory)
datacube_l1 (xr.Dataset) – If the reference mass balance should be derived from an observation data, which is available in a L1 datacube.
ref_mb_period (str) – Reference calibration period in the format <YYYY-MM-DD_YYYY-MM-DD>.
source (str) – Define the observation source
- Returns:
ref_mb, ref_mb_unit, ref_mb_err, ref_mb_period: the reference mass balance to match with unit, associated uncertainty and valid period.
- Return type:
tuple
- get_temporal_bounds(
- dates,
- date_start,
- date_end,
Get start and end dates of geodetic and observational periods.
This matches the nearest available dates for irregular time indices.
- Parameters:
dates (array_like) – Time index. This may be irregularly spaced.
date_start (str) – Start year of a desired period.
date_end (str) – End year of a desired period.
- Returns:
Nearest available start and end dates for observations.
- Return type:
tuple[datetime]
- set_model_matrix(
- name='SfcType_Cryosat',
- model=<class 'oggm.core.massbalance.SfcTypeTIModel'>,
- geo_period='2011-01-01_2020-01-01',
- daily=True,
- source='CryoTEMPO-EOLIS',
- **kwargs,
Set model parameters for calibration.
- Parameters:
name (str) – Name of configuration parameters. Ideally this should match the settings filesuffix.
model (oggm.core.massbalance.MassBalanceModel) – OGGM mass balance model class.
geo_period (str) – Reference mass balance period in the format YYYY-MM-DD_YYYY-MM-DD.
kwargs – Additional arguments passed to the mass balance model class.
daily (bool)
source (str)
