# Spherical Harmonic transforms using Julia

**URL:** https://discourse.julialang.org/t/spherical-harmonic-transforms-using-julia/35824
**Category:** Geo
**Created:** [March 11, 2020, 4:44am UTC](https://discourse.julialang.org/t/spherical-harmonic-transforms-using-julia/35824 "2020-03-11T04:44:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SMH](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@SMH](https://discourse.julialang.org/u/SMH)
#### Post date: [March 11, 2020, 4:44am UTC](https://discourse.julialang.org/t/spherical-harmonic-transforms-using-julia/35824/1 "2020-03-11T04:44:15Z")

</div>

Hello,

I want to compute forward and inverse spherical harmonic transforms in Julia. I tried using FastTransforms but the package appears to be unstable (on the Mac Desktop, at any rate) and I also can’t seem to control parameters of the transform such as the harmonic bandlimit. Furthermore, I’m unable to determine the data format, i.e. the order of coefficients and how to arrange the latitudes / longitudes. Could someone please point me to documentation / examples?

Thanks a lot.

---

<div class="post-metadata">

### Author: ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)
#### Post date: [March 11, 2020, 5:29am UTC](https://discourse.julialang.org/t/spherical-harmonic-transforms-using-julia/35824/2 "2020-03-11T05:29:30Z")

</div>

FastTransforms.jl is stable. Please file an issue

---

<div class="post-metadata">

### Author: ![fabiangans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fabiangans/32/2624_2.png) [@fabiangans](https://discourse.julialang.org/u/fabiangans)
#### Post date: [March 12, 2020, 7:44am UTC](https://discourse.julialang.org/t/spherical-harmonic-transforms-using-julia/35824/3 "2020-03-12T07:44:30Z")

</div>

I have some old julia 0.6 code that wraps the SH transforms from FastTransforms and puts the coefficients in a PLM struct on which I define `getindex` and `setindex` so you can directly access and modify coefficients by their l and m number.

I put the code into [this gist](https://gist.github.com/meggart/9d3e70bef2a441b12a21666666002a41), feel free to update/reuse whatever you need.

---

<div class="post-metadata">

### Author: ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)
#### Post date: [March 12, 2020, 10:59am UTC](https://discourse.julialang.org/t/spherical-harmonic-transforms-using-julia/35824/4 "2020-03-12T10:59:02Z")

</div>

Note FastTransforms.jl has been completely redesigned since then, in particular it now wraps a very efficient and multithreaded C library called FastTransforms

---

<div class="post-metadata">

### Author: ![fabiangans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fabiangans/32/2624_2.png) [@fabiangans](https://discourse.julialang.org/u/fabiangans)
#### Post date: [March 12, 2020, 11:37am UTC](https://discourse.julialang.org/t/spherical-harmonic-transforms-using-julia/35824/5 "2020-03-12T11:37:32Z")

</div>

Thanks for the hint, I have not touched the code in a long time, so one would have to check how much rewrite would be necessary, although from looking at the recent docs, the interface logic does not seem to have changed too much.
