harmonica.magnetic_vec_to_angles

harmonica.magnetic_vec_to_angles#

harmonica.magnetic_vec_to_angles(magnetic_e, magnetic_n, magnetic_u, degrees=True)[source]#

Convert magnetic field vector to magnetic field angles

Convert the 3-component magnetic vector to intensity, and inclination and declination angles.

Note

Inclination is measured positive downward from the horizontal plane and declination is measured with respect to North and it is positive east.

Parameters:
magnetic_efloat or array

Easting component of the magnetic vector.

magnetic_nfloat or array

Northing component of the magnetic vector.

magnetic_ufloat or array

Upward component of the magnetic vector.

degreesbool (optional)

If True, the angles are returned in degrees. If False, the angles are returned in radians. Default True.

Returns:
intensity: float or array

Intensity of the magnetic vector.

inclinationfloat or array

Inclination angle of the magnetic vector. If degrees is True, then the angle is returned in degree, else it’s returned in radians.

declinationfloat or array

Declination angle of the magnetic vector. If degrees is True, then the angle is returned in degrees, else it’s returned in radians.

Notes

The intensity of the magnetic vector is calculated as:

\[T = \sqrt{B_e^2 + B_n^2 + B_u^2}\]

where \(B_e\), \(B_n\), \(B_u\) are the easting, northing and upward components of the magnetic vector, respectively.

The inclination angle is defined as the angle between the magnetic field vector and the horizontal plane:

\[I = \arctan \frac{- B_u}{\sqrt{B_e^2 + B_n^2}}\]

And the declination angle is defined as the azimuth of the projection of the magnetic field vector onto the horizontal plane (starting from the northing direction, positive to the east and negative to the west):

\[D = \arcsin \frac{B_e}{\sqrt{B_e^2 + B_n^2}}\]

Examples

>>> intensity, inc, dec = magnetic_vec_to_angles(1.5, 1.5, -2.12132)
>>> print(intensity, inc, dec)
3.0 45.0 45.0