The fatiando package has been deprecated. Please check out the new tools in the Fatiando a Terra website:

Forward modeling with 2D polygons (fatiando.gravmag.talwani)

Calculate the gravitational attraction of a 2D body with polygonal vertical cross-section using the formula of Talwani et al. (1959)

Use the Polygon object to create polygons.


the vertices must be given clockwise! If not, the result will have an inverted sign.



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(1), 49-59, doi:10.1029/JZ064i001p00049.

fatiando.gravmag.talwani.gz(xp, zp, polygons, dens=None)[source]

Calculates the \(g_z\) gravity acceleration component.


The coordinate system of the input parameters is z -> DOWN.


All input values in SI units(!) and output in mGal!


  • xp, zp
    : arrays

    The x and z coordinates of the computation points.

  • polygons
    : list of Polygon

    The density model used. Polygons must have the property 'density'. Polygons that don’t have this property will be ignored in the computations. Elements of polygons that are None will also be ignored.

  • dens
    : float or None

    If not None, will use this value instead of the 'density' property of the polygons. Use this, e.g., for sensitivity matrix building.


    The y coordinate of the polygons is used as z!


  • gz
    : array

    The \(g_z\) component calculated on the computation points