Habitat Q. Error

Hi
what is the error for this message…
Initializing…
Showing messages with level INFO and higher
09/02/2019 09:53:47 natcap.invest.utils INFO Writing log messages to X:\KKC_Threat2\invest\run1\InVEST-Habitat-Quality-log-2019-09-02–09_53_47.txt
09/02/2019 09:53:47 natcap.invest.ui.model Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.habitat_quality 3.6.0:
half_saturation_constant 0.5
lulc_cur_path X:/KKC_Threat2/invest/landuse_tiff/lu2015_4.tif
n_workers -1
sensitivity_table_path X:/KKC_Threat2/invest/sensitivity5_kkc.csv
suffix T2
threat_raster_folder X:\KKC_Threat2\invest\Threat_tiff
threats_table_path X:/KKC_Threat2/invest/KKC_Threat4.csv
workspace_dir X:\KKC_Threat2\invest\run1

09/02/2019 09:53:47 natcap.invest.ui.model ERROR Exception while executing <function execute at 0x137FE3F0>
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 1579, in _logged_target
File “C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 178, in execute
ValueError: The following land cover codes were found in the sensitivity table. Check your sensitivity table to see if they are missing: -128.

09/02/2019 09:53:47 natcap.invest.ui.model INFO Execution finished
09/02/2019 09:53:47 natcap.invest.utils INFO Elapsed time: 0.27s
09/02/2019 09:53:47 natcap.invest.ui.execution ERROR Target <function _logged_target at 0x17224B30> 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 1579, in _logged_target
File “C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 178, in execute
ValueError: The following land cover codes were found in the sensitivity table. Check your sensitivity table to see if they are missing: -128.

09/02/2019 09:53:47 natcap.invest.ui.execution INFO Execution finished
09/02/2019 09:53:57 natcap.invest.ui.inputs INFO Opening file explorer to workspace directory
09/02/2019 09:53:57 natcap.invest.ui.inputs INFO Using windows explorer to view files
09/02/2019 10:06:24 natcap.invest.ui.inputs INFO Opening file explorer to workspace directory
09/02/2019 10:06:24 natcap.invest.ui.inputs INFO Using windows explorer to view files

Hi @dhamma57, I believe we’ve fixed this issue in a more recent version of InVEST. Could you try this development build and see if the issue is fixed?

Here’s the download link: https://storage.googleapis.com/releases.naturalcapitalproject.org/invest/3.6.0.post525%2Bh31b10cfee0d4/InVEST_3.6.0.post525%2Bh31b10cfee0d4_x86_Setup.exe

Let us know if the issue persists using this version of InVEST.
James

Dear Sir.
It run to a new ERROR,
Initializing…
Showing messages with level INFO and higher
2019-09-04 00:35:16,947 utils.prepare_workspace(109) INFO Writing log messages to X:\KKC_Threat2\invest\run1\InVEST-Habitat-Quality-log-2019-09-04–00_35_16.txt
2019-09-04 00:35:16,953 model._logged_target(1634) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.habitat_quality 3.6.0.post525+h31b10cfee0d4:
half_saturation_constant 0.5
lulc_cur_path X:/KKC_Threat2/invest/landuse_tiff/lu2015_4.tif
n_workers -1
sensitivity_table_path X:/KKC_Threat2/invest/sensitivity5_kkc.csv
suffix T2
threat_raster_folder X:\KKC_Threat2\invest\Threat_tiff
threats_table_path X:/KKC_Threat2/invest/KKC_Threat4.csv
workspace_dir X:\KKC_Threat2\invest\run1

