Skip to content

Commit

Permalink
Add property geodetic_vector to class WMM.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayitzin committed Sep 14, 2023
1 parent c77f350 commit a887d95
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ahrs/utils/wmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,3 +881,19 @@ def magnetic_elements(self) -> Dict[str, float]:
'D': -9.73078560629778, 'GV': -9.73078560629778}
"""
return {k: self.__dict__[k] for k in ['X', 'Y', 'Z', 'H', 'F', 'I', 'D', 'GV']}

@property
def geodetic_vector(self) -> np.ndarray:
"""
Magnetic field vector in geodetic coordinates
The magnetic field vector is returned as a 3D vector in geodetic
coordinates.
Example
-------
>>> wmm = WMM(datetime.date(2017, 5, 12), latitude=10.0, longitude=-20.0, height=10.5)
>>> wmm.geodetic_vector
array([ 30499.64046961, -5230.26715847, -1716.63331136])
"""
return np.array([self.X, self.Y, self.Z])

0 comments on commit a887d95

Please sign in to comment.