Aerospace Toolbox

Visualizing World Magnetic Model Contours for 2010 Epoch

This example shows how to visualize contour plots of the calculated values for the Earth's magnetic field using World Magnetic Model 2010 (WMM-2010) overlaid on maps of the Earth. The Mapping Toolbox™ software is required to generate the maps of the Earth.

Generating Values for Earth's Magnetic Field

Calculate values for the Earth's magnetic field using wrldmagm function to implement the World Magnetic Model 2010 (WMM-2010):

  • X - North component of magnetic field vector in nanotesla (nT)

  • Y - East component of magnetic field vector in nanotesla (nT)

  • Z - Down component of magnetic field vector in nanotesla (nT)

  • H - Horizontal intensity in nanotesla (nT)

  • DEC - Declination in degrees

  • DIP - Inclination in degrees

  • F - Total intensity in nanotesla (nT)

Based on the wrldmagm inputs:

  • model_epoch - Epoch of WMM model.

  • decimal_year - Scalar value representing the decimal year within the epoch for which the data was generated.

model_epoch = '2010';
decimal_year = 2010;

For a given epoch and decimal year, use the following code to generate 13021 data points for calculating values of Earth's magnetic field using wrldmagm. To reduce overhead calculation, this model includes a mat-file that contains this data for epoch 2010 and decimal year 2010.

% % Assume zero height
% height = 0;
%
% % Geodetic Longitude value in degrees to use for latitude sweep.
% geod_lon = -180:1:180;      %degrees
%
% % Geodetic Latitude values to sweep.
% geod_lat = -90:.5:90;       %degrees
%
% % Loop through longitude values for each array of latitudes -90:90.
% for lonIdx = size(geod_lon,2):-1:1
%     for latIdx = size(geod_lat,2):-1:1
%
%     % Use WRLDMAGM function to obtain magnetic parameters for each lat/lon
%     % value.
%     [xyz, h, dec, dip, f] = wrldmagm(height, geod_lat(latIdx),geod_lon(lonIdx), decimal_year, model_epoch);
%
%     % Store results
%     WMMResults(latIdx,1:7,lonIdx) = [xyz' h dec dip f];
%
%     end
% end

Load data saved in mat-file.

WMMFileName = 'WMMResults_Epoch_2010_decyear_2010.mat';
load(WMMFileName);

Read in continent land areas for plot overlay using Mapping Toolbox function, shaperead.

landAreas = shaperead('landareas.shp','UseGeoCoords',true);

Plotting Earth's Magnetic Field Overlaid on Earth Maps

Load plot formatting data for each of the magnetic parameters.

plotWMM = load('astPlotWMM.mat');
hX = figure;
set(hX,'Position',[0 0 827 620],'Color','white')
astPlotWMMContours( WMMResults, plotWMM, 1, landAreas, geod_lat, geod_lon, decimal_year, model_epoch)

Figure 1: North Component of Magnetic Field Vector, X (nT)

hY = figure;
set(hY,'Position',[0 0 827 620],'Color','white')
astPlotWMMContours( WMMResults, plotWMM, 2, landAreas, geod_lat, geod_lon, decimal_year, model_epoch)

Figure 2: East Component of Magnetic Field Vector, Y (nT)

hZ = figure;
set(hZ,'Position',[0 0 827 620],'Color','white')
astPlotWMMContours( WMMResults, plotWMM, 3, landAreas, geod_lat, geod_lon, decimal_year, model_epoch)

Figure 3: Down Component of Magnetic Field Vector, Z (nT)

hH = figure;
set(hH,'Position',[0 0 827 620],'Color','white')
astPlotWMMContours( WMMResults, plotWMM, 4, landAreas, geod_lat, geod_lon, decimal_year, model_epoch)

Figure 4: Horizontal Intensity, H (nT)

hDEC = figure;
set(hDEC,'Position',[0 0 827 620],'Color','white')
astPlotWMMContours( WMMResults, plotWMM, 5, landAreas, geod_lat, geod_lon, decimal_year, model_epoch)

Figure 5: Declination, DEC (deg)

hDIP = figure;
set(hDIP,'Position',[0 0 827 620],'Color','white')
astPlotWMMContours( WMMResults, plotWMM, 6, landAreas, geod_lat, geod_lon, decimal_year, model_epoch)

Figure 6: Inclination, DIP (deg)

hF = figure;
set(hF,'Position',[0 0 827 620],'Color','white')
astPlotWMMContours( WMMResults, plotWMM, 7, landAreas, geod_lat, geod_lon, decimal_year, model_epoch)

Figure 7: Total Intensity, F (nT)

close (hX, hY, hZ, hH, hDEC, hDIP, hF)