Error message stating index 5 is out of bounds for axis 1 with size 5

What is the issue or question you have?

How can I correct the index error message? I originally received an index error saying 15 is out of bounds. It looks like the object Id column was creating the problem in the land use raster I am using. However, I fixed that and am not receiving the same error, but with a different index number (5).

What do you expect to happen?

I expect to receive a retention raster with data. I am receiving empty outputs.

What have you tried so far?

I reclassified the land use raster to correct the object id to match the lucode to ensure it also started at 0. Now, it is not giving me an error related to that parameter, but giving me an error potentially with the hydrologic soil group raster. I checked the object Id column for the HSG raster and the index starts at 0 as it should. I am not sure how to fix this issue to receive an output with data included.

Upload the logfile using the :outbox_tray: button

I can not find the ‘outbox_tray: button’. Here is a copy of the error message:
06/19/2024 12:52:17 natcap.invest.utils Level 100 Writing log messages to [C:\WatershedMaps\HeadwatersSwiftCreek_Watersh\InVEST-natcap.invest.stormwater-log-2024-06-19–12_52_17.txt]
06/19/2024 12:52:17 main Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.stormwater 3.14.2:
adjust_retention_ratios True
aggregate_areas_path C:\WatershedMaps\HeadwatersSwiftCreek_Watersh\Headwaters_Boundary.shp
biophysical_table C:\WatershedMaps\HeadwatersSwiftCreek_Watersh\Headwaters_BIO.csv
lulc_path C:\WatershedMaps\HeadwatersSwiftCreek_Watersh\Processed_Headwtr_2001LU.tif
n_workers -1
precipitation_path C:\WatershedMaps\HeadwatersSwiftCreek_Watersh\Processed_Headwater_Prcpt.tif
replacement_cost 10000
results_suffix
retention_radius 564000000
road_centerlines_path C:\WatershedMaps\HeadwatersSwiftCreek_Watersh\Processed_headwtr_rds.shp
soil_group_path C:\WatershedMaps\HeadwatersSwiftCreek_Watersh\processed_HSC_headwter.tif
workspace_dir C:\WatershedMaps\HeadwatersSwiftCreek_Watersh

06/19/2024 12:52:17 py.warnings WARNING osgeo\gdal.py:312: FutureWarning: Neither gdal.UseExceptions() nor gdal.DontUseExceptions() has been explicitly called. In GDAL 4.0, exceptions will be enabled by default.

06/19/2024 12:52:17 pygeoprocessing.geoprocessing INFO 1 of 3 aligned: lulc_aligned.tif
06/19/2024 12:52:17 pygeoprocessing.geoprocessing INFO 2 of 3 aligned: soil_group_aligned.tif
06/19/2024 12:52:17 pygeoprocessing.geoprocessing INFO 3 of 3 aligned: precipitation_aligned.tif
06/19/2024 12:52:17 pygeoprocessing.geoprocessing INFO aligned all 3 rasters.
06/19/2024 12:52:17 pygeoprocessing.geoprocessing INFO starting stats_worker
06/19/2024 12:52:17 pygeoprocessing.geoprocessing INFO started stats_worker <Thread(Thread-1 (stats_worker), started daemon 10704)>
06/19/2024 12:52:17 pygeoprocessing.geoprocessing ERROR exception encountered in raster_calculator
Traceback (most recent call last):
File “pygeoprocessing\geoprocessing.py”, line 495, in raster_calculator
File “pygeoprocessing\geoprocessing.py”, line 728, in apply_op
File “natcap\invest\stormwater.py”, line 869, in
IndexError: index 5 is out of bounds for axis 1 with size 5
06/19/2024 12:52:17 pygeoprocessing.geoprocessing INFO Waiting for raster stats worker result.
06/19/2024 12:52:17 pygeoprocessing.geoprocessing_core WARNING No valid pixels were received, sending None.
06/19/2024 12:52:17 taskgraph.Task ERROR Something went wrong when adding task calculate stormwater retention ratio (1), terminating taskgraph.
Traceback (most recent call last):
File “taskgraph\Task.py”, line 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “natcap\invest\stormwater.py”, line 868, in lookup_ratios
File “pygeoprocessing\geoprocessing.py”, line 731, in raster_map
File “pygeoprocessing\geoprocessing.py”, line 495, in raster_calculator
File “pygeoprocessing\geoprocessing.py”, line 728, in apply_op
File “natcap\invest\stormwater.py”, line 869, in
IndexError: index 5 is out of bounds for axis 1 with size 5
06/19/2024 12:52:17 natcap.invest.utils ERROR Exception while executing natcap.invest.stormwater
Traceback (most recent call last):
File “natcap\invest\utils.py”, line 165, in prepare_workspace
File “invest\cli.py”, line 470, in main
File “natcap\invest\stormwater.py”, line 509, in execute
File “taskgraph\Task.py”, line 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “natcap\invest\stormwater.py”, line 868, in lookup_ratios
File “pygeoprocessing\geoprocessing.py”, line 731, in raster_map
File “pygeoprocessing\geoprocessing.py”, line 495, in raster_calculator
File “pygeoprocessing\geoprocessing.py”, line 728, in apply_op
File “natcap\invest\stormwater.py”, line 869, in
IndexError: index 5 is out of bounds for axis 1 with size 5
06/19/2024 12:52:17 natcap.invest.utils INFO Elapsed time: 0.25s
06/19/2024 12:52:17 natcap.invest.utils INFO Execution finished; version: 3.14.2

Hello @ARiggs -

Does your Soil Hydrologic Group raster have any values other than 1-4? This raster may only have values 1-4, corresponding with hydrologic soil groups A-D.

I’m noticing now that the Urban Stormwater model User Guide chapter is missing information in the Data Sources section, where we provide more detail about these layers, so I’ll fix that. In the meantime, here’s a link to more information about this layer.

