Class: Eot

Inherits:
Object
  • Object
show all
Defined in:
lib/eot/all.rb,
lib/eot/init.rb,
lib/eot/times.rb,
lib/eot/angles.rb,
lib/eot/deltas.rb,
lib/eot/version.rb,
lib/eot/jd_times.rb,
lib/eot/constants.rb,
lib/eot/utilities.rb,
lib/eot/delta_times.rb,
lib/eot/trigonometric.rb,
lib/eot/time_displays.rb,
lib/eot/angles_displays.rb

Overview

class Eot file = angle_displays.rb: methods for display of angles.

Constant Summary

VERSION =

current version

'4.1.9'.freeze
ARCSEC =

in lib/eot/constants.rb
Arc seconds in a degree
ARCSEC      = 3_600.0
3_600.0
ASD =

in lib/eot/constants.rb
Arc seconds in a degree
ASD         = 3_600.0
3_600.0
ASH =

in lib/eot/constants.rb
Arc seconds in an hour
ASH         = 240.0
240.0
AULT =

in lib/eot/constants.rb
Light time for 1 au (s)
AULT        = 499.004782
499.004782
CMPS =

in lib/eot/constants.rb
Speed of light (m/s)
CMPS        = 299_792_458.0
299_792_458.0
D2000 =

in lib/eot/constants.rb
Default date string
D2000       = '2000-01-01'.freeze
'2000-01-01'.freeze
D2PI =

in lib/eot/constants.rb
Pi * 2
from desktop calculator
D2PI        = 6.283185307179586476925287
6.283185307179586476925287
DAS2R =

in lib/eot/constants.rb
Degree arc seconds to radians
DAS2R       = 4.8481368110953599358991410235795e-6
4.8481368110953599358991410235795e-6
DAU =

in lib/eot/constants.rb
Astronomical unit (m)
DAU         = 149_597_870e3
149_597_870e3
DAY_HOURS =

in lib/eot/constants.rb
Hours in a day
DAY_HOURS   = 24.0
24.0
DAY_MINUTES =

in lib/eot/constants.rb
Minutes in a day
DAY_MINUTES = 1_440.0
1_440.0
DAY_SECONDS =

in lib/eot/constants.rb
Seconds in a day
DAY_SECONDS = 86_400.0
86_400.0
DAYSEC =

in lib/eot/constants.rb
Seconds in a day
DAYSEC      = 86_400.0
86_400.0
DAY_USECS =

in lib/eot/constants.rb
Micro Seconds in a day
DAY_USECS   = 86_400_000_000.0
86_400_000_000.0
DC =

in lib/eot/constants.rb
Speed of light (AU per day)
DC          = DAYSEC / AULT
DAYSEC / AULT
D2R =

in lib/eot/constants.rb
Dregrees to radians
A multiplier for conversion
D2R         = 0.017453292519943295769236907684886
0.017453292519943295769236907684886
DJ00 =

in lib/eot/constants.rb
Reference epoch (J2000.0), Julian Date
Default Julian Number = 2451545.0
DJ00        = 2_451_545.0
2_451_545.0
DJC =

in lib/eot/constants.rb
Days in Julian century
DJC         = 36_525.0
36_525.0
DJM =

in lib/eot/constants.rb
Days per Julian millennium
DJM         = 365_250.0
365_250.0
DJM0 =

in lib/eot/constants.rb
Julian Date of Modified Julian Date zero
1858, 11, 17, 0.0 midnight start of calendar reform
Removed from Julian Date to get Modified Julian Date
DJM0        = 2_400_000.5
2_400_000.5
DJM00 =

in lib/eot/constants.rb
Reference epoch (J2000.0), Modified Julian Date
DJM00       = 51_544.5
51_544.5
DJM77 =

in lib/eot/constants.rb
1977 Jan 1.0 as MJD
DJM77       = 43_144.0
43_144.0
DJY =

in lib/eot/constants.rb
Days in Julian year
DJY         = 365.25
365.25
DMAS2R =

in lib/eot/constants.rb
Milli-arc-seconds to radians
DMAS2R      = DAS2R / 1e3
DAS2R / 1e3
DR2AS =

in lib/eot/constants.rb
Radians to arc seconds
DR2AS       = 206_264.8062470963551564734
206_264.8062470963551564734
DS2R =

in lib/eot/constants.rb
Seconds of time to radians
DS2R        = 7.272205216643039903848712e-5
7.272205216643039903848712e-5
DT2000 =

