diff --git a/.nojekyll b/.nojekyll index ca12c5b..9273a9e 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -f78dddcd \ No newline at end of file +daed3880 \ No newline at end of file diff --git a/docs/explanation/index.html b/docs/explanation/index.html index 77a72a2..ddc6040 100644 --- a/docs/explanation/index.html +++ b/docs/explanation/index.html @@ -252,7 +252,7 @@

Inspecting GTFS

Validating GTFS

When working with GTFS from a range of sources, it is important to understand whether the feed you intend to use is compliant. Online tools like that available on the French government’s Transport Data Portal are excellent choices for manual validation of a small number of feeds.

assess-gtfs produces tabular outputs for specification warnings and errors using gtfs_kit under the hood. Note that not all of these errors are as severe as they initially appear. For example, the below validation table is commonly seen when validating British GTFS:

-
+
@@ -340,7 +340,7 @@

Validating GTFS

The first row in the validity table shows an apparent error, reporting “Invalid route_type; maybe has extra space characters”. Examining the routes table for the affected rows:

-
+
0      3
 1    200
diff --git a/docs/getting_started/index.html b/docs/getting_started/index.html
index e80c706..c685128 100644
--- a/docs/getting_started/index.html
+++ b/docs/getting_started/index.html
@@ -228,7 +228,7 @@ 

Installation

pip install assess-gtfs

To use assess-gtfs, you will need a source of GTFS data. To locate your own, follow the how-to on GTFS data.

Alternatively, you can use the small GTFS fixture that is bundled with the assess_gtfs package.

-
+
import glob
 import os
 
@@ -239,7 +239,7 @@ 

Installation

gtfs = MultiGtfsInstance(glob.glob(gtfs_pth + "/*.zip")) gtfs.is_valid()
-
  0%|          | 0/1 [00:00<?, ?it/s]Validating GTFS from path /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/assess_gtfs/data/newport-20230613_gtfs.zip:   0%|          | 0/1 [00:00<?, ?it/s]Validating GTFS from path /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/assess_gtfs/data/newport-20230613_gtfs.zip: 100%|██████████| 1/1 [00:00<00:00,  7.06it/s]Validating GTFS from path /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/assess_gtfs/data/newport-20230613_gtfs.zip: 100%|██████████| 1/1 [00:00<00:00,  7.03it/s]
+
  0%|          | 0/1 [00:00<?, ?it/s]Validating GTFS from path /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/assess_gtfs/data/newport-20230613_gtfs.zip:   0%|          | 0/1 [00:00<?, ?it/s]Validating GTFS from path /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/assess_gtfs/data/newport-20230613_gtfs.zip: 100%|██████████| 1/1 [00:00<00:00,  6.81it/s]Validating GTFS from path /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/assess_gtfs/data/newport-20230613_gtfs.zip: 100%|██████████| 1/1 [00:00<00:00,  6.78it/s]
diff --git a/docs/tutorials/index.html b/docs/tutorials/index.html index 472a787..8afadd6 100644 --- a/docs/tutorials/index.html +++ b/docs/tutorials/index.html @@ -291,7 +291,7 @@

Requirements

Working With GTFS

Let’s import the necessary dependencies:

-
+
import datetime
 import os
 import pathlib
@@ -313,7 +313,7 @@ 

Working With GTFS

You may wish to manually download at least one GTFS feed and store somewhere in your file system. Alternatively you may programmatically download the data, as in the solution here.

-
+
BUS_URL = "<INSERT_SOME_URL_TO_BUS_GTFS>"
 RAIL_URL = "<INSERT_SOME_URL_TO_RAIL_GTFS>"
 
@@ -325,7 +325,7 @@ 

Working With GTFS

-
+
BUS_URL = "https://tsvc.pilote4.cityway.fr/api/Export/v1/GetExportedDataFile?ExportFormat=Gtfs&OperatorCode=RTM"
 RAIL_URL = "https://eu.ftp.opendatasoft.com/sncf/gtfs/export-intercites-gtfs-last.zip"
 # using tmp for tutorial but not necessary
@@ -337,13 +337,13 @@ 

