1 #include "erfa.h"
2 #include "erfam.h"
3 #include <stdlib.h>
4 
eraMoon98(double date1,double date2,double pv[2][3])5 void eraMoon98 ( double date1, double date2, double pv[2][3] )
6 /*
7 **  - - - - - - - - - -
8 **   e r a M o o n 9 8
9 **  - - - - - - - - - -
10 **
11 **  Approximate geocentric position and velocity of the Moon.
12 **
13 **  n.b. Not IAU-endorsed and without canonical status.
14 **
15 **  Given:
16 **     date1  double         TT date part A (Notes 1,4)
17 **     date2  double         TT date part B (Notes 1,4)
18 **
19 **  Returned:
20 **     pv     double[2][3]   Moon p,v, GCRS (AU, AU/d, Note 5)
21 **
22 **  Notes:
23 **
24 **  1) The TT date date1+date2 is a Julian Date, apportioned in any
25 **     convenient way between the two arguments.  For example,
26 **     JD(TT)=2450123.7 could be expressed in any of these ways, among
27 **     others:
28 **
29 **            date1          date2
30 **
31 **         2450123.7           0.0       (JD method)
32 **         2451545.0       -1421.3       (J2000 method)
33 **         2400000.5       50123.2       (MJD method)
34 **         2450123.5           0.2       (date & time method)
35 **
36 **     The JD method is the most natural and convenient to use in cases
37 **     where the loss of several decimal digits of resolution is
38 **     acceptable.  The J2000 method is best matched to the way the
39 **     argument is handled internally and will deliver the optimum
40 **     resolution.  The MJD method and the date & time methods are both
41 **     good compromises between resolution and convenience.  The limited
42 **     accuracy of the present algorithm is such that any of the methods
43 **     is satisfactory.
44 **
45 **  2) This function is a full implementation of the algorithm
46 **     published by Meeus (see reference) except that the light-time
47 **     correction to the Moon's mean longitude has been omitted.
48 **
49 **  3) Comparisons with ELP/MPP02 over the interval 1950-2100 gave RMS
50 **     errors of 2.9 arcsec in geocentric direction, 6.1 km in position
51 **     and 36 mm/s in velocity.  The worst case errors were 18.3 arcsec
52 **     in geocentric direction, 31.7 km in position and 172 mm/s in
53 **     velocity.
54 **
55 **  4) The original algorithm is expressed in terms of "dynamical time",
56 **     which can either be TDB or TT without any significant change in
57 **     accuracy.  UT cannot be used without incurring significant errors
58 **     (30 arcsec in the present era) due to the Moon's 0.5 arcsec/sec
59 **     movement.
60 **
61 **  5) The result is with respect to the GCRS (the same as J2000.0 mean
62 **     equator and equinox to within 23 mas).
63 **
64 **  6) Velocity is obtained by a complete analytical differentiation
65 **     of the Meeus model.
66 **
67 **  7) The Meeus algorithm generates position and velocity in mean
68 **     ecliptic coordinates of date, which the present function then
69 **     rotates into GCRS.  Because the ecliptic system is precessing,
70 **     there is a coupling between this spin (about 1.4 degrees per
71 **     century) and the Moon position that produces a small velocity
72 **     contribution.  In the present function this effect is neglected
73 **     as it corresponds to a maximum difference of less than 3 mm/s and
74 **     increases the RMS error by only 0.4%.
75 **
76 **  References:
77 **
78 **     Meeus, J., Astronomical Algorithms, 2nd edition, Willmann-Bell,
79 **     1998, p337.
80 **
81 **     Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
82 **     Francou, G. & Laskar, J., Astron.Astrophys., 1994, 282, 663
83 **
84 **  Defined in erfam.h:
85 **     ERFA_DAU           astronomical unit (m)
86 **     ERFA_DJC           days per Julian century
87 **     ERFA_DJ00          reference epoch (J2000.0), Julian Date
88 **     ERFA_DD2R          degrees to radians
89 **
90 **  Called:
91 **     eraS2pv      spherical coordinates to pv-vector
92 **     eraPfw06     bias-precession F-W angles, IAU 2006
93 **     eraIr        initialize r-matrix to identity
94 **     eraRz        rotate around Z-axis
95 **     eraRx        rotate around X-axis
96 **     eraRxpv      product of r-matrix and pv-vector
97 **
98 **  This revision:  2021 May 11
99 **
100 **  Copyright (C) 2013-2021, NumFOCUS Foundation.
101 **  Derived, with permission, from the SOFA library.  See notes at end of file.
102 */
103 {
104 /*
105 **  Coefficients for fundamental arguments:
106 **
107 **  . Powers of time in Julian centuries
108 **  . Units are degrees.
109 */
110 
111 /* Moon's mean longitude (wrt mean equinox and ecliptic of date) */
112    static double elp0 = 218.31665436,        /* Simon et al. (1994). */
113                  elp1 = 481267.88123421,
114                  elp2 = -0.0015786,
115                  elp3 = 1.0 / 538841.0,
116                  elp4 = -1.0 / 65194000.0;
117    double elp, delp;
118 
119 /* Moon's mean elongation */
120    static double d0 = 297.8501921,
121                  d1 = 445267.1114034,
122                  d2 = -0.0018819,
123                  d3 = 1.0 / 545868.0,
124                  d4 = 1.0 / 113065000.0;
125    double d, dd;
126 
127 /* Sun's mean anomaly */
128    static double em0 = 357.5291092,
129                  em1 = 35999.0502909,
130                  em2 = -0.0001536,
131                  em3 = 1.0 / 24490000.0,
132                  em4 = 0.0;
133    double em, dem;
134 
135 /* Moon's mean anomaly */
136    static double emp0 = 134.9633964,
137                  emp1 = 477198.8675055,
138                  emp2 = 0.0087414,
139                  emp3 = 1.0 / 69699.0,
140                  emp4 = -1.0 / 14712000.0;
141    double emp, demp;
142 
143 /* Mean distance of the Moon from its ascending node */
144    static double f0 = 93.2720950,
145                  f1 = 483202.0175233,
146                  f2 = -0.0036539,
147                  f3 = 1.0 / 3526000.0,
148                  f4 = 1.0 / 863310000.0;
149    double f, df;
150 
151 /*
152 ** Other arguments
153 */
154 
155 /* Meeus A_1, due to Venus (deg) */
156    static double a10 = 119.75,
157                  a11 = 131.849;
158    double a1, da1;
159 
160 /* Meeus A_2, due to Jupiter (deg) */
161    static double a20 = 53.09,
162                  a21 = 479264.290;
163    double a2, da2;
164 
165 /* Meeus A_3, due to sidereal motion of the Moon in longitude (deg) */
166    static double a30 = 313.45,
167                  a31 = 481266.484;
168    double a3, da3;
169 
170 /* Coefficients for Meeus "additive terms" (deg) */
171    static double al1 =  0.003958,
172                  al2 =  0.001962,
173                  al3 =  0.000318;
174    static double ab1 = -0.002235,
175                  ab2 =  0.000382,
176                  ab3 =  0.000175,
177                  ab4 =  0.000175,
178                  ab5 =  0.000127,
179                  ab6 = -0.000115;
180 
181 /* Fixed term in distance (m) */
182    static double r0 = 385000560.0;
183 
184 /* Coefficients for (dimensionless) E factor */
185    static double e1 = -0.002516,
186                  e2 = -0.0000074;
187    double e, de, esq, desq;
188 
189 /*
190 ** Coefficients for Moon longitude and distance series
191 */
192    struct termlr {
193       int nd;           /* multiple of D  in argument           */
194       int nem;          /*     "    "  M   "    "               */
195       int nemp;         /*     "    "  M'  "    "               */
196       int nf;           /*     "    "  F   "    "               */
197       double coefl;     /* coefficient of L sine argument (deg) */
198       double coefr;     /* coefficient of R cosine argument (m) */
199    };
200 
201 static struct termlr tlr[] = {{0,  0,  1,  0,  6.288774, -20905355.0},
202                               {2,  0, -1,  0,  1.274027,  -3699111.0},
203                               {2,  0,  0,  0,  0.658314,  -2955968.0},
204                               {0,  0,  2,  0,  0.213618,   -569925.0},
205                               {0,  1,  0,  0, -0.185116,     48888.0},
206                               {0,  0,  0,  2, -0.114332,     -3149.0},
207                               {2,  0, -2,  0,  0.058793,    246158.0},
208                               {2, -1, -1,  0,  0.057066,   -152138.0},
209                               {2,  0,  1,  0,  0.053322,   -170733.0},
210                               {2, -1,  0,  0,  0.045758,   -204586.0},
211                               {0,  1, -1,  0, -0.040923,   -129620.0},
212                               {1,  0,  0,  0, -0.034720,    108743.0},
213                               {0,  1,  1,  0, -0.030383,    104755.0},
214                               {2,  0,  0, -2,  0.015327,     10321.0},
215                               {0,  0,  1,  2, -0.012528,         0.0},
216                               {0,  0,  1, -2,  0.010980,     79661.0},
217                               {4,  0, -1,  0,  0.010675,    -34782.0},
218                               {0,  0,  3,  0,  0.010034,    -23210.0},
219                               {4,  0, -2,  0,  0.008548,    -21636.0},
220                               {2,  1, -1,  0, -0.007888,     24208.0},
221                               {2,  1,  0,  0, -0.006766,     30824.0},
222                               {1,  0, -1,  0, -0.005163,     -8379.0},
223                               {1,  1,  0,  0,  0.004987,    -16675.0},
224                               {2, -1,  1,  0,  0.004036,    -12831.0},
225                               {2,  0,  2,  0,  0.003994,    -10445.0},
226                               {4,  0,  0,  0,  0.003861,    -11650.0},
227                               {2,  0, -3,  0,  0.003665,     14403.0},
228                               {0,  1, -2,  0, -0.002689,     -7003.0},
229                               {2,  0, -1,  2, -0.002602,         0.0},
230                               {2, -1, -2,  0,  0.002390,     10056.0},
231                               {1,  0,  1,  0, -0.002348,      6322.0},
232                               {2, -2,  0,  0,  0.002236,     -9884.0},
233                               {0,  1,  2,  0, -0.002120,      5751.0},
234                               {0,  2,  0,  0, -0.002069,         0.0},
235                               {2, -2, -1,  0,  0.002048,     -4950.0},
236                               {2,  0,  1, -2, -0.001773,      4130.0},
237                               {2,  0,  0,  2, -0.001595,         0.0},
238                               {4, -1, -1,  0,  0.001215,     -3958.0},
239                               {0,  0,  2,  2, -0.001110,         0.0},
240                               {3,  0, -1,  0, -0.000892,      3258.0},
241                               {2,  1,  1,  0, -0.000810,      2616.0},
242                               {4, -1, -2,  0,  0.000759,     -1897.0},
243                               {0,  2, -1,  0, -0.000713,     -2117.0},
244                               {2,  2, -1,  0, -0.000700,      2354.0},
245                               {2,  1, -2,  0,  0.000691,         0.0},
246                               {2, -1,  0, -2,  0.000596,         0.0},
247                               {4,  0,  1,  0,  0.000549,     -1423.0},
248                               {0,  0,  4,  0,  0.000537,     -1117.0},
249                               {4, -1,  0,  0,  0.000520,     -1571.0},
250                               {1,  0, -2,  0, -0.000487,     -1739.0},
251                               {2,  1,  0, -2, -0.000399,         0.0},
252                               {0,  0,  2, -2, -0.000381,     -4421.0},
253                               {1,  1,  1,  0,  0.000351,         0.0},
254                               {3,  0, -2,  0, -0.000340,         0.0},
255                               {4,  0, -3,  0,  0.000330,         0.0},
256                               {2, -1,  2,  0,  0.000327,         0.0},
257                               {0,  2,  1,  0, -0.000323,      1165.0},
258                               {1,  1, -1,  0,  0.000299,         0.0},
259                               {2,  0,  3,  0,  0.000294,         0.0},
260                               {2,  0, -1, -2,  0.000000,      8752.0}};
261 
262    static int NLR = ( sizeof tlr / sizeof ( struct termlr ) );
263 
264 /*
265 ** Coefficients for Moon latitude series
266 */
267    struct termb {
268       int nd;           /* multiple of D  in argument           */
269       int nem;          /*     "    "  M   "    "               */
270       int nemp;         /*     "    "  M'  "    "               */
271       int nf;           /*     "    "  F   "    "               */
272       double coefb;     /* coefficient of B sine argument (deg) */
273    };
274 
275 static struct termb tb[] = {{0,  0,  0,  1,  5.128122},
276                             {0,  0,  1,  1,  0.280602},
277                             {0,  0,  1, -1,  0.277693},
278                             {2,  0,  0, -1,  0.173237},
279                             {2,  0, -1,  1,  0.055413},
280                             {2,  0, -1, -1,  0.046271},
281                             {2,  0,  0,  1,  0.032573},
282                             {0,  0,  2,  1,  0.017198},
283                             {2,  0,  1, -1,  0.009266},
284                             {0,  0,  2, -1,  0.008822},
285                             {2, -1,  0, -1,  0.008216},
286                             {2,  0, -2, -1,  0.004324},
287                             {2,  0,  1,  1,  0.004200},
288                             {2,  1,  0, -1, -0.003359},
289                             {2, -1, -1,  1,  0.002463},
290                             {2, -1,  0,  1,  0.002211},
291                             {2, -1, -1, -1,  0.002065},
292                             {0,  1, -1, -1, -0.001870},
293                             {4,  0, -1, -1,  0.001828},
294                             {0,  1,  0,  1, -0.001794},
295                             {0,  0,  0,  3, -0.001749},
296                             {0,  1, -1,  1, -0.001565},
297                             {1,  0,  0,  1, -0.001491},
298                             {0,  1,  1,  1, -0.001475},
299                             {0,  1,  1, -1, -0.001410},
300                             {0,  1,  0, -1, -0.001344},
301                             {1,  0,  0, -1, -0.001335},
302                             {0,  0,  3,  1,  0.001107},
303                             {4,  0,  0, -1,  0.001021},
304                             {4,  0, -1,  1,  0.000833},
305                             {0,  0,  1, -3,  0.000777},
306                             {4,  0, -2,  1,  0.000671},
307                             {2,  0,  0, -3,  0.000607},
308                             {2,  0,  2, -1,  0.000596},
309                             {2, -1,  1, -1,  0.000491},
310                             {2,  0, -2,  1, -0.000451},
311                             {0,  0,  3, -1,  0.000439},
312                             {2,  0,  2,  1,  0.000422},
313                             {2,  0, -3, -1,  0.000421},
314                             {2,  1, -1,  1, -0.000366},
315                             {2,  1,  0,  1, -0.000351},
316                             {4,  0,  0,  1,  0.000331},
317                             {2, -1,  1,  1,  0.000315},
318                             {2, -2,  0, -1,  0.000302},
319                             {0,  0,  1,  3, -0.000283},
320                             {2,  1,  1, -1, -0.000229},
321                             {1,  1,  0, -1,  0.000223},
322                             {1,  1,  0,  1,  0.000223},
323                             {0,  1, -2, -1, -0.000220},
324                             {2,  1, -1, -1, -0.000220},
325                             {1,  0,  1,  1, -0.000185},
326                             {2, -1, -2, -1,  0.000181},
327                             {0,  1,  2,  1, -0.000177},
328                             {4,  0, -2, -1,  0.000176},
329                             {4, -1, -1, -1,  0.000166},
330                             {1,  0,  1, -1, -0.000164},
331                             {4,  0,  1, -1,  0.000132},
332                             {1,  0, -1, -1, -0.000119},
333                             {4, -1,  0, -1,  0.000115},
334                             {2, -2,  0,  1,  0.000107}};
335 
336    static int NB = ( sizeof tb / sizeof ( struct termb ) );
337 
338 /* Miscellaneous */
339    int n, i;
340    double t, elpmf, delpmf, vel, vdel, vr, vdr, a1mf, da1mf, a1pf,
341           da1pf, dlpmp, slpmp, vb, vdb, v, dv, emn, empn, dn, fn, en,
342           den, arg, darg, farg, coeff, el, del, r, dr, b, db, gamb,
343           phib, psib, epsa, rm[3][3];
344 
345 /* ------------------------------------------------------------------ */
346 
347 /* Centuries since J2000.0 */
348    t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;
349 
350 /* --------------------- */
351 /* Fundamental arguments */
352 /* --------------------- */
353 
354 /* Arguments (radians) and derivatives (radians per Julian century)
355    for the current date. */
356 
357 /* Moon's mean longitude. */
358    elp = ERFA_DD2R * fmod ( elp0
359                    + ( elp1
360                    + ( elp2
361                    + ( elp3
362                    +   elp4 * t ) * t ) * t ) * t, 360.0 );
363    delp = ERFA_DD2R * (     elp1
364                    + ( elp2 * 2.0
365                    + ( elp3 * 3.0
366                    +   elp4 * 4.0 * t ) * t ) * t );
367 
368 /* Moon's mean elongation. */
369    d = ERFA_DD2R * fmod ( d0
370                  + ( d1
371                  + ( d2
372                  + ( d3
373                  +   d4 * t ) * t ) * t ) * t, 360.0 );
374    dd = ERFA_DD2R * (     d1
375                  + ( d2 * 2.0
376                  + ( d3 * 3.0
377                  +   d4 * 4.0 * t ) * t ) * t );
378 
379 /* Sun's mean anomaly. */
380    em = ERFA_DD2R * fmod ( em0
381                   + ( em1
382                   + ( em2
383                   + ( em3
384                   +   em4 * t ) * t ) * t ) * t, 360.0 );
385    dem = ERFA_DD2R * (     em1
386                   + ( em2 * 2.0
387                   + ( em3 * 3.0
388                   +   em4 * 4.0 * t ) * t ) * t );
389 
390 /* Moon's mean anomaly. */
391    emp = ERFA_DD2R * fmod ( emp0
392                    + ( emp1
393                    + ( emp2
394                    + ( emp3
395                    +   emp4 * t ) * t ) * t ) * t, 360.0 );
396    demp = ERFA_DD2R * (     emp1
397                    + ( emp2 * 2.0
398                    + ( emp3 * 3.0
399                    +   emp4 * 4.0 * t ) * t ) * t );
400 
401 /* Mean distance of the Moon from its ascending node. */
402    f = ERFA_DD2R * fmod ( f0
403                  + ( f1
404                  + ( f2
405                  + ( f3
406                  +   f4 * t ) * t ) * t ) * t, 360.0 );
407    df = ERFA_DD2R * (     f1
408                  + ( f2 * 2.0
409                  + ( f3 * 3.0
410                  +   f4 * 4.0 * t ) * t ) * t );
411 
412 /* Meeus further arguments. */
413    a1 = ERFA_DD2R * ( a10 + a11*t );
414    da1 = ERFA_DD2R * al1;
415    a2 = ERFA_DD2R * ( a20 + a21*t );
416    da2 = ERFA_DD2R * a21;
417    a3 = ERFA_DD2R * ( a30 + a31*t );
418    da3 = ERFA_DD2R * a31;
419 
420 /* E-factor, and square. */
421    e = 1.0 + ( e1 + e2*t ) * t;
422    de = e1 + 2.0*e2*t;
423    esq = e*e;
424    desq = 2.0*e*de;
425 
426 /* Use the Meeus additive terms (deg) to start off the summations. */
427    elpmf = elp - f;
428    delpmf = delp - df;
429    vel = al1 * sin(a1)
430        + al2 * sin(elpmf)
431        + al3 * sin(a2);
432    vdel = al1 * cos(a1) * da1
433         + al2 * cos(elpmf) * delpmf
434         + al3 * cos(a2) * da2;
435 
436    vr = 0.0;
437    vdr = 0.0;
438 
439    a1mf = a1 - f;
440    da1mf = da1 - df;
441    a1pf = a1 + f;
442    da1pf = da1 + df;
443    dlpmp = elp - emp;
444    slpmp = elp + emp;
445    vb = ab1 * sin(elp)
446       + ab2 * sin(a3)
447       + ab3 * sin(a1mf)
448       + ab4 * sin(a1pf)
449       + ab5 * sin(dlpmp)
450       + ab6 * sin(slpmp);
451    vdb = ab1 * cos(elp) * delp
452        + ab2 * cos(a3) * da3
453        + ab3 * cos(a1mf) * da1mf
454        + ab4 * cos(a1pf) * da1pf
455        + ab5 * cos(dlpmp) * (delp-demp)
456        + ab6 * cos(slpmp) * (delp+demp);
457 
458 /* ----------------- */
459 /* Series expansions */
460 /* ----------------- */
461 
462 /* Longitude and distance plus derivatives. */
463    for ( n = NLR-1; n >= 0; n-- ) {
464       dn = (double) tlr[n].nd;
465       emn = (double) ( i = tlr[n].nem );
466       empn = (double) tlr[n].nemp;
467       fn = (double) tlr[n].nf;
468       switch ( abs(i) ) {
469       case 1:
470          en = e;
471          den = de;
472          break;
473       case 2:
474          en = esq;
475          den = desq;
476          break;
477       default:
478          en = 1.0;
479          den = 0.0;
480       }
481       arg = dn*d + emn*em + empn*emp + fn*f;
482       darg = dn*dd + emn*dem + empn*demp + fn*df;
483       farg = sin(arg);
484       v = farg * en;
485       dv = cos(arg)*darg*en + farg*den;
486       coeff = tlr[n].coefl;
487       vel += coeff * v;
488       vdel += coeff * dv;
489       farg = cos(arg);
490       v = farg * en;
491       dv = -sin(arg)*darg*en + farg*den;
492       coeff = tlr[n].coefr;
493       vr += coeff * v;
494       vdr += coeff * dv;
495    }
496    el = elp + ERFA_DD2R*vel;
497    del = ( delp + ERFA_DD2R*vdel ) / ERFA_DJC;
498    r = ( vr + r0 ) / ERFA_DAU;
499    dr = vdr / ERFA_DAU / ERFA_DJC;
500 
501 /* Latitude plus derivative. */
502    for ( n = NB-1; n >= 0; n-- ) {
503       dn = (double) tb[n].nd;
504       emn = (double) ( i = tb[n].nem );
505       empn = (double) tb[n].nemp;
506       fn = (double) tb[n].nf;
507       switch ( abs(i) ) {
508       case 1:
509          en = e;
510          den = de;
511          break;
512       case 2:
513          en = esq;
514          den = desq;
515          break;
516       default:
517          en = 1.0;
518          den = 0.0;
519       }
520       arg = dn*d + emn*em + empn*emp + fn*f;
521       darg = dn*dd + emn*dem + empn*demp + fn*df;
522       farg = sin(arg);
523       v = farg * en;
524       dv = cos(arg)*darg*en + farg*den;
525       coeff = tb[n].coefb;
526       vb += coeff * v;
527       vdb += coeff * dv;
528    }
529    b = vb * ERFA_DD2R;
530    db = vdb * ERFA_DD2R / ERFA_DJC;
531 
532 /* ------------------------------ */
533 /* Transformation into final form */
534 /* ------------------------------ */
535 
536 /* Longitude, latitude to x, y, z (AU). */
537    eraS2pv ( el, b, r, del, db, dr, pv );
538 
539 /* IAU 2006 Fukushima-Williams bias+precession angles. */
540    eraPfw06 ( date1, date2, &gamb, &phib, &psib, &epsa );
541 
542 /* Mean ecliptic coordinates to GCRS rotation matrix. */
543    eraIr ( rm );
544    eraRz ( psib, rm );
545    eraRx ( -phib, rm );
546    eraRz ( -gamb, rm );
547 
548 /* Rotate the Moon position and velocity into GCRS (Note 6). */
549    eraRxpv ( rm, pv, pv );
550 
551 /* Finished. */
552 
553 }
554 /*----------------------------------------------------------------------
555 **
556 **
557 **  Copyright (C) 2013-2021, NumFOCUS Foundation.
558 **  All rights reserved.
559 **
560 **  This library is derived, with permission, from the International
561 **  Astronomical Union's "Standards of Fundamental Astronomy" library,
562 **  available from http://www.iausofa.org.
563 **
564 **  The ERFA version is intended to retain identical functionality to
565 **  the SOFA library, but made distinct through different function and
566 **  file names, as set out in the SOFA license conditions.  The SOFA
567 **  original has a role as a reference standard for the IAU and IERS,
568 **  and consequently redistribution is permitted only in its unaltered
569 **  state.  The ERFA version is not subject to this restriction and
570 **  therefore can be included in distributions which do not support the
571 **  concept of "read only" software.
572 **
573 **  Although the intent is to replicate the SOFA API (other than
574 **  replacement of prefix names) and results (with the exception of
575 **  bugs;  any that are discovered will be fixed), SOFA is not
576 **  responsible for any errors found in this version of the library.
577 **
578 **  If you wish to acknowledge the SOFA heritage, please acknowledge
579 **  that you are using a library derived from SOFA, rather than SOFA
580 **  itself.
581 **
582 **
583 **  TERMS AND CONDITIONS
584 **
585 **  Redistribution and use in source and binary forms, with or without
586 **  modification, are permitted provided that the following conditions
587 **  are met:
588 **
589 **  1 Redistributions of source code must retain the above copyright
590 **    notice, this list of conditions and the following disclaimer.
591 **
592 **  2 Redistributions in binary form must reproduce the above copyright
593 **    notice, this list of conditions and the following disclaimer in
594 **    the documentation and/or other materials provided with the
595 **    distribution.
596 **
597 **  3 Neither the name of the Standards Of Fundamental Astronomy Board,
598 **    the International Astronomical Union nor the names of its
599 **    contributors may be used to endorse or promote products derived
600 **    from this software without specific prior written permission.
601 **
602 **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
603 **  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
604 **  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
605 **  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
606 **  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
607 **  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
608 **  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
609 **  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
610 **  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
611 **  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
612 **  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
613 **  POSSIBILITY OF SUCH DAMAGE.
614 **
615 */
616