ELRMileages.get_conn_mileages

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

Retrieves the connection point between two pairs of ELRs and their associated mileages.

Specifically, it finds the end mileage for the starting ELR and the start mileage for the ending ELR.

Note

This function may not be able to find a connection for every pair of ELRs. Please refer to Example 2 for more information.

Parameters:
  • start_elr (str) – The starting ELR.

  • end_elr (str) – The ending ELR.

  • update (bool) – Whether to check for updates to the package data; defaults to False.

  • kwargs – [Optional] Additional parameters for the method fetch_mileage_file().

Returns:

A tuple containing the connection ELR(s) and mileage(s) between the specified 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
('', '', '', '', '')