# Plot 2D profile using file having xyz and diffusion

I am a beginner in GMT and this is my first question so I’m sorry if it is simple question.

I have a text file which have diffusion value at each xyz point aront.txt (31.8 KB) . My question is that if xyz are evenly distributed then can we get 2D plot at any depth using xyz2grd or surface (what i learned from GMT tutorial).

when I look at xyz2grd, It seems like there is no need to input of 4 columns. Just confused to get 2D slices at depth by user defined.

Thanks

Hi.

to get 2D slices at depth by user defined.

right now you have all the slices in one file. I believe GMT don’t have a means of choosing a slice. You can do it manually before gridding and plotting. An example extracting a slice at depth = -0.2 using awk (assuming columns 1,2,3 are x,y,z and column 4 is your diffusion value):
cat aront.txt | awk '{if (\$3 == -0.2) print \$1, \$2, \$4}' > aront_depth_-0.2.txt

then run xyz2grd and surface on each slice.

1 Like

This is correct. However, you are the 2nd person in a week with this need so I will see if I can get xyz2grd to produce a 3-D cube as well. But for now, follow the advice above.

1 Like

Thank you so much

Thank you so much. I will do it . Honestly, these depths are so random to publish in article so i was thinking to have a integer depth e.g 1,2,3 etc from 3Dgrid

How was that aront.txt file created? Looking at it we can see that it’s layout is the equivalent of what in images we call pixel-interleaved. one vertical column starting at first column, first row and then moving down the column. This means the equivalent of line and band interleaved can also exist. Plus the scanline or column major orientations and if it’s written top-down or bottom-up. Ufa, quite a lot of possibilities.

txt file was generated after the inversion process. The file layout is based on the grid size (10108). In this file, each value is calculated at each grid cell.

??? which?

I was trying to figure out if there is some common practice in these text cube layouts.

It will be bit long answer. I will try to explain, what I’m doing now:
I used the MuRAT package to calculate the attenuation in the Induced seismicity region. It provides the 3D output in the form of txt and vtk file. I want to plot in GMT so we can further understand the change in attenuation with respect to local geology.

I understand that. What I’m trying to tell you is that if we are going to add the ability to read cubes in text files we cannot do that only for your particular case. It must be a generic solution and that’s why I’m trying to figure out how general this particular layout is.

I have a text file which have diffusion value at each xyz pointurl/tQWE5GoMpd46AJ3iodHRbqmUNlx.txt) 31.8 KB.

My question is that if xyz are evenly distributed then can we get 2D plot at any depth using xyz2grd or surface what i learned from GMT tutorial.

when I look at xyz2grd, It seems like there is no need to input of 4 columns.
Just confused to get 2D slices at depth by user defined.

Steinco Industrial Solutions, Inc.

Cubes are a recent adding in GMT. xyz2grd cannot deal with the yet. The only solution with pure GMT is to create level grids with xyz2grd and stack them together with grdinterpolate

A non-pure solution is to use the Julia wrapper. I recently added the xzyw2cube() function that manages to guess the xyz data layout (there are several possibilities) and create a cube grid that can later be processed by grdinterpolate or the the Julia function cubeslice

In @mkononets solution, the depth = -0.2 is selected which is a depth value in the input data, namely aront.txt. What if we want to have the (diffusion) values at those depths not being included in the input file? Let’s say there are 50 and 100 depths in the input file and we apply the surface command on these depths. What if we need our values at depth 20? Sorry for this naive question but I certainly miss something. Where should we enter our desired depths in the gmt surface command?

I have never done anything like this, but here are some thoughts.

the data in this topic are defined on a 3d “lattice”, (grid is a 2d XY planar coordinate surface, so I call the 3D XYZ coordinate structure a lattice, like a crystalline lattice)

it seems like one needs to define a new 3D lattice having same XY spacing as the old, but finer Z spacing (say not every 50 meters like source depths in your hypothetical example but every 10 or 20 meters to get the 20-m depth included). Then interpolate the data on the new 3D lattice. Then extract a grid at Z=20 meters.

(and I have no idea how to perform the interpolation step on the new lattice).

1 Like