geossm: Python for spatiotemporal geostatistics
Jacopo Rodeschini, Lorenzo Tedesco, Francesco Finazzi, Philipp Otto and Alessandro Fassò (2026). Multivariate low-rank state–space model with SPDE approach for high-dimensional data. Spatial Statistics, 73, 100971.
Summary
geossm is an open-source Python package for fitting geostatistical state-space models and mapping spatial processes that evolve over time. It takes observations in a GeoPandas GeoDataFrame and supports joint modelling of variables measured at different sets of locations. For example, PM₁₀ and PM₂.₅ monitors may only partially overlap. The model can use their estimated cross-dependence, alongside weather covariates and nearby observations, to predict each pollutant and quantify prediction uncertainty.
Consider geossm for dynamic kriging or spatial gap filling when measurements can be aligned to a regular time grid and a linear-Gaussian model is appropriate. Missing site–time responses can remain missing during fitting. The low-rank prediction workflow described here targets unsampled sites within the fitted time period. Its test at held-out stations evaluates spatial interpolation, so it answers a different question from forecasting at future times.
How the low-rank state-space model works
The observation equation combines covariate effects with a linear combination of latent spatial fields and measurement noise. Shared latent fields create cross-variable dependence even when changes in the variables are observed at different locations. The state equation evolves those fields through an autoregressive transition with spatially correlated Gaussian innovations. In compact notation, with \(H_t\) projecting the states to observation locations and incorporating the coregionalisation loadings, the model is
\[y_t = X_t\beta + H_t z_t + \varepsilon_t,\qquad z_t = F z_{t-1} + \eta_t.\]
A stochastic partial differential equation (SPDE) gives a finite-element approximation to the Matérn innovation field. The mesh defines the spatial basis, and its coefficients form the latent state. Fewer vertices reduce the state dimension and computation, with a potential loss of fine-scale resolution. The paper studies the convergence of the approximation as the discretisation is refined and gives a prediction error bound for the approximation.
Parameter estimation uses maximum likelihood via expectation–maximisation (EM). The Kalman filter and smoother infer the latent state from available observations in the expectation step. The maximisation step has closed-form updates for many parameters and numerical optimisation for the remainder. The package uses JAX for numerical computation and automatic differentiation. Rank selection is a model choice: assess prediction error at the locations or spatial blocks that match the intended use.
What the Italian air-quality study found
The paper jointly models daily PM₁₀ and PM₂.₅ concentrations over 2,009 days at 661 stations in Italy. The pollutants are observed at partially overlapping sites, with substantial missingness. The authors reserved approximately 10% of sites per pollutant for validation and excluded sites close to the domain boundary from the holdout. Table 5 of the paper reports the following comparison between the reference mesh and the coarsest mesh.
| Mesh level | Estimation time | PM₁₀ validation RMSE | PM₂.₅ validation RMSE |
|---|---|---|---|
| 100% reference | 12,360 s | 6.92 µg/m³ | 5.84 µg/m³ |
| 25% of reference | 780 s | 6.88 µg/m³ | 6.69 µg/m³ |
At 25% of the reference mesh size, the reported fit was about 15.8 times faster. PM₁₀ validation RMSE was nearly unchanged and PM₂.₅ RMSE rose by about 15%. This benchmark illustrates why mesh resolution should be checked separately for each response. Runtime and prediction accuracy depend on hardware, mesh geometry and the dataset.
Fit a first model in Python
The installation guide documents Linux x86-64 and Python 3.10 or later. Install the package from PyPI in that environment.
python -m pip install geossm
This example follows the official 3.x quick start. It uses the bundled Agrimonia data to fit a univariate PM₁₀ model with temperature. Use one formula per response for a joint fit and follow the package’s multivariate examples for the corresponding covariance setup.
from geossm.covmodel import SPDEApproxCov
from geossm.covmodel.utils import buildMesh2d
from geossm.datasets import load_dataset
from geossm.stmodel import LRStateSpaceModel
observations, region = load_dataset("agrimonia")
region_geometry = region.geometry.iloc[0]
mainland = max(region_geometry.geoms, key=lambda part: part.area)
domain = [mainland.buffer(0.3)]
model = LRStateSpaceModel(
observations, ["AQ_pm10 ~ 1 + WE_temp_2m"], domain=domain
)
mesh, _ = buildMesh2d(model.points[0], lowrank=0.5, domain=domain)
covariance = SPDEApproxCov(latlon=True).setup(mesh, domain=domain)
model = model.setup(cov_fun=[covariance])
results = model.fit()
print(results.summary())
For your own data, supply a long-format GeoDataFrame with site geometry, regularly spaced timestamps, numeric responses and the formula covariates. The example uses longitude and latitude. Project both the data and domain if you need a planar mesh in metric units. For interpolation, results.predict(prediction_data) returns the estimated mean and pointwise variance for rows with valid covariates and timestamps in the training period. Use held-out stations for a new-site accuracy assessment.
Software, documentation and paper
Install geossm from PyPI, use the package documentation for the current API, and record the installed version when reporting results. Cite Rodeschini et al. (2026) when using the low-rank SPDE state-space method. The paper’s replication repository contains the scripts for the published analysis.
PyPI Documentation Source code Open-access paper Paper replication code