TerraFlow Model: Dual Flow Prediction Approaches
- TerraFlow is a dual-model framework integrating a Transformer for glacier time-series prediction and an algorithm for planetary runoff simulation.
- The IceWatch TerraFlow model employs a four-layer Transformer with quantile loss to deliver robust, interpretable glacier velocity forecasts for GLOF risk assessment.
- The Handmer TerraFlow algorithm utilizes depression filling and steepest descent flow accumulation to simulate water redistribution on Martian terrains.
TerraFlow refers to two distinct, technically rigorous models in contemporary research: (1) a Transformer encoder for glacier velocity time-series regression central to the IceWatch multimodal GLOF prediction system (Fatima et al., 18 Jan 2026), and (2) a global surface-runoff and catchment network algorithm for disordered planetary terrain, particularly Mars, as developed in the Handmer model (Handmer, 2016). These models share an emphasis on physics-informed flow modeling, algorithmic interpretability, and integration with remote sensing data, but differ fundamentally in mathematical formulation, input structure, and intended application domain.
1. Time-Series Transformer Architecture for Glacier Flow (IceWatch TerraFlow)
The IceWatch TerraFlow module is a four-layer Transformer encoder trained on long-term NASA ITS_LIVE glacier velocity series to predict daily surface velocity for the Shisper Glacier, enabling robust, cross-validated warnings of glacial lake outburst floods (GLOFs) (Fatima et al., 18 Jan 2026). The model uses transformer-specific constructs as follows:
- Model structure: 4 stacked encoder blocks, each incorporating multi-head self-attention (), with embedding dimension and per-head projection . Each block contains a two-layer feed-forward subnet (ReLU, hidden size ), layer normalization, and residuals.
- Input representation: Sequence windows of 30 days (), batch size 2048, with 9 engineered features (coordinates, year, cyclical encodings for month/day, mean/max velocities), standardized.
- Mathematics: Inputs are embedded via
with learnable positional encoding . Attention is realized through
and multi-head composition:
- Loss function: Quantile (pinball) loss at (median prediction), which is robust to surge-day outliers:
- Optimization: Adam (, , ), 50 epochs, mixed precision.
- Output: Scalar velocity () in m/yr for day .
2. Preprocessing and Feature Engineering for Glacier Time-Series
The data pipeline for TerraFlow leverages ~73.6 million glacier surface velocity measurements (2000–2024). Key preprocessing steps are:
- Spatial subsampling: Shisper basin mask (~1,000 km²).
- Temporal aggregation: Daily raster averaging.
- Outlier and missing-value management: Removal of samples >3σ from local mean or flagged bad quality; gaps ≤7 days interpolated, else masked.
- Feature set: Latitude , longitude , year, cyclical month/day, daily mean/max velocities.
- Normalization: Z-score within training split.
- Window construction: 30-day sliding sequences.
The harmonization protocol aligns TerraFlow outputs with RiskFlow's Sentinel-2 image acquisition and TempFlow's MODIS-derived temperature records on matched grid cells, enabling precise multimodal fusion for GLOF event detection (Fatima et al., 18 Jan 2026).
3. Performance Evaluation and Cross-Validation
On the Shisper Glacier dataset (2000–2024; ~11.9M cell-days), TerraFlow demonstrates superior predictive accuracy across several baselines:
| Model type | MAE (m/yr) | Validation R² |
|---|---|---|
| Linear regression, tree ensembles | 40–100 | |
| LSTM (30-day window) | 44 | |
| Transformer (+MSE loss) | 35 | |
| Transformer (+weighted MAE) | 30 | |
| Transformer (+quantile loss) | 25.6 | ≈0.95 |
The quantile loss formulation yields resilience to velocity surges, and attention weights offer interpretability, indicating which temporal features drive predictions. Cyclical time encodings preserve seasonal periodicity relevant for glacier acceleration/deceleration cycles. Quantile loss extension to () provides approximate prediction intervals for (Fatima et al., 18 Jan 2026).
4. Algorithmic Surface-Runoff Modeling for Planetary Terrain (Handmer TerraFlow)
The Handmer TerraFlow model (Handmer, 2016) is an algorithmic framework for simulating catchment networks and water redistribution on planetary-scale, high-relief DEMs, developed for Martian terraforming scenarios. The principal components are:
- Assumptions: Surface-only flow, negligible infiltration, orographically modulated precipitation, spatially uniform evaporation, constant conductance , and depression-filled DEM preprocessing.
- Continuity equation:
- Flux computation:
where .
- Pit/depression filling: Priority-Flood min-heap algorithm ensures all cells can drain.
- Water redistribution: Enforced non-negativity through proportional scaling of outflows.
- Flow accumulation and channel/ catchment identification: Steepest descent direction and recursive area tally.
5. Computational Complexity and Convergence
For the Handmer model, depression filling is , time-stepping per iteration, with empirical convergence in steps on grids. Watershed labeling and channel detection are post-convergence. The CFL condition constrains maximum stable timestep:
6. Applications and Validation Examples
- IceWatch TerraFlow: Enables real-time, robust GLOF risk assessment by fusing glacier velocity with image-based meltwater assessment and temperature anomaly scores—synchronized on common spatiotemporal grids (Fatima et al., 18 Jan 2026).
- Handmer TerraFlow: Capable of reconstructing plausible Martian hydrology, predicting distribution of channel networks, catchment basins, and steady-state water depths. Notable results include accurate identification of fossilized Martian waterways, validation against high-resolution terrain, and metrics on global drainage density and flow-length statistics. The model supports engineering assessment of terraformed hydrological cycles with minimal intervention required.
7. Interpretability and Domain-Specific Insights
Attention mechanisms in IceWatch TerraFlow enable factor analysis of periodicity and surge-detection, whereas the Handmer surface-runoff construct transparently exposes algorithmic transformation from raw DEM to catchment map. Quantile loss in the transformer is physically motivated, optimizing prediction robustness for rare surges. Depression filling and flow-accumulation calculations in the runoff model assure physical validity and correspondence to observable channel morphology.
A plausible implication is that both paradigms could be extended for other planetary hydrology or terrestrial hazard domains, where integration of multimodal remote sensing data and physics-informed time-series prediction is essential for interpretability and operational reliability.