2019-09-04 00:35:17,186 habitat_quality.execute(193) INFO Starting aligning and resizing land cover and threat rasters
2019-09-04 00:35:17,194 geoprocessing.align_and_resize_raster_stack(729) INFO n_workers > 1 (2) so starting a processes pool.
2019-09-04 00:35:18,477 geoprocessing.align_and_resize_raster_stack(779) INFO 1 of 7 aligned: lu2015_4_aligned.tif
2019-09-04 00:35:19,089 geoprocessing.align_and_resize_raster_stack(779) INFO 2 of 7 aligned: ntfp_c_aligned.tif
2019-09-04 00:35:19,181 geoprocessing.align_and_resize_raster_stack(779) INFO 3 of 7 aligned: poaching_c_aligned.tif
2019-09-04 00:35:19,578 geoprocessing.align_and_resize_raster_stack(779) INFO 4 of 7 aligned: logging_c_aligned.tif
2019-09-04 00:35:19,670 geoprocessing.align_and_resize_raster_stack(779) INFO 5 of 7 aligned: slash_c_aligned.tif
2019-09-04 00:35:20,134 geoprocessing.align_and_resize_raster_stack(779) INFO 6 of 7 aligned: camp_c_aligned.tif
2019-09-04 00:35:20,272 geoprocessing.align_and_resize_raster_stack(779) INFO 7 of 7 aligned: human_c_aligned.tif
2019-09-04 00:35:20,414 geoprocessing.align_and_resize_raster_stack(788) INFO aligned all 7 rasters.
2019-09-04 00:35:20,414 habitat_quality.execute(207) INFO Finished aligning and resizing land cover and threat rasters
2019-09-04 00:35:20,414 habitat_quality.execute(221) INFO Starting habitat_quality biophysical calculations
2019-09-04 00:35:20,414 habitat_quality.execute(228) INFO Handling Access Shape
2019-09-04 00:35:20,753 habitat_quality.execute(241) INFO No Access Shape Provided, access raster filled with 1s.
2019-09-04 00:35:20,757 habitat_quality.execute(253) INFO Calculating habitat quality for landuse: X:\KKC_Threat2\invest\run1\intermediate\lu2015_4_aligned.tif
2019-09-04 00:35:20,757 habitat_quality.map_raster_to_dict_values(640) INFO Starting map_raster_to_dict_values
2019-09-04 00:35:20,778 geoprocessing.raster_calculator(366) INFO starting stats_worker
2019-09-04 00:35:20,789 geoprocessing.raster_calculator(372) INFO started stats_worker <Thread(Thread-25, started daemon 3472)>
2019-09-04 00:35:20,838 geoprocessing.raster_calculator(477) INFO Waiting for raster stats worker result.
2019-09-04 00:35:20,838 threading.run(754) WARNING No valid pixels were received, sending None.
2019-09-04 00:35:20,842 model._logged_target(1640) ERROR Exception while executing <function execute at 0x10EBC270>
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1637, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 260, in execute
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 647, in map_raster_to_dict_values
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1766, in reclassify_raster
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 415, in raster_calculator
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1762, in _map_dataset_to_value_op
IndexError: index 17 is out of bounds for axis 0 with size 17
2019-09-04 00:35:20,842 model._logged_target(1643) INFO Execution finished
2019-09-04 00:35:20,842 utils.prepare_workspace(115) INFO Elapsed time: 3.89s
2019-09-04 00:35:20,845 execution.run(78) ERROR Target <function _logged_target at 0x13A94030> failed with exception
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\execution.py”, line 68, in run
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1637, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 260, in execute
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 647, in map_raster_to_dict_values
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1766, in reclassify_raster
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 415, in raster_calculator
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1762, in _map_dataset_to_value_op
IndexError: index 17 is out of bounds for axis 0 with size 17
2019-09-04 00:35:20,845 execution.run(83) INFO Execution finished
2019-09-04 00:35:20,858 inputs.open_workspace(99) INFO Opening file explorer to workspace directory
2019-09-04 00:35:20,858 inputs.open_workspace(103) INFO Using windows explorer to view files

I am sure, i am not run with the pipeline data,
Thank you

