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

# Potential field transformations (fatiando.gravmag.transform)¶

Potential field transformations, like upward continuation and derivatives.

Note

Most, if not all, functions here required gridded data.

Transformations

Derivatives

• derivx: Calculate the n-th order derivative of a potential field in the x-direction (North-South)
• derivy: Calculate the n-th order derivative of a potential field in the y-direction (East-West)
• derivz: Calculate the n-th order derivative of a potential field in the z-direction

fatiando.gravmag.transform.derivx(x, y, data, shape, order=1, method='fd')[source]

Calculate the derivative of a potential field in the x direction.

Note

Requires gridded data.

Warning

If the data is not in SI units, the derivative will be in strange units! I strongly recommend converting the data to SI before calculating the derivative (use one of the unit conversion functions of fatiando.utils). This way the derivative will be in SI units and can be easily converted to what unit you want.

Parameters:

• x, y
: 1D-arrays

The x and y coordinates of the grid points

• data
: 1D-array

The potential field at the grid points

• shape
: tuple = (nx, ny)

The shape of the grid

• order
: int

The order of the derivative

• method
: string

The method used to calculate the derivatives. Options are: 'fd' for central finite-differences (more stable) or 'fft' for the Fast Fourier Transform.

Returns:

• deriv
: 1D-array

The derivative

fatiando.gravmag.transform.derivy(x, y, data, shape, order=1, method='fd')[source]

Calculate the derivative of a potential field in the y direction.

Note

Requires gridded data.

Warning

If the data is not in SI units, the derivative will be in strange units! I strongly recommend converting the data to SI before calculating the derivative (use one of the unit conversion functions of fatiando.utils). This way the derivative will be in SI units and can be easily converted to what unit you want.

Parameters:

• x, y
: 1D-arrays

The x and y coordinates of the grid points

• data
: 1D-array

The potential field at the grid points

• shape
: tuple = (nx, ny)

The shape of the grid

• order
: int

The order of the derivative

• method
: string

The method used to calculate the derivatives. Options are: 'fd' for central finite-differences (more stable) or 'fft' for the Fast Fourier Transform.

Returns:

• deriv
: 1D-array

The derivative

fatiando.gravmag.transform.derivz(x, y, data, shape, order=1, method='fft')[source]

Calculate the derivative of a potential field in the z direction.

Note

Requires gridded data.

Warning

If the data is not in SI units, the derivative will be in strange units! I strongly recommend converting the data to SI before calculating the derivative (use one of the unit conversion functions of fatiando.utils). This way the derivative will be in SI units and can be easily converted to what unit you want.

Parameters:

• x, y
: 1D-arrays

The x and y coordinates of the grid points

• data
: 1D-array

The potential field at the grid points

• shape
: tuple = (nx, ny)

The shape of the grid

• order
: int

The order of the derivative

• method
: string

The method used to calculate the derivatives. Options are: 'fft' for the Fast Fourier Transform.

Returns:

• deriv
: 1D-array

The derivative

fatiando.gravmag.transform.power_density_spectra(x, y, data, shape)[source]

Calculates the Power Density Spectra of a 2D gridded potential field through the FFT:

$\Phi_{\Delta T}(k_x, k_y) = | F\left{\Delta T \right}(k_x, k_y) |^2$

Note

Requires gridded data.

Note

x, y, z and height should be in meters.

Parameters:

• x, y
: 1D-arrays

The x and y coordinates of the grid points

• data
: 1D-array

The potential field at the grid points

• shape
: tuple = (nx, ny)

The shape of the grid

Returns:

• kx, ky
: 2D-arrays

The wavenumbers of each Power Density Spectra point

• pds
: 2D-array

The Power Density Spectra of the data

fatiando.gravmag.transform.radial_average_spectrum(kx, ky, pds, max_radius=None, ring_width=None)[source]

Calculates the average of the Power Density Spectra points that falls inside concentric rings built around the origin of the wavenumber coordinate system with constant width.

