# talwani3d¶

talwani3d - Compute geopotential anomalies over 3-D bodies by the method of Talwani

## Synopsis¶

**gmt talwani3d** [ *modeltable* ]
[ **-A** ] [ **-D***rho* ] ]
[ **-F****f**|**n**|**v** ]
[ **-G***outfile* ]
[ **-I***increment* ]
[ **-M**[**h**][**v**] ]
[ **-N***trackfile* ]
[ **-R***region* ]
[ **-Z***level*|*obsgrid* ]
[ **-V**[*level*] ]
[ **-bi**binary ]
[ **-d**nodata ]
[ **-e**regexp ]
[ **-f**flags ]
[ **-i**flags ]
[ **-o**flags ]
[ **-r**reg ]
[ **-x**[[-]*n*] ]
[ **–PAR**=*value* ]

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

## Description¶

**talwani3d** will read the multi-segment *modeltable* from file (or standard input).
This file contains horizontal contours of a 3-D body at different *z*-levels, with one contour
per segment. Each segment header must contain the parameters *zlevel rho*, which
states the *z* level of the contour and the density of this slice (optionally, individual slice
densities may be overridden by a fixed density contrast given via **-D**).
We can compute anomalies on an equidistant grid (by specifying a new grid with
**-R** and **-I** or provide an observation grid with desired elevations) or at arbitrary
output points specified via **-N**. Choose between free-air anomalies, vertical
gravity gradient anomalies, or geoid anomalies. Options are available to control
axes units and direction.

## Required Arguments¶

*modeltable*- The file describing the horizontal contours of the bodies. Contours will be
automatically closed if not already closed, and repeated vertices will be eliminated.
The segment header for each slice will be examined for the pair
*zlevel rho*, i.e., the depth level of the slice and a density contrast in kg/m^3; see**-D**for overriding this value.

