A package that implements positional astronomy tools as described in the book Celestial Calculations by J. L. Lawrence.
CelestialCalc was created for (self-)educational purposes and its main goal is teaching myself positional astronomy in more depth. The package is made available as open source for anyone interested in amateur computational astronomy. Keep in mind that Julia already has some astronomy packages (many of them under the JuliaAstro organization) that might be a better fit for serious use.
This package is a work in progress.
Current state (loosely following the book's outline)
- Time conversions
- LCT to UT
- UT to LCT
- UT to GST
- GST to UT
- GST to LST
- LST to GST
- Coordinate Systems
- Equatorial
- Horizon
- Ecliptic
- Galactic
- Precession and other corrections
- Stars
- Equatorial to horizon coordinates
- Rising and setting times
- Star maps
- Sun
- Moon
- Solar System
- Satellites
Given a star's equatorial coordinates (e.g. Betelgeuse in J2000) and an observer's local date/time and position, find the object's horizon coordinates.
using CelestialCalc, Dates, TimeZones
# equatorial coordinates for Betelgeuse in J2000
eq = EquatorialCoordinates(α=Time(5,55,10),δ=Angle(7,24,24))
# observer's local date/time and position
datetime = ZonedDateTime(2024,1,5,20,tz"UTC-3")
location = LatLng(-22.9068,-43.1729)
# local horizon coordinates
hz = equatorial_to_horizon(eq, datetime, location)
# HorizonCoordinates h=39°00'34.33'' Az=58°30'24.15''
using CelestialCalc, TimeZones, Plots
# load the Bright Star catalog
brightstars = brightstars_catalog()
# define observer's date/time and position
date = ZonedDateTime(2024,1,2,22,45,tz"UTC-3")
latlng = LatLng(-22.9068, -43.1729)
# convert the equatorial coordinates of the catalog to the observer's horizon coordinates
brightstars_horizon = [Star(equatorial_to_horizon(star.coordinates, date, latlng), star.magnitude) for star in brightstars]
# filter only above-horizon stars within a certain magnitude
filter!(s -> s.coordinates.h >= 0 && s.magnitude <= 4.0, brightstars_horizon)
# create the star map
plot(brightstars_horizon; size=(900,800), colormode=:dark)