Warning " Raster has undefined NODATA value" in InVEST 3.11.0 Workbench

Hi everyone, my habitat quality model has finished successfully, but I have received warning messages in the process (showed in the screenshot 1) and wonder if these warnings would affect the reliability of my final results. To be specific, the final results provide valid values between 0 and 1, so I can’t make sure if these values are wrong.
As shown in the screenshot 1, in the part of “Validate threat rasters and collect unique LULC codes”, InVEST warned that my distribution rasters have undefined NODATA value.
However, I’m quite sure that all my threats rasters only have values of 0 and 1, which are showed in screenshot 2.
I want to know if these warning messages could be ignored and if my results under these warnings are reliable.
Thanks for your help in advance!

Hi @Qiao -

We do recommend that all of the raster inputs to InVEST models have a NoData value set. If you search this forum you’ll find many posts where people got errors because NoData was not set. I know that the software team is trying to handle the case of missing NoData, which is why you may have gotten a warning, instead of an error, but it is still best if you set a NoData value using your GIS.

If the results look fine to you, then it’s likely that, in this case, not having a NoData value did not affect the result.

~ Stacie


Hi Stacie,

Thank you for your detailed explanation! Then I’ll set NoData values as zero to deal with the warnings.

@Qiao , if 0 is a valid value for the raster, then it is not a good choice for the NoData value. If all the values of the raster should be between 0 and 1, then you might choose -1 for the NoData value, for example.

If you are concerned, please upload the complete logfile (the .txt file in the output workspace) so we can see exactly where the warning comes from and advise about the exact implications of an undefined NoData value.

@dave Hi dave, thanks for your help!
I was worried that values other than 0 and 1 would also be idenfied as “Undefined NODATA value”, so I have set 0 as the NODATA value. Then I ran the habitat quality model again and did not received warnings. Next, I compared the first set of results (which received warnings when being processed) and the second set of results (which didn’t receive warnings). Luckily, for the several pixels I checked, they had the same values in both the first and the second results. Therefore, I assume that not setting NODATA values or setting 0 as NODATA values does not affect the results.
However, there is still a problem. When I generated threat maps, I set values for threatening land uses (e.g. urban areas) as 1 and values for natural land uses as 0. But for NODATA areas, I also set their values as 0 in the threat maps. Given that only marine regions in my data are NODATA and all terrestrial regions are not NODATA, I think setting values for both NODATA and no-threatening regions as 0 in threat maps won’t affect the results. May I know what’s your opinion on this problem? many thanks.
Here is the logfile for the first set of results. Looking forward to your advice!
InVEST-natcap.invest.habitat_quality-log-2022-07-25–18_28_46.txt (392.1 KB)

@dave As a supplement, in the sensitivity table for all land uses, I add a row for NODATA: its Name is “NoData”, its LULC code is set as 0, and its sensitivities to all threats are set as 0 too.
The sample sensitivity table in InVEST guidance document doesn’t include information on NODATA, so I’m not sure if it’s okay to deal with NODATA in this way.

I wonder if NODATA in both LULC rasters and threats rasters must be set to a same value (e.g. -1), so that this value could be identifed as NODATA value by InVEST when running models and there would be no warnings about “Undefined NODATA value”.
I would like to get suggestions from you on this problem as well, thanks a lot!

Actually each raster file can store information about its own nodata value as part of the file’s metadata. So as long as this metadata is defined, InVEST can detect what the nodata value is, and deal with it appropriately. It doesn’t matter if it is the same for every file. And I don’t think it is necessary to add a row in the tables for this value, so long as every raster has its nodata value defined in its metadata.

This is true, but only for this very specific case, probably because there were no pixels with nodata present in your rasters. For other rasters, and other GIS applications more generally, there will be lots of cases where 0 should not be treated the same as nodata. “nodata” means “I don’t know what the data is in this pixel”. “0” means, “I know the data in this pixel, and it is 0”.

Regarding the original WARNING, I think it’s not so helpful to display this message. The model is checking if all the threat raster values are between 0 and 1. In doing so, it tried to detect the nodata value defined in the raster’s metadata, and found that it was undefined. This is not a problem, so long as all the values were in fact between 0 and 1. (They are, you would have gotten an error otherwise).

It may not affect the results in this case, but nodata means “I don’t know what the threat is in this area.” 0 means, “I know this area has no threat”. So I would assign the values accordingly and not try to make “0” carry two different meanings.

I get it!
I’ll assign unique values (not the same with other meaningful values) for NODATA in LULC raster and threats, and delete the row for NODATA in table.
Really appreciate your helpful suggestions!

1 Like