The width of the rings and the inner radius of the biggest ring can be changed by setting the optional parameters ring_width and max_radius, respectively.

Note

To calculate the radially averaged power density spectra use the outputs of the function power_density_spectra as input of this one.

Parameters:

• kx, ky
: 2D-arrays

The x and y coordinates of the grid points

• data
: 1D-array

The potential field at the grid points

• shape
: tuple = (nx, ny)

The shape of the grid

: float (optional)

Inner radius of the biggest ring. By default it’s set as the minimum of kx.max() and ky.max(). Making it smaller leaves points outside of the averaging, and making it bigger includes points nearer to the boundaries.

• ring_width
: float (optional)

Width of the rings. By default it’s set as the largest value of $$\Delta k_x$$ and $$\Delta k_y$$, being them the equidistances of the kx and ky arrays. Making it bigger gives more populated averages, and making it smaller lowers the ammount of points per ring (use it carefully).

Returns:

: 1D-array

Wavenumbers of each Radially Averaged Power Spectrum point. Also, the inner radius of the rings.

: 1D array

fatiando.gravmag.transform.reduce_to_pole(x, y, data, shape, inc, dec, sinc, sdec)[source]

Reduce total field magnetic anomaly data to the pole.

The reduction to the pole if a phase transformation that can be applied to total field magnetic anomaly data. It “simulates” how the data would be if both the Geomagnetic field and the magnetization of the source were vertical ($$90^\circ$$ inclination) (Blakely, 1996).

This functions performs the reduction in the frequency domain (using the FFT). The transform filter is (in the frequency domain):

$RTP(k_x, k_y) = \frac{|k|}{ a_1 k_x^2 + a_2 k_y^2 + a_3 k_x k_y + i|k|(b_1 k_x + b_2 k_y)}$

in which $$k_x$$ and $$k_y$$ are the wave-numbers in the x and y directions and

$\begin{split}|k| = \sqrt{k_x^2 + k_y^2} \\ a_1 = m_z f_z - m_x f_x \\ a_2 = m_z f_z - m_y f_y \\ a_3 = -m_y f_x - m_x f_y \\ b_1 = m_x f_z + m_z f_x \\ b_2 = m_y f_z + m_z f_y\end{split}$

$$\mathbf{m} = (m_x, m_y, m_z)$$ is the unit-vector of the total magnetization of the source and $$\mathbf{f} = (f_x, f_y, f_z)$$ is the unit-vector of the Geomagnetic field.

Note

Requires gridded data.

Warning

The magnetization direction of the anomaly source is crucial to the reduction-to-the-pole. Wrong values of *sinc* and *sdec* will lead to a wrong reduction.

Parameters:

• x, y
: 1d-arrays

The x, y, z coordinates of each data point.

• data
: 1d-array

The total field anomaly data at each point.

• shape
: tuple = (nx, ny)

The shape of the data grid

• inc, dec
: floats

The inclination and declination of the inducing Geomagnetic field

• sinc, sdec
: floats

The inclination and declination of the total magnetization of the anomaly source. The total magnetization is the vector sum of the induced and remanent magnetization. If there is only induced magnetization, use the inc and dec of the Geomagnetic field.

Returns:

• rtp
: 1d-array

The data reduced to the pole.

References:

Blakely, R. J. (1996), Potential Theory in Gravity and Magnetic Applications, Cambridge University Press.

fatiando.gravmag.transform.tga(x, y, data, shape, method='fd')[source]

Calculate the total gradient amplitude (TGA).

This the same as the 3D analytic signal of Roest et al. (1992), but we prefer the newer, more descriptive nomenclature suggested by Reid (2012).

The TGA is defined as the amplitude of the gradient vector of a potential field $$T$$ (e.g. the magnetic total field anomaly):

$TGA = \sqrt{ \left(\frac{\partial T}{\partial x}\right)^2 + \left(\frac{\partial T}{\partial y}\right)^2 + \left(\frac{\partial T}{\partial z}\right)^2 }$

Note

Requires gridded data.

Warning

