# Urban Flood Risk Mitigation (v. 3.9.0) TypeError

**URL:** <https://community.naturalcapitalalliance.org/t/urban-flood-risk-mitigation-v-3-9-0-typeerror/1930>\
**Category:** Software Support\
**Tags:** urban-flood\
**Created:** [May 19, 2021, 12:55pm UTC](https://community.naturalcapitalalliance.org/t/urban-flood-risk-mitigation-v-3-9-0-typeerror/1930 "2021-05-19T12:55:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![deschoni](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/deschoni/32/1339_2.png) [@deschoni](https://community.naturalcapitalalliance.org/u/deschoni)\
**Post date:** [May 19, 2021, 12:55pm UTC](https://community.naturalcapitalalliance.org/t/urban-flood-risk-mitigation-v-3-9-0-typeerror/1930/1 "2021-05-19T12:55:33Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![dcdenu4](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dcdenu4/32/544_2.png) [@dcdenu4](https://community.naturalcapitalalliance.org/u/dcdenu4)\
**Post date:** [May 19, 2021, 9:09pm UTC](https://community.naturalcapitalalliance.org/t/urban-flood-risk-mitigation-v-3-9-0-typeerror/1930/2 "2021-05-19T21:09:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![deschoni](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/deschoni/32/1339_2.png) [@deschoni](https://community.naturalcapitalalliance.org/u/deschoni)\
**Post date:** [May 21, 2021, 1:52pm UTC](https://community.naturalcapitalalliance.org/t/urban-flood-risk-mitigation-v-3-9-0-typeerror/1930/3 "2021-05-21T13:52:51Z")

</div>

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](https://community.naturalcapitalalliance.org/uploads/short-url/8UCKjNp0MtVoCy0kzHCaXxbySwk.csv) (100 Bytes)  
In column “lucode” I have written VALUE records from my raster, which I converted from Corine Land Cover data.

Regards,  
Desislava

---

<div class="post-metadata">

**Author:** ![dcdenu4](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dcdenu4/32/544_2.png) [@dcdenu4](https://community.naturalcapitalalliance.org/u/dcdenu4)\
**Post date:** [May 23, 2021, 2:15pm UTC](https://community.naturalcapitalalliance.org/t/urban-flood-risk-mitigation-v-3-9-0-typeerror/1930/4 "2021-05-23T14:15:24Z")

</div>

Hi @deschoni ,

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

```auto
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](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

---

<div class="post-metadata">

**Author:** ![deschoni](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/deschoni/32/1339_2.png) [@deschoni](https://community.naturalcapitalalliance.org/u/deschoni)\
**Post date:** [June 1, 2021, 1:55pm UTC](https://community.naturalcapitalalliance.org/t/urban-flood-risk-mitigation-v-3-9-0-typeerror/1930/5 "2021-06-01T13:55:53Z")

</div>

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:

 ![error](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/2/2830a97baea30d02babbecde49b3458edf57ae8f.png)

All the best,  
Desislava.

---

<div class="post-metadata">

**Author:** ![deschoni](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/deschoni/32/1339_2.png) [@deschoni](https://community.naturalcapitalalliance.org/u/deschoni)\
**Post date:** [June 1, 2021, 2:07pm UTC](https://community.naturalcapitalalliance.org/t/urban-flood-risk-mitigation-v-3-9-0-typeerror/1930/6 "2021-06-01T14:07:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/8/8d95591aa074da87ea0fdd61ca47c1c3c0588aa7.png) [@system](https://community.naturalcapitalalliance.org/u/system)\
**Post date:** [June 8, 2021, 2:07pm UTC](https://community.naturalcapitalalliance.org/t/urban-flood-risk-mitigation-v-3-9-0-typeerror/1930/7 "2021-06-08T14:07:40Z")

</div>

Closed on June 8, 2021, 2:07pm UTC

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