Problems with the hydropower valuation model

Hello, 
    I have problems when I run the hydropower valuation model within the water yield model. When I haven't chosen  the valuation model, I can get the output of water scaricy model. And the error code is shown partly as below,



07/10/2015 17:20:24  root               ERROR    ---------------------------------------------------
07/10/2015 17:20:24  root               ERROR    ---------------------- ERROR ----------------------
07/10/2015 17:20:24  root               ERROR    ---------------------------------------------------
07/10/2015 17:20:24  root               ERROR    Error: exception found while running hydropower_water_yield
07/10/2015 17:20:24  root               DEBUG    
07/10/2015 17:20:24  root               DEBUG    Build details
07/10/2015 17:20:24  root               DEBUG    Interpreter
07/10/2015 17:20:24  root               DEBUG    Current temp dir: D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp
07/10/2015 17:20:24  root               DEBUG    tempfile.tempdir: D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp
07/10/2015 17:20:24  root               DEBUG    
07/10/2015 17:20:24  root               DEBUG    System
07/10/2015 17:20:24  root               DEBUG    OS              : Windows-7-6.1.7601-SP1
07/10/2015 17:20:24  root               DEBUG    Processor architecture: AMD64
07/10/2015 17:20:24  root               DEBUG    FS encoding     : mbcs
07/10/2015 17:20:24  root               DEBUG    
07/10/2015 17:20:24  root               DEBUG    Python
07/10/2015 17:20:24  root               DEBUG    Version         : 2.7.9
07/10/2015 17:20:24  root               DEBUG    Build           : ('default', 'Dec 10 2014 12:24:55')
07/10/2015 17:20:24  root               DEBUG    Compiler        : MSC v.1500 32 bit (Intel)
07/10/2015 17:20:24  root               DEBUG    Implementation  : CPython
07/10/2015 17:20:24  root               DEBUG    Architecture    : 32bit
07/10/2015 17:20:24  root               DEBUG    Linkage format  : WindowsPE
07/10/2015 17:20:24  root               DEBUG    
07/10/2015 17:20:24  root               DEBUG    Packages
07/10/2015 17:20:24  root               DEBUG    Cython          : ?
07/10/2015 17:20:24  root               DEBUG    Numpy           : 1.8.1
07/10/2015 17:20:24  root               DEBUG    Scipy           : 0.15.1
07/10/2015 17:20:24  root               DEBUG    OSGEO           : 1.10.1
07/10/2015 17:20:24  root               DEBUG    Shapely         : 1.5.5
07/10/2015 17:20:24  root               DEBUG    InVEST          : 3.1.3
07/10/2015 17:20:24  root               DEBUG    
07/10/2015 17:20:24  root               DEBUG    
07/10/2015 17:20:24  root               DEBUG    Exception not environment-related
07/10/2015 17:20:24  root               DEBUG    Printing traceback
Traceback (most recent call last):
  File "invest_natcap\iui\executor.pyc", line 553, in runModel
  File "invest_natcap\hydropower\hydropower_water_yield.pyc", line 603, in execute
  File "invest_natcap\hydropower\hydropower_water_yield.pyc", line 661, in compute_watershed_valuation
KeyError: 3
None

07/10/2015 17:20:24  root               ERROR    Exiting due to failures


Please someone help me to figure out the problem.
Thank you .


