Can i turn a .txt file back into a .grd file without disturbing it

So I got a .txt file that has already been gridded (attached) and I just want to turn it into a .grd. I’ve made it a .xyz and that works fine, but as soon as I run xyz2grd it changes my third column to 0. It has also added lines, there were 85 and now there are 225.

is there a way to fix this? it needs to be a .grd so I can use grdimage afterwards. the increments are the same, 1x1 degree. is this something that is possible? ive attached an image of my original .txt with some of my values

heres my attempt:

gmt convert test.txt >!
gmt xyz2grd -Gtest.grd $proj $area -I1/1 -di0

You don’t need to run gmt convert before running gmt xyz2grd as it can read the text file you have. Since your text file has latitude (y) longitude (x) order, you can use the special flag gmt xyz2grd -: to switch the order of those two columns as it reads it.

update it has worked. thank you so so much

1 Like