Skip to main content

Sidereal

Struct Sidereal 

Source
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) + correction

plus 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 which ref_angle_rad is defined. For Earth ERA this is a UT1 MJD.
  • ref_angle_rad — Rotation angle of the prime meridian at ref_epoch.
  • longitude_rad — Observer longitude on the body (radians, east positive). 0.0 corresponds to the body’s prime meridian.
  • correction_rad — Optional additive angle (radians) folded into rotation_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: Real

Sidereal rotation rate in radians per SI second.

§ref_epoch: Real

Reference epoch as an MJD (UT1 for Earth ERA).

§ref_angle_rad: Real

Rotation angle of the prime meridian (radians) at ref_epoch.

§longitude_rad: Real

Longitude of the observer on the body (radians, east positive). 0.0 = body’s prime meridian.

§correction_rad: Real

Optional 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.

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).

Source

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.

Source

pub const fn eo(tt_mjd: Real) -> Real

Equation of the Origins at TT MJD (eo06a): EO = ERA − GAST.

Source

pub const fn ee(tt_mjd: Real) -> Real

Equation of the Equinoxes at TT MJD (ee06a): EE = GAST − GMST.

Source

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;
Source

pub const fn gast(ut1_mjd: Real, tt_mjd: Real) -> Real

Greenwich Apparent Sidereal Time (radians): ERA(UT1) − eo(TT).

Source

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 RA
Source

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 RA
Source§

impl Sidereal

Source

pub const EARTH: Self

Pre-configured Sidereal for Earth using the IAU 2000 ERA.

This uses:

  • The IAU 2000 Earth Rotation Angle rate (1.00273781191135448 turns per UT1 day).
  • J2000.0 as the reference epoch (ref_epoch = 51544.5 UT1 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).

Source

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.

Source

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.

Source

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);
Source

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;
Source

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) − RA

Use 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 Clone for Sidereal

Source§

fn clone(&self) -> Sidereal

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Sidereal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Sidereal

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Format for Sidereal
where Real: Format,

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for Sidereal

Source§

fn eq(&self, other: &Sidereal) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Sidereal

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Sidereal

Source§

impl Tsify for Sidereal

Source§

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}"

Source§

const SERIALIZATION_CONFIG: SerializationConfig

Source§

type JsType = JsType

Must be a type imported through #[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.
Source§

fn into_js(&self) -> Result<Self::JsType, Error>
where Self: Serialize,

Source§

fn from_js<T>(js: T) -> Result<Self, Error>
where T: Into<JsValue>, Self: DeserializeOwned,

Source§

fn into_ts(&self) -> Result<Ts<Self>, Error>
where Self: Sized + Serialize,

Calls Ts::from_rust on self, returning a Result<Ts<Self>, crate::Error>. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more