arup-group / elara

Command line utility for processing MATSim events output files.
MIT License
13 stars 4 forks source link

overrides road pricing fix #112

Closed fredshone closed 3 years ago

fredshone commented 3 years ago

Cheeky little fix to a part of elara that allows it to work with bitsim...

bitsim uses elara run --overrides NEW_PATH to correct the elara config paths when working in a matsim (overrides is simply used to point elara at the outputs from the latest matsim run).

a little bug has been that matsim does not output the road pricing config file, hence overrides actually break the path which remains in the 'inputs root'. I have hacked it so that now elara does not update this particular path.

Therefore we can now use the road pricing handlers in elara in bitsim (we must remember to set the correct path in the elara config though). Also a reminder that the road pricing handler has to be asked for in the config.

This is not a general fix - it is hard coded for the road_pricing input path. Hopefully it is a one off - currently all other files that elara uses are matsim outputs.

Test ammeded to suit.

Also i will see if this works with latest TII run.

Theodore-Chatziioannou commented 3 years ago

looks fine, although I think I would prefer that a user explicitly provides absolute paths in the toml file, for more transparent version control (ie each set of elara outputs to be accompanied by the responding toml file which records the version/path used). In this case, how about printing or logging the location of the files actually used by Elara (including the road pricing file)?

Theodore-Chatziioannou commented 3 years ago

I believe the override argument would be elara run --path_override https://github.com/arup-group/elara/blob/d2fc95ca0ec61f46c3731236051b3d60918a40ad/elara/main.py#L484

fredshone commented 3 years ago

looks fine, although I think I would prefer that a user explicitly provides absolute paths in the toml file, for more transparent version control (ie each set of elara outputs to be accompanied by the responding toml file which records the version/path used).

Yes, it's sort of amusing that matsim's awkwardness has the unintended consequence of leaving a trail of configs (it requires us to edit config files because we are unable to interface directly with the matsim code), but elara does not because we can pass args directly. Both have their advantages and disadvantages.

In this case, how about printing or logging the location of the files actually used by Elara (including the road pricing file)?

Yes great idea. I've added something to dump the config settings. 🤞🏻

fredshone commented 3 years ago

also cleaned up some hardcoded path joins eg f"{folder}/{file}" --> os.path.join(folder, file). Need to keep an eye out for these.

Thanks for quick review