MATLAB script for 3D visualizing geodata on a rotating globe

We present a free Matlab package rotating_3d_globe.zip, with which you can produce your own 2D and 3D png images, animated gifs, videos or input files for 3D printers. The only prerequisite is to have the basic module of Matlab. Our idea was to offer the reader snippets of the Matlab code for "copy and paste" style of programming. In principle, any scalar data given on a grid of longitudes and latitudes can be visualized with this package. We provide the Matlab code and the data sets used in creating the presented images and animations.
For usage examples and a step-by-step tutorial, have a look at the package online manual.

The package is generally described in:

When using the package, please cite the paper published in Computers & geosciences.

Contents


Geoid height

Originally this package was developed for 3D visualizing the geoid height of new global gravity field models.
♣ Variations in geoid height are thousand times exaggerated ("Earth potato"), in reality the Earth's shape is very close to a sphere (for more details, see the reference paper).
♣ Clicking on each image displays it in your browser, clicking on the image title will take you to its Matlab code.
Geoid height on 3D globe
Geoid height as 2D map

Animation: rotating globe

GIF
WMV
High resolution image


Topography of Earth, Moon, Mars

Examples of using the package rotating_3d_globe.zip. With only the basic module of Matlab without any toolbox, one can produce 2D and 3D images of planetary topography using various colour scales and with surprising details (look at high resolution images below).
♣ The Moon in greyscale resembles to a photography, although here we visualize altitudes; the Moon does not have an atmosphere, obviously its altitudes correspond rather well to the colouring of its surface.
♣ See also http://en.wikipedia.org/wiki/Topography_of_the_Moon, http://en.wikipedia.org/wiki/Geography_of_Mars.
♣ Clicking on each image displays it in your browser, clicking on the image title will take you to its Matlab code.
Topography of Earth
Topography of the Moon
Topography of the Moon
Topography of Mars
2D map
2D map
2D map
2D map
GIF
WMV
GIF
WMV
GIF
WMV
GIF
WMV
Topography of Earth
(high resolution)

Topography of the Moon
(high resolution)

Topography of the Moon
(high resolution)

Topography of Mars
(high resolution)



Geoid height, gravity disturbance, gravity gradient

Examples of using this free Matlab package rotating_3d_globe.zip. From left to right, gradually increasing order of differentiation has the effect of amplifying the "waviness" in the quantities shown, which is particularly well illustrated in the 3D images. Here, geoid height is related to Earth gravity potential and gravity disturbance to the first derivative of the potential; and the displayed gravity gradient was computed as the second radial derivative of the disturbing potential. For precise definitions, see the reference paper.
♣ Clicking on each image displays it in your browser, clicking on the image title will take you to its Matlab code.
Geoid height
Gravity disturbance
Gravity gradient
2D map
2D map
2D map
GIF
WMV
GIF
WMV
GIF
WMV
Geoid height
(high resolution)

Gravity disturbance
(high resolution)

Gravity gradient
(high resolution)



Matlab scripts for all the examples

First download the package rotating_3d_globe.zip, unpack it and add it to your Matlab path. A step-by-step manual is included. This package contains also the data for the lower resolution images. For high resolution images, download data_high_resolution.zip (122 MB) separately.
♣ To create videos in compressed formats WMV, MP4, xvid AVI, download, install and add to your Matlab path: ffmpeg.

Geoid height on 3D globe

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height in 3D as PNG image
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,gh,'coastlines',1,...
      'exaggeration_factor',1.3e4,'radius',6378e3,'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'cptcmap_pm','BlueWhiteOrangeRed',...
      'preview_figure_visible',1,...
      'window_height',650);

Geoid height as 2D map

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height as 2D map
   [hc,htit,name_png]=elevation_2d_map(lond,latd,gh,'coastlines',1,...
      'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'cptcmap_pm','BlueWhiteOrangeRed',...
      'window_height',650);
%% Geoid height as 2D map (centred on the Pacific)
   [hc,htit,name_png]=elevation_2d_map(lond,latd,gh,'coastlines',1,...
      'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'cptcmap_pm','BlueWhiteOrangeRed',...
      'map_center','Pacific',...
      'window_height',650);

