ValueError: The biophysical table is missing a row for lucode(s) [255]

Hello, this error is appearing when I run the urban flood risk model: ValueError: The biophysical table is missing a row for lucode(s) [255].
There are 0 values in the table, but they are meant as values and not meant as NoData. I tried adding a row for lucode 0 with CN values 0, and it still doesn’t work. Any thoughts? I attached the LULC raster and biophysical table. Thanks

LULC_CB.tif (2.5 MB)
Biophys_CB.csv (81.3 KB)

Hi @EAM07 , thanks for creating a new topic. Your message says “biophysical table is missing a row for lucode(s) [255]”.

You need a row in your table for code 255. Or you you need to reclassify the 255 in your raster to another code, or to nodata.

However, looking at your raster, I think you might need to go back a few steps to the original source of the landcover raster. The raster you linked here is a simple image, with Red-Green-Blue bands. The pixel values only represent colors on the RGB scale.

What you really need is a raster with the pixel values representing categories of landcover, to match your biophysical table. If you did any pre-processing to create this raster, you might want to go back to the original source. Or if this is the original data source, you might need to find a different source for the LULC raster.

Hello again,
Thank you for your response.
Actually the is no lucode 255, so the error is really weird.
I did however check the LULC raster, and I fixed the issue, my rasters both include pixel values and I relaunched the model, I am now getting this error, although I added a row for lucode 0 with 0 values:

ValueError: The biophysical table is missing a row for lucode(s) [0]

Any thoughts?
Thanks again!

Feature_ocso1.tif (194.2 KB)

Biophys_CB.csv (81.3 KB)

Hi @EAM07 , thanks for updating your data. Could you please share the rest of your input data (Area Of Interest & soils raster) and the logfile in your output workspace? Thank you,

Sure, thanks.

Feature_Rast1.tif (578.3 KB)
Area of (2.1 MB)
InVEST-natcap.invest.urban_flood_risk_mitigation-log-2022-11-22–13_54_07.txt (3.8 KB)

Did you know your raster has 3 layers? This could be an issue.
Moreover, when I open it either on QGIS or R, I get an image as if it was a map image (with a north arrow and all) not an actual raster. Maybe that’s the problem?

Thanks for these items. There’s a couple things going on here, including a misleading error message since you do have “0” present in the biophysical table.

But, looking at the updated landcover raster, it seems likely that “0” is intended to represent nodata, rather than a particular landcover type. All the green around the outside of this raster has a value 0.

In that case, I think the best thing to do is follow the suggestions from this post to assign a NoData value: ValueError: The biophysical table is missing a row for lucode(s) [0] - #4 by dave

And then remove the row for “lucode 0” in your biophysical table.

We will also fix the problem of the misleading error message. Because technically I think your data should be okay the way it is.

Hello again,

I tried everything you suggested and then I got this error:
ValueError: invalid entry in choice array
Check that the Soil Group raster does not contain values other than (1, 2, 3, 4)

I think the problem was the hydrologic soil group raster because it has more than 4 values. However I downloaded the map that is suggested in the documentation of the model, I couldn’t find any other hydrologic soil group maps. I attached the 2 files I’m trying to use for you to check, but I think maybe this is the main issue?

Feature_Rast1_CB.tif (578.3 KB)
HYSG_CB.tif (18.2 KB)

Yes, the soil raster is now the problem. Often solving one problem reveals another. Which soils dataset did you download? There are a couple mentioned in the documentation and it is also mentioned that these rasters need to be reclassified to only contain values from 1 - 4 before using them. That seems like the step you will need to take.

I downloaded it from this link:

I am trying the Reclassify tool on ArcGIS, this is it right?

Yes, that should do it.