This forum is shutting down! Please post new discussions at community.naturalcapitalproject.org

Scenario Generator, 'KeyError: 95.0'

Hi again,

I've been trying to use the Scenario Generator (Rule-Based) but I've been getting 'KeyError: 95.0'. I do have a LULC in the Land Use raster and in the biophysical table with the value/id number 95. I have tried using the OID number in the biophysical table, but it didn't work with that. I've checked the two tables several times to see if there's any difference in how the numbers are presented, but there doesn't seem to be any. I've also attached screenshots of the Attribute Table for my land use file, and the CSV biophysical/transition table, to this post.

Here is my full traceback:

Initializing...
Showing messages with level INFO and higher
07/22/2018 10:20:14  natcap.invest.utils INFO     Writing log messages to C:\Users\andie\Documents\scenario_generator_workspace\InVEST-Scenario-Generator-log-2018-07-22--10_20_14.txt
07/22/2018 10:20:14  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
07/22/2018 10:20:14  natcap.invest.ui.model Level 100 Starting model with parameters: 
Arguments for InVEST natcap.invest.scenario_generator.scenario_generator 3.4.4:
calculate_constraints False
calculate_factors     False
calculate_priorities  False
calculate_proximity   True
calculate_transition  True
landcover             C:/Users/andie/Documents/Land Use New Project/MuncieWatershed_LandUse.bil
override_layer        False
priorities_csv_uri    
seed                  
suffix                
transition            C:/Users/andie/Documents/transition_table.csv
workspace_dir         C:\Users\andie\Documents\scenario_generator_workspace

