Harmonica provides functions and classes for processing, modelling and interpolating gravity and magnetic data.

Its main goals are:

  • Provide efficient, well designed, and fully tested code that would compress the building blocks for more complex workflows.

  • Cover the entire data life-cycle: from raw data to 3D Earth model.

  • Focus on best-practices to discourage misuse of methods.

  • Easily extendable code to enable research on the developments of new methods.

Harmonica will not provide:

  • Multi-physics partial differential equation solvers. Use SimPEG or PyGIMLi instead.

  • Generic processing methods like grid transformations (use Verde or Xarray instead) or multidimensional FFT calculations (use xrft instead).

  • Reference ellipsoid representations and computations like normal gravity. Use Boule instead.

  • Data visualization functions. Use matplotlib for generic plots, Xarray for plotting grids, PyGMT for maps, and PyVista for 3D visualizations.

  • GUI applications.


Before we get started, here are a few conventions we keep across Harmonica:

  • Every physical quantity will be assumed to be given in a unit belonging to the International System of Units (SI). The only exceptions are:

    • gravity accelerations are expected in miligal (mGal) (\(1~\text{mGal} = 10^{-5}~\text{m}/\text{s}^2\)).

    • gravity tensor components are assumed to be in Eotvos (\(1~\text{Eotvos} = 10^{-9}~\text{s}^{-2}\)).

    • magnetic fields are given in nano Tesla (nT).

  • Harmonica uses the same conventions as verde, meaning:

    • Functions expect coordinates in the order: West-East, South-North and (in occasions) Bottom-Top. Exceptions to this rule are the dims and shape arguments.

    • We avoid using names like “x”, “y” and “z” to avoid ambiguity. We use “easting”, “northing” and “upward” or “longitude”, “latitude” and “height” instead.

  • Some functions or classes expect its arguments to be defined in a specific coordinate system. They can either be in:

    • Cartesian coordinates: usually given as easting, northing and upward coordinates (in meters), where the vertical axis points upwards.

    • Geodetic or ellipsoidal coordinates: given as longitude, latitude (both in decimal degrees) and geodetic height (in meters).

    • Spherical geocentric coordinates: given as longitude, spherical latitude (both in decimal degrees) and radius (in meters).

See also

Checkout the Coordinate systems section for more details on these coordinates systems.

The Library

Most classes and functions are available through the harmonica top level package. Througout the documentation, we’ll use hm as an alias for harmonica.

import harmonica as hm

See also

Checkout the API Reference for a comprehensive list of the available function and classes in Harmonica.