HRA error: should be number but is "nan"


I tried to run the HRA model with (simplified) own data of the Belgian North Sea but ran into the following error:
Value Error encountered: Values in the DQ column for habitat “M_balthica” should be a number, but is “nan”

The consequence criteria table:
Book1.csv (6.1 KB)

The habitat info table:
habitat_stressor_info_X.csv (1.3 KB)

And the logfile for this run:
InVEST-Habitat-Risk-Assessment-log-2020-06-02–09_24_59.txt (7.6 KB)

Apologies I if asked ± the same question under another topic already. The title of the other doesn’t reflect the issue I’m having anymore so I decided to make a new one. Hope that doesn’t make your lives more difficult.

Thanks in advance for any help

1 Like

Hi Simon, thanks for posting. We also like to err on the side of starting a new topic.

Opening the criteria csv in LibreOffice I can see that the data are not aligned in the columns – all the data are crammed into the first column. If I open the csv in a text editor, I can see extra quotation marks are causing the problem:

"recruitment rate,3,2,2,1,2,2,3,2,2,1,2,2,C,""<enter (3) every 2+ yrs, (2) every 1-2 yrs, (1) every ""<1 yrs, or (0) no score>"""

The quotes are forcing the commas within to be interpreted literally instead of serving the purpose of delimiting columns. I’m not sure how the quotes got there (the habitat csv does not have this problem).

One option is to manually remove some of the quote pairs, though some are necessary, e.g. around "<enter (3) every 2+ yrs, (2) every 1-2 yrs, (1) every ""<1 yrs, or (0) no score>" where the commas are meant literally.

Another option is maybe backtrack, if you started the process in Excel, then perhaps choose a different export option? If you’re able to pinpoint where things went wrong, please follow up and let us know!

1 Like

Thanks for the quick response.
In Excel it didn’t reveal anything strange but in notepad there were indeed a bunch too many quotes, I think they got there when I tried to re-install the commas in the right place. Anyway, they’re supposed to be gone now:
Exposure_consuequence_criteria_X.csv (6.0 KB)

The model didn’t stop with an error, but it never really finished either, it got in some loop without making any progress anymore. Here is the logfile:
InVEST-Habitat-Risk-Assessment-log-2020-06-03–09_27_11.txt (80.9 KB)

Thanks again for any help.
Best regards

Okay, glad you got the table working.

That next issue is an interesting one and might be revealing a bug with an underlying library. Could you try running this in a fresh new workspace?


Hi Dave,

I ran the model with a fresh new workspace and it worked. I got some output of my own based on some input of my own! I’m very happy about that, thank you very much!

I found that, when adjusting the exposure consequence table via excel, these extra quotes crept in again, not sure why but it’s good to know where to look when I run in that particular error again. I also know that a fresh new workspace can also do the trick.

Now I can start running the model with varying inputs scores.

Thanks again
Best regards

1 Like

Great to hear! We’ll have a fix for that workspace problem forthcoming. A database in the workspace was created with a previous version of InVEST and was not compatible with the version you are running now. Ordinarily you should be able to re-use workspaces whenever you want to.