Nutrient Model: Value Error Encountered

Hiya all,

Here's the error we're getting, and we have no idea why.  Help!!!

Arguments:
accum_threshold                        1000
biophysical_table_uri                  G:/projects/14145/ENVIRONMENTAL/GIS/Data Sources/Biophysical.csv
calc_n                                 True
calc_p                                 True
dem_uri                                G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopo.tif
depth_to_root_rest_layer_uri           G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoD2LYRmm.tif
eto_uri                                G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoPET.tif
lulc_uri                               G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoLULC.tif
pawc_uri                               G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoPAWC.tif
precipitation_uri                      G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoPRECIP.tif
seasonality_constant                   5
valuation_enabled                      False
water_purification_threshold_table_uri C:\InVEST_3_2_0_x86\WP_Nutrient_Retention\Input\water_purification_threshold.csv
water_purification_valuation_table_uri C:\InVEST_3_2_0_x86\WP_Nutrient_Retention\Input\water_purification_valuation.csv
watersheds_uri                         G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/SunkenMeadowContributingAreas.shp
workspace_dir                          C:\Users\pomi\Desktop\NEIWPCC\INVEST2


01/19/2016 08:39:43  root               INFO     Logging will be saved to nutrient-log-2016-01-19--08_39_43.txt
01/19/2016 08:39:43  root               DEBUG    Loaded the model from invest_natcap.nutrient.nutrient
01/19/2016 08:39:43  root               INFO     Executing the loaded model
01/19/2016 08:39:43  root               INFO     Running InVEST version "3.2.0"
01/19/2016 08:39:43  root               INFO     Python architecture: ('32bit', 'WindowsPE')
01/19/2016 08:39:43  root               INFO     Disk space remaining for workspace: 263.88 GB
01/19/2016 08:39:43  root               INFO     Pointing temporary directory at the workspace at C:\Users\pomi\Desktop\NEIWPCC\INVEST2
01/19/2016 08:39:43  root               INFO     Updating os.environ["TMP"]=C:\Users\pomi\Desktop\NEIWPCC\INVEST\tmp to C:\Users\pomi\Desktop\NEIWPCC\INVEST2
01/19/2016 08:39:43  root               INFO     Updating os.environ["TEMP"]=C:\Users\pomi\Desktop\NEIWPCC\INVEST\tmp to C:\Users\pomi\Desktop\NEIWPCC\INVEST2
01/19/2016 08:39:43  root               INFO     Updating os.environ["TMPDIR"]=C:\Users\pomi\Desktop\NEIWPCC\INVEST\tmp to C:\Users\pomi\Desktop\NEIWPCC\INVEST2
01/19/2016 08:39:43  root               INFO     Setting tempfile.tempdir to C:\Users\pomi\Desktop\NEIWPCC\INVEST2\tmp
01/19/2016 08:39:43  root               INFO     Starting nutrient
01/19/2016 08:39:43  invest_natcap.hydropower.hydropower_water_yield INFO     Starting Water Yield Core Calculations
01/19/2016 08:39:43  invest_natcap.hydropower.hydropower_water_yield INFO     Reclassifying temp_Kc raster
01/19/2016 08:39:43  root               ERROR    ---------------------------------------------------
01/19/2016 08:39:43  root               ERROR    ---------------------- ERROR ----------------------
01/19/2016 08:39:43  root               ERROR    ---------------------------------------------------
01/19/2016 08:39:43  root               ERROR    Error: exception found while running nutrient
01/19/2016 08:39:43  root               DEBUG    
01/19/2016 08:39:43  root               DEBUG    Build details
01/19/2016 08:39:43  root               DEBUG    Interpreter
01/19/2016 08:39:43  root               DEBUG    Current temp dir: C:\Users\pomi\Desktop\NEIWPCC\INVEST2\tmp
01/19/2016 08:39:43  root               DEBUG    tempfile.tempdir: C:\Users\pomi\Desktop\NEIWPCC\INVEST2\tmp
01/19/2016 08:39:43  root               DEBUG    
01/19/2016 08:39:43  root               DEBUG    System
01/19/2016 08:39:43  root               DEBUG    OS              : Windows-7-6.1.7601-SP1
01/19/2016 08:39:43  root               DEBUG    Processor architecture: AMD64
01/19/2016 08:39:43  root               DEBUG    FS encoding     : mbcs
01/19/2016 08:39:43  root               DEBUG    Preferred encoding: cp1252
01/19/2016 08:39:43  root               DEBUG    
01/19/2016 08:39:43  root               DEBUG    Python
01/19/2016 08:39:43  root               DEBUG    Version         : 2.7.9
01/19/2016 08:39:43  root               DEBUG    Build           : ('default', 'Dec 10 2014 12:24:55')
01/19/2016 08:39:43  root               DEBUG    Compiler        : MSC v.1500 32 bit (Intel)
01/19/2016 08:39:43  root               DEBUG    Implementation  : CPython
01/19/2016 08:39:43  root               DEBUG    Architecture    : 32bit
01/19/2016 08:39:43  root               DEBUG    Linkage format  : WindowsPE
01/19/2016 08:39:43  root               DEBUG    
01/19/2016 08:39:43  root               DEBUG    Packages
01/19/2016 08:39:43  root               DEBUG    Cython          : ?
01/19/2016 08:39:43  root               DEBUG    Numpy           : 1.8.1
01/19/2016 08:39:43  root               DEBUG    Scipy           : 0.15.1
01/19/2016 08:39:43  root               DEBUG    OSGEO           : 1.10.1
01/19/2016 08:39:43  root               DEBUG    Shapely         : 1.5.5
01/19/2016 08:39:43  root               DEBUG    InVEST          : 3.2.0
01/19/2016 08:39:43  root               DEBUG    
01/19/2016 08:39:43  root               DEBUG    
01/19/2016 08:39:43  root               DEBUG    Exception not environment-related
01/19/2016 08:39:43  root               DEBUG    Printing traceback
Traceback (most recent call last):
  File "invest_natcap\iui\executor.pyc", line 555, in runModel
  File "invest_natcap\nutrient\nutrient.pyc", line 193, in execute
  File "invest_natcap\hydropower\hydropower_water_yield.pyc", line 186, in execute
  File "pygeoprocessing\geoprocessing.pyc", line 1619, in reclassify_dataset_uri
  File "pygeoprocessing\geoprocessing.pyc", line 2386, in vectorize_datasets
  File "pygeoprocessing\geoprocessing.pyc", line 1609, in map_dataset_to_value
