plot module¶
Visualizations of historical data, flooding zones, and stations.
-
plot.
create_choropleth_colour_scale
(min_severity=4, discrete_colourscale=False)¶ Define the colours and tick labels for the choropleth map legend.
- Parameters
min_severity (int, optional) – the minimum severity of warnings which are to be accomodated in the colour scale. Defaults to 4, allowing all possible severities
discrete_colourscale (bool, optional.) – If True, creates a discrete colour bar. Default is false.
- Returns
colorscale, ticktext – These are intended to be directly passed to the plotly colorscale and colorbar_ticktext parameters.
- Return type
list, list of strings
-
plot.
create_water_levels_plot
(listinput)¶ Plot the water levels of stations given corresponding date.
Subplots are created for each station.
- Parameters
listinput (list) –
- list of station (MonitoringStation), dates (list), and
levels (list), in this order. List must be of length multiple of 3.
- Raises
ValueError – when listinput is not of length multiple of three.
- Returns
fig – plotly figure with water levels, high, and low plotted.
- Return type
plotly.graph_objects.figure
-
plot.
get_recommended_simplification_params
(warning_len)¶ Return the recommended geometry simplification tolerance and buffer.
These settings are based on the number of warnings present, and designed to prevent the map interface from lagging if many warnings are present.
- Parameters
warning_len (int) – number of warnings in the warning list.
- Returns
{‘tol’: float, ‘buf’: float}. Parameters which determine the degree of shape approximation recommended for mapping.
- Return type
dict
-
plot.
map_flood_warnings
(geojson, warning_df=None, min_severity=4, station_df=None)¶ Plot flood warnings and station levels as a chloropleth map figure.
- Parameters
geojson (geo_json) –
- Contains the perimeter definitions for all warnings. Created from
warningdata.build_regions_geojson.
warning_df (pandas.dataframe, optional) – Contains information regarding the severity of the floods and the location name. Created using warningdata.build_severity_dataframe. Defaults to None, where warnings are not mapped.
station_df (pandas.dataframe, optional) – Contains information of position and relative water level of each station, to be plotted as a scatter map. Defaults to None, where stations are not mapped.
min_severity (int, optional) – If provided, plots only warnings equal to or above this severity level Use SeverityLevel.value to obtain the integer value corresponding to a named severity level. default is 4 (all warnings plotted)
- Returns
- Return type
None.
-
plot.
plot_water_levels
(listinput)¶ Display plot generated in create_water_levels_plot.
- Parameters
listinput (list) – list of station (MonitoringStation), dates (list), and levels (list), in this order. List must be of length multiple of 3.
- Returns
- Return type
None.
-
plot.
plot_water_levels_with_fit
(listinput, p)¶ Add best-fit line to water level graphs, and display them.
- Parameters
listinput (list) – list of station (MonitoringStation), dates (list), and levels (list), in this order. List must be of length multiple of 3.
p (int) – order of polynomial fit
- Returns
- Return type
None.