LocationIdentifiers

class pyrcs.line_data.loc_id.LocationIdentifiers(data_dir=None, update=False, verbose=True)

A class for collecting data of location identifiers (including other systems’ station codes).

Parameters
  • data_dir (str or None) – name of data directory, defaults to None

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

  • verbose (bool or int) – whether to print relevant information in console, defaults to True

Variables
  • catalogue (dict) – catalogue of the data

  • last_updated_date (str) – last updated date

  • data_dir (str) – path to the data directory

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

Examples:

>>> from pyrcs.line_data import LocationIdentifiers
>>> # from pyrcs import LocationIdentifiers

>>> lid = LocationIdentifiers()

>>> lid.NAME
'CRS, NLC, TIPLOC and STANOX codes'

>>> lid.URL
'http://www.railwaycodes.org.uk/crs/crs0.shtm'

Attributes

KEY

Key of the dict-type data

KEY_TO_ADDITIONAL_NOTES

Key of the dict-type data of additional notes

KEY_TO_LAST_UPDATED_DATE

Key of the data of the last updated date

KEY_TO_MSCEN

Key of the dict-type data of the 'multiple station codes explanatory note'

KEY_TO_OTHER_SYSTEMS

Key of the dict-type data of the 'other systems'

NAME

Name of the data

URL

URL of the main web page of the data

Methods

cleanse_mult_alt_codes(data)

Cleanse multiple alternatives for every code column.

collect_codes_by_initial(initial[, update, ...])

Collect CRS, NLC, TIPLOC, STANME and STANOX codes for a given initial letter.

collect_explanatory_note([...])

Collect note about CRS code from source web page.

collect_other_systems_codes([...])

Collect data of other systems' station codes from source web page.

fetch_codes([update, dump_dir, verbose])

Fetch CRS, NLC, TIPLOC, STANME and STANOX codes and other systems' station codes.

fetch_explanatory_note([update, dump_dir, ...])

Fetch multiple station codes explanatory note.

fetch_other_systems_codes([update, ...])

Fetch data of other systems' station codes.

get_code_notes(data)

Get notes for every code column.

make_xref_dict(keys[, initials, main_key, ...])

Make a dict/dataframe for location code data for the given keys.

parse_location_name(data)

Parse the location names of the preprocessed data.

parse_stanox_note(data)

Parse the note for STANOX.