Error in Habitat risk assessment model run

Dear Sir/Madam,
Good day. I was trying to run the habitat risk assessment model. When I run the model, I got a key error encountered called "roadOVERLAP". I am attaching you the data also.Please see below the details:

Initializing...

Showing messages with level INFO and higher

11/28/2018 09:35:15 natcap.invest.utils INFO Writing log messages to C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess\InVEST-Habitat-Risk-Assessment-log-2018-11-28--09_35_15.txt

11/28/2018 09:35:15 natcap.invest.ui.model Level 100 Starting model with parameters:

Arguments for InVEST natcap.invest.habitat_risk_assessment.hra 3.5.0:

aoi_tables C:/Users/ecohyd/Desktop/CEGIS/LGED-Sunamgang project/HabitatRiskAssess/Input/subregion.shp

csv_uri C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\habitat_stressor_ratings

decay_eq None

grid_size 100

max_rating 3

max_stress 2

results_suffix

risk_eq Euclidean

workspace_dir C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess


11/28/2018 09:35:17 natcap.invest.habitat_risk_assessment.hra INFO Rasterizing shapefile layers.

11/28/2018 09:35:17 natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO Distance Transform Phase 1

11/28/2018 09:35:17 natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO Distance Transform Phase 2

11/28/2018 09:35:19 natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO Distance Transform Phase 1

11/28/2018 09:35:19 natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO Distance Transform Phase 2

11/28/2018 09:35:19 natcap.invest.ui.model ERROR Exception while executing <function execute at 0x13CE03F0>

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\habitat_risk_assessment\hra.py", line 417, in execute

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\habitat_risk_assessment\hra.py", line 535, in make_add_overlap_rasters

KeyError: 'roadOVERLAP'

11/28/2018 09:35:19 natcap.invest.ui.model INFO Execution finished

11/28/2018 09:35:19 natcap.invest.utils INFO Elapsed time: 4.38s

11/28/2018 09:35:20 natcap.invest.ui.execution ERROR Target <function _logged_target at 0x13CE0C70> 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\habitat_risk_assessment\hra.py", line 417, in execute

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\habitat_risk_assessment\hra.py", line 535, in make_add_overlap_rasters

KeyError: 'roadOVERLAP'

11/28/2018 09:35:20 natcap.invest.ui.execution INFO Execution finished


Please help me. thanks for your cooperation.


Kind regards

Sohel

