oggm.core.massbalance.RandomMassBalance#
- class oggm.core.massbalance.RandomMassBalance(gdir, mb_model_class=<class 'oggm.core.massbalance.MonthlyTIModel'>, y0=None, halfsize=15, seed=None, all_years=False, unique_samples=False, prescribe_years=None, **kwargs)[source]#
Random shuffle of all MB years within a given time period.
This is useful for finding a possible past glacier state or for sensitivity experiments.
Note that this is going to be sensitive to extreme years in certain periods, but it is by far more physically reasonable than other approaches based on gaussian assumptions.
- __init__(gdir, mb_model_class=<class 'oggm.core.massbalance.MonthlyTIModel'>, y0=None, halfsize=15, seed=None, all_years=False, unique_samples=False, prescribe_years=None, **kwargs)[source]#
Initialize.
- Parameters:
- gdirGlacierDirectory
the glacier directory
- mb_model_classMassBalanceModel class
the MassBalanceModel to use for the random shuffle
- y0int, required
the year at the center of the period of interest.
- halfsizeint, optional
the half-size of the time window (window size = 2 * halfsize + 1)
- seedint, optional
Random seed used to initialize the pseudo-random number generator.
- all_yearsbool
if True, overwrites
y0
andhalfsize
to use all available years.- unique_samples: bool
if true, chosen random mass balance years will only be available once per random climate period-length if false, every model year will be chosen from the random climate period with the same probability
- prescribe_yearspandas Series
instead of random samples, take a series of (i, y) pairs where (i) is the simulation year index and (y) is the year to pick in the original timeseries. Overrides y0, halfsize, all_years, unique_samples and seed.
- **kwargs:
keyword arguments to pass to the mb_model_class
Methods
__init__
(gdir[, mb_model_class, y0, ...])Initialize.
get_annual_mb
(heights[, year])Like self.get_monthly_mb(), but for annual MB.
get_ela
([year])Compute the equilibrium line altitude for a given year.
get_monthly_mb
(heights[, year])Monthly mass balance at given altitude(s) for a moment in time.
get_specific_mb
([heights, widths, fls, year])Specific mb for this year and a specific glacier geometry.
get_state_yr
([year])For a given year, get the random year associated to it.
is_year_valid
(year)Checks if a given date year be simulated by this model.
Attributes
bias
Residual bias to apply to the original series.
prcp_fac
Precipitation factor to apply to the original series.
temp_bias
Temperature bias to add to the original series.