Documentation
The NLSA Python toolkit: how to run it, how it is built, and how to set its options
This section documents the Python toolkit that produces the analyses and forecasts on this website. The toolkit implements the methods described under Methodology: delay embedding, kernel methods, Koopman spectral analysis and kernel analog forecasting.
The toolkit
The code is open source, in the NLSA repository on GitHub, under the BSD 3-Clause license. Its Python part, in the Python/ folder, contains two packages:
nlsa, the algorithms: delay-coordinate maps, kernels and their normalizations, kernel eigendecomposition, Koopman operator approximation, kernel analog forecasting and skill scores. The numerical work runs on JAX, on a CPU or on one or more GPUs.nlsa_models, the data pipelines and models: reading ERA5 reanalysis and 14th Weather Squadron station records, the Lorenz 63 test system, and functions for plotting results.
Example scripts in Python/examples/ run complete experiments for ENSO and for the Lorenz 63 system.
These pages describe version 0.4 of the toolkit, at commit f945945 of 20 September 2026 (“Update ENSO examples”). Option names, defaults and allowed values in the tables are taken directly from that version of the code. The Python code is under active development, so check the repository when you update.
What is implemented
| Component | Status in the Python toolkit |
|---|---|
| Delay embedding, variable-bandwidth and cone kernels, diffusion-maps and bistochastic normalizations, out-of-sample (Nyström) extension | Implemented |
| Koopman eigendecomposition: diffusion-regularized generator, and compactified Laplace or Gauss transforms (resolvent methods) | Implemented |
| Kernel analog forecasting (KAF), direct and iterative | Implemented |
| Forecasts from Koopman eigenfunctions | Implemented (Lorenz 63 examples) |
| Skill scores: normalized RMSE and anomaly correlation | Implemented |
| Baseline forecasts: persistence, climatology, autoregressive models | Not yet in the repository |
| Extended EOF analysis, for comparison with Koopman indices | Implemented, without an example script |
| Quantum mechanical data assimilation (QMDA) | Building blocks only; the full method is in the MATLAB code |
| Data: ERA5 (monthly and daily), 14th Weather Squadron stations, Pituffik, Lorenz 63 | Implemented |
| Example scripts: ENSO and Lorenz 63 | In the repository |
| Example scripts: MJO and station forecasts | Not yet in the repository |
How this documentation is organized
Installing the toolkit on a CPU or GPU machine, running the examples, and using it from your own code.
The experiments: ENSO from monthly data, the MJO from daily data, station forecasts, and the Lorenz 63 test system.
How the packages and modules are organized, and how an experiment script is put together.
One page for each step of the calculation, from data to skill scores, with all of its options.
Each algorithm written out step by step, with the function that implements it.
Choosing hyperparameters and All options
How to choose the settings that matter most, and every option in one place.
Conventions
- Names in
monospaceare exactly as they appear in the code. Options marked required have no default and must be set. - Classes are referred to by the module they are imported from, for example
nlsa.jax.kernels.TuneParsorclimate.DataParsfornlsa_models.climate.DataPars. - Times and lead times are counted in samples: months for monthly data, days for daily data.
- Eigenfunctions are numbered from 0. Several options select eigenfunctions with the same convention: an integer n means the first n (indices 0 to n − 1), a tuple
(a, b)means indices a to b inclusive, and a list gives the indices. The Galerkin basis of the Koopman block is the exception: an integer L there means indices 1 to L (see Koopman analysis).
The notation used on these pages:
| Symbol | Meaning | In the code |
|---|---|---|
| T | Number of time samples in the chosen period | DataPars.num_total_samples |
| h | Half-width of the delay window (the window holds 2h + 1 samples) | num_half_delays |
| N | Number of training samples after embedding | DataPars.num_samples |
| ε | Kernel bandwidth | TuneInfo.bandwidth |
| φ_j, λ_j | Kernel eigenfunctions and eigenvalues | KernelEigen.evecs, KernelEigen.evals |
| L | Number of kernel eigenfunctions in a basis | num_eigs, which_eigs, which_eigs_galerkin |
| ζ_k | Koopman eigenfunctions | KoopmanEigen |
| Q | Number of prediction steps (lead times 0 to Q) | PredPars.num_steps |