Class: Eot

Inherits:
Object
  • Object
show all
Includes:
Math
Defined in:
lib/eot/times.rb,
lib/eot/init.rb,
lib/eot/angles.rb,
lib/eot/version.rb,
lib/eot/displays.rb,
lib/eot/nutation.rb,
lib/eot/constants.rb,
lib/eot/utilities.rb,
ext/eot/eot.c

Overview

utilities.rb

Constant Summary collapse

VERSION =
"4.1.2"
ARCSEC =

Arc seconds in a degree = 3_600.0

3_600.0
ASD =

Arc seconds in a degree = 3_600.0

3_600.0
DAS2R =

from desktop calculator DAS2R = 4.8481368110953599358991410235795e-6

4.8481368110953599358991410235795e-6
DAY_HOURS =

Hours in a day = 24.0

24.0
DAY_MINUTES =

Minutes in a day = 1_440.0

1_440.0
DAY_SECONDS =

Seconds in a day = 86_400.0

86_400.0
DAYSEC =

Seconds in a day = 86_400.0

86400.0
DAY_USECS =

Micro Seconds in a day = 86_400_000_000.0

86_400_000_000.0
D2R =

from desktop calculator D2R = 0.017453292519943295769236907684886

0.017453292519943295769236907684886
DJ00 =

Reference epoch (J2000.0), Julian Date Default Julian Number = 2451545.0

2451545.0
DJC =

Days per Julian century = 36525.0

36525.0
DT2000 =

Default DateTime = DateTime.new( 2000, 01, 01, 12, 00, 00, “+00:00” )

DateTime.new( 2000, 01, 01, 12, 00, 00, "+00:00" )
PI =

from desktop calculator PI = 3.1415926535897932384626433832795

3.1415926535897932384626433832795
R2D =

from desktop calculator R2D = 57.295779513082320876798154814105

57.295779513082320876798154814105
RTD =

from desktop calculator RTD = 0.015915494309189533576888376337251

0.015915494309189533576888376337251
SM =

from desktop calculator Sidereal minutes = 4.0 / 1.0027379093507953456536618754278

4.0 / 1.0027379093507953456536618754278

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEot

From init.rb:

Initialize to set attributes You may use GeoLatLng to set up @latitude and @longitude but you need to have internet so if not please comment it out for now.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/eot/init.rb', line 78

def initialize()

  # file_path     = File.expand_path( File.dirname( __FILE__ ) + "/nutation_table5_3a.yaml" )
  # @data         = YAML::load( File.open( file_path, 'r'), :safe => true  ).freeze
 
  # set all date and time from this attribute
  @ajd = DateTime.now.to_time.utc.to_datetime.jd.to_f
  @jd = @ajd
  @date = ajd_to_datetime(@ajd) 
  @ta = (( @ajd - DJ00 ) / DJC).to_f
  @ma = Celes.falp03(@ta)                                      
  
  # comment out below if you do not have internet connection
  geo = GeoLatLng.new()      
  geo.get_coordinates_from_address
  @addr = geo.addr
  @latitude = geo.lat
  @longitude = geo.lng
end

Instance Attribute Details

#addrObject

From init.rb:

address used for GeoLatLng.addr



13
14
15
# File 'lib/eot/init.rb', line 13

def addr
  @addr
end

#ajdObject

From init.rb:

Astronomical Julian Day Number is an instance of DateTime class. When new Equation of Time class is initialized



19
20
21
# File 'lib/eot/init.rb', line 19

def ajd
  @ajd
end

#dateObject

From init.rb:

When new Eot class is initialized @date = ajd_to_datetime(@ajd)



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

def date
  @date
end

#jdObject

From init.rb:

Julian Day Number is an instance of DateTime class. When new Eot class is initialized @jd = @ajd



46
47
48
# File 'lib/eot/init.rb', line 46

def jd
  @jd
end

#latitudeObject

From init.rb:

Latitude input is an instance of Float class. When new Eot class is initialized @latitude = 0.0 May use GeoLatLng class to set it also but please comment that out

if no internet connection is present via proxies or firewalls :D



53
54
55
# File 'lib/eot/init.rb', line 53

def latitude
  @latitude
end

#longitudeObject

From init.rb:

Longitude input is an instance of Float class. When new Eot class is initialized @longitude = 0.0 May use GeoLatLng class to set it also but please comment that out if no internet connection is present via proxies or firewalls :D



