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 A high-level class for spherical harmonic coefficients
SHGrid A high level-class for global grids
SHWindow A high-level class for localization windows
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

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?

To read the info string of an SHTOOLS constant, such as a_mars, enter

pyshtools.constant.a_mars.info()

Documentation for the Python functions used in SHTOOLS can also be accessed by their unix man pages, appending py to the name and using all lower case letters. As an example, to access the python MakeGridDH man page, use

man pymakegriddh

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

Edit me