How to explain the results of NDR model?

Hello everyone,

I would like to know how can I explain the results of NDR? The results include n_export, but how can I get n_retention?
We can use NR model in InVEST 3.2.0 to get it. But when I try to run 3.2.0 version, an error occurs:

Initializing…
05/05/2021 10:09:21 root DEBUG PATH: [‘C:\InVEST_3_2_0_x86\invest-3-x86\.’]
05/05/2021 10:09:21 root DEBUG Loading nutrient from PATH
Arguments:
accum_threshold 10000
biophysical_table_uri C:/Users/Liuya/Desktop/nrdata/biophysical_table_self.csv
calc_n True
calc_p True
dem_uri C:/Users/Liuya/Desktop/nrdata/demfilled.tif
depth_to_root_rest_layer_uri C:/Users/Liuya/Desktop/nrdata/soildepth.tif
eto_uri C:/Users/Liuya/Desktop/nrdata/etoiii.tif
lulc_uri C:/Users/Liuya/Desktop/nrdata/lu_wateryield.tif
pawc_uri C:/Users/Liuya/Desktop/nrdata/pawc11.tif
precipitation_uri C:/Users/Liuya/Desktop/nrdata/pi.tif
seasonality_constant 7.5
valuation_enabled False
water_purification_threshold_table_uri C:/Users/Liuya/Desktop/nrdata/wptt.csv
watersheds_uri C:/Users/Liuya/Desktop/nrdata/ws_clip.shp
workspace_dir C:\InVEST_3_2_0_x86\Nutrient_Retention

05/05/2021 10:09:21 root INFO Logging will be saved to nutrient-log-2021-05-05–10_09_21.txt
05/05/2021 10:09:21 root DEBUG Loaded the model from invest_natcap.nutrient.nutrient
05/05/2021 10:09:21 root INFO Executing the loaded model
05/05/2021 10:09:21 root INFO Running InVEST version “3.2.0”
05/05/2021 10:09:21 root INFO Python architecture: (‘32bit’, ‘WindowsPE’)
05/05/2021 10:09:21 root INFO Disk space remaining for workspace: 21.74 GB
an exception encountered when logging
05/05/2021 10:09:21 root INFO Pointing temporary directory at the workspace at C:\InVEST_3_2_0_x86\Nutrient_Retention
05/05/2021 10:09:21 root INFO Updating os.environ[“TMP”]=C:\InVEST_3_2_0_x86\Nutrient_Retention\tmp to C:\InVEST_3_2_0_x86\Nutrient_Retention
05/05/2021 10:09:21 root INFO Updating os.environ[“TEMP”]=C:\InVEST_3_2_0_x86\Nutrient_Retention\tmp to C:\InVEST_3_2_0_x86\Nutrient_Retention
05/05/2021 10:09:21 root INFO Updating os.environ[“TMPDIR”]=C:\InVEST_3_2_0_x86\Nutrient_Retention\tmp to C:\InVEST_3_2_0_x86\Nutrient_Retention
05/05/2021 10:09:21 root INFO Setting tempfile.tempdir to C:\InVEST_3_2_0_x86\Nutrient_Retention\tmp
05/05/2021 10:09:21 root INFO Starting nutrient
05/05/2021 10:09:21 invest_natcap.hydropower.hydropower_water_yield INFO Starting Water Yield Core Calculations
05/05/2021 10:09:28 pygeoprocessing.geoprocessing INFO align_dataset_list aligning dataset 2 of 5
05/05/2021 10:09:37 pygeoprocessing.geoprocessing INFO align_dataset_list aligning dataset 4 of 5
05/05/2021 10:09:51 root ERROR ---------------------------------------------------
05/05/2021 10:09:51 root ERROR ---------------------- ERROR ----------------------
05/05/2021 10:09:51 root ERROR ---------------------------------------------------
05/05/2021 10:09:51 root ERROR Error: exception found while running nutrient
05/05/2021 10:09:51 root DEBUG
05/05/2021 10:09:51 root DEBUG Build details
05/05/2021 10:09:51 root DEBUG Interpreter
05/05/2021 10:09:51 root DEBUG Current temp dir: C:\InVEST_3_2_0_x86\Nutrient_Retention\tmp
05/05/2021 10:09:51 root DEBUG tempfile.tempdir: C:\InVEST_3_2_0_x86\Nutrient_Retention\tmp
05/05/2021 10:09:51 root DEBUG
05/05/2021 10:09:51 root DEBUG System
05/05/2021 10:09:51 root DEBUG OS : Windows-8-6.2.9200
05/05/2021 10:09:51 root DEBUG Processor architecture: AMD64
05/05/2021 10:09:51 root DEBUG FS encoding : mbcs
05/05/2021 10:09:51 root DEBUG Preferred encoding: cp936
05/05/2021 10:09:51 root DEBUG
05/05/2021 10:09:51 root DEBUG Python
05/05/2021 10:09:51 root DEBUG Version : 2.7.9
05/05/2021 10:09:51 root DEBUG Build : (‘default’, ‘Dec 10 2014 12:24:55’)
05/05/2021 10:09:51 root DEBUG Compiler : MSC v.1500 32 bit (Intel)
05/05/2021 10:09:51 root DEBUG Implementation : CPython
05/05/2021 10:09:51 root DEBUG Architecture : 32bit
05/05/2021 10:09:51 root DEBUG Linkage format : WindowsPE
05/05/2021 10:09:51 root DEBUG
05/05/2021 10:09:51 root DEBUG Packages
05/05/2021 10:09:51 root DEBUG Cython : ?
05/05/2021 10:09:51 root DEBUG Numpy : 1.8.1
05/05/2021 10:09:51 root DEBUG Scipy : 0.15.1
05/05/2021 10:09:51 root DEBUG OSGEO : 1.10.1
05/05/2021 10:09:51 root DEBUG Shapely : 1.5.5
05/05/2021 10:09:51 root DEBUG InVEST : 3.2.0
05/05/2021 10:09:51 root DEBUG
05/05/2021 10:09:51 root DEBUG
05/05/2021 10:09:51 root DEBUG Exception not environment-related
05/05/2021 10:09:51 root DEBUG Printing traceback
Traceback (most recent call last):
File “invest_natcap\iui\executor.pyc”, line 555, in runModel
File “invest_natcap\nutrient\nutrient.pyc”, line 193, in execute
File “invest_natcap\hydropower\hydropower_water_yield.pyc”, line 131, in execute
KeyError: ‘LULC_veg’
None

