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

Nutrient Model "error 22"

Hi.
I am trying to use Nutrient model when all needed factor has been  full checked.
But I faced the value error.
"There was not a value for at least the following code [22] for this file・・・・.

Initializing...

12/15/2015 17:31:52 root DEBUG PATH: ['C:\\InVEST_3_2_0_x86\\invest-3-x86\\.']

12/15/2015 17:31:52 root DEBUG Loading nutrient from PATH

Arguments:

accum_threshold 1000

biophysical_table_uri C:/InVEST_3_2_0_x86/WP_Nutrient_Retention/Input/water_biophysical_table.csv

calc_n True

calc_p False

dem_uri E:/NewResearch/DEM/553656.tif

depth_to_root_rest_layer_uri E:/NewResearch/dojyou/dojoshindo.tif

eto_uri E:/NewResearch/kikoumesh/johashed1.tif

lulc_uri E:/NewResearch/shokusei/kumakishokusei/kumashokusei2.tif

pawc_uri E:/NewResearch/dojyou/yukosuibun.tif

precipitation_uri E:/NewResearch/dojyou/kousuished1.tif

seasonality_constant 5

valuation_enabled False

water_purification_threshold_table_uri E:/NewResearch/waterpurifi.csv

watersheds_uri E:/NewResearch/ryuiki/ryuikished2.shp

workspace_dir E:\NewResearch\nuttest



12/15/2015 17:31:54 root INFO Logging will be saved to nutrient-log-2015-12-15--17_31_52.txt

12/15/2015 17:31:54 root DEBUG Loaded the model from invest_natcap.nutrient.nutrient

12/15/2015 17:31:54 root INFO Executing the loaded model

12/15/2015 17:31:54 root INFO Running InVEST version "3.2.0"

12/15/2015 17:31:54 root INFO Python architecture: ('32bit', 'WindowsPE')

12/15/2015 17:31:54 root INFO Disk space remaining for workspace: 1.52 GB

12/15/2015 17:31:55 root INFO Pointing temporary directory at the workspace at E:\NewResearch\nuttest

12/15/2015 17:31:55 root INFO Updating os.environ["TMP"]=E:\NewResearch\nuttest\tmp to E:\NewResearch\nuttest

12/15/2015 17:31:55 root INFO Updating os.environ["TEMP"]=E:\NewResearch\nuttest\tmp to E:\NewResearch\nuttest

12/15/2015 17:31:55 root INFO Updating os.environ["TMPDIR"]=E:\NewResearch\nuttest\tmp to E:\NewResearch\nuttest

12/15/2015 17:31:55 root INFO Setting tempfile.tempdir to E:\NewResearch\nuttest\tmp

12/15/2015 17:31:55 root INFO Starting nutrient

12/15/2015 17:31:55 invest_natcap.hydropower.hydropower_water_yield INFO Starting Water Yield Core Calculations

12/15/2015 17:32:01 invest_natcap.hydropower.hydropower_water_yield INFO Reclassifying temp_Kc raster

12/15/2015 17:32:01 root ERROR ---------------------------------------------------

12/15/2015 17:32:01 root ERROR ---------------------- ERROR ----------------------

12/15/2015 17:32:01 root ERROR ---------------------------------------------------

12/15/2015 17:32:01 root ERROR Error: exception found while running nutrient

12/15/2015 17:32:01 root DEBUG

12/15/2015 17:32:01 root DEBUG Build details

12/15/2015 17:32:01 root DEBUG Interpreter

12/15/2015 17:32:01 root DEBUG Current temp dir: E:\NewResearch\nuttest\tmp

12/15/2015 17:32:01 root DEBUG tempfile.tempdir: E:\NewResearch\nuttest\tmp

12/15/2015 17:32:01 root DEBUG

12/15/2015 17:32:01 root DEBUG System

12/15/2015 17:32:01 root DEBUG OS : Windows-7-6.1.7601-SP1

12/15/2015 17:32:01 root DEBUG Processor architecture: x86

12/15/2015 17:32:01 root DEBUG FS encoding : mbcs

12/15/2015 17:32:01 root DEBUG Preferred encoding: cp932

12/15/2015 17:32:01 root DEBUG

12/15/2015 17:32:01 root DEBUG Python

12/15/2015 17:32:01 root DEBUG Version : 2.7.9

12/15/2015 17:32:01 root DEBUG Build : ('default', 'Dec 10 2014 12:24:55')

12/15/2015 17:32:01 root DEBUG Compiler : MSC v.1500 32 bit (Intel)

12/15/2015 17:32:01 root DEBUG Implementation : CPython

12/15/2015 17:32:01 root DEBUG Architecture : 32bit

12/15/2015 17:32:01 root DEBUG Linkage format : WindowsPE

