Error pollination model

Hi,
Here is my problem :
Arguments:
ag_classes             1 6 9 10 12 13
do_valuation           False
guilds_uri             C:/Users/Elsa/Desktop/PostDoc/INVEST/Pollinisation_workspace/Input_polination/Guild_BM.csv
landuse_attributes_uri C:/Users/Elsa/Desktop/PostDoc/INVEST/Pollinisation_workspace/Input_polination/LU_BM.csv
landuse_cur_uri        C:/Users/Elsa/Desktop/PostDoc/INVEST/Pollinisation_workspace/Current_Land_Cover/w001001x.adf
results_suffix         
workspace_dir          C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace


12/12/2017 21:33:43  root               INFO     Logging will be saved to natcap.invest.pollination.pollination-log-2017-12-12--21_33_43.txt
12/12/2017 21:33:43  root               DEBUG    Loaded the model from natcap.invest.pollination.pollination
12/12/2017 21:33:43  root               INFO     Executing the loaded model
12/12/2017 21:33:43  root               INFO     Running InVEST version "3.3.3"
12/12/2017 21:33:43  root               INFO     Python architecture: ('32bit', 'WindowsPE')
12/12/2017 21:33:43  root               INFO     Disk space remaining for workspace: 298.78 GB
12/12/2017 21:33:43  root               INFO     Pointing temporary directory at the workspace at C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace
12/12/2017 21:33:43  root               INFO     Starting natcap.invest.pollination.pollination
12/12/2017 21:33:43  root               INFO     Setting tempfile.tempdir to C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\tmp
12/12/2017 21:33:43  natcap.invest.pollination.pollination INFO     Starting pollination model for the cur scenario
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    Opening landuse raster from C:/Users/Elsa/Desktop/PostDoc/INVEST/Pollinisation_workspace/Current_Land_Cover/w001001x.adf
12/12/2017 21:33:43  natcap.invest.pollination.pollination INFO     Opening landuse attributes table
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    Parsed nesting fields: []
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    Parsed floral fields: []
12/12/2017 21:33:43  natcap.invest.pollination.pollination INFO     Opening guilds table
12/12/2017 21:33:43  natcap.invest.pollination.pollination INFO     Processing agricultural classes
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    Parsed ag classes: [1, 6, 9, 10, 12, 13]
12/12/2017 21:33:43  natcap.invest.pollination.pollination INFO     Creating top-level raster URIs
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    foraging_total: C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\output\frm_tot_cur.tif
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    foraging_average: C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\output\frm_avg_cur.tif
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    farm_value_sum: C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\intermediate\frm_val_sum_cur.tif
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    service_value_sum: C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\output\sup_val_sum_cur.tif
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    abundance_total: C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\output\sup_tot_cur.tif
12/12/2017 21:33:43  natcap.invest.pollination.pollination DEBUG    ag_map: C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\intermediate\agmap_cur.tif
12/12/2017 21:33:43  root               ERROR    ---------------------------------------------------
12/12/2017 21:33:43  root               ERROR    ---------------------- ERROR ----------------------
12/12/2017 21:33:43  root               ERROR    ---------------------------------------------------
12/12/2017 21:33:43  root               ERROR    Error: exception found while running natcap.invest.pollination.pollination
12/12/2017 21:33:43  root               DEBUG    
12/12/2017 21:33:43  root               DEBUG    Build details
12/12/2017 21:33:43  root               DEBUG    Interpreter
12/12/2017 21:33:43  root               DEBUG    Current temp dir: C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\tmp
12/12/2017 21:33:43  root               DEBUG    tempfile.tempdir: C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\tmp
12/12/2017 21:33:43  root               DEBUG    
12/12/2017 21:33:43  root               DEBUG    System
12/12/2017 21:33:43  root               DEBUG    OS              : Windows-7-6.1.7601-SP1
12/12/2017 21:33:43  root               DEBUG    Processor architecture: AMD64
12/12/2017 21:33:43  root               DEBUG    FS encoding     : mbcs
12/12/2017 21:33:43  root               DEBUG    Preferred encoding: cp1252
12/12/2017 21:33:43  root               DEBUG    
12/12/2017 21:33:43  root               DEBUG    Python
12/12/2017 21:33:43  root               DEBUG    Version         : 2.7.9
12/12/2017 21:33:43  root               DEBUG    Build           : ('default', 'Dec 10 2014 12:24:55')
12/12/2017 21:33:43  root               DEBUG    Compiler        : MSC v.1500 32 bit (Intel)
12/12/2017 21:33:43  root               DEBUG    Implementation  : CPython
12/12/2017 21:33:43  root               DEBUG    Architecture    : 32bit
12/12/2017 21:33:43  root               DEBUG    Linkage format  : WindowsPE
12/12/2017 21:33:43  root               DEBUG    
12/12/2017 21:33:43  root               DEBUG    Packages
12/12/2017 21:33:43  root               DEBUG    Cython          : ?
12/12/2017 21:33:43  root               DEBUG    Numpy           : 1.11.2
12/12/2017 21:33:43  root               DEBUG    Scipy           : 0.16.1
12/12/2017 21:33:43  root               DEBUG    OSGEO           : 1.11.3
12/12/2017 21:33:43  root               DEBUG    Shapely         : 1.5.5
12/12/2017 21:33:43  root               DEBUG    InVEST          : 3.3.3
12/12/2017 21:33:43  root               DEBUG    
12/12/2017 21:33:43  root               DEBUG    
12/12/2017 21:33:43  root               DEBUG    Exception not environment-related
12/12/2017 21:33:43  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.pollination.pollination", line 205, in execute
KeyError: 'species'

