Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

From catalog to horizon

A star catalog gives you a direction in the ICRS, a frame centered on the solar system’s barycenter and tied to distant quasars. Your telescope points in a frame fixed to the ground under it. Between the two are the star’s own motion, the bending of light by the Sun, the Earth’s orbital and rotational velocity, the motion of the Earth’s axis, the Earth’s rotation and the atmosphere. celestial-coords gives each of those a step, and each frame along the way its own type.

Here is every step for Barnard’s Star, seen from Mauna Kea before dawn on 2026 April 10, with how far each step moves it:

use celestial_coords::aberration::apply_light_deflection;
use celestial_coords::astrom::earth::EarthRotation;
use celestial_coords::astrom::Astrom;
use celestial_coords::eop::EopProvider;
use celestial_coords::frames::icrs::ICRSPosition;
use celestial_coords::frames::topocentric::refraction::Refraction;
use celestial_coords::proper_motion::CatalogStar;
use celestial_core::angle::Angle;
use celestial_core::constants::{J2000_JD, MJD_ZERO_POINT};
use celestial_core::location::Location;
use celestial_core::math::angular_separation;
use celestial_core::matrix::Vector3;
use celestial_time::julian::JulianDate;
use celestial_time::scales::conversions::{ToTAI, ToTT};
use celestial_time::scales::tt::TT;
use celestial_time::scales::utc::UTC;

// Angle between two directions, in arcseconds.
fn shift(a: Vector3, b: Vector3) -> f64 {
    let ((ra1, dec1), (ra2, dec2)) = (a.to_spherical(), b.to_spherical());
    Angle::from_radians(angular_separation(ra1, dec1, ra2, dec2)).arcseconds()
}

// When and where
let utc: UTC = "2026-04-10T14:00:00Z".parse()?;
let tt = utc.to_tai()?.to_tt()?;
let jd = utc.to_julian_date();
let eop = EopProvider::bundled()?.get((jd.jd1() - MJD_ZERO_POINT) + jd.jd2())?;
let mauna_kea = Location::from_degrees(19.8207, -155.4681, 4205.0)?;

// Barnard's Star at the Gaia DR3 epoch, J2016.0
let barnard = CatalogStar {
    ra: Angle::from_degrees(269.44850252543),
    dec: Angle::from_degrees(4.73942005111),
    pm_ra_cos_dec_mas_per_year: -801.551,
    pm_dec_mas_per_year: 10362.394,
    parallax_mas: 546.976,
    radial_velocity_km_per_s: -110.47,
};
let j2016 = TT::from_julian_date(JulianDate::new(J2000_JD, 5844.0));

// 1. Proper motion: the star's ICRS place on the date
let moved = barnard.propagate(&j2016, &tt)?;
let catalog = ICRSPosition::new(barnard.ra, barnard.dec)?;
let icrs = ICRSPosition::new(moved.ra, moved.dec)?;

// 2 and 3. Light deflection, then aberration, seen from the site
let astrom = Astrom::for_site(&tt, &eop, &mauna_kea)?;
let deflected = apply_light_deflection(
    icrs.unit_vector(),
    astrom.sun_to_observer(),
    astrom.sun_distance_au(),
);
let gcrs = astrom.icrs_to_gcrs(&icrs)?;
let geocentric = Astrom::with_eop(&tt, &eop)?.icrs_to_gcrs(&icrs)?;

// 4. Precession-nutation: GCRS to CIRS
let cirs = astrom.gcrs_to_cirs(&gcrs)?;

// 5. Earth rotation: hour angle, then the horizon
let hour_angle = EarthRotation::new(&tt, &eop)?.cirs_to_hour_angle(&cirs, &mauna_kea)?;
let horizon = hour_angle.to_topocentric()?;

// 6. Refraction
let air = Refraction::new(615.0, 2.0, 0.3, 0.55)?;
let observed = horizon.with_refraction(&air);

println!("proper motion        {:9.3}\"", shift(catalog.unit_vector(), icrs.unit_vector()));
println!("light deflection     {:9.3}\"", shift(icrs.unit_vector(), deflected));
println!("annual aberration    {:9.3}\"", shift(deflected, geocentric.unit_vector()));
println!("diurnal aberration   {:9.3}\"", shift(geocentric.unit_vector(), gcrs.unit_vector()));
println!("precession-nutation  {:9.3}\"", shift(gcrs.unit_vector(), cirs.unit_vector()));
println!("refraction           {:9.3}\"", (observed.elevation() - horizon.elevation()).arcseconds());
println!();
println!("HA {:.4} h, Dec {:.4}°", hour_angle.hour_angle().hours(), hour_angle.declination().degrees());
println!("az {:.4}°, el {:.4}°", observed.azimuth().degrees(), observed.elevation().degrees());
// proper motion          106.835"
// light deflection         0.003"
// annual aberration       11.471"
// diurnal aberration       0.289"
// precession-nutation     45.641"
// refraction              14.664"
//
// HA -1.0950 h, Dec 4.7630°
// az 131.1203°, el 68.0376°

