Git Product home page Git Product logo

elara's Introduction

Elara

A command line utility for processing (in big batches or bit by bit) MATSim XML outputs (events or plans files) into useful tabular and geospatial outputs for analysis.

Contents

Introduction

Elara allows processing of complex MATSim outputs into more easilly useable forms and formats. For example extracting hourly flows of vehicles for all links in a network (link_vehicle_counts). Elara outputs are typically some form of aggregation of simulation outputs. Elara outputs are typically made available in tabular (csv) and spatial (geojson) formats. Spatial representations are converted to EPSG:4326, which works in kepler.

Once installed Elara is intended to be used as a Command Line Interface (CLI), within this interface you can choose to run elara via a config or purely through the CLI using command line arguments. The CLI is preferred for producing single outputs, for example to extract vehicle kms, whereas using a config can handle big batches of outputs in one go. So if you are after a quick output - best to use the CLI, whereas if you need a collection of outputs and/or reproducibility, a config is preferred.

The CLI and configs share naming conventions and structure. But we recommend learning about configs first as this provides an overview of most available tools.

Installation

Assuming Python >=3.7, virtualenv and using git, clone or download this repository.

git clone [email protected]:arup-group/elara.git

Once available locally, navigate to the folder to install Elara and its dependencies. Using a virtual environment is highly recommended.

OSX

cd elara
virtualenv -p python3.7 venv
source venv/bin/activate
pip3 install -e .
pytest
elara --help

Windows

It is recommended to use an Anaconda environment for installation on Windows:

conda create -n elara python=3.7
conda activate elara
conda install geopandas
git clone [email protected]:arup-group/elara.git
cd elara
pip install -e .
pytest
elara --help

On Windows, installation may fail due to failure to locate underlying geospatial dependencies (with a traceback indicating geos_c.dll cannot be found, or similar). In this case, it is recommended to first install geopandas from conda-forge.

conda install geopandas -c conda-forge

After removing geopandas, fiona, and shapely from the requirements.txt file, install Elara as per above.

Inputs

Inputs to Elara are MATSim format output files, eg:

  • events = "./tests/test_fixtures/output_events.xml"
  • network = "./tests/test_fixtures/output_network.xml"
  • transit_schedule = "./tests/test_fixtures/output_transitSchedule.xml"
  • transit_vehicles = "./tests/test_fixtures/output_transitVehicles.xml"
  • attributes = "./tests/test_fixtures/output_personAttributes.xml"
  • plans = "./tests/test_fixtures/output_plans.xml"
  • output_config_path = "./tests/test_fixtures/output_config.xml"
  • road pricing config = "./tests/test_fixtures/roadpricing.xml"
  • vehicles = "./tests/test_fixtures/output_vehicles.xml"

Depending on what outputs you require from elara, some of these inputs may not be required, but it is often convenient to have them all available as a default. In most cases these Elara inputs may be compressed using gzip (file.xml.gz).

The road pricing config is required when using the (deprecated) toll_log plan handler, but not when calcuating toll logs using the agent_tolls_log event handler.

Output Handlers

Elara supports and can be selectively configured to output a growing number of outputs. The units responsible for each output are often referred to as 'handlers', although elara.factory describes them more generally as Tools.

There are four main types of handler/tools, arranged into python modules:

  • elara.event_handlers
  • elara.plan_handlers
  • elara.postprocessing
  • elara.benchmarking

Within each module a WorkStation is responsible for orchestrating all that modules tools. The elara.factory module is then responsible for orchestratinig all the Workstations together.

Event Handlers/WorkStation Tools

Users are encouraged to add new tools as they require. The below lists are updated periodically but may not be complete.

These are processed by streaming (in order) through all output events from simulation.

Currently supported handlers include:

  • link_vehicle_counts: Produce link volume counts and volume capacity ratios by time slice. Counts vehicles entering link (PT vehicles counted once).
  • link_vehicle_capacity: Produce link capacity counts by time slice for understanding PT crowding. Sums the vehicle capacities of all vehicles entering link for the particular PT mode.
  • link_passenger_counts: Produce link passenger counts by time slice. Counts agents entering link.
  • link_vehicle_speeds: Produce average vehicle speeds across link (in kilometers per hour).
  • route_passenger_counts: (WIP) Produce vehicle occupancies by transit routes.
  • stop_passenger_interactions: Boardings and Alightings by time slice.
  • stop_to_stop_passenger_counts: Passenger counts between directly connected stops/stations.
  • stop_passenger_waiting: Agent waiting times for unique pt interaction events.
  • vehicle_departure_log: Vehicle departures and delays from facilities (stops in the case of PT).
  • vehicle_passenger_log: A log of every passenger boarding and alighting to/from a transit vehicle.
  • vehicle_passenger_graph: Experimental support for building interaction graph objects (networkx).
  • agent_tolls_log: Produce a log and 24-hour summary (total amount, number of tolls incurred) of agents' tolling events.

Plan Handlers/WorkStation Tools

These are processed by streaming through all output plans from simulation. Compared to the event based outputs these are typically more aggregate but can be computationally faster and can be used to expose agent plan 'memories' and plan scoring.

Currently supported handlers include:

  • trip_modes: Produce modeshares and counts of all trips.
  • trip_activity_modes: Produce modeshares and counts of all trips to specified destination activities.
  • plan_modes: Produce modeshares and counts of all plans (ie the dominant mode for each person).
  • plan_activity_modes: Produce modeshares and counts of all plans (ie the dominant mode for each person) to specified destination activities.
  • trip_logs: Produce agent activity logs and trip logs for all selected plans. Omits pt interactions and individual trip legs. Trip mode is based on maximum leg distance.
  • leg_logs: Produce agent activity logs and leg logs for all selected plans.
  • plan_logs: Produce agent plans including unselected plans and scores.
  • agent_highway_distance_logs: Produce agent distances by car on different road types. Requires network to have osm:way:highways attribute.
  • trip_highway_distance_logs: Produce flat output of agent trip distances by car on different road types. Requires network to have osm:way:highways attribute.
  • (DEPRECATED) toll_logs: Produces summary of amounts agents paid at tolls based on route information contained in agent plans. Requires road pricing input file. Only works for option ["car"]. The AgentTollsPaidFromRPConfig handler is still supported, but has been superseded by an event handler. This handler calculates toll payments via a link-lookup with the road pricing configuration file, and will not account for any in-simulation adjustments for differential or capped road pricing.

