# FMTOMO-GMT issue: 3D velocity and interface structure

**URL:** <https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973>\
**Category:** Q&A\
**Created:** [May 26, 2023, 3:00pm UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973 "2023-05-26T15:00:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![liam](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/liam/32/3132_2.png) [@liam](https://forum.generic-mapping-tools.org/u/liam)\
**Post date:** [May 26, 2023, 3:00pm UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973/1 "2023-05-26T15:00:34Z")

</div>

Hi all,

I am currently trying to run the example files from the FMTOMO documentation. Since the doc examples run on an old GMT version, I had to come up with new bash plotting scripts compatible with the latest GMT version’s syntax (v6.4.0).

Below I have pasted my plotting script for an EW section through a layered velocity model created by jointly inverting for synthetic reflection, refraction, and teleseismic arrival time residuals to solve for the 3-D velocity and interface structure:

```
#!/usr/bin/env bash

psfile="gmtslice.ps"

gmt begin $psfile

gmt set FONT_ANNOT_PRIMARY Helvetica,16p

# Plot velocity field
gmt xyz2grd grid2dvew.z -Ggrid2dvew.grd -R138/142/-101.000000000003/1.49999999999700 -I461+/481+ -ZTL
gmt grdimage grid2dvew.grd -JX8.0i/2.6i -Cvelrelativesc.cpt -Bxa0.5f0.25 -Bya20f10

# Plot scale bar
gmt psscale -Ba0.3f0.1 -Cvelrelativesc.cpt

# Plot moho interface
gmt psxy intew.xy -R138/142/-101.000000000003/1.49999999999700 -JX8.0i/2.6i -W7/0/0/0

# Plot sources, receivers, and ray paths
# Ray Paths: gmt psxy raysew.xy 
gmt psxy sourcesew.xy -R138/142/-101.000000000003/1.49999999999700 -JX8.0i/2.6i -Sa0.40 -Gred -W2/0/0/0
gmt psxy receiversew.xy -R138/142/-101.000000000003/1.49999999999700 -JX8.0i/2.6i -Si0.40 -Gblue -W2/0/0/0

# Display output
gmt end show

```

* * *

This is what my output plot looks like:

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/6/6b186d248fbfcbb6776369d65f70481edb4a4fa4.png)

What it’s supposed to look like:  
 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/4/48fdd85c4e7e0279b391089d5f24ac9af6286bdf.png)

I am new to coding, nevermind making use of bash and fmtomo within linux. What I tried to accomplish here was to alter the already-made example script to fit the latest GMT syntax.  
Everything plots correctly, except the velocity field, IMHO, meaning the problem likely lies between either the xyz2grd or grdimage modules.

This is what I’ve tried so far to fix the velocity field:  
Tried using the two different supplied colour maps - velrelativesc.cpt and velrelative.cpt  
Checked that my values in my grid2dvew.z file looks correct.  
Made sure my -R and -I values correspond to the boundew.gmt file values.  
Tried different interpolation methods for xyz2grd.

Any help would be greatly appreciated.

Kind regards,  
Liam

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [May 29, 2023, 5:54pm UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973/2 "2023-05-29T17:54:00Z")

</div>

Should be +n not just + since there is another modifier too.

---

<div class="post-metadata">

**Author:** ![liam](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/liam/32/3132_2.png) [@liam](https://forum.generic-mapping-tools.org/u/liam)\
**Post date:** [May 30, 2023, 8:45am UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973/3 "2023-05-30T08:45:03Z")

</div>

I have tried this, the n modifier doesn’t fix anything. I remember reading somewhere that both + and +n both represent the ‘number of nodes’ definition.

But thank you for your reply.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [May 30, 2023, 8:36pm UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973/4 "2023-05-30T20:36:59Z")

</div>

Yep, checked the code and it still donors just +.  
If you can post your \*.z file then we can probably figure out the problem.

---

<div class="post-metadata">

**Author:** ![liam](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/liam/32/3132_2.png) [@liam](https://forum.generic-mapping-tools.org/u/liam)\
**Post date:** [May 31, 2023, 6:37am UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973/5 "2023-05-31T06:37:31Z")

</div>

Sure thing. I have attached my grid2dvew.z file as a .txt below (somehow too large to upload directly here):

> **[OneDrive for Business](https://uctcloud-my.sharepoint.com/personal/nlllia003_myuct_ac_za/_layouts/15/onedrive.aspx?id=%2Fpersonal%2Fnlllia003%5Fmyuct%5Fac%5Fza%2FDocuments%2Fgrid2dvew%2Ez%2Etxt&parent=%2Fpersonal%2Fnlllia003%5Fmyuct%5Fac%5Fza%2FDocuments&ga=1)**

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [May 31, 2023, 8:50pm UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973/6 "2023-05-31T20:50:38Z")

</div>

Requires an account to access it says.

---

<div class="post-metadata">

**Author:** ![liam](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/liam/32/3132_2.png) [@liam](https://forum.generic-mapping-tools.org/u/liam)\
**Post date:** [May 31, 2023, 9:14pm UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973/7 "2023-05-31T21:14:56Z")

</div>

Strange, here’s another link below.

But basically in 221 741 rows, 1 column, i.e.:  
0.0518977875514  
0.0526268252122  
0.0533520788678  
0.0540732516194  
0.0547900465681  
0.0555021668149  
0.0562093154609  
0.0569111956072  
0.0576075103548  
0.0582979628049  
0.0589822560585  
0.0596600932166  
0.0603311773804

Minimum: -0,513470949  
Max: 0,580537282

[https://1drv.ms/t/s!Amu9cj9XBtqZkxeXTeG5w\_CmX0Gi?e=iYxzUi](https://1drv.ms/t/s!Amu9cj9XBtqZkxeXTeG5w_CmX0Gi?e=iYxzUi)

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [May 31, 2023, 10:26pm UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973/8 "2023-05-31T22:26:19Z")

</div>

Makes a big difference if you use -ZLB instead.

---

<div class="post-metadata">

**Author:** ![liam](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/liam/32/3132_2.png) [@liam](https://forum.generic-mapping-tools.org/u/liam)\
**Post date:** [June 2, 2023, 3:23pm UTC](https://forum.generic-mapping-tools.org/t/fmtomo-gmt-issue-3d-velocity-and-interface-structure/3973/9 "2023-06-02T15:23:30Z")

</div>

Ahh not too sure how I missed this… Thank you so much - you fixed my issue.

kindest regards,  
Liam
