Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grdcontour hanging #8387

Closed
macpurity opened this issue Mar 2, 2024 · 5 comments · Fixed by #8388
Closed

grdcontour hanging #8387

macpurity opened this issue Mar 2, 2024 · 5 comments · Fixed by #8388
Labels
bug Something isn't working

Comments

@macpurity
Copy link

grdcontour gets hung when fed a grid file that has values very close to zero, but not exactly zero.

Please see the post on the GMT forum page. Data and two-line script were posted there.

System information

  • Operating system: MacOS 13.6.4
  • GMT version (gmt --version): 6.6.0_1443c0c_2024.02.26
@macpurity macpurity added the bug Something isn't working label Mar 2, 2024
@anbj
Copy link
Contributor

anbj commented Mar 2, 2024

Link to forum post with script that causes hang: https://forum.generic-mapping-tools.org/t/grdcontour-gets-hung/4697.

joa-quim added a commit that referenced this issue Mar 2, 2024
…finite alloc loop.

The situation arose when the condition

if ((dz = z[this_side] - z[this_side+1]) == 0.0f) continue;

was never met by a tiny bit. Comparing to 0.0 is never a good idea. So I made it

if (fabs((dz = z[this_side] - z[this_side+1])) < 1e-10) continue;

I get 6 grdcontour test failures but they don't seem related to this change (more due to the endless headache of slight different grids).

Fixes #8387
@seisman
Copy link
Member

seisman commented Mar 2, 2024

maybe related to GenericMappingTools/pygmt#1927 and #6738

@joa-quim
Copy link
Member

joa-quim commented Mar 2, 2024

Can you please try if my fix fixes it too?

@macpurity
Copy link
Author

Joaquim, not sure if that was directed to me, but I updated GMT to 6.6.0_09d27ad_2024.03.03 and it still hangs on my system.

@joa-quim
Copy link
Member

joa-quim commented Mar 3, 2024

John, it was actually meant to Dongdong but meanwhile I checked that this fix also fixes #6738 so I'll be merging this soon.
To test it you need to build the branch, not from master.

joa-quim added a commit that referenced this issue Mar 4, 2024
…finite alloc loop. (#8388)

The situation arose when the condition

if ((dz = z[this_side] - z[this_side+1]) == 0.0f) continue;

was never met by a tiny bit. Comparing to 0.0 is never a good idea. So I made it

if (fabs((dz = z[this_side] - z[this_side+1])) < 1e-10) continue;

I get 6 grdcontour test failures but they don't seem related to this change (more due to the endless headache of slight different grids).

Fixes #8387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants