| 1 | /* magfield.h -- compute local magnetic variation given position, | 
|---|
| 2 | **               altitude, and date | 
|---|
| 3 | ** | 
|---|
| 4 | ** This is an implementation of the NIMA WMM 2000 | 
|---|
| 5 | ** | 
|---|
| 6 | **    http://www.nima.mil/GandG/ngdc-wmm2000.html | 
|---|
| 7 | **    For WMM2000 coefficients: | 
|---|
| 8 | **    ftp://ftp.ngdc.noaa.gov/Solid_Earth/Mainfld_Mag/DoD_Model/wmm.cof | 
|---|
| 9 | **    For IGRF/DGRF coefficients: | 
|---|
| 10 | **    http://swdcdb.kugi.kyoto-u.ac.jp/igrf/coef/igrfall.d | 
|---|
| 11 | ** | 
|---|
| 12 | ** Copyright (C) 2000  Edward A Williams <Ed_Williams@compuserve.com> | 
|---|
| 13 | ** | 
|---|
| 14 | ** Adapted from Excel 3.0 version 3/27/94 EAW | 
|---|
| 15 | ** Recoded in C++ by Starry Chan | 
|---|
| 16 | ** WMM95 added and rearranged in ANSI-C EAW 7/9/95 | 
|---|
| 17 | ** Put shell around program and made Borland & GCC compatible EAW 11/22/95 | 
|---|
| 18 | ** IGRF95 added 2/96 EAW | 
|---|
| 19 | ** WMM2000 IGR2000 added 2/00 EAW | 
|---|
| 20 | ** Released under GPL 3/26/00 EAW | 
|---|
| 21 | ** Adaptions and modifications for the SimGear project  3/27/2000 CLO | 
|---|
| 22 | ** | 
|---|
| 23 | ** This program is free software; you can redistribute it and/or | 
|---|
| 24 | ** modify it under the terms of the GNU General Public License as | 
|---|
| 25 | ** published by the Free Software Foundation; either version 2 of the | 
|---|
| 26 | ** License, or (at your option) any later version. | 
|---|
| 27 | ** | 
|---|
| 28 | ** This program is distributed in the hope that it will be useful, but | 
|---|
| 29 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 30 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
|---|
| 31 | ** General Public License for more details. | 
|---|
| 32 | ** | 
|---|
| 33 | ** You should have received a copy of the GNU General Public License | 
|---|
| 34 | ** along with this program; if not, write to the Free Software | 
|---|
| 35 | ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 
|---|
| 36 | ** | 
|---|
| 37 | */ | 
|---|
| 38 | #ifndef MAGFIELD_H | 
|---|
| 39 | #define MAGFIELD_H | 
|---|
| 40 |  | 
|---|
| 41 | #ifdef __cplusplus | 
|---|
| 42 | extern "C" {  /* extern "C" */ | 
|---|
| 43 | #endif | 
|---|
| 44 |  | 
|---|
| 45 | /* Convert date to Julian day    1950-2049 */ | 
|---|
| 46 | unsigned long int yymmdd_to_julian_days( int yy, int mm, int dd ); | 
|---|
| 47 |  | 
|---|
| 48 | /* Convert degrees to radians */ | 
|---|
| 49 | double deg_to_rad( double deg ); | 
|---|
| 50 |  | 
|---|
| 51 | /* Convert radians to degrees */ | 
|---|
| 52 | double rad_to_deg( double rad ); | 
|---|
| 53 |  | 
|---|
| 54 | /* return variation (in radians) given geodetic latitude (radians), longitude | 
|---|
| 55 | (radians) ,height (km), (Julian) date and field model | 
|---|
| 56 | model=1 is IGRF90, 2 is WMM85, 3 is WMM90, 4 is WMM95, 5 is IGRF95, | 
|---|
| 57 | 6 is WMM2000, 7 is IGRF2000 | 
|---|
| 58 | N and E lat and long are positive, S and W negative | 
|---|
| 59 | */ | 
|---|
| 60 | double SGMagVar( double lat, double lon, double h, long dat, int model, double* field ); | 
|---|
| 61 |  | 
|---|
| 62 | #ifdef __cplusplus | 
|---|
| 63 | }             /* extern "C" */ | 
|---|
| 64 | #endif | 
|---|
| 65 |  | 
|---|
| 66 | #endif | 
|---|