Urban Stormwater Retention Model error

I’ve do “Raster Calculator” with all of my data, trying to fix the “no-data” in ArcGIS. But it still can’t work, and output the error of raster_calculator. That’s the reason I’d like to ask if there is anyone stuck in the same question? Could this error be related to the wrong way of filling in the biophysical tables?
InVEST-natcap.invest.stormwater-log-2023-01-05–02_13_03.txt (14.3 KB)
background.csv (1.6 KB)

Hi @JENN -

These error message sure are confusing, but I’m seeing a couple of things. First, the initial ERROR is “ERROR [errno 1] Deleting C:\invest\plantest\retention_ratio.tif failed:Permission denied”. Are you trying to write over a previous run of InVEST? You should be able to do that, but if one of those files (like retention_ratio.tif) is open in a GIS or some other app, then you’ll get an error like this. So first, I’d figure out why the Permission denied error is happening, that might be the source of the problem.

The other thing that looks odd to me is the “lulc_path” value
“C:\Users\jenni\Desktop\0104\lu_2016_2.tif”. It looks like the LULC TIFF file is missing a file name (as in, a string before “.tif”, like “lulc.tif”. I’d think that the user interface would catch any problems with this input file before running, but you might look at that as well.

~ Stacie

1 Like

Thank you so much for replying. It’s amazing to learn that these storage formats can cause errors. After trying to fix it, I found that the “ERROR [errno 1] Deleting C:\invest\plantest\retention_ratio.tif failed:Permission denied” had disappeared. But about the error of “raster_calculator” is still there.
So if it is convenient, the new output is attached below. Do you know if there is any other part of this output that could be improved?
(‘utf-8’ code may be a problem with my computer version)

2023-01-05 11:03:53,479 (pygeoprocessing.geoprocessing) geoprocessing.align_and_resize_raster_stack(824) INFO 1 of 3 aligned: lulc_aligned_try.tif
2023-01-05 11:03:53,509 (pygeoprocessing.geoprocessing) geoprocessing.align_and_resize_raster_stack(824) INFO 2 of 3 aligned: soil_group_aligned_try.tif
2023-01-05 11:03:53,528 (pygeoprocessing.geoprocessing) geoprocessing.align_and_resize_raster_stack(824) INFO 3 of 3 aligned: precipitation_aligned_try.tif
2023-01-05 11:03:53,528 (pygeoprocessing.geoprocessing) geoprocessing.align_and_resize_raster_stack(828) INFO aligned all 3 rasters.
2023-01-05 11:03:54,149 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(396) INFO starting stats_worker
2023-01-05 11:03:54,149 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(402) INFO started stats_worker <Thread(Thread-1 (stats_worker), started daemon 10820)>
2023-01-05 11:03:54,207 (pygeoprocessing.geoprocessing) geoprocessing.raster_calculator(498) ERROR exception encountered in raster_calculator
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xa7 in position 79: invalid start byte
InVEST-natcap.invest.stormwater-log-2023-01-05–11_03_50.txt (14.8 KB)

Thanks again for your help!


I’m not sure what the model is trying to calculate when getting this error, but one thing I see in the background.csv table that you posted is that the lucode values all have a space after them. This can be seen looking at the CSV in a text editor:


Again, I don’t know if this is causing the UnicodeDecodeErrors or not, but I would try removing the blank space after each lucode value and see if it helps.

If this doesn’t help, I’ll need to look at your spatial data. So please send me all of your model run inputs and I’ll try to run the model myself and debug it. If they’re small you can share them here, if they’re larger you can share them through any cloud storage method. And if you’d rather not post the link here, you can send it to swolny@stanford.edu.

~ Stacie


Thank you so much for your reply. I’ll have a try.