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::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, PSEC, Pluto, SIN, SINL, SINLT, SINT, Saturn, Uranus, Venus

Constants included from Namespace

Namespace::DC, Namespace::DCQ, Namespace::DCT, Namespace::FOAF, Namespace::OWL, Namespace::RDF, Namespace::RDFC, Namespace::RDFS, Namespace::RSS, Namespace::XSD

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

#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

#[], #^, _instance, _setup_, _setup_info, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #parent, #registered?, root_dir

Methods included from Parts::Resource::Pool

#[], #[]=, #_setup_

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>)

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



730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
# File 'lib/when_exe/region/chinese.rb', line 730

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:



717
718
719
720
721
722
# File 'lib/when_exe/region/chinese.rb', line 717

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