Ah, I can’t believe I attached the wrong download link. Sorry about that! Here’s the actual latest development build: https://storage.googleapis.com/releases.naturalcapitalproject.org/invest/3.7.0.post366+hc94dfedffddd/InVEST_3.7.0.post366+hc94dfedffddd_x86_Setup.exe

Could you try this one and let us know if this works?
Thanks!
James

Dear Sir;
It still error by the pipeline data;
Initializing…
Showing messages with level INFO and higher
2019-09-04 13:06:23,216 utils.prepare_workspace(115) INFO Writing log messages to X:\KKC_Threat2\invest\run2\InVEST-Habitat-Quality-log-2019-09-04–13_06_23.txt
2019-09-04 13:06:23,220 model._logged_target(1653) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.habitat_quality 3.7.0.post366+hc94dfedffddd:
half_saturation_constant 0.5
lulc_cur_path X:/KKC_Threat2/invest/landuse_tiff/lu2015_4.tif
n_workers -1
sensitivity_table_path X:/KKC_Threat2/invest/sensitivity5_kkc.csv
suffix T3
threat_raster_folder X:\KKC_Threat2\invest\Threat_tiff
threats_table_path X:/KKC_Threat2/invest/KKC_Threat4.csv
workspace_dir X:\KKC_Threat2\invest\run2

2019-09-04 13:06:23,263 model._logged_target(1659) ERROR Exception while executing <function execute at 0x13F7E330>
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1656, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 94, in execute
KeyError: 0
2019-09-04 13:06:23,263 model._logged_target(1662) INFO Execution finished
2019-09-04 13:06:23,267 utils.prepare_workspace(121) INFO Elapsed time: 0.05s
2019-09-04 13:06:23,279 execution.run(78) ERROR Target <function _logged_target at 0x13F7E8B0> failed with exception
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\execution.py”, line 68, in run
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1656, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 94, in execute
KeyError: 0
2019-09-04 13:06:23,279 execution.run(83) INFO Execution finished

Cheers;

Ah, interesting. This error makes it sound like the model couldn’t effectively parse the sensitivity table ( X:/KKC_Threat2/invest/sensitivity5_kkc.csv) correctly. This is usually die to a formatting issue such as the use of an unsupported delimiter. Could you post your sensitivity table so we can take a look?

Thanks!
James

Hi @dhamma57, actually, another user on the forums just reported the same error and if it is indeed the same, I’m hoping that this development build will address the issue for you. Could you try it out and let us know how it goes?

https://storage.googleapis.com/natcap-dev-build-artifacts/invest/jdouglass/3.7.0.post367+h11eff01a4d13/InVEST_3.7.0.post367+h11eff01a4d13_x86_Setup.exe

Thanks!
James

Dear jdouglass,
I have tried running a model for about a week now without success. It has kept flagging an error. I am using the latest version of the software. The log is as follows:

2019-09-07 22:35:36,664 utils.prepare_workspace(109) INFO Writing log messages to C:\Users\DR. ENARUVBE\Documents\habitat_quality_workspace\InVEST-Habitat-Quality-log-2019-09-07–22_35_36.txt
2019-09-07 22:35:37,117 model._logged_target(1633) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.habitat_quality 3.7.0:
half_saturation_constant 0.5
lulc_bas_path E:/Google Drive/Research/Ecosystem services Ile-Ife/Opa Reservior/2000raw.tif
lulc_cur_path E:/Google Drive/Research/Ecosystem services Ile-Ife/Opa Reservior/2018raw.tif
lulc_fut_path E:/Google Drive/Research/Ecosystem services Ile-Ife/Opa Reservior/2030a.tif
n_workers -1
sensitivity_table_path E:/Google Drive/Research/Ecosystem services Ile-Ife/Opa Reservior/Threats/sensitivity.csv
suffix
threat_raster_folder E:\Google Drive\Research\Ecosystem services Ile-Ife\Opa Reservior\Threats
threats_table_path E:/Google Drive/Research/Ecosystem services Ile-Ife/Opa Reservior/Threats/threats.csv
workspace_dir C:\Users\DR. ENARUVBE\Documents\habitat_quality_workspace

