NDR null values in watershed results

Hi, I’ve just tried running the NDR model using InVEST 3.8.The model seemed to run successfully, the streams layer looks ok and I have a ‘n_export.tif’ file with no obvious gaps. However, the ‘watershed_results_ndr.shp’ file contains NULL for the surf_n, sub_n and n_export_tot fields for both of my watersheds. I will try to attach the log file in case this provides any clues. Any advice would be really helpful.

Thanks, Katrina

InVEST-Nutrient-Delivery-Ratio-Model-(NDR)-log-2020-04-06–16_44_10.txt (25.0 KB)

Thanks for posting Katrina and welcome to the forums!

Hmm, well, it’s hard to say exactly from the logfile, but if the values of all those fields is NULL, then it sounds like the field values aren’t being set (which shouldn’t happen). Could you share your inputs with me so I can take a closer look? Dropbox or google drive or some other filesharing service is usually best, and feel free to send them either to me directly at jdouglass@stanford.edu or else direct-message me through the forums.

Thanks!
James

@Kat81 Thanks for sharing your inputs! This turned out to be a really interesting one, and it did turn up a bug in NDR where the nodata value of your nutrient runoff proxy input raster was not being handled appropriately, resulting in -inf values that then dominated any other calculations (such as summary statisics) elsewhere in the model.

If you don’t mind, could you try out this development build of InVEST for me and make sure that it resolves the issue? If it does, we’ll make sure that this fix gets into the next release of InVEST. Here’s the download link: https://storage.googleapis.com/natcap-dev-build-artifacts/invest/phargogh/3.8.0.post248+gf51689d3/InVEST_3.8.0.post248+gf51689d3_x86_Setup.exe

Thanks!
James

Hi James,

Thanks very much for your help. Sorry for the delay, I had some time off over Easter. I will try the development build version of InVEST and let you know how I get on.

Best wishes, Katrina

Hi @jdouglass, I’ve tried running the development version of InVEST that you sent but haven’t had much luck I’m afraid. I’m attaching the log from the first time I tried running the NDR model. Now, I’ve tried again and the model doesn’t seem to be running at all, the window keeps closing and I have to keep starting it again.

InVEST-Nutrient-Delivery-Ratio-Model-(NDR)-log-2020-05-06–16_11_25.txt (48.1 KB)

Any advice very useful,

Thanks,
Katrina

Hi Katrina, thanks for trying out the new build! Could you try running the model in a new workspace? Alternatively, could you try deleting this workspace (ndr_workspace)? These errors in the log are from a recent update to an internal task-management library, and could conceivably be causing InVEST to crash as well.

Let us know how this goes!
James

Hi James, I’ve deleted the ndr_workspace and made a new folder, then I’ve put that folder name as the new workspace. Unfortunately the InVEST model window just completely disappears when I click run. I noticed that when I re-open the NDR window to try again, it’s got the autosaved inputs from the previous run. Should I try and somehow start a completely new run?
Thanks,
Katrina

Hi Katrina,

Well that’s not a great sign! InVEST crashing hard like that indicates some deeper issue that we’ll need to address. To do so, it’ll be helpful to take a look at the error message that InVEST displays on the command prompt window that pops up with the application. Could you do these few steps to show the error message?

  1. Open up a command prompt (cmd.exe would be great)
  2. Within the command prompt, type:
    C:\InVEST_3.8.0.post248+gf51689d3\invest-3-x86\invest.exe
    
    If this InVEST installation is in a different place (or if I have the version slightly wrong), just be sure that you’re executing <InVEST installation path>\invest-3-x86\invest.exe.
  3. Open InVEST and run the model (to trigger the crash)
  4. Copy and paste whatever is displayed in the command prompt into a a text file and upload the text file to the thread here.

Thanks for your help debugging this!
James

1 Like

Hi James,

Thanks for the advice. I switched everything off and tried running the NDR model this morning, with a new workspace and it ran ok! It’s only crashed once and I just tried a new workspace again and that seemed to work. I’ve now been able to run it quite a few times without having to make a new workspace. The original problem I had with the nulls in the attribute table for N export seems to have been solved too, I have values in the table now. So I’m not sure why it was crashing like that yesterday. I tried getting a copy of the command line file but that didn’t seem to work. When I have the NDR model open, I can see the command line window behind it but this closes when the model crashes. When I opened my own cmd window, enter the location of InVEST and then run the model, my cmd window stayed empty. Maybe we don’t need to do this now the model is running, but I can try again if the model crashes any further.

Thanks again for your help,
Katrina

Hm. Well, I’m glad it was able to run, and please let us know if it crashes again! We’d like to fix those sorts of bugs if at all possible.

Hi James, I have been running InVEST over the last week. Unfortunately it is still crashing intermittently. The logs show no error messages and the model appears to be running fine until the window closes altogether. I’m trying to save a copy of the cmd window to send you but having a few problems.

When I run the model, the NDR command line window is automatically open and notes on model progress are being written there. If I try and open my own cmd window and type in the C drive location of InVEST and invest.exe, (before I run the model) that window just sits empty while the model runs. I’m probably missing something, I don’t use cmd a lot. Any thoughts on how to get the model to write the notes on model progress into the new command line window I have opened instead of the InVEST one?

Thanks,
Katrina

Yes! When running the InVEST application, the --debug flag will do the trick. So for NDR, this would look like:

C:\InVEST_3.8.0.post248+gf51689d3\invest-3-x86\invest.exe --debug run ndr

Assuming C:\InVEST_3.8.0.post248+gf51689d3 is the location of your InVEST installation.

This will produce a lot of output, both from the model and from the user interface itself, so it might be helpful to write all of that output to a single text file. Note that when everything is being written to a textfile, it won’t be printing to the command-line at all.

C:\InVEST_3.8.0.post248+gf51689d3\invest-3-x86\invest.exe --debug run ndr > logfile.txt

Then, once the application crashes, it would be really helpful if you could upload logfile.txt to the thread here so we can take a look.

Thanks for your help debugging this!
James

Hi James,

Thanks for your reply. As I was short of time, I tried downloading the latest version of InVEST (3.8.2) from the website instead.This is working well, with no crashing and I don’t have the problem with the null values in the NDR output. I probably won’t have time for a while, but if I do, I’ll try and send you the log from the development version to help you figure out what was causing the crashes.

Best wishes,
Katrina

Ok great! I’m glad to hear it isn’t crashing and that there aren’t any null values in the outputs. Definitely let us know if it starts crashing again.