This is a demo tool developped in Python mainly to illustate basic notions in frequential analysis in Hydrology, with the example of annual maximum discharges, denoted QY. It involves matplotlib widgets implementation (sliders) of toolbar customisation.
The authors share this code because it might be helpful to others although it can (and will) be improved. Please feel free to send feedback.
Note : the icons do not appear on the toolbar for Linux users and the "menu" button of the toolbar does not work , but it only displays what the other tools do...
Poulard Christine et Leblois Etienne, Inrae, Unité de recherche Riverly
about Hydrology :
This demo tool was initially designed for a first contact with frequential analysis in hydrology, Master level (french Engineering School). Let us consider the maximal flood discharge of each year, QY (max in a calendar year or, better, hydrological year), and let us assume this variable follows a known Gumbel distribution (the assumption is correct for return period under a given thresholk, largely ex...).
Initial figure : sample of 10 QY The sample corresponding to 10 years of observation is represented as a time-series and with plotting positions in another graph with respect to the return period, denoted T, where a Gumbel distribution fitted on the sample is compared to the "theoretical" Gumbel one. to estimate the "right" Gumbel distribution parameters. Of course, withe only a few years of obervation the QY(T) relationship estimated by fitting Gumbel parameters has no reason to be very good ; the Confidence Interval is very thick at first.
🛠 tools added in the TOOLBAR
added TOOLBAR icons :
⏹icon MENU : a very brief summary of the functions of the added tools
⏹icon "+ 10" : add 10 new obs, see how the estimated Gumbel graph evolves (the estimated Gumbel should be closer to the theoretical one). Only the 10 highest values are represented with a marker "X" in the graph, to compare with the sample plotted uing plotting positions
⏹icon "NEW" : starts with a new 10-year observation series Check with several tries the variability of the samples and resulting estimated QY(T). However, the plotting position remains identical with any 10-year sample (it is obvious, they only depend on the RANK of the observations, but this code illustrates this.
⏹icon "write QT" : write in Python console current numerical values of QY samples and the related T (plotted positions, Gumbel estimates), as well as fresquencies
⏹icon frequency <=> return period : toggles the x axis of the 2nd graph between frequency and return period. Frequency is interesting to better understant plotting position theory.
⏹icon C.I. : shows/hide Confidence Intervals for Estimated Gumbel distribution.
🛠 slider widgets
Sliders allow to modify a and b parameters of the plotting position formula. Defaults value are Chegodayev's parameters.
Differences between this code and a real-life hydrological analysis...
Annual Maximum are interesting as a first contact with flood frequency analyses, but for real studies "Peak-Over-Threshold" sampling is recommanded. Also, as stated in the introduction, the Gumbel distribution is widely used in hydrology, but it is not valid for extreme floods. This is why in the graphs the confidence intervals do not go further than T=100 years and the x axis in return period is limited in range, eventhough highest observed values are out of the graph. To see them all, toggle to "x axis as frequency" (and back...).
Maybe a fork with POT Sample generation (with fitted exponential law) can be proposed. Other tools are developped to sample and process real data (as time series) with both annual maxima and POT methods. The use of pandas for coding has the advantage of yielding very readable code, but "default" arguments of resample methods are sometimes questionable ; a tool should be on line soon, with a control of missing values (to validate sampled peak or aggregation for multiduration analysis).
By adding the definition of a discharge-frequency table, for one or more land-uses, an spinoff named Sample2Gumbal2Damages computes the damages per land use and per event, as another chronological time-series, and compares the observed damages per land-use and total per year on average to the Annual Average Damage estimated from the damage-frequency curve.
Renard Benjamin, Probabilités et Statistiques appliquées à l'Hydrologie, 90 p (in french) Inrae UR HHLY - Hydrologie-Hydraulique (now at Inrae Riverly)
Poulard Christine et Leblois Etienne, Inrae, Unité de recherche Riverly Dimensionnement d’un aménagement de gestion des inondations, Cours de Sciences de l’eau , 19 p. (in French)
about Python : matplotlib as a robust visualization tool, using plot, scatter, stem...
Features that can be interesting :