ValueError: There was not a value for at least the following codes [ 0 24] for this file C:\Users\pomi\Desktop\NEIWPCC\INVEST2\tmp\tmpquokg0.
Nodata value is: 255
None

01/19/2016 08:39:43  root               ERROR    Exiting due to failures
01/19/2016 08:39:43  root               INFO     Elapsed time: 0.6s

Comments

  • DougDoug Administrator, NatCap Staff
    Hi,

    This error is usually due to a land cover code discrepancy between the land cover raster and the values found in the biophysical table. Specifically it looks like you have land cover values of 0 and 24 in your "WestTopoLULC.tif" raster but no corresponding values in the "Biophysical.csv". Could you check to make sure that these land cover codes are represented in your table?

    Keep us posted,

    Cheers
  • LaraULaraU Member
    edited January 2016

    Thank you!  That's very helpful (and I'd love to know how you deciphered that from the log).  We corrected that for 24.  Our raster didn't have a 0 value, but we made a dummy field because otherwise it wouldn't run.  In doing so, we get a new error.  Here it is:



    Initializing...




    01/19/2016
    12:54:14 root DEBUG PATH: ['C:\\InVEST_3_2_0_x86\\invest-3-x86\\.']



    01/19/2016
    12:54:14 root DEBUG Loading nutrient from PATH



    Arguments:



    accum_threshold
    1000



    biophysical_table_uri
    G:/projects/14145/ENVIRONMENTAL/GIS/Data Sources/Biophysical.csv



    calc_n True



    calc_p True



    dem_uri
    G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopo.tif



    depth_to_root_rest_layer_uri
    G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoD2LYRmm.tif



    eto_uri
    G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoPET.tif



    lulc_uri
    G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoLULC.tif



    pawc_uri
    G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoPAWC.tif



    precipitation_uri
    G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST Data/NY/WestTopoPRECIP.tif



    seasonality_constant
    5



    valuation_enabled
    False



    water_purification_threshold_table_uri
    C:\InVEST_3_2_0_x86\WP_Nutrient_Retention\Input\water_purification_threshold.csv



    watersheds_uri
    G:/projects/14145/ENVIRONMENTAL/GIS/shp/InVEST
    Data/NY/SunkenMeadowContributingAreas.shp



    workspace_dir
    G:\projects\14145\ENVIRONMENTAL\GIS\Data Sources\InVEST




    01/19/2016
    12:54:14 root INFO Logging will be saved to nutrient-log-2016-01-19--12_54_14.txt



    01/19/2016
    12:54:14 root DEBUG Loaded the model from invest_natcap.nutrient.nutrient



    01/19/2016
    12:54:14 root INFO Executing the loaded model



    01/19/2016
    12:54:14 root INFO Running InVEST version "3.2.0"



    01/19/2016
    12:54:14 root INFO Python architecture: ('32bit', 'WindowsPE')



    01/19/2016
    12:54:14 root INFO Disk space remaining for workspace: 1.89 TB



    01/19/2016
    12:54:14 root INFO Pointing temporary directory at the workspace at
    G:\projects\14145\ENVIRONMENTAL\GIS\Data Sources\InVEST



    01/19/2016
    12:54:14 root INFO Updating
    os.environ["TMP"]=C:\Users\hemouna\AppData\Local\Temp to
    G:\projects\14145\ENVIRONMENTAL\GIS\Data Sources\InVEST



    01/19/2016
    12:54:14 root INFO Updating os.environ["TEMP"]=C:\Users\hemouna\AppData\Local\Temp
    to G:\projects\14145\ENVIRONMENTAL\GIS\Data Sources\InVEST



    01/19/2016
    12:54:14 root INFO Setting
    os.environ["TMPDIR"]=G:\projects\14145\ENVIRONMENTAL\GIS\Data
    Sources\InVEST



    01/19/2016
    12:54:14 root INFO Setting tempfile.tempdir to
    G:\projects\14145\ENVIRONMENTAL\GIS\Data Sources\InVEST\tmp



    01/19/2016
    12:54:14 root INFO Starting nutrient



    01/19/2016
    12:54:14 invest_natcap.hydropower.hydropower_water_yield INFO Starting Water
    Yield Core Calculations



    01/19/2016
    12:54:16 invest_natcap.hydropower.hydropower_water_yield INFO Reclassifying
    temp_Kc raster



    01/19/2016
    12:54:16 invest_natcap.hydropower.hydropower_water_yield INFO Reclassifying
    tmp_root raster



    01/19/2016
    12:54:17 invest_natcap.hydropower.hydropower_water_yield INFO Reclassifying
    tmp_veg raster



    01/19/2016
    12:54:17 invest_natcap.hydropower.hydropower_water_yield DEBUG Calculate PET
    from Ref Evap times Kc



    01/19/2016
    12:54:18 invest_natcap.hydropower.hydropower_water_yield DEBUG Performing
    fractp operation



    01/19/2016 12:54:18
    invest_natcap.hydropower.hydropower_water_yield DEBUG {'Kc': -1.0, 'soil':
    -3.4028235e+38, 'pawc': -3.4028231e+38, 'veg': -1.0, 'precip': -3.4028231e+38,
    'root': -1.0, 'eto': 32767}



    01/19/2016
    12:54:20 invest_natcap.hydropower.hydropower_water_yield DEBUG Performing
    wyield operation



    01/19/2016
    12:54:21 invest_natcap.hydropower.hydropower_water_yield DEBUG Performing aet
    operation



    01/19/2016
    12:54:29 invest_natcap.hydropower.hydropower_water_yield DEBUG
    wyield_value_dict_ws : {1: {'precip_mn': 1238.760009765625, 'AET_mn':
    410.80691321676295, 'PET_mn': 618.191184573002, 'wyield_mn': 827.9530965488616,
    'wyield_vol': 9016409.221417103, 'num_pixels': 1089.0, 'ws_id': 1}, 2:
    {'precip_mn': 1238.760009765625, 'AET_mn': 367.46065497739966, 'PET_mn':
    528.3583748828487, 'wyield_mn': 837.0506010037021, 'wyield_vol':
    17862659.825419, 'num_pixels': 2134.0, 'ws_id': 2}, 3: {'precip_mn':
    1238.760009765625, 'AET_mn': 428.4206355308106, 'PET_mn': 578.8275964391688,
    'wyield_mn': 810.339374234815, 'wyield_vol': 2730843.691171326, 'num_pixels':
    337.0, 'ws_id': 3}, 4: {'precip_mn': 1238.760009765625, 'AET_mn':
    409.0751787746335, 'PET_mn': 561.8440809968856, 'wyield_mn': 829.6848309909906,
    'wyield_vol': 5326576.614962159, 'num_pixels': 642.0, 'ws_id': 4}, 5:
    {'precip_mn': 1238.760009765625, 'AET_mn': 347.22045551935065, 'PET_mn':
    420.92561205273057, 'wyield_mn': 891.5395542462755, 'wyield_vol':
    4734075.033047723, 'num_pixels': 531.0, 'ws_id': 5}, 6: {'precip_mn':
    1238.760009765625, 'AET_mn': 353.39630855137113, 'PET_mn': 394.7720238095237,
    'wyield_mn': 885.3637012142542, 'wyield_vol': 1487411.0180399474, 'num_pixels':
    168.0, 'ws_id': 6}, 7: {'precip_mn': 1238.760009765625, 'AET_mn':
    530.2015520749554, 'PET_mn': 676.5566450742241, 'wyield_mn': 688.4975668442626,
    'wyield_vol': 5101766.970315985, 'num_pixels': 741.0, 'ws_id': 7}, 8:
    {'precip_mn': 1238.760009765625, 'AET_mn': 384.85482819148234, 'PET_mn':
    472.1139042553195, 'wyield_mn': 844.021458091971, 'wyield_vol':
    3173520.682425811, 'num_pixels': 376.0, 'ws_id': 8}, 9: {'precip_mn':
    1238.760009765625, 'AET_mn': 374.77939683781807, 'PET_mn': 516.9688356164386,
    'wyield_mn': 863.9806129278076, 'wyield_vol': 2522823.3897491978, 'num_pixels':
    292.0, 'ws_id': 9}, 10: {'precip_mn': 1238.760009765625, 'AET_mn':
    565.7338878391364, 'PET_mn': 725.6111006879299, 'wyield_mn': 666.8284483316637,
    'wyield_vol': 10662586.8888233, 'num_pixels': 1599.0, 'ws_id': 10}, 11:
    {'precip_mn': 1238.760009765625, 'AET_mn': 394.2120913204745, 'PET_mn':
    538.9865056818179, 'wyield_mn': 844.5479184451509, 'wyield_vol':
    5945617.345853862, 'num_pixels': 704.0, 'ws_id': 11}, 12: {'precip_mn':
    1238.760009765625, 'AET_mn': 307.4275269482682, 'PET_mn': 368.37507507507513,
    'wyield_mn': 931.3324828173568, 'wyield_vol': 3101337.167781798, 'num_pixels':
    333.0, 'ws_id': 12}, 13: {'precip_mn': 1238.760009765625, 'AET_mn':
    401.1134517084495, 'PET_mn': 609.2851015801359, 'wyield_mn': 837.6465580571752,
    'wyield_vol': 3710774.252193286, 'num_pixels': 443.0, 'ws_id': 13}, 14:
    {'precip_mn': 1238.760009765625, 'AET_mn': 334.07659254118073, 'PET_mn':
    355.41475903614463, 'wyield_mn': 904.6834172244445, 'wyield_vol':
    3003548.9451851556, 'num_pixels': 332.0, 'ws_id': 14}, 15: {'precip_mn':
    1238.760009765625, 'AET_mn': 317.17963865923775, 'PET_mn': 336.7390625000003,
    'wyield_mn': 921.580371106388, 'wyield_vol': 4718491.500064706, 'num_pixels':
    512.0, 'ws_id': 15}}




    01/19/2016
    12:54:29 invest_natcap.hydropower.hydropower_water_yield DEBUG Water Scarcity
    Not Selected



    01/19/2016
    12:54:30 invest_natcap.nutrient.nutrient INFO calculating flow accumulation



    01/19/2016
    12:54:30 pygeoprocessing.routing.routing_core INFO labeling flats



    01/19/2016
    12:54:30 pygeoprocessing.routing.routing_core INFO draining away from higher



    01/19/2016
    12:54:30 pygeoprocessing.routing.routing_core INFO draining towards lower



    01/19/2016
    12:54:30 pygeoprocessing.routing DEBUG flats exist, calculating flow direction
    for them



    01/19/2016
    12:54:30 pygeoprocessing.routing.routing_core INFO labeling flats



    01/19/2016
    12:54:30 pygeoprocessing.routing.routing_core INFO draining away from higher



    01/19/2016
    12:54:30 pygeoprocessing.routing.routing_core INFO draining towards lower



    01/19/2016
    12:54:30 pygeoprocessing.routing INFO flats exist on second pass, must be flat
    areas that abut the raster edge



    01/19/2016
    12:54:31 pygeoprocessing.routing DEBUG starting flow accumulation



    01/19/2016
    12:54:32 invest_natcap.nutrient.nutrient INFO Classifying streams from flow
    accumulation raster



    01/19/2016
    12:54:32 invest_natcap.nutrient.nutrient DEBUG
    G:\projects\14145\ENVIRONMENTAL\GIS\Data Sources\InVEST\tmp\tmpdrialx



    01/19/2016
    12:54:32 pygeoprocessing.geoprocessing WARNING this call is vectorizing which
    is deprecated and slow



    01/19/2016
    12:54:33 pygeoprocessing.geoprocessing WARNING this call is vectorizing which
    is deprecated and slow



    01/19/2016
    12:54:33 invest_natcap.nutrient.nutrient DEBUG
    G:\projects\14145\ENVIRONMENTAL\GIS\Data Sources\InVEST\tmp\tmpdrialx



    01/19/2016
    12:54:33 pygeoprocessing.geoprocessing WARNING this call is vectorizing which
    is deprecated and slow



    01/19/2016 12:54:34
    pygeoprocessing.geoprocessing WARNING this call is vectorizing which is
    deprecated and slow



    01/19/2016
    12:54:38 pygeoprocessing.geoprocessing WARNING this call is vectorizing which
    is deprecated and slow



    01/19/2016
    12:54:41 pygeoprocessing.geoprocessing WARNING this call is vectorizing which
    is deprecated and slow



    01/19/2016
    12:54:41 pygeoprocessing.routing.routing_core INFO calculating percent to sink



    01/19/2016
    12:54:41 pygeoprocessing.routing.routing_core INFO Done calculating percent to
    sink elapsed time 0s



    01/19/2016
    12:54:41 pygeoprocessing.geoprocessing WARNING this call is vectorizing which
    is deprecated and slow



    01/19/2016
    12:54:42 invest_natcap.nutrient.nutrient INFO Summarizing the results of
    nutrient n



    01/19/2016
    12:54:44 root ERROR ---------------------------------------------------



    01/19/2016
    12:54:44 root ERROR ---------------------- ERROR ----------------------



    01/19/2016
    12:54:44 root ERROR ---------------------------------------------------



    01/19/2016
    12:54:44 root ERROR Error: exception found while running nutrient



    01/19/2016
    12:54:44 root DEBUG



    01/19/2016
    12:54:44 root DEBUG Build details



    01/19/2016
    12:54:44 root DEBUG Interpreter



    01/19/2016
    12:54:44 root DEBUG Current temp dir: G:\projects\14145\ENVIRONMENTAL\GIS\Data
    Sources\InVEST\tmp



    01/19/2016
    12:54:44 root DEBUG tempfile.tempdir: G:\projects\14145\ENVIRONMENTAL\GIS\Data
    Sources\InVEST\tmp



    01/19/2016
    12:54:44 root DEBUG



    01/19/2016
    12:54:44 root DEBUG System



    01/19/2016
    12:54:44 root DEBUG OS : Windows-7-6.1.7601-SP1



    01/19/2016 12:54:44
    root DEBUG Processor architecture: AMD64



    01/19/2016
    12:54:44 root DEBUG FS encoding : mbcs



    01/19/2016
    12:54:44 root DEBUG Preferred encoding: cp1252



    01/19/2016
    12:54:44 root DEBUG



    01/19/2016
    12:54:44 root DEBUG Python



    01/19/2016
    12:54:44 root DEBUG Version : 2.7.9



    01/19/2016
    12:54:44 root DEBUG Build : ('default', 'Dec 10 2014 12:24:55')



    01/19/2016
    12:54:44 root DEBUG Compiler : MSC v.1500 32 bit (Intel)



    01/19/2016
    12:54:44 root DEBUG Implementation : CPython



    01/19/2016
    12:54:44 root DEBUG Architecture : 32bit



    01/19/2016
    12:54:44 root DEBUG Linkage format : WindowsPE



    01/19/2016
    12:54:44 root DEBUG



    01/19/2016
    12:54:44 root DEBUG Packages



    01/19/2016
    12:54:44 root DEBUG Cython : ?



    01/19/2016
    12:54:44 root DEBUG Numpy : 1.8.1



    01/19/2016
    12:54:44 root DEBUG Scipy : 0.15.1



    01/19/2016
    12:54:44 root DEBUG OSGEO : 1.10.1



    01/19/2016
    12:54:44 root DEBUG Shapely : 1.5.5



    01/19/2016
    12:54:44 root DEBUG InVEST : 3.2.0



    01/19/2016
    12:54:44 root DEBUG



    01/19/2016
    12:54:44 root DEBUG



    01/19/2016
    12:54:44 root DEBUG Exception not environment-related



    01/19/2016
    12:54:44 root DEBUG Printing traceback




    Traceback (most
    recent call last):



    File
    "invest_natcap\iui\executor.pyc", line 555, in runModel



    File
    "invest_natcap\nutrient\nutrient.pyc", line 206, in execute



    File
    "invest_natcap\nutrient\nutrient.pyc", line 494, in _execute_nutrient




    KeyError: 3



    None




    01/19/2016
    12:54:44 root ERROR Exiting due to failures




    Post edited by LaraU on
  • RichRich Administrator, NatCap Staff
    Hi, that second error looks like you have a (sub)watershed with an ID of "3" but no corresponding entry in the threshold lookup table.  Can you check your threshold table and see if that ID is missing?
Sign In or Register to comment.