Use when working with astronomical coordinate systems — converting between equatorial (RA/Dec), horizontal (Az/Alt), ecliptic, and galactic coordinates, and applying precession, refraction, and parallax corrections for accurate sky position calculations.
Scanned 9/8/2026
Install to Claude Code
npx -y skills add jeffreytse/grimoire-core --skill calculate-celestial-coordinates --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Calculate Celestial Coordinates?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/jeffreytse-calculate-celestial-coordinates)More formats (shields.io, HTML) on the badges page.
---
name: calculate-celestial-coordinates
description: Use when working with astronomical coordinate systems — converting between equatorial (RA/Dec), horizontal (Az/Alt), ecliptic, and galactic coordinates, and applying precession, refraction, and parallax corrections for accurate sky position calculations.
source: Meeus "Astronomical Algorithms" 2nd ed. (1998); Green "Spherical Astronomy" (1985); USNO Astronomical Almanac; IAU SOFA (Standards of Fundamental Astronomy) library documentation
tags: [astronomy, coordinates, right-ascension, declination, coordinate-transformation, precession, astrometry]
---
# Calculate Celestial Coordinates
Convert between celestial coordinate systems — equatorial (RA/Dec), horizontal (Az/Alt), ecliptic, and galactic — applying rigorous transformations including precession, nutation, aberration, and atmospheric refraction to achieve accurate positions for observation planning and astrometric work.
## Why This Is Best Practice
**Why best:** Rigorous coordinate transformation with full precession, nutation, aberration, and refraction correction is the only approach that yields astrometric accuracy — approximate or single-epoch methods accumulate arcminute-to-degree errors that break telescope pointing and source identification.
**Adopted by:** IAU (International Astronomical Union) defines the reference frames (ICRS — International Celestial Reference System) and the standard corrections (SOFA library) used by all professional observatories, space telescopes (Hubble, JWST), and satellite tracking. NASA JPL uses DE440 ephemeris with full astrometric corrections for solar system position predictions. Gaia mission astrometry achieves µas-level precision using complete IAU 2006/2000B precession-nutation models.
**Impact:** Meeus (1998) is the definitive practical reference for astronomical algorithms — all major planetarium software (Stellarium, Cartes du Ciel, SkySafari) implements Meeus algorithms. Position errors from ignoring precession accumulate at ~50 arcsec/year (J2000 vs current epoch) — significant enough to cause telescope pointing failures and make guide star identification ambiguous. Professional astrometry requires sub-arcsecond accuracy, only achievable with full correction chains.
## Steps
### 1. Establish the reference epoch
All coordinates must specify the reference epoch:
- **J2000.0 (FK5 / ICRS):** the current standard; RA and Dec relative to mean equinox of January 1, 2000, 12:00 TT
- **ICRS:** the modern realization (within 20 mas of FK5 J2000)
- **Apparent coordinates:** coordinates in the true equinox of date (includes precession + nutation)
Published catalog coordinates (Hipparcos, Gaia DR3) are in ICRS. Telescope pointing uses apparent coordinates of date.
### 2. Convert equatorial to horizontal coordinates (Az/Alt)
Required for telescope pointing and observation planning:
Inputs: RA (α), Dec (δ), Observer latitude (φ), Observer longitude (λ), Universal Time (UT)
Step 1: Calculate Local Sidereal Time (LST):
```
GMST = 6h 41m 50.54841s + 8640184.812866s × T + 0.093104s × T² (at 0h UT)
Where T = Julian centuries from J2000.0
LST = GMST + (East longitude in hours)
```
Step 2: Calculate Hour Angle (H):
```
H = LST − α
```
Step 3: Convert to horizontal:
```
sin(Alt) = sin(δ)sin(φ) + cos(δ)cos(φ)cos(H)
cos(Az)sin(Azimuth distance) = −cos(δ)sin(H)
cos(Az)cos(Azimuth distance) = sin(δ)cos(φ) − cos(δ)sin(φ)cos(H)
```
Or use the rotated frame directly:
```python
import numpy as np
def equatorial_to_horizontal(ra_deg, dec_deg, lat_deg, lst_hours):
H = np.radians((lst_hours - ra_deg/15) * 15) # Hour angle
dec = np.radians(dec_deg)
lat = np.radians(lat_deg)
sin_alt = np.sin(dec)*np.sin(lat) + np.cos(dec)*np.cos(lat)*np.cos(H)
alt = np.degrees(np.arcsin(sin_alt))
cos_az = (np.sin(dec) - np.sin(lat)*sin_alt) / (np.cos(lat)*np.cos(np.radians(alt)))
az = np.degrees(np.arccos(np.clip(cos_az, -1, 1)))
if np.sin(H) > 0:
az = 360 - az # correct for sign ambiguity
return alt, az
```
### 3. Apply precession correction
Precession shifts RA and Dec at ~50.3"/year (general precession in longitude):
**Rigorous precession (IAU 2006 P03):**
Use the SOFA library (py-sofa Python wrapper) for professional-grade accuracy:
```python
import erfa # Python wrapper for SOFA/ERFA
# Precess from J2000.0 to date
ra2000, dec2000 = np.radians(ra_deg), np.radians(dec_deg)
ra_date, dec_date = erfa.pmsafe(ra2000, dec2000, 0, 0, 0, 0, 2451545.0, jd_date)
```
**Simplified precession (for <0.1° accuracy over <100 years):**
```
Δα = (M + N·sin(α)·tan(δ)) × n_years
Δδ = N·cos(α) × n_years
M = 1.2812323 degrees/year; N = 0.5567530 degrees/year (approximate J2000 rates)
```
### 4. Apply atmospheric refraction correction
Atmosphere bends light toward zenith — stars appear higher than their geometric position:
```
R ≈ 1.02 / tan(h + 10.3/(h + 5.11)) (arcminutes)
Where h = true altitude in degrees
```
Correction is significant:
- h = 0° (horizon): R ≈ 34' (more than 1 solar diameter!)
- h = 10°: R ≈ 5.3'
- h = 45°: R ≈ 1.0'
- h = 90° (zenith): R ≈ 0
Apply: apparent altitude = true altitude + R.
Note: this is the Bennett formula (1982); more accurate models include temperature and pressure.
### 5. Convert between coordinate systems
**Equatorial ↔ Ecliptic** (ecliptic obliquity ε ≈ 23.4°):
```
sin(β) = sin(δ)cos(ε) − cos(δ)sin(ε)sin(α)
tan(λ) = (sin(α)cos(ε) + tan(δ)sin(ε)) / cos(α)
```
**Equatorial ↔ Galactic** (using IAU definition: north galactic pole at α=192.85°, δ=27.13°):
```python
# Use astropy for reliable coordinate transformations
from astropy.coordinates import SkyCoord
import astropy.units as u
c_eq = SkyCoord(ra=83.82*u.deg, dec=-5.39*u.deg, frame='icrs')
c_gal = c_eq.galactic
print(c_gal.l.deg, c_gal.b.deg) # Galactic longitude l, latitude b
```
### 6. Calculate rise, transit, and set times
For object at (RA, Dec) from observer at latitude φ:
```
Hour angle at rise/set: cos(H0) = (sin(h0) − sin(δ)sin(φ)) / (cos(δ)cos(φ))
h0 = −0.5667° (for stars accounting for atmospheric refraction)
h0 = −0.8333° (for Sun center, accounting for semi-diameter + refraction)
```
Transit altitude: Alt_max = 90° − |φ − δ| (for object that crosses the meridian)
Object is circumpolar if δ > 90° − φ (northern hemisphere) — never sets.
## Common Mistakes
- **Mixing J2000 catalog coordinates with current apparent positions without precessing:** A 20-year-old catalog gives positions ~17' off current position due to precession. Always precess to the date of observation.
- **Ignoring atmospheric refraction for low-altitude observations:** Below 20° altitude, refraction is arcminutes — far exceeding the typical telescope pointing tolerance of 30".
- **Using degrees vs hours for RA:** RA is conventionally in hours (0-24h) for display; calculations require radians; mixing degree/hour/radian units is the most common error.
## When NOT to Use
- Proper motion stars over multi-decade timescales: proper motion (e.g., Barnard's Star moves 10.3"/year) must be propagated alongside precession; catalog coordinates without proper motion correction fail for high-proper-motion objects.Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!