In environmental hazard assessment, risk is defined as the probability of a hazardous event occuring multiplied by the consequences of that event. Thus high risk can be the result of frequent events of low consequence or rare events of high consequence; the highest risk scenarios are often not obvious.
The Environment Agency routinely collects data on rainfall, sea level and river discharge and has published flooding probability maps that indicate areas of England that fall within four flood probability bands, based on the recurrence interval of flood levels that cause property damage and threat to life. These bands are very low probability (flooding expected once per 1000 years), low probability (flooding expected once per 100 years), medium probability (flooding expected once per 50 years), and high probability (flooding expected once per 10 years).
This tool calculates flood probabilities and risks for postcodes in England.
To install the Tool, the user must run, in the command line, either:
python setup.py install
or
python setup.py install --user
To use the Tool in command line:
-
Open Python
-
import assignment
-
There are 4 functions to run in assignment (see table below for what each function achieves). To run a specific function, type:
assignment.questionX(input)
Where X is the number of the function you want to use and input is a list of postcodes (q1-3) or a date (q4).
question1(postcodes) : For a list of postcodes, this function returns a Dataframe of flood probabilities ordered from High
to Zero
, then by lexagraphic (dictionary) order on postcode. The index is named Postcode
and the d data column is named Probability Band
. Invalid postcodes and duplicates are removed.
question2(postcodes) : For a list of postcodes, this function
returns a Dataframe of flood risks, ordered by risk, then by lexagraph (dictionary) order on the postcode. The index is named
Postcode
and the data column Flood Risk
.
Invalid postcodes and duplicates are removed.
question3(postcodes) : For a list of postcodes, this function returns a map of flood alerts at the location of the postcodes. Alerts will either be "Red" (High Warning), "Amber" (Medium Warning), Green (No warning) or will return "No data".
question4(postcodes) : For a list of postcodes, this function returns a bar chart of mean total rainfall in the North, Midlands, South East and South West regions of England for a specific date.
For information on what every function inside the assignment python module achieves, view the index.html from the Sphinx documentation (see 'Documentation section below).
Functions question3 and quesiton4 use Environment Agency rainfall data from the real-time data API (Beta).
The code includes Sphinx documentation. On systems with Sphinx installed, this can be built by running
python -m sphinx docs html
then viewing the index.html
file in the html
directory in your browser.
For systems with LaTeX installed, a manual pdf can be generated by running
python -m sphinx -b latex docs latex
Then following the instructions to process the FloodTool.tex
file in the latex
directory in your browser.
The tool includes several tests, which you can use to check its operation on your system. With [pytest installed, these can be run with
python -m pytest flood_tool
``
The current version also includes a speed scoring algorithm. This can be run with.
python -m score
in the main repository directory.