nismod / open-gira

Open-data Global Infrastructure Risk/Resilience Analysis
https://nismod.github.io/open-gira/
MIT License
12 stars 3 forks source link

Investigate failure in osm_to_pq.py for asia-latest OSM #79

Closed thomas-fred closed 2 years ago

thomas-fred commented 2 years ago

Some of the road network linestring data in the OSM subset asia-latest seems to be malformed, and when shapely tries to handle it in osm_to_pq.py it dies.

To reproduce: snakemake --cores 10 --rerun-incomplete results/asia-latest_filter-highway-tertiary/road_network_map_by_component.png

Traceback (most recent call last):
  File "shapely/speedups/_speedups.pyx", line 90, in shapely.speedups._speedups.geos_linestring_from_py
AttributeError: 'list' object has no attribute '__array_interface__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/fred/open-gira/.snakemake/scripts/tmp7pi4kmsb.osm_to_pq.py", line 197, in <module>
    h.apply_file(pbf_path, locations=True)
  File "/home/fred/open-gira/.snakemake/scripts/tmp7pi4kmsb.osm_to_pq.py", line 92, in way
    linestring = shape.linestring.LineString(locations)
  File "/home/fred/anaconda3/envs/open-gira/lib/python3.9/site-packages/shapely/geometry/linestring.py", line 46, in __init__
    ret = geos_linestring_from_py(coordinates)
  File "shapely/speedups/_speedups.pyx", line 156, in shapely.speedups._speedups.geos_linestring_from_py
ValueError: LineStrings must have at least 2 coordinate tuples
[Wed Jul 13 15:47:56 2022]
Error in rule convert_to_geoparquet:
    jobid: 28
    output: results/geoparquet/asia-latest_filter-highway-tertiary/slice-6.geoparquet

RuleException:
CalledProcessError in line 20 of /home/fred/open-gira/workflow/rules/convert_to_geoparquet.smk:
Command 'set -euo pipefail;  /home/fred/anaconda3/envs/open-gira/bin/python /home/fred/open-gira/.snakemake/scripts/tmp7pi4kmsb.osm_to_pq.py' returned non-zero exit status 1.
  File "/home/fred/open-gira/workflow/rules/convert_to_geoparquet.smk", line 20, in __rule_convert_to_geoparquet
  File "/home/fred/anaconda3/envs/open-gira/lib/python3.9/concurrent/futures/thread.py", line 58, in run
thomas-fred commented 2 years ago

Is this helpful?

tomalrussell commented 2 years ago

Closed by #85