equationoftime 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.buildpath +5 -0
- data/.project +17 -0
- data/.rvmrc +1 -0
- data/.settings/org.eclipse.ltk.core.refactoring.prefs +2 -0
- data/Makefile +238 -0
- data/Rakefile +40 -3
- data/analemma_data.yml +2925 -0
- data/equationoftime.gemspec +6 -3
- data/examples/analemma_data_generator.rb +12 -12
- data/examples/celes_parts/.RUBYARCHDIR.time +0 -0
- data/examples/celes_parts/.cproject +56 -0
- data/examples/celes_parts/.project +78 -0
- data/examples/celes_parts/a2af.c +120 -0
- data/examples/celes_parts/a2tf.c +116 -0
- data/examples/celes_parts/af2a.c +107 -0
- data/examples/celes_parts/anp.c +82 -0
- data/examples/celes_parts/anpm.c +82 -0
- data/examples/celes_parts/bi00.c +116 -0
- data/examples/celes_parts/bp00.c +173 -0
- data/examples/celes_parts/bp06.c +136 -0
- data/examples/celes_parts/bpn2xy.c +100 -0
- data/examples/celes_parts/c2i00a.c +139 -0
- data/examples/celes_parts/c2i00b.c +139 -0
- data/examples/celes_parts/c2i06a.c +136 -0
- data/examples/celes_parts/c2ibpn.c +142 -0
- data/examples/celes_parts/c2ixy.c +131 -0
- data/examples/celes_parts/c2ixys.c +123 -0
- data/examples/celes_parts/c2s.c +96 -0
- data/examples/celes_parts/c2t00a.c +154 -0
- data/examples/celes_parts/c2t00b.c +150 -0
- data/examples/celes_parts/c2t06a.c +152 -0
- data/examples/celes_parts/c2tcio.c +122 -0
- data/examples/celes_parts/c2teqx.c +122 -0
- data/examples/celes_parts/c2tpe.c +167 -0
- data/examples/celes_parts/c2txy.c +159 -0
- data/examples/celes_parts/cal2jd.c +139 -0
- data/examples/celes_parts/celes_core.c +2522 -0
- data/examples/celes_parts/cp.c +80 -0
- data/examples/celes_parts/cpv.c +82 -0
- data/examples/celes_parts/cr.c +83 -0
- data/examples/celes_parts/d2dtf.c +206 -0
- data/examples/celes_parts/d2tf.c +160 -0
- data/examples/celes_parts/dat.c +289 -0
- data/examples/celes_parts/depend +25 -0
- data/examples/celes_parts/dtdb.c +1213 -0
- data/examples/celes_parts/dtf2d.c +196 -0
- data/examples/celes_parts/ee00.c +128 -0
- data/examples/celes_parts/ee00a.c +135 -0
- data/examples/celes_parts/ee00b.c +141 -0
- data/examples/celes_parts/ee06a.c +122 -0
- data/examples/celes_parts/eect00.c +282 -0
- data/examples/celes_parts/eform.c +147 -0
- data/examples/celes_parts/eo06a.c +131 -0
- data/examples/celes_parts/eors.c +108 -0
- data/examples/celes_parts/epb.c +96 -0
- data/examples/celes_parts/epb2jd.c +91 -0
- data/examples/celes_parts/epj.c +93 -0
- data/examples/celes_parts/epj2jd.c +91 -0
- data/examples/celes_parts/epv00.c +2589 -0
- data/examples/celes_parts/eqeq94.c +131 -0
- data/examples/celes_parts/era00.c +136 -0
- data/examples/celes_parts/extconf.rb +4 -0
- data/examples/celes_parts/fad03.c +103 -0
- data/examples/celes_parts/fae03.c +102 -0
- data/examples/celes_parts/faf03.c +106 -0
- data/examples/celes_parts/faju03.c +102 -0
- data/examples/celes_parts/fal03.c +103 -0
- data/examples/celes_parts/falp03.c +103 -0
- data/examples/celes_parts/fama03.c +102 -0
- data/examples/celes_parts/fame03.c +102 -0
- data/examples/celes_parts/fane03.c +99 -0
- data/examples/celes_parts/faom03.c +104 -0
- data/examples/celes_parts/fapa03.c +103 -0
- data/examples/celes_parts/fasa03.c +102 -0
- data/examples/celes_parts/faur03.c +99 -0
- data/examples/celes_parts/fave03.c +102 -0
- data/examples/celes_parts/fk52h.c +143 -0
- data/examples/celes_parts/fk5hip.c +126 -0
- data/examples/celes_parts/fk5hz.c +160 -0
- data/examples/celes_parts/fw2m.c +134 -0
- data/examples/celes_parts/fw2xy.c +120 -0
- data/examples/celes_parts/gc2gd.c +134 -0
- data/examples/celes_parts/gc2gde.c +200 -0
- data/examples/celes_parts/gd2gc.c +134 -0
- data/examples/celes_parts/gd2gce.c +138 -0
- data/examples/celes_parts/gmst00.c +145 -0
- data/examples/celes_parts/gmst06.c +136 -0
- data/examples/celes_parts/gmst82.c +151 -0
- data/examples/celes_parts/gst00a.c +138 -0
- data/examples/celes_parts/gst00b.c +146 -0
- data/examples/celes_parts/gst06.c +140 -0
- data/examples/celes_parts/gst06a.c +131 -0
- data/examples/celes_parts/gst94.c +131 -0
- data/examples/celes_parts/h2fk5.c +148 -0
- data/examples/celes_parts/hfk5z.c +175 -0
- data/examples/celes_parts/ir.c +83 -0
- data/examples/celes_parts/jd2cal.c +155 -0
- data/examples/celes_parts/jdcalf.c +161 -0
- data/examples/celes_parts/num00a.c +121 -0
- data/examples/celes_parts/num00b.c +121 -0
- data/examples/celes_parts/num06a.c +125 -0
- data/examples/celes_parts/numat.c +109 -0
- data/examples/celes_parts/nut00a.c +2047 -0
- data/examples/celes_parts/nut00b.c +372 -0
- data/examples/celes_parts/nut06a.c +153 -0
- data/examples/celes_parts/nut80.c +325 -0
- data/examples/celes_parts/nutm80.c +117 -0
- data/examples/celes_parts/obl06.c +118 -0
- data/examples/celes_parts/obl80.c +118 -0
- data/examples/celes_parts/p06e.c +321 -0
- data/examples/celes_parts/p2pv.c +83 -0
- data/examples/celes_parts/p2s.c +91 -0
- data/examples/celes_parts/pap.c +139 -0
- data/examples/celes_parts/pas.c +96 -0
- data/examples/celes_parts/pb06.c +144 -0
- data/examples/celes_parts/pdp.c +84 -0
- data/examples/celes_parts/pfw06.c +165 -0
- data/examples/celes_parts/plan94.c +514 -0
- data/examples/celes_parts/pm.c +83 -0
- data/examples/celes_parts/pmat00.c +118 -0
- data/examples/celes_parts/pmat06.c +122 -0
- data/examples/celes_parts/pmat76.c +141 -0
- data/examples/celes_parts/pmp.c +85 -0
- data/examples/celes_parts/pn.c +109 -0
- data/examples/celes_parts/pn00.c +177 -0
- data/examples/celes_parts/pn00a.c +162 -0
- data/examples/celes_parts/pn00b.c +162 -0
- data/examples/celes_parts/pn06.c +187 -0
- data/examples/celes_parts/pn06a.c +152 -0
- data/examples/celes_parts/pnm00a.c +121 -0
- data/examples/celes_parts/pnm00b.c +121 -0
- data/examples/celes_parts/pnm06a.c +124 -0
- data/examples/celes_parts/pnm80.c +126 -0
- data/examples/celes_parts/pom00.c +115 -0
- data/examples/celes_parts/ppp.c +85 -0
- data/examples/celes_parts/ppsp.c +94 -0
- data/examples/celes_parts/pr00.c +142 -0
- data/examples/celes_parts/prec76.c +148 -0
- data/examples/celes_parts/pv2p.c +81 -0
- data/examples/celes_parts/pv2s.c +144 -0
- data/examples/celes_parts/pvdpv.c +102 -0
- data/examples/celes_parts/pvm.c +86 -0
- data/examples/celes_parts/pvmpv.c +87 -0
- data/examples/celes_parts/pvppv.c +87 -0
- data/examples/celes_parts/pvstar.c +207 -0
- data/examples/celes_parts/pvu.c +93 -0
- data/examples/celes_parts/pvup.c +88 -0
- data/examples/celes_parts/pvxpv.c +107 -0
- data/examples/celes_parts/pxp.c +94 -0
- data/examples/celes_parts/rm2v.c +111 -0
- data/examples/celes_parts/rv2m.c +118 -0
- data/examples/celes_parts/rx.c +110 -0
- data/examples/celes_parts/rxp.c +99 -0
- data/examples/celes_parts/rxpv.c +86 -0
- data/examples/celes_parts/rxr.c +99 -0
- data/examples/celes_parts/ry.c +110 -0
- data/examples/celes_parts/rz.c +110 -0
- data/examples/celes_parts/s00.c +371 -0
- data/examples/celes_parts/s00a.c +143 -0
- data/examples/celes_parts/s00b.c +143 -0
- data/examples/celes_parts/s06.c +368 -0
- data/examples/celes_parts/s06a.c +145 -0
- data/examples/celes_parts/s2c.c +85 -0
- data/examples/celes_parts/s2p.c +88 -0
- data/examples/celes_parts/s2pv.c +103 -0
- data/examples/celes_parts/s2xpv.c +87 -0
- data/examples/celes_parts/sepp.c +105 -0
- data/examples/celes_parts/seps.c +93 -0
- data/examples/celes_parts/sofa.h +379 -0
- data/examples/celes_parts/sofam.h +155 -0
- data/examples/celes_parts/sp00.c +118 -0
- data/examples/celes_parts/starpm.c +205 -0
- data/examples/celes_parts/starpv.c +264 -0
- data/examples/celes_parts/sxp.c +84 -0
- data/examples/celes_parts/sxpv.c +85 -0
- data/examples/celes_parts/taitt.c +110 -0
- data/examples/celes_parts/taiut1.c +112 -0
- data/examples/celes_parts/taiutc.c +182 -0
- data/examples/celes_parts/tcbtdb.c +132 -0
- data/examples/celes_parts/tcgtt.c +109 -0
- data/examples/celes_parts/tdbtcb.c +137 -0
- data/examples/celes_parts/tdbtt.c +122 -0
- data/examples/celes_parts/test_celes.rb +48 -0
- data/examples/celes_parts/tf2a.c +107 -0
- data/examples/celes_parts/tf2d.c +107 -0
- data/examples/celes_parts/tr.c +93 -0
- data/examples/celes_parts/trxp.c +93 -0
- data/examples/celes_parts/trxpv.c +93 -0
- data/examples/celes_parts/tttai.c +110 -0
- data/examples/celes_parts/tttcg.c +112 -0
- data/examples/celes_parts/tttdb.c +121 -0
- data/examples/celes_parts/ttut1.c +110 -0
- data/examples/celes_parts/ut1tai.c +111 -0
- data/examples/celes_parts/ut1tt.c +110 -0
- data/examples/celes_parts/ut1utc.c +193 -0
- data/examples/celes_parts/utctai.c +163 -0
- data/examples/celes_parts/utcut1.c +151 -0
- data/examples/celes_parts/xy06.c +2758 -0
- data/examples/celes_parts/xys00a.c +133 -0
- data/examples/celes_parts/xys00b.c +133 -0
- data/examples/celes_parts/xys06a.c +133 -0
- data/examples/celes_parts/zp.c +77 -0
- data/examples/celes_parts/zpv.c +79 -0
- data/examples/celes_parts/zr.c +83 -0
- data/examples/check_date_type.rb +2 -4
- data/examples/compare_geoc_long_ra.rb +19 -11
- data/examples/data_table_for_astro_dog.rb +40 -0
- data/examples/earth_rotation.rb +28 -3
- data/examples/eot.c +15 -0
- data/examples/eot.h +2 -0
- data/examples/eot_methods_list.rb +30 -3
- data/examples/eot_suntimes.rb +99 -95
- data/examples/extconf.rb +2 -0
- data/examples/{read_nutation_data.rb → gmst_gast_non_sofa.rb} +103 -98
- data/examples/nutation_table5_3a.yaml +1658 -1658
- data/examples/rbeot.c +24 -0
- data/examples/test_eot.rb +17 -0
- data/examples/test_poly_eval.rb +6 -17
- data/examples/time_scales.rb +4 -7
- data/examples/times_year.rb +50 -0
- data/examples/usage_example.rb +15 -5
- data/examples/use_angles.rb +151 -87
- data/lib/eot/angles.rb +130 -177
- data/lib/eot/constants.rb +41 -44
- data/lib/eot/displays.rb +40 -37
- data/lib/eot/geo_lat_lng_smt.rb +7 -6
- data/lib/eot/init.rb +62 -39
- data/lib/eot/nutation.rb +53 -45
- data/lib/eot/times.rb +32 -41
- data/lib/eot/utilities.rb +11 -90
- data/lib/eot/version.rb +3 -2
- data/rise_set_data.yml +1461 -0
- data/run_tests_eclipse.rb +1 -0
- data/tests/minitest/aliased_angles_spec.rb +119 -165
- data/tests/minitest/aliased_displays_spec.rb +41 -39
- data/tests/minitest/aliased_utilities_spec.rb +11 -22
- data/tests/minitest/angles_spec.rb +134 -181
- data/tests/minitest/constants_spec.rb +4 -10
- data/tests/minitest/delta_epsilon_spec.rb +13 -16
- data/tests/minitest/displays_spec.rb +39 -37
- data/tests/minitest/geo_spec.rb +15 -11
- data/tests/minitest/init_spec.rb +30 -16
- data/tests/minitest/nutation_spec.rb +19 -13
- data/tests/minitest/times_spec.rb +77 -75
- data/tests/minitest/utilities_spec.rb +10 -94
- data/wiki.md +7 -9
- metadata +218 -26
- data/examples/data_table.rb +0 -26
- data/lib/eot/nutation_table5_3a.yaml +0 -9532
- data/tests/minitest/aliased_times_spec.rb +0 -36
@@ -0,0 +1,160 @@
|
|
1
|
+
#include "sofam.h"
|
2
|
+
|
3
|
+
void iauD2tf(int ndp, double days, char *sign, int ihmsf[4])
|
4
|
+
/*
|
5
|
+
** - - - - - - - -
|
6
|
+
** i a u D 2 t f
|
7
|
+
** - - - - - - - -
|
8
|
+
**
|
9
|
+
** Decompose days to hours, minutes, seconds, fraction.
|
10
|
+
**
|
11
|
+
** Status: vector/matrix support function.
|
12
|
+
**
|
13
|
+
** Given:
|
14
|
+
** ndp int resolution (Note 1)
|
15
|
+
** days double interval in days
|
16
|
+
**
|
17
|
+
** Returned:
|
18
|
+
** sign char '+' or '-'
|
19
|
+
** ihmsf int[4] hours, minutes, seconds, fraction
|
20
|
+
**
|
21
|
+
** Notes:
|
22
|
+
**
|
23
|
+
** 1) The argument ndp is interpreted as follows:
|
24
|
+
**
|
25
|
+
** ndp resolution
|
26
|
+
** : ...0000 00 00
|
27
|
+
** -7 1000 00 00
|
28
|
+
** -6 100 00 00
|
29
|
+
** -5 10 00 00
|
30
|
+
** -4 1 00 00
|
31
|
+
** -3 0 10 00
|
32
|
+
** -2 0 01 00
|
33
|
+
** -1 0 00 10
|
34
|
+
** 0 0 00 01
|
35
|
+
** 1 0 00 00.1
|
36
|
+
** 2 0 00 00.01
|
37
|
+
** 3 0 00 00.001
|
38
|
+
** : 0 00 00.000...
|
39
|
+
**
|
40
|
+
** 2) The largest positive useful value for ndp is determined by the
|
41
|
+
** size of days, the format of double on the target platform, and
|
42
|
+
** the risk of overflowing ihmsf[3]. On a typical platform, for
|
43
|
+
** days up to 1.0, the available floating-point precision might
|
44
|
+
** correspond to ndp=12. However, the practical limit is typically
|
45
|
+
** ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is
|
46
|
+
** only 16 bits.
|
47
|
+
**
|
48
|
+
** 3) The absolute value of days may exceed 1.0. In cases where it
|
49
|
+
** does not, it is up to the caller to test for and handle the
|
50
|
+
** case where days is very nearly 1.0 and rounds up to 24 hours,
|
51
|
+
** by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
|
52
|
+
**
|
53
|
+
** This revision: 2008 May 17
|
54
|
+
**
|
55
|
+
** Original version 2012-03-01
|
56
|
+
**
|
57
|
+
** Copyright (C) 2013 Naoki Arita. See notes at end.
|
58
|
+
*/
|
59
|
+
{
|
60
|
+
int nrs, n;
|
61
|
+
double rs, rm, rh, a, w, ah, am, as, af;
|
62
|
+
|
63
|
+
|
64
|
+
/* Handle sign. */
|
65
|
+
*sign = (char) ( ( days >= 0.0 ) ? '+' : '-' );
|
66
|
+
|
67
|
+
/* Interval in seconds. */
|
68
|
+
a = DAYSEC * fabs(days);
|
69
|
+
|
70
|
+
/* Pre-round if resolution coarser than 1s (then pretend ndp=1). */
|
71
|
+
if (ndp < 0) {
|
72
|
+
nrs = 1;
|
73
|
+
for (n = 1; n <= -ndp; n++) {
|
74
|
+
nrs *= (n == 2 || n == 4) ? 6 : 10;
|
75
|
+
}
|
76
|
+
rs = (double) nrs;
|
77
|
+
w = a / rs;
|
78
|
+
a = rs * dnint(w);
|
79
|
+
}
|
80
|
+
|
81
|
+
/* Express the unit of each field in resolution units. */
|
82
|
+
nrs = 1;
|
83
|
+
for (n = 1; n <= ndp; n++) {
|
84
|
+
nrs *= 10;
|
85
|
+
}
|
86
|
+
rs = (double) nrs;
|
87
|
+
rm = rs * 60.0;
|
88
|
+
rh = rm * 60.0;
|
89
|
+
|
90
|
+
/* Round the interval and express in resolution units. */
|
91
|
+
a = dnint(rs * a);
|
92
|
+
|
93
|
+
/* Break into fields. */
|
94
|
+
ah = a / rh;
|
95
|
+
ah = dint(ah);
|
96
|
+
a -= ah * rh;
|
97
|
+
am = a / rm;
|
98
|
+
am = dint(am);
|
99
|
+
a -= am * rm;
|
100
|
+
as = a / rs;
|
101
|
+
as = dint(as);
|
102
|
+
af = a - as * rs;
|
103
|
+
|
104
|
+
/* Return results. */
|
105
|
+
ihmsf[0] = (int) ah;
|
106
|
+
ihmsf[1] = (int) am;
|
107
|
+
ihmsf[2] = (int) as;
|
108
|
+
ihmsf[3] = (int) af;
|
109
|
+
|
110
|
+
return;
|
111
|
+
|
112
|
+
/*----------------------------------------------------------------------
|
113
|
+
**
|
114
|
+
** Celes is a wrapper of the SOFA Library for Ruby.
|
115
|
+
**
|
116
|
+
** This file is redistributed and relicensed in accordance with
|
117
|
+
** the SOFA Software License (http://www.iausofa.org/tandc.html).
|
118
|
+
**
|
119
|
+
** The original library is available from IAU Standards of
|
120
|
+
** Fundamental Astronomy (http://www.iausofa.org/).
|
121
|
+
**
|
122
|
+
**
|
123
|
+
**
|
124
|
+
**
|
125
|
+
**
|
126
|
+
** Copyright (C) 2013, Naoki Arita
|
127
|
+
** All rights reserved.
|
128
|
+
**
|
129
|
+
** Redistribution and use in source and binary forms, with or without
|
130
|
+
** modification, are permitted provided that the following conditions
|
131
|
+
** are met:
|
132
|
+
**
|
133
|
+
** 1 Redistributions of source code must retain the above copyright
|
134
|
+
** notice, this list of conditions and the following disclaimer.
|
135
|
+
**
|
136
|
+
** 2 Redistributions in binary form must reproduce the above copyright
|
137
|
+
** notice, this list of conditions and the following disclaimer in
|
138
|
+
** the documentation and/or other materials provided with the
|
139
|
+
** distribution.
|
140
|
+
**
|
141
|
+
** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
|
142
|
+
** the International Astronomical Union nor the names of its
|
143
|
+
** contributors may be used to endorse or promote products derived
|
144
|
+
** from this software without specific prior written permission.
|
145
|
+
**
|
146
|
+
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
147
|
+
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
148
|
+
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
149
|
+
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
150
|
+
** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
151
|
+
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
152
|
+
** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
153
|
+
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
154
|
+
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
155
|
+
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
156
|
+
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
157
|
+
** POSSIBILITY OF SUCH DAMAGE.
|
158
|
+
**
|
159
|
+
**--------------------------------------------------------------------*/
|
160
|
+
}
|
@@ -0,0 +1,289 @@
|
|
1
|
+
#include "sofam.h"
|
2
|
+
|
3
|
+
int iauDat(int iy, int im, int id, double fd, double *deltat )
|
4
|
+
/*
|
5
|
+
** - - - - - - -
|
6
|
+
** i a u D a t
|
7
|
+
** - - - - - - -
|
8
|
+
**
|
9
|
+
** For a given UTC date, calculate delta(AT) = TAI-UTC.
|
10
|
+
**
|
11
|
+
** :------------------------------------------:
|
12
|
+
** : :
|
13
|
+
** : IMPORTANT :
|
14
|
+
** : :
|
15
|
+
** : A new version of this function must be :
|
16
|
+
** : produced whenever a new leap second is :
|
17
|
+
** : announced. There are four items to :
|
18
|
+
** : change on each such occasion: :
|
19
|
+
** : :
|
20
|
+
** : 1) A new line must be added to the set :
|
21
|
+
** : of statements that initialize the :
|
22
|
+
** : array "changes". :
|
23
|
+
** : :
|
24
|
+
** : 2) The parameter IYV must be set to :
|
25
|
+
** : the current year. :
|
26
|
+
** : :
|
27
|
+
** : 3) The "Latest leap second" comment :
|
28
|
+
** : below must be set to the new leap :
|
29
|
+
** : second date. :
|
30
|
+
** : :
|
31
|
+
** : 4) The "This revision" comment, later, :
|
32
|
+
** : must be set to the current date. :
|
33
|
+
** : :
|
34
|
+
** : Change (2) must also be carried out :
|
35
|
+
** : whenever the function is re-issued, :
|
36
|
+
** : even if no leap seconds have been :
|
37
|
+
** : added. :
|
38
|
+
** : :
|
39
|
+
** : Latest leap second: 2012 June 30 :
|
40
|
+
** : :
|
41
|
+
** :__________________________________________:
|
42
|
+
**
|
43
|
+
** Status: support function.
|
44
|
+
**
|
45
|
+
** Given:
|
46
|
+
** iy int UTC: year (Notes 1 and 2)
|
47
|
+
** im int month (Note 2)
|
48
|
+
** id int day (Notes 2 and 3)
|
49
|
+
** fd double fraction of day (Note 4)
|
50
|
+
**
|
51
|
+
** Returned:
|
52
|
+
** deltat double TAI minus UTC, seconds
|
53
|
+
**
|
54
|
+
** Returned (function value):
|
55
|
+
** int status (Note 5):
|
56
|
+
** 1 = dubious year (Note 1)
|
57
|
+
** 0 = OK
|
58
|
+
** -1 = bad year
|
59
|
+
** -2 = bad month
|
60
|
+
** -3 = bad day (Note 3)
|
61
|
+
** -4 = bad fraction (Note 4)
|
62
|
+
**
|
63
|
+
** Notes:
|
64
|
+
**
|
65
|
+
** 1) UTC began at 1960 January 1.0 (JD 2436934.5) and it is improper
|
66
|
+
** to call the function with an earlier date. If this is attempted,
|
67
|
+
** zero is returned together with a warning status.
|
68
|
+
**
|
69
|
+
** Because leap seconds cannot, in principle, be predicted in
|
70
|
+
** advance, a reliable check for dates beyond the valid range is
|
71
|
+
** impossible. To guard against gross errors, a year five or more
|
72
|
+
** after the release year of the present function (see parameter
|
73
|
+
** IYV) is considered dubious. In this case a warning status is
|
74
|
+
** returned but the result is computed in the normal way.
|
75
|
+
**
|
76
|
+
** For both too-early and too-late years, the warning status is
|
77
|
+
** j=+1. This is distinct from the error status j=-1, which
|
78
|
+
** signifies a year so early that JD could not be computed.
|
79
|
+
**
|
80
|
+
** 2) If the specified date is for a day which ends with a leap second,
|
81
|
+
** the UTC-TAI value returned is for the period leading up to the
|
82
|
+
** leap second. If the date is for a day which begins as a leap
|
83
|
+
** second ends, the UTC-TAI returned is for the period following the
|
84
|
+
** leap second.
|
85
|
+
**
|
86
|
+
** 3) The day number must be in the normal calendar range, for example
|
87
|
+
** 1 through 30 for April. The "almanac" convention of allowing
|
88
|
+
** such dates as January 0 and December 32 is not supported in this
|
89
|
+
** function, in order to avoid confusion near leap seconds.
|
90
|
+
**
|
91
|
+
** 4) The fraction of day is used only for dates before the
|
92
|
+
** introduction of leap seconds, the first of which occurred at the
|
93
|
+
** end of 1971. It is tested for validity (0 to 1 is the valid
|
94
|
+
** range) even if not used; if invalid, zero is used and status
|
95
|
+
** j=-4 is returned. For many applications, setting fd to zero is
|
96
|
+
** acceptable; the resulting error is always less than 3 ms (and
|
97
|
+
** occurs only pre-1972).
|
98
|
+
**
|
99
|
+
** 5) The status value returned in the case where there are multiple
|
100
|
+
** errors refers to the first error detected. For example, if the
|
101
|
+
** month and day are 13 and 32 respectively, j=-2 (bad month)
|
102
|
+
** will be returned.
|
103
|
+
**
|
104
|
+
** 6) In cases where a valid result is not available, zero is returned.
|
105
|
+
**
|
106
|
+
** References:
|
107
|
+
**
|
108
|
+
** 1) For dates from 1961 January 1 onwards, the expressions from the
|
109
|
+
** file ftp://maia.usno.navy.mil/ser7/tai-utc.dat are used.
|
110
|
+
**
|
111
|
+
** 2) The 5ms timestep at 1961 January 1 is taken from 2.58.1 (p87) of
|
112
|
+
** the 1992 Explanatory Supplement.
|
113
|
+
**
|
114
|
+
** Called:
|
115
|
+
** iauCal2jd Gregorian calendar to Julian Day number
|
116
|
+
**
|
117
|
+
** This revision: 2012 June 14
|
118
|
+
**
|
119
|
+
** Original version 2012-03-01
|
120
|
+
**
|
121
|
+
** Copyright (C) 2013 Naoki Arita. See notes at end.
|
122
|
+
*/
|
123
|
+
{
|
124
|
+
/* Release year for this version of iauDat */
|
125
|
+
#define IYV (2012)
|
126
|
+
|
127
|
+
/* Reference dates (MJD) and drift rates (s/day), pre leap seconds */
|
128
|
+
static const double drift[][2] = {
|
129
|
+
{ 37300.0, 0.0012960 },
|
130
|
+
{ 37300.0, 0.0012960 },
|
131
|
+
{ 37300.0, 0.0012960 },
|
132
|
+
{ 37665.0, 0.0011232 },
|
133
|
+
{ 37665.0, 0.0011232 },
|
134
|
+
{ 38761.0, 0.0012960 },
|
135
|
+
{ 38761.0, 0.0012960 },
|
136
|
+
{ 38761.0, 0.0012960 },
|
137
|
+
{ 38761.0, 0.0012960 },
|
138
|
+
{ 38761.0, 0.0012960 },
|
139
|
+
{ 38761.0, 0.0012960 },
|
140
|
+
{ 38761.0, 0.0012960 },
|
141
|
+
{ 39126.0, 0.0025920 },
|
142
|
+
{ 39126.0, 0.0025920 }
|
143
|
+
};
|
144
|
+
|
145
|
+
/* Number of Delta(AT) expressions before leap seconds were introduced */
|
146
|
+
#define NERA1 ((int) (sizeof drift / sizeof (double) / 2))
|
147
|
+
|
148
|
+
/* Dates and Delta(AT)s */
|
149
|
+
static const struct {
|
150
|
+
int iyear, month;
|
151
|
+
double delat;
|
152
|
+
} changes[] = {
|
153
|
+
{ 1960, 1, 1.4178180 },
|
154
|
+
{ 1961, 1, 1.4228180 },
|
155
|
+
{ 1961, 8, 1.3728180 },
|
156
|
+
{ 1962, 1, 1.8458580 },
|
157
|
+
{ 1963, 11, 1.9458580 },
|
158
|
+
{ 1964, 1, 3.2401300 },
|
159
|
+
{ 1964, 4, 3.3401300 },
|
160
|
+
{ 1964, 9, 3.4401300 },
|
161
|
+
{ 1965, 1, 3.5401300 },
|
162
|
+
{ 1965, 3, 3.6401300 },
|
163
|
+
{ 1965, 7, 3.7401300 },
|
164
|
+
{ 1965, 9, 3.8401300 },
|
165
|
+
{ 1966, 1, 4.3131700 },
|
166
|
+
{ 1968, 2, 4.2131700 },
|
167
|
+
{ 1972, 1, 10.0 },
|
168
|
+
{ 1972, 7, 11.0 },
|
169
|
+
{ 1973, 1, 12.0 },
|
170
|
+
{ 1974, 1, 13.0 },
|
171
|
+
{ 1975, 1, 14.0 },
|
172
|
+
{ 1976, 1, 15.0 },
|
173
|
+
{ 1977, 1, 16.0 },
|
174
|
+
{ 1978, 1, 17.0 },
|
175
|
+
{ 1979, 1, 18.0 },
|
176
|
+
{ 1980, 1, 19.0 },
|
177
|
+
{ 1981, 7, 20.0 },
|
178
|
+
{ 1982, 7, 21.0 },
|
179
|
+
{ 1983, 7, 22.0 },
|
180
|
+
{ 1985, 7, 23.0 },
|
181
|
+
{ 1988, 1, 24.0 },
|
182
|
+
{ 1990, 1, 25.0 },
|
183
|
+
{ 1991, 1, 26.0 },
|
184
|
+
{ 1992, 7, 27.0 },
|
185
|
+
{ 1993, 7, 28.0 },
|
186
|
+
{ 1994, 7, 29.0 },
|
187
|
+
{ 1996, 1, 30.0 },
|
188
|
+
{ 1997, 7, 31.0 },
|
189
|
+
{ 1999, 1, 32.0 },
|
190
|
+
{ 2006, 1, 33.0 },
|
191
|
+
{ 2009, 1, 34.0 },
|
192
|
+
{ 2012, 7, 35.0 }
|
193
|
+
};
|
194
|
+
|
195
|
+
/* Number of Delta(AT) changes */
|
196
|
+
const int NDAT = sizeof changes / sizeof changes[0];
|
197
|
+
|
198
|
+
/* Miscellaneous local variables */
|
199
|
+
int j, i, m;
|
200
|
+
double da, djm0, djm;
|
201
|
+
|
202
|
+
|
203
|
+
/* Initialize the result to zero. */
|
204
|
+
*deltat = da = 0.0;
|
205
|
+
|
206
|
+
/* If invalid fraction of a day, set error status and give up. */
|
207
|
+
if (fd < 0.0 || fd > 1.0) return -4;
|
208
|
+
|
209
|
+
/* Convert the date into an MJD. */
|
210
|
+
j = iauCal2jd(iy, im, id, &djm0, &djm);
|
211
|
+
|
212
|
+
/* If invalid year, month, or day, give up. */
|
213
|
+
if (j < 0) return j;
|
214
|
+
|
215
|
+
/* If pre-UTC year, set warning status and give up. */
|
216
|
+
if (iy < changes[0].iyear) return 1;
|
217
|
+
|
218
|
+
/* If suspiciously late year, set warning status but proceed. */
|
219
|
+
if (iy > IYV + 5) j = 1;
|
220
|
+
|
221
|
+
/* Combine year and month to form a date-ordered integer... */
|
222
|
+
m = 12*iy + im;
|
223
|
+
|
224
|
+
/* ...and use it to find the preceding table entry. */
|
225
|
+
for (i = NDAT-1; i >=0; i--) {
|
226
|
+
if (m >= (12 * changes[i].iyear + changes[i].month)) break;
|
227
|
+
}
|
228
|
+
|
229
|
+
/* Get the Delta(AT). */
|
230
|
+
da = changes[i].delat;
|
231
|
+
|
232
|
+
/* If pre-1972, adjust for drift. */
|
233
|
+
if (i < NERA1) da += (djm + fd - drift[i][0]) * drift[i][1];
|
234
|
+
|
235
|
+
/* Return the Delta(AT) value. */
|
236
|
+
*deltat = da;
|
237
|
+
|
238
|
+
/* Return the status. */
|
239
|
+
return j;
|
240
|
+
|
241
|
+
/*----------------------------------------------------------------------
|
242
|
+
**
|
243
|
+
** Celes is a wrapper of the SOFA Library for Ruby.
|
244
|
+
**
|
245
|
+
** This file is redistributed and relicensed in accordance with
|
246
|
+
** the SOFA Software License (http://www.iausofa.org/tandc.html).
|
247
|
+
**
|
248
|
+
** The original library is available from IAU Standards of
|
249
|
+
** Fundamental Astronomy (http://www.iausofa.org/).
|
250
|
+
**
|
251
|
+
**
|
252
|
+
**
|
253
|
+
**
|
254
|
+
**
|
255
|
+
** Copyright (C) 2013, Naoki Arita
|
256
|
+
** All rights reserved.
|
257
|
+
**
|
258
|
+
** Redistribution and use in source and binary forms, with or without
|
259
|
+
** modification, are permitted provided that the following conditions
|
260
|
+
** are met:
|
261
|
+
**
|
262
|
+
** 1 Redistributions of source code must retain the above copyright
|
263
|
+
** notice, this list of conditions and the following disclaimer.
|
264
|
+
**
|
265
|
+
** 2 Redistributions in binary form must reproduce the above copyright
|
266
|
+
** notice, this list of conditions and the following disclaimer in
|
267
|
+
** the documentation and/or other materials provided with the
|
268
|
+
** distribution.
|
269
|
+
**
|
270
|
+
** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
|
271
|
+
** the International Astronomical Union nor the names of its
|
272
|
+
** contributors may be used to endorse or promote products derived
|
273
|
+
** from this software without specific prior written permission.
|
274
|
+
**
|
275
|
+
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
276
|
+
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
277
|
+
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
278
|
+
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
279
|
+
** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
280
|
+
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
281
|
+
** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
282
|
+
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
283
|
+
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
284
|
+
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
285
|
+
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
286
|
+
** POSSIBILITY OF SUCH DAMAGE.
|
287
|
+
**
|
288
|
+
**--------------------------------------------------------------------*/
|
289
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
celes_core.o: celes_core.c sofa.h sofam.h a2af.c a2tf.c af2a.c \
|
2
|
+
anp.c anpm.c bi00.c bp00.c bp06.c bpn2xy.c c2i00a.c c2i00b.c \
|
3
|
+
c2i06a.c c2ibpn.c c2ixy.c c2ixys.c c2s.c c2t00a.c c2t00b.c \
|
4
|
+
c2t06a.c c2tcio.c c2teqx.c c2tpe.c c2txy.c cal2jd.c cp.c cpv.c \
|
5
|
+
cr.c d2dtf.c d2tf.c dat.c dtdb.c dtf2d.c ee00.c ee00a.c ee00b.c \
|
6
|
+
ee06a.c eect00.c eform.c eo06a.c eors.c epb.c epb2jd.c epj.c \
|
7
|
+
epj2jd.c epv00.c eqeq94.c era00.c fad03.c fae03.c faf03.c \
|
8
|
+
faju03.c fal03.c falp03.c fama03.c fame03.c fane03.c faom03.c \
|
9
|
+
fapa03.c fasa03.c faur03.c fave03.c fk52h.c fk5hip.c fk5hz.c \
|
10
|
+
fw2m.c fw2xy.c gc2gd.c gc2gde.c gd2gc.c gd2gce.c gmst00.c \
|
11
|
+
gmst06.c gmst82.c gst00a.c gst00b.c gst06.c gst06a.c gst94.c \
|
12
|
+
h2fk5.c hfk5z.c ir.c jd2cal.c jdcalf.c num00a.c num00b.c \
|
13
|
+
num06a.c numat.c nut00a.c nut00b.c nut06a.c nut80.c nutm80.c \
|
14
|
+
obl06.c obl80.c p06e.c p2pv.c p2s.c pap.c pas.c pb06.c pdp.c \
|
15
|
+
pfw06.c plan94.c pm.c pmat00.c pmat06.c pmat76.c pmp.c pn.c \
|
16
|
+
pn00.c pn00a.c pn00b.c pn06.c pn06a.c pnm00a.c pnm00b.c \
|
17
|
+
pnm06a.c pnm80.c pom00.c ppp.c ppsp.c pr00.c prec76.c pv2p.c \
|
18
|
+
pv2s.c pvdpv.c pvm.c pvmpv.c pvppv.c pvstar.c pvu.c pvup.c \
|
19
|
+
pvxpv.c pxp.c rm2v.c rv2m.c rx.c rxp.c rxpv.c rxr.c ry.c \
|
20
|
+
rz.c s00.c s00a.c s00b.c s06.c s06a.c s2c.c s2p.c s2pv.c \
|
21
|
+
s2xpv.c sepp.c seps.c sp00.c starpm.c starpv.c sxp.c sxpv.c \
|
22
|
+
taitt.c taiut1.c taiutc.c tcbtdb.c tcgtt.c tdbtcb.c tdbtt.c \
|
23
|
+
tf2a.c tf2d.c tr.c trxp.c trxpv.c tttai.c tttcg.c tttdb.c \
|
24
|
+
ttut1.c ut1tai.c ut1tt.c ut1utc.c utctai.c utcut1.c xy06.c \
|
25
|
+
xys00a.c xys00b.c xys06a.c zp.c zpv.c zr.c
|