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

Atmospheric refraction

Light bends as it enters the atmosphere, so every star appears higher than it is. At the zenith the effect is zero. At 45° it’s about a minute of arc at sea level, and near the horizon it grows fast. Thinner air bends light less, so a mountain site sees less of it:

use celestial_coords::frames::topocentric::refraction::Refraction;
use celestial_coords::frames::topocentric::TopocentricPosition;
use celestial_core::location::Location;
use celestial_time::scales::tt::TT;

let site = Location::from_degrees(19.8207, -155.4681, 4205.0)?;
// Pressure (hPa), temperature (°C), relative humidity (0-1), wavelength (µm)
let sea_level = Refraction::new(1013.25, 10.0, 0.5, 0.55)?;
let summit = Refraction::new(615.0, 2.0, 0.3, 0.55)?;

for elevation in [90.0, 60.0, 30.0, 10.0, 5.0, 2.0] {
    let observed = TopocentricPosition::from_degrees(180.0, elevation, site, TT::j2000())?;
    println!(
        "el {elevation:4.0}°  sea level {:7.1}\"  summit {:7.1}\"",
        observed.atmospheric_refraction(&sea_level).arcseconds(),
        observed.atmospheric_refraction(&summit).arcseconds(),
    );
}
// el   90°  sea level     0.0"  summit     0.0"
// el   60°  sea level    33.6"  summit    21.0"
// el   30°  sea level   100.5"  summit    62.8"
// el   10°  sea level   318.2"  summit   198.7"
// el    5°  sea level   568.0"  summit   354.0"
// el    2°  sea level   643.1"  summit   396.8"

The value at 2° is too small. Refraction on a TopocentricPosition is held at its value for about 2.9° elevation below that height, as ERFA’s refraction is, because the two-constant formula below stops working near the horizon. Refraction there also depends on the air along the line of sight more than on any model.

Two constants

Away from the horizon, refraction follows a two-term formula in the observed zenith distance z:

refraction = A tan z + B tan³ z

Refraction holds A and B, in radians. You get them from the weather, through a refraction model:

  • Refraction::new(pressure_hpa, temperature_c, relative_humidity, wavelength_um) uses the closed-form model.
  • Refraction::from_weather(&weather) runs a numerical ray trace through a model atmosphere.
  • Refraction::from_model(&model, &weather) takes any RefractionModel.

Once you have a Refraction, applying it costs a few multiplications, so compute it once per change in the weather.

Choose a model

use celestial_coords::frames::topocentric::refraction::closed_form::ClosedForm;
use celestial_coords::frames::topocentric::refraction::ray_trace::{RayTrace, Refractivity};
use celestial_coords::frames::topocentric::refraction::weather::Weather;
use celestial_coords::frames::topocentric::refraction::Refraction;
use celestial_core::constants::ARCSEC_PER_RAD;
use celestial_core::location::Location;

let site = Location::from_degrees(19.8207, -155.4681, 4205.0)?;
let weather = Weather::new(615.0, 2.0, 0.3, 0.55)?.with_location(&site)?;

let models: [(&str, Refraction); 3] = [
    ("closed form", Refraction::from_model(&ClosedForm, &weather)?),
    ("ray trace, Ciddor", Refraction::from_weather(&weather)?),
    (
        "ray trace, H&S",
        Refraction::from_model(&RayTrace::new(Refractivity::HohenkerkSinclair), &weather)?,
    ),
];
for (name, r) in models {
    println!(
        "{name:18} A = {:.4}\"  B = {:.6}\"",
        r.a() * ARCSEC_PER_RAD,
        r.b() * ARCSEC_PER_RAD
    );
}
// closed form        A = 36.3711"  B = -0.041347"
// ray trace, Ciddor  A = 36.3588"  B = -0.040597"
// ray trace, H&S     A = 36.3668"  B = -0.040607"

The three agree to about 0.01″ in A. They differ in cost and in what they take into account.

ClosedForm computes A and B from formulas, with no integration. It uses the formulas ERFA’s eraRefco uses, and it’s the model behind Refraction::new. It reads pressure, temperature, humidity and wavelength, and ignores the site’s height, latitude and lapse rate. Each input is clamped to the range the formulas hold over.

RayTrace integrates the bending along a ray through the two-layer atmosphere of Hohenkerk and Sinclair (NAO Technical Note 63). Temperature falls at a constant lapse rate up to the tropopause at 11 km and stays constant above it, and the stratosphere is dry. The integral runs to 80 km and stops when successive estimates agree to 1e-8 rad. The ray trace then fits A and B so they’re exact at tan z = 1 and tan z = 4, which is z = 45° and z = 76°. It takes longer than the closed form, but it uses the site’s height and latitude.

The ray trace takes one of two formulas for the refractive index of air at optical wavelengths:

  • Refractivity::Ciddor, the default, uses Ciddor (1996) as given in the NIST Engineering Metrology Toolbox, with 450 µmol/mol of carbon dioxide. It needs a wavelength of at least 0.3 µm.
  • Refractivity::HohenkerkSinclair uses the refractivity of NAO Technical Note 63. Its tests agree with a SLALIB-compatible sla_REFCO to within 2e-9 rad in A, so use it when you need to match older SLALIB-based software.

Above 100 µm both refractivities give way to the radio formula of Rueger (2002), and the closed form switches to its radio formulas at the same wavelength.

Weather and site

Weather::new(pressure_hpa, temperature_c, relative_humidity, wavelength_um) holds the conditions at the telescope. Relative humidity runs from 0 to 1. Use the station pressure at the telescope, not the sea-level pressure a weather service reports. The two differ by about 40% on Mauna Kea.

