Error csv files in UFRM model

Dear InVEST Team

I am currently working with the UFRM model, but when running the model, this error appears in the logfile: TypeError: int() argument must be a string, a bytes-like object or a real number, not ‘NoneType’ it seems to be that this error is located in the damage table csv file

I ran the model with the damage table files like: CSV hyphen separated, CSV UTF 8 hyphen separated and also CSV MS DOS but it did not work with none of them; I debugged the files also looked for empty values or cells using pandas, GDAL, OSGeoshell4W, but it seems that the csv file is ok.

Then, maybe the error could be found in other input for the model.

I would like to ask you kindly if could you review the attached files: logfile and input_folder_2025 and you could tell me where ist he error and how could it be fixed, that would be great. The damage table is included in the attached folder.

Thanks so much and have a nice day

Best,

Diego

InVEST-natcap.invest.urban_flood_risk_mitigation-log-2025-03-27–09_45_47.txt (2.6 KB)

Input_folder_2025

Hi @Diego_Guarin -

Thanks for posting the log file and data, I’ve asked for access to the Gfolder. Meanwhile, have you tried saving your CSV with comma separators instead of hyphens? See if that helps.

~ Stacie

Hi Stacie,

Yes also with commas but the error still appears, oh and I forgot to comment that I am using InVEST version 3.13.0, because it has worked well before in other models, but I do not know if that also has to do with the problem.

Best,

Diego

Hi Diego -

It looks like the error you’re posting about is caused by some of your built infrastructure polygons not having a value for the “type” field. When I set these blank values to “1”, this error went away.

But, then I got a different error, shown in this log file:
InVEST-natcap.invest.urban_flood_risk_mitigation-log-2025-04-02–07_22_20.txt (13.6 KB)

04/02/2025 07:29:34  taskgraph.Task     ERROR    Something went wrong when adding task reproject built infrastructure to target SRS (11), terminating taskgraph...
"File "pygeoprocessing\geoprocessing.py", line 2279, in reproject_vector
  File "osgeo\ogr.py", line 3239, in SetField
RuntimeError: not a string or os.PathLike"

I thought it might be because one of the fields in the built infrastructure shapefile began with “@”, or other field values have characters that might be causing the problem. So I deleted those fields, but none of that has helped. I’ve asked the software team to help, and we’ll report back here.

~ Stacie

Hi Diego,

Following on from Stacie’s reply, it seems the additional error ( RuntimeError: not a string or os.PathLike) is being caused by non-UTF-8 characters in values within the built_infrastructure_vector_path shapefile. We have an open issue to address this in Pygeoprocessing, but in the meantime you can work around the error by manually editing those values to remove non-UTF-8 characters.

I’ve attached an edited version of the vector that does run, as an example, but please note that values have been edited by both Stacie and myself. You may want to make your own edits to your original vector to ensure all changes make sense.

built_infrastructure_vector_path_vector.zip (1.0 MB)

Dear Stacie

Thanks for keeping me updated and for all your help.

Dear Megan.

Thank you very much for reviewing and editing the data. I will check what you sent me and let you know if it works. Thanks so much and have a nice day.

Dear Stacie and Megan

Thanks so much, now the model is working, thanks so much for your review :slight_smile:

Best,

Diego