Animation: rotating globe as animated GIF

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height in 3D as animated GIF
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,gh,'coastlines',1,...
      'exaggeration_factor',1.3e4,'radius',6378e3,'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'cptcmap_pm','BlueWhiteOrangeRed',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'anim_gif',1,'anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Animation: rotating globe as WMV video

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height in 3D as WMV video
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,gh,'coastlines',1,...
      'exaggeration_factor',1.3e4,'radius',6378e3,'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'cptcmap_pm','BlueWhiteOrangeRed',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'video_format','wmv','anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Geoid height on 3D globe: high resolution image

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=1000;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height in 3D as PNG image (high resolution)
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,gh,'coastlines',1,...
      'exaggeration_factor',1.3e4,'radius',6378e3,'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'cptcmap_pm','BlueWhiteOrangeRed',...
      'font_size',18,...
      'window_height',3000);

Topography of Earth

%% Selection of Earth topographical data
model='ETOPO2_010arcmin';
fprintf('Loading Earth data: %s\n',model);
load (model);

%% Earth topography in 3D as PNG image
   [hc,hlab,name_png]=rotating_3d_globe(lond_etopo2,latd_etopo2,elev_etopo2_km,'coastlines',0,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Earth topography (%s)',model),...
      'clbr_limits',[-10 10],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_globe',...
      'preview_figure_visible',1,...
      'window_height',650);

Earth topography as 2D map

%% Selection of Earth topographical data
model='ETOPO2_010arcmin';
fprintf('Loading Earth data: %s\n',model);
load (model);

%% Earth topography as 2D map
   [hc,htit,name_png]=elevation_2d_map(lond_etopo2,latd_etopo2,elev_etopo2_km,'coastlines',1,...
      'units','km',...
      'graph_label',sprintf('Earth topography (%s)',model),...
      'clbr_limits',[-10 10],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_globe',...
      'preview_figure_visible',1,...
      'window_height',650);
%% Earth topography as 2D map (centred on the Pacific)
   [hc,htit,name_png]=elevation_2d_map(lond_etopo2,latd_etopo2,elev_etopo2_km,'coastlines',1,...
      'units','km',...
      'graph_label',sprintf('Earth topography (%s)',model),...
      'clbr_limits',[-10 10],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_globe',...
      'map_center','Pacific',...
      'window_height',650);

Animation: rotating globe as animated GIF

%% Selection of Earth topographical data
model='ETOPO2_010arcmin';
fprintf('Loading Earth data: %s\n',model);
load (model);