in lib/eot/constants.rb
Default DateTime
DT2000      = DateTime.new( 2000, 01, 01, 12, 00, 00, "+00:00" )
DateTime.new(2000, 0o1, 0o1, 12, 0o0, 0o0, '+00:00')
DTR =

in lib/eot/constants.rb
arc seconds degrees to radians
DTR         = PI / 180.0 / ARCSEC
DTR         = 4.8481368110953599358991410235795e-6 # from calculator
Math::PI / 180.0 / ARCSEC
DTY =

in lib/eot/constants.rb
Length of tropical year B1900 (days)
DTY         = 365.242198781
365.242198781
ELG =

in lib/eot/constants.rb
L_G = 1 - d(TT)/d(TCG)
ELG         = 6.969290134e-10
6.969290134e-10
ELB =

in lib/eot/constants.rb
L_B = 1 - d(TDB)/d(TCB)
ELB         = 1.550519768e-8
1.550519768e-8
J2000 =

in lib/eot/constants.rb
Reference epoch (J2000.0), Julian Date
Default Julian Number
J2000       = 2_451_545.0
2_451_545.0
MJD0 =

in lib/eot/constants.rb
Julian Date of Modified Julian Date zero
1858, 11, 17, 0.0 midnight start of calendar reform
MJD0        = 2_400_000.5
2_400_000.5
PI =

in lib/eot/constants.rb
from desktop calculator
PI          = 3.1415926535897932384626433832795
3.1415926535897932384626433832795
P2 =

in lib/eot/constants.rb
2 * Pi from Math module
P2          = Math::PI * 2.0
Math::PI * 2.0
R2D =

in lib/eot/constants.rb
from desktop calculator
A multiplier for conversion
Radians to degrees
R2D         = 57.295779513082320876798154814105
57.295779513082320876798154814105
SM =

in lib/eot/constants.rb
from desktop calculator Sidereal minutes
4.0 / 1.0027379093507953456536618754278
probably 3.989 would be close enough because
it's not that constant anyway
SM          = 4.0 / 1.0027379093507953456536618754278
4.0 / 1.0027379093507953456536618754278
SRS =

in lib/eot/constants.rb
Schwarzschild radius of the Sun (au)
2 * 1.32712440041e20 / (2.99792458e8)^2 / 1.49597870700e11
SRS         = 1.97412574336e-8
1.97412574336e-8
TDB0 =

in lib/eot/constants.rb
TDB (s) at TAI 1977/1/1.0
TDB0        = -6.55e-5
-6.55e-5
TTMTAI =

in lib/eot/constants.rb
TT minus TAI (s)
TTMTAI      = 32.184
32.184
TURNAS =

in lib/eot/constants.rb
Arcseconds in a full circle
TURNAS      = 1_296_000.0
1_296_000.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEot

in lib/eot/init.rb:
Eot::new


98
99
100
101
102
103
104
# File 'lib/eot/init.rb', line 98

def initialize
  d = DateTime.now.to_time.utc.to_datetime
  @jd = d.jd
  set_t
  @latitude = 0.0
  @longitude = 0.0
end

Instance Attribute Details

#addrObject

in lib/eot/init.rb:
:addr is entered as a String ex: "houston, tx"
and is used for Google Geo location lookup.
There are two of these. One is in GeoLatLng class
and this one you may use this for storage only.
It has no effect otherwise.
see GeoLatLng class #new and #set_coordinates


16
17
18
# File 'lib/eot/init.rb', line 16

def addr
  @addr
end

#ajdObject

in lib/eot/init.rb:
@ajd gets set the same as @jd all the time.
This just saves the confusion of which one to use.
So let Ruby Date and DateTime classes decide.
You could use this for storage temporarally until
it gets reset by #set_t method.


27
28
29
# File 'lib/eot/init.rb', line 27

def ajd
  @ajd
end

#dateObject

in lib/eot/init.rb:
see the top document for Eot class.


50
51
52
# File 'lib/eot/init.rb', line 50

def date
  @date
end

#jdObject

in lib/eot/init.rb:
see the top document for Eot class.


57
58
59
# File 'lib/eot/init.rb', line 57

def jd
  @jd
end

#latitudeObject

in lib/eot/init.rb:
set this before making new calculations.
New class objects set this to 0.0


65
66
67
# File 'lib/eot/init.rb', line 65

def latitude
  @latitude
end

#longitudeObject

in lib/eot/init.rb:
set this before making new calculations.
New class objects set this to 0.0


73
74
75
# File 'lib/eot/init.rb', line 73

def longitude
  @longitude
end

#maObject

