Nutrient Delivery Ratio lucode error

Hi all,

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?

Any help would be really appreciated!


Hi @sarahhalperin ,

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.

  • Doug

Thank you! I must have ran into issue reprojecting in R.

1 Like

Hi @dcdenu4 ,

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.


1 Like

Yes, my apologies! I should have attached it to start with.

I have attached it here and have uploaded files to the same google drive folder.

InVEST-Nutrient-Delivery-Ratio-Model-(NDR)-log-2021-10-15–09_05_04.txt (74.1 KB)

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”.

So if you’re working in R (and using the raster package), you might need to first reclassify the NA values to something else. Filling/replacing nodata values of a raster layer in R - Geographic Information Systems Stack Exchange

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

Good luck!