I am receiving an error when I run the Nutrient Delivery Ratio model using InVEST 3.9.1. I see that people have had a similar issue before, but I can’t seem to solve the problem. I received an error saying “lucode 11 present in land use raster but missing from the biophysical table”.
I have attached example data in a google drive folder. Both appear to have lucode 11. I am wonder if it is an issue with decimal places?
It does look like you have 11.0 in your LULC and biophysical table, but upon looking at the LULC raster in QGIS I saw that you had long floating point values. See the screen shot below:
In general you might need to clean up your LULC so that it only has the desired land use classes. It is a little strange that it didn’t error on one of these values instead.
I was able to fix my initial problem, but now I am receiving an error “cannot convert float NaN to integer”. I was able to fix this problem using the Arc tool int, but do you know if there is a way to do this in R? I have tried converting the raster values to integer and that does not seem to fix the problem.
Hi @sarahhalperin is this error coming from InVEST? If so, could you upload the logfile showing the error? That’ll help us pinpoint where the error is, and hopefully figure out a workaround in R.
Hi @sarahhalperin , thanks for sharing your data and log. You might have figured this out already, but it looks like the landcover raster has values of ‘nan’ and this is used as the nodata value as well. As you mentioned, the landcover raster would be more ideally an integer type. But nan is generally a “float”.
Then write the new raster using the datatype and NAflag options to define the new nodata value you chose and to specify the datatype as an integer type. R: Write raster data to a file