Module: IERS::LengthOfDay

Extended by:
EopParameter
Defined in:
lib/iers/length_of_day.rb

Defined Under Namespace

Classes: Entry

Constant Summary

Constants included from EopParameter

EopParameter::FLAG_TO_QUALITY

Class Method Summary collapse

Methods included from EopParameter

derive_quality, interpolate_field, resolve

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:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/iers/length_of_day.rb', line 23

def at(input = nil, jd: nil, mjd: nil, interpolation: nil)
  query_mjd, window, method = resolve(
    input,
    jd: jd,
    mjd: mjd,
    interpolation: interpolation
  )

  lod = interpolate_field(window, query_mjd, method) { |e| e.lod / 1000.0 }

  Entry.new(
    length_of_day: lod,
    mjd: query_mjd,
    data_quality: derive_quality(window, :ut1_flag)
  )
end

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

Parameters:

  • start_date (Date)
  • end_date (Date)

Returns:

  • (Enumerator::Lazy<Entry>)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/iers/length_of_day.rb', line 43

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 do |e|
      Entry.new(
        length_of_day: e.lod / 1000.0,
        mjd: e.mjd,
        data_quality: EopParameter::FLAG_TO_QUALITY.fetch(e.ut1_flag, :observed)
      )
    end
end