I tried looking for an existing package in JuliaAstro, and it truly seems like all the pieces are there, but I couldn’t find anything that directly mentions any of this.
Does anyone know of a straight forward way to do this?
First, Merry Christmas. Second, I don’t see documentation for AstroLib.sunpos(). Is there any? Lastly, I’m doing something wrong in trying to get the azimuth and elevation of the sun. All pointers appreciated.
“”"
B5 = Observatory(“Bldg5”, 29.574166, -95.114444, 1, -6)
jd=jdcnv(“2024-01-28T07:15:00”)
ra,dec=sunpos(jd)
az, el = eq2hor(ra, dec)
“”"
The values I get are nowhere near the values other sources have. Even if I use a 6 hour offset for my time vs UTC.
Just a curiosity: what is the day on which the curve intertwines?
What characteristic does it have (same hours of dark and light or something like that)?
Hi - I am also trying calculate the local sunrise/sunset/moonPhase using the functions in AstroLib.jl. I have the following example code.
I read the article linked in the solution to this question, but I’m not able to take it that final step for times (either a code problem or lack of understanding the process).
using AstroLib
using Dates
dateTime = DateTime("2024-01-13")
lat, lon = (38.88, -77.03)
jd = jdcnv(dateTime)
gmst = ct2lst(lon, -5, dateTime) # local sideral time in hours
## find local coords and hour angle (in degrees)
ra, dec = sunpos(jd) # get sun ra and dec
alt, az, ha = eq2hor(ra, dec, jd, lat, lon) # local alt, azi, and hour angle in degrees
## calculate transit
transit = ra/360 + lon/360 - gmst
if (transit < 0) transit += 24 end
transit_time = DateTime(year(dateTime), month(dateTime), day(dateTime), sixty(transit)[1], sixty(transit)[2])
# transit time is close, according to NOAA web site - 17:17 UTC (12:17 EST (local))
## Calculation of sunrise from transit and hour angle
sunrise = transit - ha/360
## convert to dateTime
sunrise_time = DateTime(year(dateTime), month(dateTime), day(dateTime), sixty(sunrise)[1], sixty(sunrise)[2])
## According to the NOAA calculator, sunrise should be at 12:26 UTC
It seems to have calculated the transit correctly (close to NOAA’s spreadsheet); however, I am not getting the sunrise to be even close (off by several hours). I assume I have botched units or a transform.
Any astronomy people out there familiar with AstroLib and might quickly see what is wrong?
Side question - Is Astrolib.jl considered fast/slow/similar compared to something like SunCalc? I typically need a few hundred days calculated at a time.