2019-09-07 22:35:37,164 model._logged_target(1639) ERROR Exception while executing <function execute at 0x10F0C3F0>
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1636, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 112, in execute
ValueError: Threat “Farmland” does not match any column in the sensitivity table. Possible columns: set([‘Farmland’, ‘Built-up’])
2019-09-07 22:35:37,164 model._logged_target(1642) INFO Execution finished
2019-09-07 22:35:37,164 utils.prepare_workspace(115) INFO Elapsed time: 0.5s

Please assist
Glory

Hi.
It’ still error but with this message,
Initializing…
Showing messages with level INFO and higher
2019-09-09 20:30:29,979 utils.prepare_workspace(115) INFO Writing log messages to X:\KKC_Threat2\invest\run2\InVEST-Habitat-Quality-log-2019-09-09–20_30_29.txt
2019-09-09 20:30:29,979 model._logged_target(1653) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.habitat_quality 3.7.0.post367+h11eff01a4d13:
half_saturation_constant 0.5
lulc_cur_path X:/KKC_Threat2/invest/landuse_tiff/lu2015_4.tif
n_workers -1
sensitivity_table_path X:/KKC_Threat2/invest/sensitivity5_kkc.csv
suffix T3
threat_raster_folder X:\KKC_Threat2\invest\Threat_tiff
threats_table_path X:/KKC_Threat2/invest/KKC_Threat4.csv
workspace_dir X:\KKC_Threat2\invest\run2

2019-09-09 20:30:30,306 habitat_quality.execute(193) INFO Starting aligning and resizing land cover and threat rasters
2019-09-09 20:30:30,315 geoprocessing.align_and_resize_raster_stack(730) INFO n_workers > 1 (2) so starting a processes pool.
2019-09-09 20:30:31,852 geoprocessing.align_and_resize_raster_stack(780) INFO 1 of 7 aligned: lu2015_4_aligned.tif
2019-09-09 20:30:32,490 geoprocessing.align_and_resize_raster_stack(780) INFO 2 of 7 aligned: ntfp_c_aligned.tif
2019-09-09 20:30:32,678 geoprocessing.align_and_resize_raster_stack(780) INFO 3 of 7 aligned: poaching_c_aligned.tif
2019-09-09 20:30:33,171 geoprocessing.align_and_resize_raster_stack(780) INFO 4 of 7 aligned: logging_c_aligned.tif
2019-09-09 20:30:33,344 geoprocessing.align_and_resize_raster_stack(780) INFO 5 of 7 aligned: slash_c_aligned.tif
2019-09-09 20:30:33,727 geoprocessing.align_and_resize_raster_stack(780) INFO 6 of 7 aligned: camp_c_aligned.tif
2019-09-09 20:30:34,029 geoprocessing.align_and_resize_raster_stack(780) INFO 7 of 7 aligned: human_c_aligned.tif
2019-09-09 20:30:34,109 geoprocessing.align_and_resize_raster_stack(789) INFO aligned all 7 rasters.
2019-09-09 20:30:34,109 habitat_quality.execute(207) INFO Finished aligning and resizing land cover and threat rasters
2019-09-09 20:30:34,109 habitat_quality.execute(221) INFO Starting habitat_quality biophysical calculations
2019-09-09 20:30:34,109 habitat_quality.execute(228) INFO Handling Access Shape
2019-09-09 20:30:34,503 habitat_quality.execute(241) INFO No Access Shape Provided, access raster filled with 1s.
2019-09-09 20:30:34,503 habitat_quality.execute(253) INFO Calculating habitat quality for landuse: X:\KKC_Threat2\invest\run2\intermediate\lu2015_4_aligned.tif
2019-09-09 20:30:34,503 habitat_quality.map_raster_to_dict_values(641) INFO Starting map_raster_to_dict_values
2019-09-09 20:30:34,525 geoprocessing.raster_calculator(367) INFO starting stats_worker
2019-09-09 20:30:34,529 geoprocessing.raster_calculator(373) INFO started stats_worker <Thread(Thread-5, started daemon 2188)>
2019-09-09 20:30:34,536 geoprocessing.raster_calculator(478) INFO Waiting for raster stats worker result.
2019-09-09 20:30:34,536 threading.run(754) WARNING No valid pixels were received, sending None.
2019-09-09 20:30:34,540 model._logged_target(1659) ERROR Exception while executing <function execute at 0x149DE330>
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1656, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 260, in execute
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 648, in map_raster_to_dict_values
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1770, in reclassify_raster
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 416, in raster_calculator
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1766, in _map_dataset_to_value_op
IndexError: index 17 is out of bounds for axis 0 with size 17
2019-09-09 20:30:34,540 model._logged_target(1662) INFO Execution finished
2019-09-09 20:30:34,540 utils.prepare_workspace(121) INFO Elapsed time: 4.56s
2019-09-09 20:30:34,545 execution.run(78) ERROR Target <function _logged_target at 0x149DE8B0> failed with exception
Traceback (most recent call last):
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\execution.py”, line 68, in run
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\ui\model.py”, line 1656, in _logged_target
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 260, in execute
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\natcap\invest\habitat_quality.py”, line 648, in map_raster_to_dict_values
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1770, in reclassify_raster
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 416, in raster_calculator
File “Z:\opt\atlassian\pipelines\agent\build\env\lib\site-packages\pygeoprocessing\geoprocessing.py”, line 1766, in _map_dataset_to_value_op
IndexError: index 17 is out of bounds for axis 0 with size 17
2019-09-09 20:30:34,545 execution.run(83) INFO Execution finished

