mk_greenwich 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +10 -0
- data/Guardfile +70 -0
- data/LICENSE.txt +21 -0
- data/README.md +64 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/mk_greenwich +21 -0
- data/lib/mk_greenwich/argument.rb +24 -0
- data/lib/mk_greenwich/cip_cio.rb +92 -0
- data/lib/mk_greenwich/const.rb +97 -0
- data/lib/mk_greenwich/era_eors.rb +116 -0
- data/lib/mk_greenwich/fundamental_argument.rb +130 -0
- data/lib/mk_greenwich/greenwich.rb +213 -0
- data/lib/mk_greenwich/version.rb +3 -0
- data/lib/mk_greenwich.rb +18 -0
- data/mk_greenwich.gemspec +35 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 577c15044a40fd368c0dc1922bdcfad86ce2adbc
|
4
|
+
data.tar.gz: ab54e375e1c5a4a0aaafebdbb96bc0fbc317057c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 630c3cfe10dc9758910c0a625adcdb7042023479fc617931aae646df771172e4977fa9d30bad5ec51f74299afca6dab5ef175e6336be4c3323d2ae8fd47c101d
|
7
|
+
data.tar.gz: 5148bcaff4f812c041e3419752b9522de2e262a41defc3429e04b4e7b24be1649377f0e8f691f019f4ea741e74d3235380769bbc915f21457466b6511bcd7525
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
+
require "guard/rspec/dsl"
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
# Feel free to open issues for suggestions and improvements
|
32
|
+
|
33
|
+
# RSpec files
|
34
|
+
rspec = dsl.rspec
|
35
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
36
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
37
|
+
watch(rspec.spec_files)
|
38
|
+
|
39
|
+
# Ruby files
|
40
|
+
ruby = dsl.ruby
|
41
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
42
|
+
|
43
|
+
## Rails files
|
44
|
+
#rails = dsl.rails(view_extensions: %w(erb haml slim))
|
45
|
+
#dsl.watch_spec_files_for(rails.app_files)
|
46
|
+
#dsl.watch_spec_files_for(rails.views)
|
47
|
+
|
48
|
+
#watch(rails.controllers) do |m|
|
49
|
+
# [
|
50
|
+
# rspec.spec.call("routing/#{m[1]}_routing"),
|
51
|
+
# rspec.spec.call("controllers/#{m[1]}_controller"),
|
52
|
+
# rspec.spec.call("acceptance/#{m[1]}")
|
53
|
+
# ]
|
54
|
+
#end
|
55
|
+
|
56
|
+
## Rails config changes
|
57
|
+
#watch(rails.spec_helper) { rspec.spec_dir }
|
58
|
+
#watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
59
|
+
#watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
60
|
+
|
61
|
+
## Capybara features specs
|
62
|
+
#watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
63
|
+
#watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
64
|
+
|
65
|
+
## Turnip features and steps
|
66
|
+
#watch(%r{^spec/acceptance/(.+)\.feature$})
|
67
|
+
#watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
68
|
+
# Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
69
|
+
#end
|
70
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Masaru Koizumi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# MkGreenwich
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
This is the gem library which calculates Greenwich time.
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'mk_greenwich'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install mk_greenwich
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### Instantiation
|
22
|
+
|
23
|
+
require 'mk_greenwich'
|
24
|
+
|
25
|
+
g = MkGreenwich.new("20160906")
|
26
|
+
g = MkGreenwich.new("20160906123456")
|
27
|
+
g = MkGreenwich.new
|
28
|
+
|
29
|
+
* You can set UTC formatted "YYYYMMDD" or "YYYYMMDDHHMMSS" as an argument.
|
30
|
+
* If you don't set an argument, this class considers the system time to have been set as an argument.
|
31
|
+
|
32
|
+
### Calculation
|
33
|
+
|
34
|
+
puts " UTC: #{g.utc.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
35
|
+
puts " TT: #{g.tt.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
36
|
+
puts " UT1: #{g.ut1.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
37
|
+
puts " TDB: #{g.tdb.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
38
|
+
puts " ERA: #{g.era}"
|
39
|
+
puts " EO: #{g.eo}"
|
40
|
+
puts "GAST: #{g.gast} rad"
|
41
|
+
puts " = #{g.gast_deg} °"
|
42
|
+
puts " = #{g.gast_hms}"
|
43
|
+
puts "GMST: #{g.gmst} rad"
|
44
|
+
puts " = #{g.gmst_deg} °"
|
45
|
+
puts " = #{g.gmst_hms}"
|
46
|
+
puts " EE: #{g.ee} rad"
|
47
|
+
puts " = #{g.ee_deg} °"
|
48
|
+
puts " = #{g.ee_hms}"
|
49
|
+
|
50
|
+
## Development
|
51
|
+
|
52
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
53
|
+
|
54
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/komasaru/mk_greenwich.
|
59
|
+
|
60
|
+
|
61
|
+
## License
|
62
|
+
|
63
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
64
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mk_greenwich"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/mk_greenwich
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "mk_greenwich"
|
4
|
+
|
5
|
+
g = MkGreenwich.new(ARGV[0]) # argument should be UT
|
6
|
+
puts " UTC: #{g.utc.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
7
|
+
puts " TT: #{g.tt.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
8
|
+
puts " UT1: #{g.ut1.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
9
|
+
puts " TDB: #{g.tdb.instance_eval { '%s.%03d' % [strftime('%Y-%m-%d %H:%M:%S'), (usec / 1000.0).round] }}"
|
10
|
+
puts " ERA: #{g.era}"
|
11
|
+
puts " EO: #{g.eo}"
|
12
|
+
puts "GAST: #{g.gast} rad"
|
13
|
+
puts " = #{g.gast_deg} °"
|
14
|
+
puts " = #{g.gast_hms}"
|
15
|
+
puts "GMST: #{g.gmst} rad"
|
16
|
+
puts " = #{g.gmst_deg} °"
|
17
|
+
puts " = #{g.gmst_hms}"
|
18
|
+
puts " EE: #{g.ee} rad"
|
19
|
+
puts " = #{g.ee_deg} °"
|
20
|
+
puts " = #{g.ee_hms}"
|
21
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module MkGreenwich
|
2
|
+
class Argument
|
3
|
+
def initialize(arg)
|
4
|
+
@arg = arg
|
5
|
+
end
|
6
|
+
|
7
|
+
#=========================================================================
|
8
|
+
# 引数取得
|
9
|
+
#
|
10
|
+
# * コマンドライン引数を取得して日時の妥当性チェックを行う
|
11
|
+
# * コマンドライン引数無指定なら、現在日時とする。
|
12
|
+
#
|
13
|
+
# @return: utc (Time Object)
|
14
|
+
#=========================================================================
|
15
|
+
def get_utc
|
16
|
+
(puts Const::MSG_ERR_1; return) unless @arg =~ /^\d{8}$|^\d{14}$/
|
17
|
+
year, month, day = @arg[ 0, 4].to_i, @arg[ 4, 2].to_i, @arg[ 6, 2].to_i
|
18
|
+
hour, min, sec = @arg[ 8, 2].to_i, @arg[10, 2].to_i, @arg[12, 2].to_i
|
19
|
+
(puts Const::MSG_ERR_2; return) unless Date.valid_date?(year, month, day)
|
20
|
+
(puts Const::MSG_ERR_2; return) if hour > 23 || min > 59 || sec > 59
|
21
|
+
return Time.new(year, month, day, hour, min, sec, "+00:00")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require "mk_greenwich/fundamental_argument"
|
2
|
+
|
3
|
+
module MkGreenwich
|
4
|
+
class CipCio
|
5
|
+
include MkGreenwich::FundamentalArgument
|
6
|
+
|
7
|
+
#-------------------------------------------------------------------------
|
8
|
+
# Initialization
|
9
|
+
#
|
10
|
+
# @param: t (Julian Century)
|
11
|
+
#-------------------------------------------------------------------------
|
12
|
+
def initialize(t)
|
13
|
+
@t = t
|
14
|
+
end
|
15
|
+
|
16
|
+
#-------------------------------------------------------------------------
|
17
|
+
# Extract from the bias-precession-nutation matrix the X,Y coordinates
|
18
|
+
# of the Celestial Intermediate Pole.
|
19
|
+
#
|
20
|
+
# @param: r (Rotation Matrix)
|
21
|
+
# @return: [x, y] (x, y cordinates of CIP)
|
22
|
+
#-------------------------------------------------------------------------
|
23
|
+
def bpn2xy(r)
|
24
|
+
return [r[2][0], r[2][1]]
|
25
|
+
rescue => e
|
26
|
+
raise
|
27
|
+
end
|
28
|
+
|
29
|
+
#-------------------------------------------------------------------------
|
30
|
+
# The CIO locator s, positioning the Celestial Intermediate Origin on
|
31
|
+
# the equator of the Celestial Intermediate Pole, given the CIP's X,Y
|
32
|
+
# coordinates. Compatible with IAU 2006/2000A precession-nutation.
|
33
|
+
#
|
34
|
+
# @param: x (x coordinate of CIP)
|
35
|
+
# @param: y (y coordinate of CIP)
|
36
|
+
# @return: s (CIO locator (Unit: rad))
|
37
|
+
#-------------------------------------------------------------------------
|
38
|
+
def calc_s_06(x, y)
|
39
|
+
# Fundamental Arguments (from IERS Conventions 2003)
|
40
|
+
fa = [
|
41
|
+
# Mean anomaly of the Moon.(Ref: iauFal03(t))
|
42
|
+
calc_l_iers2003(@t),
|
43
|
+
# Mean anomaly of the Sun.(Ref: iauFalp03(t))
|
44
|
+
calc_p_iers2003(@t),
|
45
|
+
# Mean longitude of the Moon minus that of the ascending node.(Ref: iauFaf03(t))
|
46
|
+
calc_f_iers2003(@t),
|
47
|
+
# Mean elongation of the Moon from the Sun.(Ref: iauFad03(t))
|
48
|
+
calc_d_iers2003(@t),
|
49
|
+
# Mean longitude of the ascending node of the Moon.(Ref: iauFaom03(t))
|
50
|
+
calc_om_iers2003(@t),
|
51
|
+
# Mean longitude of Venus.(Ref: iauFave03(t))
|
52
|
+
calc_ve_iers2003(@t),
|
53
|
+
# Mean longitude of Earth.(Ref: iauFae03(t))
|
54
|
+
calc_ea_iers2003(@t),
|
55
|
+
# General precession in longitude.(Ref: iauFapa03(t))
|
56
|
+
calc_pa_iers2003(@t)
|
57
|
+
]
|
58
|
+
# Evaluate s.
|
59
|
+
w_0, w_1, w_2, w_3, w_4, w_5 = Const::SP
|
60
|
+
(Const::S_0.size - 1).downto(0) do |i|
|
61
|
+
a = 0.0
|
62
|
+
0.upto(7) { |j| a += Const::S_0[i][0][j] * fa[j] }
|
63
|
+
w_0 += Const::S_0[i][1] * Math.sin(a) + Const::S_0[i][2] * Math.cos(a)
|
64
|
+
end
|
65
|
+
(Const::S_1.size - 1).downto(0) do |i|
|
66
|
+
a = 0.0
|
67
|
+
0.upto(7) { |j| a += Const::S_1[i][0][j] * fa[j] }
|
68
|
+
w_1 += Const::S_1[i][1] * Math.sin(a) + Const::S_1[i][2] * Math.cos(a)
|
69
|
+
end
|
70
|
+
(Const::S_2.size - 1).downto(0) do |i|
|
71
|
+
a = 0.0
|
72
|
+
0.upto(7) { |j| a += Const::S_2[i][0][j] * fa[j] }
|
73
|
+
w_2 += Const::S_2[i][1] * Math.sin(a) + Const::S_2[i][2] * Math.cos(a)
|
74
|
+
end
|
75
|
+
(Const::S_3.size - 1).downto(0) do |i|
|
76
|
+
a = 0.0
|
77
|
+
0.upto(7) { |j| a += Const::S_3[i][0][j] * fa[j] }
|
78
|
+
w_3 += Const::S_3[i][1] * Math.sin(a) + Const::S_3[i][2] * Math.cos(a)
|
79
|
+
end
|
80
|
+
(Const::S_4.size - 1).downto(0) do |i|
|
81
|
+
a = 0.0
|
82
|
+
0.upto(7) { |j| a += Const::S_4[i][0][j] * fa[j] }
|
83
|
+
w_4 += Const::S_4[i][1] * Math.sin(a) + Const::S_4[i][2] * Math.cos(a)
|
84
|
+
end
|
85
|
+
return (w_0 + (w_1 + (w_2 + (w_3 + (w_4 + w_5 \
|
86
|
+
* @t) * @t) * @t) * @t) * @t) * Const::AS2R - x * y / 2.0
|
87
|
+
rescue => e
|
88
|
+
raise
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module MkGreenwich
|
2
|
+
module Const
|
3
|
+
MSG_ERR_1 = "[ERROR] Format: YYYYMMDD or YYYYMMDDHHMMSS"
|
4
|
+
MSG_ERR_2 = "[ERROR] Invalid date-time!"
|
5
|
+
J2000 = 2451545.0 # Reference epoch (J2000.0), Julian Date
|
6
|
+
JC = 36525.0 # Days per Julian century
|
7
|
+
# ==== for CipCio ====
|
8
|
+
# Polynomial coefficients
|
9
|
+
SP = [94.00e-6, 3808.65e-6, -122.68e-6, -72574.11e-6, 27.98e-6, 15.62e-6]
|
10
|
+
# Terms of order t^0
|
11
|
+
S_0 = [
|
12
|
+
[[0, 0, 0, 0, 1, 0, 0, 0], -2640.73e-6, 0.39e-6],
|
13
|
+
[[0, 0, 0, 0, 2, 0, 0, 0], -63.53e-6, 0.02e-6],
|
14
|
+
[[0, 0, 2, -2, 3, 0, 0, 0], -11.75e-6, -0.01e-6],
|
15
|
+
[[0, 0, 2, -2, 1, 0, 0, 0], -11.21e-6, -0.01e-6],
|
16
|
+
[[0, 0, 2, -2, 2, 0, 0, 0], 4.57e-6, 0.00e-6],
|
17
|
+
[[0, 0, 2, 0, 3, 0, 0, 0], -2.02e-6, 0.00e-6],
|
18
|
+
[[0, 0, 2, 0, 1, 0, 0, 0], -1.98e-6, 0.00e-6],
|
19
|
+
[[0, 0, 0, 0, 3, 0, 0, 0], 1.72e-6, 0.00e-6],
|
20
|
+
[[0, 1, 0, 0, 1, 0, 0, 0], 1.41e-6, 0.01e-6],
|
21
|
+
[[0, 1, 0, 0, -1, 0, 0, 0], 1.26e-6, 0.01e-6],
|
22
|
+
[[1, 0, 0, 0, -1, 0, 0, 0], 0.63e-6, 0.00e-6],
|
23
|
+
[[1, 0, 0, 0, 1, 0, 0, 0], 0.63e-6, 0.00e-6],
|
24
|
+
[[0, 1, 2, -2, 3, 0, 0, 0], -0.46e-6, 0.00e-6],
|
25
|
+
[[0, 1, 2, -2, 1, 0, 0, 0], -0.45e-6, 0.00e-6],
|
26
|
+
[[0, 0, 4, -4, 4, 0, 0, 0], -0.36e-6, 0.00e-6],
|
27
|
+
[[0, 0, 1, -1, 1, -8, 12, 0], 0.24e-6, 0.12e-6],
|
28
|
+
[[0, 0, 2, 0, 0, 0, 0, 0], -0.32e-6, 0.00e-6],
|
29
|
+
[[0, 0, 2, 0, 2, 0, 0, 0], -0.28e-6, 0.00e-6],
|
30
|
+
[[1, 0, 2, 0, 3, 0, 0, 0], -0.27e-6, 0.00e-6],
|
31
|
+
[[1, 0, 2, 0, 1, 0, 0, 0], -0.26e-6, 0.00e-6],
|
32
|
+
[[0, 0, 2, -2, 0, 0, 0, 0], 0.21e-6, 0.00e-6],
|
33
|
+
[[0, 1, -2, 2, -3, 0, 0, 0], -0.19e-6, 0.00e-6],
|
34
|
+
[[0, 1, -2, 2, -1, 0, 0, 0], -0.18e-6, 0.00e-6],
|
35
|
+
[[0, 0, 0, 0, 0, 8,-13, -1], 0.10e-6, -0.05e-6],
|
36
|
+
[[0, 0, 0, 2, 0, 0, 0, 0], -0.15e-6, 0.00e-6],
|
37
|
+
[[2, 0, -2, 0, -1, 0, 0, 0], 0.14e-6, 0.00e-6],
|
38
|
+
[[0, 1, 2, -2, 2, 0, 0, 0], 0.14e-6, 0.00e-6],
|
39
|
+
[[1, 0, 0, -2, 1, 0, 0, 0], -0.14e-6, 0.00e-6],
|
40
|
+
[[1, 0, 0, -2, -1, 0, 0, 0], -0.14e-6, 0.00e-6],
|
41
|
+
[[0, 0, 4, -2, 4, 0, 0, 0], -0.13e-6, 0.00e-6],
|
42
|
+
[[0, 0, 2, -2, 4, 0, 0, 0], 0.11e-6, 0.00e-6],
|
43
|
+
[[1, 0, -2, 0, -3, 0, 0, 0], -0.11e-6, 0.00e-6],
|
44
|
+
[[1, 0, -2, 0, -1, 0, 0, 0], -0.11e-6, 0.00e-6]
|
45
|
+
]
|
46
|
+
# Terms of order t^1
|
47
|
+
S_1 = [
|
48
|
+
[[0, 0, 0, 0, 2, 0, 0, 0], -0.07e-6, 3.57e-6],
|
49
|
+
[[0, 0, 0, 0, 1, 0, 0, 0], 1.73e-6, -0.03e-6],
|
50
|
+
[[0, 0, 2, -2, 3, 0, 0, 0], 0.00e-6, 0.48e-6]
|
51
|
+
]
|
52
|
+
# Terms of order t^2
|
53
|
+
S_2 = [
|
54
|
+
[[0, 0, 0, 0, 1, 0, 0, 0], 743.52e-6, -0.17e-6],
|
55
|
+
[[0, 0, 2, -2, 2, 0, 0, 0], 56.91e-6, 0.06e-6],
|
56
|
+
[[0, 0, 2, 0, 2, 0, 0, 0], 9.84e-6, -0.01e-6],
|
57
|
+
[[0, 0, 0, 0, 2, 0, 0, 0], -8.85e-6, 0.01e-6],
|
58
|
+
[[0, 1, 0, 0, 0, 0, 0, 0], -6.38e-6, -0.05e-6],
|
59
|
+
[[1, 0, 0, 0, 0, 0, 0, 0], -3.07e-6, 0.00e-6],
|
60
|
+
[[0, 1, 2, -2, 2, 0, 0, 0], 2.23e-6, 0.00e-6],
|
61
|
+
[[0, 0, 2, 0, 1, 0, 0, 0], 1.67e-6, 0.00e-6],
|
62
|
+
[[1, 0, 2, 0, 2, 0, 0, 0], 1.30e-6, 0.00e-6],
|
63
|
+
[[0, 1, -2, 2, -2, 0, 0, 0], 0.93e-6, 0.00e-6],
|
64
|
+
[[1, 0, 0, -2, 0, 0, 0, 0], 0.68e-6, 0.00e-6],
|
65
|
+
[[0, 0, 2, -2, 1, 0, 0, 0], -0.55e-6, 0.00e-6],
|
66
|
+
[[1, 0, -2, 0, -2, 0, 0, 0], 0.53e-6, 0.00e-6],
|
67
|
+
[[0, 0, 0, 2, 0, 0, 0, 0], -0.27e-6, 0.00e-6],
|
68
|
+
[[1, 0, 0, 0, 1, 0, 0, 0], -0.27e-6, 0.00e-6],
|
69
|
+
[[1, 0, -2, -2, -2, 0, 0, 0], -0.26e-6, 0.00e-6],
|
70
|
+
[[1, 0, 0, 0, -1, 0, 0, 0], -0.25e-6, 0.00e-6],
|
71
|
+
[[1, 0, 2, 0, 1, 0, 0, 0], 0.22e-6, 0.00e-6],
|
72
|
+
[[2, 0, 0, -2, 0, 0, 0, 0], -0.21e-6, 0.00e-6],
|
73
|
+
[[2, 0, -2, 0, -1, 0, 0, 0], 0.20e-6, 0.00e-6],
|
74
|
+
[[0, 0, 2, 2, 2, 0, 0, 0], 0.17e-6, 0.00e-6],
|
75
|
+
[[2, 0, 2, 0, 2, 0, 0, 0], 0.13e-6, 0.00e-6],
|
76
|
+
[[2, 0, 0, 0, 0, 0, 0, 0], -0.13e-6, 0.00e-6],
|
77
|
+
[[1, 0, 2, -2, 2, 0, 0, 0], -0.12e-6, 0.00e-6],
|
78
|
+
[[0, 0, 2, 0, 0, 0, 0, 0], -0.11e-6, 0.00e-6]
|
79
|
+
]
|
80
|
+
# Terms of order t^3
|
81
|
+
S_3 = [
|
82
|
+
[[0, 0, 0, 0, 1, 0, 0, 0], 0.30e-6, -23.42e-6],
|
83
|
+
[[0, 0, 2, -2, 2, 0, 0, 0], -0.03e-6, -1.46e-6],
|
84
|
+
[[0, 0, 2, 0, 2, 0, 0, 0], -0.01e-6, -0.25e-6],
|
85
|
+
[[0, 0, 0, 0, 2, 0, 0, 0], 0.00e-6, 0.23e-6]
|
86
|
+
]
|
87
|
+
# Terms of order t^4
|
88
|
+
S_4 = [
|
89
|
+
[[0, 0, 0, 0, 1, 0, 0, 0], -0.26e-6, -0.01e-6]
|
90
|
+
]
|
91
|
+
AS2R = 4.848136811095359935899141e-6 # Arcseconds to radians
|
92
|
+
PI = 3.141592653589793238462643 # PI
|
93
|
+
PI2 = 6.283185307179586476925287 # 2 * PI
|
94
|
+
PI_180 = 0.017453292519943295 # PI / 180
|
95
|
+
TURNAS = 1296000.0 # Arcseconds in a full circle
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module MkGreenwich
|
2
|
+
#===========================================================================
|
3
|
+
# Class for
|
4
|
+
# ERA(Earth rotation angle (IAU 2000 model), 地球回転角),
|
5
|
+
# EORS(Equation of the origins, 原点差)
|
6
|
+
# GMST(Greenwich mean sidereal time, グリニッジ平均恒星時)
|
7
|
+
# GAST(Greenwich apparent sidereal time, グリニッジ視恒星時)
|
8
|
+
# EE(Equation of Equinoxes, 分点均差)
|
9
|
+
#===========================================================================
|
10
|
+
class EraEors
|
11
|
+
#-------------------------------------------------------------------------
|
12
|
+
# Initialization
|
13
|
+
#
|
14
|
+
# @param: jd (Julian Day)
|
15
|
+
#-------------------------------------------------------------------------
|
16
|
+
def initialize(jd)
|
17
|
+
@jd, @t = jd, jd - Const::J2000 # JD, JD2000.0
|
18
|
+
end
|
19
|
+
|
20
|
+
#-------------------------------------------------------------------------
|
21
|
+
# Earth rotation angle (IAU 2000 model).
|
22
|
+
#
|
23
|
+
# @param: <none>
|
24
|
+
# @return: ERA (Earth rotation angle (Unit: rad, Range: 0-2pi), 地球回転角)
|
25
|
+
#-------------------------------------------------------------------------
|
26
|
+
def calc_era(jd, t)
|
27
|
+
# Fractional part of T (days).
|
28
|
+
f = jd % 1.0
|
29
|
+
# Earth rotation angle at this UT1.
|
30
|
+
return norm_angle((f + 0.7790572732640 + 0.00273781191135448 * t) * Const::PI2)
|
31
|
+
rescue => e
|
32
|
+
raise
|
33
|
+
end
|
34
|
+
|
35
|
+
#-------------------------------------------------------------------------
|
36
|
+
# Equation of the origins, given the classical NPB matrix and the
|
37
|
+
# quantity s.
|
38
|
+
#
|
39
|
+
# @param: r (Rotation matrix)
|
40
|
+
# @param: s (CIO locator)
|
41
|
+
# @return: EO (Equation of the origin (Unit: rad), 原点差)
|
42
|
+
#-------------------------------------------------------------------------
|
43
|
+
def calc_eo(r_mtx, s)
|
44
|
+
x = r_mtx[2][0]
|
45
|
+
ax = x / (1.0 + r_mtx[2][2])
|
46
|
+
xs = 1.0 - ax * x
|
47
|
+
ys = -ax * r_mtx[2][1]
|
48
|
+
zs = -x
|
49
|
+
p = r_mtx[0][0] * xs + r_mtx[0][1] * ys + r_mtx[0][2] * zs
|
50
|
+
q = r_mtx[1][0] * xs + r_mtx[1][1] * ys + r_mtx[1][2] * zs
|
51
|
+
return (p != 0 || q != 0) ? s - Math.atan2(q, p) : s
|
52
|
+
rescue => e
|
53
|
+
raise
|
54
|
+
end
|
55
|
+
|
56
|
+
#-------------------------------------------------------------------------
|
57
|
+
# Greenwich apparent sidereal time
|
58
|
+
#
|
59
|
+
# @param: era (Earth rotation angle)
|
60
|
+
# @param: eo (Equation of the origin)
|
61
|
+
# @return: GAST (Greenwich apparent sidereal time (Unit: rad), グリニッジ視恒星時)
|
62
|
+
#-------------------------------------------------------------------------
|
63
|
+
def calc_gast(era, eo)
|
64
|
+
return norm_angle(era - eo)
|
65
|
+
rescue => e
|
66
|
+
raise
|
67
|
+
end
|
68
|
+
|
69
|
+
#-------------------------------------------------------------------------
|
70
|
+
# Greenwich mean sidereal time, IAU 2006.
|
71
|
+
#
|
72
|
+
# @param: gast (Greenwich apparent sidereal time, グリニッジ視恒星時)
|
73
|
+
# @param: t (Julian Century)
|
74
|
+
# @return: GMST (Greenwich mean sidereal time (Unit: rad), グリニッジ平均恒星時)
|
75
|
+
#-------------------------------------------------------------------------
|
76
|
+
def calc_gmst(gast, t)
|
77
|
+
return norm_angle(gast +
|
78
|
+
( 0.014506 + \
|
79
|
+
(4612.156534 + \
|
80
|
+
( 1.3915817 + \
|
81
|
+
( -0.00000044 + \
|
82
|
+
( -0.000029956 + \
|
83
|
+
( -0.0000000368) \
|
84
|
+
* t) * t) * t) * t) * t) * Const::AS2R)
|
85
|
+
rescue => e
|
86
|
+
raise
|
87
|
+
end
|
88
|
+
#-------------------------------------------------------------------------
|
89
|
+
# Equation of Equinoxes
|
90
|
+
#
|
91
|
+
# @param: gast (Greenwich apparent sidereal time, グリニッジ視恒星時)
|
92
|
+
# @param: gmst (Greenwich mean sidereal time, グリニッジ平均恒星時)
|
93
|
+
# @return: EE (Equation of Equinoxes (Unit: rad), 分点均差)
|
94
|
+
#-------------------------------------------------------------------------
|
95
|
+
def calc_ee(gast, gmst)
|
96
|
+
return gast - gmst
|
97
|
+
rescue => e
|
98
|
+
raise
|
99
|
+
end
|
100
|
+
|
101
|
+
#-------------------------------------------------------------------------
|
102
|
+
# Normalize angle into the range 0 <= a < 2pi.
|
103
|
+
#
|
104
|
+
# @param: angle (Before normalized)
|
105
|
+
# @return: angle (Normalized angle)
|
106
|
+
#-------------------------------------------------------------------------
|
107
|
+
def norm_angle(angle)
|
108
|
+
while angle < 0; angle += Const::PI2; end
|
109
|
+
while angle > Const::PI2; angle -= Const::PI2; end
|
110
|
+
return angle
|
111
|
+
rescue => e
|
112
|
+
raise
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
@@ -0,0 +1,130 @@
|
|
1
|
+
module MkGreenwich
|
2
|
+
#===========================================================================
|
3
|
+
# Module for Fundamental arguments
|
4
|
+
#===========================================================================
|
5
|
+
module FundamentalArgument
|
6
|
+
module_function
|
7
|
+
|
8
|
+
#-------------------------------------------------------------------------
|
9
|
+
# Mean anomaly of the Moon (IERS 2003)
|
10
|
+
#
|
11
|
+
# @param: t (Julian Centry)
|
12
|
+
# @return: l (Unit: rad)
|
13
|
+
#-------------------------------------------------------------------------
|
14
|
+
def calc_l_iers2003(t)
|
15
|
+
return (( 485868.249036 + \
|
16
|
+
(1717915923.2178 + \
|
17
|
+
( 31.8792 + \
|
18
|
+
( 0.051635 + \
|
19
|
+
( -0.00024470) \
|
20
|
+
* t) * t) * t) * t) % Const::TURNAS) * Const::AS2R
|
21
|
+
rescue => e
|
22
|
+
raise
|
23
|
+
end
|
24
|
+
|
25
|
+
#-------------------------------------------------------------------------
|
26
|
+
# Mean anomaly of the Sun (IERS 2003)
|
27
|
+
#
|
28
|
+
# @param: t (Julian Centry)
|
29
|
+
# @return: p (Unit: rad)
|
30
|
+
#-------------------------------------------------------------------------
|
31
|
+
def calc_p_iers2003(t)
|
32
|
+
return (( 1287104.793048 + \
|
33
|
+
( 129596581.0481 + \
|
34
|
+
( - 0.5532 + \
|
35
|
+
( 0.000136 + \
|
36
|
+
( - 0.00001149) \
|
37
|
+
* t) * t) * t) * t) % Const::TURNAS) * Const::AS2R
|
38
|
+
rescue => e
|
39
|
+
raise
|
40
|
+
end
|
41
|
+
|
42
|
+
#-------------------------------------------------------------------------
|
43
|
+
# Mean longitude of the Moon minus that of the ascending node (IERS 2003)
|
44
|
+
#
|
45
|
+
# @param: t (Julian Centry)
|
46
|
+
# @return: f (Unit: rad)
|
47
|
+
#-------------------------------------------------------------------------
|
48
|
+
def calc_f_iers2003(t)
|
49
|
+
return (( 335779.526232 + \
|
50
|
+
(1739527262.8478 + \
|
51
|
+
( -12.7512 + \
|
52
|
+
( -0.001037 + \
|
53
|
+
( 0.00000417) \
|
54
|
+
* t) * t) * t) * t) % Const::TURNAS) * Const::AS2R
|
55
|
+
rescue => e
|
56
|
+
raise
|
57
|
+
end
|
58
|
+
|
59
|
+
#-------------------------------------------------------------------------
|
60
|
+
# mean elongation of the Moon from the Sun (IERS 2003)
|
61
|
+
#
|
62
|
+
# @param: t (Julian Centry)
|
63
|
+
# @return: d (Unit: rad)
|
64
|
+
#-------------------------------------------------------------------------
|
65
|
+
def calc_d_iers2003(t)
|
66
|
+
return (( 1072260.703692 + \
|
67
|
+
(1602961601.2090 + \
|
68
|
+
( - 6.3706 + \
|
69
|
+
( 0.006593 + \
|
70
|
+
( - 0.00003169) \
|
71
|
+
* t) * t) * t) * t) % Const::TURNAS ) * Const::AS2R
|
72
|
+
rescue => e
|
73
|
+
raise
|
74
|
+
end
|
75
|
+
|
76
|
+
#-------------------------------------------------------------------------
|
77
|
+
# Mean longitude of the ascending node of the Moon (IERS 2003)
|
78
|
+
#
|
79
|
+
# @param: t (Julian Centry)
|
80
|
+
# @return: om (Unit: rad)
|
81
|
+
#-------------------------------------------------------------------------
|
82
|
+
def calc_om_iers2003(t)
|
83
|
+
return (( 450160.398036 + \
|
84
|
+
( -6962890.5431 + \
|
85
|
+
( 7.4722 + \
|
86
|
+
( 0.007702 + \
|
87
|
+
( -0.00005939) \
|
88
|
+
* t) * t) * t) * t) % Const::TURNAS) * Const::AS2R
|
89
|
+
rescue => e
|
90
|
+
raise
|
91
|
+
end
|
92
|
+
|
93
|
+
#-------------------------------------------------------------------------
|
94
|
+
# Venus longitudes (IERS 2003)
|
95
|
+
#
|
96
|
+
# @param: t (Julian Centry)
|
97
|
+
# @return: ve (Unit: rad)
|
98
|
+
#-------------------------------------------------------------------------
|
99
|
+
def calc_ve_iers2003(t)
|
100
|
+
return (3.176146697 + 1021.3285546211 * t) % Const::PI2
|
101
|
+
rescue => e
|
102
|
+
raise
|
103
|
+
end
|
104
|
+
|
105
|
+
#-------------------------------------------------------------------------
|
106
|
+
# Earth longitudes (IERS 2003)
|
107
|
+
#
|
108
|
+
# @param: t (Julian Centry)
|
109
|
+
# @return: ea (Unit: rad)
|
110
|
+
#-------------------------------------------------------------------------
|
111
|
+
def calc_ea_iers2003(t)
|
112
|
+
return (1.753470314 + 628.3075849991 * t) % Const::PI2
|
113
|
+
rescue => e
|
114
|
+
raise
|
115
|
+
end
|
116
|
+
|
117
|
+
#-------------------------------------------------------------------------
|
118
|
+
# General accumulated precession in longitude (IERS 2003)
|
119
|
+
#
|
120
|
+
# @param: t (Julian Centry)
|
121
|
+
# @return: pa (Unit: rad)
|
122
|
+
#-------------------------------------------------------------------------
|
123
|
+
def calc_pa_iers2003(t)
|
124
|
+
return (0.024381750 + 0.00000538691 * t) * t
|
125
|
+
rescue => e
|
126
|
+
raise
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
@@ -0,0 +1,213 @@
|
|
1
|
+
module MkGreenwich
|
2
|
+
class Greenwich
|
3
|
+
attr_reader :utc, :tt, :ut1, :tdb
|
4
|
+
|
5
|
+
def initialize(utc)
|
6
|
+
@utc = utc # 協定世界時
|
7
|
+
t_utc = MkTime.new(@utc.strftime("%Y%m%d%H%M%S"))
|
8
|
+
@tt = t_utc.tt # 地球時(for UTC)
|
9
|
+
@ut1 = t_utc.ut1 # 世界時1(for TT)
|
10
|
+
@tdb = t_utc.tdb # 太陽系力学時(for TT)
|
11
|
+
@jd = t_utc.jd # ユリウス日(for TT)
|
12
|
+
@jc = calc_jc(@jd) # ユリウス世紀数(for TT)
|
13
|
+
@jd_ut1 = MkTime.new(@ut1.strftime("%Y%m%d%H%M%S")).jd # ユリウス日(for UT1)
|
14
|
+
@t = @jd_ut1 - Const::J2000
|
15
|
+
bpn = EphBpn.new(@tdb.strftime("%Y%m%d%H%M%S"))
|
16
|
+
@r_mtx = prod_mtx(bpn.r_bias_prec, bpn.r_nut)
|
17
|
+
cc = CipCio.new(@jc)
|
18
|
+
x, y = cc.bpn2xy(@r_mtx)
|
19
|
+
@s = cc.calc_s_06(x, y)
|
20
|
+
@e = EraEors.new(@jd_ut1)
|
21
|
+
end
|
22
|
+
|
23
|
+
#=========================================================================
|
24
|
+
# Earth rotation angle
|
25
|
+
#
|
26
|
+
# * IAU 2000 model
|
27
|
+
#
|
28
|
+
# @param: <none>
|
29
|
+
# @return: @era
|
30
|
+
#=========================================================================
|
31
|
+
def era
|
32
|
+
@era = @e.calc_era(@jd, @t)
|
33
|
+
return @era
|
34
|
+
end
|
35
|
+
|
36
|
+
#=========================================================================
|
37
|
+
# Equation of the origins, given the classical NPB matrix and the
|
38
|
+
# quantity s.
|
39
|
+
#
|
40
|
+
# @param: <none>
|
41
|
+
# @return: @eo
|
42
|
+
#=========================================================================
|
43
|
+
def eo
|
44
|
+
@eo = @e.calc_eo(@r_mtx, @s)
|
45
|
+
return @eo
|
46
|
+
end
|
47
|
+
|
48
|
+
#=========================================================================
|
49
|
+
# Greenwich apparent sidereal time (Unit: rad)
|
50
|
+
#
|
51
|
+
# @param: <none>
|
52
|
+
# @return: @gast
|
53
|
+
#=========================================================================
|
54
|
+
def gast
|
55
|
+
@era = @e.calc_era(@jd, @t) unless @era
|
56
|
+
@eo = @e.calc_eo(@r_mtx, @s) unless @eo
|
57
|
+
@gast = @e.calc_gast(@era, @eo)
|
58
|
+
return @gast
|
59
|
+
end
|
60
|
+
|
61
|
+
#=========================================================================
|
62
|
+
# Greenwich apparent sidereal time (Unit: deg)
|
63
|
+
#
|
64
|
+
# @param: <none>
|
65
|
+
# @return: @gast_deg
|
66
|
+
#=========================================================================
|
67
|
+
def gast_deg
|
68
|
+
@gast = gast unless @gast
|
69
|
+
@gast_deg = @gast / Const::PI_180
|
70
|
+
return @gast_deg
|
71
|
+
end
|
72
|
+
|
73
|
+
#=========================================================================
|
74
|
+
# Greenwich apparent sidereal time (Unit: HMS)
|
75
|
+
#
|
76
|
+
# @param: <none>
|
77
|
+
# @return: @gast_hms
|
78
|
+
#=========================================================================
|
79
|
+
def gast_hms
|
80
|
+
@gast_deg = gast_deg unless @gast_deg
|
81
|
+
@gast_hms = deg2hms(@gast_deg)
|
82
|
+
return @gast_hms
|
83
|
+
end
|
84
|
+
|
85
|
+
#=========================================================================
|
86
|
+
# Greenwich mean sidereal time, IAU 2006. (Unit: rad)
|
87
|
+
#
|
88
|
+
# @param: <none>
|
89
|
+
# @return: @gmst
|
90
|
+
#=========================================================================
|
91
|
+
def gmst
|
92
|
+
@era = @e.calc_era(@jd, @t) unless @era
|
93
|
+
@gmst = @e.calc_gmst(@era, @jc)
|
94
|
+
return @gmst
|
95
|
+
end
|
96
|
+
|
97
|
+
#=========================================================================
|
98
|
+
# Greenwich mean sidereal time, IAU 2006. (Unit: deg)
|
99
|
+
#
|
100
|
+
# @param: <none>
|
101
|
+
# @return: @gmst_geg
|
102
|
+
#=========================================================================
|
103
|
+
def gmst_deg
|
104
|
+
@gmst = gmst unless @gast
|
105
|
+
@gmst_deg = @gmst / Const::PI_180
|
106
|
+
return @gmst_deg
|
107
|
+
end
|
108
|
+
|
109
|
+
#=========================================================================
|
110
|
+
# Greenwich mean sidereal time, IAU 2006. (Unit: HMS)
|
111
|
+
#
|
112
|
+
# @param: <none>
|
113
|
+
# @return: @gmst_hms
|
114
|
+
#=========================================================================
|
115
|
+
def gmst_hms
|
116
|
+
@gmst_deg = gmst_deg unless @gmst_deg
|
117
|
+
@gmst_hms = deg2hms(@gmst_deg)
|
118
|
+
return @gmst_hms
|
119
|
+
end
|
120
|
+
|
121
|
+
#=========================================================================
|
122
|
+
# Equation of Equinoxes (Unit: rad)
|
123
|
+
#
|
124
|
+
# @param: <none>
|
125
|
+
# @return: @ee
|
126
|
+
#=========================================================================
|
127
|
+
def ee
|
128
|
+
@gast = gast unless @gast
|
129
|
+
@gmst = gmst unless @gmst
|
130
|
+
@ee = @e.calc_ee(@gast, @gmst)
|
131
|
+
return @ee
|
132
|
+
end
|
133
|
+
|
134
|
+
#=========================================================================
|
135
|
+
# Equation of Equinoxes (Unit: deg)
|
136
|
+
#
|
137
|
+
# @param: <none>
|
138
|
+
# @return: @ee_deg
|
139
|
+
#=========================================================================
|
140
|
+
def ee_deg
|
141
|
+
@ee = ee unless @ee
|
142
|
+
@ee_deg = @ee / Const::PI_180
|
143
|
+
return @ee_deg
|
144
|
+
end
|
145
|
+
|
146
|
+
#=========================================================================
|
147
|
+
# Equation of Equinoxes (Unit: HMS)
|
148
|
+
#
|
149
|
+
# @param: <none>
|
150
|
+
# @return: @ee_hms
|
151
|
+
#=========================================================================
|
152
|
+
def ee_hms
|
153
|
+
@ee_deg = ee_deg unless @ee_deg
|
154
|
+
@ee_hms = deg2hms(@ee_deg)
|
155
|
+
return @ee_hms
|
156
|
+
end
|
157
|
+
|
158
|
+
private
|
159
|
+
|
160
|
+
#-------------------------------------------------------------------------
|
161
|
+
# ユリウス世紀数の計算
|
162
|
+
#
|
163
|
+
# @param: jd (Julian Day)
|
164
|
+
# @return: jc (Julian Centry)
|
165
|
+
#-------------------------------------------------------------------------
|
166
|
+
def calc_jc(jd)
|
167
|
+
return (jd - Const::J2000) / Const::JC
|
168
|
+
rescue => e
|
169
|
+
raise
|
170
|
+
end
|
171
|
+
|
172
|
+
#-------------------------------------------------------------------------
|
173
|
+
# 行列の積 (3x3)
|
174
|
+
#
|
175
|
+
# @param: r_1 (3x3-matrix)
|
176
|
+
# @param: r_2 (3x3-matrix)
|
177
|
+
# @return: r (3x3-matrix)
|
178
|
+
#-------------------------------------------------------------------------
|
179
|
+
def prod_mtx(r_1, r_2)
|
180
|
+
r = Array.new(3).map { |a| Array.new(3, 0.0) }
|
181
|
+
|
182
|
+
begin
|
183
|
+
0.upto(2) do |i|
|
184
|
+
0.upto(2) do |j|
|
185
|
+
r[i][j] = (0..2).inject(0.0) { |s, k| s + r_1[i][k] * r_2[k][j] }
|
186
|
+
end
|
187
|
+
end
|
188
|
+
return r
|
189
|
+
rescue => e
|
190
|
+
raise
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def deg2hms(deg)
|
195
|
+
sign = ""
|
196
|
+
|
197
|
+
begin
|
198
|
+
h = (deg / 15.0).truncate
|
199
|
+
_m = (deg - h * 15.0) * 4.0
|
200
|
+
m = _m.truncate
|
201
|
+
s = (_m - m) * 60.0
|
202
|
+
if s < 0
|
203
|
+
s *= -1
|
204
|
+
sign = "-"
|
205
|
+
end
|
206
|
+
return sprintf("%s%d h %02d m %06.3f s", sign, h, m, s)
|
207
|
+
rescue => e
|
208
|
+
raise
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
data/lib/mk_greenwich.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "date"
|
2
|
+
require "eph_bpn"
|
3
|
+
require "mk_time"
|
4
|
+
require "mk_greenwich/version"
|
5
|
+
require "mk_greenwich/argument"
|
6
|
+
require "mk_greenwich/const"
|
7
|
+
require "mk_greenwich/cip_cio"
|
8
|
+
require "mk_greenwich/era_eors"
|
9
|
+
require "mk_greenwich/greenwich"
|
10
|
+
|
11
|
+
module MkGreenwich
|
12
|
+
def self.new(arg)
|
13
|
+
arg ||= Time.now.strftime("%Y%m%d%H%M%S")
|
14
|
+
ut = MkGreenwich::Argument.new(arg).get_utc
|
15
|
+
return unless ut
|
16
|
+
return MkGreenwich::Greenwich.new(ut)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mk_greenwich/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mk_greenwich"
|
8
|
+
spec.version = MkGreenwich::VERSION
|
9
|
+
spec.authors = ["komasaru"]
|
10
|
+
spec.email = ["masaru@mk-mode.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Greenwich time calculation tool.}
|
13
|
+
spec.description = %q{MkGreenwich is a Greenwich time calculation tool.}
|
14
|
+
spec.homepage = "https://github.com/komasaru/mk_greenwich"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
#else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
#end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_dependency "eph_bpn"
|
31
|
+
spec.add_dependency "mk_time"
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mk_greenwich
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- komasaru
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: eph_bpn
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mk_time
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description: MkGreenwich is a Greenwich time calculation tool.
|
84
|
+
email:
|
85
|
+
- masaru@mk-mode.com
|
86
|
+
executables:
|
87
|
+
- mk_greenwich
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- Gemfile
|
95
|
+
- Guardfile
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- exe/mk_greenwich
|
102
|
+
- lib/mk_greenwich.rb
|
103
|
+
- lib/mk_greenwich/argument.rb
|
104
|
+
- lib/mk_greenwich/cip_cio.rb
|
105
|
+
- lib/mk_greenwich/const.rb
|
106
|
+
- lib/mk_greenwich/era_eors.rb
|
107
|
+
- lib/mk_greenwich/fundamental_argument.rb
|
108
|
+
- lib/mk_greenwich/greenwich.rb
|
109
|
+
- lib/mk_greenwich/version.rb
|
110
|
+
- mk_greenwich.gemspec
|
111
|
+
homepage: https://github.com/komasaru/mk_greenwich
|
112
|
+
licenses:
|
113
|
+
- MIT
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.6.6
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: Greenwich time calculation tool.
|
135
|
+
test_files: []
|