Module: GeomagnetismHeader

Defines

_POSIX_C_SOURCE
GEOMAGHEADER_H
READONLYMODE
MAXLINELENGTH
NOOFPARAMS
NOOFCOEFFICIENTS
_DEGREE_NOT_FOUND
CALCULATE_NUMTERMS(N)
INCL_ERROR_BASE
DECL_ERROR_OFFSET_BASE
F_ERROR_BASE
DECL_ERROR_SLOPE_BASE
WMM_ERROR_MULTIPLIER
IGRF_ERROR_MULTIPLIER
WMM_UNCERTAINTY_F
WMM_UNCERTAINTY_H
WMM_UNCERTAINTY_X
WMM_UNCERTAINTY_Y
WMM_UNCERTAINTY_Z
WMM_UNCERTAINTY_I
WMM_UNCERTAINTY_D_OFFSET
WMM_UNCERTAINTY_D_COEF
M_PI
RAD2DEG(rad)
DEG2RAD(deg)
ATanH(x)
TRUE
FALSE
MAG_PS_MIN_LAT_DEGREE
MAG_PS_MAX_LAT_DEGREE
MAG_UTM_MIN_LAT_DEGREE
MAG_UTM_MAX_LAT_DEGREE
MAG_GEO_POLE_TOLERANCE
MAG_USE_GEOID
LAT_BOUND_MIN
LAT_BOUND_MAX
LON_BOUND_MIN
LON_BOUND_MAX
ALT_BOUND_MIN
NO_ALT_MAX
USER_GAVE_UP
WGS84ON
MSLON
MODEL_RELEASE_DATE
VERSIONDATE_LARGE

Enums

enum MAGenum_Comp

Values:

enumerator DECLINATION
enumerator INCLINATION
enumerator HOR_INTENSITY
enumerator TOTAL_INTENSITY
enumerator X_COMPONENT
enumerator Y_COMPONENT
enumerator Z_COMPONENT
enumerator ALL
enum PARAMS

Values:

enumerator SHDF
enumerator MODELNAME
enumerator PUBLISHER
enumerator RELEASEDATE
enumerator DATACUTOFF
enumerator MODELSTARTYEAR
enumerator MODELENDYEAR
enumerator EPOCH
enumerator INTSTATICDEG
enumerator INTSECVARDEG
enumerator EXTSTATICDEG
enumerator EXTSECVARDEG
enumerator GEOMAGREFRAD
enumerator NORMALIZATION
enumerator SPATBASFUNC
enum COEFFICIENTS

Values:

enumerator IE
enumerator N
enumerator M
enumerator GNM
enumerator HNM
enumerator DGNM
enumerator DHNM
enum YYYYMMDD

Values:

enumerator YEAR
enumerator MONTH
enumerator DAY

Functions