60
61
62
# File 'lib/eot/init.rb', line 60

def longitude
  @longitude
end

#maObject

From init.rb:

Mean Anomaly gets called a lot so class attribute saves it.



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

def ma
  @ma
end

#taObject

From init.rb:

JCT gets called a lot so class attribute it. Setting @ajd will set this and @ma



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

def ta
  @ta
end

Instance Method Details

#ajd_to_datetime(ajd) ⇒ Object

From times.rb:

Pass in an AJD number Returns a DateTime object



8
9
10
# File 'lib/eot/times.rb', line 8

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

#al(vma, vt, vo) ⇒ Object



30
31
32
33
# File 'ext/eot/eot.c', line 30

VALUE func_al(VALUE klass, VALUE vma, VALUE vt, VALUE vo) {
  rb_ivar_set(klass, id_status, INT2FIX(0));
  return DBL2NUM(alSun(NUM2DBL(vma), NUM2DBL(vt), NUM2DBL(vo)));
}

#al_SunObject Also known as: apparent_longitude, alsun

From angles.rb:

Apparent solar longitude = true longitude - aberation



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

def al_Sun()    
  #Celes.anp(tl_Sun() - 0.00569 * D2R - 0.00478 * D2R * sin(omega()))
  al(@ma, @ta, Celes.faom03(@ta))
end

#angle_delta_epsilonObject Also known as: delta_epsilon

From angles.rb:

delta epsilon component of equation of equinox



19
20
21
# File 'lib/eot/angles.rb', line 19

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

#angle_delta_obliqueObject Also known as: delta_t_ecliptic, delta_oblique

From angles.rb:

one time component to total equation of time



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

def angle_delta_oblique()           
  al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()        
end

#angle_delta_orbitObject Also known as: delta_t_elliptic, delta_orbit

From angles.rb:

one time component to total equation of time



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

def angle_delta_orbit()           
  @ma - Celes.anp(@ma + eqc( @ma, @ta )) 
end

#angle_delta_psiObject Also known as: delta_psi

From angles.rb:

component of equation of equinox



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

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

#angle_equation_of_timeObject Also known as: eot

From angles.rb:

total equation of time



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

def angle_equation_of_time()    
  #~ @ma = ma_Sun()    
  @ma - Celes.anp(@ma + eqc( @ma, @ta )) + al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()    
end

#centerObject Also known as: equation_of_center

From angles.rb:

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



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/eot/angles.rb', line 59

def center()      
  # sine_1M = sin( 1.0 * @ma )
  # sine_2M = sin( 2.0 * @ma )
  # sine_3M = sin( 3.0 * @ma )
  # sine_4M = sin( 4.0 * @ma )
  # sine_5M = sin( 5.0 * @ma )
  # e = eccentricity_Earth()
  # sine_1M * (  2.0       * e    - e**3 * 1.0/4.0 + 5/96.0 * e**5 ) +  
  # sine_2M * (  5.0/4.0   * e**2 - 11/24.0 * e**4 )               + 
  # sine_3M * ( 13.0/12.0  * e**3 - 43/64.0 * e**5 )               +
  # sine_4M *  103.0/96.0  * e**4                                  +
  # sine_5M * 1097.0/960.0 * e**5                              
  # sine_1M * ( 1.914602 - @ta * ( 0.004817 + @ta * 0.000014 )) +                                               +
  # sine_2M * ( 0.019993 - @ta * 0.000101 )                     +                                              +
  # sine_3M *  0.000289
  eqc( @ma, @ta )
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? ? jd = 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 == 0 ? jd = DJ00 : jd = 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? ? dt = 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 == 0 ? dt = DT2000 : dt = check_t_nil( dt )
end

#cosine_al_SunObject Also known as: cosine_apparent_longitude, cosalsun

From angles.rb:

cosine apparent longitude could be useful when dividing



81
82
83
# File 'lib/eot/angles.rb', line 81

def cosine_al_Sun()    
  cos( al(@ma, @ta, Celes.faom03(@ta)) ) 
end

#cosine_tl_SunObject Also known as: cosine_true_longitude

From angles.rb:

cosine true longitude used in solar right ascension



90
91
92
# File 'lib/eot/angles.rb', line 90

def cosine_tl_Sun()    
  cos( tl(@ma, @ta) ) 
