What is the issue or question you have?
When I run the InVEST Urban Flood Mitigation model, I get the error code: " ValueError: The biophysical table is missing a row for lucode(s) ." There is no row for lucode 0 in the attribute table of the LULC raster, so I do not have a row for lucode 0 in the biophysical table either.
What have you tried so far?
I have tried adding a row of zero values to the biophysical table (with all CN values assigned to 0) but I got the same error. I also tried adding a mask to the LULC raster for the NoData values, but these are not present in the attribute table either way (with or without mask).
Attach the logfile here:
InVEST-natcap.invest.urban_flood_risk_mitigation-log-2022-10-20–11_20_49.txt (4.3 KB)
Hi @22nhaddad , thanks for posting your question.
InVEST does not actually read a raster’s attribute table, instead it reads all of the actual pixel values in the raster. And in this case there was one or more pixel with a value of 0.
That’s interesting, I would expect this to work, or at least result in a different error.
Sometimes the problem here is that the raster does not have a NoData value defined in it’s metadata. Is it possible 0 is meant to be NoData, but NoData is not actually defined in the raster?
Feel free to upload your CSV and LULC raster and we can take a closer look. Thanks,
nlcd_2019_land_cover_repr_data_edit.tif (5.8 MB)
Biophysical_Table_Floods.csv (275 Bytes)
Thank you for your response! Attached are the biophysical table and LULC raster. Do you know how I can define the NoData values for the raster?
Thanks, it looks like you do intend 0 to be interpreted as nodata, as there are many pixels with value 0 filling in the edges.
In QGIS if I
Layer > Save as there is a panel at the bottom to define the nodata value. “From” is the value you want to be treated as nodata (i.e. 0) and “To” is a value to use to represent nodata (it could also be 0 in this case).
Presumably ArcGIS has a similar functionality if you’re using that.
Hello, the same error is appearing when I run the urba flood risk model:
ValueError: The biophysical table is missing a row for lucode(s) .
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.
Biophys_CB.csv (81.3 KB)
LULC_CB.tif (2.5 MB)
Hi @EAM07 , your error is very similar to the one discussed above, but your message says “biophysical table is missing a row for lucode(s) ”.
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.