%% Earth topography in 3D as animated GIF
   [hc,hlab,name_png]=rotating_3d_globe(lond_etopo2,latd_etopo2,elev_etopo2_km,'coastlines',0,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Earth topography (%s)',model),...
      'clbr_limits',[-10 10],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_globe',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'anim_gif',1,'anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Animation: rotating globe as WMV video

%% Selection of Earth topographical data
model='ETOPO2_010arcmin';
fprintf('Loading Earth data: %s\n',model);
load (model);

%% Earth topography in 3D as WMV video
   [hc,hlab,name_png]=rotating_3d_globe(lond_etopo2,latd_etopo2,elev_etopo2_km,'coastlines',0,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Earth topography (%s)',model),...
      'clbr_limits',[-10 10],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_globe',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'video_format','wmv','anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Topography of Earth: high resolution image

%% Selection of Earth topographical data
   if exist('ETOPO2_004arcmin.mat','file')
      model='ETOPO2_004arcmin';  % RAM of 4 GB is necessary
   else
      model='ETOPO2_010arcmin';
   end
   fprintf('Loading Earth data: %s\n',model);
   load (model);

%% Earth topography in 3D as PNG image (high resolution)
   [hc,hlab,name_png]=rotating_3d_globe(lond_etopo2,latd_etopo2,elev_etopo2_km,'coastlines',0,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Earth topography (%s)',model),...
      'clbr_limits',[-10 10],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_globe',...
      'preview_figure_visible',1,...
      'font_size',18,...
      'window_height',3000);

Topography of Moon

%% Selection of Moon topographical data
model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Moon data: %s\n',model);
load (model);

%% Moon topography in 3D as PNG image
   [hc,hlab,name_png]=rotating_3d_globe(lond_moon,latd_moon,elev_moon_km,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'azimuth',90,'elevation',0,...
      'preview_figure_visible',1,...
      'window_height',650);

Moon topography as 2D map

%% Selection of Moon topographical data
model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Moon data: %s\n',model);
load (model);

%% Moon topography as 2D map
   [hc,htit,name_png]=elevation_2d_map(lond_moon,latd_moon,elev_moon_km,...
      'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'preview_figure_visible',1,...
      'window_height',650);

Animation: rotating globe as animated GIF

%% Selection of Moon topographical data
model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Moon data: %s\n',model);
load (model);

%% Moon topography in 3D as animated GIF
   [hc,hlab,name_png]=rotating_3d_globe(lond_moon,latd_moon,elev_moon_km,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'azimuth',90,'elevation',0,...
      'preview_figure_visible',1,'clbr_anim',1,...
      'anim_gif',1,'anim_angle',360,'time_for_360deg',4,'fps',.5,...
      'window_height',650);

Animation: rotating globe as WMV video

%% Selection of Moon topographical data
model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Moon data: %s\n',model);
load (model);

%% Moon topography in 3D as WMV video
   [hc,hlab,name_png]=rotating_3d_globe(lond_moon,latd_moon,elev_moon_km,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'azimuth',90,'elevation',0,...
      'preview_figure_visible',1,'clbr_anim',1,...
      'video_format','wmv','anim_angle',360,'time_for_360deg',4,'fps',.5,...
      'window_height',650);

Topography of Moon: high resolution image

%% Selection of Moon topographical data
   if exist('LOLA_16.mat','file')
      model='LOLA_16';  %resolution: 1/16 degree = 3.75 arcmin; RAM of 4 GB is necessary
   else
      model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
   end
   fprintf('Loading Moon data: %s\n',model);
   load (model);

%% Moon topography in 3D as PNG image (high resolution)
   [hc,hlab,name_png]=rotating_3d_globe(lond_moon,latd_moon,elev_moon_km,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'azimuth',90,'elevation',0,...
      'preview_figure_visible',1,...
      'font_size',18,...
      'window_height',3000);

Topography of Moon

%% Selection of Moon topographical data
model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Moon data: %s\n',model);
load (model);

%% Moon topography in 3D as PNG image
   [hc,hlab,name_png]=rotating_3d_globe(lond_moon,latd_moon,elev_moon_km,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'clrmap','gray',...
      'azimuth',90,'elevation',0,...
      'preview_figure_visible',1,...
      'window_height',650);

Moon topography as 2D map

%% Selection of Moon topographical data
model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Moon data: %s\n',model);
load (model);

%% Moon topography as 2D map
   [hc,htit,name_png]=elevation_2d_map(lond_moon,latd_moon,elev_moon_km,...
      'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'clrmap','gray',...
      'preview_figure_visible',1,...
      'window_height',650);

Animation: rotating globe as animated GIF

%% Selection of Moon topographical data
model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Moon data: %s\n',model);
load (model);

%% Moon topography in 3D as animated GIF
   [hc,hlab,name_png]=rotating_3d_globe(lond_moon,latd_moon,elev_moon_km,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'clrmap','gray',...
      'azimuth',90,'elevation',0,...
      'preview_figure_visible',1,'clbr_anim',1,...
      'anim_gif',1,'anim_angle',360,'time_for_360deg',4,'fps',.5,...
      'window_height',650);

Animation: rotating globe as WMV video

%% Selection of Moon topographical data
model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Moon data: %s\n',model);
load (model);

%% Moon topography in 3D as WMV video
   [hc,hlab,name_png]=rotating_3d_globe(lond_moon,latd_moon,elev_moon_km,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'clrmap','gray',...
      'azimuth',90,'elevation',0,...
      'preview_figure_visible',1,'clbr_anim',1,...
      'video_format','wmv','anim_angle',360,'time_for_360deg',4,'fps',.5,...
      'window_height',650);

Topography of Moon: high resolution image

%% Selection of Moon topographical data
   if exist('LOLA_16.mat','file')
      model='LOLA_16';  %resolution: 1/16 degree = 3.75 arcmin; RAM of 4 GB is necessary
   else
      model='LOLA_04';  %resolution: 1/4 degree = 15 arcmin
   end
   fprintf('Loading Moon data: %s\n',model);
   load (model);

%% Moon topography in 3D as PNG image (high resolution)
   [hc,hlab,name_png]=rotating_3d_globe(lond_moon,latd_moon,elev_moon_km,...
      'exaggeration_factor',13,'radius',6378,'units','km',...
      'graph_label',sprintf('Moon topography (%s)',model),...
      'clbr_limits',[-6 7],'clbr_tick',-10:10,...
      'clrmap','gray',...
      'azimuth',90,'elevation',0,...
      'preview_figure_visible',1,...
      'font_size',18,...
      'window_height',3000);

Topography of Mars

%% Selection of Mars topographical data
model='MOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Mars data: %s\n',model);
load (model);

%% Mars topography in 3D as PNG image
   [hc,hlab,name_png]=rotating_3d_globe(lond_Mars,latd_Mars,elev_Mars_km,...
      'exaggeration_factor',10,'radius',3400,'units','km',...
      'graph_label',sprintf('Mars topography (%s)',model),...
      'clbr_limits',[-8 8],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'azimuth',10,'elevation',0,...
      'preview_figure_visible',1,...
      'window_height',650);

Mars topography as 2D map

%% Selection of Mars topographical data
model='MOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Mars data: %s\n',model);
load (model);

