HRA- Model UnboundLocalError: local variable ‘current_stressor_header_row’

hello! I am having problem with running the HRA model.
An error occurs which says

utils.prepare_workspace(166) ERROR Exception while executing natcap.invest.hra
UnboundLocalError: local variable ‘current_stressor_header_row’ referenced before assignment
InVEST-natcap.invest.hra-log-2023-02-14–06_36_19.txt (1.7 KB)

I tried tried saving my input tables in CSVs comma delimitted and the projection system for all the layers are identical and in meters. Can you please guide me through it

Hello @Manipriyaprakash , welcome to the forums!

This error is probably an issue with the formatting of your criteria table, but the specific error message here makes me wonder if there isn’t something a little deeper going on. Would you please upload your criteria table here so we can take a closer look?


1 Like

criteria_score.csv (6.4 KB)
habitat_stresstor.csv (1.1 KB)

hello @james, thank you for your response

I am attaching my criteria table and input layers here, please guide me through

Manipriya (37.4 KB)

AREA OF (5.66 KB) (73.1 KB)

habitat_stresstor_test1.csv (989 Bytes)

criteria.csv (6.4 KB)

Hello @jdouglass! May I know if there is any update on the above mentioned error and the files shared across ?

Hello @Manipriyaprakash , I’m sorry about the delay! We had a week of kickoff meetings on a new project and they took more time than I expected.

Although the error message that was presented to you could absolutely be improved (and will be in an upcoming release of InVEST), the root of the problem here is the formatting of your criteria table. Specifically, there was a misspelling in the “HABITAT RESILIENCE ATTRIBUTES” field, which was causing the parsing function to behave in unexpected ways. The table below is corrected, and should work in the model now. Please let me know if it does not!

criteria_score.csv (6.4 KB)


1 Like

Thank you very much for your inputs, the model worked fine there was a error in one of the spatial data’s attribute table aswell. After correcting all the erros the model did work fine

I wanted to know, if there is a possibility of taking it to a next step of doing valuation ( monetary / any other kind) with the output data I received

Hi @Manipriyaprakash -

I haven’t done valuation related to the HRA model, but our marine team has. One example that I know about and can point you to is this paper that talks about doing coastal zone planning in Belize, where HRA contributed to several ecosystem services being valued. Other papers have also been written by that team about their work, which you can search for. I’m not sure how much detail they go into about their methods of doing valuation though.

~ Stacie

1 Like

Can we assess risk for species of birds and fish with HRA, without the availability of spatial data of their nesting sites

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