<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://ctk21.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://ctk21.github.io/" rel="alternate" type="text/html" /><updated>2026-11-16T14:22:43+00:00</updated><id>https://ctk21.github.io/feed.xml</id><title type="html">ctk21 notes</title><subtitle>Technical notes on AI/ML, R&amp;D, quantitative research, software, and engineering.</subtitle><author><name>Tom Kelly</name></author><entry><title type="html">What data do rainfall–runoff models need?</title><link href="https://ctk21.github.io/2026/11/16/data-for-rainfall-runoff/" rel="alternate" type="text/html" title="What data do rainfall–runoff models need?" /><published>2026-11-16T00:00:00+00:00</published><updated>2026-11-16T00:00:00+00:00</updated><id>https://ctk21.github.io/2026/11/16/data-for-rainfall-runoff</id><content type="html" xml:base="https://ctk21.github.io/2026/11/16/data-for-rainfall-runoff/"><![CDATA[<p>A rainfall-runoff model predicts river discharge rate from meteorological conditions and catchment properties. In previous posts, I’ve looked at some <a href="/2026/11/12/intro-to-gr4j/">lumped conceptual models</a> such as GR4J and some <a href="/2026/11/13/intro-to-net-rainfall-runoff/">net-based data-driven models</a> such as that used in <a href="https://sites.research.google/floods">Google Flood Hub</a>. A useful model can be used to build operational systems that alert when the flow rates are expected to be too high (e.g. floods) or too low (e.g. droughts).</p>

<p>In this post, we ask what data these models need and where we can find it.</p>

<h2 id="the-building-blocks-of-rainfallrunoff-data">The building blocks of rainfall–runoff data</h2>

<p>Source data used to train and run rainfall–runoff models can be grouped into the following categories.</p>

<table>
  <thead>
    <tr>
      <th>Data category</th>
      <th>What it contains</th>
      <th>Examples of sources</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><strong>1. Streamflow observations</strong></td>
      <td>River discharge observations and gauging station data</td>
      <td><a href="https://nrfa.ceh.ac.uk/data/about-data">National River Flow Archive (UK)</a>, <a href="https://grdc.bafg.de/data/data_portal/">Global Runoff Data Centre (GRDC)</a></td>
    </tr>
    <tr>
      <td><strong>2. Catchment geography</strong></td>
      <td>Catchment boundaries and river networks.</td>
      <td><a href="https://nrfa.ceh.ac.uk/data/about-data">National River Flow Archive (UK)</a>,  <a href="https://www.hydrosheds.org/products/hydrobasins">HydroBASINS</a></td>
    </tr>
    <tr>
      <td><strong>3. Static catchment attributes</strong></td>
      <td>Catchment area, elevation, slope, drainage density, river network characteristics, soil texture and depth, geology, bedrock permeability, groundwater characteristics, land cover, vegetation, long-term climate indices (e.g. aridity and mean precipitation), and human influences (e.g. urbanisation, dams and reservoirs).</td>
      <td><a href="https://www.hydrosheds.org/hydroatlas">HydroATLAS</a>, <a href="https://isric.org/explore/soilgrids">SoilGrids</a>, <a href="https://esa-worldcover.org/en/data-access">ESA WorldCover</a></td>
    </tr>
    <tr>
      <td><strong>4. Historical meteorological data</strong></td>
      <td>Observed or retrospectively estimated precipitation, temperature, evaporation, radiation, humidity, and other meteorological variables. Includes rain-gauge observations, gridded products, satellite estimates, and reanalysis data.</td>
      <td><a href="https://cds.climate.copernicus.eu/datasets/reanalysis-era5-land">ERA5-Land</a>, <a href="https://doi.org/10.5285/dbf13dd5-90cd-457a-a986-f2f9dd97e93c">CEH-GEAR</a>, <a href="https://gpm.nasa.gov/data/imerg">NASA IMERG</a>, <a href="https://www.cpc.ncep.noaa.gov/">NOAA CPC</a></td>
    </tr>
    <tr>
      <td><strong>5. Meteorological forecasts</strong></td>
      <td>Predicted precipitation, temperature, and other atmospheric variables at future lead times. May include deterministic forecasts, ensembles, and archived forecasts (hindcasts).</td>
      <td><a href="https://www.ecmwf.int/en/forecasts/datasets/open-data">ECMWF IFS</a>, <a href="https://github.com/google-deepmind/weathernext">WeatherNext</a>, <a href="https://www.ncei.noaa.gov/products/weather-climate-models/global-forecast">NOAA GFS</a></td>
    </tr>
    <tr>
      <td><strong>6. Additional dynamic observations</strong></td>
      <td>Time-varying hydrological and land-surface conditions, including soil moisture, groundwater levels and storage, snow cover and snow water equivalent, vegetation condition (e.g. NDVI and leaf area index), surface water extent, lake and reservoir levels and storage, and human-controlled flows (e.g. reservoir releases).</td>
      <td><a href="https://smap.jpl.nasa.gov/">NASA SMAP Soil Moisture</a>, <a href="https://land.copernicus.eu/en/dataset-catalog">Copernicus Land Monitoring Service</a>, <a href="https://cds.climate.copernicus.eu/datasets/satellite-groundwater-storage">GRACE/GRACE-FO Groundwater Storage</a>, <a href="https://nsidc.org/data/explore-data">NSIDC Snow Data</a>, <a href="https://catalogue.theia.data-terra.org/meta/HYDROWEB_LAKES_OPE">Hydroweb Lake Water Levels</a></td>
    </tr>
  </tbody>