int MAG_Geomag(MAGtype_Ellipsoid Ellip, MAGtype_CoordSpherical CoordSpherical, MAGtype_CoordGeodetic CoordGeodetic, MAGtype_MagneticModel *TimedMagneticModel, MAGtype_GeoMagneticElements *GeoMagneticElements)
void MAG_Gradient(MAGtype_Ellipsoid Ellip, MAGtype_CoordGeodetic CoordGeodetic, MAGtype_MagneticModel *TimedMagneticModel, MAGtype_Gradient *Gradient)
int MAG_robustReadMagneticModel_Large(char *filename, char *filenameSV, MAGtype_MagneticModel **MagneticModel)
int MAG_robustReadMagModels(char *filename, MAGtype_MagneticModel *(*magneticmodels)[1], int array_size)
int MAG_SetDefaults(MAGtype_Ellipsoid *Ellip, MAGtype_Geoid *Geoid)
void MAG_Error(int control)
int MAG_GetUserGrid(MAGtype_CoordGeodetic *minimum, MAGtype_CoordGeodetic *maximum, double *step_size, double *a_step_size, double *step_time, MAGtype_Date *StartDate, MAGtype_Date *EndDate, int *ElementOption, int *PrintOption, char *OutputFile, MAGtype_Geoid *Geoid)
int MAG_GetUserInput(MAGtype_MagneticModel *MagneticModel, MAGtype_Geoid *Geoid, MAGtype_CoordGeodetic *CoordGeodetic, MAGtype_Date *MagneticDate)
void MAG_PrintGradient(MAGtype_Gradient Gradient)
void MAG_PrintUserData(MAGtype_GeoMagneticElements GeomagElements, MAGtype_CoordGeodetic SpaceInput, MAGtype_Date TimeInput, MAGtype_MagneticModel *MagneticModel, MAGtype_Geoid *Geoid)
int MAG_ValidateDMSstring(char *input, int min, int max, char *Error)
int MAG_Warnings(int control, double value, MAGtype_MagneticModel *MagneticModel)
MAGtype_LegendreFunction *MAG_AllocateLegendreFunctionMemory(int NumTerms)
MAGtype_MagneticModel *MAG_AllocateModelMemory(int NumTerms)
MAGtype_SphericalHarmonicVariables *MAG_AllocateSphVarMemory(int nMax)
void MAG_AssignHeaderValues(MAGtype_MagneticModel *model, char values[][MAXLINELENGTH])
void MAG_AssignMagneticModelCoeffs(MAGtype_MagneticModel *Assignee, MAGtype_MagneticModel *Source, int nMax, int nMaxSecVar)
int MAG_FreeMemory(MAGtype_MagneticModel *MagneticModel, MAGtype_MagneticModel *TimedMagneticModel, MAGtype_LegendreFunction *LegendreFunction)
int MAG_FreeLegendreMemory(MAGtype_LegendreFunction *LegendreFunction)
int MAG_FreeMagneticModelMemory(MAGtype_MagneticModel *MagneticModel)
int MAG_FreeSphVarMemory(MAGtype_SphericalHarmonicVariables *SphVar)
void MAG_PrintWMMFormat(char *filename, MAGtype_MagneticModel *MagneticModel)
void MAG_PrintEMMFormat(char *filename, char *filenameSV, MAGtype_MagneticModel *MagneticModel)
void MAG_PrintSHDFFormat(char *filename, MAGtype_MagneticModel *(*MagneticModel)[1], int epochs)
int MAG_readMagneticModel(char *filename, MAGtype_MagneticModel *MagneticModel)
int MAG_readMagneticModel_Large(char *filename, char *filenameSV, MAGtype_MagneticModel *MagneticModel)
int MAG_readMagneticModel_SHDF(char *filename, MAGtype_MagneticModel *(*magneticmodels)[1], int array_size)
char *MAG_Trim(char *str)
void MAG_BaseErrors(double DeclCoef, double DeclBaseline, double InclOffset, double FOffset, double Multiplier, double H, double *DeclErr, double *InclErr, double *FErr)
int MAG_CalculateGeoMagneticElements(MAGtype_MagneticResults *MagneticResultsGeo, MAGtype_GeoMagneticElements *GeoMagneticElements)
void MAG_CalculateGradientElements(MAGtype_MagneticResults GradResults, MAGtype_GeoMagneticElements MagneticElements, MAGtype_GeoMagneticElements *GradElements)
int MAG_CalculateSecularVariationElements(MAGtype_MagneticResults MagneticVariation, MAGtype_GeoMagneticElements *MagneticElements)
int MAG_CalculateGridVariation(MAGtype_CoordGeodetic location, MAGtype_GeoMagneticElements *elements)
void MAG_CartesianToGeodetic(MAGtype_Ellipsoid Ellip, double x, double y, double z, MAGtype_CoordGeodetic *CoordGeodetic)
MAGtype_CoordGeodetic MAG_CoordGeodeticAssign(MAGtype_CoordGeodetic CoordGeodetic)
int MAG_DateToYear(MAGtype_Date *Calendar_Date, char *Error)
void MAG_DegreeToDMSstring(double DegreesOfArc, int UnitDepth, char *DMSstring)
void MAG_DMSstringToDegree(char *DMSstring, double *DegreesOfArc)
void MAG_ErrorCalc(MAGtype_GeoMagneticElements B, MAGtype_GeoMagneticElements *Errors)
int MAG_GeodeticToSpherical(MAGtype_Ellipsoid Ellip, MAGtype_CoordGeodetic CoordGeodetic, MAGtype_CoordSpherical *CoordSpherical)
MAGtype_GeoMagneticElements MAG_GeoMagneticElementsAssign(MAGtype_GeoMagneticElements Elements)
MAGtype_GeoMagneticElements MAG_GeoMagneticElementsScale(MAGtype_GeoMagneticElements Elements, double factor)
MAGtype_GeoMagneticElements MAG_GeoMagneticElementsSubtract(MAGtype_GeoMagneticElements minuend, MAGtype_GeoMagneticElements subtrahend)
int MAG_GetTransverseMercator(MAGtype_CoordGeodetic CoordGeodetic, MAGtype_UTMParameters *UTMParameters)
int MAG_GetUTMParameters(double Latitude, double Longitude, int *Zone, char *Hemisphere, double *CentralMeridian)
int MAG_isNaN(double d)
int MAG_RotateMagneticVector(MAGtype_CoordSpherical, MAGtype_CoordGeodetic CoordGeodetic, MAGtype_MagneticResults MagneticResultsSph, MAGtype_MagneticResults *MagneticResultsGeo)
void MAG_SphericalToCartesian(MAGtype_CoordSpherical CoordSpherical, double *x, double *y, double *z)
void MAG_SphericalToGeodetic(MAGtype_Ellipsoid Ellip, MAGtype_CoordSpherical CoordSpherical, MAGtype_CoordGeodetic *CoordGeodetic)
void MAG_TMfwd4(double Eps, double Epssq, double K0R4, double K0R4oa, double Acoeff[], double Lam0, double K0, double falseE, double falseN, int XYonly, double Lambda, double Phi, double *X, double *Y, double *pscale, double *CoM)
int MAG_YearToDate(MAGtype_Date *Date)
int MAG_AssociatedLegendreFunction(MAGtype_CoordSpherical CoordSpherical, int nMax, MAGtype_LegendreFunction *LegendreFunction)
int MAG_CheckGeographicPole(MAGtype_CoordGeodetic *CoordGeodetic)
int MAG_ComputeSphericalHarmonicVariables(MAGtype_Ellipsoid Ellip, MAGtype_CoordSpherical CoordSpherical, int nMax, MAGtype_SphericalHarmonicVariables *SphVariables)
void MAG_GradY(MAGtype_Ellipsoid Ellip, MAGtype_CoordSpherical CoordSpherical, MAGtype_CoordGeodetic CoordGeodetic, MAGtype_MagneticModel *TimedMagneticModel, MAGtype_GeoMagneticElements GeoMagneticElements, MAGtype_GeoMagneticElements *GradYElements)
void MAG_GradYSummation(MAGtype_LegendreFunction *LegendreFunction, MAGtype_MagneticModel *MagneticModel, MAGtype_SphericalHarmonicVariables SphVariables, MAGtype_CoordSpherical CoordSpherical, MAGtype_MagneticResults *GradY)
int MAG_PcupHigh(double *Pcup, double *dPcup, double x, int nMax)
int MAG_PcupLow(double *Pcup, double *dPcup, double x, int nMax)
int MAG_SecVarSummation(MAGtype_LegendreFunction *LegendreFunction, MAGtype_MagneticModel *MagneticModel, MAGtype_SphericalHarmonicVariables SphVariables, MAGtype_CoordSpherical CoordSpherical, MAGtype_MagneticResults *MagneticResults)
int MAG_SecVarSummationSpecial(MAGtype_MagneticModel *MagneticModel, MAGtype_SphericalHarmonicVariables SphVariables, MAGtype_CoordSpherical CoordSpherical, MAGtype_MagneticResults *MagneticResults)
int MAG_Summation(MAGtype_LegendreFunction *LegendreFunction, MAGtype_MagneticModel *MagneticModel, MAGtype_SphericalHarmonicVariables SphVariables, MAGtype_CoordSpherical CoordSpherical, MAGtype_MagneticResults *MagneticResults)
int MAG_SummationSpecial(MAGtype_MagneticModel *MagneticModel, MAGtype_SphericalHarmonicVariables SphVariables, MAGtype_CoordSpherical CoordSpherical, MAGtype_MagneticResults *MagneticResults)
int MAG_TimelyModifyMagneticModel(MAGtype_Date UserDate, MAGtype_MagneticModel *MagneticModel, MAGtype_MagneticModel *TimedMagneticModel)
int MAG_ConvertGeoidToEllipsoidHeight(MAGtype_CoordGeodetic *CoordGeodetic, MAGtype_Geoid *Geoid)
int MAG_GetGeoidHeight(double Latitude, double Longitude, double *DeltaHeight, MAGtype_Geoid *Geoid)
void MAG_EquivalentLatLon(double lat, double lon, double *repairedLat, double *repairedLon)
void MAG_WMMErrorCalc(double H, MAGtype_GeoMagneticElements *Uncertainty)
void MAG_PrintUserDataWithUncertainty(MAGtype_GeoMagneticElements GeomagElements, MAGtype_GeoMagneticElements Errors, MAGtype_CoordGeodetic SpaceInput, MAGtype_Date TimeInput, MAGtype_MagneticModel *MagneticModel, MAGtype_Geoid *Geoid)
void MAG_GetDeg(char *Query_String, double *latitude, double bounds[2])
int MAG_GetAltitude(char *Query_String, MAGtype_Geoid *Geoid, MAGtype_CoordGeodetic *coords, int bounds[2], int AltitudeSetting)
struct MAGtype_MagneticModel
#include <GeomagnetismHeader.h>

