geo module¶
Collection of functions related to geographical data.
-
geo.
rivers_by_station_number
(stations_list, N)¶ Find the N rivers with the greatest number of stations.
The rivers are returned in order of decreasing number of stations. If there is a tie between multiple rivers at the Nth entry, all rivers with equal number of stations are returned.
- Parameters
stations (list[MonitoringStation]) – generated using build_station_list.
N (int) – The number of rivers to return, in descending order of number of stations
- Returns
list of tuples containing the river names and number of stations of rivers with the N highest number of monitoring stations.
- Return type
list[(string, int)]
-
geo.
rivers_with_stations
(stations)¶ Get names of rivers with an associated monitoring station.
- Parameters
stations (list[MonitoringStation]) – generated using build_station_list.
- Returns
output – A set containing the names of all the rivers with a monitoring station.
- Return type
set
-
geo.
stations_by_distance
(stations, p)¶ Calculate distances from stations to a coordinate p.
- Parameters
stations (list[MonitoringStation]) – generated using build_station_list.
p (float) – coordinates of the center.
- Returns
pair of station object and the corresponding distance from it to point p.
- Return type
(MonitoringStation, float)
-
geo.
stations_by_river
(stations)¶ Map stations to the rivers which they are associated with.
- Parameters
stations (list[MonitoringStation]) – generated using build_station_list..
- Returns
output – {river_name : [MonitoringStations]}: {string : [MonitoringStation]}. dict containing lists of MonitoringStations for each river. The dict keys are the river names.
- Return type
dict()
-
geo.
stations_within_radius
(stations, centre, r)¶ Return station/distance pair that are within radius r of center.
- Parameters
stations (list[MonitoringStation]) – generated using build_station_list.
centre ((float, float)) – float coordinates of the center.
r (float) – radius from center.
- Returns
output – list of station objects.
- Return type
list[MonitoringStation]