Working With GTFS

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
-  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0 16 3931k   16  642k    0     0   380k      0  0:00:10  0:00:01  0:00:09  380k 93 3931k   93 3676k    0     0  1365k      0  0:00:02  0:00:02 --:--:-- 1365k100 3931k  100 3931k    0     0  1436k      0  0:00:02  0:00:02 --:--:-- 1436k
+  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0 68 3931k   68 2685k    0     0  1681k      0  0:00:02  0:00:01  0:00:01 1681k100 3931k  100 3931k    0     0  2273k      0  0:00:01  0:00:01 --:--:-- 2273k
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
-  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0100 91397  100 91397    0     0   161k      0 --:--:-- --:--:-- --:--:--  161k
+ 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0100 91397 100 91397 0 0 195k 0 --:--:-- --:--:-- --:--:-- 196k
-
CompletedProcess(args=['curl', 'https://eu.ftp.opendatasoft.com/sncf/gtfs/export-intercites-gtfs-last.zip', '-o', '/tmp/tmp8s_537sp/intercity_rail_gtfs.zip'], returncode=0)
+
CompletedProcess(args=['curl', 'https://eu.ftp.opendatasoft.com/sncf/gtfs/export-intercites-gtfs-last.zip', '-o', '/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip'], returncode=0)
@@ -359,14 +359,14 @@

Working With GTFS

Instantiate a feed object by pointing the MultiGtfsInstance class at a path to the GTFS feed(s) that you have downloaded. Once you have successfully instantiated feed, inspect the correct attribute in order to confirm the number of separate feeds instances contained within it.

-
+
gtfs_pth = "<INSERT_PATH_TO_GTFS>"
 feed = MultiGtfsInstance(path=gtfs_pth)
 print(len(feed.<INSERT_CORRECT_ATTRIBUTE>))
-
+
gtfs_pth = pathlib.Path(tmp_path.name) # need to use pathlib for tmp_path
 feed = MultiGtfsInstance(path=gtfs_pth)
 print(f"There are {len(feed.instances)} feed instances")
@@ -385,14 +385,14 @@

Working With GTFS

By accessing the appropriate attribute, print out the first 5 stops of the first instance within the feed object.

-
+
feed.<INSERT_CORRECT_ATTR>[0].feed.stops.<INSERT_CORRECT_METHOD>(5)

These records will match the contents of the stops.txt file within the feed that you downloaded.


-
+
feed.instances[0].feed.stops.head(5)
@@ -487,7 +487,7 @@

Working With GTFS

Checking Validity

Transport routing operations require services that run upon a specified date. It is a useful sanity check to confirm that the dates that you expect to perform routing on exist within the GTFS feed. To do this, we can use the get_dates() method to print out the first and last date in the available date range, as below.

-
+
s0, e0 = feed.get_dates()
 print(f"Feed starts at: {s0}\nFeed ends at: {e0}")
@@ -506,7 +506,7 @@

Checking Validity

