-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeomag.h
81 lines (68 loc) · 2.57 KB
/
geomag.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef GEOMAG_H
#define GEOMAG_H
#ifdef __cplusplus
extern "C" {
#endif
/** Max number of models in a file */
#define MAXMOD 30
typedef enum {
kUnitsKilometers = 1,
kUnitsMeters = 2,
kUnitsFeet = 3
} Units;
typedef enum {
kCoordSysGeodetic = 1, /* WGS-84 */
kCoordSysGeocentric = 2
} CoordinateSystem;
typedef struct {
double d; /** Declination of the field from the
geographic north (deg). */
double i; /** Inclination of the field (deg). */
double h; /** */
double f; /** Total field intensity. */
double x; /** */
double y; /** */
double z; /** */
double ddot; /** Annual rate of change of declination. (arc-min/yr) */
double fdot; /** Annual rate of change of . */
double hdot; /** Annual rate of change of . */
double idot; /** Annual rate of change of inclination. (arc-min/yr). */
double xdot; /** Annual rate of change of . */
double ydot; /** Annual rate of change of . */
double zdot; /** Annual rate of change of . */
} BField;
#define MAXDEG 13
#define MAXCOEFF (MAXDEG*(MAXDEG+2)+1) /* index starts with 1!, (from old Fortran?) */
typedef struct {
char name[MAXMOD][9];
double epoch[MAXMOD]; /** epoch of model. */
double yrmin[MAXMOD]; /** Min year of model. */
double yrmax[MAXMOD]; /** Max year of model. */
double minyr; /** Min year of all models. */
double maxyr; /** Max year of all models. */
double altmin[MAXMOD]; /** Minimum height of each model. */
double altmax[MAXMOD]; /** Maximum height of each model. */
int nmodel; /** Number of models in file */
int max1[MAXMOD]; /** Main field coefficient. */
int max2[MAXMOD]; /** Secular variation coefficient. */
int max3[MAXMOD]; /** Acceleration coefficient. */
long irec_pos[MAXMOD]; /** Record counter for header */
double gh1[MAXMOD][MAXCOEFF]; /** Schmidt quasi-normal internal spherical harmonic coeff. */
double gh2[MAXMOD][MAXCOEFF]; /** Schmidt quasi-normal internal spherical harmonic coeff. */
} BFieldModel;
int get_field_components(BField *const bfield,
BFieldModel const*const model,
double alt,
const Units altUnits,
const CoordinateSystem coordSys,
const double latitude,
const double longitude,
const double sdate);
double julday(const int month, const int day, const int year);
#ifndef TARGET_EMBEDDED
int read_model(BFieldModel *const model, const char mdfile[]);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif