# HRA: AttributeError: 'float' object has no attribute 'lower'

**URL:** <https://community.naturalcapitalalliance.org/t/hra-attributeerror-float-object-has-no-attribute-lower/3733>\
**Category:** Software Support\
**Tags:** hra\
**Created:** [May 10, 2023, 9:22pm UTC](https://community.naturalcapitalalliance.org/t/hra-attributeerror-float-object-has-no-attribute-lower/3733 "2023-05-10T21:22:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gperilla](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@Gperilla](https://community.naturalcapitalalliance.org/u/Gperilla)\
**Post date:** [May 10, 2023, 9:22pm UTC](https://community.naturalcapitalalliance.org/t/hra-attributeerror-float-object-has-no-attribute-lower/3733/1 "2023-05-10T21:22:27Z")

</div>

### What is the issue or question you have?

i have problems running the Habitat risk assessment model, the logfile says The maximum pairwise risk score for multiplicative risk is 9.0  
or The maximum pairwise risk score for euclidean risk is 2.8…

### What do you expect to happen?

i don’t understand what is the issue here, i would expect it to run without problems

### What have you tried so far?

i’ve tried using invest 3.13  
i’ve tried using only 9 stressors  
i’ve tried changing the parameters from decay and equation and number of overlapping stressors  
i’ve tried using only a couple of habitat and stressors  
i’ve checked if all my stressors .tiff are int (instead of float)  
[ex\_criteria\_mon.csv](https://community.naturalcapitalalliance.org/uploads/short-url/y6qk1roD61xeLUSiOPZ599Hbzdv.csv) (21.4 KB)

i’ve erased all field in my habitat .shp that are float  
i’ve checked both the stressors table and the criteria table

### Attach the logfile here:

[InVEST-natcap.invest.hra-log-2023-05-10–16\_48\_19.txt](https://community.naturalcapitalalliance.org/uploads/short-url/pjwZdVwr6wsgAR4Qa5ZYVzYjChV.txt) (1.7 KB)  
[InVEST-natcap.invest.hra-log-2023-05-10–16\_08\_46.txt](https://community.naturalcapitalalliance.org/uploads/short-url/75bK3YacjfLbo03V59eWkD43e5t.txt) (1.7 KB)  
[InVEST-natcap.invest.hra-log-2023-05-10–16\_09\_49.txt](https://community.naturalcapitalalliance.org/uploads/short-url/qV4qf35uQ6JNfM9IfOfS5dsV5bU.txt) (1.8 KB)  
[InVEST-natcap.invest.hra-log-2023-05-10–16\_10\_40.txt](https://community.naturalcapitalalliance.org/uploads/short-url/jybv3Q21sKYLLTSr10RjR3c5Zsw.txt) (1.7 KB)  
[InVEST-natcap.invest.hra-log-2023-05-10–16\_16\_56.txt](https://community.naturalcapitalalliance.org/uploads/short-url/26oePJGnW2xc3bK3FVXK3qIhVtL.txt) (1.7 KB)  
[InVEST-natcap.invest.hra-log-2023-05-10–16\_29\_23.txt](https://community.naturalcapitalalliance.org/uploads/short-url/tuHyc7GbmeaY4UwztQuriGH8D2Q.txt) (1.7 KB)  
[habitat\_stressor\_mon.csv](https://community.naturalcapitalalliance.org/uploads/short-url/fZpkBlv3WJTnDEzrTcFkP7M0vR2.csv) (3.6 KB)

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [May 11, 2023, 2:19pm UTC](https://community.naturalcapitalalliance.org/t/hra-attributeerror-float-object-has-no-attribute-lower/3733/2 "2023-05-11T14:19:29Z")

</div>

Hi @Gperilla , thanks for sharing your data.

The error appearing in your logs is this,

```plaintext
  File "natcap\invest\utils.py", line 164, in prepare_workspace
  File "invest\cli.py", line 469, in main
  File "natcap\invest\hra.py", line 537, in execute
  File "natcap\invest\hra.py", line 2047, in _parse_criteria_table
AttributeError: 'float' object has no attribute 'lower'

```

I found a small formatting error in your criteria table. Each stressor row is expected to repeat the column headers, “RATING, DQ, WEIGHT, …”

Please try the attached CSV to see what I mean.  
[ex\_criteria\_mon\_fixed.csv](https://community.naturalcapitalalliance.org/uploads/short-url/DRC0M25zx9weo4mMZk6EcndGLN.csv) (25.2 KB)

Thanks,

---

<div class="post-metadata">

**Author:** ![Gperilla](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@Gperilla](https://community.naturalcapitalalliance.org/u/Gperilla)\
**Post date:** [May 11, 2023, 6:47pm UTC](https://community.naturalcapitalalliance.org/t/hra-attributeerror-float-object-has-no-attribute-lower/3733/3 "2023-05-11T18:47:20Z")

</div>

thanks @dave, it solves the initial issue, but now im facing this new Error ‘NoneType’ object is not subscriptable,

i think it has something to do with some rasters sizes, however, the model was able to create the aligned tiffs and reprojected shapes  
these are the first stressor and the first habitat  
[aligned\_aeropuerto\_mon.tif](https://community.naturalcapitalalliance.org/uploads/short-url/xDADVAKsTgHiZHprX2XX3UWcr3z.tif) (57.0 KB)  
[reprojected\_sierra chiquita\_mon.zip](https://community.naturalcapitalalliance.org/uploads/short-url/mUoD7GaKCkiZy4FfeicWdU3M2Qz.zip) (10.2 KB)

[InVEST-Habitat-Risk-Assessment-log-2023-05-11–13\_38\_23.txt](https://community.naturalcapitalalliance.org/uploads/short-url/gFOeibPrMBLTQcXJjx5wUDBDSPf.txt) (35.8 KB)

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [May 11, 2023, 9:24pm UTC](https://community.naturalcapitalalliance.org/t/hra-attributeerror-float-object-has-no-attribute-lower/3733/4 "2023-05-11T21:24:20Z")

</div>

This new error is a tough one. It seems the aligned habitat and the aligned stressor that the model is creating are not actually aligned with one another. There is one extra column of pixels in the habitat raster.

```auto
aligned habitat
Width	2793
Height	2972

aligned stressor
Width	2792
Height	2972

```

I’m not sure of the cause of this yet, but we’ll get back to you as soon as we can. I tested this in version 3.13.0.

---

<div class="post-metadata">

**Author:** ![Gperilla](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@Gperilla](https://community.naturalcapitalalliance.org/u/Gperilla)\
**Post date:** [May 12, 2023, 5:20am UTC](https://community.naturalcapitalalliance.org/t/hra-attributeerror-float-object-has-no-attribute-lower/3733/5 "2023-05-12T05:20:23Z")

</div>

thank you @dave, i dont know why or how this error is happening, but i was able to work around it by poligonizing all my stressors, the model seems to work fine when using only poligons,  
it worked when i didnt have any rasters (.tif) as habitat or stressors

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [May 12, 2023, 12:29pm UTC](https://community.naturalcapitalalliance.org/t/hra-attributeerror-float-object-has-no-attribute-lower/3733/6 "2023-05-12T12:29:41Z")

</div>

Okay, thanks @Gperilla, good to know. Yes, I expect it would work fine with all polygons or all rasters. I have your data to reproduce the error, and it is likely a bug in the model, so we’ll try to get to the bottom of it anyway.

---

<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:** [May 19, 2023, 12:30pm UTC](https://community.naturalcapitalalliance.org/t/hra-attributeerror-float-object-has-no-attribute-lower/3733/7 "2023-05-19T12:30:02Z")

</div>

Closed on May 19, 2023, 12:30pm UTC

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