GeoscienceAustralia/dea-coastlines

Two tiles fail due to KeyError in `skimage.measure.find_contours`

Closed this issue · 1 comments

Contour extraction on two Albers tiles are currently failing with a KeyError. This has been raised on the scikit-image Github here:
scikit-image/scikit-image#4505

These two tiles may not be able to be processed until this bug has been resolved and the new version of scikit-image made available on the NCI.

6922:
image

2524:
image

Error:

Traceback (most recent call last):
  File "/g/data/r78/DEACoastLines/deacoastlines_statistics.py", line 137, in contours_to_multiline
    for i in find_contours(da_i.data, z_value) 
  File "/g/data/v10/public/modules/dea-env/20200612/lib/python3.6/site-packages/skimage/measure/_find_contours.py", line 137, in find_contours
    contours = _assemble_contours(segments)
  File "/g/data/v10/public/modules/dea-env/20200612/lib/python3.6/site-packages/skimage/measure/_find_contours.py", line 174, in _assemble_contours
    ends.pop(tail[-1])
KeyError: (66.0, 381)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/g/data/r78/DEACoastLines/deacoastlines_statistics.py", line 1024, in <module>
    main()
  File "/g/data/r78/DEACoastLines/deacoastlines_statistics.py", line 923, in main
    dim='year').set_index('year')
  File "/g/data/r78/DEACoastLines/deacoastlines_statistics.py", line 196, in subpixel_contours
    for i, da_i in da.groupby(dim)}
  File "/g/data/r78/DEACoastLines/deacoastlines_statistics.py", line 196, in <dictcomp>
    for i, da_i in da.groupby(dim)}
  File "/g/data/r78/DEACoastLines/deacoastlines_statistics.py", line 143, in contours_to_multiline
    fully_connected='high') 
  File "/g/data/v10/public/modules/dea-env/20200612/lib/python3.6/site-packages/skimage/measure/_find_contours.py", line 137, in find_contours
    contours = _assemble_contours(segments)
  File "/g/data/v10/public/modules/dea-env/20200612/lib/python3.6/site-packages/skimage/measure/_find_contours.py", line 174, in _assemble_contours
    ends.pop(tail[-1])
KeyError: (1109.0, 15)

Appears to be resolved in latest v1.0.0