Skip to content

Transit mode coding error during assignment #28

Description

@xyzjayne

After creating time period scenarios and preparing the transit network, we ran into this issue during transit assignment.

It was triggered at the following location:
tm2py\components\network\transit\transit.py in run_assignment(self, scenario, period, network, mode_types, use_fares, use_ccr, congested_transit_assignment)

Error: transit_assignment_spec[0].journey_levels[0].transition_rules[2].mode: Mode does not exist or is not a transit mode: f

Prior to the error, there were printouts showing that:

mode_type = {'TRN': ['p', 'b', 'x', 'f', 'l', 'h', 'r'], 'WALK': ['w', 'a', 'e'], 'PNR_ACCESS': ['D', 'w', 'e'], 'PNR_EGRESS': ['D', 'w', 'a'], 'KNR_ACCESS': ['D', 'k', 'w', 'e'], 'KNR_EGRESS': ['D', 'k', 'w', 'a']}
all_modes = ['b', 'j', 'd', 'q', 'p', 'g', 't'] # note that 'f' is missing

This seems to be the line causing all_modes to neglect ferry:
all_modes = get_fare_modes(mode_types["TRN"])

The function called in the line above references a dictionary called fare_modes, which maps the ferry mode to 'd'. Below is the full value of the dictionary:

defaultdict(<function TransitAssignment.run_assignment.<locals>.<lambda> at 0x000001DE6B2641F8>, {'o': {'r'}, 'j': {'i'}, 'l': {'j'}, 'v': {'o'}, 'u': {'x'}, 'i': {'h'}, 'n': {'y'}, 'y': {'z'}, 'z': {'A'}, 'm': {'n'}, 'x': {'q'}, 'h': {'g'}, 'g': {'f'}, 'f': {'d'}, 's': {'u'}, 't': {'v'}, 'q': {'s'}, 'r': {'t'}, 'A': {'l'}, 'B': {'m'}, 'b': {'b'}, 'p': {'p'}})````

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions