Coastal Vulnerability KeyError: 'Illegal field requested in GetField()'

Hello everyone,
I am trying to execute the Coastal Vulnerability Model , but I face the following error which is inside the log file,
InVEST-Coastal-Vulnerability-log-2021-12-13–10_47_06.txt (3.5 MB).

Could someone please explain me what kind of error is it and how it can be solved?
Thanks,
Petros

Hi @pante003,

The error on line 30566 of your log file (ERROR Something went wrong when adding task calculate wind exposure (4)) indicates that there may be an issue with the WW3 input layer. Does the model run successfully when you input the .shp version of that layer, rather than the .dbf?

-Jesse

1 Like

Hi @jesseG . I tried to run it , replacing the dbf with the shp file, but I get the same error I think.
InVEST-Coastal-Vulnerability-log-2021-12-14–09_55_10.txt (5.6 KB)

Hi @pante003,

Yes, this does appear to be the same error (but interestingly the log file shows that the model failed much more quickly this time (after <2 seconds instead of >46 minutes!).

I still believe the problem is coming from the WW3 vector, but we need to examine your input data in order to diagnose this further. How large are those WW3 files in total? Are you able to post them to a cloud somewhere and share them with me at jgldstn@stanford.edu?

Thanks,
Jesse

2 Likes

Hi @jesseG
please I cannot upload them because a receive a message that these file formats are not supported. My e mail address is : petros.panteleon@wur.nl. I just sent you an email.
Kind Regards,
Petros Panteleon

Hi @pante003,

Thanks for emailing me your wind and wave vector input. Did you obtain these data from WAVEWATCH III? The attribute table does not contain the proper columns and corresponding values. Please reference the User Guide section on “Wind and Wave data”. There you’ll see that this vector’s attribute table needs to have at least 80 columns, with each named exactly as described.

I recommend downloading the sample data for this model if you do not have those already. You can find sample data for all InVEST models on the NatCap website, here. Within that, there’s a vector named “WaveWatchIII_global.shp”. Notice all the columns and corresponding values in that attribute table. They are named exactly as specified in the User Guide, which is required for the model to run successfully. I suggest that you clip that global layer to your spatial extent for the island of Bonaire and use that as an input instead of the “wind_data” vector you shared.

Please let us know if this approach works for you,
Jesse

3 Likes

Even use the global layer as-is and let the model clip it for you :slight_smile:

3 Likes

Hi @dave and @jesseG , I did it with the sample data and it started working , but the “problem” now is that is running for more than 3 hours. Is it normal? It actually works for more that 1 hour for a specific task: “(natcap.invest.coastal_vulnerability) coastal_vulnerability.calculate_surge_exposure(1522) INFO Calculating surge potential”

Kind Regards,
Petros

Hi @pante003,

We’re glad to hear that the model at least started to run with the WW3 input replacement. Did the model ever complete successfully?

It is not unheard of for InVEST to run for multiple hours, but it is often not ideal either. For Coastal Vulnerability, it mostly depends on the processing speed on your machine and on the model resolution (given in meters) that you enter. Finer resolutions (smaller values) will create more shore points but will also take longer to compute. It looks like you chose 60m. That sounds like a rather fine resolution to me, even for a small island. I recommend increasing the resolution substantially, to say 1,000m, and testing the model with that. If that runs quickly and successfully, you can iterate, gradually reducing the resolution so that you obtain finer results, albeit slower runs.

If you’re still having issues, please upload the latest log file with the new WW3 input. Also, please note that I and our whole team will be away on Holiday break (and likely unresponsive) from December 18th, 2021 through January 2nd, 2022. We still encourage you to post though as other members of the community may be able to help and learn from you.

Thanks,
Jesse

3 Likes

Hi @jesseG , the last try that I mentioned in the previous comment was about 4 and 1/2 hours and never got something , so I shut it down(16 december 2021).

Earlier I tried it with the sample data and the new resolution that you mentioned, and it is running already for 2 hours and for the last 1 and 1/2 is remaining at this point :
“(natcap.invest.coastal_vulnerability) coastal_vulnerability.calculate_surge_exposure(1522) INFO Calculating surge potential”.
I do not know if it is expected or not but I will wait to see if something happens until I leave the office(curious to see if it finally produces something).
I use some files form my external hard drive and some other are computer located files? Could this affect the procedure time or you think is not an issue?

Hi @pante003 ,

The external drive file location could slow things down if it’s connected to your local machine via a USB port. USB 1, 2, and 3 ports have dramatically different data transfer speeds, as explained here.

-Jesse

1 Like

In addition, external platter-based drives (particularly those that are powered over USB) typically have significantly slower read/write speeds because they need to consume less power than a drive with an external power source. Thus, external hard disk drives are good for one-time backups of data, but not so good for random read/writes like what InVEST needs to do all the time.

In general, I’d suggest avoiding external hard disk drives if you can for your spatial data, but if your InVEST workspace is on your computer’s internal hard disk drive, the runtime should be reasonably fast.

James

1 Like