## Plotting a 3 column data with surface, makecpt and grdimage

Added by H. Tarık 9 months ago

Hello everyone

I' ve been trying to learn GMT for a couple of days and trying to write scripts for myself. I couldn' t figure out how to plot a 3 column data file.

I have a file with 3 columns. First column is x coordinate, second is y coordinate and third is water elevation.

I want to plot these elevation data in to corresponding x, y points.

Here is the script I am running but as a result I do not get a good output.

`#I have layer01_all.dat file (you can find it in the attachment) with 3 columns max value for third column is 16.8262.`

#The distance between the cells are 2 arc-min as i did in my numerical simulation.

#You can see the lat and lon values.

gmt surface layer01_all.dat -Gsurfaceoutput.grd -I2m2m -R-96/-69/-35/-9

#I tried to make a cpt file

gmt makecpt -T0/16.8262/0.0001 -Cjet > color.cpt

#I tried to plot it

gmt grdimage surfaceoutput.grd -Jm15 -Ccolor.cpt > plot.ps

If someone can help me with this it would be great.

Thanks in advance.

layer01_all.dat.zip (1.83 MB)

### Replies (3)

#### RE: Plotting a 3 column data with surface, makecpt and grdimage - Added by Peter 9 months ago

Hi Tarik

Running your script does yield a figure but as most of the data points in you file are either very close to 0 or 16.8262 the resulting figure mainly looks blue with regions of black dots. As your wording "I do not get a good output" leave little information as to what you expect to "get" perhaps you want to give some more information on this subject. In lack of this I suspect that you want to visualize the small deviations from 0 and 16.8262 that are present in your file. If this is the case you need to manually edit the cpt file so that the color intervals reflect the information you wish to display. In your script you create a cpt file with 168262 color intervals making it virtualy impossible to distinguish between two intervals that are close, I suspect that this is so even for two colors separated by 1000 intervals. Instead perhaps limit the number of intervals to, say, 10-20 in your call to `makecpt`

(e.g. -T0/16.9/0.8) and then open the resulting cpt file and adjust the intervals boundaries to something appropriate for your data set.

#### RE: Plotting a 3 column data with surface, makecpt and grdimage - Added by Paul 9 months ago

Your scale of 15 cm (or inches) per degree means you plot will be (-69 - (-96) = 27 degrees * 15 cm (or inch) = 405 cm or inches. You probably mean -JM15 ?

#### RE: Plotting a 3 column data with surface, makecpt and grdimage - Added by H. Tarık 8 months ago

First of all thank you for your help and sorry for the delayed reply,

Dear Peter and Paul I was doing 2 things wrong and you two referred to them separately thank you for your help, I figured them out now I get good results.

PS It is a tsunami maximum wave height data from an earthquake happened in Chile, Illapel couple of years back.

(1-3/3)