How get distance value with pygmt.grdtrack?

Hi,

I’m trying to extract the slab data along a profile knowing its start and end point (A and B). Then I use grdtrack, but output doesn’t have distance. it’s only lon lat and depth. how i can get distance value ?

code:
profile = “123.084147/0.981491/123.084147/-1.499472”

track = pygmt.grdtrack(profile=profile, grid=“sul_slab2_dep.grd”, distcalc=(“g”),
skiprows=True, outfile=“slabA.dat”)

output:

x y z
123.084147 0.981491 -47.1000760455
123.084147 0.956430767677 -48.6422078813
123.084147 0.931370535354 -50.2089361906
123.084147 0.90631030303 -51.801011911
123.084147 0.881250070707 -53.4217551394
123.084147 0.856189838384 -55.0720520884
123.084147 0.831129606061 -56.7562370777
123.084147 0.806069373737 -58.4752894543
123.084147 0.781009141414 -60.2343442166
123.084147 0.755948909091 -62.0344210595
123.084147 0.730888676768 -63.8811745575
123.084147 0.705828444444 -65.7756066675
123.084147 0.680768212121 -67.7235740161
123.084147 0.655707979798 -69.7259937105
123.084147 0.630647747475 -71.7885693534
123.084147 0.605587515152 -73.9120785076
123.084147 0.580527282828 -76.1017487152
123.084147 0.555467050505 -78.3581622886
123.084147 0.530406818182 -80.6857728702
123.084147 0.505346585859 -83.0849225561
123.084147 0.480286353535 -85.5590439843
123.084147 0.455226121212 -88.1082096066
123.084147 0.430165888889 -90.7346598928
123.084147 0.405105656566 -93.4381790707
123.084147 0.380045424242 -96.2197133768
123.084147 0.354985191919 -99.0787591922
123.084147 0.329924959596 -102.014957413
123.084147 0.304864727273 -105.027515973
123.084147 0.279804494949 -108.114794464
123.084147 0.254744262626 -111.275738764
123.084147 0.229684030303 -114.507540522
123.084147 0.20462379798 -117.808896735
123.084147 0.179563565657 -121.175947266
123.084147 0.154503333333 -124.607171301
123.084147 0.12944310101 -128.064416315
123.084147 0.104382868687 -131.631302438
123.084147 0.0793226363636 -135.845986755
123.084147 0.0542624040404 -139.041559748
123.084147 0.0292021717172 -140.127000924

Am I doing something wrong?

sorry for my english.

Hi @egisuyoga

looks all good IMHO but you might have missed one crucial bit according to the documentation:

Append +d to output the along-track distances after the coordinates.

So your profile variable should read like this:

profile = “123.084147/0.981491/123.084147/-1.499472+d”

which should give you distance along profiles measured along a great circle from your x1,y1.

Hope this works,
Christian