SHTOOLS.jl

A Julia package wrapping SHTOOLS, the Spherical Harmonic Tools
Author eschnett
Popularity
6 Stars
Updated Last
1 Year Ago
Started In
February 2021

SHTOOLS.jl

A Julia package wrapping SHTOOLS, the Spherical Harmonic Tools.

  • Documenter
  • GitHub CI
  • Codecov

Most functions come in two versions, one that mutates its arguments and one that allocates its output.

Note that the function arguments are not always the same as in Fortran or C. For example, output arguments for mutating functions come first in the argument list, and are omitted in non-mutating functions.

The documentation lists the implemented functions as well as their Julia signatures.

Example: Calculate gradient of a scalar field

julia> using SHTOOLS

julia> n = 4;

julia>= n;

julia>= 2n;

julia> Θ =*(i-1)/for i in 1:nθ];

julia> Φ = [2π*(j-1)/for j in 1:nϕ];

julia> # z + 2x
       F = [cos(θ) + 2*sin(θ)*cos(ϕ) for θ in Θ, ϕ in Φ];

julia> chop(x) = abs2(x) < 10eps(x) ? zero(x) : x;

julia> C,lmax = SHExpandDH(F, n; sampling=2);

julia> chop.(C[1,:,:])

julia> chop.(C[2,:,:])

julia> ∂θF, ∂ϕF, _ = MakeGradientDH(C, lmax; sampling=2);

julia> chop.(∂θF)

julia> chop.(∂ϕF)

These are wrong???

Used By Packages

No packages found.