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

Defined Under Namespace

Modules: JujiMethods, MethodA, MethodC, MethodJ, MethodS, MethodW, TangMethods

Constant Summary collapse

MethodB =

日本暦日原典 計算 B)

MethodC

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::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIDecode, Parts::Resource::IRIDecodeTable, Parts::Resource::IRIEncode, Parts::Resource::IRIEncodeTable, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty

Instance Attribute Summary

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, #cn_to_time_, #day_event, #lunar_eclipse, #meridian_passage_of_moon, #meridian_passage_of_sun, #moon_noon, #moon_visibility, #moonrise, #moonset, #nearest_past, #solar_eclipse, #sun_noon, #sunrise, #sunset, #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_, _setup_info, escape, #method_missing, #method_missing_

Methods included from Parts::Resource

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

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 Method Details

#phase_range(date) ⇒ Array<Numeric>

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

Parameters:

Returns:

  • (Array<Numeric>)

    当該日付の月の位相の変化範囲



707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/when_exe/region/chinese.rb', line 707

def phase_range(date)
  date = date.floor
  [date, date.succ].map {|d|
    t  = d.to_f
    c  = (60.0 * ((t - CYCLE_0M) * @cycle_number_1m + @cycle_number_0m)).floor
    t0 = t1 = nil
    loop do
      t0 = cn_to_time( c   / 60.0)
      t1 = cn_to_time((c+1)/ 60.0)
      d  = ((t-t0) / (t1-t0)).round
      if d.abs > 1
        c += d
      elsif t0 > t
        c -= 1
      elsif t1 <= t
        c += 1
      else
        break
      end
    end
    (c + (t-t0) / (t1-t0)) / 60.0
  }
end

#time_to_cn(t) ⇒ Numeric

日時 -> 周期番号(唐代の定朔の暦法用 cn_to_time(1L) を使用する)

Parameters:

Returns:



694
695
696
697
698
699
# File 'lib/when_exe/region/chinese.rb', line 694

def time_to_cn(t)
  return super unless @cycle_number_1m
  time = @is_dynamical ? +t : t.to_f
  cn0  = time * @cycle_number_1m + @cycle_number_0m
  root(cn0, time, 0, 5) {|cn| cn_to_time(cn)}
end