# Development of Open-Source Tools for Event-Based Hydrological Modelling Using GIS and Python
## 1 Introduction  
Hydrological models play a key role in the proper management of water resources [1, 2, 3]. From the evaluation of management strategies [4, 5, 6] to the assessment and allocation of water resources [7, 8] through the optimization of networks [9, 10] or the assessment of the impact of climate change on water resources [11, 12], hydrological models are essential across a wide range of water-related topics.  
Hydrological models have evolved from simple tools with a few parameters to complex models requiring extensive geographical and meteorological information. The development of Geographical Information Systems (GIS) coupled with improvements in computational capabilities marked a step forward in hydrological modelling by enabling large-scale distributed simulations of time-dependent processes within the catchment. In parallel, the growing availability of remote sensing products has further enhanced the use of GIS in hydrological modelling, providing significant advantages over traditional on-site measurements by covering large areas with high spatio-temporal resolution, facilitating the simulation of dynamic hydrological phenomena with frequent updates. Scientists have largely used satellite images at different hydrological planes, for example, to estimate soil water content [13, 14, 15, 16, 17], evapotranspiration [18, 19, 20, 21], streamflow [22, 23, 24, 25, 26, 27] or precipitation [28, 29, 30, 31, 32, 33].  
Hydrologists have also exploited GIS to develop tools for complex hydrological simulations (see for example [25, 34, 35]) integrating models of different phenomena (oftenrainfall generation, infiltration/runoff and surface runoff flooding) into comprehensive packages with diverse functionalities (see for example SWAT or SWMM models). Most of these models utilise geographical information by either discretising the catchment into cells or aggregating data into homogeneous units (lumped models). They incorporate mathematical theories for simulating the processes while requiring users to provide spatial information (land use, topography, soil moisture or soil physical properties), which is pre-processed prior to its incorporation into the models, along with the parameters required for the selected hydrological simulations.  
Such tools do not provide users with full access to the internal models and routines, limiting the ability to adjust the geographic information, mathematical formulations or model architecture. This may hinder the development of tailored applications and also limit the level of generality often sought by researchers. Hydrological models are complex and frequently require case-specific and tailored analysis to deliver accurate results, or even on many occasions to ensure the convergence of mathematical routines.  
In contrast to proprietary solutions, open-paradigm tools, such as QGIS and Python, offer the required flexibility and adaptability to overcome the previous limitations. Using these tools, tailored models and routines can be developed to perform highly-specific and complex hydrological analyses. In this work, we leverage these tools to provide a methodological framework for analysing event-based hydrological processes at the catchment scale. Building on this approach, the main objective of this paper is to present a methodology for coupling Python programming tools with spatial data generated from QGIS outputs to execute hydrological simulations. Since the aim of this manuscript is to demonstrate the applicability of the GIS\(-\)Python framework for spatial data processing, we will present several applications of the proposed framework to specific hydrological models using different pilot catchments within the Spanish Ebro River basin.