structure definition

Public Members

double EditionDate

variable

double epoch

Base time of Geomagnetic model epoch (yrs)

char ModelName[32]

variable

double *Main_Field_Coeff_G

C - Gauss coefficients of main geomagnetic model (nT) Index is (n * (n + 1) / 2 + m)

double *Main_Field_Coeff_H

C - Gauss coefficients of main geomagnetic model (nT)

double *Secular_Var_Coeff_G

CD - Gauss coefficients of secular geomagnetic model (nT/yr)

double *Secular_Var_Coeff_H

CD - Gauss coefficients of secular geomagnetic model (nT/yr)

int nMax

Maximum degree of spherical harmonic model

int nMaxSecVar

Maximum degree of spherical harmonic secular model

int SecularVariationUsed

Whether or not the magnetic secular variation vector will be needed by program

double CoefficientFileEndDate

variable

struct MAGtype_Ellipsoid
#include <GeomagnetismHeader.h>

structure definition

Public Members

double a

semi-major axis of the ellipsoid

double b

semi-minor axis of the ellipsoid

double fla

flattening

double epssq

first eccentricity squared

double eps

first eccentricity

double re

mean radius of ellipsoid

struct MAGtype_CoordGeodetic
#include <GeomagnetismHeader.h>

structure definition

Public Members

