Class: When::Ephemeris::ChineseTrueLunation

Inherits:
MeanLunation show all
Defined in:
lib/when_exe/region/chinese.rb

Overview

Chinese Luni-Solar Calendar Formula for True Lunation Type

Constant Summary

Constants inherited from Formula

Formula::Bs, Formula::CYCLE_0M, Formula::CYCLE_1M, Formula::Sgn

Constants included from When::Ephemeris

AU, AcS, BCENT, C0, CIRCLE, COS, COSL, COSLT, COST, DAY, DEG, EPOCH1800, EPOCH1900, EPOCH1975, EPOCH2000, FARAWAY, JCENT, JYEAR, Jupiter, LIN, Mars, Mercury, Neptune, P0B, P0L, P0P, P0dB, P0dL, P1B, P1L, P1R, P2B, P2L, P2Q, P2dL, P3L, P3Q, P4B, P4L, P4Q, P4dL, P5B, P5L, P5Q, P5dL, P5l, P5n, P5r, P5t, P6B, P6L, P6Q, P6dL, P6l, P6n, P6r, P6t, P7B, P7L, P7R, P8B, P8L, P8R, P9B, P9L, P9R, PSEC, Pluto, SIN, SINL, SINLT, SINT, Saturn, Uranus, Venus

Constants included from Parts::MethodCash

Parts::MethodCash::Escape

Constants included from Parts::Resource

Parts::Resource::LabelProperty

Instance Attribute Summary collapse

Attributes inherited from MeanLunation

#day_epoch, #denominator, #long, #lunation_length, #month_epoch, #month_length, #year_epoch, #year_length

Attributes inherited from Formula

#alt, #formula, #graha, #is_dynamical, #lat, #location, #long, #time_standard

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#_pool, #child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods inherited from MeanLunation

#_mean_moon_, #_mean_sun_, #sunrise

Methods inherited from Formula

#_coords, #_to_seed_type, #day_event, #meridian_passage_of_moon, #meridian_passage_of_sun, #moon_noon, #moon_visibility, #moonrise, #moonset, #nearest_past, #sun_noon, #sunrise, #sunset, #time_to_cn, #year_event

Methods included from When::Ephemeris

_adjust, _rot, _to_p2, _to_p3, _to_r3, acos, asin, cosc, cosd, delta_e, delta_p, julian_century_from_2000, julian_year_from_1975, obl, polynomial, root, sinc, sind, tanc, tand, trigonometric

Methods included from Parts::MethodCash

_setup_, escape, #method_missing, #method_missing_

Methods included from Parts::Resource

#[], #^, _decode, _encode, _extract_prefix, _instance, _parse, _path_with_prefix, _replace_tags, _setup_, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?

Methods included from Parts::Resource::Pool

#[], #[]=, #_pool, #_setup_, #pool_keys

Methods included from Parts::Resource::Synchronize

#synchronize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::MethodCash

Instance Attribute Details

#anomalistic_month_lengthNumeric (readonly)

近点月

Returns:


130
131
132
# File 'lib/when_exe/region/chinese.rb', line 130

def anomalistic_month_length
  @anomalistic_month_length
end

#anomalistic_month_shiftNumeric (readonly)

元期の近点離隔

Returns:


134
135
136
# File 'lib/when_exe/region/chinese.rb', line 134

def anomalistic_month_shift
  @anomalistic_month_shift
end

#mArray<Array< 区間の時間/分, 損益率 >> (readonly)

月の位置補正表

Returns:

  • (Array<Array< 区間の時間/分, 損益率 >>)

126
127
128
# File 'lib/when_exe/region/chinese.rb', line 126

def m
  @m
end

#sArray<Array< 入気定日加減数, 朓朒数, 損益率, 損益率増分 >> (readonly)

太陽の位置補正表

Returns:

  • (Array<Array< 入気定日加減数, 朓朒数, 損益率, 損益率増分 >>)

122
123
124
# File 'lib/when_exe/region/chinese.rb', line 122

def s
  @s
end

Instance Method Details

#thiti_range(date) ⇒ Range

当該日付のthiti の変化範囲(唐代の定朔の暦法用 cn_to_time(1L) を使用する)

Parameters:

Returns:

  • (Range)

    当該日付のthiti の変化範囲(朔を含む場合 nil)


142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/when_exe/region/chinese.rb', line 142

def thiti_range(date)
  date = date.floor
  p0, p1 = [date, date.succ].map {|d|
    t  = d.to_f
    c  = (30.0 * ((t - CYCLE_0M) * @cycle_number_1m + @cycle_number_0m)).floor
    t0 = t1 = nil
    loop do
      t0 = cn_to_time( c   / 30.0)
      t1 = cn_to_time((c+1)/ 30.0)
      if t0 > t
        c -= 1
      elsif t1 <= t
        c += 1
      else
        break
      end
    end
    (c + (t-t0) / (t1-t0)) % 30.0
  }
  p0 >= p1 ? nil : p0...p1
end