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

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

import pyshtools as pysh

This will load the following classes and subpackages into the pysh namespace:

Class Description
SHCoeffs Class for spherical harmonic coefficients
SHGrid Class for global grids
SHWindow Class for localization windows
Slepian Class for Slepian functions
SHGravCoeffs Class for gravitational potential spherical harmonic coefficients
SHMagCoeffs Class for magnetic potential spherical harmonic coefficients
Subpackage Description
shclasses All classes and subclasses
constants Planetary constants
datasets Gravity, topography and magnetic field datasets
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
utils Utilities
shtools All Python wrapped Fortran 95 routines

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


where [tab] is the tab key.

To read the documentation of a routine in iPython, such as the expand() method of the SHCoeffs class, enter


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


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.

Edit me