</table>

<p>Not all models require every category, and the requirements differ between historical simulation and operational forecasting. The exact inputs depend on the model: conceptual models may use a small set of meteorological inputs, while net-models can also use static catchment attributes. All models use streamflow observations to support calibration, training and evaluation.</p>

<h2 id="aggregated-data-for-hydrological-modelling">Aggregated data for hydrological modelling</h2>

<p>While these individual data sources are useful, combining them across catchments and jurisdictions requires aggregation, quality control and standardisation. There are aggregated datasets for hydrological modelling in which streamflow data, static catchment attributes and meteorological information have already been cleaned, standardised and joined. Two examples of this are:</p>
<ul>
  <li><strong><a href="https://github.com/kratzert/Caravan">Caravan</a> (<a href="https://www.nature.com/articles/s41597-023-01975-w">Kratzert et al., 2023</a>)</strong>: Caravan combines standardised CAMELS (Catchment Attributes and Meteorology for Large-sample Studies) datasets to make global studies easier. It includes meteorological forcing data, streamflow data, and static catchment attributes (e.g., geophysical, sociological, climatological) for 6,830 catchments in the original release, with subsequent extensions adding further catchments. It has been extended by Caravan MultiMet (<a href="https://arxiv.org/abs/2411.09459">Shalev et al., 2024</a>) to include several nowcast products (CPC, IMERG v07 Early, CHIRPS), as well as three different forecast products (ECMWF IFS HRES, GraphCast, CHIRPS-GEFS) with multiple bands and 10-day (IFS, GraphCast) or 16-day (CHIRPS-GEFS) lead times.</li>
  <li><strong><a href="https://catalogue.ceh.ac.uk/documents/9a46d428-958f-4ac1-86eb-94eee70c0955">CAMELS-GB v2</a> (<a href="https://essd.copernicus.org/articles/18/4345/2026/essd-18-4345-2026.html">Coxon et al., 2026</a>)</strong>: This presents a standard dataset of daily and hourly streamflow for 671 catchments across Great Britain joined with meteorological and static catchment information. The dataset includes some reservoir and groundwater sites.</li>
</ul>

<p>Google has also published code supporting its global flood forecasting models including how to source the dataset they used:</p>
<ul>
  <li>
    <p><strong><a href="https://doi.org/10.5281/zenodo.10397664">Data for “Global prediction of extreme floods in ungauged watersheds”</a> (<a href="https://www.nature.com/articles/s41586-024-07145-1">Nearing et al., 2024</a>)</strong>: This model was trained using daily streamflow observations from 5,680 gauges, catchment boundaries derived from HydroBASINS, static catchment attributes from HydroATLAS, historical meteorological data from ERA5-Land, NOAA CPC and IMERG, and weather forecasts from ECMWF IFS HRES. The <a href="https://doi.org/10.5281/zenodo.10397664">published data on Zenodo</a> includes Google model reforecasts, GloFAS reanalyses, trained model artefacts, evaluation metrics and supporting metadata. These are primarily model outputs rather than the original observations and meteorological inputs used for training. See the paper authors’ <a href="https://github.com/google-research-datasets/global_streamflow_model_paper">reproduction code</a> for notes on training data preparation because some inputs (e.g. GRDC) must be obtained separately due to redistribution restrictions.</p>
  </li>
  <li>
    <p><strong><a href="https://github.com/google-research/flood-forecasting">Google Global Flood Forecasting v2</a> (<a href="https://egusphere.copernicus.org/preprints/2026/egusphere-2026-2283/">Cohen et al., 2026 <em>preprint</em></a>)</strong>: Rather than providing a completely independent catchment dataset, the <a href="https://github.com/google-research/flood-forecasting">Google Hydrology repository</a> builds on Caravan for streamflow observations and static catchment attributes, and Caravan MultiMet for historical meteorological inputs and weather forecasts, including ECMWF IFS HRES and GraphCast products. The repository includes model architectures, training and evaluation pipelines, example configurations, and tools for delineating new catchments and extracting HydroATLAS attributes. The paper also links to a <a href="https://doi.org/10.5281/zenodo.19676842">Zenodo model data release</a>.</p>
  </li>
