Coastal Blue Carbon Model Run

jmandoskejmandoske Member
edited May 10 in General
Hello,

I'm trying to run the coastal blue carbon model - I got through the pre-processor, but when I try to run the model for four future scenarios, I get an error that says:

IndexError: index 2 is out of bounds for axis 0 with size 2

I'm not sure what this refers to - if it's a problem with the tif inputs or something with the model?

One thing to mention is that to for the pre-processor to work, I had to change one of the tif files cell size because there was an error (access window out of range). Could this be a problem if not all the tif rasters have the same cell size? (All are the same, except one that has slightly different inputs in order to get the pre-processor to work) Should I go back through and change the other cell sizes to be the same? Could this error be due to something else?

Thanks for any help you can offer.

Best,
Jackie
Post edited by jmandoske on
Tagged:

Comments

  • jdouglassjdouglass Administrator, NatCap Staff
    Hi @jmandoske, yes, the CBC preprocessor and model currently require that all input rasters have identical dimensions.

    For the IndexError, could you include your logfile here so we can take a look and see where it failed?

    Thanks,
    James
  • jmandoskejmandoske Member
    Hi James,

    Thanks so much for your help. I recreated my tif files to ensure they have the exact same dimensions - so that should no longer be the problem. However, again, I'm able to get through the preprocessor, but when I try to run the coastal blue carbon model, I am getting an error code: "KeyError encountered: u".

    Attached is my logfile. I'm happy to send you my other files as well if that helps.

    Thanks,
    Jackie


    Arguments:
    analysis_year              2040
    carbon_pool_initial_uri    C:/Users/jmand/Documents/Andros_workspace_6/outputs_preprocessor/carbon_pool_initial_andros_hra_run1.csv
    carbon_pool_transient_uri  C:/Users/jmand/Documents/Andros_workspace_6/outputs_preprocessor/carbon_pool_transient_andros_hra_run1.csv
    discount_rate              3.0
    do_economic_analysis       True
    do_price_table             False
    interest_rate              3.0
    lulc_baseline_map_uri      C:/Users/jmand/Documents/Andros_workspace_6/Cur_and_hra1.tif
    lulc_baseline_year         2017
    lulc_lookup_uri            C:/Users/jmand/Documents/Andros_workspace_6/lulc_Andros_scenarios_6.csv
    lulc_transition_maps_list  [u'C:/Users/jmand/Documents/Andros_workspace_6/Bau_and_hra1.tif']
    lulc_transition_matrix_uri C:/Users/jmand/Documents/Andros_workspace_6/outputs_preprocessor/transitions_andros_hra_run1.csv
    lulc_transition_years_list []
    price                      10.0
    results_suffix             CUR_BAU_Run1
    workspace_dir              C:\Users\jmand\Documents\Andros_workspace_6


    05/12/2017 11:09:56  root               INFO     Logging will be saved to natcap.invest.coastal_blue_carbon.coastal_blue_carbon-log-2017-05-12--11_09_56.txt
    05/12/2017 11:09:56  root               DEBUG    Loaded the model from natcap.invest.coastal_blue_carbon.coastal_blue_carbon
    05/12/2017 11:09:56  root               INFO     Executing the loaded model
    05/12/2017 11:09:56  root               INFO     Running InVEST version "3.3.3"
    05/12/2017 11:09:56  root               INFO     Python architecture: ('32bit', 'WindowsPE')
    05/12/2017 11:09:56  root               INFO     Disk space remaining for workspace: 775.55 GB
    05/12/2017 11:09:56  root               INFO     Pointing temporary directory at the workspace at C:\Users\jmand\Documents\Andros_workspace_6
    05/12/2017 11:09:56  root               INFO     Starting natcap.invest.coastal_blue_carbon.coastal_blue_carbon
    05/12/2017 11:09:56  root               INFO     Setting tempfile.tempdir to C:\Users\jmand\Documents\Andros_workspace_6\tmp
    05/12/2017 11:09:56  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Starting Coastal Blue Carbon model run...
    05/12/2017 11:09:56  root               ERROR    ---------------------------------------------------
    05/12/2017 11:09:56  root               ERROR    ---------------------- ERROR ----------------------
    05/12/2017 11:09:56  root               ERROR    ---------------------------------------------------
    05/12/2017 11:09:56  root               ERROR    Error: exception found while running natcap.invest.coastal_blue_carbon.coastal_blue_carbon
    05/12/2017 11:09:56  root               DEBUG    
    05/12/2017 11:09:56  root               DEBUG    Build details
    05/12/2017 11:09:56  root               DEBUG    Interpreter
    05/12/2017 11:09:56  root               DEBUG    Current temp dir: C:\Users\jmand\Documents\Andros_workspace_6\tmp
    05/12/2017 11:09:56  root               DEBUG    tempfile.tempdir: C:\Users\jmand\Documents\Andros_workspace_6\tmp
    05/12/2017 11:09:56  root               DEBUG    
    05/12/2017 11:09:56  root               DEBUG    System
    05/12/2017 11:09:56  root               DEBUG    OS              : Windows-8-6.2.9200
    05/12/2017 11:09:56  root               DEBUG    Processor architecture: AMD64
    05/12/2017 11:09:56  root               DEBUG    FS encoding     : mbcs
    05/12/2017 11:09:56  root               DEBUG    Preferred encoding: cp1252
    05/12/2017 11:09:56  root               DEBUG    
    05/12/2017 11:09:56  root               DEBUG    Python
    05/12/2017 11:09:56  root               DEBUG    Version         : 2.7.9
    05/12/2017 11:09:56  root               DEBUG    Build           : ('default', 'Dec 10 2014 12:24:55')
    05/12/2017 11:09:56  root               DEBUG    Compiler        : MSC v.1500 32 bit (Intel)
    05/12/2017 11:09:56  root               DEBUG    Implementation  : CPython
    05/12/2017 11:09:56  root               DEBUG    Architecture    : 32bit
    05/12/2017 11:09:56  root               DEBUG    Linkage format  : WindowsPE
    05/12/2017 11:09:56  root               DEBUG    
    05/12/2017 11:09:56  root               DEBUG    Packages
    05/12/2017 11:09:56  root               DEBUG    Cython          : ?
    05/12/2017 11:09:56  root               DEBUG    Numpy           : 1.11.2
    05/12/2017 11:09:56  root               DEBUG    Scipy           : 0.16.1
    05/12/2017 11:09:56  root               DEBUG    OSGEO           : 1.11.3
    05/12/2017 11:09:56  root               DEBUG    Shapely         : 1.5.5
    05/12/2017 11:09:56  root               DEBUG    InVEST          : 3.3.3
    05/12/2017 11:09:56  root               DEBUG    
    05/12/2017 11:09:56  root               DEBUG    
    05/12/2017 11:09:56  root               DEBUG    Exception not environment-related
    05/12/2017 11:09:56  root               DEBUG    Printing traceback
    Traceback (most recent call last):
      File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.iui.executor", line 620, in runModel
      File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.coastal_blue_carbon.coastal_blue_carbon", line 121, in execute
      File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.coastal_blue_carbon.coastal_blue_carbon", line 640, in get_inputs
      File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.coastal_blue_carbon.coastal_blue_carbon", line 639, in <genexpr>
    KeyError: u''



  • jmandoskejmandoske Member
    Hi, please disregard the message about the KeyError as I was able to address it.

    However, I am still getting the same original message about IndexError: index 2 is out of bounds for axis 0 with size 2.

    I also went back through and tried to rerun the sample data that came with the CBC Model, and I got the same error: Index 2 is out if bounds for axis 0 with size 2. Please let me know if there's anything that can be done to help fix this.

    Attached is the logfile from my run and the same error occurred using the sample data.Thank you!


    Arguments:
    analysis_year              2040
    carbon_pool_initial_uri    C:/Users/jmand/Documents/Andros_workspace_6/outputs_preprocessor/carbon_pool_initial_andros_hra_run1.csv
    carbon_pool_transient_uri  C:/Users/jmand/Documents/Andros_workspace_6/outputs_preprocessor/carbon_pool_transient_andros_hra_run1.csv
    discount_rate              3.0
    do_economic_analysis       True
    do_price_table             False
    interest_rate              3.0
    lulc_baseline_map_uri      C:/Users/jmand/Documents/Andros_workspace_6/Cur_and_hra1.tif
    lulc_baseline_year         2017
    lulc_lookup_uri            C:/Users/jmand/Documents/Andros_workspace_6/lulc_Andros_scenarios_6.csv
    lulc_transition_maps_list  [u'C:/Users/jmand/Documents/Andros_workspace_6/Bau_and_hra1.tif']
    lulc_transition_matrix_uri C:/Users/jmand/Documents/Andros_workspace_6/outputs_preprocessor/transitions_andros_hra_run1.csv
    lulc_transition_years_list []
    price                      10.0
    results_suffix             CUR_BAU_Run1
    workspace_dir              C:\Users\jmand\Documents\Andros_workspace_6


    05/12/2017 11:35:16  root               INFO     Logging will be saved to natcap.invest.coastal_blue_carbon.coastal_blue_carbon-log-2017-05-12--11_35_16.txt
    05/12/2017 11:35:16  root               DEBUG    Loaded the model from natcap.invest.coastal_blue_carbon.coastal_blue_carbon
    05/12/2017 11:35:16  root               INFO     Executing the loaded model
    05/12/2017 11:35:16  root               INFO     Running InVEST version "3.3.3"
    05/12/2017 11:35:16  root               INFO     Python architecture: ('32bit', 'WindowsPE')
    05/12/2017 11:35:16  root               INFO     Disk space remaining for workspace: 775.89 GB
    05/12/2017 11:35:16  root               INFO     Pointing temporary directory at the workspace at C:\Users\jmand\Documents\Andros_workspace_6
    05/12/2017 11:35:16  root               INFO     Starting natcap.invest.coastal_blue_carbon.coastal_blue_carbon
    05/12/2017 11:35:16  root               INFO     Setting tempfile.tempdir to C:\Users\jmand\Documents\Andros_workspace_6\tmp
    05/12/2017 11:35:16  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Starting Coastal Blue Carbon model run...
    05/12/2017 11:35:16  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Creating 5 temporal rasters
    05/12/2017 11:35:16  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Setting up temporal raster 1 of 5 at carbon_stock_at_2017_CUR_BAU_Run1.tif
    05/12/2017 11:35:16  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Setting up temporal raster 2 of 5 at carbon_stock_at_2040_CUR_BAU_Run1.tif
    05/12/2017 11:35:16  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Setting up temporal raster 3 of 5 at carbon_accumulation_between_2017_and_2040_CUR_BAU_Run1.tif
    05/12/2017 11:35:16  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Setting up temporal raster 4 of 5 at carbon_emissions_between_2017_and_2040_CUR_BAU_Run1.tif
    05/12/2017 11:35:16  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Setting up temporal raster 5 of 5 at net_carbon_sequestration_between_2017_and_2040_CUR_BAU_Run1.tif
    05/12/2017 11:35:16  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Setting up valuation raster total_net_carbon_sequestration_CUR_BAU_Run1.tif
    05/12/2017 11:35:16  natcap.invest.coastal_blue_carbon.coastal_blue_carbon INFO     Setting up valuation raster net_present_value_CUR_BAU_Run1.tif
    05/12/2017 11:35:24  root               ERROR    ---------------------------------------------------
    05/12/2017 11:35:24  root               ERROR    ---------------------- ERROR ----------------------
    05/12/2017 11:35:24  root               ERROR    ---------------------------------------------------
    05/12/2017 11:35:24  root               ERROR    Error: exception found while running natcap.invest.coastal_blue_carbon.coastal_blue_carbon
    05/12/2017 11:35:24  root               DEBUG    
    05/12/2017 11:35:24  root               DEBUG    Build details
    05/12/2017 11:35:24  root               DEBUG    Interpreter
    05/12/2017 11:35:24  root               DEBUG    Current temp dir: C:\Users\jmand\Documents\Andros_workspace_6\tmp
    05/12/2017 11:35:24  root               DEBUG    tempfile.tempdir: C:\Users\jmand\Documents\Andros_workspace_6\tmp
    05/12/2017 11:35:24  root               DEBUG    
    05/12/2017 11:35:24  root               DEBUG    System
    05/12/2017 11:35:24  root               DEBUG    OS              : Windows-8-6.2.9200
    05/12/2017 11:35:24  root               DEBUG    Processor architecture: AMD64
    05/12/2017 11:35:24  root               DEBUG    FS encoding     : mbcs
    05/12/2017 11:35:24  root               DEBUG    Preferred encoding: cp1252
    05/12/2017 11:35:24  root               DEBUG    
    05/12/2017 11:35:24  root               DEBUG    Python
    05/12/2017 11:35:24  root               DEBUG    Version         : 2.7.9
    05/12/2017 11:35:25  root               DEBUG    Build           : ('default', 'Dec 10 2014 12:24:55')
    05/12/2017 11:35:25  root               DEBUG    Compiler        : MSC v.1500 32 bit (Intel)
    05/12/2017 11:35:25  root               DEBUG    Implementation  : CPython
    05/12/2017 11:35:25  root               DEBUG    Architecture    : 32bit
    05/12/2017 11:35:25  root               DEBUG    Linkage format  : WindowsPE
    05/12/2017 11:35:25  root               DEBUG    
    05/12/2017 11:35:25  root               DEBUG    Packages
    05/12/2017 11:35:25  root               DEBUG    Cython          : ?
    05/12/2017 11:35:25  root               DEBUG    Numpy           : 1.11.2
    05/12/2017 11:35:25  root               DEBUG    Scipy           : 0.16.1
    05/12/2017 11:35:25  root               DEBUG    OSGEO           : 1.11.3
    05/12/2017 11:35:25  root               DEBUG    Shapely         : 1.5.5
    05/12/2017 11:35:25  root               DEBUG    InVEST          : 3.3.3
    05/12/2017 11:35:25  root               DEBUG    
    05/12/2017 11:35:25  root               DEBUG    
    05/12/2017 11:35:25  root               DEBUG    Exception not environment-related
    05/12/2017 11:35:25  root               DEBUG    Printing traceback
    Traceback (most recent call last):
      File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.iui.executor", line 620, in runModel
      File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.coastal_blue_carbon.coastal_blue_carbon", line 230, in execute
    IndexError: index 2 is out of bounds for axis 0 with size 2

  • jmandoskejmandoske Member
    Hello - just wanted to comment that I figured out the problem. In running the model with a transition LULC map, I realized I needed not only to have a baseline and analysis year, but also an additional transition year. Once I added that, it worked!
This discussion has been closed.