end

#cosine_to_EarthObject Also known as: cosine_true_obliquity

From angles.rb:

cosine true obliquity used in solar right ascension and equation of equinox



98
99
100
# File 'lib/eot/angles.rb', line 98

def cosine_to_Earth()    
  cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) ) 
end

#cosZ(vz) ⇒ Object



35
36
37
38
# File 'ext/eot/eot.c', line 35

VALUE func_cosZ(VALUE klass, VALUE vz) {
  rb_ivar_set(klass, id_status, INT2FIX(0));
  return DBL2NUM(cosZ(NUM2DBL(vz)));
}

#dec_SunObject Also known as: declination

From angles.rb:

solar declination



105
106
107
108
# File 'lib/eot/angles.rb', line 105

def dec_Sun()   
  asin( sin(Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0)) * 
          sin( al(@ma, @ta, Celes.faom03(@ta)))) 
end

#degrees_to_s(radians = 0.0) ⇒ Object

From displays.rb

String formatter for d:m:s display



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/eot/displays.rb', line 7

def degrees_to_s( radians = 0.0 )
  radians.nil? ? radians = 0.0 : radians
  radians < 0 ? sign_string      = "-" : sign_string = "+"    
                absolute_degrees = radians.abs * R2D
        absolute_degrees_integer = Integer( absolute_degrees )
        absolute_decimal_minutes = 60.0 * 
                                   (
                                    absolute_degrees - 
                                    absolute_degrees_integer
                                   )
                                   
        absolute_minutes_integer = Integer( absolute_decimal_minutes )
        
        absolute_decimal_seconds = 60.0 * 
                                   (
                                    absolute_decimal_minutes - 
                                    absolute_minutes_integer
                                    )
                                    
        absolute_seconds_integer = Integer( absolute_decimal_seconds )
        
  absolute_milli_seconds_integer = Integer(1000.0 *
                                          (  
                                            absolute_decimal_seconds - 
                                            absolute_seconds_integer
                                           )
                                          )
                          sign_string +
    "%03d" % absolute_degrees_integer +
                                  ":" + 
    "%02d" % absolute_minutes_integer +
                                  ":" + 
    "%02d" % absolute_seconds_integer +
                                  "." + 
    "%3.3d" % absolute_milli_seconds_integer
end

#delta_equinoxObject

From nutation.rb:

Returns array with [ delta_eps, delta_psi, ma_sun, omega] celes gem is used here now for performance. It is a Ruby wrapper for see www.iausofa.org/ also see aa.usno.navy.mil/ Circular 179 nutation data page 46 (5.19) Note: Original code is still intact just commented out.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/eot/nutation.rb', line 14

def delta_equinox()      
  # Mean anomaly of the Moon. 
  # ma_moon = [-0.00024470, 0.051635, 31.8792, 1717915923.2178, 485868.249036].inject(0.0) {|p, a| p * @ta + a}		
  # ma_moon = Celes.fal03(@ta)
  # Mean anomaly of the Sun.
  # ma_sun  = [-0.00001149, 0.000136, -0.5532, 129596581.0481, 1287104.793048].inject(0.0) {|p, a| p * @ta + a}	
  # ma_sun  = Celes.falp03(@ta)
  # mean longitude of the Moon minus mean longitude of the ascending node.               
  # md_moon = [0.00000417, -0.001037, -12.7512, 1739527262.8478, 335779.526232].inject(0.0) {|p, a| p * @ta + a}
  # md_moon = Celes.faf03(@ta)
  # Mean elongation of the Moon from the Sun.        
  # me_moon = [-0.00003169, 0.006593, -6.3706, 1602961601.2090, 1072260.70369].inject(0.0) {|p, a| p * @ta + a} 
  # me_moon = Celes.fad03(@ta)
  # Mean longitude of the ascending node of the Moon.       
  # omega   = [-0.00005939, 0.007702, 7.4722, -6962890.5431, 450160.398036].inject(0.0) {|p, a| p * @ta + a}            
  # omega   = Celes.faom03(@ta)
  # declare and clear these two variables for the sigma loop
  # delta_psi, delta_eps = 0, 0

  # lines = data.size - 1
  # (0..lines).each do |i|
    # fma_sun    = data[i][0].to_i
    # fma_moon   = data[i][1].to_i  	
    # fmd_moon   = data[i][2].to_i
    # fme_moon   = data[i][3].to_i  
    # fomega     = data[i][4].to_i

    # sine       = sin(fma_moon * ma_moon +
                     # fma_sun  * ma_sun  +
                     # fmd_moon * md_moon +
                     # fme_moon * me_moon +
                     # fomega   * omega)
        
    # cosine     = cos(fma_moon * ma_moon +
                     # fma_sun  * ma_sun  +
                     # fmd_moon * md_moon +
                     # fme_moon * me_moon +
                     # fomega   * omega)
        
    # delta_psi += (data[i][6].to_f                  + 
                  # data[i][7].to_f  * @ta) * sine +
                  # data[i][10].to_f * cosine
        
    # delta_eps += (data[i][8].to_f                     + 
                  # data[i][9].to_f   * @ta) * cosine +				 
                  # data[i][12].to_f  * sine						
                       
  # end

  
  # delta_eps = delta_eps / 1000.0 / 3600.0
  # delta_psi = delta_psi  / 1000.0 / 3600.0

  [ Celes.nut06a(@ajd, 0)[0], Celes.nut06a(@ajd, 0)[1]]
  # [ nil, nil, ma_moon, ma_sun, md_moon, me_moon, omega]