</ul>

<h2 id="conclusions">Conclusions</h2>

<p>A wide range of publicly available datasets support rainfall–runoff modelling, with datasets such as CAMELS-GB and Caravan making it much easier to train models across many catchments. However, the source observations are fragmented across different providers, resolutions and licenses. Open data-processing pipelines allowing datasets to be extended or reproduced may be just as valuable as the source datasets themselves.</p>]]></content><author><name>Tom Kelly</name></author><category term="hydrology" /><category term="rainfall–runoff modelling" /><category term="ai" /><summary type="html"><![CDATA[What data do rainfall–runoff models need?]]></summary></entry><entry><title type="html">Intro to net based rainfall-runoff models</title><link href="https://ctk21.github.io/2026/11/13/intro-to-net-rainfall-runoff/" rel="alternate" type="text/html" title="Intro to net based rainfall-runoff models" /><published>2026-11-13T00:00:00+00:00</published><updated>2026-11-13T00:00:00+00:00</updated><id>https://ctk21.github.io/2026/11/13/intro-to-net-rainfall-runoff</id><content type="html" xml:base="https://ctk21.github.io/2026/11/13/intro-to-net-rainfall-runoff/"><![CDATA[<p><em>I wanted to understand net rainfall runoff models. Here I attempt a survey of some of them. This post draws from a collection of published work by others, all mistakes are my own.</em></p>

<p>In a previous <a href="/2026/11/12/intro-to-gr4j/">post</a> we looked at GR4J as a low parameter ‘lumped conceptual model’ for rainfall-runoff. Here we will look at using neural networks for rainfall-runoff modelling.</p>

<h2 id="why-use-nets-for-rainfall-runoff-models">Why use nets for rainfall-runoff models?</h2>

<p>Rainfall-runoff models use meteorological data to predict river flow over time. They must account for evaporation dynamics, catchment moisture and delays as water moves through the catchment.</p>

<p>Net based rainfall-runoff models handle the relationship and dynamics by using a trained neural network (often with recurrent state as an LSTM).</p>

<p>By using a net we can hope to:</p>
<ul>
  <li>learn how catchment characteristics and weather patterns shape river flow</li>
  <li>create models that can work across catchments</li>
  <li>make more accurate linkages between rainfall and river flows.</li>
</ul>

<h2 id="what-we-will-look-at-here">What we will look at here</h2>

<p>In this post we will focus on the thread of work that built up to Google’s FloodHub:</p>
<ul>
  <li><strong><a href="https://arxiv.org/abs/1907.08456">Kratzert et al. (2019)</a></strong>: demonstrates an LSTM trained across 531 US catchments can outperform a traditional hydrological model calibrated separately for individual basins.</li>
  <li><strong><a href="https://doi.org/10.1038/s41586-024-07145-1">Nearing et al. (2024)</a></strong>: investigates whether a model trained on data from 5680 gauges worldwide can deliver reliable forecasts of extreme river flooding in ungauged catchments. That is: can it generalise, used with weather forecasts can it predict extremes and how does it compare to <a href="https://global-flood.emergency.copernicus.eu/">Copernicus GloFAS v4</a>.</li>
  <li><strong><a href="https://egusphere.copernicus.org/preprints/2026/egusphere-2026-2283/">Google Global Flood Forecasting Model Version 2</a></strong>: documents the model behind Google FloodHub (as at time of writing). Incorporates GraphCast weather forecasts, uses <a href="https://doi.org/10.5194/hess-29-6221-2025">ME-LSTM</a> architecture and enlarged training data.</li>
</ul>

<p>There are other net rainfall-runoff models out there, for example (but not exhaustively):</p>
<ul>
  <li><strong><a href="https://doi.org/10.1029/2022WR032404">Feng et al. (2022)</a></strong>: combines a neural network with the <a href="https://en.wikipedia.org/wiki/HBV_hydrology_model">HBV hydrologic model</a> which provides some parameter explainability</li>
  <li><strong><a href="https://doi.org/10.1038/s41598-024-62127-7">Li et al. (2024)</a></strong>: combines LSTM and attention mechanism for rainfall-runoff models.</li>
  <li><strong><a href="https://proceedings.mlr.press/v139/hoedt21a.html">Hoedt et al. (2021)</a></strong>: introduces mass conserving LSTM for use in physically constrained systems with hydrology as a use case.</li>
</ul>

<h2 id="from-individual-catchments-to-regional-models">From individual catchments to regional models</h2>

<p><a href="https://arxiv.org/abs/1907.08456">Kratzert et al. (2019)</a> describe how a single regional model using an LSTM could be trained across many catchments displaying better performance than earlier regional multi-basin models. It even outperformed traditional hydrological models calibrated individually for each catchment. They also introduce an Entity-Aware LSTM variant that learns representations of catchment similarities.</p>

