# Design decisions

The main choices behind this package and its notebooks, with their dates
(2026) and the reason for each. The newest choices are at the end of each
section. Open questions are at the bottom.

## The package

- **A separate GPL package** (Nov 5). AdaPBS comes from MuSA, which is GPL-3.0;
  OGGM is BSD-3-Clause and must not depend on GPL code. This package is
  temporary: when the MuSA authors publish their permissively licensed package
  of data assimilation schemes, the algorithm will come from there, and the
  OGGM parts (priors, forward models, tasks, notebooks) can move into OGGM.
  OGGM never imports this package.
- **`adapbs.py` stays close to MuSA** and has no OGGM import, so that it can be
  compared with MuSA and replaced later. Its differences from MuSA are listed in
  its docstring. A test compares the AMIS weights with MuSA's own function, at
  the MuSA commit the code was ported from; a second CI job runs against MuSA
  master and is allowed to fail.
- **Logit-normal priors** (Oct 30): each parameter is bounded, and its prior is
  Gaussian in a transformed space. For a calibration, the prior is centred on
  OGGM's informed values (the evidence preferred it on Hintereisferner). Prior
  centres never come from the glacier settings, which hold calibrated values.
- **AdaPBS stops when Neff / Ne reaches 0.3** (Oct 30), not 0.1 as in MuSA's
  configuration: 0.1 stopped too early, with noisy posteriors.
- **Log evidence fixed** (Nov 11): it was too low by the log of the number of
  iterations. The weights were not affected. Evidence values computed before
  this fix are not comparable with later ones.

## The dynamic workflow (`oggm_adapbs.dynamic`)

- **One AdaPBS run over OGGM's whole workflow** (Nov 13): the MB parameters,
  Glen's A (inversion and dynamics) and the initial state of the spinup vary
  together, and each parameter set is a full run (inversion, initial state,
  historical run). The code is a package module, not only a notebook, so that
  it can run on a cluster.
- **Glen's A is a log10 factor on OGGM's default A** (Nov 13), between A / 10
  and 10 A, not centred on the regionally calibrated A: the regional
  calibration uses the IceBoost volumes, which are also an observation here.
- **The three observations** (Nov 13-16): the geodetic MB (Hugonnet et al.,
  2021) with 0.2 times its error (the published errors include errors shared
  by many glaciers, too large for one glacier); the RGI area with 5% plus half
  a grid point of the terminus (observation and representation error of a
  flowline glacier); and the IceBoost v2 mean thickness (volume / area) with an
  error of 20%. IceBoost's own errors (about 50-66%) would make it
  uninformative: they are the spread under perturbed inputs, summed as if
  fully correlated (an upper bound). The mean thickness depends less on the
  glacier size than the volume, and is less correlated with the area. The
  volume, and errors from IceBoost, remain options.
- **No WGMS data in the dynamic workflow** (Nov 13): it must work for any
  glacier. WGMS data are only for side checks.
- **OGGM's reference** for comparisons is its dynamic calibration
  (`run_dynamic_melt_f_calibration`: dynamic spinup and melt_f
  recalibration), on a copy of the glacier directory (Nov 13).
- **A sensitivity study, not a calibration** (Nov 16). The purpose is
  Chloe's: the equifinality of OGGM as it is used today. AdaPBS keeps
  the plausible parameter sets (as GLUE would, with a threshold on the misfit,
  but more efficiently), then we study what drives the spread of the
  predictions. Hence wide, nearly uniform priors (logit-normal, sd 1.4 in the
  transformed space, centred mid-range). A parameter which the observations do
  not constrain is a result, not a failure.
- **"Initial state", not "growth"** (Nov 16): the period of constant climate
  before the historical run does not reconstruct the past glacier, which
  present geometry and past climate cannot determine (Eis et al., 2019, 2021).
  Its temperature offset stands for the unknown state at the start of the
  historical run. Spinup 30 years, initial state period 20 years.
- **Prior bounds of the notebooks** (Nov 16): melt_f and prcp_fac vary in
  log10 (half and twice a value are equally far from it); melt_f within OGGM's
  bounds, prcp_fac 0.5-5 (OGGM's 0.1-10 let implausible runs through),
  temp_bias the informed value ± 10 K, initial state offset -3 to +2 K.
- **Runoff** (Nov 16) is OGGM's total runoff (melt and liquid precipitation,
  on and off the glacier) over a fixed catchment: the glacier area of 2000,
  not the largest area of the run, which depends on the initial state.
- **Hydrological output only in a rerun of the plausible runs** (Nov 16): it
  makes a run about 2.5 times slower, and most AdaPBS runs have a negligible
  weight. By default, the rerun keeps the runs which hold 99.9% of the weight,
  with their weights; a random draw with the weights is an option.
- **The 2026.11 glacier directories** (Nov 22): OGGM v1.7, ERA5 climate
  (1940-2025), IceBoost inversion, border 160. They were made with
  `trapezoid_lambdas = 4`, which is not stored in them: it must be set
  (`cfg.PARAMS['trapezoid_lambdas'] = 4`).
- **The code follows three steps** (Nov 23): run the model for one parameter
  set (`dynamic.run`, which knows nothing about observations), compute numbers
  from the runs (`dynamic.observations`: the model's values of the
  observations; `dynamic.metrics`: metrics which need no observations), and
  find the plausible parameter sets (`dynamic.equifinality`). Any other
  sampling method can reuse the first two steps. The refactoring changed no
  results.
- **Runoff signatures** (Nov 23): the first five of Aguayo et al. (2024, TC,
  Table 1), with the periods as arguments. Our choices where the paper leaves
  room: the peak water magnitude and duration use the 11-year moving average,
  and the duration counts all the years above 90% of the peak.
- **Projections** (Nov 23): the GCMs of GlacierMIP4 bias-corrected to ERA5
  (quantile delta mapping, 1980-2019), used without further correction from
  the end of the ERA5 data (January 2026), as in OGGM's GlacierMIP4 runs.

## Running on a cluster

- **The jobs run in a container that sees only what it needs** (Nov 16): the
  frozen code and the data read-only, the job's scratch writable; the
  outputs are copied to their final place after the container exits. The code
  is frozen at submission, so that editing the repository does not change
  queued jobs. Details in `scripts/README.md`.
- **The jobs install OGGM master at a pinned commit** (Nov 23): the 2026.11
  directories need a recent OGGM.
- **On the Bremen cluster, OGGM's public data are bound read-only** (Nov 23):
  the download cache links into them, so the jobs read the glacier directories
  and the GCM files there instead of downloading them.

## Open questions

- Keep the initial state period? The data barely prefer runs without it, and
  it makes Glen's A unidentifiable (the offset compensates A). To discuss.
- The error of the thickness: 20% for all glaciers is pragmatic; 30% is the
  next to try.
- On Vernagtferner, plausible runs match the MB of 2000-2019 but are too
  positive in 1979-1993 compared with WGMS data; the 30-year spinup runs
  through this period. Cause unknown (climate data or MB sensitivity).
- Convergence: how much do the posterior quantiles and the evidence change with
  the seed and the number of particles?
- Peak water year of a single run: around peak water the runoff is a broad
  plateau, and the year of its maximum depends on the climate variability of
  one climate realisation. The duration may be the more robust signature.
