To use SHTOOLS in Python, it is only necessary to import the pyshtools module.

The pyshtools module

To use SHTOOLS in Python, it is only necessary to execute this statement in the Python environment

import pyshtools

This will load the following three classes and subpackages into the pyshtools namespace:

Class Description
SHCoeffs Class for spherical harmonic coefficients
SHGrid Class for global grids
SHWindow Class for localization windows
SHGravCoeffs Class for gravitational potential spherical harmonic coefficients.
SHGravGrid Class for global gridded gravitational field data.
SHGravTensor Class for the gravity tensor and eigenvalues.
SHGeoid Class for the geoid.
Subpackage Description
shclasses All pyshtools classes and subclasses
shtools All Python wrapped Fortran 95 routines
legendre Legendre functions
expand Spherical harmonic expansion routines
shio Spherical harmonic I/O, storage, and conversion routines
spectralanalysis Global and localized spectral analysis routines
rotate Spherical harmonic rotation routines
gravmag Gravity and magnetics routines
constant pyshtools constants
utils Utilities

To use the pyshtools matplotlib style parameters for publication quality graphics, input

pyshtools.utils.figstyle()

This function takes optional parameters for specifying the screen resolution, the relative width of the figure, the physical width of the journal page in inches, and the aspect ratio of the figure.

If you are using iPython, which adds improved functionality to Python, the available pyshtools routines can be explored by typing

pyshtools.[tab]

where [tab] is the tab key.

Documentation

To read the documentation of a routine in iPython, such as MakeGridDH, enter

pyshtools.expand.MakeGridDH?

Alternatively, the documentation can be accessed from the Python components menu item on this web site.

The constant subpackage defines physical constants related to the gravity, topography, and magnetic field of the terrestrial planets. Each of these is an instance of an astropy Constant class, which has the attributes name, value, uncertainty, unit, and reference. To see all information about an individual constant, enter

print(pyshtools.constant.r_mars)
Edit me