For more detailed output, see wmm2020_extract().

hdg_decl(
  lon,
  lat,
  year,
  height = 0,
  height_ref = c("geoid", "ellipsoid"),
  model = c("IGRF13", "WMM2020", "EMM2017")
)

hdg_true_from_magnetic(
  hdg,
  lon,
  lat,
  year,
  height = 0,
  height_ref = c("geoid", "ellipsoid"),
  model = c("IGRF13", "WMM2020", "EMM2017")
)

hdg_magnetic_from_true(
  hdg,
  lon,
  lat,
  year,
  height = 0,
  height_ref = c("geoid", "ellipsoid"),
  model = c("IGRF13", "WMM2020", "EMM2017")
)

Arguments

lon

Vectors of coordinates.

lat

Vectors of coordinates.

year

A decimal year (e.g., 2020.2120). The World Magnetic Model is valid between 2020.0 and 2025.0; the Enhanced Magnetic Model is valid between 2000.0 and 2022.0.

height

A height above the earth's surface (as approximated by the EGM9615 geoid) in kilometers. If height_ref is "ellipsoid", this is interpreted as the height above the WGS84 ellipsoid.

height_ref

One of geoid or ellipsoid.

model

One of IGRF13, WMM2020, or EMM2017.

hdg

A heading in degrees, where 0 is north, 90 is east, 180 is south, and 270 is west. Values outside the range [0-360) are coerced to this range using hdg_norm().

Value

A declination, true heading, or magnetic heading.

Examples

hdg_decl(-64, 45, year = 2021)
#> [1] -16.88586
hdg_true_from_magnetic(13.40, -64, 45, year = 2021)
#> [1] 356.5141
hdg_magnetic_from_true(356.51, -64, 45, year = 2021)
#> [1] 13.39586