What is it?

An R Shiny app to interactively visualize flood forecasting data and model results.

Why was it developed?

A full-blown website is already used daily for the flood warning service: xgeo As it is open to the public and can slow down during periods of intense use. It also does not allow plotting multiple model results at once.

This R application was developed to complement xgeo and serve as a prototyping platform before new ideas are eventually implemented in xgeo.

How to run it?

After installing the shiny R package, you can run this application from anywhere with the following commands: library(shiny) runGitHub("NVE/Flood_forecasting") Note that the .RData files read by the app will probably be out-of-date. Our aim is to have them updated automatically every day.

For internal use at NVE, the app is updated every day at 8:15, 11:15, 13:15 and 20:15 by the shiny server.

Which features are implemented? How to use it?

Multi-model forecaster’s dashboard

Below is an annotated screenshot of the first tab, which is a multi-model forecaster’s dashboard:

Screenshot of the multi-model forecaster’s dashboard

Screenshot of the multi-model forecaster’s dashboard

1. Available tabs

The selected tab presents a multi-model and multi-station visualization using a dropdown selector. If you click on Multistasjon, you also get the option to select a group of stations by drawing rectangles or polygons.

The next set of tabs presents single-model and single-station plots of all the available variables (model input, model state and runoff).

The model results and metadata on the available stations (br23_HBV = “Y” and br9_Flomvarsling = “Y”) are then available in the next set of tabs.

Finally historical results such as calibration results, past performance and seasonal averages are available under Historisk.

The last set of tabs links back to specific pages of this website.

2. Station selection

The station selection on this tab is cumulative. You can select stations either by clicking in the dropdown menu, or directly on the map by clicking on the station markers. To delete selected stations, click on them in the dropdown selector and press delete.

The last station selected will always be highlighted by a pop-up on the map. You can also tick the show pop-ups button to show all selected stations. In this screenshot, the catchment boundaries are also selected. This is not the case by default and this selection causes the app to slow down significantly.

3. Quantitative map markers

  • Risk for flood

If M is the maximum value of the corrected HBV_UM during the forecast period and RL is the observed mean annual flood at this station, then:

Risk for flood = M / RL

  • Forecast uncertainty

If Diff is the maximum difference between the Hi90 and Lo90 estimates of HBV_UM during the forecast period and RL is the observed mean annual flood at this station, then:

Forecast uncertainty = Diff / RL

4. Choice of variable type

The variable are group in 3 types: inputs to the model (temperature, precipitation), state of the model (groundwater level, soil moisture, snow storage) and runoff which includes measured discharge and various type of model output (confidence intervals, ensemble results).

5. Choice of model-specific variables

Here you can choose, in a cumulative way, which model-specific variables you want to plot. Those selectors either change or become redundant when changing the variable type selector.

6. Past year results

Here you can plot 3 different types of HBV_UM results for last yeat:

HBV.UM.sim represents the uncorrected model results using forecast input data.

HBV.UM.korr represents the corrected model results using forecast input data.

HBV.UM.korr.med.obsMet represents the corrected model results using measured input data.

7. Return levels

You can select observed and simulated return levels for the mean annual flood, the 5 and 50-year return floods.

8. Interactive plots

The plots are interactive. Hover over the lines to read values of all variables at specific times. Explore the interactivity options at the uppe right of the plot. There are many different ways to interact with it.

Multi-model forecaster’s dashboard with polygon station selection

Below is an annotated screenshot of the second tab, which presents the option to draw polygons for selecting groups of stations:

Screenshot of the multi-model forecaster’s dashboard with polygon selection

Screenshot of the multi-model forecaster’s dashboard with polygon selection

1. Drawing tool box

You can select gorups of stations by drawing rectagles or polygons. You can draw as many shapes as you wish but clicking on a map marker will not create a single station selection (you need to draw a rectangle around it).

You can individually delete drawn polygons. For a quick way to delete many shapes at once, you can always press the refresh button.

2. Map markers

As in the first tab, you can switch between different quantitative map markers. The polygon selection will remain, allowing you for instance to select both the stations that are forecast to flood and those that have hight uncertainty.

Table tabs

Below is an annotated screenshot of one of the available table tabs, presenting as an excel spreadsheet the return level data:

Screenshot of the table tab for streamflow return levels

Screenshot of the table tab for streamflow return levels

1. Excel-like features

You can filter collumns like you would do with the excel filter. At the upper right, you can also search for specific terms in the whole table.

Contributing

Improving the documentation

This documentation website is a work-in-progress. It is build automatically by travis-ci from Rmd files located in the /report directory. An automatic report (also based on RStudio’s Rmarkdown) is being tested but is not updated everyday yet.

If you want to contribute to this documentation website, either send me your contribution in mardown format by email, do a formal pull request to this repository, or ask to be added as collaborator to this project.

Filing bugs or ideas for new/better features

If you find a bug, thanks for reporting! First press the refresh button and try again. If this solves your problem, the previous bug may have been cause by a specific clicking sequence. Try to remember the sequence (or better re-create it!) and file your issue there following the guidelines below:

One issue for one purpose. Don’t add more than one bug, feature request, documentation request, question, etc.. on to the same issue.

  • For a bug report, please add [bug] in the header and don’t forget to describe the environment (where, which clicking sequence…) of the bug as precisely as possible.

  • If you’ve a request of some kind, e.g., feature request or documentation request, it’d be much appreciated if you could add [Request] at the beginning of the title. This helps us to prioritise easily without having to go through the entire issue. Don’t forget to read our already listed ideas for further development before submitting new requests!

  • If you need support, e.g., installation issues or upgrade issues, please add [Support] at the beginning of the title. This helps us to easily identify the most common support issues, and provide solutions in a separate page.

  • If you have a general question, add [Question] at the beginning of the title.

  • If you’ve an issue that doesn’t fall into any of these categories, then it’d be helpful if you could add [Misc] to your title.

How to modify it or develop it further?

Please refer to the package documentation for the programming details of this app.

Ideas for further development

Forecaster’s dashboard

Plots of model runs from -20 to +9 days. It is also possible to view the last year of forecast data.

The metadata table should allow exporting groups of stations to the first tab. Station metadata comes directly from the NVEDATA package.

There could be more quantitative map marker options: temperature, precip… Probability of flooding take max(next 3days of probability “number of occurence in ensemble” for mean flood) as variable. risiko.rap there: Z:_grd

DDM model 24 hours: /hdata/drift/flood/H-VEPS02/simu_hbv_elev_24h//InputTimeSeries.txt

Modeller’s dashboard

Analysis of model performance / properties during the calibration period. - time series graphs, available time period, zoom functionality, tick on/off which models: - discharge: observations and all models - temperature and precipitation - Summary of model performance. There is the tricky question of how long of a time-interval to use. All perf indicators should use the same interval. 1 year is probably a good choice - NSE - KGE - Taylor diagram - Hit/miss/false alarm/correct reject table. If the timelapse is 1 year, the return level threshold should be discussed, 1 year return period being the maximum we could use.

Further ideas: Regional analysis of model runs Ouputs one plot per station of the model runs Should this include a map with polygon selection or should the group of stations only originate from tab 1?

Historical hindsight: pull out past interesting events for a specific station or group of stations

Not all the files have data for the same number of stations (120-145). Check how the station numbers are organized. Those files don’t include catchment properties, so we will have to agree on the data files for those properties. The observed flow and precip/temperature are included in all of those files.