# "Casting rays and extracting bathymetry values" hangs

**URL:** <https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868>\
**Category:** Software Support\
**Tags:** coastal-vulnerability\
**Created:** [July 1, 2024, 9:14am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868 "2024-07-01T09:14:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 1, 2024, 9:14am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/1 "2024-07-01T09:14:17Z")

</div>

The model no longer continues to run while Casting rays and extracting bathymetry values. It was stuck from 2pm to 5pm and would not continue to run.  
[InVEST-Coastal-Vulnerability-log-2024-07-01–12\_40\_07.txt](https://community.naturalcapitalalliance.org/uploads/short-url/qDtlQ2apwIMLxIp6nnZBPBMc3O1.txt) (74.1 KB)

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 1, 2024, 8:40pm UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/2 "2024-07-01T20:40:51Z")

</div>

Hi @tzlhhu0116 , thank you for posting your logfile here.

I see two issues:

1. You are running invest version 3.12.1. The latest version is 3.14.2. There have been multiple bugfixes since 3.12.1 that relate to the fetch rays and bathymetry processing.
2. This message in the logfile is concerning:

> 2024-07-01 14:18:30,961 (natcap.invest.coastal\_vulnerability) coastal\_vulnerability.prepare\_landmass\_line\_index\_and\_interpolate\_shore\_points(837) INFO Finished creating 2 shore points in AOI

It indicates that only 2 points were created along the coastline in your AOI. I encourage you to look at some of the intermediate files in the output workspace to understand this better:

`intermediate/shore_points/shore_points.gpkg`  
`intermediate/shore_points/clipped_projected_landmass.gpkg`

My best guess is perhaps your AOI input or your landmass input has an incorrectly defined projection. I would examine all of your input data in GIS to determine this.

---

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 9, 2024, 1:14am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/3 "2024-07-09T01:14:30Z")

</div>

Casting rays and extracting bathymetry values ，Running for more than 12 hours without further calculations.  
[InVEST-natcap.invest.coastal\_vulnerability-log-2024-07-08–15\_28\_18.txt](https://community.naturalcapitalalliance.org/uploads/short-url/hPEt5322DJIxGwacAITrQchT7R.txt) (48.3 KB)

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 9, 2024, 12:50pm UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/4 "2024-07-09T12:50:06Z")

</div>

> [@tzlhhu0116](#):
>
> Casting rays and extracting bathymetry values ，Running for more than 12 hours without further calculations.

Hi @tzlhhu0116 , I moved your post to this existing topic because it seems like a continuation of the same problem.

Thank you for updating to the latest version of invest. I see from the log that the model is now creating 85 shore points instead of only 2. Is that what you would expect for your Area of Interest?

If you would like, you may share your input data with me and I can try to reproduce this issue. You may send me a direct message if you prefer not to share your data publicly.

---

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 10, 2024, 9:07am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/5 "2024-07-10T09:07:13Z")

</div>

Thank you for your reply, this run was a different attempt in a different area than the last. I will attach my input data and hopefully you can help me with the problem I am having, thanks again for your help!  
[to dave.zip](https://community.naturalcapitalalliance.org/uploads/short-url/jHY4UubgtCjxrm7X9FVRfTwnAv.zip) (1.7 MB)

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 10, 2024, 12:59pm UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/6 "2024-07-10T12:59:16Z")

</div>

Thank you @tzlhhu0116 . There are some files missing from the zip folder. Shapefiles are actually composed of several files with different extensions, not just the `.shp` files. For convenience, you could use the InVEST Workbench to package your data ([An easy way to share data using the InVEST Workbench](https://community.naturalcapitalalliance.org/t/an-easy-way-to-share-data-using-the-invest-workbench/3879))

---

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 11, 2024, 12:42am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/7 "2024-07-11T00:42:04Z")

</div>

Uploading: invest\_coastal\_vulnerability\_datastack.zip…  
I think this should be the package of files you need, since .tgz files can’t be uploaded to the dialog, I changed it to a .zip file, thanks for your patience!

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 11, 2024, 1:27am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/8 "2024-07-11T01:27:01Z")

</div>

Thanks again. I’m afraid the zip file did not finish uploading before you posted your message. I wish this site would prevent that from happening.

Another good option is to upload to a filesharing site (google drive, dropbox, etc) and then share a link to that.

---

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 11, 2024, 1:43am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/9 "2024-07-11T01:43:29Z")

</div>

[invest\_coastal\_vulnerability\_datastack.zip](https://community.naturalcapitalalliance.org/uploads/short-url/teUlbRqRTtyVRLfACKICRmS74hw.zip) (1.8 MB)  
Would you please try again?

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 11, 2024, 2:16pm UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/10 "2024-07-11T14:16:08Z")

</div>

Got it, thank you! There are a few issues to deal with.

First, the input data seem to have an incorrectly defined coordinate system. The system is defined as,

```auto
Name: EPSG:32619 - WGS 84 / UTM zone 19N
Units: meters

```

But the coordinates, such as the extent of the AOI, are,  
`109.6206202631684050,18.3593145628195771 : 111.6610080756678940,20.2212427998816224`

With units of meters, this makes the AOI only about 2 meters x 2 meters wide. Instead, these coordinates appear to be decimal degrees (longitude, latitude). So, if I redefine (not reproject) the coordinate system to a geographic system, such as `EPSG 4326, WGS84`, then the data appears to make sense.

You can verify these things by looking at your data in GIS and adding a reference map, such as data from [Natural Earth » 1:10m Cultural Vectors - Free vector and raster map data at 1:10m, 1:50m, and 1:110m scales](https://www.naturalearthdata.com/downloads/10m-cultural-vectors/)

Second, for this model, it is not a good idea to clip your input data to the boundary of the AOI. Please see the Area of Interest section of the User’s Guide for more details: [Coastal Vulnerability Model — InVEST® documentation](http://releases.naturalcapitalproject.org/invest-userguide/latest/en/coastal_vulnerability.html#data-needs)

In particular, it is almost always best to use this model’s sample data with global coverage for the WW3 layer and the continental shelf layer. The landmass and bathymetry layers also must extend well beyond the AOI in order to have accurate wind & wave results, based on the ray-casting function.

---

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 12, 2024, 1:07am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/11 "2024-07-12T01:07:06Z")

</div>

When I switched to the projected coordinate system of WGS\_1984\_UTM\_Zone\_19N, his coordinates changed directly to what you see here. However, in my previous attempts at a trial run without the presence of habitats, it was able to run successfully. What projection coordinate system would you suggest I change to that would be better?

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 12, 2024, 5:34pm UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/12 "2024-07-12T17:34:10Z")

</div>

> [@tzlhhu0116](#):
>
> What projection coordinate system would you suggest I change to that would be better?

I am suggesting that despite the fact that the coordinate system is currently listed as,

```auto
Name: EPSG:32619 - WGS 84 / UTM zone 19N
Units: meters

```

In actual fact the coordinates of these layers are decimal degrees, not meters:

`109.6206202631684050,18.3593145628195771 : 111.6610080756678940,20.2212427998816224`  
Aren’t these values the longitude and latitude of Hainan, China? But the assigned coordinate system is forcing all GIS software, including InVEST, to interpret these numbers as `meters` and placing your data in the wrong location on Earth.

> [@dave](#):
>
> So, if I redefine (not reproject) the coordinate system to a geographic system, such as **`EPSG 4326, WGS84`** then the data appears to make sense.
> 
> You can verify these things by looking at your data in GIS and adding a reference map, such as data from [Natural Earth » 1:10m Cultural Vectors - Free vector and raster map data at 1:10m, 1:50m, and 1:110m scales](https://www.naturalearthdata.com/downloads/10m-cultural-vectors/)

---

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 15, 2024, 8:06am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/13 "2024-07-15T08:06:40Z")

</div>

Dave, after your last pointer answer, I appear to have successfully solved the coordinate system problem, and the coordinates have now changed to the linear form below (37367552.538791 m 284741.281614 m). However, I have encountered a new error, could you please help me to see which part of the problem is occurring?

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 15, 2024, 5:22pm UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/14 "2024-07-15T17:22:14Z")

</div>

@tzlhhu0116 I’m glad you solved the coordinate system problem. Did you intend to upload a new logfile with the new error?

---

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 16, 2024, 2:20am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/15 "2024-07-16T02:20:01Z")

