Module: IERS::EOP

Defined in:
lib/iers/eop.rb

Defined Under Namespace

Classes: Entry

Class Method Summary collapse

Class Method Details

.at(input = nil, jd: nil, mjd: nil, interpolation: nil) ⇒ Entry

Parameters:

  • input (Time, Date, DateTime, nil) (defaults to: nil)
  • jd (Float, nil) (defaults to: nil)

    Julian Date

  • mjd (Float, nil) (defaults to: nil)

    Modified Julian Date

  • interpolation (Symbol, nil) (defaults to: nil)

    +:lagrange+ or +:linear+

Returns:

Raises:



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
# File 'lib/iers/eop.rb', line 35

def at(input = nil, jd: nil, mjd: nil, interpolation: nil)
  query_mjd = TimeScale.to_mjd(input, jd: jd, mjd: mjd)
  interp = interpolation ? {interpolation: interpolation} : {}

  pm = PolarMotion.at(mjd: query_mjd, **interp)
  ut1 = UT1.at(mjd: query_mjd, **interp)
  cpo = CelestialPoleOffset.at(mjd: query_mjd, **interp)
  lod = LengthOfDay.at(mjd: query_mjd, **interp)

  quality = if [pm, ut1, cpo, lod].any?(&:predicted?)
    :predicted
  else
    :observed
  end

  Entry.new(
    polar_motion_x: pm.x,
    polar_motion_y: pm.y,
    ut1_utc: ut1.ut1_utc,
    length_of_day: lod.length_of_day,
    celestial_pole_x: cpo.x,
    celestial_pole_y: cpo.y,
    mjd: query_mjd,
    data_quality: quality
  )
end

.between(start_date, end_date) ⇒ Enumerator::Lazy<Entry>

Parameters:

  • start_date (Date)
  • end_date (Date)

Returns:

  • (Enumerator::Lazy<Entry>)


65
66
67
68
69
70
71
72
73
74
# File 'lib/iers/eop.rb', line 65

def between(start_date, end_date)
  start_mjd = TimeScale.to_mjd(start_date)
  end_mjd = TimeScale.to_mjd(end_date)
  entries = Data.finals_entries

  EopLookup
    .range(entries, start_mjd, end_mjd)
    .lazy
    .map { |e| entry_from_parser(e) }
end