Help!INVEST habitat quality,IndexError: index 7 is out of bounds for axis 0 with size 7

IndexError: index 7 is out of bounds for axis 0 with size 7.
thank you very much!Looking forward to the answer!

Initializing…
Showing messages with level INFO and higher
2019-07-17 10:11:11,141 utils.prepare_workspace(109) INFO Writing log messages to D:\muitlfunctional\workspace1\InVEST-Habitat-Quality-log-2019-07-17–10_11_11.txt
2019-07-17 10:11:11,148 usage._log_model(275) WARNING an exception encountered when logging TypeError(‘not a string’,)
2019-07-17 10:11:11,142 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_cur_path D:/muitlfunctional/lulc2015.tif
n_workers -1
sensitivity_table_path D:/muitlfunctional/sensitivity.csv
suffix
threat_raster_folder D:\muitlfunctional\threat raster
threats_table_path D:/muitlfunctional/threats.csv
workspace_dir D:\muitlfunctional\workspace1

2019-07-17 10:11:11,194 habitat_quality.execute(193) INFO Starting aligning and resizing land cover and threat rasters
2019-07-17 10:11:11,223 geoprocessing.align_and_resize_raster_stack(729) INFO n_workers > 1 (2) so starting a processes pool.
2019-07-17 10:11:12,012 geoprocessing.align_and_resize_raster_stack(779) INFO 1 of 7 aligned: lulc2015_aligned.tif
2019-07-17 10:11:12,625 geoprocessing.align_and_resize_raster_stack(779) INFO 2 of 7 aligned: urb_c_aligned.tif
2019-07-17 10:11:12,625 geoprocessing.align_and_resize_raster_stack(779) INFO 3 of 7 aligned: bl_c_aligned.tif
2019-07-17 10:11:12,665 geoprocessing.align_and_resize_raster_stack(779) INFO 4 of 7 aligned: mrail_c_aligned.tif
2019-07-17 10:11:12,667 geoprocessing.align_and_resize_raster_stack(779) INFO 5 of 7 aligned: ind_c_aligned.tif
2019-07-17 10:11:12,709 geoprocessing.align_and_resize_raster_stack(779) INFO 6 of 7 aligned: mroad_c_aligned.tif
2019-07-17 10:11:12,711 geoprocessing.align_and_resize_raster_stack(779) INFO 7 of 7 aligned: rur_c_aligned.tif
2019-07-17 10:11:12,760 geoprocessing.align_and_resize_raster_stack(788) INFO aligned all 7 rasters.
2019-07-17 10:11:12,760 habitat_quality.execute(207) INFO Finished aligning and resizing land cover and threat rasters
2019-07-17 10:11:12,760 habitat_quality.execute(221) INFO Starting habitat_quality biophysical calculations
2019-07-17 10:11:12,760 habitat_quality.execute(228) INFO Handling Access Shape
2019-07-17 10:11:12,795 habitat_quality.execute(241) INFO No Access Shape Provided, access raster filled with 1s.
2019-07-17 10:11:12,795 habitat_quality.execute(253) INFO Calculating habitat quality for landuse: D:\muitlfunctional\workspace1\intermediate\lulc2015_aligned.tif
2019-07-17 10:11:12,795 habitat_quality.map_raster_to_dict_values(640) INFO Starting map_raster_to_dict_values
2019-07-17 10:11:12,809 geoprocessing.raster_calculator(366) INFO starting stats_worker
2019-07-17 10:11:12,809 geoprocessing.raster_calculator(372) INFO started stats_worker <Thread(Thread-15, started daemon 11060)>
2019-07-17 10:11:12,812 geoprocessing.raster_calculator(477) INFO Waiting for raster stats worker result.
2019-07-17 10:11:12,813 threading.run(754) WARNING No valid pixels were received, sending None.
2019-07-17 10:11:12,815 model._logged_target(1639) ERROR Exception while executing <function execute at 0x10FED2B0>
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 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 7 is out of bounds for axis 0 with size 7
2019-07-17 10:11:12,815 model._logged_target(1642) INFO Execution finished
2019-07-17 10:11:12,815 utils.prepare_workspace(115) INFO Elapsed time: 1.67s
2019-07-17 10:11:12,815 execution.run(78) ERROR Target <function _logged_target at 0x1932FBF0> 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 1636, 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 7 is out of bounds for axis 0 with size 7
2019-07-17 10:11:12,816 execution.run(83) INFO Execution finished

This error is usually the case when your sensitivity table is missing some rows for some landcover codes. Could you check your sensitivity table to make sure that you have a value in the LULC column for each value in your landcover table?

Hi,thanks a lot!!I have looked up your answers to other people yesterday and found that it seems caused by nodata.i then converted all nodata to 0,finally it works.Thank you very much!

Excuse me. May I know how did you solve this problem. I can’t solve this problem only trans nodata to 0

Hi @AnRui2020 -

Did you also make sure that your sensitivity table has entries for all landcover codes in the landcover map, as jdouglass suggested?

~ Stacie