07/22/2018 10:20:14  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
07/22/2018 10:20:14  natcap.invest.scenario_generator.scenario_generator INFO     Starting Scenario Generator model run...
07/22/2018 10:20:14  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
07/22/2018 10:20:14  natcap.invest.scenario_generator.scenario_generator INFO     Fetching and validating inputs...
07/22/2018 10:20:14  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
07/22/2018 10:20:14  natcap.invest.ui.usage._log_model WARNING  an exception encountered when logging RuntimeError('dictionary changed size during iteration',)
07/22/2018 10:20:14  natcap.invest.scenario_generator.scenario_generator INFO     Physical suitability weight not found in user arguments. Setting weight to 0.5
07/22/2018 10:20:15  natcap.invest.scenario_generator.scenario_generator INFO     Calculating transition...
07/22/2018 10:20:18  natcap.invest.scenario_generator.scenario_generator INFO     Constraints not included.
07/22/2018 10:20:18  natcap.invest.scenario_generator.scenario_generator INFO     Calculating proximity.
07/22/2018 10:20:18  natcap.invest.scenario_generator.scenario_generator INFO     Calculating proximity for 82.
07/22/2018 10:20:18  natcap.invest.scenario_generator.scenario_generator INFO     Creating euclidean distance raster...
07/22/2018 10:20:18  natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO     Distance Transform Phase 1
07/22/2018 10:20:18  natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO     Distance Transform Phase 2
07/22/2018 10:20:20  natcap.invest.pygeoprocessing_0_3_3.geoprocessing WARNING  this call is vectorizing which is deprecated and slow
07/22/2018 10:20:21  natcap.invest.pygeoprocessing_0_3_3.geoprocessing WARNING  this call is vectorizing which is deprecated and slow
07/22/2018 10:20:22  natcap.invest.scenario_generator.scenario_generator INFO     Calculating proximity for 23.
07/22/2018 10:20:23  natcap.invest.scenario_generator.scenario_generator INFO     Creating euclidean distance raster...
07/22/2018 10:20:23  natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO     Distance Transform Phase 1
07/22/2018 10:20:23  natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO     Distance Transform Phase 2
07/22/2018 10:20:25  natcap.invest.pygeoprocessing_0_3_3.geoprocessing WARNING  this call is vectorizing which is deprecated and slow
07/22/2018 10:20:26  natcap.invest.pygeoprocessing_0_3_3.geoprocessing WARNING  this call is vectorizing which is deprecated and slow
07/22/2018 10:20:28  natcap.invest.scenario_generator.scenario_generator INFO     Calculating proximity for 24.
07/22/2018 10:20:28  natcap.invest.scenario_generator.scenario_generator INFO     Creating euclidean distance raster...
07/22/2018 10:20:28  natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO     Distance Transform Phase 1
07/22/2018 10:20:28  natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO     Distance Transform Phase 2
07/22/2018 10:20:30  natcap.invest.pygeoprocessing_0_3_3.geoprocessing WARNING  this call is vectorizing which is deprecated and slow
07/22/2018 10:20:31  natcap.invest.pygeoprocessing_0_3_3.geoprocessing WARNING  this call is vectorizing which is deprecated and slow
07/22/2018 10:20:33  natcap.invest.scenario_generator.scenario_generator INFO     Combining suitability and proximity for 82.
07/22/2018 10:20:33  natcap.invest.scenario_generator.scenario_generator INFO     Vectorizing: C:\Users\andie\Documents\scenario_generator_workspace\intermediate\transition_82.tif, C:\Users\andie\Documents\scenario_generator_workspace\intermediate\proximity_norm_82.0.tif
07/22/2018 10:20:33  natcap.invest.pygeoprocessing_0_3_3.geoprocessing WARNING  this call is vectorizing which is deprecated and slow
07/22/2018 10:20:35  natcap.invest.scenario_generator.scenario_generator INFO     Combining suitability and proximity for 23.
07/22/2018 10:20:35  natcap.invest.scenario_generator.scenario_generator INFO     Vectorizing: C:\Users\andie\Documents\scenario_generator_workspace\intermediate\transition_23.tif, C:\Users\andie\Documents\scenario_generator_workspace\intermediate\proximity_norm_23.0.tif
07/22/2018 10:20:35  natcap.invest.pygeoprocessing_0_3_3.geoprocessing WARNING  this call is vectorizing which is deprecated and slow
07/22/2018 10:20:37  natcap.invest.scenario_generator.scenario_generator INFO     Combining suitability and proximity for 24.
07/22/2018 10:20:37  natcap.invest.scenario_generator.scenario_generator INFO     Vectorizing: C:\Users\andie\Documents\scenario_generator_workspace\intermediate\transition_24.tif, C:\Users\andie\Documents\scenario_generator_workspace\intermediate\proximity_norm_24.0.tif
07/22/2018 10:20:37  natcap.invest.pygeoprocessing_0_3_3.geoprocessing WARNING  this call is vectorizing which is deprecated and slow
07/22/2018 10:20:39  natcap.invest.scenario_generator.scenario_generator INFO     Calculating priorities with land attributes table...
07/22/2018 10:20:39  natcap.invest.scenario_generator.scenario_generator WARNING  Cover 71 suitability specified, but no change indicated.
07/22/2018 10:20:39  natcap.invest.scenario_generator.scenario_generator WARNING  Cover 41 suitability specified, but no change indicated.
07/22/2018 10:20:39  natcap.invest.scenario_generator.scenario_generator WARNING  Cover 42 suitability specified, but no change indicated.
07/22/2018 10:20:39  natcap.invest.scenario_generator.scenario_generator WARNING  Cover 11 suitability specified, but no change indicated.
07/22/2018 10:20:39  natcap.invest.scenario_generator.scenario_generator WARNING  Cover 81 suitability specified, but no change indicated.
07/22/2018 10:20:39  natcap.invest.scenario_generator.scenario_generator WARNING  Cover 52 suitability specified, but no change indicated.
07/22/2018 10:20:39  natcap.invest.scenario_generator.scenario_generator WARNING  Cover 21 suitability specified, but no change indicated.
07/22/2018 10:20:39  natcap.invest.scenario_generator.scenario_generator WARNING  Cover 22 suitability specified, but no change indicated.
07/22/2018 10:20:39  natcap.invest.ui.model ERROR    Exception while executing <function execute at 0x0E40C770>
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\scenario_generator\scenario_generator.py", line 1399, in execute
KeyError: 95.0
07/22/2018 10:20:39  natcap.invest.ui.model INFO     Execution finished
07/22/2018 10:20:39  natcap.invest.utils INFO     Elapsed time: 24.56s
07/22/2018 10:20:39  natcap.invest.ui.execution ERROR    Target <function _logged_target at 0x0275AF70> 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\scenario_generator\scenario_generator.py", line 1399, in execute
KeyError: 95.0
07/22/2018 10:20:39  natcap.invest.ui.execution INFO     Execution finished

How can I fix this?

Thanks,
Andie

Comments

  • jdouglassjdouglass Administrator, NatCap Staff
    Hi Andie, sorry for the delay.  If this is still unsolved, could you send your inputs to jdouglass@stanford.edu so I can take a look?  Thanks!
Sign In or Register to comment.