plot module

This module contains functions for plotting

class plot.Map(stations, origin=(52.207, 0.1131))

Bases: object

This class represents a map of stations.

locations

List of coordinates.

Type:list
options

Google Map options, see Bokeh documentation.

Type:GMapOptions
plot

Bokeh gmap object.

Type:gmap
stations

List of stations (MonitoringStation).

Type:list
tools

String of names of all the enabled tools, separated by commas.

Type:str
build()

Build the map.

Returns:Bokeh plot object.
plot.map_palette(station)

Function that returns the colour of a given station to use on the map, depending on the relationship between latest level and typical range.

Parameters:station (MonitoringStation) – The station.
Returns:One of
  • ’gray’ - typical range not consistent
  • ’red’ - above the typical range
  • ’green’ - below the typical range
  • ’blue’ - within the typical range
Return type:str
plot.plot_prediction(date, data)

Function that plots the prediction made by predictor.

Parameters:
  • date (2-tuple) – List of datetime objects of actual and demo data, list of datatime objects of future predicted data.
  • data (3-tuple) – Lists of water levels of actual data, demo data, predicted data.
Returns:

Bokeh plot object.

plot.plot_water_level_with_fit(station, dates, levels, p)

Function that makes a graph of the water level over time for a given station with a least-square fit polynomial with a degree of p.

Parameters:
  • station (MonitoringStation) – The desired station to graph.
  • dates (list) – The list of dates for the x-axis.
  • levels (list) – The corresponding water level for each date, y-axis.
  • p (int) – The degree of polynomial that is desired.
Returns:

Bokeh plot object.

plot.plot_water_levels(station, dates, levels)

Function that makes a graph of the water level over time for a given station.

Parameters:
  • station (MonitoringStation) – The desired station to graph.
  • dates (list) – The list of dates for the x-axis.
  • levels (list) – The corresponding water level for each date, y-axis.
Returns:

Bokeh plot object.

plot.plot_water_levels_dynamic(source)

Function that makes a graph of the water level over time for a given station.

Parameters:source (type ColumnDataSource) – The dataset.
Returns:Bokeh plot object.
plot.plot_water_levels_multiple(stations, dt, ncol=3, height=250, width=300)

Function that displays a grid of graphs of the water level over time for a given list of stations.

Parameters:
  • stations (list) – List of the desired stations (type MonitoringStation) to graph.
  • dt (int) – Number of days.
  • ncol (int, optional) – Number of columns.
  • height (int, optional) – Height of each individual plot.
  • width (int, optional) – Width of each individual plot.
Returns:

Bokeh plot object.