AttributeError: 'float' object has no attribute 'lower' in running InVEST Blue Carbon Model

Hello! I have been running the InVEST Blue Carbon Model using some seagrass maps but there has been an error.

Here are the log details:

Initializing...
Showing messages with level INFO and higher
06/19/2018 10:22:04  natcap.invest.utils INFO     Writing log messages to C:\Users\Anjuli\Documents\Anjuli\Final Thesis\Software Runs\06.19.18 InVEST\Seagrass Maps\Output\InVEST-Coastal-Blue-Carbon-log-2018-06-19--10_22_04.txt
06/19/2018 10:22:04  natcap.invest.ui.model Level 100 Starting model with parameters: 
Arguments for InVEST natcap.invest.coastal_blue_carbon.coastal_blue_carbon 3.4.4:
analysis_year              
carbon_pool_initial_uri    C:/Users/Anjuli/Documents/Anjuli/Final Thesis/Software Runs/06.19.18 InVEST/InVEST Blue Carbon Model Inputs/carbon_pool_initial_thesis.csv
carbon_pool_transient_uri  C:/Users/Anjuli/Documents/Anjuli/Final Thesis/Software Runs/06.19.18 InVEST/InVEST Blue Carbon Model Inputs/carbon_pool_transient_thesis.csv
discount_rate              6
do_economic_analysis       True
do_price_table             False
inflation_rate             4
lulc_baseline_map_uri      C:/Users/Anjuli/Documents/Anjuli/Final Thesis/Software Runs/06.19.18 InVEST/Seagrass Maps/bolinao_seagrass_2010.tif
lulc_baseline_year         2010
lulc_lookup_uri            C:/Users/Anjuli/Documents/Anjuli/Final Thesis/Software Runs/06.19.18 InVEST/InVEST Blue Carbon Model Inputs/lulc_lookup.csv
lulc_transition_maps_list  [u'C:/Users/Anjuli/Documents/Anjuli/Final Thesis/Software Runs/06.19.18 InVEST/Seagrass Maps/bolinao_seagrass_2018.tif']
lulc_transition_matrix_uri C:/Users/Anjuli/Documents/Anjuli/Final Thesis/Software Runs/06.19.18 InVEST/InVEST Blue Carbon Model Inputs/transitions_thesis.csv
lulc_transition_years_list [u'2018']
price                      40
results_suffix             
workspace_dir              C:\Users\Anjuli\Documents\Anjuli\Final Thesis\Software Runs\06.19.18 InVEST\Seagrass Maps\Output

06/19/2018 10:22:04  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:04  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Starting Coastal Blue Carbon model run...
06/19/2018 10:22:04  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:04  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:04  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:04  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:06  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:06  osgeo              ERROR    [errno 1] Maximum number of characters allowed reached.
06/19/2018 10:22:06  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:06  osgeo              WARNING  [errno 1] Could not find one of the X, Y or Z column names in header line. Defaulting to the first 3 columns
06/19/2018 10:22:07  osgeo              ERROR    [errno 1] Couldn't determine X spacing
06/19/2018 10:22:07  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:07  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:07  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:07  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:07  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:07  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:07  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\usage.py", line 176, in _merge_local_bounding_boxes
UnboundLocalError: local variable 'spatial_ref' referenced before assignment
06/19/2018 10:22:10  natcap.invest.ui.model ERROR    Exception while executing <function execute at 0x0ED4C630>
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\model.py", line 1505, in _logged_target
  File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\coastal_blue_carbon\coastal_blue_carbon.py", line 126, in execute
  File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\coastal_blue_carbon\coastal_blue_carbon.py", line 684, in get_inputs
  File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\coastal_blue_carbon\coastal_blue_carbon.py", line 684, in <genexpr>
AttributeError: 'float' object has no attribute 'lower'
06/19/2018 10:22:10  natcap.invest.ui.model INFO     Execution finished
06/19/2018 10:22:10  natcap.invest.utils INFO     Elapsed time: 5.82s
06/19/2018 10:22:10  natcap.invest.ui.execution ERROR    Target <function _logged_target at 0x0ED50670> failed with exception
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\execution.py", line 68, in run
  File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\ui\model.py", line 1505, in _logged_target
  File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\coastal_blue_carbon\coastal_blue_carbon.py", line 126, in execute
  File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\coastal_blue_carbon\coastal_blue_carbon.py", line 684, in get_inputs
  File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\coastal_blue_carbon\coastal_blue_carbon.py", line 684, in <genexpr>
AttributeError: 'float' object has no attribute 'lower'
06/19/2018 10:22:10  natcap.invest.ui.execution INFO     Execution finished

Can anyone please shed a light on this how to fix this? Thank you!

My seagrass maps are in GEOTIFF format. I am attaching the files that are input to the software here. Thank you.

Comments

  • jdouglassjdouglass Administrator, NatCap Staff
    Hi @knottynut, thanks for your inputs and logfile!  It goes a long way to helping us figure out where the issue lies.

    In this case, the model is crashing because the 'lulc-class' column in your lulc_lookup and carbon_pool_initial tables are numeric, so the model is interpreting these values as numeric.  If you change these values to text, the model should continue as expected.

    Hope this helps!
    James
  • Hello! Thank you for your reply. I have edited the lulc-class with text instead of numerical values. The model run successfully.
  • jdouglassjdouglass Administrator, NatCap Staff
    Great!   Thanks for letting us know.
This discussion has been closed.