Skip to content

Commit 46adf11

Browse files
authored
1.0.0dev (#27)
1 parent e2656a5 commit 46adf11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+5318
-5342
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dist/
2323
# Project-specific directories / files
2424
*[!_]_.py
2525
pyrcs/data/*
26-
!metadata
26+
!.metadata
2727
tutorials/*
2828
.pypirc
2929
cmd.md

docs/source/other-assets.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ other_assets
1919
Stations
2020
Depots
2121
Features
22+
HabdWild
23+
WaterTroughs
24+
Telegraph
25+
Buzzer

docs/source/parser.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,5 @@ Extract information
3434
get_category_menu
3535
get_page_catalogue
3636
get_heading_text
37-
get_page_catalogue
3837
get_hypertext
3938
get_introduction

docs/source/quick-start.rst

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,29 @@ Alternatively, we can create the instance using the :class:`~pyrcs.collector.Lin
5252
Location identifiers by initial letter
5353
--------------------------------------
5454

55-
We can retrieve codes (in `pandas.DataFrame`_ format) for all locations starting with a specific letter using the :meth:`LocationIdentifiers.collect_codes_by_initial()<pyrcs.line_data.LocationIdentifiers.collect_codes_by_initial>` method. This input value for the parameter is case-insensitive. For example, to get the codes for locations whose names begin with the letter ``'A'`` (or ``'a'``):
55+
We can retrieve codes (in `pandas.DataFrame`_ format) for all locations starting with a specific letter using the :meth:`LocationIdentifiers.collect_loc_id()<pyrcs.line_data.LocationIdentifiers.collect_loc_id>` method. This input value for the parameter is case-insensitive. For example, to get the codes for locations whose names begin with the letter ``'A'`` (or ``'a'``):
5656

5757
.. code-block:: python
5858
59-
>>> loc_a_codes = lid.collect_codes_by_initial(initial='a')
59+
>>> loc_a_codes = lid.collect_loc_id(initial='a', verbose=True)
60+
To collect data of CRS, NLC, TIPLOC and STANOX codes beginning with "A"
61+
? [No]|Yes: yes
62+
Collecting the data ... Done.
6063
>>> type(loc_a_codes)
6164
dict
6265
>>> list(loc_a_codes.keys())
63-
['A', 'Additional notes', 'Last updated date']
66+
['A', 'Notes', 'Last updated date']
6467
6568
As shown above, ``loc_a_codes`` is a `dictionary`_ (i.e. in `dict`_ format) with the following *keys*:
6669

6770
- ``'A'``
68-
- ``'Additional notes'``
71+
- ``'Notes'``
6972
- ``'Last updated date'``
7073

7174
The corresponding *values* are:
7275

7376
- ``loc_a_codes['A']`` - CRS, NLC, TIPLOC and STANOX codes for the locations whose names begin with ``'A'``, referring to the table on the `Locations beginning A`_ web page.
74-
- ``loc_a_codes['Additional notes']`` - Any additional information provided on the web page (if available).
77+
- ``loc_a_codes['Notes']`` - Any additional information provided on the web page (if available).
7578
- ``loc_a_codes['Last updated date']`` - The date when the `Locations beginning A`_ web page was last updated.
7679

7780
A snapshot of the data contained in ``loc_a_codes`` is demonstrated below:
@@ -89,8 +92,14 @@ A snapshot of the data contained in ``loc_a_codes`` is demonstrated below:
8992
3 A483 Road Scheme Supervisors Closed ...
9093
4 Aachen ...
9194
[5 rows x 12 columns]
95+
>>> print("Notes: {}".format(loc_a_codes['Notes']))
9296
>>> print("Last updated date: {}".format(loc_a_codes['Last updated date']))
93-
Last updated date: 2024-08-24
97+
Notes: None
98+
Last updated date: 2025-02-19
99+
100+
>>> ## Try more examples! Uncomment the lines below and run:
101+
>>> # loc_a_codes = lid.fetch_loc_id('a') # Fetch location codes starting with 'A'
102+
>>> # loc_codes = lid.fetch_loc_id() # Fetch all location codes
94103
95104
.. _quickstart-all-available-location-identifiers:
96105

@@ -105,18 +114,18 @@ Beyond retrieving location codes for a specific letter, we can use the :meth:`Lo
105114
>>> type(loc_codes)
106115
dict
107116
>>> list(loc_codes.keys())
108-
['LocationID', 'Other systems', 'Additional notes', 'Last updated date']
117+
['Location ID', 'Other systems', 'Additional notes', 'Last updated date']
109118
110119
The ``loc_codes`` object is a dictionary with the following *keys*:
111120

112-
- ``'LocationID'``
121+
- ``'Location ID'``
113122
- ``'Other systems'``
114123
- ``'Additional notes'``
115124
- ``'Latest update date'``
116125

117126
The corresponding *values* are:
118127

119-
- ``loc_codes['LocationID']`` - CRS, NLC, TIPLOC, and STANOX codes for all locations listed across the relevant web pages.
128+
- ``loc_codes['Location ID']`` - CRS, NLC, TIPLOC, and STANOX codes for all locations listed across the relevant web pages.
120129
- ``loc_codes['Other systems']`` - Codes related to the `other systems`_.
121130
- ``loc_codes['Additional notes']`` - Any additional notes and information (if available).
122131
- ``loc_codes['Latest update date']`` - The latest ``'Last updated date'`` across all initial-specific data.
@@ -126,8 +135,8 @@ Here is a snapshot of the data contained in ``loc_codes``:
126135
.. code-block:: python
127136
128137
>>> lid.KEY
129-
'LocationID'
130-
>>> loc_codes_dat = loc_codes[lid.KEY] # loc_codes['LocationID']
138+
'Location ID'
139+
>>> loc_codes_dat = loc_codes[lid.KEY] # loc_codes['Location ID']
131140
>>> type(loc_codes_dat)
132141
pandas.core.frame.DataFrame
133142
>>> loc_codes_dat.tail()
@@ -180,6 +189,11 @@ For example, to view the data for Crossrail:
180189
4 Canary Wharf ... CWX
181190
[5 rows x 5 columns]
182191
192+
>>> ## Try more examples! Uncomment the lines below and run:
193+
>>> ## Get a dictionary for STANOX codes and location names
194+
>>> # stanox_dict = lid.make_xref_dict('STANOX')
195+
>>> ## ... and for STANOX, TIPLOC and location names starting with 'A'
196+
>>> # stanox_tiploc_dict_a = lid.make_xref_dict(['STANOX', 'TIPLOC'], initials='a')
183197
184198
.. _quickstart-elrs-and-mileages:
185199

@@ -205,11 +219,14 @@ ELRs and mileages
205219
Engineer's Line References (ELRs)
206220
---------------------------------
207221

208-
Similar to location identifiers, the ELR codes on the `Railway Codes`_ website are arranged alphabetically based on their initial letters. We can use the :meth:`ELRMileages.collect_elr_by_initial()<pyrcs.line_data.ELRMileages.collect_elr_by_initial>` method to obtain ELRs starting with a specific letter. For example, to get the data for ELRs beginning with the letter ``'A'``:
222+
Similar to location identifiers, the ELR codes on the `Railway Codes`_ website are arranged alphabetically based on their initial letters. We can use the :meth:`ELRMileages.collect_elr()<pyrcs.line_data.ELRMileages.collect_elr>` method to obtain ELRs starting with a specific letter. For example, to get the data for ELRs beginning with the letter ``'A'``:
209223

210224
.. code-block:: python
211225
212-
>>> elrs_a_codes = em.collect_elr_by_initial(initial='a')
226+
>>> elrs_a_codes = em.collect_elr(initial='a')
227+
To collect data of Engineer's Line References (ELRs) beginning with "A"
228+
? [No]|Yes: yes
229+
Collecting the data ... Done.
213230
>>> type(elrs_a_codes)
214231
dict
215232
>>> list(elrs_a_codes.keys())
@@ -241,7 +258,7 @@ Here is a snapshot of the data contained in ``elrs_a_codes``:
241258
4 ABB ...
242259
[5 rows x 5 columns]
243260
>>> print("Last updated date: {}".format(elrs_a_codes['Last updated date']))
244-
Last updated date: 2024-08-04
261+
Last updated date: 2024-10-20
245262
246263
To retrieve data for all ELRs (from ``'A'`` to ``'Z'``), we can use the :meth:`ELRMileages.fetch_elr()<pyrcs.line_data.ELRMileages.fetch_elr>` method:
247264

@@ -279,6 +296,10 @@ Here is a snapshot of the data contained in ``elrs_codes``:
279296
4579 ZZZ9 Dummy ELR for demonstrations and testing ... n/a
280297
[5 rows x 5 columns]
281298
299+
>>> ## Try more examples! Uncomment the lines below and run:
300+
>>> # elrs_a_codes = em.fetch_elr(initial='a') # Fetch ELRs starting with 'A'
301+
>>> # elrs_b_codes = em.fetch_elr(initial='B') # Fetch ELRs starting with 'B'
302+
282303
.. _quickstart-mileage-file-of-a-given-elr:
283304
284305
Mileage file of a given ELR
@@ -327,6 +348,9 @@ Here is a snapshot of the data contained in ``amm_mileage_file``:
327348
4 1.1408 ...
328349
[5 rows x 11 columns]
329350
351+
>>> ## Try more examples! Uncomment the lines below and run:
352+
>>> # xre_mileage_file = em.fetch_mileage_file('XRE') # Fetch mileage file for 'XRE'
353+
>>> # your_mileage_file = em.fetch_mileage_file(elr='?') # ... and for a given ELR '?'
330354
331355
.. _quickstart-railway-station-data:
332356
@@ -369,11 +393,14 @@ Alternatively, we can also create the instance by using the :class:`~pyrcs.colle
369393
Railway stations by initial letter
370394
----------------------------------
371395

372-
We can obtain railway station data based on the first letter (e.g. ``'A'`` or ``'Z'``) of the station's name using the :meth:`Stations.collect_locations_by_initial()<pyrcs.other_assets.Stations.collect_locations_by_initial>` method. For example, to get data for stations starting with ``'A'``:
396+
We can obtain railway station data based on the first letter (e.g. ``'A'`` or ``'Z'``) of the station's name using the :meth:`Stations.collect_locations()<pyrcs.other_assets.Stations.collect_locations>` method. For example, to get data for stations starting with ``'A'``:
373397

374398
.. code-block:: python
375399
376-
>>> stn_loc_a_codes = stn.collect_locations_by_initial(initial='a')
400+
>>> stn_loc_a_codes = stn.collect_locations(initial='a')
401+
To collect data of mileages, operators and grid coordinates beginning with "A"
402+
? [No]|Yes: yes
403+
Collecting the data ... Done.
377404
>>> type(stn_loc_a_codes)
378405
dict
379406
>>> list(stn_loc_a_codes.keys())
@@ -427,7 +454,7 @@ Here is a snapshot of the data contained in ``stn_loc_a``:
427454
3 Abercynon CAM 16m 28ch
428455
4 Abercynon ABD 16m 28ch
429456
>>> print("Last updated date: {}".format(stn_loc_a_codes['Last updated date']))
430-
Last updated date: 2024-09-23
457+
Last updated date: 2025-02-12
431458
432459
.. _quickstart-all-available-railway-stations:
433460

@@ -481,8 +508,11 @@ Here is a snapshot of the data contained in ``stn_loc_codes``:
481508
2901 Ystrad Mynach CAR 13m 60ch -3.2414 51.6414
482509
2902 Ystrad Rhondda THT 20m 05ch -3.4666 51.6436
483510
>>> print("Last updated date: {}".format(stn_loc_codes['Last updated date']))
484-
Last updated date: 2024-10-07
511+
Last updated date: 2025-02-26
485512
513+
>>> ## Try more examples! Uncomment the lines below and run:
514+
>>> # stn_loc_a_codes = em.fetch_locations('a') # railway stations starting with 'A'
515+
>>> # your_stn_loc_codes = em.fetch_locations('?') # ... and a given letter '?'
486516
487517
.. _quickstart-the-end:
488518

docs/source/requirements.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
beautifulsoup4
2-
pyhelpers>=2.0.0
3-
Sphinx==7.4.7
41
furo==2024.8.6
2+
pyhelpers==2.1.0
53
sphinx-copybutton==0.5.2
64
sphinx-new-tab-link==0.6.1
7-
sphinx-toggleprompt==0.5.2
5+
sphinx-toggleprompt==0.6.0

docs/source/utils.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ Print messages
3030
:toctree: _generated/
3131
:template: function.rst
3232

33-
confirm_msg
33+
format_confirmation_prompt
3434
print_collect_msg
3535
print_conn_err
36-
format_err_msg
3736
print_inst_conn_err
3837
print_void_msg
3938

@@ -44,8 +43,4 @@ Save and retrieve pre-packed data
4443
:toctree: _generated/
4544
:template: function.rst
4645

47-
init_data_dir
48-
make_file_pathname
4946
fetch_location_names_errata
50-
save_data_to_file
51-
fetch_data_from_file

0 commit comments

Comments
 (0)