**-I***xinc*[*unit*][**+e**|**n**][/*yinc*[*unit*][**+e**|**n**]]*x_inc*[and optionally*y_inc*] is the grid spacing. Optionally, append a suffix modifier.**Geographical (degrees) coordinates**: Append**m**to indicate arc minutes or**s**to indicate arc seconds. If one of the units**e**,**f**,**k**,**M**,**n**or**u**is appended instead, the increment is assumed to be given in meter, foot, km, Mile, nautical mile or US survey foot, respectively, and will be converted to the equivalent degrees longitude at the middle latitude of the region (the conversion depends on PROJ_ELLIPSOID). If*y_inc*is given but set to 0 it will be reset equal to*x_inc*; otherwise it will be converted to degrees latitude.**All coordinates**: If**+e**is appended then the corresponding max*x*(*east*) or*y*(*north*) may be slightly adjusted to fit exactly the given increment [by default the increment may be adjusted slightly to fit the given domain]. Finally, instead of giving an increment you may specify the*number of nodes*desired by appending**+n**to the supplied integer argument; the increment is then recalculated from the number of nodes and the domain. The resulting increment value depends on whether you have selected a gridline-registered or pixel-registered grid; see GMT File Formats for details. Note: if**-R***grdfile*is used then the grid spacing has already been initialized; use**-I**to override the values.

**-R***xmin*/*xmax*/*ymin*/*ymax*[**+r**][**+u***unit*] (more ...)- Specify the region of interest.

## Optional Arguments¶

**-A**- The
*z*-axis should be positive upwards [Default is down].

**-D***unit*- Sets a fixed density contrast that overrides any individual slice settings in the model file, in kg/m^3.

**-F****f**|**n**|**v**- Specify desired gravitational field component. Choose between
**f**(free-air anomaly) [Default],**n**(geoid; optionally append average latitude for normal gravity reference value [45]) or**v**(vertical gravity gradient).

**-G***outfile*- Specify the name of the output data (for grids, see GRID FILE FORMATS below).
Required when an equidistant grid is implied for output. If
**-N**is used then output is written to stdout unless**-G**specifies an output file.

**-M**[**h**][**v**]- Sets distance units used. Append
**h**to indicate that both horizontal distances are in km [m], and append**z**to indicate vertical distances are in km [m].

**-N***trackfile*- Specifies individual (x, y[, z]) locations where we wish to compute the predicted value. When this option
is used there are no grids and the output data records are written to stdout. If
*trackfile*has 3 columns we take the*z*value as our observation level; this level may be overridden via**-Z**.

**-V**[*level*] (more ...)- Select verbosity level [c].

**-Z***level*|*obsgrid*- Set observation level, either as a constant or variable by giveing the name of a grid with observation levels. If the latter is used then this grid determines the output grid region as well [0].

**-bi**[*ncols*][**t**] (more ...)- Select native binary format for primary input. [Default is 2 input columns].

**-d**[**i**|**o**]*nodata*(more ...)- Replace input columns that equal
*nodata*with NaN and do the reverse on output.

**-e**[**~**]*“pattern”***|****-e**[**~**]/*regexp*/[**i**] (more ...)- Only accept data records that match the given pattern.
**-f**flags- Geographic grids (i.e., dimensions of longitude, latitude) will be converted to km via a “Flat Earth” approximation using the current ellipsoidal parameters.

**-h**[**i**|**o**][*n*][**+c**][**+d**][**+r***remark*][**+r***title*] (more ...)- Skip or produce header record(s). Not used with binary data.

**-i***cols*[**+l**][**+s***scale*][**+o***offset*][,*...*] (more ...)- Select input columns and transformations (0 is first column).

**-o***cols*[,...] (more ...)- Select output columns (0 is first column).

**-r**(more ...)- Set pixel node registration [gridline].

**-x**[[-]*n*] (more ...)- Limit number of cores used in multi-threaded algorithms (OpenMP required).

**-:**[**i**|**o**] (more ...)- Swap 1st and 2nd column on input and/or output.

**-^**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.
**–PAR**=*value*- Temporarily override a GMT default setting; repeatable. See gmt.conf for parameters.

## Units¶

For map distance unit, append *unit* **d** for arc degree, **m** for arc
minute, and **s** for arc second, or **e** for meter [Default], **f**
for foot, **k** for km, **M** for statute mile, **n** for nautical mile,
and **u** for US survey foot. By default we compute such distances using
a spherical approximation with great circles. Prepend **-** to a
distance (or the unit is no distance is given) to perform “Flat Earth”
calculations (quicker but less accurate) or prepend **+** to perform
exact geodesic calculations (slower but more accurate).

## Examples¶

To compute the free-air anomalies on a grid over a 3-D body that has been contoured and saved to body3d.txt, using 1700 kg/m^3 as the fixed density contrast, with horizontal distances in km and vertical distances in meters, try

```
gmt talwani3d -R-200/200/-200/200 -I2 -Mh -G3dgrav.nc body3d.txt -D1700 -Ff
```

To obtain the vertical gravity gradient anomaly along the track in crossing.txt for the same model, try

```
gmt talwani3d -Ncrossing.txt -Mh body3d.txt -D1700 -Fv > vgg_crossing.txt
```

Finally, the geoid anomaly along the same track in crossing.txt for the same model (at 30S) is written to n_crossing.txt by

```
gmt talwani3d -Ncrossing.txt -Mh body3d.txt -D1700 -Fn-30 -Gn_crossing.txt
```

## References¶

Kim, S.-S., and P. Wessel, 2016, New analytic solutions for modeling vertical
gravity gradient anomalies, *Geochem. Geophys. Geosyst., 17*,
http://dx.doi.org/10.1002/2016GC006263.

Talwani, M., and M. Ewing, 1960, Rapid computation of gravitational attraction of
three-dimensional bodies of arbitrary shape, *Geophysics, 25*, 203-225.

## See Also¶

gmt.conf, gmt, grdmath, gravfft, gmtgravmag3d, grdgravmag3d, talwani2d