Viaducts¶
A class for collecting railway viaducts.
Viaducts.collect_railway_viaducts_by_page (page_no) |
Collect data of railway viaducts for a given page number from source web page. |
Viaducts.fetch_railway_viaducts ([update, …]) |
Fetch data of railway viaducts from local backup. |
-
class
pyrcs.other_assets.
Viaducts
(data_dir=None, update=False)[source]¶ A class for collecting railway viaducts.
Parameters: - data_dir (str, None) – name of data directory, defaults to
None
- update (bool) – whether to check on update and proceed to update the package data, defaults to
False
Example:
from pyrcs.other_assets import Viaducts viaducts = Viaducts() print(viaducts.Name) # Railway viaducts print(viaducts.SourceURL) # http://www.railwaycodes.org.uk/viaducts/viaducts0.shtm
-
collect_railway_viaducts_by_page
(page_no, update=False, verbose=False)[source]¶ Collect data of railway viaducts for a given page number from source web page.
Parameters: - page_no (int, str) – page number; valid values include 1, 2, 3, 4, 5, and 6
- update (bool) – whether to check on update and proceed to update the package data, defaults to
False
- verbose (bool) – whether to print relevant information in console as the function runs, defaults to
False
Returns: railway viaducts data of the given
page_no
and date of when the data was last updatedReturn type: dict
Example:
from pyrcs.other_assets import Viaducts viaducts = Viaducts() update = True page_no = 1 railway_viaducts_1 = viaducts.collect_railway_viaducts_by_page(page_no, update) print(railway_viaducts_1) # {'Page 1 (A-C)': <codes>, # 'Last updated date': <date>}
-
fetch_railway_viaducts
(update=False, pickle_it=False, data_dir=None, verbose=False)[source]¶ Fetch data of railway viaducts from local backup.
Parameters: - update (bool) – whether to check on update and proceed to update the package data, defaults to
False
- pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to
False
- data_dir (str, None) – name of package data folder, defaults to
None
- verbose (bool) – whether to print relevant information in console as the function runs, defaults to
False
Returns: railway viaducts data and date of when the data was last updated
Return type: dict
Example:
from pyrcs.other_assets import Viaducts viaducts = Viaducts() update = False pickle_it = False data_dir = None railway_viaducts = viaducts.fetch_railway_viaducts(update, pickle_it, data_dir) print(railway_tunnel_lengths) # {'Viaducts': <codes>, # 'Latest update date': <date>}
- update (bool) – whether to check on update and proceed to update the package data, defaults to
- data_dir (str, None) – name of data directory, defaults to