# Xyz2grd wants to produce massive file/runs out of memory

**URL:** <https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221>\
**Category:** Q&A\
**Created:** [January 17, 2021, 12:51pm UTC](https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221 "2021-01-17T12:51:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RunningWild](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@RunningWild](https://forum.generic-mapping-tools.org/u/RunningWild)\
**Post date:** [January 17, 2021, 12:51pm UTC](https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221/1 "2021-01-17T12:51:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jratike80](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/jratike80/32/1270_2.png) [@jratike80](https://forum.generic-mapping-tools.org/u/jratike80)\
**Post date:** [January 17, 2021, 6:12pm UTC](https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221/2 "2021-01-17T18:12:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [January 17, 2021, 6:52pm UTC](https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221/3 "2021-01-17T18:52:23Z")

</div>

> [@RunningWild](#):
>
> -I50e

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

```auto
gmt convert my_grid.xyz -Gmy_grid.grd

```

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [January 17, 2021, 10:00pm UTC](https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221/4 "2021-01-17T22:00:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RunningWild](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@RunningWild](https://forum.generic-mapping-tools.org/u/RunningWild)\
**Post date:** [January 18, 2021, 1:08pm UTC](https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221/5 "2021-01-18T13:08:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [January 18, 2021, 1:21pm UTC](https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221/6 "2021-01-18T13:21:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![maxrjones](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/maxrjones/32/2698_2.png) [@maxrjones](https://forum.generic-mapping-tools.org/u/maxrjones)\
**Post date:** [January 19, 2021, 3:56pm UTC](https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221/7 "2021-01-19T15:56:40Z")

</div>

> 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](https://github.com/GenericMappingTools/gmt/blob/master/CODE_OF_CONDUCT.md).

---

<div class="post-metadata">

**Author:** ![RunningWild](https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/32.png) [@RunningWild](https://forum.generic-mapping-tools.org/u/RunningWild)\
**Post date:** [January 19, 2021, 5:30pm UTC](https://forum.generic-mapping-tools.org/t/xyz2grd-wants-to-produce-massive-file-runs-out-of-memory/1221/8 "2021-01-19T17:30:59Z")

</div>

illuminating as usual, thanks Joaquim!
