Habitat Quality Error - 'float' and 'str'

Hello InVEST Community,

I recently ran the Habitat Quality model for the first time and encountered an error message: " TypeError: unsupported operand type(s) for +: ‘float’ and ‘str’ ". Despite the quick appearance of this error, all my input data seemed to be functioning correctly. I’m wondering if anyone has encountered a similar issue or has any insights into what might be causing it.

Thank you in advance.

Hello @anaacruz is it possible that a required table column is blank? This is the most common cause of this issue.

If that doesn’t make sense or isn’t the cause, could you provide your logfile so we can take a closer look at where, specifically, the model is crashing?


1 Like

Hello @jdouglass ! Thank you for the prompt response.

I noticed that there were blank columns (since I am only using current LULC, I thought base and future LULC would also need to be indicated in columns, but with the data blank, as in the UserGuide), so I deleted the blank columns, but the model still threw the same error when running.

I will share the logfile (would that be it?)

Thank you very much!!

InVEST-natcap.invest.habitat_quality-log-2024-04-01–20_35_28.txt (2.6 KB)

Thanks for your logfile @anaacruz! The specific error here is happening because there is a value in the THREAT column of your threats table that is being interpreted as a text string and not a number. I would suggest that you verify that all values of the THREAT column are, in fact, numbers. If that still doesn’t resolve the issue, please attach your threats table here and we can take a closer look.