Help for this page

Select Code to Download


  1. or download this
    # Magnetic declination calculation based on WMM2015 earth magnetism mo
    +del.
    # See https://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml
    ...
    # $yr: year, default=2015
    # Returns magnetic declination for the given location in degrees.
    # In array context, also returns magnetic inclination (dip).
    
  2. or download this
    BEGIN {
    my @WMM2015 = (
    ...
       my $incl = atan2($Z, sqrt($X*$X + $Y*$Y)) / $DEG2RAD;
       return ($decl, $incl);
    }}