fasttrips.Transfer

class fasttrips.Transfer(input_archive, output_dir, gtfs_feed)[source]

Bases: object

Transfer class.

One instance represents all of the Transfer links.

Stores transfer link information in Transfer.transfers_df, an instance of pandas.DataFrame.

__init__(input_archive, output_dir, gtfs_feed)[source]

Constructor. Reads the gtfs data from the transitfeed schedule, and the additional fast-trips transfers data from the input files in input_archive.

Methods

__init__(input_archive, output_dir, gtfs_feed) Constructor.
add_numeric_stop_id(stops) Stops are now equipped to add numeric ID (DAPs are in) so grab them
add_transfer_attributes(transfer_links_df, …) Adds transfer attributes for transfer links and returns those transfer links with the additional columns.
write_transfers_for_extension() This writes to an intermediate file a formatted file for the C++ extension.

Attributes

INPUT_TRANSFERS_FILE File with fasttrips transfer information (this extends the gtfs transfers file).See transfers_ft specification..
OUTPUT_TRANSFERS_FILE File with transfer links for C++ extension It’s easier to pass it via file rather than through the initialize_fasttrips_extension() because of the strings involved
TRANSFERS_COLUMN_AUTO_CAPACITY fasttrips Transfers column name: Auto Capacity, vehicles per hour per mile.
TRANSFERS_COLUMN_DISTANCE fasttrips Transfers column name: Link walk distance, in miles.
TRANSFERS_COLUMN_ELEVATION_GAIN fasttrips Transfers column name: Elevation Gain, feet gained along link.
TRANSFERS_COLUMN_FROM_ROUTE fasttrips Transfers column name: Origin route identifier
TRANSFERS_COLUMN_FROM_STOP gtfs Transfers column name: Origin stop identifier
TRANSFERS_COLUMN_FROM_STOP_NUM fasttrips Transfers column name: Origin Stop Numerical Identifier.
TRANSFERS_COLUMN_INDIRECTNESS fasttrips Transfers column name: Indirectness, ratio of Manhattan distance to crow-fly distance.
TRANSFERS_COLUMN_MIN_TRANSFER_TIME gtfs Transfers column name: Minimum transfer time for transfer_type=2.
TRANSFERS_COLUMN_MIN_TRANSFER_TIME_MIN gtfs Transfers column name: Minimum transfer time for transfer_type=2.
TRANSFERS_COLUMN_PENALTY Transfers column name: Link generic cost.
TRANSFERS_COLUMN_POPULATION_DENSITY fasttrips Transfers column name: Population Density, people per square mile.
TRANSFERS_COLUMN_RETAIL_DENSITY fasttrips Transfers column name: Retail Density, employees per square mile.
TRANSFERS_COLUMN_SCHEDULE_PRECEDENCE fasttrips Transfers column name: Schedule precedence
TRANSFERS_COLUMN_STOP_TO_STOP fasttrips Transfers column name: Is this a stop-to-stop transfer? (e.g.
TRANSFERS_COLUMN_TIME Transfers column name: Link walk time.
TRANSFERS_COLUMN_TIME_MIN Transfers column name: Link walk time in minutes.
TRANSFERS_COLUMN_TO_ROUTE fasttrips Transfers column name: Destination route identifier
TRANSFERS_COLUMN_TO_STOP gtfs Transfers column name: Destination stop identifier
TRANSFERS_COLUMN_TO_STOP_NUM fasttrips Transfers column name: Destination Stop Numerical Identifier.
TRANSFERS_COLUMN_TRANSFER_TYPE gtfs Transfers column name: Transfer Type
WALK_SPEED_MILES_PER_HOUR Transfer walk speed, in miles per hour
add_numeric_stop_id(stops)[source]

Stops are now equipped to add numeric ID (DAPs are in) so grab them

add_transfer_attributes(transfer_links_df, all_links_df)[source]

Adds transfer attributes for transfer links and returns those transfer links with the additional columns.

Pass all_links_df in order to get the from_route_id and to_route_id for the transfers.

write_transfers_for_extension()[source]

This writes to an intermediate file a formatted file for the C++ extension. Since there are strings involved, it’s easier than passing it to the extension.

Only write the stop/stop transfers since lot/stop transfers are only used for creating drive access links.

INPUT_TRANSFERS_FILE = 'transfers_ft.txt'

File with fasttrips transfer information (this extends the gtfs transfers file). See transfers_ft specification.

OUTPUT_TRANSFERS_FILE = 'ft_intermediate_transfers.txt'

File with transfer links for C++ extension It’s easier to pass it via file rather than through the initialize_fasttrips_extension() because of the strings involved

TRANSFERS_COLUMN_AUTO_CAPACITY = 'auto_capacity'

fasttrips Transfers column name: Auto Capacity, vehicles per hour per mile. Float.

TRANSFERS_COLUMN_DISTANCE = 'dist'

fasttrips Transfers column name: Link walk distance, in miles. This is a float.

TRANSFERS_COLUMN_ELEVATION_GAIN = 'elevation_gain'

fasttrips Transfers column name: Elevation Gain, feet gained along link. Integer.

TRANSFERS_COLUMN_FROM_ROUTE = 'from_route_id'

fasttrips Transfers column name: Origin route identifier

TRANSFERS_COLUMN_FROM_STOP = 'from_stop_id'

gtfs Transfers column name: Origin stop identifier

TRANSFERS_COLUMN_FROM_STOP_NUM = 'from_stop_id_num'

fasttrips Transfers column name: Origin Stop Numerical Identifier. Int.

TRANSFERS_COLUMN_INDIRECTNESS = 'indirectness'

fasttrips Transfers column name: Indirectness, ratio of Manhattan distance to crow-fly distance. Float.

TRANSFERS_COLUMN_MIN_TRANSFER_TIME = 'min_transfer_time'

gtfs Transfers column name: Minimum transfer time for transfer_type=2. Float, seconds.

TRANSFERS_COLUMN_MIN_TRANSFER_TIME_MIN = 'min_transfer_time_min'

gtfs Transfers column name: Minimum transfer time for transfer_type=2. Float, min.

TRANSFERS_COLUMN_PENALTY = 'transfer_penalty'

Transfers column name: Link generic cost. Float.

TRANSFERS_COLUMN_POPULATION_DENSITY = 'population_density'

fasttrips Transfers column name: Population Density, people per square mile. Float.

TRANSFERS_COLUMN_RETAIL_DENSITY = 'retail_density'

fasttrips Transfers column name: Retail Density, employees per square mile. Float.

TRANSFERS_COLUMN_SCHEDULE_PRECEDENCE = 'schedule_precedence'

fasttrips Transfers column name: Schedule precedence

TRANSFERS_COLUMN_STOP_TO_STOP = 'stop2stop'

fasttrips Transfers column name: Is this a stop-to-stop transfer? (e.g. from transfers.txt, and not involving a lot)

TRANSFERS_COLUMN_TIME = 'time'

Transfers column name: Link walk time. This is a TimeDelta.

Todo

Remove these? Maybe weights should be distance based? Walk speed is configured how?

TRANSFERS_COLUMN_TIME_MIN = 'time_min'

Transfers column name: Link walk time in minutes. This is a float.

TRANSFERS_COLUMN_TO_ROUTE = 'to_route_id'

fasttrips Transfers column name: Destination route identifier

TRANSFERS_COLUMN_TO_STOP = 'to_stop_id'

gtfs Transfers column name: Destination stop identifier

TRANSFERS_COLUMN_TO_STOP_NUM = 'to_stop_id_num'

fasttrips Transfers column name: Destination Stop Numerical Identifier. Int.

TRANSFERS_COLUMN_TRANSFER_TYPE = 'transfer_type'

gtfs Transfers column name: Transfer Type

WALK_SPEED_MILES_PER_HOUR = 2.7

Transfer walk speed, in miles per hour

Todo

Make this configurable?