in lib/eot/init.rb:
Don't make any changes to this because for
one it gets reset each time #set_t method is used.
You may of course look at the value anytime.


91
92
93
# File 'lib/eot/init.rb', line 91

def ma
  @ma
end

#tObject

in lib/eot/init.rb:
Don't make any changes to this because for
one it gets reset each time #set_t method is used.
You may of course look at the value anytime.


82
83
84
# File 'lib/eot/init.rb', line 82

def t
  @t
end

Instance Method Details

#ajd_to_datetime(ajd) ⇒ Object Also known as: jd_to_datetime

Solves the problem for converting back to a
correct DateTime


12
13
14
# File 'lib/eot/times.rb', line 12

def ajd_to_datetime(ajd)
  DateTime.jd(ajd + 0.5)
end

#al_sunObject Also known as: apparent_longitude, alsun

Apparent solar longitude = true longitude - abberation
Sometimes this is called lambda in astronomical calculations.


11
12
13
# File 'lib/eot/angles.rb', line 11

def al_sun
  al(@t)
end

#angle_delta_epsilonObject Also known as: delta_epsilon

From deltas.rb: delta epsilon component of equation of equinox



7
8
9
# File 'lib/eot/deltas.rb', line 7

def angle_delta_epsilon
  Celes.nut06a(@ajd, 0)[1]
end

#angle_delta_obliqueObject Also known as: delta_t_ecliptic, delta_oblique

From deltas.rb: one time component to total equation of time



14
15
16
# File 'lib/eot/deltas.rb', line 14

def angle_delta_oblique
  al_sun - right_ascension_sun
end

#angle_delta_orbitObject Also known as: delta_t_elliptic, delta_orbit

From deltas.rb: one time component to total equation of time



22
23
24
# File 'lib/eot/deltas.rb', line 22

def angle_delta_orbit
  -1.0 * eqc(@t)
end

#angle_delta_psiObject Also known as: delta_psi

From deltas.rb: component of equation of equinox



30
31
32
# File 'lib/eot/deltas.rb', line 30

def angle_delta_psi
  Celes.nut06a(@ajd, 0)[0]
end

#angle_equation_of_timeObject Also known as: eot

From deltas.rb: total equation of time



37
38
39
# File 'lib/eot/deltas.rb', line 37

def angle_equation_of_time
  delta_orbit + delta_oblique
end

#astronomical_twilight_end_dtObject

From times.rb: Uses @ajd attribute Returns astronomical twilight end as a DateTime



20
21
22
# File 'lib/eot/times.rb', line 20

def astronomical_twilight_end_dt
  ajd_to_datetime(astronomical_twilight_end_jd)
end

#astronomical_twilight_end_jdObject

From jd_times.rb: Uses @ajd attribute Returns astronomical twilight end as a Julian Day Number



7
8
9
# File 'lib/eot/jd_times.rb', line 7

def astronomical_twilight_end_jd
  local_noon_dt.ajd + ha_sun(4) / P2
end

#astronomical_twilight_start_dtObject

From times.rb: Uses @ajd attribute Returns astronomical twilight start as a DateTime



27
28
29
# File 'lib/eot/times.rb', line 27

def astronomical_twilight_start_dt
  ajd_to_datetime(astronomical_twilight_start_jd)
end

#astronomical_twilight_start_jdObject

From jd_times.rb: Uses @ajd attribute Returns astronomical twilight start as a Julian Day Number



14
15
16
# File 'lib/eot/jd_times.rb', line 14

def astronomical_twilight_start_jd
  local_noon_dt.ajd - ha_sun(4) / P2
end

#centerObject Also known as: equation_of_center

equation of centre is added to mean anomaly to get true anomaly.



23
24
25
# File 'lib/eot/angles.rb', line 23

def center
  eqc(@t)
end

#check_jd_nil(jd = DJ00) ⇒ Object

From utilities.rb: A check for default J2000 sets default when arg is nil



7
8
9
# File 'lib/eot/utilities.rb', line 7

def check_jd_nil(jd = DJ00)
  jd.nil? ? DJ00 : jd
end

#check_jd_zero(jd = DJ00) ⇒ Object

From utilities.rb: A check for default J2000 sets default when arg is zero



14
15
16
# File 'lib/eot/utilities.rb', line 14

def check_jd_zero(jd = DJ00)
  jd.zero? ? DJ00 : check_jd_nil(jd)
end

#check_t_nil(dt = DT2000) ⇒ Object

From utilities.rb: A check for default DT2000 sets default when arg is nil