Post Processing Handlers/Workstation Tools

These are outputs produced through additional post-processing of the above outputs. Currently supported postprocessors include:

  • vkt: Produce link volume vehicle kms by time slice.
  • trip_duration_breakdown: Produce binned trip durations.
  • trip_euclid_distance_breakdown: Produce binned trip distances.
  • plan_summary: Produce summary statistics for all agent plans

Benchmarking Handlers/WorkStation Tools

Elara can also assist with validation or 'benchmarking' of simulations. Elara will compare and present simulation results from the above outputs to available benchmarks, it will aditionally output a distance based score for the model. Where distance is some measure of how different the simulation is from the observed data.

The handlers in this module require correctly formatted benchmark data. Examples can be found in the project example_benchmark_data folder. This documentation has been moved to here.

Running from a Configuration File

For reproducibility or to process a range of outputs, using a config file is the most sensible and processing efficient way to use Elara. From your terminal:

elara run <CONFIG PATH>

Config files must be .toml format and be roughly formatted as follows. The various fields are detailed further below and an example config is also included in the repo:

[scenario]
name = "test_town"
time_periods = 24
scale_factor = 0.01
crs = "EPSG:27700"

[inputs]
events = "./tests/test_fixtures/output_events.xml"
network = "./tests/test_fixtures/output_network.xml"
transit_schedule = "./tests/test_fixtures/output_transitSchedule.xml"
transit_vehicles = "./tests/test_fixtures/output_transitVehicles.xml"
attributes = "./tests/test_fixtures/output_personAttributes.xml"
plans= "./tests/test_fixtures/output_plans.xml"
output_config_path = "./tests/test_fixtures/output_config.xml"
road_pricing = "./tests/test_fixtures/roadpricing.xml"
vehicles = "./tests/test_fixtures/output_vehicles.xml"

[outputs]
path = "./tests/test_outputs"

[event_handlers]
link_vehicle_counts = ["car", "bus"]
link_passenger_counts = ["bus"]
stop_passenger_counts = ["bus"]
stop_passenger_waiting = ["all"]

[plan_handlers]
trip_modes = {modes=["all"]}
trip_activity_mode_shares = {destination_activity_filters = ["work"]}
trip_logs = ["all"]
agent_highway_distance_logs = ["car"]
trip_highway_distance_logs = ["car"]

[post_processors]
vkt = ["car"]
plan_summary = ["all"]
trip_duration_breakdown = ["all"]
trip_euclid_distance_breakdown = ["all"]

You can run this config on some toy data: elara run example_configs/config.toml (from the project root).

If your MATSim outputs use default names and are in the same directory, you may optionally pass the path of this directory as single argument to [inputs] using, e.g. inputs_directory = "./tests/test_fixtures/". NB: If using the toll_log plan handler, you must still provide the road_pricing path separately.

Configuration dry run

elara run supports some optional flags and arguments which can be discovered with elara run --help, most useful is elara run -d (or elara run --dry) which can be use to test a config without providing valid inputs or undertaking the processing.

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:

$ elara
Usage: elara [OPTIONS] COMMAND [ARGS]...

  Command line tool for processing a MATSim scenario events output.

Options:
  --help  Show this message and exit.

Commands:
  benchmarks       Access benchmarks output group.
  event-handlers   Access event handler output group.
  plan-handlers    Access plan handler output group.
  post-processors  Access post processing output group.
  run              Run Elara using a config.toml, examples are included in...

Further commands can then be explored. In general the commands and options available follow the same structure as configuration.

$ elara event-handlers volume-counts --help

Usage: elara event-handlers volume-counts [OPTIONS] MODES...

  Create a volume counts output for a given mode or modes. Example
  invocation for "car" and "bus" modes with name "test" and scale factor at
  20% is:

  $ elara event-handlers volume-counts car bus -n test -s .2