Comments

  • DougDoug Administrator, NatCap Staff
    Hi @pink ,

    I believe this is from an unfortunate bug in our User Interface. If you open the hydropower model, can you select and then deselect the Scarcity / Valuation components? For some reason, on first launch, though these are not selected the model thinks that they are.

    Let me know if that works for you, sorry for the inconvenience. We have a more comprehensive User Interface in the works to release in the future!

    Doug
  • pinkpink Member
    edited July 2015
    Hi Doug,
        My problem cannot be solved in this way after I try that twice.And the code remains the same as before. What should I do next?
    Post edited by pink on
  • DougDoug Administrator, NatCap Staff
    Do you think you could attach the most recent log txt file for your run?

    Also, if you want to zip up your datastack (input files / workspace) and email / dropbox them to ddenu@stanford.edu, I'd be happy to take a look!
  • DougDoug Administrator, NatCap Staff
    Are you interested in running all 3 components of the model? Or are you only interested in water yield and scarcity? Thanks!
  • pinkpink Member
    Hello, 
    This is the most recent log. And I want to ask a question. If my study area contains 14 watershed, and there is no hydropower station data for  one of the watershed , does it means that I cannot get the output of other watershed.

    Initializing...
    07/10/2015 17:10:42  root               DEBUG    PATH: ['E:\\invest3.1.2\\invest 3.1.3\\InVEST_3_1_3_x86\\invest-3-x86\\.']
    07/10/2015 17:10:42  root               DEBUG    Loading hydropower_water_yield from PATH
    Arguments:
    biophysical_table_uri        D:/zm1/projection/water yield data/biophysical_table.csv
    demand_table_uri             D:/zm1/projection/water_demand_jlj.csv
    depth_to_root_rest_layer_uri D:/zm1/projection/water yield data/soil/710/w001001.adf
    eto_uri                      D:/zm1/projection/water yield data/eto/eto/w001001.adf
    lulc_uri                     D:/zm1/projection/water yield data/lu_fuzhi1/w001001.adf
    pawc_uri                     D:/zm1/projection/water yield data/pawc_new710/pawc_repro/w001001.adf
    precipitation_uri            D:/zm1/projection/water yield data/precip6a/prj_jlj_prec/w001001.adf
    results_suffix               
    seasonality_constant         9.709
    sub_watersheds_uri           D:/zm1/projection/water yield data/subws_dissolve2/subws_Dissolve1.shp
    valuation_container          True
    valuation_table_uri          D:/zm1/projection/station_data/hydropower_station_information.csv
    water_scarcity_container     True
    watersheds_uri               D:/zm1/projection/water yield data/ws1/subws_Dissolve1.shp
    workspace_dir                D:\zm1\invest_3.1.3_output\hydropower_0710_3


    07/10/2015 17:10:43  root               INFO     Logging will be saved to hydropower_water_yield-log-2015-07-10--17_10_42.txt
    07/10/2015 17:10:43  root               DEBUG    Loaded the model from invest_natcap.hydropower.hydropower_water_yield
    07/10/2015 17:10:43  root               INFO     Executing the loaded model
    07/10/2015 17:10:43  root               INFO     Running InVEST version "3.1.3"
    07/10/2015 17:10:43  root               INFO     Python architecture: ('32bit', 'WindowsPE')
    07/10/2015 17:10:43  root               INFO     Disk space remaining for workspace: 58.84 GB
    07/10/2015 17:10:43  root               INFO     Pointing temporary directory at the workspace at D:\zm1\invest_3.1.3_output\hydropower_0710_3
    07/10/2015 17:10:43  root               INFO     Updating os.environ["TMP"]=D:\zm1\invest_3.1.3_output\hydropower_0710_2\tmp to D:\zm1\invest_3.1.3_output\hydropower_0710_3
    07/10/2015 17:10:43  root               INFO     Updating os.environ["TEMP"]=D:\zm1\invest_3.1.3_output\hydropower_0710_2\tmp to D:\zm1\invest_3.1.3_output\hydropower_0710_3
    07/10/2015 17:10:43  root               INFO     Updating os.environ["TMPDIR"]=D:\zm1\invest_3.1.3_output\hydropower_0710_2\tmp to D:\zm1\invest_3.1.3_output\hydropower_0710_3
    07/10/2015 17:10:43  root               INFO     Setting tempfile.tempdir to D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp
    07/10/2015 17:10:43  root               INFO     Starting hydropower_water_yield
    07/10/2015 17:10:43  invest_natcap.hydropower.hydropower_water_yield INFO     Starting Water Yield Core Calculations
    07/10/2015 17:10:50  pygeoprocessing.geoprocessing INFO     align_dataset_list aligning dataset 4 of 5
    07/10/2015 17:11:00  invest_natcap.hydropower.hydropower_water_yield INFO     Reclassifying temp_Kc raster
    07/10/2015 17:11:08  invest_natcap.hydropower.hydropower_water_yield INFO     Reclassifying tmp_root raster
    07/10/2015 17:11:15  invest_natcap.hydropower.hydropower_water_yield INFO     Reclassifying tmp_veg raster
    07/10/2015 17:11:29  invest_natcap.hydropower.hydropower_water_yield DEBUG    Calculate PET from Ref Evap times Kc
    07/10/2015 17:11:47  pygeoprocessing.geoprocessing INFO     ReprojectImage 51.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpgc7tjc.tif, psz_message 
    07/10/2015 17:11:48  pygeoprocessing.geoprocessing INFO     ReprojectImage 100.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpgc7tjc.tif, psz_message 
    07/10/2015 17:11:49  pygeoprocessing.geoprocessing INFO     align_dataset_list aligning dataset 1 of 2
    07/10/2015 17:11:58  pygeoprocessing.geoprocessing INFO     ReprojectImage 13.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmph9grih.tif, psz_message 
    07/10/2015 17:12:04  pygeoprocessing.geoprocessing INFO     ReprojectImage 38.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmph9grih.tif, psz_message 
    07/10/2015 17:12:09  pygeoprocessing.geoprocessing INFO     ReprojectImage 63.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmph9grih.tif, psz_message 
    07/10/2015 17:12:12  pygeoprocessing.geoprocessing INFO     ReprojectImage 100.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmph9grih.tif, psz_message 
    07/10/2015 17:12:26  invest_natcap.hydropower.hydropower_water_yield DEBUG    Performing fractp operation
    07/10/2015 17:12:26  invest_natcap.hydropower.hydropower_water_yield DEBUG    {'Kc': -1.0, 'soil': -32768, 'pawc': -3.4028235e+38, 'veg': -1.0, 'precip': -3.4028235e+38, 'root': -1.0, 'eto': -32768}
    07/10/2015 17:12:35  pygeoprocessing.geoprocessing INFO     ReprojectImage 75.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpzd23wh.tif, psz_message 
    07/10/2015 17:12:36  pygeoprocessing.geoprocessing INFO     ReprojectImage 100.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpzd23wh.tif, psz_message 
    07/10/2015 17:12:36  pygeoprocessing.geoprocessing INFO     align_dataset_list aligning dataset 1 of 7
    07/10/2015 17:12:49  pygeoprocessing.geoprocessing INFO     ReprojectImage 51.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpowhgwt.tif, psz_message 
    07/10/2015 17:12:49  pygeoprocessing.geoprocessing INFO     ReprojectImage 100.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpowhgwt.tif, psz_message 
    07/10/2015 17:12:49  pygeoprocessing.geoprocessing INFO     align_dataset_list aligning dataset 2 of 7
    07/10/2015 17:12:56  pygeoprocessing.geoprocessing INFO     ReprojectImage 75.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpq2aqrp.tif, psz_message 
    07/10/2015 17:12:57  pygeoprocessing.geoprocessing INFO     ReprojectImage 100.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpq2aqrp.tif, psz_message 
    07/10/2015 17:12:57  pygeoprocessing.geoprocessing INFO     align_dataset_list aligning dataset 3 of 7
    07/10/2015 17:13:04  pygeoprocessing.geoprocessing INFO     ReprojectImage 58.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpki5ml2.tif, psz_message 
    07/10/2015 17:13:07  pygeoprocessing.geoprocessing INFO     ReprojectImage 100.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmpki5ml2.tif, psz_message 
    07/10/2015 17:13:08  pygeoprocessing.geoprocessing INFO     align_dataset_list aligning dataset 4 of 7
    07/10/2015 17:13:32  pygeoprocessing.geoprocessing INFO     ReprojectImage 51.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmprqrovu.tif, psz_message 
    07/10/2015 17:13:32  pygeoprocessing.geoprocessing INFO     ReprojectImage 100.0% complete D:\zm1\invest_3.1.3_output\hydropower_0710_3\tmp\tmprqrovu.tif, psz_message 
    07/10/2015 17:13:33  pygeoprocessing.geoprocessing INFO     align_dataset_list aligning dataset 5 of 7
    <div style="-webkit-font-smoothing: antialiased;
  • DougDoug Administrator, NatCap Staff
    Yes, currently there needs to be a row for each watershed ID in the valuation table. If you have no data for a station related to one of the watersheds, you can always put in a row with the current watershed ID followed by 1's. That way the model will complete, but you can ignore the valuation results for that watershed.

    It could be the KeyError 3 is from not having that in the valuation table.

    Let me know if this helps or if I can help further!

    Doug
  • pinkpink Member
    The valuation model can run after I take your advice. Thanks very much.
  • DougDoug Administrator, NatCap Staff
    You're welcome! Glad we got it running for you. Apologies for the documentation not being clear.
This discussion has been closed.