05/05/2021 10:09:51 root ERROR Exiting due to failures

Thanks
Leo

Hi @asuleo -

Unfortunately, the NDR model does not really include a measure of retention on each pixel. We usually evaluate retention based on comparing the current conditions with a scenario of land use/land cover and/or management change. The difference in export between current and scenario provides an estimate of the amount of nutrient retained.

Thanks for posting your log file, but I’m very confused by it. Some of the entries seem to be related to NDR (like calc_n and calc_p), but others are related to the Annual Water Yield model (like pawc and seasonality constant, along with the final KeyError message). Please try attaching the actual .txt log file that is created in your Workspace, which should only have information for one model run.

~ Stacie

And also @asuleo , from your logfile, it looks like you’re running the old Water Quality model in InVEST 3.2.0, which is very different from the NDR model available in the current version of InVEST. Unless you have a strict requirement to use InVEST 3.2.0, I would strongly recommend downloading the latest version of InVEST (here’s the download page) and using the NDR model instead.

James

PS @swolny if memory serves, I think the old Water Quality/Nutrient model used to actually call portions of the Annual Water Yield model during its execution, which may explain the overlap of inputs. Does that match your memory?

Hi @swolny and @jdouglass
Thanks for your quick response. Yes, the error happened when I run the Nutrient Retention model in InVEST 3.2.0. I use the model because I really want to get the N_retention value on each pixel. As you said, NDR model can not offer the result.

Could you give me some suggestions about the error? I used the same data and run Water Yield and NDR model in InVEST 3.9.0 successfully, but failed in Nutrient Retention in InVEST 3.2.0.

Attached please find my log file.
nutrient-log-2021-05-05–22_08_48.txt (10.2 KB)

Thank you!

Oh! yes, if it’s nutrient version 3.2.0, that would explain a lot, thanks @jdouglass.

@asuleo, it’s hard for me to support using the 3.2.0 version of Nutrient, since we updated it based on coming up with methods that our scientists feel are much improved, and we have a higher degree of confidence in, despite not providing retention. And since it’s so old, we can’t really support it.

The one thing I will say about the error in the log file is that the model is requiring the field “LULC_veg” to be in your biophysical table, but cannot find it. If it is not there, add that field and try again. If you keep having the problem, I recommend searching this forum for other “KeyError” issues, and see if any of the advice helps, since many of the suggestions for troubleshooting will be applicable.

~ Stacie

1 Like

Thank you @swolny. The point is I used “lulc_veg” in the biophysical table. I have read the newest guide version, and run the NDR model. I understand the reasons that you recomended the NDR model. But we would like to get retention values on each pixel when we integrate the result with spatial planning.

Thank you again!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.