neroden / timetable_kit

A Python toolkit for generating human-readable timetables from GTFS data; uses PANDAS and gtfs_kit
GNU Affero General Public License v3.0
39 stars 2 forks source link

('No trip_id for ', '534') #6

Closed ExtremeMemes closed 2 years ago

ExtremeMemes commented 2 years ago

Hello! I was playing around with timetable kit today, and when I was trying to generate some timetables, I ran into this error. For some reason, only train 534 will not generate the timetable. Can you help me resolve this?

Below is the command I used and the output

timetable.py --spec capitol-corridor-weekday-eb.csv capitol-corridor-weekday-eb.json -o output -a Extreme

Output

Using input_dir .
Using GTFS file C:\Users\Extreme\AppData\Roaming\Python\Python310\site-packages\timetable_kit\amtrak\gtfs
Feed loaded
Feed initialized
Feed patched, hopefully
Producing timetable for capitol-corridor-weekday-eb.csv
ttspec_csv_path capitol-corridor-weekday-eb.csv / ttspec_json_path capitol-corridor-weekday-eb.json
tt-spec JSON file loaded
Fonts and icons copied to output
Working with reference date 20220610.
tt-spec capitol-corridor-weekday-eb loaded and augmented
Feed filtered by reference date.
Feed filtered by trip_short_name.
Finding duplicate tsns, if any:
Calendar:
     service_id  monday  tuesday  wednesday  thursday  friday  saturday  sunday start_date  end_date
536     2846775       1        1          1         1       1         0       0   20220531  20220701
542     2846741       1        1          1         1       1         0       0   20220531  20220701
552     2846783       1        1          1         1       1         0       0   20220531  20220701
560     2846746       1        1          1         1       1         0       0   20220531  20220701
567     2846753       1        1          1         1       1         0       0   20220531  20220701
571     2846837       1        1          1         1       1         0       0   20220531  20220701
574     2846791       1        1          1         1       1         0       0   20220531  20220701
580     2846799       1        1          1         1       1         0       0   20220531  20220701
590     2846765       1        1          1         1       1         0       0   20220531  20220701
596     2846807       1        1          1         1       1         0       0   20220531  20220701
737     2849830       1        1          1         1       1         1       1   20220520  20230708
1797    2848293       1        1          1         1       1         0       0   20220531  20220701
1800    2848325       1        1          1         1       1         0       0   20220531  20220701
1822    2848329       1        1          1         1       1         0       0   20220531  20220701
1825    2848301       1        1          1         1       1         0       0   20220531  20220701
Believed valid from 20220531 to 20220701
[['column-options'], [], [], ['ardp'], [], [], [], [], [], [], [], [], [], [], []]
Traceback (most recent call last):
  File "C:\Users\Extreme\Downloads\timetable_kit-main_2\timetable_kit-main\timetable_kit\timetable.py", line 592, in trip_from_train_spec_local
    my_trip_id = train_spec_to_trip_id[train_spec]
KeyError: '534'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Extreme\Downloads\timetable_kit-main_2\timetable_kit-main\timetable_kit\timetable.py", line 1616, in <module>
    main()
  File "C:\Users\Extreme\Downloads\timetable_kit-main_2\timetable_kit-main\timetable_kit\timetable.py", line 1598, in main
    produce_several_timetables(
  File "C:\Users\Extreme\Downloads\timetable_kit-main_2\timetable_kit-main\timetable_kit\timetable.py", line 1521, in produce_several_timetables
    produce_timetable(
  File "C:\Users\Extreme\Downloads\timetable_kit-main_2\timetable_kit-main\timetable_kit\timetable.py", line 1347, in produce_timetable
    (timetable, styler_table, header_styling_list) = fill_tt_spec(
  File "C:\Users\Extreme\Downloads\timetable_kit-main_2\timetable_kit-main\timetable_kit\timetable.py", line 655, in fill_tt_spec
    stations_max_dwell_map = make_stations_max_dwell_map(
  File "C:\Users\Extreme\Downloads\timetable_kit-main_2\timetable_kit-main\timetable_kit\timetable.py", line 500, in make_stations_max_dwell_map
    trip_id = trip_from_train_spec_fn(train_spec).trip_id
  File "C:\Users\Extreme\Downloads\timetable_kit-main_2\timetable_kit-main\timetable_kit\timetable.py", line 594, in trip_from_train_spec_local
    raise InputError("No trip_id for ", train_spec) from e
timetable_kit.errors.InputError: ('No trip_id for ', '534')
derhuerst commented 2 years ago

Please share the exact version of the GTFS dataset you're working with, e.g. the URL you downloaded it from; Or if the URL always points to the latest version (so you might have an older one), please upload it somewhere.

(I'm not the author of timetable_kit.)

juckins commented 2 years ago

Hello,

I can look later today, but in the meantime try using a different reference date in your command. The help file should have the sample syntax for specifying the reference date. Sometimes you have to try a reference date for each day of the week to see what works. It's an Amtrak data 'feature'. (I'm also not the author but have worked with them on this project).

On Fri, Jul 22, 2022, 05:31 Jannis R @.***> wrote:

Please share the exact version of the GTFS dataset you're working with, e.g. the URL you downloaded it from; Or if the URL always points to the latest version (so you might have an older one), please upload it somewhere.

(I'm not the author of timetable_kit.)

— Reply to this email directly, view it on GitHub https://github.com/neroden/timetable_kit/issues/6#issuecomment-1192375961, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA7R7UWU67NZPG5Z7D43I3VVJTAJANCNFSM54JO2Q5A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ExtremeMemes commented 2 years ago

@juckins Thank you for the tip, Changing the reference date helped, and the timetable did generate.

Also I have tried to generate the Vermonter timetable, and I have also tried changing the reference date, but It seems like there is a separate schedule for the weekday and the weekend train, so I cannot use the same reference date for how would I be able to generate that to the same page? TLDR: Looking for a way to use two Reference Dates in 1 command/run so that the trains which are on different days (M-F&SaSu) can be on the same page.

ExtremeMemes commented 2 years ago

@juckins It also seems like you managed to get the vermonter trains which run on different dates on 1 timetable here

May you tell me how you accomplished this

juckins commented 2 years ago

@juckins It also seems like you managed to get the vermonter trains which run on different dates on 1 timetable here

May you tell me how you accomplished this

@ExtremeMemes I know the author got that to work by making unique edits to the .csv file for the Vermonter. Try opening up that csv in a spreadsheet program like Excel where you can easily view the rows and columns. Study the setup, and I think that will get you going. I don't think more than 1 reference date was used on the command line, but I have to check on that. Let me know if you get stuck and I can look more this weekend. Amtrak data can be a challenge to work with.

Separately, I'm having a problem downloading the Amtrak stations and I need to see what's going on there. It errors out after processing 1 station.

ExtremeMemes commented 2 years ago

THANK YOU! Your help @juckins helped me a lot.

What I had to do is change the Reference Date (To a weekend), and I had to modify the first and second rows to something like this:

Row 1- | 55 monday | 57 | access | station | 56 monday | 54
Row 2- column-options | ardp MoTuWeThFr | SaSu | blank | blank | reverse ardp MoTuWeThFr | reverse SaSu

Also used the tt-spec docs to help myself out

For your problem of downloading Amtrak stations, have you installed all of the requirements? If that does not work, can you create a new issue, (to keep this organized) and I will try to help you there

juckins commented 2 years ago

@ExtremeMemes Glad to help, and I got the stations working, it may be an oddity in my environment or local python patch. Thanks!