end

#eccentricity_EarthObject Also known as: eccentricity_earth_orbit

From angles.rb:

eccentricity of elliptical Earth orbit around Sun Horners’ calculation method



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

def eccentricity_Earth()
  # [-0.0000001235, -0.000042037, 0.016708617].inject(0.0) {|p, a| p * @ta + a}
  eoe(@ta) 
end

#eoe(vt) ⇒ Object



15
16
17
18
# File 'ext/eot/eot.c', line 15

VALUE func_eoe(VALUE klass, VALUE vt) {
  rb_ivar_set(klass, id_status, INT2FIX(0));
  return DBL2NUM(eoe(NUM2DBL(vt)));
}

#eot_jdObject

From times.rb:

Uses @ajd attribute Returns EOT as an AJD Julian number



15
16
17
# File 'lib/eot/times.rb', line 15

def eot_jd
  time_eot() / DAY_MINUTES 
end

#eq_of_equinoxObject

From angles.rb:

equation of equinox used for true longitude of Aries Depricated by Celes.gst06a()



125
126
127
# File 'lib/eot/angles.rb', line 125

def eq_of_equinox()   
  cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) ) * Celes.nut06a(@ajd, 0)[ 0 ]
end

#eqc(vma, vt) ⇒ Object



20
21
22
23
# File 'ext/eot/eot.c', line 20

VALUE func_eqc(VALUE klass, VALUE vma, VALUE vt) {
 rb_ivar_set(klass, id_status, INT2FIX(0));
 return DBL2NUM(eqc(NUM2DBL(vma), NUM2DBL(vt)));  
}

#gml_SunObject Also known as: geometric_mean_longitude

From angles.rb:

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



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

def gml_Sun()    
  #total = [ 1.0/-19880000.0, 1.0/-152990.0, 1.0/499310.0,
  #		 0.0003032028, 36000.76982779, 280.4664567 ] 
  # mod_360(total.inject(0.0) {|p, a| p * @ta + a}) * D2R
  ml(@ta)
end

#ha_SunObject Also known as: horizon_angle

From angles.rb:

horizon angle for provided geo coordinates used for angles from transit to horizons



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

def ha_Sun()
  zenith   = 90.8333 # use other zeniths here for non commercial    
  top      = cosZ( zenith ) - sin( dec_Sun() ) * sin( @latitude * D2R )
  bottom   = cos( dec_Sun() ) * cos( @latitude * D2R )
  t_cosine = top / bottom 
  t_cosine > 1.0 || t_cosine < -1.0 ? cos = 1.0 : cos = t_cosine
  acos( cos )  
end

#local_noon_dtObject

From times.rb:

Uses @ajd and @longitude attributes Returns DateTime object of local noon or solar transit



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

def local_noon_dt()
  ajd_to_datetime(@ajd - @longitude / 360.0 - eot_jd())
end

#ma_SunObject Also known as: mean_anomaly

From angles.rb:

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



160
161
162
163
164
# File 'lib/eot/angles.rb', line 160

def ma_Sun()
  @ta = ( @ajd - DJ00 ) / DJC     
#    @ma = delta_equinox()[2]
  @ma = Celes.falp03(@ta)       
