wmm_grid.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <math.h>
00004 #include <stdlib.h>
00005 
00006 
00007 #include "GeomagnetismHeader.h"
00008 #include "EGM9615.h"
00009 //#include "GeomagnetismLibrary.c"
00010 
00011 /*
00012 
00013 
00014 WMM grid program.
00015 
00016 The Geomagnetism Library is used to make a command prompt program. The program prompts
00017 the user to enter a location, performs the computations and prints the results to the
00018 standard output. The program expects the files GeomagnetismLibrary.c, GeomagnetismHeader.h,
00019 WMM2010SHDF.COF and EGM9615.h to be in the same directory. 
00020 
00021 Manoj.C.Nair@Noaa.Gov
00022 April 21, 2011
00023  *  Revision Number: $Revision: 843 $
00024  *  Last changed by: $Author: awoods $
00025  *  Last changed on: $Date: 2012-04-25 16:23:56 -0600 (Wed, 25 Apr 2012) $
00026 
00027  */
00028 
00029 
00030 
00031 int main()
00032 {
00033     MAGtype_MagneticModel * MagneticModels[1];
00034     MAGtype_Ellipsoid Ellip;
00035     MAGtype_CoordGeodetic minimum, maximum;
00036     MAGtype_Geoid Geoid;
00037     MAGtype_Date startdate, enddate;
00038     int ElementOption, PrintOption, i, epochs = 1;
00039     double cord_step_size, altitude_step_size, time_step_size;
00040     char filename[] = "WMM.COF";
00041     char OutputFilename[32];
00042     char VersionDate_Large[] = "$Date: 2012-04-25 16:23:56 -0600 (Wed, 25 Apr 2012) $";
00043     char VersionDate[12];
00044 
00045     MAG_robustReadMagModels(filename, &MagneticModels, 1);
00046 
00047     strncpy(VersionDate, VersionDate_Large + 39, 11);
00048     VersionDate[11] = '\0';
00049 
00050     MAG_SetDefaults(&Ellip, &Geoid);
00051     //MAG_InitializeGeoid(&Geoid);
00052     /* Set EGM96 Geoid parameters */
00053     Geoid.GeoidHeightBuffer = GeoidHeightBuffer;
00054     Geoid.Geoid_Initialized = 1;
00055     /* Set EGM96 Geoid parameters END */
00056     //MAG_GeomagIntroduction_WMM(MagneticModels[0]);  /* Print out the WMM introduction */
00057     printf("\n\n Welcome to the World Magnetic Model (WMM) C-Program\nof the US National Geophysical Data Center\n\t\t--- Grid Calculation Program ----\n\t       --- Model Release Date: 15 Dec 2009 ---\n\t     --- Software Release Date: %s ---\n", VersionDate);
00058     printf("This program may be used to generate a grid/volume of magnetic field values\n");
00059     printf("over latitude, longitude, altitude and time axes. To skip an axis,\n");
00060     printf("keep the start and end values the same and enter zero for the step size.\n");
00061 
00062     printf("\n\n                     Enter grid parameters \n\n");
00063 
00064 
00065     /* Get the Lat/Long, Altitude, Time limits from a user interface and print the grid to screen */
00066 
00067     MAG_GetUserGrid(&minimum, &maximum, &cord_step_size, &altitude_step_size, &time_step_size, &startdate, &enddate, &ElementOption, &PrintOption, OutputFilename, &Geoid);
00068     MAG_Grid(minimum, maximum, cord_step_size, altitude_step_size, time_step_size, MagneticModels[0], &Geoid, Ellip, startdate, enddate, ElementOption, PrintOption, OutputFilename);
00069 
00070     for(i = 0; i < epochs; i++) MAG_FreeMagneticModelMemory(MagneticModels[i]);
00071 
00072 
00073 
00074 
00075     printf("\nPress any key to exit...\n");
00076     getchar();
00077 
00078     return 0;
00079 }


world_magnetic_model
Author(s): National Geophysical Data Center (NGDC, Boulder CO, USA), British Geological Survey (BGS, Edinburgh, Scotland)
autogenerated on Sat Jul 26 2014 07:02:19