Habitat Quality KeyError

Hello! I've been trying my best to get the Habitat Quality module running, but it keeps throwing a rather obtuse error. Here's the log:

Arguments:
access_uri               R:/RRI/InVEST Model Clone/Hemlock/Protected_Lands1.shp
half_saturation_constant 0.5
landuse_cur_uri          R:/RRI/InVEST Model Clone/Hemlock/gap20_c/dblbnd.adf
sensitivity_uri          R:/RRI/InVEST Model Clone/Hemlock/Sensitivity_LULC.csv
suffix                   1
threats_uri              R:/RRI/InVEST Model Clone/Hemlock/Threats.csv
workspace_dir            R:\RRI\InVEST Model Clone\Hemlock


08/27/2015 14:36:15  root               INFO     Logging will be saved to habitat_quality-log-2015-08-27--14_36_15.txt
08/27/2015 14:36:15  root               DEBUG    Loaded the model from invest_natcap.habitat_quality.habitat_quality
08/27/2015 14:36:15  root               INFO     Executing the loaded model
08/27/2015 14:36:15  root               INFO     Running InVEST version "3.2.0"
08/27/2015 14:36:15  root               INFO     Python architecture: ('32bit', 'WindowsPE')
08/27/2015 14:36:15  root               INFO     Disk space remaining for workspace: 574.52 GB
08/27/2015 14:36:15  root               INFO     Pointing temporary directory at the workspace at R:\RRI\InVEST Model Clone\Hemlock
08/27/2015 14:36:15  root               INFO     Updating os.environ["TMP"]=C:\Users\FWD826\AppData\Local\Temp to R:\RRI\InVEST Model Clone\Hemlock
08/27/2015 14:36:15  root               INFO     Updating os.environ["TEMP"]=C:\Users\FWD826\AppData\Local\Temp to R:\RRI\InVEST Model Clone\Hemlock
08/27/2015 14:36:15  root               INFO     Setting os.environ["TMPDIR"]=R:\RRI\InVEST Model Clone\Hemlock
08/27/2015 14:36:15  root               INFO     Setting tempfile.tempdir to R:\RRI\InVEST Model Clone\Hemlock\tmp
08/27/2015 14:36:15  root               INFO     Starting habitat_quality
08/27/2015 14:36:15  invest_natcap.habitat_quality.habitat_quality DEBUG    Starting habitat_quality biophysical calculations
08/27/2015 14:36:15  invest_natcap.habitat_quality.habitat_quality DEBUG    Handling Access Shape
08/27/2015 14:36:49  invest_natcap.habitat_quality.habitat_quality DEBUG    landuse_uri_dict : {'_c': u'R:/RRI/InVEST Model Clone/Hemlock/gap20_c/dblbnd.adf'}
08/27/2015 14:36:49  invest_natcap.habitat_quality.habitat_quality DEBUG    Calculating results for landuse : _c
08/27/2015 14:36:49  invest_natcap.habitat_quality.habitat_quality DEBUG    Starting map_raster_to_dict_values
08/27/2015 14:36:49  root               ERROR    ---------------------------------------------------
08/27/2015 14:36:49  root               ERROR    ---------------------- ERROR ----------------------
08/27/2015 14:36:49  root               ERROR    ---------------------------------------------------
08/27/2015 14:36:49  root               ERROR    Error: exception found while running habitat_quality
08/27/2015 14:36:49  root               DEBUG    
08/27/2015 14:36:49  root               DEBUG    Build details
08/27/2015 14:36:49  root               DEBUG    Interpreter
08/27/2015 14:36:49  root               DEBUG    Current temp dir: R:\RRI\InVEST Model Clone\Hemlock\tmp
08/27/2015 14:36:49  root               DEBUG    tempfile.tempdir: R:\RRI\InVEST Model Clone\Hemlock\tmp
08/27/2015 14:36:49  root               DEBUG    
08/27/2015 14:36:49  root               DEBUG    System
08/27/2015 14:36:49  root               DEBUG    OS              : Windows-7-6.1.7601-SP1
08/27/2015 14:36:49  root               DEBUG    Processor architecture: AMD64
08/27/2015 14:36:49  root               DEBUG    FS encoding     : mbcs
08/27/2015 14:36:49  root               DEBUG    Preferred encoding: cp1252
08/27/2015 14:36:49  root               DEBUG    
08/27/2015 14:36:49  root               DEBUG    Python
08/27/2015 14:36:49  root               DEBUG    Version         : 2.7.9
08/27/2015 14:36:49  root               DEBUG    Build           : ('default', 'Dec 10 2014 12:24:55')
08/27/2015 14:36:49  root               DEBUG    Compiler        : MSC v.1500 32 bit (Intel)
08/27/2015 14:36:49  root               DEBUG    Implementation  : CPython
08/27/2015 14:36:49  root               DEBUG    Architecture    : 32bit
08/27/2015 14:36:49  root               DEBUG    Linkage format  : WindowsPE
08/27/2015 14:36:49  root               DEBUG    
08/27/2015 14:36:49  root               DEBUG    Packages
08/27/2015 14:36:49  root               DEBUG    Cython          : ?
08/27/2015 14:36:49  root               DEBUG    Numpy           : 1.8.1
08/27/2015 14:36:49  root               DEBUG    Scipy           : 0.15.1
08/27/2015 14:36:49  root               DEBUG    OSGEO           : 1.10.1
08/27/2015 14:36:49  root               DEBUG    Shapely         : 1.5.5
08/27/2015 14:36:49  root               DEBUG    InVEST          : 3.2.0
08/27/2015 14:36:49  root               DEBUG    
08/27/2015 14:36:49  root               DEBUG    
08/27/2015 14:36:49  root               DEBUG    Exception not environment-related
08/27/2015 14:36:49  root               DEBUG    Printing traceback
Traceback (most recent call last):
  File "invest_natcap\iui\executor.pyc", line 555, in runModel
  File "invest_natcap\habitat_quality\habitat_quality.pyc", line 206, in execute
  File "invest_natcap\habitat_quality\habitat_quality.pyc", line 677, in map_raster_to_dict_values
KeyError: 'HABITAT'
None

08/27/2015 14:36:49  root               ERROR    Exiting due to failures
08/27/2015 14:36:49  root               INFO     Elapsed time: 33.7s

Any idea what I'm doing wrong?

Comments

  • DougDoug Administrator, NatCap Staff
    Hi,

    It looks like this is due to a mis-labeled field in the Sensitivity table. The model is expecting a column header with the name of HABITAT, and that my need to be in all caps. Is it possible that you have a similar column in lowercase? Could you try changing it to all caps?

    Sorry bout this problem, the model should NOT be case sensitive like this and the User Interface should catch such validation issues.
  • DougDoug Administrator, NatCap Staff
    Marking this as resolved, will definitely be a non issue in the next release. 3.3.0. 
This discussion has been closed.