Error running Wave Energy with Global analysis area

Hi,

I’m trying to run the Wave Energy 3.0 beta model from InVEST 3.7.0, and am having trouble when I set Analysis Area to “Global.” The analysis works fine if I set Analysis Area to “East Coast of North America and Puerto Rico,” but doing so crops out the northern part of the study area I’m interested in.

I specifically get the error, “IndexError: index 4 is out of bounds for axis 0 with size 4”. Digging into the log file, things seem to start going wrong here:

2019-09-11 15:11:56,445 wave_energy.execute(374) INFO Adding DEPTH_M field to the wave shapefile from the DEM
2019-09-11 15:11:56,685 Task.add_task(636) ERROR Something went wrong when adding task index_depth_to_wave_vector (2), terminating taskgraph.

I assume this has something to do with the global wave data? I’m using the wave data as downloaded from data.naturalcapitalproject.org/invest-data/3.6.0/WaveEnergy.zip, and the DEM is from 3.6.0/Marine.zip.

I’ve attached the log file and can upload other files if that would be helpful. I’m running on a MacBook Pro 13" 2017 with macOS 10.14.6.

I appreciate any thoughts on debugging this!

InVEST-Wave-Energy-log-2019-09-11–15_26_23.txt (6.2 KB)

Hi @malinpinsky, thanks for including your logfile! The part of the model that’s crashing is determining the index of an array to pick out based on the coordinates of the wave points being analyzed. What isn’t immediately clear if why this is happening. It looks like the inputs you’re using are almost all from the sample data … could you attach your AOI so we can try to reproduce this on our end?

Thanks,
James

Thanks so much for looking into this. This is a large-scale analysis for the North American East Coast, and I’ve attached my AOI as a zipped shapefile. Let me know if you need anything else.

AOI_east.zip (98.6 KB)

Hmm … I don’t see anything obviously wrong here, except that the model is clearly indexing with an off-by-one index in one of the dimensions. I still need to dig into why this is. More soon!

James

Hi @malinpinsky, sorry about the delay and thanks for your patience! This error really turned out to be interesting! It ended up being an edge case on how the model was doing some spatial indexing of the underlying wave data points that was leading to 1) an incorrect index that caused this error and 2) the model to double-count some of the wave data points. Neither of these are good things.

This development build should address the issue for you … could you try it out and make sure that it does? Here’s the download link: https://storage.googleapis.com/natcap-dev-build-artifacts/invest/jdouglass/3.7.0.post378+hd9612c04a8dc/InVEST_3.7.0.post378+hd9612c04a8dc_x86_Setup.exe

Assuming this works for you (and please let me know either way), this change will be included in the next release of InVEST.

James

Hi @jdouglass,

Thanks so much for looking into this and finding a solution. Amazing!

I’m running on a Mac and don’t have easy access to a PC. Any chance you could post a build for macOS? If that’s hard, though, I’ll look around on my end.

Regards,
Malin

Sure, @malinpinsky, here’s a mac build of the same revision: https://storage.googleapis.com/natcap-dev-build-artifacts/invest/jdouglass/3.7.0.post212%2Bhd9612c04a8dc/InVEST-3.7.0.post212%2Bhd9612c04a8dc-mac.zip

Fantastic. The InVEST Launcher opens fine, but I get this error at the Terminal when I click Wave Energy Production:

Traceback (most recent call last):
File “/Users/jenkins/workspace/jdouglass/invest/src/natcap/invest/cli.py”, line 550, in
File “/Users/jenkins/workspace/jdouglass/invest/src/natcap/invest/cli.py”, line 504, in main
File “/private/var/folders/xm/cs4vtrc11vv61yb4pb3zkzpm0000gn/T/pip-install-oqA0Yh/PyInstaller/PyInstaller/loader/pyimod03_importers.py”, line 396, in load_module
File “/Users/jenkins/workspace/jdouglass/invest/env/lib/python2.7/site-packages/natcap/invest/ui/inputs.py”, line 21, in
ImportError: No module named PySide2
[42071] Failed to execute script cli

And the Wave Energy module doesn’t launch. I’ve tried other modules as well and got the same error.

Any ideas?

Thanks again for all the help.

Regards,
Malin

Ah, sorry about that! There’s a dependency missing from the build, which has been fixed. If you could re-download the build (https://storage.googleapis.com/natcap-dev-build-artifacts/invest/jdouglass/3.7.0.post212%2Bhd9612c04a8dc/InVEST-3.7.0.post212%2Bhd9612c04a8dc-mac.zip), I believe this should be fixed now.

And it works! Thanks so much for the fix and the update.

1 Like

Glad to hear it! Thanks for letting us know. We’ll include this in the next release of InVEST.