Cheers,

Hi @glo, I’m not completely sure what’s going on here. Could you attach or send your inputs so we can take a closer look?

Thanks!
James

@dhamma57, could you attach or send your inputs so we can take a closer look? It isn’t immediately clear what’s going on here.

Thanks!
James

Hi,

These are the set of files,

Cheers

ในวันที่ พ. 11 ก.ย. 2019 เวลา 02:09 James Douglass via Natural Capital Project Online Community naturalcapitalproject@discoursemail.com เขียนว่า:

(Attachment invest.rar is missing)

Hi

I send the files to your mail box,
But i have some surprise, these files could run by version 3.4.4

Thammanoon

Ok, good to know that these inputs will run in InVEST 3.4.4 … we’ll take a look at why they aren’t running in the latest version yet. You can send them to my email, jdouglass@stanford.edu since it looks like they’re too big to upload here.

HI @dhamma57, it looks like invest.rar wasn’t attached to the discussion (probably because the file is too large for the forum :slight_smile: )

Could you send your inputs directly to my email address (jdouglass@stanford.edu) so I can take a look?

Thanks,
James

Hi @dhamma57 I’m so sorry about the delay on this, and thanks for sending your inputs!!

So, the issue here is that a reclassification operation within the InVEST Habitat Quality model isn’t handling your landcover raster correctly because its format is a signed byte. While ArcGIS supports signed byte rasters no problem, the library we use to read and write rasters (GDAL) does not. I’ve converted your landcover to an Unsigned Int16 (and set the nodata value to 128) and the model completes successfully. I’ve emailed you the revised landcover raster so you can try this out for yourself in the short term. In the longer term, we’ll see about the best way to resolve this on our end and include the fix in a future release of InVEST.

Thanks for your patience on this and again, so sorry about the delay!
James

sensitivity_JJJ.csv (972 Bytes) threats_JJJ.csv (268 Bytes)
Dear jdouglass,
**I run the HQ, encounter the following problem, please see attached CSV and the log . could you please give me an email so I can provide the input data for your check, which is big to upload here.
Regards,
Su

We’re addressing this new problem in a different thread. I’m closing this one so we don’t duplicate efforts.

1 Like