Urban Flood Risk Mitigation (v. 3.9.0) TypeError

Hello there,

I have just run the tool but it occurs TypeError.
Here is the log:
2021-05-19 15:43:57,654 utils.prepare_workspace(123) INFO Writing log messages to C:\Users\desch\Documents\urban_flood_risk_mitigation_workspace\InVEST-UrbanFloodRiskMitigation-log-2021-05-19–15_43_57.txt
2021-05-19 15:43:57,655 model._logged_target(1646) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.urban_flood_risk_mitigation 3.9.0:
aoi_watersheds_path C:/Users/desch/OneDrive/Desktop/Flood Risk Mitigation - InVEST/urb_KRZ.shp
built_infrastructure_vector_path
curve_number_table_path C:/Users/desch/OneDrive/Desktop/Flood Risk Mitigation - InVEST/biophysical table_KRZ.csv
infrastructure_damage_loss_table_path
lulc_path C:/Users/desch/OneDrive/Desktop/Flood Risk Mitigation - InVEST/soils&lc/clc_test.tif
n_workers -1
rainfall_depth 600
results_suffix
soils_hydrological_group_raster_path C:/Users/desch/OneDrive/Desktop/Flood Risk Mitigation - InVEST/soils&lc/soil_test.tif
workspace_dir C:\Users\desch\Documents\urban_flood_risk_mitigation_workspace

2021-05-19 15:43:57,656 validation._wrapped_validate_func(911) DEBUG Using ARG_SPEC for validation
2021-05-19 15:43:57,656 validation._wrapped_validate_func(915) INFO Starting whole-model validation with ARGS_SPEC
2021-05-19 15:43:57,656 validation.timeout(625) DEBUG Starting file checking thread with timeout=5
2021-05-19 15:43:57,686 validation.timeout(637) DEBUG File checking thread completed.
2021-05-19 15:43:57,686 validation.timeout(625) DEBUG Starting file checking thread with timeout=5
2021-05-19 15:43:57,748 validation.timeout(637) DEBUG File checking thread completed.
2021-05-19 15:43:57,748 validation.timeout(625) DEBUG Starting file checking thread with timeout=5
2021-05-19 15:43:57,754 validation.timeout(637) DEBUG File checking thread completed.
2021-05-19 15:43:57,754 validation.timeout(625) DEBUG Starting file checking thread with timeout=5
2021-05-19 15:43:57,780 validation.timeout(637) DEBUG File checking thread completed.
2021-05-19 15:43:57,780 validation.timeout(625) DEBUG Starting file checking thread with timeout=5
2021-05-19 15:43:57,784 validation.timeout(637) DEBUG File checking thread completed.
2021-05-19 15:43:57,872 validation._wrapped_validate_func(962) DEBUG Validation warnings: []
2021-05-19 15:43:57,960 geoprocessing.align_and_resize_raster_stack(795) INFO 1 of 2 aligned: aligned_lulc.tif
2021-05-19 15:43:57,972 geoprocessing.align_and_resize_raster_stack(795) INFO 2 of 2 aligned: aligned_soils_hydrological_group.tif
2021-05-19 15:43:57,972 geoprocessing.align_and_resize_raster_stack(797) INFO aligned all 2 rasters.
2021-05-19 15:43:57,982 utils.build_lookup_from_csv(528) WARNING Empty or NaN values were found in the table: C:/Users/desch/OneDrive/Desktop/Flood Risk Mitigation - InVEST/biophysical table_KRZ.csv.
2021-05-19 15:43:57,985 model._logged_target(1652) ERROR Exception while executing <function execute at 0x0000024139B68DC8>
Traceback (most recent call last):
File “site-packages\scipy\sparse\base.py”, line 326, in asformat
File “site-packages\scipy\sparse\coo.py”, line 406, in tocsr
File “site-packages\scipy\sparse\sputils.py”, line 53, in upcast
TypeError: no supported conversion for types: (dtype(’<U1’),)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “site-packages\natcap\invest\ui\model.py”, line 1649, in _logged_target
File “site-packages\natcap\invest\urban_flood_risk_mitigation.py”, line 222, in execute
File “site-packages\scipy\sparse\compressed.py”, line 57, in init
File “site-packages\scipy\sparse\compressed.py”, line 37, in init
File “site-packages\scipy\sparse\base.py”, line 328, in asformat
File “site-packages\scipy\sparse\coo.py”, line 406, in tocsr
File “site-packages\scipy\sparse\sputils.py”, line 53, in upcast
TypeError: no supported conversion for types: (dtype(’<U1’),)
2021-05-19 15:43:57,986 model._logged_target(1655) INFO Execution finished
2021-05-19 15:43:57,988 utils.prepare_workspace(129) INFO Elapsed time: 0.33s

Could you tell me where i’m wrong?

Thanks in advance :slight_smile:

HI @deschoni ,

Thanks for posting. It looks like something is wonky in the Biophysical table. Could you attach that table so we can see what might be going on in there?

In the future it also might be easier to attach the logfile instead of pasting the contents. Thanks!

Doug

Hi @dcdenu4 ,

I’m pretty sure that my biophysical table isn’t correct, but I have tried for the test. Here it is:
biophysical table_KRZ.csv (100 Bytes)
In column “lucode” I have written VALUE records from my raster, which I converted from Corine Land Cover data.

Regards,
Desislava

Hi @deschoni ,

Thanks for uploading that table. It looks like the columns are empty:

lucode;CN_A;CN_B;CN_C;CN_D
1;;;;
2;;;;
3;;;;

If you don’t know what those values should be at the moment you could try just filling them in for now to get the model running. Here’s the Users Guide data needs section for the mode: https://storage.googleapis.com/releases.naturalcapitalproject.org/invest-userguide/latest/urban_flood_mitigation.html#data-needs

  • Curve number (CN) values for each LULC type and each hydrologic soil group. Column names should be: CN_A , CN_B , CN_C , CN_D , which the letter suffix corresponding to the hydrologic soil group

and for the soil group raster:

  • Soils Hydrological Group Raster (required). Raster of categorical hydrological groups. Pixel values must be limited to 1, 2, 3, or 4, which correspond to soil hydrologic group A, B, C, or D, respectively (used to derive the CN number)

I hope this helps!

Doug

Hi @dcdenu4 ,
Sorry for this later response.

I’ve run the model today again after I repaired the biophysical table.
Now I have a new problem, which I can’t understand:

All the best,
Desislava.

Hi again @dcdenu4 ,

My bad, sorry for that. It turned out that this error was due to the antivirus program on my computer.
So the model ended successfully.

Thanks a lot!
Regards,
Desislava.

2 Likes

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