🧪 Experimental solar image coordinates
Pure functions that convert between the coordinate systems of a solar image. They follow Thompson (2006), "Coordinate systems for solar image data", A&A 449, 791, Sections 3 to 7. They use no ephemeris: the caller gives the position of the observer, usually from the FITS header.
Coordinate systems​
- Heliographic (Stonyhurst). Longitude and latitude on the Sun, in degrees, and a radius in metres. Longitude 0 is the meridian that crosses the Sun-Earth line. Carrington longitude rotates with the Sun instead.
- Heliocentric Cartesian. Metres from the Sun centre. x points to solar west, y to solar north, and z to the observer. The observer is at (0, 0, D).
- Helioprojective. The angles (θx, θy), in arcseconds, west and north of the Sun centre as the observer sees them. θx = atan2(x, D − z) and θy = asin(y / d), where d is the distance from the observer to the point.
SolarObserver​
| Field | Meaning | FITS keyword |
|---|---|---|
latitude | Heliographic latitude of the observer, B0, deg | HGLT_OBS |
longitude | Stonyhurst longitude of the observer, deg | HGLN_OBS |
distance | Distance from the Sun centre, metres | DSUN_OBS |
carringtonLongitude | Carrington longitude of the observer, L0, deg | CRLN_OBS |
longitude is 0 for an Earth observer. carringtonLongitude is optional. Only the Carrington
functions need it, and they throw RangeError without it.
import {
SOLAR_RADIUS_METERS,
heliographicToHeliocentric,
heliocentricToHelioprojective,
getSolarObserver,
isOnVisibleSide
} from '@math.gl/earth/celestial';
import type {JulianDate, SolarObserver} from '@math.gl/earth/celestial';
// header: a FITS header of a SUVI image. tt: the TT date of the image, a JulianDate.
declare const header: Record<string, number | undefined>;
declare const tt: JulianDate;
// GOES SUVI L2 headers have no CRLN_OBS. The offset between Stonyhurst and Carrington longitude
// is the same for all points at one time, so L0 + HGLN_OBS gives the Carrington longitude of
// the observer.
const observer: SolarObserver = {
latitude: header.HGLT_OBS!,
longitude: header.HGLN_OBS!,
distance: header.DSUN_OBS!,
carringtonLongitude:
header.CRLN_OBS ?? getSolarObserver(tt).carringtonLongitude + header.HGLN_OBS!
};
const radius = header.RSUN_REF ?? SOLAR_RADIUS_METERS;
const point = heliographicToHeliocentric(-30, 20, observer, radius);
if (isOnVisibleSide(point, observer, radius)) {
const [thetaX, thetaY] = heliocentricToHelioprojective(point, observer); // arcsec
}
Functions​
SOLAR_RADIUS_METERSis 695 700 000 m.heliographicToHeliocentric(longitude, latitude, observer, radius?)returns [x, y, z], metres.heliocentricToHeliographic(point, observer)returns [longitude, latitude, radius]. Longitude is in (-180, 180]. A pole has longitude 0.heliocentricToHelioprojective(point, observer)returns [θx, θy], arcseconds.helioprojectiveToHeliocentric(theta, observer, radius?)returns the point where the line of sight meets the sphere, on the side nearer to the observer. It returnsnullwhen the ray misses.isOnVisibleSide(point, observer, radius?)is true when z ≥ R² / D. This is the exact limb of a sphere seen from a finite distance. It is not the plane z = 0.getSolarAngularRadius(distance, radius?)returns asin(R / D), arcseconds. It is about 959.2 arcsec at 1 au.stonyhurstToCarrington(longitude, observer)andcarringtonToStonyhurst(longitude, observer)add or remove the offsetcarringtonLongitude − longitudeof the observer. Carrington longitude is in [0, 360).
All functions throw RangeError for a non-finite input. heliographicToHeliocentric,
heliocentricToHelioprojective, helioprojectiveToHeliocentric, isOnVisibleSide and
getSolarAngularRadius also throw for a non-positive radius or a distance that is not larger than
the radius. heliocentricToHelioprojective uses SOLAR_RADIUS_METERS for this check.
Earth-observer ephemeris​
getSolarObserver(tt) gives the SolarObserver of the geocentre at a TT date, with two more
angles. Use it when an image has no observer keywords, or to plan an observation.
import {JulianDate, getSolarObserver} from '@math.gl/earth/celestial';
// 2026-11-28T23:57:22Z UTC. TT − UTC is 69.184 s from 2017 to 2026.
const tt = JulianDate.fromUnixMilliseconds(Date.parse('2026-11-28T23:57:22Z'), 69.184, 'TT');
const observer = getSolarObserver(tt);
// observer.latitude ≈ 1.17, observer.positionAngle ≈ 16.9
| Field | Meaning |
|---|---|
distance | Distance from the Sun centre to the Earth, metres |
latitude | B0: the heliographic latitude of the Earth, degrees |
longitude | 0: Stonyhurst longitude is measured from the Sun-Earth line |
carringtonLongitude | L0: the Carrington longitude of the disc centre, degrees, in [0, 360) |
positionAngle | P: the angle of the solar north pole, east of celestial north, in (−180, 180] |
carringtonRotation | The Carrington rotation number, a real number |
- B0 is the angle between the solar equator and the Sun-Earth line. It goes from about −7.25° in early March to +7.25° in early September.
- L0 is the longitude of the disc centre in the frame that turns with the Sun. The IAU prime meridian of the Sun is the Carrington meridian. L0 decreases by about 13.2° per day. The function uses the Sun orientation at the time the light left the Sun, tt − distance / c.
- P is the angle on the sky from celestial north to the solar north pole, positive to the east. It goes from about −26.3° in early April to +26.3° in early October. The function uses the mean equator of date (IAU 1976 precession). It applies no nutation and no aberration.
- carringtonRotation has the fractional part (360 − L0) / 360. Its integer part is the rotation number that makes the value closest to 1690 + (JD(TT) − 2444235.34) / 27.2753.
The Earth position is the Earth-Moon barycentre of getApproximatePlanetPosition. The barycentre
is about 4 700 km from the geocentre, which changes B0 and L0 by up to about 0.002°. The Sun
orientation is the IAU WGCCRE 2015 model (Archinal et al. 2018). The values agree with the FITS
headers of GOES-19 SUVI images to better than 0.01° in B0 and 15 000 km in distance. GOES is up
to 42 000 km from the geocentre, so part of this difference is parallax.
From 2050 to 2100 the JPL Table 2 fit of getApproximatePlanetPosition applies: 40 arcseconds in
longitude and 15 000 km for the Earth-Moon barycentre. The switch at 2050 gives no step. A SunPy
8.0.1 cross-check over 1950 to 2050 agrees within 0.0012° (B0), 0.007° (L0), 0.006° (P) and
8 000 km (distance).
The supported range is 1900-01-02T12:00 TT to 2100-01-01T12:00 TT. The function throws
RangeError for a date that is not TT or is outside the range.