Options:
  -f, --full                  Option to disable output contracting.
  -e, --epsg TEXT             EPSG string, defaults to 'EPSG:27700' (UK).
  -s, --scale_factor FLOAT    Scale factor, defaults to 0.1 (10%).
  -v, --version INT           MATSim version {11,12}, defaults to 12.
  -p, --time_periods INTEGER  Time period breakdown, defaults to 24 (hourly.
  -o, --outputs_path PATH     Outputs path, defaults to './elara_out'.
  -i, --inputs_path PATH      Inputs path location, defaults to current root.
  -x, --no_experienced_plans  Switch for turning off Experienced Plans. Set to
                              use output_plans instead.
  -n, --name TEXT             Scenario name, defaults to root dir name.
  -d, --debug                 Switch on debug verbosity.
  --help                      Show this message and exit.

Note that defaults will not always be suitable for your scenario. -s --scale_factor in particular, should be updated accordingly.

Similarly, note that the CLI assumes inputs will have standard (at the time of writing) MATSim names, ie output_plans.xml.gz, output_personAttributes.xml.gz, output_config.xml and so on.

Example CLI Usage

To produce vehicle kilometres travelled by car (VKT) for a London scenario, all the defaults are correct but you'd like to read the inputs from a different location to your current path:

elara post-processors vkt car -inputs_path ~/DIFFERENT/DATA/LOCATION

or, more succinctly:

elara post-processors vkt car -i ~/DIFFERENT/DATA/LOCATION

To reduce volume counts for cars and buses using a New Zealand projection (2113). The scenario was a 1% sample. You'd like to prefix the outputs as 'nz_test' in a new directory '~/Data/nz_test':

elara event-handlers volume-counts car bus -epsg EPSG:2113 -scale_factor .01 -name nz_test -outputs_path ~/Data/nz_test

or, much more succinctly:

elara event-handlers link-vehicle-counts car bus -e EPSG:2113 -s .01 -n nz_test -o ~/Data/nz_test

To produce a benchmark, in this case we assume that a benchmark has already been created called and that it works for all modes.

elara benchmarks mode_shares_comparison all

Note that we are assuming that all other option defaults are correct. ie:

  • --scale_factor = 0.1
  • --time_periods = 24
  • etc

Configuration Options

Configuration Reference

Configured fields are described below:

[scenario]

name string (required)

The name of the scenario being processed.

time_periods integer (required)

The number of time slices used to split a 24-hour period for the purposes of reporting. A value of 24 will produce summary metrics for each our of the day. Similarly, a value of 96 will produce 15-minute summaries.

scale_factor float (required)

The sample size used in the originating MATSim scenario run. This is used to scale metrics such as volume counts. For example, if the underlying scenario was run with a 25% sample size, a value of 0.25 in this field will ensure that all calculated volume counts are scaled by 4 times.

version int {11,12} (default 12)

Set version = 11 if using MATSim version 11 outputs (in which case there a personAttributes file will be required).

using_experienced_plans boolean {true, false} (default true)

If using MATSim "experienced_plans" you should set this flag to 'true'.

crs string (required)

The EPSG code specifying which coordinate projection system the MATSim scenario inputs used. This is used to convert the results to WGS 84 as required.

debug bool {true,false} (optional)

Set logging to DEBUG level, defaults to false.

[inputs]

inputs_directory path Path to a directory containing MATSim Outputs. A convenient override for setting paths to standard MATSim outputs using a single line. Handles network, plans, attributes, events, transit vehicles, transit schedule, output config files.

events file

Path to the MATSim events XML file. Can be absolute or relative to the invocation location.

.network file Path to the MATSim network XML file. Can be absolute or relative to the invocation location.

etc file

Path to additional MATSim resources:

  • transit_schedule
  • transit_vehicles
  • attributes
  • plans
  • output_config_path
  • road_pricing

[outputs]

path directory (required)

Desired output directory. Can be absolute or relative to the invocation location. If the directory does not exist it will be created.

[event_handlers]

[NAME] list of strings as below (all optional)

Specification of the plan handlers to be run during processing. For example:

[event_handlers]
link_vehicle_counts = ["car", "bus"]
link_passenger_counts = ["bus"]

All available event handlers are described in Output Handlers.

The associated list attached to each handler allows specification of the network modes to be processed using that handler. This allows certain handlers to be activated for specific modes.

  • modes should be supplied as a list eg ["car", "bus", "train", ...] or just ["car"].
  • note that waiting_times only supports the option of ["all"].
  • note that vehicle_departure_log supports any valid mode options, but is intended for public transit modes only. It will produce empty csv outputs for modes without events of type VehicleDepartsAtFacility.

The above format of HANDLER_NAME = ["car", "bus"] is a shorthand way of passing options. These options can also be passed in a dictionary format, ie HANDLER_NAMES = {modes=["car","bus"]}. More complex configuration options using this dictionary option are described later.

[plan_handlers]

[NAME] list of strings as below (optional)

Specification of the plan handlers to be run during processing. For example:

[plan_handlers]
trip_modes = ["all"]
trip_logs
agent_highway_distance_logs = ["car"]

All available event handlers are described in Output Handlers.

The associated list attached to each handler allows specification of the network modes to be processed using that handler. This allows certain handlers to be activated for specific modes.

  • in many cases the only modes supported are ["all"] (this is a default, demonstrated in the above example for trip_logs).
  • highway_distances only supports the mode car

[post_processors]

[NAME] list of strings (optional)

Specification of the event handlers to be run post processing. For example:

[post_processors]
vkt = ["car"]
plan_summary = ["all"]
trip_duration_breakdown = ["all"]

The associated list attached to each handler allows specification of which modes of transport should be processed using that handler.

  • modes should be supplied as a list eg ["car", "bus", "train", ...] or just ["car"].
  • note that plan_summary and breakdowns only support the option of ["all"].

Additional Options

The above configurations typically pass a modes option, eg:

[event_handlers]
link_vehicle_counts = ["car", "bus"]

Note that if no mode is defined a defualt of ["all"] will be passed which is not a valid mode for most handlers.

This is equivalent to passing a dictionary with the modes option as a key, eg:

[event_handlers]
link_vehicle_counts = {modes=["car", "bus"]}

This more verbose method, of using a dictionary of handler options, allows more options to be passed to handlers. Allowing them to have more complex functionality.

Most handlers support a groupby operation that groups outputs such as counts based on person attribute. This can be enabled by passing the groupby_person_attributes option as follows:

[event_handlers]
link_vehicle_counts = {modes = ["car","bus"], groupby_person_attributes = ["income", "age"]}

The above config will produce a number of link counts for car and bus with breakdowns by the person attributes named 'income' and 'age'. Note that cross tabulations are not supported and that specifying an unavailable attribute key will result in a warning and outputs being assigned to the 'None' group.

An example config using the groupby_person_attributes option is included: ./example_configs/complex_options.toml.

Some handlers require additional options to be passed, for example activity_mode_shares which calculated mode share only for trips with given destination activity types:

trip_activity_mode_shares = {destination_activity_filters = ["work"]}

You can also name your handler, which will be added to the output file names:

trip_activity_mode_shares = {name = "commuters", destination_activity_filters = ["work"]}

Tabular (csv) outputs of the event and plan handlers can optionally be exported to a compressed format, by passing the compression option:

[event_handlers]
link_vehicle_counts = {modes = ["car","bus"], compression = "gzip"}

Letting Elara Deal With Dependancies

The modes and groupby_person_attributes options are understood by elara as dependancies. Therefore if you ask for a postprocessor such as VKT (or a benchmark - described later below), elara will make sure that any handlers required to produce these outputs will also be created and given the correct options.

This means that a config can be very minimal. As an example, the following configurations are equivalent:

A complex config, using a post processor that requires outputs from the event handlers:

...
[event_handlers]
link_vehicle_counts = {modes=["car","bus"], groupby_person_attributes=["age"]}

[post_processors]
vkt = {modes=["car"], groupby_person_attributes=["age"]}
...

An equivalent config, allowing Elara to deal with the dependancies:

...
[event_handlers]
link_vehicle_counts = ["bus"]

[post_processors]
vkt = {modes=["car"], groupby_person_attributes=["age"]}
...

Care should be taken not to specify unnecesary options as they can add significant compute time. An example configuration that passes complex dependancies is included: ./example_configs/complex_dependancies.toml

Experienced Plans

Elara assumes your MATSim run is configured to output agents' "experienced" plans (rather than "planned" plans). If you do not wish to use experienced plans, you can set the following option in the config:

[scenario]
...
using_experienced_plans = false

This option is set to true by default, and does not need to be included it in the config, although you may set it explicitly if you wish.

When using MATSim "experienced" plans from versions 12 and up you will find that these (currently) do not include the person attributes. In turn, this prevents elara from providing outputs grouped by person attributes (ie those that use the groupby_person_attributes option).

If such outputs are required when using experienced plans, provide the standard MATSim 'output_plans' as the attributes input:

[inputs]
...
attributes = "./tests/test_fixtures/output_plans_v12.xml"
plans= "./tests/test_fixtures/output_experienced_plans.xml"
...

This allows elara to access person attributes from the standard output_plans, while taking plans from the output_experienced_plans. This is not necessary if groupby_person_attributes are not required.

This guidance does apply when using MATSim version 11 and below, because attributes must always be set explicitly to the relevant output_personAttributes.xml file.

Tests

Run the tests (from the elara root dir)

pytest -v

Generate a code coverage report

To generate XML & HTML coverage reports to reports/coverage:

./scripts/code-coverage.sh

Debug

Logging level can be set to debug in the config (debug = True) or via the cli, or otherwise defaults to False (INFO). We currently support the following levels: DEBUG, INFO.

Note that the configured or default logging level can be overwritten to debug using an env variable:

export ELARA_LOGGINGLEVEL='True'

Technical Details

Elara is designed to work out it's own dependencies and be somewhat efficient with compute using elara.factory. This allows some flexibility and succinctness in application and is particularly suited to extracting batches of outputs as defined in a config.

This design allows Elara to create arbitrarily complex pipelines of output processing, postprocessing and benchmarking as defined by a configuration file or via the CLI.

Elara defines a graph of connected WorkStations, each responsible for building certain types of output or intermediate data requirements (Tools). These workstations are connected to their respective dependees and dependencies (managers and suppliers) to form a DAG.

dag

Elara uses this DAG to provide:

  • Minimal dependency processing
  • Early validation of all intermediate requirements
  • Early Failure/Ordering

Elara does this by traversing the DAG in three stages:

  1. Longest path search to ensure correct order.

  2. Breadth first initiation of .tools as .resources and supplier validation.

  3. Reverse Breadth first build all tools in .resources and build workstation.

Is it fast/sensible?

Sometimes:

dag

Adding Features

NOTE: Pushing code to this repository is temporarily restricted while we undergo some spring cleaning during April/May 2022. If you wish to contribute code, please contact one of the owners for permisison.

Elara is designed to be extendable, primarily with new tools such as handlers or benchmarks.

Where new tools are new classes that implement some process that fits within the implementation (both in terms of code and also abstractly) of a WorkStation. New tools must be added to the relevant workstations 'roster' of tools (ie .tools).

New tool classes must correctly inherit and implement a number of values and methods so that they play well with their respective workstation:

  • .__init__(self, config, mode): Used for early validation of mode and subsequent requirements.
  • .build(self, resource=None): Used to process required output (assumes required resources are available).

A good place to start when adding a new handler/tool is to copy or adapt an existing one.

It may also be required to add or connect new workstations, where new workstations are new types of process that might contain a new or multiple new tools. New workstations must be defined and connected to their respective suppliers and managers in main.

Conventions

Where possible please name new handlers/tools based on the following:

<Where><What>

For example: LinkPassengerCounts or StopPassengerCounts.

Todo

  • Add support for all available handlers to CLI
  • More descriptive generated column headers in handler results. Right now column headers are simply numbers mapped to the particular time slice during the modelled day.
  • Try and move away from test_data towards unit tests.
  • More outputs, ie mode distances/times/animations.
  • S3 integration (read and write).
  • Clean up docstrings and add "read the docs" style documentation.

What does the name mean?

Elara is a moon of Jupiter. There's not much else interesting to say about it, other than that the wikipedia article states that it orbits 11-13 gigametres from the planet. Gigametres is a cool unit of measurement.

elara's People

Contributors

alex-andrey avatar ana-kop avatar andkay avatar andrewelandxarup avatar arup-sb avatar divyasharma-arup avatar elizabethc-arup avatar fredshone avatar gac55 avatar jaimefera avatar kasiakoz avatar mfitz avatar michaelbyrneau avatar pnvaga avatar rorysedgwick avatar sarah-e-hayes avatar syhwawa avatar theodore-chatziioannou avatar yannisza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elara's Issues

late memory deaths

The handler finalise methods involve initiating pandas dataframe classes (and also geopandas) from some big numpy arrays. At this step there is therefore i) a duplication of information in the arrays and tables and ii) the problem of potentially inefficient info storage in pandas.

