ladybug.north module¶
Module converting between magnetic and true North.
- class ladybug.north.WorldMagneticModel(cof_file=None)[source]¶
Bases:
object
World Magnetic Model (WMM) that can convert from magnetic to true North.
- Parameters:
cof_file – The full path to a .COF file containing the coefficients that form the inputs for the World Magnetic Model (WMM). A new set of coefficients is published roughly every 5 years as the magnetic poles continue to move. If None, coefficients will be derived from the WMM.COF file contained within this Python package, which should be for the most recent model. If not, the most recent coefficients are available at https://www.ncei.noaa.gov/products/world-magnetic-model/wmm-coefficients
- magnetic_declination(latitude=0, longitude=0, elevation=0, year=2025)[source]¶
Compute the magnetic declination using the World Magnetic Model (WMM).
Magnetic declination is the difference between magnetic North and true North at a given location on the globe (expressed in terms of degrees). The function here uses the same method that underlies the NOAA Magnetic Declination calculator.
- Parameters:
latitude – A number between -90 and 90 for the latitude of the location in degrees. (Default: 0 for the equator).
longitude – A number between -180 and 180 for the longitude of the location in degrees (Default: 0 for the prime meridian).
elevation – A number for elevation of the location in meters. (Default: 0).
year – A number for the year in which the magnetic declination is being evaluated. Decimal values are accepted. (Default: 2025).
- Returns:
A number for the magnetic declination in degrees.
- magnetic_to_true_north(location, magnetic_north=0, year=2025)[source]¶
Compute true North from a magnetic North vector.
- Parameters:
location – A Ladybug Location object that will be used to determine the magnetic declination.
magnetic_north – A number between -360 and 360 for the counterclockwise difference between the North and the positive Y-axis in degrees. 90 is West and 270 is East (Default: 0).
year – A number for the year in which the magnetic declination is being evaluated. Decimal values are accepted. (Default: 2025).
- Returns:
A number between -360 and 360 for the true North angle in degrees.