Main Content

Visualize World Magnetic Model Contours for 2020 Epoch

This example shows how to visualize contour plots of the calculated values for the Earth's magnetic field using World Magnetic Model 2020 (WMM2020) overlaid on maps of the Earth.

The Mapping Toolbox™ is required to generate the maps of the Earth.

Generate Values for Earth's Magnetic Field

Calculate these values for the Earth magnetic field. To implement the World Magnetic Model 2020 (WMM2020), use the wrldmagm function.

  • 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 these 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 = '2020';
decimal_year = 2020;

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 2020 and decimal year 2020.

Assume zero height.

% height = 0;

Geodetic Longitude value in degrees to use for latitude sweep.

% geod_lon = -180:1:180;

Geodetic Latitude values in degrees to sweep.

% geod_lat = -89.5:.5:89.5;

Loop through longitude values for each array of latitudes -89.5:89.5.

% for lonIdx = size(geod_lon,2):-1:1
%     for latIdx = size(geod_lat,2):-1:1

To obtain magnetic parameters for each latitude and longitude value, use the wrldmagm function.

%     [xyz, h, dec, dip, f] = wrldmagm(height, geod_lat(latIdx),geod_lon(lonIdx), decimal_year, model_epoch);             

Store the results.

%     WMMResults(latIdx,1:7,lonIdx) = [xyz' h dec dip f];
%     
%     end
% end

Load the saved data in the MAT-file.

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

Read in the continent land areas for plot overlay using the 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 contains 3 axes objects. Hidden axes object 1 with title Epoch: 2020 Decyear: 2020 Contour interval: 1000 nT Red: Positive (north) Blue: Negative (south) Green: Zero (Agonic) Line contains 552 objects of type patch, line, text. Hidden axes object 2 with title North Polar Region contains 235 objects of type patch, line, text. Hidden axes object 3 with title South Polar Region contains 119 objects of type patch, line, text.

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 contains 3 axes objects. Hidden axes object 1 with title Epoch: 2020 Decyear: 2020 Contour interval: 1000 nT Red: Positive (east) Blue: Negative (west) Green: Zero (Agonic) Line contains 510 objects of type patch, line, text. Hidden axes object 2 with title North Polar Region contains 205 objects of type patch, line, text. Hidden axes object 3 with title South Polar Region contains 102 objects of type patch, line, text.

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 contains 3 axes objects. Hidden axes object 1 with title Epoch: 2020 Decyear: 2020 Contour interval: 2000 nT Red: Positive (down) Blue: Negative (up) Green: Zero (Agonic) Line contains 559 objects of type patch, line, text. Hidden axes object 2 with title North Polar Region contains 299 objects of type patch, line, text. Hidden axes object 3 with title South Polar Region contains 192 objects of type patch, line, text.

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 contains 3 axes objects. Hidden axes object 1 with title Epoch: 2020 Decyear: 2020 Contour interval: 1000 nT contains 533 objects of type patch, line, text. Hidden axes object 2 with title North Polar Region contains 216 objects of type patch, line, text. Hidden axes object 3 with title South Polar Region contains 103 objects of type patch, line, text.

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 contains 3 axes objects. Hidden axes object 1 with title Epoch: 2020 Decyear: 2020 Contour interval: 2 deg Red: Positive (east) Blue: Negative (west) Green: Zero (Agonic) Line contains 687 objects of type patch, line, text. Hidden axes object 2 with title North Polar Region contains 269 objects of type patch, line, text. Hidden axes object 3 with title South Polar Region contains 172 objects of type patch, line, text.

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 contains 3 axes objects. Hidden axes object 1 with title Epoch: 2020 Decyear: 2020 Contour interval: 4 deg Red: Positive (down) Blue: Negative (up) Green: Zero (Agonic) Line contains 532 objects of type patch, line, text. Hidden axes object 2 with title North Polar Region contains 357 objects of type patch, line, text. Hidden axes object 3 with title South Polar Region contains 150 objects of type patch, line, text.

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 contains 3 axes objects. Hidden axes object 1 with title Epoch: 2020 Decyear: 2020 Contour interval: 1000 nT contains 538 objects of type patch, line, text. Hidden axes object 2 with title North Polar Region contains 214 objects of type patch, line, text. Hidden axes object 3 with title South Polar Region contains 111 objects of type patch, line, text.

Figure 7: Total Intensity, F (nT)

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

See Also