Electrification.fetch_ohns_codes¶
- Electrification.fetch_ohns_codes(update=False, dump_dir=None, verbose=False)[source]¶
Fetches the overhead line electrification neutral sections (OHNS) codes.
- Parameters:
update (bool) – Whether to check for updates to the package data; defaults to
False
.dump_dir (str | None) – Path to a directory where the data file will be saved; defaults to
None
.verbose (bool | int) – Whether to print relevant information to the console; defaults to
False
.
- Returns:
A dictionary of 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'].head() ELR OHNS Name Mileage Tracks Dates 0 ARG1 Rutherglen 0m 03ch 1 ARG2 Finnieston East 4m 23ch Down 2 ARG2 Finnieston West 4m 57ch Up 3 AYR1 Shields Junction 0m 68ch Up Ayr 4 AYR1 Shields Junction 0m 69ch Down Ayr