HyDeCoFfEE: sea, river and rain in the Santoña estuary. From 100 SFINCS simulations to 3 × 100 years of flood maps, in your browser and in your notebooks.
A simpler version of HyCoFfEE (Hybrid Approaches Predicting Compound Flooding for Estuarine Environments), with SFINCS instead of SCHISM.
Geomatics and Ocean Engineering Group (GeoOcean) · Universidad de Cantabria
Each block is a short talk with interactive demos, then you run the notebook. About two hours in total.
Why hybrid models, and the Santoña estuary.
LHS + MDA pick 100 days, SFINCS floods them, PCA compresses the maps.
LHS · MDA · PCAAn RBF learns the flood map of any day in milliseconds.
RBFWeather types and copulas generate 3 × 100 years of plausible days.
KMA · copulas110,000 days through the surrogate: return periods and flood maps.
HyFloodUSE_PRETRAINED = True at the top of
notebooks 02 and 04: they then read our models from notebooks/pretrained/.On github.com/GeoOcean/BlueMath_Course_InterJIA, click Code → Codespaces → Create. Wait about a minute: everything is installed.
Open notebooks/01 and choose the Python kernel in /opt/conda. Then 02, 03 and 04.
Set USE_PRETRAINED = True at the top of notebooks 02 and 04
(run_sfincs = False in 01) and continue with our results.
Universidad de Cantabria, Santander. We study ocean and coastal processes with numerical models, statistics and data, and turn the methods into open tools such as BlueMath.
people
projects
publications
partners
With partners such as USGS, NOAA, Scripps, CSIRO, NIWA, the Pacific Community, Puertos del Estado and IEO.
PhD student · compound flooding
Civil engineer (Granada), MSc in Coast and Port Engineering (Cantabria) and expert in numerical simulation (UPM). Many projects on coastal processes and on the impact of climate change on the coast.
PhD at Universidad de Cantabria: hybrid short-term prediction and climate-change projection systems for compound flooding.
Software developer · technical researcher
Physics (2016) and MSc in Data Science (2020), Universidad de Cantabria.
Develops efficient meteo-oceanographic tools, and new ways of coding that widen the usability and reach of the group's methods: BlueMath.
BlueMath is an open-source Python framework for the statistical analysis and simulation of coastal climate hazards. Years of research broken into small, reusable pieces that anyone can snap together into methods and climate services.
of researchers failed to reproduce someone else's published research.
failed to reproduce their own experiments.
of the analysed papers provided their code.
Research slows down when every new method has to be rebuilt from scratch before it fits into an existing workflow. BlueMath turns that work into shared pieces that are written once, tested, and reused.
Installed once, the same everywhere: same results on any machine. Platforms such as EDITO run models the same way.
From raw data to scenarios, simulations and risk products, in reproducible workflows.
Automatic downloads: precipitation, discharge, climate change, soils
Extremes, regional frequency, copulas, spatial interpolation
Synthetic series and multisite rainfall
Hydrological and hydraulic models, automated
DATA SOURCES
ERA5 · GPM · AEMET · Meteostat · GloFAS · GRDC · CMIP6 · SoilGrids
MODELS
HEC-HMS · SWAT+ · HEC-RAS · SFINCS
Today the river discharge and the rain come as files. With HYDRA in BlueMath, the same SFINCS workflow could start from the downloads and the stochastic rainfall.
Cover all plausible days
LHSKeep the 100 most different
MDARun the physics on those 100 days only
SFINCSFlood maps → a few numbers
PCAForcing → numbers → map
RBFThousands of years of days → flood statistics
KMA · copulasSFINCS on the 110,673 emulated days (~2 s each)
SFINCS on the 100 selected days, in parallel on a laptop
The surrogate on the 110,673 days
| Method | What it does | Figure | Paper |
|---|---|---|---|
| BinWaves | Nearshore wave spectra by superposing monochromatic cases (SWAN) | Paper ↗ | |
| HyWaves | Nearshore wave spectra with a SnapWave metamodel (MDA + PCA + GP) | Paper ↗ | |
| HyWaThy / HyBeat | Nearshore waves over changing beach bathymetry (XBeach) | Paper ↗ | |
| HySwash | Nearshore hydrodynamics and run-up on beaches and reefs (SWASH) | Paper ↗ | |
| HyCReWW | Wave run-up on coral reefs of any shape (XBeach) | Paper ↗ | |
| SHyTCWaves | Tropical-cyclone wave fields without a SWAN run per storm | Paper ↗ | |
| GreenSurge | Storm-surge fields with an additive hybrid model | Paper ↗ | |
| HyCoFfEE | Compound flooding in estuaries from waves, surge, tide and rain (SCHISM) | Paper ↗ | |
| HyFlood | High-resolution compound coastal flood maps with cascaded surrogates | Paper ↗ | |
| HySalt | Estuary salinity and water level from a few Delft3D-FLOW runs | Paper ↗ |
Today: HyDeCoFfEE, a decaff version of HyCoFfEE, and with SFINCS instead of
SCHISM.
Waves, surge, cyclones, run-up, salinity, floods: the same playbook at every scale.
Hover the map: elevation from the 20 m topobathymetry (UTM 30N). The dashed area is the SFINCS domain, closed at the mouth.
River and rain go together: rain generates the runoff. A big flood with no rain is not physical.
The sea is driven by the tide, the surge and the waves: almost independent of the river.
We cannot run SFINCS for every possible day. Which days do we run?
Random sampling leaves gaps and clusters, by chance.
LHS splits every variable into N equal strata and puts exactly one sample in each row and each column: one shaded cell per row and per column.
Every value range is covered, whatever N. Here the samples sit at the centre of their cells; in bluemath-tk they are placed at random inside them. In 3D (TWL, Q, rain) the idea is the same.
LHS(num_dimensions=3, seed=1) → 20,000 samples.The LHS samples Q and rain independently: it proposes a river flood on a dry day.
We keep only the samples inside the convex hull of the observed (Q, rain) pairs.
The TWL is left free: high tide + river flood stays possible.
The selection covers the edges first: exactly where the extremes are. Random selection mostly picks the crowded centre.
The real selection of the notebook: MDA on the 13,457 plausible scenarios, normalised to [0, 1].
Move the slider: the first cases are the corners of the space. Drag the plot to rotate it.
MDA(num_centers=100).fit(data, normalize_data=True)Sea: a triangle peaking at hour 12. The tide is symmetric around the mean level and the residual (surge + setup) is nearly constant over a day, so
River: the SCS unit hydrograph scaled to the daily peak, shifted by a random lag of ±2–6 h.
Rain: the daily depth spread uniformly over the 24 h.
SFINCS (Deltares) solves simplified shallow-water equations: fast enough for compound floods over large areas.
Move the water level: a coarse model without subgrid sees the cell as either dry or wet; the subgrid cell fills gradually, like the real terrain.
A bluemath-tk wrapper builds the model once, makes a folder for every case, runs them anywhere and returns all the results together. You only describe what changes between cases.
templates/ ├─ sfincs.ind sfincs.msk └─ sfincs_subgrid.nc
Grid, active cells and subgrid tables from the DEM
(fixed_parameters, HydroMT).
cases/ ├─ 0000/ .bzs .dis .precip ├─ 0001/ ... └─ ... 100 cases
Each MDA day writes its sea, river and rain forcing (metamodel_parameters).
serial sfincs docker sfincs-cpu apptainer sfincs.sif
A launcher is just a command. One case per core, a log in each folder.
water_level_cases(...)
# zs (case_num, y, x)
The maximum water level of the 100 cases in one xarray Dataset, ready for PCA.
build_case also writes sfincs.src + sfincs.dis
(notebooks/utils/sfincs_wrapper.py).PCA finds the directions where the data vary the most. Rotate the axis: the variance of the projections is largest along PC1.
With correlated variables, one direction captures almost everything, and the second adds little.
run_sfincs = False: the
notebook uses our results.You should see:
An interpolator learns the 100 SFINCS runs and predicts the flood map of any day.
The prediction is a weighted sum of bumps centred at the training points, plus a linear trend:
The weights make f pass exactly through every training point. σ sets how far each point reaches.
Click on the plot to add a training point. bluemath-tk optimises σ for each output.
TWL, Q, rain, normalised to [0, 1]
One RBF per principal component, each with its own σ
RBFmean + Σ PCk · EOFk on the 100 m grid
PCAmax(level − DEM, 0) on the 20 m DEM
hydromt-sfincsIn milliseconds, for any day
The level is a smooth surface defined in every active cell: PCA and RBF handle it well. The DEM adds the sharp wet/dry edges afterwards.
It interpolates between the 100 SFINCS days. Outside their range (bigger storms than ever simulated) it is not reliable.
new_days.Lost? USE_PRETRAINED = True
Ten years of data cannot tell us the 100-year flood. We simulate plausible days that keep the physics of the weather.
25 patterns of sea level pressure around Iberia, 1979–2018
PCA · KMA5 types of year, from the share of each DWT in the year
PCA · KMAAWT year by year, then DWT day by day with the AWT PCs as covariates
ALRRain, surge + setup and river discharge sampled together
Gaussian copula110,673 plausible days, with the right dependence
data/xds_output.nc) is given. In notebook 03 you
fit the copulas and simulate the drivers. The tide is added in notebook 04.Sea level pressure, its gradient and the 500 hPa geopotential, 1979–2018 → PCA (90% of the variance) + KMA guided by local rain and wind.
Count the DWTs of each year: 25 probabilities per year, summing to 100%.
Some years have more stormy types, others more anticyclonic ones. PCA (3 PCs) + KMA groups the 40 years into 5 annual weather types.
Each AWT is a different mix of daily types: it sets which days are more likely that year.
An autoregressive logistic regression gives the probability of each AWT next year, knowing this year's.
P(AWTt = i) ∝ exp(αi + βi·AWTt−1)
Terms: intercept + Markov order 1. Simulated: 3 sequences, 1999–2100.
Only 6–10 years per AWT: a Gaussian copula with KDE marginals populates the PC space of each AWT (1000 samples).
Each simulated year then picks its 3 PCs at random from the populated PCs of its AWT.
ALR_WRP(...).Simulate(num_sims=3, ...): done for you, in
data/AWT_SIM_nsims3_2000_2100.nc.A second ALR gives the probability of each of the 25 DWTs tomorrow.
intercept season cos/sin 2πt, 4πt AWT PC1 PC2 PC3 of the year Markov DWT of yesterday
The seasonality brings winter storms in winter; the AWT PCs make some years stormier; Markov keeps the persistence of the weather.
Covariates: the simulated PCs of the annual ALR, one value per year, repeated for every day.
data/xds_output.nc, 3 × 100 years of DWTs. Notebook 03
starts here.ECDF kernel instead of KDE for a variable:
what happens to the extremes?It writes outputs/simulated_precip_ss_q.nc for notebook 04.
The emulator gives the days, the surrogate gives the maps. Together: flood statistics.
SFINCS runs, chosen with LHS + MDA
principal components per flood map (99.9%)
emulated days through the RBF surrogate
year flood map, without fitting an extreme-value distribution
The same recipe works for waves (HySwash, HyBeat), cyclones (SHyTCWaves) or any expensive model: simulate a few, learn them, emulate many.
The RBF interpolates. Emulated days above the simulated maxima are clipped, and the rarest floods are underestimated. Add SFINCS runs at the edges.
One triangle, one hydrograph, uniform rain and a random lag per day: the timing of the drivers matters for compound floods.
3 × 100 years from 10 years of local data and 40 of weather types. The tide is drawn independently of the weather.
Add sea level rise to the TWL, or drive the emulator with weather types from climate projections.
Clone the repositories, pick a piece, and build something bigger on top of it.
Develop code, use and test the methods on your coast, bring computing power, start a project, host a course. Open an issue or a pull request.
BlueMath toolkit (GeoOcean): LHS, MDA, PCA, RBF and the climate emulator. SFINCS and HydroMT-SFINCS (Deltares). Licensed GPL-3.0.
HyDeCoFfEE · InterJIA 2026