21
22
23
# File 'lib/eot/utilities.rb', line 21

def check_t_nil(dt = DT2000)
  dt.nil? ? DT2000 : dt
end

#check_t_zero(dt = DT2000) ⇒ Object

From utilities.rb: A check for default DT2000 sets default when arg is zero



28
29
30
# File 'lib/eot/utilities.rb', line 28

def check_t_zero(dt = DT2000)
  dt.zero? ? DT2000 : check_t_nil(dt)
end

#choice(c) ⇒ Object

used by ha_sun method to select rise set and civil, nautical, astronomical twilights.



100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/eot/angles.rb', line 100

def choice(c)
  case c
  when 0..1 || nil
    90.8333 # Sunrise and Sunset
  when 2
    96 # Civil Twilight
  when 3
    102 # Nautical Twilight
  when 4
    108 # Astronomical Twilight
  end
end

#civil_twilight_end_dtObject

From times.rb: Uses @ajd attribute Returns civil twilight end as a DateTime



34
35
36
# File 'lib/eot/times.rb', line 34

def civil_twilight_end_dt
  ajd_to_datetime(civil_twilight_end_jd)
end

#civil_twilight_end_jdObject

From jd_times.rb: Uses @ajd attribute Returns civil twilight end as a Julian Day Number



21
22
23
# File 'lib/eot/jd_times.rb', line 21

def civil_twilight_end_jd
  local_noon_dt.ajd + ha_sun(2) / P2
end

#civil_twilight_start_dtObject

From times.rb: Uses @ajd attribute Returns civil twilight start as a DateTime



41
42
43
# File 'lib/eot/times.rb', line 41

def civil_twilight_start_dt
  ajd_to_datetime(civil_twilight_start_jd)
end

#civil_twilight_start_jdObject

From jd_times.rb: Uses @ajd attribute Returns civil twilight start as a Julian Day Number



28
29
30
# File 'lib/eot/jd_times.rb', line 28

def civil_twilight_start_jd
  local_noon_dt.ajd - ha_sun(2) / P2
end

#cosine_al_sunObject Also known as: cosine_apparent_longitude, cosalsun

From trigometric.rb: cosine apparent longitude could be useful when dividing



7
8
9
# File 'lib/eot/trigonometric.rb', line 7

def cosine_al_sun
  cos_al_sun(@t)
end

#cosine_tl_sunObject Also known as: cosine_true_longitude

From trigometric.rb: cosine true longitude used in solar right ascension



16
17
18
# File 'lib/eot/trigonometric.rb', line 16

def cosine_tl_sun
  cos_tl_sun(@t)
end

#cosine_to_earthObject Also known as: cosine_true_obliquity

From trigometric.rb: cosine true obliquity used in solar right ascension and equation of equinox



24
25
26
# File 'lib/eot/trigonometric.rb', line 24

def cosine_to_earth
  cos_to_earth(to_earth)
end

#dec_sunObject Also known as: declination

solar declination



33
34
35
# File 'lib/eot/angles.rb', line 33

def dec_sun
  sun_dec(@t, to_earth)
end

#degrees_to_s(radians = 0.0) ⇒ Object

String formatter for d:m:s display



9
10
11
12
13
# File 'lib/eot/angles_displays.rb', line 9

def degrees_to_s(radians = 0.0)
  radians.nil? ? radians = 0.0 : radians
  s, idmsf = Celes.a2af(3, radians)
  f_string(s, idmsf[0], idmsf[1], idmsf[2], idmsf[3])
end

#dt_parts(val) ⇒ Object

From displays.rb creates [h,m,s,ds] array from Time or DateTime



91
92
93
94
95
96
97
98
# File 'lib/eot/time_displays.rb', line 91

def dt_parts(val)
  h  = val.hour
  m  = val.min
  s  = val.sec
  is = Integer(s)
  ds = Integer((s - is).round(3) * 1000.0)
  [h, m, is, ds]
end

#eccentricity_earthObject Also known as: eccentricity_earth_orbit

eccentricity of elliptical Earth orbit around Sun Horners' calculation method



44
45
46
# File 'lib/eot/angles.rb', line 44

def eccentricity_earth
  eoe(@t)
end

#eot_jdObject

From jd_times.rb: Uses @ajd attribute Returns EOT as an AJD Julian number



35
36
37
# File 'lib/eot/jd_times.rb', line 35

def eot_jd
  time_eot / DAY_MINUTES
end

#eq_of_equinoxObject

