Skip to content

Commit

Permalink
Merge pull request #31 from arup-group/update-london-bms
Browse files Browse the repository at this point in the history
adds new single mode bms for london
  • Loading branch information
fredshone authored Aug 11, 2020
2 parents adbe8bd + 2a288fc commit ab66e57
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 63 deletions.
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ A command line utility for processing (in big batches or bit by bit) MATSim outp

* **Benchmarking and Scoring** of specific subselections of outputs:
* ``ireland_highways``
* ``london_rods``
* ``london_central_cordon``
* ``london_inner_cordon``
* ``london_outer_cordon``
* ``london_thames_screen``
* ``london_board_alight_subway``
* ``london_central_cordon_car``
* ``london_central_cordon_bus``
* ``london_inner_cordon_car``
* ``london_inner_cordon_bus``
* ``london_boundary_cordon_car``
* ``london_boundary_cordon_bus``
* ``london_thames_screen_car``
* ``london_thames_screen_bus``
* ``test_pt_interaction_counter``
* ``test_link_cordon``

Expand Down Expand Up @@ -256,11 +260,15 @@ Currently available benchmarks include:
_newer formats (produced using `bench`):_

* ``ireland_highways``
* ``london_rods``
* ``london_central_cordon``
* ``london_inner_cordon``
* ``london_outer_cordon``
* ``london_thames_screen``
* ``london_board_alight_subway``
* ``london_central_cordon_car``
* ``london_central_cordon_bus``
* ``london_inner_cordon_car``
* ``london_inner_cordon_bus``
* ``london_boundary_cordon_car``
* ``london_boundary_cordon_bus``
* ``london_thames_screen_car``
* ``london_thames_screen_bus``
* ``test_pt_interaction_counter``
* ``test_link_cordon``

Expand All @@ -281,6 +289,10 @@ transport modes but not private vehicles for example. Possible modes currently i

* eg ``car, bus, train, subway...``

However please note that benchmarks are often mode specific and should be configured as such, eg:

* ``london_central_cordon_car = ["car"]``

## Command Line Reference

Elara can also be more generally used via the CLI to process individual outputs. USed in this manner the CLI should be pretty discoverable, once installed, try the command `elara` in your terminal to find out about the available options:
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

167 changes: 114 additions & 53 deletions elara/benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,90 +309,146 @@ class IrelandHighwayCountersNew(LinkCounter):
weight = 1


class LondonCentralCordon(LinkCounter):
class LondonCentralCordonCar(LinkCounter):

name = 'london_central_cordon'
benchmark_data_path = get_benchmark_data(
os.path.join('london', 'london-GLA', 'central_cordon.json')
os.path.join('london', 'london-GLA', 'central_london_car_2016.json')
)

requirements = ['volume_counts']
valid_options = ['car', 'bus']
valid_options = ['car']
options_enabled = True

weight = 1


class LondonInnerCordon(LinkCounter):
class LondonCentralCordonBus(LinkCounter):

name = 'london_central_cordon'
benchmark_data_path = get_benchmark_data(
os.path.join('london', 'london-GLA', 'central_london_bus_2016.json')
)

requirements = ['volume_counts']
valid_options = ['bus']
options_enabled = True

weight = 1


class LondonInnerCordonCar(LinkCounter):

name = 'london_inner_cordon'
benchmark_data_path = get_benchmark_data(
os.path.join('london', 'london-GLA', 'inner_cordon.json')
os.path.join('london', 'london-GLA', 'inner_london_car_2016.json')
)

requirements = ['volume_counts']
valid_options = ['car', 'bus']
valid_options = ['car']
options_enabled = True

weight = 1


class LondonInnerCordonBus(LinkCounter):

name = 'london_inner_cordon'
benchmark_data_path = get_benchmark_data(
os.path.join('london', 'london-GLA', 'inner_london_bus_2016.json')
)

requirements = ['volume_counts']
valid_options = ['bus']
options_enabled = True

weight = 1


class LondonOuterCordon(LinkCounter):
class LondonBoundaryCordonCar(LinkCounter):

name = 'london_outer_cordon'
benchmark_data_path = get_benchmark_data(
os.path.join('london', 'london-GLA', 'boundary_cordon.json')
os.path.join('london', 'london-GLA', 'boundary_london_car_2017.json')
)

requirements = ['volume_counts']
valid_options = ['car', 'bus']
valid_options = ['car']
options_enabled = True

weight = 1


class LondonThamesScreen(LinkCounter):
class LondonBoundaryCordonBus(LinkCounter):

name = 'london_thames_screen'
name = 'london_outer_cordon'
benchmark_data_path = get_benchmark_data(
os.path.join('london', 'london-GLA', 'thames_screen.json')
os.path.join('london', 'london-GLA', 'boundary_london_bus_2017.json')
)

requirements = ['volume_counts']
valid_options = ['car', 'bus']
valid_options = ['bus']
options_enabled = True

weight = 1


class LondonNorthScreen(LinkCounter):
class LondonThamesScreenCar(LinkCounter):

name = 'london_northern_screen'
name = 'london_thames_screen'
benchmark_data_path = get_benchmark_data(
os.path.join('london', 'london-GLA', 'northern_screen.json')
os.path.join('london', 'london-GLA', 'london_thames_screen_car_2016.json')
)

requirements = ['volume_counts']
valid_options = ['car', 'bus']
valid_options = ['car']
options_enabled = True

weight = 1


class LondonPeriphScreen(LinkCounter):
class LondonThamesScreenBus(LinkCounter):

name = 'london_peripheral_screen'
name = 'london_thames_screen'
benchmark_data_path = get_benchmark_data(
os.path.join('london', 'london-GLA', 'peripheral_screen.json')
os.path.join('london', 'london-GLA', 'london_thames_screen_bus_2016.json')
)

