ELRMileages.get_conn_mileages

ELRMileages.get_conn_mileages(start_elr, end_elr, update=False, **kwargs)

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 to find the connection for every pair of ELRs. See Example 2 below.

Parameters
  • start_elr (str) – start ELR

  • end_elr (str) – end ELR

  • update (bool) – whether to do an update check (for the package data), defaults to False

  • kwargs – [optional] parameters of the method ELRMileages.fetch_mileage_file()

Returns

connection ELR and mileages between the given start_elr and end_elr

Return type

tuple

Example 1:

>>> from pyrcs.line_data import ELRMileages  # from pyrcs import ELRMileages

>>> em = ELRMileages()

>>> conn = em.get_conn_mileages(start_elr='NAY', end_elr='LTN2')
>>> (s_dest_mlg, c_elr, c_orig_mlg, c_dest_mlg, e_orig_mlg) = conn

>>> s_dest_mlg
'5.1606'
>>> c_elr
'NOL'
>>> c_orig_mlg
'5.1606'
>>> c_dest_mlg
'0.0638'
>>> e_orig_mlg
'123.1320'

Example 2:

>>> from pyrcs.line_data import ELRMileages  # from pyrcs import ELRMileages

>>> em = ELRMileages()

>>> conn = em.get_conn_mileages(start_elr='MAC3', end_elr='DBP1', dump_dir="tests")
>>> conn
('', '', '', '', '')