class MkGreenwich::Greenwich

Attributes

tdb[R]
tt[R]
ut1[R]
utc[R]

Public Class Methods

new(utc) click to toggle source
# File lib/mk_greenwich/greenwich.rb, line 5
def initialize(utc)
  @utc = utc                                              # 協定世界時
  t_utc = MkTime.new(@utc.strftime("%Y%m%d%H%M%S"))
  @tt  = t_utc.tt                                         # 地球時(for UTC)
  @ut1 = t_utc.ut1                                        # 世界時1(for TT)
  @tdb = t_utc.tdb                                        # 太陽系力学時(for TT)
  @jd  = t_utc.jd                                         # ユリウス日(for TT)
  @jc = calc_jc(@jd)                                      # ユリウス世紀数(for TT)
  @jd_ut1 = MkTime.new(@ut1.strftime("%Y%m%d%H%M%S")).jd  # ユリウス日(for UT1)
  @t = @jd_ut1 - Const::J2000
  bpn = EphBpn.new(@tdb.strftime("%Y%m%d%H%M%S"))
  @r_mtx = bpn.r_bias_prec_nut
  cc = CipCio.new(@jc)
  x, y = cc.bpn2xy(@r_mtx)
  @s = cc.calc_s_06(x, y)
  @e = EraEors.new(@jd_ut1)
end

Public Instance Methods

ee() click to toggle source
Equation of Equinoxes (Unit: rad)

@param:  <none>
@return: @ee
# File lib/mk_greenwich/greenwich.rb, line 127
def ee
  @gast = gast unless @gast
  @gmst = gmst unless @gmst
  @ee = @e.calc_ee(@gast, @gmst)
  return @ee
end
ee_deg() click to toggle source
Equation of Equinoxes (Unit: deg)

@param:  <none>
@return: @ee_deg
# File lib/mk_greenwich/greenwich.rb, line 140
def ee_deg
  @ee = ee unless @ee
  @ee_deg = @ee / Const::PI_180
  return @ee_deg
end
ee_hms() click to toggle source
Equation of Equinoxes (Unit: HMS)

@param:  <none>
@return: @ee_hms
# File lib/mk_greenwich/greenwich.rb, line 152
def ee_hms
  @ee_deg = ee_deg unless @ee_deg
  @ee_hms = deg2hms(@ee_deg)
  return @ee_hms
end
eo() click to toggle source
Equation of the origins, given the classical NPB matrix and the
quantity s.

@param:  <none>
@return: @eo
# File lib/mk_greenwich/greenwich.rb, line 43
def eo
  @eo = @e.calc_eo(@r_mtx, @s)
  return @eo
end
era() click to toggle source
Earth rotation angle

* IAU 2000 model

@param:  <none>
@return: @era
# File lib/mk_greenwich/greenwich.rb, line 31
def era
  @era = @e.calc_era(@jd, @t)
  return @era
end
gast() click to toggle source
Greenwich apparent sidereal time (Unit: rad)

@param:  <none>
@return: @gast
# File lib/mk_greenwich/greenwich.rb, line 54
def gast
  @era  = @e.calc_era(@jd, @t)   unless @era
  @eo   = @e.calc_eo(@r_mtx, @s) unless @eo
  @gast = @e.calc_gast(@era, @eo)
  return @gast
end
gast_deg() click to toggle source
Greenwich apparent sidereal time (Unit: deg)

@param:  <none>
@return: @gast_deg
# File lib/mk_greenwich/greenwich.rb, line 67
def gast_deg
  @gast = gast unless @gast
  @gast_deg = @gast / Const::PI_180
  return @gast_deg
end
gast_hms() click to toggle source
Greenwich apparent sidereal time (Unit: HMS)

@param:  <none>
@return: @gast_hms
# File lib/mk_greenwich/greenwich.rb, line 79
def gast_hms
  @gast_deg = gast_deg unless @gast_deg
  @gast_hms = deg2hms(@gast_deg)
  return @gast_hms
end
gmst() click to toggle source
Greenwich mean sidereal time, IAU 2006. (Unit: rad)

@param:  <none>
@return: @gmst
# File lib/mk_greenwich/greenwich.rb, line 91
def gmst
  @era  = @e.calc_era(@jd, @t)   unless @era
  @gmst = @e.calc_gmst(@era, @jc)
  return @gmst
end
gmst_deg() click to toggle source
Greenwich mean sidereal time, IAU 2006. (Unit: deg)

@param:  <none>
@return: @gmst_geg
# File lib/mk_greenwich/greenwich.rb, line 103
def gmst_deg
  @gmst = gmst unless @gast
  @gmst_deg = @gmst / Const::PI_180
  return @gmst_deg
end
gmst_hms() click to toggle source
Greenwich mean sidereal time, IAU 2006. (Unit: HMS)

@param:  <none>
@return: @gmst_hms
# File lib/mk_greenwich/greenwich.rb, line 115
def gmst_hms
  @gmst_deg = gmst_deg unless @gmst_deg
  @gmst_hms = deg2hms(@gmst_deg)
  return @gmst_hms
end

Private Instance Methods

calc_jc(jd) click to toggle source
# File lib/mk_greenwich/greenwich.rb, line 166
def calc_jc(jd)
  return (jd - Const::J2000) / Const::JC
rescue => e
  raise
end
deg2hms(deg) click to toggle source
# File lib/mk_greenwich/greenwich.rb, line 172
def deg2hms(deg)
  sign = ""

  begin
    h = (deg / 15.0).truncate
    _m = (deg - h * 15.0) * 4.0
    m = _m.truncate
    s = (_m - m) * 60.0
    if s < 0
      s *= -1
      sign = "-"
    end
    return sprintf("%s%d h %02d m %06.3f s", sign, h, m, s)
  rescue => e
    raise
  end
end