ELRMileages.get_conn_mileages

ELRMileages.get_conn_mileages(start_elr, end_elr, update=False, pickle_mileage_file=False, data_dir=None, verbose=False)[source]

Get a connection point between two ELR-and-mileage pairs.

Namely, find the end and start mileages for the start and end ELRs, respectively.

Note

This function may not be able find the connection for every pair of ELRs. See the Example 2 below.

Parameters
  • start_elr (str) – start ELR

  • end_elr (str) – end ELR

  • update (bool) – whether to check on update and proceed to update the package data, defaults to False

  • pickle_mileage_file (bool) – whether to replace the current mileage file with newly collected data, defaults to False

  • data_dir (str or None) – name of package data folder, defaults to None

  • verbose (bool or int) – whether to print relevant information in console as the function runs, defaults to False

Returns

connection ELR and mileages between the given start_elr and end_elr

Return type

tuple

Example 1:

>>> from pyrcs.line_data import ELRMileages

>>> em = ELRMileages()

>>> conn = em.get_conn_mileages('NAY', 'LTN2')
>>> (start_dest_mileage_,
...  conn_elr_, conn_orig_mileage_, conn_dest_mileage_,
...  end_orig_mileage_) = conn

>>> print(start_dest_mileage_)
5.1606
>>> print(conn_elr_)
NOL
>>> print(conn_orig_mileage_)
5.1606
>>> print(conn_dest_mileage_)
0.0638
>>> print(end_orig_mileage_)
123.1320

Example 2:

>>> from pyrcs.line_data import ELRMileages

>>> em = ELRMileages()

>>> conn = em.get_conn_mileages('MAC3', 'DBP1')
>>> print(conn)
('', '', '', '', '')