<p>The architecture, inputs and outputs are:</p>
<figure class="article-image">
  <img src="/assets/images/2026-11-13-intro-to-net-rainfall-runoff/Kratzert_Rainfall_Runoff_Model_Architecture.png" alt="Kratzert et al. (2019) LSTM with catchment variables" width="700" />
  
    <figcaption>Kratzert et al. (2019) LSTM with catchment variables.</figcaption>
  
</figure>

<p>The dataset used had daily observations from 531 US catchments in the CAMELS dataset, with training covering 1999–2008 and evaluation covering 1989–1999. Observed river discharge was the prediction target.</p>

<p>This dataset included:</p>
<ul>
  <li><strong>Meteorological inputs (5):</strong> daily precipitation, minimum and maximum air temperature, shortwave solar radiation and vapour pressure.</li>
  <li><strong>Static catchment attributes (27)</strong>: includes climate characteristics (mean precipitation, aridity and seasonality), vegetation and land cover, soil characteristics (porosity, hydraulic conductivity, depth and texture), geological permeability and topographical characteristics (such as elevation and slope).</li>
</ul>

<p>A single LSTM was trained jointly across all catchments using 270-day input sequences. MSE and basin-normalised squared-error (NSE*) losses were examined, with the latter preventing larger or wetter catchments from dominating training.</p>

<p>This experiment evaluates generalisation across time within the training catchments, whereas later work explicitly evaluates spatial generalisation to catchments whose discharge records were withheld from training.</p>

<h2 id="predicting-extreme-events-in-ungauged-catchments-and-usage-for-flood-forecasts">Predicting extreme events in ungauged catchments and usage for flood forecasts</h2>

<p><strong><a href="https://doi.org/10.1038/s41586-024-07145-1">Nearing et al. (2024)</a></strong>
builds on regional LSTM rainfall–runoff models, extending the approach to global-scale river flow forecasting in ungauged catchments, with particular emphasis on extreme flood events. This work aims to produce a model that can transfer to unseen catchments. It also evaluates the model when used with forecast data to predict extreme events.</p>

<p>The architecture for the LSTM network in this model (<em>reproduced from <a href="https://www.nature.com/articles/s41586-024-07145-1/figures/10">Extended Data Figure 4</a></em>) is:</p>
<figure class="article-image">
  <img src="/assets/images/2026-11-13-intro-to-net-rainfall-runoff/nature_global_prediction_of_extreme_floods_in_ungaged_watersheds.png" alt="Nearing et al. (2024) LSTM-encoder + LSTM-decoder architecture" width="700" />
  
    <figcaption>Nearing et al. (2024) LSTM-encoder + LSTM-decoder architecture.</figcaption>
  
</figure>

<p>Unlike the earlier LSTM rainfall–runoff models, which simulate discharge from historical meteorological observations, the encoder–decoder architecture separates the estimation of historical catchment state from the prediction of future discharge. The encoder processes 365 days of historical meteorology, transferring its learned hidden and cell states to a decoder that uses forecast meteorology to predict discharge up to seven days ahead.</p>

<p>The study dataset comprised daily streamflow observations from 5,680 catchments globally, representing approximately 152,000 catchment-years of records. Historical reanalysis covers 1984–2021 and forecast-based evaluation covers 2014–2021, with differing availability across sources and locations.</p>

<p>This dataset included:</p>
<ul>
  <li><strong>Historical meteorological inputs:</strong> daily precipitation, air temperature, shortwave and longwave radiation, snowfall and surface pressure, primarily from <a href="https://www.ecmwf.int/en/era5-land">ECMWF ERA5-Land</a> reanalysis, supplemented with precipitation estimates from <a href="https://www.cpc.ncep.noaa.gov/products/Precip_Monitoring/gl_obs.shtml">NOAA CPC</a> and <a href="https://gpm.nasa.gov/data/imerg">NASA IMERG</a>.</li>
  <li><strong>Forecast meteorological inputs:</strong> precipitation, temperature, radiation, snowfall and surface pressure from <a href="https://www.ecmwf.int/en/forecasts/datasets/ifs-medium-range-control-forecast-formerly-hres-and-analysis-data-15-days-set-i">ECMWF IFS HRES</a> weather forecasts, used to predict river discharge up to 7 days ahead.</li>
  <li><strong>Static catchment attributes:</strong> geological, geophysical and anthropogenic characteristics from <a href="https://www.hydrosheds.org/hydroatlas">HydroATLAS</a>, including climate (precipitation, temperature and snow fraction), topography (elevation and drainage area), soils, land cover and human influences (such as nighttime lights).</li>
</ul>