equation of equinox is used for true longitude of Aries but Depricated by Celes.gst06a() compinents are still used see: #cosine_to_earth and #angle_delta_psi



58
59
60
# File 'lib/eot/angles.rb', line 58

def eq_of_equinox
  Celes.ee06a(@ajd, 0.0)
end

#eraObject

Earth rotation angle (for comparison to tl_aries which uses gmst06)



68
69
70
# File 'lib/eot/angles.rb', line 68

def era
  Celes.era00(@ajd, 0.0)
end

#f_string(sgn, u, m, s, ds) ⇒ Object

From utilities.rb: formats degree string



34
35
36
37
38
39
40
41
42
43
# File 'lib/eot/utilities.rb', line 34

def f_string(sgn, u, m, s, ds)
  sgn +
    format('%03d', u) +
    ':' +
    format('%02d', m) +
    ':' +
    format('%02d', s) +
    '.' +
    format('%3.3d', ds)
end

#float_parts(val) ⇒ Object

From displays.rb creates [h,m,s,ds] from hours Float



102
103
104
105
106
107
108
109
110
111
# File 'lib/eot/time_displays.rb', line 102

def float_parts(val)
  val.nil? ? val = 0.0 : val
  hours = Integer(val % DAY_HOURS)
  mins = 60.0 * (val % DAY_HOURS - hours)
  imins = Integer(mins)
  secs = 60.0 * (mins - imins)
  isecs = Integer(secs)
  ds    = Integer((secs - isecs).round(3) * 1000.0)
  [hours, imins, isecs, ds]
end

#format_time(h, m, s, ds) ⇒ Object

From displays.rb formats time components



79
80
81
82
83
84
85
86
87
# File 'lib/eot/time_displays.rb', line 79

def format_time(h, m, s, ds)
  format('%02d', h) +
    ':' +
    format('%02d', m) +
    ':' +
    format('%02d', s) +
    '.' +
    format('%3.3d', ds)
end

#gha_sunObject



78
79
80
# File 'lib/eot/angles.rb', line 78

def gha_sun
  (tl_aries - sun_ra(@t, to_earth)) % 2 * Math::PI  
end

#ha_sun(c) ⇒ Object Also known as: horizon_angle

horizon angle for provided geo coordinates used for angles from transit to horizons east, west.



119
120
121
122
123
# File 'lib/eot/angles.rb', line 119

def ha_sun(c)
  c.nil? ? c = 1 : c
  zenith = choice(c)
  sun(zenith, dec_sun, @latitude)
end

#local_noon_dtObject

From times.rb: Uses @ajd and @longitude attributes Returns DateTime object of local noon or solar transit



48
49
50
# File 'lib/eot/times.rb', line 48

def local_noon_dt
  ajd_to_datetime(mean_local_noon_jd - eot_jd)
end

#ma_sunObject Also known as: mean_anomaly

angle of Suns' mean anomaly calculated in nutation.rb via celes function sets ta attribute for the rest the methods needing it. used in equation of time and to get true anomaly true longitude via center equation



135
136
137
# File 'lib/eot/angles.rb', line 135

def ma_sun
  mu(@t)
end

#mean_local_noon_jdObject

From jd_times.rb: Uses @ajd and @longitude attributes Returns DateTime object of local mean noon or solar transit



42
43
44
# File 'lib/eot/jd_times.rb', line 42

def mean_local_noon_jd
  @ajd - @longitude / 360.0
end

#ml_ariesObject Also known as: mean_longitude_aries

Mean equinox point where right ascension is measured from as zero hours. # see www.iausofa.org/publications/aas04.pdf



146
147
148
149
150
# File 'lib/eot/angles.rb', line 146

def ml_aries
  dt = 68.182
  tt = @ajd + dt / 86_400.0
  Celes.gmst06(@ajd, 0, tt, 0)
end

#ml_sunObject Also known as: geometric_mean_longitude, gml_sun

angle geometric mean longitude needed to get true longitude for low accuracy.



88
89
90
# File 'lib/eot/angles.rb', line 88

def ml_sun
  ml(@t)
end

#mo_earthObject Also known as: mean_obliquity_of_ecliptic, mean_obliquity

mean obliquity of Earth



158
159
160
# File 'lib/eot/angles.rb', line 158

def mo_earth
  Celes.obl06(@ajd, 0)
end

#mod_360(x = 0.0) ⇒ Object Also known as: truncate

From utilities.rb: Keeps large angles in range of 360.0 aliased by truncate



48
49
50
51
# File 'lib/eot/utilities.rb', line 48

