Xyz2grd wants to produce massive file/runs out of memory

Gents - I have exported a .dat file (plain xyz format) from a seismic interpretation package thinking “let’s see if I can plot this feature in 3D with grdview”. Grdview didn’t like “.dat” so I thought let’s do xyz2grd first. It’s a relatively small file (153KB, about 4k rows).

So I try to run:

gmt xyz2grd my_grid.dat -Gother_grid.nc -R265060/267360/4154020/4155500 -I50e -V

and I get

xyz2grd [INFORMATION]: Processing input table data xyz2grd [INFORMATION]: Distance to degree conversion implies x_inc = 0.00044966 xyz2grd [INFORMATION]: Given domain implies x_inc = 0.00044966 xyz2grd [INFORMATION]: Distance to degree conversion implies y_inc = 0.00044966 xyz2grd [INFORMATION]: Given domain implies y_inc = 0.00044966 xyz2grd (gmtapi_alloc_grid): Could not reallocate memory [62716.36 Gb, 16835294257875 items of 4 bytes]

63 THOUSAND GB? Even if I change the increment to 500 it would still require like 627 GB. Where am I messing up?

Input data and output data are/should be both cartesian.

Running GMT 6 on Windows on Git with bash. Thanks for any help as usual

Hi,

It seems that the increment in the source data is 0.00044966 in some units. I guess that the unit is degree that is 113 km long at the equator. 113 km x 0.00044966 makes about 50 m.

With your -R the size of the output is 2300 x 1480 units. The intended unit is perhaps meter. However, the extents divided by 0.00044966 make a raster that has 5114975 by 3291375 pixels. That’s a big raster.

The problem is that 'e'. It makes xyz2grd think that your limits were given in degrees and that you want increments at 50 meters. Just drop the 'e'. Alternatively, if your my_grid.dat is really already gridded, rename it to my_grid.xyz and let GDAL (indirectly) figure out -R and -I. That is, you should be able to do

gmt convert my_grid.xyz -Gmy_grid.grd

Given that -R setting, I think GMT should simply warn that the “e” will be ignored since it is only used when -R is in degrees.

1 Like

Yep, its was the “e”. I wanted to make sure I was getting meters which is why I appended it. xyz2grd worked just fine and then so did grdview.

I tried the other thing you recommended just for fun - the gmt convert function but it didn’t like the fact there was “a change in direction” in the file so it clearly doesn’t think my exported file is a regular grid.

It means your file is probably written column-wise and GDAL expects scanline. Tht was fixed recently in GDAL.

Gents -

Please help us make the community forum an open and welcoming environment by using inclusive language in future posts, per GMT’s code of conduct.

illuminating as usual, thanks Joaquim!