Package: pyshtools
SHTOOLS/pyshtools is a Fortran-95/Python library that can be used for spherical harmonic transforms, multitaper spectral analyses, expansions of gridded data into Slepian basis functions, standard operations on global gravitational and magnetic field data.TABLE OF CONTENTSFEATURESHOW TO USEINSTALLATIONpyshtools (for Python)Install usingcondaInstall usingpipFor DevelopersSHTOOLS (for Fortran 95)Install using thebrewpackage manager (MacOS, Linux, Windows)Install using themacportspackage manager (MacOS)Install from sourceCONTRIBUTINGMAINTAINERS AND CONTRIBUTORSLICENSEREFERENCESFEATURESSupports all standard normalizations and phase conventions of the spherical harmonic functions.Effortless conversion between real and complex harmonics, and between different normalization and phase conventions.Use of both regularly sampled geographic grids and grids appropriate for Gauss-Legendre quadrature.Spherical harmonic transforms proven to be accurate up to about degree 2800 for the native Fortran 95 backend and beyond using theDUCC0backend.Perform localized multitaper spectral analyses, or expand gridded data in terms of localized Slepian basis functions.Support for standard data and file formats, includingxarrayandnetcdf.Import research-grade gravity, topography, and magnetic field datasets with a single command.Creation of publication quality maps usingCartopyandPyGMT.Support multithreaded programming using theOpenMPAPI.HOW TO USEA variety of Python tutorials and guides are available to explain the main library features. To get started, click on the following Python tutorials and run them interactively in Binder:Spherical harmonic coefficients and gridsLocalization windows and spectral analysisGravity and magnetic fieldsPlotting mapsINSTALLATIONSHTOOLS can be invoked in any Fortran 95 or Python program. The core software is written in Fortran 95, and Python wrappers and dedicated classes allow simple access to the fortran-compiled routines. To install it, run these commands below:pyshtools (for Python)Install usingconda:condainstall-cconda-forgepyshtools
condaupdate-cconda-forgepyshtools# to upgrade a pre-existing installationInstall usingpip:pipinstallpyshtools
pipinstall--upgradepyshtools# to upgrade a pre-existing installationpipinstallpyshtools--no-binarypyshtools# build from sourcepipinstallgit+https://github.com/SHTOOLS/SHTOOLS@develop# install the develop branch from sourceFor developers:Install the system level build requirements:sudoapt-getinstallbuild-essentialcmakegfortran# Debian, Ubuntu and derivativessudodnfgroupinstall"C Development Tools and Libraries""Development Tools"# Fedora, Centos, RHEL and derivativessudodnfinstallcmakegcc-fortran# Fedora, Centos, RHEL and derivativesxcode-select--install# macOSThen clone the shtools repo, install the other dependencies, and install manually in a conda environment:gitclonehttps://github.com/SHTOOLS/SHTOOLS.gitcdshtools
condacreate-nyour_env_namepython=3.xx# create a new conda environment, if desiredcondaenvupdate-nyour_env_name-fenvironment.yml
condaactivateyour_env_name# activate the new conda environmentpipinstall--no-build-isolation-e.# install into the shtools folder and link to the active python environmentSHTOOLS (for Fortran 95)Install using thebrewpackage manager (MacOS, Linux, Windows):brewinstallshtoolsInstall using themacportspackage manager (MacOS):sudoportinstallshtoolsInstall from source:Clone or download the this repo, and then execute one (or both) of the following commands in theshtoolsdirectory:makefortran
makefortran-mp# for OpenMP Fortran routinesFurther installation instructions and options can be found in theweb documentation.CONTRIBUTINGWe work on thedevelopbranch and only push releases tomaster. Please base all pull requests ondevelop.CONTRIBUTORSFor the full list of contributors, see theAUTHORSfile.LICENSEThis project uses the BSD 3-Clause license, as found in theLICENSEfile.REFERENCESMark A. Wieczorek and Matthias Meschede (2018). SHTools --- Tools for working with spherical harmonics,Geochemistry, Geophysics, Geosystems, 19, 2574-2592, doi:10.1029/2018GC007529.Mark Wieczorek,et al. (2019). SHTOOLS/SHTOOLS. Zenodo, doi:10.5281/zenodo.3457861