1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19                                 T H E
20
21
22              SSSSS           OOOOOO       FFFFFFFFFFFFF      AAAAAAA
23           SSSSSSSSSS     OOOOOOOOOOOO     FFFFFFFFFFFF      AAAAAAAA
24          SSSSSSSSSSS   OOOOOOOOOOOOOO    FFFFFFFFFFFF      AAAA AAAA
25         SSSS      S   OOOOOO    OOOOO    FFFF             AAAA  AAAA
26        SSSSS         OOOOO       OOOO   FFFFF            AAAA   AAAA
27        SSSSSSSSSS    OOOO       OOOOO   FFFFFFFFFFFF    AAAA    AAAA
28          SSSSSSSSS  OOOOO       OOOO   FFFFFFFFFFFF    AAAAAAAAAAAAA
29              SSSSS  OOOO       OOOO    FFFF           AAAAAAAAAAAAAA
30       S      SSSS   OOOOO    OOOOO    FFFF           AAAAAAAAAAAAAAA
31      SSSSSSSSSSS    OOOOOOOOOOOOO     FFFF          AAAA       AAAAA
32      SSSSSSSSS       OOOOOOOOOO      FFFF          AAAA        AAAAA
33        SSSS            OOOOO         FFFF         AAAA         AAAAA
34
35
36                            S O F T W A R E
37
38                           L I B R A R I E S
39
40
41
42
43
44
45                   International Astronomical Union
46
47                   Division A: Fundamental Astronomy
48
49
50                Standards Of Fundamental Astronomy Board
51
52
53
54
55
56                               Release 18
57
58                              2021 April 12
59
60contents.lis                                             2018 January 26
61
62
63                             --------
64                             CONTENTS
65                             --------
66
67
68
69
70
71                 1)   Introduction
72
73                 2)   The SOFA Astronomy Library
74
75                 3)   The SOFA Vector/Matrix Library
76
77                 4)   The individual routines
78
79
80                 A1   The SOFA copyright notice
81
82                 A2   Constants
83
84                 A3   SOFA Board membership
85
86intro.lis                                                  2021 April 19
87
88
89                  -------------------------------
90                  THE IAU-SOFA SOFTWARE LIBRARIES
91                  -------------------------------
92
93
94  SOFA stands for "Standards Of Fundamental Astronomy".  The SOFA
95  software libraries are a collection of subprograms, in source-
96  code form, which implement official IAU algorithms for fundamental-
97  astronomy computations.   The subprograms at present comprise 192
98  "astronomy" routines supported by 55 "vector/matrix" routines,
99  available in both Fortran77 and C implementations.
100
101
102THE SOFA INITIATIVE
103
104SOFA is an IAU Service which operates as a Standing Working Group under
105Division A (Fundamental Astronomy).
106
107The IAU set up the SOFA initiative at the 1994 General Assembly, to
108promulgate an authoritative set of fundamental-astronomy constants and
109algorithms.  At the subsequent General Assembly, in 1997, the
110appointment of a review board and the selection of a site for the SOFA
111Center (the outlet for SOFA products) were announced.
112
113The SOFA initiative was originally proposed by the IAU Working Group on
114Astronomical Standards (WGAS), under the chairmanship of
115Toshio Fukushima.  The proposal was for "...new arrangements to
116establish and maintain an accessible and authoritative set of constants,
117algorithms and procedures that implement standard models used in
118fundamental astronomy".  The SOFA Software Libraries implement the
119"algorithms" part of the SOFA initiative.  They were developed under the
120supervision of an international panel called the SOFA Board.  The
121current membership of this panel is listed in an appendix.
122
123A feature of the original SOFA software proposals was that the products
124would be self-contained and not depend on other software.  This includes
125basic documentation, which, like the present file, will mostly be plain
126ASCII text.  It should also be noted that there is no assumption that
127the software will be used on a particular computer and Operating System.
128Although OS-related facilities may be present (Unix make files for
129instance, use by the SOFA Center of automatic code management systems,
130HTML versions of some documentation), the routines themselves will be
131visible as individual text files and will run on a variety of platforms.
132
133
134ALGORITHMS
135
136The SOFA Board's initial goal has been to create a set of callable
137subprograms.  Whether "subroutines" or "functions", they are all
138referred to simply as "routines".  They are designed for use by software
139developers wishing to write complete applications;  no runnable, free-
140standing applications are included in SOFA's present plans.
141
142The algorithms are drawn from a variety of sources.  Because most of the
143routines so far developed have either been standard "text-book"
144operations or implement well-documented standard algorithms, it has not
145been necessary to invite the whole community to submit algorithms,
146though consultation with authorities has occurred where necessary.  It
147should also be noted that consistency with the conventions published by
148the International Earth Rotation Service was a stipulation in the
149original SOFA proposals, further constraining the software designs.
150This state of affairs will continue to exist for some time, as there is
151a large backlog of agreed extensions to work on.  However, in the future
152the Board may decide to call for proposals, and is in the meantime
153willing to look into any suggestions that are received by the SOFA
154Center.
155
156
157SCOPE
158
159The routines currently available are listed in the next two chapters of
160this document.
161
162The "astronomy" library comprises 192 routines (plus one obsolete
163Fortran routine that now appears under a revised name).  The areas
164addressed include calendars, astrometry, time scales, Earth rotation,
165ephemerides, precession-nutation, star catalog transformations,
166gnomonic projection, horizon/equatorial transformations and
167geodetic/geocentric transformations.
168
169The "vector-matrix" library, comprising 55 routines, contains a
170collection of simple tools for manipulating the vectors, matrices and
171angles used by the astronomy routines.
172
173There is no explicit commitment by SOFA to support historical models,
174though as time goes on a legacy of superseded models will naturally
175accumulate.  There is, for example, no support of pre-1976 precession
176models, though these capabilities could be added were there significant
177demand.
178
179Though the SOFA software libraries are rather limited in scope, and are
180likely to remain so for a considerable time, they do offer distinct
181advantages to prospective users.  In particular, the routines are:
182
183  * authoritative:  they are IAU-backed and have been constructed with
184    great care;
185
186  * practical:  they are straightforward to use in spite of being
187    precise and rigorous (to some stated degree);
188
189  * accessible and supported: they are downloadable from an easy-to-
190    find place, they are in an integrated and consistent form, they
191    come with adequate internal documentation, and help for users is
192    available.
193
194
195VERSIONS
196
197Once it has been published, an issue is never revised or updated, and
198remains accessible indefinitely.  Subsequent issues may, however,
199include corrected versions under the original routine name and
200filenames.  However, where a different model is introduced, it will have
201a different name.
202
203The issues will be referred to by the date when they were announced.
204The frequency of re-issue will be decided by the Board, taking into
205account the importance of the changes and the impact on the user
206community.
207
208
209DOCUMENTATION
210
211At present there is little free-standing documentation about individual
212routines.  However, each routine has preamble comments which specify in
213detail what the routine does and how it is used.
214
215The files sofa_pn_f.pdf and sofa_pn_c.pdf (for Fortran and C users
216respectively) describe the SOFA tools for precession-nutation
217and other aspects of Earth attitude, and include example code and,
218in an appendix, diagrams showing the interrelationships between the
219routines supporting the latest (IAU 2006/2000A) models.  Two other pairs
220of documents introduce time scale transformations (sofa_ts_f.pdf and
221sofa_ts_c.pdf ) and astrometric transformations (sofa_ast_f.pdf and
222sofa_ast_c.pdf).  Finally the two files sofa_vm_f.pdf and sofa_vm_c.pdf
223describe the vector/matrix routines used throughout SOFA.
224
225
226PROGRAMMING LANGUAGES AND STANDARDS
227
228The SOFA routines are available in two programming languages at present:
229Fortran77 and ANSI C.  Related software in other languages is under
230consideration.
231
232The Fortran code conforms to ANSI X3.9-1978 in all but two minor
233respects: each has an IMPLICIT NONE declaration, and its name has a
234prefix of "iau_" and may be longer than 6 characters.  A global edit to
235erase both of these will produce ANSI-compliant code with no change in
236its function.
237
238Coding style, and restrictions on the range of language features, have
239been much debated by the Board, and the results comply with the majority
240view.  There is (at present) no document that defines the standards, but
241the code itself offers a wide range of examples of what is acceptable.
242
243The Fortran routines contain explicit numerical constants (the INCLUDE
244statement is not part of ANSI Fortran77).  These are drawn from the
245file consts.lis, which is listed in an appendix.  Constants for the
246SOFA/C functions are defined in a header file sofam.h.
247
248The naming convention is such that a SOFA routine referred to
249generically as "EXAMPL" exists as a Fortran subprogram iau_EXAMPL and a
250C function iauExampl.  The calls for the two versions are very similar,
251with the same arguments in the same order.  In a few cases, the C
252equivalent of a Fortran SUBROUTINE subprogram uses a return value rather
253than an argument.
254
255Each language version includes a "testbed" main-program that can be used
256to verify that the SOFA routines have been correctly compiled on the end
257user's system.  The Fortran and C versions are called t_sofa_f.for and
258t_sofa_c.c respectively.  The testbeds execute every SOFA routine and
259check that the results are within expected accuracy margins.  It is not
260possible to guarantee that all platforms will meet the rather stringent
261criteria that have been used, and an occasional warning message may be
262encountered on some systems.
263
264
265COPYRIGHT ISSUES
266
267Copyright for all of the SOFA software and documentation is owned by the
268IAU SOFA Board.  The Software is made available free of charge for all
269classes of user, including commercial.  However, there are strict rules
270designed to avoid unauthorized variants coming into circulation.  It is
271permissible to distribute derived works and other modifications, but
272they must be clearly marked to avoid confusion with the SOFA originals.
273
274Further details are included in the block of comments which concludes
275every routine.  The text is also set out in an appendix to the present
276document.
277
278
279ACCURACY
280
281The SOFA policy is to organize the calculations so that the machine
282accuracy is fully exploited.  The gap between the precision of the
283underlying model or theory and the computational resolution has to be
284kept as large as possible, hopefully leaving several orders of
285magnitude of headroom.
286
287The SOFA routines in some cases involve design compromises between rigor
288and ease of use (and also speed, though nowadays this is seldom a major
289concern).
290
291
292ACKNOWLEDGEMENTS
293
294The Board is indebted to a number of contributors, who are acknowledged
295in the preamble comments of the routines concerned.
296
297The Board's effort is provided by the members' individual institutes.
298
299Resources for operating the SOFA Center are provided by Her Majesty's
300Nautical Almanac Office, operated by the United Kingdom Hydrographic
301Office.
302
303sofa_lib.lis                                               2021 April 19
304
305                     ----------------------
306                     SOFA Astronomy Library
307                     ----------------------
308
309
310PREFACE
311
312The routines described here comprise the SOFA astronomy library.  Their
313general appearance and coding style conforms to conventions agreed by
314the SOFA Board, and their functions, names and algorithms have been
315ratified by the Board.  Procedures for soliciting and agreeing additions
316to the library are still evolving.
317
318
319PROGRAMMING LANGUAGES
320
321The SOFA routines are available in two programming languages at present:
322Fortran 77 and ANSI C.
323
324Except for a single obsolete Fortran routine, which has no C equivalent,
325there is a one-to-one relationship between the two language versions.
326The naming convention is such that a SOFA routine referred to
327generically as "EXAMPL" exists as a Fortran subprogram iau_EXAMPL and a
328C function iauExampl.  The calls for the two versions are very similar,
329with the same arguments in the same order.  In a few cases, the C
330equivalent of a Fortran SUBROUTINE subprogram uses a return value rather
331than an argument.
332
333
334GENERAL PRINCIPLES
335
336The principal function of the SOFA Astronomy Library is to provide
337definitive algorithms.  A secondary function is to provide software
338suitable for convenient direct use by writers of astronomical
339applications.
340
341The astronomy routines call on the SOFA vector/matrix library routines,
342which are separately listed, and described in sofa_vm_f.pdf (Fortran)
343and sofa_vm_c.pdf (C).
344
345The routines are designed to exploit the full floating-point accuracy
346of the machines on which they run, and not to rely on compiler
347optimizations.  Within these constraints, the intention is that the code
348corresponds to the published formulation (if any).
349
350Dates are always Julian Dates (except in calendar conversion routines)
351and are expressed as two double precision numbers which sum to the
352required value.
353
354A distinction is made between routines that implement IAU-approved
355models and those that use those models to create other results.  The
356former are referred to as "canonical models" in the preamble comments;
357the latter are described as "support routines".
358
359Using the library requires knowledge of positional astronomy and
360time-scales.  These topics are covered in "Explanatory Supplement to the
361Astronomical Almanac", 3rd Edition,  Sean E. Urban &
362P. Kenneth Seidelmann (eds.), University Science Books, 2013.  Recent
363developments are documented in the scientific journals, and references
364to the relevant papers are given in the SOFA code as required.  The IERS
365Conventions are also an essential reference.  The routines concerned
366with Earth attitude (precession-nutation etc.) are described in the SOFA
367document sofa_pn.pdf.  Those concerned with transformations between
368different time scales are described in sofa_ts_f.pdf (Fortran) and
369sofa_ts_c.pdf (C).  Those concerned with astrometric transformations
370are described in sofa_ast_f.pdf (Fortran) and sofa_ast_c (C).
371
372
373ROUTINES
374
375  Calendars
376
377     CAL2JD    Gregorian calendar to Julian Day number
378     EPB       Julian Date to Besselian Epoch
379     EPB2JD    Besselian Epoch to Julian Date
380     EPJ       Julian Date to Julian Epoch
381     EPJ2JD    Julian Epoch to Julian Date
382     JD2CAL    Julian Date to Gregorian year, month, day, fraction
383     JDCALF    Julian Date to Gregorian date for formatted output
384
385  Astrometry
386
387     AB        apply stellar aberration
388     APCG      prepare for ICRS <-> GCRS, geocentric, special
389     APCG13    prepare for ICRS <-> GCRS, geocentric
390     APCI      prepare for ICRS <-> CIRS, terrestrial, special
391     APCI13    prepare for ICRS <-> CIRS, terrestrial
392     APCO      prepare for ICRS <-> observed, terrestrial, special
393     APCO13    prepare for ICRS <-> observed, terrestrial
394     APCS      prepare for ICRS <-> CIRS, space, special
395     APCS13    prepare for ICRS <-> CIRS, space
396     APER      insert ERA into context
397     APER13    update context for Earth rotation
398     APIO      prepare for CIRS <-> observed, terrestrial, special
399     APIO13    prepare for CIRS <-> observed, terrestrial
400     ATCC13    catalog -> astrometric
401     ATCCQ     quick catalog -> astrometric
402     ATCI13    catalog -> CIRS
403     ATCIQ     quick ICRS -> CIRS
404     ATCIQN    quick ICRS -> CIRS, multiple deflections
405     ATCIQZ    quick astrometric ICRS -> CIRS
406     ATCO13    ICRS -> observed
407     ATIC13    CIRS -> ICRS
408     ATICQ     quick CIRS -> ICRS
409     ATCIQN    quick CIRS -> ICRS, multiple deflections
410     ATIO13    CIRS -> observed
411     ATIOQ     quick CIRS -> observed
412     ATOC13    observed -> astrometric ICRS
413     ATOI13    observed -> CIRS
414     ATOIQ     quick observed -> CIRS
415     LD        light deflection by a single solar-system body
416     LDN       light deflection by multiple solar-system bodies
417     LDSUN     light deflection by the Sun
418     PMPX      apply proper motion and parallax
419     PMSAFE    apply proper motion, with zero-parallax precautions
420     PVTOB     observatory position and velocity
421     PVSTAR    space motion pv-vector to star catalog data
422     REFCO     refraction constants
423     STARPM    apply proper motion
424     STARPV    star catalog data to space motion pv-vector
425
426  Time scales
427
428     D2DTF     format 2-part JD for output
429     DAT       Delta(AT) (=TAI-UTC) for a given UTC date
430     DTDB      TDB-TT
431     DTF2D     encode time and date fields into 2-part JD
432     TAITT     TAI to TT
433     TAIUT1    TAI to UT1
434     TAIUTC    TAI to UTC
435     TCBTDB    TCB to TDB
436     TCGTT     TCG to TT
437     TDBTCB    TDB to TCB
438     TDBTT     TDB to TT
439     TTTAI     TT to TAI
440     TTTCG     TT to TCG
441     TTTDB     TT to TDB
442     TTUT1     TT to UT1
443     UT1TAI    UT1 to TAI
444     UT1TT     UT1 to TT
445     UT1UTC    UT1 to UTC
446     UTCTAI    UTC to TAI
447     UTCUT1    UTC to UT1
448
449  Earth rotation angle and sidereal time
450
451     EE00      equation of the equinoxes, IAU 2000
452     EE00A     equation of the equinoxes, IAU 2000A
453     EE00B     equation of the equinoxes, IAU 2000B
454     EE06A     equation of the equinoxes, IAU 2006/2000A
455     EECT00    equation of the equinoxes complementary terms, IAU 2000
456     EQEQ94    equation of the equinoxes, IAU 1994
457     ERA00     Earth rotation angle, IAU 2000
458     GMST00    Greenwich mean sidereal time, IAU 2000
459     GMST06    Greenwich mean sidereal time, IAU 2006
460     GMST82    Greenwich mean sidereal time, IAU 1982
461     GST00A    Greenwich apparent sidereal time, IAU 2000A
462     GST00B    Greenwich apparent sidereal time, IAU 2000B
463     GST06     Greenwich apparent ST, IAU 2006, given NPB matrix
464     GST06A    Greenwich apparent sidereal time, IAU 2006/2000A
465     GST94     Greenwich apparent sidereal time, IAU 1994
466
467  Ephemerides (limited precision)
468
469     EPV00     Earth position and velocity
470     MOON98    Moon position and velocity
471     PLAN94    major-planet position and velocity
472
473  Precession, nutation, polar motion
474
475     BI00      frame bias components, IAU 2000
476     BP00      frame bias and precession matrices, IAU 2000
477     BP06      frame bias and precession matrices, IAU 2006
478     BPN2XY    extract CIP X,Y coordinates from NPB matrix
479     C2I00A    celestial-to-intermediate matrix, IAU 2000A
480     C2I00B    celestial-to-intermediate matrix, IAU 2000B
481     C2I06A    celestial-to-intermediate matrix, IAU 2006/2000A
482     C2IBPN    celestial-to-intermediate matrix, given NPB matrix, IAU 2000
483     C2IXY     celestial-to-intermediate matrix, given X,Y, IAU 2000
484     C2IXYS    celestial-to-intermediate matrix, given X,Y and s
485     C2T00A    celestial-to-terrestrial matrix, IAU 2000A
486     C2T00B    celestial-to-terrestrial matrix, IAU 2000B
487     C2T06A    celestial-to-terrestrial matrix, IAU 2006/2000A
488     C2TCIO    form CIO-based celestial-to-terrestrial matrix
489     C2TEQX    form equinox-based celestial-to-terrestrial matrix
490     C2TPE     celestial-to-terrestrial matrix given nutation, IAU 2000
491     C2TXY     celestial-to-terrestrial matrix given CIP, IAU 2000
492     EO06A     equation of the origins, IAU 2006/2000A
493     EORS      equation of the origins, given NPB matrix and s
494     FW2M      Fukushima-Williams angles to r-matrix
495     FW2XY     Fukushima-Williams angles to X,Y
496     LTP       long-term precession matrix
497     LTPB      long-term precession matrix, including ICRS frame bias
498     LTPECL    long-term precession of the ecliptic
499     LTPEQU    long-term precession of the equator
500     NUM00A    nutation matrix, IAU 2000A
501     NUM00B    nutation matrix, IAU 2000B
502     NUM06A    nutation matrix, IAU 2006/2000A
503     NUMAT     form nutation matrix
504     NUT00A    nutation, IAU 2000A
505     NUT00B    nutation, IAU 2000B
506     NUT06A    nutation, IAU 2006/2000A
507     NUT80     nutation, IAU 1980
508     NUTM80    nutation matrix, IAU 1980
509     OBL06     mean obliquity, IAU 2006
510     OBL80     mean obliquity, IAU 1980
511     PB06      zeta,z,theta precession angles, IAU 2006, including bias
512     PFW06     bias-precession Fukushima-Williams angles, IAU 2006
513     PMAT00    precession matrix (including frame bias), IAU 2000
514     PMAT06    PB matrix, IAU 2006
515     PMAT76    precession matrix, IAU 1976
516     PN00      bias/precession/nutation results, IAU 2000
517     PN00A     bias/precession/nutation, IAU 2000A
518     PN00B     bias/precession/nutation, IAU 2000B
519     PN06      bias/precession/nutation results, IAU 2006
520     PN06A     bias/precession/nutation results, IAU 2006/2000A
521     PNM00A    classical NPB matrix, IAU 2000A
522     PNM00B    classical NPB matrix, IAU 2000B
523     PNM06A    classical NPB matrix, IAU 2006/2000A
524     PNM80     precession/nutation matrix, IAU 1976/1980
525     P06E      precession angles, IAU 2006, equinox based
526     POM00     polar motion matrix
527     PR00      IAU 2000 precession adjustments
528     PREC76    accumulated precession angles, IAU 1976
529     S00       the CIO locator s, given X,Y, IAU 2000A
530     S00A      the CIO locator s, IAU 2000A
531     S00B      the CIO locator s, IAU 2000B
532     S06       the CIO locator s, given X,Y, IAU 2006
533     S06A      the CIO locator s, IAU 2006/2000A
534     SP00      the TIO locator s', IERS 2003
535     XY06      CIP, IAU 2006/2000A, from series
536     XYS00A    CIP and s, IAU 2000A
537     XYS00B    CIP and s, IAU 2000B
538     XYS06A    CIP and s, IAU 2006/2000A
539
540  Fundamental arguments for nutation etc.
541
542     FAD03     mean elongation of the Moon from the Sun
543     FAE03     mean longitude of Earth
544     FAF03     mean argument of the latitude of the Moon
545     FAJU03    mean longitude of Jupiter
546     FAL03     mean anomaly of the Moon
547     FALP03    mean anomaly of the Sun
548     FAMA03    mean longitude of Mars
549     FAME03    mean longitude of Mercury
550     FANE03    mean longitude of Neptune
551     FAOM03    mean longitude of the Moon's ascending node
552     FAPA03    general accumulated precession in longitude
553     FASA03    mean longitude of Saturn
554     FAUR03    mean longitude of Uranus
555     FAVE03    mean longitude of Venus
556
557  Star catalog conversions
558
559     FK52H     transform FK5 star data into the Hipparcos system
560     FK5HIP    FK5 to Hipparcos rotation and spin
561     FK5HZ     FK5 to Hipparcos assuming zero Hipparcos proper motion
562     H2FK5     transform Hipparcos star data into the FK5 system
563     HFK5Z     Hipparcos to FK5 assuming zero Hipparcos proper motion
564     FK425     transform FK4 star data into FK5
565     FK45Z     FK4 to FK5 assuming zero FK5 proper motion
566     FK524     transform FK5 star data into FK4
567     FK54Z     FK5 to FK4 assuming zero FK5 proper motion
568
569  Ecliptic coordinates
570
571     ECEQ06    ecliptic to ICRS, IAU 2006
572     ECM06     rotation matrix, ICRS to ecliptic, IAU 2006
573     EQEC06    ICRS to ecliptic, IAU 2006
574     LTECEQ    ecliptic to ICRS, long term
575     LTECM     rotation matrix, ICRS to ecliptic, long-term
576     LTEQEC    ICRS to ecliptic, long term
577
578  Galactic coordinates
579
580     G2ICRS    transform IAU 1958 galactic coordinates to ICRS
581     ICRS2G    transform ICRS coordinates to IAU 1958 Galactic
582
583  Geodetic/geocentric
584
585     EFORM     a,f for a nominated Earth reference ellipsoid
586     GC2GD     geocentric to geodetic for a nominated ellipsoid
587     GC2GDE    geocentric to geodetic given ellipsoid a,f
588     GD2GC     geodetic to geocentric for a nominated ellipsoid
589     GD2GCE    geodetic to geocentric given ellipsoid a,f
590
591  Gnomonic projection
592
593     TPORS     solve for tangent point, spherical
594     TPORV     solve for tangent point, vector
595     TPSTS     deproject tangent plane to celestial, spherical
596     TPSTV     deproject tangent plane to celestial, vector
597     TPXES     project celestial to tangent plane, spherical
598     TPXEV     project celestial to tangent plane, vector
599
600  Horizon/equatorial
601
602     AE2HD     (azimuth, altitude) to (hour angle, declination)
603     HD2AE     (hour angle, declination) to (azimuth, altitude)
604     HD2PA     parallactic angle
605
606  Obsolete
607
608     C2TCEO    former name of C2TCIO
609
610
611CALLS: FORTRAN VERSION
612
613   CALL iau_AB     ( PNAT, V, S, BM1, PPR )
614   CALL iau_AE2HD  ( AZ, EL, PHI, HA, DEC )
615   CALL iau_APCG   ( DATE1, DATE2, EB, EH, ASTROM )
616   CALL iau_APCG13 ( DATE1, DATE2, ASTROM )
617   CALL iau_APCI   ( DATE1, DATE2, EB, EH, X, Y, S, ASTROM )
618   CALL iau_APCI13 ( DATE1, DATE2, ASTROM, EO )
619   CALL iau_APCO   ( DATE1, DATE2, EB, EH, X, Y, S,
620  :                  THETA, ELONG, PHI, HM, XP, YP, SP,
621  :                  REFA, REFB, ASTROM )
622   CALL iau_APCO13 ( UTC1, UTC2, DUT1, ELONG, PHI, HM, XP, YP,
623  :                  PHPA, TC, RH, WL, ASTROM, EO, J )
624   CALL iau_APCS   ( DATE1, DATE2, PV, EB, EH, ASTROM )
625   CALL iau_APCS13 ( DATE1, DATE2, PV, ASTROM )
626   CALL iau_APER   ( THETA, ASTROM )
627   CALL iau_APER13 ( UT11, UT12, ASTROM )
628   CALL iau_APIO   ( SP, THETA, ELONG, PHI, HM, XP, YP,
629  :                  REFA, REFB, ASTROM )
630   CALL iau_APIO13 ( UTC1, UTC2, DUT1, ELONG, PHI, HM, XP, YP,
631  :                  PHPA, TC, RH, WL, ASTROM, J )
632   CALL iau_ATCC13 ( RC, DC, PR, PD, PX, RV, DATE1, DATE2, RA, DA )
633   CALL iau_ATCCQ  ( RC, DC, PR, PD, PX, RV, ASTROM, RA, DA )
634   CALL iau_ATCI13 ( RC, DC, PR, PD, PX, RV, DATE1, DATE2, RI, DI, EO )
635   CALL iau_ATCIQ  ( RC, DC, PR, PD, PX, RV, ASTROM, RI, DI )
636   CALL iau_ATCIQN ( RC, DC, PR, PD, PX, RV, ASTROM, N, B, RI, DI )
637   CALL iau_ATCIQZ ( RC, DC, ASTROM, RI, DI )
638   CALL iau_ATCO13 ( RC, DC, PR, PD, PX, RV, UTC1, UTC2, DUT1, ELONG,
639  :                  PHI, HM, XP, YP, PHPA, TC, RH, WL,
640  :                  AOB, ZOB, HOB, DOB, ROB, EO, J )
641   CALL iau_ATIC13 ( RI, DI, DATE1, DATE2, RC, DC, EO )
642   CALL iau_ATICQ  ( RI, DI, ASTROM, RC, DC )
643   CALL iau_ATCIQN ( RI, DI, ASTROM, N, B, RC, DC )
644   CALL iau_ATIO13 ( RI, DI, UTC1, UTC2, DUT1, ELONG, PHI, HM, XP, YP,
645  :                  PHPA, TC, RH, WL, AOB, ZOB, HOB, DOB, ROB, J )
646   CALL iau_ATIOQ  ( RI, DI, ASTROM, AOB, ZOB, HOB, DOB, ROB )
647   CALL iau_ATOC13 ( TYPE, OB1, OB2, UTC1, UTC2, DUT1,
648  :                  ELONG, PHI, HM, XP, YP, PHPA, TC, RH, WL,
649  :                  RC, DC, J )
650   CALL iau_ATOI13 ( TYPE, OB1, OB2, UTC1, UTC2, DUT1,
651  :                  ELONG, PHI, HM, XP, YP, PHPA, TC, RH, WL,
652  :                  RI, DI, J  )
653   CALL iau_ATOIQ  ( TYPE, OB1, OB2, ASTROM, RI, DI )
654   CALL iau_BI00   ( DPSIBI, DEPSBI, DRA )
655   CALL iau_BP00   ( DATE1, DATE2, RB, RP, RBP )
656   CALL iau_BP06   ( DATE1, DATE2, RB, RP, RBP )
657   CALL iau_BPN2XY ( RBPN, X, Y )
658   CALL iau_C2I00A ( DATE1, DATE2, RC2I )
659   CALL iau_C2I00B ( DATE1, DATE2, RC2I )
660   CALL iau_C2I06A ( DATE1, DATE2, RC2I )
661   CALL iau_C2IBPN ( DATE1, DATE2, RBPN, RC2I )
662   CALL iau_C2IXY  ( DATE1, DATE2, X, Y, RC2I )
663   CALL iau_C2IXYS ( X, Y, S, RC2I )
664   CALL iau_C2T00A ( TTA, TTB, UTA, UTB, XP, YP, RC2T )
665   CALL iau_C2T00B ( TTA, TTB, UTA, UTB, XP, YP, RC2T )
666   CALL iau_C2T06A ( TTA, TTB, UTA, UTB, XP, YP, RC2T )
667   CALL iau_C2TCEO ( RC2I, ERA, RPOM, RC2T )
668   CALL iau_C2TCIO ( RC2I, ERA, RPOM, RC2T )
669   CALL iau_C2TEQX ( RBPN, GST, RPOM, RC2T )
670   CALL iau_C2TPE  ( TTA, TTB, UTA, UTB, DPSI, DEPS, XP, YP, RC2T )
671   CALL iau_C2TXY  ( TTA, TTB, UTA, UTB, X, Y, XP, YP, RC2T )
672   CALL iau_CAL2JD ( IY, IM, ID, DJM0, DJM, J )
673   CALL iau_D2DTF  ( SCALE, NDP, D1, D2, IY, IM, ID, IHMSF, J )
674   CALL iau_DAT    ( IY, IM, ID, FD, DELTAT, J )
675   D =  iau_DTDB   ( DATE1, DATE2, UT, ELONG, U, V )
676   CALL iau_DTF2D  ( SCALE, IY, IM, ID, IHR, IMN, SEC, D1, D2, J )
677   CALL iau_ECEQ06 ( DATE1, DATE2, DL, DB, DR, DD )
678   CALL iau_ECM06  ( DATE1, DATE2, RM );
679   D =  iau_EE00   ( DATE1, DATE2, EPSA, DPSI )
680   D =  iau_EE00A  ( DATE1, DATE2 )
681   D =  iau_EE00B  ( DATE1, DATE2 )
682   D =  iau_EE06A  ( DATE1, DATE2 )
683   D =  iau_EECT00 ( DATE1, DATE2 )
684   CALL iau_EFORM  ( N, A, F, J )
685   D =  iau_EO06A  ( DATE1, DATE2 )
686   D =  iau_EORS   ( RNPB, S )
687   D =  iau_EPB    ( DJ1, DJ2 )
688   CALL iau_EPB2JD ( EPB, DJM0, DJM )
689   D =  iau_EPJ    ( DJ1, DJ2 )
690   CALL iau_EPJ2JD ( EPJ, DJM0, DJM )
691   CALL iau_EPV00  ( DJ1, DJ2, PVH, PVB, J )
692   CALL iau_EQEC06 ( DATE1, DATE2, DR, DD, DL, DB )
693   D =  iau_EQEQ94 ( DATE1, DATE2 )
694   D =  iau_ERA00  ( DJ1, DJ2 )
695   D =  iau_FAD03  ( T )
696   D =  iau_FAE03  ( T )
697   D =  iau_FAF03  ( T )
698   D =  iau_FAJU03 ( T )
699   D =  iau_FAL03  ( T )
700   D =  iau_FALP03 ( T )
701   D =  iau_FAMA03 ( T )
702   D =  iau_FAME03 ( T )
703   D =  iau_FANE03 ( T )
704   D =  iau_FAOM03 ( T )
705   D =  iau_FAPA03 ( T )
706   D =  iau_FASA03 ( T )
707   D =  iau_FAUR03 ( T )
708   D =  iau_FAVE03 ( T )
709   CALL iau_FK425 ( R1950, D1950, DR1950, DD1950, P1950, V1950,
710  :                 R2000, D2000, DR2000, DD2000, P2000, V2000 )
711   CALL iau_FK45Z ( R1950, D1950, BEPOCH, R2000, D2000 )
712   CALL iau_FK524 ( R2000, D2000, DR2000, DD2000, P2000, V2000,
713  :                 R1950, D1950, DR1950, DD1950, P1950, V1950 )
714   CALL iau_FK52H  ( R5, D5, DR5, DD5, PX5, RV5,
715  :                  RH, DH, DRH, DDH, PXH, RVH )
716   CALL iau_FK54Z ( R2000, D2000, BEPOCH, R1950, D1950, DR1950, DD1950 )
717   CALL iau_FK5HIP ( R5H, S5H )
718   CALL iau_FK5HZ  ( R5, D5, DATE1, DATE2, RH, DH )
719   CALL iau_FW2M   ( GAMB, PHIB, PSI, EPS, R )
720   CALL iau_FW2XY  ( GAMB, PHIB, PSI, EPS, X, Y )
721   CALL iau_G2ICRS ( DL, DB, DR, DD )
722   CALL iau_GC2GD  ( N, XYZ, ELONG, PHI, HEIGHT, J )
723   CALL iau_GC2GDE ( A, F, XYZ, ELONG, PHI, HEIGHT, J )
724   CALL iau_GD2GC  ( N, ELONG, PHI, HEIGHT, XYZ, J )
725   CALL iau_GD2GCE ( A, F, ELONG, PHI, HEIGHT, XYZ, J )
726   D =  iau_GMST00 ( UTA, UTB, TTA, TTB )
727   D =  iau_GMST06 ( UTA, UTB, TTA, TTB )
728   D =  iau_GMST82 ( UTA, UTB )
729   D =  iau_GST00A ( UTA, UTB, TTA, TTB )
730   D =  iau_GST00B ( UTA, UTB )
731   D =  iau_GST06  ( UTA, UTB, TTA, TTB, RNPB )
732   D =  iau_GST06A ( UTA, UTB, TTA, TTB )
733   D =  iau_GST94  ( UTA, UTB )
734   CALL iau_H2FK5  ( RH, DH, DRH, DDH, PXH, RVH,
735  :                  R5, D5, DR5, DD5, PX5, RV5 )
736   CALL iau_HD2AE  ( HA, DEC, PHI, AZ, EL )
737   D =  iau_HD2PA  ( HA, DEC, PHI )
738   CALL iau_HFK5Z  ( RH, DH, DATE1, DATE2, R5, D5, DR5, DD5 )
739   CALL iau_ICRS2G ( DR, DD, DL, DB  )
740   CALL iau_JD2CAL ( DJ1, DJ2, IY, IM, ID, FD, J )
741   CALL iau_JDCALF ( NDP, DJ1, DJ2, IYMDF, J )
742   CALL iau_LD     ( BM, P, Q, E, EM, DLIM, P1 )
743   CALL iau_LDN    ( N, B, OB, SC, SN )
744   CALL iau_LDSUN  ( P, E, EM, P1 )
745   CALL iau_LTECEQ ( EPJ, DL, DB, DR, DD )
746   CALL iau_LTECM  ( EPJ, RM] )
747   CALL iau_LTEQEC ( EPJ, DR, DD, DL, DB )
748   CALL iau_LTP    ( EPJ, RP )
749   CALL iau_LTPB   ( EPJ, RPB )
750   CALL iau_LTPECL ( EPJ, VEC )
751   CALL iau_LTPEQU ( EPJ, VEQ )
752   CALL iau_MOON98 ( DATE1, DATE2, PV )
753   CALL iau_NUM00A ( DATE1, DATE2, RMATN )
754   CALL iau_NUM00B ( DATE1, DATE2, RMATN )
755   CALL iau_NUM06A ( DATE1, DATE2, RMATN )
756   CALL iau_NUMAT  ( EPSA, DPSI, DEPS, RMATN )
757   CALL iau_NUT00A ( DATE1, DATE2, DPSI, DEPS )
758   CALL iau_NUT00B ( DATE1, DATE2, DPSI, DEPS )
759   CALL iau_NUT06A ( DATE1, DATE2, DPSI, DEPS )
760   CALL iau_NUT80  ( DATE1, DATE2, DPSI, DEPS )
761   CALL iau_NUTM80 ( DATE1, DATE2, RMATN )
762   D =  iau_OBL06  ( DATE1, DATE2 )
763   D =  iau_OBL80  ( DATE1, DATE2 )
764   CALL iau_PB06   ( DATE1, DATE2, BZETA, BZ, BTHETA )
765   CALL iau_PFW06  ( DATE1, DATE2, GAMB, PHIB, PSIB, EPSA )
766   CALL iau_PLAN94 ( DATE1, DATE2, NP, PV, J )
767   CALL iau_PMAT00 ( DATE1, DATE2, RBP )
768   CALL iau_PMAT06 ( DATE1, DATE2, RBP )
769   CALL iau_PMAT76 ( DATE1, DATE2, RMATP )
770   CALL iau_PMPX   ( RC, DC, PR, PD, PX, RV, PMT, POB, PCO )
771   CALL iau_PMSAFE ( RA1, DEC1, PMR1, PMD1, PX1, RV1,
772  :                  EP1A, EP1B, EP2A, EP2B,
773  :                  RA2, DEC2, PMR2, PMD2, PX2, RV2, J )
774   CALL iau_PN00   ( DATE1, DATE2, DPSI, DEPS,
775  :                  EPSA, RB, RP, RBP, RN, RBPN )
776   CALL iau_PN00A  ( DATE1, DATE2,
777  :                  DPSI, DEPS, EPSA, RB, RP, RBP, RN, RBPN )
778   CALL iau_PN00B  ( DATE1, DATE2,
779  :                  DPSI, DEPS, EPSA, RB, RP, RBP, RN, RBPN )
780   CALL iau_PN06   ( DATE1, DATE2, DPSI, DEPS,
781  :                  EPSA, RB, RP, RBP, RN, RBPN )
782   CALL iau_PN06A  ( DATE1, DATE2,
783  :                  DPSI, DEPS, RB, RP, RBP, RN, RBPN )
784   CALL iau_PNM00A ( DATE1, DATE2, RBPN )
785   CALL iau_PNM00B ( DATE1, DATE2, RBPN )
786   CALL iau_PNM06A ( DATE1, DATE2, RNPB )
787   CALL iau_PNM80  ( DATE1, DATE2, RMATPN )
788   CALL iau_P06E   ( DATE1, DATE2,
789  :                  EPS0, PSIA, OMA, BPA, BQA, PIA, BPIA,
790  :                  EPSA, CHIA, ZA, ZETAA, THETAA, PA, GAM, PHI, PSI )
791   CALL iau_POM00  ( XP, YP, SP, RPOM )
792   CALL iau_PR00   ( DATE1, DATE2, DPSIPR, DEPSPR )
793   CALL iau_PREC76 ( DATE01, DATE02, DATE11, DATE12, ZETA, Z, THETA )
794   CALL iau_PVSTAR ( PV, RA, DEC, PMR, PMD, PX, RV, J )
795   CALL iau_PVTOB  ( ELONG, PHI, HM, XP, YP, SP, THETA, PV )
796   CALL iau_REFCO  ( PHPA, TC, RH, WL, REFA, REFB )
797   D =  iau_S00    ( DATE1, DATE2, X, Y )
798   D =  iau_S00A   ( DATE1, DATE2 )
799   D =  iau_S00B   ( DATE1, DATE2 )
800   D =  iau_S06    ( DATE1, DATE2, X, Y )
801   D =  iau_S06A   ( DATE1, DATE2 )
802   D =  iau_SP00   ( DATE1, DATE2 )
803   CALL iau_STARPM ( RA1, DEC1, PMR1, PMD1, PX1, RV1,
804  :                  EP1A, EP1B, EP2A, EP2B,
805  :                  RA2, DEC2, PMR2, PMD2, PX2, RV2, J )
806   CALL iau_STARPV ( RA, DEC, PMR, PMD, PX, RV, PV, J )
807   CALL iau_TAITT  ( TAI1, TAI2, TT1, TT2, J )
808   CALL iau_TAIUT1 ( TAI1, TAI2, DTA, UT11, UT12, J )
809   CALL iau_TAIUTC ( TAI1, TAI2, UTC1, UTC2, J )
810   CALL iau_TCBTDB ( TCB1, TCB2, TDB1, TDB2, J )
811   CALL iau_TCGTT  ( TCG1, TCG2, TT1, TT2, J )
812   CALL iau_TDBTCB ( TDB1, TDB2, TCB1, TCB2, J )
813   CALL iau_TDBTT  ( TDB1, TDB2, DTR, TT1, TT2, J )
814   CALL iau_TPORS  ( XI, ETA, A, B, A01, B01, A02, B02, N )
815   CALL iau_TPORV  ( XI, ETA, V, V01, V02, N )
816   CALL iau_TPSTS  ( XI, ETA, A0, B0, A, B )
817   CALL iau_TPSTV  ( XI, ETA, V0, V )
818   CALL iau_TPXES  ( A, B, A0, B0, XI, ETA, J )
819   CALL iau_TPXEV  ( V, V0, XI, ETA, J )
820   CALL iau_TTTAI  ( TT1, TT2, TAI1, TAI2, J )
821   CALL iau_TTTCG  ( TT1, TT2, TCG1, TCG2, J )
822   CALL iau_TTTDB  ( TT1, TT2, DTR, TDB1, TDB2, J )
823   CALL iau_TTUT1  ( TT1, TT2, DT, UT11, UT12, J )
824   CALL iau_UT1TAI ( UT11, UT12, TAI1, TAI2, J )
825   CALL iau_UT1TT  ( UT11, UT12, DT, TT1, TT2, J )
826   CALL iau_UT1UTC ( UT11, UT12, DUT, UTC1, UTC2, J )
827   CALL iau_UTCTAI ( UTC1, UTC2, DTA, TAI1, TAI2, J )
828   CALL iau_UTCUT1 ( UTC1, UTC2, DUT, UT11, UT12, J )
829   CALL iau_XY06   ( DATE1, DATE2, X, Y )
830   CALL iau_XYS00A ( DATE1, DATE2, X, Y, S )
831   CALL iau_XYS00B ( DATE1, DATE2, X, Y, S )
832   CALL iau_XYS06A ( DATE1, DATE2, X, Y, S )
833
834
835CALLS: C VERSION
836
837       iauAb     ( pnat, v, s, bm1, ppr );
838       iauAe2hd  ( az, el, phi, &ha, &dec );
839       iauApcg   ( date1, date2, eb, eh, &astrom );
840       iauApcg13 ( date1, date2, &astrom );
841       iauApci   ( date1, date2, eb, eh, x, y, s, &astrom );
842       iauApci13 ( date1, date2, &astrom, &eo );
843       iauApco   ( date1, date2, eb, eh, x, y, s,
844                   theta, elong, phi, hm, xp, yp, sp,
845                   refa, refb, &astrom );
846   i = iauApco13 ( utc1, utc2, dut1, elong, phi, hm, xp, yp,
847                   phpa, tc, rh, wl, &astrom, &eo );
848       iauApcs   ( date1, date2, pv, eb, eh, &astrom );
849       iauApcs13 ( date1, date2, pv, &astrom );
850       iauAper   ( theta, &astrom );
851       iauAper13 ( ut11, ut12, &astrom );
852       iauApio   ( sp, theta, elong, phi, hm, xp, yp, refa, refb,
853                   &astrom );
854   i = iauApio13 ( utc1, utc2, dut1, elong, phi, hm, xp, yp,
855                   phpa, tc, rh, wl, &astrom );
856       iauAtcc13 ( rc, dc, pr, pd, px, rv, date1, date2, &ra, &da );
857       iauAtccq  ( rc, dc, pr, pd, px, rv, &astrom, &ra, &da );
858       iauAtci13 ( rc, dc, pr, pd, px, rv, date1, date2,
859                   &ri, &di, &eo );
860       iauAtciq  ( rc, dc, pr, pd, px, rv, &astrom, &ri, &di );
861       iauAtciqn ( rc, dc, pr, pd, px, rv, astrom, n, b, &ri, &di );
862       iauAtciqz ( rc, dc, &astrom, &ri, &di );
863   i = iauAtco13 ( rc, dc, pr, pd, px, rv, utc1, utc2, dut1,
864                   elong phi, hm, xp, yp, phpa, tc, rh, wl,
865                   aob, zob, hob, dob, rob, eo );
866       iauAtic13 ( ri, di, date1, date2, &rc, &dc, &eo );
867       iauAticq  ( ri, di, &astrom, &rc, &dc );
868       iauAtciqn ( ri, di, astrom, n, b, &rc, &dc );
869   i = iauAtio13 ( ri, di, utc1, utc2, dut1, elong, phi, hm, xp, yp,
870                   phpa, tc, rh, wl, aob, zob, hob, dob, rob );
871       iauAtioq  ( ri, di, &astrom, &aob, &zob, &hob, &dob, &rob );
872   i = iauAtoc13 ( type, ob1, ob2, utc1, utc2, dut1,
873                   elong, phi, hm, xp, yp, phpa, tc, rh, wl,
874                   &rc, &dc );
875   i = iauAtoi13 ( type, ob1, ob2, utc1, utc2, dut1, elong, phi, hm,
876                   xp, yp, phpa, tc, rh, wl, &ri, &di  );
877       iauAtoiq  ( type, ob1, ob2, &astrom, &ri, &di );
878       iauBi00   ( &dpsibi, &depsbi, &dra );
879       iauBp00   ( date1, date2, rb, rp, rbp );
880       iauBp06   ( date1, date2, rb, rp, rbp );
881       iauBpn2xy ( rbpn, &x, &y );
882       iauC2i00a ( date1, date2, rc2i );
883       iauC2i00b ( date1, date2, rc2i );
884       iauC2i06a ( date1, date2, rc2i );
885       iauC2ibpn ( date1, date2, rbpn, rc2i );
886       iauC2ixy  ( date1, date2, x, y, rc2i );
887       iauC2ixys ( x, y, s, rc2i );
888       iauC2t00a ( tta, ttb, uta, utb, xp, yp, rc2t );
889       iauC2t00b ( tta, ttb, uta, utb, xp, yp, rc2t );
890       iauC2t06a ( tta, ttb, uta, utb, xp, yp, rc2t );
891       iauC2tcio ( rc2i, era, rpom, rc2t );
892       iauC2teqx ( rbpn, gst, rpom, rc2t );
893       iauC2tpe  ( tta, ttb, uta, utb, dpsi, deps, xp, yp, rc2t );
894       iauC2txy  ( tta, ttb, uta, utb, x, y, xp, yp, rc2t );
895   i = iauCal2jd ( iy, im, id, &djm0, &djm );
896   i = iauD2dtf  ( scale, ndp, d1, d2, &iy, &im, &id, ihmsf );
897   i = iauDat    ( iy, im, id, fd, &deltat );
898   d = iauDtdb   ( date1, date2, ut, elong, u, v );
899   i = iauDtf2d  ( scale, iy, im, id, ihr, imn, sec, &d1, &d2 );
900       iauEceq06 ( date1, date2, dl, db, &dr, &dd );
901       iauEcm06  ( date1, date2, rm );
902   d = iauEe00   ( date1, date2, epsa, dpsi );
903   d = iauEe00a  ( date1, date2 );
904   d = iauEe00b  ( date1, date2 );
905   d = iauEe06   ( date1, date2 );
906   d = iauEect00 ( date1, date2 );
907   i = iauEform  ( n, &a, &f );
908   d = iauEo06   ( date1, date2 );
909   d = iauEors   ( rnpb, s );
910   d = iauEpb    ( dj1, dj2 );
911       iauEpb2jd ( epb, &djm0, &djm );
912   d = iauEpj    ( dj1, dj2 );
913       iauEpj2jd ( epj, &djm0, &djm );
914   i = iauEpv00  ( dj1, dj2, pvh, pvb );
915       iauEqec06 ( date1, date2, dr, dd, &dl, &db );
916   d = iauEqeq94 ( date1, date2 );
917   d = iauEra00  ( dj1, dj2 );
918   d = iauFad03  ( t );
919   d = iauFae03  ( t );
920   d = iauFaf03  ( t );
921   d = iauFaju03 ( t );
922   d = iauFal03  ( t );
923   d = iauFalp03 ( t );
924   d = iauFama03 ( t );
925   d = iauFame03 ( t );
926   d = iauFane03 ( t );
927   d = iauFaom03 ( t );
928   d = iauFapa03 ( t );
929   d = iauFasa03 ( t );
930   d = iauFaur03 ( t );
931   d = iauFave03 ( t );
932       iauFk425 ( r1950, d1950, dr1950, dd1950, p1950, v1950,
933                  &r2000, &d2000, &dr2000, &dd2000, &p2000, &v2000 );
934       iauFk45z ( r1950, d1950, bepoch, &r2000, &d2000 );
935       iauFk524 ( r2000, d2000, dr2000, dd2000, p2000, v2000,
936                  &r1950, &d1950, &dr1950, &dd1950, &p1950, &v1950 );
937       iauFk52h  ( r5, d5, dr5, dd5, px5, rv5,
938                   &rh, &dh, &drh, &ddh, &pxh, &rvh );
939       iauFk54z ( r2000, d2000, bepoch,
940                  &r1950, &d1950, &dr1950, &dd1950 );
941       iauFk5hip ( r5h, s5h );
942       iauFk5hz  ( r5, d5, date1, date2, &rh, &dh );
943       iauFw2m   ( gamb, phib, psi, eps, r );
944       iauFw2xy  ( gamb, phib, psi, eps, &x, &y );
945       iauG2icrs ( dl, db, &dr, &dd );
946   i = iauGc2gd  ( n, xyz, &elong, &phi, &height );
947   i = iauGc2gde ( a, f, xyz, &elong, &phi, &height );
948   i = iauGd2gc  ( n, elong, phi, height, xyz );
949   i = iauGd2gce ( a, f, elong, phi, height, xyz );
950   d = iauGmst00 ( uta, utb, tta, ttb );
951   d = iauGmst06 ( uta, utb, tta, ttb );
952   d = iauGmst82 ( uta, utb );
953   d = iauGst00a ( uta, utb, tta, ttb );
954   d = iauGst00b ( uta, utb );
955   d = iauGst06  ( uta, utb, tta, ttb, rnpb );
956   d = iauGst06a ( uta, utb, tta, ttb );
957   d = iauGst94  ( uta, utb );
958       iauH2fk5  ( rh, dh, drh, ddh, pxh, rvh,
959                   &r5, &d5, &dr5, &dd5, &px5, &rv5 );
960       iauHd2ae  ( ha, dec, phi, &az, &el );
961   d = iauHd2pa  ( ha, dec, phi );
962       iauHfk5z  ( rh, dh, date1, date2,
963                   &r5, &d5, &dr5, &dd5 );
964       iauIcrs2g ( dr, dd, &dl, &db );
965   i = iauJd2cal ( dj1, dj2, &iy, &im, &id, &fd );
966   i = iauJdcalf ( ndp, dj1, dj2, iymdf );
967       iauLd     ( bm, p, q, e, em, dlim, p1 );
968       iauLdn    ( n, b, ob, sc, sn );
969       iauLdsun  ( p, e, em, p1 );
970       iauLteceq ( epj,  dl, db, &dr, &dd );
971       iauLtecm  ( epj,  rm );
972       iauLteqec ( epj,  dr,  dd, &dl, &db );
973       iauLtp    ( epj,  rp );
974       iauLtpb   ( epj,  rpb );
975       iauLtpecl ( epj,  vec );
976       iauLtpequ ( epj,  veq );
977       iauMoon98 ( date1, date2, pv );
978       iauNum00a ( date1, date2, rmatn );
979       iauNum00b ( date1, date2, rmatn );
980       iauNum06a ( date1, date2, rmatn );
981       iauNumat  ( epsa, dpsi, deps, rmatn );
982       iauNut00a ( date1, date2, &dpsi, &deps );
983       iauNut00b ( date1, date2, &dpsi, &deps );
984       iauNut06a ( date1, date2, &dpsi, &deps );
985       iauNut80  ( date1, date2, &dpsi, &deps );
986       iauNutm80 ( date1, date2, rmatn );
987   d = iauObl06  ( date1, date2 );
988   d = iauObl80  ( date1, date2 );
989       iauPb06   ( date1, date2, &bzeta, &bz, &btheta );
990       iauPfw06  ( date1, date2, &gamb, &phib, &psib, &epsa );
991   i = iauPlan94 ( date1, date2, np, pv );
992       iauPmat00 ( date1, date2, rbp );
993       iauPmat06 ( date1, date2, rbp );
994       iauPmat76 ( date1, date2, rmatp );
995       iauPmpx   ( rc, dc, pr, pd, px, rv, pmt, pob, pco );
996   i = iauPmsafe ( ra1, dec1, pmr1, pmd1, px1, rv1,
997                   ep1a, ep1b, ep2a, ep2b,
998                   &ra2, &dec2, &pmr2, &pmd2, &px2, &rv2);
999       iauPn00   ( date1, date2, dpsi, deps,
1000                   &epsa, rb, rp, rbp, rn, rbpn );
1001       iauPn00a  ( date1, date2,
1002                   &dpsi, &deps, &epsa, rb, rp, rbp, rn, rbpn );
1003       iauPn00b  ( date1, date2,
1004                   &dpsi, &deps, &epsa, rb, rp, rbp, rn, rbpn );
1005       iauPn06   ( date1, date2, dpsi, deps,
1006                   &epsa, rb, rp, rbp, rn, rbpn );
1007       iauPn06a  ( date1, date2,
1008                   &dpsi, &deps, &epsa, rb, rp, rbp, rn, rbpn );
1009       iauPnm00a ( date1, date2, rbpn );
1010       iauPnm00b ( date1, date2, rbpn );
1011       iauPnm06a ( date1, date2, rnpb );
1012       iauPnm80  ( date1, date2, rmatpn );
1013       iauP06e   ( date1, date2,
1014                   &eps0, &psia, &oma, &bpa, &bqa, &pia, &bpia,
1015                   &epsa, &chia, &za, &zetaa, &thetaa, &pa,
1016                   &gam, &phi, &psi );
1017       iauPom00  ( xp, yp, sp, rpom );
1018       iauPr00   ( date1, date2, &dpsipr, &depspr );
1019       iauPrec76 ( date01, date02, date11, date12, &zeta, &z, &theta );
1020   i = iauPvstar ( pv, &ra, &dec, &pmr, &pmd, &px, &rv );
1021       iauPvtob  ( elong, phi, hm, xp, yp, sp, theta, pv );
1022       iauRefco  ( phpa, tc, rh, wl, refa, refb );
1023   d = iauS00    ( date1, date2, x, y );
1024   d = iauS00a   ( date1, date2 );
1025   d = iauS00b   ( date1, date2 );
1026   d = iauS06    ( date1, date2, x, y );
1027   d = iauS06a   ( date1, date2 );
1028   d = iauSp00   ( date1, date2 );
1029   i = iauStarpm ( ra1, dec1, pmr1, pmd1, px1, rv1,
1030                   ep1a, ep1b, ep2a, ep2b,
1031                   &ra2, &dec2, &pmr2, &pmd2, &px2, &rv2 );
1032   i = iauStarpv ( ra, dec, pmr, pmd, px, rv, pv );
1033   i = iauTaitt  ( tai1, tai2, &tt1, &tt2 );
1034   i = iauTaiut1 ( tai1, tai2, dta, &ut11, &ut12 );
1035   i = iauTaiutc ( tai1, tai2, &utc1, &utc2 );
1036   i = iauTcbtdb ( tcb1, tcb2, &tdb1, &tdb2 );
1037   i = iauTcgtt  ( tcg1, tcg2, &tt1, &tt2 );
1038   i = iauTdbtcb ( tdb1, tdb2, &tcb1, &tcb2 );
1039   i = iauTdbtt  ( tdb1, tdb2, dtr, &tt1, &tt2 );
1040   i = iauTpors  ( xi, eta, a, b, &a01, &b01, &a02, &b02 );
1041   i = iauTporv  ( xi, eta, v, v01, v02 );
1042       iauTpsts  ( xi, eta, a0, b0, &a, &b );
1043       iauTpstv  ( xi, eta, v0, v );
1044   i = iauTpxes  ( a, b, a0, b0, &xi, &eta );
1045   i = iauTpxev  ( v, v0, &xi, &eta );
1046   i = iauTttai  ( tt1, tt2, &tai1, &tai2 );
1047   i = iauTttcg  ( tt1, tt2, &tcg1, &tcg2 );
1048   i = iauTttdb  ( tt1, tt2, dtr, &tdb1, &tdb2 );
1049   i = iauTtut1  ( tt1, tt2, dt, &ut11, &ut12 );
1050   i = iauUt1tai ( ut11, ut12, &tai1, &tai2 );
1051   i = iauUt1tt  ( ut11, ut12, dt, &tt1, &tt2 );
1052   i = iauUt1utc ( ut11, ut12, dut, &utc1, &utc2 );
1053   i = iauUtctai ( utc1, utc2, dta, &tai1, &tai2 );
1054   i = iauUtcut1 ( utc1, utc2, dut, &ut11, &ut12 );
1055       iauXy06   ( date1, date2, &x, &y );
1056       iauXys00a ( date1, date2, &x, &y, &s );
1057       iauXys00b ( date1, date2, &x, &y, &s );
1058       iauXys06a ( date1, date2, &x, &y, &s );
1059
1060
1061
1062
1063
1064
1065sofa_vml.lis                                            2020 September 9
1066
1067                   --------------------------
1068                   SOFA Vector/Matrix Library
1069                   --------------------------
1070
1071PREFACE
1072
1073The routines described here comprise the SOFA vector/matrix library.
1074Their general appearance and coding style conforms to conventions
1075agreed by the SOFA Board, and their functions, names and algorithms have
1076been ratified by the Board.  Procedures for soliciting and agreeing
1077additions to the library are still evolving.
1078
1079
1080PROGRAMMING LANGUAGES
1081
1082The SOFA routines are available in two programming languages at present:
1083Fortran 77 and ANSI C.
1084
1085There is a one-to-one relationship between the two language versions.
1086The naming convention is such that a SOFA routine referred to
1087generically as "EXAMPL" exists as a Fortran subprogram iau_EXAMPL and a
1088C function iauExampl.  The calls for the two versions are very similar,
1089with the same arguments in the same order.  In a few cases, the C
1090equivalent of a Fortran SUBROUTINE subprogram uses a return value rather
1091than an argument.
1092
1093
1094GENERAL PRINCIPLES
1095
1096The library consists mostly of routines which operate on ordinary
1097Cartesian vectors (x,y,z) and 3x3 rotation matrices.  However, there is
1098also support for vectors which represent velocity as well as position
1099and vectors which represent rotation instead of position.  The vectors
1100which represent both position and velocity may be considered still to
1101have dimensions (3), but to comprise elements each of which is two
1102numbers, representing the value itself and the time derivative.  Thus:
1103
1104* "Position" or "p" vectors (or just plain 3-vectors) have dimension
1105  (3) in Fortran and [3] in C.
1106
1107* "Position/velocity" or "pv" vectors have dimensions (3,2) in Fortran
1108  and [2][3] in C.
1109
1110* "Rotation" or "r" matrices have dimensions (3,3) in Fortran and [3][3]
1111  in C.  When used for rotation, they are "orthogonal";  the inverse of
1112  such a matrix is equal to the transpose.  Most of the routines in
1113  this library do not assume that r-matrices are necessarily orthogonal
1114  and in fact work on any 3x3 matrix.
1115
1116* "Rotation" or "r" vectors have dimensions (3) in Fortran and [3] in C.
1117  Such vectors are a combination of the Euler axis and angle and are
1118  convertible to and from r-matrices.  The direction is the axis of
1119  rotation and the magnitude is the angle of rotation, in radians.
1120  Because the amount of rotation can be scaled up and down simply by
1121  multiplying the vector by a scalar, r-vectors are useful for
1122  representing spins about an axis which is fixed.
1123
1124* The above rules mean that in terms of memory address, the three
1125  velocity components of a pv-vector follow the three position
1126  components.  Application code is permitted to exploit this and all
1127  other knowledge of the internal layouts:  that x, y and z appear in
1128  that order and are in a right-handed Cartesian coordinate system etc.
1129  For example, the cp function (copy a p-vector) can be used to copy
1130  the velocity component of a pv-vector (indeed, this is how the
1131  CPV routine is coded).
1132
1133* The routines provided do not completely fill the range of operations
1134  that link all the various vector and matrix options, but are confined
1135  to functions that are required by other parts of the SOFA software or
1136  which are likely to prove useful.
1137
1138In addition to the vector/matrix routines, the library contains some
1139routines related to spherical angles, including conversions to and
1140from sexagesimal format.
1141
1142Using the library requires knowledge of vector/matrix methods, spherical
1143trigonometry, and methods of attitude representation.  These topics are
1144covered in many textbooks, including "Spacecraft Attitude Determination
1145and Control", James R. Wertz (ed.), Astrophysics and Space Science
1146Library, Vol. 73, D. Reidel Publishing Company, 1986.
1147
1148
1149OPERATIONS INVOLVING P-VECTORS AND R-MATRICES
1150
1151  Initialize
1152
1153     ZP        zero p-vector
1154     ZR        initialize r-matrix to null
1155     IR        initialize r-matrix to identity
1156
1157  Copy
1158
1159     CP        copy p-vector
1160     CR        copy r-matrix
1161
1162  Build rotations
1163
1164     RX        rotate r-matrix about x
1165     RY        rotate r-matrix about y
1166     RZ        rotate r-matrix about z
1167
1168  Spherical/Cartesian conversions
1169
1170     S2C       spherical to unit vector
1171     C2S       unit vector to spherical
1172     S2P       spherical to p-vector
1173     P2S       p-vector to spherical
1174
1175  Operations on vectors
1176
1177     PPP       p-vector plus p-vector
1178     PMP       p-vector minus p-vector
1179     PPSP      p-vector plus scaled p-vector
1180     PDP       inner (=scalar=dot) product of two p-vectors
1181     PXP       outer (=vector=cross) product of two p-vectors
1182     PM        modulus of p-vector
1183     PN        normalize p-vector returning modulus
1184     SXP       multiply p-vector by scalar
1185
1186  Operations on matrices
1187
1188     RXR       r-matrix multiply
1189     TR        transpose r-matrix
1190
1191  Matrix-vector products
1192
1193     RXP       product of r-matrix and p-vector
1194     TRXP      product of transpose of r-matrix and p-vector
1195
1196  Separation and position-angle
1197
1198     SEPP      angular separation from p-vectors
1199     SEPS      angular separation from spherical coordinates
1200     PAP       position-angle from p-vectors
1201     PAS       position-angle from spherical coordinates
1202
1203  Rotation vectors
1204
1205     RV2M      r-vector to r-matrix
1206     RM2V      r-matrix to r-vector
1207
1208
1209OPERATIONS INVOLVING PV-VECTORS
1210
1211  Initialize
1212
1213     ZPV       zero pv-vector
1214
1215  Copy/extend/extract
1216
1217     CPV       copy pv-vector
1218     P2PV      append zero velocity to p-vector
1219     PV2P      discard velocity component of pv-vector
1220
1221  Spherical/Cartesian conversions
1222
1223     S2PV      spherical to pv-vector
1224     PV2S      pv-vector to spherical
1225
1226  Operations on pv-vectors
1227
1228     PVPPV     pv-vector plus pv-vector
1229     PVMPV     pv-vector minus pv-vector
1230     PVDPV     inner (=scalar=dot) product of two pv-vectors
1231     PVXPV     outer (=vector=cross) product of two pv-vectors
1232     PVM       modulus of pv-vector
1233     SXPV      multiply pv-vector by scalar
1234     S2XPV     multiply pv-vector by two scalars
1235     PVU       update pv-vector
1236     PVUP      update pv-vector discarding velocity
1237
1238  Matrix-vector products
1239
1240     RXPV      product of r-matrix and pv-vector
1241     TRXPV     product of transpose of r-matrix and pv-vector
1242
1243
1244OPERATIONS ON ANGLES
1245
1246  Wrap
1247
1248     ANP       normalize radians to range 0 to 2pi
1249     ANPM      normalize radians to range -pi to +pi
1250
1251  To sexagesimal
1252
1253     A2TF      decompose radians into hours, minutes, seconds
1254     A2AF      decompose radians into degrees, arcminutes, arcseconds
1255     D2TF      decompose days into hours, minutes, seconds
1256
1257  From sexagesimal
1258
1259     AF2A      degrees, arcminutes, arcseconds to radians
1260     TF2A      hours, minutes, seconds to radians
1261     TF2D      hours, minutes, seconds to days
1262
1263
1264CALLS: FORTRAN VERSION
1265
1266   CALL iau_A2AF  ( NDP, ANGLE, SIGN, IDMSF )
1267   CALL iau_A2TF  ( NDP, ANGLE, SIGN, IHMSF )
1268   CALL iau_AF2A  ( S, IDEG, IAMIN, ASEC, RAD, J )
1269   D =  iau_ANP   ( A )
1270   D =  iau_ANPM  ( A )
1271   CALL iau_C2S   ( P, THETA, PHI )
1272   CALL iau_CP    ( P, C )
1273   CALL iau_CPV   ( PV, C )
1274   CALL iau_CR    ( R, C )
1275   CALL iau_D2TF  ( NDP, DAYS, SIGN, IHMSF )
1276   CALL iau_IR    ( R )
1277   CALL iau_P2PV  ( P, PV )
1278   CALL iau_P2S   ( P, THETA, PHI, R )
1279   CALL iau_PAP   ( A, B, THETA )
1280   CALL iau_PAS   ( AL, AP, BL, BP, THETA )
1281   CALL iau_PDP   ( A, B, ADB )
1282   CALL iau_PM    ( P, R )
1283   CALL iau_PMP   ( A, B, AMB )
1284   CALL iau_PN    ( P, R, U )
1285   CALL iau_PPP   ( A, B, APB )
1286   CALL iau_PPSP  ( A, S, B, APSB )
1287   CALL iau_PV2P  ( PV, P )
1288   CALL iau_PV2S  ( PV, THETA, PHI, R, TD, PD, RD )
1289   CALL iau_PVDPV ( A, B, ADB )
1290   CALL iau_PVM   ( PV, R, S )
1291   CALL iau_PVMPV ( A, B, AMB )
1292   CALL iau_PVPPV ( A, B, APB )
1293   CALL iau_PVU   ( DT, PV, UPV )
1294   CALL iau_PVUP  ( DT, PV, P )
1295   CALL iau_PVXPV ( A, B, AXB )
1296   CALL iau_PXP   ( A, B, AXB )
1297   CALL iau_RM2V  ( R, P )
1298   CALL iau_RV2M  ( P, R )
1299   CALL iau_RX    ( PHI, R )
1300   CALL iau_RXP   ( R, P, RP )
1301   CALL iau_RXPV  ( R, PV, RPV )
1302   CALL iau_RXR   ( A, B, ATB )
1303   CALL iau_RY    ( THETA, R )
1304   CALL iau_RZ    ( PSI, R )
1305   CALL iau_S2C   ( THETA, PHI, C )
1306   CALL iau_S2P   ( THETA, PHI, R, P )
1307   CALL iau_S2PV  ( THETA, PHI, R, TD, PD, RD, PV )
1308   CALL iau_S2XPV ( S1, S2, PV )
1309   CALL iau_SEPP  ( A, B, S )
1310   CALL iau_SEPS  ( AL, AP, BL, BP, S )
1311   CALL iau_SXP   ( S, P, SP )
1312   CALL iau_SXPV  ( S, PV, SPV )
1313   CALL iau_TF2A  ( S, IHOUR, IMIN, SEC, RAD, J )
1314   CALL iau_TF2D  ( S, IHOUR, IMIN, SEC, DAYS, J )
1315   CALL iau_TR    ( R, RT )
1316   CALL iau_TRXP  ( R, P, TRP )
1317   CALL iau_TRXPV ( R, PV, TRPV )
1318   CALL iau_ZP    ( P )
1319   CALL iau_ZPV   ( PV )
1320   CALL iau_ZR    ( R )
1321
1322
1323CALLS: C VERSION
1324
1325       iauA2af  ( ndp, angle, &sign, idmsf );
1326       iauA2tf  ( ndp, angle, &sign, ihmsf );
1327   i = iauAf2a  ( s, ideg, iamin, asec, &rad );
1328   d = iauAnp   ( a );
1329   d = iauAnpm  ( a );
1330       iauC2s   ( p, &theta, &phi );
1331       iauCp    ( p, c );
1332       iauCpv   ( pv, c );
1333       iauCr    ( r, c );
1334       iauD2tf  ( ndp, days, &sign, ihmsf );
1335       iauIr    ( r );
1336       iauP2pv  ( p, pv );
1337       iauP2s   ( p, &theta, &phi, &r );
1338   d = iauPap   ( a, b );
1339   d = iauPas   ( al, ap, bl, bp );
1340   d = iauPdp   ( a, b );
1341   d = iauPm    ( p );
1342       iauPmp   ( a, b, amb );
1343       iauPn    ( p, &r, u );
1344       iauPpp   ( a, b, apb );
1345       iauPpsp  ( a, s, b, apsb );
1346       iauPv2p  ( pv, p );
1347       iauPv2s  ( pv, &theta, &phi, &r, &td, &pd, &rd );
1348       iauPvdpv ( a, b, adb );
1349       iauPvm   ( pv, &r, &s );
1350       iauPvmpv ( a, b, amb );
1351       iauPvppv ( a, b, apb );
1352       iauPvu   ( dt, pv, upv );
1353       iauPvup  ( dt, pv, p );
1354       iauPvxpv ( a, b, axb );
1355       iauPxp   ( a, b, axb );
1356       iauRm2v  ( r, p );
1357       iauRv2m  ( p, r );
1358       iauRx    ( phi, r );
1359       iauRxp   ( r, p, rp );
1360       iauRxpv  ( r, pv, rpv );
1361       iauRxr   ( a, b, atb );
1362       iauRy    ( theta, r );
1363       iauRz    ( psi, r );
1364       iauS2c   ( theta, phi, c );
1365       iauS2p   ( theta, phi, r, p );
1366       iauS2pv  ( theta, phi, r, td, pd, rd, pv );
1367       iauS2xpv ( s1, s2, pv );
1368   d = iauSepp  ( a, b );
1369   d = iauSeps  ( al, ap, bl, bp );
1370       iauSxp   ( s, p, sp );
1371       iauSxpv  ( s, pv, spv );
1372   i = iauTf2a  ( s, ihour, imin, sec, &rad );
1373   i = iauTf2d  ( s, ihour, imin, sec, &days );
1374       iauTr    ( r, rt );
1375       iauTrxp  ( r, p, trp );
1376       iauTrxpv ( r, pv, trpv );
1377       iauZp    ( p );
1378       iauZpv   ( pv );
1379       iauZr    ( r );
1380
1381
1382
1383void iauA2af(int ndp, double angle, char *sign, int idmsf[4])
1384/*
1385**  - - - - - - - -
1386**   i a u A 2 a f
1387**  - - - - - - - -
1388**
1389**  Decompose radians into degrees, arcminutes, arcseconds, fraction.
1390**
1391**  This function is part of the International Astronomical Union's
1392**  SOFA (Standards Of Fundamental Astronomy) software collection.
1393**
1394**  Status:  vector/matrix support function.
1395**
1396**  Given:
1397**     ndp     int     resolution (Note 1)
1398**     angle   double  angle in radians
1399**
1400**  Returned:
1401**     sign    char*   '+' or '-'
1402**     idmsf   int[4]  degrees, arcminutes, arcseconds, fraction
1403**
1404**  Notes:
1405**
1406**  1) The argument ndp is interpreted as follows:
1407**
1408**     ndp         resolution
1409**      :      ...0000 00 00
1410**     -7         1000 00 00
1411**     -6          100 00 00
1412**     -5           10 00 00
1413**     -4            1 00 00
1414**     -3            0 10 00
1415**     -2            0 01 00
1416**     -1            0 00 10
1417**      0            0 00 01
1418**      1            0 00 00.1
1419**      2            0 00 00.01
1420**      3            0 00 00.001
1421**      :            0 00 00.000...
1422**
1423**  2) The largest positive useful value for ndp is determined by the
1424**     size of angle, the format of doubles on the target platform, and
1425**     the risk of overflowing idmsf[3].  On a typical platform, for
1426**     angle up to 2pi, the available floating-point precision might
1427**     correspond to ndp=12.  However, the practical limit is typically
1428**     ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is
1429**     only 16 bits.
1430**
1431**  3) The absolute value of angle may exceed 2pi.  In cases where it
1432**     does not, it is up to the caller to test for and handle the
1433**     case where angle is very nearly 2pi and rounds up to 360 degrees,
1434**     by testing for idmsf[0]=360 and setting idmsf[0-3] to zero.
1435**
1436**  Called:
1437**     iauD2tf      decompose days to hms
1438**
1439*/
1440
1441
1442
1443void iauA2tf(int ndp, double angle, char *sign, int ihmsf[4])
1444/*
1445**  - - - - - - - -
1446**   i a u A 2 t f
1447**  - - - - - - - -
1448**
1449**  Decompose radians into hours, minutes, seconds, fraction.
1450**
1451**  This function is part of the International Astronomical Union's
1452**  SOFA (Standards Of Fundamental Astronomy) software collection.
1453**
1454**  Status:  vector/matrix support function.
1455**
1456**  Given:
1457**     ndp     int     resolution (Note 1)
1458**     angle   double  angle in radians
1459**
1460**  Returned:
1461**     sign    char*   '+' or '-'
1462**     ihmsf   int[4]  hours, minutes, seconds, fraction
1463**
1464**  Notes:
1465**
1466**  1) The argument ndp is interpreted as follows:
1467**
1468**     ndp         resolution
1469**      :      ...0000 00 00
1470**     -7         1000 00 00
1471**     -6          100 00 00
1472**     -5           10 00 00
1473**     -4            1 00 00
1474**     -3            0 10 00
1475**     -2            0 01 00
1476**     -1            0 00 10
1477**      0            0 00 01
1478**      1            0 00 00.1
1479**      2            0 00 00.01
1480**      3            0 00 00.001
1481**      :            0 00 00.000...
1482**
1483**  2) The largest positive useful value for ndp is determined by the
1484**     size of angle, the format of doubles on the target platform, and
1485**     the risk of overflowing ihmsf[3].  On a typical platform, for
1486**     angle up to 2pi, the available floating-point precision might
1487**     correspond to ndp=12.  However, the practical limit is typically
1488**     ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is
1489**     only 16 bits.
1490**
1491**  3) The absolute value of angle may exceed 2pi.  In cases where it
1492**     does not, it is up to the caller to test for and handle the
1493**     case where angle is very nearly 2pi and rounds up to 24 hours,
1494**     by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
1495**
1496**  Called:
1497**     iauD2tf      decompose days to hms
1498**
1499*/
1500
1501
1502
1503void iauAb(double pnat[3], double v[3], double s, double bm1,
1504           double ppr[3])
1505/*
1506**  - - - - - -
1507**   i a u A b
1508**  - - - - - -
1509**
1510**  Apply aberration to transform natural direction into proper
1511**  direction.
1512**
1513**  This function is part of the International Astronomical Union's
1514**  SOFA (Standards of Fundamental Astronomy) software collection.
1515**
1516**  Status:  support function.
1517**
1518**  Given:
1519**    pnat    double[3]   natural direction to the source (unit vector)
1520**    v       double[3]   observer barycentric velocity in units of c
1521**    s       double      distance between the Sun and the observer (au)
1522**    bm1     double      sqrt(1-|v|^2): reciprocal of Lorenz factor
1523**
1524**  Returned:
1525**    ppr     double[3]   proper direction to source (unit vector)
1526**
1527**  Notes:
1528**
1529**  1) The algorithm is based on Expr. (7.40) in the Explanatory
1530**     Supplement (Urban & Seidelmann 2013), but with the following
1531**     changes:
1532**
1533**     o  Rigorous rather than approximate normalization is applied.
1534**
1535**     o  The gravitational potential term from Expr. (7) in
1536**        Klioner (2003) is added, taking into account only the Sun's
1537**        contribution.  This has a maximum effect of about
1538**        0.4 microarcsecond.
1539**
1540**  2) In almost all cases, the maximum accuracy will be limited by the
1541**     supplied velocity.  For example, if the SOFA iauEpv00 function is
1542**     used, errors of up to 5 microarcseconds could occur.
1543**
1544**  References:
1545**
1546**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
1547**     the Astronomical Almanac, 3rd ed., University Science Books
1548**     (2013).
1549**
1550**     Klioner, Sergei A., "A practical relativistic model for micro-
1551**     arcsecond astrometry in space", Astr. J. 125, 1580-1597 (2003).
1552**
1553**  Called:
1554**     iauPdp       scalar product of two p-vectors
1555**
1556*/
1557
1558
1559
1560void iauAe2hd (double az, double el, double phi,
1561               double *ha, double *dec)
1562/*
1563**  - - - - - - - - -
1564**   i a u A e 2 h d
1565**  - - - - - - - - -
1566**
1567**  Horizon to equatorial coordinates:  transform azimuth and altitude
1568**  to hour angle and declination.
1569**
1570**  Given:
1571**     az       double       azimuth
1572**     el       double       altitude (informally, elevation)
1573**     phi      double       site latitude
1574**
1575**  Returned:
1576**     ha       double       hour angle (local)
1577**     dec      double       declination
1578**
1579**  Notes:
1580**
1581**  1)  All the arguments are angles in radians.
1582**
1583**  2)  The sign convention for azimuth is north zero, east +pi/2.
1584**
1585**  3)  HA is returned in the range +/-pi.  Declination is returned in
1586**      the range +/-pi/2.
1587**
1588**  4)  The latitude phi is pi/2 minus the angle between the Earth's
1589**      rotation axis and the adopted zenith.  In many applications it
1590**      will be sufficient to use the published geodetic latitude of the
1591**      site.  In very precise (sub-arcsecond) applications, phi can be
1592**      corrected for polar motion.
1593**
1594**  5)  The azimuth az must be with respect to the rotational north pole,
1595**      as opposed to the ITRS pole, and an azimuth with respect to north
1596**      on a map of the Earth's surface will need to be adjusted for
1597**      polar motion if sub-arcsecond accuracy is required.
1598**
1599**  6)  Should the user wish to work with respect to the astronomical
1600**      zenith rather than the geodetic zenith, phi will need to be
1601**      adjusted for deflection of the vertical (often tens of
1602**      arcseconds), and the zero point of ha will also be affected.
1603**
1604**  7)  The transformation is the same as Ve = Ry(phi-pi/2)*Rz(pi)*Vh,
1605**      where Ve and Vh are lefthanded unit vectors in the (ha,dec) and
1606**      (az,el) systems respectively and Rz and Ry are rotations about
1607**      first the z-axis and then the y-axis.  (n.b. Rz(pi) simply
1608**      reverses the signs of the x and y components.)  For efficiency,
1609**      the algorithm is written out rather than calling other utility
1610**      functions.  For applications that require even greater
1611**      efficiency, additional savings are possible if constant terms
1612**      such as functions of latitude are computed once and for all.
1613**
1614**  8)  Again for efficiency, no range checking of arguments is carried
1615**      out.
1616**
1617**  Last revision:   2017 September 12
1618**
1619**  SOFA release 2021-05-12
1620**
1621**  Copyright (C) 2021 IAU SOFA Board.  See notes at end.
1622*/
1623{
1624   double sa, ca, se, ce, sp, cp, x, y, z, r;
1625
1626
1627/* Useful trig functions. */
1628   sa = sin(az);
1629   ca = cos(az);
1630   se = sin(el);
1631   ce = cos(el);
1632   sp = sin(phi);
1633   cp = cos(phi);
1634
1635/* HA,Dec unit vector. */
1636   x = - ca*ce*sp + se*cp;
1637   y = - sa*ce;
1638   z = ca*ce*cp + se*sp;
1639
1640/* To spherical. */
1641   r = sqrt(x*x + y*y);
1642   *ha = (r != 0.0) ? atan2(y,x) : 0.0;
1643   *dec = atan2(z,r);
1644
1645/* Finished. */
1646
1647/*----------------------------------------------------------------------
1648**
1649**  Copyright (C) 2021
1650**  Standards Of Fundamental Astronomy Board
1651**  of the International Astronomical Union.
1652**
1653**  =====================
1654**  SOFA Software License
1655**  =====================
1656**
1657**  NOTICE TO USER:
1658**
1659**  BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
1660**  CONDITIONS WHICH APPLY TO ITS USE.
1661**
1662**  1. The Software is owned by the IAU SOFA Board ("SOFA").
1663**
1664**  2. Permission is granted to anyone to use the SOFA software for any
1665**     purpose, including commercial applications, free of charge and
1666**     without payment of royalties, subject to the conditions and
1667**     restrictions listed below.
1668**
1669**  3. You (the user) may copy and distribute SOFA source code to others,
1670**     and use and adapt its code and algorithms in your own software,
1671**     on a world-wide, royalty-free basis.  That portion of your
1672**     distribution that does not consist of intact and unchanged copies
1673**     of SOFA source code files is a "derived work" that must comply
1674**     with the following requirements:
1675**
1676**     a) Your work shall be marked or carry a statement that it
1677**        (i) uses routines and computations derived by you from
1678**        software provided by SOFA under license to you; and
1679**        (ii) does not itself constitute software provided by and/or
1680**        endorsed by SOFA.
1681**
1682**     b) The source code of your derived work must contain descriptions
1683**        of how the derived work is based upon, contains and/or differs
1684**        from the original SOFA software.
1685**
1686**     c) The names of all routines in your derived work shall not
1687**        include the prefix "iau" or "sofa" or trivial modifications
1688**        thereof such as changes of case.
1689**
1690**     d) The origin of the SOFA components of your derived work must
1691**        not be misrepresented;  you must not claim that you wrote the
1692**        original software, nor file a patent application for SOFA
1693**        software or algorithms embedded in the SOFA software.
1694**
1695**     e) These requirements must be reproduced intact in any source
1696**        distribution and shall apply to anyone to whom you have
1697**        granted a further right to modify the source code of your
1698**        derived work.
1699**
1700**     Note that, as originally distributed, the SOFA software is
1701**     intended to be a definitive implementation of the IAU standards,
1702**     and consequently third-party modifications are discouraged.  All
1703**     variations, no matter how minor, must be explicitly marked as
1704**     such, as explained above.
1705**
1706**  4. You shall not cause the SOFA software to be brought into
1707**     disrepute, either by misuse, or use for inappropriate tasks, or
1708**     by inappropriate modification.
1709**
1710**  5. The SOFA software is provided "as is" and SOFA makes no warranty
1711**     as to its use or performance.   SOFA does not and cannot warrant
1712**     the performance or results which the user may obtain by using the
1713**     SOFA software.  SOFA makes no warranties, express or implied, as
1714**     to non-infringement of third party rights, merchantability, or
1715**     fitness for any particular purpose.  In no event will SOFA be
1716**     liable to the user for any consequential, incidental, or special
1717**     damages, including any lost profits or lost savings, even if a
1718**     SOFA representative has been advised of such damages, or for any
1719**     claim by any third party.
1720**
1721**  6. The provision of any version of the SOFA software under the terms
1722**     and conditions specified herein does not imply that future
1723**     versions will also be made available under the same terms and
1724**     conditions.
1725*
1726**  In any published work or commercial product which uses the SOFA
1727**  software directly, acknowledgement (see www.iausofa.org) is
1728**  appreciated.
1729**
1730**  Correspondence concerning SOFA software should be addressed as
1731**  follows:
1732**
1733**      By email:  sofa@ukho.gov.uk
1734**      By post:   IAU SOFA Center
1735**                 HM Nautical Almanac Office
1736**                 UK Hydrographic Office
1737**                 Admiralty Way, Taunton
1738**                 Somerset, TA1 2DN
1739**                 United Kingdom
1740**
1741**--------------------------------------------------------------------*/
1742}
1743
1744
1745
1746int iauAf2a(char s, int ideg, int iamin, double asec, double *rad)
1747/*
1748**  - - - - - - - -
1749**   i a u A f 2 a
1750**  - - - - - - - -
1751**
1752**  Convert degrees, arcminutes, arcseconds to radians.
1753**
1754**  This function is part of the International Astronomical Union's
1755**  SOFA (Standards of Fundamental Astronomy) software collection.
1756**
1757**  Status:  support function.
1758**
1759**  Given:
1760**     s         char    sign:  '-' = negative, otherwise positive
1761**     ideg      int     degrees
1762**     iamin     int     arcminutes
1763**     asec      double  arcseconds
1764**
1765**  Returned:
1766**     rad       double  angle in radians
1767**
1768**  Returned (function value):
1769**               int     status:  0 = OK
1770**                                1 = ideg outside range 0-359
1771**                                2 = iamin outside range 0-59
1772**                                3 = asec outside range 0-59.999...
1773**
1774**  Notes:
1775**
1776**  1)  The result is computed even if any of the range checks fail.
1777**
1778**  2)  Negative ideg, iamin and/or asec produce a warning status, but
1779**      the absolute value is used in the conversion.
1780**
1781**  3)  If there are multiple errors, the status value reflects only the
1782**      first, the smallest taking precedence.
1783**
1784*/
1785
1786
1787
1788double iauAnp(double a)
1789/*
1790**  - - - - - - -
1791**   i a u A n p
1792**  - - - - - - -
1793**
1794**  Normalize angle into the range 0 <= a < 2pi.
1795**
1796**  This function is part of the International Astronomical Union's
1797**  SOFA (Standards Of Fundamental Astronomy) software collection.
1798**
1799**  Status:  vector/matrix support function.
1800**
1801**  Given:
1802**     a        double     angle (radians)
1803**
1804**  Returned (function value):
1805**              double     angle in range 0-2pi
1806**
1807*/
1808
1809
1810
1811double iauAnpm(double a)
1812/*
1813**  - - - - - - - -
1814**   i a u A n p m
1815**  - - - - - - - -
1816**
1817**  Normalize angle into the range -pi <= a < +pi.
1818**
1819**  This function is part of the International Astronomical Union's
1820**  SOFA (Standards Of Fundamental Astronomy) software collection.
1821**
1822**  Status:  vector/matrix support function.
1823**
1824**  Given:
1825**     a        double     angle (radians)
1826**
1827**  Returned (function value):
1828**              double     angle in range +/-pi
1829**
1830*/
1831
1832
1833
1834void iauApcg(double date1, double date2,
1835             double ebpv[2][3], double ehp[3],
1836             iauASTROM *astrom)
1837/*
1838**  - - - - - - - -
1839**   i a u A p c g
1840**  - - - - - - - -
1841**
1842**  For a geocentric observer, prepare star-independent astrometry
1843**  parameters for transformations between ICRS and GCRS coordinates.
1844**  The Earth ephemeris is supplied by the caller.
1845**
1846**  The parameters produced by this function are required in the
1847**  parallax, light deflection and aberration parts of the astrometric
1848**  transformation chain.
1849**
1850**  This function is part of the International Astronomical Union's
1851**  SOFA (Standards of Fundamental Astronomy) software collection.
1852**
1853**  Status:  support function.
1854**
1855**  Given:
1856**     date1  double       TDB as a 2-part...
1857**     date2  double       ...Julian Date (Note 1)
1858**     ebpv   double[2][3] Earth barycentric pos/vel (au, au/day)
1859**     ehp    double[3]    Earth heliocentric position (au)
1860**
1861**  Returned:
1862**     astrom iauASTROM*   star-independent astrometry parameters:
1863**      pmt    double       PM time interval (SSB, Julian years)
1864**      eb     double[3]    SSB to observer (vector, au)
1865**      eh     double[3]    Sun to observer (unit vector)
1866**      em     double       distance from Sun to observer (au)
1867**      v      double[3]    barycentric observer velocity (vector, c)
1868**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
1869**      bpn    double[3][3] bias-precession-nutation matrix
1870**      along  double       unchanged
1871**      xpl    double       unchanged
1872**      ypl    double       unchanged
1873**      sphi   double       unchanged
1874**      cphi   double       unchanged
1875**      diurab double       unchanged
1876**      eral   double       unchanged
1877**      refa   double       unchanged
1878**      refb   double       unchanged
1879**
1880**  Notes:
1881**
1882**  1) The TDB date date1+date2 is a Julian Date, apportioned in any
1883**     convenient way between the two arguments.  For example,
1884**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
1885**     others:
1886**
1887**            date1          date2
1888**
1889**         2450123.7           0.0       (JD method)
1890**         2451545.0       -1421.3       (J2000 method)
1891**         2400000.5       50123.2       (MJD method)
1892**         2450123.5           0.2       (date & time method)
1893**
1894**     The JD method is the most natural and convenient to use in cases
1895**     where the loss of several decimal digits of resolution is
1896**     acceptable.  The J2000 method is best matched to the way the
1897**     argument is handled internally and will deliver the optimum
1898**     resolution.  The MJD method and the date & time methods are both
1899**     good compromises between resolution and convenience.  For most
1900**     applications of this function the choice will not be at all
1901**     critical.
1902**
1903**     TT can be used instead of TDB without any significant impact on
1904**     accuracy.
1905**
1906**  2) All the vectors are with respect to BCRS axes.
1907**
1908**  3) This is one of several functions that inserts into the astrom
1909**     structure star-independent parameters needed for the chain of
1910**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
1911**
1912**     The various functions support different classes of observer and
1913**     portions of the transformation chain:
1914**
1915**          functions         observer        transformation
1916**
1917**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
1918**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
1919**       iauApco iauApco13    terrestrial     ICRS <-> observed
1920**       iauApcs iauApcs13    space           ICRS <-> GCRS
1921**       iauAper iauAper13    terrestrial     update Earth rotation
1922**       iauApio iauApio13    terrestrial     CIRS <-> observed
1923**
1924**     Those with names ending in "13" use contemporary SOFA models to
1925**     compute the various ephemerides.  The others accept ephemerides
1926**     supplied by the caller.
1927**
1928**     The transformation from ICRS to GCRS covers space motion,
1929**     parallax, light deflection, and aberration.  From GCRS to CIRS
1930**     comprises frame bias and precession-nutation.  From CIRS to
1931**     observed takes account of Earth rotation, polar motion, diurnal
1932**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
1933**     transformation), and atmospheric refraction.
1934**
1935**  4) The context structure astrom produced by this function is used by
1936**     iauAtciq* and iauAticq*.
1937**
1938**  Called:
1939**     iauApcs      astrometry parameters, ICRS-GCRS, space observer
1940**
1941*/
1942
1943
1944
1945void iauApcg13(double date1, double date2, iauASTROM *astrom)
1946/*
1947**  - - - - - - - - - -
1948**   i a u A p c g 1 3
1949**  - - - - - - - - - -
1950**
1951**  For a geocentric observer, prepare star-independent astrometry
1952**  parameters for transformations between ICRS and GCRS coordinates.
1953**  The caller supplies the date, and SOFA models are used to predict
1954**  the Earth ephemeris.
1955**
1956**  The parameters produced by this function are required in the
1957**  parallax, light deflection and aberration parts of the astrometric
1958**  transformation chain.
1959**
1960**  This function is part of the International Astronomical Union's
1961**  SOFA (Standards of Fundamental Astronomy) software collection.
1962**
1963**  Status:  support function.
1964**
1965**  Given:
1966**     date1  double     TDB as a 2-part...
1967**     date2  double     ...Julian Date (Note 1)
1968**
1969**  Returned:
1970**     astrom iauASTROM* star-independent astrometry parameters:
1971**      pmt    double       PM time interval (SSB, Julian years)
1972**      eb     double[3]    SSB to observer (vector, au)
1973**      eh     double[3]    Sun to observer (unit vector)
1974**      em     double       distance from Sun to observer (au)
1975**      v      double[3]    barycentric observer velocity (vector, c)
1976**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
1977**      bpn    double[3][3] bias-precession-nutation matrix
1978**      along  double       unchanged
1979**      xpl    double       unchanged
1980**      ypl    double       unchanged
1981**      sphi   double       unchanged
1982**      cphi   double       unchanged
1983**      diurab double       unchanged
1984**      eral   double       unchanged
1985**      refa   double       unchanged
1986**      refb   double       unchanged
1987**
1988**  Notes:
1989**
1990**  1) The TDB date date1+date2 is a Julian Date, apportioned in any
1991**     convenient way between the two arguments.  For example,
1992**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
1993**     others:
1994**
1995**            date1          date2
1996**
1997**         2450123.7           0.0       (JD method)
1998**         2451545.0       -1421.3       (J2000 method)
1999**         2400000.5       50123.2       (MJD method)
2000**         2450123.5           0.2       (date & time method)
2001**
2002**     The JD method is the most natural and convenient to use in cases
2003**     where the loss of several decimal digits of resolution is
2004**     acceptable.  The J2000 method is best matched to the way the
2005**     argument is handled internally and will deliver the optimum
2006**     resolution.  The MJD method and the date & time methods are both
2007**     good compromises between resolution and convenience.  For most
2008**     applications of this function the choice will not be at all
2009**     critical.
2010**
2011**     TT can be used instead of TDB without any significant impact on
2012**     accuracy.
2013**
2014**  2) All the vectors are with respect to BCRS axes.
2015**
2016**  3) In cases where the caller wishes to supply his own Earth
2017**     ephemeris, the function iauApcg can be used instead of the present
2018**     function.
2019**
2020**  4) This is one of several functions that inserts into the astrom
2021**     structure star-independent parameters needed for the chain of
2022**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2023**
2024**     The various functions support different classes of observer and
2025**     portions of the transformation chain:
2026**
2027**          functions         observer        transformation
2028**
2029**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
2030**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
2031**       iauApco iauApco13    terrestrial     ICRS <-> observed
2032**       iauApcs iauApcs13    space           ICRS <-> GCRS
2033**       iauAper iauAper13    terrestrial     update Earth rotation
2034**       iauApio iauApio13    terrestrial     CIRS <-> observed
2035**
2036**     Those with names ending in "13" use contemporary SOFA models to
2037**     compute the various ephemerides.  The others accept ephemerides
2038**     supplied by the caller.
2039**
2040**     The transformation from ICRS to GCRS covers space motion,
2041**     parallax, light deflection, and aberration.  From GCRS to CIRS
2042**     comprises frame bias and precession-nutation.  From CIRS to
2043**     observed takes account of Earth rotation, polar motion, diurnal
2044**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
2045**     transformation), and atmospheric refraction.
2046**
2047**  5) The context structure astrom produced by this function is used by
2048**     iauAtciq* and iauAticq*.
2049**
2050**  Called:
2051**     iauEpv00     Earth position and velocity
2052**     iauApcg      astrometry parameters, ICRS-GCRS, geocenter
2053**
2054*/
2055
2056
2057
2058void iauApci(double date1, double date2,
2059             double ebpv[2][3], double ehp[3],
2060             double x, double y, double s,
2061             iauASTROM *astrom)
2062/*
2063**  - - - - - - - -
2064**   i a u A p c i
2065**  - - - - - - - -
2066**
2067**  For a terrestrial observer, prepare star-independent astrometry
2068**  parameters for transformations between ICRS and geocentric CIRS
2069**  coordinates.  The Earth ephemeris and CIP/CIO are supplied by the
2070**  caller.
2071**
2072**  The parameters produced by this function are required in the
2073**  parallax, light deflection, aberration, and bias-precession-nutation
2074**  parts of the astrometric transformation chain.
2075**
2076**  This function is part of the International Astronomical Union's
2077**  SOFA (Standards of Fundamental Astronomy) software collection.
2078**
2079**  Status:  support function.
2080**
2081**  Given:
2082**     date1  double       TDB as a 2-part...
2083**     date2  double       ...Julian Date (Note 1)
2084**     ebpv   double[2][3] Earth barycentric position/velocity (au, au/day)
2085**     ehp    double[3]    Earth heliocentric position (au)
2086**     x,y    double       CIP X,Y (components of unit vector)
2087**     s      double       the CIO locator s (radians)
2088**
2089**  Returned:
2090**     astrom iauASTROM*   star-independent astrometry parameters:
2091**      pmt    double       PM time interval (SSB, Julian years)
2092**      eb     double[3]    SSB to observer (vector, au)
2093**      eh     double[3]    Sun to observer (unit vector)
2094**      em     double       distance from Sun to observer (au)
2095**      v      double[3]    barycentric observer velocity (vector, c)
2096**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
2097**      bpn    double[3][3] bias-precession-nutation matrix
2098**      along  double       unchanged
2099**      xpl    double       unchanged
2100**      ypl    double       unchanged
2101**      sphi   double       unchanged
2102**      cphi   double       unchanged
2103**      diurab double       unchanged
2104**      eral   double       unchanged
2105**      refa   double       unchanged
2106**      refb   double       unchanged
2107**
2108**  Notes:
2109**
2110**  1) The TDB date date1+date2 is a Julian Date, apportioned in any
2111**     convenient way between the two arguments.  For example,
2112**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
2113**     others:
2114**
2115**            date1          date2
2116**
2117**         2450123.7           0.0       (JD method)
2118**         2451545.0       -1421.3       (J2000 method)
2119**         2400000.5       50123.2       (MJD method)
2120**         2450123.5           0.2       (date & time method)
2121**
2122**     The JD method is the most natural and convenient to use in cases
2123**     where the loss of several decimal digits of resolution is
2124**     acceptable.  The J2000 method is best matched to the way the
2125**     argument is handled internally and will deliver the optimum
2126**     resolution.  The MJD method and the date & time methods are both
2127**     good compromises between resolution and convenience.  For most
2128**     applications of this function the choice will not be at all
2129**     critical.
2130**
2131**     TT can be used instead of TDB without any significant impact on
2132**     accuracy.
2133**
2134**  2) All the vectors are with respect to BCRS axes.
2135**
2136**  3) In cases where the caller does not wish to provide the Earth
2137**     ephemeris and CIP/CIO, the function iauApci13 can be used instead
2138**     of the present function.  This computes the required quantities
2139**     using other SOFA functions.
2140**
2141**  4) This is one of several functions that inserts into the astrom
2142**     structure star-independent parameters needed for the chain of
2143**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2144**
2145**     The various functions support different classes of observer and
2146**     portions of the transformation chain:
2147**
2148**          functions         observer        transformation
2149**
2150**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
2151**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
2152**       iauApco iauApco13    terrestrial     ICRS <-> observed
2153**       iauApcs iauApcs13    space           ICRS <-> GCRS
2154**       iauAper iauAper13    terrestrial     update Earth rotation
2155**       iauApio iauApio13    terrestrial     CIRS <-> observed
2156**
2157**     Those with names ending in "13" use contemporary SOFA models to
2158**     compute the various ephemerides.  The others accept ephemerides
2159**     supplied by the caller.
2160**
2161**     The transformation from ICRS to GCRS covers space motion,
2162**     parallax, light deflection, and aberration.  From GCRS to CIRS
2163**     comprises frame bias and precession-nutation.  From CIRS to
2164**     observed takes account of Earth rotation, polar motion, diurnal
2165**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
2166**     transformation), and atmospheric refraction.
2167**
2168**  5) The context structure astrom produced by this function is used by
2169**     iauAtciq* and iauAticq*.
2170**
2171**  Called:
2172**     iauApcg      astrometry parameters, ICRS-GCRS, geocenter
2173**     iauC2ixys    celestial-to-intermediate matrix, given X,Y and s
2174**
2175*/
2176
2177
2178
2179void iauApci13(double date1, double date2,
2180               iauASTROM *astrom, double *eo)
2181/*
2182**  - - - - - - - - - -
2183**   i a u A p c i 1 3
2184**  - - - - - - - - - -
2185**
2186**  For a terrestrial observer, prepare star-independent astrometry
2187**  parameters for transformations between ICRS and geocentric CIRS
2188**  coordinates.  The caller supplies the date, and SOFA models are used
2189**  to predict the Earth ephemeris and CIP/CIO.
2190**
2191**  The parameters produced by this function are required in the
2192**  parallax, light deflection, aberration, and bias-precession-nutation
2193**  parts of the astrometric transformation chain.
2194**
2195**  This function is part of the International Astronomical Union's
2196**  SOFA (Standards of Fundamental Astronomy) software collection.
2197**
2198**  Status:  support function.
2199**
2200**  Given:
2201**     date1  double      TDB as a 2-part...
2202**     date2  double      ...Julian Date (Note 1)
2203**
2204**  Returned:
2205**     astrom iauASTROM*  star-independent astrometry parameters:
2206**      pmt    double       PM time interval (SSB, Julian years)
2207**      eb     double[3]    SSB to observer (vector, au)
2208**      eh     double[3]    Sun to observer (unit vector)
2209**      em     double       distance from Sun to observer (au)
2210**      v      double[3]    barycentric observer velocity (vector, c)
2211**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
2212**      bpn    double[3][3] bias-precession-nutation matrix
2213**      along  double       unchanged
2214**      xpl    double       unchanged
2215**      ypl    double       unchanged
2216**      sphi   double       unchanged
2217**      cphi   double       unchanged
2218**      diurab double       unchanged
2219**      eral   double       unchanged
2220**      refa   double       unchanged
2221**      refb   double       unchanged
2222**     eo     double*     equation of the origins (ERA-GST)
2223**
2224**  Notes:
2225**
2226**  1) The TDB date date1+date2 is a Julian Date, apportioned in any
2227**     convenient way between the two arguments.  For example,
2228**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
2229**     others:
2230**
2231**            date1          date2
2232**
2233**         2450123.7           0.0       (JD method)
2234**         2451545.0       -1421.3       (J2000 method)
2235**         2400000.5       50123.2       (MJD method)
2236**         2450123.5           0.2       (date & time method)
2237**
2238**     The JD method is the most natural and convenient to use in cases
2239**     where the loss of several decimal digits of resolution is
2240**     acceptable.  The J2000 method is best matched to the way the
2241**     argument is handled internally and will deliver the optimum
2242**     resolution.  The MJD method and the date & time methods are both
2243**     good compromises between resolution and convenience.  For most
2244**     applications of this function the choice will not be at all
2245**     critical.
2246**
2247**     TT can be used instead of TDB without any significant impact on
2248**     accuracy.
2249**
2250**  2) All the vectors are with respect to BCRS axes.
2251**
2252**  3) In cases where the caller wishes to supply his own Earth
2253**     ephemeris and CIP/CIO, the function iauApci can be used instead
2254**     of the present function.
2255**
2256**  4) This is one of several functions that inserts into the astrom
2257**     structure star-independent parameters needed for the chain of
2258**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2259**
2260**     The various functions support different classes of observer and
2261**     portions of the transformation chain:
2262**
2263**          functions         observer        transformation
2264**
2265**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
2266**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
2267**       iauApco iauApco13    terrestrial     ICRS <-> observed
2268**       iauApcs iauApcs13    space           ICRS <-> GCRS
2269**       iauAper iauAper13    terrestrial     update Earth rotation
2270**       iauApio iauApio13    terrestrial     CIRS <-> observed
2271**
2272**     Those with names ending in "13" use contemporary SOFA models to
2273**     compute the various ephemerides.  The others accept ephemerides
2274**     supplied by the caller.
2275**
2276**     The transformation from ICRS to GCRS covers space motion,
2277**     parallax, light deflection, and aberration.  From GCRS to CIRS
2278**     comprises frame bias and precession-nutation.  From CIRS to
2279**     observed takes account of Earth rotation, polar motion, diurnal
2280**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
2281**     transformation), and atmospheric refraction.
2282**
2283**  5) The context structure astrom produced by this function is used by
2284**     iauAtciq* and iauAticq*.
2285**
2286**  Called:
2287**     iauEpv00     Earth position and velocity
2288**     iauPnm06a    classical NPB matrix, IAU 2006/2000A
2289**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
2290**     iauS06       the CIO locator s, given X,Y, IAU 2006
2291**     iauApci      astrometry parameters, ICRS-CIRS
2292**     iauEors      equation of the origins, given NPB matrix and s
2293**
2294*/
2295
2296
2297
2298void iauApco(double date1, double date2,
2299             double ebpv[2][3], double ehp[3],
2300             double x, double y, double s, double theta,
2301             double elong, double phi, double hm,
2302             double xp, double yp, double sp,
2303             double refa, double refb,
2304             iauASTROM *astrom)
2305/*
2306**  - - - - - - - -
2307**   i a u A p c o
2308**  - - - - - - - -
2309**
2310**  For a terrestrial observer, prepare star-independent astrometry
2311**  parameters for transformations between ICRS and observed
2312**  coordinates.  The caller supplies the Earth ephemeris, the Earth
2313**  rotation information and the refraction constants as well as the
2314**  site coordinates.
2315**
2316**  This function is part of the International Astronomical Union's
2317**  SOFA (Standards of Fundamental Astronomy) software collection.
2318**
2319**  Status:  support function.
2320**
2321**  Given:
2322**     date1  double       TDB as a 2-part...
2323**     date2  double       ...Julian Date (Note 1)
2324**     ebpv   double[2][3] Earth barycentric PV (au, au/day, Note 2)
2325**     ehp    double[3]    Earth heliocentric P (au, Note 2)
2326**     x,y    double       CIP X,Y (components of unit vector)
2327**     s      double       the CIO locator s (radians)
2328**     theta  double       Earth rotation angle (radians)
2329**     elong  double       longitude (radians, east +ve, Note 3)
2330**     phi    double       latitude (geodetic, radians, Note 3)
2331**     hm     double       height above ellipsoid (m, geodetic, Note 3)
2332**     xp,yp  double       polar motion coordinates (radians, Note 4)
2333**     sp     double       the TIO locator s' (radians, Note 4)
2334**     refa   double       refraction constant A (radians, Note 5)
2335**     refb   double       refraction constant B (radians, Note 5)
2336**
2337**  Returned:
2338**     astrom iauASTROM*   star-independent astrometry parameters:
2339**      pmt    double       PM time interval (SSB, Julian years)
2340**      eb     double[3]    SSB to observer (vector, au)
2341**      eh     double[3]    Sun to observer (unit vector)
2342**      em     double       distance from Sun to observer (au)
2343**      v      double[3]    barycentric observer velocity (vector, c)
2344**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
2345**      bpn    double[3][3] bias-precession-nutation matrix
2346**      along  double       adjusted longitude (radians)
2347**      xpl    double       polar motion xp wrt local meridian (radians)
2348**      ypl    double       polar motion yp wrt local meridian (radians)
2349**      sphi   double       sine of geodetic latitude
2350**      cphi   double       cosine of geodetic latitude
2351**      diurab double       magnitude of diurnal aberration vector
2352**      eral   double       "local" Earth rotation angle (radians)
2353**      refa   double       refraction constant A (radians)
2354**      refb   double       refraction constant B (radians)
2355**
2356**  Notes:
2357**
2358**  1) The TDB date date1+date2 is a Julian Date, apportioned in any
2359**     convenient way between the two arguments.  For example,
2360**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
2361**     others:
2362**
2363**            date1          date2
2364**
2365**         2450123.7           0.0       (JD method)
2366**         2451545.0       -1421.3       (J2000 method)
2367**         2400000.5       50123.2       (MJD method)
2368**         2450123.5           0.2       (date & time method)
2369**
2370**     The JD method is the most natural and convenient to use in cases
2371**     where the loss of several decimal digits of resolution is
2372**     acceptable.  The J2000 method is best matched to the way the
2373**     argument is handled internally and will deliver the optimum
2374**     resolution.  The MJD method and the date & time methods are both
2375**     good compromises between resolution and convenience.  For most
2376**     applications of this function the choice will not be at all
2377**     critical.
2378**
2379**     TT can be used instead of TDB without any significant impact on
2380**     accuracy.
2381**
2382**  2) The vectors eb, eh, and all the astrom vectors, are with respect
2383**     to BCRS axes.
2384**
2385**  3) The geographical coordinates are with respect to the WGS84
2386**     reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN
2387**     CONVENTION:  the longitude required by the present function is
2388**     right-handed, i.e. east-positive, in accordance with geographical
2389**     convention.
2390**
2391**     The adjusted longitude stored in the astrom array takes into
2392**     account the TIO locator and polar motion.
2393**
2394**  4) xp and yp are the coordinates (in radians) of the Celestial
2395**     Intermediate Pole with respect to the International Terrestrial
2396**     Reference System (see IERS Conventions), measured along the
2397**     meridians 0 and 90 deg west respectively.  sp is the TIO locator
2398**     s', in radians, which positions the Terrestrial Intermediate
2399**     Origin on the equator.  For many applications, xp, yp and
2400**     (especially) sp can be set to zero.
2401**
2402**     Internally, the polar motion is stored in a form rotated onto the
2403**     local meridian.
2404**
2405**  5) The refraction constants refa and refb are for use in a
2406**     dZ = A*tan(Z)+B*tan^3(Z) model, where Z is the observed
2407**     (i.e. refracted) zenith distance and dZ is the amount of
2408**     refraction.
2409**
2410**  6) It is advisable to take great care with units, as even unlikely
2411**     values of the input parameters are accepted and processed in
2412**     accordance with the models used.
2413**
2414**  7) In cases where the caller does not wish to provide the Earth
2415**     Ephemeris, the Earth rotation information and refraction
2416**     constants, the function iauApco13 can be used instead of the
2417**     present function.  This starts from UTC and weather readings etc.
2418**     and computes suitable values using other SOFA functions.
2419**
2420**  8) This is one of several functions that inserts into the astrom
2421**     structure star-independent parameters needed for the chain of
2422**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2423**
2424**     The various functions support different classes of observer and
2425**     portions of the transformation chain:
2426**
2427**          functions         observer        transformation
2428**
2429**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
2430**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
2431**       iauApco iauApco13    terrestrial     ICRS <-> observed
2432**       iauApcs iauApcs13    space           ICRS <-> GCRS
2433**       iauAper iauAper13    terrestrial     update Earth rotation
2434**       iauApio iauApio13    terrestrial     CIRS <-> observed
2435**
2436**     Those with names ending in "13" use contemporary SOFA models to
2437**     compute the various ephemerides.  The others accept ephemerides
2438**     supplied by the caller.
2439**
2440**     The transformation from ICRS to GCRS covers space motion,
2441**     parallax, light deflection, and aberration.  From GCRS to CIRS
2442**     comprises frame bias and precession-nutation.  From CIRS to
2443**     observed takes account of Earth rotation, polar motion, diurnal
2444**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
2445**     transformation), and atmospheric refraction.
2446**
2447**  9) The context structure astrom produced by this function is used by
2448**     iauAtioq, iauAtoiq, iauAtciq* and iauAticq*.
2449**
2450**  Called:
2451**     iauIr        initialize r-matrix to identity
2452**     iauRz        rotate around Z-axis
2453**     iauRy        rotate around Y-axis
2454**     iauRx        rotate around X-axis
2455**     iauAnpm      normalize angle into range +/- pi
2456**     iauC2ixys    celestial-to-intermediate matrix, given X,Y and s
2457**     iauPvtob     position/velocity of terrestrial station
2458**     iauTrxpv     product of transpose of r-matrix and pv-vector
2459**     iauApcs      astrometry parameters, ICRS-GCRS, space observer
2460**     iauCr        copy r-matrix
2461**
2462*/
2463
2464
2465
2466int iauApco13(double utc1, double utc2, double dut1,
2467              double elong, double phi, double hm, double xp, double yp,
2468              double phpa, double tc, double rh, double wl,
2469              iauASTROM *astrom, double *eo)
2470/*
2471**  - - - - - - - - - -
2472**   i a u A p c o 1 3
2473**  - - - - - - - - - -
2474**
2475**  For a terrestrial observer, prepare star-independent astrometry
2476**  parameters for transformations between ICRS and observed
2477**  coordinates.  The caller supplies UTC, site coordinates, ambient air
2478**  conditions and observing wavelength, and SOFA models are used to
2479**  obtain the Earth ephemeris, CIP/CIO and refraction constants.
2480**
2481**  The parameters produced by this function are required in the
2482**  parallax, light deflection, aberration, and bias-precession-nutation
2483**  parts of the ICRS/CIRS transformations.
2484**
2485**  This function is part of the International Astronomical Union's
2486**  SOFA (Standards of Fundamental Astronomy) software collection.
2487**
2488**  Status:  support function.
2489**
2490**  Given:
2491**     utc1   double     UTC as a 2-part...
2492**     utc2   double     ...quasi Julian Date (Notes 1,2)
2493**     dut1   double     UT1-UTC (seconds, Note 3)
2494**     elong  double     longitude (radians, east +ve, Note 4)
2495**     phi    double     latitude (geodetic, radians, Note 4)
2496**     hm     double     height above ellipsoid (m, geodetic, Notes 4,6)
2497**     xp,yp  double     polar motion coordinates (radians, Note 5)
2498**     phpa   double     pressure at the observer (hPa = mB, Note 6)
2499**     tc     double     ambient temperature at the observer (deg C)
2500**     rh     double     relative humidity at the observer (range 0-1)
2501**     wl     double     wavelength (micrometers, Note 7)
2502**
2503**  Returned:
2504**     astrom iauASTROM* star-independent astrometry parameters:
2505**      pmt    double       PM time interval (SSB, Julian years)
2506**      eb     double[3]    SSB to observer (vector, au)
2507**      eh     double[3]    Sun to observer (unit vector)
2508**      em     double       distance from Sun to observer (au)
2509**      v      double[3]    barycentric observer velocity (vector, c)
2510**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
2511**      bpn    double[3][3] bias-precession-nutation matrix
2512**      along  double       longitude + s' (radians)
2513**      xpl    double       polar motion xp wrt local meridian (radians)
2514**      ypl    double       polar motion yp wrt local meridian (radians)
2515**      sphi   double       sine of geodetic latitude
2516**      cphi   double       cosine of geodetic latitude
2517**      diurab double       magnitude of diurnal aberration vector
2518**      eral   double       "local" Earth rotation angle (radians)
2519**      refa   double       refraction constant A (radians)
2520**      refb   double       refraction constant B (radians)
2521**     eo     double*    equation of the origins (ERA-GST)
2522**
2523**  Returned (function value):
2524**            int        status: +1 = dubious year (Note 2)
2525**                                0 = OK
2526**                               -1 = unacceptable date
2527**
2528**  Notes:
2529**
2530**  1)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
2531**      convenient way between the two arguments, for example where utc1
2532**      is the Julian Day Number and utc2 is the fraction of a day.
2533**
2534**      However, JD cannot unambiguously represent UTC during a leap
2535**      second unless special measures are taken.  The convention in the
2536**      present function is that the JD day represents UTC days whether
2537**      the length is 86399, 86400 or 86401 SI seconds.
2538**
2539**      Applications should use the function iauDtf2d to convert from
2540**      calendar date and time of day into 2-part quasi Julian Date, as
2541**      it implements the leap-second-ambiguity convention just
2542**      described.
2543**
2544**  2)  The warning status "dubious year" flags UTCs that predate the
2545**      introduction of the time scale or that are too far in the
2546**      future to be trusted.  See iauDat for further details.
2547**
2548**  3)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
2549**      one second at the end of each positive UTC leap second,
2550**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
2551**      practice is under review, and in the future UT1-UTC may grow
2552**      essentially without limit.
2553**
2554**  4)  The geographical coordinates are with respect to the WGS84
2555**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
2556**      longitude required by the present function is east-positive
2557**      (i.e. right-handed), in accordance with geographical convention.
2558**
2559**  5)  The polar motion xp,yp can be obtained from IERS bulletins.  The
2560**      values are the coordinates (in radians) of the Celestial
2561**      Intermediate Pole with respect to the International Terrestrial
2562**      Reference System (see IERS Conventions 2003), measured along the
2563**      meridians 0 and 90 deg west respectively.  For many
2564**      applications, xp and yp can be set to zero.
2565**
2566**      Internally, the polar motion is stored in a form rotated onto
2567**      the local meridian.
2568**
2569**  6)  If hm, the height above the ellipsoid of the observing station
2570**      in meters, is not known but phpa, the pressure in hPa (=mB), is
2571**      available, an adequate estimate of hm can be obtained from the
2572**      expression
2573**
2574**            hm = -29.3 * tsl * log ( phpa / 1013.25 );
2575**
2576**      where tsl is the approximate sea-level air temperature in K
2577**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
2578**      52).  Similarly, if the pressure phpa is not known, it can be
2579**      estimated from the height of the observing station, hm, as
2580**      follows:
2581**
2582**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
2583**
2584**      Note, however, that the refraction is nearly proportional to
2585**      the pressure and that an accurate phpa value is important for
2586**      precise work.
2587**
2588**  7)  The argument wl specifies the observing wavelength in
2589**      micrometers.  The transition from optical to radio is assumed to
2590**      occur at 100 micrometers (about 3000 GHz).
2591**
2592**  8)  It is advisable to take great care with units, as even unlikely
2593**      values of the input parameters are accepted and processed in
2594**      accordance with the models used.
2595**
2596**  9)  In cases where the caller wishes to supply his own Earth
2597**      ephemeris, Earth rotation information and refraction constants,
2598**      the function iauApco can be used instead of the present function.
2599**
2600**  10) This is one of several functions that inserts into the astrom
2601**      structure star-independent parameters needed for the chain of
2602**      astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2603**
2604**      The various functions support different classes of observer and
2605**      portions of the transformation chain:
2606**
2607**          functions         observer        transformation
2608**
2609**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
2610**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
2611**       iauApco iauApco13    terrestrial     ICRS <-> observed
2612**       iauApcs iauApcs13    space           ICRS <-> GCRS
2613**       iauAper iauAper13    terrestrial     update Earth rotation
2614**       iauApio iauApio13    terrestrial     CIRS <-> observed
2615**
2616**      Those with names ending in "13" use contemporary SOFA models to
2617**      compute the various ephemerides.  The others accept ephemerides
2618**      supplied by the caller.
2619**
2620**      The transformation from ICRS to GCRS covers space motion,
2621**      parallax, light deflection, and aberration.  From GCRS to CIRS
2622**      comprises frame bias and precession-nutation.  From CIRS to
2623**      observed takes account of Earth rotation, polar motion, diurnal
2624**      aberration and parallax (unless subsumed into the ICRS <-> GCRS
2625**      transformation), and atmospheric refraction.
2626**
2627**  11) The context structure astrom produced by this function is used
2628**      by iauAtioq, iauAtoiq, iauAtciq* and iauAticq*.
2629**
2630**  Called:
2631**     iauUtctai    UTC to TAI
2632**     iauTaitt     TAI to TT
2633**     iauUtcut1    UTC to UT1
2634**     iauEpv00     Earth position and velocity
2635**     iauPnm06a    classical NPB matrix, IAU 2006/2000A
2636**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
2637**     iauS06       the CIO locator s, given X,Y, IAU 2006
2638**     iauEra00     Earth rotation angle, IAU 2000
2639**     iauSp00      the TIO locator s', IERS 2000
2640**     iauRefco     refraction constants for given ambient conditions
2641**     iauApco      astrometry parameters, ICRS-observed
2642**     iauEors      equation of the origins, given NPB matrix and s
2643**
2644*/
2645
2646
2647
2648void iauApcs(double date1, double date2, double pv[2][3],
2649             double ebpv[2][3], double ehp[3],
2650             iauASTROM *astrom)
2651/*
2652**  - - - - - - - -
2653**   i a u A p c s
2654**  - - - - - - - -
2655**
2656**  For an observer whose geocentric position and velocity are known,
2657**  prepare star-independent astrometry parameters for transformations
2658**  between ICRS and GCRS.  The Earth ephemeris is supplied by the
2659**  caller.
2660**
2661**  The parameters produced by this function are required in the space
2662**  motion, parallax, light deflection and aberration parts of the
2663**  astrometric transformation chain.
2664**
2665**  This function is part of the International Astronomical Union's
2666**  SOFA (Standards of Fundamental Astronomy) software collection.
2667**
2668**  Status:  support function.
2669**
2670**  Given:
2671**     date1  double       TDB as a 2-part...
2672**     date2  double       ...Julian Date (Note 1)
2673**     pv     double[2][3] observer's geocentric pos/vel (m, m/s)
2674**     ebpv   double[2][3] Earth barycentric PV (au, au/day)
2675**     ehp    double[3]    Earth heliocentric P (au)
2676**
2677**  Returned:
2678**     astrom iauASTROM*   star-independent astrometry parameters:
2679**      pmt    double       PM time interval (SSB, Julian years)
2680**      eb     double[3]    SSB to observer (vector, au)
2681**      eh     double[3]    Sun to observer (unit vector)
2682**      em     double       distance from Sun to observer (au)
2683**      v      double[3]    barycentric observer velocity (vector, c)
2684**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
2685**      bpn    double[3][3] bias-precession-nutation matrix
2686**      along  double       unchanged
2687**      xpl    double       unchanged
2688**      ypl    double       unchanged
2689**      sphi   double       unchanged
2690**      cphi   double       unchanged
2691**      diurab double       unchanged
2692**      eral   double       unchanged
2693**      refa   double       unchanged
2694**      refb   double       unchanged
2695**
2696**  Notes:
2697**
2698**  1) The TDB date date1+date2 is a Julian Date, apportioned in any
2699**     convenient way between the two arguments.  For example,
2700**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
2701**     others:
2702**
2703**            date1          date2
2704**
2705**         2450123.7           0.0       (JD method)
2706**         2451545.0       -1421.3       (J2000 method)
2707**         2400000.5       50123.2       (MJD method)
2708**         2450123.5           0.2       (date & time method)
2709**
2710**     The JD method is the most natural and convenient to use in cases
2711**     where the loss of several decimal digits of resolution is
2712**     acceptable.  The J2000 method is best matched to the way the
2713**     argument is handled internally and will deliver the optimum
2714**     resolution.  The MJD method and the date & time methods are both
2715**     good compromises between resolution and convenience.  For most
2716**     applications of this function the choice will not be at all
2717**     critical.
2718**
2719**     TT can be used instead of TDB without any significant impact on
2720**     accuracy.
2721**
2722**  2) All the vectors are with respect to BCRS axes.
2723**
2724**  3) Providing separate arguments for (i) the observer's geocentric
2725**     position and velocity and (ii) the Earth ephemeris is done for
2726**     convenience in the geocentric, terrestrial and Earth orbit cases.
2727**     For deep space applications it maybe more convenient to specify
2728**     zero geocentric position and velocity and to supply the
2729**     observer's position and velocity information directly instead of
2730**     with respect to the Earth.  However, note the different units:
2731**     m and m/s for the geocentric vectors, au and au/day for the
2732**     heliocentric and barycentric vectors.
2733**
2734**  4) In cases where the caller does not wish to provide the Earth
2735**     ephemeris, the function iauApcs13 can be used instead of the
2736**     present function.  This computes the Earth ephemeris using the
2737**     SOFA function iauEpv00.
2738**
2739**  5) This is one of several functions that inserts into the astrom
2740**     structure star-independent parameters needed for the chain of
2741**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2742**
2743**     The various functions support different classes of observer and
2744**     portions of the transformation chain:
2745**
2746**          functions         observer        transformation
2747**
2748**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
2749**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
2750**       iauApco iauApco13    terrestrial     ICRS <-> observed
2751**       iauApcs iauApcs13    space           ICRS <-> GCRS
2752**       iauAper iauAper13    terrestrial     update Earth rotation
2753**       iauApio iauApio13    terrestrial     CIRS <-> observed
2754**
2755**     Those with names ending in "13" use contemporary SOFA models to
2756**     compute the various ephemerides.  The others accept ephemerides
2757**     supplied by the caller.
2758**
2759**     The transformation from ICRS to GCRS covers space motion,
2760**     parallax, light deflection, and aberration.  From GCRS to CIRS
2761**     comprises frame bias and precession-nutation.  From CIRS to
2762**     observed takes account of Earth rotation, polar motion, diurnal
2763**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
2764**     transformation), and atmospheric refraction.
2765**
2766**  6) The context structure astrom produced by this function is used by
2767**     iauAtciq* and iauAticq*.
2768**
2769**  Called:
2770**     iauCp        copy p-vector
2771**     iauPm        modulus of p-vector
2772**     iauPn        decompose p-vector into modulus and direction
2773**     iauIr        initialize r-matrix to identity
2774**
2775*/
2776
2777
2778
2779void iauApcs13(double date1, double date2, double pv[2][3],
2780               iauASTROM *astrom)
2781/*
2782**  - - - - - - - - - -
2783**   i a u A p c s 1 3
2784**  - - - - - - - - - -
2785**
2786**  For an observer whose geocentric position and velocity are known,
2787**  prepare star-independent astrometry parameters for transformations
2788**  between ICRS and GCRS.  The Earth ephemeris is from SOFA models.
2789**
2790**  The parameters produced by this function are required in the space
2791**  motion, parallax, light deflection and aberration parts of the
2792**  astrometric transformation chain.
2793**
2794**  This function is part of the International Astronomical Union's
2795**  SOFA (Standards of Fundamental Astronomy) software collection.
2796**
2797**  Status:  support function.
2798**
2799**  Given:
2800**     date1  double       TDB as a 2-part...
2801**     date2  double       ...Julian Date (Note 1)
2802**     pv     double[2][3] observer's geocentric pos/vel (Note 3)
2803**
2804**  Returned:
2805**     astrom iauASTROM*   star-independent astrometry parameters:
2806**      pmt    double       PM time interval (SSB, Julian years)
2807**      eb     double[3]    SSB to observer (vector, au)
2808**      eh     double[3]    Sun to observer (unit vector)
2809**      em     double       distance from Sun to observer (au)
2810**      v      double[3]    barycentric observer velocity (vector, c)
2811**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
2812**      bpn    double[3][3] bias-precession-nutation matrix
2813**      along  double       unchanged
2814**      xpl    double       unchanged
2815**      ypl    double       unchanged
2816**      sphi   double       unchanged
2817**      cphi   double       unchanged
2818**      diurab double       unchanged
2819**      eral   double       unchanged
2820**      refa   double       unchanged
2821**      refb   double       unchanged
2822**
2823**  Notes:
2824**
2825**  1) The TDB date date1+date2 is a Julian Date, apportioned in any
2826**     convenient way between the two arguments.  For example,
2827**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
2828**     others:
2829**
2830**            date1          date2
2831**
2832**         2450123.7           0.0       (JD method)
2833**         2451545.0       -1421.3       (J2000 method)
2834**         2400000.5       50123.2       (MJD method)
2835**         2450123.5           0.2       (date & time method)
2836**
2837**     The JD method is the most natural and convenient to use in cases
2838**     where the loss of several decimal digits of resolution is
2839**     acceptable.  The J2000 method is best matched to the way the
2840**     argument is handled internally and will deliver the optimum
2841**     resolution.  The MJD method and the date & time methods are both
2842**     good compromises between resolution and convenience.  For most
2843**     applications of this function the choice will not be at all
2844**     critical.
2845**
2846**     TT can be used instead of TDB without any significant impact on
2847**     accuracy.
2848**
2849**  2) All the vectors are with respect to BCRS axes.
2850**
2851**  3) The observer's position and velocity pv are geocentric but with
2852**     respect to BCRS axes, and in units of m and m/s.  No assumptions
2853**     are made about proximity to the Earth, and the function can be
2854**     used for deep space applications as well as Earth orbit and
2855**     terrestrial.
2856**
2857**  4) In cases where the caller wishes to supply his own Earth
2858**     ephemeris, the function iauApcs can be used instead of the present
2859**     function.
2860**
2861**  5) This is one of several functions that inserts into the astrom
2862**     structure star-independent parameters needed for the chain of
2863**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2864**
2865**     The various functions support different classes of observer and
2866**     portions of the transformation chain:
2867**
2868**          functions         observer        transformation
2869**
2870**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
2871**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
2872**       iauApco iauApco13    terrestrial     ICRS <-> observed
2873**       iauApcs iauApcs13    space           ICRS <-> GCRS
2874**       iauAper iauAper13    terrestrial     update Earth rotation
2875**       iauApio iauApio13    terrestrial     CIRS <-> observed
2876**
2877**     Those with names ending in "13" use contemporary SOFA models to
2878**     compute the various ephemerides.  The others accept ephemerides
2879**     supplied by the caller.
2880**
2881**     The transformation from ICRS to GCRS covers space motion,
2882**     parallax, light deflection, and aberration.  From GCRS to CIRS
2883**     comprises frame bias and precession-nutation.  From CIRS to
2884**     observed takes account of Earth rotation, polar motion, diurnal
2885**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
2886**     transformation), and atmospheric refraction.
2887**
2888**  6) The context structure astrom produced by this function is used by
2889**     iauAtciq* and iauAticq*.
2890**
2891**  Called:
2892**     iauEpv00     Earth position and velocity
2893**     iauApcs      astrometry parameters, ICRS-GCRS, space observer
2894**
2895*/
2896
2897
2898
2899void iauAper(double theta, iauASTROM *astrom)
2900/*
2901**  - - - - - - - -
2902**   i a u A p e r
2903**  - - - - - - - -
2904**
2905**  In the star-independent astrometry parameters, update only the
2906**  Earth rotation angle, supplied by the caller explicitly.
2907**
2908**  This function is part of the International Astronomical Union's
2909**  SOFA (Standards of Fundamental Astronomy) software collection.
2910**
2911**  Status:  support function.
2912**
2913**  Given:
2914**     theta   double      Earth rotation angle (radians, Note 2)
2915**     astrom  iauASTROM*  star-independent astrometry parameters:
2916**      pmt    double       not used
2917**      eb     double[3]    not used
2918**      eh     double[3]    not used
2919**      em     double       not used
2920**      v      double[3]    not used
2921**      bm1    double       not used
2922**      bpn    double[3][3] not used
2923**      along  double       longitude + s' (radians)
2924**      xpl    double       not used
2925**      ypl    double       not used
2926**      sphi   double       not used
2927**      cphi   double       not used
2928**      diurab double       not used
2929**      eral   double       not used
2930**      refa   double       not used
2931**      refb   double       not used
2932**
2933**  Returned:
2934**     astrom  iauASTROM*  star-independent astrometry parameters:
2935**      pmt    double       unchanged
2936**      eb     double[3]    unchanged
2937**      eh     double[3]    unchanged
2938**      em     double       unchanged
2939**      v      double[3]    unchanged
2940**      bm1    double       unchanged
2941**      bpn    double[3][3] unchanged
2942**      along  double       unchanged
2943**      xpl    double       unchanged
2944**      ypl    double       unchanged
2945**      sphi   double       unchanged
2946**      cphi   double       unchanged
2947**      diurab double       unchanged
2948**      eral   double       "local" Earth rotation angle (radians)
2949**      refa   double       unchanged
2950**      refb   double       unchanged
2951**
2952**  Notes:
2953**
2954**  1) This function exists to enable sidereal-tracking applications to
2955**     avoid wasteful recomputation of the bulk of the astrometry
2956**     parameters:  only the Earth rotation is updated.
2957**
2958**  2) For targets expressed as equinox based positions, such as
2959**     classical geocentric apparent (RA,Dec), the supplied theta can be
2960**     Greenwich apparent sidereal time rather than Earth rotation
2961**     angle.
2962**
2963**  3) The function iauAper13 can be used instead of the present
2964**     function, and starts from UT1 rather than ERA itself.
2965**
2966**  4) This is one of several functions that inserts into the astrom
2967**     structure star-independent parameters needed for the chain of
2968**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2969**
2970**     The various functions support different classes of observer and
2971**     portions of the transformation chain:
2972**
2973**          functions         observer        transformation
2974**
2975**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
2976**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
2977**       iauApco iauApco13    terrestrial     ICRS <-> observed
2978**       iauApcs iauApcs13    space           ICRS <-> GCRS
2979**       iauAper iauAper13    terrestrial     update Earth rotation
2980**       iauApio iauApio13    terrestrial     CIRS <-> observed
2981**
2982**     Those with names ending in "13" use contemporary SOFA models to
2983**     compute the various ephemerides.  The others accept ephemerides
2984**     supplied by the caller.
2985**
2986**     The transformation from ICRS to GCRS covers space motion,
2987**     parallax, light deflection, and aberration.  From GCRS to CIRS
2988**     comprises frame bias and precession-nutation.  From CIRS to
2989**     observed takes account of Earth rotation, polar motion, diurnal
2990**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
2991**     transformation), and atmospheric refraction.
2992**
2993*/
2994
2995
2996
2997void iauAper13(double ut11, double ut12, iauASTROM *astrom)
2998/*
2999**  - - - - - - - - - -
3000**   i a u A p e r 1 3
3001**  - - - - - - - - - -
3002**
3003**  In the star-independent astrometry parameters, update only the
3004**  Earth rotation angle.  The caller provides UT1, (n.b. not UTC).
3005**
3006**  This function is part of the International Astronomical Union's
3007**  SOFA (Standards of Fundamental Astronomy) software collection.
3008**
3009**  Status:  support function.
3010**
3011**  Given:
3012**     ut11    double      UT1 as a 2-part...
3013**     ut12    double      ...Julian Date (Note 1)
3014**     astrom  iauASTROM*  star-independent astrometry parameters:
3015**      pmt    double       not used
3016**      eb     double[3]    not used
3017**      eh     double[3]    not used
3018**      em     double       not used
3019**      v      double[3]    not used
3020**      bm1    double       not used
3021**      bpn    double[3][3] not used
3022**      along  double       longitude + s' (radians)
3023**      xpl    double       not used
3024**      ypl    double       not used
3025**      sphi   double       not used
3026**      cphi   double       not used
3027**      diurab double       not used
3028**      eral   double       not used
3029**      refa   double       not used
3030**      refb   double       not used
3031**
3032**  Returned:
3033**     astrom  iauASTROM*  star-independent astrometry parameters:
3034**      pmt    double       unchanged
3035**      eb     double[3]    unchanged
3036**      eh     double[3]    unchanged
3037**      em     double       unchanged
3038**      v      double[3]    unchanged
3039**      bm1    double       unchanged
3040**      bpn    double[3][3] unchanged
3041**      along  double       unchanged
3042**      xpl    double       unchanged
3043**      ypl    double       unchanged
3044**      sphi   double       unchanged
3045**      cphi   double       unchanged
3046**      diurab double       unchanged
3047**      eral   double       "local" Earth rotation angle (radians)
3048**      refa   double       unchanged
3049**      refb   double       unchanged
3050**
3051**  Notes:
3052**
3053**  1) The UT1 date (n.b. not UTC) ut11+ut12 is a Julian Date,
3054**     apportioned in any convenient way between the arguments ut11 and
3055**     ut12.  For example, JD(UT1)=2450123.7 could be expressed in any
3056**     of these ways, among others:
3057**
3058**            ut11           ut12
3059**
3060**         2450123.7           0.0       (JD method)
3061**         2451545.0       -1421.3       (J2000 method)
3062**         2400000.5       50123.2       (MJD method)
3063**         2450123.5           0.2       (date & time method)
3064**
3065**     The JD method is the most natural and convenient to use in cases
3066**     where the loss of several decimal digits of resolution is
3067**     acceptable.  The J2000 and MJD methods are good compromises
3068**     between resolution and convenience.  The date & time method is
3069**     best matched to the algorithm used:  maximum precision is
3070**     delivered when the ut11 argument is for 0hrs UT1 on the day in
3071**     question and the ut12 argument lies in the range 0 to 1, or vice
3072**     versa.
3073**
3074**  2) If the caller wishes to provide the Earth rotation angle itself,
3075**     the function iauAper can be used instead.  One use of this
3076**     technique is to substitute Greenwich apparent sidereal time and
3077**     thereby to support equinox based transformations directly.
3078**
3079**  3) This is one of several functions that inserts into the astrom
3080**     structure star-independent parameters needed for the chain of
3081**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
3082**
3083**     The various functions support different classes of observer and
3084**     portions of the transformation chain:
3085**
3086**          functions         observer        transformation
3087**
3088**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
3089**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
3090**       iauApco iauApco13    terrestrial     ICRS <-> observed
3091**       iauApcs iauApcs13    space           ICRS <-> GCRS
3092**       iauAper iauAper13    terrestrial     update Earth rotation
3093**       iauApio iauApio13    terrestrial     CIRS <-> observed
3094**
3095**     Those with names ending in "13" use contemporary SOFA models to
3096**     compute the various ephemerides.  The others accept ephemerides
3097**     supplied by the caller.
3098**
3099**     The transformation from ICRS to GCRS covers space motion,
3100**     parallax, light deflection, and aberration.  From GCRS to CIRS
3101**     comprises frame bias and precession-nutation.  From CIRS to
3102**     observed takes account of Earth rotation, polar motion, diurnal
3103**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
3104**     transformation), and atmospheric refraction.
3105**
3106**  Called:
3107**     iauAper      astrometry parameters: update ERA
3108**     iauEra00     Earth rotation angle, IAU 2000
3109**
3110*/
3111
3112
3113
3114void iauApio(double sp, double theta,
3115             double elong, double phi, double hm, double xp, double yp,
3116             double refa, double refb,
3117             iauASTROM *astrom)
3118/*
3119**  - - - - - - - -
3120**   i a u A p i o
3121**  - - - - - - - -
3122**
3123**  For a terrestrial observer, prepare star-independent astrometry
3124**  parameters for transformations between CIRS and observed
3125**  coordinates.  The caller supplies the Earth orientation information
3126**  and the refraction constants as well as the site coordinates.
3127**
3128**  This function is part of the International Astronomical Union's
3129**  SOFA (Standards of Fundamental Astronomy) software collection.
3130**
3131**  Status:  support function.
3132**
3133**  Given:
3134**     sp     double      the TIO locator s' (radians, Note 1)
3135**     theta  double      Earth rotation angle (radians)
3136**     elong  double      longitude (radians, east +ve, Note 2)
3137**     phi    double      geodetic latitude (radians, Note 2)
3138**     hm     double      height above ellipsoid (m, geodetic Note 2)
3139**     xp,yp  double      polar motion coordinates (radians, Note 3)
3140**     refa   double      refraction constant A (radians, Note 4)
3141**     refb   double      refraction constant B (radians, Note 4)
3142**
3143**  Returned:
3144**     astrom iauASTROM*  star-independent astrometry parameters:
3145**      pmt    double       unchanged
3146**      eb     double[3]    unchanged
3147**      eh     double[3]    unchanged
3148**      em     double       unchanged
3149**      v      double[3]    unchanged
3150**      bm1    double       unchanged
3151**      bpn    double[3][3] unchanged
3152**      along  double       adjusted longitude (radians)
3153**      xpl    double       polar motion xp wrt local meridian (radians)
3154**      ypl    double       polar motion yp wrt local meridian (radians)
3155**      sphi   double       sine of geodetic latitude
3156**      cphi   double       cosine of geodetic latitude
3157**      diurab double       magnitude of diurnal aberration vector
3158**      eral   double       "local" Earth rotation angle (radians)
3159**      refa   double       refraction constant A (radians)
3160**      refb   double       refraction constant B (radians)
3161**
3162**  Notes:
3163**
3164**  1) sp, the TIO locator s', is a tiny quantity needed only by the
3165**     most precise applications.  It can either be set to zero or
3166**     predicted using the SOFA function iauSp00.
3167**
3168**  2) The geographical coordinates are with respect to the WGS84
3169**     reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
3170**     longitude required by the present function is east-positive
3171**     (i.e. right-handed), in accordance with geographical convention.
3172**
3173**  3) The polar motion xp,yp can be obtained from IERS bulletins.  The
3174**     values are the coordinates (in radians) of the Celestial
3175**     Intermediate Pole with respect to the International Terrestrial
3176**     Reference System (see IERS Conventions 2003), measured along the
3177**     meridians 0 and 90 deg west respectively.  For many applications,
3178**     xp and yp can be set to zero.
3179**
3180**     Internally, the polar motion is stored in a form rotated onto the
3181**     local meridian.
3182**
3183**  4) The refraction constants refa and refb are for use in a
3184**     dZ = A*tan(Z)+B*tan^3(Z) model, where Z is the observed
3185**     (i.e. refracted) zenith distance and dZ is the amount of
3186**     refraction.
3187**
3188**  5) It is advisable to take great care with units, as even unlikely
3189**     values of the input parameters are accepted and processed in
3190**     accordance with the models used.
3191**
3192**  6) In cases where the caller does not wish to provide the Earth
3193**     rotation information and refraction constants, the function
3194**     iauApio13 can be used instead of the present function.  This
3195**     starts from UTC and weather readings etc. and computes suitable
3196**     values using other SOFA functions.
3197**
3198**  7) This is one of several functions that inserts into the astrom
3199**     structure star-independent parameters needed for the chain of
3200**     astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
3201**
3202**     The various functions support different classes of observer and
3203**     portions of the transformation chain:
3204**
3205**          functions         observer        transformation
3206**
3207**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
3208**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
3209**       iauApco iauApco13    terrestrial     ICRS <-> observed
3210**       iauApcs iauApcs13    space           ICRS <-> GCRS
3211**       iauAper iauAper13    terrestrial     update Earth rotation
3212**       iauApio iauApio13    terrestrial     CIRS <-> observed
3213**
3214**     Those with names ending in "13" use contemporary SOFA models to
3215**     compute the various ephemerides.  The others accept ephemerides
3216**     supplied by the caller.
3217**
3218**     The transformation from ICRS to GCRS covers space motion,
3219**     parallax, light deflection, and aberration.  From GCRS to CIRS
3220**     comprises frame bias and precession-nutation.  From CIRS to
3221**     observed takes account of Earth rotation, polar motion, diurnal
3222**     aberration and parallax (unless subsumed into the ICRS <-> GCRS
3223**     transformation), and atmospheric refraction.
3224**
3225**  8) The context structure astrom produced by this function is used by
3226**     iauAtioq and iauAtoiq.
3227**
3228**  Called:
3229**     iauIr        initialize r-matrix to identity
3230**     iauRz        rotate around Z-axis
3231**     iauRy        rotate around Y-axis
3232**     iauRx        rotate around X-axis
3233**     iauAnpm      normalize angle into range +/- pi
3234**     iauPvtob     position/velocity of terrestrial station
3235**
3236*/
3237
3238
3239
3240int iauApio13(double utc1, double utc2, double dut1,
3241              double elong, double phi, double hm, double xp, double yp,
3242              double phpa, double tc, double rh, double wl,
3243              iauASTROM *astrom)
3244/*
3245**  - - - - - - - - - -
3246**   i a u A p i o 1 3
3247**  - - - - - - - - - -
3248**
3249**  For a terrestrial observer, prepare star-independent astrometry
3250**  parameters for transformations between CIRS and observed
3251**  coordinates.  The caller supplies UTC, site coordinates, ambient air
3252**  conditions and observing wavelength.
3253**
3254**  This function is part of the International Astronomical Union's
3255**  SOFA (Standards of Fundamental Astronomy) software collection.
3256**
3257**  Status:  support function.
3258**
3259**  Given:
3260**     utc1   double      UTC as a 2-part...
3261**     utc2   double      ...quasi Julian Date (Notes 1,2)
3262**     dut1   double      UT1-UTC (seconds)
3263**     elong  double      longitude (radians, east +ve, Note 3)
3264**     phi    double      geodetic latitude (radians, Note 3)
3265**     hm     double      height above ellipsoid (m, geodetic Notes 4,6)
3266**     xp,yp  double      polar motion coordinates (radians, Note 5)
3267**     phpa   double      pressure at the observer (hPa = mB, Note 6)
3268**     tc     double      ambient temperature at the observer (deg C)
3269**     rh     double      relative humidity at the observer (range 0-1)
3270**     wl     double      wavelength (micrometers, Note 7)
3271**
3272**  Returned:
3273**     astrom iauASTROM*  star-independent astrometry parameters:
3274**      pmt    double       unchanged
3275**      eb     double[3]    unchanged
3276**      eh     double[3]    unchanged
3277**      em     double       unchanged
3278**      v      double[3]    unchanged
3279**      bm1    double       unchanged
3280**      bpn    double[3][3] unchanged
3281**      along  double       longitude + s' (radians)
3282**      xpl    double       polar motion xp wrt local meridian (radians)
3283**      ypl    double       polar motion yp wrt local meridian (radians)
3284**      sphi   double       sine of geodetic latitude
3285**      cphi   double       cosine of geodetic latitude
3286**      diurab double       magnitude of diurnal aberration vector
3287**      eral   double       "local" Earth rotation angle (radians)
3288**      refa   double       refraction constant A (radians)
3289**      refb   double       refraction constant B (radians)
3290**
3291**  Returned (function value):
3292**            int         status: +1 = dubious year (Note 2)
3293**                                 0 = OK
3294**                                -1 = unacceptable date
3295**
3296**  Notes:
3297**
3298**  1)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
3299**      convenient way between the two arguments, for example where utc1
3300**      is the Julian Day Number and utc2 is the fraction of a day.
3301**
3302**      However, JD cannot unambiguously represent UTC during a leap
3303**      second unless special measures are taken.  The convention in the
3304**      present function is that the JD day represents UTC days whether
3305**      the length is 86399, 86400 or 86401 SI seconds.
3306**
3307**      Applications should use the function iauDtf2d to convert from
3308**      calendar date and time of day into 2-part quasi Julian Date, as
3309**      it implements the leap-second-ambiguity convention just
3310**      described.
3311**
3312**  2)  The warning status "dubious year" flags UTCs that predate the
3313**      introduction of the time scale or that are too far in the future
3314**      to be trusted.  See iauDat for further details.
3315**
3316**  3)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
3317**      one second at the end of each positive UTC leap second,
3318**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
3319**      practice is under review, and in the future UT1-UTC may grow
3320**      essentially without limit.
3321**
3322**  4)  The geographical coordinates are with respect to the WGS84
3323**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
3324**      longitude required by the present function is east-positive
3325**      (i.e. right-handed), in accordance with geographical convention.
3326**
3327**  5)  The polar motion xp,yp can be obtained from IERS bulletins.  The
3328**      values are the coordinates (in radians) of the Celestial
3329**      Intermediate Pole with respect to the International Terrestrial
3330**      Reference System (see IERS Conventions 2003), measured along the
3331**      meridians 0 and 90 deg west respectively.  For many applications,
3332**      xp and yp can be set to zero.
3333**
3334**      Internally, the polar motion is stored in a form rotated onto
3335**      the local meridian.
3336**
3337**  6)  If hm, the height above the ellipsoid of the observing station
3338**      in meters, is not known but phpa, the pressure in hPa (=mB), is
3339**      available, an adequate estimate of hm can be obtained from the
3340**      expression
3341**
3342**            hm = -29.3 * tsl * log ( phpa / 1013.25 );
3343**
3344**      where tsl is the approximate sea-level air temperature in K
3345**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
3346**      52).  Similarly, if the pressure phpa is not known, it can be
3347**      estimated from the height of the observing station, hm, as
3348**      follows:
3349**
3350**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
3351**
3352**      Note, however, that the refraction is nearly proportional to the
3353**      pressure and that an accurate phpa value is important for
3354**      precise work.
3355**
3356**  7)  The argument wl specifies the observing wavelength in
3357**      micrometers.  The transition from optical to radio is assumed to
3358**      occur at 100 micrometers (about 3000 GHz).
3359**
3360**  8)  It is advisable to take great care with units, as even unlikely
3361**      values of the input parameters are accepted and processed in
3362**      accordance with the models used.
3363**
3364**  9)  In cases where the caller wishes to supply his own Earth
3365**      rotation information and refraction constants, the function
3366**      iauApc can be used instead of the present function.
3367**
3368**  10) This is one of several functions that inserts into the astrom
3369**      structure star-independent parameters needed for the chain of
3370**      astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
3371**
3372**      The various functions support different classes of observer and
3373**      portions of the transformation chain:
3374**
3375**          functions         observer        transformation
3376**
3377**       iauApcg iauApcg13    geocentric      ICRS <-> GCRS
3378**       iauApci iauApci13    terrestrial     ICRS <-> CIRS
3379**       iauApco iauApco13    terrestrial     ICRS <-> observed
3380**       iauApcs iauApcs13    space           ICRS <-> GCRS
3381**       iauAper iauAper13    terrestrial     update Earth rotation
3382**       iauApio iauApio13    terrestrial     CIRS <-> observed
3383**
3384**      Those with names ending in "13" use contemporary SOFA models to
3385**      compute the various ephemerides.  The others accept ephemerides
3386**      supplied by the caller.
3387**
3388**      The transformation from ICRS to GCRS covers space motion,
3389**      parallax, light deflection, and aberration.  From GCRS to CIRS
3390**      comprises frame bias and precession-nutation.  From CIRS to
3391**      observed takes account of Earth rotation, polar motion, diurnal
3392**      aberration and parallax (unless subsumed into the ICRS <-> GCRS
3393**      transformation), and atmospheric refraction.
3394**
3395**  11) The context structure astrom produced by this function is used
3396**      by iauAtioq and iauAtoiq.
3397**
3398**  Called:
3399**     iauUtctai    UTC to TAI
3400**     iauTaitt     TAI to TT
3401**     iauUtcut1    UTC to UT1
3402**     iauSp00      the TIO locator s', IERS 2000
3403**     iauEra00     Earth rotation angle, IAU 2000
3404**     iauRefco     refraction constants for given ambient conditions
3405**     iauApio      astrometry parameters, CIRS-observed
3406**
3407*/
3408
3409
3410
3411void iauAtcc13(double rc, double dc,
3412               double pr, double pd, double px, double rv,
3413               double date1, double date2,
3414               double *ra, double *da)
3415/*
3416**  - - - - - - - - - -
3417**   i a u A t c c 1 3
3418**  - - - - - - - - - -
3419**
3420**  Transform a star's ICRS catalog entry (epoch J2000.0) into ICRS
3421**  astrometric place.
3422**
3423**  This function is part of the International Astronomical Union's
3424**  SOFA (Standards of Fundamental Astronomy) software collection.
3425**
3426**  Status:  support function.
3427**
3428**  Given:
3429**     rc     double   ICRS right ascension at J2000.0 (radians, Note 1)
3430**     dc     double   ICRS declination at J2000.0 (radians, Note 1)
3431**     pr     double   RA proper motion (radians/year, Note 2)
3432**     pd     double   Dec proper motion (radians/year)
3433**     px     double   parallax (arcsec)
3434**     rv     double   radial velocity (km/s, +ve if receding)
3435**     date1  double   TDB as a 2-part...
3436**     date2  double   ...Julian Date (Note 3)
3437**
3438**  Returned:
3439**     ra,da  double*  ICRS astrometric RA,Dec (radians)
3440**
3441**  Notes:
3442**
3443**  1) Star data for an epoch other than J2000.0 (for example from the
3444**     Hipparcos catalog, which has an epoch of J1991.25) will require a
3445**     preliminary call to iauPmsafe before use.
3446**
3447**  2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
3448**
3449**  3) The TDB date date1+date2 is a Julian Date, apportioned in any
3450**     convenient way between the two arguments.  For example,
3451**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
3452**     others:
3453**
3454**            date1          date2
3455**
3456**         2450123.7           0.0       (JD method)
3457**         2451545.0       -1421.3       (J2000 method)
3458**         2400000.5       50123.2       (MJD method)
3459**         2450123.5           0.2       (date & time method)
3460**
3461**     The JD method is the most natural and convenient to use in cases
3462**     where the loss of several decimal digits of resolution is
3463**     acceptable.  The J2000 method is best matched to the way the
3464**     argument is handled internally and will deliver the optimum
3465**     resolution.  The MJD method and the date & time methods are both
3466**     good compromises between resolution and convenience.  For most
3467**     applications of this function the choice will not be at all
3468**     critical.
3469**
3470**     TT can be used instead of TDB without any significant impact on
3471**     accuracy.
3472**
3473**  Called:
3474**     iauApci13    astrometry parameters, ICRS-CIRS, 2013
3475**     iauAtccq     quick catalog ICRS to astrometric
3476**
3477*/
3478
3479
3480
3481void iauAtccq(double rc, double dc,
3482              double pr, double pd, double px, double rv,
3483              iauASTROM *astrom, double *ra, double *da)
3484/*
3485**  - - - - - - - - -
3486**   i a u A t c c q
3487**  - - - - - - - - -
3488**
3489**  Quick transformation of a star's ICRS catalog entry (epoch J2000.0)
3490**  into ICRS astrometric place, given precomputed star-independent
3491**  astrometry parameters.
3492**
3493**  Use of this function is appropriate when efficiency is important and
3494**  where many star positions are to be transformed for one date.  The
3495**  star-independent parameters can be obtained by calling one of the
3496**  functions iauApci[13], iauApcg[13], iauApco[13] or iauApcs[13].
3497**
3498**  If the parallax and proper motions are zero the transformation has
3499**  no effect.
3500**
3501**  This function is part of the International Astronomical Union's
3502**  SOFA (Standards of Fundamental Astronomy) software collection.
3503**
3504**  Status:  support function.
3505**
3506**  Given:
3507**     rc,dc  double     ICRS RA,Dec at J2000.0 (radians)
3508**     pr     double     RA proper motion (radians/year, Note 3)
3509**     pd     double     Dec proper motion (radians/year)
3510**     px     double     parallax (arcsec)
3511**     rv     double     radial velocity (km/s, +ve if receding)
3512**     astrom iauASTROM* star-independent astrometry parameters:
3513**      pmt    double       PM time interval (SSB, Julian years)
3514**      eb     double[3]    SSB to observer (vector, au)
3515**      eh     double[3]    Sun to observer (unit vector)
3516**      em     double       distance from Sun to observer (au)
3517**      v      double[3]    barycentric observer velocity (vector, c)
3518**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
3519**      bpn    double[3][3] bias-precession-nutation matrix
3520**      along  double       longitude + s' (radians)
3521**      xpl    double       polar motion xp wrt local meridian (radians)
3522**      ypl    double       polar motion yp wrt local meridian (radians)
3523**      sphi   double       sine of geodetic latitude
3524**      cphi   double       cosine of geodetic latitude
3525**      diurab double       magnitude of diurnal aberration vector
3526**      eral   double       "local" Earth rotation angle (radians)
3527**      refa   double       refraction constant A (radians)
3528**      refb   double       refraction constant B (radians)
3529**
3530**  Returned:
3531**     ra,da  double*    ICRS astrometric RA,Dec (radians)
3532**
3533**  Notes:
3534**
3535**  1) All the vectors are with respect to BCRS axes.
3536**
3537**  2) Star data for an epoch other than J2000.0 (for example from the
3538**     Hipparcos catalog, which has an epoch of J1991.25) will require a
3539**     preliminary call to iauPmsafe before use.
3540**
3541**  3) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
3542**
3543**  Called:
3544**     iauPmpx      proper motion and parallax
3545**     iauC2s       p-vector to spherical
3546**     iauAnp       normalize angle into range 0 to 2pi
3547**
3548*/
3549
3550
3551
3552void iauAtci13(double rc, double dc,
3553               double pr, double pd, double px, double rv,
3554               double date1, double date2,
3555               double *ri, double *di, double *eo)
3556/*
3557**  - - - - - - - - - -
3558**   i a u A t c i 1 3
3559**  - - - - - - - - - -
3560**
3561**  Transform ICRS star data, epoch J2000.0, to CIRS.
3562**
3563**  This function is part of the International Astronomical Union's
3564**  SOFA (Standards of Fundamental Astronomy) software collection.
3565**
3566**  Status:  support function.
3567**
3568**  Given:
3569**     rc     double   ICRS right ascension at J2000.0 (radians, Note 1)
3570**     dc     double   ICRS declination at J2000.0 (radians, Note 1)
3571**     pr     double   RA proper motion (radians/year, Note 2)
3572**     pd     double   Dec proper motion (radians/year)
3573**     px     double   parallax (arcsec)
3574**     rv     double   radial velocity (km/s, +ve if receding)
3575**     date1  double   TDB as a 2-part...
3576**     date2  double   ...Julian Date (Note 3)
3577**
3578**  Returned:
3579**     ri,di  double*  CIRS geocentric RA,Dec (radians)
3580**     eo     double*  equation of the origins (ERA-GST, Note 5)
3581**
3582**  Notes:
3583**
3584**  1) Star data for an epoch other than J2000.0 (for example from the
3585**     Hipparcos catalog, which has an epoch of J1991.25) will require a
3586**     preliminary call to iauPmsafe before use.
3587**
3588**  2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
3589**
3590**  3) The TDB date date1+date2 is a Julian Date, apportioned in any
3591**     convenient way between the two arguments.  For example,
3592**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
3593**     others:
3594**
3595**            date1          date2
3596**
3597**         2450123.7           0.0       (JD method)
3598**         2451545.0       -1421.3       (J2000 method)
3599**         2400000.5       50123.2       (MJD method)
3600**         2450123.5           0.2       (date & time method)
3601**
3602**     The JD method is the most natural and convenient to use in cases
3603**     where the loss of several decimal digits of resolution is
3604**     acceptable.  The J2000 method is best matched to the way the
3605**     argument is handled internally and will deliver the optimum
3606**     resolution.  The MJD method and the date & time methods are both
3607**     good compromises between resolution and convenience.  For most
3608**     applications of this function the choice will not be at all
3609**     critical.
3610**
3611**     TT can be used instead of TDB without any significant impact on
3612**     accuracy.
3613**
3614**  4) The available accuracy is better than 1 milliarcsecond, limited
3615**     mainly by the precession-nutation model that is used, namely
3616**     IAU 2000A/2006.  Very close to solar system bodies, additional
3617**     errors of up to several milliarcseconds can occur because of
3618**     unmodeled light deflection;  however, the Sun's contribution is
3619**     taken into account, to first order.  The accuracy limitations of
3620**     the SOFA function iauEpv00 (used to compute Earth position and
3621**     velocity) can contribute aberration errors of up to
3622**     5 microarcseconds.  Light deflection at the Sun's limb is
3623**     uncertain at the 0.4 mas level.
3624**
3625**  5) Should the transformation to (equinox based) apparent place be
3626**     required rather than (CIO based) intermediate place, subtract the
3627**     equation of the origins from the returned right ascension:
3628**     RA = RI - EO. (The iauAnp function can then be applied, as
3629**     required, to keep the result in the conventional 0-2pi range.)
3630**
3631**  Called:
3632**     iauApci13    astrometry parameters, ICRS-CIRS, 2013
3633**     iauAtciq     quick ICRS to CIRS
3634**
3635*/
3636
3637
3638
3639void iauAtciq(double rc, double dc,
3640              double pr, double pd, double px, double rv,
3641              iauASTROM *astrom, double *ri, double *di)
3642/*
3643**  - - - - - - - - -
3644**   i a u A t c i q
3645**  - - - - - - - - -
3646**
3647**  Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed
3648**  star-independent astrometry parameters.
3649**
3650**  Use of this function is appropriate when efficiency is important and
3651**  where many star positions are to be transformed for one date.  The
3652**  star-independent parameters can be obtained by calling one of the
3653**  functions iauApci[13], iauApcg[13], iauApco[13] or iauApcs[13].
3654**
3655**  If the parallax and proper motions are zero the iauAtciqz function
3656**  can be used instead.
3657**
3658**  This function is part of the International Astronomical Union's
3659**  SOFA (Standards of Fundamental Astronomy) software collection.
3660**
3661**  Status:  support function.
3662**
3663**  Given:
3664**     rc,dc  double     ICRS RA,Dec at J2000.0 (radians, Note 1)
3665**     pr     double     RA proper motion (radians/year, Note 2)
3666**     pd     double     Dec proper motion (radians/year)
3667**     px     double     parallax (arcsec)
3668**     rv     double     radial velocity (km/s, +ve if receding)
3669**     astrom iauASTROM* star-independent astrometry parameters:
3670**      pmt    double       PM time interval (SSB, Julian years)
3671**      eb     double[3]    SSB to observer (vector, au)
3672**      eh     double[3]    Sun to observer (unit vector)
3673**      em     double       distance from Sun to observer (au)
3674**      v      double[3]    barycentric observer velocity (vector, c)
3675**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
3676**      bpn    double[3][3] bias-precession-nutation matrix
3677**      along  double       longitude + s' (radians)
3678**      xpl    double       polar motion xp wrt local meridian (radians)
3679**      ypl    double       polar motion yp wrt local meridian (radians)
3680**      sphi   double       sine of geodetic latitude
3681**      cphi   double       cosine of geodetic latitude
3682**      diurab double       magnitude of diurnal aberration vector
3683**      eral   double       "local" Earth rotation angle (radians)
3684**      refa   double       refraction constant A (radians)
3685**      refb   double       refraction constant B (radians)
3686**
3687**  Returned:
3688**     ri,di   double    CIRS RA,Dec (radians)
3689**
3690**  Notes:
3691**
3692**  1) Star data for an epoch other than J2000.0 (for example from the
3693**     Hipparcos catalog, which has an epoch of J1991.25) will require a
3694**     preliminary call to iauPmsafe before use.
3695**
3696**  2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
3697**
3698**  Called:
3699**     iauPmpx      proper motion and parallax
3700**     iauLdsun     light deflection by the Sun
3701**     iauAb        stellar aberration
3702**     iauRxp       product of r-matrix and pv-vector
3703**     iauC2s       p-vector to spherical
3704**     iauAnp       normalize angle into range 0 to 2pi
3705**
3706*/
3707
3708
3709
3710void iauAtciqn(double rc, double dc, double pr, double pd,
3711               double px, double rv, iauASTROM *astrom,
3712               int n, iauLDBODY b[], double *ri, double *di)
3713/*
3714**  - - - - - - - - - -
3715**   i a u A t c i q n
3716**  - - - - - - - - - -
3717**
3718**  Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed
3719**  star-independent astrometry parameters plus a list of light-
3720**  deflecting bodies.
3721**
3722**  Use of this function is appropriate when efficiency is important and
3723**  where many star positions are to be transformed for one date.  The
3724**  star-independent parameters can be obtained by calling one of the
3725**  functions iauApci[13], iauApcg[13], iauApco[13] or iauApcs[13].
3726**
3727**
3728**  If the only light-deflecting body to be taken into account is the
3729**  Sun, the iauAtciq function can be used instead.  If in addition the
3730**  parallax and proper motions are zero, the iauAtciqz function can be
3731**  used.
3732**
3733**  This function is part of the International Astronomical Union's
3734**  SOFA (Standards of Fundamental Astronomy) software collection.
3735**
3736**  Status:  support function.
3737**
3738**  Given:
3739**     rc,dc  double       ICRS RA,Dec at J2000.0 (radians)
3740**     pr     double       RA proper motion (radians/year, Note 3)
3741**     pd     double       Dec proper motion (radians/year)
3742**     px     double       parallax (arcsec)
3743**     rv     double       radial velocity (km/s, +ve if receding)
3744**     astrom iauASTROM*   star-independent astrometry parameters:
3745**      pmt    double       PM time interval (SSB, Julian years)
3746**      eb     double[3]    SSB to observer (vector, au)
3747**      eh     double[3]    Sun to observer (unit vector)
3748**      em     double       distance from Sun to observer (au)
3749**      v      double[3]    barycentric observer velocity (vector, c)
3750**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
3751**      bpn    double[3][3] bias-precession-nutation matrix
3752**      along  double       longitude + s' (radians)
3753**      xpl    double       polar motion xp wrt local meridian (radians)
3754**      ypl    double       polar motion yp wrt local meridian (radians)
3755**      sphi   double       sine of geodetic latitude
3756**      cphi   double       cosine of geodetic latitude
3757**      diurab double       magnitude of diurnal aberration vector
3758**      eral   double       "local" Earth rotation angle (radians)
3759**      refa   double       refraction constant A (radians)
3760**      refb   double       refraction constant B (radians)
3761**     n      int          number of bodies (Note 3)
3762**     b      iauLDBODY[n] data for each of the n bodies (Notes 3,4):
3763**      bm     double       mass of the body (solar masses, Note 5)
3764**      dl     double       deflection limiter (Note 6)
3765**      pv     [2][3]       barycentric PV of the body (au, au/day)
3766**
3767**  Returned:
3768**     ri,di   double    CIRS RA,Dec (radians)
3769**
3770**  Notes:
3771**
3772**  1) Star data for an epoch other than J2000.0 (for example from the
3773**     Hipparcos catalog, which has an epoch of J1991.25) will require a
3774**     preliminary call to iauPmsafe before use.
3775**
3776**  2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
3777**
3778**  3) The struct b contains n entries, one for each body to be
3779**     considered.  If n = 0, no gravitational light deflection will be
3780**     applied, not even for the Sun.
3781**
3782**  4) The struct b should include an entry for the Sun as well as for
3783**     any planet or other body to be taken into account.  The entries
3784**     should be in the order in which the light passes the body.
3785**
3786**  5) In the entry in the b struct for body i, the mass parameter
3787**     b[i].bm can, as required, be adjusted in order to allow for such
3788**     effects as quadrupole field.
3789**
3790**  6) The deflection limiter parameter b[i].dl is phi^2/2, where phi is
3791**     the angular separation (in radians) between star and body at
3792**     which limiting is applied.  As phi shrinks below the chosen
3793**     threshold, the deflection is artificially reduced, reaching zero
3794**     for phi = 0.   Example values suitable for a terrestrial
3795**     observer, together with masses, are as follows:
3796**
3797**        body i     b[i].bm        b[i].dl
3798**
3799**        Sun        1.0            6e-6
3800**        Jupiter    0.00095435     3e-9
3801**        Saturn     0.00028574     3e-10
3802**
3803**  7) For efficiency, validation of the contents of the b array is
3804**     omitted.  The supplied masses must be greater than zero, the
3805**     position and velocity vectors must be right, and the deflection
3806**     limiter greater than zero.
3807**
3808**  Called:
3809**     iauPmpx      proper motion and parallax
3810**     iauLdn       light deflection by n bodies
3811**     iauAb        stellar aberration
3812**     iauRxp       product of r-matrix and pv-vector
3813**     iauC2s       p-vector to spherical
3814**     iauAnp       normalize angle into range 0 to 2pi
3815**
3816*/
3817
3818
3819
3820void iauAtciqz(double rc, double dc, iauASTROM *astrom,
3821               double *ri, double *di)
3822/*
3823**  - - - - - - - - - -
3824**   i a u A t c i q z
3825**  - - - - - - - - - -
3826**
3827**  Quick ICRS to CIRS transformation, given precomputed star-
3828**  independent astrometry parameters, and assuming zero parallax and
3829**  proper motion.
3830**
3831**  Use of this function is appropriate when efficiency is important and
3832**  where many star positions are to be transformed for one date.  The
3833**  star-independent parameters can be obtained by calling one of the
3834**  functions iauApci[13], iauApcg[13], iauApco[13] or iauApcs[13].
3835**
3836**  The corresponding function for the case of non-zero parallax and
3837**  proper motion is iauAtciq.
3838**
3839**  This function is part of the International Astronomical Union's
3840**  SOFA (Standards of Fundamental Astronomy) software collection.
3841**
3842**  Status:  support function.
3843**
3844**  Given:
3845**     rc,dc  double     ICRS astrometric RA,Dec (radians)
3846**     astrom iauASTROM* star-independent astrometry parameters:
3847**      pmt    double       PM time interval (SSB, Julian years)
3848**      eb     double[3]    SSB to observer (vector, au)
3849**      eh     double[3]    Sun to observer (unit vector)
3850**      em     double       distance from Sun to observer (au)
3851**      v      double[3]    barycentric observer velocity (vector, c)
3852**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
3853**      bpn    double[3][3] bias-precession-nutation matrix
3854**      along  double       longitude + s' (radians)
3855**      xpl    double       polar motion xp wrt local meridian (radians)
3856**      ypl    double       polar motion yp wrt local meridian (radians)
3857**      sphi   double       sine of geodetic latitude
3858**      cphi   double       cosine of geodetic latitude
3859**      diurab double       magnitude of diurnal aberration vector
3860**      eral   double       "local" Earth rotation angle (radians)
3861**      refa   double       refraction constant A (radians)
3862**      refb   double       refraction constant B (radians)
3863**
3864**  Returned:
3865**     ri,di  double     CIRS RA,Dec (radians)
3866**
3867**  Note:
3868**
3869**     All the vectors are with respect to BCRS axes.
3870**
3871**  References:
3872**
3873**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
3874**     the Astronomical Almanac, 3rd ed., University Science Books
3875**     (2013).
3876**
3877**     Klioner, Sergei A., "A practical relativistic model for micro-
3878**     arcsecond astrometry in space", Astr. J. 125, 1580-1597 (2003).
3879**
3880**  Called:
3881**     iauS2c       spherical coordinates to unit vector
3882**     iauLdsun     light deflection due to Sun
3883**     iauAb        stellar aberration
3884**     iauRxp       product of r-matrix and p-vector
3885**     iauC2s       p-vector to spherical
3886**     iauAnp       normalize angle into range +/- pi
3887**
3888*/
3889
3890
3891
3892int iauAtco13(double rc, double dc,
3893              double pr, double pd, double px, double rv,
3894              double utc1, double utc2, double dut1,
3895              double elong, double phi, double hm, double xp, double yp,
3896              double phpa, double tc, double rh, double wl,
3897              double *aob, double *zob, double *hob,
3898              double *dob, double *rob, double *eo)
3899/*
3900**  - - - - - - - - - -
3901**   i a u A t c o 1 3
3902**  - - - - - - - - - -
3903**
3904**  ICRS RA,Dec to observed place.  The caller supplies UTC, site
3905**  coordinates, ambient air conditions and observing wavelength.
3906**
3907**  SOFA models are used for the Earth ephemeris, bias-precession-
3908**  nutation, Earth orientation and refraction.
3909**
3910**  This function is part of the International Astronomical Union's
3911**  SOFA (Standards of Fundamental Astronomy) software collection.
3912**
3913**  Status:  support function.
3914**
3915**  Given:
3916**     rc,dc  double   ICRS right ascension at J2000.0 (radians, Note 1)
3917**     pr     double   RA proper motion (radians/year, Note 2)
3918**     pd     double   Dec proper motion (radians/year)
3919**     px     double   parallax (arcsec)
3920**     rv     double   radial velocity (km/s, +ve if receding)
3921**     utc1   double   UTC as a 2-part...
3922**     utc2   double   ...quasi Julian Date (Notes 3-4)
3923**     dut1   double   UT1-UTC (seconds, Note 5)
3924**     elong  double   longitude (radians, east +ve, Note 6)
3925**     phi    double   latitude (geodetic, radians, Note 6)
3926**     hm     double   height above ellipsoid (m, geodetic, Notes 6,8)
3927**     xp,yp  double   polar motion coordinates (radians, Note 7)
3928**     phpa   double   pressure at the observer (hPa = mB, Note 8)
3929**     tc     double   ambient temperature at the observer (deg C)
3930**     rh     double   relative humidity at the observer (range 0-1)
3931**     wl     double   wavelength (micrometers, Note 9)
3932**
3933**  Returned:
3934**     aob    double*  observed azimuth (radians: N=0,E=90)
3935**     zob    double*  observed zenith distance (radians)
3936**     hob    double*  observed hour angle (radians)
3937**     dob    double*  observed declination (radians)
3938**     rob    double*  observed right ascension (CIO-based, radians)
3939**     eo     double*  equation of the origins (ERA-GST)
3940**
3941**  Returned (function value):
3942**            int      status: +1 = dubious year (Note 4)
3943**                              0 = OK
3944**                             -1 = unacceptable date
3945**
3946**  Notes:
3947**
3948**  1)  Star data for an epoch other than J2000.0 (for example from the
3949**      Hipparcos catalog, which has an epoch of J1991.25) will require
3950**      a preliminary call to iauPmsafe before use.
3951**
3952**  2)  The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
3953**
3954**  3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
3955**      convenient way between the two arguments, for example where utc1
3956**      is the Julian Day Number and utc2 is the fraction of a day.
3957**
3958**      However, JD cannot unambiguously represent UTC during a leap
3959**      second unless special measures are taken.  The convention in the
3960**      present function is that the JD day represents UTC days whether
3961**      the length is 86399, 86400 or 86401 SI seconds.
3962**
3963**      Applications should use the function iauDtf2d to convert from
3964**      calendar date and time of day into 2-part quasi Julian Date, as
3965**      it implements the leap-second-ambiguity convention just
3966**      described.
3967**
3968**  4)  The warning status "dubious year" flags UTCs that predate the
3969**      introduction of the time scale or that are too far in the
3970**      future to be trusted.  See iauDat for further details.
3971**
3972**  5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
3973**      one second at the end of each positive UTC leap second,
3974**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
3975**      practice is under review, and in the future UT1-UTC may grow
3976**      essentially without limit.
3977**
3978**  6)  The geographical coordinates are with respect to the WGS84
3979**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
3980**      longitude required by the present function is east-positive
3981**      (i.e. right-handed), in accordance with geographical convention.
3982**
3983**  7)  The polar motion xp,yp can be obtained from IERS bulletins.  The
3984**      values are the coordinates (in radians) of the Celestial
3985**      Intermediate Pole with respect to the International Terrestrial
3986**      Reference System (see IERS Conventions 2003), measured along the
3987**      meridians 0 and 90 deg west respectively.  For many
3988**      applications, xp and yp can be set to zero.
3989**
3990**  8)  If hm, the height above the ellipsoid of the observing station
3991**      in meters, is not known but phpa, the pressure in hPa (=mB),
3992**      is available, an adequate estimate of hm can be obtained from
3993**      the expression
3994**
3995**            hm = -29.3 * tsl * log ( phpa / 1013.25 );
3996**
3997**      where tsl is the approximate sea-level air temperature in K
3998**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
3999**      52).  Similarly, if the pressure phpa is not known, it can be
4000**      estimated from the height of the observing station, hm, as
4001**      follows:
4002**
4003**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
4004**
4005**      Note, however, that the refraction is nearly proportional to
4006**      the pressure and that an accurate phpa value is important for
4007**      precise work.
4008**
4009**  9)  The argument wl specifies the observing wavelength in
4010**      micrometers.  The transition from optical to radio is assumed to
4011**      occur at 100 micrometers (about 3000 GHz).
4012**
4013**  10) The accuracy of the result is limited by the corrections for
4014**      refraction, which use a simple A*tan(z) + B*tan^3(z) model.
4015**      Providing the meteorological parameters are known accurately and
4016**      there are no gross local effects, the predicted observed
4017**      coordinates should be within 0.05 arcsec (optical) or 1 arcsec
4018**      (radio) for a zenith distance of less than 70 degrees, better
4019**      than 30 arcsec (optical or radio) at 85 degrees and better
4020**      than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
4021**
4022**      Without refraction, the complementary functions iauAtco13 and
4023**      iauAtoc13 are self-consistent to better than 1 microarcsecond
4024**      all over the celestial sphere.  With refraction included,
4025**      consistency falls off at high zenith distances, but is still
4026**      better than 0.05 arcsec at 85 degrees.
4027**
4028**  11) "Observed" Az,ZD means the position that would be seen by a
4029**      perfect geodetically aligned theodolite.  (Zenith distance is
4030**      used rather than altitude in order to reflect the fact that no
4031**      allowance is made for depression of the horizon.)  This is
4032**      related to the observed HA,Dec via the standard rotation, using
4033**      the geodetic latitude (corrected for polar motion), while the
4034**      observed HA and RA are related simply through the Earth rotation
4035**      angle and the site longitude.  "Observed" RA,Dec or HA,Dec thus
4036**      means the position that would be seen by a perfect equatorial
4037**      with its polar axis aligned to the Earth's axis of rotation.
4038**
4039**  12) It is advisable to take great care with units, as even unlikely
4040**      values of the input parameters are accepted and processed in
4041**      accordance with the models used.
4042**
4043**  Called:
4044**     iauApco13    astrometry parameters, ICRS-observed, 2013
4045**     iauAtciq     quick ICRS to CIRS
4046**     iauAtioq     quick CIRS to observed
4047**
4048*/
4049
4050
4051
4052void iauAtic13(double ri, double di, double date1, double date2,
4053               double *rc, double *dc, double *eo)
4054/*
4055**  - - - - - - - - - -
4056**   i a u A t i c 1 3
4057**  - - - - - - - - - -
4058**
4059**  Transform star RA,Dec from geocentric CIRS to ICRS astrometric.
4060**
4061**  This function is part of the International Astronomical Union's
4062**  SOFA (Standards of Fundamental Astronomy) software collection.
4063**
4064**  Status:  support function.
4065**
4066**  Given:
4067**     ri,di  double  CIRS geocentric RA,Dec (radians)
4068**     date1  double  TDB as a 2-part...
4069**     date2  double  ...Julian Date (Note 1)
4070**
4071**  Returned:
4072**     rc,dc  double  ICRS astrometric RA,Dec (radians)
4073**     eo     double  equation of the origins (ERA-GST, Note 4)
4074**
4075**  Notes:
4076**
4077**  1) The TDB date date1+date2 is a Julian Date, apportioned in any
4078**     convenient way between the two arguments.  For example,
4079**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
4080**     others:
4081**
4082**            date1          date2
4083**
4084**         2450123.7           0.0       (JD method)
4085**         2451545.0       -1421.3       (J2000 method)
4086**         2400000.5       50123.2       (MJD method)
4087**         2450123.5           0.2       (date & time method)
4088**
4089**     The JD method is the most natural and convenient to use in cases
4090**     where the loss of several decimal digits of resolution is
4091**     acceptable.  The J2000 method is best matched to the way the
4092**     argument is handled internally and will deliver the optimum
4093**     resolution.  The MJD method and the date & time methods are both
4094**     good compromises between resolution and convenience.  For most
4095**     applications of this function the choice will not be at all
4096**     critical.
4097**
4098**     TT can be used instead of TDB without any significant impact on
4099**     accuracy.
4100**
4101**  2) Iterative techniques are used for the aberration and light
4102**     deflection corrections so that the functions iauAtic13 (or
4103**     iauAticq) and iauAtci13 (or iauAtciq) are accurate inverses;
4104**     even at the edge of the Sun's disk the discrepancy is only about
4105**     1 nanoarcsecond.
4106**
4107**  3) The available accuracy is better than 1 milliarcsecond, limited
4108**     mainly by the precession-nutation model that is used, namely
4109**     IAU 2000A/2006.  Very close to solar system bodies, additional
4110**     errors of up to several milliarcseconds can occur because of
4111**     unmodeled light deflection;  however, the Sun's contribution is
4112**     taken into account, to first order.  The accuracy limitations of
4113**     the SOFA function iauEpv00 (used to compute Earth position and
4114**     velocity) can contribute aberration errors of up to
4115**     5 microarcseconds.  Light deflection at the Sun's limb is
4116**     uncertain at the 0.4 mas level.
4117**
4118**  4) Should the transformation to (equinox based) J2000.0 mean place
4119**     be required rather than (CIO based) ICRS coordinates, subtract the
4120**     equation of the origins from the returned right ascension:
4121**     RA = RI - EO.  (The iauAnp function can then be applied, as
4122**     required, to keep the result in the conventional 0-2pi range.)
4123**
4124**  Called:
4125**     iauApci13    astrometry parameters, ICRS-CIRS, 2013
4126**     iauAticq     quick CIRS to ICRS astrometric
4127**
4128*/
4129
4130
4131
4132void iauAticq(double ri, double di, iauASTROM *astrom,
4133              double *rc, double *dc)
4134/*
4135**  - - - - - - - - -
4136**   i a u A t i c q
4137**  - - - - - - - - -
4138**
4139**  Quick CIRS RA,Dec to ICRS astrometric place, given the star-
4140**  independent astrometry parameters.
4141**
4142**  Use of this function is appropriate when efficiency is important and
4143**  where many star positions are all to be transformed for one date.
4144**  The star-independent astrometry parameters can be obtained by
4145**  calling one of the functions iauApci[13], iauApcg[13], iauApco[13]
4146**  or iauApcs[13].
4147**
4148**  This function is part of the International Astronomical Union's
4149**  SOFA (Standards of Fundamental Astronomy) software collection.
4150**
4151**  Status:  support function.
4152**
4153**  Given:
4154**     ri,di  double     CIRS RA,Dec (radians)
4155**     astrom iauASTROM* star-independent astrometry parameters:
4156**      pmt    double       PM time interval (SSB, Julian years)
4157**      eb     double[3]    SSB to observer (vector, au)
4158**      eh     double[3]    Sun to observer (unit vector)
4159**      em     double       distance from Sun to observer (au)
4160**      v      double[3]    barycentric observer velocity (vector, c)
4161**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
4162**      bpn    double[3][3] bias-precession-nutation matrix
4163**      along  double       longitude + s' (radians)
4164**      xpl    double       polar motion xp wrt local meridian (radians)
4165**      ypl    double       polar motion yp wrt local meridian (radians)
4166**      sphi   double       sine of geodetic latitude
4167**      cphi   double       cosine of geodetic latitude
4168**      diurab double       magnitude of diurnal aberration vector
4169**      eral   double       "local" Earth rotation angle (radians)
4170**      refa   double       refraction constant A (radians)
4171**      refb   double       refraction constant B (radians)
4172**
4173**  Returned:
4174**     rc,dc  double     ICRS astrometric RA,Dec (radians)
4175**
4176**  Notes:
4177**
4178**  1) Only the Sun is taken into account in the light deflection
4179**     correction.
4180**
4181**  2) Iterative techniques are used for the aberration and light
4182**     deflection corrections so that the functions iauAtic13 (or
4183**     iauAticq) and iauAtci13 (or iauAtciq) are accurate inverses;
4184**     even at the edge of the Sun's disk the discrepancy is only about
4185**     1 nanoarcsecond.
4186**
4187**  Called:
4188**     iauS2c       spherical coordinates to unit vector
4189**     iauTrxp      product of transpose of r-matrix and p-vector
4190**     iauZp        zero p-vector
4191**     iauAb        stellar aberration
4192**     iauLdsun     light deflection by the Sun
4193**     iauC2s       p-vector to spherical
4194**     iauAnp       normalize angle into range +/- pi
4195**
4196*/
4197
4198
4199
4200void iauAticqn(double ri, double di, iauASTROM *astrom,
4201               int n, iauLDBODY b[], double *rc, double *dc)
4202/*
4203**  - - - - - - - - - -
4204**   i a u A t i c q n
4205**  - - - - - - - - - -
4206**
4207**  Quick CIRS to ICRS astrometric place transformation, given the star-
4208**  independent astrometry parameters plus a list of light-deflecting
4209**  bodies.
4210**
4211**  Use of this function is appropriate when efficiency is important and
4212**  where many star positions are all to be transformed for one date.
4213**  The star-independent astrometry parameters can be obtained by
4214**  calling one of the functions iauApci[13], iauApcg[13], iauApco[13]
4215**  or iauApcs[13].
4216*
4217*  If the only light-deflecting body to be taken into account is the
4218*  Sun, the iauAticq function can be used instead.
4219**
4220**  This function is part of the International Astronomical Union's
4221**  SOFA (Standards of Fundamental Astronomy) software collection.
4222**
4223**  Status:  support function.
4224**
4225**  Given:
4226**     ri,di  double      CIRS RA,Dec (radians)
4227**     astrom iauASTROM*  star-independent astrometry parameters:
4228**      pmt    double       PM time interval (SSB, Julian years)
4229**      eb     double[3]    SSB to observer (vector, au)
4230**      eh     double[3]    Sun to observer (unit vector)
4231**      em     double       distance from Sun to observer (au)
4232**      v      double[3]    barycentric observer velocity (vector, c)
4233**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
4234**      bpn    double[3][3] bias-precession-nutation matrix
4235**      along  double       longitude + s' (radians)
4236**      xpl    double       polar motion xp wrt local meridian (radians)
4237**      ypl    double       polar motion yp wrt local meridian (radians)
4238**      sphi   double       sine of geodetic latitude
4239**      cphi   double       cosine of geodetic latitude
4240**      diurab double       magnitude of diurnal aberration vector
4241**      eral   double       "local" Earth rotation angle (radians)
4242**      refa   double       refraction constant A (radians)
4243**      refb   double       refraction constant B (radians)
4244**     n      int          number of bodies (Note 3)
4245**     b      iauLDBODY[n] data for each of the n bodies (Notes 3,4):
4246**      bm     double       mass of the body (solar masses, Note 5)
4247**      dl     double       deflection limiter (Note 6)
4248**      pv     [2][3]       barycentric PV of the body (au, au/day)
4249**
4250**  Returned:
4251**     rc,dc  double     ICRS astrometric RA,Dec (radians)
4252**
4253**  Notes:
4254**
4255**  1) Iterative techniques are used for the aberration and light
4256**     deflection corrections so that the functions iauAticqn and
4257**     iauAtciqn are accurate inverses; even at the edge of the Sun's
4258**     disk the discrepancy is only about 1 nanoarcsecond.
4259**
4260**  2) If the only light-deflecting body to be taken into account is the
4261**     Sun, the iauAticq function can be used instead.
4262**
4263**  3) The struct b contains n entries, one for each body to be
4264**     considered.  If n = 0, no gravitational light deflection will be
4265**     applied, not even for the Sun.
4266**
4267**  4) The struct b should include an entry for the Sun as well as for
4268**     any planet or other body to be taken into account.  The entries
4269**     should be in the order in which the light passes the body.
4270**
4271**  5) In the entry in the b struct for body i, the mass parameter
4272**     b[i].bm can, as required, be adjusted in order to allow for such
4273**     effects as quadrupole field.
4274**
4275**  6) The deflection limiter parameter b[i].dl is phi^2/2, where phi is
4276**     the angular separation (in radians) between star and body at
4277**     which limiting is applied.  As phi shrinks below the chosen
4278**     threshold, the deflection is artificially reduced, reaching zero
4279**     for phi = 0.   Example values suitable for a terrestrial
4280**     observer, together with masses, are as follows:
4281**
4282**        body i     b[i].bm        b[i].dl
4283**
4284**        Sun        1.0            6e-6
4285**        Jupiter    0.00095435     3e-9
4286**        Saturn     0.00028574     3e-10
4287**
4288**  7) For efficiency, validation of the contents of the b array is
4289**     omitted.  The supplied masses must be greater than zero, the
4290**     position and velocity vectors must be right, and the deflection
4291**     limiter greater than zero.
4292**
4293**  Called:
4294**     iauS2c       spherical coordinates to unit vector
4295**     iauTrxp      product of transpose of r-matrix and p-vector
4296**     iauZp        zero p-vector
4297**     iauAb        stellar aberration
4298**     iauLdn       light deflection by n bodies
4299**     iauC2s       p-vector to spherical
4300**     iauAnp       normalize angle into range +/- pi
4301**
4302*/
4303
4304
4305
4306int iauAtio13(double ri, double di,
4307              double utc1, double utc2, double dut1,
4308              double elong, double phi, double hm, double xp, double yp,
4309              double phpa, double tc, double rh, double wl,
4310              double *aob, double *zob, double *hob,
4311              double *dob, double *rob)
4312/*
4313**  - - - - - - - - - -
4314**   i a u A t i o 1 3
4315**  - - - - - - - - - -
4316**
4317**  CIRS RA,Dec to observed place.  The caller supplies UTC, site
4318**  coordinates, ambient air conditions and observing wavelength.
4319**
4320**  This function is part of the International Astronomical Union's
4321**  SOFA (Standards of Fundamental Astronomy) software collection.
4322**
4323**  Status:  support function.
4324**
4325**  Given:
4326**     ri     double   CIRS right ascension (CIO-based, radians)
4327**     di     double   CIRS declination (radians)
4328**     utc1   double   UTC as a 2-part...
4329**     utc2   double   ...quasi Julian Date (Notes 1,2)
4330**     dut1   double   UT1-UTC (seconds, Note 3)
4331**     elong  double   longitude (radians, east +ve, Note 4)
4332**     phi    double   geodetic latitude (radians, Note 4)
4333**     hm     double   height above ellipsoid (m, geodetic Notes 4,6)
4334**     xp,yp  double   polar motion coordinates (radians, Note 5)
4335**     phpa   double   pressure at the observer (hPa = mB, Note 6)
4336**     tc     double   ambient temperature at the observer (deg C)
4337**     rh     double   relative humidity at the observer (range 0-1)
4338**     wl     double   wavelength (micrometers, Note 7)
4339**
4340**  Returned:
4341**     aob    double*  observed azimuth (radians: N=0,E=90)
4342**     zob    double*  observed zenith distance (radians)
4343**     hob    double*  observed hour angle (radians)
4344**     dob    double*  observed declination (radians)
4345**     rob    double*  observed right ascension (CIO-based, radians)
4346**
4347**  Returned (function value):
4348**            int      status: +1 = dubious year (Note 2)
4349**                              0 = OK
4350**                             -1 = unacceptable date
4351**
4352**  Notes:
4353**
4354**  1)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
4355**      convenient way between the two arguments, for example where utc1
4356**      is the Julian Day Number and utc2 is the fraction of a day.
4357**
4358**      However, JD cannot unambiguously represent UTC during a leap
4359**      second unless special measures are taken.  The convention in the
4360**      present function is that the JD day represents UTC days whether
4361**      the length is 86399, 86400 or 86401 SI seconds.
4362**
4363**      Applications should use the function iauDtf2d to convert from
4364**      calendar date and time of day into 2-part quasi Julian Date, as
4365**      it implements the leap-second-ambiguity convention just
4366**      described.
4367**
4368**  2)  The warning status "dubious year" flags UTCs that predate the
4369**      introduction of the time scale or that are too far in the
4370**      future to be trusted.  See iauDat for further details.
4371**
4372**  3)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
4373**      one second at the end of each positive UTC leap second,
4374**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
4375**      practice is under review, and in the future UT1-UTC may grow
4376**      essentially without limit.
4377**
4378**  4)  The geographical coordinates are with respect to the WGS84
4379**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
4380**      longitude required by the present function is east-positive
4381**      (i.e. right-handed), in accordance with geographical convention.
4382**
4383**  5)  The polar motion xp,yp can be obtained from IERS bulletins.  The
4384**      values are the coordinates (in radians) of the Celestial
4385**      Intermediate Pole with respect to the International Terrestrial
4386**      Reference System (see IERS Conventions 2003), measured along the
4387**      meridians 0 and 90 deg west respectively.  For many
4388**      applications, xp and yp can be set to zero.
4389**
4390**  6)  If hm, the height above the ellipsoid of the observing station
4391**      in meters, is not known but phpa, the pressure in hPa (=mB), is
4392**      available, an adequate estimate of hm can be obtained from the
4393**      expression
4394**
4395**            hm = -29.3 * tsl * log ( phpa / 1013.25 );
4396**
4397**      where tsl is the approximate sea-level air temperature in K
4398**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
4399**      52).  Similarly, if the pressure phpa is not known, it can be
4400**      estimated from the height of the observing station, hm, as
4401**      follows:
4402**
4403**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
4404**
4405**      Note, however, that the refraction is nearly proportional to
4406**      the pressure and that an accurate phpa value is important for
4407**      precise work.
4408**
4409**  7)  The argument wl specifies the observing wavelength in
4410**      micrometers.  The transition from optical to radio is assumed to
4411**      occur at 100 micrometers (about 3000 GHz).
4412**
4413**  8)  "Observed" Az,ZD means the position that would be seen by a
4414**      perfect geodetically aligned theodolite.  (Zenith distance is
4415**      used rather than altitude in order to reflect the fact that no
4416**      allowance is made for depression of the horizon.)  This is
4417**      related to the observed HA,Dec via the standard rotation, using
4418**      the geodetic latitude (corrected for polar motion), while the
4419**      observed HA and RA are related simply through the Earth rotation
4420**      angle and the site longitude.  "Observed" RA,Dec or HA,Dec thus
4421**      means the position that would be seen by a perfect equatorial
4422**      with its polar axis aligned to the Earth's axis of rotation.
4423**
4424**  9)  The accuracy of the result is limited by the corrections for
4425**      refraction, which use a simple A*tan(z) + B*tan^3(z) model.
4426**      Providing the meteorological parameters are known accurately and
4427**      there are no gross local effects, the predicted astrometric
4428**      coordinates should be within 0.05 arcsec (optical) or 1 arcsec
4429**      (radio) for a zenith distance of less than 70 degrees, better
4430**      than 30 arcsec (optical or radio) at 85 degrees and better
4431**      than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
4432**
4433**  10) The complementary functions iauAtio13 and iauAtoi13 are self-
4434**      consistent to better than 1 microarcsecond all over the
4435**      celestial sphere.
4436**
4437**  11) It is advisable to take great care with units, as even unlikely
4438**      values of the input parameters are accepted and processed in
4439**      accordance with the models used.
4440**
4441**  Called:
4442**     iauApio13    astrometry parameters, CIRS-observed, 2013
4443**     iauAtioq     quick CIRS to observed
4444**
4445*/
4446
4447
4448
4449void iauAtioq(double ri, double di, iauASTROM *astrom,
4450              double *aob, double *zob,
4451              double *hob, double *dob, double *rob)
4452/*
4453**  - - - - - - - - -
4454**   i a u A t i o q
4455**  - - - - - - - - -
4456**
4457**  Quick CIRS to observed place transformation.
4458**
4459**  Use of this function is appropriate when efficiency is important and
4460**  where many star positions are all to be transformed for one date.
4461**  The star-independent astrometry parameters can be obtained by
4462**  calling iauApio[13] or iauApco[13].
4463**
4464**  This function is part of the International Astronomical Union's
4465**  SOFA (Standards of Fundamental Astronomy) software collection.
4466**
4467**  Status:  support function.
4468**
4469**  Given:
4470**     ri     double     CIRS right ascension
4471**     di     double     CIRS declination
4472**     astrom iauASTROM* star-independent astrometry parameters:
4473**      pmt    double       PM time interval (SSB, Julian years)
4474**      eb     double[3]    SSB to observer (vector, au)
4475**      eh     double[3]    Sun to observer (unit vector)
4476**      em     double       distance from Sun to observer (au)
4477**      v      double[3]    barycentric observer velocity (vector, c)
4478**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
4479**      bpn    double[3][3] bias-precession-nutation matrix
4480**      along  double       longitude + s' (radians)
4481**      xpl    double       polar motion xp wrt local meridian (radians)
4482**      ypl    double       polar motion yp wrt local meridian (radians)
4483**      sphi   double       sine of geodetic latitude
4484**      cphi   double       cosine of geodetic latitude
4485**      diurab double       magnitude of diurnal aberration vector
4486**      eral   double       "local" Earth rotation angle (radians)
4487**      refa   double       refraction constant A (radians)
4488**      refb   double       refraction constant B (radians)
4489**
4490**  Returned:
4491**     aob    double*    observed azimuth (radians: N=0,E=90)
4492**     zob    double*    observed zenith distance (radians)
4493**     hob    double*    observed hour angle (radians)
4494**     dob    double*    observed declination (radians)
4495**     rob    double*    observed right ascension (CIO-based, radians)
4496**
4497**  Notes:
4498**
4499**  1) This function returns zenith distance rather than altitude in
4500**     order to reflect the fact that no allowance is made for
4501**     depression of the horizon.
4502**
4503**  2) The accuracy of the result is limited by the corrections for
4504**     refraction, which use a simple A*tan(z) + B*tan^3(z) model.
4505**     Providing the meteorological parameters are known accurately and
4506**     there are no gross local effects, the predicted observed
4507**     coordinates should be within 0.05 arcsec (optical) or 1 arcsec
4508**     (radio) for a zenith distance of less than 70 degrees, better
4509**     than 30 arcsec (optical or radio) at 85 degrees and better
4510**     than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
4511**
4512**     Without refraction, the complementary functions iauAtioq and
4513**     iauAtoiq are self-consistent to better than 1 microarcsecond all
4514**     over the celestial sphere.  With refraction included, consistency
4515**     falls off at high zenith distances, but is still better than
4516**     0.05 arcsec at 85 degrees.
4517**
4518**  3) It is advisable to take great care with units, as even unlikely
4519**     values of the input parameters are accepted and processed in
4520**     accordance with the models used.
4521**
4522**  4) The CIRS RA,Dec is obtained from a star catalog mean place by
4523**     allowing for space motion, parallax, the Sun's gravitational lens
4524**     effect, annual aberration and precession-nutation.  For star
4525**     positions in the ICRS, these effects can be applied by means of
4526**     the iauAtci13 (etc.) functions.  Starting from classical "mean
4527**     place" systems, additional transformations will be needed first.
4528**
4529**  5) "Observed" Az,El means the position that would be seen by a
4530**     perfect geodetically aligned theodolite.  This is obtained from
4531**     the CIRS RA,Dec by allowing for Earth orientation and diurnal
4532**     aberration, rotating from equator to horizon coordinates, and
4533**     then adjusting for refraction.  The HA,Dec is obtained by
4534**     rotating back into equatorial coordinates, and is the position
4535**     that would be seen by a perfect equatorial with its polar axis
4536**     aligned to the Earth's axis of rotation.  Finally, the RA is
4537**     obtained by subtracting the HA from the local ERA.
4538**
4539**  6) The star-independent CIRS-to-observed-place parameters in ASTROM
4540**     may be computed with iauApio[13] or iauApco[13].  If nothing has
4541**     changed significantly except the time, iauAper[13] may be used to
4542**     perform the requisite adjustment to the astrom structure.
4543**
4544**  Called:
4545**     iauS2c       spherical coordinates to unit vector
4546**     iauC2s       p-vector to spherical
4547**     iauAnp       normalize angle into range 0 to 2pi
4548**
4549*/
4550
4551
4552
4553int iauAtoc13(const char *type, double ob1, double ob2,
4554              double utc1, double utc2, double dut1,
4555              double elong, double phi, double hm, double xp, double yp,
4556              double phpa, double tc, double rh, double wl,
4557              double *rc, double *dc)
4558/*
4559**  - - - - - - - - - -
4560**   i a u A t o c 1 3
4561**  - - - - - - - - - -
4562**
4563**  Observed place at a groundbased site to to ICRS astrometric RA,Dec.
4564**  The caller supplies UTC, site coordinates, ambient air conditions
4565**  and observing wavelength.
4566**
4567**  This function is part of the International Astronomical Union's
4568**  SOFA (Standards of Fundamental Astronomy) software collection.
4569**
4570**  Status:  support function.
4571**
4572**  Given:
4573**     type   char[]   type of coordinates - "R", "H" or "A" (Notes 1,2)
4574**     ob1    double   observed Az, HA or RA (radians; Az is N=0,E=90)
4575**     ob2    double   observed ZD or Dec (radians)
4576**     utc1   double   UTC as a 2-part...
4577**     utc2   double   ...quasi Julian Date (Notes 3,4)
4578**     dut1   double   UT1-UTC (seconds, Note 5)
4579**     elong  double   longitude (radians, east +ve, Note 6)
4580**     phi    double   geodetic latitude (radians, Note 6)
4581**     hm     double   height above ellipsoid (m, geodetic Notes 6,8)
4582**     xp,yp  double   polar motion coordinates (radians, Note 7)
4583**     phpa   double   pressure at the observer (hPa = mB, Note 8)
4584**     tc     double   ambient temperature at the observer (deg C)
4585**     rh     double   relative humidity at the observer (range 0-1)
4586**     wl     double   wavelength (micrometers, Note 9)
4587**
4588**  Returned:
4589**     rc,dc  double   ICRS astrometric RA,Dec (radians)
4590**
4591**  Returned (function value):
4592**            int      status: +1 = dubious year (Note 4)
4593**                              0 = OK
4594**                             -1 = unacceptable date
4595**
4596**  Notes:
4597**
4598**  1)  "Observed" Az,ZD means the position that would be seen by a
4599**      perfect geodetically aligned theodolite.  (Zenith distance is
4600**      used rather than altitude in order to reflect the fact that no
4601**      allowance is made for depression of the horizon.)  This is
4602**      related to the observed HA,Dec via the standard rotation, using
4603**      the geodetic latitude (corrected for polar motion), while the
4604**      observed HA and RA are related simply through the Earth rotation
4605**      angle and the site longitude.  "Observed" RA,Dec or HA,Dec thus
4606**      means the position that would be seen by a perfect equatorial
4607**      with its polar axis aligned to the Earth's axis of rotation.
4608**
4609**  2)  Only the first character of the type argument is significant.
4610**      "R" or "r" indicates that ob1 and ob2 are the observed right
4611**      ascension and declination;  "H" or "h" indicates that they are
4612**      hour angle (west +ve) and declination;  anything else ("A" or
4613**      "a" is recommended) indicates that ob1 and ob2 are azimuth
4614**      (north zero, east 90 deg) and zenith distance.
4615**
4616**  3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
4617**      convenient way between the two arguments, for example where utc1
4618**      is the Julian Day Number and utc2 is the fraction of a day.
4619**
4620**      However, JD cannot unambiguously represent UTC during a leap
4621**      second unless special measures are taken.  The convention in the
4622**      present function is that the JD day represents UTC days whether
4623**      the length is 86399, 86400 or 86401 SI seconds.
4624**
4625**      Applications should use the function iauDtf2d to convert from
4626**      calendar date and time of day into 2-part quasi Julian Date, as
4627**      it implements the leap-second-ambiguity convention just
4628**      described.
4629**
4630**  4)  The warning status "dubious year" flags UTCs that predate the
4631**      introduction of the time scale or that are too far in the
4632**      future to be trusted.  See iauDat for further details.
4633**
4634**  5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
4635**      one second at the end of each positive UTC leap second,
4636**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
4637**      practice is under review, and in the future UT1-UTC may grow
4638**      essentially without limit.
4639**
4640**  6)  The geographical coordinates are with respect to the WGS84
4641**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
4642**      longitude required by the present function is east-positive
4643**      (i.e. right-handed), in accordance with geographical convention.
4644**
4645**  7)  The polar motion xp,yp can be obtained from IERS bulletins.  The
4646**      values are the coordinates (in radians) of the Celestial
4647**      Intermediate Pole with respect to the International Terrestrial
4648**      Reference System (see IERS Conventions 2003), measured along the
4649**      meridians 0 and 90 deg west respectively.  For many
4650**      applications, xp and yp can be set to zero.
4651**
4652**  8)  If hm, the height above the ellipsoid of the observing station
4653**      in meters, is not known but phpa, the pressure in hPa (=mB), is
4654**      available, an adequate estimate of hm can be obtained from the
4655**      expression
4656**
4657**            hm = -29.3 * tsl * log ( phpa / 1013.25 );
4658**
4659**      where tsl is the approximate sea-level air temperature in K
4660**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
4661**      52).  Similarly, if the pressure phpa is not known, it can be
4662**      estimated from the height of the observing station, hm, as
4663**      follows:
4664**
4665**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
4666**
4667**      Note, however, that the refraction is nearly proportional to
4668**      the pressure and that an accurate phpa value is important for
4669**      precise work.
4670**
4671**  9)  The argument wl specifies the observing wavelength in
4672**      micrometers.  The transition from optical to radio is assumed to
4673**      occur at 100 micrometers (about 3000 GHz).
4674**
4675**  10) The accuracy of the result is limited by the corrections for
4676**      refraction, which use a simple A*tan(z) + B*tan^3(z) model.
4677**      Providing the meteorological parameters are known accurately and
4678**      there are no gross local effects, the predicted astrometric
4679**      coordinates should be within 0.05 arcsec (optical) or 1 arcsec
4680**      (radio) for a zenith distance of less than 70 degrees, better
4681**      than 30 arcsec (optical or radio) at 85 degrees and better
4682**      than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
4683**
4684**      Without refraction, the complementary functions iauAtco13 and
4685**      iauAtoc13 are self-consistent to better than 1 microarcsecond
4686**      all over the celestial sphere.  With refraction included,
4687**      consistency falls off at high zenith distances, but is still
4688**      better than 0.05 arcsec at 85 degrees.
4689**
4690**  11) It is advisable to take great care with units, as even unlikely
4691**      values of the input parameters are accepted and processed in
4692**      accordance with the models used.
4693**
4694**  Called:
4695**     iauApco13    astrometry parameters, ICRS-observed
4696**     iauAtoiq     quick observed to CIRS
4697**     iauAticq     quick CIRS to ICRS
4698**
4699*/
4700
4701
4702
4703int iauAtoi13(const char *type, double ob1, double ob2,
4704              double utc1, double utc2, double dut1,
4705              double elong, double phi, double hm, double xp, double yp,
4706              double phpa, double tc, double rh, double wl,
4707              double *ri, double *di)
4708/*
4709**  - - - - - - - - - -
4710**   i a u A t o i 1 3
4711**  - - - - - - - - - -
4712**
4713**  Observed place to CIRS.  The caller supplies UTC, site coordinates,
4714**  ambient air conditions and observing wavelength.
4715**
4716**  This function is part of the International Astronomical Union's
4717**  SOFA (Standards of Fundamental Astronomy) software collection.
4718**
4719**  Status:  support function.
4720**
4721**  Given:
4722**     type   char[]   type of coordinates - "R", "H" or "A" (Notes 1,2)
4723**     ob1    double   observed Az, HA or RA (radians; Az is N=0,E=90)
4724**     ob2    double   observed ZD or Dec (radians)
4725**     utc1   double   UTC as a 2-part...
4726**     utc2   double   ...quasi Julian Date (Notes 3,4)
4727**     dut1   double   UT1-UTC (seconds, Note 5)
4728**     elong  double   longitude (radians, east +ve, Note 6)
4729**     phi    double   geodetic latitude (radians, Note 6)
4730**     hm     double   height above the ellipsoid (meters, Notes 6,8)
4731**     xp,yp  double   polar motion coordinates (radians, Note 7)
4732**     phpa   double   pressure at the observer (hPa = mB, Note 8)
4733**     tc     double   ambient temperature at the observer (deg C)
4734**     rh     double   relative humidity at the observer (range 0-1)
4735**     wl     double   wavelength (micrometers, Note 9)
4736**
4737**  Returned:
4738**     ri     double*  CIRS right ascension (CIO-based, radians)
4739**     di     double*  CIRS declination (radians)
4740**
4741**  Returned (function value):
4742**            int      status: +1 = dubious year (Note 2)
4743**                              0 = OK
4744**                             -1 = unacceptable date
4745**
4746**  Notes:
4747**
4748**  1)  "Observed" Az,ZD means the position that would be seen by a
4749**      perfect geodetically aligned theodolite.  (Zenith distance is
4750**      used rather than altitude in order to reflect the fact that no
4751**      allowance is made for depression of the horizon.)  This is
4752**      related to the observed HA,Dec via the standard rotation, using
4753**      the geodetic latitude (corrected for polar motion), while the
4754**      observed HA and RA are related simply through the Earth rotation
4755**      angle and the site longitude.  "Observed" RA,Dec or HA,Dec thus
4756**      means the position that would be seen by a perfect equatorial
4757**      with its polar axis aligned to the Earth's axis of rotation.
4758**
4759**  2)  Only the first character of the type argument is significant.
4760**      "R" or "r" indicates that ob1 and ob2 are the observed right
4761**      ascension and declination;  "H" or "h" indicates that they are
4762**      hour angle (west +ve) and declination;  anything else ("A" or
4763**      "a" is recommended) indicates that ob1 and ob2 are azimuth
4764**      (north zero, east 90 deg) and zenith distance.
4765**
4766**  3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
4767**      convenient way between the two arguments, for example where utc1
4768**      is the Julian Day Number and utc2 is the fraction of a day.
4769**
4770**      However, JD cannot unambiguously represent UTC during a leap
4771**      second unless special measures are taken.  The convention in the
4772**      present function is that the JD day represents UTC days whether
4773**      the length is 86399, 86400 or 86401 SI seconds.
4774**
4775**      Applications should use the function iauDtf2d to convert from
4776**      calendar date and time of day into 2-part quasi Julian Date, as
4777**      it implements the leap-second-ambiguity convention just
4778**      described.
4779**
4780**  4)  The warning status "dubious year" flags UTCs that predate the
4781**      introduction of the time scale or that are too far in the
4782**      future to be trusted.  See iauDat for further details.
4783**
4784**  5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
4785**      one second at the end of each positive UTC leap second,
4786**      introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
4787**      practice is under review, and in the future UT1-UTC may grow
4788**      essentially without limit.
4789**
4790**  6)  The geographical coordinates are with respect to the WGS84
4791**      reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
4792**      longitude required by the present function is east-positive
4793**      (i.e. right-handed), in accordance with geographical convention.
4794**
4795**  7)  The polar motion xp,yp can be obtained from IERS bulletins.  The
4796**      values are the coordinates (in radians) of the Celestial
4797**      Intermediate Pole with respect to the International Terrestrial
4798**      Reference System (see IERS Conventions 2003), measured along the
4799**      meridians 0 and 90 deg west respectively.  For many
4800**      applications, xp and yp can be set to zero.
4801**
4802**  8)  If hm, the height above the ellipsoid of the observing station
4803**      in meters, is not known but phpa, the pressure in hPa (=mB), is
4804**      available, an adequate estimate of hm can be obtained from the
4805**      expression
4806**
4807**            hm = -29.3 * tsl * log ( phpa / 1013.25 );
4808**
4809**      where tsl is the approximate sea-level air temperature in K
4810**      (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
4811**      52).  Similarly, if the pressure phpa is not known, it can be
4812**      estimated from the height of the observing station, hm, as
4813**      follows:
4814**
4815**            phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
4816**
4817**      Note, however, that the refraction is nearly proportional to
4818**      the pressure and that an accurate phpa value is important for
4819**      precise work.
4820**
4821**  9)  The argument wl specifies the observing wavelength in
4822**      micrometers.  The transition from optical to radio is assumed to
4823**      occur at 100 micrometers (about 3000 GHz).
4824**
4825**  10) The accuracy of the result is limited by the corrections for
4826**      refraction, which use a simple A*tan(z) + B*tan^3(z) model.
4827**      Providing the meteorological parameters are known accurately and
4828**      there are no gross local effects, the predicted astrometric
4829**      coordinates should be within 0.05 arcsec (optical) or 1 arcsec
4830**      (radio) for a zenith distance of less than 70 degrees, better
4831**      than 30 arcsec (optical or radio) at 85 degrees and better
4832**      than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
4833**
4834**      Without refraction, the complementary functions iauAtio13 and
4835**      iauAtoi13 are self-consistent to better than 1 microarcsecond
4836**      all over the celestial sphere.  With refraction included,
4837**      consistency falls off at high zenith distances, but is still
4838**      better than 0.05 arcsec at 85 degrees.
4839**
4840**  12) It is advisable to take great care with units, as even unlikely
4841**      values of the input parameters are accepted and processed in
4842**      accordance with the models used.
4843**
4844**  Called:
4845**     iauApio13    astrometry parameters, CIRS-observed, 2013
4846**     iauAtoiq     quick observed to CIRS
4847**
4848*/
4849
4850
4851
4852void iauAtoiq(const char *type,
4853              double ob1, double ob2, iauASTROM *astrom,
4854              double *ri, double *di)
4855/*
4856**  - - - - - - - - -
4857**   i a u A t o i q
4858**  - - - - - - - - -
4859**
4860**  Quick observed place to CIRS, given the star-independent astrometry
4861**  parameters.
4862**
4863**  Use of this function is appropriate when efficiency is important and
4864**  where many star positions are all to be transformed for one date.
4865**  The star-independent astrometry parameters can be obtained by
4866**  calling iauApio[13] or iauApco[13].
4867**
4868**  Status:  support function.
4869**
4870**  Given:
4871**     type   char[]     type of coordinates: "R", "H" or "A" (Note 1)
4872**     ob1    double     observed Az, HA or RA (radians; Az is N=0,E=90)
4873**     ob2    double     observed ZD or Dec (radians)
4874**     astrom iauASTROM* star-independent astrometry parameters:
4875**      pmt    double       PM time interval (SSB, Julian years)
4876**      eb     double[3]    SSB to observer (vector, au)
4877**      eh     double[3]    Sun to observer (unit vector)
4878**      em     double       distance from Sun to observer (au)
4879**      v      double[3]    barycentric observer velocity (vector, c)
4880**      bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
4881**      bpn    double[3][3] bias-precession-nutation matrix
4882**      along  double       longitude + s' (radians)
4883**      xpl    double       polar motion xp wrt local meridian (radians)
4884**      ypl    double       polar motion yp wrt local meridian (radians)
4885**      sphi   double       sine of geodetic latitude
4886**      cphi   double       cosine of geodetic latitude
4887**      diurab double       magnitude of diurnal aberration vector
4888**      eral   double       "local" Earth rotation angle (radians)
4889**      refa   double       refraction constant A (radians)
4890**      refb   double       refraction constant B (radians)
4891**
4892**  Returned:
4893**     ri     double*    CIRS right ascension (CIO-based, radians)
4894**     di     double*    CIRS declination (radians)
4895**
4896**  Notes:
4897**
4898**  1) "Observed" Az,El means the position that would be seen by a
4899**     perfect geodetically aligned theodolite.  This is related to
4900**     the observed HA,Dec via the standard rotation, using the geodetic
4901**     latitude (corrected for polar motion), while the observed HA and
4902**     RA are related simply through the Earth rotation angle and the
4903**     site longitude.  "Observed" RA,Dec or HA,Dec thus means the
4904**     position that would be seen by a perfect equatorial with its
4905**     polar axis aligned to the Earth's axis of rotation.  By removing
4906**     from the observed place the effects of atmospheric refraction and
4907**     diurnal aberration, the CIRS RA,Dec is obtained.
4908**
4909**  2) Only the first character of the type argument is significant.
4910**     "R" or "r" indicates that ob1 and ob2 are the observed right
4911**     ascension and declination;  "H" or "h" indicates that they are
4912**     hour angle (west +ve) and declination;  anything else ("A" or
4913**     "a" is recommended) indicates that ob1 and ob2 are azimuth (north
4914**     zero, east 90 deg) and zenith distance.  (Zenith distance is used
4915**     rather than altitude in order to reflect the fact that no
4916**     allowance is made for depression of the horizon.)
4917**
4918**  3) The accuracy of the result is limited by the corrections for
4919**     refraction, which use a simple A*tan(z) + B*tan^3(z) model.
4920**     Providing the meteorological parameters are known accurately and
4921**     there are no gross local effects, the predicted intermediate
4922**     coordinates should be within 0.05 arcsec (optical) or 1 arcsec
4923**     (radio) for a zenith distance of less than 70 degrees, better
4924**     than 30 arcsec (optical or radio) at 85 degrees and better than
4925**     20 arcmin (optical) or 25 arcmin (radio) at the horizon.
4926**
4927**     Without refraction, the complementary functions iauAtioq and
4928**     iauAtoiq are self-consistent to better than 1 microarcsecond all
4929**     over the celestial sphere.  With refraction included, consistency
4930**     falls off at high zenith distances, but is still better than
4931**     0.05 arcsec at 85 degrees.
4932**
4933**  4) It is advisable to take great care with units, as even unlikely
4934**     values of the input parameters are accepted and processed in
4935**     accordance with the models used.
4936**
4937**  Called:
4938**     iauS2c       spherical coordinates to unit vector
4939**     iauC2s       p-vector to spherical
4940**     iauAnp       normalize angle into range 0 to 2pi
4941**
4942*/
4943
4944
4945
4946void iauBi00(double *dpsibi, double *depsbi, double *dra)
4947/*
4948**  - - - - - - - -
4949**   i a u B i 0 0
4950**  - - - - - - - -
4951**
4952**  Frame bias components of IAU 2000 precession-nutation models;  part
4953**  of the Mathews-Herring-Buffett (MHB2000) nutation series, with
4954**  additions.
4955**
4956**  This function is part of the International Astronomical Union's
4957**  SOFA (Standards Of Fundamental Astronomy) software collection.
4958**
4959**  Status:  canonical model.
4960**
4961**  Returned:
4962**     dpsibi,depsbi  double  longitude and obliquity corrections
4963**     dra            double  the ICRS RA of the J2000.0 mean equinox
4964**
4965**  Notes:
4966**
4967**  1) The frame bias corrections in longitude and obliquity (radians)
4968**     are required in order to correct for the offset between the GCRS
4969**     pole and the mean J2000.0 pole.  They define, with respect to the
4970**     GCRS frame, a J2000.0 mean pole that is consistent with the rest
4971**     of the IAU 2000A precession-nutation model.
4972**
4973**  2) In addition to the displacement of the pole, the complete
4974**     description of the frame bias requires also an offset in right
4975**     ascension.  This is not part of the IAU 2000A model, and is from
4976**     Chapront et al. (2002).  It is returned in radians.
4977**
4978**  3) This is a supplemented implementation of one aspect of the IAU
4979**     2000A nutation model, formally adopted by the IAU General
4980**     Assembly in 2000, namely MHB2000 (Mathews et al. 2002).
4981**
4982**  References:
4983**
4984**     Chapront, J., Chapront-Touze, M. & Francou, G., Astron.
4985**     Astrophys., 387, 700, 2002.
4986**
4987**     Mathews, P.M., Herring, T.A., Buffet, B.A., "Modeling of nutation
4988**     and precession:  New nutation series for nonrigid Earth and
4989**     insights into the Earth's interior", J.Geophys.Res., 107, B4,
4990**     2002.  The MHB2000 code itself was obtained on 2002 September 9
4991**     from ftp://maia.usno.navy.mil/conv2000/chapter5/IAU2000A.
4992**
4993*/
4994
4995
4996
4997void iauBp00(double date1, double date2,
4998             double rb[3][3], double rp[3][3], double rbp[3][3])
4999/*
5000**  - - - - - - - -
5001**   i a u B p 0 0
5002**  - - - - - - - -
5003**
5004**  Frame bias and precession, IAU 2000.
5005**
5006**  This function is part of the International Astronomical Union's
5007**  SOFA (Standards Of Fundamental Astronomy) software collection.
5008**
5009**  Status:  canonical model.
5010**
5011**  Given:
5012**     date1,date2  double         TT as a 2-part Julian Date (Note 1)
5013**
5014**  Returned:
5015**     rb           double[3][3]   frame bias matrix (Note 2)
5016**     rp           double[3][3]   precession matrix (Note 3)
5017**     rbp          double[3][3]   bias-precession matrix (Note 4)
5018**
5019**  Notes:
5020**
5021**  1) The TT date date1+date2 is a Julian Date, apportioned in any
5022**     convenient way between the two arguments.  For example,
5023**     JD(TT)=2450123.7 could be expressed in any of these ways,
5024**     among others:
5025**
5026**             date1         date2
5027**
5028**         2450123.7           0.0       (JD method)
5029**         2451545.0       -1421.3       (J2000 method)
5030**         2400000.5       50123.2       (MJD method)
5031**         2450123.5           0.2       (date & time method)
5032**
5033**     The JD method is the most natural and convenient to use in
5034**     cases where the loss of several decimal digits of resolution
5035**     is acceptable.  The J2000 method is best matched to the way
5036**     the argument is handled internally and will deliver the
5037**     optimum resolution.  The MJD method and the date & time methods
5038**     are both good compromises between resolution and convenience.
5039**
5040**  2) The matrix rb transforms vectors from GCRS to mean J2000.0 by
5041**     applying frame bias.
5042**
5043**  3) The matrix rp transforms vectors from J2000.0 mean equator and
5044**     equinox to mean equator and equinox of date by applying
5045**     precession.
5046**
5047**  4) The matrix rbp transforms vectors from GCRS to mean equator and
5048**     equinox of date by applying frame bias then precession.  It is
5049**     the product rp x rb.
5050**
5051**  5) It is permissible to re-use the same array in the returned
5052**     arguments.  The arrays are filled in the order given.
5053**
5054**  Called:
5055**     iauBi00      frame bias components, IAU 2000
5056**     iauPr00      IAU 2000 precession adjustments
5057**     iauIr        initialize r-matrix to identity
5058**     iauRx        rotate around X-axis
5059**     iauRy        rotate around Y-axis
5060**     iauRz        rotate around Z-axis
5061**     iauCr        copy r-matrix
5062**     iauRxr       product of two r-matrices
5063**
5064**  Reference:
5065**     "Expressions for the Celestial Intermediate Pole and Celestial
5066**     Ephemeris Origin consistent with the IAU 2000A precession-
5067**     nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
5068**
5069**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
5070**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
5071**
5072*/
5073
5074
5075
5076void iauBp06(double date1, double date2,
5077             double rb[3][3], double rp[3][3], double rbp[3][3])
5078/*
5079**  - - - - - - - -
5080**   i a u B p 0 6
5081**  - - - - - - - -
5082**
5083**  Frame bias and precession, IAU 2006.
5084**
5085**  This function is part of the International Astronomical Union's
5086**  SOFA (Standards Of Fundamental Astronomy) software collection.
5087**
5088**  Status:  support function.
5089**
5090**  Given:
5091**     date1,date2  double         TT as a 2-part Julian Date (Note 1)
5092**
5093**  Returned:
5094**     rb           double[3][3]   frame bias matrix (Note 2)
5095**     rp           double[3][3]   precession matrix (Note 3)
5096**     rbp          double[3][3]   bias-precession matrix (Note 4)
5097**
5098**  Notes:
5099**
5100**  1) The TT date date1+date2 is a Julian Date, apportioned in any
5101**     convenient way between the two arguments.  For example,
5102**     JD(TT)=2450123.7 could be expressed in any of these ways,
5103**     among others:
5104**
5105**             date1         date2
5106**
5107**         2450123.7           0.0       (JD method)
5108**         2451545.0       -1421.3       (J2000 method)
5109**         2400000.5       50123.2       (MJD method)
5110**         2450123.5           0.2       (date & time method)
5111**
5112**     The JD method is the most natural and convenient to use in
5113**     cases where the loss of several decimal digits of resolution
5114**     is acceptable.  The J2000 method is best matched to the way
5115**     the argument is handled internally and will deliver the
5116**     optimum resolution.  The MJD method and the date & time methods
5117**     are both good compromises between resolution and convenience.
5118**
5119**  2) The matrix rb transforms vectors from GCRS to mean J2000.0 by
5120**     applying frame bias.
5121**
5122**  3) The matrix rp transforms vectors from mean J2000.0 to mean of
5123**     date by applying precession.
5124**
5125**  4) The matrix rbp transforms vectors from GCRS to mean of date by
5126**     applying frame bias then precession.  It is the product rp x rb.
5127**
5128**  5) It is permissible to re-use the same array in the returned
5129**     arguments.  The arrays are filled in the order given.
5130**
5131**  Called:
5132**     iauPfw06     bias-precession F-W angles, IAU 2006
5133**     iauFw2m      F-W angles to r-matrix
5134**     iauPmat06    PB matrix, IAU 2006
5135**     iauTr        transpose r-matrix
5136**     iauRxr       product of two r-matrices
5137**     iauCr        copy r-matrix
5138**
5139**  References:
5140**
5141**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
5142**
5143**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
5144**
5145*/
5146
5147
5148
5149void iauBpn2xy(double rbpn[3][3], double *x, double *y)
5150/*
5151**  - - - - - - - - - -
5152**   i a u B p n 2 x y
5153**  - - - - - - - - - -
5154**
5155**  Extract from the bias-precession-nutation matrix the X,Y coordinates
5156**  of the Celestial Intermediate Pole.
5157**
5158**  This function is part of the International Astronomical Union's
5159**  SOFA (Standards Of Fundamental Astronomy) software collection.
5160**
5161**  Status:  support function.
5162**
5163**  Given:
5164**     rbpn      double[3][3]  celestial-to-true matrix (Note 1)
5165**
5166**  Returned:
5167**     x,y       double        Celestial Intermediate Pole (Note 2)
5168**
5169**  Notes:
5170**
5171**  1) The matrix rbpn transforms vectors from GCRS to true equator (and
5172**     CIO or equinox) of date, and therefore the Celestial Intermediate
5173**     Pole unit vector is the bottom row of the matrix.
5174**
5175**  2) The arguments x,y are components of the Celestial Intermediate
5176**     Pole unit vector in the Geocentric Celestial Reference System.
5177**
5178**  Reference:
5179**
5180**     "Expressions for the Celestial Intermediate Pole and Celestial
5181**     Ephemeris Origin consistent with the IAU 2000A precession-
5182**     nutation model", Astron.Astrophys. 400, 1145-1154
5183**     (2003)
5184**
5185**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
5186**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
5187**
5188*/
5189
5190
5191
5192void iauC2i00a(double date1, double date2, double rc2i[3][3])
5193/*
5194**  - - - - - - - - - -
5195**   i a u C 2 i 0 0 a
5196**  - - - - - - - - - -
5197**
5198**  Form the celestial-to-intermediate matrix for a given date using the
5199**  IAU 2000A precession-nutation model.
5200**
5201**  This function is part of the International Astronomical Union's
5202**  SOFA (Standards Of Fundamental Astronomy) software collection.
5203**
5204**  Status:  support function.
5205**
5206**  Given:
5207**     date1,date2 double       TT as a 2-part Julian Date (Note 1)
5208**
5209**  Returned:
5210**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 2)
5211**
5212**  Notes:
5213**
5214**  1) The TT date date1+date2 is a Julian Date, apportioned in any
5215**     convenient way between the two arguments.  For example,
5216**     JD(TT)=2450123.7 could be expressed in any of these ways,
5217**     among others:
5218**
5219**            date1          date2
5220**
5221**         2450123.7           0.0       (JD method)
5222**         2451545.0       -1421.3       (J2000 method)
5223**         2400000.5       50123.2       (MJD method)
5224**         2450123.5           0.2       (date & time method)
5225**
5226**     The JD method is the most natural and convenient to use in
5227**     cases where the loss of several decimal digits of resolution
5228**     is acceptable.  The J2000 method is best matched to the way
5229**     the argument is handled internally and will deliver the
5230**     optimum resolution.  The MJD method and the date & time methods
5231**     are both good compromises between resolution and convenience.
5232**
5233**  2) The matrix rc2i is the first stage in the transformation from
5234**     celestial to terrestrial coordinates:
5235**
5236**        [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]
5237**
5238**               =  rc2t * [CRS]
5239**
5240**     where [CRS] is a vector in the Geocentric Celestial Reference
5241**     System and [TRS] is a vector in the International Terrestrial
5242**     Reference System (see IERS Conventions 2003), ERA is the Earth
5243**     Rotation Angle and RPOM is the polar motion matrix.
5244**
5245**  3) A faster, but slightly less accurate, result (about 1 mas) can be
5246**     obtained by using instead the iauC2i00b function.
5247**
5248**  Called:
5249**     iauPnm00a    classical NPB matrix, IAU 2000A
5250**     iauC2ibpn    celestial-to-intermediate matrix, given NPB matrix
5251**
5252**  References:
5253**
5254**     "Expressions for the Celestial Intermediate Pole and Celestial
5255**     Ephemeris Origin consistent with the IAU 2000A precession-
5256**     nutation model", Astron.Astrophys. 400, 1145-1154
5257**     (2003)
5258**
5259**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
5260**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
5261**
5262**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5263**     IERS Technical Note No. 32, BKG (2004)
5264**
5265*/
5266
5267
5268
5269void iauC2i00b(double date1, double date2, double rc2i[3][3])
5270/*
5271**  - - - - - - - - - -
5272**   i a u C 2 i 0 0 b
5273**  - - - - - - - - - -
5274**
5275**  Form the celestial-to-intermediate matrix for a given date using the
5276**  IAU 2000B precession-nutation model.
5277**
5278**  This function is part of the International Astronomical Union's
5279**  SOFA (Standards Of Fundamental Astronomy) software collection.
5280**
5281**  Status:  support function.
5282**
5283**  Given:
5284**     date1,date2 double       TT as a 2-part Julian Date (Note 1)
5285**
5286**  Returned:
5287**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 2)
5288**
5289**  Notes:
5290**
5291**  1) The TT date date1+date2 is a Julian Date, apportioned in any
5292**     convenient way between the two arguments.  For example,
5293**     JD(TT)=2450123.7 could be expressed in any of these ways,
5294**     among others:
5295**
5296**            date1          date2
5297**
5298**         2450123.7           0.0       (JD method)
5299**         2451545.0       -1421.3       (J2000 method)
5300**         2400000.5       50123.2       (MJD method)
5301**         2450123.5           0.2       (date & time method)
5302**
5303**     The JD method is the most natural and convenient to use in
5304**     cases where the loss of several decimal digits of resolution
5305**     is acceptable.  The J2000 method is best matched to the way
5306**     the argument is handled internally and will deliver the
5307**     optimum resolution.  The MJD method and the date & time methods
5308**     are both good compromises between resolution and convenience.
5309**
5310**  2) The matrix rc2i is the first stage in the transformation from
5311**     celestial to terrestrial coordinates:
5312**
5313**        [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]
5314**
5315**               =  rc2t * [CRS]
5316**
5317**     where [CRS] is a vector in the Geocentric Celestial Reference
5318**     System and [TRS] is a vector in the International Terrestrial
5319**     Reference System (see IERS Conventions 2003), ERA is the Earth
5320**     Rotation Angle and RPOM is the polar motion matrix.
5321**
5322**  3) The present function is faster, but slightly less accurate (about
5323**     1 mas), than the iauC2i00a function.
5324**
5325**  Called:
5326**     iauPnm00b    classical NPB matrix, IAU 2000B
5327**     iauC2ibpn    celestial-to-intermediate matrix, given NPB matrix
5328**
5329**  References:
5330**
5331**     "Expressions for the Celestial Intermediate Pole and Celestial
5332**     Ephemeris Origin consistent with the IAU 2000A precession-
5333**     nutation model", Astron.Astrophys. 400, 1145-1154
5334**     (2003)
5335**
5336**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
5337**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
5338**
5339**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5340**     IERS Technical Note No. 32, BKG (2004)
5341**
5342*/
5343
5344
5345
5346void iauC2i06a(double date1, double date2, double rc2i[3][3])
5347/*
5348**  - - - - - - - - - -
5349**   i a u C 2 i 0 6 a
5350**  - - - - - - - - - -
5351**
5352**  Form the celestial-to-intermediate matrix for a given date using the
5353**  IAU 2006 precession and IAU 2000A nutation models.
5354**
5355**  This function is part of the International Astronomical Union's
5356**  SOFA (Standards Of Fundamental Astronomy) software collection.
5357**
5358**  Status:  support function.
5359**
5360**  Given:
5361**     date1,date2 double       TT as a 2-part Julian Date (Note 1)
5362**
5363**  Returned:
5364**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 2)
5365**
5366**  Notes:
5367**
5368**  1) The TT date date1+date2 is a Julian Date, apportioned in any
5369**     convenient way between the two arguments.  For example,
5370**     JD(TT)=2450123.7 could be expressed in any of these ways,
5371**     among others:
5372**
5373**            date1          date2
5374**
5375**         2450123.7           0.0       (JD method)
5376**         2451545.0       -1421.3       (J2000 method)
5377**         2400000.5       50123.2       (MJD method)
5378**         2450123.5           0.2       (date & time method)
5379**
5380**     The JD method is the most natural and convenient to use in
5381**     cases where the loss of several decimal digits of resolution
5382**     is acceptable.  The J2000 method is best matched to the way
5383**     the argument is handled internally and will deliver the
5384**     optimum resolution.  The MJD method and the date & time methods
5385**     are both good compromises between resolution and convenience.
5386**
5387**  2) The matrix rc2i is the first stage in the transformation from
5388**     celestial to terrestrial coordinates:
5389**
5390**        [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]
5391**
5392**               =  RC2T * [CRS]
5393**
5394**     where [CRS] is a vector in the Geocentric Celestial Reference
5395**     System and [TRS] is a vector in the International Terrestrial
5396**     Reference System (see IERS Conventions 2003), ERA is the Earth
5397**     Rotation Angle and RPOM is the polar motion matrix.
5398**
5399**  Called:
5400**     iauPnm06a    classical NPB matrix, IAU 2006/2000A
5401**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
5402**     iauS06       the CIO locator s, given X,Y, IAU 2006
5403**     iauC2ixys    celestial-to-intermediate matrix, given X,Y and s
5404**
5405**  References:
5406**
5407**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
5408**     IERS Technical Note No. 32, BKG
5409**
5410*/
5411
5412
5413
5414void iauC2ibpn(double date1, double date2, double rbpn[3][3],
5415               double rc2i[3][3])
5416/*
5417**  - - - - - - - - - -
5418**   i a u C 2 i b p n
5419**  - - - - - - - - - -
5420**
5421**  Form the celestial-to-intermediate matrix for a given date given
5422**  the bias-precession-nutation matrix.  IAU 2000.
5423**
5424**  This function is part of the International Astronomical Union's
5425**  SOFA (Standards Of Fundamental Astronomy) software collection.
5426**
5427**  Status:  support function.
5428**
5429**  Given:
5430**     date1,date2 double       TT as a 2-part Julian Date (Note 1)
5431**     rbpn        double[3][3] celestial-to-true matrix (Note 2)
5432**
5433**  Returned:
5434**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 3)
5435**
5436**  Notes:
5437**
5438**  1) The TT date date1+date2 is a Julian Date, apportioned in any
5439**     convenient way between the two arguments.  For example,
5440**     JD(TT)=2450123.7 could be expressed in any of these ways,
5441**     among others:
5442**
5443**            date1          date2
5444**
5445**         2450123.7           0.0       (JD method)
5446**         2451545.0       -1421.3       (J2000 method)
5447**         2400000.5       50123.2       (MJD method)
5448**         2450123.5           0.2       (date & time method)
5449**
5450**     The JD method is the most natural and convenient to use in
5451**     cases where the loss of several decimal digits of resolution
5452**     is acceptable.  The J2000 method is best matched to the way
5453**     the argument is handled internally and will deliver the
5454**     optimum resolution.  The MJD method and the date & time methods
5455**     are both good compromises between resolution and convenience.
5456**
5457**  2) The matrix rbpn transforms vectors from GCRS to true equator (and
5458**     CIO or equinox) of date.  Only the CIP (bottom row) is used.
5459**
5460**  3) The matrix rc2i is the first stage in the transformation from
5461**     celestial to terrestrial coordinates:
5462**
5463**        [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]
5464**
5465**              = RC2T * [CRS]
5466**
5467**     where [CRS] is a vector in the Geocentric Celestial Reference
5468**     System and [TRS] is a vector in the International Terrestrial
5469**     Reference System (see IERS Conventions 2003), ERA is the Earth
5470**     Rotation Angle and RPOM is the polar motion matrix.
5471**
5472**  4) Although its name does not include "00", This function is in fact
5473**     specific to the IAU 2000 models.
5474**
5475**  Called:
5476**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
5477**     iauC2ixy     celestial-to-intermediate matrix, given X,Y
5478**
5479**  References:
5480**     "Expressions for the Celestial Intermediate Pole and Celestial
5481**     Ephemeris Origin consistent with the IAU 2000A precession-
5482**     nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
5483**
5484**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
5485**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
5486**
5487**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5488**     IERS Technical Note No. 32, BKG (2004)
5489**
5490*/
5491
5492
5493
5494void iauC2ixy(double date1, double date2, double x, double y,
5495              double rc2i[3][3])
5496/*
5497**  - - - - - - - - -
5498**   i a u C 2 i x y
5499**  - - - - - - - - -
5500**
5501**  Form the celestial to intermediate-frame-of-date matrix for a given
5502**  date when the CIP X,Y coordinates are known.  IAU 2000.
5503**
5504**  This function is part of the International Astronomical Union's
5505**  SOFA (Standards Of Fundamental Astronomy) software collection.
5506**
5507**  Status:  support function.
5508**
5509**  Given:
5510**     date1,date2 double       TT as a 2-part Julian Date (Note 1)
5511**     x,y         double       Celestial Intermediate Pole (Note 2)
5512**
5513**  Returned:
5514**     rc2i        double[3][3] celestial-to-intermediate matrix (Note 3)
5515**
5516**  Notes:
5517**
5518**  1) The TT date date1+date2 is a Julian Date, apportioned in any
5519**     convenient way between the two arguments.  For example,
5520**     JD(TT)=2450123.7 could be expressed in any of these ways,
5521**     among others:
5522**
5523**            date1          date2
5524**
5525**         2450123.7           0.0       (JD method)
5526**         2451545.0       -1421.3       (J2000 method)
5527**         2400000.5       50123.2       (MJD method)
5528**         2450123.5           0.2       (date & time method)
5529**
5530**     The JD method is the most natural and convenient to use in
5531**     cases where the loss of several decimal digits of resolution
5532**     is acceptable.  The J2000 method is best matched to the way
5533**     the argument is handled internally and will deliver the
5534**     optimum resolution.  The MJD method and the date & time methods
5535**     are both good compromises between resolution and convenience.
5536**
5537**  2) The Celestial Intermediate Pole coordinates are the x,y components
5538**     of the unit vector in the Geocentric Celestial Reference System.
5539**
5540**  3) The matrix rc2i is the first stage in the transformation from
5541**     celestial to terrestrial coordinates:
5542**
5543**        [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]
5544**
5545**              = RC2T * [CRS]
5546**
5547**     where [CRS] is a vector in the Geocentric Celestial Reference
5548**     System and [TRS] is a vector in the International Terrestrial
5549**     Reference System (see IERS Conventions 2003), ERA is the Earth
5550**     Rotation Angle and RPOM is the polar motion matrix.
5551**
5552**  4) Although its name does not include "00", This function is in fact
5553**     specific to the IAU 2000 models.
5554**
5555**  Called:
5556**     iauC2ixys    celestial-to-intermediate matrix, given X,Y and s
5557**     iauS00       the CIO locator s, given X,Y, IAU 2000A
5558**
5559**  Reference:
5560**
5561**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5562**     IERS Technical Note No. 32, BKG (2004)
5563**
5564*/
5565
5566
5567
5568void iauC2ixys(double x, double y, double s, double rc2i[3][3])
5569/*
5570**  - - - - - - - - - -
5571**   i a u C 2 i x y s
5572**  - - - - - - - - - -
5573**
5574**  Form the celestial to intermediate-frame-of-date matrix given the CIP
5575**  X,Y and the CIO locator s.
5576**
5577**  This function is part of the International Astronomical Union's
5578**  SOFA (Standards Of Fundamental Astronomy) software collection.
5579**
5580**  Status:  support function.
5581**
5582**  Given:
5583**     x,y      double         Celestial Intermediate Pole (Note 1)
5584**     s        double         the CIO locator s (Note 2)
5585**
5586**  Returned:
5587**     rc2i     double[3][3]   celestial-to-intermediate matrix (Note 3)
5588**
5589**  Notes:
5590**
5591**  1) The Celestial Intermediate Pole coordinates are the x,y
5592**     components of the unit vector in the Geocentric Celestial
5593**     Reference System.
5594**
5595**  2) The CIO locator s (in radians) positions the Celestial
5596**     Intermediate Origin on the equator of the CIP.
5597**
5598**  3) The matrix rc2i is the first stage in the transformation from
5599**     celestial to terrestrial coordinates:
5600**
5601**        [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]
5602**
5603**              = RC2T * [CRS]
5604**
5605**     where [CRS] is a vector in the Geocentric Celestial Reference
5606**     System and [TRS] is a vector in the International Terrestrial
5607**     Reference System (see IERS Conventions 2003), ERA is the Earth
5608**     Rotation Angle and RPOM is the polar motion matrix.
5609**
5610**  Called:
5611**     iauIr        initialize r-matrix to identity
5612**     iauRz        rotate around Z-axis
5613**     iauRy        rotate around Y-axis
5614**
5615**  Reference:
5616**
5617**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5618**     IERS Technical Note No. 32, BKG (2004)
5619**
5620*/
5621
5622
5623
5624void iauC2s(double p[3], double *theta, double *phi)
5625/*
5626**  - - - - - - -
5627**   i a u C 2 s
5628**  - - - - - - -
5629**
5630**  P-vector to spherical coordinates.
5631**
5632**  This function is part of the International Astronomical Union's
5633**  SOFA (Standards Of Fundamental Astronomy) software collection.
5634**
5635**  Status:  vector/matrix support function.
5636**
5637**  Given:
5638**     p      double[3]    p-vector
5639**
5640**  Returned:
5641**     theta  double       longitude angle (radians)
5642**     phi    double       latitude angle (radians)
5643**
5644**  Notes:
5645**
5646**  1) The vector p can have any magnitude; only its direction is used.
5647**
5648**  2) If p is null, zero theta and phi are returned.
5649**
5650**  3) At either pole, zero theta is returned.
5651**
5652*/
5653
5654
5655
5656void iauC2t00a(double tta, double ttb, double uta, double utb,
5657               double xp, double yp, double rc2t[3][3])
5658/*
5659**  - - - - - - - - - -
5660**   i a u C 2 t 0 0 a
5661**  - - - - - - - - - -
5662**
5663**  Form the celestial to terrestrial matrix given the date, the UT1 and
5664**  the polar motion, using the IAU 2000A precession-nutation model.
5665**
5666**  This function is part of the International Astronomical Union's
5667**  SOFA (Standards Of Fundamental Astronomy) software collection.
5668**
5669**  Status:  support function.
5670**
5671**  Given:
5672**     tta,ttb  double         TT as a 2-part Julian Date (Note 1)
5673**     uta,utb  double         UT1 as a 2-part Julian Date (Note 1)
5674**     xp,yp    double         CIP coordinates (radians, Note 2)
5675**
5676**  Returned:
5677**     rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 3)
5678**
5679**  Notes:
5680**
5681**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
5682**     apportioned in any convenient way between the arguments uta and
5683**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
5684**     these ways, among others:
5685**
5686**             uta            utb
5687**
5688**         2450123.7           0.0       (JD method)
5689**         2451545.0       -1421.3       (J2000 method)
5690**         2400000.5       50123.2       (MJD method)
5691**         2450123.5           0.2       (date & time method)
5692**
5693**     The JD method is the most natural and convenient to use in
5694**     cases where the loss of several decimal digits of resolution is
5695**     acceptable.  The J2000 and MJD methods are good compromises
5696**     between resolution and convenience.  In the case of uta,utb, the
5697**     date & time method is best matched to the Earth rotation angle
5698**     algorithm used:  maximum precision is delivered when the uta
5699**     argument is for 0hrs UT1 on the day in question and the utb
5700**     argument lies in the range 0 to 1, or vice versa.
5701**
5702**  2) The arguments xp and yp are the coordinates (in radians) of the
5703**     Celestial Intermediate Pole with respect to the International
5704**     Terrestrial Reference System (see IERS Conventions 2003),
5705**     measured along the meridians 0 and 90 deg west respectively.
5706**
5707**  3) The matrix rc2t transforms from celestial to terrestrial
5708**     coordinates:
5709**
5710**        [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]
5711**
5712**              = rc2t * [CRS]
5713**
5714**     where [CRS] is a vector in the Geocentric Celestial Reference
5715**     System and [TRS] is a vector in the International Terrestrial
5716**     Reference System (see IERS Conventions 2003), RC2I is the
5717**     celestial-to-intermediate matrix, ERA is the Earth rotation
5718**     angle and RPOM is the polar motion matrix.
5719**
5720**  4) A faster, but slightly less accurate, result (about 1 mas) can
5721**     be obtained by using instead the iauC2t00b function.
5722**
5723**  Called:
5724**     iauC2i00a    celestial-to-intermediate matrix, IAU 2000A
5725**     iauEra00     Earth rotation angle, IAU 2000
5726**     iauSp00      the TIO locator s', IERS 2000
5727**     iauPom00     polar motion matrix
5728**     iauC2tcio    form CIO-based celestial-to-terrestrial matrix
5729**
5730**  Reference:
5731**
5732**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5733**     IERS Technical Note No. 32, BKG (2004)
5734**
5735*/
5736
5737
5738
5739void iauC2t00b(double tta, double ttb, double uta, double utb,
5740               double xp, double yp, double rc2t[3][3])
5741/*
5742**  - - - - - - - - - -
5743**   i a u C 2 t 0 0 b
5744**  - - - - - - - - - -
5745**
5746**  Form the celestial to terrestrial matrix given the date, the UT1 and
5747**  the polar motion, using the IAU 2000B precession-nutation model.
5748**
5749**  This function is part of the International Astronomical Union's
5750**  SOFA (Standards Of Fundamental Astronomy) software collection.
5751**
5752**  Status:  support function.
5753**
5754**  Given:
5755**     tta,ttb  double         TT as a 2-part Julian Date (Note 1)
5756**     uta,utb  double         UT1 as a 2-part Julian Date (Note 1)
5757**     xp,yp    double         coordinates of the pole (radians, Note 2)
5758**
5759**  Returned:
5760**     rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 3)
5761**
5762**  Notes:
5763**
5764**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
5765**     apportioned in any convenient way between the arguments uta and
5766**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
5767**     these ways, among others:
5768**
5769**             uta            utb
5770**
5771**         2450123.7           0.0       (JD method)
5772**         2451545.0       -1421.3       (J2000 method)
5773**         2400000.5       50123.2       (MJD method)
5774**         2450123.5           0.2       (date & time method)
5775**
5776**     The JD method is the most natural and convenient to use in
5777**     cases where the loss of several decimal digits of resolution is
5778**     acceptable.  The J2000 and MJD methods are good compromises
5779**     between resolution and convenience.  In the case of uta,utb, the
5780**     date & time method is best matched to the Earth rotation angle
5781**     algorithm used:  maximum precision is delivered when the uta
5782**     argument is for 0hrs UT1 on the day in question and the utb
5783**     argument lies in the range 0 to 1, or vice versa.
5784**
5785**  2) The arguments xp and yp are the coordinates (in radians) of the
5786**     Celestial Intermediate Pole with respect to the International
5787**     Terrestrial Reference System (see IERS Conventions 2003),
5788**     measured along the meridians 0 and 90 deg west respectively.
5789**
5790**  3) The matrix rc2t transforms from celestial to terrestrial
5791**     coordinates:
5792**
5793**        [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]
5794**
5795**              = rc2t * [CRS]
5796**
5797**     where [CRS] is a vector in the Geocentric Celestial Reference
5798**     System and [TRS] is a vector in the International Terrestrial
5799**     Reference System (see IERS Conventions 2003), RC2I is the
5800**     celestial-to-intermediate matrix, ERA is the Earth rotation
5801**     angle and RPOM is the polar motion matrix.
5802**
5803**  4) The present function is faster, but slightly less accurate (about
5804**     1 mas), than the iauC2t00a function.
5805**
5806**  Called:
5807**     iauC2i00b    celestial-to-intermediate matrix, IAU 2000B
5808**     iauEra00     Earth rotation angle, IAU 2000
5809**     iauPom00     polar motion matrix
5810**     iauC2tcio    form CIO-based celestial-to-terrestrial matrix
5811**
5812**  Reference:
5813**
5814**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5815**     IERS Technical Note No. 32, BKG (2004)
5816**
5817*/
5818
5819
5820
5821void iauC2t06a(double tta, double ttb, double uta, double utb,
5822               double xp, double yp, double rc2t[3][3])
5823/*
5824**  - - - - - - - - - -
5825**   i a u C 2 t 0 6 a
5826**  - - - - - - - - - -
5827**
5828**  Form the celestial to terrestrial matrix given the date, the UT1 and
5829**  the polar motion, using the IAU 2006/2000A precession-nutation
5830**  model.
5831**
5832**  This function is part of the International Astronomical Union's
5833**  SOFA (Standards Of Fundamental Astronomy) software collection.
5834**
5835**  Status:  support function.
5836**
5837**  Given:
5838**     tta,ttb  double         TT as a 2-part Julian Date (Note 1)
5839**     uta,utb  double         UT1 as a 2-part Julian Date (Note 1)
5840**     xp,yp    double         coordinates of the pole (radians, Note 2)
5841**
5842**  Returned:
5843**     rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 3)
5844**
5845**  Notes:
5846**
5847**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
5848**     apportioned in any convenient way between the arguments uta and
5849**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
5850**     these ways, among others:
5851**
5852**             uta            utb
5853**
5854**         2450123.7           0.0       (JD method)
5855**         2451545.0       -1421.3       (J2000 method)
5856**         2400000.5       50123.2       (MJD method)
5857**         2450123.5           0.2       (date & time method)
5858**
5859**     The JD method is the most natural and convenient to use in
5860**     cases where the loss of several decimal digits of resolution is
5861**     acceptable.  The J2000 and MJD methods are good compromises
5862**     between resolution and convenience.  In the case of uta,utb, the
5863**     date & time method is best matched to the Earth rotation angle
5864**     algorithm used:  maximum precision is delivered when the uta
5865**     argument is for 0hrs UT1 on the day in question and the utb
5866**     argument lies in the range 0 to 1, or vice versa.
5867**
5868**  2) The arguments xp and yp are the coordinates (in radians) of the
5869**     Celestial Intermediate Pole with respect to the International
5870**     Terrestrial Reference System (see IERS Conventions 2003),
5871**     measured along the meridians 0 and 90 deg west respectively.
5872**
5873**  3) The matrix rc2t transforms from celestial to terrestrial
5874**     coordinates:
5875**
5876**        [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]
5877**
5878**              = rc2t * [CRS]
5879**
5880**     where [CRS] is a vector in the Geocentric Celestial Reference
5881**     System and [TRS] is a vector in the International Terrestrial
5882**     Reference System (see IERS Conventions 2003), RC2I is the
5883**     celestial-to-intermediate matrix, ERA is the Earth rotation
5884**     angle and RPOM is the polar motion matrix.
5885**
5886**  Called:
5887**     iauC2i06a    celestial-to-intermediate matrix, IAU 2006/2000A
5888**     iauEra00     Earth rotation angle, IAU 2000
5889**     iauSp00      the TIO locator s', IERS 2000
5890**     iauPom00     polar motion matrix
5891**     iauC2tcio    form CIO-based celestial-to-terrestrial matrix
5892**
5893**  Reference:
5894**
5895**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
5896**     IERS Technical Note No. 32, BKG
5897**
5898*/
5899
5900
5901
5902void iauC2tcio(double rc2i[3][3], double era, double rpom[3][3],
5903               double rc2t[3][3])
5904/*
5905**  - - - - - - - - - -
5906**   i a u C 2 t c i o
5907**  - - - - - - - - - -
5908**
5909**  Assemble the celestial to terrestrial matrix from CIO-based
5910**  components (the celestial-to-intermediate matrix, the Earth Rotation
5911**  Angle and the polar motion matrix).
5912**
5913**  This function is part of the International Astronomical Union's
5914**  SOFA (Standards Of Fundamental Astronomy) software collection.
5915**
5916**  Status:  support function.
5917**
5918**  Given:
5919**     rc2i     double[3][3]    celestial-to-intermediate matrix
5920**     era      double          Earth rotation angle (radians)
5921**     rpom     double[3][3]    polar-motion matrix
5922**
5923**  Returned:
5924**     rc2t     double[3][3]    celestial-to-terrestrial matrix
5925**
5926**  Notes:
5927**
5928**  1) This function constructs the rotation matrix that transforms
5929**     vectors in the celestial system into vectors in the terrestrial
5930**     system.  It does so starting from precomputed components, namely
5931**     the matrix which rotates from celestial coordinates to the
5932**     intermediate frame, the Earth rotation angle and the polar motion
5933**     matrix.  One use of the present function is when generating a
5934**     series of celestial-to-terrestrial matrices where only the Earth
5935**     Rotation Angle changes, avoiding the considerable overhead of
5936**     recomputing the precession-nutation more often than necessary to
5937**     achieve given accuracy objectives.
5938**
5939**  2) The relationship between the arguments is as follows:
5940**
5941**        [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]
5942**
5943**              = rc2t * [CRS]
5944**
5945**     where [CRS] is a vector in the Geocentric Celestial Reference
5946**     System and [TRS] is a vector in the International Terrestrial
5947**     Reference System (see IERS Conventions 2003).
5948**
5949**  Called:
5950**     iauCr        copy r-matrix
5951**     iauRz        rotate around Z-axis
5952**     iauRxr       product of two r-matrices
5953**
5954**  Reference:
5955**
5956**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
5957**     IERS Technical Note No. 32, BKG
5958**
5959*/
5960
5961
5962
5963void iauC2teqx(double rbpn[3][3], double gst, double rpom[3][3],
5964               double rc2t[3][3])
5965/*
5966**  - - - - - - - - - -
5967**   i a u C 2 t e q x
5968**  - - - - - - - - - -
5969**
5970**  Assemble the celestial to terrestrial matrix from equinox-based
5971**  components (the celestial-to-true matrix, the Greenwich Apparent
5972**  Sidereal Time and the polar motion matrix).
5973**
5974**  This function is part of the International Astronomical Union's
5975**  SOFA (Standards Of Fundamental Astronomy) software collection.
5976**
5977**  Status:  support function.
5978**
5979**  Given:
5980**     rbpn   double[3][3]  celestial-to-true matrix
5981**     gst    double        Greenwich (apparent) Sidereal Time (radians)
5982**     rpom   double[3][3]  polar-motion matrix
5983**
5984**  Returned:
5985**     rc2t   double[3][3]  celestial-to-terrestrial matrix (Note 2)
5986**
5987**  Notes:
5988**
5989**  1) This function constructs the rotation matrix that transforms
5990**     vectors in the celestial system into vectors in the terrestrial
5991**     system.  It does so starting from precomputed components, namely
5992**     the matrix which rotates from celestial coordinates to the
5993**     true equator and equinox of date, the Greenwich Apparent Sidereal
5994**     Time and the polar motion matrix.  One use of the present function
5995**     is when generating a series of celestial-to-terrestrial matrices
5996**     where only the Sidereal Time changes, avoiding the considerable
5997**     overhead of recomputing the precession-nutation more often than
5998**     necessary to achieve given accuracy objectives.
5999**
6000**  2) The relationship between the arguments is as follows:
6001**
6002**        [TRS] = rpom * R_3(gst) * rbpn * [CRS]
6003**
6004**              = rc2t * [CRS]
6005**
6006**     where [CRS] is a vector in the Geocentric Celestial Reference
6007**     System and [TRS] is a vector in the International Terrestrial
6008**     Reference System (see IERS Conventions 2003).
6009**
6010**  Called:
6011**     iauCr        copy r-matrix
6012**     iauRz        rotate around Z-axis
6013**     iauRxr       product of two r-matrices
6014**
6015**  Reference:
6016**
6017**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6018**     IERS Technical Note No. 32, BKG (2004)
6019**
6020*/
6021
6022
6023
6024void iauC2tpe(double tta, double ttb, double uta, double utb,
6025              double dpsi, double deps, double xp, double yp,
6026              double rc2t[3][3])
6027/*
6028**  - - - - - - - - -
6029**   i a u C 2 t p e
6030**  - - - - - - - - -
6031**
6032**  Form the celestial to terrestrial matrix given the date, the UT1,
6033**  the nutation and the polar motion.  IAU 2000.
6034**
6035**  This function is part of the International Astronomical Union's
6036**  SOFA (Standards Of Fundamental Astronomy) software collection.
6037**
6038**  Status:  support function.
6039**
6040**  Given:
6041**     tta,ttb    double        TT as a 2-part Julian Date (Note 1)
6042**     uta,utb    double        UT1 as a 2-part Julian Date (Note 1)
6043**     dpsi,deps  double        nutation (Note 2)
6044**     xp,yp      double        coordinates of the pole (radians, Note 3)
6045**
6046**  Returned:
6047**     rc2t       double[3][3]  celestial-to-terrestrial matrix (Note 4)
6048**
6049**  Notes:
6050**
6051**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
6052**     apportioned in any convenient way between the arguments uta and
6053**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
6054**     these ways, among others:
6055**
6056**             uta            utb
6057**
6058**         2450123.7           0.0       (JD method)
6059**         2451545.0       -1421.3       (J2000 method)
6060**         2400000.5       50123.2       (MJD method)
6061**         2450123.5           0.2       (date & time method)
6062**
6063**     The JD method is the most natural and convenient to use in
6064**     cases where the loss of several decimal digits of resolution is
6065**     acceptable.  The J2000 and MJD methods are good compromises
6066**     between resolution and convenience.  In the case of uta,utb, the
6067**     date & time method is best matched to the Earth rotation angle
6068**     algorithm used:  maximum precision is delivered when the uta
6069**     argument is for 0hrs UT1 on the day in question and the utb
6070**     argument lies in the range 0 to 1, or vice versa.
6071**
6072**  2) The caller is responsible for providing the nutation components;
6073**     they are in longitude and obliquity, in radians and are with
6074**     respect to the equinox and ecliptic of date.  For high-accuracy
6075**     applications, free core nutation should be included as well as
6076**     any other relevant corrections to the position of the CIP.
6077**
6078**  3) The arguments xp and yp are the coordinates (in radians) of the
6079**     Celestial Intermediate Pole with respect to the International
6080**     Terrestrial Reference System (see IERS Conventions 2003),
6081**     measured along the meridians 0 and 90 deg west respectively.
6082**
6083**  4) The matrix rc2t transforms from celestial to terrestrial
6084**     coordinates:
6085**
6086**        [TRS] = RPOM * R_3(GST) * RBPN * [CRS]
6087**
6088**              = rc2t * [CRS]
6089**
6090**     where [CRS] is a vector in the Geocentric Celestial Reference
6091**     System and [TRS] is a vector in the International Terrestrial
6092**     Reference System (see IERS Conventions 2003), RBPN is the
6093**     bias-precession-nutation matrix, GST is the Greenwich (apparent)
6094**     Sidereal Time and RPOM is the polar motion matrix.
6095**
6096**  5) Although its name does not include "00", This function is in fact
6097**     specific to the IAU 2000 models.
6098**
6099**  Called:
6100**     iauPn00      bias/precession/nutation results, IAU 2000
6101**     iauGmst00    Greenwich mean sidereal time, IAU 2000
6102**     iauSp00      the TIO locator s', IERS 2000
6103**     iauEe00      equation of the equinoxes, IAU 2000
6104**     iauPom00     polar motion matrix
6105**     iauC2teqx    form equinox-based celestial-to-terrestrial matrix
6106**
6107**  Reference:
6108**
6109**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6110**     IERS Technical Note No. 32, BKG (2004)
6111**
6112*/
6113
6114
6115
6116void iauC2txy(double tta, double ttb, double uta, double utb,
6117              double x, double y, double xp, double yp,
6118              double rc2t[3][3])
6119/*
6120**  - - - - - - - - -
6121**   i a u C 2 t x y
6122**  - - - - - - - - -
6123**
6124**  Form the celestial to terrestrial matrix given the date, the UT1,
6125**  the CIP coordinates and the polar motion.  IAU 2000.
6126**
6127**  This function is part of the International Astronomical Union's
6128**  SOFA (Standards Of Fundamental Astronomy) software collection.
6129**
6130**  Status:  support function.
6131**
6132**  Given:
6133**     tta,ttb  double         TT as a 2-part Julian Date (Note 1)
6134**     uta,utb  double         UT1 as a 2-part Julian Date (Note 1)
6135**     x,y      double         Celestial Intermediate Pole (Note 2)
6136**     xp,yp    double         coordinates of the pole (radians, Note 3)
6137**
6138**  Returned:
6139**     rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 4)
6140**
6141**  Notes:
6142**
6143**  1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
6144**     apportioned in any convenient way between the arguments uta and
6145**     utb.  For example, JD(UT1)=2450123.7 could be expressed in any o
6146**     these ways, among others:
6147**
6148**             uta            utb
6149**
6150**         2450123.7           0.0       (JD method)
6151**         2451545.0       -1421.3       (J2000 method)
6152**         2400000.5       50123.2       (MJD method)
6153**         2450123.5           0.2       (date & time method)
6154**
6155**     The JD method is the most natural and convenient to use in
6156**     cases where the loss of several decimal digits of resolution is
6157**     acceptable.  The J2000 and MJD methods are good compromises
6158**     between resolution and convenience.  In the case of uta,utb, the
6159**     date & time method is best matched to the Earth rotation angle
6160**     algorithm used:  maximum precision is delivered when the uta
6161**     argument is for 0hrs UT1 on the day in question and the utb
6162**     argument lies in the range 0 to 1, or vice versa.
6163**
6164**  2) The Celestial Intermediate Pole coordinates are the x,y
6165**     components of the unit vector in the Geocentric Celestial
6166**     Reference System.
6167**
6168**  3) The arguments xp and yp are the coordinates (in radians) of the
6169**     Celestial Intermediate Pole with respect to the International
6170**     Terrestrial Reference System (see IERS Conventions 2003),
6171**     measured along the meridians 0 and 90 deg west respectively.
6172**
6173**  4) The matrix rc2t transforms from celestial to terrestrial
6174**     coordinates:
6175**
6176**        [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]
6177**
6178**              = rc2t * [CRS]
6179**
6180**     where [CRS] is a vector in the Geocentric Celestial Reference
6181**     System and [TRS] is a vector in the International Terrestrial
6182**     Reference System (see IERS Conventions 2003), ERA is the Earth
6183**     Rotation Angle and RPOM is the polar motion matrix.
6184**
6185**  5) Although its name does not include "00", This function is in fact
6186**     specific to the IAU 2000 models.
6187**
6188**  Called:
6189**     iauC2ixy     celestial-to-intermediate matrix, given X,Y
6190**     iauEra00     Earth rotation angle, IAU 2000
6191**     iauSp00      the TIO locator s', IERS 2000
6192**     iauPom00     polar motion matrix
6193**     iauC2tcio    form CIO-based celestial-to-terrestrial matrix
6194**
6195** Reference:
6196**
6197**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6198**     IERS Technical Note No. 32, BKG (2004)
6199**
6200*/
6201
6202
6203
6204int iauCal2jd(int iy, int im, int id, double *djm0, double *djm)
6205/*
6206**  - - - - - - - - - -
6207**   i a u C a l 2 j d
6208**  - - - - - - - - - -
6209**
6210**  Gregorian Calendar to Julian Date.
6211**
6212**  This function is part of the International Astronomical Union's
6213**  SOFA (Standards Of Fundamental Astronomy) software collection.
6214**
6215**  Status:  support function.
6216**
6217**  Given:
6218**     iy,im,id  int     year, month, day in Gregorian calendar (Note 1)
6219**
6220**  Returned:
6221**     djm0      double  MJD zero-point: always 2400000.5
6222**     djm       double  Modified Julian Date for 0 hrs
6223**
6224**  Returned (function value):
6225**               int     status:
6226**                           0 = OK
6227**                          -1 = bad year   (Note 3: JD not computed)
6228**                          -2 = bad month  (JD not computed)
6229**                          -3 = bad day    (JD computed)
6230**
6231**  Notes:
6232**
6233**  1) The algorithm used is valid from -4800 March 1, but this
6234**     implementation rejects dates before -4799 January 1.
6235**
6236**  2) The Julian Date is returned in two pieces, in the usual SOFA
6237**     manner, which is designed to preserve time resolution.  The
6238**     Julian Date is available as a single number by adding djm0 and
6239**     djm.
6240**
6241**  3) In early eras the conversion is from the "Proleptic Gregorian
6242**     Calendar";  no account is taken of the date(s) of adoption of
6243**     the Gregorian Calendar, nor is the AD/BC numbering convention
6244**     observed.
6245**
6246**  Reference:
6247**
6248**     Explanatory Supplement to the Astronomical Almanac,
6249**     P. Kenneth Seidelmann (ed), University Science Books (1992),
6250**     Section 12.92 (p604).
6251**
6252*/
6253
6254
6255
6256void iauCp(double p[3], double c[3])
6257/*
6258**  - - - - - -
6259**   i a u C p
6260**  - - - - - -
6261**
6262**  Copy a p-vector.
6263**
6264**  This function is part of the International Astronomical Union's
6265**  SOFA (Standards Of Fundamental Astronomy) software collection.
6266**
6267**  Status:  vector/matrix support function.
6268**
6269**  Given:
6270**     p        double[3]     p-vector to be copied
6271**
6272**  Returned:
6273**     c        double[3]     copy
6274**
6275*/
6276
6277
6278
6279void iauCpv(double pv[2][3], double c[2][3])
6280/*
6281**  - - - - - - -
6282**   i a u C p v
6283**  - - - - - - -
6284**
6285**  Copy a position/velocity vector.
6286**
6287**  This function is part of the International Astronomical Union's
6288**  SOFA (Standards Of Fundamental Astronomy) software collection.
6289**
6290**  Status:  vector/matrix support function.
6291**
6292**  Given:
6293**     pv     double[2][3]    position/velocity vector to be copied
6294**
6295**  Returned:
6296**     c      double[2][3]    copy
6297**
6298**  Called:
6299**     iauCp        copy p-vector
6300**
6301*/
6302
6303
6304
6305void iauCr(double r[3][3], double c[3][3])
6306/*
6307**  - - - - - -
6308**   i a u C r
6309**  - - - - - -
6310**
6311**  Copy an r-matrix.
6312**
6313**  This function is part of the International Astronomical Union's
6314**  SOFA (Standards Of Fundamental Astronomy) software collection.
6315**
6316**  Status:  vector/matrix support function.
6317**
6318**  Given:
6319**     r        double[3][3]    r-matrix to be copied
6320**
6321**  Returned:
6322**     c        double[3][3]    copy
6323**
6324**  Called:
6325**     iauCp        copy p-vector
6326**
6327*/
6328
6329
6330
6331int iauD2dtf(const char *scale, int ndp, double d1, double d2,
6332             int *iy, int *im, int *id, int ihmsf[4])
6333/*
6334**  - - - - - - - - -
6335**   i a u D 2 d t f
6336**  - - - - - - - - -
6337**
6338**  Format for output a 2-part Julian Date (or in the case of UTC a
6339**  quasi-JD form that includes special provision for leap seconds).
6340**
6341**  This function is part of the International Astronomical Union's
6342**  SOFA (Standards of Fundamental Astronomy) software collection.
6343**
6344**  Status:  support function.
6345**
6346**  Given:
6347**     scale     char[]  time scale ID (Note 1)
6348**     ndp       int     resolution (Note 2)
6349**     d1,d2     double  time as a 2-part Julian Date (Notes 3,4)
6350**
6351**  Returned:
6352**     iy,im,id  int     year, month, day in Gregorian calendar (Note 5)
6353**     ihmsf     int[4]  hours, minutes, seconds, fraction (Note 1)
6354**
6355**  Returned (function value):
6356**               int     status: +1 = dubious year (Note 5)
6357**                                0 = OK
6358**                               -1 = unacceptable date (Note 6)
6359**
6360**  Notes:
6361**
6362**  1) scale identifies the time scale.  Only the value "UTC" (in upper
6363**     case) is significant, and enables handling of leap seconds (see
6364**     Note 4).
6365**
6366**  2) ndp is the number of decimal places in the seconds field, and can
6367**     have negative as well as positive values, such as:
6368**
6369**     ndp         resolution
6370**     -4            1 00 00
6371**     -3            0 10 00
6372**     -2            0 01 00
6373**     -1            0 00 10
6374**      0            0 00 01
6375**      1            0 00 00.1
6376**      2            0 00 00.01
6377**      3            0 00 00.001
6378**
6379**     The limits are platform dependent, but a safe range is -5 to +9.
6380**
6381**  3) d1+d2 is Julian Date, apportioned in any convenient way between
6382**     the two arguments, for example where d1 is the Julian Day Number
6383**     and d2 is the fraction of a day.  In the case of UTC, where the
6384**     use of JD is problematical, special conventions apply:  see the
6385**     next note.
6386**
6387**  4) JD cannot unambiguously represent UTC during a leap second unless
6388**     special measures are taken.  The SOFA internal convention is that
6389**     the quasi-JD day represents UTC days whether the length is 86399,
6390**     86400 or 86401 SI seconds.  In the 1960-1972 era there were
6391**     smaller jumps (in either direction) each time the linear UTC(TAI)
6392**     expression was changed, and these "mini-leaps" are also included
6393**     in the SOFA convention.
6394**
6395**  5) The warning status "dubious year" flags UTCs that predate the
6396**     introduction of the time scale or that are too far in the future
6397**     to be trusted.  See iauDat for further details.
6398**
6399**  6) For calendar conventions and limitations, see iauCal2jd.
6400**
6401**  Called:
6402**     iauJd2cal    JD to Gregorian calendar
6403**     iauD2tf      decompose days to hms
6404**     iauDat       delta(AT) = TAI-UTC
6405**
6406*/
6407
6408
6409
6410void iauD2tf(int ndp, double days, char *sign, int ihmsf[4])
6411/*
6412**  - - - - - - - -
6413**   i a u D 2 t f
6414**  - - - - - - - -
6415**
6416**  Decompose days to hours, minutes, seconds, fraction.
6417**
6418**  This function is part of the International Astronomical Union's
6419**  SOFA (Standards Of Fundamental Astronomy) software collection.
6420**
6421**  Status:  vector/matrix support function.
6422**
6423**  Given:
6424**     ndp     int     resolution (Note 1)
6425**     days    double  interval in days
6426**
6427**  Returned:
6428**     sign    char*   '+' or '-'
6429**     ihmsf   int[4]  hours, minutes, seconds, fraction
6430**
6431**  Notes:
6432**
6433**  1) The argument ndp is interpreted as follows:
6434**
6435**     ndp         resolution
6436**      :      ...0000 00 00
6437**     -7         1000 00 00
6438**     -6          100 00 00
6439**     -5           10 00 00
6440**     -4            1 00 00
6441**     -3            0 10 00
6442**     -2            0 01 00
6443**     -1            0 00 10
6444**      0            0 00 01
6445**      1            0 00 00.1
6446**      2            0 00 00.01
6447**      3            0 00 00.001
6448**      :            0 00 00.000...
6449**
6450**  2) The largest positive useful value for ndp is determined by the
6451**     size of days, the format of double on the target platform, and
6452**     the risk of overflowing ihmsf[3].  On a typical platform, for
6453**     days up to 1.0, the available floating-point precision might
6454**     correspond to ndp=12.  However, the practical limit is typically
6455**     ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is
6456**     only 16 bits.
6457**
6458**  3) The absolute value of days may exceed 1.0.  In cases where it
6459**     does not, it is up to the caller to test for and handle the
6460**     case where days is very nearly 1.0 and rounds up to 24 hours,
6461**     by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
6462**
6463*/
6464
6465
6466
6467int iauDat(int iy, int im, int id, double fd, double *deltat)
6468/*
6469**  - - - - - - -
6470**   i a u D a t
6471**  - - - - - - -
6472**
6473**  For a given UTC date, calculate Delta(AT) = TAI-UTC.
6474**
6475**     :------------------------------------------:
6476**     :                                          :
6477**     :                 IMPORTANT                :
6478**     :                                          :
6479**     :  A new version of this function must be  :
6480**     :  produced whenever a new leap second is  :
6481**     :  announced.  There are four items to     :
6482**     :  change on each such occasion:           :
6483**     :                                          :
6484**     :  1) A new line must be added to the set  :
6485**     :     of statements that initialize the    :
6486**     :     array "changes".                     :
6487**     :                                          :
6488**     :  2) The constant IYV must be set to the  :
6489**     :     current year.                        :
6490**     :                                          :
6491**     :  3) The "Latest leap second" comment     :
6492**     :     below must be set to the new leap    :
6493**     :     second date.                         :
6494**     :                                          :
6495**     :  4) The "This revision" comment, later,  :
6496**     :     must be set to the current date.     :
6497**     :                                          :
6498**     :  Change (2) must also be carried out     :
6499**     :  whenever the function is re-issued,     :
6500**     :  even if no leap seconds have been       :
6501**     :  added.                                  :
6502**     :                                          :
6503**     :  Latest leap second:  2016 December 31   :
6504**     :                                          :
6505**     :__________________________________________:
6506**
6507**  This function is part of the International Astronomical Union's
6508**  SOFA (Standards Of Fundamental Astronomy) software collection.
6509**
6510**  Status:  user-replaceable support function.
6511**
6512**  Given:
6513**     iy     int      UTC:  year (Notes 1 and 2)
6514**     im     int            month (Note 2)
6515**     id     int            day (Notes 2 and 3)
6516**     fd     double         fraction of day (Note 4)
6517**
6518**  Returned:
6519**     deltat double   TAI minus UTC, seconds
6520**
6521**  Returned (function value):
6522**            int      status (Note 5):
6523**                       1 = dubious year (Note 1)
6524**                       0 = OK
6525**                      -1 = bad year
6526**                      -2 = bad month
6527**                      -3 = bad day (Note 3)
6528**                      -4 = bad fraction (Note 4)
6529**                      -5 = internal error (Note 5)
6530**
6531**  Notes:
6532**
6533**  1) UTC began at 1960 January 1.0 (JD 2436934.5) and it is improper
6534**     to call the function with an earlier date.  If this is attempted,
6535**     zero is returned together with a warning status.
6536**
6537**     Because leap seconds cannot, in principle, be predicted in
6538**     advance, a reliable check for dates beyond the valid range is
6539**     impossible.  To guard against gross errors, a year five or more
6540**     after the release year of the present function (see the constant
6541**     IYV) is considered dubious.  In this case a warning status is
6542**     returned but the result is computed in the normal way.
6543**
6544**     For both too-early and too-late years, the warning status is +1.
6545**     This is distinct from the error status -1, which signifies a year
6546**     so early that JD could not be computed.
6547**
6548**  2) If the specified date is for a day which ends with a leap second,
6549**     the TAI-UTC value returned is for the period leading up to the
6550**     leap second.  If the date is for a day which begins as a leap
6551**     second ends, the TAI-UTC returned is for the period following the
6552**     leap second.
6553**
6554**  3) The day number must be in the normal calendar range, for example
6555**     1 through 30 for April.  The "almanac" convention of allowing
6556**     such dates as January 0 and December 32 is not supported in this
6557**     function, in order to avoid confusion near leap seconds.
6558**
6559**  4) The fraction of day is used only for dates before the
6560**     introduction of leap seconds, the first of which occurred at the
6561**     end of 1971.  It is tested for validity (0 to 1 is the valid
6562**     range) even if not used;  if invalid, zero is used and status -4
6563**     is returned.  For many applications, setting fd to zero is
6564**     acceptable;  the resulting error is always less than 3 ms (and
6565**     occurs only pre-1972).
6566**
6567**  5) The status value returned in the case where there are multiple
6568**     errors refers to the first error detected.  For example, if the
6569**     month and day are 13 and 32 respectively, status -2 (bad month)
6570**     will be returned.  The "internal error" status refers to a
6571**     case that is impossible but causes some compilers to issue a
6572**     warning.
6573**
6574**  6) In cases where a valid result is not available, zero is returned.
6575**
6576**  References:
6577**
6578**  1) For dates from 1961 January 1 onwards, the expressions from the
6579**     file ftp://maia.usno.navy.mil/ser7/tai-utc.dat are used.
6580**
6581**  2) The 5ms timestep at 1961 January 1 is taken from 2.58.1 (p87) of
6582**     the 1992 Explanatory Supplement.
6583**
6584**  Called:
6585**     iauCal2jd    Gregorian calendar to JD
6586**
6587*/
6588
6589
6590
6591double iauDtdb(double date1, double date2,
6592               double ut, double elong, double u, double v)
6593/*
6594**  - - - - - - - -
6595**   i a u D t d b
6596**  - - - - - - - -
6597**
6598**  An approximation to TDB-TT, the difference between barycentric
6599**  dynamical time and terrestrial time, for an observer on the Earth.
6600**
6601**  The different time scales - proper, coordinate and realized - are
6602**  related to each other:
6603**
6604**            TAI             <-  physically realized
6605**             :
6606**          offset            <-  observed (nominally +32.184s)
6607**             :
6608**            TT              <-  terrestrial time
6609**             :
6610**    rate adjustment (L_G)   <-  definition of TT
6611**             :
6612**            TCG             <-  time scale for GCRS
6613**             :
6614**      "periodic" terms      <-  iauDtdb  is an implementation
6615**             :
6616**    rate adjustment (L_C)   <-  function of solar-system ephemeris
6617**             :
6618**            TCB             <-  time scale for BCRS
6619**             :
6620**    rate adjustment (-L_B)  <-  definition of TDB
6621**             :
6622**            TDB             <-  TCB scaled to track TT
6623**             :
6624**      "periodic" terms      <-  -iauDtdb is an approximation
6625**             :
6626**            TT              <-  terrestrial time
6627**
6628**  Adopted values for the various constants can be found in the IERS
6629**  Conventions (McCarthy & Petit 2003).
6630**
6631**  This function is part of the International Astronomical Union's
6632**  SOFA (Standards Of Fundamental Astronomy) software collection.
6633**
6634**  Status:  support function.
6635**
6636**  Given:
6637**     date1,date2   double  date, TDB (Notes 1-3)
6638**     ut            double  universal time (UT1, fraction of one day)
6639**     elong         double  longitude (east positive, radians)
6640**     u             double  distance from Earth spin axis (km)
6641**     v             double  distance north of equatorial plane (km)
6642**
6643**  Returned (function value):
6644**                   double  TDB-TT (seconds)
6645**
6646**  Notes:
6647**
6648**  1) The date date1+date2 is a Julian Date, apportioned in any
6649**     convenient way between the two arguments.  For example,
6650**     JD(TT)=2450123.7 could be expressed in any of these ways,
6651**     among others:
6652**
6653**            date1          date2
6654**
6655**         2450123.7           0.0       (JD method)
6656**         2451545.0       -1421.3       (J2000 method)
6657**         2400000.5       50123.2       (MJD method)
6658**         2450123.5           0.2       (date & time method)
6659**
6660**     The JD method is the most natural and convenient to use in
6661**     cases where the loss of several decimal digits of resolution
6662**     is acceptable.  The J2000 method is best matched to the way
6663**     the argument is handled internally and will deliver the
6664**     optimum resolution.  The MJD method and the date & time methods
6665**     are both good compromises between resolution and convenience.
6666**
6667**     Although the date is, formally, barycentric dynamical time (TDB),
6668**     the terrestrial dynamical time (TT) can be used with no practical
6669**     effect on the accuracy of the prediction.
6670**
6671**  2) TT can be regarded as a coordinate time that is realized as an
6672**     offset of 32.184s from International Atomic Time, TAI.  TT is a
6673**     specific linear transformation of geocentric coordinate time TCG,
6674**     which is the time scale for the Geocentric Celestial Reference
6675**     System, GCRS.
6676**
6677**  3) TDB is a coordinate time, and is a specific linear transformation
6678**     of barycentric coordinate time TCB, which is the time scale for
6679**     the Barycentric Celestial Reference System, BCRS.
6680**
6681**  4) The difference TCG-TCB depends on the masses and positions of the
6682**     bodies of the solar system and the velocity of the Earth.  It is
6683**     dominated by a rate difference, the residual being of a periodic
6684**     character.  The latter, which is modeled by the present function,
6685**     comprises a main (annual) sinusoidal term of amplitude
6686**     approximately 0.00166 seconds, plus planetary terms up to about
6687**     20 microseconds, and lunar and diurnal terms up to 2 microseconds.
6688**     These effects come from the changing transverse Doppler effect
6689**     and gravitational red-shift as the observer (on the Earth's
6690**     surface) experiences variations in speed (with respect to the
6691**     BCRS) and gravitational potential.
6692**
6693**  5) TDB can be regarded as the same as TCB but with a rate adjustment
6694**     to keep it close to TT, which is convenient for many applications.
6695**     The history of successive attempts to define TDB is set out in
6696**     Resolution 3 adopted by the IAU General Assembly in 2006, which
6697**     defines a fixed TDB(TCB) transformation that is consistent with
6698**     contemporary solar-system ephemerides.  Future ephemerides will
6699**     imply slightly changed transformations between TCG and TCB, which
6700**     could introduce a linear drift between TDB and TT;  however, any
6701**     such drift is unlikely to exceed 1 nanosecond per century.
6702**
6703**  6) The geocentric TDB-TT model used in the present function is that of
6704**     Fairhead & Bretagnon (1990), in its full form.  It was originally
6705**     supplied by Fairhead (private communications with P.T.Wallace,
6706**     1990) as a Fortran subroutine.  The present C function contains an
6707**     adaptation of the Fairhead code.  The numerical results are
6708**     essentially unaffected by the changes, the differences with
6709**     respect to the Fairhead & Bretagnon original being at the 1e-20 s
6710**     level.
6711**
6712**     The topocentric part of the model is from Moyer (1981) and
6713**     Murray (1983), with fundamental arguments adapted from
6714**     Simon et al. 1994.  It is an approximation to the expression
6715**     ( v / c ) . ( r / c ), where v is the barycentric velocity of
6716**     the Earth, r is the geocentric position of the observer and
6717**     c is the speed of light.
6718**
6719**     By supplying zeroes for u and v, the topocentric part of the
6720**     model can be nullified, and the function will return the Fairhead
6721**     & Bretagnon result alone.
6722**
6723**  7) During the interval 1950-2050, the absolute accuracy is better
6724**     than +/- 3 nanoseconds relative to time ephemerides obtained by
6725**     direct numerical integrations based on the JPL DE405 solar system
6726**     ephemeris.
6727**
6728**  8) It must be stressed that the present function is merely a model,
6729**     and that numerical integration of solar-system ephemerides is the
6730**     definitive method for predicting the relationship between TCG and
6731**     TCB and hence between TT and TDB.
6732**
6733**  References:
6734**
6735**     Fairhead, L., & Bretagnon, P., Astron.Astrophys., 229, 240-247
6736**     (1990).
6737**
6738**     IAU 2006 Resolution 3.
6739**
6740**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6741**     IERS Technical Note No. 32, BKG (2004)
6742**
6743**     Moyer, T.D., Cel.Mech., 23, 33 (1981).
6744**
6745**     Murray, C.A., Vectorial Astrometry, Adam Hilger (1983).
6746**
6747**     Seidelmann, P.K. et al., Explanatory Supplement to the
6748**     Astronomical Almanac, Chapter 2, University Science Books (1992).
6749**
6750**     Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
6751**     Francou, G. & Laskar, J., Astron.Astrophys., 282, 663-683 (1994).
6752**
6753*/
6754
6755
6756
6757int iauDtf2d(const char *scale, int iy, int im, int id,
6758             int ihr, int imn, double sec, double *d1, double *d2)
6759/*
6760**  - - - - - - - - -
6761**   i a u D t f 2 d
6762**  - - - - - - - - -
6763**
6764**  Encode date and time fields into 2-part Julian Date (or in the case
6765**  of UTC a quasi-JD form that includes special provision for leap
6766**  seconds).
6767**
6768**  This function is part of the International Astronomical Union's
6769**  SOFA (Standards of Fundamental Astronomy) software collection.
6770**
6771**  Status:  support function.
6772**
6773**  Given:
6774**     scale     char[]  time scale ID (Note 1)
6775**     iy,im,id  int     year, month, day in Gregorian calendar (Note 2)
6776**     ihr,imn   int     hour, minute
6777**     sec       double  seconds
6778**
6779**  Returned:
6780**     d1,d2     double  2-part Julian Date (Notes 3,4)
6781**
6782**  Returned (function value):
6783**               int     status: +3 = both of next two
6784**                               +2 = time is after end of day (Note 5)
6785**                               +1 = dubious year (Note 6)
6786**                                0 = OK
6787**                               -1 = bad year
6788**                               -2 = bad month
6789**                               -3 = bad day
6790**                               -4 = bad hour
6791**                               -5 = bad minute
6792**                               -6 = bad second (<0)
6793**
6794**  Notes:
6795**
6796**  1) scale identifies the time scale.  Only the value "UTC" (in upper
6797**     case) is significant, and enables handling of leap seconds (see
6798**     Note 4).
6799**
6800**  2) For calendar conventions and limitations, see iauCal2jd.
6801**
6802**  3) The sum of the results, d1+d2, is Julian Date, where normally d1
6803**     is the Julian Day Number and d2 is the fraction of a day.  In the
6804**     case of UTC, where the use of JD is problematical, special
6805**     conventions apply:  see the next note.
6806**
6807**  4) JD cannot unambiguously represent UTC during a leap second unless
6808**     special measures are taken.  The SOFA internal convention is that
6809**     the quasi-JD day represents UTC days whether the length is 86399,
6810**     86400 or 86401 SI seconds.  In the 1960-1972 era there were
6811**     smaller jumps (in either direction) each time the linear UTC(TAI)
6812**     expression was changed, and these "mini-leaps" are also included
6813**     in the SOFA convention.
6814**
6815**  5) The warning status "time is after end of day" usually means that
6816**     the sec argument is greater than 60.0.  However, in a day ending
6817**     in a leap second the limit changes to 61.0 (or 59.0 in the case
6818**     of a negative leap second).
6819**
6820**  6) The warning status "dubious year" flags UTCs that predate the
6821**     introduction of the time scale or that are too far in the future
6822**     to be trusted.  See iauDat for further details.
6823**
6824**  7) Only in the case of continuous and regular time scales (TAI, TT,
6825**     TCG, TCB and TDB) is the result d1+d2 a Julian Date, strictly
6826**     speaking.  In the other cases (UT1 and UTC) the result must be
6827**     used with circumspection;  in particular the difference between
6828**     two such results cannot be interpreted as a precise time
6829**     interval.
6830**
6831**  Called:
6832**     iauCal2jd    Gregorian calendar to JD
6833**     iauDat       delta(AT) = TAI-UTC
6834**     iauJd2cal    JD to Gregorian calendar
6835**
6836*/
6837
6838
6839
6840void iauEceq06(double date1, double date2, double dl, double db,
6841               double *dr, double *dd)
6842/*
6843**  - - - - - - - - - -
6844**   i a u E c e q 0 6
6845**  - - - - - - - - - -
6846**
6847**  Transformation from ecliptic coordinates (mean equinox and ecliptic
6848**  of date) to ICRS RA,Dec, using the IAU 2006 precession model.
6849**
6850**  This function is part of the International Astronomical Union's
6851**  SOFA (Standards of Fundamental Astronomy) software collection.
6852**
6853**  Status:  support function.
6854**
6855**  Given:
6856**     date1,date2 double TT as a 2-part Julian date (Note 1)
6857**     dl,db       double ecliptic longitude and latitude (radians)
6858**
6859**  Returned:
6860**     dr,dd       double ICRS right ascension and declination (radians)
6861**
6862**  1) The TT date date1+date2 is a Julian Date, apportioned in any
6863**     convenient way between the two arguments.  For example,
6864**     JD(TT)=2450123.7 could be expressed in any of these ways,
6865**     among others:
6866**
6867**            date1          date2
6868**
6869**         2450123.7           0.0       (JD method)
6870**         2451545.0       -1421.3       (J2000 method)
6871**         2400000.5       50123.2       (MJD method)
6872**         2450123.5           0.2       (date & time method)
6873**
6874**     The JD method is the most natural and convenient to use in
6875**     cases where the loss of several decimal digits of resolution
6876**     is acceptable.  The J2000 method is best matched to the way
6877**     the argument is handled internally and will deliver the
6878**     optimum resolution.  The MJD method and the date & time methods
6879**     are both good compromises between resolution and convenience.
6880**
6881**  2) No assumptions are made about whether the coordinates represent
6882**     starlight and embody astrometric effects such as parallax or
6883**     aberration.
6884**
6885**  3) The transformation is approximately that from ecliptic longitude
6886**     and latitude (mean equinox and ecliptic of date) to mean J2000.0
6887**     right ascension and declination, with only frame bias (always
6888**     less than 25 mas) to disturb this classical picture.
6889**
6890**  Called:
6891**     iauS2c       spherical coordinates to unit vector
6892**     iauEcm06     J2000.0 to ecliptic rotation matrix, IAU 2006
6893**     iauTrxp      product of transpose of r-matrix and p-vector
6894**     iauC2s       unit vector to spherical coordinates
6895**     iauAnp       normalize angle into range 0 to 2pi
6896**     iauAnpm      normalize angle into range +/- pi
6897**
6898*/
6899
6900
6901
6902void iauEcm06(double date1, double date2, double rm[3][3])
6903/*
6904**  - - - - - - - - -
6905**   i a u E c m 0 6
6906**  - - - - - - - - -
6907**
6908**  ICRS equatorial to ecliptic rotation matrix, IAU 2006.
6909**
6910**  This function is part of the International Astronomical Union's
6911**  SOFA (Standards of Fundamental Astronomy) software collection.
6912**
6913**  Status:  support function.
6914**
6915**  Given:
6916**     date1,date2  double         TT as a 2-part Julian date (Note 1)
6917**
6918**  Returned:
6919**     rm           double[3][3]   ICRS to ecliptic rotation matrix
6920**
6921**  Notes:
6922**
6923**  1) The TT date date1+date2 is a Julian Date, apportioned in any
6924**     convenient way between the two arguments.  For example,
6925**     JD(TT)=2450123.7 could be expressed in any of these ways,
6926**     among others:
6927**
6928**            date1          date2
6929**
6930**         2450123.7           0.0       (JD method)
6931**         2451545.0       -1421.3       (J2000 method)
6932**         2400000.5       50123.2       (MJD method)
6933**         2450123.5           0.2       (date & time method)
6934**
6935**     The JD method is the most natural and convenient to use in
6936**     cases where the loss of several decimal digits of resolution
6937**     is acceptable.  The J2000 method is best matched to the way
6938**     the argument is handled internally and will deliver the
6939**     optimum resolution.  The MJD method and the date & time methods
6940**     are both good compromises between resolution and convenience.
6941**
6942**  1) The matrix is in the sense
6943**
6944**        E_ep = rm x P_ICRS,
6945**
6946**     where P_ICRS is a vector with respect to ICRS right ascension
6947**     and declination axes and E_ep is the same vector with respect to
6948**     the (inertial) ecliptic and equinox of date.
6949**
6950**  2) P_ICRS is a free vector, merely a direction, typically of unit
6951**     magnitude, and not bound to any particular spatial origin, such
6952**     as the Earth, Sun or SSB.  No assumptions are made about whether
6953**     it represents starlight and embodies astrometric effects such as
6954**     parallax or aberration.  The transformation is approximately that
6955**     between mean J2000.0 right ascension and declination and ecliptic
6956**     longitude and latitude, with only frame bias (always less than
6957**     25 mas) to disturb this classical picture.
6958**
6959**  Called:
6960**     iauObl06     mean obliquity, IAU 2006
6961**     iauPmat06    PB matrix, IAU 2006
6962**     iauIr        initialize r-matrix to identity
6963**     iauRx        rotate around X-axis
6964**     iauRxr       product of two r-matrices
6965**
6966*/
6967
6968
6969
6970double iauEe00(double date1, double date2, double epsa, double dpsi)
6971/*
6972**  - - - - - - - -
6973**   i a u E e 0 0
6974**  - - - - - - - -
6975**
6976**  The equation of the equinoxes, compatible with IAU 2000 resolutions,
6977**  given the nutation in longitude and the mean obliquity.
6978**
6979**  This function is part of the International Astronomical Union's
6980**  SOFA (Standards Of Fundamental Astronomy) software collection.
6981**
6982**  Status:  canonical model.
6983**
6984**  Given:
6985**     date1,date2  double    TT as a 2-part Julian Date (Note 1)
6986**     epsa         double    mean obliquity (Note 2)
6987**     dpsi         double    nutation in longitude (Note 3)
6988**
6989**  Returned (function value):
6990**                  double    equation of the equinoxes (Note 4)
6991**
6992**  Notes:
6993**
6994**  1) The TT date date1+date2 is a Julian Date, apportioned in any
6995**     convenient way between the two arguments.  For example,
6996**     JD(TT)=2450123.7 could be expressed in any of these ways,
6997**     among others:
6998**
6999**            date1          date2
7000**
7001**         2450123.7           0.0       (JD method)
7002**         2451545.0       -1421.3       (J2000 method)
7003**         2400000.5       50123.2       (MJD method)
7004**         2450123.5           0.2       (date & time method)
7005**
7006**     The JD method is the most natural and convenient to use in
7007**     cases where the loss of several decimal digits of resolution
7008**     is acceptable.  The J2000 method is best matched to the way
7009**     the argument is handled internally and will deliver the
7010**     optimum resolution.  The MJD method and the date & time methods
7011**     are both good compromises between resolution and convenience.
7012**
7013**  2) The obliquity, in radians, is mean of date.
7014**
7015**  3) The result, which is in radians, operates in the following sense:
7016**
7017**        Greenwich apparent ST = GMST + equation of the equinoxes
7018**
7019**  4) The result is compatible with the IAU 2000 resolutions.  For
7020**     further details, see IERS Conventions 2003 and Capitaine et al.
7021**     (2002).
7022**
7023**  Called:
7024**     iauEect00    equation of the equinoxes complementary terms
7025**
7026**  References:
7027**
7028**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
7029**     implement the IAU 2000 definition of UT1", Astronomy &
7030**     Astrophysics, 406, 1135-1149 (2003)
7031**
7032**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7033**     IERS Technical Note No. 32, BKG (2004)
7034**
7035*/
7036
7037
7038
7039double iauEe00a(double date1, double date2)
7040/*
7041**  - - - - - - - - -
7042**   i a u E e 0 0 a
7043**  - - - - - - - - -
7044**
7045**  Equation of the equinoxes, compatible with IAU 2000 resolutions.
7046**
7047**  This function is part of the International Astronomical Union's
7048**  SOFA (Standards Of Fundamental Astronomy) software collection.
7049**
7050**  Status:  support function.
7051**
7052**  Given:
7053**     date1,date2  double    TT as a 2-part Julian Date (Note 1)
7054**
7055**  Returned (function value):
7056**                  double    equation of the equinoxes (Note 2)
7057**
7058**  Notes:
7059**
7060**  1) The TT date date1+date2 is a Julian Date, apportioned in any
7061**     convenient way between the two arguments.  For example,
7062**     JD(TT)=2450123.7 could be expressed in any of these ways,
7063**     among others:
7064**
7065**            date1          date2
7066**
7067**         2450123.7           0.0       (JD method)
7068**         2451545.0       -1421.3       (J2000 method)
7069**         2400000.5       50123.2       (MJD method)
7070**         2450123.5           0.2       (date & time method)
7071**
7072**     The JD method is the most natural and convenient to use in
7073**     cases where the loss of several decimal digits of resolution
7074**     is acceptable.  The J2000 method is best matched to the way
7075**     the argument is handled internally and will deliver the
7076**     optimum resolution.  The MJD method and the date & time methods
7077**     are both good compromises between resolution and convenience.
7078**
7079**  2) The result, which is in radians, operates in the following sense:
7080**
7081**        Greenwich apparent ST = GMST + equation of the equinoxes
7082**
7083**  3) The result is compatible with the IAU 2000 resolutions.  For
7084**     further details, see IERS Conventions 2003 and Capitaine et al.
7085**     (2002).
7086**
7087**  Called:
7088**     iauPr00      IAU 2000 precession adjustments
7089**     iauObl80     mean obliquity, IAU 1980
7090**     iauNut00a    nutation, IAU 2000A
7091**     iauEe00      equation of the equinoxes, IAU 2000
7092**
7093**  References:
7094**
7095**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
7096**     implement the IAU 2000 definition of UT1", Astronomy &
7097**     Astrophysics, 406, 1135-1149 (2003).
7098**
7099**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7100**     IERS Technical Note No. 32, BKG (2004).
7101**
7102*/
7103
7104
7105
7106double iauEe00b(double date1, double date2)
7107/*
7108**  - - - - - - - - -
7109**   i a u E e 0 0 b
7110**  - - - - - - - - -
7111**
7112**  Equation of the equinoxes, compatible with IAU 2000 resolutions but
7113**  using the truncated nutation model IAU 2000B.
7114**
7115**  This function is part of the International Astronomical Union's
7116**  SOFA (Standards Of Fundamental Astronomy) software collection.
7117**
7118**  Status:  support function.
7119**
7120**  Given:
7121**     date1,date2  double    TT as a 2-part Julian Date (Note 1)
7122**
7123**  Returned (function value):
7124**                  double    equation of the equinoxes (Note 2)
7125**
7126**  Notes:
7127**
7128**  1) The TT date date1+date2 is a Julian Date, apportioned in any
7129**     convenient way between the two arguments.  For example,
7130**     JD(TT)=2450123.7 could be expressed in any of these ways,
7131**     among others:
7132**
7133**            date1          date2
7134**
7135**         2450123.7           0.0       (JD method)
7136**         2451545.0       -1421.3       (J2000 method)
7137**         2400000.5       50123.2       (MJD method)
7138**         2450123.5           0.2       (date & time method)
7139**
7140**     The JD method is the most natural and convenient to use in
7141**     cases where the loss of several decimal digits of resolution
7142**     is acceptable.  The J2000 method is best matched to the way
7143**     the argument is handled internally and will deliver the
7144**     optimum resolution.  The MJD method and the date & time methods
7145**     are both good compromises between resolution and convenience.
7146**
7147**  2) The result, which is in radians, operates in the following sense:
7148**
7149**        Greenwich apparent ST = GMST + equation of the equinoxes
7150**
7151**  3) The result is compatible with the IAU 2000 resolutions except
7152**     that accuracy has been compromised (1 mas) for the sake of speed.
7153**     For further details, see McCarthy & Luzum (2003), IERS
7154**     Conventions 2003 and Capitaine et al. (2003).
7155**
7156**  Called:
7157**     iauPr00      IAU 2000 precession adjustments
7158**     iauObl80     mean obliquity, IAU 1980
7159**     iauNut00b    nutation, IAU 2000B
7160**     iauEe00      equation of the equinoxes, IAU 2000
7161**
7162**  References:
7163**
7164**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
7165**     implement the IAU 2000 definition of UT1", Astronomy &
7166**     Astrophysics, 406, 1135-1149 (2003)
7167**
7168**     McCarthy, D.D. & Luzum, B.J., "An abridged model of the
7169**     precession-nutation of the celestial pole", Celestial Mechanics &
7170**     Dynamical Astronomy, 85, 37-49 (2003)
7171**
7172**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7173**     IERS Technical Note No. 32, BKG (2004)
7174**
7175*/
7176
7177
7178
7179double iauEe06a(double date1, double date2)
7180/*
7181**  - - - - - - - - -
7182**   i a u E e 0 6 a
7183**  - - - - - - - - -
7184**
7185**  Equation of the equinoxes, compatible with IAU 2000 resolutions and
7186**  IAU 2006/2000A precession-nutation.
7187**
7188**  This function is part of the International Astronomical Union's
7189**  SOFA (Standards Of Fundamental Astronomy) software collection.
7190**
7191**  Status:  support function.
7192**
7193**  Given:
7194**     date1,date2  double    TT as a 2-part Julian Date (Note 1)
7195**
7196**  Returned (function value):
7197**                  double    equation of the equinoxes (Note 2)
7198**
7199**  Notes:
7200**
7201**  1) The TT date date1+date2 is a Julian Date, apportioned in any
7202**     convenient way between the two arguments.  For example,
7203**     JD(TT)=2450123.7 could be expressed in any of these ways,
7204**     among others:
7205**
7206**            date1          date2
7207**
7208**         2450123.7           0.0       (JD method)
7209**         2451545.0       -1421.3       (J2000 method)
7210**         2400000.5       50123.2       (MJD method)
7211**         2450123.5           0.2       (date & time method)
7212**
7213**     The JD method is the most natural and convenient to use in
7214**     cases where the loss of several decimal digits of resolution
7215**     is acceptable.  The J2000 method is best matched to the way
7216**     the argument is handled internally and will deliver the
7217**     optimum resolution.  The MJD method and the date & time methods
7218**     are both good compromises between resolution and convenience.
7219**
7220**  2) The result, which is in radians, operates in the following sense:
7221**
7222**        Greenwich apparent ST = GMST + equation of the equinoxes
7223**
7224**  Called:
7225**     iauAnpm      normalize angle into range +/- pi
7226**     iauGst06a    Greenwich apparent sidereal time, IAU 2006/2000A
7227**     iauGmst06    Greenwich mean sidereal time, IAU 2006
7228**
7229**  Reference:
7230**
7231**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
7232**     IERS Technical Note No. 32, BKG
7233**
7234*/
7235
7236
7237
7238double iauEect00(double date1, double date2)
7239/*
7240**  - - - - - - - - - -
7241**   i a u E e c t 0 0
7242**  - - - - - - - - - -
7243**
7244**  Equation of the equinoxes complementary terms, consistent with
7245**  IAU 2000 resolutions.
7246**
7247**  This function is part of the International Astronomical Union's
7248**  SOFA (Standards Of Fundamental Astronomy) software collection.
7249**
7250**  Status:  canonical model.
7251**
7252**  Given:
7253**     date1,date2  double   TT as a 2-part Julian Date (Note 1)
7254**
7255**  Returned (function value):
7256**                  double   complementary terms (Note 2)
7257**
7258**  Notes:
7259**
7260**  1) The TT date date1+date2 is a Julian Date, apportioned in any
7261**     convenient way between the two arguments.  For example,
7262**     JD(TT)=2450123.7 could be expressed in any of these ways,
7263**     among others:
7264**
7265**            date1          date2
7266**
7267**         2450123.7           0.0       (JD method)
7268**         2451545.0       -1421.3       (J2000 method)
7269**         2400000.5       50123.2       (MJD method)
7270**         2450123.5           0.2       (date & time method)
7271**
7272**     The JD method is the most natural and convenient to use in
7273**     cases where the loss of several decimal digits of resolution
7274**     is acceptable.  The J2000 method is best matched to the way
7275**     the argument is handled internally and will deliver the
7276**     optimum resolution.  The MJD method and the date & time methods
7277**     are both good compromises between resolution and convenience.
7278**
7279**  2) The "complementary terms" are part of the equation of the
7280**     equinoxes (EE), classically the difference between apparent and
7281**     mean Sidereal Time:
7282**
7283**        GAST = GMST + EE
7284**
7285**     with:
7286**
7287**        EE = dpsi * cos(eps)
7288**
7289**     where dpsi is the nutation in longitude and eps is the obliquity
7290**     of date.  However, if the rotation of the Earth were constant in
7291**     an inertial frame the classical formulation would lead to
7292**     apparent irregularities in the UT1 timescale traceable to side-
7293**     effects of precession-nutation.  In order to eliminate these
7294**     effects from UT1, "complementary terms" were introduced in 1994
7295**     (IAU, 1994) and took effect from 1997 (Capitaine and Gontier,
7296**     1993):
7297**
7298**        GAST = GMST + CT + EE
7299**
7300**     By convention, the complementary terms are included as part of
7301**     the equation of the equinoxes rather than as part of the mean
7302**     Sidereal Time.  This slightly compromises the "geometrical"
7303**     interpretation of mean sidereal time but is otherwise
7304**     inconsequential.
7305**
7306**     The present function computes CT in the above expression,
7307**     compatible with IAU 2000 resolutions (Capitaine et al., 2002, and
7308**     IERS Conventions 2003).
7309**
7310**  Called:
7311**     iauFal03     mean anomaly of the Moon
7312**     iauFalp03    mean anomaly of the Sun
7313**     iauFaf03     mean argument of the latitude of the Moon
7314**     iauFad03     mean elongation of the Moon from the Sun
7315**     iauFaom03    mean longitude of the Moon's ascending node
7316**     iauFave03    mean longitude of Venus
7317**     iauFae03     mean longitude of Earth
7318**     iauFapa03    general accumulated precession in longitude
7319**
7320**  References:
7321**
7322**     Capitaine, N. & Gontier, A.-M., Astron.Astrophys., 275,
7323**     645-650 (1993)
7324**
7325**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
7326**     implement the IAU 2000 definition of UT1", Astron.Astrophys., 406,
7327**     1135-1149 (2003)
7328**
7329**     IAU Resolution C7, Recommendation 3 (1994)
7330**
7331**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7332**     IERS Technical Note No. 32, BKG (2004)
7333**
7334*/
7335
7336
7337
7338int iauEform ( int n, double *a, double *f )
7339/*
7340**  - - - - - - - - -
7341**   i a u E f o r m
7342**  - - - - - - - - -
7343**
7344**  Earth reference ellipsoids.
7345**
7346**  This function is part of the International Astronomical Union's
7347**  SOFA (Standards of Fundamental Astronomy) software collection.
7348**
7349**  Status:  canonical.
7350**
7351**  Given:
7352**     n    int         ellipsoid identifier (Note 1)
7353**
7354**  Returned:
7355**     a    double      equatorial radius (meters, Note 2)
7356**     f    double      flattening (Note 2)
7357**
7358**  Returned (function value):
7359**          int         status:  0 = OK
7360**                              -1 = illegal identifier (Note 3)
7361**
7362**  Notes:
7363**
7364**  1) The identifier n is a number that specifies the choice of
7365**     reference ellipsoid.  The following are supported:
7366**
7367**        n    ellipsoid
7368**
7369**        1     WGS84
7370**        2     GRS80
7371**        3     WGS72
7372**
7373**     The n value has no significance outside the SOFA software.  For
7374**     convenience, symbols WGS84 etc. are defined in sofam.h.
7375**
7376**  2) The ellipsoid parameters are returned in the form of equatorial
7377**     radius in meters (a) and flattening (f).  The latter is a number
7378**     around 0.00335, i.e. around 1/298.
7379**
7380**  3) For the case where an unsupported n value is supplied, zero a and
7381**     f are returned, as well as error status.
7382**
7383**  References:
7384**
7385**     Department of Defense World Geodetic System 1984, National
7386**     Imagery and Mapping Agency Technical Report 8350.2, Third
7387**     Edition, p3-2.
7388**
7389**     Moritz, H., Bull. Geodesique 66-2, 187 (1992).
7390**
7391**     The Department of Defense World Geodetic System 1972, World
7392**     Geodetic System Committee, May 1974.
7393**
7394**     Explanatory Supplement to the Astronomical Almanac,
7395**     P. Kenneth Seidelmann (ed), University Science Books (1992),
7396**     p220.
7397**
7398*/
7399
7400
7401
7402double iauEo06a(double date1, double date2)
7403/*
7404**  - - - - - - - - -
7405**   i a u E o 0 6 a
7406**  - - - - - - - - -
7407**
7408**  Equation of the origins, IAU 2006 precession and IAU 2000A nutation.
7409**
7410**  This function is part of the International Astronomical Union's
7411**  SOFA (Standards Of Fundamental Astronomy) software collection.
7412**
7413**  Status:  support function.
7414**
7415**  Given:
7416**     date1,date2  double    TT as a 2-part Julian Date (Note 1)
7417**
7418**  Returned (function value):
7419**                  double    the equation of the origins in radians
7420**
7421**  Notes:
7422**
7423**  1) The TT date date1+date2 is a Julian Date, apportioned in any
7424**     convenient way between the two arguments.  For example,
7425**     JD(TT)=2450123.7 could be expressed in any of these ways,
7426**     among others:
7427**
7428**            date1          date2
7429**
7430**         2450123.7           0.0       (JD method)
7431**         2451545.0       -1421.3       (J2000 method)
7432**         2400000.5       50123.2       (MJD method)
7433**         2450123.5           0.2       (date & time method)
7434**
7435**     The JD method is the most natural and convenient to use in
7436**     cases where the loss of several decimal digits of resolution
7437**     is acceptable.  The J2000 method is best matched to the way
7438**     the argument is handled internally and will deliver the
7439**     optimum resolution.  The MJD method and the date & time methods
7440**     are both good compromises between resolution and convenience.
7441**
7442**  2) The equation of the origins is the distance between the true
7443**     equinox and the celestial intermediate origin and, equivalently,
7444**     the difference between Earth rotation angle and Greenwich
7445**     apparent sidereal time (ERA-GST).  It comprises the precession
7446**     (since J2000.0) in right ascension plus the equation of the
7447**     equinoxes (including the small correction terms).
7448**
7449**  Called:
7450**     iauPnm06a    classical NPB matrix, IAU 2006/2000A
7451**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
7452**     iauS06       the CIO locator s, given X,Y, IAU 2006
7453**     iauEors      equation of the origins, given NPB matrix and s
7454**
7455**  References:
7456**
7457**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
7458**
7459**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
7460**
7461*/
7462
7463
7464
7465double iauEors(double rnpb[3][3], double s)
7466/*
7467**  - - - - - - - -
7468**   i a u E o r s
7469**  - - - - - - - -
7470**
7471**  Equation of the origins, given the classical NPB matrix and the
7472**  quantity s.
7473**
7474**  This function is part of the International Astronomical Union's
7475**  SOFA (Standards Of Fundamental Astronomy) software collection.
7476**
7477**  Status:  support function.
7478**
7479**  Given:
7480**     rnpb  double[3][3]  classical nutation x precession x bias matrix
7481**     s     double        the quantity s (the CIO locator) in radians
7482**
7483**  Returned (function value):
7484**           double        the equation of the origins in radians
7485**
7486**  Notes:
7487**
7488**  1)  The equation of the origins is the distance between the true
7489**      equinox and the celestial intermediate origin and, equivalently,
7490**      the difference between Earth rotation angle and Greenwich
7491**      apparent sidereal time (ERA-GST).  It comprises the precession
7492**      (since J2000.0) in right ascension plus the equation of the
7493**      equinoxes (including the small correction terms).
7494**
7495**  2)  The algorithm is from Wallace & Capitaine (2006).
7496**
7497** References:
7498**
7499**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
7500**
7501**     Wallace, P. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
7502**
7503*/
7504
7505
7506
7507double iauEpb(double dj1, double dj2)
7508/*
7509**  - - - - - - -
7510**   i a u E p b
7511**  - - - - - - -
7512**
7513**  Julian Date to Besselian Epoch.
7514**
7515**  This function is part of the International Astronomical Union's
7516**  SOFA (Standards Of Fundamental Astronomy) software collection.
7517**
7518**  Status:  support function.
7519**
7520**  Given:
7521**     dj1,dj2    double     Julian Date (see note)
7522**
7523**  Returned (function value):
7524**                double     Besselian Epoch.
7525**
7526**  Note:
7527**
7528**     The Julian Date is supplied in two pieces, in the usual SOFA
7529**     manner, which is designed to preserve time resolution.  The
7530**     Julian Date is available as a single number by adding dj1 and
7531**     dj2.  The maximum resolution is achieved if dj1 is 2451545.0
7532**     (J2000.0).
7533**
7534**  Reference:
7535**
7536**     Lieske, J.H., 1979. Astron.Astrophys., 73, 282.
7537**
7538*/
7539
7540
7541
7542void iauEpb2jd(double epb, double *djm0, double *djm)
7543/*
7544**  - - - - - - - - - -
7545**   i a u E p b 2 j d
7546**  - - - - - - - - - -
7547**
7548**  Besselian Epoch to Julian Date.
7549**
7550**  This function is part of the International Astronomical Union's
7551**  SOFA (Standards Of Fundamental Astronomy) software collection.
7552**
7553**  Status:  support function.
7554**
7555**  Given:
7556**     epb      double    Besselian Epoch (e.g. 1957.3)
7557**
7558**  Returned:
7559**     djm0     double    MJD zero-point: always 2400000.5
7560**     djm      double    Modified Julian Date
7561**
7562**  Note:
7563**
7564**     The Julian Date is returned in two pieces, in the usual SOFA
7565**     manner, which is designed to preserve time resolution.  The
7566**     Julian Date is available as a single number by adding djm0 and
7567**     djm.
7568**
7569**  Reference:
7570**
7571**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
7572**
7573*/
7574
7575
7576
7577double iauEpj(double dj1, double dj2)
7578/*
7579**  - - - - - - -
7580**   i a u E p j
7581**  - - - - - - -
7582**
7583**  Julian Date to Julian Epoch.
7584**
7585**  This function is part of the International Astronomical Union's
7586**  SOFA (Standards Of Fundamental Astronomy) software collection.
7587**
7588**  Status:  support function.
7589**
7590**  Given:
7591**     dj1,dj2    double     Julian Date (see note)
7592**
7593**  Returned (function value):
7594**                double     Julian Epoch
7595**
7596**  Note:
7597**
7598**     The Julian Date is supplied in two pieces, in the usual SOFA
7599**     manner, which is designed to preserve time resolution.  The
7600**     Julian Date is available as a single number by adding dj1 and
7601**     dj2.  The maximum resolution is achieved if dj1 is 2451545.0
7602**     (J2000.0).
7603**
7604**  Reference:
7605**
7606**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
7607**
7608*/
7609
7610
7611
7612void iauEpj2jd(double epj, double *djm0, double *djm)
7613/*
7614**  - - - - - - - - - -
7615**   i a u E p j 2 j d
7616**  - - - - - - - - - -
7617**
7618**  Julian Epoch to Julian Date.
7619**
7620**  This function is part of the International Astronomical Union's
7621**  SOFA (Standards Of Fundamental Astronomy) software collection.
7622**
7623**  Status:  support function.
7624**
7625**  Given:
7626**     epj      double    Julian Epoch (e.g. 1996.8)
7627**
7628**  Returned:
7629**     djm0     double    MJD zero-point: always 2400000.5
7630**     djm      double    Modified Julian Date
7631**
7632**  Note:
7633**
7634**     The Julian Date is returned in two pieces, in the usual SOFA
7635**     manner, which is designed to preserve time resolution.  The
7636**     Julian Date is available as a single number by adding djm0 and
7637**     djm.
7638**
7639**  Reference:
7640**
7641**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
7642**
7643*/
7644
7645
7646
7647int iauEpv00(double date1, double date2,
7648             double pvh[2][3], double pvb[2][3])
7649/*
7650**  - - - - - - - - -
7651**   i a u E p v 0 0
7652**  - - - - - - - - -
7653**
7654**  Earth position and velocity, heliocentric and barycentric, with
7655**  respect to the Barycentric Celestial Reference System.
7656**
7657**  This function is part of the International Astronomical Union's
7658**  SOFA (Standards Of Fundamental Astronomy) software collection.
7659**
7660**  Status:  support function.
7661**
7662**  Given:
7663**     date1,date2  double        TDB date (Note 1)
7664**
7665**  Returned:
7666**     pvh          double[2][3]  heliocentric Earth position/velocity
7667**     pvb          double[2][3]  barycentric Earth position/velocity
7668**
7669**  Returned (function value):
7670**                  int           status: 0 = OK
7671**                                       +1 = warning: date outside
7672**                                            the range 1900-2100 AD
7673**
7674**  Notes:
7675**
7676**  1) The TDB date date1+date2 is a Julian Date, apportioned in any
7677**     convenient way between the two arguments.  For example,
7678**     JD(TDB)=2450123.7 could be expressed in any of these ways, among
7679**     others:
7680**
7681**            date1          date2
7682**
7683**         2450123.7           0.0       (JD method)
7684**         2451545.0       -1421.3       (J2000 method)
7685**         2400000.5       50123.2       (MJD method)
7686**         2450123.5           0.2       (date & time method)
7687**
7688**     The JD method is the most natural and convenient to use in cases
7689**     where the loss of several decimal digits of resolution is
7690**     acceptable.  The J2000 method is best matched to the way the
7691**     argument is handled internally and will deliver the optimum
7692**     resolution.  The MJD method and the date & time methods are both
7693**     good compromises between resolution and convenience.  However,
7694**     the accuracy of the result is more likely to be limited by the
7695**     algorithm itself than the way the date has been expressed.
7696**
7697**     n.b. TT can be used instead of TDB in most applications.
7698**
7699**  2) On return, the arrays pvh and pvb contain the following:
7700**
7701**        pvh[0][0]  x       }
7702**        pvh[0][1]  y       } heliocentric position, au
7703**        pvh[0][2]  z       }
7704**
7705**        pvh[1][0]  xdot    }
7706**        pvh[1][1]  ydot    } heliocentric velocity, au/d
7707**        pvh[1][2]  zdot    }
7708**
7709**        pvb[0][0]  x       }
7710**        pvb[0][1]  y       } barycentric position, au
7711**        pvb[0][2]  z       }
7712**
7713**        pvb[1][0]  xdot    }
7714**        pvb[1][1]  ydot    } barycentric velocity, au/d
7715**        pvb[1][2]  zdot    }
7716**
7717**     The vectors are with respect to the Barycentric Celestial
7718**     Reference System.  The time unit is one day in TDB.
7719**
7720**  3) The function is a SIMPLIFIED SOLUTION from the planetary theory
7721**     VSOP2000 (X. Moisson, P. Bretagnon, 2001, Celes. Mechanics &
7722**     Dyn. Astron., 80, 3/4, 205-213) and is an adaptation of original
7723**     Fortran code supplied by P. Bretagnon (private comm., 2000).
7724**
7725**  4) Comparisons over the time span 1900-2100 with this simplified
7726**     solution and the JPL DE405 ephemeris give the following results:
7727**
7728**                                RMS    max
7729**           Heliocentric:
7730**              position error    3.7   11.2   km
7731**              velocity error    1.4    5.0   mm/s
7732**
7733**           Barycentric:
7734**              position error    4.6   13.4   km
7735**              velocity error    1.4    4.9   mm/s
7736**
7737**     Comparisons with the JPL DE406 ephemeris show that by 1800 and
7738**     2200 the position errors are approximately double their 1900-2100
7739**     size.  By 1500 and 2500 the deterioration is a factor of 10 and
7740**     by 1000 and 3000 a factor of 60.  The velocity accuracy falls off
7741**     at about half that rate.
7742**
7743**  5) It is permissible to use the same array for pvh and pvb, which
7744**     will receive the barycentric values.
7745**
7746*/
7747
7748
7749
7750void iauEqec06(double date1, double date2, double dr, double dd,
7751               double *dl, double *db)
7752/*
7753**  - - - - - - - - - -
7754**   i a u E q e c 0 6
7755**  - - - - - - - - - -
7756**
7757**  Transformation from ICRS equatorial coordinates to ecliptic
7758**  coordinates (mean equinox and ecliptic of date) using IAU 2006
7759**  precession model.
7760**
7761**  This function is part of the International Astronomical Union's
7762**  SOFA (Standards of Fundamental Astronomy) software collection.
7763**
7764**  Status:  support function.
7765**
7766**  Given:
7767**     date1,date2 double TT as a 2-part Julian date (Note 1)
7768**     dr,dd       double ICRS right ascension and declination (radians)
7769**
7770**  Returned:
7771**     dl,db       double ecliptic longitude and latitude (radians)
7772**
7773**  1) The TT date date1+date2 is a Julian Date, apportioned in any
7774**     convenient way between the two arguments.  For example,
7775**     JD(TT)=2450123.7 could be expressed in any of these ways,
7776**     among others:
7777**
7778**            date1          date2
7779**
7780**         2450123.7           0.0       (JD method)
7781**         2451545.0       -1421.3       (J2000 method)
7782**         2400000.5       50123.2       (MJD method)
7783**         2450123.5           0.2       (date & time method)
7784**
7785**     The JD method is the most natural and convenient to use in
7786**     cases where the loss of several decimal digits of resolution
7787**     is acceptable.  The J2000 method is best matched to the way
7788**     the argument is handled internally and will deliver the
7789**     optimum resolution.  The MJD method and the date & time methods
7790**     are both good compromises between resolution and convenience.
7791**
7792**  2) No assumptions are made about whether the coordinates represent
7793**     starlight and embody astrometric effects such as parallax or
7794**     aberration.
7795**
7796**  3) The transformation is approximately that from mean J2000.0 right
7797**     ascension and declination to ecliptic longitude and latitude
7798**     (mean equinox and ecliptic of date), with only frame bias (always
7799**     less than 25 mas) to disturb this classical picture.
7800**
7801**  Called:
7802**     iauS2c       spherical coordinates to unit vector
7803**     iauEcm06     J2000.0 to ecliptic rotation matrix, IAU 2006
7804**     iauRxp       product of r-matrix and p-vector
7805**     iauC2s       unit vector to spherical coordinates
7806**     iauAnp       normalize angle into range 0 to 2pi
7807**     iauAnpm      normalize angle into range +/- pi
7808**
7809*/
7810
7811
7812
7813double iauEqeq94(double date1, double date2)
7814/*
7815**  - - - - - - - - - -
7816**   i a u E q e q 9 4
7817**  - - - - - - - - - -
7818**
7819**  Equation of the equinoxes, IAU 1994 model.
7820**
7821**  This function is part of the International Astronomical Union's
7822**  SOFA (Standards Of Fundamental Astronomy) software collection.
7823**
7824**  Status:  canonical model.
7825**
7826**  Given:
7827**     date1,date2   double     TDB date (Note 1)
7828**
7829**  Returned (function value):
7830**                   double     equation of the equinoxes (Note 2)
7831**
7832**  Notes:
7833**
7834**  1) The date date1+date2 is a Julian Date, apportioned in any
7835**     convenient way between the two arguments.  For example,
7836**     JD(TT)=2450123.7 could be expressed in any of these ways,
7837**     among others:
7838**
7839**            date1          date2
7840**
7841**         2450123.7           0.0       (JD method)
7842**         2451545.0       -1421.3       (J2000 method)
7843**         2400000.5       50123.2       (MJD method)
7844**         2450123.5           0.2       (date & time method)
7845**
7846**     The JD method is the most natural and convenient to use in
7847**     cases where the loss of several decimal digits of resolution
7848**     is acceptable.  The J2000 method is best matched to the way
7849**     the argument is handled internally and will deliver the
7850**     optimum resolution.  The MJD method and the date & time methods
7851**     are both good compromises between resolution and convenience.
7852**
7853**  2) The result, which is in radians, operates in the following sense:
7854**
7855**        Greenwich apparent ST = GMST + equation of the equinoxes
7856**
7857**  Called:
7858**     iauAnpm      normalize angle into range +/- pi
7859**     iauNut80     nutation, IAU 1980
7860**     iauObl80     mean obliquity, IAU 1980
7861**
7862**  References:
7863**
7864**     IAU Resolution C7, Recommendation 3 (1994).
7865**
7866**     Capitaine, N. & Gontier, A.-M., 1993, Astron.Astrophys., 275,
7867**     645-650.
7868**
7869*/
7870
7871
7872
7873double iauEra00(double dj1, double dj2)
7874/*
7875**  - - - - - - - - -
7876**   i a u E r a 0 0
7877**  - - - - - - - - -
7878**
7879**  Earth rotation angle (IAU 2000 model).
7880**
7881**  This function is part of the International Astronomical Union's
7882**  SOFA (Standards Of Fundamental Astronomy) software collection.
7883**
7884**  Status:  canonical model.
7885**
7886**  Given:
7887**     dj1,dj2   double    UT1 as a 2-part Julian Date (see note)
7888**
7889**  Returned (function value):
7890**               double    Earth rotation angle (radians), range 0-2pi
7891**
7892**  Notes:
7893**
7894**  1) The UT1 date dj1+dj2 is a Julian Date, apportioned in any
7895**     convenient way between the arguments dj1 and dj2.  For example,
7896**     JD(UT1)=2450123.7 could be expressed in any of these ways,
7897**     among others:
7898**
7899**             dj1            dj2
7900**
7901**         2450123.7           0.0       (JD method)
7902**         2451545.0       -1421.3       (J2000 method)
7903**         2400000.5       50123.2       (MJD method)
7904**         2450123.5           0.2       (date & time method)
7905**
7906**     The JD method is the most natural and convenient to use in
7907**     cases where the loss of several decimal digits of resolution
7908**     is acceptable.  The J2000 and MJD methods are good compromises
7909**     between resolution and convenience.  The date & time method is
7910**     best matched to the algorithm used:  maximum precision is
7911**     delivered when the dj1 argument is for 0hrs UT1 on the day in
7912**     question and the dj2 argument lies in the range 0 to 1, or vice
7913**     versa.
7914**
7915**  2) The algorithm is adapted from Expression 22 of Capitaine et al.
7916**     2000.  The time argument has been expressed in days directly,
7917**     and, to retain precision, integer contributions have been
7918**     eliminated.  The same formulation is given in IERS Conventions
7919**     (2003), Chap. 5, Eq. 14.
7920**
7921**  Called:
7922**     iauAnp       normalize angle into range 0 to 2pi
7923**
7924**  References:
7925**
7926**     Capitaine N., Guinot B. and McCarthy D.D, 2000, Astron.
7927**     Astrophys., 355, 398-405.
7928**
7929**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7930**     IERS Technical Note No. 32, BKG (2004)
7931**
7932*/
7933
7934
7935
7936double iauFad03(double t)
7937/*
7938**  - - - - - - - - -
7939**   i a u F a d 0 3
7940**  - - - - - - - - -
7941**
7942**  Fundamental argument, IERS Conventions (2003):
7943**  mean elongation of the Moon from the Sun.
7944**
7945**  This function is part of the International Astronomical Union's
7946**  SOFA (Standards Of Fundamental Astronomy) software collection.
7947**
7948**  Status:  canonical model.
7949**
7950**  Given:
7951**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
7952**
7953**  Returned (function value):
7954**           double    D, radians (Note 2)
7955**
7956**  Notes:
7957**
7958**  1) Though t is strictly TDB, it is usually more convenient to use
7959**     TT, which makes no significant difference.
7960**
7961**  2) The expression used is as adopted in IERS Conventions (2003) and
7962**     is from Simon et al. (1994).
7963**
7964**  References:
7965**
7966**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7967**     IERS Technical Note No. 32, BKG (2004)
7968**
7969**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
7970**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
7971**
7972*/
7973
7974
7975
7976double iauFae03(double t)
7977/*
7978**  - - - - - - - - -
7979**   i a u F a e 0 3
7980**  - - - - - - - - -
7981**
7982**  Fundamental argument, IERS Conventions (2003):
7983**  mean longitude of Earth.
7984**
7985**  This function is part of the International Astronomical Union's
7986**  SOFA (Standards Of Fundamental Astronomy) software collection.
7987**
7988**  Status:  canonical model.
7989**
7990**  Given:
7991**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
7992**
7993**  Returned (function value):
7994**           double    mean longitude of Earth, radians (Note 2)
7995**
7996**  Notes:
7997**
7998**  1) Though t is strictly TDB, it is usually more convenient to use
7999**     TT, which makes no significant difference.
8000**
8001**  2) The expression used is as adopted in IERS Conventions (2003) and
8002**     comes from Souchay et al. (1999) after Simon et al. (1994).
8003**
8004**  References:
8005**
8006**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8007**     IERS Technical Note No. 32, BKG (2004)
8008**
8009**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8010**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8011**
8012**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
8013**     Astron.Astrophys.Supp.Ser. 135, 111
8014**
8015*/
8016
8017
8018
8019double iauFaf03(double t)
8020/*
8021**  - - - - - - - - -
8022**   i a u F a f 0 3
8023**  - - - - - - - - -
8024**
8025**  Fundamental argument, IERS Conventions (2003):
8026**  mean longitude of the Moon minus mean longitude of the ascending
8027**  node.
8028**
8029**  This function is part of the International Astronomical Union's
8030**  SOFA (Standards Of Fundamental Astronomy) software collection.
8031**
8032**  Status:  canonical model.
8033**
8034**  Given:
8035**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8036**
8037**  Returned (function value):
8038**           double    F, radians (Note 2)
8039**
8040**  Notes:
8041**
8042**  1) Though t is strictly TDB, it is usually more convenient to use
8043**     TT, which makes no significant difference.
8044**
8045**  2) The expression used is as adopted in IERS Conventions (2003) and
8046**     is from Simon et al. (1994).
8047**
8048**  References:
8049**
8050**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8051**     IERS Technical Note No. 32, BKG (2004)
8052**
8053**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8054**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8055**
8056*/
8057
8058
8059
8060double iauFaju03(double t)
8061/*
8062**  - - - - - - - - - -
8063**   i a u F a j u 0 3
8064**  - - - - - - - - - -
8065**
8066**  Fundamental argument, IERS Conventions (2003):
8067**  mean longitude of Jupiter.
8068**
8069**  This function is part of the International Astronomical Union's
8070**  SOFA (Standards Of Fundamental Astronomy) software collection.
8071**
8072**  Status:  canonical model.
8073**
8074**  Given:
8075**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8076**
8077**  Returned (function value):
8078**           double    mean longitude of Jupiter, radians (Note 2)
8079**
8080**  Notes:
8081**
8082**  1) Though t is strictly TDB, it is usually more convenient to use
8083**     TT, which makes no significant difference.
8084**
8085**  2) The expression used is as adopted in IERS Conventions (2003) and
8086**     comes from Souchay et al. (1999) after Simon et al. (1994).
8087**
8088**  References:
8089**
8090**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8091**     IERS Technical Note No. 32, BKG (2004)
8092**
8093**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8094**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8095**
8096**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
8097**     Astron.Astrophys.Supp.Ser. 135, 111
8098**
8099*/
8100
8101
8102
8103double iauFal03(double t)
8104/*
8105**  - - - - - - - - -
8106**   i a u F a l 0 3
8107**  - - - - - - - - -
8108**
8109**  Fundamental argument, IERS Conventions (2003):
8110**  mean anomaly of the Moon.
8111**
8112**  This function is part of the International Astronomical Union's
8113**  SOFA (Standards Of Fundamental Astronomy) software collection.
8114**
8115**  Status:  canonical model.
8116**
8117**  Given:
8118**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8119**
8120**  Returned (function value):
8121**           double    l, radians (Note 2)
8122**
8123**  Notes:
8124**
8125**  1) Though t is strictly TDB, it is usually more convenient to use
8126**     TT, which makes no significant difference.
8127**
8128**  2) The expression used is as adopted in IERS Conventions (2003) and
8129**     is from Simon et al. (1994).
8130**
8131**  References:
8132**
8133**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8134**     IERS Technical Note No. 32, BKG (2004)
8135**
8136**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8137**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8138**
8139*/
8140
8141
8142
8143double iauFalp03(double t)
8144/*
8145**  - - - - - - - - - -
8146**   i a u F a l p 0 3
8147**  - - - - - - - - - -
8148**
8149**  Fundamental argument, IERS Conventions (2003):
8150**  mean anomaly of the Sun.
8151**
8152**  This function is part of the International Astronomical Union's
8153**  SOFA (Standards Of Fundamental Astronomy) software collection.
8154**
8155**  Status:  canonical model.
8156**
8157**  Given:
8158**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8159**
8160**  Returned (function value):
8161**           double    l', radians (Note 2)
8162**
8163**  Notes:
8164**
8165**  1) Though t is strictly TDB, it is usually more convenient to use
8166**     TT, which makes no significant difference.
8167**
8168**  2) The expression used is as adopted in IERS Conventions (2003) and
8169**     is from Simon et al. (1994).
8170**
8171**  References:
8172**
8173**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8174**     IERS Technical Note No. 32, BKG (2004)
8175**
8176**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8177**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8178**
8179*/
8180
8181
8182
8183double iauFama03(double t)
8184/*
8185**  - - - - - - - - - -
8186**   i a u F a m a 0 3
8187**  - - - - - - - - - -
8188**
8189**  Fundamental argument, IERS Conventions (2003):
8190**  mean longitude of Mars.
8191**
8192**  This function is part of the International Astronomical Union's
8193**  SOFA (Standards Of Fundamental Astronomy) software collection.
8194**
8195**  Status:  canonical model.
8196**
8197**  Given:
8198**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8199**
8200**  Returned (function value):
8201**           double    mean longitude of Mars, radians (Note 2)
8202**
8203**  Notes:
8204**
8205**  1) Though t is strictly TDB, it is usually more convenient to use
8206**     TT, which makes no significant difference.
8207**
8208**  2) The expression used is as adopted in IERS Conventions (2003) and
8209**     comes from Souchay et al. (1999) after Simon et al. (1994).
8210**
8211**  References:
8212**
8213**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8214**     IERS Technical Note No. 32, BKG (2004)
8215**
8216**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8217**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8218**
8219**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
8220**     Astron.Astrophys.Supp.Ser. 135, 111
8221**
8222*/
8223
8224
8225
8226double iauFame03(double t)
8227/*
8228**  - - - - - - - - - -
8229**   i a u F a m e 0 3
8230**  - - - - - - - - - -
8231**
8232**  Fundamental argument, IERS Conventions (2003):
8233**  mean longitude of Mercury.
8234**
8235**  This function is part of the International Astronomical Union's
8236**  SOFA (Standards Of Fundamental Astronomy) software collection.
8237**
8238**  Status:  canonical model.
8239**
8240**  Given:
8241**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8242**
8243**  Returned (function value):
8244**           double    mean longitude of Mercury, radians (Note 2)
8245**
8246**  Notes:
8247**
8248**  1) Though t is strictly TDB, it is usually more convenient to use
8249**     TT, which makes no significant difference.
8250**
8251**  2) The expression used is as adopted in IERS Conventions (2003) and
8252**     comes from Souchay et al. (1999) after Simon et al. (1994).
8253**
8254**  References:
8255**
8256**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8257**     IERS Technical Note No. 32, BKG (2004)
8258**
8259**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8260**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8261**
8262**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
8263**     Astron.Astrophys.Supp.Ser. 135, 111
8264**
8265*/
8266
8267
8268
8269double iauFane03(double t)
8270/*
8271**  - - - - - - - - - -
8272**   i a u F a n e 0 3
8273**  - - - - - - - - - -
8274**
8275**  Fundamental argument, IERS Conventions (2003):
8276**  mean longitude of Neptune.
8277**
8278**  This function is part of the International Astronomical Union's
8279**  SOFA (Standards Of Fundamental Astronomy) software collection.
8280**
8281**  Status:  canonical model.
8282**
8283**  Given:
8284**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8285**
8286**  Returned (function value):
8287**           double    mean longitude of Neptune, radians (Note 2)
8288**
8289**  Notes:
8290**
8291**  1) Though t is strictly TDB, it is usually more convenient to use
8292**     TT, which makes no significant difference.
8293**
8294**  2) The expression used is as adopted in IERS Conventions (2003) and
8295**     is adapted from Simon et al. (1994).
8296**
8297**  References:
8298**
8299**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8300**     IERS Technical Note No. 32, BKG (2004)
8301**
8302**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8303**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8304**
8305*/
8306
8307
8308
8309double iauFaom03(double t)
8310/*
8311**  - - - - - - - - - -
8312**   i a u F a o m 0 3
8313**  - - - - - - - - - -
8314**
8315**  Fundamental argument, IERS Conventions (2003):
8316**  mean longitude of the Moon's ascending node.
8317**
8318**  This function is part of the International Astronomical Union's
8319**  SOFA (Standards Of Fundamental Astronomy) software collection.
8320**
8321**  Status:  canonical model.
8322**
8323**  Given:
8324**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8325**
8326**  Returned (function value):
8327**           double    Omega, radians (Note 2)
8328**
8329**  Notes:
8330**
8331**  1) Though t is strictly TDB, it is usually more convenient to use
8332**     TT, which makes no significant difference.
8333**
8334**  2) The expression used is as adopted in IERS Conventions (2003) and
8335**     is from Simon et al. (1994).
8336**
8337**  References:
8338**
8339**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8340**     IERS Technical Note No. 32, BKG (2004)
8341**
8342**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8343**     Francou, G., Laskar, J., 1994, Astron.Astrophys. 282, 663-683.
8344**
8345*/
8346
8347
8348
8349double iauFapa03(double t)
8350/*
8351**  - - - - - - - - - -
8352**   i a u F a p a 0 3
8353**  - - - - - - - - - -
8354**
8355**  Fundamental argument, IERS Conventions (2003):
8356**  general accumulated precession in longitude.
8357**
8358**  This function is part of the International Astronomical Union's
8359**  SOFA (Standards Of Fundamental Astronomy) software collection.
8360**
8361**  Status:  canonical model.
8362**
8363**  Given:
8364**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8365**
8366**  Returned (function value):
8367**           double    general precession in longitude, radians (Note 2)
8368**
8369**  Notes:
8370**
8371**  1) Though t is strictly TDB, it is usually more convenient to use
8372**     TT, which makes no significant difference.
8373**
8374**  2) The expression used is as adopted in IERS Conventions (2003).  It
8375**     is taken from Kinoshita & Souchay (1990) and comes originally
8376**     from Lieske et al. (1977).
8377**
8378**  References:
8379**
8380**     Kinoshita, H. and Souchay J. 1990, Celest.Mech. and Dyn.Astron.
8381**     48, 187
8382**
8383**     Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977,
8384**     Astron.Astrophys. 58, 1-16
8385**
8386**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8387**     IERS Technical Note No. 32, BKG (2004)
8388**
8389*/
8390
8391
8392
8393double iauFasa03(double t)
8394/*
8395**  - - - - - - - - - -
8396**   i a u F a s a 0 3
8397**  - - - - - - - - - -
8398**
8399**  Fundamental argument, IERS Conventions (2003):
8400**  mean longitude of Saturn.
8401**
8402**  This function is part of the International Astronomical Union's
8403**  SOFA (Standards Of Fundamental Astronomy) software collection.
8404**
8405**  Status:  canonical model.
8406**
8407**  Given:
8408**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8409**
8410**  Returned (function value):
8411**           double    mean longitude of Saturn, radians (Note 2)
8412**
8413**  Notes:
8414**
8415**  1) Though t is strictly TDB, it is usually more convenient to use
8416**     TT, which makes no significant difference.
8417**
8418**  2) The expression used is as adopted in IERS Conventions (2003) and
8419**     comes from Souchay et al. (1999) after Simon et al. (1994).
8420**
8421**  References:
8422**
8423**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8424**     IERS Technical Note No. 32, BKG (2004)
8425**
8426**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8427**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8428**
8429**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
8430**     Astron.Astrophys.Supp.Ser. 135, 111
8431**
8432*/
8433
8434
8435
8436double iauFaur03(double t)
8437/*
8438**  - - - - - - - - - -
8439**   i a u F a u r 0 3
8440**  - - - - - - - - - -
8441**
8442**  Fundamental argument, IERS Conventions (2003):
8443**  mean longitude of Uranus.
8444**
8445**  This function is part of the International Astronomical Union's
8446**  SOFA (Standards Of Fundamental Astronomy) software collection.
8447**
8448**  Status:  canonical model.
8449**
8450**  Given:
8451**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8452**
8453**  Returned  (function value):
8454**           double    mean longitude of Uranus, radians (Note 2)
8455**
8456**  Notes:
8457**
8458**  1) Though t is strictly TDB, it is usually more convenient to use
8459**     TT, which makes no significant difference.
8460**
8461**  2) The expression used is as adopted in IERS Conventions (2003) and
8462**     is adapted from Simon et al. (1994).
8463**
8464**  References:
8465**
8466**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8467**     IERS Technical Note No. 32, BKG (2004)
8468**
8469**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8470**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8471**
8472*/
8473
8474
8475
8476double iauFave03(double t)
8477/*
8478**  - - - - - - - - - -
8479**   i a u F a v e 0 3
8480**  - - - - - - - - - -
8481**
8482**  Fundamental argument, IERS Conventions (2003):
8483**  mean longitude of Venus.
8484**
8485**  This function is part of the International Astronomical Union's
8486**  SOFA (Standards Of Fundamental Astronomy) software collection.
8487**
8488**  Status:  canonical model.
8489**
8490**  Given:
8491**     t     double    TDB, Julian centuries since J2000.0 (Note 1)
8492**
8493**  Returned (function value):
8494**           double    mean longitude of Venus, radians (Note 2)
8495**
8496**  Notes:
8497**
8498**  1) Though t is strictly TDB, it is usually more convenient to use
8499**     TT, which makes no significant difference.
8500**
8501**  2) The expression used is as adopted in IERS Conventions (2003) and
8502**     comes from Souchay et al. (1999) after Simon et al. (1994).
8503**
8504**  References:
8505**
8506**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8507**     IERS Technical Note No. 32, BKG (2004)
8508**
8509**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
8510**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
8511**
8512**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
8513**     Astron.Astrophys.Supp.Ser. 135, 111
8514**
8515*/
8516
8517
8518
8519void iauFk425(double r1950, double d1950,
8520              double dr1950, double dd1950,
8521              double p1950, double v1950,
8522              double *r2000, double *d2000,
8523              double *dr2000, double *dd2000,
8524              double *p2000, double *v2000)
8525/*
8526**  - - - - - - - - -
8527**   i a u F k 4 2 5
8528**  - - - - - - - - -
8529**
8530**  Convert B1950.0 FK4 star catalog data to J2000.0 FK5.
8531**
8532**  This function is part of the International Astronomical Union's
8533**  SOFA (Standards of Fundamental Astronomy) software collection.
8534**
8535**  Status:  support function.
8536**
8537**  This function converts a star's catalog data from the old FK4
8538** (Bessel-Newcomb) system to the later IAU 1976 FK5 (Fricke) system.
8539**
8540**  Given: (all B1950.0, FK4)
8541**     r1950,d1950    double   B1950.0 RA,Dec (rad)
8542**     dr1950,dd1950  double   B1950.0 proper motions (rad/trop.yr)
8543**     p1950          double   parallax (arcsec)
8544**     v1950          double   radial velocity (km/s, +ve = moving away)
8545**
8546**  Returned: (all J2000.0, FK5)
8547**     r2000,d2000    double   J2000.0 RA,Dec (rad)
8548**     dr2000,dd2000  double   J2000.0 proper motions (rad/Jul.yr)
8549**     p2000          double   parallax (arcsec)
8550**     v2000          double   radial velocity (km/s, +ve = moving away)
8551**
8552**  Notes:
8553**
8554**  1) The proper motions in RA are dRA/dt rather than cos(Dec)*dRA/dt,
8555**     and are per year rather than per century.
8556**
8557**  2) The conversion is somewhat complicated, for several reasons:
8558**
8559**     . Change of standard epoch from B1950.0 to J2000.0.
8560**
8561**     . An intermediate transition date of 1984 January 1.0 TT.
8562**
8563**     . A change of precession model.
8564**
8565**     . Change of time unit for proper motion (tropical to Julian).
8566**
8567**     . FK4 positions include the E-terms of aberration, to simplify
8568**       the hand computation of annual aberration.  FK5 positions
8569**       assume a rigorous aberration computation based on the Earth's
8570**       barycentric velocity.
8571**
8572**     . The E-terms also affect proper motions, and in particular cause
8573**       objects at large distances to exhibit fictitious proper
8574**       motions.
8575**
8576**     The algorithm is based on Smith et al. (1989) and Yallop et al.
8577**     (1989), which presented a matrix method due to Standish (1982) as
8578**     developed by Aoki et al. (1983), using Kinoshita's development of
8579**     Andoyer's post-Newcomb precession.  The numerical constants from
8580**     Seidelmann (1992) are used canonically.
8581**
8582**  3) Conversion from B1950.0 FK4 to J2000.0 FK5 only is provided for.
8583**     Conversions for different epochs and equinoxes would require
8584**     additional treatment for precession, proper motion and E-terms.
8585**
8586**  4) In the FK4 catalog the proper motions of stars within 10 degrees
8587**     of the poles do not embody differential E-terms effects and
8588**     should, strictly speaking, be handled in a different manner from
8589**     stars outside these regions.  However, given the general lack of
8590**     homogeneity of the star data available for routine astrometry,
8591**     the difficulties of handling positions that may have been
8592**     determined from astrometric fields spanning the polar and non-
8593**     polar regions, the likelihood that the differential E-terms
8594**     effect was not taken into account when allowing for proper motion
8595**     in past astrometry, and the undesirability of a discontinuity in
8596**     the algorithm, the decision has been made in this SOFA algorithm
8597**     to include the effects of differential E-terms on the proper
8598**     motions for all stars, whether polar or not.  At epoch J2000.0,
8599**     and measuring "on the sky" rather than in terms of RA change, the
8600**     errors resulting from this simplification are less than
8601**     1 milliarcsecond in position and 1 milliarcsecond per century in
8602**     proper motion.
8603**
8604**  Called:
8605**     iauAnp       normalize angle into range 0 to 2pi
8606**     iauPv2s      pv-vector to spherical coordinates
8607**     iauPdp       scalar product of two p-vectors
8608**     iauPvmpv     pv-vector minus pv_vector
8609**     iauPvppv     pv-vector plus pv_vector
8610**     iauS2pv      spherical coordinates to pv-vector
8611**     iauSxp       multiply p-vector by scalar
8612**
8613**  References:
8614**
8615**     Aoki, S. et al., 1983, "Conversion matrix of epoch B1950.0
8616**     FK4-based positions of stars to epoch J2000.0 positions in
8617**     accordance with the new IAU resolutions".  Astron.Astrophys.
8618**     128, 263-267.
8619**
8620**     Seidelmann, P.K. (ed), 1992, "Explanatory Supplement to the
8621**     Astronomical Almanac", ISBN 0-935702-68-7.
8622**
8623**     Smith, C.A. et al., 1989, "The transformation of astrometric
8624**     catalog systems to the equinox J2000.0".  Astron.J. 97, 265.
8625**
8626**     Standish, E.M., 1982, "Conversion of positions and proper motions
8627**     from B1950.0 to the IAU system at J2000.0".  Astron.Astrophys.,
8628**     115, 1, 20-22.
8629**
8630**     Yallop, B.D. et al., 1989, "Transformation of mean star places
8631**     from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space".
8632**     Astron.J. 97, 274.
8633**
8634*/
8635
8636
8637
8638void iauFk45z(double r1950, double d1950, double bepoch,
8639              double *r2000, double *d2000)
8640/*
8641**  - - - - - - - - -
8642**   i a u F k 4 5 z
8643**  - - - - - - - - -
8644**
8645**  Convert a B1950.0 FK4 star position to J2000.0 FK5, assuming zero
8646**  proper motion in the FK5 system.
8647**
8648**  This function is part of the International Astronomical Union's
8649**  SOFA (Standards of Fundamental Astronomy) software collection.
8650**
8651**  Status:  support function.
8652**
8653**  This function converts a star's catalog data from the old FK4
8654**  (Bessel-Newcomb) system to the later IAU 1976 FK5 (Fricke) system,
8655**  in such a way that the FK5 proper motion is zero.  Because such a
8656**  star has, in general, a non-zero proper motion in the FK4 system,
8657**  the function requires the epoch at which the position in the FK4
8658**  system was determined.
8659**
8660**  Given:
8661**     r1950,d1950    double   B1950.0 FK4 RA,Dec at epoch (rad)
8662**     bepoch         double   Besselian epoch (e.g. 1979.3)
8663**
8664**  Returned:
8665**     r2000,d2000    double   J2000.0 FK5 RA,Dec (rad)
8666**
8667**  Notes:
8668**
8669**  1) The epoch bepoch is strictly speaking Besselian, but if a
8670**     Julian epoch is supplied the result will be affected only to a
8671**     negligible extent.
8672**
8673**  2) The method is from Appendix 2 of Aoki et al. (1983), but using
8674**     the constants of Seidelmann (1992).  See the function iauFk425
8675**     for a general introduction to the FK4 to FK5 conversion.
8676**
8677**  3) Conversion from equinox B1950.0 FK4 to equinox J2000.0 FK5 only
8678**     is provided for.  Conversions for different starting and/or
8679**     ending epochs would require additional treatment for precession,
8680**     proper motion and E-terms.
8681**
8682**  4) In the FK4 catalog the proper motions of stars within 10 degrees
8683**     of the poles do not embody differential E-terms effects and
8684**     should, strictly speaking, be handled in a different manner from
8685**     stars outside these regions.  However, given the general lack of
8686**     homogeneity of the star data available for routine astrometry,
8687**     the difficulties of handling positions that may have been
8688**     determined from astrometric fields spanning the polar and non-
8689**     polar regions, the likelihood that the differential E-terms
8690**     effect was not taken into account when allowing for proper motion
8691**     in past astrometry, and the undesirability of a discontinuity in
8692**     the algorithm, the decision has been made in this SOFA algorithm
8693**     to include the effects of differential E-terms on the proper
8694**     motions for all stars, whether polar or not.  At epoch 2000.0,
8695**     and measuring "on the sky" rather than in terms of RA change, the
8696**     errors resulting from this simplification are less than
8697**     1 milliarcsecond in position and 1 milliarcsecond per century in
8698**     proper motion.
8699**
8700**  References:
8701**
8702**     Aoki, S. et al., 1983, "Conversion matrix of epoch B1950.0
8703**     FK4-based positions of stars to epoch J2000.0 positions in
8704**     accordance with the new IAU resolutions".  Astron.Astrophys.
8705**     128, 263-267.
8706**
8707**     Seidelmann, P.K. (ed), 1992, "Explanatory Supplement to the
8708**     Astronomical Almanac", ISBN 0-935702-68-7.
8709**
8710**  Called:
8711**     iauAnp       normalize angle into range 0 to 2pi
8712**     iauC2s       p-vector to spherical
8713**     iauEpb2jd    Besselian epoch to Julian date
8714**     iauEpj       Julian date to Julian epoch
8715**     iauPdp       scalar product of two p-vectors
8716**     iauPmp       p-vector minus p-vector
8717**     iauPpsp      p-vector plus scaled p-vector
8718**     iauPvu       update a pv-vector
8719**     iauS2c       spherical to p-vector
8720**
8721*/
8722
8723
8724
8725void iauFk524(double r2000, double d2000,
8726              double dr2000, double dd2000,
8727              double p2000, double v2000,
8728              double *r1950, double *d1950,
8729              double *dr1950, double *dd1950,
8730              double *p1950, double *v1950)
8731/*
8732**  - - - - - - - - -
8733**   i a u F k 5 2 4
8734**  - - - - - - - - -
8735**
8736**  Convert J2000.0 FK5 star catalog data to B1950.0 FK4.
8737**
8738**  This function is part of the International Astronomical Union's
8739**  SOFA (Standards of Fundamental Astronomy) software collection.
8740**
8741**  Status:  support function.
8742**
8743**  Given: (all J2000.0, FK5)
8744**     r2000,d2000    double   J2000.0 RA,Dec (rad)
8745**     dr2000,dd2000  double   J2000.0 proper motions (rad/Jul.yr)
8746**     p2000          double   parallax (arcsec)
8747**     v2000          double   radial velocity (km/s, +ve = moving away)
8748**
8749**  Returned: (all B1950.0, FK4)
8750**     r1950,d1950    double   B1950.0 RA,Dec (rad)
8751**     dr1950,dd1950  double   B1950.0 proper motions (rad/trop.yr)
8752**     p1950          double   parallax (arcsec)
8753**     v1950          double   radial velocity (km/s, +ve = moving away)
8754**
8755**  Notes:
8756**
8757**  1) The proper motions in RA are dRA/dt rather than cos(Dec)*dRA/dt,
8758**     and are per year rather than per century.
8759**
8760**  2) The conversion is somewhat complicated, for several reasons:
8761**
8762**     . Change of standard epoch from J2000.0 to B1950.0.
8763**
8764**     . An intermediate transition date of 1984 January 1.0 TT.
8765**
8766**     . A change of precession model.
8767**
8768**     . Change of time unit for proper motion (Julian to tropical).
8769**
8770**     . FK4 positions include the E-terms of aberration, to simplify
8771**       the hand computation of annual aberration.  FK5 positions
8772**       assume a rigorous aberration computation based on the Earth's
8773**       barycentric velocity.
8774**
8775**     . The E-terms also affect proper motions, and in particular cause
8776**       objects at large distances to exhibit fictitious proper
8777**       motions.
8778**
8779**     The algorithm is based on Smith et al. (1989) and Yallop et al.
8780**     (1989), which presented a matrix method due to Standish (1982) as
8781**     developed by Aoki et al. (1983), using Kinoshita's development of
8782**     Andoyer's post-Newcomb precession.  The numerical constants from
8783**     Seidelmann (1992) are used canonically.
8784**
8785**  4) In the FK4 catalog the proper motions of stars within 10 degrees
8786**     of the poles do not embody differential E-terms effects and
8787**     should, strictly speaking, be handled in a different manner from
8788**     stars outside these regions.  However, given the general lack of
8789**     homogeneity of the star data available for routine astrometry,
8790**     the difficulties of handling positions that may have been
8791**     determined from astrometric fields spanning the polar and non-
8792**     polar regions, the likelihood that the differential E-terms
8793**     effect was not taken into account when allowing for proper motion
8794**     in past astrometry, and the undesirability of a discontinuity in
8795**     the algorithm, the decision has been made in this SOFA algorithm
8796**     to include the effects of differential E-terms on the proper
8797**     motions for all stars, whether polar or not.  At epoch J2000.0,
8798**     and measuring "on the sky" rather than in terms of RA change, the
8799**     errors resulting from this simplification are less than
8800**     1 milliarcsecond in position and 1 milliarcsecond per century in
8801**     proper motion.
8802**
8803**  Called:
8804**     iauAnp       normalize angle into range 0 to 2pi
8805**     iauPdp       scalar product of two p-vectors
8806**     iauPm        modulus of p-vector
8807**     iauPmp       p-vector minus p-vector
8808**     iauPpp       p-vector pluus p-vector
8809**     iauPv2s      pv-vector to spherical coordinates
8810**     iauS2pv      spherical coordinates to pv-vector
8811**     iauSxp       multiply p-vector by scalar
8812**
8813**  References:
8814**
8815**     Aoki, S. et al., 1983, "Conversion matrix of epoch B1950.0
8816**     FK4-based positions of stars to epoch J2000.0 positions in
8817**     accordance with the new IAU resolutions".  Astron.Astrophys.
8818**     128, 263-267.
8819**
8820**     Seidelmann, P.K. (ed), 1992, "Explanatory Supplement to the
8821**     Astronomical Almanac", ISBN 0-935702-68-7.
8822**
8823**     Smith, C.A. et al., 1989, "The transformation of astrometric
8824**     catalog systems to the equinox J2000.0".  Astron.J. 97, 265.
8825**
8826**     Standish, E.M., 1982, "Conversion of positions and proper motions
8827**     from B1950.0 to the IAU system at J2000.0".  Astron.Astrophys.,
8828**     115, 1, 20-22.
8829**
8830**     Yallop, B.D. et al., 1989, "Transformation of mean star places
8831**     from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space".
8832**     Astron.J. 97, 274.
8833**
8834*/
8835
8836
8837
8838void iauFk52h(double r5, double d5,
8839              double dr5, double dd5, double px5, double rv5,
8840              double *rh, double *dh,
8841              double *drh, double *ddh, double *pxh, double *rvh)
8842/*
8843**  - - - - - - - - -
8844**   i a u F k 5 2 h
8845**  - - - - - - - - -
8846**
8847**  Transform FK5 (J2000.0) star data into the Hipparcos system.
8848**
8849**  This function is part of the International Astronomical Union's
8850**  SOFA (Standards Of Fundamental Astronomy) software collection.
8851**
8852**  Status:  support function.
8853**
8854**  Given (all FK5, equinox J2000.0, epoch J2000.0):
8855**     r5      double    RA (radians)
8856**     d5      double    Dec (radians)
8857**     dr5     double    proper motion in RA (dRA/dt, rad/Jyear)
8858**     dd5     double    proper motion in Dec (dDec/dt, rad/Jyear)
8859**     px5     double    parallax (arcsec)
8860**     rv5     double    radial velocity (km/s, positive = receding)
8861**
8862**  Returned (all Hipparcos, epoch J2000.0):
8863**     rh      double    RA (radians)
8864**     dh      double    Dec (radians)
8865**     drh     double    proper motion in RA (dRA/dt, rad/Jyear)
8866**     ddh     double    proper motion in Dec (dDec/dt, rad/Jyear)
8867**     pxh     double    parallax (arcsec)
8868**     rvh     double    radial velocity (km/s, positive = receding)
8869**
8870**  Notes:
8871**
8872**  1) This function transforms FK5 star positions and proper motions
8873**     into the system of the Hipparcos catalog.
8874**
8875**  2) The proper motions in RA are dRA/dt rather than
8876**     cos(Dec)*dRA/dt, and are per year rather than per century.
8877**
8878**  3) The FK5 to Hipparcos transformation is modeled as a pure
8879**     rotation and spin;  zonal errors in the FK5 catalog are not
8880**     taken into account.
8881**
8882**  4) See also iauH2fk5, iauFk5hz, iauHfk5z.
8883**
8884**  Called:
8885**     iauStarpv    star catalog data to space motion pv-vector
8886**     iauFk5hip    FK5 to Hipparcos rotation and spin
8887**     iauRxp       product of r-matrix and p-vector
8888**     iauPxp       vector product of two p-vectors
8889**     iauPpp       p-vector plus p-vector
8890**     iauPvstar    space motion pv-vector to star catalog data
8891**
8892**  Reference:
8893**
8894**     F.Mignard & M.Froeschle, Astron.Astrophys., 354, 732-739 (2000).
8895**
8896*/
8897
8898
8899
8900void iauFk54z(double r2000, double d2000, double bepoch,
8901              double *r1950, double *d1950,
8902              double *dr1950, double *dd1950)
8903/*
8904**  - - - - - - - - -
8905**   i a u F k 5 4 z
8906**  - - - - - - - - -
8907**
8908**  Convert a J2000.0 FK5 star position to B1950.0 FK4, assuming zero
8909**  proper motion in FK5 and parallax.
8910**
8911**  This function is part of the International Astronomical Union's
8912**  SOFA (Standards of Fundamental Astronomy) software collection.
8913**
8914**  Status:  support function.
8915**
8916**  Given:
8917**     r2000,d2000    double   J2000.0 FK5 RA,Dec (rad)
8918**     bepoch         double   Besselian epoch (e.g. 1950.0)
8919**
8920**  Returned:
8921**     r1950,d1950    double   B1950.0 FK4 RA,Dec (rad) at epoch BEPOCH
8922**     dr1950,dd1950  double   B1950.0 FK4 proper motions (rad/trop.yr)
8923**
8924**  Notes:
8925**
8926**  1) In contrast to the iauFk524 function, here the FK5 proper
8927**     motions, the parallax and the radial velocity are presumed zero.
8928**
8929**  2) This function converts a star position from the IAU 1976 FK5
8930**    (Fricke) system to the former FK4 (Bessel-Newcomb) system, for
8931**     cases such as distant radio sources where it is presumed there is
8932**     zero parallax and no proper motion.  Because of the E-terms of
8933**     aberration, such objects have (in general) non-zero proper motion
8934**     in FK4, and the present function returns those fictitious proper
8935**     motions.
8936**
8937**  3) Conversion from B1950.0 FK4 to J2000.0 FK5 only is provided for.
8938**     Conversions involving other equinoxes would require additional
8939**     treatment for precession.
8940**
8941**  4) The position returned by this function is in the B1950.0 FK4
8942**     reference system but at Besselian epoch BEPOCH.  For comparison
8943**     with catalogs the BEPOCH argument will frequently be 1950.0. (In
8944**     this context the distinction between Besselian and Julian epoch
8945**     is insignificant.)
8946**
8947**  5) The RA component of the returned (fictitious) proper motion is
8948**     dRA/dt rather than cos(Dec)*dRA/dt.
8949**
8950**  Called:
8951**     iauAnp       normalize angle into range 0 to 2pi
8952**     iauC2s       p-vector to spherical
8953**     iauFk524     FK4 to FK5
8954**     iauS2c       spherical to p-vector
8955**
8956*/
8957
8958
8959
8960void iauFk5hip(double r5h[3][3], double s5h[3])
8961/*
8962**  - - - - - - - - - -
8963**   i a u F k 5 h i p
8964**  - - - - - - - - - -
8965**
8966**  FK5 to Hipparcos rotation and spin.
8967**
8968**  This function is part of the International Astronomical Union's
8969**  SOFA (Standards Of Fundamental Astronomy) software collection.
8970**
8971**  Status:  support function.
8972**
8973**  Returned:
8974**     r5h   double[3][3]  r-matrix: FK5 rotation wrt Hipparcos (Note 2)
8975**     s5h   double[3]     r-vector: FK5 spin wrt Hipparcos (Note 3)
8976**
8977**  Notes:
8978**
8979**  1) This function models the FK5 to Hipparcos transformation as a
8980**     pure rotation and spin;  zonal errors in the FK5 catalogue are
8981**     not taken into account.
8982**
8983**  2) The r-matrix r5h operates in the sense:
8984**
8985**           P_Hipparcos = r5h x P_FK5
8986**
8987**     where P_FK5 is a p-vector in the FK5 frame, and P_Hipparcos is
8988**     the equivalent Hipparcos p-vector.
8989**
8990**  3) The r-vector s5h represents the time derivative of the FK5 to
8991**     Hipparcos rotation.  The units are radians per year (Julian,
8992**     TDB).
8993**
8994**  Called:
8995**     iauRv2m      r-vector to r-matrix
8996**
8997**  Reference:
8998**
8999**     F.Mignard & M.Froeschle, Astron.Astrophys., 354, 732-739 (2000).
9000**
9001*/
9002
9003
9004
9005void iauFk5hz(double r5, double d5, double date1, double date2,
9006              double *rh, double *dh)
9007/*
9008**  - - - - - - - - -
9009**   i a u F k 5 h z
9010**  - - - - - - - - -
9011**
9012**  Transform an FK5 (J2000.0) star position into the system of the
9013**  Hipparcos catalogue, assuming zero Hipparcos proper motion.
9014**
9015**  This function is part of the International Astronomical Union's
9016**  SOFA (Standards Of Fundamental Astronomy) software collection.
9017**
9018**  Status:  support function.
9019**
9020**  Given:
9021**     r5           double   FK5 RA (radians), equinox J2000.0, at date
9022**     d5           double   FK5 Dec (radians), equinox J2000.0, at date
9023**     date1,date2  double   TDB date (Notes 1,2)
9024**
9025**  Returned:
9026**     rh           double   Hipparcos RA (radians)
9027**     dh           double   Hipparcos Dec (radians)
9028**
9029**  Notes:
9030**
9031**  1) This function converts a star position from the FK5 system to
9032**     the Hipparcos system, in such a way that the Hipparcos proper
9033**     motion is zero.  Because such a star has, in general, a non-zero
9034**     proper motion in the FK5 system, the function requires the date
9035**     at which the position in the FK5 system was determined.
9036**
9037**  2) The TT date date1+date2 is a Julian Date, apportioned in any
9038**     convenient way between the two arguments.  For example,
9039**     JD(TT)=2450123.7 could be expressed in any of these ways,
9040**     among others:
9041**
9042**            date1          date2
9043**
9044**         2450123.7           0.0       (JD method)
9045**         2451545.0       -1421.3       (J2000 method)
9046**         2400000.5       50123.2       (MJD method)
9047**         2450123.5           0.2       (date & time method)
9048**
9049**     The JD method is the most natural and convenient to use in
9050**     cases where the loss of several decimal digits of resolution
9051**     is acceptable.  The J2000 method is best matched to the way
9052**     the argument is handled internally and will deliver the
9053**     optimum resolution.  The MJD method and the date & time methods
9054**     are both good compromises between resolution and convenience.
9055**
9056**  3) The FK5 to Hipparcos transformation is modeled as a pure
9057**     rotation and spin;  zonal errors in the FK5 catalogue are not
9058**     taken into account.
9059**
9060**  4) The position returned by this function is in the Hipparcos
9061**     reference system but at date date1+date2.
9062**
9063**  5) See also iauFk52h, iauH2fk5, iauHfk5z.
9064**
9065**  Called:
9066**     iauS2c       spherical coordinates to unit vector
9067**     iauFk5hip    FK5 to Hipparcos rotation and spin
9068**     iauSxp       multiply p-vector by scalar
9069**     iauRv2m      r-vector to r-matrix
9070**     iauTrxp      product of transpose of r-matrix and p-vector
9071**     iauPxp       vector product of two p-vectors
9072**     iauC2s       p-vector to spherical
9073**     iauAnp       normalize angle into range 0 to 2pi
9074**
9075**  Reference:
9076**
9077**     F.Mignard & M.Froeschle, 2000, Astron.Astrophys. 354, 732-739.
9078**
9079*/
9080
9081
9082
9083void iauFw2m(double gamb, double phib, double psi, double eps,
9084             double r[3][3])
9085/*
9086**  - - - - - - - -
9087**   i a u F w 2 m
9088**  - - - - - - - -
9089**
9090**  Form rotation matrix given the Fukushima-Williams angles.
9091**
9092**  This function is part of the International Astronomical Union's
9093**  SOFA (Standards Of Fundamental Astronomy) software collection.
9094**
9095**  Status:  support function.
9096**
9097**  Given:
9098**     gamb     double         F-W angle gamma_bar (radians)
9099**     phib     double         F-W angle phi_bar (radians)
9100**     psi      double         F-W angle psi (radians)
9101**     eps      double         F-W angle epsilon (radians)
9102**
9103**  Returned:
9104**     r        double[3][3]   rotation matrix
9105**
9106**  Notes:
9107**
9108**  1) Naming the following points:
9109**
9110**           e = J2000.0 ecliptic pole,
9111**           p = GCRS pole,
9112**           E = ecliptic pole of date,
9113**     and   P = CIP,
9114**
9115**     the four Fukushima-Williams angles are as follows:
9116**
9117**        gamb = gamma = epE
9118**        phib = phi = pE
9119**        psi = psi = pEP
9120**        eps = epsilon = EP
9121**
9122**  2) The matrix representing the combined effects of frame bias,
9123**     precession and nutation is:
9124**
9125**        NxPxB = R_1(-eps).R_3(-psi).R_1(phib).R_3(gamb)
9126**
9127**  3) The present function can construct three different matrices,
9128**     depending on which angles are supplied as the arguments gamb,
9129**     phib, psi and eps:
9130**
9131**     o  To obtain the nutation x precession x frame bias matrix,
9132**        first generate the four precession angles known conventionally
9133**        as gamma_bar, phi_bar, psi_bar and epsilon_A, then generate
9134**        the nutation components Dpsi and Depsilon and add them to
9135**        psi_bar and epsilon_A, and finally call the present function
9136**        using those four angles as arguments.
9137**
9138**     o  To obtain the precession x frame bias matrix, generate the
9139**        four precession angles and call the present function.
9140**
9141**     o  To obtain the frame bias matrix, generate the four precession
9142**        angles for date J2000.0 and call the present function.
9143**
9144**     The nutation-only and precession-only matrices can if necessary
9145**     be obtained by combining these three appropriately.
9146**
9147**  Called:
9148**     iauIr        initialize r-matrix to identity
9149**     iauRz        rotate around Z-axis
9150**     iauRx        rotate around X-axis
9151**
9152**  References:
9153**
9154**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
9155**
9156**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
9157**
9158*/
9159
9160
9161
9162void iauFw2xy(double gamb, double phib, double psi, double eps,
9163              double *x, double *y)
9164/*
9165**  - - - - - - - - -
9166**   i a u F w 2 x y
9167**  - - - - - - - - -
9168**
9169**  CIP X,Y given Fukushima-Williams bias-precession-nutation angles.
9170**
9171**  This function is part of the International Astronomical Union's
9172**  SOFA (Standards Of Fundamental Astronomy) software collection.
9173**
9174**  Status:  support function.
9175**
9176**  Given:
9177**     gamb     double    F-W angle gamma_bar (radians)
9178**     phib     double    F-W angle phi_bar (radians)
9179**     psi      double    F-W angle psi (radians)
9180**     eps      double    F-W angle epsilon (radians)
9181**
9182**  Returned:
9183**     x,y      double    CIP unit vector X,Y
9184**
9185**  Notes:
9186**
9187**  1) Naming the following points:
9188**
9189**           e = J2000.0 ecliptic pole,
9190**           p = GCRS pole
9191**           E = ecliptic pole of date,
9192**     and   P = CIP,
9193**
9194**     the four Fukushima-Williams angles are as follows:
9195**
9196**        gamb = gamma = epE
9197**        phib = phi = pE
9198**        psi = psi = pEP
9199**        eps = epsilon = EP
9200**
9201**  2) The matrix representing the combined effects of frame bias,
9202**     precession and nutation is:
9203**
9204**        NxPxB = R_1(-epsA).R_3(-psi).R_1(phib).R_3(gamb)
9205**
9206**     The returned values x,y are elements [2][0] and [2][1] of the
9207**     matrix.  Near J2000.0, they are essentially angles in radians.
9208**
9209**  Called:
9210**     iauFw2m      F-W angles to r-matrix
9211**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
9212**
9213**  Reference:
9214**
9215**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
9216**
9217*/
9218
9219
9220
9221
9222void iauG2icrs ( double dl, double db, double *dr, double *dd )
9223/*
9224**  - - - - - - - - - -
9225**   i a u G 2 i c r s
9226**  - - - - - - - - - -
9227**
9228**  Transformation from Galactic Coordinates to ICRS.
9229**
9230**  This function is part of the International Astronomical Union's
9231**  SOFA (Standards of Fundamental Astronomy) software collection.
9232**
9233**  Status:  support function.
9234**
9235**  Given:
9236**     dl     double      galactic longitude (radians)
9237**     db     double      galactic latitude (radians)
9238**
9239**  Returned:
9240**     dr     double      ICRS right ascension (radians)
9241**     dd     double      ICRS declination (radians)
9242**
9243**  Notes:
9244**
9245**  1) The IAU 1958 system of Galactic coordinates was defined with
9246**     respect to the now obsolete reference system FK4 B1950.0.  When
9247**     interpreting the system in a modern context, several factors have
9248**     to be taken into account:
9249**
9250**     . The inclusion in FK4 positions of the E-terms of aberration.
9251**
9252**     . The distortion of the FK4 proper motion system by differential
9253**       Galactic rotation.
9254**
9255**     . The use of the B1950.0 equinox rather than the now-standard
9256**       J2000.0.
9257**
9258**     . The frame bias between ICRS and the J2000.0 mean place system.
9259**
9260**     The Hipparcos Catalogue (Perryman & ESA 1997) provides a rotation
9261**     matrix that transforms directly between ICRS and Galactic
9262**     coordinates with the above factors taken into account.  The
9263**     matrix is derived from three angles, namely the ICRS coordinates
9264**     of the Galactic pole and the longitude of the ascending node of
9265**     the galactic equator on the ICRS equator.  They are given in
9266**     degrees to five decimal places and for canonical purposes are
9267**     regarded as exact.  In the Hipparcos Catalogue the matrix
9268**     elements are given to 10 decimal places (about 20 microarcsec).
9269**     In the present SOFA function the matrix elements have been
9270**     recomputed from the canonical three angles and are given to 30
9271**     decimal places.
9272**
9273**  2) The inverse transformation is performed by the function iauIcrs2g.
9274**
9275**  Called:
9276**     iauAnp       normalize angle into range 0 to 2pi
9277**     iauAnpm      normalize angle into range +/- pi
9278**     iauS2c       spherical coordinates to unit vector
9279**     iauTrxp      product of transpose of r-matrix and p-vector
9280**     iauC2s       p-vector to spherical
9281**
9282**  Reference:
9283**     Perryman M.A.C. & ESA, 1997, ESA SP-1200, The Hipparcos and Tycho
9284**     catalogues.  Astrometric and photometric star catalogues
9285**     derived from the ESA Hipparcos Space Astrometry Mission.  ESA
9286**     Publications Division, Noordwijk, Netherlands.
9287**
9288*/
9289
9290
9291
9292int iauGc2gd ( int n, double xyz[3],
9293               double *elong, double *phi, double *height )
9294/*
9295**  - - - - - - - - -
9296**   i a u G c 2 g d
9297**  - - - - - - - - -
9298**
9299**  Transform geocentric coordinates to geodetic using the specified
9300**  reference ellipsoid.
9301**
9302**  This function is part of the International Astronomical Union's
9303**  SOFA (Standards of Fundamental Astronomy) software collection.
9304**
9305**  Status:  canonical transformation.
9306**
9307**  Given:
9308**     n       int        ellipsoid identifier (Note 1)
9309**     xyz     double[3]  geocentric vector (Note 2)
9310**
9311**  Returned:
9312**     elong   double     longitude (radians, east +ve, Note 3)
9313**     phi     double     latitude (geodetic, radians, Note 3)
9314**     height  double     height above ellipsoid (geodetic, Notes 2,3)
9315**
9316**  Returned (function value):
9317**            int         status:  0 = OK
9318**                                -1 = illegal identifier (Note 3)
9319**                                -2 = internal error (Note 3)
9320**
9321**  Notes:
9322**
9323**  1) The identifier n is a number that specifies the choice of
9324**     reference ellipsoid.  The following are supported:
9325**
9326**        n    ellipsoid
9327**
9328**        1     WGS84
9329**        2     GRS80
9330**        3     WGS72
9331**
9332**     The n value has no significance outside the SOFA software.  For
9333**     convenience, symbols WGS84 etc. are defined in sofam.h.
9334**
9335**  2) The geocentric vector (xyz, given) and height (height, returned)
9336**     are in meters.
9337**
9338**  3) An error status -1 means that the identifier n is illegal.  An
9339**     error status -2 is theoretically impossible.  In all error cases,
9340**     all three results are set to -1e9.
9341**
9342**  4) The inverse transformation is performed in the function iauGd2gc.
9343**
9344**  Called:
9345**     iauEform     Earth reference ellipsoids
9346**     iauGc2gde    geocentric to geodetic transformation, general
9347**
9348*/
9349
9350
9351
9352int iauGc2gde ( double a, double f, double xyz[3],
9353                double *elong, double *phi, double *height )
9354/*
9355**  - - - - - - - - - -
9356**   i a u G c 2 g d e
9357**  - - - - - - - - - -
9358**
9359**  Transform geocentric coordinates to geodetic for a reference
9360**  ellipsoid of specified form.
9361**
9362**  This function is part of the International Astronomical Union's
9363**  SOFA (Standards of Fundamental Astronomy) software collection.
9364**
9365**  Status:  support function.
9366**
9367**  Given:
9368**     a       double     equatorial radius (Notes 2,4)
9369**     f       double     flattening (Note 3)
9370**     xyz     double[3]  geocentric vector (Note 4)
9371**
9372**  Returned:
9373**     elong   double     longitude (radians, east +ve)
9374**     phi     double     latitude (geodetic, radians)
9375**     height  double     height above ellipsoid (geodetic, Note 4)
9376**
9377**  Returned (function value):
9378**             int        status:  0 = OK
9379**                                -1 = illegal f
9380**                                -2 = illegal a
9381**
9382**  Notes:
9383**
9384**  1) This function is based on the GCONV2H Fortran subroutine by
9385**     Toshio Fukushima (see reference).
9386**
9387**  2) The equatorial radius, a, can be in any units, but meters is
9388**     the conventional choice.
9389**
9390**  3) The flattening, f, is (for the Earth) a value around 0.00335,
9391**     i.e. around 1/298.
9392**
9393**  4) The equatorial radius, a, and the geocentric vector, xyz,
9394**     must be given in the same units, and determine the units of
9395**     the returned height, height.
9396**
9397**  5) If an error occurs (status < 0), elong, phi and height are
9398**     unchanged.
9399**
9400**  6) The inverse transformation is performed in the function
9401**     iauGd2gce.
9402**
9403**  7) The transformation for a standard ellipsoid (such as WGS84) can
9404**     more conveniently be performed by calling iauGc2gd, which uses a
9405**     numerical code to identify the required A and F values.
9406**
9407**  Reference:
9408**
9409**     Fukushima, T., "Transformation from Cartesian to geodetic
9410**     coordinates accelerated by Halley's method", J.Geodesy (2006)
9411**     79: 689-693
9412**
9413*/
9414
9415
9416
9417int iauGd2gc ( int n, double elong, double phi, double height,
9418               double xyz[3] )
9419/*
9420**  - - - - - - - - -
9421**   i a u G d 2 g c
9422**  - - - - - - - - -
9423**
9424**  Transform geodetic coordinates to geocentric using the specified
9425**  reference ellipsoid.
9426**
9427**  This function is part of the International Astronomical Union's
9428**  SOFA (Standards of Fundamental Astronomy) software collection.
9429**
9430**  Status:  canonical transformation.
9431**
9432**  Given:
9433**     n       int        ellipsoid identifier (Note 1)
9434**     elong   double     longitude (radians, east +ve)
9435**     phi     double     latitude (geodetic, radians, Note 3)
9436**     height  double     height above ellipsoid (geodetic, Notes 2,3)
9437**
9438**  Returned:
9439**     xyz     double[3]  geocentric vector (Note 2)
9440**
9441**  Returned (function value):
9442**             int        status:  0 = OK
9443**                                -1 = illegal identifier (Note 3)
9444**                                -2 = illegal case (Note 3)
9445**
9446**  Notes:
9447**
9448**  1) The identifier n is a number that specifies the choice of
9449**     reference ellipsoid.  The following are supported:
9450**
9451**        n    ellipsoid
9452**
9453**        1     WGS84
9454**        2     GRS80
9455**        3     WGS72
9456**
9457**     The n value has no significance outside the SOFA software.  For
9458**     convenience, symbols WGS84 etc. are defined in sofam.h.
9459**
9460**  2) The height (height, given) and the geocentric vector (xyz,
9461**     returned) are in meters.
9462**
9463**  3) No validation is performed on the arguments elong, phi and
9464**     height.  An error status -1 means that the identifier n is
9465**     illegal.  An error status -2 protects against cases that would
9466**     lead to arithmetic exceptions.  In all error cases, xyz is set
9467**     to zeros.
9468**
9469**  4) The inverse transformation is performed in the function iauGc2gd.
9470**
9471**  Called:
9472**     iauEform     Earth reference ellipsoids
9473**     iauGd2gce    geodetic to geocentric transformation, general
9474**     iauZp        zero p-vector
9475**
9476*/
9477
9478
9479
9480int iauGd2gce ( double a, double f, double elong, double phi,
9481                double height, double xyz[3] )
9482/*
9483**  - - - - - - - - - -
9484**   i a u G d 2 g c e
9485**  - - - - - - - - - -
9486**
9487**  Transform geodetic coordinates to geocentric for a reference
9488**  ellipsoid of specified form.
9489**
9490**  This function is part of the International Astronomical Union's
9491**  SOFA (Standards of Fundamental Astronomy) software collection.
9492**
9493**  Status:  support function.
9494**
9495**  Given:
9496**     a       double     equatorial radius (Notes 1,4)
9497**     f       double     flattening (Notes 2,4)
9498**     elong   double     longitude (radians, east +ve)
9499**     phi     double     latitude (geodetic, radians, Note 4)
9500**     height  double     height above ellipsoid (geodetic, Notes 3,4)
9501**
9502**  Returned:
9503**     xyz     double[3]  geocentric vector (Note 3)
9504**
9505**  Returned (function value):
9506**             int        status:  0 = OK
9507**                                -1 = illegal case (Note 4)
9508**  Notes:
9509**
9510**  1) The equatorial radius, a, can be in any units, but meters is
9511**     the conventional choice.
9512**
9513**  2) The flattening, f, is (for the Earth) a value around 0.00335,
9514**     i.e. around 1/298.
9515**
9516**  3) The equatorial radius, a, and the height, height, must be
9517**     given in the same units, and determine the units of the
9518**     returned geocentric vector, xyz.
9519**
9520**  4) No validation is performed on individual arguments.  The error
9521**     status -1 protects against (unrealistic) cases that would lead
9522**     to arithmetic exceptions.  If an error occurs, xyz is unchanged.
9523**
9524**  5) The inverse transformation is performed in the function
9525**     iauGc2gde.
9526**
9527**  6) The transformation for a standard ellipsoid (such as WGS84) can
9528**     more conveniently be performed by calling iauGd2gc,  which uses a
9529**     numerical code to identify the required a and f values.
9530**
9531**  References:
9532**
9533**     Green, R.M., Spherical Astronomy, Cambridge University Press,
9534**     (1985) Section 4.5, p96.
9535**
9536**     Explanatory Supplement to the Astronomical Almanac,
9537**     P. Kenneth Seidelmann (ed), University Science Books (1992),
9538**     Section 4.22, p202.
9539**
9540*/
9541
9542
9543
9544double iauGmst00(double uta, double utb, double tta, double ttb)
9545/*
9546**  - - - - - - - - - -
9547**   i a u G m s t 0 0
9548**  - - - - - - - - - -
9549**
9550**  Greenwich mean sidereal time (model consistent with IAU 2000
9551**  resolutions).
9552**
9553**  This function is part of the International Astronomical Union's
9554**  SOFA (Standards Of Fundamental Astronomy) software collection.
9555**
9556**  Status:  canonical model.
9557**
9558**  Given:
9559**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
9560**     tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)
9561**
9562**  Returned (function value):
9563**                double    Greenwich mean sidereal time (radians)
9564**
9565**  Notes:
9566**
9567**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
9568**     Julian Dates, apportioned in any convenient way between the
9569**     argument pairs.  For example, JD(UT1)=2450123.7 could be
9570**     expressed in any of these ways, among others:
9571**
9572**            Part A         Part B
9573**
9574**         2450123.7           0.0       (JD method)
9575**         2451545.0       -1421.3       (J2000 method)
9576**         2400000.5       50123.2       (MJD method)
9577**         2450123.5           0.2       (date & time method)
9578**
9579**     The JD method is the most natural and convenient to use in
9580**     cases where the loss of several decimal digits of resolution
9581**     is acceptable (in the case of UT;  the TT is not at all critical
9582**     in this respect).  The J2000 and MJD methods are good compromises
9583**     between resolution and convenience.  For UT, the date & time
9584**     method is best matched to the algorithm that is used by the Earth
9585**     Rotation Angle function, called internally:  maximum precision is
9586**     delivered when the uta argument is for 0hrs UT1 on the day in
9587**     question and the utb argument lies in the range 0 to 1, or vice
9588**     versa.
9589**
9590**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation
9591**     and TT to predict the effects of precession.  If UT1 is used for
9592**     both purposes, errors of order 100 microarcseconds result.
9593**
9594**  3) This GMST is compatible with the IAU 2000 resolutions and must be
9595**     used only in conjunction with other IAU 2000 compatible
9596**     components such as precession-nutation and equation of the
9597**     equinoxes.
9598**
9599**  4) The result is returned in the range 0 to 2pi.
9600**
9601**  5) The algorithm is from Capitaine et al. (2003) and IERS
9602**     Conventions 2003.
9603**
9604**  Called:
9605**     iauEra00     Earth rotation angle, IAU 2000
9606**     iauAnp       normalize angle into range 0 to 2pi
9607**
9608**  References:
9609**
9610**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
9611**     implement the IAU 2000 definition of UT1", Astronomy &
9612**     Astrophysics, 406, 1135-1149 (2003)
9613**
9614**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
9615**     IERS Technical Note No. 32, BKG (2004)
9616**
9617*/
9618
9619
9620
9621double iauGmst06(double uta, double utb, double tta, double ttb)
9622/*
9623**  - - - - - - - - - -
9624**   i a u G m s t 0 6
9625**  - - - - - - - - - -
9626**
9627**  Greenwich mean sidereal time (consistent with IAU 2006 precession).
9628**
9629**  This function is part of the International Astronomical Union's
9630**  SOFA (Standards Of Fundamental Astronomy) software collection.
9631**
9632**  Status:  canonical model.
9633**
9634**  Given:
9635**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
9636**     tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)
9637**
9638**  Returned (function value):
9639**                double    Greenwich mean sidereal time (radians)
9640**
9641**  Notes:
9642**
9643**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
9644**     Julian Dates, apportioned in any convenient way between the
9645**     argument pairs.  For example, JD=2450123.7 could be expressed in
9646**     any of these ways, among others:
9647**
9648**            Part A        Part B
9649**
9650**         2450123.7           0.0       (JD method)
9651**         2451545.0       -1421.3       (J2000 method)
9652**         2400000.5       50123.2       (MJD method)
9653**         2450123.5           0.2       (date & time method)
9654**
9655**     The JD method is the most natural and convenient to use in
9656**     cases where the loss of several decimal digits of resolution
9657**     is acceptable (in the case of UT;  the TT is not at all critical
9658**     in this respect).  The J2000 and MJD methods are good compromises
9659**     between resolution and convenience.  For UT, the date & time
9660**     method is best matched to the algorithm that is used by the Earth
9661**     rotation angle function, called internally:  maximum precision is
9662**     delivered when the uta argument is for 0hrs UT1 on the day in
9663**     question and the utb argument lies in the range 0 to 1, or vice
9664**     versa.
9665**
9666**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation
9667**     and TT to predict the effects of precession.  If UT1 is used for
9668**     both purposes, errors of order 100 microarcseconds result.
9669**
9670**  3) This GMST is compatible with the IAU 2006 precession and must not
9671**     be used with other precession models.
9672**
9673**  4) The result is returned in the range 0 to 2pi.
9674**
9675**  Called:
9676**     iauEra00     Earth rotation angle, IAU 2000
9677**     iauAnp       normalize angle into range 0 to 2pi
9678**
9679**  Reference:
9680**
9681**     Capitaine, N., Wallace, P.T. & Chapront, J., 2005,
9682**     Astron.Astrophys. 432, 355
9683**
9684*/
9685
9686
9687
9688double iauGmst82(double dj1, double dj2)
9689/*
9690**  - - - - - - - - - -
9691**   i a u G m s t 8 2
9692**  - - - - - - - - - -
9693**
9694**  Universal Time to Greenwich mean sidereal time (IAU 1982 model).
9695**
9696**  This function is part of the International Astronomical Union's
9697**  SOFA (Standards Of Fundamental Astronomy) software collection.
9698**
9699**  Status:  canonical model.
9700**
9701**  Given:
9702**     dj1,dj2    double    UT1 Julian Date (see note)
9703**
9704**  Returned (function value):
9705**                double    Greenwich mean sidereal time (radians)
9706**
9707**  Notes:
9708**
9709**  1) The UT1 date dj1+dj2 is a Julian Date, apportioned in any
9710**     convenient way between the arguments dj1 and dj2.  For example,
9711**     JD(UT1)=2450123.7 could be expressed in any of these ways,
9712**     among others:
9713**
9714**             dj1            dj2
9715**
9716**         2450123.7          0          (JD method)
9717**          2451545        -1421.3       (J2000 method)
9718**         2400000.5       50123.2       (MJD method)
9719**         2450123.5         0.2         (date & time method)
9720**
9721**     The JD method is the most natural and convenient to use in
9722**     cases where the loss of several decimal digits of resolution
9723**     is acceptable.  The J2000 and MJD methods are good compromises
9724**     between resolution and convenience.  The date & time method is
9725**     best matched to the algorithm used:  maximum accuracy (or, at
9726**     least, minimum noise) is delivered when the dj1 argument is for
9727**     0hrs UT1 on the day in question and the dj2 argument lies in the
9728**     range 0 to 1, or vice versa.
9729**
9730**  2) The algorithm is based on the IAU 1982 expression.  This is
9731**     always described as giving the GMST at 0 hours UT1.  In fact, it
9732**     gives the difference between the GMST and the UT, the steady
9733**     4-minutes-per-day drawing-ahead of ST with respect to UT.  When
9734**     whole days are ignored, the expression happens to equal the GMST
9735**     at 0 hours UT1 each day.
9736**
9737**  3) In this function, the entire UT1 (the sum of the two arguments
9738**     dj1 and dj2) is used directly as the argument for the standard
9739**     formula, the constant term of which is adjusted by 12 hours to
9740**     take account of the noon phasing of Julian Date.  The UT1 is then
9741**     added, but omitting whole days to conserve accuracy.
9742**
9743**  Called:
9744**     iauAnp       normalize angle into range 0 to 2pi
9745**
9746**  References:
9747**
9748**     Transactions of the International Astronomical Union,
9749**     XVIII B, 67 (1983).
9750**
9751**     Aoki et al., Astron.Astrophys., 105, 359-361 (1982).
9752**
9753*/
9754
9755
9756
9757double iauGst00a(double uta, double utb, double tta, double ttb)
9758/*
9759**  - - - - - - - - - -
9760**   i a u G s t 0 0 a
9761**  - - - - - - - - - -
9762**
9763**  Greenwich apparent sidereal time (consistent with IAU 2000
9764**  resolutions).
9765**
9766**  This function is part of the International Astronomical Union's
9767**  SOFA (Standards Of Fundamental Astronomy) software collection.
9768**
9769**  Status:  canonical model.
9770**
9771**  Given:
9772**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
9773**     tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)
9774**
9775**  Returned (function value):
9776**                double    Greenwich apparent sidereal time (radians)
9777**
9778**  Notes:
9779**
9780**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
9781**     Julian Dates, apportioned in any convenient way between the
9782**     argument pairs.  For example, JD(UT1)=2450123.7 could be
9783**     expressed in any of these ways, among others:
9784**
9785**             uta            utb
9786**
9787**         2450123.7           0.0       (JD method)
9788**         2451545.0       -1421.3       (J2000 method)
9789**         2400000.5       50123.2       (MJD method)
9790**         2450123.5           0.2       (date & time method)
9791**
9792**     The JD method is the most natural and convenient to use in
9793**     cases where the loss of several decimal digits of resolution
9794**     is acceptable (in the case of UT;  the TT is not at all critical
9795**     in this respect).  The J2000 and MJD methods are good compromises
9796**     between resolution and convenience.  For UT, the date & time
9797**     method is best matched to the algorithm that is used by the Earth
9798**     Rotation Angle function, called internally:  maximum precision is
9799**     delivered when the uta argument is for 0hrs UT1 on the day in
9800**     question and the utb argument lies in the range 0 to 1, or vice
9801**     versa.
9802**
9803**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation
9804**     and TT to predict the effects of precession-nutation.  If UT1 is
9805**     used for both purposes, errors of order 100 microarcseconds
9806**     result.
9807**
9808**  3) This GAST is compatible with the IAU 2000 resolutions and must be
9809**     used only in conjunction with other IAU 2000 compatible
9810**     components such as precession-nutation.
9811**
9812**  4) The result is returned in the range 0 to 2pi.
9813**
9814**  5) The algorithm is from Capitaine et al. (2003) and IERS
9815**     Conventions 2003.
9816**
9817**  Called:
9818**     iauGmst00    Greenwich mean sidereal time, IAU 2000
9819**     iauEe00a     equation of the equinoxes, IAU 2000A
9820**     iauAnp       normalize angle into range 0 to 2pi
9821**
9822**  References:
9823**
9824**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
9825**     implement the IAU 2000 definition of UT1", Astronomy &
9826**     Astrophysics, 406, 1135-1149 (2003)
9827**
9828**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
9829**     IERS Technical Note No. 32, BKG (2004)
9830**
9831*/
9832
9833
9834
9835double iauGst00b(double uta, double utb)
9836/*
9837**  - - - - - - - - - -
9838**   i a u G s t 0 0 b
9839**  - - - - - - - - - -
9840**
9841**  Greenwich apparent sidereal time (consistent with IAU 2000
9842**  resolutions but using the truncated nutation model IAU 2000B).
9843**
9844**  This function is part of the International Astronomical Union's
9845**  SOFA (Standards Of Fundamental Astronomy) software collection.
9846**
9847**  Status:  support function.
9848**
9849**  Given:
9850**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
9851**
9852**  Returned (function value):
9853**                double    Greenwich apparent sidereal time (radians)
9854**
9855**  Notes:
9856**
9857**  1) The UT1 date uta+utb is a Julian Date, apportioned in any
9858**     convenient way between the argument pair.  For example,
9859**     JD(UT1)=2450123.7 could be expressed in any of these ways,
9860**     among others:
9861**
9862**             uta            utb
9863**
9864**         2450123.7           0.0       (JD method)
9865**         2451545.0       -1421.3       (J2000 method)
9866**         2400000.5       50123.2       (MJD method)
9867**         2450123.5           0.2       (date & time method)
9868**
9869**     The JD method is the most natural and convenient to use in cases
9870**     where the loss of several decimal digits of resolution is
9871**     acceptable.  The J2000 and MJD methods are good compromises
9872**     between resolution and convenience.  For UT, the date & time
9873**     method is best matched to the algorithm that is used by the Earth
9874**     Rotation Angle function, called internally:  maximum precision is
9875**     delivered when the uta argument is for 0hrs UT1 on the day in
9876**     question and the utb argument lies in the range 0 to 1, or vice
9877**     versa.
9878**
9879**  2) The result is compatible with the IAU 2000 resolutions, except
9880**     that accuracy has been compromised for the sake of speed and
9881**     convenience in two respects:
9882**
9883**     . UT is used instead of TDB (or TT) to compute the precession
9884**       component of GMST and the equation of the equinoxes.  This
9885**       results in errors of order 0.1 mas at present.
9886**
9887**     . The IAU 2000B abridged nutation model (McCarthy & Luzum, 2003)
9888**       is used, introducing errors of up to 1 mas.
9889**
9890**  3) This GAST is compatible with the IAU 2000 resolutions and must be
9891**     used only in conjunction with other IAU 2000 compatible
9892**     components such as precession-nutation.
9893**
9894**  4) The result is returned in the range 0 to 2pi.
9895**
9896**  5) The algorithm is from Capitaine et al. (2003) and IERS
9897**     Conventions 2003.
9898**
9899**  Called:
9900**     iauGmst00    Greenwich mean sidereal time, IAU 2000
9901**     iauEe00b     equation of the equinoxes, IAU 2000B
9902**     iauAnp       normalize angle into range 0 to 2pi
9903**
9904**  References:
9905**
9906**     Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
9907**     implement the IAU 2000 definition of UT1", Astronomy &
9908**     Astrophysics, 406, 1135-1149 (2003)
9909**
9910**     McCarthy, D.D. & Luzum, B.J., "An abridged model of the
9911**     precession-nutation of the celestial pole", Celestial Mechanics &
9912**     Dynamical Astronomy, 85, 37-49 (2003)
9913**
9914**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
9915**     IERS Technical Note No. 32, BKG (2004)
9916**
9917*/
9918
9919
9920
9921double iauGst06(double uta, double utb, double tta, double ttb,
9922                double rnpb[3][3])
9923/*
9924**  - - - - - - - - -
9925**   i a u G s t 0 6
9926**  - - - - - - - - -
9927**
9928**  Greenwich apparent sidereal time, IAU 2006, given the NPB matrix.
9929**
9930**  This function is part of the International Astronomical Union's
9931**  SOFA (Standards Of Fundamental Astronomy) software collection.
9932**
9933**  Status:  support function.
9934**
9935**  Given:
9936**     uta,utb  double        UT1 as a 2-part Julian Date (Notes 1,2)
9937**     tta,ttb  double        TT as a 2-part Julian Date (Notes 1,2)
9938**     rnpb     double[3][3]  nutation x precession x bias matrix
9939**
9940**  Returned (function value):
9941**              double        Greenwich apparent sidereal time (radians)
9942**
9943**  Notes:
9944**
9945**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
9946**     Julian Dates, apportioned in any convenient way between the
9947**     argument pairs.  For example, JD(UT1)=2450123.7 could be
9948**     expressed in any of these ways, among others:
9949**
9950**             uta            utb
9951**
9952**         2450123.7           0.0       (JD method)
9953**         2451545.0       -1421.3       (J2000 method)
9954**         2400000.5       50123.2       (MJD method)
9955**         2450123.5           0.2       (date & time method)
9956**
9957**     The JD method is the most natural and convenient to use in
9958**     cases where the loss of several decimal digits of resolution
9959**     is acceptable (in the case of UT;  the TT is not at all critical
9960**     in this respect).  The J2000 and MJD methods are good compromises
9961**     between resolution and convenience.  For UT, the date & time
9962**     method is best matched to the algorithm that is used by the Earth
9963**     rotation angle function, called internally:  maximum precision is
9964**     delivered when the uta argument is for 0hrs UT1 on the day in
9965**     question and the utb argument lies in the range 0 to 1, or vice
9966**     versa.
9967**
9968**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation
9969**     and TT to predict the effects of precession-nutation.  If UT1 is
9970**     used for both purposes, errors of order 100 microarcseconds
9971**     result.
9972**
9973**  3) Although the function uses the IAU 2006 series for s+XY/2, it is
9974**     otherwise independent of the precession-nutation model and can in
9975**     practice be used with any equinox-based NPB matrix.
9976**
9977**  4) The result is returned in the range 0 to 2pi.
9978**
9979**  Called:
9980**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
9981**     iauS06       the CIO locator s, given X,Y, IAU 2006
9982**     iauAnp       normalize angle into range 0 to 2pi
9983**     iauEra00     Earth rotation angle, IAU 2000
9984**     iauEors      equation of the origins, given NPB matrix and s
9985**
9986**  Reference:
9987**
9988**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
9989**
9990*/
9991
9992
9993
9994double iauGst06a(double uta, double utb, double tta, double ttb)
9995/*
9996**  - - - - - - - - - -
9997**   i a u G s t 0 6 a
9998**  - - - - - - - - - -
9999**
10000**  Greenwich apparent sidereal time (consistent with IAU 2000 and 2006
10001**  resolutions).
10002**
10003**  This function is part of the International Astronomical Union's
10004**  SOFA (Standards Of Fundamental Astronomy) software collection.
10005**
10006**  Status:  canonical model.
10007**
10008**  Given:
10009**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
10010**     tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)
10011**
10012**  Returned (function value):
10013**                double    Greenwich apparent sidereal time (radians)
10014**
10015**  Notes:
10016**
10017**  1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
10018**     Julian Dates, apportioned in any convenient way between the
10019**     argument pairs.  For example, JD(UT1)=2450123.7 could be
10020**     expressed in any of these ways, among others:
10021**
10022**             uta            utb
10023**
10024**         2450123.7           0.0       (JD method)
10025**         2451545.0       -1421.3       (J2000 method)
10026**         2400000.5       50123.2       (MJD method)
10027**         2450123.5           0.2       (date & time method)
10028**
10029**     The JD method is the most natural and convenient to use in
10030**     cases where the loss of several decimal digits of resolution
10031**     is acceptable (in the case of UT;  the TT is not at all critical
10032**     in this respect).  The J2000 and MJD methods are good compromises
10033**     between resolution and convenience.  For UT, the date & time
10034**     method is best matched to the algorithm that is used by the Earth
10035**     rotation angle function, called internally:  maximum precision is
10036**     delivered when the uta argument is for 0hrs UT1 on the day in
10037**     question and the utb argument lies in the range 0 to 1, or vice
10038**     versa.
10039**
10040**  2) Both UT1 and TT are required, UT1 to predict the Earth rotation
10041**     and TT to predict the effects of precession-nutation.  If UT1 is
10042**     used for both purposes, errors of order 100 microarcseconds
10043**     result.
10044**
10045**  3) This GAST is compatible with the IAU 2000/2006 resolutions and
10046**     must be used only in conjunction with IAU 2006 precession and
10047**     IAU 2000A nutation.
10048**
10049**  4) The result is returned in the range 0 to 2pi.
10050**
10051**  Called:
10052**     iauPnm06a    classical NPB matrix, IAU 2006/2000A
10053**     iauGst06     Greenwich apparent ST, IAU 2006, given NPB matrix
10054**
10055**  Reference:
10056**
10057**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
10058**
10059*/
10060
10061
10062
10063double iauGst94(double uta, double utb)
10064/*
10065**  - - - - - - - - -
10066**   i a u G s t 9 4
10067**  - - - - - - - - -
10068**
10069**  Greenwich apparent sidereal time (consistent with IAU 1982/94
10070**  resolutions).
10071**
10072**  This function is part of the International Astronomical Union's
10073**  SOFA (Standards Of Fundamental Astronomy) software collection.
10074**
10075**  Status:  support function.
10076**
10077**  Given:
10078**     uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
10079**
10080**  Returned (function value):
10081**                double    Greenwich apparent sidereal time (radians)
10082**
10083**  Notes:
10084**
10085**  1) The UT1 date uta+utb is a Julian Date, apportioned in any
10086**     convenient way between the argument pair.  For example,
10087**     JD(UT1)=2450123.7 could be expressed in any of these ways, among
10088**     others:
10089**
10090**             uta            utb
10091**
10092**         2450123.7           0.0       (JD method)
10093**         2451545.0       -1421.3       (J2000 method)
10094**         2400000.5       50123.2       (MJD method)
10095**         2450123.5           0.2       (date & time method)
10096**
10097**     The JD method is the most natural and convenient to use in cases
10098**     where the loss of several decimal digits of resolution is
10099**     acceptable.  The J2000 and MJD methods are good compromises
10100**     between resolution and convenience.  For UT, the date & time
10101**     method is best matched to the algorithm that is used by the Earth
10102**     Rotation Angle function, called internally:  maximum precision is
10103**     delivered when the uta argument is for 0hrs UT1 on the day in
10104**     question and the utb argument lies in the range 0 to 1, or vice
10105**     versa.
10106**
10107**  2) The result is compatible with the IAU 1982 and 1994 resolutions,
10108**     except that accuracy has been compromised for the sake of
10109**     convenience in that UT is used instead of TDB (or TT) to compute
10110**     the equation of the equinoxes.
10111**
10112**  3) This GAST must be used only in conjunction with contemporaneous
10113**     IAU standards such as 1976 precession, 1980 obliquity and 1982
10114**     nutation.  It is not compatible with the IAU 2000 resolutions.
10115**
10116**  4) The result is returned in the range 0 to 2pi.
10117**
10118**  Called:
10119**     iauGmst82    Greenwich mean sidereal time, IAU 1982
10120**     iauEqeq94    equation of the equinoxes, IAU 1994
10121**     iauAnp       normalize angle into range 0 to 2pi
10122**
10123**  References:
10124**
10125**     Explanatory Supplement to the Astronomical Almanac,
10126**     P. Kenneth Seidelmann (ed), University Science Books (1992)
10127**
10128**     IAU Resolution C7, Recommendation 3 (1994)
10129**
10130*/
10131
10132
10133
10134void iauH2fk5(double rh, double dh,
10135              double drh, double ddh, double pxh, double rvh,
10136              double *r5, double *d5,
10137              double *dr5, double *dd5, double *px5, double *rv5)
10138/*
10139**  - - - - - - - - -
10140**   i a u H 2 f k 5
10141**  - - - - - - - - -
10142**
10143**  Transform Hipparcos star data into the FK5 (J2000.0) system.
10144**
10145**  This function is part of the International Astronomical Union's
10146**  SOFA (Standards Of Fundamental Astronomy) software collection.
10147**
10148**  Status:  support function.
10149**
10150**  Given (all Hipparcos, epoch J2000.0):
10151**     rh      double    RA (radians)
10152**     dh      double    Dec (radians)
10153**     drh     double    proper motion in RA (dRA/dt, rad/Jyear)
10154**     ddh     double    proper motion in Dec (dDec/dt, rad/Jyear)
10155**     pxh     double    parallax (arcsec)
10156**     rvh     double    radial velocity (km/s, positive = receding)
10157**
10158**  Returned (all FK5, equinox J2000.0, epoch J2000.0):
10159**     r5      double    RA (radians)
10160**     d5      double    Dec (radians)
10161**     dr5     double    proper motion in RA (dRA/dt, rad/Jyear)
10162**     dd5     double    proper motion in Dec (dDec/dt, rad/Jyear)
10163**     px5     double    parallax (arcsec)
10164**     rv5     double    radial velocity (km/s, positive = receding)
10165**
10166**  Notes:
10167**
10168**  1) This function transforms Hipparcos star positions and proper
10169**     motions into FK5 J2000.0.
10170**
10171**  2) The proper motions in RA are dRA/dt rather than
10172**     cos(Dec)*dRA/dt, and are per year rather than per century.
10173**
10174**  3) The FK5 to Hipparcos transformation is modeled as a pure
10175**     rotation and spin;  zonal errors in the FK5 catalog are not
10176**     taken into account.
10177**
10178**  4) See also iauFk52h, iauFk5hz, iauHfk5z.
10179**
10180**  Called:
10181**     iauStarpv    star catalog data to space motion pv-vector
10182**     iauFk5hip    FK5 to Hipparcos rotation and spin
10183**     iauRv2m      r-vector to r-matrix
10184**     iauRxp       product of r-matrix and p-vector
10185**     iauTrxp      product of transpose of r-matrix and p-vector
10186**     iauPxp       vector product of two p-vectors
10187**     iauPmp       p-vector minus p-vector
10188**     iauPvstar    space motion pv-vector to star catalog data
10189**
10190**  Reference:
10191**
10192**     F.Mignard & M.Froeschle, Astron.Astrophys., 354, 732-739 (2000).
10193**
10194*/
10195
10196
10197
10198void iauHd2ae (double ha, double dec, double phi,
10199               double *az, double *el)
10200/*
10201**  - - - - - - - - -
10202**   i a u H d 2 a e
10203**  - - - - - - - - -
10204**
10205**  Equatorial to horizon coordinates:  transform hour angle and
10206**  declination to azimuth and altitude.
10207**
10208**  This function is part of the International Astronomical Union's
10209**  SOFA (Standards of Fundamental Astronomy) software collection.
10210**
10211**  Status:  support function.
10212**
10213**  Given:
10214**     ha       double       hour angle (local)
10215**     dec      double       declination
10216**     phi      double       site latitude
10217**
10218**  Returned:
10219**     *az      double       azimuth
10220**     *el      double       altitude (informally, elevation)
10221**
10222**  Notes:
10223**
10224**  1)  All the arguments are angles in radians.
10225**
10226**  2)  Azimuth is returned in the range 0-2pi;  north is zero, and east
10227**      is +pi/2.  Altitude is returned in the range +/- pi/2.
10228**
10229**  3)  The latitude phi is pi/2 minus the angle between the Earth's
10230**      rotation axis and the adopted zenith.  In many applications it
10231**      will be sufficient to use the published geodetic latitude of the
10232**      site.  In very precise (sub-arcsecond) applications, phi can be
10233**      corrected for polar motion.
10234**
10235**  4)  The returned azimuth az is with respect to the rotational north
10236**      pole, as opposed to the ITRS pole, and for sub-arcsecond
10237**      accuracy will need to be adjusted for polar motion if it is to
10238**      be with respect to north on a map of the Earth's surface.
10239**
10240**  5)  Should the user wish to work with respect to the astronomical
10241**      zenith rather than the geodetic zenith, phi will need to be
10242**      adjusted for deflection of the vertical (often tens of
10243**      arcseconds), and the zero point of the hour angle ha will also
10244**      be affected.
10245**
10246**  6)  The transformation is the same as Vh = Rz(pi)*Ry(pi/2-phi)*Ve,
10247**      where Vh and Ve are lefthanded unit vectors in the (az,el) and
10248**      (ha,dec) systems respectively and Ry and Rz are rotations about
10249**      first the y-axis and then the z-axis.  (n.b. Rz(pi) simply
10250**      reverses the signs of the x and y components.)  For efficiency,
10251**      the algorithm is written out rather than calling other utility
10252**      functions.  For applications that require even greater
10253**      efficiency, additional savings are possible if constant terms
10254**      such as functions of latitude are computed once and for all.
10255**
10256**  7)  Again for efficiency, no range checking of arguments is carried
10257**      out.
10258**
10259**  Last revision:   2021 February 24
10260**
10261**  SOFA release 2021-05-12
10262**
10263**  Copyright (C) 2021 IAU SOFA Board.  See notes at end.
10264*/
10265{
10266   double sh, ch, sd, cd, sp, cp, x, y, z, r, a;
10267
10268
10269/* Useful trig functions. */
10270   sh = sin(ha);
10271   ch = cos(ha);
10272   sd = sin(dec);
10273   cd = cos(dec);
10274   sp = sin(phi);
10275   cp = cos(phi);
10276
10277/* Az,Alt unit vector. */
10278   x = - ch*cd*sp + sd*cp;
10279   y = - sh*cd;
10280   z = ch*cd*cp + sd*sp;
10281
10282/* To spherical. */
10283   r = sqrt(x*x + y*y);
10284   a = (r != 0.0) ? atan2(y,x) : 0.0;
10285   *az = (a < 0.0) ? a+D2PI : a;
10286   *el = atan2(z,r);
10287
10288/* Finished. */
10289
10290/*----------------------------------------------------------------------
10291**
10292**  Copyright (C) 2021
10293**  Standards Of Fundamental Astronomy Board
10294**  of the International Astronomical Union.
10295**
10296**  =====================
10297**  SOFA Software License
10298**  =====================
10299**
10300**  NOTICE TO USER:
10301**
10302**  BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
10303**  CONDITIONS WHICH APPLY TO ITS USE.
10304**
10305**  1. The Software is owned by the IAU SOFA Board ("SOFA").
10306**
10307**  2. Permission is granted to anyone to use the SOFA software for any
10308**     purpose, including commercial applications, free of charge and
10309**     without payment of royalties, subject to the conditions and
10310**     restrictions listed below.
10311**
10312**  3. You (the user) may copy and distribute SOFA source code to others,
10313**     and use and adapt its code and algorithms in your own software,
10314**     on a world-wide, royalty-free basis.  That portion of your
10315**     distribution that does not consist of intact and unchanged copies
10316**     of SOFA source code files is a "derived work" that must comply
10317**     with the following requirements:
10318**
10319**     a) Your work shall be marked or carry a statement that it
10320**        (i) uses routines and computations derived by you from
10321**        software provided by SOFA under license to you; and
10322**        (ii) does not itself constitute software provided by and/or
10323**        endorsed by SOFA.
10324**
10325**     b) The source code of your derived work must contain descriptions
10326**        of how the derived work is based upon, contains and/or differs
10327**        from the original SOFA software.
10328**
10329**     c) The names of all routines in your derived work shall not
10330**        include the prefix "iau" or "sofa" or trivial modifications
10331**        thereof such as changes of case.
10332**
10333**     d) The origin of the SOFA components of your derived work must
10334**        not be misrepresented;  you must not claim that you wrote the
10335**        original software, nor file a patent application for SOFA
10336**        software or algorithms embedded in the SOFA software.
10337**
10338**     e) These requirements must be reproduced intact in any source
10339**        distribution and shall apply to anyone to whom you have
10340**        granted a further right to modify the source code of your
10341**        derived work.
10342**
10343**     Note that, as originally distributed, the SOFA software is
10344**     intended to be a definitive implementation of the IAU standards,
10345**     and consequently third-party modifications are discouraged.  All
10346**     variations, no matter how minor, must be explicitly marked as
10347**     such, as explained above.
10348**
10349**  4. You shall not cause the SOFA software to be brought into
10350**     disrepute, either by misuse, or use for inappropriate tasks, or
10351**     by inappropriate modification.
10352**
10353**  5. The SOFA software is provided "as is" and SOFA makes no warranty
10354**     as to its use or performance.   SOFA does not and cannot warrant
10355**     the performance or results which the user may obtain by using the
10356**     SOFA software.  SOFA makes no warranties, express or implied, as
10357**     to non-infringement of third party rights, merchantability, or
10358**     fitness for any particular purpose.  In no event will SOFA be
10359**     liable to the user for any consequential, incidental, or special
10360**     damages, including any lost profits or lost savings, even if a
10361**     SOFA representative has been advised of such damages, or for any
10362**     claim by any third party.
10363**
10364**  6. The provision of any version of the SOFA software under the terms
10365**     and conditions specified herein does not imply that future
10366**     versions will also be made available under the same terms and
10367**     conditions.
10368*
10369**  In any published work or commercial product which uses the SOFA
10370**  software directly, acknowledgement (see www.iausofa.org) is
10371**  appreciated.
10372**
10373**  Correspondence concerning SOFA software should be addressed as
10374**  follows:
10375**
10376**      By email:  sofa@ukho.gov.uk
10377**      By post:   IAU SOFA Center
10378**                 HM Nautical Almanac Office
10379**                 UK Hydrographic Office
10380**                 Admiralty Way, Taunton
10381**                 Somerset, TA1 2DN
10382**                 United Kingdom
10383**
10384**--------------------------------------------------------------------*/
10385}
10386
10387
10388
10389double iauHd2pa (double ha, double dec, double phi)
10390/*
10391**  - - - - - - - - -
10392**   i a u H d 2 p a
10393**  - - - - - - - - -
10394**
10395**  Parallactic angle for a given hour angle and declination.
10396**
10397**  This function is part of the International Astronomical Union's
10398**  SOFA (Standards of Fundamental Astronomy) software collection.
10399**
10400**  Status:  support function.
10401**
10402**  Given:
10403**     ha     double     hour angle
10404**     dec    double     declination
10405**     phi    double     site latitude
10406**
10407**  Returned (function value):
10408**            double     parallactic angle
10409**
10410**  Notes:
10411**
10412**  1)  All the arguments are angles in radians.
10413**
10414**  2)  The parallactic angle at a point in the sky is the position
10415**      angle of the vertical, i.e. the angle between the directions to
10416**      the north celestial pole and to the zenith respectively.
10417**
10418**  3)  The result is returned in the range -pi to +pi.
10419**
10420**  4)  At the pole itself a zero result is returned.
10421**
10422**  5)  The latitude phi is pi/2 minus the angle between the Earth's
10423**      rotation axis and the adopted zenith.  In many applications it
10424**      will be sufficient to use the published geodetic latitude of the
10425**      site.  In very precise (sub-arcsecond) applications, phi can be
10426**      corrected for polar motion.
10427**
10428**  6)  Should the user wish to work with respect to the astronomical
10429**      zenith rather than the geodetic zenith, phi will need to be
10430**      adjusted for deflection of the vertical (often tens of
10431**      arcseconds), and the zero point of the hour angle ha will also
10432**      be affected.
10433**
10434**  Reference:
10435**     Smart, W.M., "Spherical Astronomy", Cambridge University Press,
10436**     6th edition (Green, 1977), p49.
10437**
10438**  Last revision:   2017 September 12
10439**
10440**  SOFA release 2021-05-12
10441**
10442**  Copyright (C) 2021 IAU SOFA Board.  See notes at end.
10443*/
10444{
10445   double cp, cqsz, sqsz;
10446
10447
10448   cp = cos(phi);
10449   sqsz = cp*sin(ha);
10450   cqsz = sin(phi)*cos(dec) - cp*sin(dec)*cos(ha);
10451   return ( ( sqsz != 0.0 || cqsz != 0.0 ) ? atan2(sqsz,cqsz) : 0.0 );
10452
10453/* Finished. */
10454
10455/*----------------------------------------------------------------------
10456**
10457**  Copyright (C) 2021
10458**  Standards Of Fundamental Astronomy Board
10459**  of the International Astronomical Union.
10460**
10461**  =====================
10462**  SOFA Software License
10463**  =====================
10464**
10465**  NOTICE TO USER:
10466**
10467**  BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
10468**  CONDITIONS WHICH APPLY TO ITS USE.
10469**
10470**  1. The Software is owned by the IAU SOFA Board ("SOFA").
10471**
10472**  2. Permission is granted to anyone to use the SOFA software for any
10473**     purpose, including commercial applications, free of charge and
10474**     without payment of royalties, subject to the conditions and
10475**     restrictions listed below.
10476**
10477**  3. You (the user) may copy and distribute SOFA source code to others,
10478**     and use and adapt its code and algorithms in your own software,
10479**     on a world-wide, royalty-free basis.  That portion of your
10480**     distribution that does not consist of intact and unchanged copies
10481**     of SOFA source code files is a "derived work" that must comply
10482**     with the following requirements:
10483**
10484**     a) Your work shall be marked or carry a statement that it
10485**        (i) uses routines and computations derived by you from
10486**        software provided by SOFA under license to you; and
10487**        (ii) does not itself constitute software provided by and/or
10488**        endorsed by SOFA.
10489**
10490**     b) The source code of your derived work must contain descriptions
10491**        of how the derived work is based upon, contains and/or differs
10492**        from the original SOFA software.
10493**
10494**     c) The names of all routines in your derived work shall not
10495**        include the prefix "iau" or "sofa" or trivial modifications
10496**        thereof such as changes of case.
10497**
10498**     d) The origin of the SOFA components of your derived work must
10499**        not be misrepresented;  you must not claim that you wrote the
10500**        original software, nor file a patent application for SOFA
10501**        software or algorithms embedded in the SOFA software.
10502**
10503**     e) These requirements must be reproduced intact in any source
10504**        distribution and shall apply to anyone to whom you have
10505**        granted a further right to modify the source code of your
10506**        derived work.
10507**
10508**     Note that, as originally distributed, the SOFA software is
10509**     intended to be a definitive implementation of the IAU standards,
10510**     and consequently third-party modifications are discouraged.  All
10511**     variations, no matter how minor, must be explicitly marked as
10512**     such, as explained above.
10513**
10514**  4. You shall not cause the SOFA software to be brought into
10515**     disrepute, either by misuse, or use for inappropriate tasks, or
10516**     by inappropriate modification.
10517**
10518**  5. The SOFA software is provided "as is" and SOFA makes no warranty
10519**     as to its use or performance.   SOFA does not and cannot warrant
10520**     the performance or results which the user may obtain by using the
10521**     SOFA software.  SOFA makes no warranties, express or implied, as
10522**     to non-infringement of third party rights, merchantability, or
10523**     fitness for any particular purpose.  In no event will SOFA be
10524**     liable to the user for any consequential, incidental, or special
10525**     damages, including any lost profits or lost savings, even if a
10526**     SOFA representative has been advised of such damages, or for any
10527**     claim by any third party.
10528**
10529**  6. The provision of any version of the SOFA software under the terms
10530**     and conditions specified herein does not imply that future
10531**     versions will also be made available under the same terms and
10532**     conditions.
10533*
10534**  In any published work or commercial product which uses the SOFA
10535**  software directly, acknowledgement (see www.iausofa.org) is
10536**  appreciated.
10537**
10538**  Correspondence concerning SOFA software should be addressed as
10539**  follows:
10540**
10541**      By email:  sofa@ukho.gov.uk
10542**      By post:   IAU SOFA Center
10543**                 HM Nautical Almanac Office
10544**                 UK Hydrographic Office
10545**                 Admiralty Way, Taunton
10546**                 Somerset, TA1 2DN
10547**                 United Kingdom
10548**
10549**--------------------------------------------------------------------*/
10550}
10551
10552
10553
10554void iauHfk5z(double rh, double dh, double date1, double date2,
10555              double *r5, double *d5, double *dr5, double *dd5)
10556/*
10557**  - - - - - - - - -
10558**   i a u H f k 5 z
10559**  - - - - - - - - -
10560**
10561**  Transform a Hipparcos star position into FK5 J2000.0, assuming
10562**  zero Hipparcos proper motion.
10563**
10564**  This function is part of the International Astronomical Union's
10565**  SOFA (Standards Of Fundamental Astronomy) software collection.
10566**
10567**  Status:  support function.
10568**
10569**  Given:
10570**     rh            double    Hipparcos RA (radians)
10571**     dh            double    Hipparcos Dec (radians)
10572**     date1,date2   double    TDB date (Note 1)
10573**
10574**  Returned (all FK5, equinox J2000.0, date date1+date2):
10575**     r5            double    RA (radians)
10576**     d5            double    Dec (radians)
10577**     dr5           double    FK5 RA proper motion (rad/year, Note 4)
10578**     dd5           double    Dec proper motion (rad/year, Note 4)
10579**
10580**  Notes:
10581**
10582**  1) The TT date date1+date2 is a Julian Date, apportioned in any
10583**     convenient way between the two arguments.  For example,
10584**     JD(TT)=2450123.7 could be expressed in any of these ways,
10585**     among others:
10586**
10587**            date1          date2
10588**
10589**         2450123.7           0.0       (JD method)
10590**         2451545.0       -1421.3       (J2000 method)
10591**         2400000.5       50123.2       (MJD method)
10592**         2450123.5           0.2       (date & time method)
10593**
10594**     The JD method is the most natural and convenient to use in
10595**     cases where the loss of several decimal digits of resolution
10596**     is acceptable.  The J2000 method is best matched to the way
10597**     the argument is handled internally and will deliver the
10598**     optimum resolution.  The MJD method and the date & time methods
10599**     are both good compromises between resolution and convenience.
10600**
10601**  2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
10602**
10603**  3) The FK5 to Hipparcos transformation is modeled as a pure rotation
10604**     and spin;  zonal errors in the FK5 catalogue are not taken into
10605**     account.
10606**
10607**  4) It was the intention that Hipparcos should be a close
10608**     approximation to an inertial frame, so that distant objects have
10609**     zero proper motion;  such objects have (in general) non-zero
10610**     proper motion in FK5, and this function returns those fictitious
10611**     proper motions.
10612**
10613**  5) The position returned by this function is in the FK5 J2000.0
10614**     reference system but at date date1+date2.
10615**
10616**  6) See also iauFk52h, iauH2fk5, iauFk5zhz.
10617**
10618**  Called:
10619**     iauS2c       spherical coordinates to unit vector
10620**     iauFk5hip    FK5 to Hipparcos rotation and spin
10621**     iauRxp       product of r-matrix and p-vector
10622**     iauSxp       multiply p-vector by scalar
10623**     iauRxr       product of two r-matrices
10624**     iauTrxp      product of transpose of r-matrix and p-vector
10625**     iauPxp       vector product of two p-vectors
10626**     iauPv2s      pv-vector to spherical
10627**     iauAnp       normalize angle into range 0 to 2pi
10628**
10629**  Reference:
10630**
10631**     F.Mignard & M.Froeschle, 2000, Astron.Astrophys. 354, 732-739.
10632**
10633*/
10634
10635
10636
10637void iauIcrs2g ( double dr, double dd, double *dl, double *db )
10638/*
10639**  - - - - - - - - - -
10640**   i a u I c r s 2 g
10641**  - - - - - - - - - -
10642**
10643**  Transformation from ICRS to Galactic Coordinates.
10644**
10645**  This function is part of the International Astronomical Union's
10646**  SOFA (Standards of Fundamental Astronomy) software collection.
10647**
10648**  Status:  support function.
10649**
10650**  Given:
10651**     dr     double      ICRS right ascension (radians)
10652**     dd     double      ICRS declination (radians)
10653**
10654**  Returned:
10655**     dl     double      galactic longitude (radians)
10656**     db     double      galactic latitude (radians)
10657**
10658**  Notes:
10659**
10660**  1) The IAU 1958 system of Galactic coordinates was defined with
10661**     respect to the now obsolete reference system FK4 B1950.0.  When
10662**     interpreting the system in a modern context, several factors have
10663**     to be taken into account:
10664**
10665**     . The inclusion in FK4 positions of the E-terms of aberration.
10666**
10667**     . The distortion of the FK4 proper motion system by differential
10668**       Galactic rotation.
10669**
10670**     . The use of the B1950.0 equinox rather than the now-standard
10671**       J2000.0.
10672**
10673**     . The frame bias between ICRS and the J2000.0 mean place system.
10674**
10675**     The Hipparcos Catalogue (Perryman & ESA 1997) provides a rotation
10676**     matrix that transforms directly between ICRS and Galactic
10677**     coordinates with the above factors taken into account.  The
10678**     matrix is derived from three angles, namely the ICRS coordinates
10679**     of the Galactic pole and the longitude of the ascending node of
10680**     the galactic equator on the ICRS equator.  They are given in
10681**     degrees to five decimal places and for canonical purposes are
10682**     regarded as exact.  In the Hipparcos Catalogue the matrix
10683**     elements are given to 10 decimal places (about 20 microarcsec).
10684**     In the present SOFA function the matrix elements have been
10685**     recomputed from the canonical three angles and are given to 30
10686**     decimal places.
10687**
10688**  2) The inverse transformation is performed by the function iauG2icrs.
10689**
10690**  Called:
10691**     iauAnp       normalize angle into range 0 to 2pi
10692**     iauAnpm      normalize angle into range +/- pi
10693**     iauS2c       spherical coordinates to unit vector
10694**     iauRxp       product of r-matrix and p-vector
10695**     iauC2s       p-vector to spherical
10696**
10697**  Reference:
10698**     Perryman M.A.C. & ESA, 1997, ESA SP-1200, The Hipparcos and Tycho
10699**     catalogues.  Astrometric and photometric star catalogues
10700**     derived from the ESA Hipparcos Space Astrometry Mission.  ESA
10701**     Publications Division, Noordwijk, Netherlands.
10702**
10703*/
10704
10705
10706
10707void iauIr(double r[3][3])
10708/*
10709**  - - - - - -
10710**   i a u I r
10711**  - - - - - -
10712**
10713**  Initialize an r-matrix to the identity matrix.
10714**
10715**  This function is part of the International Astronomical Union's
10716**  SOFA (Standards Of Fundamental Astronomy) software collection.
10717**
10718**  Status:  vector/matrix support function.
10719**
10720**  Returned:
10721**     r       double[3][3]    r-matrix
10722**
10723*/
10724
10725
10726
10727int iauJd2cal(double dj1, double dj2,
10728              int *iy, int *im, int *id, double *fd)
10729/*
10730**  - - - - - - - - - -
10731**   i a u J d 2 c a l
10732**  - - - - - - - - - -
10733**
10734**  Julian Date to Gregorian year, month, day, and fraction of a day.
10735**
10736**  This function is part of the International Astronomical Union's
10737**  SOFA (Standards Of Fundamental Astronomy) software collection.
10738**
10739**  Status:  support function.
10740**
10741**  Given:
10742**     dj1,dj2   double   Julian Date (Notes 1, 2)
10743**
10744**  Returned (arguments):
10745**     iy        int      year
10746**     im        int      month
10747**     id        int      day
10748**     fd        double   fraction of day
10749**
10750**  Returned (function value):
10751**               int      status:
10752**                           0 = OK
10753**                          -1 = unacceptable date (Note 1)
10754**
10755**  Notes:
10756**
10757**  1) The earliest valid date is -68569.5 (-4900 March 1).  The
10758**     largest value accepted is 1e9.
10759**
10760**  2) The Julian Date is apportioned in any convenient way between
10761**     the arguments dj1 and dj2.  For example, JD=2450123.7 could
10762**     be expressed in any of these ways, among others:
10763**
10764**            dj1             dj2
10765**
10766**         2450123.7           0.0       (JD method)
10767**         2451545.0       -1421.3       (J2000 method)
10768**         2400000.5       50123.2       (MJD method)
10769**         2450123.5           0.2       (date & time method)
10770**
10771**     Separating integer and fraction uses the "compensated summation"
10772**     algorithm of Kahan-Neumaier to preserve as much precision as
10773**     possible irrespective of the jd1+jd2 apportionment.
10774**
10775**  3) In early eras the conversion is from the "proleptic Gregorian
10776**     calendar";  no account is taken of the date(s) of adoption of
10777**     the Gregorian calendar, nor is the AD/BC numbering convention
10778**     observed.
10779**
10780**  References:
10781**
10782**     Explanatory Supplement to the Astronomical Almanac,
10783**     P. Kenneth Seidelmann (ed), University Science Books (1992),
10784**     Section 12.92 (p604).
10785**
10786**     Klein, A., A Generalized Kahan-Babuska-Summation-Algorithm.
10787**     Computing, 76, 279-293 (2006), Section 3.
10788**
10789*/
10790
10791
10792
10793int iauJdcalf(int ndp, double dj1, double dj2, int iymdf[4])
10794/*
10795**  - - - - - - - - - -
10796**   i a u J d c a l f
10797**  - - - - - - - - - -
10798**
10799**  Julian Date to Gregorian Calendar, expressed in a form convenient
10800**  for formatting messages:  rounded to a specified precision.
10801**
10802**  This function is part of the International Astronomical Union's
10803**  SOFA (Standards Of Fundamental Astronomy) software collection.
10804**
10805**  Status:  support function.
10806**
10807**  Given:
10808**     ndp       int      number of decimal places of days in fraction
10809**     dj1,dj2   double   dj1+dj2 = Julian Date (Note 1)
10810**
10811**  Returned:
10812**     iymdf     int[4]   year, month, day, fraction in Gregorian
10813**                        calendar
10814**
10815**  Returned (function value):
10816**               int      status:
10817**                          -1 = date out of range
10818**                           0 = OK
10819**                          +1 = NDP not 0-9 (interpreted as 0)
10820**
10821**  Notes:
10822**
10823**  1) The Julian Date is apportioned in any convenient way between
10824**     the arguments dj1 and dj2.  For example, JD=2450123.7 could
10825**     be expressed in any of these ways, among others:
10826**
10827**             dj1            dj2
10828**
10829**         2450123.7           0.0       (JD method)
10830**         2451545.0       -1421.3       (J2000 method)
10831**         2400000.5       50123.2       (MJD method)
10832**         2450123.5           0.2       (date & time method)
10833**
10834**  2) In early eras the conversion is from the "Proleptic Gregorian
10835**     Calendar";  no account is taken of the date(s) of adoption of
10836**     the Gregorian Calendar, nor is the AD/BC numbering convention
10837**     observed.
10838**
10839**  3) See also the function iauJd2cal.
10840**
10841**  4) The number of decimal places ndp should be 4 or less if internal
10842**     overflows are to be avoided on platforms which use 16-bit
10843**     integers.
10844**
10845**  Called:
10846**     iauJd2cal    JD to Gregorian calendar
10847**
10848**  Reference:
10849**
10850**     Explanatory Supplement to the Astronomical Almanac,
10851**     P. Kenneth Seidelmann (ed), University Science Books (1992),
10852**     Section 12.92 (p604).
10853**
10854*/
10855
10856
10857
10858void iauLd(double bm, double p[3], double q[3], double e[3],
10859           double em, double dlim, double p1[3])
10860/*
10861**  - - - - - -
10862**   i a u L d
10863**  - - - - - -
10864**
10865**  Apply light deflection by a solar-system body, as part of
10866**  transforming coordinate direction into natural direction.
10867**
10868**  This function is part of the International Astronomical Union's
10869**  SOFA (Standards of Fundamental Astronomy) software collection.
10870**
10871**  Status:  support function.
10872**
10873**  Given:
10874**     bm     double     mass of the gravitating body (solar masses)
10875**     p      double[3]  direction from observer to source (unit vector)
10876**     q      double[3]  direction from body to source (unit vector)
10877**     e      double[3]  direction from body to observer (unit vector)
10878**     em     double     distance from body to observer (au)
10879**     dlim   double     deflection limiter (Note 4)
10880**
10881**  Returned:
10882**     p1     double[3]  observer to deflected source (unit vector)
10883**
10884**  Notes:
10885**
10886**  1) The algorithm is based on Expr. (70) in Klioner (2003) and
10887**     Expr. (7.63) in the Explanatory Supplement (Urban & Seidelmann
10888**     2013), with some rearrangement to minimize the effects of machine
10889**     precision.
10890**
10891**  2) The mass parameter bm can, as required, be adjusted in order to
10892**     allow for such effects as quadrupole field.
10893**
10894**  3) The barycentric position of the deflecting body should ideally
10895**     correspond to the time of closest approach of the light ray to
10896**     the body.
10897**
10898**  4) The deflection limiter parameter dlim is phi^2/2, where phi is
10899**     the angular separation (in radians) between source and body at
10900**     which limiting is applied.  As phi shrinks below the chosen
10901**     threshold, the deflection is artificially reduced, reaching zero
10902**     for phi = 0.
10903**
10904**  5) The returned vector p1 is not normalized, but the consequential
10905**     departure from unit magnitude is always negligible.
10906**
10907**  6) The arguments p and p1 can be the same array.
10908**
10909**  7) To accumulate total light deflection taking into account the
10910**     contributions from several bodies, call the present function for
10911**     each body in succession, in decreasing order of distance from the
10912**     observer.
10913**
10914**  8) For efficiency, validation is omitted.  The supplied vectors must
10915**     be of unit magnitude, and the deflection limiter non-zero and
10916**     positive.
10917**
10918**  References:
10919**
10920**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
10921**     the Astronomical Almanac, 3rd ed., University Science Books
10922**     (2013).
10923**
10924**     Klioner, Sergei A., "A practical relativistic model for micro-
10925**     arcsecond astrometry in space", Astr. J. 125, 1580-1597 (2003).
10926**
10927**  Called:
10928**     iauPdp       scalar product of two p-vectors
10929**     iauPxp       vector product of two p-vectors
10930**
10931*/
10932
10933
10934
10935void iauLdn(int n, iauLDBODY b[], double ob[3], double sc[3],
10936            double sn[3])
10937/*+
10938**  - - - - - - -
10939**   i a u L d n
10940**  - - - - - - -
10941**
10942**  For a star, apply light deflection by multiple solar-system bodies,
10943**  as part of transforming coordinate direction into natural direction.
10944**
10945**  This function is part of the International Astronomical Union's
10946**  SOFA (Standards of Fundamental Astronomy) software collection.
10947**
10948**  Status:  support function.
10949**
10950**  Given:
10951**     n    int           number of bodies (note 1)
10952**     b    iauLDBODY[n]  data for each of the n bodies (Notes 1,2):
10953**      bm   double         mass of the body (solar masses, Note 3)
10954**      dl   double         deflection limiter (Note 4)
10955**      pv   [2][3]         barycentric PV of the body (au, au/day)
10956**     ob   double[3]     barycentric position of the observer (au)
10957**     sc   double[3]     observer to star coord direction (unit vector)
10958**
10959**  Returned:
10960**     sn    double[3]      observer to deflected star (unit vector)
10961**
10962**  1) The array b contains n entries, one for each body to be
10963**     considered.  If n = 0, no gravitational light deflection will be
10964**     applied, not even for the Sun.
10965**
10966**  2) The array b should include an entry for the Sun as well as for
10967**     any planet or other body to be taken into account.  The entries
10968**     should be in the order in which the light passes the body.
10969**
10970**  3) In the entry in the b array for body i, the mass parameter
10971**     b[i].bm can, as required, be adjusted in order to allow for such
10972**     effects as quadrupole field.
10973**
10974**  4) The deflection limiter parameter b[i].dl is phi^2/2, where phi is
10975**     the angular separation (in radians) between star and body at
10976**     which limiting is applied.  As phi shrinks below the chosen
10977**     threshold, the deflection is artificially reduced, reaching zero
10978**     for phi = 0.   Example values suitable for a terrestrial
10979**     observer, together with masses, are as follows:
10980**
10981**        body i     b[i].bm        b[i].dl
10982**
10983**        Sun        1.0            6e-6
10984**        Jupiter    0.00095435     3e-9
10985**        Saturn     0.00028574     3e-10
10986**
10987**  5) For cases where the starlight passes the body before reaching the
10988**     observer, the body is placed back along its barycentric track by
10989**     the light time from that point to the observer.  For cases where
10990**     the body is "behind" the observer no such shift is applied.  If
10991**     a different treatment is preferred, the user has the option of
10992**     instead using the iauLd function.  Similarly, iauLd can be used
10993**     for cases where the source is nearby, not a star.
10994**
10995**  6) The returned vector sn is not normalized, but the consequential
10996**     departure from unit magnitude is always negligible.
10997**
10998**  7) The arguments sc and sn can be the same array.
10999**
11000**  8) For efficiency, validation is omitted.  The supplied masses must
11001**     be greater than zero, the position and velocity vectors must be
11002**     right, and the deflection limiter greater than zero.
11003**
11004**  Reference:
11005**
11006**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
11007**     the Astronomical Almanac, 3rd ed., University Science Books
11008**     (2013), Section 7.2.4.
11009**
11010**  Called:
11011**     iauCp        copy p-vector
11012**     iauPdp       scalar product of two p-vectors
11013**     iauPmp       p-vector minus p-vector
11014**     iauPpsp      p-vector plus scaled p-vector
11015**     iauPn        decompose p-vector into modulus and direction
11016**     iauLd        light deflection by a solar-system body
11017**
11018*/
11019
11020
11021
11022void iauLdsun(double p[3], double e[3], double em, double p1[3])
11023/*
11024**  - - - - - - - - -
11025**   i a u L d s u n
11026**  - - - - - - - - -
11027**
11028**  Deflection of starlight by the Sun.
11029**
11030**  This function is part of the International Astronomical Union's
11031**  SOFA (Standards of Fundamental Astronomy) software collection.
11032**
11033**  Status:  support function.
11034**
11035**  Given:
11036**     p      double[3]  direction from observer to star (unit vector)
11037**     e      double[3]  direction from Sun to observer (unit vector)
11038**     em     double     distance from Sun to observer (au)
11039**
11040**  Returned:
11041**     p1     double[3]  observer to deflected star (unit vector)
11042**
11043**  Notes:
11044**
11045**  1) The source is presumed to be sufficiently distant that its
11046**     directions seen from the Sun and the observer are essentially
11047**     the same.
11048**
11049**  2) The deflection is restrained when the angle between the star and
11050**     the center of the Sun is less than a threshold value, falling to
11051**     zero deflection for zero separation.  The chosen threshold value
11052**     is within the solar limb for all solar-system applications, and
11053**     is about 5 arcminutes for the case of a terrestrial observer.
11054**
11055**  3) The arguments p and p1 can be the same array.
11056**
11057**  Called:
11058**     iauLd        light deflection by a solar-system body
11059**
11060*/
11061
11062
11063
11064void iauLteceq(double epj, double dl, double db, double *dr, double *dd)
11065/*
11066**  - - - - - - - - - -
11067**   i a u L t e c e q
11068**  - - - - - - - - - -
11069**
11070**  Transformation from ecliptic coordinates (mean equinox and ecliptic
11071**  of date) to ICRS RA,Dec, using a long-term precession model.
11072**
11073**  This function is part of the International Astronomical Union's
11074**  SOFA (Standards of Fundamental Astronomy) software collection.
11075**
11076**  Status:  support function.
11077**
11078**  Given:
11079**     epj     double     Julian epoch (TT)
11080**     dl,db   double     ecliptic longitude and latitude (radians)
11081**
11082**  Returned:
11083**     dr,dd   double     ICRS right ascension and declination (radians)
11084**
11085**  1) No assumptions are made about whether the coordinates represent
11086**     starlight and embody astrometric effects such as parallax or
11087**     aberration.
11088**
11089**  2) The transformation is approximately that from ecliptic longitude
11090**     and latitude (mean equinox and ecliptic of date) to mean J2000.0
11091**     right ascension and declination, with only frame bias (always
11092**     less than 25 mas) to disturb this classical picture.
11093**
11094**  3) The Vondrak et al. (2011, 2012) 400 millennia precession model
11095**     agrees with the IAU 2006 precession at J2000.0 and stays within
11096**     100 microarcseconds during the 20th and 21st centuries.  It is
11097**     accurate to a few arcseconds throughout the historical period,
11098**     worsening to a few tenths of a degree at the end of the
11099**     +/- 200,000 year time span.
11100**
11101**  Called:
11102**     iauS2c       spherical coordinates to unit vector
11103**     iauLtecm     J2000.0 to ecliptic rotation matrix, long term
11104**     iauTrxp      product of transpose of r-matrix and p-vector
11105**     iauC2s       unit vector to spherical coordinates
11106**     iauAnp       normalize angle into range 0 to 2pi
11107**     iauAnpm      normalize angle into range +/- pi
11108**
11109**  References:
11110**
11111**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
11112**    expressions, valid for long time intervals, Astron.Astrophys. 534,
11113**    A22
11114**
11115**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
11116**    expressions, valid for long time intervals (Corrigendum),
11117**    Astron.Astrophys. 541, C1
11118**
11119*/
11120
11121
11122
11123void iauLtecm(double epj, double rm[3][3])
11124/*
11125**  - - - - - - - - -
11126**   i a u L t e c m
11127**  - - - - - - - - -
11128**
11129**  ICRS equatorial to ecliptic rotation matrix, long-term.
11130**
11131**  This function is part of the International Astronomical Union's
11132**  SOFA (Standards of Fundamental Astronomy) software collection.
11133**
11134**  Status:  support function.
11135**
11136**  Given:
11137**     epj     double         Julian epoch (TT)
11138**
11139**  Returned:
11140**     rm      double[3][3]   ICRS to ecliptic rotation matrix
11141**
11142**  Notes:
11143**
11144**  1) The matrix is in the sense
11145**
11146**        E_ep = rm x P_ICRS,
11147**
11148**     where P_ICRS is a vector with respect to ICRS right ascension
11149**     and declination axes and E_ep is the same vector with respect to
11150**     the (inertial) ecliptic and equinox of epoch epj.
11151**
11152**  2) P_ICRS is a free vector, merely a direction, typically of unit
11153**     magnitude, and not bound to any particular spatial origin, such
11154**     as the Earth, Sun or SSB.  No assumptions are made about whether
11155**     it represents starlight and embodies astrometric effects such as
11156**     parallax or aberration.  The transformation is approximately that
11157**     between mean J2000.0 right ascension and declination and ecliptic
11158**     longitude and latitude, with only frame bias (always less than
11159**     25 mas) to disturb this classical picture.
11160**
11161**  3) The Vondrak et al. (2011, 2012) 400 millennia precession model
11162**     agrees with the IAU 2006 precession at J2000.0 and stays within
11163**     100 microarcseconds during the 20th and 21st centuries.  It is
11164**     accurate to a few arcseconds throughout the historical period,
11165**     worsening to a few tenths of a degree at the end of the
11166**     +/- 200,000 year time span.
11167**
11168**  Called:
11169**     iauLtpequ    equator pole, long term
11170**     iauLtpecl    ecliptic pole, long term
11171**     iauPxp       vector product
11172**     iauPn        normalize vector
11173**
11174**  References:
11175**
11176**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
11177**    expressions, valid for long time intervals, Astron.Astrophys. 534,
11178**    A22
11179**
11180**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
11181**    expressions, valid for long time intervals (Corrigendum),
11182**    Astron.Astrophys. 541, C1
11183**
11184*/
11185
11186
11187
11188void iauLteqec(double epj, double dr, double dd, double *dl, double *db)
11189/*
11190**  - - - - - - - - - -
11191**   i a u L t e q e c
11192**  - - - - - - - - - -
11193**
11194**  Transformation from ICRS equatorial coordinates to ecliptic
11195**  coordinates (mean equinox and ecliptic of date) using a long-term
11196**  precession model.
11197**
11198**  This function is part of the International Astronomical Union's
11199**  SOFA (Standards of Fundamental Astronomy) software collection.
11200**
11201**  Status:  support function.
11202**
11203**  Given:
11204**     epj     double     Julian epoch (TT)
11205**     dr,dd   double     ICRS right ascension and declination (radians)
11206**
11207**  Returned:
11208**     dl,db   double     ecliptic longitude and latitude (radians)
11209**
11210**  1) No assumptions are made about whether the coordinates represent
11211**     starlight and embody astrometric effects such as parallax or
11212**     aberration.
11213**
11214**  2) The transformation is approximately that from mean J2000.0 right
11215**     ascension and declination to ecliptic longitude and latitude
11216**     (mean equinox and ecliptic of date), with only frame bias (always
11217**     less than 25 mas) to disturb this classical picture.
11218**
11219**  3) The Vondrak et al. (2011, 2012) 400 millennia precession model
11220**     agrees with the IAU 2006 precession at J2000.0 and stays within
11221**     100 microarcseconds during the 20th and 21st centuries.  It is
11222**     accurate to a few arcseconds throughout the historical period,
11223**     worsening to a few tenths of a degree at the end of the
11224**     +/- 200,000 year time span.
11225**
11226**  Called:
11227**     iauS2c       spherical coordinates to unit vector
11228**     iauLtecm     J2000.0 to ecliptic rotation matrix, long term
11229**     iauRxp       product of r-matrix and p-vector
11230**     iauC2s       unit vector to spherical coordinates
11231**     iauAnp       normalize angle into range 0 to 2pi
11232**     iauAnpm      normalize angle into range +/- pi
11233**
11234**  References:
11235**
11236**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
11237**    expressions, valid for long time intervals, Astron.Astrophys. 534,
11238**    A22
11239**
11240**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
11241**    expressions, valid for long time intervals (Corrigendum),
11242**    Astron.Astrophys. 541, C1
11243**
11244*/
11245
11246
11247
11248void iauLtp(double epj, double rp[3][3])
11249/*
11250**  - - - - - - -
11251**   i a u L t p
11252**  - - - - - - -
11253**
11254**  Long-term precession matrix.
11255**
11256**  This function is part of the International Astronomical Union's
11257**  SOFA (Standards of Fundamental Astronomy) software collection.
11258**
11259**  Status:  support function.
11260**
11261**  Given:
11262**     epj     double         Julian epoch (TT)
11263**
11264**  Returned:
11265**     rp      double[3][3]   precession matrix, J2000.0 to date
11266**
11267**  Notes:
11268**
11269**  1) The matrix is in the sense
11270**
11271**        P_date = rp x P_J2000,
11272**
11273**     where P_J2000 is a vector with respect to the J2000.0 mean
11274**     equator and equinox and P_date is the same vector with respect to
11275**     the equator and equinox of epoch epj.
11276**
11277**  2) The Vondrak et al. (2011, 2012) 400 millennia precession model
11278**     agrees with the IAU 2006 precession at J2000.0 and stays within
11279**     100 microarcseconds during the 20th and 21st centuries.  It is
11280**     accurate to a few arcseconds throughout the historical period,
11281**     worsening to a few tenths of a degree at the end of the
11282**     +/- 200,000 year time span.
11283**
11284**  Called:
11285**     iauLtpequ    equator pole, long term
11286**     iauLtpecl    ecliptic pole, long term
11287**     iauPxp       vector product
11288**     iauPn        normalize vector
11289**
11290**  References:
11291**
11292**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
11293**    expressions, valid for long time intervals, Astron.Astrophys. 534,
11294**    A22
11295**
11296**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
11297**    expressions, valid for long time intervals (Corrigendum),
11298**    Astron.Astrophys. 541, C1
11299**
11300*/
11301
11302
11303
11304void iauLtpb(double epj, double rpb[3][3])
11305/*
11306**  - - - - - - - -
11307**   i a u L t p b
11308**  - - - - - - - -
11309**
11310**  Long-term precession matrix, including ICRS frame bias.
11311**
11312**  This function is part of the International Astronomical Union's
11313**  SOFA (Standards of Fundamental Astronomy) software collection.
11314**
11315**  Status:  support function.
11316**
11317**  Given:
11318**     epj     double         Julian epoch (TT)
11319**
11320**  Returned:
11321**     rpb     double[3][3]   precession-bias matrix, J2000.0 to date
11322**
11323**  Notes:
11324**
11325**  1) The matrix is in the sense
11326**
11327**        P_date = rpb x P_ICRS,
11328**
11329**     where P_ICRS is a vector in the Geocentric Celestial Reference
11330**     System, and P_date is the vector with respect to the Celestial
11331**     Intermediate Reference System at that date but with nutation
11332**     neglected.
11333**
11334**  2) A first order frame bias formulation is used, of sub-
11335**     microarcsecond accuracy compared with a full 3D rotation.
11336**
11337**  3) The Vondrak et al. (2011, 2012) 400 millennia precession model
11338**     agrees with the IAU 2006 precession at J2000.0 and stays within
11339**     100 microarcseconds during the 20th and 21st centuries.  It is
11340**     accurate to a few arcseconds throughout the historical period,
11341**     worsening to a few tenths of a degree at the end of the
11342**     +/- 200,000 year time span.
11343**
11344**  References:
11345**
11346**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
11347**    expressions, valid for long time intervals, Astron.Astrophys. 534,
11348**    A22
11349**
11350**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
11351**    expressions, valid for long time intervals (Corrigendum),
11352**    Astron.Astrophys. 541, C1
11353**
11354*/
11355
11356
11357
11358void iauLtpecl(double epj, double vec[3])
11359/*
11360**  - - - - - - - - - -
11361**   i a u L t p e c l
11362**  - - - - - - - - - -
11363**
11364**  Long-term precession of the ecliptic.
11365**
11366**  This function is part of the International Astronomical Union's
11367**  SOFA (Standards of Fundamental Astronomy) software collection.
11368**
11369**  Status:  support function.
11370**
11371**  Given:
11372**     epj     double         Julian epoch (TT)
11373**
11374**  Returned:
11375**     vec     double[3]      ecliptic pole unit vector
11376**
11377**  Notes:
11378**
11379**  1) The returned vector is with respect to the J2000.0 mean equator
11380**     and equinox.
11381**
11382**  2) The Vondrak et al. (2011, 2012) 400 millennia precession model
11383**     agrees with the IAU 2006 precession at J2000.0 and stays within
11384**     100 microarcseconds during the 20th and 21st centuries.  It is
11385**     accurate to a few arcseconds throughout the historical period,
11386**     worsening to a few tenths of a degree at the end of the
11387**     +/- 200,000 year time span.
11388**
11389**  References:
11390**
11391**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
11392**    expressions, valid for long time intervals, Astron.Astrophys. 534,
11393**    A22
11394**
11395**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
11396**    expressions, valid for long time intervals (Corrigendum),
11397**    Astron.Astrophys. 541, C1
11398**
11399*/
11400
11401
11402
11403void iauLtpequ(double epj, double veq[3])
11404/*
11405**  - - - - - - - - - -
11406**   i a u L t p e q u
11407**  - - - - - - - - - -
11408**
11409**  Long-term precession of the equator.
11410**
11411**  This function is part of the International Astronomical Union's
11412**  SOFA (Standards of Fundamental Astronomy) software collection.
11413**
11414**  Status:  support function.
11415**
11416**  Given:
11417**     epj     double         Julian epoch (TT)
11418**
11419**  Returned:
11420**     veq     double[3]      equator pole unit vector
11421**
11422**  Notes:
11423**
11424**  1) The returned vector is with respect to the J2000.0 mean equator
11425**     and equinox.
11426**
11427**  2) The Vondrak et al. (2011, 2012) 400 millennia precession model
11428**     agrees with the IAU 2006 precession at J2000.0 and stays within
11429**     100 microarcseconds during the 20th and 21st centuries.  It is
11430**     accurate to a few arcseconds throughout the historical period,
11431**     worsening to a few tenths of a degree at the end of the
11432**     +/- 200,000 year time span.
11433**
11434**  References:
11435**
11436**    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
11437**    expressions, valid for long time intervals, Astron.Astrophys. 534,
11438**    A22
11439**
11440**    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
11441**    expressions, valid for long time intervals (Corrigendum),
11442**    Astron.Astrophys. 541, C1
11443**
11444*/
11445
11446
11447
11448void iauMoon98 ( double date1, double date2, double pv[2][3] )
11449/*
11450**  - - - - - - - - - -
11451**   i a u M o o n 9 8
11452**  - - - - - - - - - -
11453**
11454**  Approximate geocentric position and velocity of the Moon.
11455**
11456**  This function is part of the International Astronomical Union's
11457**  SOFA (Standards Of Fundamental Astronomy) software collection.
11458**
11459**  Status:  support function.
11460**
11461**  n.b. Not IAU-endorsed and without canonical status.
11462**
11463**  Given:
11464**     date1  double         TT date part A (Notes 1,4)
11465**     date2  double         TT date part B (Notes 1,4)
11466**
11467**  Returned:
11468**     pv     double[2][3]   Moon p,v, GCRS (AU, AU/d, Note 5)
11469**
11470**  Notes:
11471**
11472**  1) The TT date date1+date2 is a Julian Date, apportioned in any
11473**     convenient way between the two arguments.  For example,
11474**     JD(TT)=2450123.7 could be expressed in any of these ways, among
11475**     others:
11476**
11477**            date1          date2
11478**
11479**         2450123.7           0.0       (JD method)
11480**         2451545.0       -1421.3       (J2000 method)
11481**         2400000.5       50123.2       (MJD method)
11482**         2450123.5           0.2       (date & time method)
11483**
11484**     The JD method is the most natural and convenient to use in cases
11485**     where the loss of several decimal digits of resolution is
11486**     acceptable.  The J2000 method is best matched to the way the
11487**     argument is handled internally and will deliver the optimum
11488**     resolution.  The MJD method and the date & time methods are both
11489**     good compromises between resolution and convenience.  The limited
11490**     accuracy of the present algorithm is such that any of the methods
11491**     is satisfactory.
11492**
11493**  2) This function is a full implementation of the algorithm
11494**     published by Meeus (see reference) except that the light-time
11495**     correction to the Moon's mean longitude has been omitted.
11496**
11497**  3) Comparisons with ELP/MPP02 over the interval 1950-2100 gave RMS
11498**     errors of 2.9 arcsec in geocentric direction, 6.1 km in position
11499**     and 36 mm/s in velocity.  The worst case errors were 18.3 arcsec
11500**     in geocentric direction, 31.7 km in position and 172 mm/s in
11501**     velocity.
11502**
11503**  4) The original algorithm is expressed in terms of "dynamical time",
11504**     which can either be TDB or TT without any significant change in
11505**     accuracy.  UT cannot be used without incurring significant errors
11506**     (30 arcsec in the present era) due to the Moon's 0.5 arcsec/sec
11507**     movement.
11508**
11509**  5) The result is with respect to the GCRS (the same as J2000.0 mean
11510**     equator and equinox to within 23 mas).
11511**
11512**  6) Velocity is obtained by a complete analytical differentiation
11513**     of the Meeus model.
11514**
11515**  7) The Meeus algorithm generates position and velocity in mean
11516**     ecliptic coordinates of date, which the present function then
11517**     rotates into GCRS.  Because the ecliptic system is precessing,
11518**     there is a coupling between this spin (about 1.4 degrees per
11519**     century) and the Moon position that produces a small velocity
11520**     contribution.  In the present function this effect is neglected
11521**     as it corresponds to a maximum difference of less than 3 mm/s and
11522**     increases the RMS error by only 0.4%.
11523**
11524**  References:
11525**
11526**     Meeus, J., Astronomical Algorithms, 2nd edition, Willmann-Bell,
11527**     1998, p337.
11528**
11529**     Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
11530**     Francou, G. & Laskar, J., Astron.Astrophys., 1994, 282, 663
11531**
11532**  Defined in sofam.h:
11533**     DAU           astronomical unit (m)
11534**     DJC           days per Julian century
11535**     DJ00          reference epoch (J2000.0), Julian Date
11536**     DD2R          degrees to radians
11537**
11538**  Called:
11539**     iauS2pv      spherical coordinates to pv-vector
11540**     iauPfw06     bias-precession F-W angles, IAU 2006
11541**     iauIr        initialize r-matrix to identity
11542**     iauRz        rotate around Z-axis
11543**     iauRx        rotate around X-axis
11544**     iauRxpv      product of r-matrix and pv-vector
11545**
11546*/
11547
11548
11549
11550void iauNum00a(double date1, double date2, double rmatn[3][3])
11551/*
11552**  - - - - - - - - - -
11553**   i a u N u m 0 0 a
11554**  - - - - - - - - - -
11555**
11556**  Form the matrix of nutation for a given date, IAU 2000A model.
11557**
11558**  This function is part of the International Astronomical Union's
11559**  SOFA (Standards Of Fundamental Astronomy) software collection.
11560**
11561**  Status:  support function.
11562**
11563**  Given:
11564**     date1,date2  double          TT as a 2-part Julian Date (Note 1)
11565**
11566**  Returned:
11567**     rmatn        double[3][3]    nutation matrix
11568**
11569**  Notes:
11570**
11571**  1) The TT date date1+date2 is a Julian Date, apportioned in any
11572**     convenient way between the two arguments.  For example,
11573**     JD(TT)=2450123.7 could be expressed in any of these ways,
11574**     among others:
11575**
11576**            date1          date2
11577**
11578**         2450123.7           0.0       (JD method)
11579**         2451545.0       -1421.3       (J2000 method)
11580**         2400000.5       50123.2       (MJD method)
11581**         2450123.5           0.2       (date & time method)
11582**
11583**     The JD method is the most natural and convenient to use in
11584**     cases where the loss of several decimal digits of resolution
11585**     is acceptable.  The J2000 method is best matched to the way
11586**     the argument is handled internally and will deliver the
11587**     optimum resolution.  The MJD method and the date & time methods
11588**     are both good compromises between resolution and convenience.
11589**
11590**  2) The matrix operates in the sense V(true) = rmatn * V(mean), where
11591**     the p-vector V(true) is with respect to the true equatorial triad
11592**     of date and the p-vector V(mean) is with respect to the mean
11593**     equatorial triad of date.
11594**
11595**  3) A faster, but slightly less accurate, result (about 1 mas) can be
11596**     obtained by using instead the iauNum00b function.
11597**
11598**  Called:
11599**     iauPn00a     bias/precession/nutation, IAU 2000A
11600**
11601**  Reference:
11602**
11603**     Explanatory Supplement to the Astronomical Almanac,
11604**     P. Kenneth Seidelmann (ed), University Science Books (1992),
11605**     Section 3.222-3 (p114).
11606**
11607*/
11608
11609
11610
11611void iauNum00b(double date1, double date2, double rmatn[3][3])
11612/*
11613**  - - - - - - - - - -
11614**   i a u N u m 0 0 b
11615**  - - - - - - - - - -
11616**
11617**  Form the matrix of nutation for a given date, IAU 2000B model.
11618**
11619**  This function is part of the International Astronomical Union's
11620**  SOFA (Standards Of Fundamental Astronomy) software collection.
11621**
11622**  Status:  support function.
11623**
11624**  Given:
11625**     date1,date2  double         TT as a 2-part Julian Date (Note 1)
11626**
11627**  Returned:
11628**     rmatn        double[3][3]   nutation matrix
11629**
11630**  Notes:
11631**
11632**  1) The TT date date1+date2 is a Julian Date, apportioned in any
11633**     convenient way between the two arguments.  For example,
11634**     JD(TT)=2450123.7 could be expressed in any of these ways,
11635**     among others:
11636**
11637**            date1          date2
11638**
11639**         2450123.7           0.0       (JD method)
11640**         2451545.0       -1421.3       (J2000 method)
11641**         2400000.5       50123.2       (MJD method)
11642**         2450123.5           0.2       (date & time method)
11643**
11644**     The JD method is the most natural and convenient to use in
11645**     cases where the loss of several decimal digits of resolution
11646**     is acceptable.  The J2000 method is best matched to the way
11647**     the argument is handled internally and will deliver the
11648**     optimum resolution.  The MJD method and the date & time methods
11649**     are both good compromises between resolution and convenience.
11650**
11651**  2) The matrix operates in the sense V(true) = rmatn * V(mean), where
11652**     the p-vector V(true) is with respect to the true equatorial triad
11653**     of date and the p-vector V(mean) is with respect to the mean
11654**     equatorial triad of date.
11655**
11656**  3) The present function is faster, but slightly less accurate (about
11657**     1 mas), than the iauNum00a function.
11658**
11659**  Called:
11660**     iauPn00b     bias/precession/nutation, IAU 2000B
11661**
11662**  Reference:
11663**
11664**     Explanatory Supplement to the Astronomical Almanac,
11665**     P. Kenneth Seidelmann (ed), University Science Books (1992),
11666**     Section 3.222-3 (p114).
11667**
11668*/
11669
11670
11671
11672void iauNum06a(double date1, double date2, double rmatn[3][3])
11673/*
11674**  - - - - - - - - - -
11675**   i a u N u m 0 6 a
11676**  - - - - - - - - - -
11677**
11678**  Form the matrix of nutation for a given date, IAU 2006/2000A model.
11679**
11680**  This function is part of the International Astronomical Union's
11681**  SOFA (Standards Of Fundamental Astronomy) software collection.
11682**
11683**  Status:  support function.
11684**
11685**  Given:
11686**     date1,date2   double          TT as a 2-part Julian Date (Note 1)
11687**
11688**  Returned:
11689**     rmatn         double[3][3]    nutation matrix
11690**
11691**  Notes:
11692**
11693**  1) The TT date date1+date2 is a Julian Date, apportioned in any
11694**     convenient way between the two arguments.  For example,
11695**     JD(TT)=2450123.7 could be expressed in any of these ways,
11696**     among others:
11697**
11698**            date1          date2
11699**
11700**         2450123.7           0.0       (JD method)
11701**         2451545.0       -1421.3       (J2000 method)
11702**         2400000.5       50123.2       (MJD method)
11703**         2450123.5           0.2       (date & time method)
11704**
11705**     The JD method is the most natural and convenient to use in
11706**     cases where the loss of several decimal digits of resolution
11707**     is acceptable.  The J2000 method is best matched to the way
11708**     the argument is handled internally and will deliver the
11709**     optimum resolution.  The MJD method and the date & time methods
11710**     are both good compromises between resolution and convenience.
11711**
11712**  2) The matrix operates in the sense V(true) = rmatn * V(mean), where
11713**     the p-vector V(true) is with respect to the true equatorial triad
11714**     of date and the p-vector V(mean) is with respect to the mean
11715**     equatorial triad of date.
11716**
11717**  Called:
11718**     iauObl06     mean obliquity, IAU 2006
11719**     iauNut06a    nutation, IAU 2006/2000A
11720**     iauNumat     form nutation matrix
11721**
11722**  Reference:
11723**
11724**     Explanatory Supplement to the Astronomical Almanac,
11725**     P. Kenneth Seidelmann (ed), University Science Books (1992),
11726**     Section 3.222-3 (p114).
11727**
11728*/
11729
11730
11731
11732void iauNumat(double epsa, double dpsi, double deps, double rmatn[3][3])
11733/*
11734**  - - - - - - - - -
11735**   i a u N u m a t
11736**  - - - - - - - - -
11737**
11738**  Form the matrix of nutation.
11739**
11740**  This function is part of the International Astronomical Union's
11741**  SOFA (Standards Of Fundamental Astronomy) software collection.
11742**
11743**  Status:  support function.
11744**
11745**  Given:
11746**     epsa        double         mean obliquity of date (Note 1)
11747**     dpsi,deps   double         nutation (Note 2)
11748**
11749**  Returned:
11750**     rmatn       double[3][3]   nutation matrix (Note 3)
11751**
11752**  Notes:
11753**
11754**
11755**  1) The supplied mean obliquity epsa, must be consistent with the
11756**     precession-nutation models from which dpsi and deps were obtained.
11757**
11758**  2) The caller is responsible for providing the nutation components;
11759**     they are in longitude and obliquity, in radians and are with
11760**     respect to the equinox and ecliptic of date.
11761**
11762**  3) The matrix operates in the sense V(true) = rmatn * V(mean),
11763**     where the p-vector V(true) is with respect to the true
11764**     equatorial triad of date and the p-vector V(mean) is with
11765**     respect to the mean equatorial triad of date.
11766**
11767**  Called:
11768**     iauIr        initialize r-matrix to identity
11769**     iauRx        rotate around X-axis
11770**     iauRz        rotate around Z-axis
11771**
11772**  Reference:
11773**
11774**     Explanatory Supplement to the Astronomical Almanac,
11775**     P. Kenneth Seidelmann (ed), University Science Books (1992),
11776**     Section 3.222-3 (p114).
11777**
11778*/
11779
11780
11781
11782void iauNut00a(double date1, double date2, double *dpsi, double *deps)
11783/*
11784**  - - - - - - - - - -
11785**   i a u N u t 0 0 a
11786**  - - - - - - - - - -
11787**
11788**  Nutation, IAU 2000A model (MHB2000 luni-solar and planetary nutation
11789**  with free core nutation omitted).
11790**
11791**  This function is part of the International Astronomical Union's
11792**  SOFA (Standards Of Fundamental Astronomy) software collection.
11793**
11794**  Status:  canonical model.
11795**
11796**  Given:
11797**     date1,date2   double   TT as a 2-part Julian Date (Note 1)
11798**
11799**  Returned:
11800**     dpsi,deps     double   nutation, luni-solar + planetary (Note 2)
11801**
11802**  Notes:
11803**
11804**  1) The TT date date1+date2 is a Julian Date, apportioned in any
11805**     convenient way between the two arguments.  For example,
11806**     JD(TT)=2450123.7 could be expressed in any of these ways,
11807**     among others:
11808**
11809**            date1          date2
11810**
11811**         2450123.7           0.0       (JD method)
11812**         2451545.0       -1421.3       (J2000 method)
11813**         2400000.5       50123.2       (MJD method)
11814**         2450123.5           0.2       (date & time method)
11815**
11816**     The JD method is the most natural and convenient to use in
11817**     cases where the loss of several decimal digits of resolution
11818**     is acceptable.  The J2000 method is best matched to the way
11819**     the argument is handled internally and will deliver the
11820**     optimum resolution.  The MJD method and the date & time methods
11821**     are both good compromises between resolution and convenience.
11822**
11823**  2) The nutation components in longitude and obliquity are in radians
11824**     and with respect to the equinox and ecliptic of date.  The
11825**     obliquity at J2000.0 is assumed to be the Lieske et al. (1977)
11826**     value of 84381.448 arcsec.
11827**
11828**     Both the luni-solar and planetary nutations are included.  The
11829**     latter are due to direct planetary nutations and the
11830**     perturbations of the lunar and terrestrial orbits.
11831**
11832**  3) The function computes the MHB2000 nutation series with the
11833**     associated corrections for planetary nutations.  It is an
11834**     implementation of the nutation part of the IAU 2000A precession-
11835**     nutation model, formally adopted by the IAU General Assembly in
11836**     2000, namely MHB2000 (Mathews et al. 2002), but with the free
11837**     core nutation (FCN - see Note 4) omitted.
11838**
11839**  4) The full MHB2000 model also contains contributions to the
11840**     nutations in longitude and obliquity due to the free-excitation
11841**     of the free-core-nutation during the period 1979-2000.  These FCN
11842**     terms, which are time-dependent and unpredictable, are NOT
11843**     included in the present function and, if required, must be
11844**     independently computed.  With the FCN corrections included, the
11845**     present function delivers a pole which is at current epochs
11846**     accurate to a few hundred microarcseconds.  The omission of FCN
11847**     introduces further errors of about that size.
11848**
11849**  5) The present function provides classical nutation.  The MHB2000
11850**     algorithm, from which it is adapted, deals also with (i) the
11851**     offsets between the GCRS and mean poles and (ii) the adjustments
11852**     in longitude and obliquity due to the changed precession rates.
11853**     These additional functions, namely frame bias and precession
11854**     adjustments, are supported by the SOFA functions iauBi00  and
11855**     iauPr00.
11856**
11857**  6) The MHB2000 algorithm also provides "total" nutations, comprising
11858**     the arithmetic sum of the frame bias, precession adjustments,
11859**     luni-solar nutation and planetary nutation.  These total
11860**     nutations can be used in combination with an existing IAU 1976
11861**     precession implementation, such as iauPmat76,  to deliver GCRS-
11862**     to-true predictions of sub-mas accuracy at current dates.
11863**     However, there are three shortcomings in the MHB2000 model that
11864**     must be taken into account if more accurate or definitive results
11865**     are required (see Wallace 2002):
11866**
11867**       (i) The MHB2000 total nutations are simply arithmetic sums,
11868**           yet in reality the various components are successive Euler
11869**           rotations.  This slight lack of rigor leads to cross terms
11870**           that exceed 1 mas after a century.  The rigorous procedure
11871**           is to form the GCRS-to-true rotation matrix by applying the
11872**           bias, precession and nutation in that order.
11873**
11874**      (ii) Although the precession adjustments are stated to be with
11875**           respect to Lieske et al. (1977), the MHB2000 model does
11876**           not specify which set of Euler angles are to be used and
11877**           how the adjustments are to be applied.  The most literal
11878**           and straightforward procedure is to adopt the 4-rotation
11879**           epsilon_0, psi_A, omega_A, xi_A option, and to add DPSIPR
11880**           to psi_A and DEPSPR to both omega_A and eps_A.
11881**
11882**     (iii) The MHB2000 model predates the determination by Chapront
11883**           et al. (2002) of a 14.6 mas displacement between the
11884**           J2000.0 mean equinox and the origin of the ICRS frame.  It
11885**           should, however, be noted that neglecting this displacement
11886**           when calculating star coordinates does not lead to a
11887**           14.6 mas change in right ascension, only a small second-
11888**           order distortion in the pattern of the precession-nutation
11889**           effect.
11890**
11891**     For these reasons, the SOFA functions do not generate the "total
11892**     nutations" directly, though they can of course easily be
11893**     generated by calling iauBi00, iauPr00 and the present function
11894**     and adding the results.
11895**
11896**  7) The MHB2000 model contains 41 instances where the same frequency
11897**     appears multiple times, of which 38 are duplicates and three are
11898**     triplicates.  To keep the present code close to the original MHB
11899**     algorithm, this small inefficiency has not been corrected.
11900**
11901**  Called:
11902**     iauFal03     mean anomaly of the Moon
11903**     iauFaf03     mean argument of the latitude of the Moon
11904**     iauFaom03    mean longitude of the Moon's ascending node
11905**     iauFame03    mean longitude of Mercury
11906**     iauFave03    mean longitude of Venus
11907**     iauFae03     mean longitude of Earth
11908**     iauFama03    mean longitude of Mars
11909**     iauFaju03    mean longitude of Jupiter
11910**     iauFasa03    mean longitude of Saturn
11911**     iauFaur03    mean longitude of Uranus
11912**     iauFapa03    general accumulated precession in longitude
11913**
11914**  References:
11915**
11916**     Chapront, J., Chapront-Touze, M. & Francou, G. 2002,
11917**     Astron.Astrophys. 387, 700
11918**
11919**     Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977,
11920**     Astron.Astrophys. 58, 1-16
11921**
11922**     Mathews, P.M., Herring, T.A., Buffet, B.A. 2002, J.Geophys.Res.
11923**     107, B4.  The MHB_2000 code itself was obtained on 9th September
11924**     2002 from ftp//maia.usno.navy.mil/conv2000/chapter5/IAU2000A.
11925**
11926**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
11927**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
11928**
11929**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
11930**     Astron.Astrophys.Supp.Ser. 135, 111
11931**
11932**     Wallace, P.T., "Software for Implementing the IAU 2000
11933**     Resolutions", in IERS Workshop 5.1 (2002)
11934**
11935*/
11936
11937
11938
11939void iauNut00b(double date1, double date2, double *dpsi, double *deps)
11940/*
11941**  - - - - - - - - - -
11942**   i a u N u t 0 0 b
11943**  - - - - - - - - - -
11944**
11945**  Nutation, IAU 2000B model.
11946**
11947**  This function is part of the International Astronomical Union's
11948**  SOFA (Standards Of Fundamental Astronomy) software collection.
11949**
11950**  Status:  canonical model.
11951**
11952**  Given:
11953**     date1,date2   double    TT as a 2-part Julian Date (Note 1)
11954**
11955**  Returned:
11956**     dpsi,deps     double    nutation, luni-solar + planetary (Note 2)
11957**
11958**  Notes:
11959**
11960**  1) The TT date date1+date2 is a Julian Date, apportioned in any
11961**     convenient way between the two arguments.  For example,
11962**     JD(TT)=2450123.7 could be expressed in any of these ways,
11963**     among others:
11964**
11965**            date1          date2
11966**
11967**         2450123.7           0.0       (JD method)
11968**         2451545.0       -1421.3       (J2000 method)
11969**         2400000.5       50123.2       (MJD method)
11970**         2450123.5           0.2       (date & time method)
11971**
11972**     The JD method is the most natural and convenient to use in
11973**     cases where the loss of several decimal digits of resolution
11974**     is acceptable.  The J2000 method is best matched to the way
11975**     the argument is handled internally and will deliver the
11976**     optimum resolution.  The MJD method and the date & time methods
11977**     are both good compromises between resolution and convenience.
11978**
11979**  2) The nutation components in longitude and obliquity are in radians
11980**     and with respect to the equinox and ecliptic of date.  The
11981**     obliquity at J2000.0 is assumed to be the Lieske et al. (1977)
11982**     value of 84381.448 arcsec.  (The errors that result from using
11983**     this function with the IAU 2006 value of 84381.406 arcsec can be
11984**     neglected.)
11985**
11986**     The nutation model consists only of luni-solar terms, but
11987**     includes also a fixed offset which compensates for certain long-
11988**     period planetary terms (Note 7).
11989**
11990**  3) This function is an implementation of the IAU 2000B abridged
11991**     nutation model formally adopted by the IAU General Assembly in
11992**     2000.  The function computes the MHB_2000_SHORT luni-solar
11993**     nutation series (Luzum 2001), but without the associated
11994**     corrections for the precession rate adjustments and the offset
11995**     between the GCRS and J2000.0 mean poles.
11996**
11997**  4) The full IAU 2000A (MHB2000) nutation model contains nearly 1400
11998**     terms.  The IAU 2000B model (McCarthy & Luzum 2003) contains only
11999**     77 terms, plus additional simplifications, yet still delivers
12000**     results of 1 mas accuracy at present epochs.  This combination of
12001**     accuracy and size makes the IAU 2000B abridged nutation model
12002**     suitable for most practical applications.
12003**
12004**     The function delivers a pole accurate to 1 mas from 1900 to 2100
12005**     (usually better than 1 mas, very occasionally just outside
12006**     1 mas).  The full IAU 2000A model, which is implemented in the
12007**     function iauNut00a (q.v.), delivers considerably greater accuracy
12008**     at current dates;  however, to realize this improved accuracy,
12009**     corrections for the essentially unpredictable free-core-nutation
12010**     (FCN) must also be included.
12011**
12012**  5) The present function provides classical nutation.  The
12013**     MHB_2000_SHORT algorithm, from which it is adapted, deals also
12014**     with (i) the offsets between the GCRS and mean poles and (ii) the
12015**     adjustments in longitude and obliquity due to the changed
12016**     precession rates.  These additional functions, namely frame bias
12017**     and precession adjustments, are supported by the SOFA functions
12018**     iauBi00  and iauPr00.
12019**
12020**  6) The MHB_2000_SHORT algorithm also provides "total" nutations,
12021**     comprising the arithmetic sum of the frame bias, precession
12022**     adjustments, and nutation (luni-solar + planetary).  These total
12023**     nutations can be used in combination with an existing IAU 1976
12024**     precession implementation, such as iauPmat76,  to deliver GCRS-
12025**     to-true predictions of mas accuracy at current epochs.  However,
12026**     for symmetry with the iauNut00a  function (q.v. for the reasons),
12027**     the SOFA functions do not generate the "total nutations"
12028**     directly.  Should they be required, they could of course easily
12029**     be generated by calling iauBi00, iauPr00 and the present function
12030**     and adding the results.
12031**
12032**  7) The IAU 2000B model includes "planetary bias" terms that are
12033**     fixed in size but compensate for long-period nutations.  The
12034**     amplitudes quoted in McCarthy & Luzum (2003), namely
12035**     Dpsi = -1.5835 mas and Depsilon = +1.6339 mas, are optimized for
12036**     the "total nutations" method described in Note 6.  The Luzum
12037**     (2001) values used in this SOFA implementation, namely -0.135 mas
12038**     and +0.388 mas, are optimized for the "rigorous" method, where
12039**     frame bias, precession and nutation are applied separately and in
12040**     that order.  During the interval 1995-2050, the SOFA
12041**     implementation delivers a maximum error of 1.001 mas (not
12042**     including FCN).
12043**
12044**  References:
12045**
12046**     Lieske, J.H., Lederle, T., Fricke, W., Morando, B., "Expressions
12047**     for the precession quantities based upon the IAU /1976/ system of
12048**     astronomical constants", Astron.Astrophys. 58, 1-2, 1-16. (1977)
12049**
12050**     Luzum, B., private communication, 2001 (Fortran code
12051**     MHB_2000_SHORT)
12052**
12053**     McCarthy, D.D. & Luzum, B.J., "An abridged model of the
12054**     precession-nutation of the celestial pole", Cel.Mech.Dyn.Astron.
12055**     85, 37-49 (2003)
12056**
12057**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
12058**     Francou, G., Laskar, J., Astron.Astrophys. 282, 663-683 (1994)
12059**
12060*/
12061
12062
12063
12064void iauNut06a(double date1, double date2, double *dpsi, double *deps)
12065/*
12066**  - - - - - - - - - -
12067**   i a u N u t 0 6 a
12068**  - - - - - - - - - -
12069**
12070**  IAU 2000A nutation with adjustments to match the IAU 2006
12071**  precession.
12072**
12073**  Given:
12074**     date1,date2   double   TT as a 2-part Julian Date (Note 1)
12075**
12076**  Returned:
12077**     dpsi,deps     double   nutation, luni-solar + planetary (Note 2)
12078**
12079**  Status:  canonical model.
12080**
12081**  Notes:
12082**
12083**  1) The TT date date1+date2 is a Julian Date, apportioned in any
12084**     convenient way between the two arguments.  For example,
12085**     JD(TT)=2450123.7 could be expressed in any of these ways,
12086**     among others:
12087**
12088**            date1          date2
12089**
12090**         2450123.7           0.0       (JD method)
12091**         2451545.0       -1421.3       (J2000 method)
12092**         2400000.5       50123.2       (MJD method)
12093**         2450123.5           0.2       (date & time method)
12094**
12095**     The JD method is the most natural and convenient to use in
12096**     cases where the loss of several decimal digits of resolution
12097**     is acceptable.  The J2000 method is best matched to the way
12098**     the argument is handled internally and will deliver the
12099**     optimum resolution.  The MJD method and the date & time methods
12100**     are both good compromises between resolution and convenience.
12101**
12102**  2) The nutation components in longitude and obliquity are in radians
12103**     and with respect to the mean equinox and ecliptic of date,
12104**     IAU 2006 precession model (Hilton et al. 2006, Capitaine et al.
12105**     2005).
12106**
12107**  3) The function first computes the IAU 2000A nutation, then applies
12108**     adjustments for (i) the consequences of the change in obliquity
12109**     from the IAU 1980 ecliptic to the IAU 2006 ecliptic and (ii) the
12110**     secular variation in the Earth's dynamical form factor J2.
12111**
12112**  4) The present function provides classical nutation, complementing
12113**     the IAU 2000 frame bias and IAU 2006 precession.  It delivers a
12114**     pole which is at current epochs accurate to a few tens of
12115**     microarcseconds, apart from the free core nutation.
12116**
12117**  Called:
12118**     iauNut00a    nutation, IAU 2000A
12119**
12120**  References:
12121**
12122**     Chapront, J., Chapront-Touze, M. & Francou, G. 2002,
12123**     Astron.Astrophys. 387, 700
12124**
12125**     Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977,
12126**     Astron.Astrophys. 58, 1-16
12127**
12128**     Mathews, P.M., Herring, T.A., Buffet, B.A. 2002, J.Geophys.Res.
12129**     107, B4.  The MHB_2000 code itself was obtained on 9th September
12130**     2002 from ftp//maia.usno.navy.mil/conv2000/chapter5/IAU2000A.
12131**
12132**     Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
12133**     Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
12134**
12135**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
12136**     Astron.Astrophys.Supp.Ser. 135, 111
12137**
12138**     Wallace, P.T., "Software for Implementing the IAU 2000
12139**     Resolutions", in IERS Workshop 5.1 (2002)
12140**
12141*/
12142
12143
12144
12145void iauNut80(double date1, double date2, double *dpsi, double *deps)
12146/*
12147**  - - - - - - - - -
12148**   i a u N u t 8 0
12149**  - - - - - - - - -
12150**
12151**  Nutation, IAU 1980 model.
12152**
12153**  This function is part of the International Astronomical Union's
12154**  SOFA (Standards Of Fundamental Astronomy) software collection.
12155**
12156**  Status:  canonical model.
12157**
12158**  Given:
12159**     date1,date2   double    TT as a 2-part Julian Date (Note 1)
12160**
12161**  Returned:
12162**     dpsi          double    nutation in longitude (radians)
12163**     deps          double    nutation in obliquity (radians)
12164**
12165**  Notes:
12166**
12167**  1) The TT date date1+date2 is a Julian Date, apportioned in any
12168**     convenient way between the two arguments.  For example,
12169**     JD(TT)=2450123.7 could be expressed in any of these ways,
12170**     among others:
12171**
12172**            date1          date2
12173**
12174**         2450123.7           0.0       (JD method)
12175**         2451545.0       -1421.3       (J2000 method)
12176**         2400000.5       50123.2       (MJD method)
12177**         2450123.5           0.2       (date & time method)
12178**
12179**     The JD method is the most natural and convenient to use in
12180**     cases where the loss of several decimal digits of resolution
12181**     is acceptable.  The J2000 method is best matched to the way
12182**     the argument is handled internally and will deliver the
12183**     optimum resolution.  The MJD method and the date & time methods
12184**     are both good compromises between resolution and convenience.
12185**
12186**  2) The nutation components are with respect to the ecliptic of
12187**     date.
12188**
12189**  Called:
12190**     iauAnpm      normalize angle into range +/- pi
12191**
12192**  Reference:
12193**
12194**     Explanatory Supplement to the Astronomical Almanac,
12195**     P. Kenneth Seidelmann (ed), University Science Books (1992),
12196**     Section 3.222 (p111).
12197**
12198*/
12199
12200
12201
12202void iauNutm80(double date1, double date2, double rmatn[3][3])
12203/*
12204**  - - - - - - - - - -
12205**   i a u N u t m 8 0
12206**  - - - - - - - - - -
12207**
12208**  Form the matrix of nutation for a given date, IAU 1980 model.
12209**
12210**  This function is part of the International Astronomical Union's
12211**  SOFA (Standards Of Fundamental Astronomy) software collection.
12212**
12213**  Status:  support function.
12214**
12215**  Given:
12216**     date1,date2    double          TDB date (Note 1)
12217**
12218**  Returned:
12219**     rmatn          double[3][3]    nutation matrix
12220**
12221**  Notes:
12222**
12223**  1) The TT date date1+date2 is a Julian Date, apportioned in any
12224**     convenient way between the two arguments.  For example,
12225**     JD(TT)=2450123.7 could be expressed in any of these ways,
12226**     among others:
12227**
12228**            date1          date2
12229**
12230**         2450123.7           0.0       (JD method)
12231**         2451545.0       -1421.3       (J2000 method)
12232**         2400000.5       50123.2       (MJD method)
12233**         2450123.5           0.2       (date & time method)
12234**
12235**     The JD method is the most natural and convenient to use in
12236**     cases where the loss of several decimal digits of resolution
12237**     is acceptable.  The J2000 method is best matched to the way
12238**     the argument is handled internally and will deliver the
12239**     optimum resolution.  The MJD method and the date & time methods
12240**     are both good compromises between resolution and convenience.
12241**
12242**  2) The matrix operates in the sense V(true) = rmatn * V(mean),
12243**     where the p-vector V(true) is with respect to the true
12244**     equatorial triad of date and the p-vector V(mean) is with
12245**     respect to the mean equatorial triad of date.
12246**
12247**  Called:
12248**     iauNut80     nutation, IAU 1980
12249**     iauObl80     mean obliquity, IAU 1980
12250**     iauNumat     form nutation matrix
12251**
12252*/
12253
12254
12255
12256double iauObl06(double date1, double date2)
12257/*
12258**  - - - - - - - - -
12259**   i a u O b l 0 6
12260**  - - - - - - - - -
12261**
12262**  Mean obliquity of the ecliptic, IAU 2006 precession model.
12263**
12264**  This function is part of the International Astronomical Union's
12265**  SOFA (Standards Of Fundamental Astronomy) software collection.
12266**
12267**  Status:  canonical model.
12268**
12269**  Given:
12270**     date1,date2  double   TT as a 2-part Julian Date (Note 1)
12271**
12272**  Returned (function value):
12273**                  double   obliquity of the ecliptic (radians, Note 2)
12274**
12275**  Notes:
12276**
12277**  1) The TT date date1+date2 is a Julian Date, apportioned in any
12278**     convenient way between the two arguments.  For example,
12279**     JD(TT)=2450123.7 could be expressed in any of these ways,
12280**     among others:
12281**
12282**            date1          date2
12283**
12284**         2450123.7           0.0       (JD method)
12285**         2451545.0       -1421.3       (J2000 method)
12286**         2400000.5       50123.2       (MJD method)
12287**         2450123.5           0.2       (date & time method)
12288**
12289**     The JD method is the most natural and convenient to use in
12290**     cases where the loss of several decimal digits of resolution
12291**     is acceptable.  The J2000 method is best matched to the way
12292**     the argument is handled internally and will deliver the
12293**     optimum resolution.  The MJD method and the date & time methods
12294**     are both good compromises between resolution and convenience.
12295**
12296**  2) The result is the angle between the ecliptic and mean equator of
12297**     date date1+date2.
12298**
12299**  Reference:
12300**
12301**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
12302**
12303*/
12304
12305
12306
12307double iauObl80(double date1, double date2)
12308/*
12309**  - - - - - - - - -
12310**   i a u O b l 8 0
12311**  - - - - - - - - -
12312**
12313**  Mean obliquity of the ecliptic, IAU 1980 model.
12314**
12315**  This function is part of the International Astronomical Union's
12316**  SOFA (Standards Of Fundamental Astronomy) software collection.
12317**
12318**  Status:  canonical model.
12319**
12320**  Given:
12321**     date1,date2   double    TT as a 2-part Julian Date (Note 1)
12322**
12323**  Returned (function value):
12324**                   double    obliquity of the ecliptic (radians, Note 2)
12325**
12326**  Notes:
12327**
12328**  1) The TT date date1+date2 is a Julian Date, apportioned in any
12329**     convenient way between the two arguments.  For example,
12330**     JD(TT)=2450123.7 could be expressed in any of these ways,
12331**     among others:
12332**
12333**            date1          date2
12334**
12335**         2450123.7           0.0       (JD method)
12336**         2451545.0       -1421.3       (J2000 method)
12337**         2400000.5       50123.2       (MJD method)
12338**         2450123.5           0.2       (date & time method)
12339**
12340**     The JD method is the most natural and convenient to use in
12341**     cases where the loss of several decimal digits of resolution
12342**     is acceptable.  The J2000 method is best matched to the way
12343**     the argument is handled internally and will deliver the
12344**     optimum resolution.  The MJD method and the date & time methods
12345**     are both good compromises between resolution and convenience.
12346**
12347**  2) The result is the angle between the ecliptic and mean equator of
12348**     date date1+date2.
12349**
12350**  Reference:
12351**
12352**     Explanatory Supplement to the Astronomical Almanac,
12353**     P. Kenneth Seidelmann (ed), University Science Books (1992),
12354**     Expression 3.222-1 (p114).
12355**
12356*/
12357
12358
12359
12360void iauP06e(double date1, double date2,
12361             double *eps0, double *psia, double *oma, double *bpa,
12362             double *bqa, double *pia, double *bpia,
12363             double *epsa, double *chia, double *za, double *zetaa,
12364             double *thetaa, double *pa,
12365             double *gam, double *phi, double *psi)
12366/*
12367**  - - - - - - - -
12368**   i a u P 0 6 e
12369**  - - - - - - - -
12370**
12371**  Precession angles, IAU 2006, equinox based.
12372**
12373**  This function is part of the International Astronomical Union's
12374**  SOFA (Standards Of Fundamental Astronomy) software collection.
12375**
12376**  Status:  canonical models.
12377**
12378**  Given:
12379**     date1,date2   double   TT as a 2-part Julian Date (Note 1)
12380**
12381**  Returned (see Note 2):
12382**     eps0          double   epsilon_0
12383**     psia          double   psi_A
12384**     oma           double   omega_A
12385**     bpa           double   P_A
12386**     bqa           double   Q_A
12387**     pia           double   pi_A
12388**     bpia          double   Pi_A
12389**     epsa          double   obliquity epsilon_A
12390**     chia          double   chi_A
12391**     za            double   z_A
12392**     zetaa         double   zeta_A
12393**     thetaa        double   theta_A
12394**     pa            double   p_A
12395**     gam           double   F-W angle gamma_J2000
12396**     phi           double   F-W angle phi_J2000
12397**     psi           double   F-W angle psi_J2000
12398**
12399**  Notes:
12400**
12401**  1) The TT date date1+date2 is a Julian Date, apportioned in any
12402**     convenient way between the two arguments.  For example,
12403**     JD(TT)=2450123.7 could be expressed in any of these ways,
12404**     among others:
12405**
12406**            date1          date2
12407**
12408**         2450123.7           0.0       (JD method)
12409**         2451545.0       -1421.3       (J2000 method)
12410**         2400000.5       50123.2       (MJD method)
12411**         2450123.5           0.2       (date & time method)
12412**
12413**     The JD method is the most natural and convenient to use in
12414**     cases where the loss of several decimal digits of resolution
12415**     is acceptable.  The J2000 method is best matched to the way
12416**     the argument is handled internally and will deliver the
12417**     optimum resolution.  The MJD method and the date & time methods
12418**     are both good compromises between resolution and convenience.
12419**
12420**  2) This function returns the set of equinox based angles for the
12421**     Capitaine et al. "P03" precession theory, adopted by the IAU in
12422**     2006.  The angles are set out in Table 1 of Hilton et al. (2006):
12423**
12424**     eps0   epsilon_0   obliquity at J2000.0
12425**     psia   psi_A       luni-solar precession
12426**     oma    omega_A     inclination of equator wrt J2000.0 ecliptic
12427**     bpa    P_A         ecliptic pole x, J2000.0 ecliptic triad
12428**     bqa    Q_A         ecliptic pole -y, J2000.0 ecliptic triad
12429**     pia    pi_A        angle between moving and J2000.0 ecliptics
12430**     bpia   Pi_A        longitude of ascending node of the ecliptic
12431**     epsa   epsilon_A   obliquity of the ecliptic
12432**     chia   chi_A       planetary precession
12433**     za     z_A         equatorial precession: -3rd 323 Euler angle
12434**     zetaa  zeta_A      equatorial precession: -1st 323 Euler angle
12435**     thetaa theta_A     equatorial precession: 2nd 323 Euler angle
12436**     pa     p_A         general precession (n.b. see below)
12437**     gam    gamma_J2000 J2000.0 RA difference of ecliptic poles
12438**     phi    phi_J2000   J2000.0 codeclination of ecliptic pole
12439**     psi    psi_J2000   longitude difference of equator poles, J2000.0
12440**
12441**     The returned values are all radians.
12442**
12443**     Note that the t^5 coefficient in the series for p_A from
12444**     Capitaine et al. (2003) is incorrectly signed in Hilton et al.
12445**     (2006).
12446**
12447**  3) Hilton et al. (2006) Table 1 also contains angles that depend on
12448**     models distinct from the P03 precession theory itself, namely the
12449**     IAU 2000A frame bias and nutation.  The quoted polynomials are
12450**     used in other SOFA functions:
12451**
12452**     . iauXy06  contains the polynomial parts of the X and Y series.
12453**
12454**     . iauS06  contains the polynomial part of the s+XY/2 series.
12455**
12456**     . iauPfw06  implements the series for the Fukushima-Williams
12457**       angles that are with respect to the GCRS pole (i.e. the variants
12458**       that include frame bias).
12459**
12460**  4) The IAU resolution stipulated that the choice of parameterization
12461**     was left to the user, and so an IAU compliant precession
12462**     implementation can be constructed using various combinations of
12463**     the angles returned by the present function.
12464**
12465**  5) The parameterization used by SOFA is the version of the Fukushima-
12466**     Williams angles that refers directly to the GCRS pole.  These
12467**     angles may be calculated by calling the function iauPfw06.  SOFA
12468**     also supports the direct computation of the CIP GCRS X,Y by
12469**     series, available by calling iauXy06.
12470**
12471**  6) The agreement between the different parameterizations is at the
12472**     1 microarcsecond level in the present era.
12473**
12474**  7) When constructing a precession formulation that refers to the GCRS
12475**     pole rather than the dynamical pole, it may (depending on the
12476**     choice of angles) be necessary to introduce the frame bias
12477**     explicitly.
12478**
12479**  8) It is permissible to re-use the same variable in the returned
12480**     arguments.  The quantities are stored in the stated order.
12481**
12482**  References:
12483**
12484**     Capitaine, N., Wallace, P.T. & Chapront, J., 2003,
12485**     Astron.Astrophys., 412, 567
12486**
12487**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
12488**
12489**  Called:
12490**     iauObl06     mean obliquity, IAU 2006
12491**
12492*/
12493
12494
12495
12496void iauP2pv(double p[3], double pv[2][3])
12497/*
12498**  - - - - - - - -
12499**   i a u P 2 p v
12500**  - - - - - - - -
12501**
12502**  Extend a p-vector to a pv-vector by appending a zero velocity.
12503**
12504**  This function is part of the International Astronomical Union's
12505**  SOFA (Standards Of Fundamental Astronomy) software collection.
12506**
12507**  Status:  vector/matrix support function.
12508**
12509**  Given:
12510**     p        double[3]       p-vector
12511**
12512**  Returned:
12513**     pv       double[2][3]    pv-vector
12514**
12515**  Called:
12516**     iauCp        copy p-vector
12517**     iauZp        zero p-vector
12518**
12519*/
12520
12521
12522
12523void iauP2s(double p[3], double *theta, double *phi, double *r)
12524/*
12525**  - - - - - - -
12526**   i a u P 2 s
12527**  - - - - - - -
12528**
12529**  P-vector to spherical polar coordinates.
12530**
12531**  This function is part of the International Astronomical Union's
12532**  SOFA (Standards Of Fundamental Astronomy) software collection.
12533**
12534**  Status:  vector/matrix support function.
12535**
12536**  Given:
12537**     p        double[3]    p-vector
12538**
12539**  Returned:
12540**     theta    double       longitude angle (radians)
12541**     phi      double       latitude angle (radians)
12542**     r        double       radial distance
12543**
12544**  Notes:
12545**
12546**  1) If P is null, zero theta, phi and r are returned.
12547**
12548**  2) At either pole, zero theta is returned.
12549**
12550**  Called:
12551**     iauC2s       p-vector to spherical
12552**     iauPm        modulus of p-vector
12553**
12554*/
12555
12556
12557
12558double iauPap(double a[3], double b[3])
12559/*
12560**  - - - - - - -
12561**   i a u P a p
12562**  - - - - - - -
12563**
12564**  Position-angle from two p-vectors.
12565**
12566**  This function is part of the International Astronomical Union's
12567**  SOFA (Standards Of Fundamental Astronomy) software collection.
12568**
12569**  Status:  vector/matrix support function.
12570**
12571**  Given:
12572**     a      double[3]  direction of reference point
12573**     b      double[3]  direction of point whose PA is required
12574**
12575**  Returned (function value):
12576**            double     position angle of b with respect to a (radians)
12577**
12578**  Notes:
12579**
12580**  1) The result is the position angle, in radians, of direction b with
12581**     respect to direction a.  It is in the range -pi to +pi.  The
12582**     sense is such that if b is a small distance "north" of a the
12583**     position angle is approximately zero, and if b is a small
12584**     distance "east" of a the position angle is approximately +pi/2.
12585**
12586**  2) The vectors a and b need not be of unit length.
12587**
12588**  3) Zero is returned if the two directions are the same or if either
12589**     vector is null.
12590**
12591**  4) If vector a is at a pole, the result is ill-defined.
12592**
12593**  Called:
12594**     iauPn        decompose p-vector into modulus and direction
12595**     iauPm        modulus of p-vector
12596**     iauPxp       vector product of two p-vectors
12597**     iauPmp       p-vector minus p-vector
12598**     iauPdp       scalar product of two p-vectors
12599**
12600*/
12601
12602
12603
12604double iauPas(double al, double ap, double bl, double bp)
12605/*
12606**  - - - - - - -
12607**   i a u P a s
12608**  - - - - - - -
12609**
12610**  Position-angle from spherical coordinates.
12611**
12612**  This function is part of the International Astronomical Union's
12613**  SOFA (Standards Of Fundamental Astronomy) software collection.
12614**
12615**  Status:  vector/matrix support function.
12616**
12617**  Given:
12618**     al     double     longitude of point A (e.g. RA) in radians
12619**     ap     double     latitude of point A (e.g. Dec) in radians
12620**     bl     double     longitude of point B
12621**     bp     double     latitude of point B
12622**
12623**  Returned (function value):
12624**            double     position angle of B with respect to A
12625**
12626**  Notes:
12627**
12628**  1) The result is the bearing (position angle), in radians, of point
12629**     B with respect to point A.  It is in the range -pi to +pi.  The
12630**     sense is such that if B is a small distance "east" of point A,
12631**     the bearing is approximately +pi/2.
12632**
12633**  2) Zero is returned if the two points are coincident.
12634**
12635*/
12636
12637
12638
12639void iauPb06(double date1, double date2,
12640             double *bzeta, double *bz, double *btheta)
12641/*
12642**  - - - - - - - -
12643**   i a u P b 0 6
12644**  - - - - - - - -
12645**
12646**  This function forms three Euler angles which implement general
12647**  precession from epoch J2000.0, using the IAU 2006 model.  Frame
12648**  bias (the offset between ICRS and mean J2000.0) is included.
12649**
12650**  This function is part of the International Astronomical Union's
12651**  SOFA (Standards Of Fundamental Astronomy) software collection.
12652**
12653**  Status:  support function.
12654**
12655**  Given:
12656**     date1,date2  double   TT as a 2-part Julian Date (Note 1)
12657**
12658**  Returned:
12659**     bzeta        double   1st rotation: radians cw around z
12660**     bz           double   3rd rotation: radians cw around z
12661**     btheta       double   2nd rotation: radians ccw around y
12662**
12663**  Notes:
12664**
12665**  1) The TT date date1+date2 is a Julian Date, apportioned in any
12666**     convenient way between the two arguments.  For example,
12667**     JD(TT)=2450123.7 could be expressed in any of these ways,
12668**     among others:
12669**
12670**            date1          date2
12671**
12672**         2450123.7           0.0       (JD method)
12673**         2451545.0       -1421.3       (J2000 method)
12674**         2400000.5       50123.2       (MJD method)
12675**         2450123.5           0.2       (date & time method)
12676**
12677**     The JD method is the most natural and convenient to use in
12678**     cases where the loss of several decimal digits of resolution
12679**     is acceptable.  The J2000 method is best matched to the way
12680**     the argument is handled internally and will deliver the
12681**     optimum resolution.  The MJD method and the date & time methods
12682**     are both good compromises between resolution and convenience.
12683**
12684**  2) The traditional accumulated precession angles zeta_A, z_A,
12685**     theta_A cannot be obtained in the usual way, namely through
12686**     polynomial expressions, because of the frame bias.  The latter
12687**     means that two of the angles undergo rapid changes near this
12688**     date.  They are instead the results of decomposing the
12689**     precession-bias matrix obtained by using the Fukushima-Williams
12690**     method, which does not suffer from the problem.  The
12691**     decomposition returns values which can be used in the
12692**     conventional formulation and which include frame bias.
12693**
12694**  3) The three angles are returned in the conventional order, which
12695**     is not the same as the order of the corresponding Euler
12696**     rotations.  The precession-bias matrix is
12697**     R_3(-z) x R_2(+theta) x R_3(-zeta).
12698**
12699**  4) Should zeta_A, z_A, theta_A angles be required that do not
12700**     contain frame bias, they are available by calling the SOFA
12701**     function iauP06e.
12702**
12703**  Called:
12704**     iauPmat06    PB matrix, IAU 2006
12705**     iauRz        rotate around Z-axis
12706**
12707*/
12708
12709
12710
12711double iauPdp(double a[3], double b[3])
12712/*
12713**  - - - - - - -
12714**   i a u P d p
12715**  - - - - - - -
12716**
12717**  p-vector inner (=scalar=dot) product.
12718**
12719**  This function is part of the International Astronomical Union's
12720**  SOFA (Standards Of Fundamental Astronomy) software collection.
12721**
12722**  Status:  vector/matrix support function.
12723**
12724**  Given:
12725**     a      double[3]     first p-vector
12726**     b      double[3]     second p-vector
12727**
12728**  Returned (function value):
12729**            double        a . b
12730**
12731*/
12732
12733
12734
12735void iauPfw06(double date1, double date2,
12736              double *gamb, double *phib, double *psib, double *epsa)
12737/*
12738**  - - - - - - - - -
12739**   i a u P f w 0 6
12740**  - - - - - - - - -
12741**
12742**  Precession angles, IAU 2006 (Fukushima-Williams 4-angle formulation).
12743**
12744**  This function is part of the International Astronomical Union's
12745**  SOFA (Standards Of Fundamental Astronomy) software collection.
12746**
12747**  Status:  canonical model.
12748**
12749**  Given:
12750**     date1,date2  double   TT as a 2-part Julian Date (Note 1)
12751**
12752**  Returned:
12753**     gamb         double   F-W angle gamma_bar (radians)
12754**     phib         double   F-W angle phi_bar (radians)
12755**     psib         double   F-W angle psi_bar (radians)
12756**     epsa         double   F-W angle epsilon_A (radians)
12757**
12758**  Notes:
12759**
12760**  1) The TT date date1+date2 is a Julian Date, apportioned in any
12761**     convenient way between the two arguments.  For example,
12762**     JD(TT)=2450123.7 could be expressed in any of these ways,
12763**     among others:
12764**
12765**            date1          date2
12766**
12767**         2450123.7           0.0       (JD method)
12768**         2451545.0       -1421.3       (J2000 method)
12769**         2400000.5       50123.2       (MJD method)
12770**         2450123.5           0.2       (date & time method)
12771**
12772**     The JD method is the most natural and convenient to use in
12773**     cases where the loss of several decimal digits of resolution
12774**     is acceptable.  The J2000 method is best matched to the way
12775**     the argument is handled internally and will deliver the
12776**     optimum resolution.  The MJD method and the date & time methods
12777**     are both good compromises between resolution and convenience.
12778**
12779**  2) Naming the following points:
12780**
12781**           e = J2000.0 ecliptic pole,
12782**           p = GCRS pole,
12783**           E = mean ecliptic pole of date,
12784**     and   P = mean pole of date,
12785**
12786**     the four Fukushima-Williams angles are as follows:
12787**
12788**        gamb = gamma_bar = epE
12789**        phib = phi_bar = pE
12790**        psib = psi_bar = pEP
12791**        epsa = epsilon_A = EP
12792**
12793**  3) The matrix representing the combined effects of frame bias and
12794**     precession is:
12795**
12796**        PxB = R_1(-epsa).R_3(-psib).R_1(phib).R_3(gamb)
12797**
12798**  4) The matrix representing the combined effects of frame bias,
12799**     precession and nutation is simply:
12800**
12801**        NxPxB = R_1(-epsa-dE).R_3(-psib-dP).R_1(phib).R_3(gamb)
12802**
12803**     where dP and dE are the nutation components with respect to the
12804**     ecliptic of date.
12805**
12806**  Reference:
12807**
12808**     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
12809**
12810**  Called:
12811**     iauObl06     mean obliquity, IAU 2006
12812**
12813*/
12814
12815
12816
12817int iauPlan94(double date1, double date2, int np, double pv[2][3])
12818/*
12819**  - - - - - - - - - -
12820**   i a u P l a n 9 4
12821**  - - - - - - - - - -
12822**
12823**  Approximate heliocentric position and velocity of a nominated major
12824**  planet:  Mercury, Venus, EMB, Mars, Jupiter, Saturn, Uranus or
12825**  Neptune (but not the Earth itself).
12826**
12827**  This function is part of the International Astronomical Union's
12828**  SOFA (Standards Of Fundamental Astronomy) software collection.
12829**
12830**  Status:  support function.
12831**
12832**  n.b. Not IAU-endorsed and without canonical status.
12833**
12834**  Given:
12835**     date1  double       TDB date part A (Note 1)
12836**     date2  double       TDB date part B (Note 1)
12837**     np     int          planet (1=Mercury, 2=Venus, 3=EMB, 4=Mars,
12838**                             5=Jupiter, 6=Saturn, 7=Uranus, 8=Neptune)
12839**
12840**  Returned (argument):
12841**     pv     double[2][3] planet p,v (heliocentric, J2000.0, au,au/d)
12842**
12843**  Returned (function value):
12844**            int          status: -1 = illegal NP (outside 1-8)
12845**                                  0 = OK
12846**                                 +1 = warning: year outside 1000-3000
12847**                                 +2 = warning: failed to converge
12848**
12849**  Notes:
12850**
12851**  1) The date date1+date2 is in the TDB time scale (in practice TT can
12852**     be used) and is a Julian Date, apportioned in any convenient way
12853**     between the two arguments.  For example, JD(TDB)=2450123.7 could
12854**     be expressed in any of these ways, among others:
12855**
12856**            date1          date2
12857**
12858**         2450123.7           0.0       (JD method)
12859**         2451545.0       -1421.3       (J2000 method)
12860**         2400000.5       50123.2       (MJD method)
12861**         2450123.5           0.2       (date & time method)
12862**
12863**     The JD method is the most natural and convenient to use in cases
12864**     where the loss of several decimal digits of resolution is
12865**     acceptable.  The J2000 method is best matched to the way the
12866**     argument is handled internally and will deliver the optimum
12867**     resolution.  The MJD method and the date & time methods are both
12868**     good compromises between resolution and convenience.  The limited
12869**     accuracy of the present algorithm is such that any of the methods
12870**     is satisfactory.
12871**
12872**  2) If an np value outside the range 1-8 is supplied, an error status
12873**     (function value -1) is returned and the pv vector set to zeroes.
12874**
12875**  3) For np=3 the result is for the Earth-Moon Barycenter.  To obtain
12876**     the heliocentric position and velocity of the Earth, use instead
12877**     the SOFA function iauEpv00.
12878**
12879**  4) On successful return, the array pv contains the following:
12880**
12881**        pv[0][0]   x      }
12882**        pv[0][1]   y      } heliocentric position, au
12883**        pv[0][2]   z      }
12884**
12885**        pv[1][0]   xdot   }
12886**        pv[1][1]   ydot   } heliocentric velocity, au/d
12887**        pv[1][2]   zdot   }
12888**
12889**     The reference frame is equatorial and is with respect to the
12890**     mean equator and equinox of epoch J2000.0.
12891**
12892**  5) The algorithm is due to J.L. Simon, P. Bretagnon, J. Chapront,
12893**     M. Chapront-Touze, G. Francou and J. Laskar (Bureau des
12894**     Longitudes, Paris, France).  From comparisons with JPL
12895**     ephemeris DE102, they quote the following maximum errors
12896**     over the interval 1800-2050:
12897**
12898**                     L (arcsec)    B (arcsec)      R (km)
12899**
12900**        Mercury          4             1             300
12901**        Venus            5             1             800
12902**        EMB              6             1            1000
12903**        Mars            17             1            7700
12904**        Jupiter         71             5           76000
12905**        Saturn          81            13          267000
12906**        Uranus          86             7          712000
12907**        Neptune         11             1          253000
12908**
12909**     Over the interval 1000-3000, they report that the accuracy is no
12910**     worse than 1.5 times that over 1800-2050.  Outside 1000-3000 the
12911**     accuracy declines.
12912**
12913**     Comparisons of the present function with the JPL DE200 ephemeris
12914**     give the following RMS errors over the interval 1960-2025:
12915**
12916**                      position (km)     velocity (m/s)
12917**
12918**        Mercury            334               0.437
12919**        Venus             1060               0.855
12920**        EMB               2010               0.815
12921**        Mars              7690               1.98
12922**        Jupiter          71700               7.70
12923**        Saturn          199000              19.4
12924**        Uranus          564000              16.4
12925**        Neptune         158000              14.4
12926**
12927**     Comparisons against DE200 over the interval 1800-2100 gave the
12928**     following maximum absolute differences.  (The results using
12929**     DE406 were essentially the same.)
12930**
12931**                   L (arcsec)   B (arcsec)     R (km)   Rdot (m/s)
12932**
12933**        Mercury        7            1            500       0.7
12934**        Venus          7            1           1100       0.9
12935**        EMB            9            1           1300       1.0
12936**        Mars          26            1           9000       2.5
12937**        Jupiter       78            6          82000       8.2
12938**        Saturn        87           14         263000      24.6
12939**        Uranus        86            7         661000      27.4
12940**        Neptune       11            2         248000      21.4
12941**
12942**  6) The present SOFA re-implementation of the original Simon et al.
12943**     Fortran code differs from the original in the following respects:
12944**
12945**       *  C instead of Fortran.
12946**
12947**       *  The date is supplied in two parts.
12948**
12949**       *  The result is returned only in equatorial Cartesian form;
12950**          the ecliptic longitude, latitude and radius vector are not
12951**          returned.
12952**
12953**       *  The result is in the J2000.0 equatorial frame, not ecliptic.
12954**
12955**       *  More is done in-line: there are fewer calls to subroutines.
12956**
12957**       *  Different error/warning status values are used.
12958**
12959**       *  A different Kepler's-equation-solver is used (avoiding
12960**          use of double precision complex).
12961**
12962**       *  Polynomials in t are nested to minimize rounding errors.
12963**
12964**       *  Explicit double constants are used to avoid mixed-mode
12965**          expressions.
12966**
12967**     None of the above changes affects the result significantly.
12968**
12969**  7) The returned status indicates the most serious condition
12970**     encountered during execution of the function.  Illegal np is
12971**     considered the most serious, overriding failure to converge,
12972**     which in turn takes precedence over the remote date warning.
12973**
12974**  Called:
12975**     iauAnpm      normalize angle into range +/- pi
12976**
12977**  Reference:  Simon, J.L, Bretagnon, P., Chapront, J.,
12978**              Chapront-Touze, M., Francou, G., and Laskar, J.,
12979**              Astron.Astrophys., 282, 663 (1994).
12980**
12981*/
12982
12983
12984
12985double iauPm(double p[3])
12986/*
12987**  - - - - - -
12988**   i a u P m
12989**  - - - - - -
12990**
12991**  Modulus of p-vector.
12992**
12993**  This function is part of the International Astronomical Union's
12994**  SOFA (Standards Of Fundamental Astronomy) software collection.
12995**
12996**  Status:  vector/matrix support function.
12997**
12998**  Given:
12999**     p      double[3]     p-vector
13000**
13001**  Returned (function value):
13002**            double        modulus
13003**
13004*/
13005
13006
13007
13008void iauPmat00(double date1, double date2, double rbp[3][3])
13009/*
13010**  - - - - - - - - - -
13011**   i a u P m a t 0 0
13012**  - - - - - - - - - -
13013**
13014**  Precession matrix (including frame bias) from GCRS to a specified
13015**  date, IAU 2000 model.
13016**
13017**  This function is part of the International Astronomical Union's
13018**  SOFA (Standards Of Fundamental Astronomy) software collection.
13019**
13020**  Status:  support function.
13021**
13022**  Given:
13023**     date1,date2  double          TT as a 2-part Julian Date (Note 1)
13024**
13025**  Returned:
13026**     rbp          double[3][3]    bias-precession matrix (Note 2)
13027**
13028**  Notes:
13029**
13030**  1) The TT date date1+date2 is a Julian Date, apportioned in any
13031**     convenient way between the two arguments.  For example,
13032**     JD(TT)=2450123.7 could be expressed in any of these ways,
13033**     among others:
13034**
13035**            date1          date2
13036**
13037**         2450123.7           0.0       (JD method)
13038**         2451545.0       -1421.3       (J2000 method)
13039**         2400000.5       50123.2       (MJD method)
13040**         2450123.5           0.2       (date & time method)
13041**
13042**     The JD method is the most natural and convenient to use in
13043**     cases where the loss of several decimal digits of resolution
13044**     is acceptable.  The J2000 method is best matched to the way
13045**     the argument is handled internally and will deliver the
13046**     optimum resolution.  The MJD method and the date & time methods
13047**     are both good compromises between resolution and convenience.
13048**
13049**  2) The matrix operates in the sense V(date) = rbp * V(GCRS), where
13050**     the p-vector V(GCRS) is with respect to the Geocentric Celestial
13051**     Reference System (IAU, 2000) and the p-vector V(date) is with
13052**     respect to the mean equatorial triad of the given date.
13053**
13054**  Called:
13055**     iauBp00      frame bias and precession matrices, IAU 2000
13056**
13057**  Reference:
13058**
13059**     IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.
13060**     24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.
13061**     (2000)
13062**
13063*/
13064
13065
13066
13067void iauPmat06(double date1, double date2, double rbp[3][3])
13068/*
13069**  - - - - - - - - - -
13070**   i a u P m a t 0 6
13071**  - - - - - - - - - -
13072**
13073**  Precession matrix (including frame bias) from GCRS to a specified
13074**  date, IAU 2006 model.
13075**
13076**  This function is part of the International Astronomical Union's
13077**  SOFA (Standards Of Fundamental Astronomy) software collection.
13078**
13079**  Status:  support function.
13080**
13081**  Given:
13082**     date1,date2  double          TT as a 2-part Julian Date (Note 1)
13083**
13084**  Returned:
13085**     rbp          double[3][3]    bias-precession matrix (Note 2)
13086**
13087**  Notes:
13088**
13089**  1) The TT date date1+date2 is a Julian Date, apportioned in any
13090**     convenient way between the two arguments.  For example,
13091**     JD(TT)=2450123.7 could be expressed in any of these ways,
13092**     among others:
13093**
13094**            date1          date2
13095**
13096**         2450123.7           0.0       (JD method)
13097**         2451545.0       -1421.3       (J2000 method)
13098**         2400000.5       50123.2       (MJD method)
13099**         2450123.5           0.2       (date & time method)
13100**
13101**     The JD method is the most natural and convenient to use in
13102**     cases where the loss of several decimal digits of resolution
13103**     is acceptable.  The J2000 method is best matched to the way
13104**     the argument is handled internally and will deliver the
13105**     optimum resolution.  The MJD method and the date & time methods
13106**     are both good compromises between resolution and convenience.
13107**
13108**  2) The matrix operates in the sense V(date) = rbp * V(GCRS), where
13109**     the p-vector V(GCRS) is with respect to the Geocentric Celestial
13110**     Reference System (IAU, 2000) and the p-vector V(date) is with
13111**     respect to the mean equatorial triad of the given date.
13112**
13113**  Called:
13114**     iauPfw06     bias-precession F-W angles, IAU 2006
13115**     iauFw2m      F-W angles to r-matrix
13116**
13117**  References:
13118**
13119**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
13120**
13121**     IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.
13122**     24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.
13123**     (2000)
13124**
13125**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
13126**
13127*/
13128
13129
13130
13131void iauPmat76(double date1, double date2, double rmatp[3][3])
13132/*
13133**  - - - - - - - - - -
13134**   i a u P m a t 7 6
13135**  - - - - - - - - - -
13136**
13137**  Precession matrix from J2000.0 to a specified date, IAU 1976 model.
13138**
13139**  This function is part of the International Astronomical Union's
13140**  SOFA (Standards Of Fundamental Astronomy) software collection.
13141**
13142**  Status:  support function.
13143**
13144**  Given:
13145**     date1,date2 double       ending date, TT (Note 1)
13146**
13147**  Returned:
13148**     rmatp       double[3][3] precession matrix, J2000.0 -> date1+date2
13149**
13150**  Notes:
13151**
13152**  1) The TT date date1+date2 is a Julian Date, apportioned in any
13153**     convenient way between the two arguments.  For example,
13154**     JD(TT)=2450123.7 could be expressed in any of these ways,
13155**     among others:
13156**
13157**            date1          date2
13158**
13159**         2450123.7           0.0       (JD method)
13160**         2451545.0       -1421.3       (J2000 method)
13161**         2400000.5       50123.2       (MJD method)
13162**         2450123.5           0.2       (date & time method)
13163**
13164**     The JD method is the most natural and convenient to use in
13165**     cases where the loss of several decimal digits of resolution
13166**     is acceptable.  The J2000 method is best matched to the way
13167**     the argument is handled internally and will deliver the
13168**     optimum resolution.  The MJD method and the date & time methods
13169**     are both good compromises between resolution and convenience.
13170**
13171**  2) The matrix operates in the sense V(date) = RMATP * V(J2000),
13172**     where the p-vector V(J2000) is with respect to the mean
13173**     equatorial triad of epoch J2000.0 and the p-vector V(date)
13174**     is with respect to the mean equatorial triad of the given
13175**     date.
13176**
13177**  3) Though the matrix method itself is rigorous, the precession
13178**     angles are expressed through canonical polynomials which are
13179**     valid only for a limited time span.  In addition, the IAU 1976
13180**     precession rate is known to be imperfect.  The absolute accuracy
13181**     of the present formulation is better than 0.1 arcsec from
13182**     1960AD to 2040AD, better than 1 arcsec from 1640AD to 2360AD,
13183**     and remains below 3 arcsec for the whole of the period
13184**     500BC to 3000AD.  The errors exceed 10 arcsec outside the
13185**     range 1200BC to 3900AD, exceed 100 arcsec outside 4200BC to
13186**     5600AD and exceed 1000 arcsec outside 6800BC to 8200AD.
13187**
13188**  Called:
13189**     iauPrec76    accumulated precession angles, IAU 1976
13190**     iauIr        initialize r-matrix to identity
13191**     iauRz        rotate around Z-axis
13192**     iauRy        rotate around Y-axis
13193**     iauCr        copy r-matrix
13194**
13195**  References:
13196**
13197**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
13198**      equations (6) & (7), p283.
13199**
13200**     Kaplan,G.H., 1981. USNO circular no. 163, pA2.
13201**
13202*/
13203
13204
13205
13206void iauPmp(double a[3], double b[3], double amb[3])
13207/*
13208**  - - - - - - -
13209**   i a u P m p
13210**  - - - - - - -
13211**
13212**  P-vector subtraction.
13213**
13214**  This function is part of the International Astronomical Union's
13215**  SOFA (Standards Of Fundamental Astronomy) software collection.
13216**
13217**  Status:  vector/matrix support function.
13218**
13219**  Given:
13220**     a        double[3]      first p-vector
13221**     b        double[3]      second p-vector
13222**
13223**  Returned:
13224**     amb      double[3]      a - b
13225**
13226**  Note:
13227**     It is permissible to re-use the same array for any of the
13228**     arguments.
13229**
13230*/
13231
13232
13233
13234void iauPmpx(double rc, double dc, double pr, double pd,
13235             double px, double rv, double pmt, double pob[3],
13236             double pco[3])
13237/*
13238**  - - - - - - - -
13239**   i a u P m p x
13240**  - - - - - - - -
13241**
13242**  Proper motion and parallax.
13243**
13244**  This function is part of the International Astronomical Union's
13245**  SOFA (Standards of Fundamental Astronomy) software collection.
13246**
13247**  Status:  support function.
13248**
13249**  Given:
13250**     rc,dc  double     ICRS RA,Dec at catalog epoch (radians)
13251**     pr     double     RA proper motion (radians/year, Note 1)
13252**     pd     double     Dec proper motion (radians/year)
13253**     px     double     parallax (arcsec)
13254**     rv     double     radial velocity (km/s, +ve if receding)
13255**     pmt    double     proper motion time interval (SSB, Julian years)
13256**     pob    double[3]  SSB to observer vector (au)
13257**
13258**  Returned:
13259**     pco    double[3]  coordinate direction (BCRS unit vector)
13260**
13261**  Notes:
13262**
13263**  1) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
13264**
13265**  2) The proper motion time interval is for when the starlight
13266**     reaches the solar system barycenter.
13267**
13268**  3) To avoid the need for iteration, the Roemer effect (i.e. the
13269**     small annual modulation of the proper motion coming from the
13270**     changing light time) is applied approximately, using the
13271**     direction of the star at the catalog epoch.
13272**
13273**  References:
13274**
13275**     1984 Astronomical Almanac, pp B39-B41.
13276**
13277**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
13278**     the Astronomical Almanac, 3rd ed., University Science Books
13279**     (2013), Section 7.2.
13280**
13281**  Called:
13282**     iauPdp       scalar product of two p-vectors
13283**     iauPn        decompose p-vector into modulus and direction
13284**
13285*/
13286
13287
13288
13289int iauPmsafe(double ra1, double dec1, double pmr1, double pmd1,
13290              double px1, double rv1,
13291              double ep1a, double ep1b, double ep2a, double ep2b,
13292              double *ra2, double *dec2, double *pmr2, double *pmd2,
13293              double *px2, double *rv2)
13294/*
13295**  - - - - - - - - - -
13296**   i a u P m s a f e
13297**  - - - - - - - - - -
13298**
13299**  Star proper motion:  update star catalog data for space motion, with
13300**  special handling to handle the zero parallax case.
13301**
13302**  This function is part of the International Astronomical Union's
13303**  SOFA (Standards of Fundamental Astronomy) software collection.
13304**
13305**  Status:  support function.
13306**
13307**  Given:
13308**     ra1    double      right ascension (radians), before
13309**     dec1   double      declination (radians), before
13310**     pmr1   double      RA proper motion (radians/year), before
13311**     pmd1   double      Dec proper motion (radians/year), before
13312**     px1    double      parallax (arcseconds), before
13313**     rv1    double      radial velocity (km/s, +ve = receding), before
13314**     ep1a   double      "before" epoch, part A (Note 1)
13315**     ep1b   double      "before" epoch, part B (Note 1)
13316**     ep2a   double      "after" epoch, part A (Note 1)
13317**     ep2b   double      "after" epoch, part B (Note 1)
13318**
13319**  Returned:
13320**     ra2    double      right ascension (radians), after
13321**     dec2   double      declination (radians), after
13322**     pmr2   double      RA proper motion (radians/year), after
13323**     pmd2   double      Dec proper motion (radians/year), after
13324**     px2    double      parallax (arcseconds), after
13325**     rv2    double      radial velocity (km/s, +ve = receding), after
13326**
13327**  Returned (function value):
13328**            int         status:
13329**                         -1 = system error (should not occur)
13330**                          0 = no warnings or errors
13331**                          1 = distance overridden (Note 6)
13332**                          2 = excessive velocity (Note 7)
13333**                          4 = solution didn't converge (Note 8)
13334**                       else = binary logical OR of the above warnings
13335**
13336**  Notes:
13337**
13338**  1) The starting and ending TDB epochs ep1a+ep1b and ep2a+ep2b are
13339**     Julian Dates, apportioned in any convenient way between the two
13340**     parts (A and B).  For example, JD(TDB)=2450123.7 could be
13341**     expressed in any of these ways, among others:
13342**
13343**            epNa            epNb
13344**
13345**         2450123.7           0.0       (JD method)
13346**         2451545.0       -1421.3       (J2000 method)
13347**         2400000.5       50123.2       (MJD method)
13348**         2450123.5           0.2       (date & time method)
13349**
13350**     The JD method is the most natural and convenient to use in cases
13351**     where the loss of several decimal digits of resolution is
13352**     acceptable.  The J2000 method is best matched to the way the
13353**     argument is handled internally and will deliver the optimum
13354**     resolution.  The MJD method and the date & time methods are both
13355**     good compromises between resolution and convenience.
13356**
13357**  2) In accordance with normal star-catalog conventions, the object's
13358**     right ascension and declination are freed from the effects of
13359**     secular aberration.  The frame, which is aligned to the catalog
13360**     equator and equinox, is Lorentzian and centered on the SSB.
13361**
13362**     The proper motions are the rate of change of the right ascension
13363**     and declination at the catalog epoch and are in radians per TDB
13364**     Julian year.
13365**
13366**     The parallax and radial velocity are in the same frame.
13367**
13368**  3) Care is needed with units.  The star coordinates are in radians
13369**     and the proper motions in radians per Julian year, but the
13370**     parallax is in arcseconds.
13371**
13372**  4) The RA proper motion is in terms of coordinate angle, not true
13373**     angle.  If the catalog uses arcseconds for both RA and Dec proper
13374**     motions, the RA proper motion will need to be divided by cos(Dec)
13375**     before use.
13376**
13377**  5) Straight-line motion at constant speed, in the inertial frame, is
13378**     assumed.
13379**
13380**  6) An extremely small (or zero or negative) parallax is overridden
13381**     to ensure that the object is at a finite but very large distance,
13382**     but not so large that the proper motion is equivalent to a large
13383**     but safe speed (about 0.1c using the chosen constant).  A warning
13384**     status of 1 is added to the status if this action has been taken.
13385**
13386**  7) If the space velocity is a significant fraction of c (see the
13387**     constant VMAX in the function iauStarpv), it is arbitrarily set
13388**     to zero.  When this action occurs, 2 is added to the status.
13389**
13390**  8) The relativistic adjustment carried out in the iauStarpv function
13391**     involves an iterative calculation.  If the process fails to
13392**     converge within a set number of iterations, 4 is added to the
13393**     status.
13394**
13395**  Called:
13396**     iauSeps      angle between two points
13397**     iauStarpm    update star catalog data for space motion
13398**
13399*/
13400
13401
13402
13403void iauPn(double p[3], double *r, double u[3])
13404/*
13405**  - - - - - -
13406**   i a u P n
13407**  - - - - - -
13408**
13409**  Convert a p-vector into modulus and unit vector.
13410**
13411**  This function is part of the International Astronomical Union's
13412**  SOFA (Standards Of Fundamental Astronomy) software collection.
13413**
13414**  Status:  vector/matrix support function.
13415**
13416**  Given:
13417**     p        double[3]      p-vector
13418**
13419**  Returned:
13420**     r        double         modulus
13421**     u        double[3]      unit vector
13422**
13423**  Notes:
13424**
13425**  1) If p is null, the result is null.  Otherwise the result is a unit
13426**     vector.
13427**
13428**  2) It is permissible to re-use the same array for any of the
13429**     arguments.
13430**
13431**  Called:
13432**     iauPm        modulus of p-vector
13433**     iauZp        zero p-vector
13434**     iauSxp       multiply p-vector by scalar
13435**
13436*/
13437
13438
13439
13440void iauPn00(double date1, double date2, double dpsi, double deps,
13441             double *epsa,
13442             double rb[3][3], double rp[3][3], double rbp[3][3],
13443             double rn[3][3], double rbpn[3][3])
13444/*
13445**  - - - - - - - -
13446**   i a u P n 0 0
13447**  - - - - - - - -
13448**
13449**  Precession-nutation, IAU 2000 model:  a multi-purpose function,
13450**  supporting classical (equinox-based) use directly and CIO-based
13451**  use indirectly.
13452**
13453**  This function is part of the International Astronomical Union's
13454**  SOFA (Standards Of Fundamental Astronomy) software collection.
13455**
13456**  Status:  support function.
13457**
13458**  Given:
13459**     date1,date2  double          TT as a 2-part Julian Date (Note 1)
13460**     dpsi,deps    double          nutation (Note 2)
13461**
13462**  Returned:
13463**     epsa         double          mean obliquity (Note 3)
13464**     rb           double[3][3]    frame bias matrix (Note 4)
13465**     rp           double[3][3]    precession matrix (Note 5)
13466**     rbp          double[3][3]    bias-precession matrix (Note 6)
13467**     rn           double[3][3]    nutation matrix (Note 7)
13468**     rbpn         double[3][3]    GCRS-to-true matrix (Note 8)
13469**
13470**  Notes:
13471**
13472**  1) The TT date date1+date2 is a Julian Date, apportioned in any
13473**     convenient way between the two arguments.  For example,
13474**     JD(TT)=2450123.7 could be expressed in any of these ways,
13475**     among others:
13476**
13477**            date1          date2
13478**
13479**         2450123.7           0.0       (JD method)
13480**         2451545.0       -1421.3       (J2000 method)
13481**         2400000.5       50123.2       (MJD method)
13482**         2450123.5           0.2       (date & time method)
13483**
13484**     The JD method is the most natural and convenient to use in
13485**     cases where the loss of several decimal digits of resolution
13486**     is acceptable.  The J2000 method is best matched to the way
13487**     the argument is handled internally and will deliver the
13488**     optimum resolution.  The MJD method and the date & time methods
13489**     are both good compromises between resolution and convenience.
13490**
13491**  2) The caller is responsible for providing the nutation components;
13492**     they are in longitude and obliquity, in radians and are with
13493**     respect to the equinox and ecliptic of date.  For high-accuracy
13494**     applications, free core nutation should be included as well as
13495**     any other relevant corrections to the position of the CIP.
13496**
13497**  3) The returned mean obliquity is consistent with the IAU 2000
13498**     precession-nutation models.
13499**
13500**  4) The matrix rb transforms vectors from GCRS to J2000.0 mean
13501**     equator and equinox by applying frame bias.
13502**
13503**  5) The matrix rp transforms vectors from J2000.0 mean equator and
13504**     equinox to mean equator and equinox of date by applying
13505**     precession.
13506**
13507**  6) The matrix rbp transforms vectors from GCRS to mean equator and
13508**     equinox of date by applying frame bias then precession.  It is
13509**     the product rp x rb.
13510**
13511**  7) The matrix rn transforms vectors from mean equator and equinox of
13512**     date to true equator and equinox of date by applying the nutation
13513**     (luni-solar + planetary).
13514**
13515**  8) The matrix rbpn transforms vectors from GCRS to true equator and
13516**     equinox of date.  It is the product rn x rbp, applying frame
13517**     bias, precession and nutation in that order.
13518**
13519**  9) It is permissible to re-use the same array in the returned
13520**     arguments.  The arrays are filled in the order given.
13521**
13522**  Called:
13523**     iauPr00      IAU 2000 precession adjustments
13524**     iauObl80     mean obliquity, IAU 1980
13525**     iauBp00      frame bias and precession matrices, IAU 2000
13526**     iauCr        copy r-matrix
13527**     iauNumat     form nutation matrix
13528**     iauRxr       product of two r-matrices
13529**
13530**  Reference:
13531**
13532**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
13533**     "Expressions for the Celestial Intermediate Pole and Celestial
13534**     Ephemeris Origin consistent with the IAU 2000A precession-
13535**     nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
13536**
13537**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
13538**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
13539**
13540*/
13541
13542
13543
13544void iauPn00a(double date1, double date2,
13545              double *dpsi, double *deps, double *epsa,
13546              double rb[3][3], double rp[3][3], double rbp[3][3],
13547              double rn[3][3], double rbpn[3][3])
13548/*
13549**  - - - - - - - - -
13550**   i a u P n 0 0 a
13551**  - - - - - - - - -
13552**
13553**  Precession-nutation, IAU 2000A model:  a multi-purpose function,
13554**  supporting classical (equinox-based) use directly and CIO-based
13555**  use indirectly.
13556**
13557**  This function is part of the International Astronomical Union's
13558**  SOFA (Standards Of Fundamental Astronomy) software collection.
13559**
13560**  Status:  support function.
13561**
13562**  Given:
13563**     date1,date2  double          TT as a 2-part Julian Date (Note 1)
13564**
13565**  Returned:
13566**     dpsi,deps    double          nutation (Note 2)
13567**     epsa         double          mean obliquity (Note 3)
13568**     rb           double[3][3]    frame bias matrix (Note 4)
13569**     rp           double[3][3]    precession matrix (Note 5)
13570**     rbp          double[3][3]    bias-precession matrix (Note 6)
13571**     rn           double[3][3]    nutation matrix (Note 7)
13572**     rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)
13573**
13574**  Notes:
13575**
13576**  1)  The TT date date1+date2 is a Julian Date, apportioned in any
13577**      convenient way between the two arguments.  For example,
13578**      JD(TT)=2450123.7 could be expressed in any of these ways,
13579**      among others:
13580**
13581**             date1          date2
13582**
13583**          2450123.7           0.0       (JD method)
13584**          2451545.0       -1421.3       (J2000 method)
13585**          2400000.5       50123.2       (MJD method)
13586**          2450123.5           0.2       (date & time method)
13587**
13588**      The JD method is the most natural and convenient to use in
13589**      cases where the loss of several decimal digits of resolution
13590**      is acceptable.  The J2000 method is best matched to the way
13591**      the argument is handled internally and will deliver the
13592**      optimum resolution.  The MJD method and the date & time methods
13593**      are both good compromises between resolution and convenience.
13594**
13595**  2)  The nutation components (luni-solar + planetary, IAU 2000A) in
13596**      longitude and obliquity are in radians and with respect to the
13597**      equinox and ecliptic of date.  Free core nutation is omitted;
13598**      for the utmost accuracy, use the iauPn00 function, where the
13599**      nutation components are caller-specified.  For faster but
13600**      slightly less accurate results, use the iauPn00b function.
13601**
13602**  3)  The mean obliquity is consistent with the IAU 2000 precession.
13603**
13604**  4)  The matrix rb transforms vectors from GCRS to J2000.0 mean
13605**      equator and equinox by applying frame bias.
13606**
13607**  5)  The matrix rp transforms vectors from J2000.0 mean equator and
13608**      equinox to mean equator and equinox of date by applying
13609**      precession.
13610**
13611**  6)  The matrix rbp transforms vectors from GCRS to mean equator and
13612**      equinox of date by applying frame bias then precession.  It is
13613**      the product rp x rb.
13614**
13615**  7)  The matrix rn transforms vectors from mean equator and equinox
13616**      of date to true equator and equinox of date by applying the
13617**      nutation (luni-solar + planetary).
13618**
13619**  8)  The matrix rbpn transforms vectors from GCRS to true equator and
13620**      equinox of date.  It is the product rn x rbp, applying frame
13621**      bias, precession and nutation in that order.
13622**
13623**  9)  The X,Y,Z coordinates of the IAU 2000A Celestial Intermediate
13624**      Pole are elements (3,1-3) of the GCRS-to-true matrix,
13625**      i.e. rbpn[2][0-2].
13626**
13627**  10) It is permissible to re-use the same array in the returned
13628**      arguments.  The arrays are filled in the stated order.
13629**
13630**  Called:
13631**     iauNut00a    nutation, IAU 2000A
13632**     iauPn00      bias/precession/nutation results, IAU 2000
13633**
13634**  Reference:
13635**
13636**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
13637**     "Expressions for the Celestial Intermediate Pole and Celestial
13638**     Ephemeris Origin consistent with the IAU 2000A precession-
13639**     nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
13640**
13641**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
13642**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
13643**
13644*/
13645
13646
13647
13648void iauPn00b(double date1, double date2,
13649              double *dpsi, double *deps, double *epsa,
13650              double rb[3][3], double rp[3][3], double rbp[3][3],
13651              double rn[3][3], double rbpn[3][3])
13652/*
13653**  - - - - - - - - -
13654**   i a u P n 0 0 b
13655**  - - - - - - - - -
13656**
13657**  Precession-nutation, IAU 2000B model:  a multi-purpose function,
13658**  supporting classical (equinox-based) use directly and CIO-based
13659**  use indirectly.
13660**
13661**  This function is part of the International Astronomical Union's
13662**  SOFA (Standards Of Fundamental Astronomy) software collection.
13663**
13664**  Status:  support function.
13665**
13666**  Given:
13667**     date1,date2  double          TT as a 2-part Julian Date (Note 1)
13668**
13669**  Returned:
13670**     dpsi,deps    double          nutation (Note 2)
13671**     epsa         double          mean obliquity (Note 3)
13672**     rb           double[3][3]    frame bias matrix (Note 4)
13673**     rp           double[3][3]    precession matrix (Note 5)
13674**     rbp          double[3][3]    bias-precession matrix (Note 6)
13675**     rn           double[3][3]    nutation matrix (Note 7)
13676**     rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)
13677**
13678**  Notes:
13679**
13680**  1)  The TT date date1+date2 is a Julian Date, apportioned in any
13681**      convenient way between the two arguments.  For example,
13682**      JD(TT)=2450123.7 could be expressed in any of these ways,
13683**      among others:
13684**
13685**             date1          date2
13686**
13687**          2450123.7           0.0       (JD method)
13688**          2451545.0       -1421.3       (J2000 method)
13689**          2400000.5       50123.2       (MJD method)
13690**          2450123.5           0.2       (date & time method)
13691**
13692**      The JD method is the most natural and convenient to use in
13693**      cases where the loss of several decimal digits of resolution
13694**      is acceptable.  The J2000 method is best matched to the way
13695**      the argument is handled internally and will deliver the
13696**      optimum resolution.  The MJD method and the date & time methods
13697**      are both good compromises between resolution and convenience.
13698**
13699**  2)  The nutation components (luni-solar + planetary, IAU 2000B) in
13700**      longitude and obliquity are in radians and with respect to the
13701**      equinox and ecliptic of date.  For more accurate results, but
13702**      at the cost of increased computation, use the iauPn00a function.
13703**      For the utmost accuracy, use the iauPn00 function, where the
13704**      nutation components are caller-specified.
13705**
13706**  3)  The mean obliquity is consistent with the IAU 2000 precession.
13707**
13708**  4)  The matrix rb transforms vectors from GCRS to J2000.0 mean
13709**      equator and equinox by applying frame bias.
13710**
13711**  5)  The matrix rp transforms vectors from J2000.0 mean equator and
13712**      equinox to mean equator and equinox of date by applying
13713**      precession.
13714**
13715**  6)  The matrix rbp transforms vectors from GCRS to mean equator and
13716**      equinox of date by applying frame bias then precession.  It is
13717**      the product rp x rb.
13718**
13719**  7)  The matrix rn transforms vectors from mean equator and equinox
13720**      of date to true equator and equinox of date by applying the
13721**      nutation (luni-solar + planetary).
13722**
13723**  8)  The matrix rbpn transforms vectors from GCRS to true equator and
13724**      equinox of date.  It is the product rn x rbp, applying frame
13725**      bias, precession and nutation in that order.
13726**
13727**  9)  The X,Y,Z coordinates of the IAU 2000B Celestial Intermediate
13728**      Pole are elements (3,1-3) of the GCRS-to-true matrix,
13729**      i.e. rbpn[2][0-2].
13730**
13731**  10) It is permissible to re-use the same array in the returned
13732**      arguments.  The arrays are filled in the stated order.
13733**
13734**  Called:
13735**     iauNut00b    nutation, IAU 2000B
13736**     iauPn00      bias/precession/nutation results, IAU 2000
13737**
13738**  Reference:
13739**
13740**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
13741**     "Expressions for the Celestial Intermediate Pole and Celestial
13742**     Ephemeris Origin consistent with the IAU 2000A precession-
13743**     nutation model", Astron.Astrophys. 400, 1145-1154 (2003).
13744**
13745**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
13746**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
13747**
13748*/
13749
13750
13751
13752void iauPn06(double date1, double date2, double dpsi, double deps,
13753             double *epsa,
13754             double rb[3][3], double rp[3][3], double rbp[3][3],
13755             double rn[3][3], double rbpn[3][3])
13756/*
13757**  - - - - - - - -
13758**   i a u P n 0 6
13759**  - - - - - - - -
13760**
13761**  Precession-nutation, IAU 2006 model:  a multi-purpose function,
13762**  supporting classical (equinox-based) use directly and CIO-based use
13763**  indirectly.
13764**
13765**  This function is part of the International Astronomical Union's
13766**  SOFA (Standards Of Fundamental Astronomy) software collection.
13767**
13768**  Status:  support function.
13769**
13770**  Given:
13771**     date1,date2  double          TT as a 2-part Julian Date (Note 1)
13772**     dpsi,deps    double          nutation (Note 2)
13773**
13774**  Returned:
13775**     epsa         double          mean obliquity (Note 3)
13776**     rb           double[3][3]    frame bias matrix (Note 4)
13777**     rp           double[3][3]    precession matrix (Note 5)
13778**     rbp          double[3][3]    bias-precession matrix (Note 6)
13779**     rn           double[3][3]    nutation matrix (Note 7)
13780**     rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)
13781**
13782**  Notes:
13783**
13784**  1)  The TT date date1+date2 is a Julian Date, apportioned in any
13785**      convenient way between the two arguments.  For example,
13786**      JD(TT)=2450123.7 could be expressed in any of these ways,
13787**      among others:
13788**
13789**             date1          date2
13790**
13791**          2450123.7           0.0       (JD method)
13792**          2451545.0       -1421.3       (J2000 method)
13793**          2400000.5       50123.2       (MJD method)
13794**          2450123.5           0.2       (date & time method)
13795**
13796**      The JD method is the most natural and convenient to use in
13797**      cases where the loss of several decimal digits of resolution
13798**      is acceptable.  The J2000 method is best matched to the way
13799**      the argument is handled internally and will deliver the
13800**      optimum resolution.  The MJD method and the date & time methods
13801**      are both good compromises between resolution and convenience.
13802**
13803**  2)  The caller is responsible for providing the nutation components;
13804**      they are in longitude and obliquity, in radians and are with
13805**      respect to the equinox and ecliptic of date.  For high-accuracy
13806**      applications, free core nutation should be included as well as
13807**      any other relevant corrections to the position of the CIP.
13808**
13809**  3)  The returned mean obliquity is consistent with the IAU 2006
13810**      precession.
13811**
13812**  4)  The matrix rb transforms vectors from GCRS to J2000.0 mean
13813**      equator and equinox by applying frame bias.
13814**
13815**  5)  The matrix rp transforms vectors from J2000.0 mean equator and
13816**      equinox to mean equator and equinox of date by applying
13817**      precession.
13818**
13819**  6)  The matrix rbp transforms vectors from GCRS to mean equator and
13820**      equinox of date by applying frame bias then precession.  It is
13821**      the product rp x rb.
13822**
13823**  7)  The matrix rn transforms vectors from mean equator and equinox
13824**      of date to true equator and equinox of date by applying the
13825**      nutation (luni-solar + planetary).
13826**
13827**  8)  The matrix rbpn transforms vectors from GCRS to true equator and
13828**      equinox of date.  It is the product rn x rbp, applying frame
13829**      bias, precession and nutation in that order.
13830**
13831**  9)  The X,Y,Z coordinates of the Celestial Intermediate Pole are
13832**      elements (3,1-3) of the GCRS-to-true matrix, i.e. rbpn[2][0-2].
13833**
13834**  10) It is permissible to re-use the same array in the returned
13835**      arguments.  The arrays are filled in the stated order.
13836**
13837**  Called:
13838**     iauPfw06     bias-precession F-W angles, IAU 2006
13839**     iauFw2m      F-W angles to r-matrix
13840**     iauCr        copy r-matrix
13841**     iauTr        transpose r-matrix
13842**     iauRxr       product of two r-matrices
13843**
13844**  References:
13845**
13846**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
13847**
13848**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
13849**
13850*/
13851
13852
13853
13854void iauPn06a(double date1, double date2,
13855              double *dpsi, double *deps, double *epsa,
13856              double rb[3][3], double rp[3][3], double rbp[3][3],
13857              double rn[3][3], double rbpn[3][3])
13858/*
13859**  - - - - - - - - -
13860**   i a u P n 0 6 a
13861**  - - - - - - - - -
13862**
13863**  Precession-nutation, IAU 2006/2000A models:  a multi-purpose function,
13864**  supporting classical (equinox-based) use directly and CIO-based use
13865**  indirectly.
13866**
13867**  This function is part of the International Astronomical Union's
13868**  SOFA (Standards Of Fundamental Astronomy) software collection.
13869**
13870**  Status:  support function.
13871**
13872**  Given:
13873**     date1,date2  double          TT as a 2-part Julian Date (Note 1)
13874**
13875**  Returned:
13876**     dpsi,deps    double          nutation (Note 2)
13877**     epsa         double          mean obliquity (Note 3)
13878**     rb           double[3][3]    frame bias matrix (Note 4)
13879**     rp           double[3][3]    precession matrix (Note 5)
13880**     rbp          double[3][3]    bias-precession matrix (Note 6)
13881**     rn           double[3][3]    nutation matrix (Note 7)
13882**     rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)
13883**
13884**  Notes:
13885**
13886**  1)  The TT date date1+date2 is a Julian Date, apportioned in any
13887**      convenient way between the two arguments.  For example,
13888**      JD(TT)=2450123.7 could be expressed in any of these ways,
13889**      among others:
13890**
13891**             date1          date2
13892**
13893**          2450123.7           0.0       (JD method)
13894**          2451545.0       -1421.3       (J2000 method)
13895**          2400000.5       50123.2       (MJD method)
13896**          2450123.5           0.2       (date & time method)
13897**
13898**      The JD method is the most natural and convenient to use in
13899**      cases where the loss of several decimal digits of resolution
13900**      is acceptable.  The J2000 method is best matched to the way
13901**      the argument is handled internally and will deliver the
13902**      optimum resolution.  The MJD method and the date & time methods
13903**      are both good compromises between resolution and convenience.
13904**
13905**  2)  The nutation components (luni-solar + planetary, IAU 2000A) in
13906**      longitude and obliquity are in radians and with respect to the
13907**      equinox and ecliptic of date.  Free core nutation is omitted;
13908**      for the utmost accuracy, use the iauPn06 function, where the
13909**      nutation components are caller-specified.
13910**
13911**  3)  The mean obliquity is consistent with the IAU 2006 precession.
13912**
13913**  4)  The matrix rb transforms vectors from GCRS to mean J2000.0 by
13914**      applying frame bias.
13915**
13916**  5)  The matrix rp transforms vectors from mean J2000.0 to mean of
13917**      date by applying precession.
13918**
13919**  6)  The matrix rbp transforms vectors from GCRS to mean of date by
13920**      applying frame bias then precession.  It is the product rp x rb.
13921**
13922**  7)  The matrix rn transforms vectors from mean of date to true of
13923**      date by applying the nutation (luni-solar + planetary).
13924**
13925**  8)  The matrix rbpn transforms vectors from GCRS to true of date
13926**      (CIP/equinox).  It is the product rn x rbp, applying frame bias,
13927**      precession and nutation in that order.
13928**
13929**  9)  The X,Y,Z coordinates of the IAU 2006/2000A Celestial
13930**      Intermediate Pole are elements (3,1-3) of the GCRS-to-true
13931**      matrix, i.e. rbpn[2][0-2].
13932**
13933**  10) It is permissible to re-use the same array in the returned
13934**      arguments.  The arrays are filled in the stated order.
13935**
13936**  Called:
13937**     iauNut06a    nutation, IAU 2006/2000A
13938**     iauPn06      bias/precession/nutation results, IAU 2006
13939**
13940**  Reference:
13941**
13942**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
13943**
13944*/
13945
13946
13947
13948void iauPnm00a(double date1, double date2, double rbpn[3][3])
13949/*
13950**  - - - - - - - - - -
13951**   i a u P n m 0 0 a
13952**  - - - - - - - - - -
13953**
13954**  Form the matrix of precession-nutation for a given date (including
13955**  frame bias), equinox based, IAU 2000A model.
13956**
13957**  This function is part of the International Astronomical Union's
13958**  SOFA (Standards Of Fundamental Astronomy) software collection.
13959**
13960**  Status:  support function.
13961**
13962**  Given:
13963**     date1,date2 double       TT as a 2-part Julian Date (Note 1)
13964**
13965**  Returned:
13966**     rbpn        double[3][3] bias-precession-nutation matrix (Note 2)
13967**
13968**  Notes:
13969**
13970**  1) The TT date date1+date2 is a Julian Date, apportioned in any
13971**     convenient way between the two arguments.  For example,
13972**     JD(TT)=2450123.7 could be expressed in any of these ways, among
13973**     others:
13974**
13975**            date1          date2
13976**
13977**         2450123.7           0.0       (JD method)
13978**         2451545.0       -1421.3       (J2000 method)
13979**         2400000.5       50123.2       (MJD method)
13980**         2450123.5           0.2       (date & time method)
13981**
13982**     The JD method is the most natural and convenient to use in
13983**     cases where the loss of several decimal digits of resolution
13984**     is acceptable.  The J2000 method is best matched to the way
13985**     the argument is handled internally and will deliver the
13986**     optimum resolution.  The MJD method and the date & time methods
13987**     are both good compromises between resolution and convenience.
13988**
13989**  2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where
13990**     the p-vector V(date) is with respect to the true equatorial triad
13991**     of date date1+date2 and the p-vector V(GCRS) is with respect to
13992**     the Geocentric Celestial Reference System (IAU, 2000).
13993**
13994**  3) A faster, but slightly less accurate, result (about 1 mas) can be
13995**     obtained by using instead the iauPnm00b function.
13996**
13997**  Called:
13998**     iauPn00a     bias/precession/nutation, IAU 2000A
13999**
14000**  Reference:
14001**
14002**     IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.
14003**     24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.
14004**     (2000)
14005**
14006*/
14007
14008
14009
14010void iauPnm00b(double date1, double date2, double rbpn[3][3])
14011/*
14012**  - - - - - - - - - -
14013**   i a u P n m 0 0 b
14014**  - - - - - - - - - -
14015**
14016**  Form the matrix of precession-nutation for a given date (including
14017**  frame bias), equinox-based, IAU 2000B model.
14018**
14019**  This function is part of the International Astronomical Union's
14020**  SOFA (Standards Of Fundamental Astronomy) software collection.
14021**
14022**  Status:  support function.
14023**
14024**  Given:
14025**     date1,date2 double       TT as a 2-part Julian Date (Note 1)
14026**
14027**  Returned:
14028**     rbpn        double[3][3] bias-precession-nutation matrix (Note 2)
14029**
14030**  Notes:
14031**
14032**  1) The TT date date1+date2 is a Julian Date, apportioned in any
14033**     convenient way between the two arguments.  For example,
14034**     JD(TT)=2450123.7 could be expressed in any of these ways, among
14035**     others:
14036**
14037**            date1          date2
14038**
14039**         2450123.7           0.0       (JD method)
14040**         2451545.0       -1421.3       (J2000 method)
14041**         2400000.5       50123.2       (MJD method)
14042**         2450123.5           0.2       (date & time method)
14043**
14044**     The JD method is the most natural and convenient to use in
14045**     cases where the loss of several decimal digits of resolution
14046**     is acceptable.  The J2000 method is best matched to the way
14047**     the argument is handled internally and will deliver the
14048**     optimum resolution.  The MJD method and the date & time methods
14049**     are both good compromises between resolution and convenience.
14050**
14051**  2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where
14052**     the p-vector V(date) is with respect to the true equatorial triad
14053**     of date date1+date2 and the p-vector V(GCRS) is with respect to
14054**     the Geocentric Celestial Reference System (IAU, 2000).
14055**
14056**  3) The present function is faster, but slightly less accurate (about
14057**     1 mas), than the iauPnm00a function.
14058**
14059**  Called:
14060**     iauPn00b     bias/precession/nutation, IAU 2000B
14061**
14062**  Reference:
14063**
14064**     IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.
14065**     24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.
14066**     (2000)
14067**
14068*/
14069
14070
14071
14072void iauPnm06a(double date1, double date2, double rbpn[3][3])
14073/*
14074**  - - - - - - - - - -
14075**   i a u P n m 0 6 a
14076**  - - - - - - - - - -
14077**
14078**  Form the matrix of precession-nutation for a given date (including
14079**  frame bias), equinox based, IAU 2006 precession and IAU 2000A
14080**  nutation models.
14081**
14082**  This function is part of the International Astronomical Union's
14083**  SOFA (Standards Of Fundamental Astronomy) software collection.
14084**
14085**  Status:  support function.
14086**
14087**  Given:
14088**     date1,date2 double       TT as a 2-part Julian Date (Note 1)
14089**
14090**  Returned:
14091**     rbpn        double[3][3] bias-precession-nutation matrix (Note 2)
14092**
14093**  Notes:
14094**
14095**  1) The TT date date1+date2 is a Julian Date, apportioned in any
14096**     convenient way between the two arguments.  For example,
14097**     JD(TT)=2450123.7 could be expressed in any of these ways, among
14098**     others:
14099**
14100**            date1          date2
14101**
14102**         2450123.7           0.0       (JD method)
14103**         2451545.0       -1421.3       (J2000 method)
14104**         2400000.5       50123.2       (MJD method)
14105**         2450123.5           0.2       (date & time method)
14106**
14107**     The JD method is the most natural and convenient to use in
14108**     cases where the loss of several decimal digits of resolution
14109**     is acceptable.  The J2000 method is best matched to the way
14110**     the argument is handled internally and will deliver the
14111**     optimum resolution.  The MJD method and the date & time methods
14112**     are both good compromises between resolution and convenience.
14113**
14114**  2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where
14115**     the p-vector V(date) is with respect to the true equatorial triad
14116**     of date date1+date2 and the p-vector V(GCRS) is with respect to
14117**     the Geocentric Celestial Reference System (IAU, 2000).
14118**
14119**  Called:
14120**     iauPfw06     bias-precession F-W angles, IAU 2006
14121**     iauNut06a    nutation, IAU 2006/2000A
14122**     iauFw2m      F-W angles to r-matrix
14123**
14124**  Reference:
14125**
14126**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855.
14127**
14128*/
14129
14130
14131
14132void iauPnm80(double date1, double date2, double rmatpn[3][3])
14133/*
14134**  - - - - - - - - -
14135**   i a u P n m 8 0
14136**  - - - - - - - - -
14137**
14138**  Form the matrix of precession/nutation for a given date, IAU 1976
14139**  precession model, IAU 1980 nutation model.
14140**
14141**  This function is part of the International Astronomical Union's
14142**  SOFA (Standards Of Fundamental Astronomy) software collection.
14143**
14144**  Status:  support function.
14145**
14146**  Given:
14147**     date1,date2 double       TT as a 2-part Julian Date (Note 1)
14148**
14149**  Returned:
14150**     rmatpn         double[3][3]   combined precession/nutation matrix
14151**
14152**  Notes:
14153**
14154**  1) The TT date date1+date2 is a Julian Date, apportioned in any
14155**     convenient way between the two arguments.  For example,
14156**     JD(TT)=2450123.7 could be expressed in any of these ways,
14157**     among others:
14158**
14159**            date1          date2
14160**
14161**         2450123.7           0.0       (JD method)
14162**         2451545.0       -1421.3       (J2000 method)
14163**         2400000.5       50123.2       (MJD method)
14164**         2450123.5           0.2       (date & time method)
14165**
14166**     The JD method is the most natural and convenient to use in
14167**     cases where the loss of several decimal digits of resolution
14168**     is acceptable.  The J2000 method is best matched to the way
14169**     the argument is handled internally and will deliver the
14170**     optimum resolution.  The MJD method and the date & time methods
14171**     are both good compromises between resolution and convenience.
14172**
14173**  2) The matrix operates in the sense V(date) = rmatpn * V(J2000),
14174**     where the p-vector V(date) is with respect to the true equatorial
14175**     triad of date date1+date2 and the p-vector V(J2000) is with
14176**     respect to the mean equatorial triad of epoch J2000.0.
14177**
14178**  Called:
14179**     iauPmat76    precession matrix, IAU 1976
14180**     iauNutm80    nutation matrix, IAU 1980
14181**     iauRxr       product of two r-matrices
14182**
14183**  Reference:
14184**
14185**     Explanatory Supplement to the Astronomical Almanac,
14186**     P. Kenneth Seidelmann (ed), University Science Books (1992),
14187**     Section 3.3 (p145).
14188**
14189*/
14190
14191
14192
14193void iauPom00(double xp, double yp, double sp, double rpom[3][3])
14194/*
14195**  - - - - - - - - - -
14196**   i a u P o m 0 0
14197**  - - - - - - - - - -
14198**
14199**  Form the matrix of polar motion for a given date, IAU 2000.
14200**
14201**  This function is part of the International Astronomical Union's
14202**  SOFA (Standards Of Fundamental Astronomy) software collection.
14203**
14204**  Status:  support function.
14205**
14206**  Given:
14207**     xp,yp    double    coordinates of the pole (radians, Note 1)
14208**     sp       double    the TIO locator s' (radians, Note 2)
14209**
14210**  Returned:
14211**     rpom     double[3][3]   polar-motion matrix (Note 3)
14212**
14213**  Notes:
14214**
14215**  1) The arguments xp and yp are the coordinates (in radians) of the
14216**     Celestial Intermediate Pole with respect to the International
14217**     Terrestrial Reference System (see IERS Conventions 2003),
14218**     measured along the meridians 0 and 90 deg west respectively.
14219**
14220**  2) The argument sp is the TIO locator s', in radians, which
14221**     positions the Terrestrial Intermediate Origin on the equator.  It
14222**     is obtained from polar motion observations by numerical
14223**     integration, and so is in essence unpredictable.  However, it is
14224**     dominated by a secular drift of about 47 microarcseconds per
14225**     century, and so can be taken into account by using s' = -47*t,
14226**     where t is centuries since J2000.0.  The function iauSp00
14227**     implements this approximation.
14228**
14229**  3) The matrix operates in the sense V(TRS) = rpom * V(CIP), meaning
14230**     that it is the final rotation when computing the pointing
14231**     direction to a celestial source.
14232**
14233**  Called:
14234**     iauIr        initialize r-matrix to identity
14235**     iauRz        rotate around Z-axis
14236**     iauRy        rotate around Y-axis
14237**     iauRx        rotate around X-axis
14238**
14239**  Reference:
14240**
14241**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
14242**     IERS Technical Note No. 32, BKG (2004)
14243**
14244*/
14245
14246
14247
14248void iauPpp(double a[3], double b[3], double apb[3])
14249/*
14250**  - - - - - - -
14251**   i a u P p p
14252**  - - - - - - -
14253**
14254**  P-vector addition.
14255**
14256**  This function is part of the International Astronomical Union's
14257**  SOFA (Standards Of Fundamental Astronomy) software collection.
14258**
14259**  Status:  vector/matrix support function.
14260**
14261**  Given:
14262**     a        double[3]      first p-vector
14263**     b        double[3]      second p-vector
14264**
14265**  Returned:
14266**     apb      double[3]      a + b
14267**
14268**  Note:
14269**     It is permissible to re-use the same array for any of the
14270**     arguments.
14271**
14272*/
14273
14274
14275
14276void iauPpsp(double a[3], double s, double b[3], double apsb[3])
14277/*
14278**  - - - - - - - -
14279**   i a u P p s p
14280**  - - - - - - - -
14281**
14282**  P-vector plus scaled p-vector.
14283**
14284**  This function is part of the International Astronomical Union's
14285**  SOFA (Standards Of Fundamental Astronomy) software collection.
14286**
14287**  Status:  vector/matrix support function.
14288**
14289**  Given:
14290**     a      double[3]     first p-vector
14291**     s      double        scalar (multiplier for b)
14292**     b      double[3]     second p-vector
14293**
14294**  Returned:
14295**     apsb   double[3]     a + s*b
14296**
14297**  Note:
14298**     It is permissible for any of a, b and apsb to be the same array.
14299**
14300**  Called:
14301**     iauSxp       multiply p-vector by scalar
14302**     iauPpp       p-vector plus p-vector
14303**
14304*/
14305
14306
14307
14308void iauPr00(double date1, double date2, double *dpsipr, double *depspr)
14309/*
14310**  - - - - - - - -
14311**   i a u P r 0 0
14312**  - - - - - - - -
14313**
14314**  Precession-rate part of the IAU 2000 precession-nutation models
14315**  (part of MHB2000).
14316**
14317**  This function is part of the International Astronomical Union's
14318**  SOFA (Standards Of Fundamental Astronomy) software collection.
14319**
14320**  Status:  canonical model.
14321**
14322**  Given:
14323**     date1,date2    double  TT as a 2-part Julian Date (Note 1)
14324**
14325**  Returned:
14326**     dpsipr,depspr  double  precession corrections (Notes 2,3)
14327**
14328**  Notes:
14329**
14330**  1) The TT date date1+date2 is a Julian Date, apportioned in any
14331**     convenient way between the two arguments.  For example,
14332**     JD(TT)=2450123.7 could be expressed in any of these ways,
14333**     among others:
14334**
14335**            date1          date2
14336**
14337**         2450123.7           0.0       (JD method)
14338**         2451545.0       -1421.3       (J2000 method)
14339**         2400000.5       50123.2       (MJD method)
14340**         2450123.5           0.2       (date & time method)
14341**
14342**     The JD method is the most natural and convenient to use in
14343**     cases where the loss of several decimal digits of resolution
14344**     is acceptable.  The J2000 method is best matched to the way
14345**     the argument is handled internally and will deliver the
14346**     optimum resolution.  The MJD method and the date & time methods
14347**     are both good compromises between resolution and convenience.
14348**
14349**  2) The precession adjustments are expressed as "nutation
14350**     components", corrections in longitude and obliquity with respect
14351**     to the J2000.0 equinox and ecliptic.
14352**
14353**  3) Although the precession adjustments are stated to be with respect
14354**     to Lieske et al. (1977), the MHB2000 model does not specify which
14355**     set of Euler angles are to be used and how the adjustments are to
14356**     be applied.  The most literal and straightforward procedure is to
14357**     adopt the 4-rotation epsilon_0, psi_A, omega_A, xi_A option, and
14358**     to add dpsipr to psi_A and depspr to both omega_A and eps_A.
14359**
14360**  4) This is an implementation of one aspect of the IAU 2000A nutation
14361**     model, formally adopted by the IAU General Assembly in 2000,
14362**     namely MHB2000 (Mathews et al. 2002).
14363**
14364**  References:
14365**
14366**     Lieske, J.H., Lederle, T., Fricke, W. & Morando, B., "Expressions
14367**     for the precession quantities based upon the IAU (1976) System of
14368**     Astronomical Constants", Astron.Astrophys., 58, 1-16 (1977)
14369**
14370**     Mathews, P.M., Herring, T.A., Buffet, B.A., "Modeling of nutation
14371**     and precession   New nutation series for nonrigid Earth and
14372**     insights into the Earth's interior", J.Geophys.Res., 107, B4,
14373**     2002.  The MHB2000 code itself was obtained on 9th September 2002
14374**     from ftp://maia.usno.navy.mil/conv2000/chapter5/IAU2000A.
14375**
14376**     Wallace, P.T., "Software for Implementing the IAU 2000
14377**     Resolutions", in IERS Workshop 5.1 (2002).
14378**
14379*/
14380
14381
14382
14383void iauPrec76(double date01, double date02, double date11, double date12,
14384               double *zeta, double *z, double *theta)
14385/*
14386**  - - - - - - - - - -
14387**   i a u P r e c 7 6
14388**  - - - - - - - - - -
14389**
14390**  IAU 1976 precession model.
14391**
14392**  This function forms the three Euler angles which implement general
14393**  precession between two dates, using the IAU 1976 model (as for the
14394**  FK5 catalog).
14395**
14396**  This function is part of the International Astronomical Union's
14397**  SOFA (Standards Of Fundamental Astronomy) software collection.
14398**
14399**  Status:  canonical model.
14400**
14401**  Given:
14402**     date01,date02   double    TDB starting date (Note 1)
14403**     date11,date12   double    TDB ending date (Note 1)
14404**
14405**  Returned:
14406**     zeta            double    1st rotation: radians cw around z
14407**     z               double    3rd rotation: radians cw around z
14408**     theta           double    2nd rotation: radians ccw around y
14409**
14410**  Notes:
14411**
14412**  1) The dates date01+date02 and date11+date12 are Julian Dates,
14413**     apportioned in any convenient way between the arguments daten1
14414**     and daten2.  For example, JD(TDB)=2450123.7 could be expressed in
14415**     any of these ways, among others:
14416**
14417**           daten1        daten2
14418**
14419**         2450123.7           0.0       (JD method)
14420**         2451545.0       -1421.3       (J2000 method)
14421**         2400000.5       50123.2       (MJD method)
14422**         2450123.5           0.2       (date & time method)
14423**
14424**     The JD method is the most natural and convenient to use in cases
14425**     where the loss of several decimal digits of resolution is
14426**     acceptable.  The J2000 method is best matched to the way the
14427**     argument is handled internally and will deliver the optimum
14428**     optimum resolution.  The MJD method and the date & time methods
14429**     are both good compromises between resolution and convenience.
14430**     The two dates may be expressed using different methods, but at
14431**     the risk of losing some resolution.
14432**
14433**  2) The accumulated precession angles zeta, z, theta are expressed
14434**     through canonical polynomials which are valid only for a limited
14435**     time span.  In addition, the IAU 1976 precession rate is known to
14436**     be imperfect.  The absolute accuracy of the present formulation
14437**     is better than 0.1 arcsec from 1960AD to 2040AD, better than
14438**     1 arcsec from 1640AD to 2360AD, and remains below 3 arcsec for
14439**     the whole of the period 500BC to 3000AD.  The errors exceed
14440**     10 arcsec outside the range 1200BC to 3900AD, exceed 100 arcsec
14441**     outside 4200BC to 5600AD and exceed 1000 arcsec outside 6800BC to
14442**     8200AD.
14443**
14444**  3) The three angles are returned in the conventional order, which
14445**     is not the same as the order of the corresponding Euler
14446**     rotations.  The precession matrix is
14447**     R_3(-z) x R_2(+theta) x R_3(-zeta).
14448**
14449**  Reference:
14450**
14451**     Lieske, J.H., 1979, Astron.Astrophys. 73, 282, equations
14452**     (6) & (7), p283.
14453**
14454*/
14455
14456
14457
14458void iauPv2p(double pv[2][3], double p[3])
14459/*
14460**  - - - - - - - -
14461**   i a u P v 2 p
14462**  - - - - - - - -
14463**
14464**  Discard velocity component of a pv-vector.
14465**
14466**  This function is part of the International Astronomical Union's
14467**  SOFA (Standards Of Fundamental Astronomy) software collection.
14468**
14469**  Status:  vector/matrix support function.
14470**
14471**  Given:
14472**     pv      double[2][3]     pv-vector
14473**
14474**  Returned:
14475**     p       double[3]        p-vector
14476**
14477**  Called:
14478**     iauCp        copy p-vector
14479**
14480*/
14481
14482
14483
14484void iauPv2s(double pv[2][3],
14485             double *theta, double *phi, double *r,
14486             double *td, double *pd, double *rd)
14487/*
14488**  - - - - - - - -
14489**   i a u P v 2 s
14490**  - - - - - - - -
14491**
14492**  Convert position/velocity from Cartesian to spherical coordinates.
14493**
14494**  This function is part of the International Astronomical Union's
14495**  SOFA (Standards Of Fundamental Astronomy) software collection.
14496**
14497**  Status:  vector/matrix support function.
14498**
14499**  Given:
14500**     pv       double[2][3]  pv-vector
14501**
14502**  Returned:
14503**     theta    double        longitude angle (radians)
14504**     phi      double        latitude angle (radians)
14505**     r        double        radial distance
14506**     td       double        rate of change of theta
14507**     pd       double        rate of change of phi
14508**     rd       double        rate of change of r
14509**
14510**  Notes:
14511**
14512**  1) If the position part of pv is null, theta, phi, td and pd
14513**     are indeterminate.  This is handled by extrapolating the
14514**     position through unit time by using the velocity part of
14515**     pv.  This moves the origin without changing the direction
14516**     of the velocity component.  If the position and velocity
14517**     components of pv are both null, zeroes are returned for all
14518**     six results.
14519**
14520**  2) If the position is a pole, theta, td and pd are indeterminate.
14521**     In such cases zeroes are returned for all three.
14522**
14523*/
14524
14525
14526
14527void iauPvdpv(double a[2][3], double b[2][3], double adb[2])
14528/*
14529**  - - - - - - - - -
14530**   i a u P v d p v
14531**  - - - - - - - - -
14532**
14533**  Inner (=scalar=dot) product of two pv-vectors.
14534**
14535**  This function is part of the International Astronomical Union's
14536**  SOFA (Standards Of Fundamental Astronomy) software collection.
14537**
14538**  Status:  vector/matrix support function.
14539**
14540**  Given:
14541**     a        double[2][3]      first pv-vector
14542**     b        double[2][3]      second pv-vector
14543**
14544**  Returned:
14545**     adb      double[2]         a . b (see note)
14546**
14547**  Note:
14548**
14549**     If the position and velocity components of the two pv-vectors are
14550**     ( ap, av ) and ( bp, bv ), the result, a . b, is the pair of
14551**     numbers ( ap . bp , ap . bv + av . bp ).  The two numbers are the
14552**     dot-product of the two p-vectors and its derivative.
14553**
14554**  Called:
14555**     iauPdp       scalar product of two p-vectors
14556**
14557*/
14558
14559
14560
14561void iauPvm(double pv[2][3], double *r, double *s)
14562/*
14563**  - - - - - - -
14564**   i a u P v m
14565**  - - - - - - -
14566**
14567**  Modulus of pv-vector.
14568**
14569**  This function is part of the International Astronomical Union's
14570**  SOFA (Standards Of Fundamental Astronomy) software collection.
14571**
14572**  Status:  vector/matrix support function.
14573**
14574**  Given:
14575**     pv     double[2][3]   pv-vector
14576**
14577**  Returned:
14578**     r      double         modulus of position component
14579**     s      double         modulus of velocity component
14580**
14581**  Called:
14582**     iauPm        modulus of p-vector
14583**
14584*/
14585
14586
14587
14588void iauPvmpv(double a[2][3], double b[2][3], double amb[2][3])
14589/*
14590**  - - - - - - - - -
14591**   i a u P v m p v
14592**  - - - - - - - - -
14593**
14594**  Subtract one pv-vector from another.
14595**
14596**  This function is part of the International Astronomical Union's
14597**  SOFA (Standards Of Fundamental Astronomy) software collection.
14598**
14599**  Status:  vector/matrix support function.
14600**
14601**  Given:
14602**     a       double[2][3]      first pv-vector
14603**     b       double[2][3]      second pv-vector
14604**
14605**  Returned:
14606**     amb     double[2][3]      a - b
14607**
14608**  Note:
14609**     It is permissible to re-use the same array for any of the
14610**     arguments.
14611**
14612**  Called:
14613**     iauPmp       p-vector minus p-vector
14614**
14615*/
14616
14617
14618
14619void iauPvppv(double a[2][3], double b[2][3], double apb[2][3])
14620/*
14621**  - - - - - - - - -
14622**   i a u P v p p v
14623**  - - - - - - - - -
14624**
14625**  Add one pv-vector to another.
14626**
14627**  This function is part of the International Astronomical Union's
14628**  SOFA (Standards Of Fundamental Astronomy) software collection.
14629**
14630**  Status:  vector/matrix support function.
14631**
14632**  Given:
14633**     a        double[2][3]      first pv-vector
14634**     b        double[2][3]      second pv-vector
14635**
14636**  Returned:
14637**     apb      double[2][3]      a + b
14638**
14639**  Note:
14640**     It is permissible to re-use the same array for any of the
14641**     arguments.
14642**
14643**  Called:
14644**     iauPpp       p-vector plus p-vector
14645**
14646*/
14647
14648
14649
14650int iauPvstar(double pv[2][3], double *ra, double *dec,
14651              double *pmr, double *pmd, double *px, double *rv)
14652/*
14653**  - - - - - - - - - -
14654**   i a u P v s t a r
14655**  - - - - - - - - - -
14656**
14657**  Convert star position+velocity vector to catalog coordinates.
14658**
14659**  This function is part of the International Astronomical Union's
14660**  SOFA (Standards Of Fundamental Astronomy) software collection.
14661**
14662**  Status:  support function.
14663**
14664**  Given (Note 1):
14665**     pv     double[2][3]   pv-vector (au, au/day)
14666**
14667**  Returned (Note 2):
14668**     ra     double         right ascension (radians)
14669**     dec    double         declination (radians)
14670**     pmr    double         RA proper motion (radians/year)
14671**     pmd    double         Dec proper motion (radians/year)
14672**     px     double         parallax (arcsec)
14673**     rv     double         radial velocity (km/s, positive = receding)
14674**
14675**  Returned (function value):
14676**            int            status:
14677**                              0 = OK
14678**                             -1 = superluminal speed (Note 5)
14679**                             -2 = null position vector
14680**
14681**  Notes:
14682**
14683**  1) The specified pv-vector is the coordinate direction (and its rate
14684**     of change) for the date at which the light leaving the star
14685**     reached the solar-system barycenter.
14686**
14687**  2) The star data returned by this function are "observables" for an
14688**     imaginary observer at the solar-system barycenter.  Proper motion
14689**     and radial velocity are, strictly, in terms of barycentric
14690**     coordinate time, TCB.  For most practical applications, it is
14691**     permissible to neglect the distinction between TCB and ordinary
14692**     "proper" time on Earth (TT/TAI).  The result will, as a rule, be
14693**     limited by the intrinsic accuracy of the proper-motion and
14694**     radial-velocity data;  moreover, the supplied pv-vector is likely
14695**     to be merely an intermediate result (for example generated by the
14696**     function iauStarpv), so that a change of time unit will cancel
14697**     out overall.
14698**
14699**     In accordance with normal star-catalog conventions, the object's
14700**     right ascension and declination are freed from the effects of
14701**     secular aberration.  The frame, which is aligned to the catalog
14702**     equator and equinox, is Lorentzian and centered on the SSB.
14703**
14704**     Summarizing, the specified pv-vector is for most stars almost
14705**     identical to the result of applying the standard geometrical
14706**     "space motion" transformation to the catalog data.  The
14707**     differences, which are the subject of the Stumpff paper cited
14708**     below, are:
14709**
14710**     (i) In stars with significant radial velocity and proper motion,
14711**     the constantly changing light-time distorts the apparent proper
14712**     motion.  Note that this is a classical, not a relativistic,
14713**     effect.
14714**
14715**     (ii) The transformation complies with special relativity.
14716**
14717**  3) Care is needed with units.  The star coordinates are in radians
14718**     and the proper motions in radians per Julian year, but the
14719**     parallax is in arcseconds; the radial velocity is in km/s, but
14720**     the pv-vector result is in au and au/day.
14721**
14722**  4) The proper motions are the rate of change of the right ascension
14723**     and declination at the catalog epoch and are in radians per Julian
14724**     year.  The RA proper motion is in terms of coordinate angle, not
14725**     true angle, and will thus be numerically larger at high
14726**     declinations.
14727**
14728**  5) Straight-line motion at constant speed in the inertial frame is
14729**     assumed.  If the speed is greater than or equal to the speed of
14730**     light, the function aborts with an error status.
14731**
14732**  6) The inverse transformation is performed by the function iauStarpv.
14733**
14734**  Called:
14735**     iauPn        decompose p-vector into modulus and direction
14736**     iauPdp       scalar product of two p-vectors
14737**     iauSxp       multiply p-vector by scalar
14738**     iauPmp       p-vector minus p-vector
14739**     iauPm        modulus of p-vector
14740**     iauPpp       p-vector plus p-vector
14741**     iauPv2s      pv-vector to spherical
14742**     iauAnp       normalize angle into range 0 to 2pi
14743**
14744**  Reference:
14745**
14746**     Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.
14747**
14748*/
14749
14750
14751
14752void iauPvtob(double elong, double phi, double hm,
14753              double xp, double yp, double sp, double theta,
14754              double pv[2][3])
14755/*
14756**  - - - - - - - - -
14757**   i a u P v t o b
14758**  - - - - - - - - -
14759**
14760**  Position and velocity of a terrestrial observing station.
14761**
14762**  This function is part of the International Astronomical Union's
14763**  SOFA (Standards of Fundamental Astronomy) software collection.
14764**
14765**  Status:  support function.
14766**
14767**  Given:
14768**     elong   double       longitude (radians, east +ve, Note 1)
14769**     phi     double       latitude (geodetic, radians, Note 1)
14770**     hm      double       height above ref. ellipsoid (geodetic, m)
14771**     xp,yp   double       coordinates of the pole (radians, Note 2)
14772**     sp      double       the TIO locator s' (radians, Note 2)
14773**     theta   double       Earth rotation angle (radians, Note 3)
14774**
14775**  Returned:
14776**     pv      double[2][3] position/velocity vector (m, m/s, CIRS)
14777**
14778**  Notes:
14779**
14780**  1) The terrestrial coordinates are with respect to the WGS84
14781**     reference ellipsoid.
14782**
14783**  2) xp and yp are the coordinates (in radians) of the Celestial
14784**     Intermediate Pole with respect to the International Terrestrial
14785**     Reference System (see IERS Conventions), measured along the
14786**     meridians 0 and 90 deg west respectively.  sp is the TIO locator
14787**     s', in radians, which positions the Terrestrial Intermediate
14788**     Origin on the equator.  For many applications, xp, yp and
14789**     (especially) sp can be set to zero.
14790**
14791**  3) If theta is Greenwich apparent sidereal time instead of Earth
14792**     rotation angle, the result is with respect to the true equator
14793**     and equinox of date, i.e. with the x-axis at the equinox rather
14794**     than the celestial intermediate origin.
14795**
14796**  4) The velocity units are meters per UT1 second, not per SI second.
14797**     This is unlikely to have any practical consequences in the modern
14798**     era.
14799**
14800**  5) No validation is performed on the arguments.  Error cases that
14801**     could lead to arithmetic exceptions are trapped by the iauGd2gc
14802**     function, and the result set to zeros.
14803**
14804**  References:
14805**
14806**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
14807**     IERS Technical Note No. 32, BKG (2004)
14808**
14809**     Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
14810**     the Astronomical Almanac, 3rd ed., University Science Books
14811**     (2013), Section 7.4.3.3.
14812**
14813**  Called:
14814**     iauGd2gc     geodetic to geocentric transformation
14815**     iauPom00     polar motion matrix
14816**     iauTrxp      product of transpose of r-matrix and p-vector
14817**
14818*/
14819
14820
14821
14822void iauPvu(double dt, double pv[2][3], double upv[2][3])
14823/*
14824**  - - - - - - -
14825**   i a u P v u
14826**  - - - - - - -
14827**
14828**  Update a pv-vector.
14829**
14830**  This function is part of the International Astronomical Union's
14831**  SOFA (Standards Of Fundamental Astronomy) software collection.
14832**
14833**  Status:  vector/matrix support function.
14834**
14835**  Given:
14836**     dt       double           time interval
14837**     pv       double[2][3]     pv-vector
14838**
14839**  Returned:
14840**     upv      double[2][3]     p updated, v unchanged
14841**
14842**  Notes:
14843**
14844**  1) "Update" means "refer the position component of the vector
14845**     to a new date dt time units from the existing date".
14846**
14847**  2) The time units of dt must match those of the velocity.
14848**
14849**  3) It is permissible for pv and upv to be the same array.
14850**
14851**  Called:
14852**     iauPpsp      p-vector plus scaled p-vector
14853**     iauCp        copy p-vector
14854**
14855*/
14856
14857
14858
14859void iauPvup(double dt, double pv[2][3], double p[3])
14860/*
14861**  - - - - - - - -
14862**   i a u P v u p
14863**  - - - - - - - -
14864**
14865**  Update a pv-vector, discarding the velocity component.
14866**
14867**  This function is part of the International Astronomical Union's
14868**  SOFA (Standards Of Fundamental Astronomy) software collection.
14869**
14870**  Status:  vector/matrix support function.
14871**
14872**  Given:
14873**     dt       double            time interval
14874**     pv       double[2][3]      pv-vector
14875**
14876**  Returned:
14877**     p        double[3]         p-vector
14878**
14879**  Notes:
14880**
14881**  1) "Update" means "refer the position component of the vector to a
14882**     new date dt time units from the existing date".
14883**
14884**  2) The time units of dt must match those of the velocity.
14885**
14886*/
14887
14888
14889
14890void iauPvxpv(double a[2][3], double b[2][3], double axb[2][3])
14891/*
14892**  - - - - - - - - -
14893**   i a u P v x p v
14894**  - - - - - - - - -
14895**
14896**  Outer (=vector=cross) product of two pv-vectors.
14897**
14898**  This function is part of the International Astronomical Union's
14899**  SOFA (Standards Of Fundamental Astronomy) software collection.
14900**
14901**  Status:  vector/matrix support function.
14902**
14903**  Given:
14904**     a        double[2][3]      first pv-vector
14905**     b        double[2][3]      second pv-vector
14906**
14907**  Returned:
14908**     axb      double[2][3]      a x b
14909**
14910**  Notes:
14911**
14912**  1) If the position and velocity components of the two pv-vectors are
14913**     ( ap, av ) and ( bp, bv ), the result, a x b, is the pair of
14914**     vectors ( ap x bp, ap x bv + av x bp ).  The two vectors are the
14915**     cross-product of the two p-vectors and its derivative.
14916**
14917**  2) It is permissible to re-use the same array for any of the
14918**     arguments.
14919**
14920**  Called:
14921**     iauCpv       copy pv-vector
14922**     iauPxp       vector product of two p-vectors
14923**     iauPpp       p-vector plus p-vector
14924**
14925*/
14926
14927
14928
14929void iauPxp(double a[3], double b[3], double axb[3])
14930/*
14931**  - - - - - - -
14932**   i a u P x p
14933**  - - - - - - -
14934**
14935**  p-vector outer (=vector=cross) product.
14936**
14937**  This function is part of the International Astronomical Union's
14938**  SOFA (Standards Of Fundamental Astronomy) software collection.
14939**
14940**  Status:  vector/matrix support function.
14941**
14942**  Given:
14943**     a        double[3]      first p-vector
14944**     b        double[3]      second p-vector
14945**
14946**  Returned:
14947**     axb      double[3]      a x b
14948**
14949**  Note:
14950**     It is permissible to re-use the same array for any of the
14951**     arguments.
14952**
14953*/
14954
14955
14956
14957void iauRefco(double phpa, double tc, double rh, double wl,
14958              double *refa, double *refb)
14959/*
14960**  - - - - - - - - -
14961**   i a u R e f c o
14962**  - - - - - - - - -
14963**
14964**  Determine the constants A and B in the atmospheric refraction model
14965**  dZ = A tan Z + B tan^3 Z.
14966**
14967**  Z is the "observed" zenith distance (i.e. affected by refraction)
14968**  and dZ is what to add to Z to give the "topocentric" (i.e. in vacuo)
14969**  zenith distance.
14970**
14971**  This function is part of the International Astronomical Union's
14972**  SOFA (Standards of Fundamental Astronomy) software collection.
14973**
14974**  Status:  support function.
14975**
14976**  Given:
14977**    phpa   double    pressure at the observer (hPa = millibar)
14978**    tc     double    ambient temperature at the observer (deg C)
14979**    rh     double    relative humidity at the observer (range 0-1)
14980**    wl     double    wavelength (micrometers)
14981**
14982**  Returned:
14983**    refa   double*   tan Z coefficient (radians)
14984**    refb   double*   tan^3 Z coefficient (radians)
14985**
14986**  Notes:
14987**
14988**  1) The model balances speed and accuracy to give good results in
14989**     applications where performance at low altitudes is not paramount.
14990**     Performance is maintained across a range of conditions, and
14991**     applies to both optical/IR and radio.
14992**
14993**  2) The model omits the effects of (i) height above sea level (apart
14994**     from the reduced pressure itself), (ii) latitude (i.e. the
14995**     flattening of the Earth), (iii) variations in tropospheric lapse
14996**     rate and (iv) dispersive effects in the radio.
14997**
14998**     The model was tested using the following range of conditions:
14999**
15000**       lapse rates 0.0055, 0.0065, 0.0075 deg/meter
15001**       latitudes 0, 25, 50, 75 degrees
15002**       heights 0, 2500, 5000 meters ASL
15003**       pressures mean for height -10% to +5% in steps of 5%
15004**       temperatures -10 deg to +20 deg with respect to 280 deg at SL
15005**       relative humidity 0, 0.5, 1
15006**       wavelengths 0.4, 0.6, ... 2 micron, + radio
15007**       zenith distances 15, 45, 75 degrees
15008**
15009**     The accuracy with respect to raytracing through a model
15010**     atmosphere was as follows:
15011**
15012**                            worst         RMS
15013**
15014**       optical/IR           62 mas       8 mas
15015**       radio               319 mas      49 mas
15016**
15017**     For this particular set of conditions:
15018**
15019**       lapse rate 0.0065 K/meter
15020**       latitude 50 degrees
15021**       sea level
15022**       pressure 1005 mb
15023**       temperature 280.15 K
15024**       humidity 80%
15025**       wavelength 5740 Angstroms
15026**
15027**     the results were as follows:
15028**
15029**       ZD       raytrace     iauRefco   Saastamoinen
15030**
15031**       10         10.27        10.27        10.27
15032**       20         21.19        21.20        21.19
15033**       30         33.61        33.61        33.60
15034**       40         48.82        48.83        48.81
15035**       45         58.16        58.18        58.16
15036**       50         69.28        69.30        69.27
15037**       55         82.97        82.99        82.95
15038**       60        100.51       100.54       100.50
15039**       65        124.23       124.26       124.20
15040**       70        158.63       158.68       158.61
15041**       72        177.32       177.37       177.31
15042**       74        200.35       200.38       200.32
15043**       76        229.45       229.43       229.42
15044**       78        267.44       267.29       267.41
15045**       80        319.13       318.55       319.10
15046**
15047**      deg        arcsec       arcsec       arcsec
15048**
15049**     The values for Saastamoinen's formula (which includes terms
15050**     up to tan^5) are taken from Hohenkerk and Sinclair (1985).
15051**
15052**  3) A wl value in the range 0-100 selects the optical/IR case and is
15053**     wavelength in micrometers.  Any value outside this range selects
15054**     the radio case.
15055**
15056**  4) Outlandish input parameters are silently limited to
15057**     mathematically safe values.  Zero pressure is permissible, and
15058**     causes zeroes to be returned.
15059**
15060**  5) The algorithm draws on several sources, as follows:
15061**
15062**     a) The formula for the saturation vapour pressure of water as
15063**        a function of temperature and temperature is taken from
15064**        Equations (A4.5-A4.7) of Gill (1982).
15065**
15066**     b) The formula for the water vapour pressure, given the
15067**        saturation pressure and the relative humidity, is from
15068**        Crane (1976), Equation (2.5.5).
15069**
15070**     c) The refractivity of air is a function of temperature,
15071**        total pressure, water-vapour pressure and, in the case
15072**        of optical/IR, wavelength.  The formulae for the two cases are
15073**        developed from Hohenkerk & Sinclair (1985) and Rueger (2002).
15074**        The IAG (1999) optical refractivity for dry air is used.
15075**
15076**     d) The formula for beta, the ratio of the scale height of the
15077**        atmosphere to the geocentric distance of the observer, is
15078**        an adaption of Equation (9) from Stone (1996).  The
15079**        adaptations, arrived at empirically, consist of (i) a small
15080**        adjustment to the coefficient and (ii) a humidity term for the
15081**        radio case only.
15082**
15083**     e) The formulae for the refraction constants as a function of
15084**        n-1 and beta are from Green (1987), Equation (4.31).
15085**
15086**  References:
15087**
15088**     Crane, R.K., Meeks, M.L. (ed), "Refraction Effects in the Neutral
15089**     Atmosphere", Methods of Experimental Physics: Astrophysics 12B,
15090**     Academic Press, 1976.
15091**
15092**     Gill, Adrian E., "Atmosphere-Ocean Dynamics", Academic Press,
15093**     1982.
15094**
15095**     Green, R.M., "Spherical Astronomy", Cambridge University Press,
15096**     1987.
15097**
15098**     Hohenkerk, C.Y., & Sinclair, A.T., NAO Technical Note No. 63,
15099**     1985.
15100**
15101**     IAG Resolutions adopted at the XXIIth General Assembly in
15102**     Birmingham, 1999, Resolution 3.
15103**
15104**     Rueger, J.M., "Refractive Index Formulae for Electronic Distance
15105**     Measurement with Radio and Millimetre Waves", in Unisurv Report
15106**     S-68, School of Surveying and Spatial Information Systems,
15107**     University of New South Wales, Sydney, Australia, 2002.
15108**
15109**     Stone, Ronald C., P.A.S.P. 108, 1051-1058, 1996.
15110**
15111*/
15112
15113
15114
15115void iauRm2v(double r[3][3], double w[3])
15116/*
15117**  - - - - - - - -
15118**   i a u R m 2 v
15119**  - - - - - - - -
15120**
15121**  Express an r-matrix as an r-vector.
15122**
15123**  This function is part of the International Astronomical Union's
15124**  SOFA (Standards Of Fundamental Astronomy) software collection.
15125**
15126**  Status:  vector/matrix support function.
15127**
15128**  Given:
15129**     r        double[3][3]    rotation matrix
15130**
15131**  Returned:
15132**     w        double[3]       rotation vector (Note 1)
15133**
15134**  Notes:
15135**
15136**  1) A rotation matrix describes a rotation through some angle about
15137**     some arbitrary axis called the Euler axis.  The "rotation vector"
15138**     returned by this function has the same direction as the Euler axis,
15139**     and its magnitude is the angle in radians.  (The magnitude and
15140**     direction can be separated by means of the function iauPn.)
15141**
15142**  2) If r is null, so is the result.  If r is not a rotation matrix
15143**     the result is undefined;  r must be proper (i.e. have a positive
15144**     determinant) and real orthogonal (inverse = transpose).
15145**
15146**  3) The reference frame rotates clockwise as seen looking along
15147**     the rotation vector from the origin.
15148**
15149*/
15150
15151
15152
15153void iauRv2m(double w[3], double r[3][3])
15154/*
15155**  - - - - - - - -
15156**   i a u R v 2 m
15157**  - - - - - - - -
15158**
15159**  Form the r-matrix corresponding to a given r-vector.
15160**
15161**  This function is part of the International Astronomical Union's
15162**  SOFA (Standards Of Fundamental Astronomy) software collection.
15163**
15164**  Status:  vector/matrix support function.
15165**
15166**  Given:
15167**     w        double[3]      rotation vector (Note 1)
15168**
15169**  Returned:
15170**     r        double[3][3]    rotation matrix
15171**
15172**  Notes:
15173**
15174**  1) A rotation matrix describes a rotation through some angle about
15175**     some arbitrary axis called the Euler axis.  The "rotation vector"
15176**     supplied to This function has the same direction as the Euler
15177**     axis, and its magnitude is the angle in radians.
15178**
15179**  2) If w is null, the identity matrix is returned.
15180**
15181**  3) The reference frame rotates clockwise as seen looking along the
15182**     rotation vector from the origin.
15183**
15184*/
15185
15186
15187
15188void iauRx(double phi, double r[3][3])
15189/*
15190**  - - - - - -
15191**   i a u R x
15192**  - - - - - -
15193**
15194**  Rotate an r-matrix about the x-axis.
15195**
15196**  This function is part of the International Astronomical Union's
15197**  SOFA (Standards Of Fundamental Astronomy) software collection.
15198**
15199**  Status:  vector/matrix support function.
15200**
15201**  Given:
15202**     phi    double          angle (radians)
15203**
15204**  Given and returned:
15205**     r      double[3][3]    r-matrix, rotated
15206**
15207**  Notes:
15208**
15209**  1) Calling this function with positive phi incorporates in the
15210**     supplied r-matrix r an additional rotation, about the x-axis,
15211**     anticlockwise as seen looking towards the origin from positive x.
15212**
15213**  2) The additional rotation can be represented by this matrix:
15214**
15215**         (  1        0            0      )
15216**         (                               )
15217**         (  0   + cos(phi)   + sin(phi)  )
15218**         (                               )
15219**         (  0   - sin(phi)   + cos(phi)  )
15220**
15221*/
15222
15223
15224
15225void iauRxp(double r[3][3], double p[3], double rp[3])
15226/*
15227**  - - - - - - -
15228**   i a u R x p
15229**  - - - - - - -
15230**
15231**  Multiply a p-vector by an r-matrix.
15232**
15233**  This function is part of the International Astronomical Union's
15234**  SOFA (Standards Of Fundamental Astronomy) software collection.
15235**
15236**  Status:  vector/matrix support function.
15237**
15238**  Given:
15239**     r        double[3][3]    r-matrix
15240**     p        double[3]       p-vector
15241**
15242**  Returned:
15243**     rp       double[3]       r * p
15244**
15245**  Note:
15246**     It is permissible for p and rp to be the same array.
15247**
15248**  Called:
15249**     iauCp        copy p-vector
15250**
15251*/
15252
15253
15254
15255void iauRxpv(double r[3][3], double pv[2][3], double rpv[2][3])
15256/*
15257**  - - - - - - - -
15258**   i a u R x p v
15259**  - - - - - - - -
15260**
15261**  Multiply a pv-vector by an r-matrix.
15262**
15263**  This function is part of the International Astronomical Union's
15264**  SOFA (Standards Of Fundamental Astronomy) software collection.
15265**
15266**  Status:  vector/matrix support function.
15267**
15268**  Given:
15269**     r        double[3][3]    r-matrix
15270**     pv       double[2][3]    pv-vector
15271**
15272**  Returned:
15273**     rpv      double[2][3]    r * pv
15274**
15275**  Notes:
15276**
15277**  1) The algorithm is for the simple case where the r-matrix r is not
15278**     a function of time.  The case where r is a function of time leads
15279**     to an additional velocity component equal to the product of the
15280**     derivative of r and the position vector.
15281**
15282**  2) It is permissible for pv and rpv to be the same array.
15283**
15284**  Called:
15285**     iauRxp       product of r-matrix and p-vector
15286**
15287*/
15288
15289
15290
15291void iauRxr(double a[3][3], double b[3][3], double atb[3][3])
15292/*
15293**  - - - - - - -
15294**   i a u R x r
15295**  - - - - - - -
15296**
15297**  Multiply two r-matrices.
15298**
15299**  This function is part of the International Astronomical Union's
15300**  SOFA (Standards Of Fundamental Astronomy) software collection.
15301**
15302**  Status:  vector/matrix support function.
15303**
15304**  Given:
15305**     a        double[3][3]    first r-matrix
15306**     b        double[3][3]    second r-matrix
15307**
15308**  Returned:
15309**     atb      double[3][3]    a * b
15310**
15311**  Note:
15312**     It is permissible to re-use the same array for any of the
15313**     arguments.
15314**
15315**  Called:
15316**     iauCr        copy r-matrix
15317**
15318*/
15319
15320
15321
15322void iauRy(double theta, double r[3][3])
15323/*
15324**  - - - - - -
15325**   i a u R y
15326**  - - - - - -
15327**
15328**  Rotate an r-matrix about the y-axis.
15329**
15330**  This function is part of the International Astronomical Union's
15331**  SOFA (Standards Of Fundamental Astronomy) software collection.
15332**
15333**  Status:  vector/matrix support function.
15334**
15335**  Given:
15336**     theta  double          angle (radians)
15337**
15338**  Given and returned:
15339**     r      double[3][3]    r-matrix, rotated
15340**
15341**  Notes:
15342**
15343**  1) Calling this function with positive theta incorporates in the
15344**     supplied r-matrix r an additional rotation, about the y-axis,
15345**     anticlockwise as seen looking towards the origin from positive y.
15346**
15347**  2) The additional rotation can be represented by this matrix:
15348**
15349**         (  + cos(theta)     0      - sin(theta)  )
15350**         (                                        )
15351**         (       0           1           0        )
15352**         (                                        )
15353**         (  + sin(theta)     0      + cos(theta)  )
15354**
15355*/
15356
15357
15358
15359void iauRz(double psi, double r[3][3])
15360/*
15361**  - - - - - -
15362**   i a u R z
15363**  - - - - - -
15364**
15365**  Rotate an r-matrix about the z-axis.
15366**
15367**  This function is part of the International Astronomical Union's
15368**  SOFA (Standards Of Fundamental Astronomy) software collection.
15369**
15370**  Status:  vector/matrix support function.
15371**
15372**  Given:
15373**     psi    double          angle (radians)
15374**
15375**  Given and returned:
15376**     r      double[3][3]    r-matrix, rotated
15377**
15378**  Notes:
15379**
15380**  1) Calling this function with positive psi incorporates in the
15381**     supplied r-matrix r an additional rotation, about the z-axis,
15382**     anticlockwise as seen looking towards the origin from positive z.
15383**
15384**  2) The additional rotation can be represented by this matrix:
15385**
15386**         (  + cos(psi)   + sin(psi)     0  )
15387**         (                                 )
15388**         (  - sin(psi)   + cos(psi)     0  )
15389**         (                                 )
15390**         (       0            0         1  )
15391**
15392*/
15393
15394
15395
15396double iauS00(double date1, double date2, double x, double y)
15397/*
15398**  - - - - - - -
15399**   i a u S 0 0
15400**  - - - - - - -
15401**
15402**  The CIO locator s, positioning the Celestial Intermediate Origin on
15403**  the equator of the Celestial Intermediate Pole, given the CIP's X,Y
15404**  coordinates.  Compatible with IAU 2000A precession-nutation.
15405**
15406**  This function is part of the International Astronomical Union's
15407**  SOFA (Standards Of Fundamental Astronomy) software collection.
15408**
15409**  Status:  canonical model.
15410**
15411**  Given:
15412**     date1,date2   double    TT as a 2-part Julian Date (Note 1)
15413**     x,y           double    CIP coordinates (Note 3)
15414**
15415**  Returned (function value):
15416**                   double    the CIO locator s in radians (Note 2)
15417**
15418**  Notes:
15419**
15420**  1) The TT date date1+date2 is a Julian Date, apportioned in any
15421**     convenient way between the two arguments.  For example,
15422**     JD(TT)=2450123.7 could be expressed in any of these ways,
15423**     among others:
15424**
15425**            date1          date2
15426**
15427**         2450123.7           0.0       (JD method)
15428**         2451545.0       -1421.3       (J2000 method)
15429**         2400000.5       50123.2       (MJD method)
15430**         2450123.5           0.2       (date & time method)
15431**
15432**     The JD method is the most natural and convenient to use in
15433**     cases where the loss of several decimal digits of resolution
15434**     is acceptable.  The J2000 method is best matched to the way
15435**     the argument is handled internally and will deliver the
15436**     optimum resolution.  The MJD method and the date & time methods
15437**     are both good compromises between resolution and convenience.
15438**
15439**  2) The CIO locator s is the difference between the right ascensions
15440**     of the same point in two systems:  the two systems are the GCRS
15441**     and the CIP,CIO, and the point is the ascending node of the
15442**     CIP equator.  The quantity s remains below 0.1 arcsecond
15443**     throughout 1900-2100.
15444**
15445**  3) The series used to compute s is in fact for s+XY/2, where X and Y
15446**     are the x and y components of the CIP unit vector;  this series
15447**     is more compact than a direct series for s would be.  This
15448**     function requires X,Y to be supplied by the caller, who is
15449**     responsible for providing values that are consistent with the
15450**     supplied date.
15451**
15452**  4) The model is consistent with the IAU 2000A precession-nutation.
15453**
15454**  Called:
15455**     iauFal03     mean anomaly of the Moon
15456**     iauFalp03    mean anomaly of the Sun
15457**     iauFaf03     mean argument of the latitude of the Moon
15458**     iauFad03     mean elongation of the Moon from the Sun
15459**     iauFaom03    mean longitude of the Moon's ascending node
15460**     iauFave03    mean longitude of Venus
15461**     iauFae03     mean longitude of Earth
15462**     iauFapa03    general accumulated precession in longitude
15463**
15464**  References:
15465**
15466**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
15467**     "Expressions for the Celestial Intermediate Pole and Celestial
15468**     Ephemeris Origin consistent with the IAU 2000A precession-
15469**     nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
15470**
15471**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
15472**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
15473**
15474**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
15475**     IERS Technical Note No. 32, BKG (2004)
15476**
15477*/
15478
15479
15480
15481double iauS00a(double date1, double date2)
15482/*
15483**  - - - - - - - -
15484**   i a u S 0 0 a
15485**  - - - - - - - -
15486**
15487**  The CIO locator s, positioning the Celestial Intermediate Origin on
15488**  the equator of the Celestial Intermediate Pole, using the IAU 2000A
15489**  precession-nutation model.
15490**
15491**  This function is part of the International Astronomical Union's
15492**  SOFA (Standards Of Fundamental Astronomy) software collection.
15493**
15494**  Status:  support function.
15495**
15496**  Given:
15497**     date1,date2  double    TT as a 2-part Julian Date (Note 1)
15498**
15499**  Returned (function value):
15500**                  double    the CIO locator s in radians (Note 2)
15501**
15502**  Notes:
15503**
15504**  1) The TT date date1+date2 is a Julian Date, apportioned in any
15505**     convenient way between the two arguments.  For example,
15506**     JD(TT)=2450123.7 could be expressed in any of these ways,
15507**     among others:
15508**
15509**            date1          date2
15510**
15511**         2450123.7           0.0       (JD method)
15512**         2451545.0       -1421.3       (J2000 method)
15513**         2400000.5       50123.2       (MJD method)
15514**         2450123.5           0.2       (date & time method)
15515**
15516**     The JD method is the most natural and convenient to use in
15517**     cases where the loss of several decimal digits of resolution
15518**     is acceptable.  The J2000 method is best matched to the way
15519**     the argument is handled internally and will deliver the
15520**     optimum resolution.  The MJD method and the date & time methods
15521**     are both good compromises between resolution and convenience.
15522**
15523**  2) The CIO locator s is the difference between the right ascensions
15524**     of the same point in two systems.  The two systems are the GCRS
15525**     and the CIP,CIO, and the point is the ascending node of the
15526**     CIP equator.  The CIO locator s remains a small fraction of
15527**     1 arcsecond throughout 1900-2100.
15528**
15529**  3) The series used to compute s is in fact for s+XY/2, where X and Y
15530**     are the x and y components of the CIP unit vector;  this series
15531**     is more compact than a direct series for s would be.  The present
15532**     function uses the full IAU 2000A nutation model when predicting
15533**     the CIP position.  Faster results, with no significant loss of
15534**     accuracy, can be obtained via the function iauS00b, which uses
15535**     instead the IAU 2000B truncated model.
15536**
15537**  Called:
15538**     iauPnm00a    classical NPB matrix, IAU 2000A
15539**     iauBnp2xy    extract CIP X,Y from the BPN matrix
15540**     iauS00       the CIO locator s, given X,Y, IAU 2000A
15541**
15542**  References:
15543**
15544**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
15545**     "Expressions for the Celestial Intermediate Pole and Celestial
15546**     Ephemeris Origin consistent with the IAU 2000A precession-
15547**     nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
15548**
15549**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
15550**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
15551**
15552**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
15553**     IERS Technical Note No. 32, BKG (2004)
15554**
15555*/
15556
15557
15558
15559double iauS00b(double date1, double date2)
15560/*
15561**  - - - - - - - -
15562**   i a u S 0 0 b
15563**  - - - - - - - -
15564**
15565**  The CIO locator s, positioning the Celestial Intermediate Origin on
15566**  the equator of the Celestial Intermediate Pole, using the IAU 2000B
15567**  precession-nutation model.
15568**
15569**  This function is part of the International Astronomical Union's
15570**  SOFA (Standards Of Fundamental Astronomy) software collection.
15571**
15572**  Status:  support function.
15573**
15574**  Given:
15575**     date1,date2  double    TT as a 2-part Julian Date (Note 1)
15576**
15577**  Returned (function value):
15578**                  double    the CIO locator s in radians (Note 2)
15579**
15580**  Notes:
15581**
15582**  1) The TT date date1+date2 is a Julian Date, apportioned in any
15583**     convenient way between the two arguments.  For example,
15584**     JD(TT)=2450123.7 could be expressed in any of these ways,
15585**     among others:
15586**
15587**            date1          date2
15588**
15589**         2450123.7           0.0       (JD method)
15590**         2451545.0       -1421.3       (J2000 method)
15591**         2400000.5       50123.2       (MJD method)
15592**         2450123.5           0.2       (date & time method)
15593**
15594**     The JD method is the most natural and convenient to use in
15595**     cases where the loss of several decimal digits of resolution
15596**     is acceptable.  The J2000 method is best matched to the way
15597**     the argument is handled internally and will deliver the
15598**     optimum resolution.  The MJD method and the date & time methods
15599**     are both good compromises between resolution and convenience.
15600**
15601**  2) The CIO locator s is the difference between the right ascensions
15602**     of the same point in two systems.  The two systems are the GCRS
15603**     and the CIP,CIO, and the point is the ascending node of the
15604**     CIP equator.  The CIO locator s remains a small fraction of
15605**     1 arcsecond throughout 1900-2100.
15606**
15607**  3) The series used to compute s is in fact for s+XY/2, where X and Y
15608**     are the x and y components of the CIP unit vector;  this series
15609**     is more compact than a direct series for s would be.  The present
15610**     function uses the IAU 2000B truncated nutation model when
15611**     predicting the CIP position.  The function iauS00a uses instead
15612**     the full IAU 2000A model, but with no significant increase in
15613**     accuracy and at some cost in speed.
15614**
15615**  Called:
15616**     iauPnm00b    classical NPB matrix, IAU 2000B
15617**     iauBnp2xy    extract CIP X,Y from the BPN matrix
15618**     iauS00       the CIO locator s, given X,Y, IAU 2000A
15619**
15620**  References:
15621**
15622**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
15623**     "Expressions for the Celestial Intermediate Pole and Celestial
15624**     Ephemeris Origin consistent with the IAU 2000A precession-
15625**     nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
15626**
15627**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
15628**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
15629**
15630**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
15631**     IERS Technical Note No. 32, BKG (2004)
15632**
15633*/
15634
15635
15636
15637double iauS06(double date1, double date2, double x, double y)
15638/*
15639**  - - - - - - -
15640**   i a u S 0 6
15641**  - - - - - - -
15642**
15643**  The CIO locator s, positioning the Celestial Intermediate Origin on
15644**  the equator of the Celestial Intermediate Pole, given the CIP's X,Y
15645**  coordinates.  Compatible with IAU 2006/2000A precession-nutation.
15646**
15647**  This function is part of the International Astronomical Union's
15648**  SOFA (Standards Of Fundamental Astronomy) software collection.
15649**
15650**  Status:  canonical model.
15651**
15652**  Given:
15653**     date1,date2   double    TT as a 2-part Julian Date (Note 1)
15654**     x,y           double    CIP coordinates (Note 3)
15655**
15656**  Returned (function value):
15657**                   double    the CIO locator s in radians (Note 2)
15658**
15659**  Notes:
15660**
15661**  1) The TT date date1+date2 is a Julian Date, apportioned in any
15662**     convenient way between the two arguments.  For example,
15663**     JD(TT)=2450123.7 could be expressed in any of these ways,
15664**     among others:
15665**
15666**            date1          date2
15667**
15668**         2450123.7           0.0       (JD method)
15669**         2451545.0       -1421.3       (J2000 method)
15670**         2400000.5       50123.2       (MJD method)
15671**         2450123.5           0.2       (date & time method)
15672**
15673**     The JD method is the most natural and convenient to use in
15674**     cases where the loss of several decimal digits of resolution
15675**     is acceptable.  The J2000 method is best matched to the way
15676**     the argument is handled internally and will deliver the
15677**     optimum resolution.  The MJD method and the date & time methods
15678**     are both good compromises between resolution and convenience.
15679**
15680**  2) The CIO locator s is the difference between the right ascensions
15681**     of the same point in two systems:  the two systems are the GCRS
15682**     and the CIP,CIO, and the point is the ascending node of the
15683**     CIP equator.  The quantity s remains below 0.1 arcsecond
15684**     throughout 1900-2100.
15685**
15686**  3) The series used to compute s is in fact for s+XY/2, where X and Y
15687**     are the x and y components of the CIP unit vector;  this series
15688**     is more compact than a direct series for s would be.  This
15689**     function requires X,Y to be supplied by the caller, who is
15690**     responsible for providing values that are consistent with the
15691**     supplied date.
15692**
15693**  4) The model is consistent with the "P03" precession (Capitaine et
15694**     al. 2003), adopted by IAU 2006 Resolution 1, 2006, and the
15695**     IAU 2000A nutation (with P03 adjustments).
15696**
15697**  Called:
15698**     iauFal03     mean anomaly of the Moon
15699**     iauFalp03    mean anomaly of the Sun
15700**     iauFaf03     mean argument of the latitude of the Moon
15701**     iauFad03     mean elongation of the Moon from the Sun
15702**     iauFaom03    mean longitude of the Moon's ascending node
15703**     iauFave03    mean longitude of Venus
15704**     iauFae03     mean longitude of Earth
15705**     iauFapa03    general accumulated precession in longitude
15706**
15707**  References:
15708**
15709**     Capitaine, N., Wallace, P.T. & Chapront, J., 2003, Astron.
15710**     Astrophys. 432, 355
15711**
15712**     McCarthy, D.D., Petit, G. (eds.) 2004, IERS Conventions (2003),
15713**     IERS Technical Note No. 32, BKG
15714**
15715*/
15716
15717
15718
15719double iauS06a(double date1, double date2)
15720/*
15721**  - - - - - - - -
15722**   i a u S 0 6 a
15723**  - - - - - - - -
15724**
15725**  The CIO locator s, positioning the Celestial Intermediate Origin on
15726**  the equator of the Celestial Intermediate Pole, using the IAU 2006
15727**  precession and IAU 2000A nutation models.
15728**
15729**  This function is part of the International Astronomical Union's
15730**  SOFA (Standards Of Fundamental Astronomy) software collection.
15731**
15732**  Status:  support function.
15733**
15734**  Given:
15735**     date1,date2  double    TT as a 2-part Julian Date (Note 1)
15736**
15737**  Returned (function value):
15738**                  double    the CIO locator s in radians (Note 2)
15739**
15740**  Notes:
15741**
15742**  1) The TT date date1+date2 is a Julian Date, apportioned in any
15743**     convenient way between the two arguments.  For example,
15744**     JD(TT)=2450123.7 could be expressed in any of these ways,
15745**     among others:
15746**
15747**            date1          date2
15748**
15749**         2450123.7           0.0       (JD method)
15750**         2451545.0       -1421.3       (J2000 method)
15751**         2400000.5       50123.2       (MJD method)
15752**         2450123.5           0.2       (date & time method)
15753**
15754**     The JD method is the most natural and convenient to use in
15755**     cases where the loss of several decimal digits of resolution
15756**     is acceptable.  The J2000 method is best matched to the way
15757**     the argument is handled internally and will deliver the
15758**     optimum resolution.  The MJD method and the date & time methods
15759**     are both good compromises between resolution and convenience.
15760**
15761**  2) The CIO locator s is the difference between the right ascensions
15762**     of the same point in two systems.  The two systems are the GCRS
15763**     and the CIP,CIO, and the point is the ascending node of the
15764**     CIP equator.  The CIO locator s remains a small fraction of
15765**     1 arcsecond throughout 1900-2100.
15766**
15767**  3) The series used to compute s is in fact for s+XY/2, where X and Y
15768**     are the x and y components of the CIP unit vector;  this series is
15769**     more compact than a direct series for s would be.  The present
15770**     function uses the full IAU 2000A nutation model when predicting
15771**     the CIP position.
15772**
15773**  Called:
15774**     iauPnm06a    classical NPB matrix, IAU 2006/2000A
15775**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
15776**     iauS06       the CIO locator s, given X,Y, IAU 2006
15777**
15778**  References:
15779**
15780**     Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
15781**     "Expressions for the Celestial Intermediate Pole and Celestial
15782**     Ephemeris Origin consistent with the IAU 2000A precession-
15783**     nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
15784**
15785**     n.b. The celestial ephemeris origin (CEO) was renamed "celestial
15786**          intermediate origin" (CIO) by IAU 2006 Resolution 2.
15787**
15788**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
15789**
15790**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
15791**     IERS Technical Note No. 32, BKG
15792**
15793**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
15794**
15795*/
15796
15797
15798
15799void iauS2c(double theta, double phi, double c[3])
15800/*
15801**  - - - - - - -
15802**   i a u S 2 c
15803**  - - - - - - -
15804**
15805**  Convert spherical coordinates to Cartesian.
15806**
15807**  This function is part of the International Astronomical Union's
15808**  SOFA (Standards Of Fundamental Astronomy) software collection.
15809**
15810**  Status:  vector/matrix support function.
15811**
15812**  Given:
15813**     theta    double       longitude angle (radians)
15814**     phi      double       latitude angle (radians)
15815**
15816**  Returned:
15817**     c        double[3]    direction cosines
15818**
15819*/
15820
15821
15822
15823void iauS2p(double theta, double phi, double r, double p[3])
15824/*
15825**  - - - - - - -
15826**   i a u S 2 p
15827**  - - - - - - -
15828**
15829**  Convert spherical polar coordinates to p-vector.
15830**
15831**  This function is part of the International Astronomical Union's
15832**  SOFA (Standards Of Fundamental Astronomy) software collection.
15833**
15834**  Status:  vector/matrix support function.
15835**
15836**  Given:
15837**     theta   double       longitude angle (radians)
15838**     phi     double       latitude angle (radians)
15839**     r       double       radial distance
15840**
15841**  Returned:
15842**     p       double[3]    Cartesian coordinates
15843**
15844**  Called:
15845**     iauS2c       spherical coordinates to unit vector
15846**     iauSxp       multiply p-vector by scalar
15847**
15848*/
15849
15850
15851
15852void iauS2pv(double theta, double phi, double r,
15853             double td, double pd, double rd,
15854             double pv[2][3])
15855/*
15856**  - - - - - - - -
15857**   i a u S 2 p v
15858**  - - - - - - - -
15859**
15860**  Convert position/velocity from spherical to Cartesian coordinates.
15861**
15862**  This function is part of the International Astronomical Union's
15863**  SOFA (Standards Of Fundamental Astronomy) software collection.
15864**
15865**  Status:  vector/matrix support function.
15866**
15867**  Given:
15868**     theta    double          longitude angle (radians)
15869**     phi      double          latitude angle (radians)
15870**     r        double          radial distance
15871**     td       double          rate of change of theta
15872**     pd       double          rate of change of phi
15873**     rd       double          rate of change of r
15874**
15875**  Returned:
15876**     pv       double[2][3]    pv-vector
15877**
15878*/
15879
15880
15881
15882void iauS2xpv(double s1, double s2, double pv[2][3], double spv[2][3])
15883/*
15884**  - - - - - - - - -
15885**   i a u S 2 x p v
15886**  - - - - - - - - -
15887**
15888**  Multiply a pv-vector by two scalars.
15889**
15890**  This function is part of the International Astronomical Union's
15891**  SOFA (Standards Of Fundamental Astronomy) software collection.
15892**
15893**  Status:  vector/matrix support function.
15894**
15895**  Given:
15896**     s1     double         scalar to multiply position component by
15897**     s2     double         scalar to multiply velocity component by
15898**     pv     double[2][3]   pv-vector
15899**
15900**  Returned:
15901**     spv    double[2][3]   pv-vector: p scaled by s1, v scaled by s2
15902**
15903**  Note:
15904**     It is permissible for pv and spv to be the same array.
15905**
15906**  Called:
15907**     iauSxp       multiply p-vector by scalar
15908**
15909*/
15910
15911
15912
15913double iauSepp(double a[3], double b[3])
15914/*
15915**  - - - - - - - -
15916**   i a u S e p p
15917**  - - - - - - - -
15918**
15919**  Angular separation between two p-vectors.
15920**
15921**  This function is part of the International Astronomical Union's
15922**  SOFA (Standards Of Fundamental Astronomy) software collection.
15923**
15924**  Status:  vector/matrix support function.
15925**
15926**  Given:
15927**     a      double[3]    first p-vector (not necessarily unit length)
15928**     b      double[3]    second p-vector (not necessarily unit length)
15929**
15930**  Returned (function value):
15931**            double       angular separation (radians, always positive)
15932**
15933**  Notes:
15934**
15935**  1) If either vector is null, a zero result is returned.
15936**
15937**  2) The angular separation is most simply formulated in terms of
15938**     scalar product.  However, this gives poor accuracy for angles
15939**     near zero and pi.  The present algorithm uses both cross product
15940**     and dot product, to deliver full accuracy whatever the size of
15941**     the angle.
15942**
15943**  Called:
15944**     iauPxp       vector product of two p-vectors
15945**     iauPm        modulus of p-vector
15946**     iauPdp       scalar product of two p-vectors
15947**
15948*/
15949
15950
15951
15952double iauSeps(double al, double ap, double bl, double bp)
15953/*
15954**  - - - - - - - -
15955**   i a u S e p s
15956**  - - - - - - - -
15957**
15958**  Angular separation between two sets of spherical coordinates.
15959**
15960**  This function is part of the International Astronomical Union's
15961**  SOFA (Standards Of Fundamental Astronomy) software collection.
15962**
15963**  Status:  vector/matrix support function.
15964**
15965**  Given:
15966**     al     double       first longitude (radians)
15967**     ap     double       first latitude (radians)
15968**     bl     double       second longitude (radians)
15969**     bp     double       second latitude (radians)
15970**
15971**  Returned (function value):
15972**            double       angular separation (radians)
15973**
15974**  Called:
15975**     iauS2c       spherical coordinates to unit vector
15976**     iauSepp      angular separation between two p-vectors
15977**
15978*/
15979
15980
15981
15982double iauSp00(double date1, double date2)
15983/*
15984**  - - - - - - - -
15985**   i a u S p 0 0
15986**  - - - - - - - -
15987**
15988**  The TIO locator s', positioning the Terrestrial Intermediate Origin
15989**  on the equator of the Celestial Intermediate Pole.
15990**
15991**  This function is part of the International Astronomical Union's
15992**  SOFA (Standards Of Fundamental Astronomy) software collection.
15993**
15994**  Status:  canonical model.
15995**
15996**  Given:
15997**     date1,date2  double    TT as a 2-part Julian Date (Note 1)
15998**
15999**  Returned (function value):
16000**                  double    the TIO locator s' in radians (Note 2)
16001**
16002**  Notes:
16003**
16004**  1) The TT date date1+date2 is a Julian Date, apportioned in any
16005**     convenient way between the two arguments.  For example,
16006**     JD(TT)=2450123.7 could be expressed in any of these ways,
16007**     among others:
16008**
16009**            date1          date2
16010**
16011**         2450123.7           0.0       (JD method)
16012**         2451545.0       -1421.3       (J2000 method)
16013**         2400000.5       50123.2       (MJD method)
16014**         2450123.5           0.2       (date & time method)
16015**
16016**     The JD method is the most natural and convenient to use in
16017**     cases where the loss of several decimal digits of resolution
16018**     is acceptable.  The J2000 method is best matched to the way
16019**     the argument is handled internally and will deliver the
16020**     optimum resolution.  The MJD method and the date & time methods
16021**     are both good compromises between resolution and convenience.
16022**
16023**  2) The TIO locator s' is obtained from polar motion observations by
16024**     numerical integration, and so is in essence unpredictable.
16025**     However, it is dominated by a secular drift of about
16026**     47 microarcseconds per century, which is the approximation
16027**     evaluated by the present function.
16028**
16029**  Reference:
16030**
16031**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
16032**     IERS Technical Note No. 32, BKG (2004)
16033**
16034*/
16035
16036
16037
16038int iauStarpm(double ra1, double dec1,
16039              double pmr1, double pmd1, double px1, double rv1,
16040              double ep1a, double ep1b, double ep2a, double ep2b,
16041              double *ra2, double *dec2,
16042              double *pmr2, double *pmd2, double *px2, double *rv2)
16043/*
16044**  - - - - - - - - - -
16045**   i a u S t a r p m
16046**  - - - - - - - - - -
16047**
16048**  Star proper motion:  update star catalog data for space motion.
16049**
16050**  This function is part of the International Astronomical Union's
16051**  SOFA (Standards Of Fundamental Astronomy) software collection.
16052**
16053**  Status:  support function.
16054**
16055**  Given:
16056**     ra1    double     right ascension (radians), before
16057**     dec1   double     declination (radians), before
16058**     pmr1   double     RA proper motion (radians/year), before
16059**     pmd1   double     Dec proper motion (radians/year), before
16060**     px1    double     parallax (arcseconds), before
16061**     rv1    double     radial velocity (km/s, +ve = receding), before
16062**     ep1a   double     "before" epoch, part A (Note 1)
16063**     ep1b   double     "before" epoch, part B (Note 1)
16064**     ep2a   double     "after" epoch, part A (Note 1)
16065**     ep2b   double     "after" epoch, part B (Note 1)
16066**
16067**  Returned:
16068**     ra2    double     right ascension (radians), after
16069**     dec2   double     declination (radians), after
16070**     pmr2   double     RA proper motion (radians/year), after
16071**     pmd2   double     Dec proper motion (radians/year), after
16072**     px2    double     parallax (arcseconds), after
16073**     rv2    double     radial velocity (km/s, +ve = receding), after
16074**
16075**  Returned (function value):
16076**            int        status:
16077**                          -1 = system error (should not occur)
16078**                           0 = no warnings or errors
16079**                           1 = distance overridden (Note 6)
16080**                           2 = excessive velocity (Note 7)
16081**                           4 = solution didn't converge (Note 8)
16082**                        else = binary logical OR of the above warnings
16083**
16084**  Notes:
16085**
16086**  1) The starting and ending TDB dates ep1a+ep1b and ep2a+ep2b are
16087**     Julian Dates, apportioned in any convenient way between the two
16088**     parts (A and B).  For example, JD(TDB)=2450123.7 could be
16089**     expressed in any of these ways, among others:
16090**
16091**             epna          epnb
16092**
16093**         2450123.7           0.0       (JD method)
16094**         2451545.0       -1421.3       (J2000 method)
16095**         2400000.5       50123.2       (MJD method)
16096**         2450123.5           0.2       (date & time method)
16097**
16098**     The JD method is the most natural and convenient to use in
16099**     cases where the loss of several decimal digits of resolution
16100**     is acceptable.  The J2000 method is best matched to the way
16101**     the argument is handled internally and will deliver the
16102**     optimum resolution.  The MJD method and the date & time methods
16103**     are both good compromises between resolution and convenience.
16104**
16105**  2) In accordance with normal star-catalog conventions, the object's
16106**     right ascension and declination are freed from the effects of
16107**     secular aberration.  The frame, which is aligned to the catalog
16108**     equator and equinox, is Lorentzian and centered on the SSB.
16109**
16110**     The proper motions are the rate of change of the right ascension
16111**     and declination at the catalog epoch and are in radians per TDB
16112**     Julian year.
16113**
16114**     The parallax and radial velocity are in the same frame.
16115**
16116**  3) Care is needed with units.  The star coordinates are in radians
16117**     and the proper motions in radians per Julian year, but the
16118**     parallax is in arcseconds.
16119**
16120**  4) The RA proper motion is in terms of coordinate angle, not true
16121**     angle.  If the catalog uses arcseconds for both RA and Dec proper
16122**     motions, the RA proper motion will need to be divided by cos(Dec)
16123**     before use.
16124**
16125**  5) Straight-line motion at constant speed, in the inertial frame,
16126**     is assumed.
16127**
16128**  6) An extremely small (or zero or negative) parallax is interpreted
16129**     to mean that the object is on the "celestial sphere", the radius
16130**     of which is an arbitrary (large) value (see the iauStarpv
16131**     function for the value used).  When the distance is overridden in
16132**     this way, the status, initially zero, has 1 added to it.
16133**
16134**  7) If the space velocity is a significant fraction of c (see the
16135**     constant VMAX in the function iauStarpv), it is arbitrarily set
16136**     to zero.  When this action occurs, 2 is added to the status.
16137**
16138**  8) The relativistic adjustment carried out in the iauStarpv function
16139**     involves an iterative calculation.  If the process fails to
16140**     converge within a set number of iterations, 4 is added to the
16141**     status.
16142**
16143**  Called:
16144**     iauStarpv    star catalog data to space motion pv-vector
16145**     iauPvu       update a pv-vector
16146**     iauPdp       scalar product of two p-vectors
16147**     iauPvstar    space motion pv-vector to star catalog data
16148**
16149*/
16150
16151
16152
16153int iauStarpv(double ra, double dec,
16154              double pmr, double pmd, double px, double rv,
16155              double pv[2][3])
16156/*
16157**  - - - - - - - - - -
16158**   i a u S t a r p v
16159**  - - - - - - - - - -
16160**
16161**  Convert star catalog coordinates to position+velocity vector.
16162**
16163**  This function is part of the International Astronomical Union's
16164**  SOFA (Standards Of Fundamental Astronomy) software collection.
16165**
16166**  Status:  support function.
16167**
16168**  Given (Note 1):
16169**     ra     double        right ascension (radians)
16170**     dec    double        declination (radians)
16171**     pmr    double        RA proper motion (radians/year)
16172**     pmd    double        Dec proper motion (radians/year)
16173**     px     double        parallax (arcseconds)
16174**     rv     double        radial velocity (km/s, positive = receding)
16175**
16176**  Returned (Note 2):
16177**     pv     double[2][3]  pv-vector (au, au/day)
16178**
16179**  Returned (function value):
16180**            int           status:
16181**                              0 = no warnings
16182**                              1 = distance overridden (Note 6)
16183**                              2 = excessive speed (Note 7)
16184**                              4 = solution didn't converge (Note 8)
16185**                           else = binary logical OR of the above
16186**
16187**  Notes:
16188**
16189**  1) The star data accepted by this function are "observables" for an
16190**     imaginary observer at the solar-system barycenter.  Proper motion
16191**     and radial velocity are, strictly, in terms of barycentric
16192**     coordinate time, TCB.  For most practical applications, it is
16193**     permissible to neglect the distinction between TCB and ordinary
16194**     "proper" time on Earth (TT/TAI).  The result will, as a rule, be
16195**     limited by the intrinsic accuracy of the proper-motion and
16196**     radial-velocity data;  moreover, the pv-vector is likely to be
16197**     merely an intermediate result, so that a change of time unit
16198**     would cancel out overall.
16199**
16200**     In accordance with normal star-catalog conventions, the object's
16201**     right ascension and declination are freed from the effects of
16202**     secular aberration.  The frame, which is aligned to the catalog
16203**     equator and equinox, is Lorentzian and centered on the SSB.
16204**
16205**  2) The resulting position and velocity pv-vector is with respect to
16206**     the same frame and, like the catalog coordinates, is freed from
16207**     the effects of secular aberration.  Should the "coordinate
16208**     direction", where the object was located at the catalog epoch, be
16209**     required, it may be obtained by calculating the magnitude of the
16210**     position vector pv[0][0-2] dividing by the speed of light in
16211**     au/day to give the light-time, and then multiplying the space
16212**     velocity pv[1][0-2] by this light-time and adding the result to
16213**     pv[0][0-2].
16214**
16215**     Summarizing, the pv-vector returned is for most stars almost
16216**     identical to the result of applying the standard geometrical
16217**     "space motion" transformation.  The differences, which are the
16218**     subject of the Stumpff paper referenced below, are:
16219**
16220**     (i) In stars with significant radial velocity and proper motion,
16221**     the constantly changing light-time distorts the apparent proper
16222**     motion.  Note that this is a classical, not a relativistic,
16223**     effect.
16224**
16225**     (ii) The transformation complies with special relativity.
16226**
16227**  3) Care is needed with units.  The star coordinates are in radians
16228**     and the proper motions in radians per Julian year, but the
16229**     parallax is in arcseconds; the radial velocity is in km/s, but
16230**     the pv-vector result is in au and au/day.
16231**
16232**  4) The RA proper motion is in terms of coordinate angle, not true
16233**     angle.  If the catalog uses arcseconds for both RA and Dec proper
16234**     motions, the RA proper motion will need to be divided by cos(Dec)
16235**     before use.
16236**
16237**  5) Straight-line motion at constant speed, in the inertial frame,
16238**     is assumed.
16239**
16240**  6) An extremely small (or zero or negative) parallax is interpreted
16241**     to mean that the object is on the "celestial sphere", the radius
16242**     of which is an arbitrary (large) value (see the constant PXMIN).
16243**     When the distance is overridden in this way, the status,
16244**     initially zero, has 1 added to it.
16245**
16246**  7) If the space velocity is a significant fraction of c (see the
16247**     constant VMAX), it is arbitrarily set to zero.  When this action
16248**     occurs, 2 is added to the status.
16249**
16250**  8) The relativistic adjustment involves an iterative calculation.
16251**     If the process fails to converge within a set number (IMAX) of
16252**     iterations, 4 is added to the status.
16253**
16254**  9) The inverse transformation is performed by the function
16255**     iauPvstar.
16256**
16257**  Called:
16258**     iauS2pv      spherical coordinates to pv-vector
16259**     iauPm        modulus of p-vector
16260**     iauZp        zero p-vector
16261**     iauPn        decompose p-vector into modulus and direction
16262**     iauPdp       scalar product of two p-vectors
16263**     iauSxp       multiply p-vector by scalar
16264**     iauPmp       p-vector minus p-vector
16265**     iauPpp       p-vector plus p-vector
16266**
16267**  Reference:
16268**
16269**     Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.
16270**
16271*/
16272
16273
16274
16275void iauSxp(double s, double p[3], double sp[3])
16276/*
16277**  - - - - - - -
16278**   i a u S x p
16279**  - - - - - - -
16280**
16281**  Multiply a p-vector by a scalar.
16282**
16283**  This function is part of the International Astronomical Union's
16284**  SOFA (Standards Of Fundamental Astronomy) software collection.
16285**
16286**  Status:  vector/matrix support function.
16287**
16288**  Given:
16289**     s      double        scalar
16290**     p      double[3]     p-vector
16291**
16292**  Returned:
16293**     sp     double[3]     s * p
16294**
16295**  Note:
16296**     It is permissible for p and sp to be the same array.
16297**
16298*/
16299
16300
16301
16302void iauSxpv(double s, double pv[2][3], double spv[2][3])
16303/*
16304**  - - - - - - - -
16305**   i a u S x p v
16306**  - - - - - - - -
16307**
16308**  Multiply a pv-vector by a scalar.
16309**
16310**  This function is part of the International Astronomical Union's
16311**  SOFA (Standards Of Fundamental Astronomy) software collection.
16312**
16313**  Status:  vector/matrix support function.
16314**
16315**  Given:
16316**     s       double          scalar
16317**     pv      double[2][3]    pv-vector
16318**
16319**  Returned:
16320**     spv     double[2][3]    s * pv
16321**
16322**  Note:
16323**     It is permissible for pv and spv to be the same array.
16324**
16325**  Called:
16326**     iauS2xpv     multiply pv-vector by two scalars
16327**
16328*/
16329
16330
16331
16332int iauTaitt(double tai1, double tai2, double *tt1, double *tt2)
16333/*
16334**  - - - - - - - - -
16335**   i a u T a i t t
16336**  - - - - - - - - -
16337**
16338**  Time scale transformation:  International Atomic Time, TAI, to
16339**  Terrestrial Time, TT.
16340**
16341**  This function is part of the International Astronomical Union's
16342**  SOFA (Standards of Fundamental Astronomy) software collection.
16343**
16344**  Status:  canonical.
16345**
16346**  Given:
16347**     tai1,tai2  double    TAI as a 2-part Julian Date
16348**
16349**  Returned:
16350**     tt1,tt2    double    TT as a 2-part Julian Date
16351**
16352**  Returned (function value):
16353**                int       status:  0 = OK
16354**
16355**  Note:
16356**
16357**     tai1+tai2 is Julian Date, apportioned in any convenient way
16358**     between the two arguments, for example where tai1 is the Julian
16359**     Day Number and tai2 is the fraction of a day.  The returned
16360**     tt1,tt2 follow suit.
16361**
16362**  References:
16363**
16364**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
16365**     IERS Technical Note No. 32, BKG (2004)
16366**
16367**     Explanatory Supplement to the Astronomical Almanac,
16368**     P. Kenneth Seidelmann (ed), University Science Books (1992)
16369**
16370*/
16371
16372
16373
16374int iauTaiut1(double tai1, double tai2, double dta,
16375              double *ut11, double *ut12)
16376/*
16377**  - - - - - - - - - -
16378**   i a u T a i u t 1
16379**  - - - - - - - - - -
16380**
16381**  Time scale transformation:  International Atomic Time, TAI, to
16382**  Universal Time, UT1.
16383**
16384**  This function is part of the International Astronomical Union's
16385**  SOFA (Standards of Fundamental Astronomy) software collection.
16386**
16387**  Status:  canonical.
16388**
16389**  Given:
16390**     tai1,tai2  double    TAI as a 2-part Julian Date
16391**     dta        double    UT1-TAI in seconds
16392**
16393**  Returned:
16394**     ut11,ut12  double    UT1 as a 2-part Julian Date
16395**
16396**  Returned (function value):
16397**                int       status:  0 = OK
16398**
16399**  Notes:
16400**
16401**  1) tai1+tai2 is Julian Date, apportioned in any convenient way
16402**     between the two arguments, for example where tai1 is the Julian
16403**     Day Number and tai2 is the fraction of a day.  The returned
16404**     UT11,UT12 follow suit.
16405**
16406**  2) The argument dta, i.e. UT1-TAI, is an observed quantity, and is
16407**     available from IERS tabulations.
16408**
16409**  Reference:
16410**
16411**     Explanatory Supplement to the Astronomical Almanac,
16412**     P. Kenneth Seidelmann (ed), University Science Books (1992)
16413**
16414*/
16415
16416
16417
16418int iauTaiutc(double tai1, double tai2, double *utc1, double *utc2)
16419/*
16420**  - - - - - - - - - -
16421**   i a u T a i u t c
16422**  - - - - - - - - - -
16423**
16424**  Time scale transformation:  International Atomic Time, TAI, to
16425**  Coordinated Universal Time, UTC.
16426**
16427**  This function is part of the International Astronomical Union's
16428**  SOFA (Standards of Fundamental Astronomy) software collection.
16429**
16430**  Status:  canonical.
16431**
16432**  Given:
16433**     tai1,tai2  double   TAI as a 2-part Julian Date (Note 1)
16434**
16435**  Returned:
16436**     utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 1-3)
16437**
16438**  Returned (function value):
16439**                int      status: +1 = dubious year (Note 4)
16440**                                  0 = OK
16441**                                 -1 = unacceptable date
16442**
16443**  Notes:
16444**
16445**  1) tai1+tai2 is Julian Date, apportioned in any convenient way
16446**     between the two arguments, for example where tai1 is the Julian
16447**     Day Number and tai2 is the fraction of a day.  The returned utc1
16448**     and utc2 form an analogous pair, except that a special convention
16449**     is used, to deal with the problem of leap seconds - see the next
16450**     note.
16451**
16452**  2) JD cannot unambiguously represent UTC during a leap second unless
16453**     special measures are taken.  The convention in the present
16454**     function is that the JD day represents UTC days whether the
16455**     length is 86399, 86400 or 86401 SI seconds.  In the 1960-1972 era
16456**     there were smaller jumps (in either direction) each time the
16457**     linear UTC(TAI) expression was changed, and these "mini-leaps"
16458**     are also included in the SOFA convention.
16459**
16460**  3) The function iauD2dtf can be used to transform the UTC quasi-JD
16461**     into calendar date and clock time, including UTC leap second
16462**     handling.
16463**
16464**  4) The warning status "dubious year" flags UTCs that predate the
16465**     introduction of the time scale or that are too far in the future
16466**     to be trusted.  See iauDat for further details.
16467**
16468**  Called:
16469**     iauUtctai    UTC to TAI
16470**
16471**  References:
16472**
16473**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
16474**     IERS Technical Note No. 32, BKG (2004)
16475**
16476**     Explanatory Supplement to the Astronomical Almanac,
16477**     P. Kenneth Seidelmann (ed), University Science Books (1992)
16478**
16479*/
16480
16481
16482
16483int iauTcbtdb(double tcb1, double tcb2, double *tdb1, double *tdb2)
16484/*
16485**  - - - - - - - - - -
16486**   i a u T c b t d b
16487**  - - - - - - - - - -
16488**
16489**  Time scale transformation:  Barycentric Coordinate Time, TCB, to
16490**  Barycentric Dynamical Time, TDB.
16491**
16492**  This function is part of the International Astronomical Union's
16493**  SOFA (Standards of Fundamental Astronomy) software collection.
16494**
16495**  Status:  canonical.
16496**
16497**  Given:
16498**     tcb1,tcb2  double    TCB as a 2-part Julian Date
16499**
16500**  Returned:
16501**     tdb1,tdb2  double    TDB as a 2-part Julian Date
16502**
16503**  Returned (function value):
16504**                int       status:  0 = OK
16505**
16506**  Notes:
16507**
16508**  1) tcb1+tcb2 is Julian Date, apportioned in any convenient way
16509**     between the two arguments, for example where tcb1 is the Julian
16510**     Day Number and tcb2 is the fraction of a day.  The returned
16511**     tdb1,tdb2 follow suit.
16512**
16513**  2) The 2006 IAU General Assembly introduced a conventional linear
16514**     transformation between TDB and TCB.  This transformation
16515**     compensates for the drift between TCB and terrestrial time TT,
16516**     and keeps TDB approximately centered on TT.  Because the
16517**     relationship between TT and TCB depends on the adopted solar
16518**     system ephemeris, the degree of alignment between TDB and TT over
16519**     long intervals will vary according to which ephemeris is used.
16520**     Former definitions of TDB attempted to avoid this problem by
16521**     stipulating that TDB and TT should differ only by periodic
16522**     effects.  This is a good description of the nature of the
16523**     relationship but eluded precise mathematical formulation.  The
16524**     conventional linear relationship adopted in 2006 sidestepped
16525**     these difficulties whilst delivering a TDB that in practice was
16526**     consistent with values before that date.
16527**
16528**  3) TDB is essentially the same as Teph, the time argument for the
16529**     JPL solar system ephemerides.
16530**
16531**  Reference:
16532**
16533**     IAU 2006 Resolution B3
16534**
16535*/
16536
16537
16538
16539int iauTcgtt(double tcg1, double tcg2, double *tt1, double *tt2)
16540/*
16541**  - - - - - - - - -
16542**   i a u T c g t t
16543**  - - - - - - - - -
16544**
16545**  Time scale transformation:  Geocentric Coordinate Time, TCG, to
16546**  Terrestrial Time, TT.
16547**
16548**  This function is part of the International Astronomical Union's
16549**  SOFA (Standards of Fundamental Astronomy) software collection.
16550**
16551**  Status:  canonical.
16552**
16553**  Given:
16554**     tcg1,tcg2  double    TCG as a 2-part Julian Date
16555**
16556**  Returned:
16557**     tt1,tt2    double    TT as a 2-part Julian Date
16558**
16559**  Returned (function value):
16560**                int       status:  0 = OK
16561**
16562**  Note:
16563**
16564**     tcg1+tcg2 is Julian Date, apportioned in any convenient way
16565**     between the two arguments, for example where tcg1 is the Julian
16566**     Day Number and tcg22 is the fraction of a day.  The returned
16567**     tt1,tt2 follow suit.
16568**
16569**  References:
16570**
16571**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
16572**     IERS Technical Note No. 32, BKG (2004)
16573**
16574**     IAU 2000 Resolution B1.9
16575**
16576*/
16577
16578
16579
16580int iauTdbtcb(double tdb1, double tdb2, double *tcb1, double *tcb2)
16581/*
16582**  - - - - - - - - - -
16583**   i a u T d b t c b
16584**  - - - - - - - - - -
16585**
16586**  Time scale transformation:  Barycentric Dynamical Time, TDB, to
16587**  Barycentric Coordinate Time, TCB.
16588**
16589**  This function is part of the International Astronomical Union's
16590**  SOFA (Standards of Fundamental Astronomy) software collection.
16591**
16592**  Status:  canonical.
16593**
16594**  Given:
16595**     tdb1,tdb2  double    TDB as a 2-part Julian Date
16596**
16597**  Returned:
16598**     tcb1,tcb2  double    TCB as a 2-part Julian Date
16599**
16600**  Returned (function value):
16601**                int       status:  0 = OK
16602**
16603**  Notes:
16604**
16605**  1) tdb1+tdb2 is Julian Date, apportioned in any convenient way
16606**     between the two arguments, for example where tdb1 is the Julian
16607**     Day Number and tdb2 is the fraction of a day.  The returned
16608**     tcb1,tcb2 follow suit.
16609**
16610**  2) The 2006 IAU General Assembly introduced a conventional linear
16611**     transformation between TDB and TCB.  This transformation
16612**     compensates for the drift between TCB and terrestrial time TT,
16613**     and keeps TDB approximately centered on TT.  Because the
16614**     relationship between TT and TCB depends on the adopted solar
16615**     system ephemeris, the degree of alignment between TDB and TT over
16616**     long intervals will vary according to which ephemeris is used.
16617**     Former definitions of TDB attempted to avoid this problem by
16618**     stipulating that TDB and TT should differ only by periodic
16619**     effects.  This is a good description of the nature of the
16620**     relationship but eluded precise mathematical formulation.  The
16621**     conventional linear relationship adopted in 2006 sidestepped
16622**     these difficulties whilst delivering a TDB that in practice was
16623**     consistent with values before that date.
16624**
16625**  3) TDB is essentially the same as Teph, the time argument for the
16626**     JPL solar system ephemerides.
16627**
16628**  Reference:
16629**
16630**     IAU 2006 Resolution B3
16631**
16632*/
16633
16634
16635
16636int iauTdbtt(double tdb1, double tdb2, double dtr,
16637             double *tt1, double *tt2 )
16638/*
16639**  - - - - - - - - -
16640**   i a u T d b t t
16641**  - - - - - - - - -
16642**
16643**  Time scale transformation:  Barycentric Dynamical Time, TDB, to
16644**  Terrestrial Time, TT.
16645**
16646**  This function is part of the International Astronomical Union's
16647**  SOFA (Standards of Fundamental Astronomy) software collection.
16648**
16649**  Status:  canonical.
16650**
16651**  Given:
16652**     tdb1,tdb2  double    TDB as a 2-part Julian Date
16653**     dtr        double    TDB-TT in seconds
16654**
16655**  Returned:
16656**     tt1,tt2    double    TT as a 2-part Julian Date
16657**
16658**  Returned (function value):
16659**                int       status:  0 = OK
16660**
16661**  Notes:
16662**
16663**  1) tdb1+tdb2 is Julian Date, apportioned in any convenient way
16664**     between the two arguments, for example where tdb1 is the Julian
16665**     Day Number and tdb2 is the fraction of a day.  The returned
16666**     tt1,tt2 follow suit.
16667**
16668**  2) The argument dtr represents the quasi-periodic component of the
16669**     GR transformation between TT and TCB.  It is dependent upon the
16670**     adopted solar-system ephemeris, and can be obtained by numerical
16671**     integration, by interrogating a precomputed time ephemeris or by
16672**     evaluating a model such as that implemented in the SOFA function
16673**     iauDtdb.   The quantity is dominated by an annual term of 1.7 ms
16674**     amplitude.
16675**
16676**  3) TDB is essentially the same as Teph, the time argument for the
16677**     JPL solar system ephemerides.
16678**
16679**  References:
16680**
16681**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
16682**     IERS Technical Note No. 32, BKG (2004)
16683**
16684**     IAU 2006 Resolution 3
16685**
16686*/
16687
16688
16689
16690int iauTf2a(char s, int ihour, int imin, double sec, double *rad)
16691/*
16692**  - - - - - - - -
16693**   i a u T f 2 a
16694**  - - - - - - - -
16695**
16696**  Convert hours, minutes, seconds to radians.
16697**
16698**  This function is part of the International Astronomical Union's
16699**  SOFA (Standards of Fundamental Astronomy) software collection.
16700**
16701**  Status:  support function.
16702**
16703**  Given:
16704**     s         char    sign:  '-' = negative, otherwise positive
16705**     ihour     int     hours
16706**     imin      int     minutes
16707**     sec       double  seconds
16708**
16709**  Returned:
16710**     rad       double  angle in radians
16711**
16712**  Returned (function value):
16713**               int     status:  0 = OK
16714**                                1 = ihour outside range 0-23
16715**                                2 = imin outside range 0-59
16716**                                3 = sec outside range 0-59.999...
16717**
16718**  Notes:
16719**
16720**  1)  The result is computed even if any of the range checks fail.
16721**
16722**  2)  Negative ihour, imin and/or sec produce a warning status, but
16723**      the absolute value is used in the conversion.
16724**
16725**  3)  If there are multiple errors, the status value reflects only the
16726**      first, the smallest taking precedence.
16727**
16728*/
16729
16730
16731
16732int iauTf2d(char s, int ihour, int imin, double sec, double *days)
16733/*
16734**  - - - - - - - -
16735**   i a u T f 2 d
16736**  - - - - - - - -
16737**
16738**  Convert hours, minutes, seconds to days.
16739**
16740**  This function is part of the International Astronomical Union's
16741**  SOFA (Standards of Fundamental Astronomy) software collection.
16742**
16743**  Status:  support function.
16744**
16745**  Given:
16746**     s         char    sign:  '-' = negative, otherwise positive
16747**     ihour     int     hours
16748**     imin      int     minutes
16749**     sec       double  seconds
16750**
16751**  Returned:
16752**     days      double  interval in days
16753**
16754**  Returned (function value):
16755**               int     status:  0 = OK
16756**                                1 = ihour outside range 0-23
16757**                                2 = imin outside range 0-59
16758**                                3 = sec outside range 0-59.999...
16759**
16760**  Notes:
16761**
16762**  1)  The result is computed even if any of the range checks fail.
16763**
16764**  2)  Negative ihour, imin and/or sec produce a warning status, but
16765**      the absolute value is used in the conversion.
16766**
16767**  3)  If there are multiple errors, the status value reflects only the
16768**      first, the smallest taking precedence.
16769**
16770*/
16771
16772
16773
16774int iauTpors(double xi, double eta, double a, double b,
16775             double *a01, double *b01, double *a02, double *b02)
16776/*
16777**  - - - - - - - - -
16778**   i a u T p o r s
16779**  - - - - - - - - -
16780**
16781**  In the tangent plane projection, given the rectangular coordinates
16782**  of a star and its spherical coordinates, determine the spherical
16783**  coordinates of the tangent point.
16784**
16785**  This function is part of the International Astronomical Union's
16786**  SOFA (Standards of Fundamental Astronomy) software collection.
16787**
16788**  Status:  support function.
16789**
16790**  Given:
16791**     xi,eta     double  rectangular coordinates of star image (Note 2)
16792**     a,b        double  star's spherical coordinates (Note 3)
16793**
16794**  Returned:
16795**     *a01,*b01  double  tangent point's spherical coordinates, Soln. 1
16796**     *a02,*b02  double  tangent point's spherical coordinates, Soln. 2
16797**
16798**  Returned (function value):
16799**                int     number of solutions:
16800**                        0 = no solutions returned (Note 5)
16801**                        1 = only the first solution is useful (Note 6)
16802**                        2 = both solutions are useful (Note 6)
16803**
16804**  Notes:
16805**
16806**  1) The tangent plane projection is also called the "gnomonic
16807**     projection" and the "central projection".
16808**
16809**  2) The eta axis points due north in the adopted coordinate system.
16810**     If the spherical coordinates are observed (RA,Dec), the tangent
16811**     plane coordinates (xi,eta) are conventionally called the
16812**     "standard coordinates".  If the spherical coordinates are with
16813**     respect to a right-handed triad, (xi,eta) are also right-handed.
16814**     The units of (xi,eta) are, effectively, radians at the tangent
16815**     point.
16816**
16817**  3) All angular arguments are in radians.
16818**
16819**  4) The angles a01 and a02 are returned in the range 0-2pi.  The
16820**     angles b01 and b02 are returned in the range +/-pi, but in the
16821**     usual, non-pole-crossing, case, the range is +/-pi/2.
16822**
16823**  5) Cases where there is no solution can arise only near the poles.
16824**     For example, it is clearly impossible for a star at the pole
16825**     itself to have a non-zero xi value, and hence it is meaningless
16826**     to ask where the tangent point would have to be to bring about
16827**     this combination of xi and dec.
16828**
16829**  6) Also near the poles, cases can arise where there are two useful
16830**     solutions.  The return value indicates whether the second of the
16831**     two solutions returned is useful;  1 indicates only one useful
16832**     solution, the usual case.
16833**
16834**  7) The basis of the algorithm is to solve the spherical triangle PSC,
16835**     where P is the north celestial pole, S is the star and C is the
16836**     tangent point.  The spherical coordinates of the tangent point are
16837**     [a0,b0];  writing rho^2 = (xi^2+eta^2) and r^2 = (1+rho^2), side c
16838**     is then (pi/2-b), side p is sqrt(xi^2+eta^2) and side s (to be
16839**     found) is (pi/2-b0).  Angle C is given by sin(C) = xi/rho and
16840**     cos(C) = eta/rho.  Angle P (to be found) is the longitude
16841**     difference between star and tangent point (a-a0).
16842**
16843**  8) This function is a member of the following set:
16844**
16845**         spherical      vector         solve for
16846**
16847**         iauTpxes      iauTpxev         xi,eta
16848**         iauTpsts      iauTpstv          star
16849**       > iauTpors <    iauTporv         origin
16850**
16851**  Called:
16852**     iauAnp       normalize angle into range 0 to 2pi
16853**
16854**  References:
16855**
16856**     Calabretta M.R. & Greisen, E.W., 2002, "Representations of
16857**     celestial coordinates in FITS", Astron.Astrophys. 395, 1077
16858**
16859**     Green, R.M., "Spherical Astronomy", Cambridge University Press,
16860**     1987, Chapter 13.
16861**
16862*/
16863
16864
16865
16866int iauTporv(double xi, double eta, double v[3],
16867             double v01[3], double v02[3])
16868/*
16869**  - - - - - - - - -
16870**   i a u T p o r v
16871**  - - - - - - - - -
16872**
16873**  In the tangent plane projection, given the rectangular coordinates
16874**  of a star and its direction cosines, determine the direction
16875**  cosines of the tangent point.
16876**
16877**  This function is part of the International Astronomical Union's
16878**  SOFA (Standards of Fundamental Astronomy) software collection.
16879**
16880**  Status:  support function.
16881**
16882**  Given:
16883**     xi,eta   double    rectangular coordinates of star image (Note 2)
16884**     v        double[3] star's direction cosines (Note 3)
16885**
16886**  Returned:
16887**     v01      double[3] tangent point's direction cosines, Solution 1
16888**     v02      double[3] tangent point's direction cosines, Solution 2
16889**
16890**  Returned (function value):
16891**                int     number of solutions:
16892**                        0 = no solutions returned (Note 4)
16893**                        1 = only the first solution is useful (Note 5)
16894**                        2 = both solutions are useful (Note 5)
16895**
16896**  Notes:
16897**
16898**  1) The tangent plane projection is also called the "gnomonic
16899**     projection" and the "central projection".
16900**
16901**  2) The eta axis points due north in the adopted coordinate system.
16902**     If the direction cosines represent observed (RA,Dec), the tangent
16903**     plane coordinates (xi,eta) are conventionally called the
16904**     "standard coordinates".  If the direction cosines are with
16905**     respect to a right-handed triad, (xi,eta) are also right-handed.
16906**     The units of (xi,eta) are, effectively, radians at the tangent
16907**     point.
16908**
16909**  3) The vector v must be of unit length or the result will be wrong.
16910**
16911**  4) Cases where there is no solution can arise only near the poles.
16912**     For example, it is clearly impossible for a star at the pole
16913**     itself to have a non-zero xi value, and hence it is meaningless
16914**     to ask where the tangent point would have to be.
16915**
16916**  5) Also near the poles, cases can arise where there are two useful
16917**     solutions.  The return value indicates whether the second of the
16918**     two solutions returned is useful;  1 indicates only one useful
16919**     solution, the usual case.
16920**
16921**  6) The basis of the algorithm is to solve the spherical triangle
16922**     PSC, where P is the north celestial pole, S is the star and C is
16923**     the tangent point.  Calling the celestial spherical coordinates
16924**     of the star and tangent point (a,b) and (a0,b0) respectively, and
16925**     writing rho^2 = (xi^2+eta^2) and r^2 = (1+rho^2), and
16926**     transforming the vector v into (a,b) in the normal way, side c is
16927**     then (pi/2-b), side p is sqrt(xi^2+eta^2) and side s (to be
16928**     found) is (pi/2-b0), while angle C is given by sin(C) = xi/rho
16929**     and cos(C) = eta/rho;  angle P (to be found) is (a-a0).  After
16930**     solving the spherical triangle, the result (a0,b0) can be
16931**     expressed in vector form as v0.
16932**
16933**  7) This function is a member of the following set:
16934**
16935**         spherical      vector         solve for
16936**
16937**         iauTpxes      iauTpxev         xi,eta
16938**         iauTpsts      iauTpstv          star
16939**         iauTpors    > iauTporv <       origin
16940**
16941**  References:
16942**
16943**     Calabretta M.R. & Greisen, E.W., 2002, "Representations of
16944**     celestial coordinates in FITS", Astron.Astrophys. 395, 1077
16945**
16946**     Green, R.M., "Spherical Astronomy", Cambridge University Press,
16947**     1987, Chapter 13.
16948**
16949*/
16950
16951
16952
16953void iauTpsts(double xi, double eta, double a0, double b0,
16954              double *a, double *b)
16955/*
16956**  - - - - - - - - -
16957**   i a u T p s t s
16958**  - - - - - - - - -
16959**
16960**  In the tangent plane projection, given the star's rectangular
16961**  coordinates and the spherical coordinates of the tangent point,
16962**  solve for the spherical coordinates of the star.
16963**
16964**  This function is part of the International Astronomical Union's
16965**  SOFA (Standards of Fundamental Astronomy) software collection.
16966**
16967**  Status:  support function.
16968**
16969**  Given:
16970**     xi,eta    double  rectangular coordinates of star image (Note 2)
16971**     a0,b0     double  tangent point's spherical coordinates
16972**
16973**  Returned:
16974**     *a,*b     double  star's spherical coordinates
16975**
16976**  1) The tangent plane projection is also called the "gnomonic
16977**     projection" and the "central projection".
16978**
16979**  2) The eta axis points due north in the adopted coordinate system.
16980**     If the spherical coordinates are observed (RA,Dec), the tangent
16981**     plane coordinates (xi,eta) are conventionally called the
16982**     "standard coordinates".  If the spherical coordinates are with
16983**     respect to a right-handed triad, (xi,eta) are also right-handed.
16984**     The units of (xi,eta) are, effectively, radians at the tangent
16985**     point.
16986**
16987**  3) All angular arguments are in radians.
16988**
16989**  4) This function is a member of the following set:
16990**
16991**         spherical      vector         solve for
16992**
16993**         iauTpxes      iauTpxev         xi,eta
16994**       > iauTpsts <    iauTpstv          star
16995**         iauTpors      iauTporv         origin
16996**
16997**  Called:
16998**     iauAnp       normalize angle into range 0 to 2pi
16999**
17000**  References:
17001**
17002**     Calabretta M.R. & Greisen, E.W., 2002, "Representations of
17003**     celestial coordinates in FITS", Astron.Astrophys. 395, 1077
17004**
17005**     Green, R.M., "Spherical Astronomy", Cambridge University Press,
17006**     1987, Chapter 13.
17007**
17008*/
17009
17010
17011
17012void iauTpstv(double xi, double eta, double v0[3], double v[3])
17013/*
17014**  - - - - - - - - -
17015**   i a u T p s t v
17016**  - - - - - - - - -
17017**
17018**  In the tangent plane projection, given the star's rectangular
17019**  coordinates and the direction cosines of the tangent point, solve
17020**  for the direction cosines of the star.
17021**
17022**  This function is part of the International Astronomical Union's
17023**  SOFA (Standards of Fundamental Astronomy) software collection.
17024**
17025**  Status:  support function.
17026**
17027**  Given:
17028**     xi,eta  double     rectangular coordinates of star image (Note 2)
17029**     v0      double[3]  tangent point's direction cosines
17030**
17031**  Returned:
17032**     v       double[3]  star's direction cosines
17033**
17034**  1) The tangent plane projection is also called the "gnomonic
17035**     projection" and the "central projection".
17036**
17037**  2) The eta axis points due north in the adopted coordinate system.
17038**     If the direction cosines represent observed (RA,Dec), the tangent
17039**     plane coordinates (xi,eta) are conventionally called the
17040**     "standard coordinates".  If the direction cosines are with
17041**     respect to a right-handed triad, (xi,eta) are also right-handed.
17042**     The units of (xi,eta) are, effectively, radians at the tangent
17043**     point.
17044**
17045**  3) The method used is to complete the star vector in the (xi,eta)
17046**     based triad and normalize it, then rotate the triad to put the
17047**     tangent point at the pole with the x-axis aligned to zero
17048**     longitude.  Writing (a0,b0) for the celestial spherical
17049**     coordinates of the tangent point, the sequence of rotations is
17050**     (b-pi/2) around the x-axis followed by (-a-pi/2) around the
17051**     z-axis.
17052**
17053**  4) If vector v0 is not of unit length, the returned vector v will
17054**     be wrong.
17055**
17056**  5) If vector v0 points at a pole, the returned vector v will be
17057**     based on the arbitrary assumption that the longitude coordinate
17058**     of the tangent point is zero.
17059**
17060**  6) This function is a member of the following set:
17061**
17062**         spherical      vector         solve for
17063**
17064**         iauTpxes      iauTpxev         xi,eta
17065**         iauTpsts    > iauTpstv <        star
17066**         iauTpors      iauTporv         origin
17067**
17068**  References:
17069**
17070**     Calabretta M.R. & Greisen, E.W., 2002, "Representations of
17071**     celestial coordinates in FITS", Astron.Astrophys. 395, 1077
17072**
17073**     Green, R.M., "Spherical Astronomy", Cambridge University Press,
17074**     1987, Chapter 13.
17075**
17076*/
17077
17078
17079
17080int iauTpxes(double a, double b, double a0, double b0,
17081             double *xi, double *eta)
17082/*
17083**  - - - - - - - - -
17084**   i a u T p x e s
17085**  - - - - - - - - -
17086**
17087**  In the tangent plane projection, given celestial spherical
17088**  coordinates for a star and the tangent point, solve for the star's
17089**  rectangular coordinates in the tangent plane.
17090**
17091**  This function is part of the International Astronomical Union's
17092**  SOFA (Standards of Fundamental Astronomy) software collection.
17093**
17094**  Status:  support function.
17095**
17096**  Given:
17097**     a,b       double  star's spherical coordinates
17098**     a0,b0     double  tangent point's spherical coordinates
17099**
17100**  Returned:
17101**     *xi,*eta  double  rectangular coordinates of star image (Note 2)
17102**
17103**  Returned (function value):
17104**               int     status:  0 = OK
17105**                                1 = star too far from axis
17106**                                2 = antistar on tangent plane
17107**                                3 = antistar too far from axis
17108**
17109**  Notes:
17110**
17111**  1) The tangent plane projection is also called the "gnomonic
17112**     projection" and the "central projection".
17113**
17114**  2) The eta axis points due north in the adopted coordinate system.
17115**     If the spherical coordinates are observed (RA,Dec), the tangent
17116**     plane coordinates (xi,eta) are conventionally called the
17117**     "standard coordinates".  For right-handed spherical coordinates,
17118**     (xi,eta) are also right-handed.  The units of (xi,eta) are,
17119**     effectively, radians at the tangent point.
17120**
17121**  3) All angular arguments are in radians.
17122**
17123**  4) This function is a member of the following set:
17124**
17125**         spherical      vector         solve for
17126**
17127**       > iauTpxes <    iauTpxev         xi,eta
17128**         iauTpsts      iauTpstv          star
17129**         iauTpors      iauTporv         origin
17130**
17131**  References:
17132**
17133**     Calabretta M.R. & Greisen, E.W., 2002, "Representations of
17134**     celestial coordinates in FITS", Astron.Astrophys. 395, 1077
17135**
17136**     Green, R.M., "Spherical Astronomy", Cambridge University Press,
17137**     1987, Chapter 13.
17138**
17139*/
17140
17141
17142
17143int iauTpxev(double v[3], double v0[3], double *xi, double *eta)
17144/*
17145**  - - - - - - - - -
17146**   i a u T p x e v
17147**  - - - - - - - - -
17148**
17149**  In the tangent plane projection, given celestial direction cosines
17150**  for a star and the tangent point, solve for the star's rectangular
17151**  coordinates in the tangent plane.
17152**
17153**  This function is part of the International Astronomical Union's
17154**  SOFA (Standards of Fundamental Astronomy) software collection.
17155**
17156**  Status:  support function.
17157**
17158**  Given:
17159**     v         double[3]  direction cosines of star (Note 4)
17160**     v0        double[3]  direction cosines of tangent point (Note 4)
17161**
17162**  Returned:
17163**     *xi,*eta  double     tangent plane coordinates of star
17164**
17165**  Returned (function value):
17166**               int        status: 0 = OK
17167**                                  1 = star too far from axis
17168**                                  2 = antistar on tangent plane
17169**                                  3 = antistar too far from axis
17170**
17171**  Notes:
17172**
17173**  1) The tangent plane projection is also called the "gnomonic
17174**     projection" and the "central projection".
17175**
17176**  2) The eta axis points due north in the adopted coordinate system.
17177**     If the direction cosines represent observed (RA,Dec), the tangent
17178**     plane coordinates (xi,eta) are conventionally called the
17179**     "standard coordinates".  If the direction cosines are with
17180**     respect to a right-handed triad, (xi,eta) are also right-handed.
17181**     The units of (xi,eta) are, effectively, radians at the tangent
17182**     point.
17183**
17184**  3) The method used is to extend the star vector to the tangent
17185**     plane and then rotate the triad so that (x,y) becomes (xi,eta).
17186**     Writing (a,b) for the celestial spherical coordinates of the
17187**     star, the sequence of rotations is (a+pi/2) around the z-axis
17188**     followed by (pi/2-b) around the x-axis.
17189**
17190**  4) If vector v0 is not of unit length, or if vector v is of zero
17191**     length, the results will be wrong.
17192**
17193**  5) If v0 points at a pole, the returned (xi,eta) will be based on
17194**     the arbitrary assumption that the longitude coordinate of the
17195**     tangent point is zero.
17196**
17197**  6) This function is a member of the following set:
17198**
17199**         spherical      vector         solve for
17200**
17201**         iauTpxes    > iauTpxev <       xi,eta
17202**         iauTpsts      iauTpstv          star
17203**         iauTpors      iauTporv         origin
17204**
17205**  References:
17206**
17207**     Calabretta M.R. & Greisen, E.W., 2002, "Representations of
17208**     celestial coordinates in FITS", Astron.Astrophys. 395, 1077
17209**
17210**     Green, R.M., "Spherical Astronomy", Cambridge University Press,
17211**     1987, Chapter 13.
17212**
17213*/
17214
17215
17216
17217void iauTr(double r[3][3], double rt[3][3])
17218/*
17219**  - - - - - -
17220**   i a u T r
17221**  - - - - - -
17222**
17223**  Transpose an r-matrix.
17224**
17225**  This function is part of the International Astronomical Union's
17226**  SOFA (Standards Of Fundamental Astronomy) software collection.
17227**
17228**  Status:  vector/matrix support function.
17229**
17230**  Given:
17231**     r        double[3][3]    r-matrix
17232**
17233**  Returned:
17234**     rt       double[3][3]    transpose
17235**
17236**  Note:
17237**     It is permissible for r and rt to be the same array.
17238**
17239**  Called:
17240**     iauCr        copy r-matrix
17241**
17242*/
17243
17244
17245
17246void iauTrxp(double r[3][3], double p[3], double trp[3])
17247/*
17248**  - - - - - - - -
17249**   i a u T r x p
17250**  - - - - - - - -
17251**
17252**  Multiply a p-vector by the transpose of an r-matrix.
17253**
17254**  This function is part of the International Astronomical Union's
17255**  SOFA (Standards Of Fundamental Astronomy) software collection.
17256**
17257**  Status:  vector/matrix support function.
17258**
17259**  Given:
17260**     r        double[3][3]   r-matrix
17261**     p        double[3]      p-vector
17262**
17263**  Returned:
17264**     trp      double[3]      r^T * p
17265**
17266**  Note:
17267**     It is permissible for p and trp to be the same array.
17268**
17269**  Called:
17270**     iauTr        transpose r-matrix
17271**     iauRxp       product of r-matrix and p-vector
17272**
17273*/
17274
17275
17276
17277void iauTrxpv(double r[3][3], double pv[2][3], double trpv[2][3])
17278/*
17279**  - - - - - - - - -
17280**   i a u T r x p v
17281**  - - - - - - - - -
17282**
17283**  Multiply a pv-vector by the transpose of an r-matrix.
17284**
17285**  This function is part of the International Astronomical Union's
17286**  SOFA (Standards Of Fundamental Astronomy) software collection.
17287**
17288**  Status:  vector/matrix support function.
17289**
17290**  Given:
17291**     r        double[3][3]    r-matrix
17292**     pv       double[2][3]    pv-vector
17293**
17294**  Returned:
17295**     trpv     double[2][3]    r^T * pv
17296**
17297**  Notes:
17298**
17299**  1) The algorithm is for the simple case where the r-matrix r is not
17300**     a function of time.  The case where r is a function of time leads
17301**     to an additional velocity component equal to the product of the
17302**     derivative of the transpose of r and the position vector.
17303**
17304**  2) It is permissible for pv and rpv to be the same array.
17305**
17306**  Called:
17307**     iauTr        transpose r-matrix
17308**     iauRxpv      product of r-matrix and pv-vector
17309**
17310*/
17311
17312
17313
17314int iauTttai(double tt1, double tt2, double *tai1, double *tai2)
17315/*
17316**  - - - - - - - - -
17317**   i a u T t t a i
17318**  - - - - - - - - -
17319**
17320**  Time scale transformation:  Terrestrial Time, TT, to International
17321**  Atomic Time, TAI.
17322**
17323**  This function is part of the International Astronomical Union's
17324**  SOFA (Standards of Fundamental Astronomy) software collection.
17325**
17326**  Status:  canonical.
17327**
17328**  Given:
17329**     tt1,tt2    double    TT as a 2-part Julian Date
17330**
17331**  Returned:
17332**     tai1,tai2  double    TAI as a 2-part Julian Date
17333**
17334**  Returned (function value):
17335**                int       status:  0 = OK
17336**
17337**  Note:
17338**
17339**     tt1+tt2 is Julian Date, apportioned in any convenient way between
17340**     the two arguments, for example where tt1 is the Julian Day Number
17341**     and tt2 is the fraction of a day.  The returned tai1,tai2 follow
17342**     suit.
17343**
17344**  References:
17345**
17346**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17347**     IERS Technical Note No. 32, BKG (2004)
17348**
17349**     Explanatory Supplement to the Astronomical Almanac,
17350**     P. Kenneth Seidelmann (ed), University Science Books (1992)
17351**
17352*/
17353
17354
17355
17356int iauTttcg(double tt1, double tt2, double *tcg1, double *tcg2)
17357/*
17358**  - - - - - - - - -
17359**   i a u T t t c g
17360**  - - - - - - - - -
17361**
17362**  Time scale transformation:  Terrestrial Time, TT, to Geocentric
17363**  Coordinate Time, TCG.
17364**
17365**  This function is part of the International Astronomical Union's
17366**  SOFA (Standards of Fundamental Astronomy) software collection.
17367**
17368**  Status:  canonical.
17369**
17370**  Given:
17371**     tt1,tt2    double    TT as a 2-part Julian Date
17372**
17373**  Returned:
17374**     tcg1,tcg2  double    TCG as a 2-part Julian Date
17375**
17376**  Returned (function value):
17377**                int       status:  0 = OK
17378**
17379**  Note:
17380**
17381**     tt1+tt2 is Julian Date, apportioned in any convenient way between
17382**     the two arguments, for example where tt1 is the Julian Day Number
17383**     and tt2 is the fraction of a day.  The returned tcg1,tcg2 follow
17384**     suit.
17385**
17386**  References:
17387**
17388**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17389**     IERS Technical Note No. 32, BKG (2004)
17390**
17391**     IAU 2000 Resolution B1.9
17392**
17393*/
17394
17395
17396
17397int iauTttdb(double tt1, double tt2, double dtr,
17398             double *tdb1, double *tdb2)
17399/*
17400**  - - - - - - - - -
17401**   i a u T t t d b
17402**  - - - - - - - - -
17403**
17404**  Time scale transformation:  Terrestrial Time, TT, to Barycentric
17405**  Dynamical Time, TDB.
17406**
17407**  This function is part of the International Astronomical Union's
17408**  SOFA (Standards of Fundamental Astronomy) software collection.
17409**
17410**  Status:  canonical.
17411**
17412**  Given:
17413**     tt1,tt2    double    TT as a 2-part Julian Date
17414**     dtr        double    TDB-TT in seconds
17415**
17416**  Returned:
17417**     tdb1,tdb2  double    TDB as a 2-part Julian Date
17418**
17419**  Returned (function value):
17420**                int       status:  0 = OK
17421**
17422**  Notes:
17423**
17424**  1) tt1+tt2 is Julian Date, apportioned in any convenient way between
17425**     the two arguments, for example where tt1 is the Julian Day Number
17426**     and tt2 is the fraction of a day.  The returned tdb1,tdb2 follow
17427**     suit.
17428**
17429**  2) The argument dtr represents the quasi-periodic component of the
17430**     GR transformation between TT and TCB.  It is dependent upon the
17431**     adopted solar-system ephemeris, and can be obtained by numerical
17432**     integration, by interrogating a precomputed time ephemeris or by
17433**     evaluating a model such as that implemented in the SOFA function
17434**     iauDtdb.   The quantity is dominated by an annual term of 1.7 ms
17435**     amplitude.
17436**
17437**  3) TDB is essentially the same as Teph, the time argument for the JPL
17438**     solar system ephemerides.
17439**
17440**  References:
17441**
17442**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17443**     IERS Technical Note No. 32, BKG (2004)
17444**
17445**     IAU 2006 Resolution 3
17446**
17447*/
17448
17449
17450
17451int iauTtut1(double tt1, double tt2, double dt,
17452             double *ut11, double *ut12)
17453/*
17454**  - - - - - - - - -
17455**   i a u T t u t 1
17456**  - - - - - - - - -
17457**
17458**  Time scale transformation:  Terrestrial Time, TT, to Universal Time,
17459**  UT1.
17460**
17461**  This function is part of the International Astronomical Union's
17462**  SOFA (Standards of Fundamental Astronomy) software collection.
17463**
17464**  Status:  canonical.
17465**
17466**  Given:
17467**     tt1,tt2    double    TT as a 2-part Julian Date
17468**     dt         double    TT-UT1 in seconds
17469**
17470**  Returned:
17471**     ut11,ut12  double    UT1 as a 2-part Julian Date
17472**
17473**  Returned (function value):
17474**                int       status:  0 = OK
17475**
17476**  Notes:
17477**
17478**  1) tt1+tt2 is Julian Date, apportioned in any convenient way between
17479**     the two arguments, for example where tt1 is the Julian Day Number
17480**     and tt2 is the fraction of a day.  The returned ut11,ut12 follow
17481**     suit.
17482**
17483**  2) The argument dt is classical Delta T.
17484**
17485**  Reference:
17486**
17487**     Explanatory Supplement to the Astronomical Almanac,
17488**     P. Kenneth Seidelmann (ed), University Science Books (1992)
17489**
17490*/
17491
17492
17493
17494int iauUt1tai(double ut11, double ut12, double dta,
17495              double *tai1, double *tai2)
17496/*
17497**  - - - - - - - - - -
17498**   i a u U t 1 t a i
17499**  - - - - - - - - - -
17500**
17501**  Time scale transformation:  Universal Time, UT1, to International
17502**  Atomic Time, TAI.
17503**
17504**  This function is part of the International Astronomical Union's
17505**  SOFA (Standards of Fundamental Astronomy) software collection.
17506**
17507**  Status:  canonical.
17508**
17509**  Given:
17510**     ut11,ut12  double    UT1 as a 2-part Julian Date
17511**     dta        double    UT1-TAI in seconds
17512**
17513**  Returned:
17514**     tai1,tai2  double    TAI as a 2-part Julian Date
17515**
17516**  Returned (function value):
17517**                int       status:  0 = OK
17518**
17519**  Notes:
17520**
17521**  1) ut11+ut12 is Julian Date, apportioned in any convenient way
17522**     between the two arguments, for example where ut11 is the Julian
17523**     Day Number and ut12 is the fraction of a day.  The returned
17524**     tai1,tai2 follow suit.
17525**
17526**  2) The argument dta, i.e. UT1-TAI, is an observed quantity, and is
17527**     available from IERS tabulations.
17528**
17529**  Reference:
17530**
17531**     Explanatory Supplement to the Astronomical Almanac,
17532**     P. Kenneth Seidelmann (ed), University Science Books (1992)
17533**
17534*/
17535
17536
17537
17538int iauUt1tt(double ut11, double ut12, double dt,
17539             double *tt1, double *tt2)
17540/*
17541**  - - - - - - - - -
17542**   i a u U t 1 t t
17543**  - - - - - - - - -
17544**
17545**  Time scale transformation:  Universal Time, UT1, to Terrestrial
17546**  Time, TT.
17547**
17548**  This function is part of the International Astronomical Union's
17549**  SOFA (Standards of Fundamental Astronomy) software collection.
17550**
17551**  Status:  canonical.
17552**
17553**  Given:
17554**     ut11,ut12  double    UT1 as a 2-part Julian Date
17555**     dt         double    TT-UT1 in seconds
17556**
17557**  Returned:
17558**     tt1,tt2    double    TT as a 2-part Julian Date
17559**
17560**  Returned (function value):
17561**                int       status:  0 = OK
17562**
17563**  Notes:
17564**
17565**  1) ut11+ut12 is Julian Date, apportioned in any convenient way
17566**     between the two arguments, for example where ut11 is the Julian
17567**     Day Number and ut12 is the fraction of a day.  The returned
17568**     tt1,tt2 follow suit.
17569**
17570**  2) The argument dt is classical Delta T.
17571**
17572**  Reference:
17573**
17574**     Explanatory Supplement to the Astronomical Almanac,
17575**     P. Kenneth Seidelmann (ed), University Science Books (1992)
17576**
17577*/
17578
17579
17580
17581int iauUt1utc(double ut11, double ut12, double dut1,
17582              double *utc1, double *utc2)
17583/*
17584**  - - - - - - - - - -
17585**   i a u U t 1 u t c
17586**  - - - - - - - - - -
17587**
17588**  Time scale transformation:  Universal Time, UT1, to Coordinated
17589**  Universal Time, UTC.
17590**
17591**  This function is part of the International Astronomical Union's
17592**  SOFA (Standards of Fundamental Astronomy) software collection.
17593**
17594**  Status:  canonical.
17595**
17596**  Given:
17597**     ut11,ut12  double   UT1 as a 2-part Julian Date (Note 1)
17598**     dut1       double   Delta UT1: UT1-UTC in seconds (Note 2)
17599**
17600**  Returned:
17601**     utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 3,4)
17602**
17603**  Returned (function value):
17604**                int      status: +1 = dubious year (Note 5)
17605**                                  0 = OK
17606**                                 -1 = unacceptable date
17607**
17608**  Notes:
17609**
17610**  1) ut11+ut12 is Julian Date, apportioned in any convenient way
17611**     between the two arguments, for example where ut11 is the Julian
17612**     Day Number and ut12 is the fraction of a day.  The returned utc1
17613**     and utc2 form an analogous pair, except that a special convention
17614**     is used, to deal with the problem of leap seconds - see Note 3.
17615**
17616**  2) Delta UT1 can be obtained from tabulations provided by the
17617**     International Earth Rotation and Reference Systems Service.  The
17618**     value changes abruptly by 1s at a leap second;  however, close to
17619**     a leap second the algorithm used here is tolerant of the "wrong"
17620**     choice of value being made.
17621**
17622**  3) JD cannot unambiguously represent UTC during a leap second unless
17623**     special measures are taken.  The convention in the present
17624**     function is that the returned quasi-JD UTC1+UTC2 represents UTC
17625**     days whether the length is 86399, 86400 or 86401 SI seconds.
17626**
17627**  4) The function iauD2dtf can be used to transform the UTC quasi-JD
17628**     into calendar date and clock time, including UTC leap second
17629**     handling.
17630**
17631**  5) The warning status "dubious year" flags UTCs that predate the
17632**     introduction of the time scale or that are too far in the future
17633**     to be trusted.  See iauDat for further details.
17634**
17635**  Called:
17636**     iauJd2cal    JD to Gregorian calendar
17637**     iauDat       delta(AT) = TAI-UTC
17638**     iauCal2jd    Gregorian calendar to JD
17639**
17640**  References:
17641**
17642**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17643**     IERS Technical Note No. 32, BKG (2004)
17644**
17645**     Explanatory Supplement to the Astronomical Almanac,
17646**     P. Kenneth Seidelmann (ed), University Science Books (1992)
17647**
17648*/
17649
17650
17651
17652int iauUtctai(double utc1, double utc2, double *tai1, double *tai2)
17653/*
17654**  - - - - - - - - - -
17655**   i a u U t c t a i
17656**  - - - - - - - - - -
17657**
17658**  Time scale transformation:  Coordinated Universal Time, UTC, to
17659**  International Atomic Time, TAI.
17660**
17661**  This function is part of the International Astronomical Union's
17662**  SOFA (Standards of Fundamental Astronomy) software collection.
17663**
17664**  Status:  canonical.
17665**
17666**  Given:
17667**     utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 1-4)
17668**
17669**  Returned:
17670**     tai1,tai2  double   TAI as a 2-part Julian Date (Note 5)
17671**
17672**  Returned (function value):
17673**                int      status: +1 = dubious year (Note 3)
17674**                                  0 = OK
17675**                                 -1 = unacceptable date
17676**
17677**  Notes:
17678**
17679**  1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
17680**     convenient way between the two arguments, for example where utc1
17681**     is the Julian Day Number and utc2 is the fraction of a day.
17682**
17683**  2) JD cannot unambiguously represent UTC during a leap second unless
17684**     special measures are taken.  The convention in the present
17685**     function is that the JD day represents UTC days whether the
17686**     length is 86399, 86400 or 86401 SI seconds.  In the 1960-1972 era
17687**     there were smaller jumps (in either direction) each time the
17688**     linear UTC(TAI) expression was changed, and these "mini-leaps"
17689**     are also included in the SOFA convention.
17690**
17691**  3) The warning status "dubious year" flags UTCs that predate the
17692**     introduction of the time scale or that are too far in the future
17693**     to be trusted.  See iauDat for further details.
17694**
17695**  4) The function iauDtf2d converts from calendar date and time of day
17696**     into 2-part Julian Date, and in the case of UTC implements the
17697**     leap-second-ambiguity convention described above.
17698**
17699**  5) The returned TAI1,TAI2 are such that their sum is the TAI Julian
17700**     Date.
17701**
17702**  Called:
17703**     iauJd2cal    JD to Gregorian calendar
17704**     iauDat       delta(AT) = TAI-UTC
17705**     iauCal2jd    Gregorian calendar to JD
17706**
17707**  References:
17708**
17709**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17710**     IERS Technical Note No. 32, BKG (2004)
17711**
17712**     Explanatory Supplement to the Astronomical Almanac,
17713**     P. Kenneth Seidelmann (ed), University Science Books (1992)
17714**
17715*/
17716
17717
17718
17719int iauUtcut1(double utc1, double utc2, double dut1,
17720              double *ut11, double *ut12)
17721/*
17722**  - - - - - - - - - -
17723**   i a u U t c u t 1
17724**  - - - - - - - - - -
17725**
17726**  Time scale transformation:  Coordinated Universal Time, UTC, to
17727**  Universal Time, UT1.
17728**
17729**  This function is part of the International Astronomical Union's
17730**  SOFA (Standards of Fundamental Astronomy) software collection.
17731**
17732**  Status:  canonical.
17733**
17734**  Given:
17735**     utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 1-4)
17736**     dut1       double   Delta UT1 = UT1-UTC in seconds (Note 5)
17737**
17738**  Returned:
17739**     ut11,ut12  double   UT1 as a 2-part Julian Date (Note 6)
17740**
17741**  Returned (function value):
17742**                int      status: +1 = dubious year (Note 3)
17743**                                  0 = OK
17744**                                 -1 = unacceptable date
17745**
17746**  Notes:
17747**
17748**  1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
17749**     convenient way between the two arguments, for example where utc1
17750**     is the Julian Day Number and utc2 is the fraction of a day.
17751**
17752**  2) JD cannot unambiguously represent UTC during a leap second unless
17753**     special measures are taken.  The convention in the present
17754**     function is that the JD day represents UTC days whether the
17755**     length is 86399, 86400 or 86401 SI seconds.
17756**
17757**  3) The warning status "dubious year" flags UTCs that predate the
17758**     introduction of the time scale or that are too far in the future
17759**     to be trusted.  See iauDat for further details.
17760**
17761**  4) The function iauDtf2d converts from calendar date and time of
17762**     day into 2-part Julian Date, and in the case of UTC implements
17763**     the leap-second-ambiguity convention described above.
17764**
17765**  5) Delta UT1 can be obtained from tabulations provided by the
17766**     International Earth Rotation and Reference Systems Service.
17767**     It is the caller's responsibility to supply a dut1 argument
17768**     containing the UT1-UTC value that matches the given UTC.
17769**
17770**  6) The returned ut11,ut12 are such that their sum is the UT1 Julian
17771**     Date.
17772**
17773**  References:
17774**
17775**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17776**     IERS Technical Note No. 32, BKG (2004)
17777**
17778**     Explanatory Supplement to the Astronomical Almanac,
17779**     P. Kenneth Seidelmann (ed), University Science Books (1992)
17780**
17781**  Called:
17782**     iauJd2cal    JD to Gregorian calendar
17783**     iauDat       delta(AT) = TAI-UTC
17784**     iauUtctai    UTC to TAI
17785**     iauTaiut1    TAI to UT1
17786**
17787*/
17788
17789
17790
17791void iauXy06(double date1, double date2, double *x, double *y)
17792/*
17793**  - - - - - - - -
17794**   i a u X y 0 6
17795**  - - - - - - - -
17796**
17797**  X,Y coordinates of celestial intermediate pole from series based
17798**  on IAU 2006 precession and IAU 2000A nutation.
17799**
17800**  This function is part of the International Astronomical Union's
17801**  SOFA (Standards Of Fundamental Astronomy) software collection.
17802**
17803**  Status:  canonical model.
17804**
17805**  Given:
17806**     date1,date2  double     TT as a 2-part Julian Date (Note 1)
17807**
17808**  Returned:
17809**     x,y          double     CIP X,Y coordinates (Note 2)
17810**
17811**  Notes:
17812**
17813**  1) The TT date date1+date2 is a Julian Date, apportioned in any
17814**     convenient way between the two arguments.  For example,
17815**     JD(TT)=2450123.7 could be expressed in any of these ways,
17816**     among others:
17817**
17818**            date1          date2
17819**
17820**         2450123.7           0.0       (JD method)
17821**         2451545.0       -1421.3       (J2000 method)
17822**         2400000.5       50123.2       (MJD method)
17823**         2450123.5           0.2       (date & time method)
17824**
17825**     The JD method is the most natural and convenient to use in
17826**     cases where the loss of several decimal digits of resolution
17827**     is acceptable.  The J2000 method is best matched to the way
17828**     the argument is handled internally and will deliver the
17829**     optimum resolution.  The MJD method and the date & time methods
17830**     are both good compromises between resolution and convenience.
17831**
17832**  2) The X,Y coordinates are those of the unit vector towards the
17833**     celestial intermediate pole.  They represent the combined effects
17834**     of frame bias, precession and nutation.
17835**
17836**  3) The fundamental arguments used are as adopted in IERS Conventions
17837**     (2003) and are from Simon et al. (1994) and Souchay et al.
17838**     (1999).
17839**
17840**  4) This is an alternative to the angles-based method, via the SOFA
17841**     function iauFw2xy and as used in iauXys06a for example.  The two
17842**     methods agree at the 1 microarcsecond level (at present), a
17843**     negligible amount compared with the intrinsic accuracy of the
17844**     models.  However, it would be unwise to mix the two methods
17845**     (angles-based and series-based) in a single application.
17846**
17847**  Called:
17848**     iauFal03     mean anomaly of the Moon
17849**     iauFalp03    mean anomaly of the Sun
17850**     iauFaf03     mean argument of the latitude of the Moon
17851**     iauFad03     mean elongation of the Moon from the Sun
17852**     iauFaom03    mean longitude of the Moon's ascending node
17853**     iauFame03    mean longitude of Mercury
17854**     iauFave03    mean longitude of Venus
17855**     iauFae03     mean longitude of Earth
17856**     iauFama03    mean longitude of Mars
17857**     iauFaju03    mean longitude of Jupiter
17858**     iauFasa03    mean longitude of Saturn
17859**     iauFaur03    mean longitude of Uranus
17860**     iauFane03    mean longitude of Neptune
17861**     iauFapa03    general accumulated precession in longitude
17862**
17863**  References:
17864**
17865**     Capitaine, N., Wallace, P.T. & Chapront, J., 2003,
17866**     Astron.Astrophys., 412, 567
17867**
17868**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
17869**
17870**     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
17871**     IERS Technical Note No. 32, BKG
17872**
17873**     Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
17874**     Francou, G. & Laskar, J., Astron.Astrophys., 1994, 282, 663
17875**
17876**     Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M., 1999,
17877**     Astron.Astrophys.Supp.Ser. 135, 111
17878**
17879**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
17880**
17881*/
17882
17883
17884
17885void iauXys00a(double date1, double date2,
17886               double *x, double *y, double *s)
17887/*
17888**  - - - - - - - - - -
17889**   i a u X y s 0 0 a
17890**  - - - - - - - - - -
17891**
17892**  For a given TT date, compute the X,Y coordinates of the Celestial
17893**  Intermediate Pole and the CIO locator s, using the IAU 2000A
17894**  precession-nutation model.
17895**
17896**  This function is part of the International Astronomical Union's
17897**  SOFA (Standards Of Fundamental Astronomy) software collection.
17898**
17899**  Status:  support function.
17900**
17901**  Given:
17902**     date1,date2  double   TT as a 2-part Julian Date (Note 1)
17903**
17904**  Returned:
17905**     x,y          double   Celestial Intermediate Pole (Note 2)
17906**     s            double   the CIO locator s (Note 3)
17907**
17908**  Notes:
17909**
17910**  1) The TT date date1+date2 is a Julian Date, apportioned in any
17911**     convenient way between the two arguments.  For example,
17912**     JD(TT)=2450123.7 could be expressed in any of these ways,
17913**     among others:
17914**
17915**            date1          date2
17916**
17917**         2450123.7           0.0       (JD method)
17918**         2451545.0       -1421.3       (J2000 method)
17919**         2400000.5       50123.2       (MJD method)
17920**         2450123.5           0.2       (date & time method)
17921**
17922**     The JD method is the most natural and convenient to use in
17923**     cases where the loss of several decimal digits of resolution
17924**     is acceptable.  The J2000 method is best matched to the way
17925**     the argument is handled internally and will deliver the
17926**     optimum resolution.  The MJD method and the date & time methods
17927**     are both good compromises between resolution and convenience.
17928**
17929**  2) The Celestial Intermediate Pole coordinates are the x,y
17930**     components of the unit vector in the Geocentric Celestial
17931**     Reference System.
17932**
17933**  3) The CIO locator s (in radians) positions the Celestial
17934**     Intermediate Origin on the equator of the CIP.
17935**
17936**  4) A faster, but slightly less accurate result (about 1 mas for
17937**     X,Y), can be obtained by using instead the iauXys00b function.
17938**
17939**  Called:
17940**     iauPnm00a    classical NPB matrix, IAU 2000A
17941**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
17942**     iauS00       the CIO locator s, given X,Y, IAU 2000A
17943**
17944**  Reference:
17945**
17946**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17947**     IERS Technical Note No. 32, BKG (2004)
17948**
17949*/
17950
17951
17952
17953void iauXys00b(double date1, double date2,
17954               double *x, double *y, double *s)
17955/*
17956**  - - - - - - - - - -
17957**   i a u X y s 0 0 b
17958**  - - - - - - - - - -
17959**
17960**  For a given TT date, compute the X,Y coordinates of the Celestial
17961**  Intermediate Pole and the CIO locator s, using the IAU 2000B
17962**  precession-nutation model.
17963**
17964**  This function is part of the International Astronomical Union's
17965**  SOFA (Standards Of Fundamental Astronomy) software collection.
17966**
17967**  Status:  support function.
17968**
17969**  Given:
17970**     date1,date2  double   TT as a 2-part Julian Date (Note 1)
17971**
17972**  Returned:
17973**     x,y          double   Celestial Intermediate Pole (Note 2)
17974**     s            double   the CIO locator s (Note 3)
17975**
17976**  Notes:
17977**
17978**  1) The TT date date1+date2 is a Julian Date, apportioned in any
17979**     convenient way between the two arguments.  For example,
17980**     JD(TT)=2450123.7 could be expressed in any of these ways,
17981**     among others:
17982**
17983**            date1          date2
17984**
17985**         2450123.7           0.0       (JD method)
17986**         2451545.0       -1421.3       (J2000 method)
17987**         2400000.5       50123.2       (MJD method)
17988**         2450123.5           0.2       (date & time method)
17989**
17990**     The JD method is the most natural and convenient to use in
17991**     cases where the loss of several decimal digits of resolution
17992**     is acceptable.  The J2000 method is best matched to the way
17993**     the argument is handled internally and will deliver the
17994**     optimum resolution.  The MJD method and the date & time methods
17995**     are both good compromises between resolution and convenience.
17996**
17997**  2) The Celestial Intermediate Pole coordinates are the x,y
17998**     components of the unit vector in the Geocentric Celestial
17999**     Reference System.
18000**
18001**  3) The CIO locator s (in radians) positions the Celestial
18002**     Intermediate Origin on the equator of the CIP.
18003**
18004**  4) The present function is faster, but slightly less accurate (about
18005**     1 mas in X,Y), than the iauXys00a function.
18006**
18007**  Called:
18008**     iauPnm00b    classical NPB matrix, IAU 2000B
18009**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
18010**     iauS00       the CIO locator s, given X,Y, IAU 2000A
18011**
18012**  Reference:
18013**
18014**     McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
18015**     IERS Technical Note No. 32, BKG (2004)
18016**
18017*/
18018
18019
18020
18021void iauXys06a(double date1, double date2,
18022               double *x, double *y, double *s)
18023/*
18024**  - - - - - - - - - -
18025**   i a u X y s 0 6 a
18026**  - - - - - - - - - -
18027**
18028**  For a given TT date, compute the X,Y coordinates of the Celestial
18029**  Intermediate Pole and the CIO locator s, using the IAU 2006
18030**  precession and IAU 2000A nutation models.
18031**
18032**  This function is part of the International Astronomical Union's
18033**  SOFA (Standards Of Fundamental Astronomy) software collection.
18034**
18035**  Status:  support function.
18036**
18037**  Given:
18038**     date1,date2  double  TT as a 2-part Julian Date (Note 1)
18039**
18040**  Returned:
18041**     x,y          double  Celestial Intermediate Pole (Note 2)
18042**     s            double  the CIO locator s (Note 3)
18043**
18044**  Notes:
18045**
18046**  1) The TT date date1+date2 is a Julian Date, apportioned in any
18047**     convenient way between the two arguments.  For example,
18048**     JD(TT)=2450123.7 could be expressed in any of these ways,
18049**     among others:
18050**
18051**            date1          date2
18052**
18053**         2450123.7           0.0       (JD method)
18054**         2451545.0       -1421.3       (J2000 method)
18055**         2400000.5       50123.2       (MJD method)
18056**         2450123.5           0.2       (date & time method)
18057**
18058**     The JD method is the most natural and convenient to use in
18059**     cases where the loss of several decimal digits of resolution
18060**     is acceptable.  The J2000 method is best matched to the way
18061**     the argument is handled internally and will deliver the
18062**     optimum resolution.  The MJD method and the date & time methods
18063**     are both good compromises between resolution and convenience.
18064**
18065**  2) The Celestial Intermediate Pole coordinates are the x,y components
18066**     of the unit vector in the Geocentric Celestial Reference System.
18067**
18068**  3) The CIO locator s (in radians) positions the Celestial
18069**     Intermediate Origin on the equator of the CIP.
18070**
18071**  4) Series-based solutions for generating X and Y are also available:
18072**     see Capitaine & Wallace (2006) and iauXy06.
18073**
18074**  Called:
18075**     iauPnm06a    classical NPB matrix, IAU 2006/2000A
18076**     iauBpn2xy    extract CIP X,Y coordinates from NPB matrix
18077**     iauS06       the CIO locator s, given X,Y, IAU 2006
18078**
18079**  References:
18080**
18081**     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
18082**
18083**     Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
18084**
18085*/
18086
18087
18088
18089void iauZp(double p[3])
18090/*
18091**  - - - - - -
18092**   i a u Z p
18093**  - - - - - -
18094**
18095**  Zero a p-vector.
18096**
18097**  This function is part of the International Astronomical Union's
18098**  SOFA (Standards Of Fundamental Astronomy) software collection.
18099**
18100**  Status:  vector/matrix support function.
18101**
18102**  Returned:
18103**     p        double[3]      zero p-vector
18104**
18105*/
18106
18107
18108
18109void iauZpv(double pv[2][3])
18110/*
18111**  - - - - - - -
18112**   i a u Z p v
18113**  - - - - - - -
18114**
18115**  Zero a pv-vector.
18116**
18117**  This function is part of the International Astronomical Union's
18118**  SOFA (Standards Of Fundamental Astronomy) software collection.
18119**
18120**  Status:  vector/matrix support function.
18121**
18122**  Returned:
18123**     pv       double[2][3]      zero pv-vector
18124**
18125**  Called:
18126**     iauZp        zero p-vector
18127**
18128*/
18129
18130
18131
18132void iauZr(double r[3][3])
18133/*
18134**  - - - - - -
18135**   i a u Z r
18136**  - - - - - -
18137**
18138**  Initialize an r-matrix to the null matrix.
18139**
18140**  This function is part of the International Astronomical Union's
18141**  SOFA (Standards Of Fundamental Astronomy) software collection.
18142**
18143**  Status:  vector/matrix support function.
18144**
18145**  Returned:
18146**     r        double[3][3]    r-matrix
18147**
18148*/
18149
18150copyr.lis                                                    2021 April 12
18151
18152
18153COPYRIGHT NOTICE
18154
18155Text equivalent to that below appears at the end of every SOFA routine
18156(with one exception).  There are small formatting differences between
18157the Fortran and C versions.
18158
18159The one exception is the "leap second" routine DAT.  This uniquely is
18160classified as "user replaceable", and has a mitigated license statement
18161that permits the distribution of local variants under the same name.
18162This measure allows other SOFA routines to call the local variant, which
18163may be file or network based, or otherwise equipped to pick up IERS leap
18164second updates with no need to download new SOFA code.
18165
18166*+----------------------------------------------------------------------
18167*
18168*  Copyright (C) 2021
18169*  Standards Of Fundamental Astronomy Board
18170*  of the International Astronomical Union.
18171*
18172*  =====================
18173*  SOFA Software License
18174*  =====================
18175*
18176*  NOTICE TO USER:
18177*
18178*  BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
18179*  CONDITIONS WHICH APPLY TO ITS USE.
18180*
18181*  1. The Software is owned by the IAU SOFA Board ("SOFA").
18182*
18183*  2. Permission is granted to anyone to use the SOFA software for any
18184*     purpose, including commercial applications, free of charge and
18185*     without payment of royalties, subject to the conditions and
18186*     restrictions listed below.
18187*
18188*  3. You (the user) may copy and distribute SOFA source code to others,
18189*     and use and adapt its code and algorithms in your own software,
18190*     on a world-wide, royalty-free basis.  That portion of your
18191*     distribution that does not consist of intact and unchanged copies
18192*     of SOFA source code files is a "derived work" that must comply
18193*     with the following requirements:
18194*
18195*     a) Your work shall be marked or carry a statement that it
18196*        (i) uses routines and computations derived by you from
18197*        software provided by SOFA under license to you; and
18198*        (ii) does not itself constitute software provided by and/or
18199*        endorsed by SOFA.
18200*
18201*     b) The source code of your derived work must contain descriptions
18202*        of how the derived work is based upon, contains and/or differs
18203*        from the original SOFA software.
18204*
18205*     c) The names of all routines in your derived work shall not
18206*        include the prefix "iau" or "sofa" or trivial modifications
18207*        thereof such as changes of case.
18208*
18209*     d) The origin of the SOFA components of your derived work must
18210*        not be misrepresented;  you must not claim that you wrote the
18211*        original software, nor file a patent application for SOFA
18212*        software or algorithms embedded in the SOFA software.
18213*
18214*     e) These requirements must be reproduced intact in any source
18215*        distribution and shall apply to anyone to whom you have
18216*        granted a further right to modify the source code of your
18217*        derived work.
18218*
18219*     Note that, as originally distributed, the SOFA software is
18220*     intended to be a definitive implementation of the IAU standards,
18221*     and consequently third-party modifications are discouraged.  All
18222*     variations, no matter how minor, must be explicitly marked as
18223*     such, as explained above.
18224*
18225*  4. You shall not cause the SOFA software to be brought into
18226*     disrepute, either by misuse, or use for inappropriate tasks, or
18227*     by inappropriate modification.
18228*
18229*  5. The SOFA software is provided "as is" and SOFA makes no warranty
18230*     as to its use or performance.   SOFA does not and cannot warrant
18231*     the performance or results which the user may obtain by using the
18232*     SOFA software.  SOFA makes no warranties, express or implied, as
18233*     to non-infringement of third party rights, merchantability, or
18234*     fitness for any particular purpose.  In no event will SOFA be
18235*     liable to the user for any consequential, incidental, or special
18236*     damages, including any lost profits or lost savings, even if a
18237*     SOFA representative has been advised of such damages, or for any
18238*     claim by any third party.
18239*
18240*  6. The provision of any version of the SOFA software under the terms
18241*     and conditions specified herein does not imply that future
18242*     versions will also be made available under the same terms and
18243*     conditions.
18244*
18245*  In any published work or commercial product which uses the SOFA
18246*  software directly, acknowledgement (see www.iausofa.org) is
18247*  appreciated.
18248*
18249*  Correspondence concerning SOFA software should be addressed as
18250*  follows:
18251*
18252*      By email:  sofa@ukho.gov.uk
18253*      By post:   IAU SOFA Center
18254*                 HM Nautical Almanac Office
18255*                 UK Hydrographic Office
18256*                 Admiralty Way, Taunton
18257*                 Somerset, TA1 2DN
18258*                 United Kingdom
18259*
18260*-----------------------------------------------------------------------
18261
18262consts.lis                                             2008 September 30
18263
18264
18265SOFA Fortran constants
18266----------------------
18267
18268These must be used exactly as presented below.
18269
18270*  Pi
18271      DOUBLE PRECISION DPI
18272      PARAMETER ( DPI = 3.141592653589793238462643D0 )
18273
18274*  2Pi
18275      DOUBLE PRECISION D2PI
18276      PARAMETER ( D2PI = 6.283185307179586476925287D0 )
18277
18278*  Radians to hours
18279      DOUBLE PRECISION DR2H
18280      PARAMETER ( DR2H = 3.819718634205488058453210D0 )
18281
18282*  Radians to seconds
18283      DOUBLE PRECISION DR2S
18284      PARAMETER ( DR2S = 13750.98708313975701043156D0 )
18285
18286*  Radians to degrees
18287      DOUBLE PRECISION DR2D
18288      PARAMETER ( DR2D = 57.29577951308232087679815D0 )
18289
18290*  Radians to arc seconds
18291      DOUBLE PRECISION DR2AS
18292      PARAMETER ( DR2AS = 206264.8062470963551564734D0 )
18293
18294*  Hours to radians
18295      DOUBLE PRECISION DH2R
18296      PARAMETER ( DH2R = 0.2617993877991494365385536D0 )
18297
18298*  Seconds to radians
18299      DOUBLE PRECISION DS2R
18300      PARAMETER ( DS2R = 7.272205216643039903848712D-5 )
18301
18302*  Degrees to radians
18303      DOUBLE PRECISION DD2R
18304      PARAMETER ( DD2R = 1.745329251994329576923691D-2 )
18305
18306*  Arc seconds to radians
18307      DOUBLE PRECISION DAS2R
18308      PARAMETER ( DAS2R = 4.848136811095359935899141D-6 )
18309
18310
18311SOFA C constants
18312----------------
18313
18314The constants used by the C version of SOFA are defined in the header
18315file sofam.h.
18316
18317#ifndef SOFAHDEF
18318#define SOFAHDEF
18319
18320/*
18321**  - - - - - - -
18322**   s o f a . h
18323**  - - - - - - -
18324**
18325**  Prototype function declarations for SOFA library.
18326**
18327**  This file is part of the International Astronomical Union's
18328**  SOFA (Standards Of Fundamental Astronomy) software collection.
18329**
18330**  This revision:   2021 April 18
18331**
18332**  SOFA release 2021-05-12
18333**
18334**  Copyright (C) 2021 IAU SOFA Board.  See notes at end.
18335*/
18336
18337#include "math.h"
18338
18339#ifdef __cplusplus
18340extern "C" {
18341#endif
18342
18343/* Star-independent astrometry parameters */
18344typedef struct {
18345   double pmt;        /* PM time interval (SSB, Julian years) */
18346   double eb[3];      /* SSB to observer (vector, au) */
18347   double eh[3];      /* Sun to observer (unit vector) */
18348   double em;         /* distance from Sun to observer (au) */
18349   double v[3];       /* barycentric observer velocity (vector, c) */
18350   double bm1;        /* sqrt(1-|v|^2): reciprocal of Lorenz factor */
18351   double bpn[3][3];  /* bias-precession-nutation matrix */
18352   double along;      /* longitude + s' + dERA(DUT) (radians) */
18353   double phi;        /* geodetic latitude (radians) */
18354   double xpl;        /* polar motion xp wrt local meridian (radians) */
18355   double ypl;        /* polar motion yp wrt local meridian (radians) */
18356   double sphi;       /* sine of geodetic latitude */
18357   double cphi;       /* cosine of geodetic latitude */
18358   double diurab;     /* magnitude of diurnal aberration vector */
18359   double eral;       /* "local" Earth rotation angle (radians) */
18360   double refa;       /* refraction constant A (radians) */
18361   double refb;       /* refraction constant B (radians) */
18362} iauASTROM;
18363/* (Vectors eb, eh, em and v are all with respect to BCRS axes.) */
18364
18365/* Body parameters for light deflection */
18366typedef struct {
18367   double bm;         /* mass of the body (solar masses) */
18368   double dl;         /* deflection limiter (radians^2/2) */
18369   double pv[2][3];   /* barycentric PV of the body (au, au/day) */
18370} iauLDBODY;
18371
18372/* Astronomy/Calendars */
18373int iauCal2jd(int iy, int im, int id, double *djm0, double *djm);
18374double iauEpb(double dj1, double dj2);
18375void iauEpb2jd(double epb, double *djm0, double *djm);
18376double iauEpj(double dj1, double dj2);
18377void iauEpj2jd(double epj, double *djm0, double *djm);
18378int iauJd2cal(double dj1, double dj2,
18379                     int *iy, int *im, int *id, double *fd);
18380int iauJdcalf(int ndp, double dj1, double dj2, int iymdf[4]);
18381
18382/* Astronomy/Astrometry */
18383void iauAb(double pnat[3], double v[3], double s, double bm1,
18384           double ppr[3]);
18385void iauApcg(double date1, double date2,
18386             double ebpv[2][3], double ehp[3],
18387             iauASTROM *astrom);
18388void iauApcg13(double date1, double date2, iauASTROM *astrom);
18389void iauApci(double date1, double date2,
18390             double ebpv[2][3], double ehp[3],
18391             double x, double y, double s,
18392             iauASTROM *astrom);
18393void iauApci13(double date1, double date2,
18394               iauASTROM *astrom, double *eo);
18395void iauApco(double date1, double date2,
18396             double ebpv[2][3], double ehp[3],
18397             double x, double y, double s, double theta,
18398             double elong, double phi, double hm,
18399             double xp, double yp, double sp,
18400             double refa, double refb,
18401             iauASTROM *astrom);
18402int iauApco13(double utc1, double utc2, double dut1,
18403              double elong, double phi, double hm, double xp, double yp,
18404              double phpa, double tc, double rh, double wl,
18405              iauASTROM *astrom, double *eo);
18406void iauApcs(double date1, double date2, double pv[2][3],
18407             double ebpv[2][3], double ehp[3],
18408             iauASTROM *astrom);
18409void iauApcs13(double date1, double date2, double pv[2][3],
18410               iauASTROM *astrom);
18411void iauAper(double theta, iauASTROM *astrom);
18412void iauAper13(double ut11, double ut12, iauASTROM *astrom);
18413void iauApio(double sp, double theta,
18414             double elong, double phi, double hm, double xp, double yp,
18415             double refa, double refb,
18416             iauASTROM *astrom);
18417int iauApio13(double utc1, double utc2, double dut1,
18418              double elong, double phi, double hm, double xp, double yp,
18419              double phpa, double tc, double rh, double wl,
18420              iauASTROM *astrom);
18421void iauAtcc13(double rc, double dc,
18422               double pr, double pd, double px, double rv,
18423               double date1, double date2,
18424               double *ra, double *da);
18425void iauAtccq(double rc, double dc,
18426              double pr, double pd, double px, double rv,
18427              iauASTROM *astrom, double *ra, double *da);
18428void iauAtci13(double rc, double dc,
18429               double pr, double pd, double px, double rv,
18430               double date1, double date2,
18431               double *ri, double *di, double *eo);
18432void iauAtciq(double rc, double dc, double pr, double pd,
18433              double px, double rv, iauASTROM *astrom,
18434              double *ri, double *di);
18435void iauAtciqn(double rc, double dc, double pr, double pd,
18436               double px, double rv, iauASTROM *astrom,
18437               int n, iauLDBODY b[], double *ri, double *di);
18438void iauAtciqz(double rc, double dc, iauASTROM *astrom,
18439               double *ri, double *di);
18440int iauAtco13(double rc, double dc,
18441              double pr, double pd, double px, double rv,
18442              double utc1, double utc2, double dut1,
18443              double elong, double phi, double hm, double xp, double yp,
18444              double phpa, double tc, double rh, double wl,
18445              double *aob, double *zob, double *hob,
18446              double *dob, double *rob, double *eo);
18447void iauAtic13(double ri, double di,
18448               double date1, double date2,
18449               double *rc, double *dc, double *eo);
18450void iauAticq(double ri, double di, iauASTROM *astrom,
18451              double *rc, double *dc);
18452void iauAticqn(double ri, double di, iauASTROM *astrom,
18453               int n, iauLDBODY b[], double *rc, double *dc);
18454int iauAtio13(double ri, double di,
18455              double utc1, double utc2, double dut1,
18456              double elong, double phi, double hm, double xp, double yp,
18457              double phpa, double tc, double rh, double wl,
18458              double *aob, double *zob, double *hob,
18459              double *dob, double *rob);
18460void iauAtioq(double ri, double di, iauASTROM *astrom,
18461              double *aob, double *zob,
18462              double *hob, double *dob, double *rob);
18463int iauAtoc13(const char *type, double ob1, double ob2,
18464              double utc1, double utc2, double dut1,
18465              double elong, double phi, double hm, double xp, double yp,
18466              double phpa, double tc, double rh, double wl,
18467              double *rc, double *dc);
18468int iauAtoi13(const char *type, double ob1, double ob2,
18469              double utc1, double utc2, double dut1,
18470              double elong, double phi, double hm, double xp, double yp,
18471              double phpa, double tc, double rh, double wl,
18472              double *ri, double *di);
18473void iauAtoiq(const char *type,
18474              double ob1, double ob2, iauASTROM *astrom,
18475              double *ri, double *di);
18476void iauLd(double bm, double p[3], double q[3], double e[3],
18477           double em, double dlim, double p1[3]);
18478void iauLdn(int n, iauLDBODY b[], double ob[3], double sc[3],
18479            double sn[3]);
18480void iauLdsun(double p[3], double e[3], double em, double p1[3]);
18481void iauPmpx(double rc, double dc, double pr, double pd,
18482             double px, double rv, double pmt, double pob[3],
18483             double pco[3]);
18484int iauPmsafe(double ra1, double dec1, double pmr1, double pmd1,
18485              double px1, double rv1,
18486              double ep1a, double ep1b, double ep2a, double ep2b,
18487              double *ra2, double *dec2, double *pmr2, double *pmd2,
18488              double *px2, double *rv2);
18489void iauPvtob(double elong, double phi, double height, double xp,
18490              double yp, double sp, double theta, double pv[2][3]);
18491void iauRefco(double phpa, double tc, double rh, double wl,
18492              double *refa, double *refb);
18493
18494/* Astronomy/Ephemerides */
18495int iauEpv00(double date1, double date2,
18496             double pvh[2][3], double pvb[2][3]);
18497void iauMoon98(double date1, double date2, double pv[2][3]);
18498int iauPlan94(double date1, double date2, int np, double pv[2][3]);
18499
18500/* Astronomy/FundamentalArgs */
18501double iauFad03(double t);
18502double iauFae03(double t);
18503double iauFaf03(double t);
18504double iauFaju03(double t);
18505double iauFal03(double t);
18506double iauFalp03(double t);
18507double iauFama03(double t);
18508double iauFame03(double t);
18509double iauFane03(double t);
18510double iauFaom03(double t);
18511double iauFapa03(double t);
18512double iauFasa03(double t);
18513double iauFaur03(double t);
18514double iauFave03(double t);
18515
18516/* Astronomy/PrecNutPolar */
18517void iauBi00(double *dpsibi, double *depsbi, double *dra);
18518void iauBp00(double date1, double date2,
18519             double rb[3][3], double rp[3][3], double rbp[3][3]);
18520void iauBp06(double date1, double date2,
18521             double rb[3][3], double rp[3][3], double rbp[3][3]);
18522void iauBpn2xy(double rbpn[3][3], double *x, double *y);
18523void iauC2i00a(double date1, double date2, double rc2i[3][3]);
18524void iauC2i00b(double date1, double date2, double rc2i[3][3]);
18525void iauC2i06a(double date1, double date2, double rc2i[3][3]);
18526void iauC2ibpn(double date1, double date2, double rbpn[3][3],
18527               double rc2i[3][3]);
18528void iauC2ixy(double date1, double date2, double x, double y,
18529              double rc2i[3][3]);
18530void iauC2ixys(double x, double y, double s, double rc2i[3][3]);
18531void iauC2t00a(double tta, double ttb, double uta, double utb,
18532               double xp, double yp, double rc2t[3][3]);
18533void iauC2t00b(double tta, double ttb, double uta, double utb,
18534               double xp, double yp, double rc2t[3][3]);
18535void iauC2t06a(double tta, double ttb, double uta, double utb,
18536               double xp, double yp, double rc2t[3][3]);
18537void iauC2tcio(double rc2i[3][3], double era, double rpom[3][3],
18538               double rc2t[3][3]);
18539void iauC2teqx(double rbpn[3][3], double gst, double rpom[3][3],
18540               double rc2t[3][3]);
18541void iauC2tpe(double tta, double ttb, double uta, double utb,
18542              double dpsi, double deps, double xp, double yp,
18543              double rc2t[3][3]);
18544void iauC2txy(double tta, double ttb, double uta, double utb,
18545              double x, double y, double xp, double yp,
18546              double rc2t[3][3]);
18547double iauEo06a(double date1, double date2);
18548double iauEors(double rnpb[3][3], double s);
18549void iauFw2m(double gamb, double phib, double psi, double eps,
18550             double r[3][3]);
18551void iauFw2xy(double gamb, double phib, double psi, double eps,
18552              double *x, double *y);
18553void iauLtp(double epj, double rp[3][3]);
18554void iauLtpb(double epj, double rpb[3][3]);
18555void iauLtpecl(double epj, double vec[3]);
18556void iauLtpequ(double epj, double veq[3]);
18557void iauNum00a(double date1, double date2, double rmatn[3][3]);
18558void iauNum00b(double date1, double date2, double rmatn[3][3]);
18559void iauNum06a(double date1, double date2, double rmatn[3][3]);
18560void iauNumat(double epsa, double dpsi, double deps, double rmatn[3][3]);
18561void iauNut00a(double date1, double date2, double *dpsi, double *deps);
18562void iauNut00b(double date1, double date2, double *dpsi, double *deps);
18563void iauNut06a(double date1, double date2, double *dpsi, double *deps);
18564void iauNut80(double date1, double date2, double *dpsi, double *deps);
18565void iauNutm80(double date1, double date2, double rmatn[3][3]);
18566double iauObl06(double date1, double date2);
18567double iauObl80(double date1, double date2);
18568void iauP06e(double date1, double date2,
18569             double *eps0, double *psia, double *oma, double *bpa,
18570             double *bqa, double *pia, double *bpia,
18571             double *epsa, double *chia, double *za, double *zetaa,
18572             double *thetaa, double *pa,
18573             double *gam, double *phi, double *psi);
18574void iauPb06(double date1, double date2,
18575             double *bzeta, double *bz, double *btheta);
18576void iauPfw06(double date1, double date2,
18577              double *gamb, double *phib, double *psib, double *epsa);
18578void iauPmat00(double date1, double date2, double rbp[3][3]);
18579void iauPmat06(double date1, double date2, double rbp[3][3]);
18580void iauPmat76(double date1, double date2, double rmatp[3][3]);
18581void iauPn00(double date1, double date2, double dpsi, double deps,
18582             double *epsa,
18583             double rb[3][3], double rp[3][3], double rbp[3][3],
18584             double rn[3][3], double rbpn[3][3]);
18585void iauPn00a(double date1, double date2,
18586              double *dpsi, double *deps, double *epsa,
18587              double rb[3][3], double rp[3][3], double rbp[3][3],
18588              double rn[3][3], double rbpn[3][3]);
18589void iauPn00b(double date1, double date2,
18590              double *dpsi, double *deps, double *epsa,
18591              double rb[3][3], double rp[3][3], double rbp[3][3],
18592              double rn[3][3], double rbpn[3][3]);
18593void iauPn06(double date1, double date2, double dpsi, double deps,
18594             double *epsa,
18595             double rb[3][3], double rp[3][3], double rbp[3][3],
18596             double rn[3][3], double rbpn[3][3]);
18597void iauPn06a(double date1, double date2,
18598              double *dpsi, double *deps, double *epsa,
18599              double rb[3][3], double rp[3][3], double rbp[3][3],
18600              double rn[3][3], double rbpn[3][3]);
18601void iauPnm00a(double date1, double date2, double rbpn[3][3]);
18602void iauPnm00b(double date1, double date2, double rbpn[3][3]);
18603void iauPnm06a(double date1, double date2, double rnpb[3][3]);
18604void iauPnm80(double date1, double date2, double rmatpn[3][3]);
18605void iauPom00(double xp, double yp, double sp, double rpom[3][3]);
18606void iauPr00(double date1, double date2,
18607             double *dpsipr, double *depspr);
18608void iauPrec76(double date01, double date02,
18609               double date11, double date12,
18610               double *zeta, double *z, double *theta);
18611double iauS00(double date1, double date2, double x, double y);
18612double iauS00a(double date1, double date2);
18613double iauS00b(double date1, double date2);
18614double iauS06(double date1, double date2, double x, double y);
18615double iauS06a(double date1, double date2);
18616double iauSp00(double date1, double date2);
18617void iauXy06(double date1, double date2, double *x, double *y);
18618void iauXys00a(double date1, double date2,
18619               double *x, double *y, double *s);
18620void iauXys00b(double date1, double date2,
18621               double *x, double *y, double *s);
18622void iauXys06a(double date1, double date2,
18623               double *x, double *y, double *s);
18624
18625/* Astronomy/RotationAndTime */
18626double iauEe00(double date1, double date2, double epsa, double dpsi);
18627double iauEe00a(double date1, double date2);
18628double iauEe00b(double date1, double date2);
18629double iauEe06a(double date1, double date2);
18630double iauEect00(double date1, double date2);
18631double iauEqeq94(double date1, double date2);
18632double iauEra00(double dj1, double dj2);
18633double iauGmst00(double uta, double utb, double tta, double ttb);
18634double iauGmst06(double uta, double utb, double tta, double ttb);
18635double iauGmst82(double dj1, double dj2);
18636double iauGst00a(double uta, double utb, double tta, double ttb);
18637double iauGst00b(double uta, double utb);
18638double iauGst06(double uta, double utb, double tta, double ttb,
18639                double rnpb[3][3]);
18640double iauGst06a(double uta, double utb, double tta, double ttb);
18641double iauGst94(double uta, double utb);
18642
18643/* Astronomy/SpaceMotion */
18644int iauPvstar(double pv[2][3], double *ra, double *dec,
18645              double *pmr, double *pmd, double *px, double *rv);
18646int iauStarpv(double ra, double dec,
18647              double pmr, double pmd, double px, double rv,
18648              double pv[2][3]);
18649
18650/* Astronomy/StarCatalogs */
18651
18652void iauFk425(double r1950, double d1950,
18653              double dr1950, double dd1950,
18654              double p1950, double v1950,
18655              double *r2000, double *d2000,
18656              double *dr2000, double *dd2000,
18657              double *p2000, double *v2000);
18658void iauFk45z(double r1950, double d1950, double bepoch,
18659              double *r2000, double *d2000);
18660void iauFk524(double r2000, double d2000,
18661              double dr2000, double dd2000,
18662              double p2000, double v2000,
18663              double *r1950, double *d1950,
18664              double *dr1950, double *dd1950,
18665              double *p1950, double *v1950);
18666void iauFk52h(double r5, double d5,
18667              double dr5, double dd5, double px5, double rv5,
18668              double *rh, double *dh,
18669              double *drh, double *ddh, double *pxh, double *rvh);
18670void iauFk54z(double r2000, double d2000, double bepoch,
18671              double *r1950, double *d1950,
18672              double *dr1950, double *dd1950);
18673void iauFk5hip(double r5h[3][3], double s5h[3]);
18674void iauFk5hz(double r5, double d5, double date1, double date2,
18675              double *rh, double *dh);
18676void iauH2fk5(double rh, double dh,
18677              double drh, double ddh, double pxh, double rvh,
18678              double *r5, double *d5,
18679              double *dr5, double *dd5, double *px5, double *rv5);
18680void iauHfk5z(double rh, double dh, double date1, double date2,
18681              double *r5, double *d5, double *dr5, double *dd5);
18682int iauStarpm(double ra1, double dec1,
18683              double pmr1, double pmd1, double px1, double rv1,
18684              double ep1a, double ep1b, double ep2a, double ep2b,
18685              double *ra2, double *dec2,
18686              double *pmr2, double *pmd2, double *px2, double *rv2);
18687
18688/* Astronomy/EclipticCoordinates */
18689void iauEceq06(double date1, double date2, double dl, double db,
18690               double *dr, double *dd);
18691void iauEcm06(double date1, double date2, double rm[3][3]);
18692void iauEqec06(double date1, double date2, double dr, double dd,
18693               double *dl, double *db);
18694void iauLteceq(double epj, double dl, double db, double *dr, double *dd);
18695void iauLtecm(double epj, double rm[3][3]);
18696void iauLteqec(double epj, double dr, double dd, double *dl, double *db);
18697
18698/* Astronomy/GalacticCoordinates */
18699void iauG2icrs(double dl, double db, double *dr, double *dd);
18700void iauIcrs2g(double dr, double dd, double *dl, double *db);
18701
18702/* Astronomy/GeodeticGeocentric */
18703int iauEform(int n, double *a, double *f);
18704int iauGc2gd(int n, double xyz[3],
18705             double *elong, double *phi, double *height);
18706int iauGc2gde(double a, double f, double xyz[3],
18707              double *elong, double *phi, double *height);
18708int iauGd2gc(int n, double elong, double phi, double height,
18709             double xyz[3]);
18710int iauGd2gce(double a, double f,
18711              double elong, double phi, double height, double xyz[3]);
18712
18713/* Astronomy/Timescales */
18714int iauD2dtf(const char *scale, int ndp, double d1, double d2,
18715             int *iy, int *im, int *id, int ihmsf[4]);
18716int iauDat(int iy, int im, int id, double fd, double *deltat);
18717double iauDtdb(double date1, double date2,
18718               double ut, double elong, double u, double v);
18719int iauDtf2d(const char *scale, int iy, int im, int id,
18720             int ihr, int imn, double sec, double *d1, double *d2);
18721int iauTaitt(double tai1, double tai2, double *tt1, double *tt2);
18722int iauTaiut1(double tai1, double tai2, double dta,
18723              double *ut11, double *ut12);
18724int iauTaiutc(double tai1, double tai2, double *utc1, double *utc2);
18725int iauTcbtdb(double tcb1, double tcb2, double *tdb1, double *tdb2);
18726int iauTcgtt(double tcg1, double tcg2, double *tt1, double *tt2);
18727int iauTdbtcb(double tdb1, double tdb2, double *tcb1, double *tcb2);
18728int iauTdbtt(double tdb1, double tdb2, double dtr,
18729             double *tt1, double *tt2);
18730int iauTttai(double tt1, double tt2, double *tai1, double *tai2);
18731int iauTttcg(double tt1, double tt2, double *tcg1, double *tcg2);
18732int iauTttdb(double tt1, double tt2, double dtr,
18733             double *tdb1, double *tdb2);
18734int iauTtut1(double tt1, double tt2, double dt,
18735             double *ut11, double *ut12);
18736int iauUt1tai(double ut11, double ut12, double dta,
18737              double *tai1, double *tai2);
18738int iauUt1tt(double ut11, double ut12, double dt,
18739             double *tt1, double *tt2);
18740int iauUt1utc(double ut11, double ut12, double dut1,
18741              double *utc1, double *utc2);
18742int iauUtctai(double utc1, double utc2, double *tai1, double *tai2);
18743int iauUtcut1(double utc1, double utc2, double dut1,
18744              double *ut11, double *ut12);
18745
18746/* Astronomy/HorizonEquatorial */
18747void iauAe2hd(double az, double el, double phi,
18748              double *ha, double *dec);
18749void iauHd2ae(double ha, double dec, double phi,
18750              double *az, double *el);
18751double iauHd2pa(double ha, double dec, double phi);
18752
18753/* Astronomy/Gnomonic */
18754int iauTpors(double xi, double eta, double a, double b,
18755             double *a01, double *b01, double *a02, double *b02);
18756int iauTporv(double xi, double eta, double v[3],
18757             double v01[3], double v02[3]);
18758void iauTpsts(double xi, double eta, double a0, double b0,
18759              double *a, double *b);
18760void iauTpstv(double xi, double eta, double v0[3], double v[3]);
18761int iauTpxes(double a, double b, double a0, double b0,
18762             double *xi, double *eta);
18763int iauTpxev(double v[3], double v0[3], double *xi, double *eta);
18764
18765/* VectorMatrix/AngleOps */
18766void iauA2af(int ndp, double angle, char *sign, int idmsf[4]);
18767void iauA2tf(int ndp, double angle, char *sign, int ihmsf[4]);
18768int iauAf2a(char s, int ideg, int iamin, double asec, double *rad);
18769double iauAnp(double a);
18770double iauAnpm(double a);
18771void iauD2tf(int ndp, double days, char *sign, int ihmsf[4]);
18772int iauTf2a(char s, int ihour, int imin, double sec, double *rad);
18773int iauTf2d(char s, int ihour, int imin, double sec, double *days);
18774
18775/* VectorMatrix/BuildRotations */
18776void iauRx(double phi, double r[3][3]);
18777void iauRy(double theta, double r[3][3]);
18778void iauRz(double psi, double r[3][3]);
18779
18780/* VectorMatrix/CopyExtendExtract */
18781void iauCp(double p[3], double c[3]);
18782void iauCpv(double pv[2][3], double c[2][3]);
18783void iauCr(double r[3][3], double c[3][3]);
18784void iauP2pv(double p[3], double pv[2][3]);
18785void iauPv2p(double pv[2][3], double p[3]);
18786
18787/* VectorMatrix/Initialization */
18788void iauIr(double r[3][3]);
18789void iauZp(double p[3]);
18790void iauZpv(double pv[2][3]);
18791void iauZr(double r[3][3]);
18792
18793/* VectorMatrix/MatrixOps */
18794void iauRxr(double a[3][3], double b[3][3], double atb[3][3]);
18795void iauTr(double r[3][3], double rt[3][3]);
18796
18797/* VectorMatrix/MatrixVectorProducts */
18798void iauRxp(double r[3][3], double p[3], double rp[3]);
18799void iauRxpv(double r[3][3], double pv[2][3], double rpv[2][3]);
18800void iauTrxp(double r[3][3], double p[3], double trp[3]);
18801void iauTrxpv(double r[3][3], double pv[2][3], double trpv[2][3]);
18802
18803/* VectorMatrix/RotationVectors */
18804void iauRm2v(double r[3][3], double w[3]);
18805void iauRv2m(double w[3], double r[3][3]);
18806
18807/* VectorMatrix/SeparationAndAngle */
18808double iauPap(double a[3], double b[3]);
18809double iauPas(double al, double ap, double bl, double bp);
18810double iauSepp(double a[3], double b[3]);
18811double iauSeps(double al, double ap, double bl, double bp);
18812
18813/* VectorMatrix/SphericalCartesian */
18814void iauC2s(double p[3], double *theta, double *phi);
18815void iauP2s(double p[3], double *theta, double *phi, double *r);
18816void iauPv2s(double pv[2][3],
18817             double *theta, double *phi, double *r,
18818             double *td, double *pd, double *rd);
18819void iauS2c(double theta, double phi, double c[3]);
18820void iauS2p(double theta, double phi, double r, double p[3]);
18821void iauS2pv(double theta, double phi, double r,
18822             double td, double pd, double rd,
18823             double pv[2][3]);
18824
18825/* VectorMatrix/VectorOps */
18826double iauPdp(double a[3], double b[3]);
18827double iauPm(double p[3]);
18828void iauPmp(double a[3], double b[3], double amb[3]);
18829void iauPn(double p[3], double *r, double u[3]);
18830void iauPpp(double a[3], double b[3], double apb[3]);
18831void iauPpsp(double a[3], double s, double b[3], double apsb[3]);
18832void iauPvdpv(double a[2][3], double b[2][3], double adb[2]);
18833void iauPvm(double pv[2][3], double *r, double *s);
18834void iauPvmpv(double a[2][3], double b[2][3], double amb[2][3]);
18835void iauPvppv(double a[2][3], double b[2][3], double apb[2][3]);
18836void iauPvu(double dt, double pv[2][3], double upv[2][3]);
18837void iauPvup(double dt, double pv[2][3], double p[3]);
18838void iauPvxpv(double a[2][3], double b[2][3], double axb[2][3]);
18839void iauPxp(double a[3], double b[3], double axb[3]);
18840void iauS2xpv(double s1, double s2, double pv[2][3], double spv[2][3]);
18841void iauSxp(double s, double p[3], double sp[3]);
18842void iauSxpv(double s, double pv[2][3], double spv[2][3]);
18843
18844#ifdef __cplusplus
18845}
18846#endif
18847
18848#endif
18849
18850/*----------------------------------------------------------------------
18851**
18852**  Copyright (C) 2021
18853**  Standards Of Fundamental Astronomy Board
18854**  of the International Astronomical Union.
18855**
18856**  =====================
18857**  SOFA Software License
18858**  =====================
18859**
18860**  NOTICE TO USER:
18861**
18862**  BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
18863**  CONDITIONS WHICH APPLY TO ITS USE.
18864**
18865**  1. The Software is owned by the IAU SOFA Board ("SOFA").
18866**
18867**  2. Permission is granted to anyone to use the SOFA software for any
18868**     purpose, including commercial applications, free of charge and
18869**     without payment of royalties, subject to the conditions and
18870**     restrictions listed below.
18871**
18872**  3. You (the user) may copy and distribute SOFA source code to others,
18873**     and use and adapt its code and algorithms in your own software,
18874**     on a world-wide, royalty-free basis.  That portion of your
18875**     distribution that does not consist of intact and unchanged copies
18876**     of SOFA source code files is a "derived work" that must comply
18877**     with the following requirements:
18878**
18879**     a) Your work shall be marked or carry a statement that it
18880**        (i) uses routines and computations derived by you from
18881**        software provided by SOFA under license to you; and
18882**        (ii) does not itself constitute software provided by and/or
18883**        endorsed by SOFA.
18884**
18885**     b) The source code of your derived work must contain descriptions
18886**        of how the derived work is based upon, contains and/or differs
18887**        from the original SOFA software.
18888**
18889**     c) The names of all routines in your derived work shall not
18890**        include the prefix "iau" or "sofa" or trivial modifications
18891**        thereof such as changes of case.
18892**
18893**     d) The origin of the SOFA components of your derived work must
18894**        not be misrepresented;  you must not claim that you wrote the
18895**        original software, nor file a patent application for SOFA
18896**        software or algorithms embedded in the SOFA software.
18897**
18898**     e) These requirements must be reproduced intact in any source
18899**        distribution and shall apply to anyone to whom you have
18900**        granted a further right to modify the source code of your
18901**        derived work.
18902**
18903**     Note that, as originally distributed, the SOFA software is
18904**     intended to be a definitive implementation of the IAU standards,
18905**     and consequently third-party modifications are discouraged.  All
18906**     variations, no matter how minor, must be explicitly marked as
18907**     such, as explained above.
18908**
18909**  4. You shall not cause the SOFA software to be brought into
18910**     disrepute, either by misuse, or use for inappropriate tasks, or
18911**     by inappropriate modification.
18912**
18913**  5. The SOFA software is provided "as is" and SOFA makes no warranty
18914**     as to its use or performance.   SOFA does not and cannot warrant
18915**     the performance or results which the user may obtain by using the
18916**     SOFA software.  SOFA makes no warranties, express or implied, as
18917**     to non-infringement of third party rights, merchantability, or
18918**     fitness for any particular purpose.  In no event will SOFA be
18919**     liable to the user for any consequential, incidental, or special
18920**     damages, including any lost profits or lost savings, even if a
18921**     SOFA representative has been advised of such damages, or for any
18922**     claim by any third party.
18923**
18924**  6. The provision of any version of the SOFA software under the terms
18925**     and conditions specified herein does not imply that future
18926**     versions will also be made available under the same terms and
18927**     conditions.
18928*
18929**  In any published work or commercial product which uses the SOFA
18930**  software directly, acknowledgement (see www.iausofa.org) is
18931**  appreciated.
18932**
18933**  Correspondence concerning SOFA software should be addressed as
18934**  follows:
18935**
18936**      By email:  sofa@ukho.gov.uk
18937**      By post:   IAU SOFA Center
18938**                 HM Nautical Almanac Office
18939**                 UK Hydrographic Office
18940**                 Admiralty Way, Taunton
18941**                 Somerset, TA1 2DN
18942**                 United Kingdom
18943**
18944**--------------------------------------------------------------------*/
18945
18946#ifndef SOFAMHDEF
18947#define SOFAMHDEF
18948
18949/*
18950**  - - - - - - - -
18951**   s o f a m . h
18952**  - - - - - - - -
18953**
18954**  Macros used by SOFA library.
18955**
18956**  This file is part of the International Astronomical Union's
18957**  SOFA (Standards Of Fundamental Astronomy) software collection.
18958**
18959**  Please note that the constants defined below are to be used only in
18960**  the context of the SOFA software, and have no other official IAU
18961**  status.  In addition, self consistency is not guaranteed.
18962**
18963**  This revision:   2021 February 24
18964**
18965**  SOFA release 2021-05-12
18966**
18967**  Copyright (C) 2021 IAU SOFA Board.  See notes at end.
18968*/
18969
18970/* Pi */
18971#define DPI (3.141592653589793238462643)
18972
18973/* 2Pi */
18974#define D2PI (6.283185307179586476925287)
18975
18976/* Radians to degrees */
18977#define DR2D (57.29577951308232087679815)
18978
18979/* Degrees to radians */
18980#define DD2R (1.745329251994329576923691e-2)
18981
18982/* Radians to arcseconds */
18983#define DR2AS (206264.8062470963551564734)
18984
18985/* Arcseconds to radians */
18986#define DAS2R (4.848136811095359935899141e-6)
18987
18988/* Seconds of time to radians */
18989#define DS2R (7.272205216643039903848712e-5)
18990
18991/* Arcseconds in a full circle */
18992#define TURNAS (1296000.0)
18993
18994/* Milliarcseconds to radians */
18995#define DMAS2R (DAS2R / 1e3)
18996
18997/* Length of tropical year B1900 (days) */
18998#define DTY (365.242198781)
18999
19000/* Seconds per day. */
19001#define DAYSEC (86400.0)
19002
19003/* Days per Julian year */
19004#define DJY (365.25)
19005
19006/* Days per Julian century */
19007#define DJC (36525.0)
19008
19009/* Days per Julian millennium */
19010#define DJM (365250.0)
19011
19012/* Reference epoch (J2000.0), Julian Date */
19013#define DJ00 (2451545.0)
19014
19015/* Julian Date of Modified Julian Date zero */
19016#define DJM0 (2400000.5)
19017
19018/* Reference epoch (J2000.0), Modified Julian Date */
19019#define DJM00 (51544.5)
19020
19021/* 1977 Jan 1.0 as MJD */
19022#define DJM77 (43144.0)
19023
19024/* TT minus TAI (s) */
19025#define TTMTAI (32.184)
19026
19027/* Astronomical unit (m, IAU 2012) */
19028#define DAU (149597870.7e3)
19029
19030/* Speed of light (m/s) */
19031#define CMPS 299792458.0
19032
19033/* Light time for 1 au (s) */
19034#define AULT (DAU/CMPS)
19035
19036/* Speed of light (au per day) */
19037#define DC (DAYSEC/AULT)
19038
19039/* L_G = 1 - d(TT)/d(TCG) */
19040#define ELG (6.969290134e-10)
19041
19042/* L_B = 1 - d(TDB)/d(TCB), and TDB (s) at TAI 1977/1/1.0 */
19043#define ELB (1.550519768e-8)
19044#define TDB0 (-6.55e-5)
19045
19046/* Schwarzschild radius of the Sun (au) */
19047/* = 2 * 1.32712440041e20 / (2.99792458e8)^2 / 1.49597870700e11 */
19048#define SRS 1.97412574336e-8
19049
19050/* dint(A) - truncate to nearest whole number towards zero (double) */
19051#define dint(A) ((A)<0.0?ceil(A):floor(A))
19052
19053/* dnint(A) - round to nearest whole number (double) */
19054#define dnint(A) (fabs(A)<0.5?0.0\
19055                                :((A)<0.0?ceil((A)-0.5):floor((A)+0.5)))
19056
19057/* dsign(A,B) - magnitude of A with sign of B (double) */
19058#define dsign(A,B) ((B)<0.0?-fabs(A):fabs(A))
19059
19060/* max(A,B) - larger (most +ve) of two numbers (generic) */
19061#define gmax(A,B) (((A)>(B))?(A):(B))
19062
19063/* min(A,B) - smaller (least +ve) of two numbers (generic) */
19064#define gmin(A,B) (((A)<(B))?(A):(B))
19065
19066/* Reference ellipsoids */
19067#define WGS84 1
19068#define GRS80 2
19069#define WGS72 3
19070
19071#endif
19072
19073/*----------------------------------------------------------------------
19074**
19075**  Copyright (C) 2021
19076**  Standards Of Fundamental Astronomy Board
19077**  of the International Astronomical Union.
19078**
19079**  =====================
19080**  SOFA Software License
19081**  =====================
19082**
19083**  NOTICE TO USER:
19084**
19085**  BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
19086**  CONDITIONS WHICH APPLY TO ITS USE.
19087**
19088**  1. The Software is owned by the IAU SOFA Board ("SOFA").
19089**
19090**  2. Permission is granted to anyone to use the SOFA software for any
19091**     purpose, including commercial applications, free of charge and
19092**     without payment of royalties, subject to the conditions and
19093**     restrictions listed below.
19094**
19095**  3. You (the user) may copy and distribute SOFA source code to others,
19096**     and use and adapt its code and algorithms in your own software,
19097**     on a world-wide, royalty-free basis.  That portion of your
19098**     distribution that does not consist of intact and unchanged copies
19099**     of SOFA source code files is a "derived work" that must comply
19100**     with the following requirements:
19101**
19102**     a) Your work shall be marked or carry a statement that it
19103**        (i) uses routines and computations derived by you from
19104**        software provided by SOFA under license to you; and
19105**        (ii) does not itself constitute software provided by and/or
19106**        endorsed by SOFA.
19107**
19108**     b) The source code of your derived work must contain descriptions
19109**        of how the derived work is based upon, contains and/or differs
19110**        from the original SOFA software.
19111**
19112**     c) The names of all routines in your derived work shall not
19113**        include the prefix "iau" or "sofa" or trivial modifications
19114**        thereof such as changes of case.
19115**
19116**     d) The origin of the SOFA components of your derived work must
19117**        not be misrepresented;  you must not claim that you wrote the
19118**        original software, nor file a patent application for SOFA
19119**        software or algorithms embedded in the SOFA software.
19120**
19121**     e) These requirements must be reproduced intact in any source
19122**        distribution and shall apply to anyone to whom you have
19123**        granted a further right to modify the source code of your
19124**        derived work.
19125**
19126**     Note that, as originally distributed, the SOFA software is
19127**     intended to be a definitive implementation of the IAU standards,
19128**     and consequently third-party modifications are discouraged.  All
19129**     variations, no matter how minor, must be explicitly marked as
19130**     such, as explained above.
19131**
19132**  4. You shall not cause the SOFA software to be brought into
19133**     disrepute, either by misuse, or use for inappropriate tasks, or
19134**     by inappropriate modification.
19135**
19136**  5. The SOFA software is provided "as is" and SOFA makes no warranty
19137**     as to its use or performance.   SOFA does not and cannot warrant
19138**     the performance or results which the user may obtain by using the
19139**     SOFA software.  SOFA makes no warranties, express or implied, as
19140**     to non-infringement of third party rights, merchantability, or
19141**     fitness for any particular purpose.  In no event will SOFA be
19142**     liable to the user for any consequential, incidental, or special
19143**     damages, including any lost profits or lost savings, even if a
19144**     SOFA representative has been advised of such damages, or for any
19145**     claim by any third party.
19146**
19147**  6. The provision of any version of the SOFA software under the terms
19148**     and conditions specified herein does not imply that future
19149**     versions will also be made available under the same terms and
19150**     conditions.
19151*
19152**  In any published work or commercial product which uses the SOFA
19153**  software directly, acknowledgement (see www.iausofa.org) is
19154**  appreciated.
19155**
19156**  Correspondence concerning SOFA software should be addressed as
19157**  follows:
19158**
19159**      By email:  sofa@ukho.gov.uk
19160**      By post:   IAU SOFA Center
19161**                 HM Nautical Almanac Office
19162**                 UK Hydrographic Office
19163**                 Admiralty Way, Taunton
19164**                 Somerset, TA1 2DN
19165**                 United Kingdom
19166**
19167**--------------------------------------------------------------------*/
19168
19169board.lis                                                  2021 April 16
19170
19171
19172
19173IAU STANDARDS OF FUNDAMENTAL ASTRONOMY BOARD
19174
19175
19176Current Membership
19177
19178   John Bangert - United States Naval Observatory, retired
19179   Steven Bell - Her Majesty's Nautical Almanac Office (HMNAO)
19180   Nicole Capitaine - Paris Observatory
19181   Maria Davis - United States Naval Observatory (IERS)
19182   Mickael Gastineau - Paris Observatory, IMCCE
19183   Catherine Hohenkerk - HMNAO (Chair, retired)
19184   Li Jinling - Shanghai Astronomical Observatory
19185   Zinovy Malkin - Pulkovo Observatory, St Petersburg
19186   Jeffrey Percival - University of Wisconsin
19187   Wendy Puatua - United States Naval Observatory
19188   Scott Ransom - National Radio Astronomy Observatory
19189   Nick Stamatakos - United States Naval Observatory
19190   Patrick Wallace - RAL Space, retired
19191   Toni Wilmot -  Her Majesty's Nautical Almanac Office (Trainee)
19192
19193
19194Past Members
19195
19196   Wim Brouw              University of Groningen
19197   Mark Calabretta        Australia Telescope National Facility
19198   William Folkner        Jet Propulsion Laboratory
19199   Anne-Marie Gontier     Paris Observatory
19200   George Hobbs           Australia Telescope National Facility
19201   George Kaplan          United States Naval Observatory
19202   Brian Luzum            United States Naval Observatory
19203   Dennis McCarthy        United States Naval Observatory
19204   Skip Newhall           Jet Propulsion Laboratory
19205   Jin Wen-Jing           Shanghai Astronomical Observatory
19206
19207
19208The email address for the Board chair is catherine.hohenkerk@gmail.com
19209
19210