end

#mean_local_noon_dtObject

From times.rb:

Uses @ajd and @longitude attributes Returns DateTime object of local mean noon or solar transit



29
30
31
# File 'lib/eot/times.rb', line 29

def mean_local_noon_dt()
  ajd_to_datetime(@ajd - @longitude / 360.0)
end

#ml(vt) ⇒ Object



10
11
12
13
# File 'ext/eot/eot.c', line 10

VALUE func_ml(VALUE klass, VALUE vt) {
  rb_ivar_set(klass, id_status, INT2FIX(0));
  return DBL2NUM(mlSun(NUM2DBL(vt)));
}

#ml_AriesObject Also known as: mean_longitude_aries

From angles.rb:

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



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/eot/angles.rb', line 170

def ml_Aries()   
  # jd     = @ta * DJC # convert first term back to jdn - J2000
  # old terms  	
  # angle  = (36000.770053608 / DJC + 360) * jd  # 36000.770053608 = 0.9856473662862 * DJC
  # total = [ -1.0/3.8710000e7, 3.87930e-4, 0, 100.460618375 ].inject(0.0) {|p, a| p * ta[0] + a} + 180 + angle  
  # newer terms seem to be in arcseconds / 15.0
  # 0.0000013, - 0.0000062, 0.0931118, 307.4771600, 8639877.3173760, 24110.5493771
  # angle  = (35999.4888224 / DJC + 360) * jd     
  # total  = angle +   280.460622404583   +
  #  @ta[ 0 ] *  1.281154833333   +
  #  @ta[ 1 ] *  3.87965833333e-4 +
  # @ta[ 2 ] * -2.58333333333e-8 +
  # @ta[ 3 ] *  5.41666666666e-9
  # total = [5.41666666666e-9, -2.58333333333e-8, 3.87965833333e-4, 1.281154833333, 280.460622404583].inject(0.0) {|p, a| p * @ta + a}          
  # mod_360( angle + total )  * D2R
  dt = 67.184   
  tt = @ajd + dt / 86400.0#Celes.ut1tt(@ajd, 0, dt)
  Celes.gmst06(@ajd, 0, tt, 0)    
end

#mo_EarthObject Also known as: mean_obliquity_of_ecliptic, mean_obliquity

From angles.rb:

mean obliquity of Earth



193
194
195
196
197
# File 'lib/eot/angles.rb', line 193

def mo_Earth()     
#    [ -0.0000000434, -0.000000576,  0.00200340, 
#      -0.0001831,   -46.836769, 84381.406 ].inject(0.0) {|p, a| p * @ta + a} * DAS2R
  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



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

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

#nowObject

From times.rb:

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



36
37
38
39
40
# File 'lib/eot/times.rb', line 36

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

#omegaObject

From angles.rb:

omega is a component of nutation and used in apparent longitude omega is the longitude of the mean ascending node of the lunar orbit on the ecliptic plane measured from the mean equinox of date.



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

def omega()    
  # delta_equinox()[ 3 ]
  Celes.faom03(@ta)      
end

#ra_SunObject Also known as: right_ascension

From angles.rb:

solar right ascension



213
214
215
216
217
# File 'lib/eot/angles.rb', line 213

def ra_Sun()    
  y0 = sin( al(@ma, @ta, Celes.faom03(@ta)) ) * cos( Celes.nut06a(@ajd, 0)[ 1 ] + 
       Celes.obl06(@ajd, 0) )
  Celes.anp( PI + atan2( -y0, -cos( al(@ma, @ta, Celes.faom03(@ta)) ) ) )  
end

#show_minutes(min = 0.0) ⇒ Object

From displays.rb

String formatter for + and - time



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/eot/displays.rb', line 46

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

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

From displays.rb

String for time now



60
61
62
# File 'lib/eot/displays.rb', line 60

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

#sine_al_SunObject Also known as: sine_apparent_longitude

From angles.rb:

sine apparent longitude used in solar declination



223
224
225
# File 'lib/eot/angles.rb', line 223

def sine_al_Sun()
  sin( al(@ma, @ta, Celes.faom03(@ta)) ) 
end

#sine_tl_SunObject Also known as: sine_true_longitude

From angles.rb:

sine true longitude used in solar right ascension



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

def sine_tl_Sun()    
  sin( tl(@ma, @ta) ) 