<p>The model predicts the parameters of an asymmetric Laplacian probability distribution for daily catchment-area-normalised river discharge, rather than a single flow value. Observed daily discharge is the training target, with the predicted distributions used to estimate river flow and identify exceedances of flood return-period thresholds.</p>

<p>A shared encoder–decoder LSTM architecture was trained jointly across 5,680 catchments using 365 days of historical meteorological inputs and up to 7 days of weather forecasts. Training used V100 GPUs and took of order 10h with validation.</p>

<p>Cross-validation was used to show that useful predictions of extreme river flows can be given at previously unseen locations. Against Copernicus GloFAS v4, the AI model achieved significantly better flood-event F1 scores and more reliable 1-, 2-, and 5-year event scores than GloFAS’s zero-day forecasts.</p>

<h2 id="google-flood-forecasting-v2-architecture-and-improvements">Google Flood Forecasting v2: architecture and improvements</h2>

<p><a href="https://egusphere.copernicus.org/preprints/2026/egusphere-2026-2283/">Cohen et al. (2026)</a> describe v2 of Google’s global flood forecasting model, which introduces a Mean Embedding LSTM architecture (see <a href="https://doi.org/10.5194/hess-29-6221-2025">Gauch et al 2025</a>), incorporates additional meteorological forecast products and expands the training dataset. The updated system improves forecast reliability and extends useful prediction lead times, through better handling of missing inputs and discontinuities between historical and forecast meteorology.</p>

<blockquote>
  <p>The ME-LSTM then employs two LSTM layers arranged in a stack that run over the full time sequence (hindcast + forecast), eliminating the handoff discontinuity. The first layer processes a sequence of aggregated embeddings derived from hindcast data and runs over the full sequence, i.e., hindcast (spinup) + forecast sequence length. The second LSTM layer predicts
streamflow. It receives two inputs at every time step: the aggregated forecast embeddings and the hidden state output from the first LSTM layer.</p>
</blockquote>

<p>My interpretation <em>(85% confidence)</em> is that we can visualise this as:</p>
<figure class="article-image">
  <img src="/assets/images/2026-11-13-intro-to-net-rainfall-runoff/egusphere_google_flood_v2_architecture.png" alt="Conceptual interpretation of the ME-LSTM architecture for the Google global flood forecasting model v2" width="700" />
  
    <figcaption>Conceptual interpretation of the ME-LSTM architecturefor the Google global flood forecasting model v2. Embedding details and some connections are omitted for clarity.</figcaption>
  
</figure>

<p>Multiple sources of data that might not overlap can be consumed in the v2 model; which adds more geographic locations, data sources and time history. Training uses daily streamflow observations from Caravan, GRDC and BANDAS, alongside meteorological inputs from ECMWF HRES, GraphCast, CPC and IMERG, covering 1980–2024. To exploit historical data where forecast archives are unavailable, feature unioning substitutes ERA5-Land reanalysis for missing HRES/GraphCast inputs, while the ME-LSTM’s masked embeddings allow meteorological products with incomplete or non-overlapping coverage to contribute to training.</p>

<p>The supervision target is observed daily mean streamflow at the catchment outlet for the last 7 forecast days. The outputs are probabilistic predictions
trained with a Continuous Mixture of Asymmetric Laplacians (CMAL) likelihood loss rather than directly minimising squared error.</p>

<p>Across 1,223 test basins, v2 improves streamflow prediction accuracy over v1 and the GloFAS/GEOGLOWS benchmarks, matching or exceeding v1 nowcast NSE at lead times of up to six days in gauged basins and one day in ungauged basins.</p>

<h2 id="conclusion">Conclusion</h2>

<p>Neural rainfall-runoff models can generalise to ungauged catchments. Combined with weather forecasts, they can predict distributions of future river flow and provide advance warning of extreme floods in live operational systems such as <a href="https://sites.research.google/floods/">Google FloodHub</a>.</p>

<h2 id="references">References</h2>

<ul>
  <li><a href="https://sites.research.google/floods/">Google FloodHub</a></li>
  <li><a href="https://global-flood.emergency.copernicus.eu/">Copernicus GloFAS</a></li>
  <li><a href="https://doi.org/10.1038/s41586-024-07145-1">Global prediction of extreme floods in ungauged watersheds, Nature, Apr 2024, Nearing et al.</a></li>
  <li><a href="https://doi.org/10.5194/hess-29-6221-2025">LSTM-ME paper</a></li>
  <li><a href="https://egusphere.copernicus.org/preprints/2026/egusphere-2026-2283/">Google Global Flood Forecasting Model Version 2 paper</a></li>
  <li><a href="https://research.google/blog/the-next-chapter-in-flood-resilience-open-sourcing-googles-hydrology-framework/">Google Research Blog post on open sourcing hydrology framework</a></li>
  <li><a href="https://github.com/google-research/flood-forecasting">Google Flood Forecasting code</a></li>
  <li><a href="https://sites.research.google/gr/floodforecasting/resources/">Google Flood Forecasting resources</a></li>
  <li><a href="https://github.com/kratzert/Caravan">Caravan dataset</a></li>
  <li><a href="https://www.hydrosheds.org/hydroatlas">HydroATLAS</a></li>
