Electrification.collect_etz_codes

Electrification.collect_etz_codes(confirmation_required=True, verbose=False, raise_error=False)[source]

Collects OLE section codes for national network energy tariff zones from the source web page.

Parameters:
  • confirmation_required (bool) – Whether user confirmation is required; if confirmation_required=True (default), prompts the user for confirmation before proceeding with data collection.

  • verbose (bool | int) – Whether to print relevant information to the console; defaults to False.

  • raise_error (bool) – Whether to raise the provided exception; if raise_error=False (default), the error will be suppressed.

Returns:

A dictionary of OLE section codes for national network energy tariff zones.

Return type:

dict | None

Examples:

>>> from pyrcs.line_data import Electrification  # from pyrcs import Electrification
>>> elec = Electrification()
>>> rail_etz_codes = elec.collect_etz_codes(verbose=True)
To collect section codes for OLE installations: National network energy tariff zones
? [No]|Yes: yes
Collecting the data ... Done.
>>> type(rail_etz_codes)
dict
>>> list(rail_etz_codes.keys())
['National network energy tariff zones', 'Last updated date']
>>> elec.KEY_TO_ETZ
'National network energy tariff zones'
>>> rail_etz_codes_dat = rail_etz_codes[elec.KEY_TO_ETZ]
>>> type(rail_etz_codes_dat)
dict
>>> list(rail_etz_codes_dat.keys())
['Railtrack', 'Network Rail']
>>> rail_etz_codes_dat['Railtrack']['Codes']
   Code                   Energy tariff zone
0    EA                          East Anglia
1    EC                 East Coast Main Line
2    GE                      Great Eastern †
3    LT                                LTS †
4    MD                    Midland Main Line
5    ME                         Merseyside †
6    MS  Merseyside (North West DC traction)
7    NE                           North East
8    NL           North London (DC traction)
9    SC                             Scotland
10   SO                                South
11   SW                           South West
12   WA                        West Anglia †
13   WC                West Coast/North West