---
name: "segy2grd"
section: "1gmt"
platform: "linux"
package: "gmt-common"
version: "5.4.5+dfsg-2"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/segy2grd"
---

# segy2grd(1gmt)

Converting SEGY data to a GMT grid

## NAME

segy2grd - Converting SEGY data to a GMT grid

## SYNOPSIS

**segy2grd** *segyfile*  **-G***grdfile*\
  **-I***increment*\
  **-R***region* \[  **-A**\[**n**\|**z**\] \] \[  **-D**\[**+x***xname*\]\[**+y***yname*\]\[**+z***zname*\]\[**+s***scale*\]\[**+o***offset*\]\[**+n***invalid*\]\[**+t***title*\]\[**+r***remark*\] \] \[  **-L**\[*nsamp*\] \] \[  **-M**\[*ntraces*\] \] \[  **-N***nodata* \] \[  **-Q***\<mode\>\<value\>* \] \[  **-S**\[*header*\] \] \[  **-V**\[*level*\] \] \[ **-bi**binary \] \[ **-:**\[**i**\|**o**\] \]

**Note:** No space is allowed between the option flag and the associated arguments.

## DESCRIPTION

**segy2grd** reads an IEEE SEGY file and creates a binary grid file. Either a simple mapping (equivalent to xyz2grd -Z) or a more complicated averaging where a particular grid cell includes values from more than one sample in the SEGY file can be done. **segy2grd** will report if some of the nodes are not filled in with data. Such unconstrained nodes are set to a value specified by the user \[Default is NaN\]. Nodes with more than one value will be set to the average value.

## REQUIRED ARGUMENTS

*segyfile* is an IEEE floating point SEGY file. Traces are all assumed to start at 0 time/depth.

- **-G***grdfile*

  *grdfile* is the name of the binary output grid file.

- **-I**

  *x\_inc* \[and optionally *y\_inc*\] is the grid spacing. Append **m** to indicate minutes or **s** to indicate seconds.

- **-R***west*/*east*/*south*/*north*\[/*zmin*/*zmax*\]\[**+r**\]\[**+u***unit*\]

  *west*, *east*, *south*, and *north* specify the region of interest, and you may specify them in decimal degrees or in \[±\]dd:mm\[:ss.xxx\]\[**W**\|**E**\|**S**\|**N**\] format Append **+r** if lower left and upper right map coordinates are given instead of w/e/s/n. The two shorthands **-Rg** and **-Rd** stand for global domain (0/360 and -180/+180 in longitude respectively, with -90/+90 in latitude). Alternatively for grid creation, give **R***codelon*/*lat*/*nx*/*ny*, where *code* is a 2-character combination of L, C, R (for left, center, or right) and T, M, B for top, middle, or bottom. e.g., BL for lower left.  This indicates which point on a rectangular region the *lon*/*lat* coordinate refers to, and the grid dimensions *nx* and *ny* with grid spacings via **-I** is used to create the corresponding region. Alternatively, specify the name of an existing grid file and the **-R** settings (and grid spacing, if applicable) are copied from the grid. Appending **+u***unit* expects projected (Cartesian) coordinates compatible with chosen **-J** and we inversely project to determine actual rectangular geographic region. For perspective view (**-p**), optionally append /*zmin*/*zmax*. In case of perspective view (**-p**), a z-range (*zmin*, *zmax*) can be appended to indicate the third dimension. This needs to be done only when using the **-Jz** option, not when using only the **-p** option. In the latter case a perspective view of the plane is plotted, with no third dimension.

## OPTIONAL ARGUMENTS

- **-A**\[**n**\|**z**\]

  Add up multiple values that belong to the same node (same as **-Az**). Append **n** to simply count the number of data points that were assigned to each node. \[Default (no **-A** option) will calculate mean value\]. Not used for simple mapping.

- **-D**\[**+x***xname*\]\[**+y***yname*\]\[**+z***zname*\]\[**+s***scale*\]\[**+o***offset*\]\[**+n***invalid*\]\[**+t***title*\]\[**+r***remark*\]

  Give one or more combinations for values *xname*, *yname*, *zname* (give the names of those variables and in square bracket their units, e.g., "distance \[km\]"), *scale* (to multiply grid values after read \[normally 1\]), *offset* (to add to grid after scaling \[normally 0\]), *invalid* (a value to represent missing data \[NaN\]), *title* (anything you like), and *remark* (anything you like). Items not listed will remain untouched. Give a blank name to completely reset a particular string. Use quotes to group texts with more than one word. Note that for geographic grids (**-fg**) *xname* and *yname* are set automatically.

- **-L**

  Let *nsamp* override number of samples in each trace.

- **-M**\[*ntraces*\]

  Fix number of traces to read in. Default tries to read 10000 traces. **-M**0 will read number in binary header, **-M***ntraces* will attempt to read only *n* traces.

- **-N***nodata*

  No data. Set nodes with no input sample to this value \[Default is NaN\].

- **-Q***\<mode\>\<value\>*

  - **Can be used to change two different settings depending on *mode*:**

    **-Qx***x-scale* applies scalar *x-scale* to coordinates in trace header to match the coordinates specified in -R.

    **-Qy***s\_int* specifies sample interval as *s\_int* if incorrect in the SEGY file.

- **-S**\[*header*\]

  Set variable spacing; *header* is **c** for cdp, **o** for offset, or **b***number* for 4-byte float starting at byte *number*. If **-S** not set, assumes even spacing of samples at the *x\_inc, y\_inc* supplied with **-I**.

- **-V**\[*level*\] (more ...)

  Select verbosity level \[c\].

- **-r** (more ...)

  Set pixel node registration \[gridline\].

- **-^** or just **-**

  Print a short message about the syntax of the command, then exits (NOTE: on Windows just use **-**).

- **-+** or just **+**

  Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exits.

- **-?** or no arguments

  Print a complete usage (help) message, including the explanation of all options, then exits.

## EXAMPLES

To create a grid file from an even spaced SEGY file test.segy, try

```
gmt segy2grd test.segy -I0.1/0.1 -Gtest.nc -R198/208/18/25 -V
```

Note that this will read in 18-25s (or km) on each trace, but the first trace will be assumed to be at X=198

To create a grid file from the SEGY file test.segy, locating traces according to the CDP number, where there are 10 CDPs per km and the sample interval is 0.1, try

```
gmt segy2grd test.segy -Gtest.nc -R0/100/0/10 -I0.5/0.2 -V -Qx0.1 -Qy0.1
```

Because the grid interval is larger than the SEGY file sampling, the individual samples will be averaged in bins

## SEE ALSO

gmt, grd2xyz, grdedit, pssegy, xyz2grd

## COPYRIGHT

2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
