Skip to content
  • v4.8
  • 663d267
  • Compare
    Choose a tag to compare
    Search for a tag
  • v4.8
  • 663d267
  • Compare
    Choose a tag to compare
    Search for a tag

@MarkWieczorek MarkWieczorek released this Jan 26, 2021

Version 4.8

  • Several functions have been vectorized using numpy.vectorize(). These include: spharm_lm(), legendre_lm(), MakeGridPoint(), MakeGridPointC(), DownContFilterMA(), DownContFilterMC(), NormalGravity(), SHConfidence(), and PlmIndex().
  • A new Fortran routine 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.
  • Added new Fortran functions MakeGravGridPoint and MakeMagGridPoint to compute the gravity and magnetic field vector at a single point.
  • Added the option to compute the gravity and magnetic field vectors at a single point using the python class methods SHGravCoeffs.expand() and SHMagCoeffs.expand().
  • The 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.
  • Added the option to including intensity shading in the 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).
  • Modified all the Fortran routines to use a slightly more efficient way to compute the radius of an ellipsoid as a function of geocentric latitude.
  • Fixed a bug in SHCoeffs.expand() when colat was specified in radians.
  • All declarations of integers in the Fortran code are now made using the types defined in the module iso_fortran_env. Furthermore, the python wrapper and signature files have been updated to be explicit when defining the Fortran variables.
  • Fixed a bug where the old module name constant needed to be updated to constants in the method SHCoeffs.centroid().
  • Corrected the parameterization used when generating ellipsoids in SHGrid.from_ellipsoid(). Though this method was introduced in v4.7, it was not mentioned in the release notes.
  • Changed the default behavior of SHCoeffs.to_array() so that the default value is not to return the errors by setting errors=False.
  • Added the optional attribute name to the coefficient classes SHGrid, SHGravCoeffs, SHMagCoeffs and SlepianCoeffs. All datasets now explicity set name to the function call of the dataset.
  • Moved the file 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

Assets 3
  • v4.7.1
  • 1901c4e
  • Compare
    Choose a tag to compare
    Search for a tag
  • v4.7.1
  • 1901c4e
  • Compare
    Choose a tag to compare
    Search for a tag

@MarkWieczorek MarkWieczorek released this Sep 24, 2020

Version 4.7.1

This maintenance release updates the makefiles so that they can be used correctly with homebrew-core and macports.

  • Relative paths are removed in a few cases by explicitly passing variables such as $(MODPATH)$ to all dependent sub-makefiles.
  • Default variables are no longer set in the sub-makefiles, as these are not intended to be used independently. All variables are passed directly from the main Makefile.
  • Renamed the directory modules to include to be consistent with macports and homebrew installations.
  • The F95FLAGS are set by searching if the compiler name contains the "short" compiler name. This allows recognizing "gfortran-10" as being "gfortran".

Experimental support is added for calling SHTOOLS routines from c.

  • Added experimental support for cbinded wrappers to the Fortran 95 SHTOOLS routine. A working example of calling SHTOOLS with g++ is provided in examples/cpp.

Other changes:

  • Added a .github folder with templates for issues and releases checklists.
  • Converted matplotlib relative font sizes (such as 'large') to points when passing font sizes to the Cartopy and pygmt plotting routines.
  • Minor changes to configuration files.
Assets 3
  • v4.7
  • 5691a12
  • Compare
    Choose a tag to compare
    Search for a tag
  • v4.7
  • 5691a12
  • Compare
    Choose a tag to compare
    Search for a tag

@MarkWieczorek MarkWieczorek released this Sep 14, 2020

Version 4.7

Datasets

The new datasets module allows users to easily download spherical harmonic coefficient datasets and return them as SHCoeffs, SHGravCoeffs or SHMagCoeffs class instances.

To load a dataset, call the relevant method as in these examples:

    hlm = pysh.datasets.Venus.VenusTopo719()  # Venus shape
    clm = pysh.datasets.Earth.EGM2008()  # Earth gravity
    glm = pysh.datasetes.Earth.WDMAM2_800()  # Earth magnetic field
    clm = pysh.datasets.Moon.GRGM1200B()  # Gravity of the Moon