This is sometime causing late process memory failures, eg:

11-30 12:19 elara.event_handlers INFO Finalising <class 'elara.event_handlers.VolumeCounts'>
Killed

Likelly three actions: i) delete obsolete data immediately, ii) force some pandas data types to reduce memory and iii) consider removing pandas all togther (although it is super convenient)

transit stop outputs (eg boardings/alightings) are not mode specific

The outputs from event handlers counting events at transit stops, eg boardings and alightings are not modal specific.

For example _alightings_subway_total.csv includes rows for bus stops.

This is particulalry wasteful for smaller transit networks with less stops.

Suggest add modal specific filter when building empty counting matrix. ie here:

# Initialise element attributes

This should also speed up later steps.

Missing agents in `trip_logs_all_trips.csv`

Comparing MATSim's output_persons.csv with trip_logs_all_trips.csv reveals that some agents are not included in the elara trips log

(Using Suffolk outputs /mnt/efs/test_simulation/20210618_10p/experiment3_no_car_100times_cost/200)

Screenshot 2021-08-11 at 12 04 00

Mode share handling by activity

The NZ mode share benchmark only consists of Journey2Work data however Elara currently computes the global mode share from all plans. As a result it would be very ideal if there is a way to filter the mode share by activity (e.g. work) so that we can compare the census journey2work mode share to the simulation journey2work mode share.

Remove data from project

We have established formats for benchmark data and the ability to specify paths in config. We can therefore look to remove data from this project so that the project can be more easilly shared.

  1. Remove all redundant benchmarks - there will be some broken features for older projects but i don't thing anything critical
  2. Change remaining benchmarks to accept paths as config args
  3. Move benchmark data to separate project/s
  4. Clean git history