double lambda

longitude

double phi

geodetic latitude

double HeightAboveEllipsoid

height above the ellipsoid (HaE)

double HeightAboveGeoid

(height above the EGM96 geoid model )

int UseGeoid

variable

struct MAGtype_CoordSpherical
#include <GeomagnetismHeader.h>

structure definition

Public Members

double lambda

longitude

double phig

geocentric latitude

double r

distance from the center of the ellipsoid

struct MAGtype_Date
#include <GeomagnetismHeader.h>

structure definition

Public Members

int Year

variable

int Month

variable

int Day

variable

double DecimalYear

decimal years

struct MAGtype_LegendreFunction
#include <GeomagnetismHeader.h>

structure definition

Public Members

double *Pcup

Legendre Function

double *dPcup

Derivative of Legendre fcn

struct MAGtype_MagneticResults
#include <GeomagnetismHeader.h>

structure definition

Public Members

double Bx

North

double By

East

double Bz

Down

struct MAGtype_SphericalHarmonicVariables
#include <GeomagnetismHeader.h>

structure definition

Public Members

double *RelativeRadiusPower

[earth_reference_radius_km / sph. radius ]^n

double *cos_mlambda

cp(m) - cosine of (m*spherical coord. longitude)

double *sin_mlambda

sp(m) - sine of (m*spherical coord. longitude)

struct MAGtype_GeoMagneticElements
#include <GeomagnetismHeader.h>

structure definition

Public Members

double Decl

  1. Angle between the magnetic field vector and true north, positive east

double Incl

  1. Angle between the magnetic field vector and the horizontal plane, positive down

double F

  1. Magnetic Field Strength

double H

  1. Horizontal Magnetic Field Strength

double X

  1. Northern component of the magnetic field vector

double Y

  1. Eastern component of the magnetic field vector

double Z

  1. Downward component of the magnetic field vector

double GV

  1. The Grid Variation

double Decldot

  1. Yearly Rate of change in declination

double Incldot

  1. Yearly Rate of change in inclination

double Fdot

  1. Yearly rate of change in Magnetic field strength

double Hdot

  1. Yearly rate of change in horizontal field strength

double Xdot

  1. Yearly rate of change in the northern component

double Ydot

  1. Yearly rate of change in the eastern component

double Zdot

  1. Yearly rate of change in the downward component

double GVdot

  1. Yearly rate of change in grid variation

struct MAGtype_Geoid
#include <GeomagnetismHeader.h>

structure definition

Public Members

int NumbGeoidCols

360 degrees of longitude at 15 minute spacing

int NumbGeoidRows

180 degrees of latitude at 15 minute spacing

int NumbHeaderItems

min, max lat, min, max long, lat, long spacing

int ScaleFactor

4 grid cells per degree at 15 minute spacing

float *GeoidHeightBuffer

variable

int NumbGeoidElevs

variable

int Geoid_Initialized

indicates successful initialization

int UseGeoid

Is the Geoid being used?

struct MAGtype_Gradient
#include <GeomagnetismHeader.h>

structure definition

Public Members

int UseGradient

variable

MAGtype_GeoMagneticElements GradPhi

phi

MAGtype_GeoMagneticElements GradLambda

lambda

MAGtype_GeoMagneticElements GradZ

variable

struct MAGtype_CoordGeodeticStr
#include <GeomagnetismHeader.h>

structure definition

Public Members

char Longitude[40]

variable

char Latitude[40]

variable

struct MAGtype_UTMParameters
#include <GeomagnetismHeader.h>

structure definition

Public Members

double Easting

(X) in meters

double Northing

(Y) in meters

int Zone

UTM Zone

char HemiSphere

variable

double CentralMeridian

variable

double ConvergenceOfMeridians

variable

double PointScale

variable