itienary_processing.py

changeset 4
ac067a42b00f
parent 3
10ce28475e9c
equal deleted inserted replaced
3:10ce28475e9c 4:ac067a42b00f
37 return list(filter_itinerary( 37 return list(filter_itinerary(
38 entry.stop.stop_region 38 entry.stop.stop_region
39 for entry in session.query(GtfsStopTime) 39 for entry in session.query(GtfsStopTime)
40 .filter(GtfsStopTime.trip_id == stoptime.trip_id) 40 .filter(GtfsStopTime.trip_id == stoptime.trip_id)
41 .filter(GtfsStopTime.stop_sequence > stoptime.stop_sequence) 41 .filter(GtfsStopTime.stop_sequence > stoptime.stop_sequence)
42 if entry.stop.stop_region_major == 1
42 )) 43 ))
43 44
44 def get_destination(stoptime, itinerary): 45 def get_destination(stoptime, itinerary):
45 from busroute import destinations_list 46 from busroute import destinations_list
46 dests = destinations_list( 47 dests = destinations_list(
47 itinerary = itinerary, 48 itinerary = itinerary,
48 trip_length = float(length_left(stoptime)), 49 trip_length = float(length_left(stoptime)),
49 regions = regions, 50 regions = regions,
50 ) 51 )
51 return '-'.join(dests) 52 return ';'.join(dests)
52 53
53 while got_stoptimes: 54 while got_stoptimes:
54 if k > 0: 55 if k > 0:
55 print('%.2f%% done' % (k * 100 / amount)) 56 print('%.2f%% done' % (k * 100 / amount))
56 #print('%s spent in query, %s spent in processing (%.1f%% of time spent processing)' % (time_in_db, time_in_process, (time_in_process / (time_in_db + time_in_process) * 100))) 57 #print('%s spent in query, %s spent in processing (%.1f%% of time spent processing)' % (time_in_db, time_in_process, (time_in_process / (time_in_db + time_in_process) * 100)))

mercurial