ELRMileages

class pyrcs.line_data.ELRMileages(data_dir=None, update=False, verbose=True)[source]

A class for collecting data of Engineer’s Line References (ELRs).

This class provides methods to access and manage ELR data, including their mileages and last updated information.

Parameters:
  • data_dir (str | None) – The name of the directory for storing the data; defaults to None.

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

  • verbose (bool | int) – Whether to print relevant information to the console; defaults to True.

Variables:
  • catalogue (dict) – The catalogue of the data.

  • last_updated_date (str) – The date when the data was last updated.

  • data_dir (str) – The path to the directory containing the data.

  • current_data_dir (str) – The path to the current data directory.

  • measure_headers (list) – A list of potential headers for various measures in the data.

Examples:

>>> from pyrcs.line_data import ELRMileages  # from pyrcs import ELRMileages
>>> em = ELRMileages()
>>> em.NAME
"Engineer's Line References (ELRs)"
>>> em.URL
'http://www.railwaycodes.org.uk/elrs/elr0.shtm'

Attributes

KEY

The key for accessing the data.

KEY_TO_LAST_UPDATED_DATE

The key used to reference the last updated date in the data.

NAME

The name of the data.

URL

The URL of the main web page for the data.

Methods

collect_elr(initial[, ...])

Collects Engineer's Line References (ELRs) that begin with a specified initial letter from the source web page.

collect_mileage_file(elr[, parsed, ...])

Collects the mileage file for a specific ELR from the source web page.

fetch_elr([initial, update, dump_dir, verbose])

Fetches data of ELRs and their associated mileages.

fetch_mileage_file(elr[, update, dump_dir, ...])

Fetches the mileage file for a specific ELR.

get_conn_mileages(start_elr, end_elr[, update])

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

search_conn(start_elr, start_em, end_elr, end_em)

Searches for connections between two pairs of ELRs and their associated mileages.