# talwani2d¶

talwani2d - Compute geopotential anomalies over 2-D bodies by the method of Talwani

## Synopsis¶

**gmt talwani2d** [ *modeltable* ]
[ **-A** ] [ **-D***rho* ] ]
[ **-F****f**|**n**[*lat*]|**v** ]
[ **-M**[**h**][**v**] ]
[ **-N***trackfile* ]
[ **-T**[*min/max*/]*inc*[**n**] | **-T***file*|*list* ]
[ **-Z***level*[*ymin*/*ymax*] ]
[ **-V**[*level*] ]
[ **-bi**binary ]
[ **-d**nodata ]
[ **-e**regexp ]
[ **-i**flags ]
[ **-o**flags ]
[ **-x**[[-]*n*] ]
[ **--PAR**=*value* ]

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

## Description¶

**talwani2d** will read the multi-segment *modeltable* from file (or standard input).
This file contains cross-sections of one or more 2-D bodies, with one polygon
per segment. The segment header must contain the parameter *rho*, which
states the the density of this body (individual body
densities may be overridden by a fixed constant density contrast given via an optional **-D**).
We can compute anomalies on an equidistant lattice (by specifying a lattice with
**-T**) or provide arbitrary output points specified in a file 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 cross-sectional polygons of one or more bodies. Polygons
will be automatically closed if not already closed, and repeated vertices will
be eliminated. The segment header for each body will be examined for a density
parameter in kg/m^3; see
**-D**for overriding this value.

## Optional Arguments¶

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

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

**-F****f**|**n**[*lat*]|**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).

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

**-N***trackfile*- Specifies locations where we wish to compute the predicted value. When this option
is used you cannot use
**-T**to set an equidistant lattice. The output data records are written to stdout.

**-T**[*min/max*/]*inc*[**n**] |**-T***file*|*list*- Specify an equidistant output lattice. For details on array creation, see Generate 1D Array.

**-Z***level*[*ymin*/*ymax*]- Set a constant observation level [0]. Optionally, and for gravity anomalies only (
**-Ff**), append the finite extent limits of a 2.5-D body.

**-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.

**-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*][,*…*][,*t*[*word*]] (more …)- Select input columns and transformations (0 is first column,
*t*is trailing text, append*word*to read one word only).

**-o***cols*[,…][*t*[*word*]] (more …)- Select output columns (0 is first column;
*t*is trailing text, append*word*to write one word only).

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

**-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 (**-jg**). You can use **-jf** to perform
“Flat Earth” calculations (quicker but less accurate) or **-je** to perform
exact geodesic calculations (slower but more accurate; see
PROJ_GEODESIC for method used).

## Generate 1D Array¶

Make an evenly spaced coordinate array from *min* to *max* in steps of *inc*.
Append **+b** if we should take log2 of *min* and *max* and build an equidistant
log2-array using *inc* integer increments in log2.
Append **+l** if we should take log10 of *min* and *max* and build an
array where *inc* can be 1 (every magnitude), 2, (1, 2, 5 times magnitude) or 3
(1-9 times magnitude). For less than every magnitude, use a negative integer *inc*.
Append **+n** if *inc* is meant to indicate the number of equidistant coordinates
instead. Alternatively, give a *file* with output coordinates in the first column,
or provide a comma-separated *list* of coordinates. If you only want a *single* value
then you must append a comma to distinguish the list from the setting of *inc*.

If the module allows you to set up an absolute time series, append a valid time unit from the list
**y**ear, m**o**nth, **w**eek, **d**ay, **h**our, **m**inute, and **s**econd
to the given increment; add **+t** to ensure time column (or use **-f**) Note: The internal time
unit is still controlled independently by TIME_UNIT. Some modules allow for **+a**
which will paste the coordinate array to the output table.

Likewise, if the module allows you to set up a spatial distance series (with distance computed
from the first two data columns), specify the increment as *inc*[*unit*] with a
geospatial distance unit from the list
**d**egree (arc), **m**inute (arc), **s**econd (arc), m**e**ter, **f**oot, **k**ilometer,
**M**iles (statute), **n**autical miles, or s**u**rvey foot; see **-j** for calculation mode.
For Cartesian distances, you must use the special unit **c**.

Finally, if you are only providing an increment and obtain *min* and *max* from the data, then it is
possible (*max* - *min*)/*inc* is not an integer, as required. If so then *inc* will be adjusted to accordingly.
Alternatively, append **+e** to keep *inc* exact and adjust *max* instead.

## Examples¶

To compute the free-air anomalies on a equidistant profile over a 2-D body that has been contoured and saved to body2d.txt, using 1700 kg/m^3 as a constant density contrast, with all distances in meters, try

```
gmt talwani2d -T-200/200/2 body2d.txt -D1700 -Ff > 2dgrav.txt
```

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

```
gmt talwani2d -Ncrossing.txt body2d.txt -D1700 -Fv > vgg_crossing.txt
```

The geoid anomaly for the same setup, evaluated at 60N, is given by

```
gmt talwani2d -Ncrossing.txt body2d.txt -D1700 -Fn60 > n_crossing.txt
```

## Notes¶

- The 2-D geoid anomaly is a logarithmic potential and thus has no natural reference level. We simply remove the most negative (if density contrast is positive) or positive (if density contrast is negative) computed value from all values, rendering the entire anomaly positive (or negative). You can use gmtmath to change the zero level to suit your needs.

## References¶

Rasmussen, R., and L. B. Pedersen (1979), End corrections in potential field modeling,
*Geophys. Prospect., 27*, 749-760.

Chapman, M. E., 1979, Techniques for interpretation of geoid anomalies,
*J. Geophys. Res., 84(B8)*, 3793-3801.

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., J. L. Worzel, and M. Landisman, 1959, Rapid gravity computations for
two-dimensional bodies with application to the Mendocino submarine fracture zone,
*J. Geophys. Res., 64*, 49-59.

## See Also¶

gmt.conf, gmt, grdmath, gmtmath, gravfft, gmtgravmag3d, grdgravmag3d, talwani3d