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

Globio Model msa_parameters KeyError

SeunSeun Member
edited February 20 in General
Hi everyone, 

I  am currently running the GLOBIO model on InVEST 3.5.0 version and it returned an error message. This error is posted below. 


Initializing...

Showing messages with level INFO and higher

02/20/2019 17:50:32 natcap.invest.utils INFO Writing log messages to C:\PERSONALS\Phd University of Lagos\2019 Approach\InVEST model\globio\1992\InVEST-GLOBIO-log-2019-02-20--17_50_32.txt

02/20/2019 17:50:34 natcap.invest.ui.model Level 100 Starting model with parameters:

Arguments for InVEST natcap.invest.globio 3.5.0:

aoi_uri C:/PERSONALS/Phd University of Lagos/2019 Approach/InVEST model/globio/1992/AOI.shp

infrastructure_dir C:\PERSONALS\Phd University of Lagos\2019 Approach\InVEST model\globio\1992\infrastructure_dir

intensification_fraction 0.6

lulc_to_globio_table_uri C:/PERSONALS/Phd University of Lagos/2019 Approach/InVEST model/globio/1992/lulc_conversion_table.csv

lulc_uri C:/PERSONALS/Phd University of Lagos/2019 Approach/InVEST model/globio/1992/1992_lulc.tif

msa_parameters_uri C:/PERSONALS/Phd University of Lagos/2019 Approach/InVEST model/globio/1992/msa_parameters.csv

pasture_threshold 0.5

pasture_uri C:/PERSONALS/Phd University of Lagos/2019 Approach/InVEST model/globio/1992/pasture_92.tif

potential_vegetation_uri C:/PERSONALS/Phd University of Lagos/2019 Approach/InVEST model/globio/1992/potential_vegetation_92.tif

predefined_globio False

primary_threshold 0.91

results_suffix 92

workspace_dir C:\PERSONALS\Phd University of Lagos\2019 Approach\InVEST model\globio\1992


02/20/2019 17:50:35 natcap.invest.ui.model ERROR Exception while executing <function execute at 0x0E9737B0>

Traceback (most recent call last):

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\ui\model.py", line 1541, in _logged_target

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\globio.py", line 82, in execute

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\globio.py", line 430, in load_msa_parameter_table

KeyError: 8

02/20/2019 17:50:35 natcap.invest.ui.model INFO Execution finished

02/20/2019 17:51:04 natcap.invest.ui.usage._log_model WARNING an exception encountered when logging IOError('http protocol error', 0, 'got a bad status line', None)

02/20/2019 17:51:05 natcap.invest.utils INFO Elapsed time: 32.19s

02/20/2019 17:51:05 natcap.invest.ui.execution ERROR Target <function _logged_target at 0x0E973D30> failed with exception

Traceback (most recent call last):

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\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\env\lib\site-packages\natcap\invest\ui\model.py", line 1541, in _logged_target

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site


Sfter a careful observation, I noticed it returned an error tagged (KeyError encountered: 8) and I think it is related to MSA computations and its corresponding msa_parameters.csv excel worksheet. 



Please what do I need to do to resolve this issue?


Many thanks.

Post edited by Dave on

Comments

  • DaveDave Member, Administrator, NatCap Staff
    Hi Seun, thanks for posting. I think you are correct, the issue is related to msa_parameters.csv. For that input, did you use the default csv file from the sample data folder?  In particular, the model is expecting to find a row in that table where the "Value" column is 8. If this remains a problem, please also upload the entire logfile (the txt file in the output workspace) as an attachment.

    Also, since this model was updated recently, it could be worth trying the latest version of Invest, 3.6.0. 
  • SeunSeun Member
    Hello Dave, 

    Many thanks for the clarification on the subject above. I have reworked the msa_parameters.csv. It was actually adapted from the sample folder which I test-run prior to adapting it to my research. Please do explain the "Value" column aspect because it was not tampered with as it was in the test data.
    However, I have attached the txt file from the output workspace as requested. After this trial, I will take the next action which is upgrade to 3.6.0 version of InVEST software. 

    Thank you.
  • SeunSeun Member
    Hello @Dave 

    Please I need a response to my request above. I have installed inVEST 3.6.0 and the problem persists.
  • DaveDave Member, Administrator, NatCap Staff
    Okay, please send me your msa_parameters.csv so that I can reproduce the error and determine the problem. davefisher@stanford.edu
  • SeunSeun Member
    Okay @Dave

    Many thanks. 

    I am sending it to you right away.
  • DaveDave Member, Administrator, NatCap Staff
    @Seun, thanks for sending your data. It is as we suspected. The model expects this table to have a row where "MSA_type" is "msa_lu" and "Value" is "8". Such a row is present in the sample data table but not in your edited version. 

    I'm not an expert on the science behind this model, but I can tell you that the Values in that "msa_lu" section of your table will need to match the pixel values present in "globio_lulc.tif", which you can find in your intermediate output folder. In turn, the values of "globio_lulc.tif" are based on your inputs "1992_lulc.tif" and "lulc_conversion_table.csv".

    Hope this helps,
    Dave

Sign In or Register to comment.