LocationIdentifiers¶
- class pyrcs.line_data.LocationIdentifiers(data_dir=None, update=False, verbose=True)[source]¶
A class for collecting data of location identifiers (including CRS, NLC, TIPLOC and STANOX codes and other systems’ station codes).
The class retrieves and organises location identifiers for various railway stations and other related systems.
- 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.
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
The key for accessing the data.
The key used to reference the last updated date in the data.
The key for accessing the data of multiple station codes explanatory note.
The key for accessing the data of additional notes.
The key for accessing the data of other systems.
The name of the data.
The URL of the main web page for the data.
Methods
collect_loc_id
(initial[, ...])Collects CRS, NLC, TIPLOC, STANME and STANOX codes for a given initial letter.
collect_notes
([confirmation_required, ...])Collects the explanatory note related to multiple station codes (CRS codes) from the source web page.
collect_other_systems_codes
([...])Collects data of other systems' station codes from the source web page.
fetch_codes
([update, dump_dir, verbose])Fetches location codes listed in the CRS, NLC, TIPLOC and STANOX codes catalogue (including other systems' station codes).
fetch_loc_id
([initial, update, dump_dir, ...])Fetches data of CRS, NLC, TIPLOC, STANME and STANOX codes.
fetch_notes
([update, dump_dir, verbose])Fetches the explanatory note for multiple station codes (CRS codes).
fetch_other_systems_codes
([update, ...])Fetches data of other systems' station codes.
make_xref_dict
(keys[, initials, ...])Creates a dictionary or dataframe containing location code data for the specified
keys
.