-
+
feed.get_dates(return_range=False)
['20240703',
@@ -619,10 +619,10 @@ 

Checking Validity

-
+
feed.is_valid()
-
  0%|          | 0/2 [00:00<?, ?it/s]Validating GTFS from path /tmp/tmp8s_537sp/intercity_rail_gtfs.zip:   0%|          | 0/2 [00:00<?, ?it/s]Validating GTFS from path /tmp/tmp8s_537sp/intercity_rail_gtfs.zip:  50%|█████     | 1/2 [00:00<00:00,  4.84it/s]Validating GTFS from path /tmp/tmp8s_537sp/rtm_gtfs.zip:  50%|█████     | 1/2 [00:00<00:00,  4.84it/s]           Validating GTFS from path /tmp/tmp8s_537sp/rtm_gtfs.zip: 100%|██████████| 2/2 [00:02<00:00,  1.68s/it]Validating GTFS from path /tmp/tmp8s_537sp/rtm_gtfs.zip: 100%|██████████| 2/2 [00:02<00:00,  1.46s/it]
+
  0%|          | 0/2 [00:00<?, ?it/s]Validating GTFS from path /tmp/tmpxzeeqykk/intercity_rail_gtfs.zip:   0%|          | 0/2 [00:00<?, ?it/s]Validating GTFS from path /tmp/tmpxzeeqykk/intercity_rail_gtfs.zip:  50%|█████     | 1/2 [00:00<00:00,  4.80it/s]Validating GTFS from path /tmp/tmpxzeeqykk/rtm_gtfs.zip:  50%|█████     | 1/2 [00:00<00:00,  4.80it/s]           Validating GTFS from path /tmp/tmpxzeeqykk/rtm_gtfs.zip: 100%|██████████| 2/2 [00:02<00:00,  1.70s/it]Validating GTFS from path /tmp/tmpxzeeqykk/rtm_gtfs.zip: 100%|██████████| 2/2 [00:02<00:00,  1.48s/it]
@@ -646,7 +646,7 @@

Checking Validity

Unrecognized column feed_id feed_info [] -/tmp/tmp8s_537sp/intercity_rail_gtfs.zip +/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip 1 @@ -654,7 +654,7 @@

Checking Validity

Unrecognized column conv_rev feed_info [] -/tmp/tmp8s_537sp/intercity_rail_gtfs.zip +/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip 2 @@ -662,7 +662,7 @@

Checking Validity

Unrecognized column plan_rev feed_info [] -/tmp/tmp8s_537sp/intercity_rail_gtfs.zip +/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip 3 @@ -670,7 +670,7 @@

Checking Validity

Repeated pair (route_short_name, route_long_name) routes [16, 17, 18, 19, 20] -/tmp/tmp8s_537sp/intercity_rail_gtfs.zip +/tmp/tmpxzeeqykk/intercity_rail_gtfs.zip 4 @@ -678,7 +678,7 @@

Checking Validity

Repeated pair (trip_id, departure_time) stop_times [1352, 1361, 1363, 1367, 1372, 1375, 1377, 138... -/tmp/tmp8s_537sp/rtm_gtfs.zip +/tmp/tmpxzeeqykk/rtm_gtfs.zip 5 @@ -686,7 +686,7 @@

Checking Validity

Stop has no stop times stops [146, 1498, 1499, 2130] -/tmp/tmp8s_537sp/rtm_gtfs.zip +/tmp/tmpxzeeqykk/rtm_gtfs.zip @@ -712,12 +712,12 @@

Viz Stops

Inspect the MultiGtfsInstance api reference for the appropriate method.

-
+
feed.viz_...()
-
+
feed.viz_stops()
Make this Notebook Trusted to load map: File -> Trust Notebook
@@ -1059,10 +1059,10 @@

By Bounding Box

Pass the BBOX list in [xmin, ymin, xmax, ymax] order to the filter_to_bbox() method.

-
+
feed.filter_to_bbox(BBOX)
-
  0%|          | 0/2 [00:00<?, ?it/s]Filtering GTFS from path /tmp/tmp8s_537sp/intercity_rail_gtfs.zip:   0%|          | 0/2 [00:00<?, ?it/s]Filtering GTFS from path /tmp/tmp8s_537sp/rtm_gtfs.zip:   0%|          | 0/2 [00:00<?, ?it/s]           Filtering GTFS from path /tmp/tmp8s_537sp/rtm_gtfs.zip: 100%|██████████| 2/2 [00:00<00:00,  7.48it/s]Filtering GTFS from path /tmp/tmp8s_537sp/rtm_gtfs.zip: 100%|██████████| 2/2 [00:00<00:00,  7.46it/s]
+
  0%|          | 0/2 [00:00<?, ?it/s]Filtering GTFS from path /tmp/tmpxzeeqykk/intercity_rail_gtfs.zip:   0%|          | 0/2 [00:00<?, ?it/s]Filtering GTFS from path /tmp/tmpxzeeqykk/rtm_gtfs.zip:   0%|          | 0/2 [00:00<?, ?it/s]           Filtering GTFS from path /tmp/tmpxzeeqykk/rtm_gtfs.zip: 100%|██████████| 2/2 [00:00<00:00,  5.81it/s]Filtering GTFS from path /tmp/tmpxzeeqykk/rtm_gtfs.zip: 100%|██████████| 2/2 [00:00<00:00,  5.80it/s]
@@ -1070,7 +1070,7 @@

By Bounding Box

Notice that a progress bar confirms the number of successful filter operations performed depending on the number of separate GTFS zip files passed to MultiGtfsInstance.

Below I plot the filtered feed stop locations in relation to the bounding box used to restrict the feed’s extent.

-
+
imap = feed.viz_stops()
 poly_gdf.explore(m=imap)
@@ -1101,7 +1101,7 @@

By Bounding Box