Add 4 refracted rise/set functions completing the rise/set feature set: - planet_next_rise/set_refracted: -0.569 deg threshold (refraction only, point source — even Jupiter at opposition is only 24 arcsec) - moon_next_rise/set_refracted: -0.833 deg threshold (refraction + mean semidiameter, same as Sun) Add IAU constellation identification from Roman (1987) CDS VI/42: - 357 boundary segments covering all 88 constellations - Precesses J2000 coordinates to B1875.0 epoch for lookup - Two overloads: constellation(equatorial) and constellation(float8, float8) - IMMUTABLE (compiled-in static data) 141 -> 147 SQL objects. 24 -> 25 regression suites. All 25 pass.
49 lines
2.7 KiB
SQL
49 lines
2.7 KiB
SQL
-- pg_orrery 0.13.0 -> 0.14.0 migration
|
|
--
|
|
-- Adds: refracted planet/moon rise/set (4 functions),
|
|
-- constellation identification (2 functions).
|
|
|
|
-- ============================================================
|
|
-- Refracted rise/set: planets (point source, -0.569 deg)
|
|
-- ============================================================
|
|
|
|
CREATE FUNCTION planet_next_rise_refracted(body_id int4, obs observer, t timestamptz) RETURNS timestamptz
|
|
AS 'MODULE_PATHNAME' LANGUAGE C STABLE STRICT PARALLEL SAFE;
|
|
COMMENT ON FUNCTION planet_next_rise_refracted(int4, observer, timestamptz) IS
|
|
'Next refracted rise time for a planet (-0.569 deg threshold: atmospheric refraction only). Earlier than geometric.';
|
|
|
|
CREATE FUNCTION planet_next_set_refracted(body_id int4, obs observer, t timestamptz) RETURNS timestamptz
|
|
AS 'MODULE_PATHNAME' LANGUAGE C STABLE STRICT PARALLEL SAFE;
|
|
COMMENT ON FUNCTION planet_next_set_refracted(int4, observer, timestamptz) IS
|
|
'Next refracted set time for a planet (-0.569 deg threshold: atmospheric refraction only). Later than geometric.';
|
|
|
|
-- ============================================================
|
|
-- Refracted rise/set: Moon (-0.833 deg, same as Sun)
|
|
-- ============================================================
|
|
|
|
CREATE FUNCTION moon_next_rise_refracted(obs observer, t timestamptz) RETURNS timestamptz
|
|
AS 'MODULE_PATHNAME' LANGUAGE C STABLE STRICT PARALLEL SAFE;
|
|
COMMENT ON FUNCTION moon_next_rise_refracted(observer, timestamptz) IS
|
|
'Next refracted moonrise (-0.833 deg threshold: refraction + semidiameter). Earlier than geometric.';
|
|
|
|
CREATE FUNCTION moon_next_set_refracted(obs observer, t timestamptz) RETURNS timestamptz
|
|
AS 'MODULE_PATHNAME' LANGUAGE C STABLE STRICT PARALLEL SAFE;
|
|
COMMENT ON FUNCTION moon_next_set_refracted(observer, timestamptz) IS
|
|
'Next refracted moonset (-0.833 deg threshold: refraction + semidiameter). Later than geometric.';
|
|
|
|
-- ============================================================
|
|
-- Constellation identification (Roman 1987, CDS VI/42)
|
|
-- ============================================================
|
|
|
|
CREATE FUNCTION constellation(eq equatorial) RETURNS text
|
|
AS 'MODULE_PATHNAME', 'constellation_from_equatorial'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
COMMENT ON FUNCTION constellation(equatorial) IS
|
|
'IAU constellation abbreviation (3 letters) from equatorial coordinates (Roman 1987).';
|
|
|
|
CREATE FUNCTION constellation(ra_hours float8, dec_deg float8) RETURNS text
|
|
AS 'MODULE_PATHNAME', 'constellation_from_radec'
|
|
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
|
COMMENT ON FUNCTION constellation(float8, float8) IS
|
|
'IAU constellation from J2000 RA (hours [0,24)) and Dec (degrees [-90,90]).';
|