If this is not the problem, it might be useful for us to take a look at your data. You can follow these instructions to package them up, and post them wherever works for you that we can access.

~ Stacie

1 Like

Hi Stacie!

Thank you for your response!

My Soil Hydrologic Group raster has 6 values. They are indexed (0-5). I will investigate the instructions you sent and hopefully it will help me to run the model. If not, I will package my data and follow the instructions so it is available for access. Thank you again!

  • Amanda

Hi Stacie.

The instructions regarding my hydrologic soil group worked! Thank you so much for the help with that!
However, I am having different troubles regarding the title length. I retitled all of my data, yet I am still getting the same error message. I have included both the error message and my data pack below. Thank you for all your help with this!!

Best,
Amanda

6/23/2024 13:10:00 natcap.invest.utils Level 100 Writing log messages to [C:\hdw\InVEST-natcap.invest.stormwater-log-2024-06-23–13_10_00.txt]
06/23/2024 13:10:00 main Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.stormwater 3.14.2:
adjust_retention_ratios True
aggregate_areas_path C:\hdw\Hdswbnd.shp
biophysical_table C:\hdw\Hdwtr_BIO.csv
lulc_path C:\hdw\hdw2001.tif
n_workers -1
precipitation_path C:\hdw\hdwprcpt.tif
replacement_cost 10000
results_suffix
retention_radius 564000000
road_centerlines_path C:\hdw\HdwtRds.shp
soil_group_path C:\hdw\HdwHSG.tif
workspace_dir C:\hdw

06/23/2024 13:10:00 py.warnings WARNING osgeo\gdal.py:312: FutureWarning: Neither gdal.UseExceptions() nor gdal.DontUseExceptions() has been explicitly called. In GDAL 4.0, exceptions will be enabled by default.

06/23/2024 13:10:01 taskgraph.Task INFO not precalculated (create raster to pass to pygeoprocessing.rasterize (3)), Task hash exists, but there are these mismatches: Modified times don’t match cached: (1719162224318311424.000000) actual: (1719162224333220352.000000)
06/23/2024 13:10:01 taskgraph.Task INFO not precalculated (rasterize road centerlines vector (4)), Task hash exists, but there are these mismatches: Modified times don’t match cached: (1719162224333220352.000000) actual: (1719162601013785088.000000)
06/23/2024 13:10:01 pygeoprocessing.geoprocessing INFO 100.0% complete
06/23/2024 13:10:01 pygeoprocessing.geoprocessing_core INFO Distance Transform Phase 2
06/23/2024 13:10:01 pygeoprocessing.geoprocessing INFO starting stats_worker
06/23/2024 13:10:01 pygeoprocessing.geoprocessing INFO started stats_worker <Thread(Thread-1 (stats_worker), started daemon 14432)>
06/23/2024 13:10:01 pygeoprocessing.geoprocessing INFO 100.0% complete
06/23/2024 13:10:01 pygeoprocessing.geoprocessing INFO Waiting for raster stats worker result.
06/23/2024 13:10:01 osgeo ERROR [errno 6] C:\hdw\intermediate\search_kernel.tif: File too large regarding tile size. This would result in a file with tile arrays larger than 2GB
06/23/2024 13:10:01 taskgraph.Task ERROR Something went wrong when adding task average retention ratios within radius (8), terminating taskgraph.
Traceback (most recent call last):
File “taskgraph\Task.py”, line 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “natcap\invest\stormwater.py”, line 1137, in raster_average
File “pygeoprocessing\kernels.py”, line 95, in dichotomous_kernel
File “pygeoprocessing\kernels.py”, line 254, in create_distance_decay_kernel
AttributeError: ‘NoneType’ object has no attribute ‘GetRasterBand’
06/23/2024 13:10:01 natcap.invest.utils ERROR Exception while executing natcap.invest.stormwater
Traceback (most recent call last):
File “natcap\invest\utils.py”, line 165, in prepare_workspace
File “invest\cli.py”, line 470, in main
File “natcap\invest\stormwater.py”, line 615, in execute
File “taskgraph\Task.py”, line 674, in add_task
File “taskgraph\Task.py”, line 1093, in _call
File “natcap\invest\stormwater.py”, line 1137, in raster_average
File “pygeoprocessing\kernels.py”, line 95, in dichotomous_kernel
File “pygeoprocessing\kernels.py”, line 254, in create_distance_decay_kernel
AttributeError: ‘NoneType’ object has no attribute ‘GetRasterBand’
06/23/2024 13:10:01 natcap.invest.utils INFO Elapsed time: 0.3s
06/23/2024 13:10:01 natcap.invest.utils INFO Execution finished; version: 3.14.2

invest_stormwater_datastack.zip (57.4 KB)

Hi @ARiggs -

The first error seems to be

06/23/2024 13:10:01 osgeo ERROR [errno 6] C:\hdw\intermediate\search_kernel.tif: File too large regarding tile size. This would result in a file with tile arrays larger than 2GB
06/23/2024 13:10:01 taskgraph.Task ERROR Something went wrong when adding task average retention ratios within radius (8), terminating taskgraph.

Looking at your inputs, the Retention Radius is given as 564000000 meters! I suspect that this is the problem.

~ Stacie

Hi Stacie.

Thank you so much for pointing out the retention radius. I will adjust the input for that parameter. If that doesn’t work, I will reach out to you. Hopefully, I will not need to bother you again!

Thank you very much for your assistance. The Urban Stormwater model is the first of three models I am working on. This research is for my thesis project, in which I am analyzing five sub-watersheds of interest. It is the first time I am using InVEST, so I truly appreciate the help! :slightly_smiling_face:

Best,
Amanda

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.