Plotting a 3 column data with surface, makecpt and grdimage

Added by H. Tarık 11 days 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 >

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

Replies (2)

RE: Plotting a 3 column data with surface, makecpt and grdimage - Added by Peter 11 days 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 11 days 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 ?