There is an error with the NDR section_UnicodeEncodeError

Hello everyone, I ran into a problem in the process of running the model.


It said"UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 18-21: ordinal not in range(128)".I don’t really understand the problem. I hope you can help me~
More information is as follows:
Initializing…
Showing messages with level INFO and higher
2019-12-27 14:13:15,679 utils.prepare_workspace(109) INFO Writing log messages to /Users/vv/Documents/ndr_workspace/InVEST-Nutrient-Delivery-Ratio-Model-(NDR)-log-2019-12-27–14_13_15.txt
2019-12-27 14:13:15,680 model._logged_target(1633) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.ndr.ndr 3.7.0:
biophysical_table_path /Users/vv/Desktop/data/biophysical.csv
calc_n True
calc_p True
dem_path /Users/vv/Desktop/土壤保持/50/dem1_ProjectRaster1.tif
k_param 2
lulc_path /Users/vv/Desktop/土壤保持/50/uongdi.tif
n_workers -1
results_suffix
runoff_proxy_path /Users/vv/Desktop/土壤保持/50/降雨_ProjectRaster2.tif
subsurface_critical_length_n 200
subsurface_critical_length_p 200
subsurface_eff_n 80
subsurface_eff_p 80
threshold_flow_accumulation 10000
watersheds_path /Users/vv/Desktop/土壤保持/50/Export_Output.shp
workspace_dir /Users/vv/Documents/ndr_workspace

2019-12-27 14:13:15,906 geoprocessing.align_and_resize_raster_stack(782) ERROR Exception occurred in worker
Traceback (most recent call last):
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/pygeoprocessing/geoprocessing.py”, line 776, in align_and_resize_raster_stack
File “/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py”, line 572, in get
UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 18-21: ordinal not in range(128)
2019-12-27 14:13:15,908 Task.add_task(636) ERROR Something went wrong when adding task align rasters (1), terminating taskgraph.
Traceback (most recent call last):
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/taskgraph/Task.py”, line 602, in add_task
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/taskgraph/Task.py”, line 1068, in _call
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/pygeoprocessing/geoprocessing.py”, line 776, in align_and_resize_raster_stack
File “/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py”, line 572, in get
UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 18-21: ordinal not in range(128)
2019-12-27 14:13:15,909 model._logged_target(1639) ERROR Exception while executing <function execute at 0x119f728c0>
Traceback (most recent call last):
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/natcap/invest/ui/model.py”, line 1636, in _logged_target
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/natcap/invest/ndr/ndr.py”, line 238, in execute
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/taskgraph/Task.py”, line 602, in add_task
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/taskgraph/Task.py”, line 1068, in _call
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/pygeoprocessing/geoprocessing.py”, line 776, in align_and_resize_raster_stack
File “/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py”, line 572, in get
UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 18-21: ordinal not in range(128)
2019-12-27 14:13:15,909 model._logged_target(1642) INFO Execution finished
2019-12-27 14:13:15,911 utils.prepare_workspace(115) INFO Elapsed time: 0.23s
2019-12-27 14:13:15,912 execution.run(78) ERROR Target <function _logged_target at 0x119eafaa0> failed with exception
Traceback (most recent call last):
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/natcap/invest/ui/execution.py”, line 68, in run
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/natcap/invest/ui/model.py”, line 1636, in _logged_target
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/natcap/invest/ndr/ndr.py”, line 238, in execute
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/taskgraph/Task.py”, line 602, in add_task
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/taskgraph/Task.py”, line 1068, in _call
File “/Users/jenkins/workspace/natcap/invest/env/lib/python2.7/site-packages/pygeoprocessing/geoprocessing.py”, line 776, in align_and_resize_raster_stack
File “/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py”, line 572, in get
UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 18-21: ordinal not in range(128)
2019-12-27 14:13:15,912 execution.run(83) INFO Execution finished
2019-12-27 14:13:49,375 usage._log_exit_status(225) WARNING an exception encountered when _log_exit_status <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)>
2019-12-27 14:13:49,415 usage._log_model(275) WARNING an exception encountered when logging URLError(SSLError(1, u’[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)’),)

Hi @VVyixiao -

Thanks for posting the log file, that’s helpful. Since the error says “can’t encode characters”, I wonder if it is having trouble with the non-ASCII characters in the input file paths, like
/Users/vv/Desktop/土壤保持/50/dem1_ProjectRaster1.tif.

Try changing this path to something like
/Users/vv/Desktop/NDR_input/50/dem1_ProjectRaster1.tif

and see if that helps.

~ Stacie

Hi@swolny
Thank you for your help. I’ve tried again as you said. Nothing has changed. But I installed a different version of the software. The software prompts me to run successfully, but I have some problems loading the successful data. I hope you can help me to see the reports generated by the software. Thank you.
InVEST-Nutrient-Delivery-Ratio-Model-(NDR)-log-2019-12-28–11_26_51.txt (30.8 KB)
image
Vivian

Hi Vivian -

Check the stream.tif raster that is part of the model output, and see if it has streams defined. Sometimes, if the area is very flat, and/or the threshold flow accumulation value is too large, streams will not be defined. Since the model works by moving nutrient downslope until it reaches a stream, if streams are not defined, export also won’t be defined. Is the case in your watershed?

If this is not the problem, then you can send me your inputs and I’ll take a look at them: swolny@stanford.edu.

~ Stacie

Hi swolny
Thank you. I’ll check my data. Then run it again.

~vivian