Astrex.Astro.Transforms (Astrex v0.4.1)

View Source

The module exports functions to convert from different coordinates systems

AltAzimuth to Equatorial
Equatorial to AltAzimuth
Ecliptic to Equatorial
Equatorial to Ecliptical

Unless otherwise stated the formulas are implemented according to the Jean Meeus book: "Astronomical Algorithms"

Chapter 13 - Transformation of Coordinates

The following conventions apply:

Longitudes East of Greenwich is POSITIVE: 0° to 180°
Longitudes West of Greenwich is NEGATIVE: 0° to -180°
Azimuth North is 0°
Azimuth East is 90°
Azimuth South is 180°
Azimuth West is 270°

All data need to be expressed in radians, not in degrees or hours

Summary

Functions

Converts from AltAzimth coordinates to Equatorial Celestial coordinates

Converts ecliptical latitude and logitude to equatorial AR / DEC at a given time

Converts from Equatorial Celestial coordinates to AltAzimth coordinates

Converts equatorial AR / DEC to ecliptical latitude and logitude at a given time

Functions

az2eq(map1, map2, dt)

Converts from AltAzimth coordinates to Equatorial Celestial coordinates

      Follows the Azimuth convention of South @ 180° (performs the necessary
      conversion to comply to Meeus algo which is South @ 0°)

Receives: map: Altitude, Azimuth in DEGREES

        map: Latitude, Longitude in DEGREES
        NaiveDateTime

Returns : map: Right Ascension, Declination in DEGREES

Note: does NOT take refraction into account

ecl2eq(map, dt)

Converts ecliptical latitude and logitude to equatorial AR / DEC at a given time

Opposite to eq2ecl, there are no reliable test numbers available Therefore this function can only be tested via round trip together with eq2ecl

Examples

iex> test = %{dec: 25.989, ra: 277.892}  # or whatever coordinates
iex> date = Astrex.Common.ndt_now()
iex> Astrex.Astro.Transforms.eq2ecl(test, date) |> Astrex.Astro.Transforms.ecl2eq(date)
%{dec: 25.989000000000008, ra: 277.89199999999994}

PASSES with float operations approximation

eq2az(map1, map2, dt)

Converts from Equatorial Celestial coordinates to AltAzimth coordinates

       according to Jean Meeus Algorithm
       Follows the Azimuth convention of South @ 180° (performs the necessary
       conversion to comply to Meeus algo which is South @ 0°)

Receives: map: Right Ascension and Declination in DEGREES

        map: Latitude, Longitude in DEGREES
        NaiveDateTime

Returns : map: Altitude and Azimuth in DEGREES

(see Meeus Astronomical Algorithms page 95 example 13.b)

Examples:

iex> site = %{lat: 38.921, long: 77.065}
iex> obj  = %{ra: 347.316, dec: -6.719}
iex> date = ~N[1987-04-10 19:21:00]
iex> Astrex.Astro.Transforms.eq2az(obj, site, date)
%{alt: 15.122211840841763, az: 248.037813189937}

Note: the example from the book returns az: 68.037813189937 because the azimuth convention
      is 0° South. We use 180° for south.

eq2ecl(map, dt)

Converts equatorial AR / DEC to ecliptical latitude and logitude at a given time

Receives: RA/DEC expressed in DEGREES Returns: Longitude/Latitude (ecliptical) expressed in DEGREES

Examples

iex> date = ~N[1987-04-10 00:00:00]
iex> obj  = %{ra: 116.328942, dec: 28.026183}
iex> Astrex.Astro.Transforms.eq2ecl(obj, date)
%{lambda: 113.215630, beta: 6.68417}  # in degrees

PASSES with float operations approximation