</ul>]]></content><author><name>Tom Kelly</name></author><category term="hydrology" /><category term="rainfall–runoff modelling" /><category term="ai" /><summary type="html"><![CDATA[Intro to net based rainfall-runoff models.]]></summary></entry><entry><title type="html">What are the GR4J and GR6J hydrology models</title><link href="https://ctk21.github.io/2026/11/12/intro-to-gr4j/" rel="alternate" type="text/html" title="What are the GR4J and GR6J hydrology models" /><published>2026-11-12T00:00:00+00:00</published><updated>2026-11-12T00:00:00+00:00</updated><id>https://ctk21.github.io/2026/11/12/intro-to-gr4j</id><content type="html" xml:base="https://ctk21.github.io/2026/11/12/intro-to-gr4j/"><![CDATA[<p><em>I wanted to understand the GR4J and GR6J rainfall runoff models. A good way to build an understanding is to try and explain it to somebody else! This post draws from a collection of published work by others, all mistakes are my own.</em></p>

<p><a href="https://en.wikipedia.org/wiki/Hydrology">Hydrology</a> is the study of the movement, distribution and storage of water in the environment. Hydrology models can help answer questions such as:</p>
<ul>
  <li>how likely is it to have too much water coming through this river (i.e. flooding)?</li>
  <li>how likely is it to have too little water coming through this river (i.e. drought)?</li>
  <li>which rivers and catchments are able to deal with more extreme weather (i.e. are there policy interventions that can help avoid extreme high or low events)?</li>
</ul>

<h2 id="why-do-we-need-rainfall-runoff-models">Why do we need rainfall-runoff models?</h2>

<p>Take a river catchment receiving rainfall. If we know how much rain fell, how do we relate that to the amount of water which reaches the river and when?</p>

<p>The relationship isn’t trivial:</p>
<ul>
  <li>Some rainfall evaporates or is transpired by vegetation.</li>
  <li>Some enters the soil and remains stored there.</li>
  <li>Some reaches the river rapidly, while some might discharge weeks later.</li>
</ul>

<p>Rainfall-runoff models try to relate the aggregate behaviour of these processes.</p>

<p>The modelling approach taken by <a href="https://doi.org/10.1016/S0022-1694(03)00225-7">GR4J</a> is to represent an entire catchment using a small number of interconnected mathematical reservoirs. This is called a <em>lumped conceptual model</em> and it avoids explicitly simulating all the physical processes at each spatial location that make up an entire catchment.</p>

<h2 id="the-gr4j-model-architecture">The GR4J model architecture</h2>

<p>The GR4J model has several components:</p>
<ul>
  <li><em>A production store.</em> This represents the catchment’s ability to retain water. Incoming rainfall increases the store, while evaporation and percolation reduce its water content.</li>
  <li><em>Percolation and effective rainfall.</em> Some stored water drains from the production store. This combines with rainfall that bypasses storage to produce the water available for routing.</li>
  <li><em>Two unit hydrographs.</em> These distribute the water over time, accounting for the delay between rainfall and river response. GR4J sends 90% of effective rainfall down one route and 10% down another.</li>
  <li><em>A routing store.</em> This introduces additional delay and nonlinear storage behaviour before water reaches the river.</li>
  <li><em>Groundwater exchange.</em> GR4J can add or remove water through an exchange term, allowing it to represent catchments where groundwater moves across the modelled catchment boundary.</li>
</ul>

<p>We can visualise how these components are linked together in the model as shown:</p>

<figure class="article-image">
  <img src="/assets/images/2026-11-12-gr4j-gr6j-models/GR4J_Model_Figure.png" alt="GR4J model architecture" width="800" />
  
    <figcaption>GR4J model architecture.</figcaption>
  
</figure>

<p>When using a GR4J model, it has a daily time series of inputs:</p>
<ul>
  <li>daily precipitation <strong>P</strong></li>
  <li>potential evapotranspiration <strong>E</strong></li>
</ul>

<p>It is then iterated daily to produce the main output:</p>
<ul>
  <li>daily river discharge <strong>Q</strong></li>
</ul>

<p>Internally there is a time series of model states:</p>
<ul>
  <li>water content in the production store <strong>S</strong></li>
  <li>water content in the routing store <strong>R</strong></li>
</ul>

<h2 id="the-gr4j-parameters">The GR4J parameters</h2>

