SHTOOLS - Spherical Harmonic Tools
New Datasets!
volume_equivalent_radius
and volume
to the constants modules.density
to mean_density
and g0
to gravity_mean_radius
.Bug fixes
SHGrid.from_xarray()
, check if the first row is 90 or -90 and flip accordingly.SHCoeffs.convert()
when coefficient errors are present.spectralanalysis.cross_spectrum()
when using real unnormalized coefficients.Plotting improvements
rectangle
to the SHGrid.plotgmt()
method that allows the use of rectangular projections that are specified by the lower-left and upper-right coordinates.cmap_background_foreground
to SHGrid.plotgmt()
that controls how data are plotted when they exceed the limits of the colormap.title_offset
to SHGrid.plotgmt()
and SHGrid.plot()
that specifies how much space to add between the plot and title.SHGrid.plotgmt()
shading options based on changes made in pygmt 0.7, including the use of xarrays directly instead of creating temporary files.cmap_rlimits
and cmap_rlimits_complex
to SHGrid.plot()
, SHGrid.plotgmt()
and SHGrid.plot3d()
to specify colorbar limits with respect to the maximum value of the data.cmap_scale
to SHGrid.plot()
and SHGrid.plotgmt()
to allow using either a linear or logarithmic color map.cb_power
to SHGrid.plotgmt()
to allow plotting annotations as powers of 10.SHCoeffs.plot_spectrum()
to plot the error spectrum (if present) or not.Other changes
r
to SHMagCoeffs.expand()
and SHGravCoeffs.expand()
that allows one to compute the field at an arbitrary list of (r, lat, lon) points.pathlib.Path
objects to all methods that require a filename.pyproject.toml
.MakeCircleCoord
when the angular radius is zero.M. A. Wieczorek, M. Meschede, A. Broquet, T. Brugere, A. Corbin, EricAtORS, A. Hattori, A. Kalinin, J. Kohler, D. Kutra, K. Leinweber, P. Lobo, J. Maia, D. Minton, I. Oshchepkov, P.-L. Phan, O. Poplawski, M. Reinecke, E. Sales de Andrade, E. Schnetter, S. Schröder, J. Sierra, A. Vasishta, A. Walker, xoviat, B. Xu (2024). SHTOOLS: Version 4.12, Zenodo, doi:10.5281/zenodo.592762
Support for Python 3.12 using the Meson build system
This version no longer relies on distutils
(which was deprecated in python 3.12) and instead makes use of Meson and Meson-Python to build and test the pyshtools package. The package can be built from source using pip as before, however, if you need to create an editable install, it will be necessary to use the slightly modified command
pip install --no-build-isolation -e .
Please see the online documentation for instructions on how to run the test suites and benchmarks.
Other changes
versioneer
to determine the package version, but instead set the version in the main meson.build
file using setuptools_scm
. At the present time, it is not possible to determine the version when using a source tarball, and for this case, the build will fail. Please ensure that when building from source that you are doing so from a git versioned repository.SHCoeffs.volume()
when the coefficient normalization was ortho
.LAPACK_UNDERSCORE
specified.M. A. Wieczorek, M. Meschede, A. Broquet, T. Brugere, A. Corbin, EricAtORS, A. Hattori, A. Kalinin, J. Kohler, D. Kutra, K. Leinweber, P. Lobo, I. Oshchepkov, P.-L. Phan, O. Poplawski, M. Reinecke, E. Sales de Andrade, E. Schnetter, S. Schröder, J. Sierra, A. Vasishta, A. Walker, xoviat, B. Xu (2024). SHTOOLS: Version 4.11.10, Zenodo, doi:10.5281/zenodo.592762
Bug fixes, minor enhancements, and deprecations
pyshtools.shtools
has been removed, and is now accessible at pyshtools.backends.shtools
.MakeGravGradGridDH
and MakeMagGradGridDH
, both of which are used in the pyshtools tensor
method of the classes SHGravCoeffs
and SHMagCoeffs
. This bug only affected the southern hemisphere, and is most noticeable close to the south pole.pyshtools/__init__.py
that led to a circular import problem on some systems.shtools
routines were wrapped using functools.wraps
.M. A. Wieczorek, M. Meschede, A. Broquet, T. Brugere, A. Corbin, EricAtORS, A. Hattori, A. Kalinin, J. Kohler, D. Kutra, K. Leinweber, P. Lobo, I. Oshchepkov, P.-L. Phan, O. Poplawski, M. Reinecke, E. Sales de Andrade, E. Schnetter, S. Schröder, J. Sierra, A. Vasishta, A. Walker, xoviat, B. Xu (2023). SHTOOLS: Version 4.10.4, Zenodo, doi:10.5281/zenodo.592762
Minor packaging enhancement
Future deprecation
The module pyshtools.shtools
will be deprecated in the v4.11 release. This module represents 1 of 2 possible backends for pyshtools, and has been located at pyshtools.backends.shtools
since version 4.9. Unless explicitly required, the user should avoid using the backends
modules directly, and should instead call the routines that are located in the top level modules such as pyshtools.expand
and pyshtools.rotate
. Setting the backend by use of the routine pyshtools.backends.selected_preferred_backend()
determines which backend to use when calling the routines in these top level modules.
M. A. Wieczorek, M. Meschede, T. Brugere, A. Corbin, A. Hattori, A. Kalinin, J. Kohler, D. Kutra, K. Leinweber, P. Lobo, I. Oshchepkov, P.-L. Phan, O. Poplawski, M. Reinecke, E. Sales de Andrade, E. Schnetter, S. Schröder, J. Sierra, A. Vasishta, A. Walker, xoviat, B. Xu (2023). SHTOOLS: Version 4.10.3, Zenodo, doi:10.5281/zenodo.592762
Bug fixes and minor enhancements
lmax
to pysh.SHWindow.to_shgrid()
.libtool
by ar
and ranlib
in the fortran makefile.PWD
by CURDIR
in the main makefile..change_units
to the SHMagCoeffs
class.shtools
module to backends.shtools
(the top-level shtools module will be deprecated in v4.11).pkg_resources
instead of setuptools.version.pkg_resources
in setup.py
._np.int_
was mistakenly _np.int
.pypandoc
as a dependency in setup.py
and don't convert the readme to reST format for pypi.datasets
module.README
.Future deprecation
The module pyshtools.shtools
will be deprecated in the v4.11 release. This module represents 1 of 2 possible backends for pyshtools, and has been located at pyshtools.backends.shtools
since version 4.9. Unless explicitly required, the user should avoid using the backends
modules directly, and should instead call the routines that are located in the top level modules such as pyshtools.expand
and pyshtools.rotate
. Setting the backend by use of the routine pyshtools.backends.selected_preferred_backend()
determines which backend to use when calling the routines in these top level modules.
M. A. Wieczorek, M. Meschede, T. Brugere, A. Corbin, A. Hattori, A. Kalinin, J. Kohler, D. Kutra, K. Leinweber, P. Lobo, I. Oshchepkov, P.-L. Phan, O. Poplawski, M. Reinecke, E. Sales de Andrade, E. Schnetter, S. Schröder, J. Sierra, A. Vasishta, A. Walker, xoviat, B. Xu (2023). SHTOOLS: Version 4.10.2, Zenodo, doi:10.5281/zenodo.592762
Bug fixes and minor enhancements
ducc0
isn't installed.expand
and rotate
submodules.setup.py
to work with all versions of setuptools
.SHGravRealCoeffs.expand
and SHGravRealCoeffs.expand
that did not correctly compute the radius of the flattened ellipsoid when an array of latitudes was provided.-static
option from compiler options.Future deprecation
The module pyshtools.shtools
will be deprecated in the v4.11 release. This module represents 1 of 2 possible backends for pyshtools, and has been located at pyshtools.backends.shtools
since version 4.9. Unless explicitly required, the user should avoid using the backends
modules directly, and should instead call the routines that are located in the top level modules such as pyshtools.expand
and pyshtools.rotate
. Setting the backend by use of the routine pyshtools.backends.selected_preferred_backend()
determines which backend to use when calling the routines in these top level modules.
M. A. Wieczorek, M. Meschede, T. Brugere, A. Corbin, A. Hattori, K. Leinweber, I. Oshchepkov, M. Reinecke, E. Sales de Andrade, E. Schnetter, S. Schröder, A. Vasishta, A. Walker, B. Xu, J. Sierra (2022). SHTOOLS: Version 4.10.1, Zenodo, doi:10.5281/zenodo.592762
Enhancements
pyshtools.expand
and pyshools.rotate
.makegravgradgriddh
and makemaggravgradgrid
for consistency with code.Bug fixes
nthreads
in SHMagCoeffs.rotate()
method.SHGravCoeffs.admittance()
when using function='geoid'
.MakeGrid2D
concerning the mandatory variable interval
.float
before using the ducc
backend.SHGeoid.to_netcdf()
now outputs double precision by default (consistent with the other grid classes).SHWindow.multitaper_cross_spectrum()
when using arbitrary localization regions.cMakeGradientDH
regarding the optional radius
parameter.setup.py
to work with setuptools 62.0.0 and 62.1.0.Note: The module pyshtools.shtools
will be deprecated in the v4.11 release. This module represents 1 of 2 possible backends for pyshtools, and will henceforth be located at pyshtools.backends.shtools
. Unless explicitly required, the user should avoid using the backends
modules directly, and should instead call the routines that are located in the top level modules such as pyshtools.expand
. Setting the backend by use of the routine pyshtools.backends.selected_preferred_backend()
determines which backed to use when calling the routines in the top level modules.
M. A. Wieczorek, M. Meschede, T. Brugere, A. Corbin, A. Hattori, K. Leinweber, I. Oshchepkov, M. Reinecke, E. Sales de Andrade, E. Schnetter, S. Schröder, A. Vasishta, A. Walker, B. Xu, J. Sierra (2022). SHTOOLS: Version 4.10, Zenodo, doi:10.5281/zenodo.592762
Backends
Implemented the option to use a different backend when performing certain operations requiring spherical harmonic transforms. At present, only 'shtools' (default) and the Distinctly Useful Code Collection ('ducc') are supported.
backends
that has functions allowing the user to control which backend is used. To set the backend for all subsequent operations, use backends.select_preferred_backend()
.backend
and nthreads
('ducc' only) to all methods of the pyshtools classes that allow multiple backends (such as SHGrid
and SHCoeffs
).backends
web documentation page that describes the use of the new module.Plotting routines
SHGrid.histogram()
and SHGrid.plot_histogram()
for generating area-weighted histograms.title_labelsize
to titlesize
for consistency. This affects the methods Slepian.plot_coupling_matrix()
, Slepian.plot_spectra()
, and SHWindow.plot_coupling_matrix()
.get_geometry
with get_subplotspec
.I
with the alias shading
for colorbars.IO and datasets
constants
variables r
to mean_radius
(but kept r
as an alias for backwards compatibility).trnd
or dot
term. When a line in the data section starts with an unknown key, a warning is now printed to the screen (which can be turned off by specifying quiet=True
). For files formatted as icgem2.0
, time variable terms were simply ignored if the specified epoch fell outside of the allowed range. Now, the routine will instead raise an error. Finally, the documentation was improved by describing the allowable keyword entries of the header and data section of the file.encoding
for all routines and methods that read or write text-based spherical harmonic files.utf-8
in order to avoid problems with the XGM2019E dataset that has a character that can not be decoded by the GBK encoding that is the default in some Chinese installations.datasets.Moon.historical.gravity
.Other changes
MakeGradientDH()
.MakeGradientDH()
and SHCoeffs.gradient()
. The original behavior was to compute the gradient on a sphere of radius r
, where r
was the degree 0 coefficient of the function. The new behaviour is to compute the gradient on the unit sphere. This radius can be modified by supplying the optional argument radius
..from_random()
methods of SHCoeffs
, SHGravCoeffs
, and SHMagCoeffs
.coeffs[1, lmax, lmax]
was in error when lmax
was odd and when using DH
grids. Second, when using SHGrid.expand()
with grid type DH2
the parameter sampling=2
was not passed to the Fortran routine.makefile install
to include example data files, and to place them in the correct directories when installing with homebrew.astropy>=4.0
and pygmt>=0.3.0
.SHGrid
that could arise if the value input to arccos was greater than 1.np.float_
and np.complex_
to np.float64
and np.complex128
to avoid numpy deprectation warning.threadsafe
to numpy signature files.M. A. Wieczorek, M. Meschede, T. Brugere, A. Corbin, A. Hattori, K. Leinweber, I. Oshchepkov, M. Reinecke, E. Sales de Andrade, E. Schnetter, S. Schröder, A. Vasishta, A. Walker, B. Xu (2021). SHTOOLS: Version 4.9, Zenodo, doi:10.5281/zenodo.592762
Backends
Implemented the option to use a different backend when performing certain operations requiring spherical harmonic transforms. At present, only 'shtools' (default) and the Distinctly Useful Code Collection ('ducc') are supported.
backends
that has functions allowing the user to control which backend is used. To set the backend for all subsequent operations, use backends.select_preferred_backend()
.backend
and nthreads
('ducc' only) to all methods of the pyshtools classes that allow multiple backends (such as SHGrid
and SHCoeffs
).backends
web documentation page that describes the use of the new module.Plotting routines
SHGrid.histogram()
and SHGrid.plot_histogram()
for generating area-weighted histograms.title_labelsize
to titlesize
for consistency. This affects the methods Slepian.plot_coupling_matrix()
, Slepian.plot_spectra()
, and SHWindow.plot_coupling_matrix()
.get_geometry
with get_subplotspec
.I
with the alias shading
for colorbars.IO and datasets
constants
variables r
to mean_radius
(but kept r
as an alias for backwards compatibility).trnd
or dot
term. When a line in the data section starts with an unknown key, a warning is now printed to the screen (which can be turned off by specifying quiet=True
). For files formatted as icgem2.0
, time variable terms were simply ignored if the specified epoch fell outside of the allowed range. Now, the routine will instead raise an error. Finally, the documentation was improved by describing the allowable keyword entries of the header and data section of the file.encoding
for all routines and methods that read or write text-based spherical harmonic files.utf-8
in order to avoid problems with the XGM2019E dataset that has a character that can not be decoded by the GBK encoding that is the default in some Chinese installations.datasets.Moon.historical.gravity
.Other changes
MakeGradientDH()
.MakeGradientDH()
and SHCoeffs.gradient()
. The original behavior was to compute the gradient on a sphere of radius r
, where r
was the degree 0 coefficient of the function. The new behaviour is to compute the gradient on the unit sphere. This radius can be modified by supplying the optional argument radius
..from_random()
methods of SHCoeffs
, SHGravCoeffs
, and SHMagCoeffs
.coeffs[1, lmax, lmax]
was in error when lmax
was odd and when using DH
grids. Second, when using SHGrid.expand()
with grid type DH2
the parameter sampling=2
was not passed to the Fortran routine.makefile install
to include example data files, and to place them in the correct directories when installing with homebrew.astropy>=4.0
and pygmt>=0.3.0
.SHGrid
that could arise if the value input to arccos was greater than 1.np.float_
and np.complex_
to np.float64
and np.complex128
to avoid numpy deprectation warning.threadsafe
to numpy signature files.M. A. Wieczorek, M. Meschede, T. Brugere, A. Corbin, A. Hattori, K. Leinweber, I. Oshchepkov, M. Reinecke, E. Sales de Andrade, E. Schnetter, S. Schröder, A. Vasishta, A. Walker, B. Xu (2021). SHTOOLS: Version 4.9, Zenodo, doi:10.5281/zenodo.592762
numpy.vectorize()
. These include: spharm_lm()
, legendre_lm()
, MakeGridPoint()
, MakeGridPointC()
, DownContFilterMA()
, DownContFilterMC()
, NormalGravity()
, SHConfidence()
, and PlmIndex()
.MakeGradientDH
was added to compute the horizontal gradient of a real scalar function. The method .gradient()
was added to the SHCoeffs
class, and a new class SHGradient
was created to store and plot the two horizontal components of the gradient.MakeGravGridPoint
and MakeMagGridPoint
to compute the gravity and magnetic field vector at a single point.SHGravCoeffs.expand()
and SHMagCoeffs.expand()
.plot_spectrum2d()
routines have been updated to include more plotting options, including placement of the origin, tick intervals, and colormaps. Most optional parameters are the same as in the SHGrid.plot()
method.SHGrid.plotgmt()
routine. The shading can be derived from the gradient of the input grid (by setting shading=True
) or from a different map by supplying an SHGrid
class instance. Optional parameters include the azimuth of the shading (shading_azimuth
), as well as the maximum amplitude of the intensity (shading_amplitude
).SHCoeffs.expand()
when colat
was specified in radians.iso_fortran_env
. Furthermore, the python wrapper and signature files have been updated to be explicit when defining the Fortran variables.constant
needed to be updated to constants
in the method SHCoeffs.centroid()
.SHGrid.from_ellipsoid()
. Though this method was introduced in v4.7, it was not mentioned in the release notes.SHCoeffs.to_array()
so that the default value is not to return the errors by setting errors=False
.name
to the coefficient classes SHGrid
, SHGravCoeffs
, SHMagCoeffs
and SlepianCoeffs
. All datasets now explicity set name
to the function call of the dataset.shtools.h
from src/
to include/
and updated the Makefiles accordingly.M. A. Wieczorek, M. Meschede, E. Sales de Andrade, A. Corbin, I. Oshchepkov, B. Xu, and A. Walker, A. Hattori, S. Schröder, K. Leinweber, A. Vasishta (2021). SHTOOLS: Version 4.8, Zenodo, doi:10.5281/zenodo.592762