I’m running the Seasonal Water Yield (SWY) model (InVEST version 3.16.0
), and I’m encountering a persistent issue with the LULC classes and biophysical table lookup.
What I did:
- My LULC raster contains the classes
[0, 10, 20, 30, 40, 50, 60, 80, 100, 110, 120, 130, 150, 180, 190, 200, 210]
. - My biophysical table contains corresponding
lucode
values for all of these classes. - I checked the raster pixel types — they are
int32
. - To be extra cautious, I also:
- Added a dummy
2
class to the biophysical table because I suspected a float/int mismatch issue (KeyError: 2.0
). - Converted the biophysical table
lucode
column tofloat
so that the data types align.
- Added a dummy
Error Message:
Despite these steps, InVEST throws the same exception every time:
makefile
CopyEdit
KeyError: 2.0
That is:
makefile
CopyEdit
KeyError: 2.0
Traceback:
...
pandas\core\indexes\base.py in get_loc
...
What I have tried so far:
Ensured LULC contains no 2s
Added dummy lucode=2 to the biophysical CSV
Converted biophysical lucode column to float
Converted LULC to int32
Checked that NoData is properly set in the LULC
And still the issue persists.
Request:
- Why does the model look for class
2.0
when it doesn’t exist in my raster or table? - Could this be an internal bug where the model incorrectly infers a
2
class? - Is there a recommended workflow for ensuring datatype compatibility (
int
vsfloat
) between LULC and the biophysical table?
Your guidance would be greatly appreciated — this issue is blocking my SWY analysis entirely. Thanks in advance!