Better IO routines

  • Added the functions (in the module shio) shwrite(),read_dov() write_dov(), read_bshc(), write_bshc() and write_igcem_gfc() to read and write 'shtools', 'dov', 'bshc', and 'icgem' files.
  • Added the function shio.read_igrf() for reading IGRF formatted files, and returning coefficients for a specified year.
  • The SHCoeffs, SHMagCoeffs and SHGravCoeffs methods to_file() and from_file() now accept all file formats.
  • Added support for reading gzip and zip files in shread, SHCoeffs.from_file(), SHGravCoeffs.from_file(), SHMagCoeffs.from_file(), and read_icgem_gfc()
  • Fixed a minor bug where netcdf files would not accept boolean attributes.

Admittance and correlation methods

  • Added the methods admittance(), correlation() and admitcorr() for the classes SHCoeffs, SHGravCoeffs, and SHMagCoeffs to compute the admittance and/or correlation with another function.
  • Added the methods plot_admittance(), plot_correlation() and plot_admitcorr() to easily plot these functions.

Better plotting routines

  • Added the option legend_loc to most plotting routines to allow fine control over where the legend is placed.
  • Minor bug fixes concerning colorbar parameters cb_offset and cb_triangles.

Better treatmentment of uncertainties

  • Added the option to include error coefficients in the class SHCoeffs.
  • Added the boolean option errors to the method to_array() in order to control whether the error coefficients are returned with the function spherical harmonic coefficients.
  • Added the option legend_error to the SHCoeffs, SHMagCoeffs and SHGravCoeffs method plot_spectrum() to provide a customized legend entry for the error spectrum.

New attributes for SHCoeffs, SHGravCoeffs and SHMagCoeffs

  • Added the attribute error_kind to specify the type of errors.
  • Added the attribute units to all grid and coefficient classes.
  • Added the attribute epoch to SHGravCoeffs, SHGravGrid , SHGeoid and SHTensor.
  • Added the attribute year to SHMagCoeffs, SHMagGrid , and SHTensor.

Improved Documentation

  • The web documentation has been broken into two separate components: pyshtools (python) and SHTOOLS (Fortran 95).
  • Reorganized the web documentation for clarity (re-organization of tutorials and guides, creation of a separate page for shtools grid formats, creation of separate pages for datasets, constants, and spherical harmonic coefficient file coeeficients).
  • The python tutorial notebooks are now rendered by the jupyter nbviewer web page. From this viewer, the user can easily download the notebook, or run it in a binder session.
  • Updated the documentation for installing pyshtools using Conda.

Initial support for fpm

Initial experimental support is added for use with fpm: the fortran package manager.

To install as a stand-alone project, it is only necesssary to use the command

fpm build

This will place the necessary .mod and .a files in a subdirectory of build.

To include shtools as a dependency in a project that compiles with fpm, you only need to add the following to the fpm.toml file:

[dependencies]
SHTOOLS = {git="https://github.com/SHTOOLS/SHTOOLS.git"}

In the current state of fpm (which is undergoing active development), it is not possible to link to system wide libraries, such as fftw and lapack, which are required by shtools.

Other changes

  • Add option empty to return an empty gird when initializing an SHgrid withfrom_zeros().
  • Add method from_ellipsoid() to SHGrid to initial a class instance with a triaxial ellipsoid.
  • Added error checks to the pyshtools function YilmIndexVector.
  • Renamed the constant module to constants, and reogranized the constants in a more logical way (i.e., constants.Mars.r instead of constants.Mars.r_mars).
  • Added a gmt xarray accessor for use with pygmt.
  • Fixed a bug in Curve2Mask python wrapper when using extended grids, and fixed a bug in the fortran code when the input file contained points at exactly 0 or 360 degree.
  • pyshtools versioning is now done using versioneer, instead of the homemade system that was in the setup.py (which was somewhat complicated and needed to set ISREALESED to True or False). Versioneer gets the version number automatically from git tags.
  • Update fortran 95 source files to be consistent with the documentation and SHTOOLS.f95 interface block. In particular, several variable names of c and sh were renamed to cilm.
Assets 2

@MarkWieczorek MarkWieczorek released this Mar 5, 2020

Version 4.6.2

New extended grids

All grid formats now allow to compute the redundant values at 360 E longitude (GLQ and DH), as well as at 90 S (DH only). These extended grids are now the default in pyshtools, but remain optional in the Fortran 95 routines. The use of extended grids is controlled by the optional argument extend. The purpose of these extended grids is to better integrate with the plotting routines that require these points (i.e.., Cartopy and pygmt).

Improved plotting and map projections

