Electrification.collect_national_network_codes

Electrification.collect_national_network_codes(confirmation_required=True, verbose=False)

Collect OLE section codes for national network from source web page.

Parameters
  • confirmation_required (bool) – whether to confirm before proceeding, defaults to True

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

Returns

OLE section codes for National network

Return type

dict or None

Examples:

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

>>> elec = Electrification()

>>> nn_codes = elec.collect_national_network_codes()
To collect section codes for OLE installations: national network
? [No]|Yes: yes
>>> type(nn_codes)
dict
>>> list(nn_codes.keys())
['National network', 'Last updated date']

>>> elec.KEY_TO_NATIONAL_NETWORK
'National network'

>>> nn_codes_dat = nn_codes[elec.KEY_TO_NATIONAL_NETWORK]
>>> type(nn_codes_dat)
dict
>>> list(nn_codes_dat.keys())
['Traditional numbering system [distance and sequence]',
 'New numbering system [km and decimal]',
 'Codes not certain [confirmation is welcome]',
 'Suspicious data',
 'An odd one to complete the record',
 'LBSC/Southern Railway overhead system',
 'Codes not known']

>>> tns_codes = nn_codes_dat['Traditional numbering system [distance and sequence]']
>>> type(tns_codes)
dict
>>> list(tns_codes.keys())
['Codes', 'Notes']
>>> tns_codes_dat = tns_codes['Codes']
>>> tns_codes_dat.head()
  Code  ...                          Datum
0    A  ...               Fenchurch Street
1    A  ...             Newbridge Junction
2    A  ...               Fenchurch Street
3    A  ...  Guide Bridge Station Junction
4   AB  ...
[5 rows x 4 columns]