Skip to content

eschnett/SHTOOLS.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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???

About

A Julia package wrapping SHTOOLS, the Spherical Harmonic Tools

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages