simulate-digital-rail / sumo-exporter

0 stars 2 forks source link

The example does not work #3

Open SaturnHafen opened 1 year ago

SaturnHafen commented 1 year ago

When trying to run the example, the program crashes with an AtributeError.

Stack trace:

saturnhafen@pop-os:~/Code/Bachelorprojekt/yaramo-testing/sumo-exporter/examples$ poetry run python example.py 
--------------------------------------------------
----- Warnings -- count: 3 -----
Warning: Value "Notstromaggregat_NEA_stationaer" near line 50 does not match xsd enumeration restriction on ENUMEV_Art
Warning: Value "1" does not match xsd pattern restrictions: [['^([0-9]{2})$']]
Warning: Value "4" does not match xsd pattern restrictions: [['^([0-9]{2})$']]
--------------------------------------------------
Traceback (most recent call last):
  File "/home/saturnhafen/Code/Bachelorprojekt/yaramo-testing/sumo-exporter/examples/example.py", line 12, in <module>
    sumo_exporter.convert()
  File "/home/saturnhafen/Code/Bachelorprojekt/yaramo-testing/sumo-exporter/sumoexporter/sumoexporter.py", line 19, in convert
    self.convert_topology()
  File "/home/saturnhafen/Code/Bachelorprojekt/yaramo-testing/sumo-exporter/sumoexporter/sumoexporter.py", line 26, in convert_topology
    point_obj = Point(yaramo_node.uuid, yaramo_node.geo_node.uuid)
AttributeError: 'NoneType' object has no attribute 'uuid'
SaturnHafen commented 1 year ago

I think the problem is that we just create Nodes without any reference to geo_nodes: https://github.com/simulate-digital-rail/planpro-importer/blob/main/planpro_importer/reader.py#L29-L32

When comparing to the ORM-Importer, it seems like GeoNodes are manually created there: https://github.com/simulate-digital-rail/orm-importer/blob/main/orm_importer/importer.py#L69-L74

I don't know enough about PlanPro to suggest a fix myself. Hope this helps :)

arneboockmeyer commented 1 year ago

@SaturnHafen This problem is fixed in here: https://github.com/simulate-digital-rail/planpro-importer/pull/6 That PR is waiting for review, but please try to checkout that branch and test it again. If it works, please close this issue.

SaturnHafen commented 1 year ago

Trying to install the package on the new branch using poetry (Adjusting the corresponding line in pyproject.toml and running poetry lock and poetry install) fails due to mismatching dependency-versions on the new branch*. Regardless if the fix works, we would need to update the dependencies here (using poetry lock), otherwise the fix would not be installed when using poetry install. I am going to leave the issue open until that has happened.

*If you are interested in the dependency-problems:

Because planpro-importer (1.9.0) @ git+https://github.com/simulate-digital-rail/planpro-importer@coordinates-name depends on yaramo (0.1.0) @ git+https://github.com/simulate-digital-rail/yaramo.git
 and sumoexporter depends on yaramo (0.1.0) @ git+https://github.com/simulate-digital-rail/yaramo, planpro-importer is forbidden.
So, because sumoexporter depends on planpro_importer (1.9.0) @ git+https://github.com/simulate-digital-rail/planpro-importer@coordinates-name, version solving failed.

My guess is that the different projects (sumo-exporter and planpro-importer) depend on different commit-hashes of yaramo which creates this specific problem. We might need to watch out when merging the modified poetry.lock-file here so this issue does not prevent others from trying the example.

jeriox commented 1 year ago

Trying to install the package on the new branch using poetry (Adjusting the corresponding line in pyproject.toml and running poetry lock and poetry install) fails due to mismatching dependency-versions on the new branch*. Regardless if the fix works, we would need to update the dependencies here (using poetry lock), otherwise the fix would not be installed when using poetry install. I am going to leave the issue open until that has happened.

*If you are interested in the dependency-problems:

Because planpro-importer (1.9.0) @ git+https://github.com/simulate-digital-rail/planpro-importer@coordinates-name depends on yaramo (0.1.0) @ git+https://github.com/simulate-digital-rail/yaramo.git
 and sumoexporter depends on yaramo (0.1.0) @ git+https://github.com/simulate-digital-rail/yaramo, planpro-importer is forbidden.
So, because sumoexporter depends on planpro_importer (1.9.0) @ git+https://github.com/simulate-digital-rail/planpro-importer@coordinates-name, version solving failed.

My guess is that the different projects (sumo-exporter and planpro-importer) depend on different commit-hashes of yaramo which creates this specific problem. We might need to watch out when merging the modified poetry.lock-file here so this issue does not prevent others from trying the example.

Different commit hashes aren't a problem for poetry as it understands the relation between different commits in git. This is due to the fact that one project depens on the URL ending with yaramo.git, the other on one ending in yaramo. This was fixed in https://github.com/simulate-digital-rail/planpro-importer/commit/d7922c4cbfa586321db177d8fce6355d0f983e96, but the branch in https://github.com/simulate-digital-rail/planpro-importer/pull/6 is out of date with the main branch, so it doesn't contain this fix and breaks.