CsvComparison NaN Strategy [PRIORITY]

Recent changes to the main branch have changed the behaviour of the CsvComparison.build method to drop records with no match after merging simulation data to benchmark data, rather than infilling with 0s (pandas dataframe fillna -> dropna).

This change was required to calculate some newer benchmarks correctly, but in general is dangerous. In some cases, the absence of evidence <-> evidence of absence.

To fix this, we need to introduce a drop_na attribute to this class that can be set by individual handler implementations as required.

Mode share benchmarks path

I met an issue when running Elara with Benchmarking Handlers.

In elara_config, I set up the path for modeshare:

suffolk_modeshares = {modes = ["all"], benchmark_data_path = "/efs/population/v6_20210616_10perc/benchmarks/combined_pop_mode_share_20210816_10pct.csv"}

It can't point to the right file. I have tried the path starting with /mnt but not working as well.

Setting Logging Level to DEBUG includes Matplotlib logging

Setting Elara's verbosity to true runs the program with logging level DEBUG.

In some environments, this causes extraneous outputs from 3rd party libraries. One potential reason for this is that the verbosity is set at for the logging module, rather than the elara's own object loggers.

logging.basicConfig(

However, this behaviour is also not universal which contradicts the above hypothesis.

Example:

...
10-19 16:57 matplotlib.font_manager DEBUG findfont: score(<Font 'Khmer Sangam MN' (Khmer Sangam MN.ttf) normal normal 400 normal>) = 10.05
10-19 16:57 matplotlib.font_manager DEBUG findfont: score(<Font 'Shree Devanagari 714' (Shree714.ttc) normal normal 400 normal>) = 10.05
10-19 16:57 matplotlib.font_manager DEBUG findfont: score(<Font 'Hiragino Sans' (ヒラギノ角ゴシック W9.ttc) normal normal 900 normal>) = 10.525
10-19 16:57 matplotlib.font_manager DEBUG findfont: score(<Font 'American Typewriter' (AmericanTypewriter.ttc) normal normal 400 normal>) = 10.05
...

Support for attribute slicing in benchmarking module

In previous iterations, we required project-specific implementations of benchmark tools. The more generalised approached is better but is problematic when benchmark data is logically related to a subset of the entire population.

The particular example that is causing a headache at the moment is trip_mode_shares_comparison. Typically, the benchmark data would come from census journey to work data or similar. The comparison requires looking only at modeshares for the "general population" -- i.e. excluding goods vehicles and agents that are external to the study area (which we include sometimes to get the full demand on the local network, but don't actually care about otherwise).

There are some workarounds, including restructuring the benchmark data to be grouped by subpopulations (with arbitrary values) or by using a destination_activity_filter to exclude particular activities (e.g. delivery). But these are cumbersome and potentially limit our ability to score simulations on how close they match benchmarks.

Allow for output generation for a subset of the Network

With larger networks the outputs from Elara become restrictively large (3gb+). It would be nice to be able to generate the outputs for subsets of the network. I.e, for a city or a selection of cities within the network. This would make the resulting outputs easier to work with. For instance currently loading in the volume-counts for cars from the New Zealand network is impossible in kepler and results in very slow performance in QGIS.

It would be great to set extents in the Elara config or provide it with a geojson with different extents and have elara filter the outputs by these extents.

PCE counts handler

We can currently extract link vehicle counts from Elara, however, to understand or analyse congestion effects, we need to be looking at PCE counts. This could be its own handler, or a switch in the LinkVehicleCounts one.

generalise agent attribute disagregation

At the moment many of the handlers disagregate output by agent subpopulation attribute as per the personAttributes.xml.gz. Some some do not disagregate at all.

This can be generalised to any attribute/s. It is not clear how this would be configured for the event handlers using the exitsing config files.

This is a requirement for mode share. So suggest doing this first. Raised by @elizabethc-arup

Config needs RP input file

Just realised that running elara via a config file will error out unless it is passed a road pricing input file ... even if the MatSim run was not a road pricing one at all. Need to fix so that it's optional.

tool default modes should be "all" not None

Most tools initialise with the default mode = None However, configs use "all" (i.e. "filter for all modes") rather than None.

In the short term, the default should be consistent. Longer term, a refactor (mode_filter = None) is probably sane.

Handling additional vehicles (bike)

The current logic for checking veh mode uses the transitVehicles input. If an id is not found then it is assumed to be a car.

def vehicle_mode(self, vehicle_id: str) -> str:

This logic may break in future with the introduction of proposer vehicles for non transit modes.

transitVehicles.xml different modes

The veh -> mode mapping defined by MATSim transitVehicles.xml files often uses a different spelling of the mode compared to the schedule, eg:

<vehicle id="veh_0_bus" type="Bus"/>

...in this case using Bus instead of bus. We deal with this using the mapping defined here, eg:

self.veh_type_mode_map = {
            "Rail": "train",
            "Suburban Railway": "suburban rail",
            "Underground Service": "subway",
            "Metro Service": "subway",
            "Bus": "bus",
            "Coach Service": "coach",
            "Tram": "tram",
            "Ferry": "ferry",
            "Gondola": "gondola"
        }

This is a likelly source of future woes. Suggest that the mapping of vehicles to modes be obtained from transitSchedule.xml instead. This would be achieved by looping through all routes, retrieving the route mode and then mapping to all vehicles scheduled to that route.

`ValueError: max() arg is an empty sequence` error when running on SF eqasim-org/california model

I'm hit with the following error running a matsim model adapted from here: https://github.com/eqasim-org/california

Traceback (most recent call last):
File "/usr/local/bin/elara", line 33, in <module>
sys.exit(load_entry_point('elara', 'console_scripts', 'elara')())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/elara/main.py", line 53, in run
main(config)
File "/elara/main.py", line 127, in main
factory.build(config_requirements)
File "/elara/factory.py", line 683, in build
current.build(write_path=write_path)
File "/elara/plan_handlers.py", line 1509, in build
plan_handler.process_plans(person)
File "/elara/plan_handlers.py", line 314, in process_plans
mode = self.get_furthest_mode(plan_modes)
File "/elara/plan_handlers.py", line 63, in get_furthest_mode
return max(modes, key=modes.get)
ValueError: max() arg is an empty sequence

My elara config:

[scenario]
name = "SF"
time_periods = 24
scale_factor = 0.01
crs = "EPSG:3494"
verbose = true
version = 12
using_experienced_plans = 'False'

[inputs]
events = "./output_events.xml.gz"
network = "./output_network.xml.gz"
transit_schedule = "./output_transitSchedule.xml.gz"
transit_vehicles = "./output_transitVehicles.xml.gz"
plans= "./output_plans.xml.gz"
output_config_path = "./output_config.xml"

[outputs]
path = "./elara"
contract = false

[event_handlers]
link_vehicle_counts = ["car"]
link_vehicle_speeds = ["car"]
link_passenger_counts = ["bus", "rail", "cable car", "ferry", "subway", "tram"]
stop_passenger_counts = ["bus", "rail", "cable car", "ferry", "subway", "tram"]
stop_passenger_waiting = ["all"]

[plan_handlers]
trip_modes = ["all"]
plan_modes = ["all"]
plan_logs = ["all"]
agent_highway_distance_logs = ["car"]
trip_highway_distance_logs = ["car"]

[post_processors]
vkt = ["car"]
plan_summary = ["all"]
trip_duration_breakdown = ["all"]

[benchmarks]
#test_pt_interaction_counter = ["bus"]
#test_link_cordon = ["car"]

There are agents in the model that stay home all day, my feeling is that this error is due to them not travelling and thus not having any modes---but running elara in the past ( Oct 2021 ) on the same sim outputs worked. I would like to take advantage of the latest advances in the speed computation, so would like to run on the latest elara version. Please halp 🥲

unscaled elara outputs

some elara outputs are scaled (for example link_vehicle_counts), but others are not (such as trip and leg logs).

suggest adding a weight or frequency column to the 'unscaled' outputs - primarilly logs

example config not working

elara run example_configs/complex_dependancies.toml not working.

Additionally reminder to add smoke test for these configs.

Locations for First Activities missing in output_experienced_plans

When using Experienced Plans, the first activity in each agents' plans does not contain location information or start times. Example from a single agent:

<activity type="home" link="299044" end_time="07:44:47" ></activity>
      ...{FIRST LEG INFO}...
<activity type="escort_education" link="306842" x="699114.0" y="803353.0" start_time="08:22:47" end_time="08:22:48" ></activity>

Several plan handlers rely on this information to populate the XY coordinates for activity sequences -- viz. LegLogs, TripLogs and PlanLogs -- so this is missing. I have checked LegLogs from other simulations, and this appears true -- the ox and oy columns for the first activity in each sequence are indeed empty.

As near as I can tell, the only way to obtain this information would be to additionally stream activities from the output_plans.xml which seems like a big and sort of difficult change.

Finally, this causes PlansLogs to throw a TypeError when using experienced plans because that handler in particular attempts to convert coordinates to float (using None b/c they don't exist) -- this handler doesn't get used much in anger, which is why I think it's not come up before.

In the short term, I will remove the type coercion from the PlanLogs and add something to the docs. But we should all be aware of this issue.

Mode errors happening very late

The following error is encountered too late (ie at handler run time). Need to add a check at startup.

1-26 17:19 elara.event_handlers WARNING 
                No viable routes found for mode:train in TransitSchedule, 
                this may be because the Schedule modes do not match the configured 
                modes. Elara will continue with all routes found in schedule.
Traceback (most recent call last):
  File "/home/arup/repo/elara/venv/bin/elara", line 11, in <module>
    load_entry_point('elara', 'console_scripts', 'elara')()
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/arup/repo/elara/venv/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/arup/repo/elara/elara/main.py", line 375, in run
    main(config)
  File "/home/arup/repo/elara/elara/main.py", line 441, in main
    factory.build(config_requirements)
  File "/home/arup/repo/elara/elara/factory.py", line 591, in build
    current.build(write_path=write_path)
  File "/home/arup/repo/elara/elara/event_handlers.py", line 1027, in build
    super().build(write_path=write_path)
  File "/home/arup/repo/elara/elara/factory.py", line 381, in build
    tool.build(self.supplier_resources, write_path)
  File "/home/arup/repo/elara/elara/event_handlers.py", line 701, in build
    self.elem_ids, self.elem_indices = self.generate_elem_ids(list(routes))
TypeError: 'NoneType' object is not iterable

Add more logging to benchmarking.CSVComparison

The CSV comparison class (here) has no logging (other than what it receives from it's parent class.

This led to a difficult to resolve bug where input benchmark data had the wrong column names.

Suggest:

i) add better logging (not necessarily more, unless in debug)
ii) consider not crashing when broken bm data is found - NOT SURE ABOUT THIS THOUGH

attribute sliced mode share summing to 1 for each attribute class

For the NZ ABM, we are looking to build a regional benchmark to compare the mode shares within each region. This BM makes use of the destination_mode_shares_comparison BM with the groupby_person_attributes parameter to group the mode shares by region.

The output of the current implementation of the handler/ BM sums the mode shares for all classes to 1, however, for our particular instance, we would like to alter it so that the mode shares sum to 1 per region (class) to allow for the comparisons regionally.

From what I understand, there seems to be two ways to implement this case, with the first being to implement it as a separate NZ-specific BM in the benchmarking.py and the other to implement it as a more general case - perhaps involving a boolean parameter or a separate handler class to enable this option. I was wondering which would be the more suitable option of implementation in the best interest of Elara?

`AgentTollsPaid` handler should parse `personMoney` events

We have an existing AgentTollsPaid handler to summarise tolls paid by agents. This handler essentially recapitulates MATSim's own tolling logic by taking a road pricing file, output plans file, and person attributes file as input, iterating over each selected agent plan, stepping through the links in each leg of the plan, and checking whether or not each link should incur a toll according to the road pricing file.

We run the risk of our logic differing somehow from MATSim's, hence giving us incorrect results. Furthermore, the results from this handler will definitely be wrong whenever our model uses a TollFactor class, for example for differential road pricing, or capped road pricing, because the handler has no view of the factor being applied, only the "default" un-factored toll defined in the road pricing file.

An alternative approach is for the handler (or possibly a new handler) to rely only on person money events in MATSim's events output file. These events fire when a toll is paid by an agent, hence the amount charged will always have taken into account any applicable toll factor. Person money events for toll charges look like this - note the amounts are negative, representing money being taken from the agent:

<event time="202.0" type="personMoney" person="LGV_45110" amount="-0.07131634459841994" purpose="toll"  />
<event time="210.0" type="personMoney" person="LGV_33658" amount="-0.11977075573916363" purpose="toll"  />
<event time="210.0" type="personMoney" person="LGV_2763" amount="-0.004715995520649573" purpose="toll"  />
<event time="214.0" type="personMoney" person="LGV_45110" amount="-0.02986826262367614" purpose="toll"  />
<event time="214.0" type="personMoney" person="LGV_26973" amount="-0.3055779751027617" purpose="toll"  />
<event time="216.0" type="personMoney" person="LGV_79004" amount="-0.16695628514069902" purpose="toll"  />
<event time="223.0" type="personMoney" person="LGV_45110" amount="-0.1563088745151321" purpose="toll"  />
<event time="226.0" type="personMoney" person="LGV_29299" amount="-0.07131634459841994" purpose="toll"  />

Not found column misleading

Summary
The not found column in the benchmark csv output is misleading. As a counter is flagged as not found when the simulation has no boarding and alightings for that stop. This makes it seem like there is an issue with finding the specified stop in the simulation rather than the simulation predicting that no one has used the stop.

In line 845 in benchmarking.py

                if not sum(sim_result):
                    found = False
                else:
                    found = True

Solution

I am not sure if the not found column is also used for missing snaps. However, if not we could just rename it as has counts or get rid of it entirely as the total column already provides a similar function.

long stop id causes casting error

Description
When building PTInteraction benchmarks for project monty the long stop ids are generating a casting error when they are saved to the csv and then reloaded again to generate the benchmark files. This casting error turns an ID such as 7857884190914906000 into its scientific notation form 7.857884190914906e+18, when this form is casted as a string it retains the scientific notation form ("7.857884190914906e+18") and therefore the stop IDs are not merging, as "7.857884190914906e+18" != "7857884190914906000". This is results in an empty benchmark.

Quick fix
To test the benchmark for monty I have added the following which forces pandas to read the ids as string which means it never converts it to standard form.

line 731 results_df = pd.read_csv(path, index_col=0) -> results_df = pd.read_csv(path, index_col=0,dtype=str)
In order to allow for the counters to still sum when need to force the counts back to a numeric value so I added
line 732 results_df[[str(h) for h in range(24)]] = results_df[[str(h) for h in range(24)]].apply(pd.to_numeric)

This solved the issue for testing purposes but I imagine the problem could be more wide spread so a better solution is most likely needed.

Other issues
Python's int size simplifies the id if you load it in as an int so either keeping it as a float or string is necessary.

Potential fixes

  • Fix all stop ids to a smaller length: I am unsure of the implications of this.
  • Enforce stop ids to be strings to ensure they are never loaded as numeric types, i.e, by adding _stop to the end of the idea. I think this is why we did not encounter this issue with link ids as the take the form stopid - stopid so the hyphen forces it to be a string.

More Generic Mode Share Benchmarks

Elara can now output handler stats by arbitrary population attributes using the groupby_person_attribute option. It would be desirable to mirror this support for this in the benchmarking module.

Simple use case: agents have a home_county attribute, and we want to compare modeshares for each county available from a census data set.

Some additional notes:

  • I think the groupby_person_attribute is not currently being handled correctly in the ModeShare handler -- when handed a groupby attribute, the handler will output the mode splits and counts by hour, which does not seem like the desired behaviour?
  • As always, users will be expected to construct viable benchmarks that will work with their population attributes. Nonetheless, I think there may some complexity surrounding missing or misaligned data.

This falls under a very general category of enhancements: things that used to be done by users as a post-processing operations, which will now become features.

Support for experienced plans

We are now aware that the final, output_plans consist of the so called "planned" plans. MATSim can output the final "experienced" plans which consists of the actual experienced reality for that agent. We therefore should use these as the final outputs.

When running elara on these plans:

07-22 17:07 elara.inputs INFO Building Tool Subpopulations
Traceback (most recent call last):
  File "/home/ssm-user/elara/venv/bin/elara", line 11, in <module>
    load_entry_point('elara', 'console_scripts', 'elara')()
  File "/home/ssm-user/elara/venv/lib64/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/ssm-user/elara/venv/lib64/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/ssm-user/elara/venv/lib64/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ssm-user/elara/venv/lib64/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ssm-user/elara/venv/lib64/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/ssm-user/elara/elara/main.py", line 611, in run
    main(config)
  File "/home/ssm-user/elara/elara/main.py", line 677, in main
    factory.build(config_requirements)
  File "/home/ssm-user/elara/elara/factory.py", line 620, in build
    current.build(write_path=write_path)
  File "/home/ssm-user/elara/elara/factory.py", line 407, in build
    tool.build(self.supplier_resources, write_path)
  File "/home/ssm-user/elara/elara/inputs.py", line 494, in build
    for elem in get_elems(path, "person")
  File "/home/ssm-user/elara/elara/inputs.py", line 494, in <listcomp>
    for elem in get_elems(path, "person")
  File "/home/ssm-user/elara/elara/inputs.py", line 521, in get_person_attribute_from_plans
    attribute = elem.find(f'./attributes/attribute[@name="{tag}"]').text
AttributeError: 'NoneType' object has no attribute 'text'

I can point to example output_plans.xml.gz and output_experienced_plans.xml.gz. The difference is unclear at initial inspection. The experienced plans appear to feature "empty" plans.

Box permissions

Box elara install doesn't get permission without first creating the output directories and giving them permissions:

sudo mkdir elara_out
sudo chmod 777 elara_out
sudo mkdir elara_out/benchmarks
sudo chmod 777 elara_out/benchmarks

How can these shenanigans be avoided?

Pandas dependency

I installed all the packages in the venv as per requirements.txt which includes pandas 1.0.4.

However when I tried to run an elara process using the test_fixtures data, it returned an error pkg_resources.ContextualVersionConflict: (pandas 1.0.4 (/home/arup/repo/elara/venv/lib/python3.8/site-packages), Requirement.parse('pandas>=1.1.0'), {'mizani'})

I tried manually upgrading pandas to 1.1.0 as the error message suggested, but then Elara didn't seem able to handle the newer verion and I got this error: pkg_resources.DistributionNotFound: The 'pandas==1.0.4' distribution was not found and is required by elara

Read me out of date

From Sarah Hayes:

Read me out of date. Don’t need to faff around with cython and geopandas dependencies separately, it all just worked.

Tests all ran fine

LinkCounter benchmarks only work in one hour time periods

LinkCounter benchmarks are limited to only being in hourly time periods.

If you build a benchmark that is at any other time period and run it using a config it produces an error where the results data frame from the link volumes only contain counts for the first 24 time bands. Note that it takes 24 buckets even though the results data frame contains the correct amount of periods. When it tries to compare the supplied benchmark to the results data frame it sees the mismatch and raises an error:
if not set(bm_hours) <= set(results_df.columns): raise UserWarning( f"Hours: {bm_hours} not available in results.columns: {results_df.columns}")

The issue seems to come from the following line of code:
results_df = results_df[[str(h) for h in range(24)]]

Commenting this out allows you to generate the benchmark ( In my case I built a 15 minute time period benchmark) and the output looks valid. I am not sure of the down stream impacts of commenting this out. Therefore, this issue is more about understanding why this line is in there in the first place and deciding what/if we need to replace it with something.

Require distance based trip mode

We are currently using a fixed mode hierarchy to pick a mode for trips with multiple modes.
eg:
given train>bus>walk
home --{walk, bus, train, walk}--> work == {train}

However, most statistics use distance based trip mode where the chosen mode is the one used to travel furthest. This is known to be the case for TfL work and NZ (thanks @elizabethc-arup)

Installing elara on box

After failing to be able to get an elara container to find paths on an ec2 instance i resorted to an virtual env install.

There were a number or undocumented installations required in addition to the requirments.txt:

sudo apt-get install libgeos-dev
sudo apt-get install libxml2-dev libxslt-dev python-dev
pip3 install wheel
python3 setup.py bdist_wheel

transit_walk != walk

Mode outputs (eg modeshare) are mapping non-stadard walk modes to walk, eg:

access_walk -> walk
egress_walk -> walk

However there is a third walk mode called transit_walk. This could be mapped to walk too:

pro: simpler outputs
con: hides high transit walk (transit walk is a PT trip that only walks)

Outputs suffixed with _total are confusing

Raised by @sarah-e-hayes:

What is the difference between 1perc_prelim_rp_mm_alightings_bus and 1perc_prelim_rp_mm_alightings_bus_total outputs?

Suggest replacing _total with _summary or removing altogether or making optional in config.

Link Vehicle Capacity Handler

We are looking to understand the ratio of passengers traversing a link in a given hour to the total capacity of all vehicles that have done the same traversal, as a result, we were thinking that a LinkVehicleCapacity handler could be very useful for computing the latter total vehicle capacity traversing a link - the LinkVehicleCapacity handler would be very similar to the LinkVehicleCounts handler but instead of summing vehicle counts it will sum the corresponding vehicle capacity of the vehicles that traverses a link.

PT vehicles log

We’re thinking of adding a handler to elara that will convert pt vehicle events, eg:

<event time="27300.0" type="VehicleDepartsAtFacility" vehicle="bus1" facility="home_stop_out" delay="0.0"  />

…into a csv log, eg;

veh_id, stop_id, departure_time, delay
bus1, home_stop_out, 27300, 0

This will be an events handler (example events above taken from test.test_fixtures). But use an chunkWriter - more commonly found in plan_handlers but made available from the factory module.

Allow for multiple time periods in a config

Currently when running Elara from a config only one time-period is allowed. This means you can not run a series of benchmarks (Such as LinkCounters) that are built using different time periods. This can often be the case when sourcing benchmark data from different authorities.

It would be ideal to be able to override the time period for individual benchmarks and add the capability for Elara to aggregate the time periods to the time period set in an individual benchmark. For instance if the config contained two benchmarks, one at 15-minute bands, and one at hourly bands. Elara would calculate the link volumes at 15 minute intervals and then aggregated them into hours for the hourly benchmark.

Wrong averaging of speeds

While analysing a Londinium test, I found that delays calculated with the vehicle log were not matching the delays calculated using the link speeds handler.

The reason is that the link speeds handler is not averaging the vehicle speeds correctly.
The elara handler is calculating: speed = Σ(speed_i) / n ,
while the correct formula for averaging speeds is : speed = (total distance travelled) / (total time travelled) = (n*d) / (Σ(t_i)) = (n*d) / (Σ(d/speed_i)) = n / Σ(1 / speed_i) ,
where d = distance, t=travel time, i denotes a vehicle, and n = number of vehicles.

over-ride not always required in Bitsim

Bitsim requires a partial override of paths:

Currently by passing --path_override to the elara.run command elara with overwrite all input paths.

For example for given config:

[inputs]
events = "./tests/test_fixtures/output_events.xml"
network = "./tests/test_fixtures/output_network.xml"
transit_schedule = "./tests/test_fixtures/output_transitSchedule.xml"
transit_vehicles = "./tests/test_fixtures/output_transitVehicles.xml"
attributes = "./tests/test_fixtures/output_personAttributes.xml"
plans= "./tests/test_fixtures/output_plans.xml"
output_config_path = "./tests/test_fixtures/output_config.xml"
road_pricing = "./tests/test_fixtures/roadpricing.xml"

running elara run config.toml --path_override example/new_directory will effectivelly modify the read paths as follows:

[inputs]
events = "example/new_directory/output_events.xml"
network = "example/new_directory/output_network.xml"
transit_schedule = "example/new_directory/output_transitSchedule.xml"
transit_vehicles = "example/new_directory/output_transitVehicles.xml"
attributes = "example/new_directory/output_personAttributes.xml"
plans= "example/new_directory/output_plans.xml"
output_config_path = "example/new_directory/output_config.xml"
road_pricing = "example/new_directory/roadpricing.xml"

This is desired behaviour in many use cases.

However, when used as part of a bitsim swarm, this assumes that all paths need to be updated to the latest swarm outputs. In fact we generally do not want to update the path for road_pricing as this is a non-standard matsim input and not a matsim output.

A suggestion is to implement a --bitsim_path_override option that selectivelly updates paths for bitsim.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.