Question about sphdistance

Hi wonderful GMT team!

Hope you are all doing well, despite the obvious challenges of 2020.

I am trying to make distance grids using sphdistance. I am feeding it reconstructed mid-oceanic ridge line geometries (densified into points), but it gives me some strange artefacts (big streaks of 0 distance away from the MORs). I have bundled the whole example input and output into this file.

I am on macOS 10.15.7 (Catalina) with GMT installed over Homebrew, running version 6.2.0_5ae91b8_2020.11.18 [64-bit] [16 cores].

I have tested it on another machine, running GMT 6.1, and the same issue appears.

Aside from the artefacts, there’s a huge challenge to densify lines with extra points and also to remove duplicated points. Paul, I remember you helped me deal with some of this in the sphinterpolate tool, but I am not sure if similar duplication checks are applied in sphdistance. In some ways, it would be cool if gmtspatial (or similar) could deal with this kind of stuff further “upstream”, in the hope it can reduce the burden of imposing these checks in all of the GMT tools.

Anyway, thanks so much for all the help in advance. I appreciate it!

Regards,
Sabin

Quick question Sabin: Do you get the same if you use -D with sphdistance?

Yes, I do. See image below.

Thanks so much for having a look at it - no rush, please enjoy your Sunday evening!!!

Hi Paul and team,

I played around with this some more. I managed to fix the problem - I’m not yet sure whether it was to do with how I was calling SAMPLED1D, or if there were other stray duplicate points. I successfully used CONVERT to deal with those.

gmt simplify mor.gmt -T${grdspace} > aa
gmt convert -Td0:1 aa -o0:1 -V > bb

# Creating third column reprsenting distance
gmt mapproject bb -Gd > b

# Densifying
gmt gmtselect -R0/180/-90/90 b -V | gmt sample1d -Ar -Fl -N2 -T0.1 -o0:2 -V  > aaa
gmt gmtselect -R-180/0/-90/90 b -V | gmt sample1d -Ar -Fl -N2 -T0.1 -o0:2 -V  > bbb

# cat aaa bbb | awk '($1 != ">") {print $0}' | sort -n | gmt convert -Td0:1 -o0:1 -V > ccc
# cat aaa bbb | awk '($1 != ">") {print $0}' | gmt convert -Td0:1 -o0:1 -V > ccc
cat aaa bbb | awk '($1 != ">") {print $0}'  > ccc

gmt sphtriangulate ccc -Qv -V -D > mor_simpl_triangulate.xy

I’ll report back if I find any other issues - I just wanted to send a quick note before you spent too much time delving into the issue… I think I need some sleep…