Stations

class pyrcs.other_assets.station.Stations(data_dir=None, update=False, verbose=True)

A class for collecting railway station data.

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.other_assets import Stations

>>> stn = Stations()

>>> stn.NAME
'Railway station data'

>>> stn.URL
'http://www.railwaycodes.org.uk/stations/station0.shtm'

Attributes

KEY

Key of the dict-type data

KEY_TO_LAST_UPDATED_DATE

Key of the data of the last updated date

KEY_TO_STN

Key of the dict-type data of 'Mileages, operators and grid coordinates'

NAME

Name of the data

URL

URL of the main web page of the data

Methods

check_row_spans(dat)

Check data where there are row spans.

collect_locations_by_initial(initial[, ...])

Collect data of railway station locations (mileages, operators and grid coordinates) for a given initial letter.

fetch_locations([update, dump_dir, verbose])

Fetch data of railway station locations (mileages, operators and grid coordinates).

get_catalogue([update, verbose])

Get catalogue of railway station data.

parse_coordinates_columns(dat)

Parse 'Degrees Longitude' and 'Degrees Latitude' of the station locations data.

parse_elr_mileage_columns(dat)

Parse 'ELR' and 'Mileage' of the station locations data.

parse_owner_and_operator_columns(dat)

Parse 'Owner' and 'Operator' of the station locations data.

parse_station_column(dat)

Parse 'Station' of the station locations data.