%% Mars topography as 2D map
   [hc,htit,name_png]=elevation_2d_map(lond_Mars,latd_Mars,elev_Mars_km,...
      'units','km',...
      'graph_label',sprintf('Mars topography (%s)',model),...
      'clbr_limits',[-8 8],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'preview_figure_visible',1,...
      'window_height',650);

Animation: rotating globe as animated GIF

%% Selection of Mars topographical data
model='MOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Mars data: %s\n',model);
load (model);

%% Mars topography in 3D as animated GIF
   [hc,hlab,name_png]=rotating_3d_globe(lond_Mars,latd_Mars,elev_Mars_km,...
      'exaggeration_factor',10,'radius',3400,'units','km',...
      'graph_label',sprintf('Mars topography (%s)',model),...
      'clbr_limits',[-8 8],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'azimuth',10,'elevation',0,...
      'preview_figure_visible',1,'clbr_anim',1,...
      'anim_gif',1,'anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Animation: rotating globe as WMV video

%% Selection of Mars topographical data
model='MOLA_04';  %resolution: 1/4 degree = 15 arcmin
fprintf('Loading Mars data: %s\n',model);
load (model);

%% Mars topography in 3D as WMV video
   [hc,hlab,name_png]=rotating_3d_globe(lond_Mars,latd_Mars,elev_Mars_km,...
      'exaggeration_factor',10,'radius',3400,'units','km',...
      'graph_label',sprintf('Mars topography (%s)',model),...
      'clbr_limits',[-8 8],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'azimuth',10,'elevation',0,...
      'preview_figure_visible',1,'clbr_anim',1,...
      'video_format','wmv','anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Topography of Mars: high resolution image

%% Selection of Mars topographical data
   if exist('MOLA_16.mat','file')
      model='MOLA_16';  %resolution: 1/16 degree = 3.75 arcmin; RAM of 4 GB is necessary
   else
      model='MOLA_04';  %resolution: 1/4 degree = 15 arcmin
   end
   fprintf('Loading Mars data: %s\n',model);
   load (model);

%% Mars topography in 3D as PNG image (high resolution)
   [hc,hlab,name_png]=rotating_3d_globe(lond_Mars,latd_Mars,elev_Mars_km,...
      'exaggeration_factor',10,'radius',3400,'units','km',...
      'graph_label',sprintf('Mars topography (%s)',model),...
      'clbr_limits',[-8 8],'clbr_tick',-10:2:10,...
      'cptcmap_pm','GMT_wysiwygcont',...
      'azimuth',10,'elevation',0,...
      'preview_figure_visible',1,...
      'font_size',18,...
      'window_height',3000);

Geoid height on 3D globe

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height in 3D as PNG image
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,gh,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3/4,'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,...
      'window_height',650);

Geoid height as 2D map

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height as 2D map
   [hc,htit,name_png]=elevation_2d_map(lond,latd,gh,'coastlines',1,...
      'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'clrmap','clrmap_byr1',...
      'window_height',650);
%% Geoid height as 2D map (centred on the Pacific)
   [hc,htit,name_png]=elevation_2d_map(lond,latd,gh,'coastlines',1,...
      'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'clrmap','clrmap_byr1',...
      'map_center','Pacific',...
      'window_height',650);

Animation: rotating globe as animated GIF

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height in 3D as animated GIF
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,gh,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3/4,'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'anim_gif',1,'anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Animation: rotating globe as WMV video

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height in 3D as WMV video
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,gh,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3/4,'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'video_format','wmv','anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Geoid height on 3D globe: high resolution image

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=1000;
% Computation of grid for the selected geopotential functional
[lond,latd,gh]=compute_geopot_grids(model,nmax,'functional','gh');

%% Geoid height in 3D as PNG image (high resolution)
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,gh,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3/4,'units','m',...
      'graph_label',sprintf('Geoid height (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-90 90],'clbr_tick',-100:20:100,...
      'clrmap','clrmap_byr1',...
      'font_size',18,...
      'window_height',3000);

Gravity disturbance on 3D globe

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,grav_disturb]=compute_geopot_grids(model,nmax,'functional','gd');
grav_disturb_mgal=grav_disturb*1e5;

