Carbon Model

Hi, then I also had problems to run the Carbon model with Version 3.3.3. I have prepared my own carbon data, which the model even refused to read, notifying me, that "it cannot find the lucode". I have checked again and again about mistakes in the file, but did not find any. Actually I had prepared the file by overwriting your sample files. Then I have tried again to run the model with your sample file, and although the related land use file did not even fit, it read the input files and even calculated for a while. Then I have tried with very modest changes in your sample file, but just changing one figure from 10.00000 to 20.00000 etc. resulted in the same message, that it "cannot find the lucode".

Comments

  • swolnyswolny Member, NatCap Staff
    Hi Ingrid -

    So all of the "Values" in your land use raster have corresponding "lucode" values in the carbon pool table, and you're still getting that error? Please try the latest version of InVEST (3.5.0) and let us know if it's still happening.

    ~ Stacie
  • Dear Swolny, yes, thank you, at least InVEST 3.5.0 does not refuse to read the input files and seems to understand, what is happening, though I am not yet completely there....

  • Dear Stacie, but even with the new version it is still the same. It says, it would expect the lucode, and does not find it, while with your samples and my land use file, at least it reads it, and finds out later, that the values do not match. Even if I change a simple figure in your sample file, for instance from 10 to 20, it says, it cannot find the lucode file, even if I leave the lucode file untouched. I wanted to attach my csv-file, but it also says here, it is not allowed.... see the message I got, and cheers. Ingrid

    Initializing...

    Showing messages with level INFO and higher

    09/19/2018 19:34:42 natcap.invest.utils INFO Writing log messages to C:\Users\privat\Documents\carbon_workspace\InVEST-InVEST-Carbon-Model-log-2018-09-19--19_34_42.txt

    09/19/2018 19:34:42 natcap.invest.ui.model Level 100 Starting model with parameters:

    Arguments for InVEST natcap.invest.carbon 3.5.0:

    calc_sequestration False

    carbon_pools_path C:/InVEST_3.3.3_x86/carbon/carbon_prek.csv

    do_redd False

    do_valuation False

    lulc_cur_path C:/Users/privat/Cambodia GIS/LC 2016.tif

    results_suffix

    workspace_dir C:\Users\privat\Documents\carbon_workspace


    09/19/2018 19:34:42 natcap.invest.carbon INFO Building file registry

    09/19/2018 19:34:42 natcap.invest.ui.model ERROR Exception while executing <function execute at 0x1330A230>

    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\carbon.py", line 122, in execute

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

    ValueError: lucode expected in ['"c_above","c_below","c_soil","c_dead","lucode","lulc_name"'] for the CSV file at C:/InVEST_3.3.3_x86/carbon/carbon_prek.csv

    09/19/2018 19:34:42 natcap.invest.ui.model INFO Execution finished

    09/19/2018 19:34:42 natcap.invest.utils INFO Elapsed time: 0.05s

    09/19/2018 19:34:42 natcap.invest.ui.execution ERROR Target <function _logged_target at 0x1330A930> 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-packages\natcap\invest\carbon.py", line 122, in execute

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

    ValueError: lucode expected in ['"c_above","c_below","c_soil","c_dead","lucode","lulc_name"'] for the CSV file at C:/InVEST_3.3.3_x86/carbon/carbon_prek.csv

    09/19/2018 19:34:42 natcap.invest.ui.execution INFO Execution finished




     Cheers. Ingrid
  • swolnyswolny Member, NatCap Staff
    Thanks for posting the logfile, Ingrid. This looks like it's having trouble reading the CSV file properly. Are the values in the file separated by commas, not semicolons (or something else)? If so, change them to be separated by commas. Another possibility is that there is a blank line at the bottom of the CSV, which can give the model trouble. Look at the CSV in a text editor, and if there is a blank line at the end, remove it and try again. The last thing I can think of is that there might be characters in lulc_name that are causing problems (like commas), so check for that too.

    ~ Stacie
  • RichRich Administrator, NatCap Staff
    Also worth mentioning that this looks like a run from InVEST 3.3.3. There is a chance we may have improved the CSV file parsing algorithm in the current version of InVEST (3.5.0) if you'd like to try that first: http://data.naturalcapitalproject.org/invest-releases/3.5.0/InVEST_3.5.0_x86_Setup.exe
Sign In or Register to comment.