Crop Pollination

Hi team,

I realize that the crop pollination model is under construction but I would like to run the current version. I`ve tried to the best to follow the instructions on labelling the Guild and Nesting& Floral biophysical tables (attached). However I keep getting the error: `encountered: ground` which, based on the log output, seems to occur when it tries to map the floral attributes to land cover. This seems like it should be a very easy fix in the tables, but I am pulling my hair out trying to figure it out.

Any suggesting very welcome. Thanks!

Log: 

Initializing...

05/31/2017 15:49:02 root DEBUG Loading <module 'natcap.invest.pollination.pollination' from 'C:\INVEST~1.3_X\INVEST~1\natcap\invest\pollination\pollination.pyc'> in frozen environment

Arguments:

ag_classes

do_valuation False

guilds_uri C:/Users/Labo_JD/Documents/Sylvia/Models/Pollination/Guilds.csv

landuse_attributes_uri C:/Users/Labo_JD/Documents/Sylvia/Models/Pollination/Nest_floral_mean_v3.csv

landuse_cur_uri C:/Users/Labo_JD/Documents/Sylvia/Models/Pollination/mddellc_UTM.tif

results_suffix _test4

workspace_dir C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs



05/31/2017 15:49:02 root INFO Logging will be saved to natcap.invest.pollination.pollination-log-2017-05-31--15_49_02.txt

05/31/2017 15:49:02 root DEBUG Loaded the model from natcap.invest.pollination.pollination

05/31/2017 15:49:02 root INFO Executing the loaded model

05/31/2017 15:49:02 root INFO Running InVEST version "3.3.3"

05/31/2017 15:49:02 root INFO Python architecture: ('32bit', 'WindowsPE')

05/31/2017 15:49:02 root INFO Disk space remaining for workspace: 1.65 TB

05/31/2017 15:49:02 root INFO Pointing temporary directory at the workspace at C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs

05/31/2017 15:49:02 root INFO Starting natcap.invest.pollination.pollination

05/31/2017 15:49:02 root INFO Setting tempfile.tempdir to C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\tmp

05/31/2017 15:49:02 natcap.invest.pollination.pollination INFO Starting pollination model for the cur scenario

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG Opening landuse raster from C:/Users/Labo_JD/Documents/Sylvia/Models/Pollination/mddellc_UTM.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination INFO Opening landuse attributes table

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG Parsed nesting fields: ['ground', 'cavity', 'stem', 'wood', 'hn']

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG Parsed floral fields: []

05/31/2017 15:49:02 natcap.invest.pollination.pollination INFO Opening guilds table

05/31/2017 15:49:02 natcap.invest.pollination.pollination INFO Processing agricultural classes

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG Parsed ag classes: []

05/31/2017 15:49:02 natcap.invest.pollination.pollination INFO Creating top-level raster URIs

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG foraging_total: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\output\frm_tot_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG foraging_average: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\output\frm_avg_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG farm_value_sum: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\frm_val_sum_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG service_value_sum: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\output\sup_val_sum_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG abundance_total: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\output\sup_tot_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG ag_map: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\agmap_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination INFO Creating species-specific raster URIs

05/31/2017 15:49:02 natcap.invest.pollination.pollination INFO Creating rasters for A

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG nesting: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\hn_A_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG floral: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\hf_A_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG species_abundance: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\sup_A_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG farm_abundance: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\frm_A_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG farm_value: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\frm_val_A_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG value_abundance_ratio: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\val_sup_ratio_A_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG value_abundance_ratio_blur: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\val_sup_ratio_blur_A_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.pollination DEBUG service_value: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\sup_val_A_cur__test4.tif

05/31/2017 15:49:02 natcap.invest.pollination.core DEBUG Starting pollination calculations

05/31/2017 15:49:02 natcap.invest.pollination.core DEBUG Using nodata value of -1.0 for internal rasters

05/31/2017 15:49:02 natcap.invest.pollination.core INFO Starting to create an ag raster at C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\intermediate\agmap_cur__test4.tif. Nodata=-1.0

05/31/2017 15:49:04 natcap.invest.pollination.core DEBUG Agricultural reclass map={0.0: 1.0, 2050.0: 1.0, 2051.0: 1.0, 2053.0: 1.0, 10.0: 1.0, 2221.0: 1.0, 20.0: 1.0, 21.0: 1.0, 22.0: 1.0, 23.0: 1.0, 24.0: 1.0, 175.0: 1.0, 4263.0: 1.0, 30.0: 1.0, 2225.0: 1.0, 50.0: 1.0, 51.0: 1.0, 53.0: 1.0, 2120.0: 1.0, 110.0: 1.0, 4211.0: 1.0, 4213.0: 1.0, 4215.0: 1.0, 120.0: 1.0, 122.0: 1.0, 4221.0: 1.0, 4223.0: 1.0, 4225.0: 1.0, 131.0: 1.0, 132.0: 1.0, 133.0: 1.0, 134.0: 1.0, 135.0: 1.0, 136.0: 1.0, 137.0: 1.0, 138.0: 1.0, 139.0: 1.0, 140.0: 1.0, 141.0: 1.0, 4120.0: 1.0, 4301.0: 1.0, 147.0: 1.0, 2200.0: 1.0, 153.0: 1.0, 154.0: 1.0, 4253.0: 1.0, 158.0: 1.0, 4255.0: 1.0, 160.0: 1.0, 162.0: 1.0, 2211.0: 1.0, 2213.0: 1.0, 167.0: 1.0, 168.0: 1.0, 169.0: 1.0, 170.0: 1.0, 171.0: 1.0, 172.0: 1.0, 173.0: 1.0, 2223.0: 1.0, 176.0: 1.0, 177.0: 1.0, 178.0: 1.0, 179.0: 1.0, 180.0: 1.0, 181.0: 1.0, 182.0: 1.0, 2231.0: 1.0, 4280.0: 1.0, 2233.0: 1.0, 2235.0: 1.0, 188.0: 1.0, 192.0: 1.0, 195.0: 1.0, 197.0: 1.0, 199.0: 1.0, 2250.0: 1.0, 2253.0: 1.0, 2255.0: 1.0, 210.0: 1.0, 211.0: 1.0, 213.0: 1.0, 215.0: 1.0, 220.0: 1.0, 221.0: 1.0, 223.0: 1.0, 225.0: 1.0, 230.0: 1.0, 231.0: 1.0, 2280.0: 1.0, 233.0: 1.0, 235.0: 1.0, 250.0: 1.0, 253.0: 1.0, 255.0: 1.0, 263.0: 1.0, 2263.0: 1.0, 280.0: 1.0, 4231.0: 1.0, 301.0: 1.0, 302.0: 1.0, 2351.0: 1.0, 4233.0: 1.0, 320.0: 1.0, 4235.0: 1.0, 341.0: 1.0, 343.0: 1.0, 351.0: 1.0, 5000.0: 1.0, 4000.0: 1.0, 4030.0: 1.0, 2000.0: 1.0, 4050.0: 1.0, 4051.0: 1.0, 4053.0: 1.0, 1000.0: 1.0, 2215.0: 1.0, 2301.0: 1.0, 4351.0: 1.0}

05/31/2017 15:49:25 natcap.invest.pollination.core DEBUG Starting A species

05/31/2017 15:49:25 natcap.invest.pollination.core INFO Calculating A abundance on the landscape

05/31/2017 15:49:25 natcap.invest.pollination.core DEBUG Mapping floral attributes to landcover, writing to C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\tmp\tmpl8y2uv

05/31/2017 15:49:29 root ERROR ---------------------------------------------------

05/31/2017 15:49:29 root ERROR ---------------------- ERROR ----------------------

05/31/2017 15:49:29 root ERROR ---------------------------------------------------

05/31/2017 15:49:29 root ERROR Error: exception found while running natcap.invest.pollination.pollination

05/31/2017 15:49:29 root DEBUG

05/31/2017 15:49:29 root DEBUG Build details

05/31/2017 15:49:29 root DEBUG Interpreter

05/31/2017 15:49:29 root DEBUG Current temp dir: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\tmp

05/31/2017 15:49:29 root DEBUG tempfile.tempdir: C:\Users\Labo_JD\Documents\Sylvia\Models\Pollination\Runs\tmp

05/31/2017 15:49:29 root DEBUG

05/31/2017 15:49:29 root DEBUG System

05/31/2017 15:49:29 root DEBUG OS : Windows-8-6.2.9200

05/31/2017 15:49:29 root DEBUG Processor architecture: AMD64

05/31/2017 15:49:29 root DEBUG FS encoding : mbcs

05/31/2017 15:49:29 root DEBUG Preferred encoding: cp1252

05/31/2017 15:49:29 root DEBUG

05/31/2017 15:49:29 root DEBUG Python

05/31/2017 15:49:29 root DEBUG Version : 2.7.9

05/31/2017 15:49:29 root DEBUG Build : ('default', 'Dec 10 2014 12:24:55')

05/31/2017 15:49:29 root DEBUG Compiler : MSC v.1500 32 bit (Intel)

05/31/2017 15:49:29 root DEBUG Implementation : CPython

05/31/2017 15:49:29 root DEBUG Architecture : 32bit

05/31/2017 15:49:29 root DEBUG Linkage format : WindowsPE

05/31/2017 15:49:29 root DEBUG

05/31/2017 15:49:29 root DEBUG Packages

05/31/2017 15:49:29 root DEBUG Cython : ?

05/31/2017 15:49:29 root DEBUG Numpy : 1.11.2

05/31/2017 15:49:29 root DEBUG Scipy : 0.16.1

05/31/2017 15:49:29 root DEBUG OSGEO : 1.11.3

05/31/2017 15:49:29 root DEBUG Shapely : 1.5.5

05/31/2017 15:49:29 root DEBUG InVEST : 3.3.3

05/31/2017 15:49:29 root DEBUG

05/31/2017 15:49:29 root DEBUG

05/31/2017 15:49:29 root DEBUG Exception not environment-related

05/31/2017 15:49:29 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 236, in execute

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.pollination.pollination_core", line 113, in execute_model

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.pollination.pollination_core", line 241, in calculate_abundance

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.pollination.pollination_core", line 593, in map_attribute

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.pollination.pollination_core", line 593, in <genexpr>

KeyError: 'ground'



05/31/2017 15:49:29 root ERROR Exiting due to failures


Comments

  • swolnyswolny Member, NatCap Staff
    Hi @Sylvie -

    I opened your tables in Excel, but the formatting is off - all of the entries appear within a single field. Are you perhaps using semicolons instead of commas for delimiting fields? Also, the model takes a .csv file, not .xlsx, so it would be helpful if you'd post your .csv file so we can see exactly what you're feeding to the model. Thanks!

    ~ Stacie


  • SylvieSylvie Member
    Hi Stacie, 

    Thank you for getting back to me! When I try to attach the .csv files here it tells me the `Upload file type is not accepted` which is why I  uploaded the .xlsx .  I did originally have a problem with semi-colons vs commas as I was working on a french computer but I have sorted that out now and still run into the same error (attached the .xlsx again with proper formatting I believe now).  

    Could I try sending you the csv via email?

    Thanks!
  • RichRich Administrator, NatCap Staff
    Hi Sylvie (and other InVEST users),

    The current version of the InVEST Pollination model does not give results that are consistent with what the user's guide describes that it should.  In short it's broken and shouldn't be used at all.  We've got a new version which for minor technical reasons can't be released yet, but will shortly. 

    Sylvie, it looks like your inputs are a combination of the old format and new format, probably because our online user's guide is reflecting the new version.  If you really want to use the old version you can statically link to the InVEST version of the 3.3.3 release here:  http://data.naturalcapitalproject.org/invest-releases/3.3.3/userguide/

    I'm very sorry for the hassle.  If you can wait a bit, I'd suggest holding on for the InVEST 3.4.0 release until you run the pollination model.

  • SylvieSylvie Member
    Hi Rich,

    Thanks for letting me know. I realized that a newer version was in development, but didn't realize that the current model was not producing accurate outputs. Do you know when the next version might be out?

    Thanks!
  • RichRich Administrator, NatCap Staff
    Hi Sylvie!  The model should be out very soon.  Like couple of weeks soon!  I promise I'll send you a dev build when it's ready.
  • RichRich Administrator, NatCap Staff
    Hi Sylvie, a development version of the new pollination model is ready: http://data.naturalcapitalproject.org/invest-releases/3.3.3.post107+ne8014498e756/InVEST_3.3.3.post107+ne8014498e756_x86_Setup.exe

    This is the version that's consistent with the online user's guide.
  • SylvieSylvie Member
    Thanks Rich,

    I am just wondering if you could provide more detail on the attributes required in the Farm polygon layer of the new pollinatin model, I am not clear on what the half saturation coefficient for a crop is (is this related to the crop coefficient?), and what exactly is meant the the proportion of crop that is dependent on pollination. For the latter does this refer to the portion of the yield that varies with pollination (as in Klein et al 2007) or area of the polygon?

    Thanks for these clarifications in advance!

    Sylvie
  • RichRich Administrator, NatCap Staff
    Hi Sylvie,

    The half saturation coefficient is the value of the pollinator abundance that will yield half the expected total crop yield.  

    The second variable, proportion of yield dependent on pollinators, is supposed to represent the inherent ability for a crop to self-pollinate; perhaps through wind or some other method.  If set to 0.0 the crop is 100% dependent on pollinators, of 1.0 the presence of pollinators does not affect the yield at all.

  • SylvieSylvie Member
    Thanks Rich!
  • Hi Rick,

    In relation with the Farm polygon, is it strictly necessary for running the new model?
    I want to run the model for a big area (Europe) where I only have the values for land cover and the guilds...this is what the old version need it.
    What can I do if I'm not interested in yield calculations? 

    Thanks in advance! 
  • RichRich Administrator, NatCap Staff
    Sure I can make that parameter optional, but even the old model had "agriculture classes".  I don't know that the pollinator supply is scientifically valid without the context of pollination for agriculture.  But I am not you so I realize you may have other uses.  :)

    I'll add that feature shortly and post here again soon.

  • RichRich Administrator, NatCap Staff
    Hi @jgallegozamorano, here's a development version of InVEST that has optional farm polygons.  If you leave them off the model will stops at the species' abundance index rasters.  Is this what you were hoping you could use in your analysis?

  • Hi Rich, 

    Thank you so much for this version, it is exactly what I need it because I want to use InVEST to understand how the bees use the landscape, where they can be and where they cannot, although I know that this depends on the parameters that I enter for each land use. 
    Anyways, thank you so much for your help!! 


  • edited June 29
    Hi Rich,

    Trying to run the model I get this error that I don't understand, I think is related to the No Data of the raster of Land Use but I don't know how to solve it...


    Initializing...

    06/29/2017 18:30:34 root DEBUG Loading <module 'natcap.invest.pollination' from 'D:\InVEST_3.3.3\InVEST_3.3.3.Juan\invest-3-x86\natcap\invest\pollination.pyc'> in frozen environment

    Arguments:

    farm_vector_path

    guild_table_path F:/TFM/Data/inVEST/bees_traits.csv

    landcover_biophysical_table_path F:/TFM/Data/inVEST/clc_invest.csv

    landcover_raster_path F:/TFM/Data/LCLU/corine2006/clc06_franc.tif

    results_suffix

    workspace_dir F:\TFM\Data\inVEST



    06/29/2017 18:30:34 root INFO Logging will be saved to natcap.invest.pollination-log-2017-06-29--18_30_34.txt

    06/29/2017 18:30:34 root DEBUG Loaded the model from natcap.invest.pollination

    06/29/2017 18:30:34 root INFO Executing the loaded model

    06/29/2017 18:30:34 root INFO Running InVEST version "3.3.3.post123+n0bec50160745"

    06/29/2017 18:30:34 root INFO Python architecture: ('32bit', 'WindowsPE')

    06/29/2017 18:30:34 root INFO Disk space remaining for workspace: 157.13 GB

    06/29/2017 18:30:34 root INFO Pointing temporary directory at the workspace at F:\TFM\Data\inVEST

    06/29/2017 18:30:34 root INFO Starting natcap.invest.pollination

    06/29/2017 18:30:34 root INFO Setting tempfile.tempdir to F:\TFM\Data\inVEST\tmp

    06/29/2017 18:30:34 natcap.invest.pollination INFO Checking to make sure guild table has all expected headers

    06/29/2017 18:30:34 natcap.invest.utils WARNING There are empty strings in row ['', '', '', '', ''] in F:/TFM/Data/inVEST/clc_invest.csv

    06/29/2017 18:30:34 natcap.invest.utils WARNING There are empty strings in row ['', '', '', '', ''] in F:/TFM/Data/inVEST/clc_invest.csv

    06/29/2017 18:30:34 natcap.invest.utils WARNING There are empty strings in row ['', '', '', '', ''] in F:/TFM/Data/inVEST/clc_invest.csv

    06/29/2017 18:30:34 natcap.invest.utils WARNING There are empty strings in row ['', '', '', '', ''] in F:/TFM/Data/inVEST/clc_invest.csv

    06/29/2017 18:30:34 natcap.invest.utils WARNING There are empty strings in row ['', '', '', '', ''] in F:/TFM/Data/inVEST/clc_invest.csv

    06/29/2017 18:30:34 natcap.invest.pollination INFO Mapping landcover to nesting substrate cavity

    06/29/2017 18:30:34 root ERROR ---------------------------------------------------

    06/29/2017 18:30:34 root ERROR ---------------------- ERROR ----------------------

    06/29/2017 18:30:34 root ERROR ---------------------------------------------------

    06/29/2017 18:30:34 root ERROR Error: exception found while running natcap.invest.pollination

    06/29/2017 18:30:34 root DEBUG

    06/29/2017 18:30:34 root DEBUG Build details

    06/29/2017 18:30:34 root DEBUG Interpreter

    06/29/2017 18:30:34 root DEBUG Current temp dir: F:\TFM\Data\inVEST\tmp

    06/29/2017 18:30:34 root DEBUG tempfile.tempdir: F:\TFM\Data\inVEST\tmp

    06/29/2017 18:30:34 root DEBUG

    06/29/2017 18:30:34 root DEBUG System

    06/29/2017 18:30:34 root DEBUG OS : Windows-8-6.2.9200

    06/29/2017 18:30:34 root DEBUG Processor architecture: AMD64

    06/29/2017 18:30:34 root DEBUG FS encoding : mbcs

    06/29/2017 18:30:34 root DEBUG Preferred encoding: cp1252

    06/29/2017 18:30:34 root DEBUG

    06/29/2017 18:30:34 root DEBUG Python

    06/29/2017 18:30:34 root DEBUG Version : 2.7.9

    06/29/2017 18:30:34 root DEBUG Build : ('default', 'Dec 10 2014 12:24:55')

    06/29/2017 18:30:34 root DEBUG Compiler : MSC v.1500 32 bit (Intel)

    06/29/2017 18:30:34 root DEBUG Implementation : CPython

    06/29/2017 18:30:34 root DEBUG Architecture : 32bit

    06/29/2017 18:30:34 root DEBUG Linkage format : WindowsPE

    06/29/2017 18:30:34 root DEBUG

    06/29/2017 18:30:34 root DEBUG Packages

    06/29/2017 18:30:34 root DEBUG Cython : ?

    06/29/2017 18:30:34 root DEBUG Numpy : 1.11.3

    06/29/2017 18:30:34 root DEBUG Scipy : 0.16.1

    06/29/2017 18:30:34 root DEBUG OSGEO : 1.11.3

    06/29/2017 18:30:34 root DEBUG Shapely : 1.5.5

    06/29/2017 18:30:34 root DEBUG InVEST : 3.3.3.post123+n0bec50160745

    06/29/2017 18:30:34 root DEBUG

    06/29/2017 18:30:34 root DEBUG

    06/29/2017 18:30:34 root DEBUG Exception not environment-related

    06/29/2017 18:30:34 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", line 328, in execute

    File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\pygeoprocessing.geoprocessing", line 1152, in reclassify_raster

    KeyError: '-128.0'



    06/29/2017 18:30:34 root ERROR Exiting due to failures 


    Can you help me please?
    Post edited by jgallegozamorano on
  • RichRich Administrator, NatCap Staff
    This could be a bunch of things.  If you don't mind, since this is a new model, could you dropbox me your datastack to richsharp@stanford.edu and that way I can shake out if there's a software bug, or if not, a better error message to present if there is a data issue?
  • Done, I wrote you a small explanation of my project also =) Thanks!
  • RichRich Administrator, NatCap Staff
    Hi!  I see the issue.  You have a huge swath of 128 values (or -127 if you're considering a signed byte) around what looks like valid landcover.  Yet the nodata value in the raster is not defined (I see this by looking at the raster properties in the QGIS menu).  

    For good practice you should set a nodata value in a raster if it really is one.  InVEST ignores values in that case.  For your case you can either define a nodata value for the raster, or tack on a "128" code in your biophysical table that has 0 values for all the biophysical properties.  Note in the latter case the model will assume the 128 codes are valid land areas but completely barren for pollinator food or habitation; it will have the effect of pulling down the pollinator supply in the valid areas.  

    Also for extra good practice, if you've got a raster like this, you should try to clip it to the bounding box of the valid pixels.  Otherwise the model will still process all those extra pixels outside and make for larger output files.

    (here's an image of your landcover map with undefined nodata colored magenta http://i.imgur.com/UDPy8IE.png)
  • Hi,

    I see! Thank you so much for your help. I am an MSc student so I miss many of these good practices. I thought it was something related to the nodata but couldn't understand what was wrong. I will assign the nodata value to the raster and see if I can run the model.

    For clipping the raster, I used the "extract by mask" tool of ArcGIS and I thought it was enough with that but indeed, I didn't check the boundaries, shame of me. 

    Again, thank you so much for your help
Sign In or Register to comment.