Comments

  • DaveDave Member, NatCap Staff
    edited November 28
    @ecohyd, this looks like a problem with the format of the habitat_stressor_ratings CSV files. 

    You have lines in those files that look like this:
    "singlecrop/constructionsiteactivitiesOVERLAP" and like this "singlecrop/roadOVERLAP"

    Try adding a space to separate the name of the stressor from the word overlap, like this:
    "singlecrop/road OVERLAP"

    That way the model will know to look for an input stressor with the name "road" and not "roadOVERLAP".

    Also, you can find examples of properly formatted CSV files from the sample data that you probably downloaded at the time you installed InVEST. And also see the User's Guide for a screenshot example (http://data.naturalcapitalproject.org/nightly-build/invest-users-guide/html/habitat_risk_assessment.html#ratings-csvs)
    Post edited by Dave on
  • ecohydecohyd Member
    edited November 28
    Many many thanks @Dave 

    Now there is another type of error occurred. Its called TypeError: Cannot concatenate 'str' and 'NoneType' Object. Can you please check?

    Thanks again.

    Kind regards
    Sohel
    Post edited by ecohyd on
  • DaveDave Member, NatCap Staff
    @ecohyd, yes. Please always post the logfile which will include the full error message. Posting your data like you did before doesn't hurt either. 
  • ecohydecohyd Member
    edited November 29
    Hi @Dave, Thanks for your suggestions. I forgot to attach the logfile details. Here I am giving you the details. Please see below.

    Thanks
    Post edited by ecohyd on
  • Hi @Dave, Thanks for your suggestions. I forgot to attach the logfile details. Here I am giving you the details. Please also check the attachment. Again many thanks and Sorry for any inconvenience. 

    Initializing...

    Showing messages with level INFO and higher

    11/29/2018 08:53:13 natcap.invest.utils INFO Writing log messages to C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess\InVEST-Habitat-Risk-Assessment-log-2018-11-29--08_53_13.txt

    11/29/2018 08:53:13 natcap.invest.ui.model Level 100 Starting model with parameters:

    Arguments for InVEST natcap.invest.habitat_risk_assessment.hra 3.5.0:

    aoi_tables C:/Users/ecohyd/Desktop/CEGIS/LGED-Sunamgang project/HabitatRiskAssess/Input/subregion.shp

    csv_uri C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\habitat_stressor_ratings

    decay_eq None

    grid_size 200

    max_rating 3

    max_stress 2

    results_suffix

    risk_eq Euclidean

    workspace_dir C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess


    11/29/2018 08:53:14 natcap.invest.habitat_risk_assessment.hra INFO Rasterizing shapefile layers.

    11/29/2018 08:53:15 natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO Distance Transform Phase 1

    11/29/2018 08:53:15 natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO Distance Transform Phase 2

    11/29/2018 08:53:16 natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO Distance Transform Phase 1

    11/29/2018 08:53:16 natcap.invest.pygeoprocessing_0_3_3.geoprocessing_cython INFO Distance Transform Phase 2

    11/29/2018 08:53:18 natcap.invest.habitat_risk_assessment.hra_core INFO Applying CSV criteria to rasters.

    11/29/2018 08:53:22 natcap.invest.habitat_risk_assessment.hra_core INFO Calculating risk rasters for individual overlaps.

    11/29/2018 08:53:27 natcap.invest.habitat_risk_assessment.hra_core INFO Calculating habitat risk rasters.

    11/29/2018 08:53:28 natcap.invest.habitat_risk_assessment.hra_core INFO Making risk shapefiles.

    11/29/2018 08:53:29 osgeo ERROR [errno 1] C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess\output\Maps\[khals]_HIGH_RISK.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:30 osgeo ERROR [errno 1] c:\swat\temp\tmp_ie119.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:30 osgeo ERROR [errno 1] C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess\output\Maps\[multiplecrop]_HIGH_RISK.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:30 osgeo ERROR [errno 1] C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess\output\Maps\[multiplecrop]_MED_RISK.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:31 osgeo ERROR [errno 1] c:\swat\temp\tmpffly3e.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:31 osgeo ERROR [errno 1] c:\swat\temp\tmpvxuzlt.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:33 osgeo ERROR [errno 1] C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess\output\Maps\[settlement]_HIGH_RISK.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:33 osgeo ERROR [errno 1] C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess\output\Maps\[settlement]_MED_RISK.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:33 osgeo ERROR [errno 1] c:\swat\temp\tmp4kzxki.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:33 osgeo ERROR [errno 1] c:\swat\temp\tmpvpjmhl.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:33 osgeo ERROR [errno 1] C:\Users\ecohyd\Desktop\CEGIS\LGED-Sunamgang project\HabitatRiskAssess\output\Maps\[singlecrop]_HIGH_RISK.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:34 osgeo ERROR [errno 1] c:\swat\temp\tmpykw0er.tif, band 1: Failed to compute statistics, no valid pixels found in sampling.

    11/29/2018 08:53:34 natcap.invest.habitat_risk_assessment.hra_core INFO Calculating ecosystem risk rasters.

    11/29/2018 08:53:36 natcap.invest.habitat_risk_assessment.hra_core INFO Creating subregion maps and risk plots.

    11/29/2018 08:53:36 osgeo WARNING [errno 1] Value 47737033.810099997 of field Shape_Area of feature 232 not successfully written. Possibly due to too larger number with respect to field width

    11/29/2018 08:53:36 osgeo WARNING [errno 1] Value 14290563.8354 of field Shape_Area of feature 234 not successfully written. Possibly due to too larger number with respect to field width

    11/29/2018 08:53:36 osgeo WARNING [errno 1] Value 47737033.810099997 of field Shape_Area of feature 232 not successfully written. Possibly due to too larger number with respect to field width

    11/29/2018 08:53:36 osgeo WARNING [errno 1] Value 14290563.8354 of field Shape_Area of feature 234 not successfully written. Possibly due to too larger number with respect to field width

    11/29/2018 08:53:40 natcap.invest.ui.model ERROR Exception while executing <function execute at 0x13B903F0>

    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\habitat_risk_assessment\hra.py", line 435, in execute

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

    File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\habitat_risk_assessment\hra_core.py", line 315, in make_risk_plots

    IndexError: list index out of range

    11/29/2018 08:53:40 natcap.invest.ui.model INFO Execution finished

    11/29/2018 08:53:40 natcap.invest.utils INFO Elapsed time: 27.37s

    11/29/2018 08:53:40 natcap.invest.ui.execution ERROR Target <function _logged_target at 0x13B90C30> 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\habitat_risk_assessment\hra.py", line 435, in execute

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

    File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\habitat_risk_assessment\hra_core.py", line 315, in make_risk_plots

    IndexError: list index out of range

    11/29/2018 08:53:40 natcap.invest.ui.execution INFO Execution finished


    Thanks and sorry for any inconvenience.


    Kind regards

    Sohel

  • Hi Sohel,

    The model is case sensitive for the required field name in the attribute table in the subregion shapefile. Therefore, it would be great if you could rename the field 'name' to 'Name' for the attribute table in your subregion.shp file. Let us know if that works!

    Best,
    Joanna
  • Hi @Joanna, @Dave
    Many many thanks for your kind reply. I have changed the 'name' to 'Name' for the attribute table in subregion.shp file. However, I still get the error messages called "IndexError: list Index out of range". I am attaching you the log file here. 

    One point I should mention. My land use shapefile, one stressor shapefile (construction site) and buffer area boundary is same. Do you think this create any problem?

    Thanks again.

    Kind regards
    Sohel


Sign In or Register to comment.