<p>The GR4J model has 4 parameters:</p>
<ul>
  <li><strong>x1</strong> production store capacity</li>
  <li><strong>x2</strong> groundwater exchange coefficient</li>
  <li><strong>x3</strong> routing store reference capacity</li>
  <li><strong>x4</strong> unit hydrograph time base</li>
</ul>

<p>As these parameters are varied, the model represents different responses from the meteorological inputs to the daily river discharge.</p>

<p>There is a <a href="https://reflector.vtti.ad.vt.edu/cran/web/packages/airGRteaching/vignettes/v00_teaching_hydrology.html">tutorial here</a> that allows you to build an intuition of how the model responds to these parameters which makes use of the <a href="https://hydrogr.github.io/airGR/">airGR R package</a>.</p>

<h2 id="calibrating-the-gr4j-parameters">Calibrating the GR4J parameters</h2>

<p>One common way to calibrate the parameters <em>for a given catchment</em> is:</p>
<ul>
  <li>take a time series for say ten years of observed daily rainfall, potential evapotranspiration and river discharge</li>
  <li>perform an optimisation to find the parameters <strong>x1, …, x4</strong> that maximise the <a href="https://en.wikipedia.org/wiki/Nash%E2%80%93Sutcliffe_model_efficiency_coefficient">Nash-Sutcliffe Efficiency</a></li>
</ul>

<p>Notice this calibration procedure gives you parameters only for a catchment where you have historical time series data. There are techniques for estimating model parameters for ungauged catchments, often called regionalisation, but these introduce another modelling problem. There is also the question of how to initialise the model’s internal state variables; typically, the model is run through a warm-up period before calibration or evaluation.</p>

<p>The <a href="https://hydrogr.github.io/airGR/">airGR (R)</a> is one way to calibrate the parameters of a GR4J model. Other packages also exist, for example: <a href="https://github.com/OuyangWenyu/hydromodel">hydromodel (python)</a> and <a href="https://github.com/Najim33/GRsuite">GRsuite (python)</a>.</p>

<h2 id="the-gr6j-parameter-additions">The GR6J parameter additions</h2>

<p><a href="https://doi.org/10.1016/j.jhydrol.2011.09.034">GR6J</a> extends GR4J, adding:</p>
<ul>
  <li><em>More flexible groundwater exchange.</em> This allows the model to better represent catchments that gain or lose water depending on hydrological conditions.</li>
  <li><em>Adding an exponential routing reservoir.</em> This is designed to improve the representation of low flows.</li>
</ul>

<p>The two parameters added affecting these additions:</p>
<ul>
  <li><strong>x5</strong> Groundwater exchange threshold. Modifies the existing groundwater exchange mechanism to allow the direction of water transfer to change as the routing store fills or empties.</li>
  <li><strong>x6</strong> Exponential reservoir coefficient. Introduces a third conceptual reservoir, operating in parallel with the original routing reservoir.</li>
</ul>

<h2 id="example-usage-of-gr4j--gr6j-models">Example usage of GR4J / GR6J models</h2>

<p>The <a href="https://hydoutuk.net/">UK Hydrological Outlook</a> produces probabilistic forecasts of river flows across the UK, from one to twelve months ahead. These use GR6J models calibrated to individual catchments, driven by historical climate sequences or meteorological forecasts. Interestingly, the service used GR4J until September 2023 before switching to GR6J, partly reflecting the latter’s improved representation of low flows. The methodology page also discusses the relatively modest changes in forecast skill resulting from this switch.</p>

<p>The models are also used for longer-term water resource planning. For example, <a href="https://www.anglianwater.co.uk/siteassets/household/corporate/wrmp24/wrmp24-supply-forecast.pdf">Anglian Water’s 2024 Water Resources Management Plan</a> uses calibrated GR6J rainfall–runoff models to simulate river flows under different climate and drought scenarios. These simulations contribute to assessing the reliability of future water supplies and the need for additional water resource infrastructure.</p>

<h2 id="conclusion">Conclusion</h2>

<p>What I find interesting about GR4J and GR6J is how much behaviour can be represented using a handful of parameters and relatively simple mathematical structures. They provide useful baseline models against which to evaluate more complex approaches, while raising interesting questions about how well model parameters and internal states can be inferred from observational data.</p>

<h2 id="references">References</h2>

<ul>
  <li><a href="https://doi.org/10.1016/S0022-1694%2803%2900225-7">GR4J paper</a></li>
  <li><a href="https://doi.org/10.1016/j.jhydrol.2011.09.034">GR6J paper</a></li>
  <li>The GR4J architecture diagram here evolved from figure 3 of <a href="https://www.frontiersin.org/journals/earth-science/articles/10.3389/feart.2021.759534/full">this paper</a>, which is consistent with Fig 1. of the GR4J paper.</li>
  <li><a href="https://hydrogr.github.io/airGR/">airGR R package</a></li>
  <li><a href="https://hydoutuk.net/">UK Hydrological Outlook</a></li>
