Negative Values in n_export for NDR model?

What would cause the NDR model to have negative values? I’m using a 0.1 for subsurface % and length of 50.

For this particular application I’m looking to estimate N export from our upland areas - it’s the coastal areas that have no N load that are showing negative values. Does this mean that they are retaining the upland N?

Sorry, I couldn’t find this question in the database.


Hi @kfalinski,

That is kind of strange. Looking at the equations for export_i, I would think it would always be positive:
export_i = load_i x NDR_i
export_i = load_i x (1-eff'_i) x (1 + exp((IC_i - IC_0) / k))^-1

load_i should always be > 0, (1-eff'_i) should be in the range [0, 1], and exp(x) is always > 0. So I’m not sure where the negative values are coming in. Maybe @jdouglass or @swolny can confirm if this makes sense or not?

1 Like

@kfalinski, could you give some examples of the negative values you’re seeing? A common example of this is that pixel values can be numerically close to 0 (within about 1e-5) but negative. If the negative values are outside of that tolerance, there might be a deeper issue here.

Let us know!

WE have a similar problem. Our InVEST models outputs, in particular the SDR model sed_export output, seem OK….but when a Land-use raster scenario is applied, and a new SDR model run done….

The ‘’change’’ raster (scenario – baseline rasters) sed_export raster contains a large number of negative very small numbers. The same to a lesser problem with our NDR model runs too.

I have not been able to find the source of this issue. The input LULC rasters seem OK, the biophysical table seems OK, projection and raster alignment seem OK,output intermediate churn aligned_LUC differences between scenario and baseline seem OK. After some discussion with a few people knowledgeable of the InVEST models I have not found a cause of this nor a solution.

Any suggestions ? Thanks.

Gordon in NB

User: BVIB

Hi @BVIB , thanks for posting. How small are the “very small numbers”? Can you post some example values? As James mentioned above, if they are exceedingly small, it might just come down to the limits of numerical precision. If you interpret all those values as zeros, would that make sense in the context of your scenarios?

That’s my quick take, I can take a closer look tomorrow if that explanation doesn’t seem reasonable.


our SDR change raster (scenario minus baseline) negative numbers are larger and possibly non-zero…. They are distributed about -0.04 to -0.009 mostly with a min of about -2.8?

a bit more info…THANKS !!

Potato scenario added crop area = yellow
Other areas remaining after negative values removed from SDR sed-exp change raster = black

Hi @BVIB, thanks for following up. I think I’ll probably need your input data for both scenarios to reproduce this. Would you be willing to share a gdrive/dropbox, etc? Please be sure to include a logfile from your runs. You may share it in a private message if you’d rather not post it here. Sharing the output data would be great too, especially if there are very long runtimes.

As a reality check - negative values would make sense if more sediment was exported in the baseline than in the scenario. And since the scenario adds crop area (presumably replacing some other higher retention landuse) you are expecting more sediment export in the scenario than in the baseline?

Also, can you confirm you’re running invest version 3.9.0? Thanks!

Hi Dave

Thanks for the response. We are using a 1-metre XY resolution (LiDAR-based) DEM for a 265 sq km watershed AOI. Consequently our raster input and model output files are rather sizeable files. A set of the baseline & scenario SDR input & output files would be about 225 GB in total. I could put that on my MS OneDrive and share it (assuming my ISP lets my 225 GB upload, they have so far!). Upload time from home where I am would be several hours. If 225 GB via MS OneDrive is workable for you, let me know and I will start uploading our files to my MS OneDrive. I should probably share the link to my personal MS One Drive in some kind of a private message for security of my One Drive yes.

I have been using using InVEST 3.9 now for a couple of months, although some earlier runs were done in 3.6 & 3.7 . Yes, exactly that, our scenario adds crop area (replacing some other higher retention landuse) and we would expect more sediment export in the scenario than in the baseline.

Thanks. Your assistance is appreciated.

Gordon in NB
user: BVIB

Well that is a very large datastack, too large for me to commit to working with it right now. If you wanted to try to make a much, much, smaller reproducible example with a small portion of your data, I could explore that.

But first maybe it makes sense for me to solicit more feedback from some other experts, to see if anyone has encountered this situation before. I’ll get back to you.

Hi Gordon -

Did anything else change about the land cover, or just an increase in crop land? And did the crop land only replace lower-eroding land cover types (like forest), or were there places where it replaced higher-eroding land cover types (like bare ground)?

~ Stacie

I can answer here (don’t want to muddy the conversation too much, but I can at least address this one!) - affirming the only change is an increase in crop land, and there are no pixels where crops replaced higher-eroding land use types. I’ve suggested Gordon triple-check all of the aligned inputs (in “churn_dir_not_for_humans”) between the scenario and baseline to make sure the model sees no differences between the scenarios other than what was intended, i.e., an increase in cropland.

thanks Dave. Appreciate the help. I will prepare small clips of our SDR model input & output data sets, possibly one sub-watershed area. I will upload them when I have the clips prepared. Possibly by end-of-day tomorrow.

Hi Dave

attached is a DropBox link to a zip file (6 GB) I am uploading containing a much smaller 19 sq km clip of our 265 sq km watershed, with the matching clipped input and resulting output files and logs of the baseline and crop scenario runs of that clipped data in the SDR model. Would greatly appreciate your input on our problem.

Thanks, Appreciated.

Gordon in NB
user: BVIB

Thanks, @BVIB , I’ll gladly take a look. FYI I’m still getting a “File is uploading” message when I click the link. Is it still uploading on your end?

upload to Drop Box was locally here very slow this morning…much slower than our local ISP highspeed which was working well. The file set shows as having completed upload to Drop Box at my end as of about 3 hours ago now. (about 11:00 am EST)


Gordon in NB
user: BVIB

Hi again Dave

please note that: in the outputs of the SDR model run that I sent, based only on a small clip of the watershed, the output ‘‘stream.tif’’ are discontinuous in places. However, when we run the InVEST models using data for all of the 265 sq km area of the watershed hydrological unit…then the ‘‘stream,tif’’ output gives continuous streamlines in the whole watershed


Thanks, Gordon. Data received! I’ll post back when I can.

Hi @BVIB , thanks for making that small sample datastack. I re-created your “scenario minus baseline” sediment export raster and here’s what I found:

Negative values (more export in baseline) are in purple and positive values in orange. Nodata pixels are white. I noticed all the purple areas are downstream of nodata holes. And those nodata holes seem to also appear in the LULC_Potatoes dataset, but they are not nodata in the baseline LULC_ESA data.

Do you think it makes sense to fill those LULC nodata holes and then re-evaluate?

1 Like

Thanks Dave. We will try that certainly ! Appreciate the feedback.

I will get our project cooperator who is doing the LULCs to take a look at this ASAP. I will let you know how we made out once he is done and we have tried the SDR model runs again with that nodata changes you have suggested made.

Thanks !

Gordon (for a project in NB)
user: BVIB

1 Like