end

#sine_to_EarthObject

sine true obliquity angle of Earth used in solar declination



239
240
241
# File 'lib/eot/angles.rb', line 239

def sine_to_Earth()
  sin(Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0))
end

#string_al_SunObject Also known as: apparent_longitude_string

From displays.rb

String format of apparent longitude



66
67
68
# File 'lib/eot/displays.rb', line 66

def string_al_Sun()
  degrees_to_s( al_Sun() )
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



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/eot/displays.rb', line 73

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 )
  hours = Integer( fraction * DAY_HOURS )
  minutes = Integer(( fraction - hours / DAY_HOURS ) * DAY_MINUTES )
  seconds = Integer(( fraction - hours / 24.0 - minutes / DAY_MINUTES ) * DAY_SECONDS )
  "%02d" % hours   +
  ":"              +
  "%02d" % minutes +
  ":"              +
  "%02d" % seconds
end

#string_dec_SunObject Also known as: declination_string

From displays.rb

String format of declination



89
90
91
# File 'lib/eot/displays.rb', line 89

def string_dec_Sun()
  degrees_to_s( dec_Sun() )
end

#string_delta_obliqueObject

From displays.rb

String format for delta oblique



96
97
98
# File 'lib/eot/displays.rb', line 96

def string_delta_oblique()
  show_minutes(delta_oblique())
end

#string_delta_orbitObject

From displays.rb

String format for delta orbit



102
103
104
# File 'lib/eot/displays.rb', line 102

def string_delta_orbit()
  show_minutes(delta_orbit())
end

#string_eotObject Also known as: display_equation_of_time

From displays.rb

Equation of time output for minutes and seconds



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/eot/displays.rb', line 114

def string_eot()    
  eot = time_eot()  
  min_eot = eot
  if min_eot < 0.0
    sign = "-"
  else
    sign = "+"
  end
  eot = min_eot.abs
  minutes = Integer( eot )
  seconds = ( eot - minutes ) * 60.0
  decimal_seconds = ( seconds - Integer( seconds )) * 100.0
  min = "%02d" % minutes
  sec = "%02d" %  seconds
  dec_sec = "%01d" % decimal_seconds
  sign << min << "m, " << sec << "." << dec_sec << "s"
end

#string_eqcObject

From displays.rb

String format for centre



108
109
110
# File 'lib/eot/displays.rb', line 108

def string_eqc()
  degrees_to_s( center())
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



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

def string_jd_to_date( jd = DJ00 )
  jd = check_jd_zero( jd )
  Date.jd( jd ).to_s
end

#string_ma_SunObject Also known as: mean_anomaly_string

From displays.rb

String format of mean anomaly



143
144
145
# File 'lib/eot/displays.rb', line 143

def string_ma_Sun()
  degrees_to_s( @ma )
end

#string_ra_SunObject Also known as: right_ascension_string

From displays.rb

String format of right ascension



150
151
152
# File 'lib/eot/displays.rb', line 150

def string_ra_Sun()
  degrees_to_s( ra_Sun() )
end

#string_ta_SunObject Also known as: true_anomaly_string

From displays.rb

String format of true anomaly



157
158
159
# File 'lib/eot/displays.rb', line 157

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



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/eot/displays.rb', line 164

def string_time( dt = DT2000 )
  dt = check_t_zero( dt )
  
  if dt.class == DateTime      
    hours   = dt.hour
    minutes = dt.min
    seconds = dt.sec
    intsecs = Integer( seconds )
    decsecs = Integer(( seconds - intsecs ).round( 3 ) * 1000.0 )
  else
    decimal    = dt % DAY_HOURS
    hours      = Integer( decimal )
    mindecimal = 60.0 * ( decimal - hours )
    minutes    = Integer( mindecimal )
    seconds    = 60.0 * ( mindecimal - minutes )    
    intsecs    = Integer( seconds )
    decsecs    = Integer(( seconds - intsecs ).round( 3 ) * 1000.0 )
  end
  
  "%02d" % hours   +
               ":" + 
  "%02d" % minutes + 
               ":" + 
  "%02d" % intsecs +
               "." +
  "%3.3d" % decsecs
end

#string_tl_SunObject Also known as: true_longitude_string

From displays.rb

String format of true longitude



195
196
197
# File 'lib/eot/displays.rb', line 195

def string_tl_Sun()
  degrees_to_s( tl_Sun() )
end

#string_to_EarthObject Also known as: true_obliquity_string

From displays.rb

String format of true obliquity



202
203
204
# File 'lib/eot/displays.rb', line 202

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



45
46
47
# File 'lib/eot/times.rb', line 45

def sunrise_dt()                    
  ajd_to_datetime(sunrise_jd())     
end

#sunrise_jdObject

From times.rb:

Uses @ajd attribute Returns Sunrise as a Julian Day Number



52
53
54
# File 'lib/eot/times.rb', line 52

def sunrise_jd()    
  local_noon_dt().ajd - ha_Sun() * R2D / 360.0
end

#sunset_dtObject

From times.rb:

Uses @ajd attribute Returns a DateTime object of local sunset



59
60
61
# File 'lib/eot/times.rb', line 59

def sunset_dt()                                                   
  ajd_to_datetime(sunset_jd())      
end

#sunset_jdObject

From times.rb:

Uses @ajd attribute Returns Sunset as a Julian Day Number



66
67
68
# File 'lib/eot/times.rb', line 66

def sunset_jd()
  local_noon_dt().ajd + ha_Sun() * R2D / 360.0 
end

#ta_SunObject Also known as: true_anomaly

From angles.rb:

angle true anomaly used in equation of time



246
247
248
# File 'lib/eot/angles.rb', line 246

def ta_Sun()     
  Celes.anp(@ma + eqc( @ma, @ta ))	
end

#time_delta_obliqueObject

From times.rb:

Uses @ajd attribute Returns Oblique component of EOT in decimal minutes time



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

def time_delta_oblique()         
  (tl_Sun() - ra_Sun()) * R2D * SM        
end

#time_delta_orbitObject

From times.rb:

Uses @ajd attribute Returns Orbit component of EOT in decimal minutes time



80
81
82
# File 'lib/eot/times.rb', line 80

def time_delta_orbit()      
  (@ma - ta_Sun()) * R2D * SM
end

#time_eotObject

From times.rb:

Uses @ajd attribute Returns EOT as a float for decimal minutes time



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

def time_eot()
  eot() * R2D * SM	  
end

#time_julian_centuryObject Also known as: time_julian_centurey

From times.rb:

All calculations with ( ta ) were based on this. Julian Century Time is a fractional century Julian Day Number DJ00 is subtracted from the JDN or AJDN and then divided by days in a Julian Century. Deprecated



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/eot/times.rb', line 97

def time_julian_century()
  t1 = ( @ajd - DJ00 ) / DJC
  # t2 = t1 * t1
  # t3 = t1 * t2
  # t4 = t2 * t2
  # t5 = t2 * t3
  # t6 = t3 * t3
  # t7 = t3 * t4
  # t8 = t4 * t4
  # t9 = t4 * t5
  # t10 = t5 * t5
#    @ta = [ t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ] 
  @ta = t1     
end

#tl(vma, vt) ⇒ Object



25
26
27
28
# File 'ext/eot/eot.c', line 25

VALUE func_tl(VALUE klass, VALUE vma, VALUE vt) {
  rb_ivar_set(klass, id_status, INT2FIX(0));
  return DBL2NUM(tlSun(NUM2DBL(vma), NUM2DBL(vt)));
}

#tl_AriesObject Also known as: true_longitude_aries

From angles.rb:

true longitude of equinox ‘first point of aries’ considers nutation



254
255
256
257
258
259
# File 'lib/eot/angles.rb', line 254

def tl_Aries()     
  # Celes.anp(eq_of_equinox() + ml_Aries())
  dt = 67.184   
  tt = @ajd + dt / 86400.0#Celes.ut1tt(@ajd, 0, dt)    
  Celes.gst06a(@ajd, 0, tt, 0)    
end

#tl_SunObject Also known as: true_longitude, ecliptic_longitude, lambda

From angles.rb:

angle of true longitude sun used in equation of time



265
266
267
268
# File 'lib/eot/angles.rb', line 265

def tl_Sun()   
  #Celes.anp(gml_Sun() + center())
  tl(@ma, @ta) 	 
end

#to_EarthObject Also known as: obliquity_correction, true_obliquity, toearth

From angles.rb:

true obliquity considers nutation



275
276
277
# File 'lib/eot/angles.rb', line 275

def to_Earth()   
  Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0)     
end