The rest of this page goes through those steps in order. If you want the recipe without the tour, Find the altitude and azimuth of a star has it.

The frames

Each stage of the chain is a type in celestial_coords::frames:

TypeModuleWhat the frame includes
ICRSPositionframes::icrsThe catalog place: barycentric, ICRS axes
GCRSPositionframes::gcrsLight deflection and aberration, ICRS axes
CIRSPositionframes::cirsFrame bias, precession and nutation
HourAnglePositionframes::topocentricEarth rotation and the site’s longitude
TopocentricPositionframes::topocentricThe site’s latitude: azimuth and elevation
TIRSPositionframes::tirsEarth rotation, as Cartesian x, y, z
ITRSPositionframes::itrsPolar motion: Earth-fixed x, y, z

The types keep you from mixing stages. A method that needs an apparent place takes a GCRSPosition or CIRSPosition, so you can’t pass it a catalog place by mistake. Every frame below the ICRS also stores its epoch, so a later step can check that the position and the Earth orientation it applies belong to the same moment.

Proper motion

Stars move across the sky. Barnard’s Star moves 10.4″ a year, so by 2026 it’s 107″ from its Gaia DR3 position at J2016.0. CatalogStar::propagate moves a catalog entry from one epoch to another using its proper motion, parallax and radial velocity. It models a straight-line path through space, with the light-time and special-relativistic terms, and its tests match ERFA’s eraPmsafe exactly.

Propagation happens before the chain, because ICRSPosition holds a direction and an optional distance but no motion. Propagate the catalog entry to the date, then build the ICRSPosition from the result’s ra and dec.

A star with a zero, negative or tiny parallax still propagates. Like eraPmsafe, propagate raises such a parallax to a value that keeps the star’s implied speed well below the speed of light.

Light deflection

The Sun’s gravity bends starlight, by about 1.75″ for a ray that grazes the solar limb and by about 4 milliarcseconds 90° away. Barnard’s Star is far from the Sun in April, so the shift is 3 mas. Very close to the Sun’s center, well inside the limb, the correction is tapered to zero so it doesn’t blow up.

aberration::apply_light_deflection exposes this step on its own. The chain applies it inside Astrom::icrs_to_gcrs and Astrom::icrs_to_cirs.

Aberration

Light arrives from a slightly different direction when you’re moving across its path. The Earth’s orbital speed of about 30 km/s shifts stars by up to about 20.5″. That’s annual aberration, and the 11.5″ above is its value for this star on this date. The crate computes the Earth’s barycentric velocity from the series in aberration::compute_earth_state, which its tests check against ERFA’s eraEpv00, and applies the full relativistic formula.

The Earth’s rotation also carries the telescope eastward, at up to 465 m/s on the equator. That adds diurnal aberration of up to 0.32″. It depends on where you stand, so only Astrom::for_site includes it. The geocentric conversions leave it out.

Precession and nutation

The GCRS to CIRS step rotates the axes to the Earth’s true pole of date, with the right ascension origin at the Celestial Intermediate Origin (CIO). It uses the IAU 2006/2000A precession-nutation matrix and the CIO locator s. How far it moves a star depends on where the star is: 45.6″ for Barnard’s Star in 2026. Precession, nutation and obliquity covers the models, and The CIO and the equinox explains why the CIRS measures right ascension from the CIO rather than the equinox.

When you pass Earth orientation data, Astrom::with_eop and Astrom::for_site add the observed pole offsets dX and dY to the model pole. In the 2026 data those offsets are below a milliarcsecond.

Earth rotation

The Earth rotation angle (ERA) is a linear function of UT1, the time scale that follows the Earth’s actual rotation. UT1 drifts away from UTC in ways nobody can predict, so the IERS measures UT1-UTC and publishes it. Earth orientation parameters covers where those values come from.

EarthRotation::new(&tt, &eop) computes the ERA once for an epoch. Its cirs_to_hour_angle measures the hour angle from the site’s meridian, which is at ERA plus the site’s east longitude. HourAnglePosition::to_topocentric then turns hour angle and declination into azimuth, measured from north through east, and elevation.

HourAnglePosition has a few helpers for planning:

  • parallactic_angle() is the angle between the directions to the pole and to the zenith, at the star.
  • is_circumpolar() and never_rises() compare the declination with the site’s latitude.

Earth-fixed Cartesian frames

The TIRS and ITRS are the same rotation as Cartesian vectors. cirs.to_tirs(&eop) turns the CIRS by the ERA. tirs.to_itrs(&eop) then applies polar motion, the drift of the Earth’s crust relative to its rotation axis by a few tenths of an arcsecond. The polar motion matrix uses the IERS 2003 model of the TIO locator s′. ITRSPosition converts to and from WGS84 geodetic longitude, latitude and height with to_geodetic and from_geodetic.

Refraction

The positions so far are where the star would be with no air. The atmosphere raises it, by 14.7″ here at 68° elevation. with_refraction applies that. Atmospheric refraction covers the models and the weather inputs they take.

