Grid file from a txt file

How to make grdfile from txt file1?

That depends. You need to give us more information. We are not mind readers.

I want to make bougar gravity map I have data in long lat and data.

I want to make this kind of map.
I have data in

psbasemap -JM10c -R65/100/5/40 -B5/5WSen -K -Y4 >
gmt txt2grd -i2,1,3 -R65/100/5/40 -J -O -K -fg -Goutput.gravity.txt

Now, how should I proceed.

The values in looks gridded to me.

Then you should figure out what the x- and y-increment is, and the region that the grid covers and use xyz2grd;

gmt xyz2grd -Ixinc/yinc -Rw/e/s/n

Then you should get a gridfile that gmt can use. Next would be to plot it (and mask areas with no data).

Tip: gmt info to get the extent.

Increment you have to eyeball the textfile. I dont know of a way to check this.

gmt psbasemap -R65/100/5/40 -JM4i -B5/5WSen -K -Y4 >
gmt xyz2grd -Ix1/y1 -R65/100/5/40
grdimage -R -J -O -K -Cfinal.cpt >>
gmt pscoast -R -J -O -K -Na >>
psscale -D/-2/12/0.5h -B10::/:mgal: -Cfinal.cpt -O -K >>
#pscolorbar -Dx1i/7i+w4i/0.5i+h -Cfinal.cpt -Ba -B+tcontinuous -I0.5

This is my script but I am not able to proceed.

Your xyz2grd command should be

gmt xyz2grd -I<number>/<number> -R65/100/5/40

I dont know what the increment in the grid is (or even if it is a grid at all), but something like

gmt xyz2grd -I0.0167/0.0167 -R65/100/5/40

may work.

Good progress!

  • Please 1: Don’t post screen-captures. Copy past the text and wrapp it pairs of triple back ticks (```) for formatting

  • Please 2: Pay attention to the error messages. If your system is saying xyz2grd ... no such file ( you will advance nothing by ignoring this (and others) error messages.