Skip to main content

ObservatoryContext

Struct ObservatoryContext 

Source
pub struct ObservatoryContext<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> ObservatoryContext<'a>

Source

pub fn new(ut1: &'a UT1, tt: &'a TT, location: &'a Location) -> Self

Source

pub fn observatory_location(observatory_name: &str) -> TimeResult<Location>

Get location for a famous observatory

Provides quick access to well-known observatory locations. Returns an owned Location that can be used with new().

§Supported Observatories
  • "mauna_kea" - Mauna Kea Observatory, Hawaii
  • "greenwich" - Royal Observatory Greenwich, UK
  • "palomar" - Palomar Observatory, California
  • "vlt" - Very Large Telescope, Chile
  • "keck" - W. M. Keck Observatory, Hawaii
§Examples
use celestial_time::{UT1, TT};
use celestial_time::sidereal::ObservatoryContext;

let ut1 = UT1::j2000();
let tt = TT::j2000();
let location = ObservatoryContext::observatory_location("mauna_kea").unwrap();
let observatory = ObservatoryContext::new(&ut1, &tt, &location);
Source

pub fn ut1(&self) -> &UT1

Get the UT1 time

Source

pub fn tt(&self) -> &TT

Get the TT time

Source

pub fn location(&self) -> &Location

Get the observer location

Source

pub fn gmst(&self) -> TimeResult<GMST>

Calculate Greenwich Mean Sidereal Time (GMST)

§Examples
use celestial_time::{UT1, TT};
use celestial_time::sidereal::ObservatoryContext;
use celestial_core::Location;

let ut1 = UT1::j2000();
let tt = TT::j2000();
let location = Location::from_degrees(19.8283, -155.4783, 4145.0).unwrap();
let observatory = ObservatoryContext::new(&ut1, &tt, &location);
let gmst = observatory.gmst().unwrap();
Source

pub fn gast(&self) -> TimeResult<GAST>

Calculate Greenwich Apparent Sidereal Time (GAST)

§Examples
use celestial_time::{UT1, TT};
use celestial_time::sidereal::ObservatoryContext;
use celestial_core::Location;

let ut1 = UT1::j2000();
let tt = TT::j2000();
let location = Location::from_degrees(19.8283, -155.4783, 4145.0).unwrap();
let observatory = ObservatoryContext::new(&ut1, &tt, &location);
let gast = observatory.gast().unwrap();
Source

pub fn lmst(&self) -> TimeResult<LMST>

Calculate Local Mean Sidereal Time (LMST)

§Examples
use celestial_time::{UT1, TT};
use celestial_time::sidereal::ObservatoryContext;
use celestial_core::Location;

let ut1 = UT1::j2000();
let tt = TT::j2000();
let location = Location::from_degrees(19.8283, -155.4783, 4145.0).unwrap();
let observatory = ObservatoryContext::new(&ut1, &tt, &location);
let lmst = observatory.lmst().unwrap();
Source

pub fn last(&self) -> TimeResult<LAST>

Calculate Local Apparent Sidereal Time (LAST)

§Examples
use celestial_time::{UT1, TT};
use celestial_time::sidereal::ObservatoryContext;
use celestial_core::Location;

let ut1 = UT1::j2000();
let tt = TT::j2000();
let location = Location::from_degrees(19.8283, -155.4783, 4145.0).unwrap();
let observatory = ObservatoryContext::new(&ut1, &tt, &location);
let last = observatory.last().unwrap();
Source

pub fn all_sidereal_times(&self) -> TimeResult<(GMST, GAST, LMST, LAST)>

Get all sidereal times at once

Returns a tuple of (GMST, GAST, LMST, LAST) for convenience.

§Examples
use celestial_time::{UT1, TT};
use celestial_time::sidereal::ObservatoryContext;
use celestial_core::Location;

let ut1 = UT1::j2000();
let tt = TT::j2000();
let location = Location::from_degrees(19.8283, -155.4783, 4145.0).unwrap();
let observatory = ObservatoryContext::new(&ut1, &tt, &location);
let (gmst, gast, lmst, last) = observatory.all_sidereal_times().unwrap();
Source

pub fn hour_angle_to_target(&self, target_ra_hours: f64) -> TimeResult<f64>

Calculate hour angle to a target right ascension

Uses Local Apparent Sidereal Time for the most accurate hour angle calculation.

§Arguments
  • target_ra_hours - Target right ascension in hours
§Returns

Hour angle in hours, normalized to [-12, 12) range

§Examples
use celestial_time::{UT1, TT};
use celestial_time::sidereal::ObservatoryContext;
use celestial_core::Location;

let ut1 = UT1::j2000();
let tt = TT::j2000();
let location = Location::from_degrees(19.8283, -155.4783, 4145.0).unwrap();
let observatory = ObservatoryContext::new(&ut1, &tt, &location);
let hour_angle = observatory.hour_angle_to_target(6.0).unwrap(); // RA = 6h
Source

pub fn info(&self) -> String

Get observatory information as a formatted string

Useful for logging and debugging.

§Examples
use celestial_time::{UT1, TT};
use celestial_time::sidereal::ObservatoryContext;
use celestial_core::Location;

let ut1 = UT1::j2000();
let tt = TT::j2000();
let location = Location::from_degrees(19.8283, -155.4783, 4145.0).unwrap();
let observatory = ObservatoryContext::new(&ut1, &tt, &location);
println!("{}", observatory.info());

Trait Implementations§

Source§

impl<'a> Clone for ObservatoryContext<'a>

Source§

fn clone(&self) -> ObservatoryContext<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ObservatoryContext<'a>

Source§

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

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

impl<'a> Display for ObservatoryContext<'a>

Source§

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

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

impl<'a> Copy for ObservatoryContext<'a>

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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.