Skip to content

Functions: DE Ephemeris

Optional high-precision function variants that use JPL DE440/441 ephemeris files when configured via the pg_orrery.ephemeris_path GUC. Each function mirrors an existing VSOP87/ELP2000-82B counterpart with identical parameters and return types.

All DE functions are STABLE STRICT PARALLEL SAFE (except pg_orrery_ephemeris_info which is STABLE PARALLEL SAFE, not STRICT). When DE is unavailable, they fall back to their VSOP87/ELP2000-82B equivalents.

See the DE Ephemeris guide for setup and configuration.


Computes the heliocentric ecliptic J2000 position of a planet using DE positions when available, falling back to VSOP87.

planet_heliocentric_de(body_id int4, t timestamptz) → heliocentric
ParameterTypeDescription
body_idint4Planet identifier: 0 (Sun), 1-8 (Mercury through Neptune)
ttimestamptzEvaluation time

A heliocentric position in AU (ecliptic J2000 frame). Identical return type to planet_heliocentric().

-- Compare DE vs VSOP87 heliocentric distances
SELECT body_id,
round(helio_distance(planet_heliocentric(body_id, '2024-06-21 12:00:00+00'))::numeric, 10) AS vsop87,
round(helio_distance(planet_heliocentric_de(body_id, '2024-06-21 12:00:00+00'))::numeric, 10) AS de
FROM generate_series(1, 8) AS body_id;

Computes the topocentric position of a planet using DE ephemeris for both the target and Earth positions.