%% Gravity disturbance in 3D as PNG image
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,grav_disturb_mgal,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3,'units','mGal',...
      'graph_label',sprintf('Gravity disturbance (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-200 200],'clbr_tick',-500:50:500,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,...
      'window_height',650);

Gravity disturbance as 2D map

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,grav_disturb]=compute_geopot_grids(model,nmax,'functional','gd');
grav_disturb_mgal=grav_disturb*1e5;

%% Gravity disturbance as 2D map
   [hc,htit,name_png]=elevation_2d_map(lond,latd,grav_disturb_mgal,'coastlines',1,...
      'units','m',...
      'graph_label',sprintf('Gravity disturbance (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-200 200],'clbr_tick',-500:50:500,...
      'clrmap','clrmap_byr1',...
      'window_height',650);
%% Gravity disturbance as 2D map (centred on the Pacific)
   [hc,htit,name_png]=elevation_2d_map(lond,latd,grav_disturb_mgal,'coastlines',1,...
      'units','m',...
      'graph_label',sprintf('Gravity disturbance (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-200 200],'clbr_tick',-500:50:500,...
      'clrmap','clrmap_byr1',...
      'map_center','Pacific',...
      'preview_figure_visible',1,...
      'window_height',650);

Animation: rotating globe as animated GIF

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,grav_disturb]=compute_geopot_grids(model,nmax,'functional','gd');
grav_disturb_mgal=grav_disturb*1e5;

%% Gravity disturbance in 3D as animated GIF
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,grav_disturb_mgal,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3,'units','mGal',...
      'graph_label',sprintf('Gravity disturbance (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-200 200],'clbr_tick',-500:50:500,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'anim_gif',1,'anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Animation: rotating globe as WMV video

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,grav_disturb]=compute_geopot_grids(model,nmax,'functional','gd');
grav_disturb_mgal=grav_disturb*1e5;

%% Gravity disturbance in 3D as WMV video
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,grav_disturb_mgal,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3,'units','mGal',...
      'graph_label',sprintf('Gravity disturbance (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-200 200],'clbr_tick',-500:50:500,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'video_format','wmv','anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Gravity disturbance on 3D globe: high resolution image

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=1000;
% Computation of grid for the selected geopotential functional
[lond,latd,grav_disturb]=compute_geopot_grids(model,nmax,'functional','gd');
grav_disturb_mgal=grav_disturb*1e5;

%% Gravity disturbance in 3D as PNG image (high resolution)
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,grav_disturb_mgal,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3,'units','mGal',...
      'graph_label',sprintf('Gravity disturbance (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-200 200],'clbr_tick',-500:50:500,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,...
      'font_size',18,...
      'window_height',3000);

Gravity gradient on 3D globe

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,Trr]=compute_geopot_grids(model,nmax,'functional','Trr');
Trr_E=Trr*1e9;

%% Gravity gradient in 3D as PNG image
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,Trr_E,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3/4,'units','E',...
      'graph_label',sprintf('Gravity gradient (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-50 50],'clbr_tick',-500:10:500,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,...
      'window_height',650);

Gravity gradient as 2D map

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,Trr]=compute_geopot_grids(model,nmax,'functional','Trr');
Trr_E=Trr*1e9;