</ul>]]></content><author><name>Tom Kelly</name></author><category term="hydrology" /><category term="rainfall–runoff modelling" /><summary type="html"><![CDATA[What are the GR4J and GR6J hydrology models along with an example of their operational usage.]]></summary></entry><entry><title type="html">Using AI to Convert Drawings Into Printable Models</title><link href="https://ctk21.github.io/2026/09/04/using-ai-to-convert-drawings-into-printable-models/" rel="alternate" type="text/html" title="Using AI to Convert Drawings Into Printable Models" /><published>2026-09-04T00:00:00+00:00</published><updated>2026-09-04T00:00:00+00:00</updated><id>https://ctk21.github.io/2026/09/04/using-ai-to-convert-drawings-into-printable-models</id><content type="html" xml:base="https://ctk21.github.io/2026/09/04/using-ai-to-convert-drawings-into-printable-models/"><![CDATA[<p>I wanted to visualise a proposed sliding-door section as a physical scale model, mainly so we could see the sightlines and proportions properly. All I had was a paper drawing showing the horizontal and vertical sections from the door manufacturer, plus a Bambu Lab A1 printer.</p>

<figure class="article-image">
  <img src="/assets/images/2026-09-04-using-ai-to-convert-drawings-into-printable-models/door_section.jpg" alt="Photograph of the original sliding-door section drawing" width="350" />
  
    <figcaption>The original door section drawing.</figcaption>
  
</figure>

<p>I gave ChatGPT a photo of the drawing and asked how I could turn it into a 3D model using free CAD software. Instead, it suggested generating the STL directly.</p>

<p>We first worked on the horizontal cross-section to extrude. The drawing contained several section types and break lines, and ChatGPT was not especially good at interpreting them. I spent about 20–30 minutes correcting the geometry. Once I described changes precisely and in small steps, though, progress was quick, and I had a STL model that could be printed.</p>

<figure class="article-image">
  <img src="/assets/images/2026-09-04-using-ai-to-convert-drawings-into-printable-models/triple_track_section_1_25_v5.svg" alt="Intermediate reconstructed sliding-door cross-section before extrusion" width="350" />
  
    <figcaption>The reconstructed cross-section before extrusion.</figcaption>
  
</figure>

<figure class="article-image">
  <img src="/assets/images/2026-09-04-using-ai-to-convert-drawings-into-printable-models/extruded_door.png" alt="Printable door model" width="350" />
  
    <figcaption>The printable door model.</figcaption>
  
</figure>

<p>That worked well enough that I tried something harder: the plan and section drawings for the surrounding brickwork, including windows, doors and overhangs.</p>

<p>The first result was plausible but wrong in several places: offsets were inverted or ignored, and explaining those errors by referring back to the drawings was slow. The breakthrough was to stop thinking in terms of “plan plus sections” and instead describe a ground-floor footprint with vertical extrusions. Once the overall geometry was right, small, precise iterations worked well.</p>

<p>ChatGPT also split the model into pieces that would fit on the A1’s build plate and added keyed joints between them.</p>

<p>I then asked it to reproduce the brickwork. Initially this was slow going with various bricks not aligning between planes or floating across openings. However, when I noticed the STL was being generated by a small Python program using <a href="https://trimesh.org/">trimesh</a>, I decided to alter my approach. Rather than repeatedly pointing out bad geometry, regenerating the STL and checking it, I started asking ChatGPT to inspect the code for the likely cause of each problem and propose a fix.</p>

<p>That was much faster.</p>

<p>More importantly, I now had a <em>program</em> for generating the brickwork. Changing from stretcher bond to soldier courses, or trying other variants, became a parameter change rather than a remodel.</p>

<figure class="article-image">
  <img src="/assets/images/2026-09-04-using-ai-to-convert-drawings-into-printable-models/pre_print_bricks.png" alt="3D model in printable sections" width="400" />
  
    <figcaption>The model in printable sections.</figcaption>
  
</figure>

<figure class="article-image">
  <img src="/assets/images/2026-09-04-using-ai-to-convert-drawings-into-printable-models/final_print.jpg" alt="Finished 3D-printed model" width="400" />
  
    <figcaption>The finished print.</figcaption>
  
</figure>

<p>The 3D print was the goal, and getting from drawings to the STL I wanted was great (without access to professional CAD tools). The surprise was ending up with generative code derived from the architectural drawings, which made it easy to produce and experiment with variants.</p>]]></content><author><name>Tom Kelly</name></author><category term="ai" /><category term="cad" /><category term="3d-printing" /><category term="engineering" /><summary type="html"><![CDATA[How I used ChatGPT, simple code, and a Bambu Lab A1 to turn architectural drawings into printable models.]]></summary></entry></feed>