requirements = ['volume_counts']
valid_options = ['car', 'bus']
valid_options = ['bus']
options_enabled = True

weight = 1


# class LondonNorthScreen(LinkCounter):

# name = 'london_northern_screen'
# benchmark_data_path = get_benchmark_data(
# os.path.join('london', 'london-GLA', 'northern_screen.json')
# )

# requirements = ['volume_counts']
# valid_options = ['car', 'bus']
# options_enabled = True

# weight = 1


# class LondonPeriphScreen(LinkCounter):

# name = 'london_peripheral_screen'
# benchmark_data_path = get_benchmark_data(
# os.path.join('london', 'london-GLA', 'peripheral_screen.json')
# )

# requirements = ['volume_counts']
# valid_options = ['car', 'bus']
# options_enabled = True

# weight = 1



class TransitInteraction(BenchmarkTool):

Expand Down Expand Up @@ -1201,25 +1257,25 @@ class MultimodalTownCarCounters(PointsCounter):

# Cordons

class LondonInnerCordonCar(Cordon):
# class LondonInnerCordonCar(Cordon):

requirements = ['volume_counts']
valid_options = ['car']
options_enabled = True
# requirements = ['volume_counts']
# valid_options = ['car']
# options_enabled = True

weight = 1
cordon_counter = HourlyCordonDirectionCount
benchmark_path = get_benchmark_data(
os.path.join('london', 'inner_cordon', 'InnerCordon2016.csv')
)
cordon_path = get_benchmark_data(
os.path.join('london', 'inner_cordon', 'cordon_links.csv')
)
# weight = 1
# cordon_counter = HourlyCordonDirectionCount
# benchmark_path = get_benchmark_data(
# os.path.join('london', 'inner_cordon', 'InnerCordon2016.csv')
# )
# cordon_path = get_benchmark_data(
# os.path.join('london', 'inner_cordon', 'cordon_links.csv')
# )

directions = {'in': 1, 'out': 2}
year = 2016
hours = None
modes = ['car']
# directions = {'in': 1, 'out': 2}
# year = 2016
# hours = None
# modes = ['car']


class DublinCanalCordonCar(Cordon):
Expand Down Expand Up @@ -1316,21 +1372,24 @@ class BenchmarkWorkStation(WorkStation):

tools = {
"ireland_highways": IrelandHighwayCountersNew,
"london_board_alight": LondonRODS,
"london_boundary_cordon": LondonOuterCordon,
"london_central_cordon": LondonCentralCordon,
"london_inner_cordon": LondonInnerCordon,
"london_northern_screen": LondonNorthScreen,
"london_peripheral_screen": LondonPeriphScreen,
"london_thames_screen": LondonThamesScreen,
"london_board_alight_subway": LondonRODS,
"london_boundary_cordon_car": LondonBoundaryCordonCar,
"london_boundary_cordon_bus": LondonBoundaryCordonBus,
"london_central_cordon_car": LondonCentralCordonCar,
"london_central_cordon_bus": LondonCentralCordonBus,
"london_inner_cordon_car": LondonInnerCordonCar,
"london_inner_cordon_bus": LondonInnerCordonBus,
"london_thames_screen_car": LondonThamesScreenCar,
"london_thames_screen_bus": LondonThamesScreenBus,
# "london_northern_screen": LondonNorthScreen,
# "london_peripheral_screen": LondonPeriphScreen,

# old style:
"test_pt_interaction_counter": TestPTInteraction,
"test_town_highways": TestHighwayCounters,
"squeeze_town_highways": SqueezeTownHighwayCounters,
"multimodal_town_modeshare": MultimodalTownModeShare,
"multimodal_town_cars_counts": MultimodalTownCarCounters,
# "ireland_highways": IrelandHighwayCounters, # replaced with new
"london_inner_cordon_car": LondonInnerCordonCar,
"dublin_canal_cordon_car": DublinCanalCordonCar,
"ireland_commuter_modeshare": IrelandCommuterStats,
"test_link_cordon": TestCordon,
Expand All @@ -1341,20 +1400,22 @@ class BenchmarkWorkStation(WorkStation):

BENCHMARK_WEIGHTS = {
"test_pt_interaction_counter": 1,
"london_rods": 1,
"test_link_cordon": 1,
"ireland_highways": 1,
"london_central_cordon": 1,
"london_inner_cordon": 1,
"london_outer_cordon": 1,
"london_thames_screen": 1,
"london_board_alight_subway": 1,
"london_boundary_cordon_car": 1,
"london_boundary_cordon_bus": 1,
"london_central_cordon_car": 1,
"london_central_cordon_bus": 1,
"london_inner_cordon_car": 1,
"london_inner_cordon_bus": 1,
"london_thames_screen_car": 1,
"london_thames_screen_bus": 1,

"test_town_highways": 1,
"squeeze_town_highways": 1,
"multimodal_town_modeshare": 1,
"multimodal_town_cars_counts": 1,
# "ireland_highways": 1, # replaced with new
"london_inner_cordon_car": 1,
"dublin_canal_cordon_car": 1,
"ireland_commuter_modeshare": 1,
"test_town_cordon": 1,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_5_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,11 @@ def test_benchmark_workstation_with_link_bms(test_config, test_paths):

pp_workstation.build(write_path=test_outputs)


def test_all_paths_exist(test_config):
benchmark_workstation = benchmarking.BenchmarkWorkStation(test_config)
for name, tool in benchmark_workstation.tools.items():
try:
assert os.path.exists(tool.benchmark_data_path)
except AttributeError:
continue

0 comments on commit ab66e57

Please sign in to comment.