def mod_360(x = 0.0)
  x.nil? ? x = 0.0 : x
  360.0 * (x / 360.0 - Integer(x / 360.0))
end

#nautical_twilight_end_dtObject

From times.rb: Uses @ajd attribute Returns nautical twilight end as a DateTime



55
56
57
# File 'lib/eot/times.rb', line 55

def nautical_twilight_end_dt
  ajd_to_datetime(nautical_twilight_end_jd)
end

#nautical_twilight_end_jdObject

From jd_times.rb: Uses @ajd attribute Returns nautical twilight end as a Julian Day Number



49
50
51
# File 'lib/eot/jd_times.rb', line 49

def nautical_twilight_end_jd
  local_noon_dt.ajd + ha_sun(3) / P2
end

#nautical_twilight_start_dtObject

From times.rb: Uses @ajd attribute Returns nautical twilight start as a DateTime



62
63
64
# File 'lib/eot/times.rb', line 62

def nautical_twilight_start_dt
  ajd_to_datetime(nautical_twilight_start_jd)
end

#nautical_twilight_start_jdObject

From jd_times.rb: Uses @ajd attribute Returns nautical twilight start as a Julian Day Number



56
57
58
# File 'lib/eot/jd_times.rb', line 56

def nautical_twilight_start_jd
  local_noon_dt.ajd - ha_sun(3) / P2
end

#nowObject

From times.rb: sets @ajd to DateTime.now Returns EOT (equation of time) now in decimal minutes form



69
70
71
72
73
# File 'lib/eot/times.rb', line 69

def now
  @ajd = DateTime.now.to_time.utc.to_datetime.ajd
  @ta = (@ajd - DJ00) / DJC
  time_eot
end

#right_ascension_sunObject Also known as: right_ascension, ra_sun

solar right ascension



181
182
183
184
185
186
# File 'lib/eot/angles.rb', line 181

def right_ascension_sun
  # y0 = sine_al_sun * cosine_to_earth
  sun_ra(@t, to_earth)
  # Celes.anp(PI + atan2(-y0, -cosine_al_sun))
  # Celes.anp(PI + ra)
end

#set_tObject Also known as: ma_ta_set

in lib/eot/init.rb:
see the source.
Use this every time you make changes for either
location or date.
Also see the top document for Eot class.


37
38
39
40
41
42
# File 'lib/eot/init.rb', line 37

def set_t
  @t = ((@jd - DJ00) / DJC).to_f
  @ma = ma_sun
  @date = jd_to_datetime(@jd)
  @ajd = @jd
end

#show_minutes(min = 0.0) ⇒ Object

From displays.rb String formatter for + and - time



6
7
8
9
10
11
12
# File 'lib/eot/time_displays.rb', line 6

def show_minutes(min = 0.0)
  min.nil? ? min = 0.0 : min
  time = Time.utc(1, 1, 1, 0, 0, 0, 0.0)
  time += (min.abs * 60.0)
  sign = sign_min(min)
  time.strftime("#{sign}%M:%S.%3N")
end

#show_now(now = now(Time.now.utc)) ⇒ Object

From displays.rb String for time now



16
17
18
# File 'lib/eot/time_displays.rb', line 16

def show_now(now = now(Time.now.utc))
  show_minutes(now)
end

#sign_min(min) ⇒ Object

From displays.rb displays + or - sign



46
47
48
49
50
51
52
53
# File 'lib/eot/time_displays.rb', line 46

def sign_min(min)
  sign = if min < 0.0
           '-'
         else
           '+'
         end
  sign
end

#sine_al_sunObject Also known as: sine_apparent_longitude

From trigometric.rb: sine apparent longitude used in solar declination



32
33
34
# File 'lib/eot/trigonometric.rb', line 32

def sine_al_sun
  sin_al_sun(@t)
end

#sine_tl_sunObject Also known as: sine_true_longitude

From trigometric.rb: sine true longitude used in solar right ascension



40
41
42
# File 'lib/eot/trigonometric.rb', line 40

def sine_tl_sun
  sin_tl_sun(tl_sun)
end

#sine_to_earthObject Also known as: sine_true_obliquity

From trigometric.rb: sine true obliquity angle of Earth used in solar declination



48
49
50
# File 'lib/eot/trigonometric.rb', line 48

def sine_to_earth
  sin_to_earth(to_earth)
end

#string_al_sunObject Also known as: apparent_longitude_string

String format of apparent longitude



18
19
20
# File 'lib/eot/angles_displays.rb', line 18

def string_al_sun
  degrees_to_s(al_sun)
end

