Hi, I am stuck on importing and plotting a .grd file. It has 4 columns with node ID, Lat, Long, and elevation respectively. I wanted to convert it into netcdf by using grdinfo or xyztogrd but I am a little confused on how to go about this. Do I have to use -f to assign each column to a specific input or is there a different way to do this.

If it is an equidistant grid then it would be something like this (since we would expect lon,lat,z on input)

gmt xyz2grd -i2,1,3 -R… -I… -fg -Goutput.grd input.txt

you may possibly need -r if your grid is pixel-registered and not gridline-registered.

ok thank you, so the -I is what dictates order of columns. What about the first column, node ID. Do I just remove it?

No need, it is not listed in the -i option that selects the columns.

GMT starts counting with 0. So the column -i1 is the second, not the first.

The third you mean

1 Like

Fixed