-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_traveltime_data.py
46 lines (34 loc) · 1.14 KB
/
create_traveltime_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
import sys
import os
sys.path.append('../nsmaps')
import nsmaps
from nsmaps.station import StationType
DATA_DIR = './website/data'
MAX_STATIONS = 60
def main():
stations = nsmaps.station.Stations(DATA_DIR)
major_station_types = (
StationType.intercitystation,
StationType.knooppuntIntercitystation,
StationType.megastation,
StationType.knooppuntSneltreinstation,
StationType.sneltreinstation,
StationType.knooppuntStoptreinstation,
StationType.stoptreinstation
)
stations_options = stations.get_stations_for_types(major_station_types)
stations_todo = []
n_stations = 0
for station in stations_options:
if n_stations >= MAX_STATIONS:
break
if not station.has_travel_time_data() and station.get_country_code() == 'NL':
stations_todo.append(station)
n_stations += 1
print(station)
timestamp = "19-04-2016 08:00"
stations.create_traveltimes_data(stations_todo, timestamp)
stations.recreate_missing_destinations(DATA_DIR, timestamp, False)
if __name__ == "__main__":
main()