Electrification.fetch_ohns_codes

Electrification.fetch_ohns_codes(update=False, dump_dir=None, verbose=False)

Fetch codes for overhead line electrification neutral sections (OHNS).

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

  • dump_dir (str or None) – pathname of a directory where the data file is dumped, defaults to None

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

Returns

OHNS codes

Return type

dict

Examples:

>>> from pyrcs.line_data import Electrification  # from pyrcs import Electrification

>>> elec = Electrification()

>>> ohl_ns_codes = elec.fetch_ohns_codes()

>>> type(ohl_ns_codes)
dict
>>> list(ohl_ns_codes.keys())
['National network neutral sections', 'Last updated date']

>>> elec.KEY_TO_OHNS
'National network neutral sections'

>>> ohl_ns_codes_dat = ohl_ns_codes[elec.KEY_TO_OHNS]
>>> type(ohl_ns_codes_dat)
dict
>>> list(ohl_ns_codes_dat.keys())
['Codes', 'Notes']
>>> ohl_ns_codes_dat['Codes']
      ELR          OHNS Name  ...     Tracks                                 Dates
0    ARG1         Rutherglen  ...
1    ARG2    Finnieston East  ...       Down
2    ARG2    Finnieston West  ...         Up
3    AYR1   Shields Junction  ...     Up Ayr
4    AYR1   Shields Junction  ...   Down Ayr
..    ...                ...  ...        ...                                   ...
436   WWD       Law Junction  ...
437   WWD  Holytown Junction  ...                           Installed October 2018
438   XRC          Royal Oak  ...  Westbound
439   YKR              Yoker  ...             Installed ??, removed ≈11 March 1979
440   YKR            Dalmuir  ...             Installed ??, removed ≈11 March 1979

[441 rows x 5 columns]