Coastal Vulnerability - TypeError: cannot unpack non-iterable NoneType object

Hello!
I try to run model with my data, and got error.
need some help, please =)

I try to change inputs, output folder, model resolution. Error still the same.

Here where i am try to run model

2022-07-27 11:11:12,079 (natcap.invest.coastal_vulnerability) coastal_vulnerability.execute(387) INFO Validating arguments
2022-07-27 11:11:12,080 (natcap.invest.validation) validation._wrapped_validate_func(1030) INFO Starting whole-model validation with ARGS_SPEC
2022-07-27 11:11:12,866 (pygeoprocessing.geoprocessing) geoprocessing.reproject_vector(1741) INFO starting reprojection
2022-07-27 11:11:12,873 (pygeoprocessing.geoprocessing) geoprocessing.reproject_vector(1783) INFO reprojection 100.0% complete on clipped_projected_landmass_0.gpkg
2022-07-27 11:11:12,960 (natcap.invest.coastal_vulnerability) coastal_vulnerability.warp_and_mask_bathymetry(1806) INFO Masking positive values from bathymetry
2022-07-27 11:11:13,012 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(396) INFO starting stats_worker
2022-07-27 11:11:13,014 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(402) INFO started stats_worker <Thread(Thread-10 (stats_worker), started daemon 5820)>
2022-07-27 11:11:13,019 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(482) INFO 100.0% complete
2022-07-27 11:11:13,019 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(485) INFO Waiting for raster stats worker result.
2022-07-27 11:11:13,094 (natcap.invest.coastal_vulnerability) coastal_vulnerability.prepare_landmass_line_index_and_interpolate_shore_points(723) INFO preparing landmass geometry and interpolating shore points
2022-07-27 11:11:13,122 (natcap.invest.coastal_vulnerability) coastal_vulnerability.prepare_landmass_line_index_and_interpolate_shore_points(772) INFO indexing geometry of landmass and creating shore points
2022-07-27 11:11:13,541 (taskgraph.Task) Task.add_task(706) ERROR Something went wrong when adding task index landmass geometry and interpolate shore points (2), terminating taskgraph.
Traceback (most recent call last):
File “taskgraph\Task.py”, line 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “natcap\invest\coastal_vulnerability.py”, line 807, in prepare_landmass_line_index_and_interpolate_shore_points
File “shapely\ops.py”, line 113, in linemerge
File “shapely\geometry\multilinestring.py”, line 49, in init
File “shapely\geometry\multilinestring.py”, line 141, in geos_multilinestring_from_py
TypeError: cannot unpack non-iterable NoneType object
2022-07-27 11:11:13,542 (natcap.invest.utils) utils.prepare_workspace(167) ERROR Exception while executing natcap.invest.coastal_vulnerability
Traceback (most recent call last):
File “natcap\invest\utils.py”, line 165, in prepare_workspace
File “natcap\invest\cli.py”, line 486, in main
File “natcap\invest\coastal_vulnerability.py”, line 476, in execute
File “taskgraph\Task.py”, line 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “natcap\invest\coastal_vulnerability.py”, line 807, in prepare_landmass_line_index_and_interpolate_shore_points
File “shapely\ops.py”, line 113, in linemerge
File “shapely\geometry\multilinestring.py”, line 49, in init
File “shapely\geometry\multilinestring.py”, line 141, in geos_multilinestring_from_py
TypeError: cannot unpack non-iterable NoneType object
2022-07-27 11:11:13,543 (natcap.invest.utils) utils.prepare_workspace(170) INFO Elapsed time: 1.46s
2022-07-27 11:11:13,543 (natcap.invest.utils) utils.prepare_workspace(173) INFO Execution finished

HI @BatTerZ -

Please upload the entire log file (.txt) that the model produces in your Workspace. This includes information about the model version and the inputs that you provided that may help us figure out what’s happening. Thanks!

~ Stacie

InVEST-natcap.invest.coastal_vulnerability-log-2022-07-27–11_11_12.txt (5.2 KB)

Hi @BatTerZ , thank you for uploading your logfile. This is a rare error that probably has something to do with the geometries in your Land.shp. Could you please share Land.shp and AOI.shp (and all of the associated files with different extensions - Land.* and AOI.*) so that we can try to reproduce this? You may share a link to google drive, dropbox, etc if the files are large.

Thank you,

shp.zip (136.5 KB)

Hello! I try to reduse size of AOI and it works. Problem with start AOI still remain.

Hi @BatTerZ , thanks for sharing your data and for trying to troubleshoot this. The problem turned out to be a very unlikely case where the land polygon has two vertices that are very nearly in the same location. These are their coordinates in units of meters (after converting to the UTM projection of the AOI)

(420275.798461657,  6042939.285698998)
(420275.7984616568, 6042939.285698998)

There is a bug in the model that failed to handle this case properly. We will fix that. For the time being, I ran Land.shp through a “simplify geometry” algorithm in QGIS, with a tolerance of 1cm, and that seems to have solved the problem. Here is that new shapefile.
Land_simple.zip (145.1 KB)

Thanks for helping us find this bug,

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.