# Sun elevation and moon phase

**URL:** <https://discourse.julialang.org/t/sun-elevation-and-moon-phase/74753>\
**Category:** Astro/Space\
**Tags:** question\
**Created:** [January 17, 2022, 11:06am UTC](https://discourse.julialang.org/t/sun-elevation-and-moon-phase/74753 "2022-01-17T11:06:22Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [December 25, 2023, 10:49am UTC](https://discourse.julialang.org/t/sun-elevation-and-moon-phase/74753/6 "2023-12-25T10:49:19Z")

</div>

You don’t supply details or expected output, but a quick test here (Julia v1.10rc, AstroLib v0.4.2) suggests it works OK.

```julia
using AstroLib
lat, lon = (51.477811, -0.001475)
jd = jdcnv("2023-12-25T10:27:00")
ra, dec = sunpos(jd)
alti, azi, ha = eq2hor(ra, dec, jd, lat, lon)

```

giving altitude and azimuth `(12.389058355400406, 157.92698445374288)`. This is close to [NOAA](https://gml.noaa.gov/grad/solcalc/)’s calculations:

 ![Screenshot 2023-12-25 at 10.38.25](https://global.discourse-cdn.com/julialang/original/3X/b/0/b0e59c928af8ee7f1556f453c46e047190776f02.png)

but I don’t know how accurate AstroLib’s results are expected to be - is `0.071` difference good or bad…

I think the documentation issue for `sunpos` has already been addressed by a [helpful contributor](https://github.com/JuliaAstro/AstroLib.jl/pull/81)! As it says in the README:

> Check [TODO.md](https://github.com/JuliaAstro/AstroLib.jl/blob/master/TODO.md) out to see how you can help. Volunteers are welcome!

But - see [here](https://discourse.julialang.org/t/calculate-positions-of-astronomical-objects-from-a-terrestrial-observatory/107772) for more recent developments.

Perhaps talk to the Julia/Astronomy folks?

---

_[View the full topic](https://discourse.julialang.org/t/sun-elevation-and-moon-phase/74753)._