#string_arc_secs(asec) ⇒ Object

String display of arc seconds



26
27
28
# File 'lib/eot/angles_displays.rb', line 26

def string_arc_secs(asec)
  asec.to_s + 34.chr
end

#string_day_fraction_to_time(jpd_time = 0.0) ⇒ Object Also known as: julian_period_day_fraction_to_time

From displays.rb String formatter for fraction of Julian day number



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/eot/time_displays.rb', line 22

def string_day_fraction_to_time(jpd_time = 0.0)
  jpd_time.nil? ? jpd_time = 0.0 : jpd_time
  fraction = jpd_time + 0.5 - Integer(jpd_time)
  h = Integer(fraction * DAY_HOURS)
  m = Integer((fraction - h / DAY_HOURS) * DAY_MINUTES)
  s = Integer((fraction - h / 24.0 - m / DAY_MINUTES) * DAY_SECONDS)
  format('%02d:', h) +
    # ':' +
    format('%02d', m) +
    ':' +
    format('%02d', s)
end

#string_dec_sunObject Also known as: declination_string

String format of declination



33
34
35
# File 'lib/eot/angles_displays.rb', line 33

def string_dec_sun
  degrees_to_s(dec_sun)
end

#string_deg_to_time(radians = 0.0) ⇒ Object

From displays.rb radians to time method



38
39
40
41
42
# File 'lib/eot/time_displays.rb', line 38

def string_deg_to_time(radians = 0.0)
  radians.nil? ? radians = 0.0 : radians
  s, ihmsf = Celes.a2tf(3, radians)
  f_string(s, ihmsf[0], ihmsf[1], ihmsf[2], ihmsf[3])
end

#string_delta_epsilonObject

String format of delta epsilon



41
42
43
# File 'lib/eot/angles_displays.rb', line 41

def string_delta_epsilon
  string_arc_secs((delta_epsilon * R2D * 3600.0).round(3))
end

#string_delta_obliqueObject

String format for delta oblique



48
49
50
# File 'lib/eot/angles_displays.rb', line 48

def string_delta_oblique
  show_minutes(delta_oblique)
end

#string_delta_orbitObject

String format for delta orbit



55
56
57
# File 'lib/eot/angles_displays.rb', line 55

def string_delta_orbit
  show_minutes(delta_orbit)
end

#string_delta_psiObject

String format for delta psi



62
63
64
# File 'lib/eot/angles_displays.rb', line 62

def string_delta_psi
  string_arc_secs((delta_psi * R2D * 3600.0).round(3))
end

#string_eotObject Also known as: display_equation_of_time

From displays.rb Equation of time output for minutes and seconds



57
58
59
60
61
62
63
64
65
# File 'lib/eot/time_displays.rb', line 57

def string_eot
  sign = sign_min(time_eot)
  minutes = Integer(time_eot.abs)
  seconds = (time_eot.abs - minutes) * 60.0
  decimal_seconds = (seconds - Integer(seconds)) * 100.0
  sign << format('%02d', minutes) << 'm, '
  sign << format('%02d', seconds) << '.'
  sign << format('%01d', decimal_seconds) << 's'
end

#string_eqcObject

String format for centre



69
70
71
# File 'lib/eot/angles_displays.rb', line 69

def string_eqc
  degrees_to_s(center)
end

#string_gha(gha) ⇒ Object

String format for GHA



76
77
78
79
80
81
82
# File 'lib/eot/angles_displays.rb', line 76

def string_gha(gha)
  a = gha * R2D
  d = Integer(a).to_s + "\xC2\xB0"
  m = Integer((a - Integer(a)) * 60).to_s + 39.chr
  s = (((a - Integer(a)) * 60 - Integer((a - Integer(a)) * 60)) * 100).round(3).to_s
  d + 32.chr + m + 32.chr + s + 34.chr
end

#string_jd_to_date(jd = DJ00) ⇒ Object Also known as: jd_to_date_string

From displays.rb String format conversion of jd to date



70
71
72
73
74
# File 'lib/eot/time_displays.rb', line 70

def string_jd_to_date(jd = DJ00)
  jd.nil? ? jd = DJ00 : jd
  # jd = check_jd_zero(jd)
  Date.jd(jd).to_s
end

#string_ma_sunObject Also known as: mean_anomaly_string

String format of mean anomaly



87
88
89
# File 'lib/eot/angles_displays.rb', line 87

def string_ma_sun
  degrees_to_s(@ma)
end

#string_ml_sunObject Also known as: mean_longitude_string

String format of mean longitude



