How to make grdfile from txt file1?
That depends. You need to give us more information. We are not mind readers.
The values in gravity.xyz 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 gravity.xyz -Ixinc/yinc -Rw/e/s/n -Goutput.gravity.nc
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 gravity.xyz 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 >map.ps
gmt xyz2grd gravity.xyz -Ix1/y1 -R65/100/5/40 -Goutput.gravity.nc
grdimage gravity_nn.nc -R -J -O -K -Cfinal.cpt >>map.ps
gmt pscoast -R -J -O -K -Na >>map.ps
psscale -D/-2/12/0.5h -B10::/:mgal: -Cfinal.cpt -O -K >> map.ps
#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 gravity.xyz -I<number>/<number> -R65/100/5/40 -Goutput.gravity.nc
I dont know what the increment in the grid is (or even if it is a grid at all), but something like
gmt xyz2grd gravity.xyz -I0.0167/0.0167 -R65/100/5/40 -Goutput.gravity.nc
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 (gravity.xyz)you will advance nothing by ignoring this (and others) error messages.