If the data is not in SI units, the derivatives will be in strange units and so will the total gradient amplitude! I strongly recommend converting the data to SI before calculating the TGA is you need the gradient in Eotvos (use one of the unit conversion functions of fatiando.utils).

Parameters:

• x, y
: 1D-arrays

The x and y coordinates of the grid points

• data
: 1D-array

The potential field at the grid points

• shape
: tuple = (nx, ny)

The shape of the grid

• method
: string

The method used to calculate the horizontal derivatives. Options are: 'fd' for finite-difference (more stable) or 'fft' for the Fast Fourier Transform. The z derivative is always calculated by FFT.

Returns:

• tga
: 1D-array

The amplitude of the total gradient

References:

Reid, A. (2012), Forgotten truths, myths and sacred cows of Potential Fields Geophysics - II, in SEG Technical Program Expanded Abstracts 2012, pp. 1-3, Society of Exploration Geophysicists.

Roest, W., J. Verhoef, and M. Pilkington (1992), Magnetic interpretation using the 3-D analytic signal, GEOPHYSICS, 57(1), 116-125, doi:10.1190/1.1443174.

fatiando.gravmag.transform.tilt(x, y, data, shape, xderiv=None, yderiv=None, zderiv=None)[source]

Calculates the potential field tilt, as defined by Miller and Singh (1994)

$tilt(f) = tan^{-1}\left( \frac{ \frac{\partial T}{\partial z}}{ \sqrt{\frac{\partial T}{\partial x}^2 + \frac{\partial T}{\partial y}^2}} \right)$

When used on magnetic total field anomaly data, works best if the data is reduced to the pole.

It’s useful to plot the zero contour line of the tilt to represent possible outlines of the source bodies. Use matplotlib’s pyplot.contour or pyplot.tricontour for this.

Note

Requires gridded data if xderiv, yderiv and zderiv are not given.

Parameters:

• x, y
: 1D-arrays

The x and y coordinates of the grid points

• data
: 1D-array

The potential field at the grid points

• shape
: tuple = (nx, ny)

The shape of the grid. Ignored if xderiv, yderiv and zderiv are given.

• xderiv
: 1D-array or None

Optional. Values of the derivative in the x direction. If None, will calculated using the default options of derivx

• yderiv
: 1D-array or None

Optional. Values of the derivative in the y direction. If None, will calculated using the default options of derivy

• zderiv
: 1D-array or None

Optional. Values of the derivative in the z direction. If None, will calculated using the default options of derivz

Returns:

• tilt
: 1D-array

The tilt angle of the total field in radians.

References:

Miller, Hugh G, and Vijay Singh. 1994. “Potential Field Tilt — a New Concept for Location of Potential Field Sources.” Journal of Applied Geophysics 32 (2–3): 213-17. doi:10.1016/0926-9851(94)90022-1.

fatiando.gravmag.transform.upcontinue(x, y, data, shape, height)[source]

Upward continuation of potential field data.

Calculates the continuation through the Fast Fourier Transform in the wavenumber domain (Blakely, 1996):

$F\{h_{up}\} = F\{h\} e^{-\Delta z |k|}$

and then transformed back to the space domain. $$h_{up}$$ is the upward continue data, $$\Delta z$$ is the height increase, $$F$$ denotes the Fourier Transform, and $$|k|$$ is the wavenumber modulus.

Note

Requires gridded data.

Note

x, y, z and height should be in meters.

Note

It is not possible to get the FFT of a masked grid. The default fatiando.gridder.interp call using minimum curvature will not be suitable. Use extrapolate=True or algorithm='nearest' to get an unmasked grid.

Parameters:

• x, y
: 1D-arrays

The x and y coordinates of the grid points

• data
: 1D-array

The potential field at the grid points

• shape
: tuple = (nx, ny)

The shape of the grid

• height
: float

The height increase (delta z) in meters.

Returns:

• cont
: array

The upward continued data

References:

Blakely, R. J. (1996), Potential Theory in Gravity and Magnetic Applications, Cambridge University Press.