The ray trace also reads three properties of the site, with defaults for a sea-level site at the equator:

  • with_location(&site) sets the height and latitude from a Location.
  • with_site(height_m, latitude) sets them directly.
  • with_lapse_rate(kelvin_per_metre) sets the temperature gradient. The default is 0.0065 K/m, the standard tropospheric value. The sign is ignored.

Apply it

with_refraction takes the place you’d see with no atmosphere, which is what the coordinate chain gives you, and returns where you see the star. without_refraction goes back:

use celestial_coords::frames::topocentric::refraction::Refraction;
use celestial_coords::frames::topocentric::TopocentricPosition;
use celestial_core::location::Location;
use celestial_time::scales::tt::TT;

let site = Location::from_degrees(19.8207, -155.4681, 4205.0)?;
let air = Refraction::new(615.0, 2.0, 0.3, 0.55)?;

// The place with no atmosphere, from the coordinate chain
let true_place = TopocentricPosition::from_degrees(250.0, 20.0, site, TT::j2000())?;

let observed = true_place.with_refraction(&air);
let back = observed.without_refraction(&air);

println!("true     {:.6}°", true_place.elevation().degrees());
println!("observed {:.6}°", observed.elevation().degrees());
println!("back     {:.6}°", back.elevation().degrees());
// true     20.000000°
// observed 20.027479°
// back     20.000000°

Only the elevation changes. atmospheric_refraction returns the amount itself, and expects the observed place, as the first example on this page does.

Refraction at one zenith distance

On this site, A and B stay within 0.3″ of the full ray trace out to a zenith distance of 80°. Past that, use the RefractionModel trait’s refraction_at, which gives the model’s own value at one zenith distance. For RayTrace that’s a full ray trace, which stays accurate where the two-term formula doesn’t:

use celestial_coords::frames::topocentric::refraction::ray_trace::RayTrace;
use celestial_coords::frames::topocentric::refraction::weather::Weather;
use celestial_coords::frames::topocentric::refraction::RefractionModel;
use celestial_core::angle::Angle;
use celestial_core::constants::ARCSEC_PER_RAD;
use celestial_core::location::Location;

let site = Location::from_degrees(19.8207, -155.4681, 4205.0)?;
let weather = Weather::new(615.0, 2.0, 0.3, 0.55)?.with_location(&site)?;
let trace = RayTrace::default();
let (a, b) = trace.constants(&weather)?;

for zd in [45.0, 75.0, 85.0, 89.0] {
    let z = Angle::from_degrees(zd);
    let t = z.tan();
    println!(
        "z {zd:2.0}°  ray trace {:8.2}\"  A tan z + B tan³ z {:8.2}\"",
        trace.refraction_at(&weather, z.radians())? * ARCSEC_PER_RAD,
        (a * t + b * t * t * t) * ARCSEC_PER_RAD,
    );
}
// z 45°  ray trace    36.32"  A tan z + B tan³ z    36.32"
// z 75°  ray trace   133.57"  A tan z + B tan³ z   133.58"
// z 85°  ray trace   368.66"  A tan z + B tan³ z   354.96"
// z 89°  ray trace   896.99"  A tan z + B tan³ z -5550.68"

Both angles are radians. refraction_at takes the observed zenith distance, and observed_zenith_distance solves the other way, from the zenith distance with no atmosphere to the observed one. For ClosedForm, refraction_at is the two-term formula itself, so it has the same problem near the horizon.

Airmass

Airmass is how much atmosphere you look through, relative to looking straight up. It sets how much extinction dims a star. TopocentricPosition has three empirical formulas:

use celestial_coords::frames::topocentric::TopocentricPosition;
use celestial_core::location::Location;
use celestial_time::scales::tt::TT;

let site = Location::from_degrees(19.8207, -155.4681, 4205.0)?;
for elevation in [90.0, 30.0, 10.0, 3.0, 0.0] {
    let p = TopocentricPosition::from_degrees(180.0, elevation, site, TT::j2000())?;
    println!(
        "el {elevation:2.0}°  Rozenberg {:6.3}  Kasten-Young {:6.3}  Pickering {:6.3}",
        p.air_mass(),
        p.air_mass_kasten_young(),
        p.air_mass_pickering()
    );
}
// el 90°  Rozenberg  1.000  Kasten-Young  1.000  Pickering  1.000
// el 30°  Rozenberg  2.000  Kasten-Young  1.994  Pickering  1.993
// el 10°  Rozenberg  5.639  Kasten-Young  5.586  Pickering  5.581
// el  3°  Rozenberg 15.062  Kasten-Young 15.148  Pickering 15.262
// el  0°  Rozenberg 40.000  Kasten-Young 38.000  Pickering 38.749

air_mass is the Rozenberg formula. They agree to about 1% above 10° elevation. At and below the horizon, Rozenberg returns 40 and Kasten-Young returns 38. Pickering’s formula stays finite down to about -1.1° and returns infinity below that.

Edge cases

  • Weather::new and its builders reject NaN and infinite values. The ray trace also rejects a negative pressure, humidity outside 0 to 1, a temperature at or below absolute zero, a zero lapse rate, a site at or above the 11 km tropopause, and conditions that would cool the tropopause below absolute zero.
  • A pressure of zero gives no refraction from the ray trace.
  • Refractivity::Ciddor rejects wavelengths below 0.3 µm, where its dispersion formula has poles nearby. Use Refractivity::HohenkerkSinclair or ClosedForm there.
  • refraction_at and observed_zenith_distance take zenith distances from 0 to 90° only. observed_zenith_distance returns an error if it hasn’t converged after 50 iterations.

Where next