IndexError: index 6 is out of bounds for axis 1 with size 5

Hi community,

I am encountering errors while executing an urban stormwater retention model. All input data, including land use/land cover (LULC), soil hydrologic group, precipitation, and the biophysical table, appear valid. The data utilizes consistent formats and coordinate systems. I have searched online resources for solutions but haven’t identified the root cause, which I suspect might be related to the Python code.

Could any members of the community share their experiences with similar issues or suggest potential troubleshooting steps?

Many thanks.
InVEST-natcap.invest.stormwater-log-2024-05-23–07_42_26.txt (3.7 KB)

Thanks for including your logfile!

First, I see that you’re using InVEST 3.13.0, which is a little out of date. Could you try the latest version of InVEST and see if it fixes the issue?

If that doesn’t fix the issue, please double-check that your biophysical table has a row for every LULC class in your land use / land cover raster.

If that doesn’t resolve the issue, could you share your data with us? It would be great to improve this error message for others anyways.

Thank you!
James

Thank you for your response. I just checked that errors come from my raster files, I already fixed and the model can run now. However, after I ran it, I realized that two warnings say:

  • py.warnings WARNING natcap\invest\stormwater.py:901: RuntimeWarning: overflow encountered in multiply
  • py.warnings WARNING natcap\invest\stormwater.py:960: RuntimeWarning: invalid value encountered in multiply

So what does this warning mean?

Glad to hear that you got it working @john16. @jdouglass might be able to give a more specific response to this particular warning message, but in general you can safely ignore things labeled WARNING. Warnings are common, and generally don’t affect results. The main time I pay attention to them is if they’re followed by an error that causes the model run to fail, in which case they may be related to the error.

~ Stacie

Usually these warnings are the result of some kind of non-finite value that is present in your arrays, especially in your precip, lulc or soils rasters, leading to a numerical overflow. Some rasters or GIS software use nan values instead of a true nodata value, so if this is the case, then you shouldn’t need to worry about the validity of outputs. Either way, you can avoid this by removing any nan or +/- infinity values in your input rasters.

And if this doesn’t make sense with your inputs, let us know and we can try to look into it a bit more.

James

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