Urban Flood Mitigation TypeError curve number table

Howdy,

Trying to get the urban flood model to work for a project of mine, and I’ve got all my tables as csvs, projected all the raster correctly, labelled my tables appropriately, and get the following error no matter what I do:

TypeError: no supported conversion for types: (dtype(‘S32’),)

Please help, I know less than nothing about programming and spent a decent chunk of time setting this up. Thanks for any help.

Here’s the last couple logs:

  1. After I set N-workers to 1 because the previous report tried to debug it.
    2019-11-05 23:47:41,111 utils.prepare_workspace(109) INFO Writing log messages to C:\Users\zpace\Documents\urban_flood_risk_mitigation_workspace\InVEST-UrbanFloodRiskMitigation-log-2019-11-05–23_47_41.txt
    2019-11-05 23:47:41,112 model._logged_target(1633) Level 100 Starting model with parameters:
    Arguments for InVEST natcap.invest.urban_flood_risk_mitigation 3.7.0.post110+h47c150dbe7b7:
    aoi_watersheds_path C:/Users/zpace/Desktop/Venice Mats/Invest/Watersheds.shx
    built_infrastructure_vector_path C:/Users/zpace/Desktop/Venice Mats/Invest/StructuresType.shx
    curve_number_table_path C:/Users/zpace/Downloads/BiotableFloodRisk - biophysicaltable(1).csv
    infrastructure_damage_loss_table_path C:/Users/zpace/Downloads/BiotableFloodRisk - Sheet2.csv
    lulc_path C:/Users/zpace/Desktop/Venice Mats/Invest/LandUse.tif
    n_workers 1
    rainfall_depth 3
    results_suffix
    soils_hydrological_group_raster_path C:/Users/zpace/Desktop/Venice Mats/Invest/landusesoil.tif
    workspace_dir C:\Users\zpace\Documents\urban_flood_risk_mitigation_workspace

2019-11-05 23:47:41,700 model._logged_target(1639) ERROR Exception while executing <function execute at 0x15093AB0>
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1636, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\urban_flood_risk_mitigation.py”, line 131, in execute
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\compressed.py”, line 52, in init
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\compressed.py”, line 32, in init
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\base.py”, line 329, in asformat
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\coo.py”, line 400, in tocsr
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\sputils.py”, line 52, in upcast
TypeError: no supported conversion for types: (dtype(‘S32’),)
2019-11-05 23:47:41,704 model._logged_target(1642) INFO Execution finished
2019-11-05 23:47:41,723 utils.prepare_workspace(115) INFO Elapsed time: 0.61s

  1. Before I set N-workers to 1, since that looked like a problem to my novice eyes looking at this:

2019-11-05 23:25:07,891 utils.prepare_workspace(109) INFO Writing log messages to C:\Users\zpace\Documents\urban_flood_risk_mitigation_workspace\InVEST-UrbanFloodRiskMitigation-log-2019-11-05–23_25_07.txt
2019-11-05 23:25:07,895 model._logged_target(1633) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.urban_flood_risk_mitigation 3.7.0.post110+h47c150dbe7b7:
aoi_watersheds_path C:/Users/zpace/Desktop/Venice Mats/Invest/Watersheds.shx
built_infrastructure_vector_path C:/Users/zpace/Desktop/Venice Mats/Invest/StructuresType.shx
curve_number_table_path C:/Users/zpace/Downloads/BiotableFloodRisk - biophysicaltable(1).csv
infrastructure_damage_loss_table_path C:/Users/zpace/Downloads/BiotableFloodRisk - Sheet2.csv
lulc_path C:/Users/zpace/Desktop/Venice Mats/Invest/LandUse.tif
n_workers -1
rainfall_depth 3
results_suffix base
soils_hydrological_group_raster_path C:/Users/zpace/Desktop/Venice Mats/Invest/soilfloat.tif
workspace_dir C:\Users\zpace\Documents\urban_flood_risk_mitigation_workspace

2019-11-05 23:25:08,075 geoprocessing.align_and_resize_raster_stack(752) DEBUG n_workers == 1 so a threadpool is sufficient
2019-11-05 23:25:08,737 geoprocessing.align_and_resize_raster_stack(779) INFO 1 of 2 aligned: aligned_lulc_base.tif
2019-11-05 23:25:08,756 geoprocessing.align_and_resize_raster_stack(779) INFO 2 of 2 aligned: aligned_soils_hydrological_group_base.tif
2019-11-05 23:25:08,835 geoprocessing.align_and_resize_raster_stack(788) INFO aligned all 2 rasters.
2019-11-05 23:25:09,020 model._logged_target(1639) ERROR Exception while executing <function execute at 0x14B81AB0>
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1636, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\urban_flood_risk_mitigation.py”, line 131, in execute
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\compressed.py”, line 52, in init
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\compressed.py”, line 32, in init
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\base.py”, line 329, in asformat
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\coo.py”, line 400, in tocsr
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\scipy\sparse\sputils.py”, line 52, in upcast
TypeError: no supported conversion for types: (dtype(‘S32’),)
2019-11-05 23:25:09,022 model._logged_target(1642) INFO Execution finished
2019-11-05 23:25:09,023 utils.prepare_workspace(115) INFO Elapsed time: 1.13s

Hello @zanepace, thanks for posting!

Based on the tracebacks, it looks like there’s something going on when the model is building up a sparse matrix internally … something coming out of the curve_number table that should be an int or float is, in fact, a string (hence the cryptic dtype('S32') mention). Could you attach your curve number table here so we can take a look?

Thanks,
James