# From GDGTs to sea temperature

A walkthrough of how one Scaled Ring Index becomes a temperature with an error bar, in plain language, with the equations folded away. Pick a sample from the published case studies, or set your own Scaled RI, GDGT-2/3, NO₃ and prior, and every figure recomputes. The curves, the Stan program, Hamiltonian trajectories and four sampler chains all run in your browser, so there is nothing to install.

The calibration is the published `tx.GHEB.sst.sri03.G23-N1p0`, using the same 500 draws a default `predict_T_from_proxyObs()` call marginalizes over. For the example samples, the page shows the package's own output beside what it computes in the browser.

```{raw} html
<p style="margin:1rem 0 0;">
  <a href="_static/gdgt-to-temperature.html" target="_blank" rel="noopener"><strong>Open the walkthrough full-page →</strong></a>
  (recommended: it is long, and the sample picker stays in view)
</p>
<iframe src="_static/gdgt-to-temperature.html"
        title="From GDGTs to sea temperature: an interactive walkthrough"
        style="width:100%;height:85vh;border:1px solid var(--pst-color-border,#ccc);border-radius:4px;margin-top:1rem;"
        loading="lazy"></iframe>
```

## Where to go next

- [The PSM guide](PSM.md) covers the same steps as API calls, including the quality flags.
- [Why marginalization improves inverse TEXAS sampling](marginalization_explainer.md) explains why step 4's average gives the sampler an easier problem.
- [Stan models](stan_models.md) describes the model shown in step 6 and the rest of the shipped set.

## Rebuilding it

The page is generated by `docs/_scripts/build_gdgt_to_temperature.py` from the installed package, so the calibration draws, the Stan source and the sampler defaults cannot drift. The stored TEXAS percentiles for the example samples need CmdStan, so they come from a committed snapshot unless you ask for a re-run:

```bash
python docs/_scripts/build_gdgt_to_temperature.py                 # uses the stored runs
python docs/_scripts/build_gdgt_to_temperature.py --refresh-runs  # re-runs the examples
```

`tests/test_gdgt_to_temperature_page.py` fails if the committed page falls out of step with the package, or if the stored runs stop matching the posterior the page computes.
