# Development of Open-Source Tools for Event-Based Hydrological Modelling Using GIS and Python
## 2 Materials and Methods
### Integration with Hydrological Models  
To develop the tools presented in this paper, we simulated some event-based (rainfall-runoff) hydrological processes based on the mass conservation law, with infiltration/abstraction and flow routing as the main processes involved. Although specific details depend on the selected theories, such simulations require gathering and processing spatial information related to the following:  
* Land uses, soil physical properties and soil moisture influencing infiltration/abstractions generation. * Topographical information for delineating catchments and determining the transient time and flow routing downstream. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Steps** & **Inputs** & **Outputs** & **Tools** \\ \hline Spatial homogenisation & Sand, silt, clay, soil classes & & QGIS (minimum bounding geometry, buffer and raster \\ 3. & and bulk density & Sand, silt, clay, soil classes & geometry, buffer and raster \\ \multirow{2}{*}{Resampling\_SOILGRIDS} & SOILGRIDS rasters and & and bulk density & layer properties), GDAL (warp), GRASS (r.resample) \\ \multirow{2}{*}{Flow pathways} & \multirow{2}{*}{Stream\_segments (vector), start point and end point} & \multirow{2}{*}{Shortest\_path} & \multirow{2}{*}{QGIS (shortest path point} \\  & & (vector line layer) & to point) \\ \multirow{2}{*}{Catchment characterisation} & \multirow{2}{*}{Model:} & slope (raster), Land\_use & Catchment\_characteristics & QGIS (zonal statistics, field \\ \multirow{2}{*}{5. Catchment\_ characterisation} & \multirow{2}{*}{(raster) and shortest path} & \multirow{2}{*}{(polygon vector)} & \multirow{2}{*}{calculator)} \\  & & length (vector) & \\ \multirow{2}{*}{Exchangeable files} & \multirow{2}{*}{Catchment, land use, elevation, slope, sand, silt, clay, soil class and bulk density (raster layers)} & \multirow{2}{*}{Catchment, land use, sand, silt, clay, soil class and bulk density (.asc file)} \\ \hline \hline \end{tabular}
\end{table} 
Table 1: _Cont._  
Figure 1: Graphical representation of the data collection process and sources. Our general approach follows two consecutive steps: (1) collecting and pre-processing spatial information; and (2) transforming it to deliver exchangeable information to feed hydrological models. The QGIS routines delivered the catchment's specific information through either nD matrix-type (spatial information such as land uses, soil physical properties or soil moisture) or 1D array (mainstream length, slope, entire area and area by land uses) formats in plain text files. From the QGIS outputs we obtained the information required for parametrising the models we present in this section. For the hydrological simulations we present in this manuscript, we assume the rainfall-runoff events within a catchment have to satisfy the mass conservation law expressed as Equation (1):  
\[\frac{dS}{dt}=I(t)-O(t) \tag{1}\]  
where the difference between inputs (\(I(t)\)) and outputs (\(O(t)\)) produces the system internal variations \(dS/dt\). However, the variables involved in rainfall-runoff processes depend on the time-scale we consider. When considering short-latency events, the inputs and outputs are precipitation and water discharge at the catchment's downstream end point and the soil moisture variation represents the system internal variation. For the specific case, we present in this manuscript focused on event-based hydrology, Equation (1) can be described as follows (Equations (2) and (3)):  
\[\frac{dS}{dt}=P(t)-R(t)-ET(t) \tag{2}\]  
\[P(t)=Inf(t)+R(t) \tag{3}\]  
where \(S\) [L] is the soil water storage, \(P(t)\) [L] is the precipitation at time t, \(Inf(t)\) [L] is the infiltration at time t, \(R(t)\) [L] is the runoff at time t, and \(ET(t)\) [L] is the evapotranspiration at time t. In this manuscript, we focus on short-term storm events with a duration of less than one hour. In this context, evapotranspiration can be neglected due to its expected small magnitude compared to the precipitation volumes.