12/15/2015 17:32:01 root DEBUG

12/15/2015 17:32:01 root DEBUG Packages

12/15/2015 17:32:01 root DEBUG Cython : ?

12/15/2015 17:32:01 root DEBUG Numpy : 1.8.1

12/15/2015 17:32:01 root DEBUG Scipy : 0.15.1

12/15/2015 17:32:01 root DEBUG OSGEO : 1.10.1

12/15/2015 17:32:01 root DEBUG Shapely : 1.5.5

12/15/2015 17:32:01 root DEBUG InVEST : 3.2.0

12/15/2015 17:32:01 root DEBUG

12/15/2015 17:32:01 root DEBUG

12/15/2015 17:32:01 root DEBUG Exception not environment-related

12/15/2015 17:32:01 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 [22] for this file E:\NewResearch\nuttest\tmp\tmpj0lks8.

Nodata value is: 0

None


12/15/2015 17:32:01 root ERROR Exiting due to failures

Please teach me why I face this error message.
Koto
Tagged:

Comments

  • DougDoug Administrator, NatCap Staff
    Hi Koto,

    Usually this error is due to not having matching LULC Codes. For ever LULC code found in the LULC raster there should be an equivalent LULC Code / row in the Biophysical input CSV table. Could you check that you have a LULC value of 22 specified in the Biophysical table?

    Cheers,

    Doug
  • Hi Doug,

    Thank you for your quick reply. I checked the LULC code and input the CSV table renew.
    But I face next error message (written below).
    "Key Error encountered:0"

    Initializing...

    12/16/2015 18:23:09 root DEBUG PATH: ['C:\\InVEST_3_2_0_x86\\invest-3-x86\\.']

    12/16/2015 18:23:09 root DEBUG Loading nutrient from PATH

    Arguments:

    accum_threshold 500

    biophysical_table_uri E:/NewResearch/biophysical5.csv

    calc_n True

    calc_p False

    dem_uri E:/NewResearch/demras/dem1.tif

    depth_to_root_rest_layer_uri E:/NewResearch/reresample/dojoshindo1.tif

    eto_uri E:/NewResearch/reresample/johashed1.tif

    lulc_uri E:/NewResearch/shokusei/kumakishokusei/kumashokusei2.tif

    pawc_uri E:/NewResearch/reresample/yukosuibun1.tif

    precipitation_uri E:/NewResearch/reresample/kousuished1.tif

    seasonality_constant 4

    valuation_enabled False

    water_purification_threshold_table_uri E:/NewResearch/waterpurifi.csv

    watersheds_uri E:/NewResearch/ryuiki/ryuikished2.shp

    workspace_dir E:\NewResearch\nuttest



    12/16/2015 18:23:10 root INFO Logging will be saved to nutrient-log-2015-12-16--18_23_09.txt

    12/16/2015 18:23:11 root DEBUG Loaded the model from invest_natcap.nutrient.nutrient

    12/16/2015 18:23:11 root INFO Executing the loaded model

    12/16/2015 18:23:11 root INFO Running InVEST version "3.2.0"

    12/16/2015 18:23:11 root INFO Python architecture: ('32bit', 'WindowsPE')

    12/16/2015 18:23:11 root INFO Disk space remaining for workspace: 1.45 GB

    12/16/2015 18:23:11 root INFO Pointing temporary directory at the workspace at E:\NewResearch\nuttest

    12/16/2015 18:23:11 root INFO Updating os.environ["TMP"]=C:\Users\Yusuke\AppData\Local\Temp to E:\NewResearch\nuttest

    12/16/2015 18:23:11 root INFO Updating os.environ["TEMP"]=C:\Users\Yusuke\AppData\Local\Temp to E:\NewResearch\nuttest

    12/16/2015 18:23:11 root INFO Setting os.environ["TMPDIR"]=E:\NewResearch\nuttest

    12/16/2015 18:23:11 root INFO Setting tempfile.tempdir to E:\NewResearch\nuttest\tmp

    12/16/2015 18:23:11 root INFO Starting nutrient

    12/16/2015 18:23:11 invest_natcap.hydropower.hydropower_water_yield INFO Starting Water Yield Core Calculations

    12/16/2015 18:23:18 pygeoprocessing.geoprocessing INFO align_dataset_list aligning dataset 1 of 5

    12/16/2015 18:23:26 invest_natcap.hydropower.hydropower_water_yield INFO Reclassifying temp_Kc raster

    12/16/2015 18:23:32 invest_natcap.hydropower.hydropower_water_yield INFO Reclassifying tmp_root raster

    12/16/2015 18:23:32 invest_natcap.hydropower.hydropower_water_yield INFO Reclassifying tmp_veg raster

    12/16/2015 18:23:32 invest_natcap.hydropower.hydropower_water_yield DEBUG Calculate PET from Ref Evap times Kc

    12/16/2015 18:23:33 invest_natcap.hydropower.hydropower_water_yield DEBUG Performing fractp operation

    12/16/2015 18:23:33 invest_natcap.hydropower.hydropower_water_yield DEBUG {'Kc': -1.0, 'soil': 0, 'pawc': 0, 'veg': -1.0, 'precip': -32768, 'root': -1.0, 'eto': -3.4028231e+38}

    12/16/2015 18:23:50 invest_natcap.hydropower.hydropower_water_yield DEBUG Performing wyield operation

    12/16/2015 18:24:12 invest_natcap.hydropower.hydropower_water_yield DEBUG Performing aet operation

    12/16/2015 18:24:32 root ERROR ---------------------------------------------------

    12/16/2015 18:24:32 root ERROR ---------------------- ERROR ----------------------

    12/16/2015 18:24:32 root ERROR ---------------------------------------------------

    12/16/2015 18:24:32 root ERROR Error: exception found while running nutrient

    12/16/2015 18:24:32 root DEBUG

    12/16/2015 18:24:32 root DEBUG Build details

    12/16/2015 18:24:32 root DEBUG Interpreter

    12/16/2015 18:24:32 root DEBUG Current temp dir: E:\NewResearch\nuttest\tmp

    12/16/2015 18:24:32 root DEBUG tempfile.tempdir: E:\NewResearch\nuttest\tmp

    12/16/2015 18:24:32 root DEBUG

    12/16/2015 18:24:32 root DEBUG System

    12/16/2015 18:24:32 root DEBUG OS : Windows-7-6.1.7601-SP1

    12/16/2015 18:24:32 root DEBUG Processor architecture: x86

    12/16/2015 18:24:32 root DEBUG FS encoding : mbcs

    12/16/2015 18:24:32 root DEBUG Preferred encoding: cp932

    12/16/2015 18:24:32 root DEBUG

    12/16/2015 18:24:32 root DEBUG Python

    12/16/2015 18:24:32 root DEBUG Version : 2.7.9

    12/16/2015 18:24:32 root DEBUG Build : ('default', 'Dec 10 2014 12:24:55')

    12/16/2015 18:24:32 root DEBUG Compiler : MSC v.1500 32 bit (Intel)

    12/16/2015 18:24:32 root DEBUG Implementation : CPython

    12/16/2015 18:24:32 root DEBUG Architecture : 32bit

    12/16/2015 18:24:32 root DEBUG Linkage format : WindowsPE

    12/16/2015 18:24:32 root DEBUG

    12/16/2015 18:24:32 root DEBUG Packages

    12/16/2015 18:24:32 root DEBUG Cython : ?

    12/16/2015 18:24:32 root DEBUG Numpy : 1.8.1

    12/16/2015 18:24:32 root DEBUG Scipy : 0.15.1

    12/16/2015 18:24:32 root DEBUG OSGEO : 1.10.1

    12/16/2015 18:24:32 root DEBUG Shapely : 1.5.5

    12/16/2015 18:24:32 root DEBUG InVEST : 3.2.0

    12/16/2015 18:24:32 root DEBUG

    12/16/2015 18:24:32 root DEBUG

    12/16/2015 18:24:32 root DEBUG Exception not environment-related

    12/16/2015 18:24:32 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 456, in execute

    File "pygeoprocessing\geoprocessing.pyc", line 949, in aggregate_raster_values_uri

    KeyError: 0

    None


    12/16/2015 18:24:32 root ERROR Exiting due to failures

     Please tell me why I face another error message.
    Sicerely yours.

    Koto
  • DougDoug Administrator, NatCap Staff
    Hi Koto,

    This looks to be either a former bug in the aggregate function we use or an issue with the watershed shapefiles.

    Could you check to make sure that your watershed shapefiles have a 'ws_id' field? Do you have a watershed with an ID of 0?

    Otherwise, could you try this development version of InVEST and see if it fixes the issue. We've made a lot of patches that will soon be released in version 3.3.0.


    Let us know!
  • Hi Doug.

    Thank you for your quick reply.
    This error message was caused by the letter which was not English on watershed shape file's column.
    So This error is not caused by a former bug.
    When I correct the shape file's column, I get the successful data.

    I am very grateful to you.
    Without your advice, I would not have noticed the cause of the error.

    Thank you for your continuous support.

    Koto


  • DougDoug Administrator, NatCap Staff
    Hi Koto,

    Good to know and very interesting. Is it possible you could send the shapefile that was causing the issue? You could email it to ddenu@stanford.edu . Or if it's big, Dropbox it to the same email.

    It would be great to have so we can debug against it in the future and build in methods of handling different characters.

    Glad you're up and running!

    Doug
This discussion has been closed.