95
96
97
# File 'lib/eot/angles_displays.rb', line 95

def string_ml_sun
  degrees_to_s(ml_sun)
end

#string_mo_earthObject Also known as: mean_obliquity_string

String format of mean obliquity



103
104
105
# File 'lib/eot/angles_displays.rb', line 103

def string_mo_earth
  degrees_to_s(mo_earth)
end

#string_ra_sunObject Also known as: right_ascension_string

String format of right ascension



111
112
113
# File 'lib/eot/angles_displays.rb', line 111

def string_ra_sun
  degrees_to_s(right_ascension_sun)
end

#string_ta_sunObject Also known as: true_anomaly_string

String format of true anomaly



119
120
121
# File 'lib/eot/angles_displays.rb', line 119

def string_ta_sun
  degrees_to_s(ta_sun)
end

#string_time(dt = DT2000) ⇒ Object Also known as: display_time_string

From displays.rb String formatter for h:m:s display



115
116
117
118
119
# File 'lib/eot/time_displays.rb', line 115

def string_time(dt = DT2000)
  dt.nil? ? dt = DT2000 : dt
  ta = dt.class == DateTime ? dt_parts(dt) : float_parts(dt)
  format_time(ta[0], ta[1], ta[2], ta[3])
end

#string_tl_sunObject Also known as: true_longitude_string

String format of true longitude



127
128
129
# File 'lib/eot/angles_displays.rb', line 127

def string_tl_sun
  degrees_to_s(tl_sun)
end

#string_to_earthObject Also known as: true_obliquity_string

String format of true obliquity



135
136
137
# File 'lib/eot/angles_displays.rb', line 135

def string_to_earth
  degrees_to_s(to_earth)
end

#sunrise_dtObject

From times.rb: Uses @ajd attribute Returns a DateTime object of local sunrise



78
79
80
# File 'lib/eot/times.rb', line 78

def sunrise_dt
  ajd_to_datetime(sunrise_jd)
end

#sunrise_jdObject

From jd_times.rb: Uses @ajd attribute Returns Sunrise as a Julian Day Number



63
64
65
# File 'lib/eot/jd_times.rb', line 63

def sunrise_jd
  local_noon_dt.ajd - ha_sun(1) / P2
end

#sunset_dtObject

From times.rb: Uses @ajd attribute Returns a DateTime object of local sunset



85
86
87
# File 'lib/eot/times.rb', line 85

def sunset_dt
  ajd_to_datetime(sunset_jd)
end

#sunset_jdObject

From jd_times.rb: Uses @ajd attribute Returns Sunset as a Julian Day Number



70
71
72
# File 'lib/eot/jd_times.rb', line 70

def sunset_jd
  local_noon_dt.ajd + ha_sun(1) / P2
end

#ta_sunObject Also known as: true_anomaly

angle true anomaly used in equation of time



196
197
198
# File 'lib/eot/angles.rb', line 196

def ta_sun
  ta(@t)
end

#time_delta_obliqueObject

From delta_times.rb: Uses @ajd attribute Returns Oblique component of EOT in decimal minutes time



7
8
9
# File 'lib/eot/delta_times.rb', line 7

def time_delta_oblique
  delta_oblique * R2D * SM
end

#time_delta_orbitObject

From delta_times.rb: Uses @ajd attribute Returns Orbit component of EOT in decimal minutes time



14
15
16
# File 'lib/eot/delta_times.rb', line 14

def time_delta_orbit
  delta_orbit * R2D * SM
end

#time_eotObject

From delta_times.rb: Uses @ajd attribute Returns EOT as a float for decimal minutes time



21
22
23
# File 'lib/eot/delta_times.rb', line 21

def time_eot
  eot * R2D * SM
end

#tl_ariesObject Also known as: true_longitude_aries

true longitude of equinox 'first point of aries' considers nutation



207
208
209
210
211
# File 'lib/eot/angles.rb', line 207

def tl_aries
  dt = 68.184
  tt = @ajd + dt / 86_400.0
  Celes.gst06a(@ajd, 0, tt, 0)
end

#tl_sunObject Also known as: true_longitude, ecliptic_longitude, lambda

angle of true longitude sun used in equation of time



220
221
222
# File 'lib/eot/angles.rb', line 220

def tl_sun
  tl(@t)
end

#to_earthObject Also known as: obliquity_correction, true_obliquity, toearth

true obliquity considers nutation



232
233
234
# File 'lib/eot/angles.rb', line 232

def to_earth
  mo_earth + angle_delta_epsilon
end