I do not understand why I have this error while the model worked previously

Thanks!


Comments

  • RichRich Administrator, NatCap Staff
    Hi @elsa,

    We've made significant changes to the InVEST 3.4.x version of the pollination model from 3.3.x. The technical issue you're experiencing is a change in the table formats. But we've made significant changes to the underlying science part of the pollination model. That includes but is not limited to

    • seasonal foraging activity for pollinators
    • relative abundance of pollinators if multiple guilds are provided
    • farms now specified by polygon rather than landcover code
    • per farm pollinator and nesting effecitveness
    • half saturation and pollinator dependence per farm
    We've rewritten large parts of the user's guide to reflect these changes and in particular you might want to look at the data needs section to see how we've changed the table formats: http://data.naturalcapitalproject.org/nightly-build/invest-users-guide/html/croppollination.html#data-needs

    Also, here's a link to a power point that describes the differences between 3.3.x and 3.4.x pollination and its use: https://www.dropbox.com/s/6plfqflq9fwpzpl/invest_pollination_20.pptx?dl=0

    And please post again if we can help you further for whatever you need!
  • RichRich Administrator, NatCap Staff
    Hi @elsa again! I see from your log you're running InVEST 3.3.3! I missed that the first time. But otherwise my comments above apply to InVEST 3.4.1 and still hold for that. You can download the new version of InVEST here: https://www.naturalcapitalproject.org/invest/
  • Thanks a lot for all these informations. This is indeed a very good step forward for the pollination model.
    However, I do not quite understand the difference (not the format but the sense) between the tables of biophysical land cover attribute and the vector "farm polygon"!
    thank you very much!
  • Now, the agricultural data is obligatory, which does not allow anymore to have only a supply in pollinator abundance or nesting, isn't it?
  • swolnyswolny Member, NatCap Staff
    Hi Elsa -

    The farm polygons are used for valuing pollinator contribution to crops. They allow you to specify where farms are located on the landscape, and provide farm-specific crop data that is independent from the land cover map. For each farm, you specify information about the crops grown there,how much each crop is dependent on pollinators, which season they need pollination, etc, as described in the User Guide

    Defining farms with separate polygons is an improvement over how the previous model worked, where farms weren't independent units with their own attributes, but were just another LULC class. We had to make a list of all of the LULC classes where agriculture was, and value wasn't really attributed to farms, but to agricultural LULC pixels. Now, value can be attributed to individual farms, and different farms can have different input parameters, which makes the model more flexible and relevant for crop production.

    The biophysical land cover is still used to set nesting and floral parameters for the different land cover types, and is required for the basic biophysical output of the model. It does seem to me that the farm polygon might be able to be an optional parameter, so you don't need to prepare one if you're not interested in valuing crop pollination, but just interested in the biophysical properties of the landscape. I'll let the model-creators speak to that topic. In the meantime, if you're not interested in valuing farm crops, you could always enter a generic polygon that covers the whole area and contains, say, one crop and values of 1 for everything in the input table, so that the valuation result doesn't mean anything but the biophysical portion will run.

    ~ Stacie


  • RichRich Administrator, NatCap Staff
    Hi @elsa, and also! It's possible to run the pollination model without a farm polygon in case you just want to see pollinator abundance. We just patched a bug in the last version of InVEST that incorrectly made farm polygons required, now they're optional in InVEST 3.4.2: 


  • Hi! 
    thank you very much for all this information, but now with the new version, using the guild files of the example, the model does not work ...Can you help me...??? (Im sorry for these basic questions...)


    12/22/2017 11:19:54  natcap.invest.utils INFO     Writing log messages to C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace\InVEST-Crop-Pollination-log-2017-12-22--11_19_54.txt
    12/22/2017 11:19:54  natcap.invest.ui.model Level 100 Starting model with parameters: 
    Arguments for InVEST natcap.invest.pollination 3.4.1:
    farm_vector_path                 C:/Users/Elsa/Desktop/PostDoc/INVEST/Pollinisation_workspace/Input_polination/farms.shp
    guild_table_path                 C:/Users/Elsa/Desktop/PostDoc/INVEST/Pollinisation_workspace/Input_polination/guild_table_BM.csv
    landcover_biophysical_table_path C:/Users/Elsa/Desktop/PostDoc/INVEST/Pollinisation_workspace/Input_polination/landcover_biophysical_table_BM.csv
    landcover_raster_path            C:/Users/Elsa/Desktop/PostDoc/INVEST/Pollinisation_workspace/Current_Land_Cover/w001001.adf
    results_suffix                   
    workspace_dir                    C:\Users\Elsa\Desktop\PostDoc\INVEST\Pollinisation_workspace

    12/22/2017 11:19:54  natcap.invest.ui.model ERROR    Exception while executing <function execute at 0x0B3F61F0>
    Traceback (most recent call last):
      File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\ui\model.py", line 1496, in _logged_target
      File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\pollination.py", line 229, in execute
      File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\pollination.py", line 856, in _parse_scenario_variables
      File "c:\users\natcap-servers\jenkins-home\workspace\natcap.invest\label\gce-windows-1\release_env\lib\site-packages\natcap\invest\utils.py", line 457, in build_lookup_from_csv
    ValueError: species expected in [u'species;nesting_suitability_cavity_index;nesting_suitability_ground_index;foraging_activity_spring_index;foraging_activity_summer_index;alpha;relative_abundance'] for the CSV file at C:/Users/Elsa/Desktop/PostDoc/INVEST/Pollinisation_workspace/Input_polination/guild_table_BM.csv
    12/22/2017 11:19:54  natcap.invest.ui.model INFO     Execution finished
    12/22/2017 11:19:54  natcap.invest.utils INFO     Elapsed time: 0.05s
  • RichRich Administrator, NatCap Staff
    Hi @Elsa, your error makes it look like you've got a semicolon delimited file rather than a comma delimited one. I've just been thinking about how to handle this better in InVEST. Can you dropbox me your complete datastack to richsharp@stanford.edu? I'd like to see if I can patch InVEST to handle semicolon separated values. Otherwise, can you try switching all the ";" to "," in your table and see if that works?
Sign In or Register to comment.