The plotting routine SHGrid.plot() has been refactored to allow support for projections using Cartopy and pygmt.

  • An incorrect 0.5 pixel offset was fixed when plotting grids via matplotlib, and grids now correctly plot both 0 and 360 degrees using the new "extended" grids of SHGrid.
  • Support was added for Cartopy projections, by specifying: SHGrid.plot(projection=ccrs.ProjectionName()).
  • The argument colorbar now takes the options 'top', 'bottom', 'left' or 'right'.
  • Improved plotting and placement of colorbars. New optional arguments include cb_label for labels, cb_ylabel for a label on the y axis of the colorbar, cb_tick_interval for specifying the major tick interval, cb_minor_tick_interval for specifying minor tick intervals, cb_triangles for plotting upper/lower limit triangles at the ends of the colorbar, cb_width to specify the colorbar width, and cb_offset to override the default spacing between the map and colorbar.
  • Improved colormap handling: New optional arguments include cmap_limits to specify the lower and upper bounds of the data, as well as an interval for constant color intervals, and cmap_reverse to reverse the colormap.
  • Improved handling of ticks and annotations: The optional argument ticks specifies which ticks and annotations to show, using a syntax from the generic mapping tools (i.e., 'WSen').
  • Experimental support for pygmt using the routine SHGrid.plotgmt(). This function takes nearly the same arguments as plot(). As soon as pygmt implements projection classes (GenericMappingTools/pygmt#379), this will be incorporated into the plot function in the same manner as Cartopy was.
  • All gravity, magnetics, tensor, localization windows and slepian function plotting routines incorporate these changes.
  • Added a new introductory notebook that shows how to use all features of the plot() function.

Improved integration with xarray DataArrays, xarray DataSets, and netcdf files

  • Added the methods to_netcdf() and from_netcdf() to the SHCoeffs, SHGravCoeffs and SHMagCoeffs classes.
  • Added the method SHGrid.from_xarray() to initialize a grid from an xarray DataArray.
  • Added improved descriptive attributes for netcdf files that mirror these conventions.
  • Added the method SHGeoid.to_xarray() to export an xarray DataArray and to_netcdf() to export a netcdf object readable by the generic mapping tools.
  • Added the methods SHGravGrid.to_xarray() and SHMagGrid.to_xarray() to export all gridded data (radial, theta, phi, total, and potential) as an xarray DataSet.
  • Added the methods SHGravTensor.to_xarray() and SHMagTensor.to_xarray()to export all gridded data (Vxx, invariants, eigenvalues) as an xarray DataSet.

Gravity routine improvements

  • Added the method SHGravCoeffs.center_of_mass to calculate the center of mass of a body.
  • Added the method SHGravCoeffs.inertia_tensor() to calculate the moment of inertia tensor.
  • Added the Earth dynamical flattening constant H (IERS Conventions 2010) to the constant module.
  • The read_icgem_gfc() function was extended with the option encoding as some models in ICGEM are not in UTF-8.
  • Addded the method centroid() to the class SHCoeffs. The centroid is computed as the center of mass of a homogeneous object.

Other changes

  • New methods SHGrid.to_real() and SHGrid.to_imag() return the real and imaginary components of a complex SHGrid instance.
  • Added an optional argument copy to SHCoeffs.pad().
  • Fixed bugs in the Fortran code of PlBar_d1 and PlON_d1 when calculating the Legendre polynomials at the north and south pole.
  • Spherical harmonic coefficients can be read remotely by specifying a URL as the filename. This functionality uses requests.get(), and has been implemented in the function shread() and the SHCoeffs method from_file().
  • Fixed a bug in the fortran code of Curve2Mask. As part of this fix, the optional parameter centralmeridian has been removed as it is no longer required. The longitudes of the curve can possess values from -360 to 720 degrees, and the routine searches for discontinuities that may occur between two successive points as the longitudes pass from 360 to 0, or -180 to 180 degrees.

M. A. Wieczorek, M. Meschede, E. Sales de Andrade, I. Oshchepkov, B. Xu, and A. Walker, A. Hattori, S. Schröder, K. Leinweber, A. Vasishta (2020). SHTOOLS: Version 4.6, Zenodo, doi:10.5281/zenodo.3698050

Assets 2

@MarkWieczorek MarkWieczorek released this Mar 5, 2020

Version 4.6.1

New extended grids

All grid formats now allow to compute the redundant values at 360 E longitude (GLQ and DH), as well as at 90 S (DH only). These extended grids are now the default in pyshtools, but remain optional in the Fortran 95 routines. The use of extended grids is controlled by the optional argument extend. The purpose of these extended grids is to better integrate with the plotting routines that require these points (i.e.., Cartopy and pygmt).

Improved plotting and map projections

The plotting routine SHGrid.plot() has been refactored to allow support for projections using Cartopy and pygmt.

  • An incorrect 0.5 pixel offset was fixed when plotting grids via matplotlib, and grids now correctly plot both 0 and 360 degrees using the new "extended" grids of SHGrid.
  • Support was added for Cartopy projections, by specifying: SHGrid.plot(projection=ccrs.ProjectionName()).
  • The argument colorbar now takes the options 'top', 'bottom', 'left' or 'right'.
  • Improved plotting and placement of colorbars. New optional arguments include cb_label for labels, cb_ylabel for a label on the y axis of the colorbar, cb_tick_interval for specifying the major tick interval, cb_minor_tick_interval for specifying minor tick intervals, cb_triangles for plotting upper/lower limit triangles at the ends of the colorbar, cb_width to specify the colorbar width, and cb_offset to override the default spacing between the map and colorbar.
  • Improved colormap handling: New optional arguments include cmap_limits to specify the lower and upper bounds of the data, as well as an interval for constant color intervals, and cmap_reverse to reverse the colormap.
  • Improved handling of ticks and annotations: The optional argument ticks specifies which ticks and annotations to show, using a syntax from the generic mapping tools (i.e., 'WSen').
  • Experimental support for pygmt using the routine SHGrid.plotgmt(). This function takes nearly the same arguments as plot(). As soon as pygmt implements projection classes (GenericMappingTools/pygmt#379), this will be incorporated into the plot function in the same manner as Cartopy was.
  • All gravity, magnetics, tensor, localization windows and slepian function plotting routines incorporate these changes.
  • Added a new introductory notebook that shows how to use all features of the plot() function.

Improved integration with xarray DataArrays, xarray DataSets, and netcdf files

  • Added the methods to_netcdf() and from_netcdf() to the SHCoeffs, SHGravCoeffs and SHMagCoeffs classes.
  • Added the method SHGrid.from_xarray() to initialize a grid from an xarray DataArray.
  • Added improved descriptive attributes for netcdf files that mirror these conventions.
  • Added the method SHGeoid.to_xarray() to export an xarray DataArray and to_netcdf() to export a netcdf object readable by the generic mapping tools.
  • Added the methods SHGravGrid.to_xarray() and SHMagGrid.to_xarray() to export all gridded data (radial, theta, phi, total, and potential) as an xarray DataSet.
  • Added the methods SHGravTensor.to_xarray() and SHMagTensor.to_xarray()to export all gridded data (Vxx, invariants, eigenvalues) as an xarray DataSet.

Gravity routine improvements

  • Added the method SHGravCoeffs.center_of_mass to calculate the center of mass of a body.
  • Added the method SHGravCoeffs.inertia_tensor() to calculate the moment of inertia tensor.
  • Added the Earth dynamical flattening constant H (IERS Conventions 2010) to the constant module.
  • The read_icgem_gfc() function was extended with the option encoding as some models in ICGEM are not in UTF-8.
  • Addded the method centroid() to the class SHCoeffs. The centroid is computed as the center of mass of a homogeneous object.

Other changes

  • New methods SHGrid.to_real() and SHGrid.to_imag() return the real and imaginary components of a complex SHGrid instance.
  • Added an optional argument copy to SHCoeffs.pad().
  • Fixed bugs in the Fortran code of PlBar_d1 and PlON_d1 when calculating the Legendre polynomials at the north and south pole.
  • Spherical harmonic coefficients can be read remotely by specifying a URL as the filename. This functionality uses requests.get(), and has been implemented in the function shread() and the SHCoeffs method from_file().
  • Fixed a bug in the fortran code of Curve2Mask. As part of this fix, the optional parameter centralmeridian has been removed as it is no longer required. The longitudes of the curve can possess values from -360 to 720 degrees, and the routine searches for discontinuities that may occur between two successive points as the longitudes pass from 360 to 0, or -180 to 180 degrees.

M. A. Wieczorek, M. Meschede, E. Sales de Andrade, I. Oshchepkov, B. Xu, and A. Walker, A. Hattori, S. Schröder, K. Leinweber, A. Vasishta (2020). SHTOOLS: Version 4.6, Zenodo, doi:10.5281/zenodo.3698050

Assets 2

@MarkWieczorek MarkWieczorek released this Mar 5, 2020

Version 4.6

New extended grids

All grid formats now allow to compute the redundant values at 360 E longitude (GLQ and DH), as well as at 90 S (DH only). These extended grids are now the default in pyshtools, but remain optional in the Fortran 95 routines. The use of extended grids is controlled by the optional argument extend. The purpose of these extended grids is to better integrate with the plotting routines that require these points (i.e.., Cartopy and pygmt).

Improved plotting and map projections

The plotting routine SHGrid.plot() has been refactored to allow support for projections using Cartopy and pygmt.

  • An incorrect 0.5 pixel offset was fixed when plotting grids via matplotlib, and grids now correctly plot both 0 and 360 degrees using the new "extended" grids of SHGrid.
  • Support was added for Cartopy projections, by specifying: SHGrid.plot(projection=ccrs.ProjectionName()).
  • The argument colorbar now takes the options 'top', 'bottom', 'left' or 'right'.
  • Improved plotting and placement of colorbars. New optional arguments include cb_label for labels, cb_ylabel for a label on the y axis of the colorbar, cb_tick_interval for specifying the major tick interval, cb_minor_tick_interval for specifying minor tick intervals, cb_triangles for plotting upper/lower limit triangles at the ends of the colorbar, cb_width to specify the colorbar width, and cb_offset to override the default spacing between the map and colorbar.
  • Improved colormap handling: New optional arguments include cmap_limits to specify the lower and upper bounds of the data, as well as an interval for constant color intervals, and cmap_reverse to reverse the colormap.
  • Improved handling of ticks and annotations: The optional argument ticks specifies which ticks and annotations to show, using a syntax from the generic mapping tools (i.e., 'WSen').
  • Experimental support for pygmt using the routine SHGrid.plotgmt(). This function takes nearly the same arguments as plot(). As soon as pygmt implements projection classes (GenericMappingTools/pygmt#379), this will be incorporated into the plot function in the same manner as Cartopy was.
  • All gravity, magnetics, tensor, localization windows and slepian function plotting routines incorporate these changes.
  • Added a new introductory notebook that shows how to use all features of the plot() function.

Improved integration with xarray DataArrays, xarray DataSets, and netcdf files

  • Added the methods to_netcdf() and from_netcdf() to the SHCoeffs, SHGravCoeffs and SHMagCoeffs classes.
  • Added the method SHGrid.from_xarray() to initialize a grid from an xarray DataArray.
  • Added improved descriptive attributes for netcdf files that mirror these conventions.
  • Added the method SHGeoid.to_xarray() to export an xarray DataArray and to_netcdf() to export a netcdf object readable by the generic mapping tools.
  • Added the methods SHGravGrid.to_xarray() and SHMagGrid.to_xarray() to export all gridded data (radial, theta, phi, total, and potential) as an xarray DataSet.
  • Added the methods SHGravTensor.to_xarray() and SHMagTensor.to_xarray()to export all gridded data (Vxx, invariants, eigenvalues) as an xarray DataSet.

Gravity routine improvements

  • Added the method SHGravCoeffs.center_of_mass to calculate the center of mass of a body.
  • Added the method SHGravCoeffs.inertia_tensor() to calculate the moment of inertia tensor.
  • Added the Earth dynamical flattening constant H (IERS Conventions 2010) to the constant module.
  • The read_icgem_gfc() function was extended with the option encoding as some models in ICGEM are not in UTF-8.
  • Addded the method centroid() to the class SHCoeffs. The centroid is computed as the center of mass of a homogeneous object.

Other changes

  • New methods SHGrid.to_real() and SHGrid.to_imag() return the real and imaginary components of a complex SHGrid instance.
  • Added an optional argument copy to SHCoeffs.pad().
  • Fixed bugs in the Fortran code of PlBar_d1 and PlON_d1 when calculating the Legendre polynomials at the north and south pole.
  • Spherical harmonic coefficients can be read remotely by specifying a URL as the filename. This functionality uses requests.get(), and has been implemented in the function shread() and the SHCoeffs method from_file().
  • Fixed a bug in the fortran code of Curve2Mask. As part of this fix, the optional parameter centralmeridian has been removed as it is no longer required. The longitudes of the curve can possess values from -360 to 720 degrees, and the routine searches for discontinuities that may occur between two successive points as the longitudes pass from 360 to 0, or -180 to 180 degrees.

M. A. Wieczorek, M. Meschede, E. Sales de Andrade, I. Oshchepkov, B. Xu, and A. Walker, A. Hattori, S. Schröder, K. Leinweber, A. Vasishta (2020). SHTOOLS: Version 4.6, Zenodo, doi:10.5281/zenodo.3698050

Assets 2