matsim-vsp / matsim-python-tools

Tools for working with matsim in python
57 stars 20 forks source link

Synpop xml writers #7

Closed davibicudo closed 4 years ago

davibicudo commented 4 years ago

As discussed in https://github.com/matsim-vsp/matsim-python-tools/issues/6 , this PR simply makes the writers.py class from https://github.com/eqasim-org/ile-de-france/blob/develop/matsim/writers.py available to the users of this project. I wanted to push also some additional utilities that actually uses it instead of simply pushing the class but I realized a more advanced and generalized solution would require more reflection time (first question: data format??). I played around a bit with them, and the classes in writers.py are quite easy to use and flexible, so it is surely a good start. We need here to put such a writer in production so the experience will bring new ideas. A nice next step could be to write a test that reads an XML and writes it back to XML (and check that both match), possibly with dataframes in-between. @sebhoerl: I did some minor changes already, as can be seen in the commits. Let me know what you think!

davibicudo commented 4 years ago

Update: fixed an issue and added static typing, which for me coming from Java makes life in Python much easier. In practice it is ignored at runtime, but makes development easier/safer. Please let me know if your are ok with it. I also updated string formatting to the newest f'{}' format, which in my opinion is quite neat.

sebhoerl commented 4 years ago

Looks good from my side :)