Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
24ad5c8
Optionally store generic x and y in a Node.
sdrewc Oct 21, 2015
cb1b98f
let Wrangler import modules in _static
sdrewc Oct 21, 2015
8ba5007
fix links -> link.csv, nodes -> nodes.csv
sdrewc Oct 21, 2015
8388ac0
this is taken care of in Wrangler itself now.
sdrewc Oct 21, 2015
1a1acf5
so _static is treated as a module and can be imported.
sdrewc Oct 21, 2015
71673ee
Add functionality to:
sdrewc Oct 21, 2015
76d75a8
script (in progress) to convert CHAMP-style Cube network to fast-trip…
sdrewc Oct 21, 2015
8673dc3
in writeFastTrips_Shape, only write the last node when it is actually…
sdrewc Oct 21, 2015
b26be3c
fix typos of 'link' where should be 'line'. Fix argument order when …
sdrewc Oct 21, 2015
8d94c9d
rename writeFastTrips_StopTimes -> writeFastTrips_Trips,
sdrewc Oct 21, 2015
ffda858
Update conversion script to write out shapes.txt, trips.txt, and stop…
sdrewc Oct 21, 2015
e3ddca5
FareParser and Fare class initial commit. Work-in-progress.
sdrewc Nov 10, 2015
c1cbd50
Commit working FareParser and Fares with ODFare, XFFare and FarelinkF…
sdrewc Nov 23, 2015
14d83f2
Add Fares to TransitParser
sdrewc Dec 5, 2015
3a88680
Updates to Fares to support fast-trips
sdrewc Dec 5, 2015
ee3341e
add function to get index of a node in the node sequence
sdrewc Dec 5, 2015
4e8a458
Move generic functions to HelperFunctions. may rename in the future.
sdrewc Dec 5, 2015
27191cf
Add boolean type functions.
sdrewc Dec 7, 2015
ad8e9b8
Fix bug in boilDown to include crosses with right_split. Add function
sdrewc Dec 7, 2015
43e4355
Function to create non-overlapping zones based on Farelinks
sdrewc Dec 7, 2015
1c86634
Move lookups to WranglerLookups.
sdrewc Dec 9, 2015
11bfa0f
added linename_pattern to match champ-style transit line names
sdrewc Dec 9, 2015
08671ab
Add logic to roll fares into lines and calculate stop-to-stop fares
sdrewc Dec 9, 2015
b49589f
fix typos.
sdrewc Dec 9, 2015
c74d6cc
Add zone creation to conversion script
sdrewc Dec 9, 2015
5f39974
Updates to lookups
sdrewc Dec 11, 2015
d36fc8f
Updates to fare structures and bug fixes
sdrewc Dec 11, 2015
57c4f0a
Bug fixes to FastTripsFare creation and minor reorg.
sdrewc Dec 11, 2015
87ec7d7
Update script with newly added functions
sdrewc Dec 11, 2015
96237c3
minor cleanup
sdrewc Dec 11, 2015
92acfdb
Fixes to fare logic in getFastTripsFareRules_asList
sdrewc Dec 11, 2015
88dff09
minor bug fixes
sdrewc Dec 12, 2015
b84eb1c
make sure to check the mode of the farelink against the transit line …
sdrewc Dec 12, 2015
80a992f
Move reproject function to HelperFunctions
sdrewc Dec 16, 2015
4657e17
Add functions for OD Fares, move node_to_zone and zone_to_nodes dicts…
sdrewc Dec 16, 2015
6973529
Add functions to write fasttrips stops and fares
sdrewc Dec 16, 2015
9c56bc8
Add functions for OD Fares
sdrewc Dec 16, 2015
cf2c230
Moved into TransitParser
sdrewc Dec 16, 2015
01f820c
Create a FastTripsFare object. All Fare objects support some fast-tr…
sdrewc Dec 16, 2015
16c9eb0
updated to use new NW fast-trips functions (stops and fares).
sdrewc Dec 16, 2015
88b40fb
bug fixes.
sdrewc Dec 16, 2015
f5148a1
Flesh out and correct logic for setting fare_id and other fare attrib…
sdrewc Dec 18, 2015
3ead577
Added functions to convert time-past-midnight to hhmmss, and a regex …
sdrewc Dec 28, 2015
b6f6010
Add FastTrips classes of Supplinks
sdrewc Dec 28, 2015
4501c79
Move lookups to WranglerLookups. Add function to add vehicle types b…
sdrewc Dec 28, 2015
2f5779b
Parse and merge supplinks into a transit network, translate them into…
sdrewc Dec 28, 2015
fb9a86d
Add FastTripsTransferFare object. Modify setFareId with some SF-spec…
sdrewc Dec 29, 2015
7f0ad68
update asList and asDataFrame to use a list variable instead of *args
sdrewc Dec 29, 2015
5da49e3
Add a mode heirarchy to WranglerLookups.
sdrewc Dec 29, 2015
b9af42f
1. Only read AM walk supplinks because they should be the same for al…
sdrewc Dec 29, 2015
1fb3452
restructure convert_cube_to_fasttrips to flow logically, more readabl…
sdrewc Dec 30, 2015
4be6a9f
Merge pull request #8 from sdrewc/fasttrips
sdrewc Dec 30, 2015
3bbb49c
Change the suffixing of fare_ids to allow '_zone_x_to_y' suffix to be…
sdrewc Dec 30, 2015
f527a17
Allow calculation of fares on lines with both OD and Farelinks fares.…
sdrewc Dec 30, 2015
3b5e3e6
bug fix.
sdrewc Dec 30, 2015
39c0326
Merge pull request #9 from sdrewc/fasttrips
sdrewc Dec 30, 2015
31a09ff
Move fasttrips-specific stuff into FastTripsTransitLine. Some stuff …
sdrewc Dec 31, 2015
9a84c31
Add URL lookups, offboard payment agency lookups
sdrewc Feb 1, 2016
1ffe44c
Put Regexes in a class to make Override behavior more clear.
sdrewc Feb 1, 2016
d6bd538
1. Add lookups for offboard payment
sdrewc Feb 1, 2016
8f69a04
1. Fix bug so that 00:60 becomes 01:00.
sdrewc Feb 2, 2016
ce42ad8
1. Add OD Fare nodes as zones
sdrewc Feb 2, 2016
9c8a06c
Clean up imports and paths
sdrewc Feb 2, 2016
8bb6034
1. Add script options
sdrewc Feb 2, 2016
0125a54
add network config examples
sdrewc Feb 2, 2016
77dd504
1. Renamed pnr.txt to drive_access_points_ft.txt
sdrewc Feb 6, 2016
c2a8d6f
Merge pull request #15 from sdrewc/fasttrips
sdrewc Feb 6, 2016
f7349e4
minor bug fixes.
sdrewc Feb 12, 2016
6087f40
allow user to specify whether fare outputs are sorted (for test netwo…
sdrewc Feb 12, 2016
02c173c
Reorganize config files, change paths to generic. config_testnet now…
sdrewc Feb 12, 2016
068862e
Include test network inputs (unittests/test_cube_to_fasttrips_input) …
sdrewc Feb 12, 2016
a6ebd10
Update .gitignore
sdrewc Feb 12, 2016
d9939df
Add try...catch blocks under supplinks stuff because supplinks need C…
sdrewc Feb 12, 2016
0b618a8
Removing these log files created by Cube
sdrewc Feb 12, 2016
475c444
gitignore cube log files
sdrewc Feb 12, 2016
bf51dc2
Merge pull request #18 from sdrewc/fasttrips
sdrewc Feb 12, 2016
4f0dbcc
add PM for parkmerced shuttle, for future years
sdrewc Mar 25, 2016
bc541f8
1. schedule all trip departure times, rather than calculating them wh…
sdrewc Mar 25, 2016
7c53327
Allow no Cube network to be passed, if using already-exported link an…
sdrewc Mar 25, 2016
c15d61f
add incomplete unit tests
sdrewc Mar 25, 2016
ffdc5b1
Allow grabbing of trip departure times from GTFS
sdrewc Apr 1, 2016
5cc4d60
some nomenclature and organizational changes
sdrewc Apr 9, 2016
c2cfc8d
additional gtfs-plus info, changes to how route info is set, allow se…
sdrewc Apr 9, 2016
3744e3a
location-based matching of lines to routes in a published gtfs feed, …
sdrewc Apr 9, 2016
73ab9e4
1. clear out logging that was just included for initial debugging.
sdrewc Apr 9, 2016
82204b0
take a dict of gtfs feeds to handle multiple agencies
sdrewc Apr 18, 2016
90de373
add gtfs_utils 0.1 to _static
sdrewc Apr 19, 2016
9c27160
hacky attempt at integrating a priori route crosswalk to aid map-matc…
sdrewc Apr 27, 2016
f15a3dd
gtfs_utils 0.1.1: add service_id to idx columns for grouping, and all…
sdrewc Apr 27, 2016
492b266
reworking of the way gtfs feeds and crosswalks are fed in, and removi…
sdrewc Apr 27, 2016
0e3c851
-Move match score to getMatchScore and clean up
sdrewc May 25, 2016
70cda50
remove muni skip and remove route_crosswalk since it's using matchLin…
sdrewc May 26, 2016
edc9ce4
Merge pull request #21 from sdrewc/fasttrips
sdrewc May 26, 2016
007f748
Use the supplink distance from CHAMP as a default, and just get the s…
sdrewc Jun 24, 2016
8ebba3c
Fix travel time calculation, set direction_id default to 0, remove "n…
sdrewc Jun 24, 2016
a1d596b
rename "fare_transfer_rules.txt" -> "fare_transfer_rules_ft.txt"
sdrewc Jun 24, 2016
ffdb15c
Check reverse-links for travel time, and add check on 0-min travel times
sdrewc Jun 24, 2016
abcfc89
remove commented-out code
sdrewc Jun 29, 2016
e4ca401
1. pnr node numbers are stored as strings; update if-statement to ref…
sdrewc Jun 29, 2016
fd57453
Funnels go both ways, so need to check both A and B nodes for connect…
sdrewc Jun 30, 2016
c0e3d4e
change order of operations so supplinks happen after nodes and stops …
sdrewc Jun 30, 2016
4d1ab2a
add comments to make units more clear. Move unit conversions to the …
sdrewc Jun 30, 2016
08c76c9
Merge pull request #22 from sdrewc/fasttrips
sdrewc Jun 30, 2016
128791c
Funnels often have dist=0, so don't override that with a skim distance.
sdrewc Jun 30, 2016
b52627d
Merge pull request #23 from sdrewc/fasttrips
sdrewc Jun 30, 2016
21c42d2
route_short_name and route_long_name can't be the CHAMP line name bec…
sdrewc Jul 7, 2016
8a9052e
Add reverse overload that sets the direction_id to opposite of whatev…
sdrewc Jul 7, 2016
0e3369a
Change reverse flag from "R" to "_R" to eliminate confusion with rapi…
sdrewc Jul 7, 2016
e0afca4
update directional indicators in Regexes and TransitLine. Lowercase …
sdrewc Jul 20, 2016
76fe79a
get rid of direction_id logic; this is now handled elsewhere
sdrewc Jul 20, 2016
411ea86
add route_id arg
sdrewc Aug 29, 2016
ac152db
Removed redundant column fare_class from routes_ft
bhargavasana Aug 31, 2016
fb2b016
Merge pull request #24 from sdrewc/fasttrips
sdrewc Aug 31, 2016
316c3ab
Changes to fix missing access links to caltrain stops
bhargavasana Sep 16, 2016
57103b3
Merge pull request #25 from bhargavasana/fasttrips
bhargavasana Sep 16, 2016
0b0aa3b
v0.3 fare attribute updates
sdrewc Nov 8, 2016
f6b9f42
Remove unused attributes, and add fasttrips_fares as an attribute dur…
sdrewc Nov 8, 2016
6666a92
Updates to crosswalk algorithm.
sdrewc Nov 8, 2016
e4679e2
stores reverse-direction attributes for FastTripsWalkSupplinks so the…
sdrewc Nov 8, 2016
f5116e1
skips non-am transit transfers (if walk_am_only) because those are id…
sdrewc Nov 8, 2016
928ce7f
v0.3 transfer fare updates
sdrewc Nov 8, 2016
222f0e8
v0.3 update fare_class -> fare_period
sdrewc Nov 16, 2016
18c474f
v0.3 add price_conversion back in
sdrewc Nov 16, 2016
e7271a6
v0.3 sorts access links by default. Fixes bug that where a bunch of …
sdrewc Nov 16, 2016
b49c908
v0.3 adds direction field, and corrects reverse function so supplink …
sdrewc Nov 16, 2016
dbf4bdf
creates setDirection function for subclass
sdrewc Nov 17, 2016
9957c3d
v0.3 gets egress links, and fixes column errors when compiling/export…
sdrewc Nov 17, 2016
a0576f6
v0.3 timeperiods are assumed [a,b) (so get rid of the :59:59)
sdrewc Nov 17, 2016
c71da4d
v0.3 writes out zones, catch exceptions when copying to csv
sdrewc Nov 17, 2016
5226f96
refactors supplink generation, gets rid of some unused code
sdrewc Nov 21, 2016
20ec762
corrects typo
sdrewc Nov 21, 2016
95f8e48
Adds function to reverse ODFares. Sets transfer_fare_type to 'transf…
sdrewc Nov 30, 2016
f99cb14
flip from_stop_id and to_stop_id, and schedule_precedence when revers…
sdrewc Nov 30, 2016
eac66e9
prepend 'lot_' to from_ or to_ stop_id if it's not a transit stop
sdrewc Nov 30, 2016
5c01436
Bug fixes for access links: create dummy supplink with desired attrib…
sdrewc Apr 21, 2017
dd9c732
creates PNRs before doing supplinks, because supplinks need the PNRs
sdrewc Apr 21, 2017
c1d612d
minor mod to string format change to handle "lot_" prefix
sdrewc Apr 21, 2017
bbcc598
Creates FastTripsPNRNode subclass
sdrewc Apr 26, 2017
59b0b75
pull in lot capacities and costs from a dataframe, and add KNRs to ra…
sdrewc Apr 26, 2017
5704594
read a PNR file in as a dataframe to get PNR attributes
sdrewc Apr 26, 2017
6a6208e
add lot_lat and lot_lon because they're GTFS-Plus attributes. ispnr …
sdrewc Apr 28, 2017
2a1333c
use nodeToTaz when pnrNodeToTaz fails, for knrs that were added where…
sdrewc Apr 28, 2017
98b1b2e
gives PNR/KNR node different number than its station, and adds drive …
sdrewc Apr 28, 2017
6118719
Get zone_id from kwargs
sdrewc May 4, 2017
093325b
bug fix: use node_to_zone if no zone_id in kwargs. Also default zone…
sdrewc May 4, 2017
dbdf544
set a zone_id with a function. Use zone_id to get skims if present, …
sdrewc May 4, 2017
ed17fd1
pass a dictionary to set pnr attributes. Create KNRs with access sup…
sdrewc May 4, 2017
24600a6
get node_to_taz before creating PNRs
sdrewc May 4, 2017
0946d89
Merge pull request #26 from sdrewc/fasttrips
sdrewc May 4, 2017
81a03d8
"headers" should be "header"
sdrewc Jun 6, 2017
9a1502d
Specify a random seed
sdrewc Jun 19, 2017
6111c42
Merge pull request #30 from sdrewc/fasttrips
sdrewc Jun 1, 2018
6628d18
Add readme.txt
Jun 1, 2018
0d7af41
Merge pull request #31 from sdrewc/fasttrips
sdrewc Jun 1, 2018
a5cc6a0
Move readme to root, and update
Jun 7, 2018
90286f5
Merge pull request #32 from sdrewc/fasttrips
sdrewc Jun 7, 2018
5d4309e
Move license into main level
Jun 15, 2018
63f2405
update README to be comprehensive of entire project
Jun 15, 2018
f1459bd
markdown fixes
Jun 15, 2018
43de0e4
Merge pull request #33 from sdrewc/fasttrips
sdrewc Jun 15, 2018
00c7343
Adjust links to other parts of SHRP2 project
ddorinson Jun 15, 2018
d02bd19
Merge pull request #34 from ddorinson/patch-1
sdrewc Jun 15, 2018
404e189
Merge branch 'master' into fasttrips
sdrewc Jun 15, 2018
9ae5a97
Update readme
e-lo Jul 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,10 @@ coverage.xml
# Sphinx documentation
docs/_build/

# outputs from test network builds
unittests/test_cube_to_fasttrips_output/*

# cube log and proj files
TPPL*.PRN
TPPL.VAR
TPPL.PRJ
File renamed without changes.
57 changes: 45 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
NetworkWrangler
===============

NetworkWrangler is a python library that enables users to define roadway
and transit projects as collection of data files in a local git repository,
and then create networks by starting with a base network and applying a
set of projects to that base network.

The base network and resulting network are in the Citilabs Cube format (http://www.citilabs.com/software/cube/)
**version**: 2.1
**updated**: 14 June 2018
**authors**:

Contributors
=======
NetworkWrangler is the brainchild of Billy Charlton, who was the Deputy Director for Technology Services at SFCTA through 2011.
Contributors include:
* Elizabeth Sall, 2010-2014
Expand All @@ -18,13 +13,31 @@ Contributors include:
* Drew Cooper, 2013-Present
* Bhargava Sana, 2015-Present

NetworkWrangler is licensed under [BSD (3-clause version)](https://github.com/sfcta/NetworkWrangler/LICENSE)

NetworkWrangler has two primary functions:
1. Create Citilabs Cube networks for SF-CHAMP
2. Create GTFS-PLUS networks for Fast-Trips

## Creating Cube Networks for SF-CHAMP
NetworkWrangler is a python library that enables users to define roadway
and transit projects as collection of data files in a local git repository,
and then create networks by starting with a base network and applying a
set of projects to that base network.

The base network and resulting network are in the [Citilabs Cube](http://www.citilabs.com/software/cube/) format

## Creating GTFS-PLUS networks for Fast-Trips
NetworkWrangler is also a library that takes Cube networks prepared for SF-CHAMP,
along with various other (optional) inputs, and creates networks in [GTFS-PLUS](https://github.com/osplanning-data-standards/GTFS-PLUS), a [GTFS](https://developers.google.com/transit/gtfs/reference)-based network format developed for use with [Fast-Trips](https://github.com/BayAreaMetro/fast-trips), a dynamic transit
passenger assignment model.

Usage
=======

## Building Cube Networks for SF-CHAMP
Build a network by running the `build_network.py` script in the `/scripts` folder.

python build_network.py [-c configword] [-m test] network_specification.py

python build_network.py [-c configword] [-m test] network_specification.py

This will build a network using the specifications in `network_specification.py`, which should define the variables listed below (in this script)

Expand All @@ -34,4 +47,24 @@ If test mode is specified (with -m test), then the following happen:
* TAG is not used for TEST_PROJECTS

The [-c configword] is if you want an optional word for your network_specification.py
(e.g. to have multiple scenarios in one file). Access it via CONFIG_WORD.
(e.g. to have multiple scenarios in one file). Access it via CONFIG_WORD.

## Building GTFS-PLUS Networks for Fast-Trips
Build a GTFS-PLUS from the SFCTA's SF-CHAMP model inputs by running the `convert_cube_to_fasttrips.py` script in the `/scripts` folder.

python NetworkWrangler\scripts\convert_cube_to_fasttrips.py NetworkWrangler\config\config_testnet.py

NOTE: This is still under development. If you have comments
or suggestions please file them in the [issue tracker][issues]. If you have
explicit changes please fork the [git repo][repo] and submit a pull request.

After script has run:

* Add dwell time formula in vehicles_ft.txt (see network 1.12_fare)
* Change the "transfer" field values for sf_muni_express_bus_allday, sf_muni_light_rail_allday, sf_muni_local_bus_allday to 2 in fare_attributes_ft.txt
* Change the "mode" for ace_ACE_ from "inter_regional_rail" to "commuter_rail" in routes_ft.txt
* Replace zones_ft.txt with the version with non-zero zone_lon and zone_lat values (see network 1.12_fare)

### Changelog
2.1 Adds ability to build GTFS-PLUS networks.
2.0 Made NetworkWrangler compatible with SF-CHAMP 5.0.
Loading