This forum is shutting down! Please post new discussions at

HRA Preprocessor - UnboundLocalError

Hi there,

I would like some help regarding an error please:

04/09/2018 10:57:52  natcap.invest.ui.usage ERROR    Error when transforming coordinates: local variable 'spatial_ref' referenced before assignment
Traceback (most recent call last):
  File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\ui\", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment

I am running Invest 3.4.4 on "Windows Server 2012 R2", and I am using the sample data sets that were provided by this version's download.

I have attached two logs:

the standard message log:
the window log message:

I have just started to look into this software. However, before I can use my own data, I wish to understand the processing by using the sample data. 

Is anybody able to help me solve the error please?




  • DaveDave Member, Administrator, NatCap Staff
    This is interesting. I'm seeing the same message in another model. So this error isn't coming from the HRA Preprocessor, but rather from the general InVEST user interface code. And the end of your log indicates that the model completed successfully after all. When you look in your output workspace, do you find the expected results? There should be a directory in your selected workspace called "habitat_stressor_ratings".

  • Hi Dave,

    Thanks for your advice.

    I have since run the following HRA model itself and again got the error. Moreove, since you have found this error with other models, perhaps this is a more generic error.

    However, after running both the HRA preprocessor and the HRA model with the sample datasets, it seems that the outputs are as expected. So, I presume that the error has not effected the outputs.

    In conclusion, when I run the models on my datasets, I will just have to be extra mindful with regards to this potentail issue.

    Hopefully, you all at NapCap are able to solve the issues in future software version releases.


  • RichRich Administrator, NatCap Staff
    HI, FYI, @Dave is right, this is an internal UI error that's only logging the error, not otherwise interrupting the flow of the model. I would expect that your result is otherwise correct so long as the model completed. And FYI, @jdouglass is working on a fix that'll go out in the next version of InVEST.
  • Hi Rich, Thanks very much for the update on this error. Great to that @jdouglass is working on it.
Sign In or Register to comment.