Convert one position or a catalog

Every frame that needs only an epoch to reach the ICRS implements the CoordinateFrame trait in celestial_coords::transforms:

pub trait CoordinateFrame: Sized {
    fn to_icrs(&self, epoch: &TT) -> CoordResult<ICRSPosition>;
    fn from_icrs(icrs: &ICRSPosition, epoch: &TT) -> CoordResult<Self>;
}

CIRSPosition::from_icrs(&star, &tt) is the shortest way from a catalog place to the CIRS. Each call builds the Earth’s state and the precession-nutation matrix for the epoch from scratch, though. For more than a few stars at one time, build an Astrom once and reuse it. The constructors differ in what they include:

CallLight deflection and annual aberrationdX, dYDiurnal aberration
CIRSPosition::from_icrs(&star, &tt)yesnono
Astrom::new(&tt)yesnono
Astrom::with_eop(&tt, &eop)yesyesno
Astrom::for_site(&tt, &eop, &site)yesyesyes

EarthRotation does the same for the steps below the CIRS. CIRSPosition::to_hour_angle and to_tirs build one per call. Build one yourself to reuse it across positions.

TIRSPosition, ITRSPosition, HourAnglePosition and TopocentricPosition don’t implement CoordinateFrame, because they need Earth orientation data or a site as well as an epoch.

Go back the other way

Every step has an inverse, so you can turn an encoder reading into a catalog place: without_refraction, TopocentricPosition::to_hour_angle, HourAnglePosition::to_cirs, Astrom::cirs_to_icrs and CoordinateFrame::to_icrs. Removing light deflection and aberration has no closed form, so the inverses iterate a fixed number of times, as ERFA’s eraAticq does. A round trip from ICRS to CIRS and back comes back within about 1e-13 rad.

Diurnal parallax

A star is far enough away that it looks the same from anywhere on Earth. The Moon isn’t: from the surface you see it up to about a degree away from where it is in the geocentric sky. TopocentricPosition corrects for this when it has a distance:

use celestial_coords::distance::Distance;
use celestial_coords::frames::topocentric::TopocentricPosition;
use celestial_core::angle::Angle;
use celestial_core::location::Location;
use celestial_time::scales::tt::TT;

let site = Location::from_degrees(19.8207, -155.4681, 4205.0)?;

// The Moon's geocentric place, turned to this site's horizon
let geocentric = TopocentricPosition::with_distance(
    Angle::from_degrees(120.0),
    Angle::from_degrees(30.0),
    site,
    TT::j2000(),
    Distance::from_kilometers(384_400.0)?,
)?;
let seen = geocentric.with_diurnal_parallax()?;

println!("el {:.4}° -> {:.4}°", geocentric.elevation().degrees(), seen.elevation().degrees());
println!("az {:.4}° -> {:.4}°", geocentric.azimuth().degrees(), seen.azimuth().degrees());
println!("distance {:.0} km", seen.distance().map_or(0.0, |d| d.kilometers()));
println!("horizontal parallax {:.2}'", geocentric.horizontal_parallax()?.map_or(0.0, |p| p.arcminutes()));
// el 30.0000° -> 29.1701°
// az 120.0000° -> 119.9980°
// distance 381244 km
// horizontal parallax 57.04'

The site’s position comes from Location::to_geocentric_meters, so the correction uses the WGS84 ellipsoid, as Observer locations describes. without_diurnal_parallax goes the other way, and diurnal_parallax returns the change in elevation. A position without a distance comes back unchanged, and the angle-returning methods return None.

What the chain leaves out

  • Annual parallax. The chain treats every ICRSPosition as a direction from the barycenter and never moves it to the Earth’s position. A distance set on the position travels with it through the conversions, but it doesn’t change the direction. For Barnard’s Star that leaves out up to 0.55″. For stars with parallaxes of a few milliarcseconds or less, the omission is below most other errors.
  • Polar motion in hour angle and azimuth. cirs_to_hour_angle uses UT1-UTC from the EOP record but not the polar motion x and y. Polar motion is applied only on the TIRS to ITRS step. The values are a few tenths of an arcsecond, and the hour angle, azimuth and elevation are off by up to that much.
  • Solar-system bodies. Light deflection treats the source as infinitely far away, and nothing in the chain corrects for light time. The Moon and planets need a geocentric position from an ephemeris, and the Moon needs the diurnal parallax correction above.

Edge cases

  • Astrom and EarthRotation reject a position whose epoch differs from their own, instead of applying the Earth’s orientation from a different moment.
  • GCRSPosition, CIRSPosition and EclipticPosition store their epoch, and their to_icrs uses it in place of the epoch argument.
  • cirs.to_tirs scales the vector by the distance in AU when the position has one. The way back, tirs.to_cirs, returns a direction without a distance.
  • HourAnglePosition::new accepts declinations past ±90° for German equatorial mounts after a pier flip, and folds them back over the pole, 12 hours of hour angle away.
  • The Earth rotation steps reject an EOP record more than one day from the epoch. See Earth orientation parameters.

Where next