%% Gravity gradient as 2D map
   [hc,htit,name_png]=elevation_2d_map(lond,latd,Trr_E,'coastlines',1,...
      'units','E',...
      'graph_label',sprintf('Gravity gradient (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-50 50],'clbr_tick',-500:10:500,...
      'clrmap','clrmap_byr1',...
      'window_height',650);
%% Gravity gradient as 2D map (centred on the Pacific)
   [hc,htit,name_png]=elevation_2d_map(lond,latd,Trr_E,'coastlines',1,...
      'units','E',...
      'graph_label',sprintf('Gravity gradient (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-50 50],'clbr_tick',-500:10:500,...
      'clrmap','clrmap_byr1',...
      'map_center','Pacific',...
      'window_height',650);

Animation: rotating globe as animated GIF

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,Trr]=compute_geopot_grids(model,nmax,'functional','Trr');
Trr_E=Trr*1e9;

%% Gravity gradient in 3D as animated GIF
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,Trr_E,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3/4,'units','E',...
      'graph_label',sprintf('Gravity gradient (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-50 50],'clbr_tick',-500:10:500,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'anim_gif',1,'anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Animation: rotating globe as WMV video

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=500;
% Computation of grid for the selected geopotential functional
[lond,latd,Trr]=compute_geopot_grids(model,nmax,'functional','Trr');
Trr_E=Trr*1e9;

%% Gravity gradient in 3D as WMV video
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,Trr_E,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3/4,'units','E',...
      'graph_label',sprintf('Gravity gradient (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-50 50],'clbr_tick',-500:10:500,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,'clbr_anim',1,...
      'video_format','wmv','anim_angle',360,'time_for_360deg',42,'fps',1,...
      'window_height',650);

Gravity gradient on 3D globe: high resolution image

%% Selection of geopotential model and computation/loading of the grid values
model='egm2008';  %nmax=2190
nmax=1000;
% Computation of grid for the selected geopotential functional
[lond,latd,Trr]=compute_geopot_grids(model,nmax,'functional','Trr');
Trr_E=Trr*1e9;

%% Gravity gradient in 3D as PNG image (high resolution)
   [hc,hlab,name_png]=rotating_3d_globe(lond,latd,Trr_E,'coastlines',1,...
      'exaggeration_factor',1,'radius',5e3/4,'units','E',...
      'graph_label',sprintf('Gravity gradient (%s, nmax=%d)',upper(model),nmax),...
      'clbr_limits',[-50 50],'clbr_tick',-500:10:500,...
      'clrmap','clrmap_byr1',...
      'preview_figure_visible',1,...
      'font_size',18,...
      'window_height',3000);


Data sets for all the examples

Data sets of low resolution are already in the package itself: rotating_3d_globe.zip (33 MB).
Data for the displayed high resolution images: data_high_resolution.zip (122 MB)

Changing image/animation properties, optional parameters

As noted above, any elevation data set given on a grid of longitudes and latitudes can be visualized with this package. Please use a step-by-step manual, which is also included in the package itself: rotating_3d_globe.zip.

Links to external packages and data sets

Matlab package Color Palette Tables (.cpt) for Matlab by Kelly Kearney for easy use of various color scales.
To convert Matlab uncompressed videos to compressed formats WMV, MP4, xvid AVI, download, install and add to your Matlab path: ffmpeg.
For producing 2D elevation maps (only as a check, not needed in our 3D visualization function): M_Map: A mapping package for Matlab.
To draw coastlines and country boundaries, we used data from http://www.naturalearthdata.com/.

Go to top


Up to Aleš Bezděk: Research

Any comments or questions will be appreciated – if you have some, please contact: Aleš Bezděk <>.

Last modified: 30 June 2022 15:46:56.