eldang / elevation_lookups

Takes an input file of paths described as series of points, outputs a file of data about the elevation changes along those paths.
Apache License 2.0
3 stars 2 forks source link

'list' object has no attribute '__array_interface__' #20

Closed dabreegster closed 3 years ago

dabreegster commented 3 years ago

Running with the parallelisation PR with n=1 on huge_seattle, using lidar:

20210327 04:08 INFO:    Processing singlethreaded.
20210327 04:08 INFO:    Loading data/kc_2016_lidar.tif_1616818096.9367285_temp.tif as raster data
20210327 04:09 INFO:    Removing temp data file data/kc_2016_lidar.tif_1616818096.9367285_temp.tif
Traceback (most recent call last):
  File "shapely/speedups/_speedups.pyx", line 88, 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 "main.py", line 114, in <module>        
    main()                                     
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)          
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)                      
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)           
  File "main.py", line 85, in main             
    infile.tag_elevations(d, outfile, n_threads)
  File "/elevation/files.py", line 99, in tag_elevations
    vals: List[ElevationStats] = d.tag_multiline(self.__paths, n_threads)
  File "/elevation/data.py", line 303, in tag_multiline
    return self.__serial_worker__(lines)
  File "/elevation/data.py", line 381, in __serial_worker__
    vals.append(self.__raster_line_lookups__(lines[i], i))
  File "/elevation/data.py", line 519, in __raster_line_lookups__
    line.coords = line.coords[1:]
  File "/usr/local/lib/python3.6/dist-packages/shapely/geometry/linestring.py", line 97, in _set_coords
    ret = geos_linestring_from_py(coordinates)
  File "shapely/speedups/_speedups.pyx", line 154, in shapely.speedups._speedups.geos_linestring_from_py
ValueError: LineStrings must have at least 2 coordinate tuples
eldang commented 3 years ago

Oh no! I can see how I caused this. The code that removes points it can't find an elevation for was set to continue until the line has only one point left. It should actually stop at 2. Hopefully https://github.com/eldang/elevation_lookups/pull/16/commits/d4eda13e256f9c9fd3e3789d1ea8d2d7639a760b addresses this.

dabreegster commented 3 years ago

Seems fixed to me, thanks!