From ce83e4115a684437efa79975dc56b997bf0e4b43 Mon Sep 17 00:00:00 2001 From: Clint Daniels Date: Wed, 11 Oct 2017 13:58:34 -0700 Subject: [PATCH 1/6] Resolve Issue #13. Clean-up GTFS feed before sending it into Fast-Trips. --- Tutorial #4 - Create Your Own.ipynb | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Tutorial #4 - Create Your Own.ipynb b/Tutorial #4 - Create Your Own.ipynb index bb23ecc..5329c20 100644 --- a/Tutorial #4 - Create Your Own.ipynb +++ b/Tutorial #4 - Create Your Own.ipynb @@ -70,6 +70,41 @@ "os.remove(tempzip_filename)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Clean-Up GoRaleigh Feed\n", + "The GTFS feed has orphan records. The following scripts remove the orphan records." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "calendar_df = pd.read_csv(os.path.join(GTFS_LOC, 'calendar.txt'), index_col='service_id')\n", + "calendar_dt_df = pd.read_csv(os.path.join(GTFS_LOC, 'calendar_dates.txt'))\n", + "\n", + "frequencies_df = pd.read_csv(os.path.join(GTFS_LOC, 'frequencies.txt'))\n", + "stop_time_df = pd.read_csv(os.path.join(GTFS_LOC, 'stop_times.txt'))\n", + "trips_df = pd.read_csv(os.path.join(GTFS_LOC, 'trips.txt'), index_col='trip_id')\n", + "\n", + "trips_df = trips_df[trips_df['service_id'].isin(calendar_df.index)]\n", + "calendar_dt_df = calendar_dt_df[calendar_dt_df['service_id'].isin(calendar_df.index)]\n", + "\n", + "frequencies_df = frequencies_df[frequencies_df['trip_id'].isin(trips_df.index)]\n", + "stop_time_df = stop_time_df[stop_time_df['trip_id'].isin(trips_df.index)]\n", + "\n", + "calendar_dt_df.to_csv(os.path.join(GTFS_LOC, 'calendar_dates.txt'), index=False)\n", + "frequencies_df.to_csv(os.path.join(GTFS_LOC, 'frequencies.txt'), index=False)\n", + "stop_time_df.to_csv(os.path.join(GTFS_LOC,'stop_times.txt'), index=False)\n", + "trips_df.to_csv(os.path.join(GTFS_LOC, 'trips.txt'))" + ] + }, { "cell_type": "markdown", "metadata": {}, From 9a3f7e3a5c170d65cc4eba1108ff0adb18dcb040 Mon Sep 17 00:00:00 2001 From: Clint Daniels Date: Wed, 11 Oct 2017 14:00:08 -0700 Subject: [PATCH 2/6] Output visualization to the screen. --- Tutorial #4 - Create Your Own.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tutorial #4 - Create Your Own.ipynb b/Tutorial #4 - Create Your Own.ipynb index 5329c20..452853b 100644 --- a/Tutorial #4 - Create Your Own.ipynb +++ b/Tutorial #4 - Create Your Own.ipynb @@ -515,7 +515,7 @@ "all_lines = Bar(final_vehicles_df, \"route_id\", values='boards', stack='trip_id',title=\"Boardings by Route\",legend=False,\n", " xlabel=\"Route ID\", ylabel=\"Boardings\",tooltips=tooltips)\n", "\n", - "ridership = show(all_lines, notebook_handle=True)" + "show(all_lines, notebook_handle=True)" ] }, { From 58f9960f82e30611992fee8e984809a615983e7b Mon Sep 17 00:00:00 2001 From: Clint Daniels Date: Wed, 11 Oct 2017 14:02:26 -0700 Subject: [PATCH 3/6] Remove user specific pathing in the tutorials. --- Tutorial #4 - Create Your Own.ipynb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Tutorial #4 - Create Your Own.ipynb b/Tutorial #4 - Create Your Own.ipynb index 452853b..9e70541 100644 --- a/Tutorial #4 - Create Your Own.ipynb +++ b/Tutorial #4 - Create Your Own.ipynb @@ -34,11 +34,12 @@ }, "outputs": [], "source": [ - "GTFS_LINK = r\"http://admin.gotransitnc.org/sites/default/files/developergtfs/GoRaleigh_GTFS_0.zip\"\n", + "GTFS_LINK = r\"http://admin.gotransitnc.org/sites/default/files/developergtfs/GoRaleigh_GTFS_0.zip\"\n", "\n", - "BASE_DIR = r\"C:\\Users\\lzorn\\Documents\\fast-trips-tutorial\"\n", - "NEW_FOLDER = \"GoRaleigh_GTFS\"\n", - "GTFS_LOC = os.path.join(BASE_DIR,NEW_FOLDER)" + "### REPLACE THIS WITH YOUR OWN DIRECTORY\n", + "BASE_DIR = r\"YOUR PATH TO THE TUTORIAL DIRECTORY\"\n", + "NEW_FOLDER = \"GoRaleigh_GTFS\"\n", + "GTFS_LOC = os.path.join(BASE_DIR,NEW_FOLDER)" ] }, { From c7b0541fc80e6afe5eb3aa8c6b1fbb26c7b3f8e3 Mon Sep 17 00:00:00 2001 From: Clint Daniels Date: Fri, 13 Oct 2017 16:25:55 -0700 Subject: [PATCH 4/6] Add network_build_date and update "fake" GTFS feed calendars to be consistent with date. --- tta/input/demand-bigger/config_ft.txt | 1 + tta/input/demand-single/config_ft.txt | 1 + tta/input/network-added-route/calendar.txt | 2 +- tta/input/network-simple/calendar.txt | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tta/input/demand-bigger/config_ft.txt b/tta/input/demand-bigger/config_ft.txt index 5cfde42..5cd2341 100644 --- a/tta/input/demand-bigger/config_ft.txt +++ b/tta/input/demand-bigger/config_ft.txt @@ -1,6 +1,7 @@ # configuration for fasttrips [fasttrips] simulation = True +network_build_date = 05/24/2017 output_passenger_trajectories = True create_skims = False prepend_route_id_to_trip_id = True diff --git a/tta/input/demand-single/config_ft.txt b/tta/input/demand-single/config_ft.txt index a449740..96dc6c5 100644 --- a/tta/input/demand-single/config_ft.txt +++ b/tta/input/demand-single/config_ft.txt @@ -1,6 +1,7 @@ # configuration for fasttrips [fasttrips] max_iterations = 1 +network_build_date = 05/24/2017 simulation = True output_passenger_trajectories = True create_skims = False diff --git a/tta/input/network-added-route/calendar.txt b/tta/input/network-added-route/calendar.txt index c29a22d..abe171c 100644 --- a/tta/input/network-added-route/calendar.txt +++ b/tta/input/network-added-route/calendar.txt @@ -1,2 +1,2 @@ service_id,monday ,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date -TTA,1,1,1,1,1,1,1,20150101,20151231 +TTA,1,1,1,1,1,1,1,20170101,20171231 diff --git a/tta/input/network-simple/calendar.txt b/tta/input/network-simple/calendar.txt index c29a22d..abe171c 100644 --- a/tta/input/network-simple/calendar.txt +++ b/tta/input/network-simple/calendar.txt @@ -1,2 +1,2 @@ service_id,monday ,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date -TTA,1,1,1,1,1,1,1,20150101,20151231 +TTA,1,1,1,1,1,1,1,20170101,20171231 From e1fca887a061d743bc1b3e7cc3e365913b44a15e Mon Sep 17 00:00:00 2001 From: Clint Daniels Date: Fri, 13 Oct 2017 16:27:02 -0700 Subject: [PATCH 5/6] Update OD pair to be valid with network_build_date. --- Tutorial #4 - Create Your Own.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tutorial #4 - Create Your Own.ipynb b/Tutorial #4 - Create Your Own.ipynb index 9e70541..e63ae79 100644 --- a/Tutorial #4 - Create Your Own.ipynb +++ b/Tutorial #4 - Create Your Own.ipynb @@ -337,8 +337,8 @@ }, "outputs": [], "source": [ - "ORIGIN_STOP = \"776415\"\n", - "DESTINATION_STOP = \"777546\"\n", + "ORIGIN_STOP = \"776182\"\n", + "DESTINATION_STOP = \"776185\"\n", "\n", "with open(os.path.join(OUTPUT_DIR,'walk_access_ft.txt'),'wb') as f:\n", " f.write(\"taz,stop_id,direction,dist\\n\")\n", From 0aa02e2432ddadb9d7bdec8eae209163dfcba73b Mon Sep 17 00:00:00 2001 From: Clint Daniels Date: Fri, 13 Oct 2017 16:41:23 -0700 Subject: [PATCH 6/6] Remove trip clean-up. This has no been resolved in the fast-trips develop branch to use a network_build_date. --- Tutorial #4 - Create Your Own.ipynb | 35 ----------------------------- 1 file changed, 35 deletions(-) diff --git a/Tutorial #4 - Create Your Own.ipynb b/Tutorial #4 - Create Your Own.ipynb index e63ae79..546256f 100644 --- a/Tutorial #4 - Create Your Own.ipynb +++ b/Tutorial #4 - Create Your Own.ipynb @@ -71,41 +71,6 @@ "os.remove(tempzip_filename)" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Clean-Up GoRaleigh Feed\n", - "The GTFS feed has orphan records. The following scripts remove the orphan records." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [ - "calendar_df = pd.read_csv(os.path.join(GTFS_LOC, 'calendar.txt'), index_col='service_id')\n", - "calendar_dt_df = pd.read_csv(os.path.join(GTFS_LOC, 'calendar_dates.txt'))\n", - "\n", - "frequencies_df = pd.read_csv(os.path.join(GTFS_LOC, 'frequencies.txt'))\n", - "stop_time_df = pd.read_csv(os.path.join(GTFS_LOC, 'stop_times.txt'))\n", - "trips_df = pd.read_csv(os.path.join(GTFS_LOC, 'trips.txt'), index_col='trip_id')\n", - "\n", - "trips_df = trips_df[trips_df['service_id'].isin(calendar_df.index)]\n", - "calendar_dt_df = calendar_dt_df[calendar_dt_df['service_id'].isin(calendar_df.index)]\n", - "\n", - "frequencies_df = frequencies_df[frequencies_df['trip_id'].isin(trips_df.index)]\n", - "stop_time_df = stop_time_df[stop_time_df['trip_id'].isin(trips_df.index)]\n", - "\n", - "calendar_dt_df.to_csv(os.path.join(GTFS_LOC, 'calendar_dates.txt'), index=False)\n", - "frequencies_df.to_csv(os.path.join(GTFS_LOC, 'frequencies.txt'), index=False)\n", - "stop_time_df.to_csv(os.path.join(GTFS_LOC,'stop_times.txt'), index=False)\n", - "trips_df.to_csv(os.path.join(GTFS_LOC, 'trips.txt'))" - ] - }, { "cell_type": "markdown", "metadata": {},