station module

Model for a monitoring station and tools for manipulating station data.

class station.MonitoringStation(station_id, measure_id, label, coord, typical_range, river, town)

Bases: object

Class representing a river level monitoring station.

static get_relative_water_level(station)

Return the relative water level of a given station.

Useful to pass directly to sorted() as a key

Parameters

station (MonitoringStation) –

Returns

the relative water level of the station.

Return type

float

static inconsistent_typical_range_stations(stations)

Return the stations with inconsistent typical ranges.

Parameters

stations (list[MonitoringStation]) –

Returns

output – the monitoring stations with inconsistent typical ranges.

Return type

list[MonituringStation]

relative_water_level()

Return the water level as a proportion of the typical range.

This is 0.0 when the water level is equal to the lower typical range and 1.0 when the water level is equal to the upper typical range

Returns

the relative water level compared to the typical range. If the typical range is not consistent, None is returned.

Return type

float

typical_range_consistent()

Return true if the typical range is inconsistent.

Range is inconsistent if lowest value is greater than largest value.

Returns

if typical range is consistent.

Return type

bool