</div>

I’m sorry that I sent it to you before the upload was finished yesterday. Could you please help me check the problem? Thank you very much！  
[InVEST-natcap.invest.coastal\_vulnerability-log-2024-07-15–16\_01\_22.txt](https://community.naturalcapitalalliance.org/uploads/short-url/23gbXPixbnzi1phyNNvYiCpcI1I.txt) (4.9 KB)

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 16, 2024, 9:03pm UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/16 "2024-07-16T21:03:13Z")

</div>

Hi @tzlhhu0116 , this error sounds similar to the first one discussed over here: [Coastal Vulnerability Model (v3.7): invalid geometries and projections - #4 by dave](https://community.naturalcapitalalliance.org/t/coastal-vulnerability-model-v3-7-invalid-geometries-and-projections/129/4)

And I see you also are not using the WaveWatch3 dataset that comes with the model’s sample data. So the first thing I would try is to use the layer from the sample data directly unless you have a clear reason for using your own.

---

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 17, 2024, 1:57am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/17 "2024-07-17T01:57:45Z")

</div>

I just projected the WWIII file in the sample data and made a new attempt after extracting some data points according to the topic you posted, and it seems that I still encountered the same problem as before, but the shore points are normal!  
[InVEST-natcap.invest.coastal\_vulnerability-log-2024-07-17–08\_54\_26.txt](https://community.naturalcapitalalliance.org/uploads/short-url/eXn2HqdhsVJEQAqSQeTtp7N5U8N.txt) (4.6 KB)

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 17, 2024, 9:04pm UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/18 "2024-07-17T21:04:13Z")

</div>

> [@tzlhhu0116](#):
>
> I just projected the WWIII file in the sample data

Based on the other thread I linked, I think this is the problem. Projecting data from all over the globe into a local coordinate system can result in some strange or unexpected results.

Please try using the WWIII shapefile from the sample data without altering it.

---

<div class="post-metadata">

**Author:** ![tzlhhu0116](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tzlhhu0116](https://community.naturalcapitalalliance.org/u/tzlhhu0116)\
**Post date:** [July 18, 2024, 1:15am UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/19 "2024-07-18T01:15:02Z")

</div>

## Something went wrong when adding task calculate surge exposure (6), terminating taskgraph.Traceback (most recent call last): File “taskgraph\Task.py”, line 674, in add\_task File “taskgraph\Task.py”, line 1093, in \_call File “natcap\invest\coastal\_vulnerability.py”, line 2045, in calculate\_surge\_exposure AttributeError: ‘NoneType’ object has no attribute ‘Intersection’ 07/18/2024 09:12:32 natcap.invest.utils ERROR Exception while executing natcap.invest.coastal\_vulnerability Traceback (most recent call last): File “natcap\invest\utils.py”, line 165, in prepare\_workspace File “invest\cli.py”, line 470, in main File “natcap\invest\coastal\_vulnerability.py”, line 938, in execute File “taskgraph\Task.py”, line 674, in add\_task File “taskgraph\Task.py”, line 1093, in \_call File “natcap\invest\coastal\_vulnerability.py”, line 2045, in calculate\_surge\_exposure AttributeError: ‘NoneType’ object has no attribute ‘Intersection’

I switched to using the WW III wind and wave data points from the original sample data and still have this problem.

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [July 19, 2024, 7:41pm UTC](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868/20 "2024-07-19T19:41:01Z")

</div>

> [@tzlhhu0116](#):
>
> I switched to using the WW III wind and wave data points from the original sample data and still have this problem.

Great, this is a new error and not related to the WW3 data. This error is related to the surge calculation, which uses the continental shelf contour layer. I would examine that layer for the same sort of issues related to coordinate systems that we have already discussed.

[Next page](https://community.naturalcapitalalliance.org/t/casting-rays-and-extracting-bathymetry-values-hangs/4868.md?page=2)
