pub struct Sidereal {
pub rate_rad_per_sec: Real,
pub ref_epoch: Real,
pub ref_angle_rad: Real,
pub longitude_rad: Real,
pub correction_rad: Real,
}Expand description
Prime-meridian / spin-angle clock for a rotating body.
The model is linear in time:
angle(t) = ref_angle + rate × (t − ref_epoch) + correctionplus optional observer longitude for local meridian angle. For Earth that is the Earth Rotation Angle (ERA). For other bodies it is only a simple mean spin / meridian angle if you supply a rate — not a full orientation ephemeris (the Moon’s librations, for example, are not included).
Earth. Sidereal::EARTH uses the IAU 2000 Earth Rotation Angle
relative to the Celestial Intermediate Origin (CIO). Equinox sidereal times
(sidereal-earth) are on this type:
Sidereal::gmst,
Sidereal::gast,
Sidereal::lmst,
Sidereal::last.
Other bodies. Supply a published spin rate and reference angle (for
example IAU WGCCRE Ẇ / W0), or start from the simplified
Sidereal::MARS / Sidereal::MOON presets. Use
rotation_angle /
local_rotation_angle.
Local meridian angle is the usual input to hour angle
(HA = local meridian − RA), meridian transit, and horizon ↔ equatorial
conversions. Meridian angle and RA must share the same equatorial frame
(CIO/CIRS with local ERA; mean or true equinox with LMST/LAST).
§Fields
rate_rad_per_sec— Sidereal rotation rate in radians per SI second.ref_epoch— Reference epoch as an MJD at whichref_angle_radis defined. For Earth ERA this is a UT1 MJD.ref_angle_rad— Rotation angle of the prime meridian atref_epoch.longitude_rad— Observer longitude on the body (radians, east positive).0.0corresponds to the body’s prime meridian.correction_rad— Optional additive angle (radians) folded intorotation_angle. Do not use this for DUT1; put UT1 in the time argument instead.
§Examples
Earth ERA from UTC via IERS C04 (needs eop and std). Equinox sidereal
time needs sidereal-earth as well — see
Sidereal::gmst.
use deep_time::{Dt, Scale, Sidereal};
use deep_time::eop::{EopData, EopFormat, Separator};
let eop = EopData::from_text_file(
"tests/assets/EOP_20u24_C04_one_file_1962-now.txt",
EopFormat::C04,
Separator::Whitespace,
).unwrap();
let utc = Dt::from_mjd_f(56879.0, Scale::UTC);
let mjd_ut1 = utc.to_ut1(&eop).unwrap().to_mjd_f_raw();
let mut earth = Sidereal::EARTH;
earth.longitude_rad = 0.0; // Greenwich
let era = earth.rotation_angle(mjd_ut1);
let local_era = earth.local_rotation_angle(mjd_ut1);
let _ = (era, local_era);Fields§
§rate_rad_per_sec: RealSidereal rotation rate in radians per SI second.
ref_epoch: RealReference epoch as an MJD (UT1 for Earth ERA).
ref_angle_rad: RealRotation angle of the prime meridian (radians) at ref_epoch.
longitude_rad: RealLongitude of the observer on the body (radians, east positive).
0.0 = body’s prime meridian.
correction_rad: RealOptional additive angle (radians) applied inside Self::rotation_angle.
Not a substitute for DUT1 — pass UT1 via the time argument instead.
Implementations§
Source§impl Sidereal
Earth equinox sidereal time.
impl Sidereal
Earth equinox sidereal time.
Greenwich forms (era, gmst, gast, eo, ee) always use the IAU ERA
(Sidereal::EARTH), not this instance’s rate or correction_rad.
Local forms (lmst, last) add this instance’s Sidereal::longitude_rad
(east positive).
Sourcepub const fn era(ut1_mjd: Real) -> Real
pub const fn era(ut1_mjd: Real) -> Real
Earth Rotation Angle at UT1 MJD, radians in [0, 2π).
Same as Sidereal::EARTH.Sidereal::rotation_angle.
Sourcepub const fn eo(tt_mjd: Real) -> Real
pub const fn eo(tt_mjd: Real) -> Real
Equation of the Origins at TT MJD (eo06a): EO = ERA − GAST.
Sourcepub const fn ee(tt_mjd: Real) -> Real
pub const fn ee(tt_mjd: Real) -> Real
Equation of the Equinoxes at TT MJD (ee06a): EE = GAST − GMST.
Sourcepub const fn gmst(ut1_mjd: Real, tt_mjd: Real) -> Real
pub const fn gmst(ut1_mjd: Real, tt_mjd: Real) -> Real
Greenwich Mean Sidereal Time (radians): ERA(UT1) − eo(TT) − ee(TT).
§Examples
use deep_time::eop::{EopData, EopFormat, Separator};
use deep_time::{Dt, Scale, Sidereal};
let eop = EopData::from_text_file(
"tests/assets/EOP_20u24_C04_one_file_1962-now.txt",
EopFormat::C04,
Separator::Whitespace,
).unwrap();
let utc = Dt::from_mjd_f(56879.0, Scale::UTC);
let ut1 = utc.to_ut1(&eop).unwrap().to_mjd_f_raw();
let tt = utc.to(Scale::TT).to_mjd_f_raw();
let gmst = Sidereal::gmst(ut1, tt);
let _ = gmst;Sourcepub const fn gast(ut1_mjd: Real, tt_mjd: Real) -> Real
pub const fn gast(ut1_mjd: Real, tt_mjd: Real) -> Real
Greenwich Apparent Sidereal Time (radians): ERA(UT1) − eo(TT).
Sourcepub const fn lmst(&self, ut1_mjd: Real, tt_mjd: Real) -> Real
pub const fn lmst(&self, ut1_mjd: Real, tt_mjd: Real) -> Real
Local Mean Sidereal Time (radians): GMST + longitude_rad.
Always uses IAU Earth ERA
(Sidereal::gmst). Only
Sidereal::longitude_rad (east positive) is taken from this instance.
HA = lmst(ut1, tt) − RA // mean-equinox RASourcepub const fn last(&self, ut1_mjd: Real, tt_mjd: Real) -> Real
pub const fn last(&self, ut1_mjd: Real, tt_mjd: Real) -> Real
Local Apparent Sidereal Time (radians): GAST + longitude_rad.
Always uses IAU Earth ERA
(Sidereal::gast). Only
Sidereal::longitude_rad (east positive) is taken from this instance.
HA = last(ut1, tt) − RA // true-equinox RASource§impl Sidereal
impl Sidereal
Sourcepub const EARTH: Self
pub const EARTH: Self
Pre-configured Sidereal for Earth using the IAU 2000 ERA.
This uses:
- The IAU 2000 Earth Rotation Angle rate
(
1.00273781191135448turns per UT1 day). - J2000.0 as the reference epoch (
ref_epoch = 51544.5UT1 MJD). - The Earth Rotation Angle (ERA) at J2000.0 as
ref_angle_rad.
You can still customize fields after construction (e.g. longitude_rad
or correction_rad). For GMST/GAST/LMST/LAST see
Sidereal::gmst
(sidereal-earth).
Sourcepub const MARS: Self
pub const MARS: Self
Simplified Sidereal preset for Mars (mean spin rate only).
Uses an approximate mean sidereal rotation period and J2000.0 as the
reference epoch. ref_angle_rad is 0.0 (not a published prime-meridian
offset). Suitable for demos and coarse meridian/spin geometry — not a
full IAU WGCCRE orientation series. For higher fidelity, replace the
rate and reference angle with published values.
You can customize fields (especially longitude_rad) after construction.
Sourcepub const MOON: Self
pub const MOON: Self
Simplified Sidereal preset for the Moon (mean spin rate only).
Uses an approximate mean sidereal rotation period and J2000.0 as the
reference epoch. ref_angle_rad is 0.0 (not a published prime-meridian
offset). Useful for coarse work; precise selenographic orientation needs
lunar librations, which this preset does not include.
You can customize fields (especially longitude_rad) after construction.
Sourcepub const fn to_sec(angle_rad: Real) -> Real
pub const fn to_sec(angle_rad: Real) -> Real
Convert a meridian / sidereal angle in radians to seconds on a 24-hour
sidereal clock, wrapped to [0, 86400).
This is (angle / 2π) × 86400 — an hour-angle clock, not SI seconds of a
sidereal day.
§Examples
use core::f64::consts::PI;
use deep_time::Sidereal;
assert!((Sidereal::to_sec(PI) - 43_200.0).abs() < 1e-9);Sourcepub const fn rotation_angle(&self, mjd: Real) -> Real
pub const fn rotation_angle(&self, mjd: Real) -> Real
Returns the instantaneous rotation angle of the body’s prime meridian
(in radians) at the given instant, normalized to [0, 2π).
For Earth this is the IAU 2000 Earth Rotation Angle (ERA) relative to the
Celestial Intermediate Origin (CIO) — the same definition as ERFA era00.
mjd is UT1 MJD for Earth ERA.
It does not include observer longitude or the Equation of the Origins.
§Examples
use deep_time::{Dt, Scale, Sidereal};
use deep_time::eop::{EopData, EopFormat, Separator};
let eop = EopData::from_text_file(
"tests/assets/EOP_20u24_C04_one_file_1962-now.txt",
EopFormat::C04,
Separator::Whitespace,
).unwrap();
let utc = Dt::from_mjd_f(57753.5, Scale::UTC);
let mjd_ut1 = utc.to_ut1(&eop).unwrap().to_mjd_f_raw();
let era = Sidereal::EARTH.rotation_angle(mjd_ut1);
let _ = era;Sourcepub const fn local_rotation_angle(&self, mjd: Real) -> Real
pub const fn local_rotation_angle(&self, mjd: Real) -> Real
Returns the rotation angle of the prime meridian at the observer’s
longitude, normalized to [0, 2π).
This is equivalent to rotation_angle(mjd) + self.longitude_rad.
For Earth with Sidereal::EARTH, that is the local ERA: the angle
between the Celestial Intermediate Origin (CIO) and the observer’s
local meridian.
Hour angle of a source:
HA = local_rotation_angle(mjd) − RAUse a right ascension in the same frame as this angle (CIO/CIRS RA with local ERA; equinox RA with LMST/LAST).
§Examples
use deep_time::{Dt, Scale, Sidereal};
use deep_time::eop::{EopData, EopFormat, Separator};
let eop = EopData::from_text_file(
"tests/assets/EOP_20u24_C04_one_file_1962-now.txt",
EopFormat::C04,
Separator::Whitespace,
).unwrap();
let utc = Dt::from_mjd_f(56879.0, Scale::UTC);
let mjd_ut1 = utc.to_ut1(&eop).unwrap().to_mjd_f_raw();
let mut earth = Sidereal::EARTH;
earth.longitude_rad = 0.0; // Greenwich
let local_era = earth.local_rotation_angle(mjd_ut1);
let _ = local_era;Trait Implementations§
Source§impl<'de> Deserialize<'de> for Sidereal
impl<'de> Deserialize<'de> for Sidereal
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Sidereal
Source§impl Tsify for Sidereal
impl Tsify for Sidereal
const DECL: &'static str = "/**\n * Prime-meridian / spin-angle clock for a rotating body.\n *\n * The model is linear in time:\n *\n * ```text\n * angle(t) = ref_angle + rate \u{d7} (t \u{2212} ref_epoch) + correction\n * ```\n *\n * plus optional observer longitude for local meridian angle. For Earth that\n * is the Earth Rotation Angle (ERA). For other bodies it is only a simple\n * mean spin / meridian angle if you supply a rate \u{2014} not a full orientation\n * ephemeris (the Moon\u{2019}s librations, for example, are not included).\n *\n * **Earth.** [`Sidereal::EARTH`] uses the IAU 2000 Earth Rotation Angle\n * relative to the Celestial Intermediate Origin (CIO). Equinox sidereal times\n * (`sidereal-earth`) are on this type:\n * [`Sidereal::gmst`](struct.Sidereal.html#method.gmst),\n * [`Sidereal::gast`](struct.Sidereal.html#method.gast),\n * [`Sidereal::lmst`](struct.Sidereal.html#method.lmst),\n * [`Sidereal::last`](struct.Sidereal.html#method.last).\n *\n * **Other bodies.** Supply a published spin rate and reference angle (for\n * example IAU WGCCRE `W\u{307}` / `W0`), or start from the simplified\n * [`Sidereal::MARS`] / [`Sidereal::MOON`] presets. Use\n * [`rotation_angle`](Self::rotation_angle) /\n * [`local_rotation_angle`](Self::local_rotation_angle).\n *\n * Local meridian angle is the usual input to hour angle\n * (`HA = local meridian \u{2212} RA`), meridian transit, and horizon \u{2194} equatorial\n * conversions. Meridian angle and `RA` must share the same equatorial frame\n * (CIO/CIRS with local ERA; mean or true equinox with LMST/LAST).\n *\n * ## Fields\n *\n * * `rate_rad_per_sec` \u{2014} Sidereal rotation rate in radians per SI second.\n * * `ref_epoch` \u{2014} Reference epoch as an MJD at which `ref_angle_rad` is defined.\n * For Earth ERA this is a **UT1** MJD.\n * * `ref_angle_rad` \u{2014} Rotation angle of the prime meridian at `ref_epoch`.\n * * `longitude_rad` \u{2014} Observer longitude on the body (radians, east positive).\n * `0.0` corresponds to the body\'s prime meridian.\n * * `correction_rad` \u{2014} Optional additive angle (radians) folded into\n * [`rotation_angle`](Self::rotation_angle). Do **not** use this for DUT1;\n * put UT1 in the time argument instead.\n *\n * ## Examples\n *\n * Earth ERA from UTC via IERS C04 (needs `eop` and `std`). Equinox sidereal\n * time needs `sidereal-earth` as well \u{2014} see\n * [`Sidereal::gmst`](struct.Sidereal.html#method.gmst).\n *\n * ```rust\n * # #[cfg(all(feature = \"eop\", feature = \"std\"))] {\n * use deep_time::{Dt, Scale, Sidereal};\n * use deep_time::eop::{EopData, EopFormat, Separator};\n *\n * let eop = EopData::from_text_file(\n * \"tests/assets/EOP_20u24_C04_one_file_1962-now.txt\",\n * EopFormat::C04,\n * Separator::Whitespace,\n * ).unwrap();\n *\n * let utc = Dt::from_mjd_f(56879.0, Scale::UTC);\n * let mjd_ut1 = utc.to_ut1(&eop).unwrap().to_mjd_f_raw();\n *\n * let mut earth = Sidereal::EARTH;\n * earth.longitude_rad = 0.0; // Greenwich\n *\n * let era = earth.rotation_angle(mjd_ut1);\n * let local_era = earth.local_rotation_angle(mjd_ut1);\n * let _ = (era, local_era);\n * # }\n * ```\n */\nexport interface Sidereal {\n /**\n * Sidereal rotation rate in **radians per SI second**.\n */\n rate_rad_per_sec: Real;\n /**\n * Reference epoch as an MJD (UT1 for Earth ERA).\n */\n ref_epoch: Real;\n /**\n * Rotation angle of the prime meridian (radians) at `ref_epoch`.\n */\n ref_angle_rad: Real;\n /**\n * Longitude of the observer on the body (radians, east positive).\n * `0.0` = body\'s prime meridian.\n */\n longitude_rad: Real;\n /**\n * Optional additive angle (radians) applied inside [`Self::rotation_angle`].\n * Not a substitute for DUT1 \u{2014} pass UT1 via the time argument instead.\n */\n correction_rad: Real;\n}"
const SERIALIZATION_CONFIG: SerializationConfig
Source§type JsType = JsType
type JsType = JsType
#[wasm_bindgen] extern "C" { .. }.
Ts<T> is #[repr(transparent)] over this and passes it across the
ABI as a plain JS handle, which any other representation would break.