Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Boundaries and Ecosystem

Overview

xtremax owns extreme value distributions, Bayesian models, and xarray extraction utilities. It delegates inference to NumPyro, spatial GP modeling to GPJax, and data preprocessing to geo_toolz.


Ownership Map

ConcernOwnerNotes
EVT distributions (GEV, GPD, Gumbel, Frechet, Weibull)xtremaxNumPyro Distribution subclasses
Point process distributions (Hawkes, Poisson, renewal)xtremaxNumPyro Distribution subclasses
Max-stable process models (Smith, Schlather, Brown-Resnick, Extremal-t)xtremaxComposite pairwise likelihood
Model zoo (stationary/nonstationary/spatial GEV, POT, PP)xtremaxNumPyro model functions
Block maxima extractionxtremaxxarray utilities
Threshold selection (constant, trend, parametric)xtremaxxarray utilities
Declustering and extremal indexxtremaxxarray utilities
EVT diagnostic plots (QQ, PP, return level, 4-panel)xtremaxmatplotlib-based
Simulation tools (synthetic extremes, GMST, spatial fields)xtremaxFor testing and demos
Dataset loaders (GHCN-D, GSOD, NDBC, UHSLC, GESLA, etc.)xtremaxStandard climate/ocean obs
Climate covariate loaders (GMST, ONI, NAO, etc.)xtremaxFor nonstationary models
GP spatial pooling engineGPJaxxtremax wraps via gp/ module
Inference (MCMC, SVI, Predictive)NumPyroNever reimplemented
Data preprocessing (regrid, detrend, subset)geo_toolzUpstream of xtremax
Structured linear algebragaussxOptional for GP covariance
ODE/SDE integration for simulationsdiffraxOptional for energy balance models

Decision Table

ScenarioRecommendation
Fit stationary GEV to annual maximablock_maxima → stationary_gev → MCMC
Detect trend in extremesnonstationary_gev with GMST covariate → SVI
Estimate 100-year return levelFit GEV → gev.return_level(100) from posterior
Model threshold exceedancesthreshold_exceedances → decluster → pot_gpd → MCMC
Spatial extreme analysisspatial_gev with GPJax spatial pooling → MCMC
Model clustered extreme eventsHawkesProcess or point_process_extreme → MCMC
Preprocess raw station datageo_toolz (upstream)
Compare return levels across modelsxtremax posterior samples → geo_toolz metrics

Ecosystem Interactions

External PackageIntegration PointPattern
numpyroDistribution base class, inferenceAll xtremax distributions and models
GPJaxGP kernels, variational inferencextremax.gp wraps GPJax for spatial models
xarrayData interface for all utilitiesBlock maxima, thresholds, datasets
geo_toolzPreprocessing upstream, evaluation downstreamPreprocess → xtremax → evaluate
diffraxODE/SDE solversEnergy balance model in simulations
gaussxStructured covariance for GP layersOptional for large-scale spatial models

Scope

In Scope

Out of Scope


Testing Strategy

CategoryWhat it testsExample
Distribution contractNumPyro Distribution interfaceGEVD.log_prob, sample, mean, variance, cdf match analytical
Numerical accuracyDistribution math vs scipy referenceGEVD.log_prob(x) matches scipy.stats.genextreme.logpdf(x)
Return levelsQuantile inversionreturn_level(T) matches cdf^{-1}(1 - 1/T)
xarray preservationCoordinates, dims, attrs surviveblock_maxima(ds).coords contains expected dims
Model inferenceModels converge on synthetic datastationary_gev recovers known parameters via MCMC
JAX transformsCompatible with jit, vmapjax.vmap(GEVD.log_prob)(batch_x) works
PlottingDiagnostic plots don’t crashQQ, PP, return level plots produce figures

Test Priorities

  1. Distribution correctness — log_prob, cdf, return_level match analytical/scipy

  2. NumPyro compatibility — all distributions work in MCMC and SVI

  3. xarray round-trip — extraction utilities preserve metadata

  4. Model convergence — model zoo recovers known parameters on synthetic data


Migration Plan from jej_vc_snippets/extremes

The existing code in jej_vc_snippets/extremes/ is the primary source material. The migration is a restructuring + cleanup, not a rewrite.

Source (jej_vc_snippets/extremes/)Destination (xtremax/)Notes
gevd.pydistributions/gevd.pyDirect move, clean imports
gpd.pydistributions/gpd.pyDirect move
gumbel.pydistributions/gumbel.pyDirect move
frechet.pydistributions/frechet.pyDirect move
weibull.pydistributions/weibull.pyDirect move
point_process/*.pydistributions/point_process/*.pyConsolidate Poisson variants
block_maxima.pyxarray/block_maxima.pyDirect move
threshold.pyxarray/threshold.pyDirect move
decluster.pyxarray/decluster.pyDirect move
models/temp_gevd_*.pymodels/spatial_gev.pyGeneralize from temperature-specific
simulations/*.pysimulations/*.pySplit and reorganize

Roadmap

PhaseFocusDepends on
v0.1Core distributions (GEV, GPD) + block maxima + stationary/nonstationary modelsnumpyro stable
v0.2Point processes + POT + spatial GEV (GPJax) + max-stablev0.1 + GPJax
v0.3Dataset loaders + simulation tools + plottingv0.1
v0.4+r-Pareto processes, copulas, additional point process modelsv0.2

Open Questions

  1. Composite likelihood adjustment — Pairwise composite likelihood underestimates posterior uncertainty. Should we implement the Chandler-Bate sandwich adjustment? Proposal: provide a sandwich_adjustment() utility.

  2. Max-stable simulation — Exact simulation of Brown-Resnick is expensive. Approximate via truncated spectral representation? How many terms?

  3. Spatial plotting backend — Plain matplotlib by default, cartopy optional for georeferenced maps?

  4. r-Pareto processes — Conditional spatial analog of max-stable processes. Defer to v0.2?