Beispiel #1
0
    dates = util.get_dates_in_range(args.date, args.date)

    print(f"Date: {', '.join([str(date) for date in dates])}")
    print(f"Time of Day: [{start_time_str}, {end_time_str})")

    def render_distance(dist):
        return '----' if np.isnan(dist) else ('%3dm' % dist)

    for route_id in route_ids:
        route_config = agency.get_route_config(route_id)

        df = pd.concat([
            arrival_history.get_by_date(agency.id, route_id, d, version) \
                .get_data_frame(
                    start_time = util.get_timestamp_or_none(d, start_time_str, tz),
                    end_time = util.get_timestamp_or_none(d, end_time_str, tz)
                )
                for d in dates
        ])

        print(f"Route: {route_id} ({route_config.title})")

        dir_infos = route_config.get_direction_infos()

        for dir_info in dir_infos:
            print(f"Direction: {dir_info.title} ({dir_info.id})")

            prev_stop_info = None

            for dir_index, stop_id in enumerate(dir_info.get_stop_ids()):
Beispiel #2
0
    route_config = agency.get_route_config(route_id)
    if route_config is None:
        raise Exception(f"Invalid route {route_id}")

    if dates is not None:
        dfs = []
        for d in dates:
            if show_scheduled:
                history = timetables.get_by_date(agency.id, route_id, d,
                                                 version)
            else:
                history = arrival_history.get_by_date(agency.id, route_id, d,
                                                      version)

            dfs.append(
                history.get_data_frame(start_time=util.get_timestamp_or_none(
                    d, start_time_str, tz),
                                       end_time=util.get_timestamp_or_none(
                                           d, end_time_str, tz)))

        df = pd.concat(dfs)
    else:
        df = None

    print(f"Route: {route_id} ({route_config.title})")

    dir_infos = route_config.get_direction_infos()
    if direction_id is not None:
        dir_infos = [
            dir_info for dir_info in dir_infos if dir_info.id == direction_id
        ]
        if len(dir_infos) == 0: