Class: Eot
- Inherits:
-
Object
- Object
- Eot
- Defined in:
- 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/time_displays.rb,
lib/eot/trigonometric.rb,
lib/eot/angle_displays.rb,
ext/eot/eot.c
Overview
class Eot file = angle_displays.rb: methods for display of angles.
Constant Summary collapse
- VERSION =
current version
'4.1.8'
- 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
86_400.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
2_451_545.0
- DJC =
Days per Julian century = 36525.0
36_525.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
- P2 =
2Pi from Math module = Math::PI * 2.0
PI * 2.0
- 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 probably 3.989 would be close enough because it’s not that constant anyway
4.0 / 1.0027379093507953456536618754278
Instance Attribute Summary collapse
-
#addr ⇒ Object
From init.rb: address is a String ex: “houston, tx”.
-
#ajd ⇒ Object
From init.rb: Astronomical Julian Day Number instance of Float class.
-
#date ⇒ Object
From init.rb: Date instance of DateTime class initialized to = ajd_to_datetime(@ajd).
-
#jd ⇒ Object
From init.rb: Julian Day Number instance of Float class initialized to = ajd.
-
#latitude ⇒ Object
From init.rb: Latitude input instance of Float class initialized to = 0.0.
-
#longitude ⇒ Object
From init.rb: Longitude input instance of Float class initialized to = 0.0.
-
#ma ⇒ Object
From init.rb: Mean Anomaly gets called often instance of Float class ma = Celes.falp03(@ta) see: celes gem.
-
#ta ⇒ Object
From init.rb: Julian Century gets called often instance of Float class ta = (( @ajd - DJ00 ) / DJC).to_f.
Instance Method Summary collapse
-
#ajd_to_datetime(ajd) ⇒ Object
Pass in an AJD number Returns a DateTime object only DateTime#jd() to work with so add a half day to make it work.
-
#al(vma, vt, vo) ⇒ Object
Apparent longitude of the Sun C extension.
-
#al_sun ⇒ Object
(also: #apparent_longitude, #alsun)
Apparent solar longitude = true longitude - aberation.
-
#angle_delta_epsilon ⇒ Object
(also: #delta_epsilon)
From deltas.rb: delta epsilon component of equation of equinox.
-
#angle_delta_oblique ⇒ Object
(also: #delta_t_ecliptic, #delta_oblique)
From deltas.rb: one time component to total equation of time.
-
#angle_delta_orbit ⇒ Object
(also: #delta_t_elliptic, #delta_orbit)
From angles.rb: one time component to total equation of time.
-
#angle_delta_psi ⇒ Object
(also: #delta_psi)
From angles.rb: component of equation of equinox.
-
#angle_equation_of_time ⇒ Object
(also: #eot)
From angles.rb: total equation of time.
-
#astronomical_twilight_end_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns astronomical twilight end as a DateTime.
-
#astronomical_twilight_end_jd ⇒ Object
From jd_times.rb: Uses @ajd attribute Returns astronomical twilight end as a Julian Day Number.
-
#astronomical_twilight_start_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns astronomical twilight start as a DateTime.
-
#astronomical_twilight_start_jd ⇒ Object
From jd_times.rb: Uses @ajd attribute Returns astronomical twilight start as a Julian Day Number.
-
#center ⇒ Object
(also: #equation_of_center)
equation of centre is added to mean anomaly to get true anomaly.
-
#check_jd_nil(jd = DJ00) ⇒ Object
From utilities.rb: A check for default J2000 sets default when arg is nil.
-
#check_jd_zero(jd = DJ00) ⇒ Object
From utilities.rb: A check for default J2000 sets default when arg is zero.
-
#check_t_nil(dt = DT2000) ⇒ Object
From utilities.rb: A check for default DT2000 sets default when arg is nil.
-
#check_t_zero(dt = DT2000) ⇒ Object
From utilities.rb: A check for default DT2000 sets default when arg is zero.
-
#choice(c) ⇒ Object
used by ha_sun method to select rise set and civil, nautical, astronomical twilights.
-
#civil_twilight_end_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns civil twilight end as a DateTime.
-
#civil_twilight_end_jd ⇒ Object
From jd_times.rb: Uses @ajd attribute Returns civil twilight end as a Julian Day Number.
-
#civil_twilight_start_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns civil twilight start as a DateTime.
-
#civil_twilight_start_jd ⇒ Object
From jd_times.rb: Uses @ajd attribute Returns civil twilight start as a Julian Day Number.
-
#cos_al_sun(vals) ⇒ Object
Cosine of Apparent Longitude Sun C extension.
-
#cos_dec_sun(vds) ⇒ Object
Cosine of Solar Declination C extension.
-
#cos_lat(vlat) ⇒ Object
C extension.
-
#cos_tl_sun(vtls) ⇒ Object
C extension.
-
#cos_to_earth(vtoe) ⇒ Object
C extension.
-
#cosine_al_sun ⇒ Object
(also: #cosine_apparent_longitude, #cosalsun)
From trigometric.rb: cosine apparent longitude could be useful when dividing.
-
#cosine_tl_sun ⇒ Object
(also: #cosine_true_longitude)
From trigometric.rb: cosine true longitude used in solar right ascension.
-
#cosine_to_earth ⇒ Object
(also: #cosine_true_obliquity)
From trigometric.rb: cosine true obliquity used in solar right ascension and equation of equinox.
-
#cosZ(vz) ⇒ Object
Cosine of the Zenith type C extension.
-
#dec_sun ⇒ Object
(also: #declination)
solar declination.
-
#degrees_to_s(radians = 0.0) ⇒ Object
String formatter for d:m:s display.
-
#dt_parts(val) ⇒ Object
From displays.rb creates [h,m,s,ds] array from Time or DateTime.
-
#eccentricity_earth ⇒ Object
(also: #eccentricity_earth_orbit)
eccentricity of elliptical Earth orbit around Sun Horners’ calculation method.
-
#eoe(vt) ⇒ Object
C extension.
-
#eot_jd ⇒ Object
From jd_times.rb: Uses @ajd attribute Returns EOT as an AJD Julian number.
-
#eq_of_equinox ⇒ Object
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.
-
#eqc(vma, vt) ⇒ Object
C extension.
-
#era ⇒ Object
Earth rotation angle (for comparison to tl_aries which uses gmst06).
-
#f_string(sgn, u, m, s, ds) ⇒ Object
From utilities.rb: formats degree string.
-
#float_parts(val) ⇒ Object
From displays.rb creates [h,m,s,ds] from hours Float.
-
#format_time(h, m, s, ds) ⇒ Object
From displays.rb formats time components.
-
#gml_sun ⇒ Object
(also: #geometric_mean_longitude, #ml_sun)
angle geometric mean longitude needed to get true longitude for low accuracy.
-
#ha_sun(c) ⇒ Object
(also: #horizon_angle)
horizon angle for provided geo coordinates used for angles from transit to horizons.
-
#initialize ⇒ Eot
constructor
From init.rb: Initialize to set attributes.
-
#local_noon_dt ⇒ Object
From times.rb: Uses @ajd and @longitude attributes Returns DateTime object of local noon or solar transit.
-
#ma_sun ⇒ Object
(also: #mean_anomaly)
angle of Suns’ mean anomaly calculated in nutation.rb via celes function sets ta attribute for the rest the methods needing it.
-
#ma_ta_set ⇒ Object
From init.rb method to reset ma and ta after initialization init sets them using ajd initial Float value see: :ajd attribute.
-
#mean_local_noon_jd ⇒ Object
From jd_times.rb: Uses @ajd and @longitude attributes Returns DateTime object of local mean noon or solar transit.
-
#ml(vt) ⇒ Object
C extension.
-
#ml_aries ⇒ Object
(also: #mean_longitude_aries)
Mean equinox point where right ascension is measured from as zero hours.
-
#mo_earth ⇒ Object
(also: #mean_obliquity_of_ecliptic, #mean_obliquity)
mean obliquity of Earth.
-
#mod_360(x = 0.0) ⇒ Object
(also: #truncate)
From utilities.rb: Keeps large angles in range of 360.0 aliased by truncate.
-
#nautical_twilight_end_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns nautical twilight end as a DateTime.
-
#nautical_twilight_end_jd ⇒ Object
From jd_times.rb: Uses @ajd attribute Returns nautical twilight end as a Julian Day Number.
-
#nautical_twilight_start_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns nautical twilight start as a DateTime.
-
#nautical_twilight_start_jd ⇒ Object
From jd_times.rb: Uses @ajd attribute Returns nautical twilight start as a Julian Day Number.
-
#now ⇒ Object
From times.rb: sets @ajd to DateTime.now Returns EOT (equation of time) now in decimal minutes form.
-
#omega ⇒ Object
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.
-
#ra_sun ⇒ Object
(also: #right_ascension)
solar right ascension.
-
#show_minutes(min = 0.0) ⇒ Object
From displays.rb String formatter for + and - time.
-
#show_now(now = now(Time.now.utc)) ⇒ Object
From displays.rb String for time now.
-
#sign_min(min) ⇒ Object
From displays.rb displays + or - sign.
-
#sin_al_sun(vals) ⇒ Object
C extension.
-
#sin_dec_sun(vds) ⇒ Object
C extension.
-
#sin_lat(vlat) ⇒ Object
C extension.
-
#sin_tl_sun(vtls) ⇒ Object
C extension.
-
#sin_to_earth(vtoe) ⇒ Object
C extension.
-
#sine_al_sun ⇒ Object
(also: #sine_apparent_longitude)
From trigometric.rb: sine apparent longitude used in solar declination.
-
#sine_tl_sun ⇒ Object
(also: #sine_true_longitude)
From trigometric.rb: sine true longitude used in solar right ascension.
-
#sine_to_earth ⇒ Object
From trigometric.rb: sine true obliquity angle of Earth used in solar declination.
-
#string_al_sun ⇒ Object
(also: #apparent_longitude_string)
String format of apparent longitude.
-
#string_day_fraction_to_time(jpd_time = 0.0) ⇒ Object
(also: #julian_period_day_fraction_to_time)
From displays.rb String formatter for fraction of Julian day number.
-
#string_dec_sun ⇒ Object
(also: #declination_string)
String format of declination.
-
#string_deg_to_time(radians = 0.0) ⇒ Object
From displays.rb radians to time method.
-
#string_delta_oblique ⇒ Object
String format for delta oblique.
-
#string_delta_orbit ⇒ Object
String format for delta orbit.
-
#string_eot ⇒ Object
(also: #display_equation_of_time)
From displays.rb Equation of time output for minutes and seconds.
-
#string_eqc ⇒ Object
String format for centre.
-
#string_jd_to_date(jd = DJ00) ⇒ Object
(also: #jd_to_date_string)
From displays.rb String format conversion of jd to date.
-
#string_ma_sun ⇒ Object
(also: #mean_anomaly_string)
String format of mean anomaly.
-
#string_ra_sun ⇒ Object
(also: #right_ascension_string)
String format of right ascension.
-
#string_ta_sun ⇒ Object
(also: #true_anomaly_string)
String format of true anomaly.
-
#string_time(dt = DT2000) ⇒ Object
(also: #display_time_string)
From displays.rb String formatter for h:m:s display.
-
#string_tl_sun ⇒ Object
(also: #true_longitude_string)
String format of true longitude.
-
#string_to_earth ⇒ Object
(also: #true_obliquity_string)
String format of true obliquity.
-
#sun(vz, vds, vlat) ⇒ Object
C extension.
-
#sun_dec(vals, vtoe) ⇒ Object
C extension.
-
#sun_ra(vy0, vcas) ⇒ Object
C extension.
-
#sunrise_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns a DateTime object of local sunrise.
-
#sunrise_jd ⇒ Object
From jd_times.rb: Uses @ajd attribute Returns Sunrise as a Julian Day Number.
-
#sunset_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns a DateTime object of local sunset.
-
#sunset_jd ⇒ Object
From jd_times.rb: Uses @ajd attribute Returns Sunset as a Julian Day Number.
-
#ta_sun ⇒ Object
(also: #true_anomaly)
angle true anomaly used in equation of time.
-
#time_delta_oblique ⇒ Object
From delta_times.rb: Uses @ajd attribute Returns Oblique component of EOT in decimal minutes time.
-
#time_delta_orbit ⇒ Object
From delta_times.rb: Uses @ajd attribute Returns Orbit component of EOT in decimal minutes time.
-
#time_eot ⇒ Object
From delta_times.rb: Uses @ajd attribute Returns EOT as a float for decimal minutes time.
-
#tl(vma, vt) ⇒ Object
C extension.
-
#tl_aries ⇒ Object
(also: #true_longitude_aries)
true longitude of equinox ‘first point of aries’ considers nutation.
-
#tl_sun ⇒ Object
(also: #true_longitude, #ecliptic_longitude, #lambda)
angle of true longitude sun used in equation of time.
-
#to_earth ⇒ Object
(also: #obliquity_correction, #true_obliquity, #toearth)
true obliquity considers nutation.
Constructor Details
#initialize ⇒ Eot
From init.rb: Initialize to set attributes
62 63 64 65 66 67 68 69 |
# File 'lib/eot/init.rb', line 62 def initialize d = DateTime.now.to_time.utc.to_datetime djm0, djm = Celes::cal2jd(d.year, d.month, d.day + d.day_fraction) @ajd = djm0 + djm + 0.5 ma_ta_set @date, @jd = ajd_to_datetime(@ajd), @ajd @latitude, @longitude = 0.0, 0.0 end |
Instance Attribute Details
#addr ⇒ Object
From init.rb: address is a String ex: “houston, tx”
6 7 8 |
# File 'lib/eot/init.rb', line 6 def addr @addr end |
#ajd ⇒ Object
From init.rb: Astronomical Julian Day Number instance of Float class. ajd or jd. Use ajd for time now and jd for noon init sets ajd = DateTime.now.to_time.utc.to_datetime.jd.to_f
13 14 15 |
# File 'lib/eot/init.rb', line 13 def ajd @ajd end |
#date ⇒ Object
From init.rb: Date instance of DateTime class initialized to = ajd_to_datetime(@ajd)
28 29 30 |
# File 'lib/eot/init.rb', line 28 def date @date end |
#jd ⇒ Object
From init.rb: Julian Day Number instance of Float class initialized to = ajd
34 35 36 |
# File 'lib/eot/init.rb', line 34 def jd @jd end |
#latitude ⇒ Object
From init.rb: Latitude input instance of Float class initialized to = 0.0
40 41 42 |
# File 'lib/eot/init.rb', line 40 def latitude @latitude end |
#longitude ⇒ Object
From init.rb: Longitude input instance of Float class initialized to = 0.0
46 47 48 |
# File 'lib/eot/init.rb', line 46 def longitude @longitude end |
#ma ⇒ Object
From init.rb: Mean Anomaly gets called often instance of Float class ma = Celes.falp03(@ta) see: celes gem
58 59 60 |
# File 'lib/eot/init.rb', line 58 def ma @ma end |
#ta ⇒ Object
From init.rb: Julian Century gets called often instance of Float class ta = (( @ajd - DJ00 ) / DJC).to_f
52 53 54 |
# File 'lib/eot/init.rb', line 52 def ta @ta end |
Instance Method Details
#ajd_to_datetime(ajd) ⇒ Object
Pass in an AJD number Returns a DateTime object only DateTime#jd() to work with so add a half day to make it work.
15 16 17 |
# File 'lib/eot/times.rb', line 15 def ajd_to_datetime(ajd) DateTime.jd(ajd + 0.5) end |
#al(vma, vt, vo) ⇒ Object
Apparent longitude of the Sun C extension. p1 = mean anomaly p2 = time in julian centuries p3 = angle of Omega
16 17 18 19 |
# File 'ext/eot/eot.c', line 16
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_sun ⇒ Object Also known as: apparent_longitude, alsun
Apparent solar longitude = true longitude - aberation
12 13 14 |
# File 'lib/eot/angles.rb', line 12 def al_sun Celes.anp(al(@ma, @ta, omega)) end |
#angle_delta_epsilon ⇒ Object 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_oblique ⇒ Object 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 - ra_sun end |
#angle_delta_orbit ⇒ Object Also known as: delta_t_elliptic, delta_orbit
From angles.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(@ma, @ta) end |
#angle_delta_psi ⇒ Object Also known as: delta_psi
From angles.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_time ⇒ Object Also known as: eot
From angles.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_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns astronomical twilight end as a DateTime
22 23 24 |
# File 'lib/eot/times.rb', line 22 def astronomical_twilight_end_dt ajd_to_datetime(astronomical_twilight_end_jd) end |
#astronomical_twilight_end_jd ⇒ Object
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_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns astronomical twilight start as a DateTime
29 30 31 |
# File 'lib/eot/times.rb', line 29 def astronomical_twilight_start_dt ajd_to_datetime(astronomical_twilight_start_jd) end |
#astronomical_twilight_start_jd ⇒ Object
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 |
#center ⇒ Object Also known as: equation_of_center
equation of centre is added to mean anomaly to get true anomaly.
24 25 26 |
# File 'lib/eot/angles.rb', line 24 def center 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? ? 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 ? 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 == 0 ? DT2000 : check_t_nil(dt) end |
#choice(c) ⇒ Object
used by ha_sun method to select rise set and civil, nautical, astronomical twilights.
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/eot/angles.rb', line 92 def choice(c) case c when 1 return 90.8333 # Sunrise and Sunset when 2 return 96 # Civil Twilight when 3 return 102 # Nautical Twilight when 4 return 108 # Astronomical Twilight end end |
#civil_twilight_end_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns civil twilight end as a DateTime
36 37 38 |
# File 'lib/eot/times.rb', line 36 def civil_twilight_end_dt ajd_to_datetime(civil_twilight_end_jd) end |
#civil_twilight_end_jd ⇒ Object
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_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns civil twilight start as a DateTime
43 44 45 |
# File 'lib/eot/times.rb', line 43 def civil_twilight_start_dt ajd_to_datetime(civil_twilight_start_jd) end |
#civil_twilight_start_jd ⇒ Object
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 |
#cos_al_sun(vals) ⇒ Object
Cosine of Apparent Longitude Sun C extension. p1 = Apparent Longitude Sun see al
32 33 34 35 |
# File 'ext/eot/eot.c', line 32
VALUE func_cos_al_sun(VALUE klass, VALUE vals) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(cos_al_sun(NUM2DBL(vals)));
}
|
#cos_dec_sun(vds) ⇒ Object
Cosine of Solar Declination C extension
39 40 41 42 |
# File 'ext/eot/eot.c', line 39
VALUE func_cos_dec_sun(VALUE klass, VALUE vds) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(cos_dec_sun(NUM2DBL(vds)));
}
|
#cos_lat(vlat) ⇒ Object
C extension
123 124 125 126 |
# File 'ext/eot/eot.c', line 123
VALUE func_cos_lat(VALUE klass, VALUE vlat) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(cos_lat(NUM2DBL(vlat)));
}
|
#cos_tl_sun(vtls) ⇒ Object
C extension
74 75 76 77 |
# File 'ext/eot/eot.c', line 74
VALUE func_cos_tl_sun(VALUE klass, VALUE vtls) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(cos_al_sun(NUM2DBL(vtls)));
}
|
#cos_to_earth(vtoe) ⇒ Object
C extension
81 82 83 84 |
# File 'ext/eot/eot.c', line 81
VALUE func_cos_to_earth(VALUE klass, VALUE vtoe) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(cos_to_earth(NUM2DBL(vtoe)));
}
|
#cosine_al_sun ⇒ Object 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(al_sun) end |
#cosine_tl_sun ⇒ Object 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(tl_sun) end |
#cosine_to_earth ⇒ Object 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 |
#cosZ(vz) ⇒ Object
Cosine of the Zenith type C extension. p1 = zenith angle sent by choice method
24 25 26 27 |
# File 'ext/eot/eot.c', line 24
VALUE func_cosZ(VALUE klass, VALUE vz) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(cosZ(NUM2DBL(vz)));
}
|
#dec_sun ⇒ Object Also known as: declination
solar declination
34 35 36 |
# File 'lib/eot/angles.rb', line 34 def dec_sun sun_dec(al_sun, to_earth) end |
#degrees_to_s(radians = 0.0) ⇒ Object
String formatter for d:m:s display
10 11 12 13 14 |
# File 'lib/eot/angle_displays.rb', line 10 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
93 94 95 96 97 98 99 100 |
# File 'lib/eot/time_displays.rb', line 93 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_earth ⇒ Object Also known as: eccentricity_earth_orbit
eccentricity of elliptical Earth orbit around Sun Horners’ calculation method
45 46 47 |
# File 'lib/eot/angles.rb', line 45 def eccentricity_earth eoe(@ta) end |
#eoe(vt) ⇒ Object
C extension
53 54 55 56 |
# File 'ext/eot/eot.c', line 53
VALUE func_eoe(VALUE klass, VALUE vt) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(eoe(NUM2DBL(vt)));
}
|
#eot_jd ⇒ Object
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_equinox ⇒ Object
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
59 60 61 |
# File 'lib/eot/angles.rb', line 59 def eq_of_equinox Celes.ee06a(@ajd, 0.0) end |
#eqc(vma, vt) ⇒ Object
C extension
60 61 62 63 |
# File 'ext/eot/eot.c', line 60
VALUE func_eqc(VALUE klass, VALUE vma, VALUE vt) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(eqc(NUM2DBL(vma), NUM2DBL(vt)));
}
|
#era ⇒ Object
Earth rotation angle (for comparison to tl_aries which uses gmst06)
70 71 72 |
# File 'lib/eot/angles.rb', line 70 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
104 105 106 107 108 109 110 111 112 |
# File 'lib/eot/time_displays.rb', line 104 def float_parts(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
81 82 83 84 85 86 87 88 89 |
# File 'lib/eot/time_displays.rb', line 81 def format_time(h, m, s, ds) format('%02d', h) + ':' + format('%02d', m) + ':' + format('%02d', s) + '.' + format('%3.3d', ds) end |
#gml_sun ⇒ Object Also known as: geometric_mean_longitude, ml_sun
angle geometric mean longitude needed to get true longitude for low accuracy.
80 81 82 |
# File 'lib/eot/angles.rb', line 80 def gml_sun ml(@ta) end |
#ha_sun(c) ⇒ Object Also known as: horizon_angle
horizon angle for provided geo coordinates used for angles from transit to horizons.
111 112 113 114 |
# File 'lib/eot/angles.rb', line 111 def ha_sun(c) zenith = choice(c) sun(zenith, dec_sun, @latitude) end |
#local_noon_dt ⇒ Object
From times.rb: Uses @ajd and @longitude attributes Returns DateTime object of local noon or solar transit
50 51 52 |
# File 'lib/eot/times.rb', line 50 def local_noon_dt ajd_to_datetime(mean_local_noon_jd - eot_jd) end |
#ma_sun ⇒ Object 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
126 127 128 129 |
# File 'lib/eot/angles.rb', line 126 def ma_sun @ta = (@ajd - DJ00) / DJC @ma = Celes.falp03(@ta) end |
#ma_ta_set ⇒ Object
From init.rb method to reset ma and ta after initialization init sets them using ajd initial Float value see: :ajd attribute
19 20 21 22 |
# File 'lib/eot/init.rb', line 19 def ma_ta_set @ta = ((@ajd - DJ00) / DJC).to_f @ma = Celes.falp03(@ta) end |
#mean_local_noon_jd ⇒ Object
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(vt) ⇒ Object
C extension
46 47 48 49 |
# File 'ext/eot/eot.c', line 46
VALUE func_ml(VALUE klass, VALUE vt) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(mlSun(NUM2DBL(vt)));
}
|
#ml_aries ⇒ Object 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
138 139 140 141 142 |
# File 'lib/eot/angles.rb', line 138 def ml_aries dt = 67.184 tt = @ajd + dt / 86_400.0 Celes.gmst06(@ajd, 0, tt, 0) end |
#mo_earth ⇒ Object Also known as: mean_obliquity_of_ecliptic, mean_obliquity
mean obliquity of Earth
150 151 152 |
# File 'lib/eot/angles.rb', line 150 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_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns nautical twilight end as a DateTime
57 58 59 |
# File 'lib/eot/times.rb', line 57 def nautical_twilight_end_dt ajd_to_datetime(nautical_twilight_end_jd) end |
#nautical_twilight_end_jd ⇒ Object
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_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns nautical twilight start as a DateTime
64 65 66 |
# File 'lib/eot/times.rb', line 64 def nautical_twilight_start_dt ajd_to_datetime(nautical_twilight_start_jd) end |
#nautical_twilight_start_jd ⇒ Object
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 |
#now ⇒ Object
From times.rb: sets @ajd to DateTime.now Returns EOT (equation of time) now in decimal minutes form
71 72 73 74 75 |
# File 'lib/eot/times.rb', line 71 def now @ajd = DateTime.now.to_time.utc.to_datetime.ajd @ta = (@ajd - DJ00) / DJC time_eot end |
#omega ⇒ Object
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.
164 165 166 |
# File 'lib/eot/angles.rb', line 164 def omega Celes.faom03(@ta) end |
#ra_sun ⇒ Object Also known as: right_ascension
solar right ascension
173 174 175 176 177 178 |
# File 'lib/eot/angles.rb', line 173 def ra_sun y0 = sine_al_sun * cosine_to_earth ra = sun_ra(y0, cosine_al_sun) # Celes.anp(PI + atan2(-y0, -cosine_al_sun)) Celes.anp(PI + ra) 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) if min < 0.0 sign = '-' else sign = '+' end sign end |
#sin_al_sun(vals) ⇒ Object
C extension
88 89 90 91 |
# File 'ext/eot/eot.c', line 88
VALUE func_sin_al_sun(VALUE klass, VALUE vals) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(sin_al_sun(NUM2DBL(vals)));
}
|
#sin_dec_sun(vds) ⇒ Object
C extension
109 110 111 112 |
# File 'ext/eot/eot.c', line 109
VALUE func_sin_dec_sun(VALUE klass, VALUE vds) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(sin_dec_sun(NUM2DBL(vds)));
}
|
#sin_lat(vlat) ⇒ Object
C extension
116 117 118 119 |
# File 'ext/eot/eot.c', line 116
VALUE func_sin_lat(VALUE klass, VALUE vlat) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(sin_lat(NUM2DBL(vlat)));
}
|
#sin_tl_sun(vtls) ⇒ Object
C extension
95 96 97 98 |
# File 'ext/eot/eot.c', line 95
VALUE func_sin_tl_sun(VALUE klass, VALUE vtls) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(sin_al_sun(NUM2DBL(vtls)));
}
|
#sin_to_earth(vtoe) ⇒ Object
C extension
102 103 104 105 |
# File 'ext/eot/eot.c', line 102
VALUE func_sin_to_earth(VALUE klass, VALUE vtoe) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(sin_to_earth(NUM2DBL(vtoe)));
}
|
#sine_al_sun ⇒ Object 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(al_sun) end |
#sine_tl_sun ⇒ Object 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_earth ⇒ Object
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_sun ⇒ Object Also known as: apparent_longitude_string
String format of apparent longitude
19 20 21 |
# File 'lib/eot/angle_displays.rb', line 19 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
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_sun ⇒ Object Also known as: declination_string
String format of declination
27 28 29 |
# File 'lib/eot/angle_displays.rb', line 27 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_oblique ⇒ Object
String format for delta oblique
35 36 37 |
# File 'lib/eot/angle_displays.rb', line 35 def string_delta_oblique show_minutes(delta_oblique) end |
#string_delta_orbit ⇒ Object
String format for delta orbit
42 43 44 |
# File 'lib/eot/angle_displays.rb', line 42 def string_delta_orbit show_minutes(delta_orbit) end |
#string_eot ⇒ Object 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 66 67 68 |
# File 'lib/eot/time_displays.rb', line 57 def string_eot min_eot = time_eot sign = sign_min(min_eot) eot = min_eot.abs minutes = Integer(eot) seconds = (eot - minutes) * 60.0 decimal_seconds = (seconds - Integer(seconds)) * 100.0 min = format('%02d', minutes) sec = format('%02d', seconds) dec_sec = format('%01d', decimal_seconds) sign << min << 'm, ' << sec << '.' << dec_sec << 's' end |
#string_eqc ⇒ Object
String format for centre
49 50 51 |
# File 'lib/eot/angle_displays.rb', line 49 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
73 74 75 76 |
# File 'lib/eot/time_displays.rb', line 73 def string_jd_to_date(jd = DJ00) jd = check_jd_zero(jd) Date.jd(jd).to_s end |
#string_ma_sun ⇒ Object Also known as: mean_anomaly_string
String format of mean anomaly
56 57 58 |
# File 'lib/eot/angle_displays.rb', line 56 def string_ma_sun degrees_to_s(@ma) end |
#string_ra_sun ⇒ Object Also known as: right_ascension_string
String format of right ascension
64 65 66 |
# File 'lib/eot/angle_displays.rb', line 64 def string_ra_sun degrees_to_s(ra_sun) end |
#string_ta_sun ⇒ Object Also known as: true_anomaly_string
String format of true anomaly
72 73 74 |
# File 'lib/eot/angle_displays.rb', line 72 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
116 117 118 119 120 |
# File 'lib/eot/time_displays.rb', line 116 def string_time(dt = DT2000) dt = check_t_zero(dt) dt.class == DateTime ? ta = dt_parts(dt) : ta = float_parts(dt) format_time(ta[0], ta[1], ta[2], ta[3]) end |
#string_tl_sun ⇒ Object Also known as: true_longitude_string
String format of true longitude
80 81 82 |
# File 'lib/eot/angle_displays.rb', line 80 def string_tl_sun degrees_to_s(tl_sun) end |
#string_to_earth ⇒ Object Also known as: true_obliquity_string
String format of true obliquity
88 89 90 |
# File 'lib/eot/angle_displays.rb', line 88 def string_to_earth degrees_to_s(to_earth) end |
#sun(vz, vds, vlat) ⇒ Object
C extension
130 131 132 133 |
# File 'ext/eot/eot.c', line 130
VALUE func_sun(VALUE klass, VALUE vz, VALUE vds, VALUE vlat) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(sun(NUM2DBL(vz), NUM2DBL(vds), NUM2DBL(vlat)));
}
|
#sun_dec(vals, vtoe) ⇒ Object
C extension
137 138 139 140 |
# File 'ext/eot/eot.c', line 137
VALUE func_sun_dec(VALUE klass, VALUE vals, VALUE vtoe) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(sun_dec(NUM2DBL(vals), NUM2DBL(vtoe)));
}
|
#sun_ra(vy0, vcas) ⇒ Object
C extension
144 145 146 147 |
# File 'ext/eot/eot.c', line 144
VALUE func_sun_ra(VALUE klass, VALUE vy0, VALUE vcas) {
rb_ivar_set(klass, id_status, INT2FIX(0));
return DBL2NUM(raSun(NUM2DBL(vy0), NUM2DBL(vcas)));
}
|
#sunrise_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns a DateTime object of local sunrise
80 81 82 |
# File 'lib/eot/times.rb', line 80 def sunrise_dt ajd_to_datetime(sunrise_jd) end |
#sunrise_jd ⇒ Object
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_dt ⇒ Object
From times.rb: Uses @ajd attribute Returns a DateTime object of local sunset
87 88 89 |
# File 'lib/eot/times.rb', line 87 def sunset_dt ajd_to_datetime(sunset_jd) end |
#sunset_jd ⇒ Object
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_sun ⇒ Object Also known as: true_anomaly
angle true anomaly used in equation of time
187 188 189 |
# File 'lib/eot/angles.rb', line 187 def ta_sun Celes.anp(@ma + eqc(@ma, @ta)) end |
#time_delta_oblique ⇒ Object
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_orbit ⇒ Object
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_eot ⇒ Object
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(vma, vt) ⇒ Object
C extension
67 68 69 70 |
# File 'ext/eot/eot.c', line 67
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_aries ⇒ Object Also known as: true_longitude_aries
true longitude of equinox ‘first point of aries’ considers nutation
198 199 200 201 202 |
# File 'lib/eot/angles.rb', line 198 def tl_aries dt = 67.184 tt = @ajd + dt / 86_400.0 Celes.gst06a(@ajd, 0, tt, 0) end |
#tl_sun ⇒ Object Also known as: true_longitude, ecliptic_longitude, lambda
angle of true longitude sun used in equation of time
211 212 213 |
# File 'lib/eot/angles.rb', line 211 def tl_sun tl(@ma, @ta) end |
#to_earth ⇒ Object Also known as: obliquity_correction, true_obliquity, toearth
true obliquity considers nutation
223 224 225 |
# File 'lib/eot/angles.rb', line 223 def to_earth mo_earth + angle_delta_epsilon end |