planet_observe_de(body_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
body_idint4Planet identifier (1-8, excluding 3/Earth)
obsobserverObserver location on Earth
ttimestamptzObservation time

A topocentric with azimuth, elevation, range (km), and range rate (km/s).

-- Mars position from Boulder using DE
SELECT round(topo_azimuth(t)::numeric, 4) AS az,
round(topo_elevation(t)::numeric, 4) AS el,
round(topo_range(t)::numeric, 0) AS range_km
FROM planet_observe_de(4, '40.0N 105.3W 1655m'::observer, now()) AS t;

Computes the topocentric position of the Sun using DE positions.

sun_observe_de(obs observer, t timestamptz) → topocentric
ParameterTypeDescription
obsobserverObserver location on Earth
ttimestamptzObservation time

A topocentric with azimuth, elevation, range (km), and range rate (km/s).

SELECT round(topo_azimuth(t)::numeric, 2) AS az,
round(topo_elevation(t)::numeric, 2) AS el
FROM sun_observe_de('40.0N 105.3W 1655m'::observer, now()) AS t;

Computes the topocentric position of the Moon using DE positions. Falls back to ELP2000-82B when DE is unavailable.

moon_observe_de(obs observer, t timestamptz) → topocentric
ParameterTypeDescription
obsobserverObserver location on Earth
ttimestamptzObservation time

A topocentric with azimuth, elevation, range (km), and range rate (km/s).

SELECT round(topo_azimuth(t)::numeric, 2) AS az,
round(topo_elevation(t)::numeric, 2) AS el,
round(topo_range(t)::numeric, 0) AS range_km
FROM moon_observe_de('40.0N 105.3W 1655m'::observer, now()) AS t;

Computes a Lambert transfer orbit using DE-precision planet positions.

lambert_transfer_de(
dep_body_id int4,
arr_body_id int4,
dep_time timestamptz,
arr_time timestamptz
) → RECORD(c3_departure float8, c3_arrival float8, v_inf_dep float8, v_inf_arr float8, tof_days float8)
ParameterTypeDescription
dep_body_idint4Departure planet (1-8)
arr_body_idint4Arrival planet (1-8, different from departure)
dep_timetimestamptzDeparture epoch
arr_timetimestamptzArrival epoch (must be after departure)

Transfer orbit parameters including departure and arrival C3 (km^2/s^2), v-infinity magnitudes, and time of flight.

-- Earth-Mars transfer window with DE positions
SELECT round(c3_departure::numeric, 2) AS c3_dep,
round(c3_arrival::numeric, 2) AS c3_arr,
round(tof_days::numeric, 1) AS tof
FROM lambert_transfer_de(3, 4, '2026-05-01 00:00:00+00', '2027-01-15 00:00:00+00');

Returns only the departure C3 (km^2/s^2) from a Lambert transfer computation using DE positions. A convenience wrapper around lambert_transfer_de().

lambert_c3_de(dep_body_id int4, arr_body_id int4, dep_time timestamptz, arr_time timestamptz) → float8
-- Pork chop grid with DE accuracy
SELECT dep::date AS departure,
arr::date AS arrival,
round(lambert_c3_de(3, 4, dep, arr)::numeric, 2) AS c3
FROM generate_series('2026-04-01'::timestamptz, '2026-08-01'::timestamptz, '14 days') dep,
generate_series('2026-12-01'::timestamptz, '2027-04-01'::timestamptz, '14 days') arr
WHERE arr > dep + interval '90 days';

Computes the topocentric position of a Galilean moon of Jupiter. Uses DE for Jupiter’s heliocentric position and L1.2 theory for the moon’s offset.

galilean_observe_de(moon_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
moon_idint40=Io, 1=Europa, 2=Ganymede, 3=Callisto
obsobserverObserver location
ttimestamptzObservation time
-- All four Galilean moons with DE-precision Jupiter
SELECT moon_id,
CASE moon_id WHEN 0 THEN 'Io' WHEN 1 THEN 'Europa'
WHEN 2 THEN 'Ganymede' WHEN 3 THEN 'Callisto' END AS moon,
round(topo_elevation(galilean_observe_de(moon_id, '40.0N 105.3W 1655m'::observer, now()))::numeric, 2) AS el
FROM generate_series(0, 3) AS moon_id;

Computes the topocentric position of a Saturn moon. Uses DE for Saturn’s heliocentric position and TASS17 theory for the moon’s offset.

saturn_moon_observe_de(moon_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
moon_idint40=Mimas, 1=Enceladus, 2=Tethys, 3=Dione, 4=Rhea, 5=Titan, 6=Iapetus, 7=Hyperion
obsobserverObserver location
ttimestamptzObservation time

Computes the topocentric position of a Uranus moon. Uses DE for Uranus’s heliocentric position and GUST86 theory for the moon’s offset.

uranus_moon_observe_de(moon_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
moon_idint40=Miranda, 1=Ariel, 2=Umbriel, 3=Titania, 4=Oberon
obsobserverObserver location
ttimestamptzObservation time

Computes the topocentric position of a Mars moon. Uses DE for Mars’s heliocentric position and MarsSat theory for the moon’s offset.

mars_moon_observe_de(moon_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
moon_idint40=Phobos, 1=Deimos
obsobserverObserver location
ttimestamptzObservation time

Computes the geocentric apparent equatorial coordinates (RA/Dec) of a planet using JPL DE ephemeris. Falls back to VSOP87 plus the equatorial conversion when DE is unavailable.

planet_equatorial_de(body_id int4, t timestamptz) → equatorial
ParameterTypeDescription
body_idint4Planet identifier (1-8, excluding 0 and 3)
ttimestamptzEvaluation time

An equatorial with RA (hours), Dec (degrees), and distance (km) from Earth’s center.

-- Compare DE vs VSOP87 equatorial coordinates for Mars
SELECT round(eq_ra(planet_equatorial(4, now()))::numeric, 6) AS ra_vsop87,
round(eq_ra(planet_equatorial_de(4, now()))::numeric, 6) AS ra_de,
round(eq_dec(planet_equatorial(4, now()))::numeric, 6) AS dec_vsop87,
round(eq_dec(planet_equatorial_de(4, now()))::numeric, 6) AS dec_de;

Computes the geocentric apparent equatorial coordinates (RA/Dec) of the Moon using JPL DE ephemeris. Falls back to ELP2000-82B plus the equatorial conversion when DE is unavailable.

moon_equatorial_de(t timestamptz) → equatorial
ParameterTypeDescription
ttimestamptzEvaluation time

An equatorial with RA (hours), Dec (degrees), and distance (km) from Earth’s center.

-- Moon RA/Dec via DE
SELECT round(eq_ra(e)::numeric, 4) AS ra_hours,
round(eq_dec(e)::numeric, 4) AS dec_deg,
round(eq_distance(e)::numeric, 0) AS dist_km
FROM moon_equatorial_de(now()) AS e;

Computes the geocentric equatorial coordinates (RA/Dec) of a Galilean moon using JPL DE ephemeris for Jupiter’s position. Falls back to VSOP87 for both Jupiter and Earth when DE is unavailable. Moon offsets always come from Lieske L1.2 theory.

galilean_equatorial_de(moon_id int4, t timestamptz) → equatorial
ParameterTypeDescription
moon_idint40=Io, 1=Europa, 2=Ganymede, 3=Callisto
ttimestamptzEvaluation time

An equatorial with RA (hours), Dec (degrees), and distance (km) from Earth’s center.

-- All 4 Galilean moons via DE
SELECT moon_id,
round(eq_ra(galilean_equatorial_de(moon_id, now()))::numeric, 4) AS ra,
round(eq_dec(galilean_equatorial_de(moon_id, now()))::numeric, 4) AS dec
FROM generate_series(0, 3) AS moon_id;

Computes the geocentric equatorial coordinates (RA/Dec) of a Saturn moon using JPL DE ephemeris for Saturn’s position. Falls back to VSOP87 when DE is unavailable. Moon offsets come from TASS 1.7 theory.

saturn_moon_equatorial_de(moon_id int4, t timestamptz) → equatorial
ParameterTypeDescription
moon_idint40=Mimas, 1=Enceladus, 2=Tethys, 3=Dione, 4=Rhea, 5=Titan, 6=Iapetus, 7=Hyperion
ttimestamptzEvaluation time
-- Titan's position via DE
SELECT round(eq_ra(saturn_moon_equatorial_de(5, now()))::numeric, 4) AS ra,
round(eq_dec(saturn_moon_equatorial_de(5, now()))::numeric, 4) AS dec;

Computes the geocentric equatorial coordinates (RA/Dec) of a Uranus moon using JPL DE ephemeris for Uranus’s position. Falls back to VSOP87 when DE is unavailable. Moon offsets come from GUST86 theory.

uranus_moon_equatorial_de(moon_id int4, t timestamptz) → equatorial
ParameterTypeDescription
moon_idint40=Miranda, 1=Ariel, 2=Umbriel, 3=Titania, 4=Oberon
ttimestamptzEvaluation time
-- Titania's position via DE
SELECT round(eq_ra(uranus_moon_equatorial_de(3, now()))::numeric, 4) AS ra,
round(eq_dec(uranus_moon_equatorial_de(3, now()))::numeric, 4) AS dec;

Computes the geocentric equatorial coordinates (RA/Dec) of a Mars moon using JPL DE ephemeris for Mars’s position. Falls back to VSOP87 when DE is unavailable. Moon offsets come from MarsSat analytical theory.

mars_moon_equatorial_de(moon_id int4, t timestamptz) → equatorial
ParameterTypeDescription
moon_idint40=Phobos, 1=Deimos
ttimestamptzEvaluation time
-- Both Mars moons via DE
SELECT moon_id,
round(eq_ra(mars_moon_equatorial_de(moon_id, now()))::numeric, 4) AS ra,
round(eq_dec(mars_moon_equatorial_de(moon_id, now()))::numeric, 4) AS dec
FROM generate_series(0, 1) AS moon_id;

Returns diagnostic information about the current ephemeris provider.

pg_orrery_ephemeris_info() → RECORD(provider text, file_path text, start_jd float8, end_jd float8, version int4, au_km float8)
ColumnTypeDescription
providertext'VSOP87' or 'JPL_DE'
file_pathtextPath to the DE file (empty string if no DE)
start_jdfloat8First Julian Date covered by the DE file
end_jdfloat8Last Julian Date covered by the DE file
versionint4DE version number (440, 441, etc.)
au_kmfloat8Astronomical Unit in km from the DE header
-- Check current provider
SELECT (pg_orrery_ephemeris_info()).provider;
-- Full diagnostic
SELECT * FROM pg_orrery_ephemeris_info();

Computes the heliocentric ecliptic J2000 position of a Sun-planet Lagrange point using DE planet positions. Falls back to VSOP87 if DE is unavailable.

lagrange_heliocentric_de(body_id int4, point_id int4, t timestamptz) → heliocentric
ParameterTypeDescription
body_idint4Planet identifier (1-8, Mercury through Neptune)
point_idint4Lagrange point (1-5, L1 through L5)
ttimestamptzEvaluation time

A heliocentric position in AU (ecliptic J2000 frame). Identical return type to lagrange_heliocentric().

-- Compare DE vs VSOP87 for Sun-Earth L1
SELECT round(helio_distance(lagrange_heliocentric(3, 1, now()))::numeric, 6) AS vsop87,
round(helio_distance(lagrange_heliocentric_de(3, 1, now()))::numeric, 6) AS de;

Computes the topocentric position of a Sun-planet Lagrange point using DE planet positions. Falls back to VSOP87 if DE is unavailable.

lagrange_observe_de(body_id int4, point_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
body_idint4Planet identifier (1-8, Mercury through Neptune)
point_idint4Lagrange point (1-5, L1 through L5)
obsobserverObserver location on Earth
ttimestamptzObservation time

A topocentric with azimuth, elevation, range (km), and range rate (km/s).

SELECT round(topo_elevation(lagrange_observe_de(3, 2, '40.0N 105.3W 1655m'::observer, now()))::numeric, 2) AS el;

Computes the geocentric apparent equatorial coordinates (RA/Dec) of a Sun-planet Lagrange point using DE planet positions. Falls back to VSOP87 if DE is unavailable.

lagrange_equatorial_de(body_id int4, point_id int4, t timestamptz) → equatorial
ParameterTypeDescription
body_idint4Planet identifier (1-8, Mercury through Neptune)
point_idint4Lagrange point (1-5, L1 through L5)
ttimestamptzEvaluation time

An equatorial with RA (hours), Dec (degrees), and distance (km) from Earth’s center.

SELECT round(eq_ra(lagrange_equatorial_de(3, 2, now()))::numeric, 4) AS ra,
round(eq_dec(lagrange_equatorial_de(3, 2, now()))::numeric, 4) AS dec;

Computes the distance in AU between a given heliocentric position and a Sun-planet Lagrange point, using DE planet positions. Falls back to VSOP87 if DE is unavailable.

lagrange_distance_de(body_id int4, point_id int4, pos heliocentric, t timestamptz) → float8
ParameterTypeDescription
body_idint4Planet identifier (1-8, Mercury through Neptune)
point_idint4Lagrange point (1-5, L1 through L5)
posheliocentricPosition to measure distance from
ttimestamptzEvaluation time

Distance in AU between the given position and the Lagrange point.

SELECT round(lagrange_distance_de(
5, 4,
lagrange_heliocentric_de(5, 4, now()),
now()
)::numeric, 10) AS self_distance;

Computes the distance in AU between an object described by orbital elements and a Sun-planet Lagrange point, using DE planet positions. Falls back to VSOP87 if DE is unavailable.

lagrange_distance_oe_de(body_id int4, point_id int4, oe orbital_elements, t timestamptz) → float8
ParameterTypeDescription
body_idint4Planet identifier (1-8, Mercury through Neptune)
point_idint4Lagrange point (1-5, L1 through L5)
oeorbital_elementsOrbital elements of the object
ttimestamptzEvaluation time

Distance in AU between the object and the Lagrange point.

-- Trojan proximity with DE accuracy
SELECT round(lagrange_distance_oe_de(5, 4, oe, now())::numeric, 4) AS dist_au
FROM mpc_asteroids WHERE name = '(588) Achilles';

Computes the topocentric position of an Earth-Moon Lagrange point using DE positions. Falls back to ELP2000-82B if DE is unavailable.

lunar_lagrange_observe_de(point_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
point_idint4Lagrange point (1-5, L1 through L5)
obsobserverObserver location on Earth
ttimestamptzObservation time

A topocentric with azimuth, elevation, range (km), and range rate (km/s).

SELECT round(topo_elevation(lunar_lagrange_observe_de(1, '40.0N 105.3W 1655m'::observer, now()))::numeric, 2) AS el;

Computes the geocentric apparent equatorial coordinates (RA/Dec) of an Earth-Moon Lagrange point using DE positions. Falls back to ELP2000-82B if DE is unavailable.

lunar_lagrange_equatorial_de(point_id int4, t timestamptz) → equatorial
ParameterTypeDescription
point_idint4Lagrange point (1-5, L1 through L5)
ttimestamptzEvaluation time

An equatorial with RA (hours), Dec (degrees), and distance (km) from Earth’s center.

SELECT round(eq_distance(lunar_lagrange_equatorial_de(1, now()))::numeric, 0) AS dist_km;

Computes the topocentric position of a Galilean moon Lagrange point. Uses DE for Jupiter’s heliocentric position and L1.2 theory for the moon’s offset. Falls back to VSOP87 if DE is unavailable.

galilean_lagrange_observe_de(body_id int4, point_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
body_idint40=Io, 1=Europa, 2=Ganymede, 3=Callisto
point_idint4Lagrange point (1-5, L1 through L5)
obsobserverObserver location on Earth
ttimestamptzObservation time

A topocentric with azimuth, elevation, range (km), and range rate (km/s).

SELECT round(topo_elevation(galilean_lagrange_observe_de(0, 4, '40.0N 105.3W 1655m'::observer, now()))::numeric, 2) AS el;

Computes the geocentric equatorial coordinates (RA/Dec) of a Galilean moon Lagrange point. Uses DE for Jupiter’s heliocentric position and L1.2 theory for the moon’s offset. Falls back to VSOP87 if DE is unavailable.

galilean_lagrange_equatorial_de(body_id int4, point_id int4, t timestamptz) → equatorial
ParameterTypeDescription
body_idint40=Io, 1=Europa, 2=Ganymede, 3=Callisto
point_idint4Lagrange point (1-5, L1 through L5)
ttimestamptzEvaluation time

An equatorial with RA (hours), Dec (degrees), and distance (km) from Earth’s center.

SELECT round(eq_ra(galilean_lagrange_equatorial_de(0, 4, now()))::numeric, 4) AS ra;

Computes the topocentric position of a Saturn moon Lagrange point. Uses DE for Saturn’s heliocentric position and TASS17 theory for the moon’s offset. Falls back to VSOP87 if DE is unavailable.

saturn_moon_lagrange_observe_de(body_id int4, point_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
body_idint40=Mimas, 1=Enceladus, 2=Tethys, 3=Dione, 4=Rhea, 5=Titan, 6=Iapetus, 7=Hyperion
point_idint4Lagrange point (1-5, L1 through L5)
obsobserverObserver location on Earth
ttimestamptzObservation time

A topocentric with azimuth, elevation, range (km), and range rate (km/s).


Computes the geocentric equatorial coordinates (RA/Dec) of a Saturn moon Lagrange point. Uses DE for Saturn’s heliocentric position and TASS17 theory for the moon’s offset. Falls back to VSOP87 if DE is unavailable.

saturn_moon_lagrange_equatorial_de(body_id int4, point_id int4, t timestamptz) → equatorial
ParameterTypeDescription
body_idint40=Mimas, 1=Enceladus, 2=Tethys, 3=Dione, 4=Rhea, 5=Titan, 6=Iapetus, 7=Hyperion
point_idint4Lagrange point (1-5, L1 through L5)
ttimestamptzEvaluation time

An equatorial with RA (hours), Dec (degrees), and distance (km) from Earth’s center.

SELECT round(eq_ra(saturn_moon_lagrange_equatorial_de(5, 1, now()))::numeric, 4) AS titan_l1_ra;

Computes the topocentric position of a Uranus moon Lagrange point. Uses DE for Uranus’s heliocentric position and GUST86 theory for the moon’s offset. Falls back to VSOP87 if DE is unavailable.

uranus_moon_lagrange_observe_de(body_id int4, point_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
body_idint40=Miranda, 1=Ariel, 2=Umbriel, 3=Titania, 4=Oberon
point_idint4Lagrange point (1-5, L1 through L5)
obsobserverObserver location on Earth
ttimestamptzObservation time

A topocentric with azimuth, elevation, range (km), and range rate (km/s).


Computes the geocentric equatorial coordinates (RA/Dec) of a Uranus moon Lagrange point. Uses DE for Uranus’s heliocentric position and GUST86 theory for the moon’s offset. Falls back to VSOP87 if DE is unavailable.

uranus_moon_lagrange_equatorial_de(body_id int4, point_id int4, t timestamptz) → equatorial
ParameterTypeDescription
body_idint40=Miranda, 1=Ariel, 2=Umbriel, 3=Titania, 4=Oberon
point_idint4Lagrange point (1-5, L1 through L5)
ttimestamptzEvaluation time

An equatorial with RA (hours), Dec (degrees), and distance (km) from Earth’s center.


Computes the topocentric position of a Mars moon Lagrange point. Uses DE for Mars’s heliocentric position and MarsSat theory for the moon’s offset. Falls back to VSOP87 if DE is unavailable.

mars_moon_lagrange_observe_de(body_id int4, point_id int4, obs observer, t timestamptz) → topocentric
ParameterTypeDescription
body_idint40=Phobos, 1=Deimos
point_idint4Lagrange point (1-5, L1 through L5)
obsobserverObserver location on Earth
ttimestamptzObservation time

A topocentric with azimuth, elevation, range (km), and range rate (km/s).


Computes the geocentric equatorial coordinates (RA/Dec) of a Mars moon Lagrange point. Uses DE for Mars’s heliocentric position and MarsSat theory for the moon’s offset. Falls back to VSOP87 if DE is unavailable.

mars_moon_lagrange_equatorial_de(body_id int4, point_id int4, t timestamptz) → equatorial
ParameterTypeDescription
body_idint40=Phobos, 1=Deimos
point_idint4Lagrange point (1-5, L1 through L5)
ttimestamptzEvaluation time

An equatorial with RA (hours), Dec (degrees), and distance (km) from Earth’s center.

SELECT round(eq_ra(mars_moon_lagrange_equatorial_de(0, 4, now()))::numeric, 4) AS phobos_l4_ra;

Computes the Hill sphere radius in AU for a planet using DE ephemeris for the instantaneous heliocentric distance. Falls back to VSOP87 if DE is unavailable.

hill_radius_de(body_id int4, t timestamptz) → float8
ParameterTypeDescription
body_idint4Planet identifier (1-8, Mercury through Neptune)
ttimestamptzEvaluation time

Hill sphere radius in AU.

SELECT round(hill_radius_de(5, now())::numeric, 4) AS jupiter_hill_de;

Computes the effective zone radius around a Lagrange point using DE ephemeris for the planet’s instantaneous heliocentric distance. Falls back to VSOP87 if DE is unavailable.

lagrange_zone_radius_de(body_id int4, point_id int4, t timestamptz) → float8
ParameterTypeDescription
body_idint4Planet identifier (1-8, Mercury through Neptune)
point_idint4Lagrange point (1-5, L1 through L5)
ttimestamptzEvaluation time

Zone radius in AU.

SELECT round(lagrange_zone_radius_de(5, 4, now())::numeric, 4) AS jup_l4_zone_de;