1# Licensed under a 3-clause BSD style license - see LICENSE.rst
2
3# "core.py" is auto-generated by erfa_generator.py from the template
4# "core.py.templ". Do *not* edit "core.py" directly, instead edit
5# "core.py.templ" and run erfa_generator.py from the source directory to
6# update it.
7
8"""
9Python wrappers for the ufunc wrappers of the ERFA library.
10
11The key idea is that any function can be called with inputs that are arrays,
12and the ufuncs will automatically vectorize and call the ERFA functions for
13each item using broadcasting rules for numpy.  So the return values are always
14numpy arrays of some sort.
15
16For ERFA functions that take/return vectors or matrices, the vector/matrix
17dimension(s) are always the *last* dimension(s).  For example, if you
18want to give ten matrices (i.e., the ERFA input type is double[3][3]),
19you would pass in a (10, 3, 3) numpy array.  If the output of the ERFA
20function is scalar, you'll get back a length-10 1D array.
21(Note that the ufuncs take this into account using structured dtypes.)
22
23Note that the ufunc part of these functions are implemented in a separate
24module (compiled as ``ufunc``), derived from the ``ufunc.c`` file.
25"""
26
27import warnings
28
29import numpy
30
31from . import ufunc
32
33__all__ = [
34    'ErfaError', 'ErfaWarning',
35    'cal2jd', 'epb', 'epb2jd', 'epj', 'epj2jd', 'jd2cal', 'jdcalf', 'ab', 'apcg',
36    'apcg13', 'apci', 'apci13', 'apco', 'apco13', 'apcs', 'apcs13', 'aper',
37    'aper13', 'apio', 'apio13', 'atcc13', 'atccq', 'atci13', 'atciq', 'atciqn',
38    'atciqz', 'atco13', 'atic13', 'aticq', 'aticqn', 'atio13', 'atioq', 'atoc13',
39    'atoi13', 'atoiq', 'ld', 'ldn', 'ldsun', 'pmpx', 'pmsafe', 'pvtob', 'refco',
40    'epv00', 'moon98', 'plan94', 'fad03', 'fae03', 'faf03', 'faju03', 'fal03',
41    'falp03', 'fama03', 'fame03', 'fane03', 'faom03', 'fapa03', 'fasa03', 'faur03',
42    'fave03', 'bi00', 'bp00', 'bp06', 'bpn2xy', 'c2i00a', 'c2i00b', 'c2i06a',
43    'c2ibpn', 'c2ixy', 'c2ixys', 'c2t00a', 'c2t00b', 'c2t06a', 'c2tcio', 'c2teqx',
44    'c2tpe', 'c2txy', 'eo06a', 'eors', 'fw2m', 'fw2xy', 'ltp', 'ltpb', 'ltpecl',
45    'ltpequ', 'num00a', 'num00b', 'num06a', 'numat', 'nut00a', 'nut00b', 'nut06a',
46    'nut80', 'nutm80', 'obl06', 'obl80', 'p06e', 'pb06', 'pfw06', 'pmat00',
47    'pmat06', 'pmat76', 'pn00', 'pn00a', 'pn00b', 'pn06', 'pn06a', 'pnm00a',
48    'pnm00b', 'pnm06a', 'pnm80', 'pom00', 'pr00', 'prec76', 's00', 's00a', 's00b',
49    's06', 's06a', 'sp00', 'xy06', 'xys00a', 'xys00b', 'xys06a', 'ee00', 'ee00a',
50    'ee00b', 'ee06a', 'eect00', 'eqeq94', 'era00', 'gmst00', 'gmst06', 'gmst82',
51    'gst00a', 'gst00b', 'gst06', 'gst06a', 'gst94', 'pvstar', 'starpv', 'fk425',
52    'fk45z', 'fk524', 'fk52h', 'fk54z', 'fk5hip', 'fk5hz', 'h2fk5', 'hfk5z',
53    'starpm', 'eceq06', 'ecm06', 'eqec06', 'lteceq', 'ltecm', 'lteqec', 'g2icrs',
54    'icrs2g', 'eform', 'gc2gd', 'gc2gde', 'gd2gc', 'gd2gce', 'd2dtf', 'dat',
55    'dtdb', 'dtf2d', 'taitt', 'taiut1', 'taiutc', 'tcbtdb', 'tcgtt', 'tdbtcb',
56    'tdbtt', 'tttai', 'tttcg', 'tttdb', 'ttut1', 'ut1tai', 'ut1tt', 'ut1utc',
57    'utctai', 'utcut1', 'ae2hd', 'hd2ae', 'hd2pa', 'tpors', 'tporv', 'tpsts',
58    'tpstv', 'tpxes', 'tpxev', 'a2af', 'a2tf', 'af2a', 'anp', 'anpm', 'd2tf',
59    'tf2a', 'tf2d', 'rx', 'ry', 'rz', 'cp', 'cpv', 'cr', 'p2pv', 'pv2p', 'ir',
60    'zp', 'zpv', 'zr', 'rxr', 'tr', 'rxp', 'rxpv', 'trxp', 'trxpv', 'rm2v', 'rv2m',
61    'pap', 'pas', 'sepp', 'seps', 'c2s', 'p2s', 'pv2s', 's2c', 's2p', 's2pv',
62    'pdp', 'pm', 'pmp', 'pn', 'ppp', 'ppsp', 'pvdpv', 'pvm', 'pvmpv', 'pvppv',
63    'pvu', 'pvup', 'pvxpv', 'pxp', 's2xpv', 'sxp', 'sxpv',
64    'DPI', 'D2PI', 'DR2D', 'DD2R', 'DR2AS', 'DAS2R', 'DS2R', 'TURNAS', 'DMAS2R',
65    'DTY', 'DAYSEC', 'DJY', 'DJC', 'DJM', 'DJ00', 'DJM0', 'DJM00', 'DJM77',
66    'TTMTAI', 'DAU', 'CMPS', 'AULT', 'DC', 'ELG', 'ELB', 'TDB0', 'SRS', 'WGS84',
67    'GRS80', 'WGS72']
68
69
70class ErfaError(ValueError):
71    """
72    A class for errors triggered by ERFA functions (status codes < 0)
73
74    Note: this class should *not* be referenced by fully-qualified name, because
75    it may move to ERFA in a future version.  In a future such move it will
76    still be imported here as an alias, but the true namespace of the class may
77    change.
78    """
79
80
81class ErfaWarning(UserWarning):
82    """
83    A class for warnings triggered by ERFA functions (status codes > 0)
84
85    Note: this class should *not* be referenced by fully-qualified name, because
86    it may move to ERFA in a future version.  In a future such move it will
87    still be imported here as an alias, but the true namespace of the class may
88    change.
89    """
90
91
92# <---------------------------------Error-handling---------------------------->
93
94
95STATUS_CODES = {}  # populated below before each function that returns an int
96
97# This is a hard-coded list of status codes that need to be remapped,
98# such as to turn errors into warnings.
99STATUS_CODES_REMAP = {
100    'cal2jd': {-3: 3}
101}
102
103
104def check_errwarn(statcodes, func_name):
105    if not numpy.any(statcodes):
106        return
107    # Remap any errors into warnings in the STATUS_CODES_REMAP dict.
108    if func_name in STATUS_CODES_REMAP:
109        for before, after in STATUS_CODES_REMAP[func_name].items():
110            statcodes[statcodes == before] = after
111            STATUS_CODES[func_name][after] = STATUS_CODES[func_name][before]
112
113    if numpy.any(statcodes < 0):
114        # Errors present - only report the errors.
115        if statcodes.shape:
116            statcodes = statcodes[statcodes < 0]
117
118        errcodes = numpy.unique(statcodes)
119
120        errcounts = dict([(e, numpy.sum(statcodes == e)) for e in errcodes])
121
122        elsemsg = STATUS_CODES[func_name].get('else', None)
123        if elsemsg is None:
124            errmsgs = dict([(e, STATUS_CODES[func_name].get(
125                e, 'Return code ' + str(e))) for e in errcodes])
126        else:
127            errmsgs = dict([(e, STATUS_CODES[func_name].get(
128                e, elsemsg)) for e in errcodes])
129
130        emsg = ', '.join(['{0} of "{1}"'.format(errcounts[e], errmsgs[e])
131                          for e in errcodes])
132        raise ErfaError('ERFA function "{}" yielded {}'
133                        .format(func_name, emsg))
134
135    elif numpy.any(statcodes > 0):
136        # Only warnings present.
137        if statcodes.shape:
138            statcodes = statcodes[statcodes > 0]
139
140        warncodes = numpy.unique(statcodes)
141
142        warncounts = dict([(w, numpy.sum(statcodes == w)) for w in warncodes])
143
144        elsemsg = STATUS_CODES[func_name].get('else', None)
145        if elsemsg is None:
146            warnmsgs = dict([(w, STATUS_CODES[func_name].get(
147                w, 'Return code ' + str(w))) for w in warncodes])
148        else:
149            warnmsgs = dict([(w, STATUS_CODES[func_name].get(
150                w, elsemsg)) for w in warncodes])
151
152        wmsg = ', '.join(['{0} of "{1}"'.format(warncounts[w], warnmsgs[w])
153                          for w in warncodes])
154        warnings.warn('ERFA function "{}" yielded {}'.format(func_name, wmsg),
155                      ErfaWarning)
156
157
158# <------------------------structured dtype conversion------------------------>
159
160dt_bytes1 = numpy.dtype('S1')
161dt_bytes12 = numpy.dtype('S12')
162
163# <--------------------------Actual ERFA-wrapping code------------------------>
164
165
166DPI = (3.141592653589793238462643)
167"""Pi"""
168D2PI = (6.283185307179586476925287)
169"""2Pi"""
170DR2D = (57.29577951308232087679815)
171"""Radians to degrees"""
172DD2R = (1.745329251994329576923691e-2)
173"""Degrees to radians"""
174DR2AS = (206264.8062470963551564734)
175"""Radians to arcseconds"""
176DAS2R = (4.848136811095359935899141e-6)
177"""Arcseconds to radians"""
178DS2R = (7.272205216643039903848712e-5)
179"""Seconds of time to radians"""
180TURNAS = (1296000.0)
181"""Arcseconds in a full circle"""
182DMAS2R = (DAS2R / 1e3)
183"""Milliarcseconds to radians"""
184DTY = (365.242198781)
185"""Length of tropical year B1900 (days)"""
186DAYSEC = (86400.0)
187"""Seconds per day."""
188DJY = (365.25)
189"""Days per Julian year"""
190DJC = (36525.0)
191"""Days per Julian century"""
192DJM = (365250.0)
193"""Days per Julian millennium"""
194DJ00 = (2451545.0)
195"""Reference epoch (J2000.0), Julian Date"""
196DJM0 = (2400000.5)
197"""Julian Date of Modified Julian Date zero"""
198DJM00 = (51544.5)
199"""Reference epoch (J2000.0), Modified Julian Date"""
200DJM77 = (43144.0)
201"""1977 Jan 1.0 as MJD"""
202TTMTAI = (32.184)
203"""TT minus TAI (s)"""
204DAU = (149597870.7e3)
205"""Astronomical unit (m, IAU 2012)"""
206CMPS = 299792458.0
207"""Speed of light (m/s)"""
208AULT = (DAU/CMPS)
209"""Light time for 1 au (s)"""
210DC = (DAYSEC/AULT)
211"""Speed of light (au per day)"""
212ELG = (6.969290134e-10)
213"""L_G = 1 - d(TT)/d(TCG)"""
214ELB = (1.550519768e-8)
215"""L_B = 1 - d(TDB)/d(TCB), and TDB (s) at TAI 1977/1/1.0"""
216TDB0 = (-6.55e-5)
217"""L_B = 1 - d(TDB)/d(TCB), and TDB (s) at TAI 1977/1/1.0"""
218SRS = 1.97412574336e-8
219"""Schwarzschild radius of the Sun (au) = 2 * 1.32712440041e20 / (2.99792458e8)^2
220/ 1.49597870700e11"""
221WGS84 = 1
222"""Reference ellipsoids"""
223GRS80 = 2
224"""Reference ellipsoids"""
225WGS72 = 3
226"""Reference ellipsoids"""
227
228
229def cal2jd(iy, im, id):
230    """
231    Gregorian Calendar to Julian Date.
232
233    Parameters
234    ----------
235    iy : int array
236    im : int array
237    id : int array
238
239    Returns
240    -------
241    djm0 : double array
242    djm : double array
243
244    Notes
245    -----
246    Wraps ERFA function ``eraCal2jd``. The ERFA documentation is::
247
248        - - - - - - - - - -
249         e r a C a l 2 j d
250        - - - - - - - - - -
251
252        Gregorian Calendar to Julian Date.
253
254        Given:
255           iy,im,id  int     year, month, day in Gregorian calendar (Note 1)
256
257        Returned:
258           djm0      double  MJD zero-point: always 2400000.5
259           djm       double  Modified Julian Date for 0 hrs
260
261        Returned (function value):
262                     int     status:
263                                 0 = OK
264                                -1 = bad year   (Note 3: JD not computed)
265                                -2 = bad month  (JD not computed)
266                                -3 = bad day    (JD computed)
267
268        Notes:
269
270        1) The algorithm used is valid from -4800 March 1, but this
271           implementation rejects dates before -4799 January 1.
272
273        2) The Julian Date is returned in two pieces, in the usual ERFA
274           manner, which is designed to preserve time resolution.  The
275           Julian Date is available as a single number by adding djm0 and
276           djm.
277
278        3) In early eras the conversion is from the "Proleptic Gregorian
279           Calendar";  no account is taken of the date(s) of adoption of
280           the Gregorian Calendar, nor is the AD/BC numbering convention
281           observed.
282
283        Reference:
284
285           Explanatory Supplement to the Astronomical Almanac,
286           P. Kenneth Seidelmann (ed), University Science Books (1992),
287           Section 12.92 (p604).
288
289        This revision:  2021 May 11
290
291        Copyright (C) 2013-2021, NumFOCUS Foundation.
292        Derived, with permission, from the SOFA library.  See notes at end of file.
293
294    """
295    djm0, djm, c_retval = ufunc.cal2jd(iy, im, id)
296    check_errwarn(c_retval, 'cal2jd')
297    return djm0, djm
298
299
300STATUS_CODES['cal2jd'] = {
301    0: 'OK',
302    -1: 'bad year   (Note 3: JD not computed)',
303    -2: 'bad month  (JD not computed)',
304    -3: 'bad day    (JD computed)',
305}
306
307
308def epb(dj1, dj2):
309    """
310    Julian Date to Besselian Epoch.
311
312    Parameters
313    ----------
314    dj1 : double array
315    dj2 : double array
316
317    Returns
318    -------
319    c_retval : double array
320
321    Notes
322    -----
323    Wraps ERFA function ``eraEpb``. The ERFA documentation is::
324
325        - - - - - - -
326         e r a E p b
327        - - - - - - -
328
329        Julian Date to Besselian Epoch.
330
331        Given:
332           dj1,dj2    double     Julian Date (see note)
333
334        Returned (function value):
335                      double     Besselian Epoch.
336
337        Note:
338
339           The Julian Date is supplied in two pieces, in the usual ERFA
340           manner, which is designed to preserve time resolution.  The
341           Julian Date is available as a single number by adding dj1 and
342           dj2.  The maximum resolution is achieved if dj1 is 2451545.0
343           (J2000.0).
344
345        Reference:
346
347           Lieske, J.H., 1979. Astron.Astrophys., 73, 282.
348
349        This revision:  2021 May 11
350
351        Copyright (C) 2013-2021, NumFOCUS Foundation.
352        Derived, with permission, from the SOFA library.  See notes at end of file.
353
354    """
355    c_retval = ufunc.epb(dj1, dj2)
356    return c_retval
357
358
359def epb2jd(epb):
360    """
361    Besselian Epoch to Julian Date.
362
363    Parameters
364    ----------
365    epb : double array
366
367    Returns
368    -------
369    djm0 : double array
370    djm : double array
371
372    Notes
373    -----
374    Wraps ERFA function ``eraEpb2jd``. The ERFA documentation is::
375
376        - - - - - - - - - -
377         e r a E p b 2 j d
378        - - - - - - - - - -
379
380        Besselian Epoch to Julian Date.
381
382        Given:
383           epb      double    Besselian Epoch (e.g. 1957.3)
384
385        Returned:
386           djm0     double    MJD zero-point: always 2400000.5
387           djm      double    Modified Julian Date
388
389        Note:
390
391           The Julian Date is returned in two pieces, in the usual ERFA
392           manner, which is designed to preserve time resolution.  The
393           Julian Date is available as a single number by adding djm0 and
394           djm.
395
396        Reference:
397
398           Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
399
400        This revision:  2021 May 11
401
402        Copyright (C) 2013-2021, NumFOCUS Foundation.
403        Derived, with permission, from the SOFA library.  See notes at end of file.
404
405    """
406    djm0, djm = ufunc.epb2jd(epb)
407    return djm0, djm
408
409
410def epj(dj1, dj2):
411    """
412    Julian Date to Julian Epoch.
413
414    Parameters
415    ----------
416    dj1 : double array
417    dj2 : double array
418
419    Returns
420    -------
421    c_retval : double array
422
423    Notes
424    -----
425    Wraps ERFA function ``eraEpj``. The ERFA documentation is::
426
427        - - - - - - -
428         e r a E p j
429        - - - - - - -
430
431        Julian Date to Julian Epoch.
432
433        Given:
434           dj1,dj2    double     Julian Date (see note)
435
436        Returned (function value):
437                      double     Julian Epoch
438
439        Note:
440
441           The Julian Date is supplied in two pieces, in the usual ERFA
442           manner, which is designed to preserve time resolution.  The
443           Julian Date is available as a single number by adding dj1 and
444           dj2.  The maximum resolution is achieved if dj1 is 2451545.0
445           (J2000.0).
446
447        Reference:
448
449           Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
450
451        This revision:  2021 May 11
452
453        Copyright (C) 2013-2021, NumFOCUS Foundation.
454        Derived, with permission, from the SOFA library.  See notes at end of file.
455
456    """
457    c_retval = ufunc.epj(dj1, dj2)
458    return c_retval
459
460
461def epj2jd(epj):
462    """
463    Julian Epoch to Julian Date.
464
465    Parameters
466    ----------
467    epj : double array
468
469    Returns
470    -------
471    djm0 : double array
472    djm : double array
473
474    Notes
475    -----
476    Wraps ERFA function ``eraEpj2jd``. The ERFA documentation is::
477
478        - - - - - - - - - -
479         e r a E p j 2 j d
480        - - - - - - - - - -
481
482        Julian Epoch to Julian Date.
483
484        Given:
485           epj      double    Julian Epoch (e.g. 1996.8)
486
487        Returned:
488           djm0     double    MJD zero-point: always 2400000.5
489           djm      double    Modified Julian Date
490
491        Note:
492
493           The Julian Date is returned in two pieces, in the usual ERFA
494           manner, which is designed to preserve time resolution.  The
495           Julian Date is available as a single number by adding djm0 and
496           djm.
497
498        Reference:
499
500           Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
501
502        This revision:  2021 May 11
503
504        Copyright (C) 2013-2021, NumFOCUS Foundation.
505        Derived, with permission, from the SOFA library.  See notes at end of file.
506
507    """
508    djm0, djm = ufunc.epj2jd(epj)
509    return djm0, djm
510
511
512def jd2cal(dj1, dj2):
513    """
514    Julian Date to Gregorian year, month, day, and fraction of a day.
515
516    Parameters
517    ----------
518    dj1 : double array
519    dj2 : double array
520
521    Returns
522    -------
523    iy : int array
524    im : int array
525    id : int array
526    fd : double array
527
528    Notes
529    -----
530    Wraps ERFA function ``eraJd2cal``. The ERFA documentation is::
531
532        - - - - - - - - - -
533         e r a J d 2 c a l
534        - - - - - - - - - -
535
536        Julian Date to Gregorian year, month, day, and fraction of a day.
537
538        Given:
539           dj1,dj2   double   Julian Date (Notes 1, 2)
540
541        Returned (arguments):
542           iy        int      year
543           im        int      month
544           id        int      day
545           fd        double   fraction of day
546
547        Returned (function value):
548                     int      status:
549                                 0 = OK
550                                -1 = unacceptable date (Note 1)
551
552        Notes:
553
554        1) The earliest valid date is -68569.5 (-4900 March 1).  The
555           largest value accepted is 1e9.
556
557        2) The Julian Date is apportioned in any convenient way between
558           the arguments dj1 and dj2.  For example, JD=2450123.7 could
559           be expressed in any of these ways, among others:
560
561                  dj1             dj2
562
563               2450123.7           0.0       (JD method)
564               2451545.0       -1421.3       (J2000 method)
565               2400000.5       50123.2       (MJD method)
566               2450123.5           0.2       (date & time method)
567
568           Separating integer and fraction uses the "compensated summation"
569           algorithm of Kahan-Neumaier to preserve as much precision as
570           possible irrespective of the jd1+jd2 apportionment.
571
572        3) In early eras the conversion is from the "proleptic Gregorian
573           calendar";  no account is taken of the date(s) of adoption of
574           the Gregorian calendar, nor is the AD/BC numbering convention
575           observed.
576
577        References:
578
579           Explanatory Supplement to the Astronomical Almanac,
580           P. Kenneth Seidelmann (ed), University Science Books (1992),
581           Section 12.92 (p604).
582
583           Klein, A., A Generalized Kahan-Babuska-Summation-Algorithm.
584           Computing, 76, 279-293 (2006), Section 3.
585
586        This revision:  2021 May 11
587
588        Copyright (C) 2013-2021, NumFOCUS Foundation.
589        Derived, with permission, from the SOFA library.  See notes at end of file.
590
591    """
592    iy, im, id, fd, c_retval = ufunc.jd2cal(dj1, dj2)
593    check_errwarn(c_retval, 'jd2cal')
594    return iy, im, id, fd
595
596
597STATUS_CODES['jd2cal'] = {
598    0: 'OK',
599    -1: 'unacceptable date (Note 1)',
600}
601
602
603def jdcalf(ndp, dj1, dj2):
604    """
605    Julian Date to Gregorian Calendar, expressed in a form convenient
606    for formatting messages:  rounded to a specified precision.
607
608    Parameters
609    ----------
610    ndp : int array
611    dj1 : double array
612    dj2 : double array
613
614    Returns
615    -------
616    iymdf : int array
617
618    Notes
619    -----
620    Wraps ERFA function ``eraJdcalf``. The ERFA documentation is::
621
622        - - - - - - - - - -
623         e r a J d c a l f
624        - - - - - - - - - -
625
626        Julian Date to Gregorian Calendar, expressed in a form convenient
627        for formatting messages:  rounded to a specified precision.
628
629        Given:
630           ndp       int      number of decimal places of days in fraction
631           dj1,dj2   double   dj1+dj2 = Julian Date (Note 1)
632
633        Returned:
634           iymdf     int[4]   year, month, day, fraction in Gregorian
635                              calendar
636
637        Returned (function value):
638                     int      status:
639                                -1 = date out of range
640                                 0 = OK
641                                +1 = NDP not 0-9 (interpreted as 0)
642
643        Notes:
644
645        1) The Julian Date is apportioned in any convenient way between
646           the arguments dj1 and dj2.  For example, JD=2450123.7 could
647           be expressed in any of these ways, among others:
648
649                   dj1            dj2
650
651               2450123.7           0.0       (JD method)
652               2451545.0       -1421.3       (J2000 method)
653               2400000.5       50123.2       (MJD method)
654               2450123.5           0.2       (date & time method)
655
656        2) In early eras the conversion is from the "Proleptic Gregorian
657           Calendar";  no account is taken of the date(s) of adoption of
658           the Gregorian Calendar, nor is the AD/BC numbering convention
659           observed.
660
661        3) See also the function eraJd2cal.
662
663        4) The number of decimal places ndp should be 4 or less if internal
664           overflows are to be avoided on platforms which use 16-bit
665           integers.
666
667        Called:
668           eraJd2cal    JD to Gregorian calendar
669
670        Reference:
671
672           Explanatory Supplement to the Astronomical Almanac,
673           P. Kenneth Seidelmann (ed), University Science Books (1992),
674           Section 12.92 (p604).
675
676        This revision:  2021 May 11
677
678        Copyright (C) 2013-2021, NumFOCUS Foundation.
679        Derived, with permission, from the SOFA library.  See notes at end of file.
680
681    """
682    iymdf, c_retval = ufunc.jdcalf(ndp, dj1, dj2)
683    check_errwarn(c_retval, 'jdcalf')
684    return iymdf
685
686
687STATUS_CODES['jdcalf'] = {
688    -1: 'date out of range',
689    0: 'OK',
690    1: 'NDP not 0-9 (interpreted as 0)',
691}
692
693
694def ab(pnat, v, s, bm1):
695    """
696    Apply aberration to transform natural direction into proper
697    direction.
698
699    Parameters
700    ----------
701    pnat : double array
702    v : double array
703    s : double array
704    bm1 : double array
705
706    Returns
707    -------
708    ppr : double array
709
710    Notes
711    -----
712    Wraps ERFA function ``eraAb``. The ERFA documentation is::
713
714        - - - - - -
715         e r a A b
716        - - - - - -
717
718        Apply aberration to transform natural direction into proper
719        direction.
720
721        Given:
722          pnat    double[3]   natural direction to the source (unit vector)
723          v       double[3]   observer barycentric velocity in units of c
724          s       double      distance between the Sun and the observer (au)
725          bm1     double      sqrt(1-|v|^2): reciprocal of Lorenz factor
726
727        Returned:
728          ppr     double[3]   proper direction to source (unit vector)
729
730        Notes:
731
732        1) The algorithm is based on Expr. (7.40) in the Explanatory
733           Supplement (Urban & Seidelmann 2013), but with the following
734           changes:
735
736           o  Rigorous rather than approximate normalization is applied.
737
738           o  The gravitational potential term from Expr. (7) in
739              Klioner (2003) is added, taking into account only the Sun's
740              contribution.  This has a maximum effect of about
741              0.4 microarcsecond.
742
743        2) In almost all cases, the maximum accuracy will be limited by the
744           supplied velocity.  For example, if the ERFA eraEpv00 function is
745           used, errors of up to 5 microarcseconds could occur.
746
747        References:
748
749           Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
750           the Astronomical Almanac, 3rd ed., University Science Books
751           (2013).
752
753           Klioner, Sergei A., "A practical relativistic model for micro-
754           arcsecond astrometry in space", Astr. J. 125, 1580-1597 (2003).
755
756        Called:
757           eraPdp       scalar product of two p-vectors
758
759        This revision:   2021 February 24
760
761        Copyright (C) 2013-2021, NumFOCUS Foundation.
762        Derived, with permission, from the SOFA library.  See notes at end of file.
763
764    """
765    ppr = ufunc.ab(pnat, v, s, bm1)
766    return ppr
767
768
769def apcg(date1, date2, ebpv, ehp):
770    """
771    For a geocentric observer, prepare star-independent astrometry
772    parameters for transformations between ICRS and GCRS coordinates.
773
774    Parameters
775    ----------
776    date1 : double array
777    date2 : double array
778    ebpv : double array
779    ehp : double array
780
781    Returns
782    -------
783    astrom : eraASTROM array
784
785    Notes
786    -----
787    Wraps ERFA function ``eraApcg``. The ERFA documentation is::
788
789        - - - - - - - -
790         e r a A p c g
791        - - - - - - - -
792
793        For a geocentric observer, prepare star-independent astrometry
794        parameters for transformations between ICRS and GCRS coordinates.
795        The Earth ephemeris is supplied by the caller.
796
797        The parameters produced by this function are required in the
798        parallax, light deflection and aberration parts of the astrometric
799        transformation chain.
800
801        Given:
802           date1  double       TDB as a 2-part...
803           date2  double       ...Julian Date (Note 1)
804           ebpv   double[2][3] Earth barycentric pos/vel (au, au/day)
805           ehp    double[3]    Earth heliocentric position (au)
806
807        Returned:
808           astrom eraASTROM         star-independent astrometry parameters:
809            pmt    double       PM time interval (SSB, Julian years)
810            eb     double[3]    SSB to observer (vector, au)
811            eh     double[3]    Sun to observer (unit vector)
812            em     double       distance from Sun to observer (au)
813            v      double[3]    barycentric observer velocity (vector, c)
814            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
815            bpn    double[3][3] bias-precession-nutation matrix
816            along  double       unchanged
817            xpl    double       unchanged
818            ypl    double       unchanged
819            sphi   double       unchanged
820            cphi   double       unchanged
821            diurab double       unchanged
822            eral   double       unchanged
823            refa   double       unchanged
824            refb   double       unchanged
825
826        Notes:
827
828        1) The TDB date date1+date2 is a Julian Date, apportioned in any
829           convenient way between the two arguments.  For example,
830           JD(TDB)=2450123.7 could be expressed in any of these ways, among
831           others:
832
833                  date1          date2
834
835               2450123.7           0.0       (JD method)
836               2451545.0       -1421.3       (J2000 method)
837               2400000.5       50123.2       (MJD method)
838               2450123.5           0.2       (date & time method)
839
840           The JD method is the most natural and convenient to use in cases
841           where the loss of several decimal digits of resolution is
842           acceptable.  The J2000 method is best matched to the way the
843           argument is handled internally and will deliver the optimum
844           resolution.  The MJD method and the date & time methods are both
845           good compromises between resolution and convenience.  For most
846           applications of this function the choice will not be at all
847           critical.
848
849           TT can be used instead of TDB without any significant impact on
850           accuracy.
851
852        2) All the vectors are with respect to BCRS axes.
853
854        3) This is one of several functions that inserts into the astrom
855           structure star-independent parameters needed for the chain of
856           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
857
858           The various functions support different classes of observer and
859           portions of the transformation chain:
860
861                functions         observer        transformation
862
863             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
864             eraApci eraApci13    terrestrial     ICRS <-> CIRS
865             eraApco eraApco13    terrestrial     ICRS <-> observed
866             eraApcs eraApcs13    space           ICRS <-> GCRS
867             eraAper eraAper13    terrestrial     update Earth rotation
868             eraApio eraApio13    terrestrial     CIRS <-> observed
869
870           Those with names ending in "13" use contemporary ERFA models to
871           compute the various ephemerides.  The others accept ephemerides
872           supplied by the caller.
873
874           The transformation from ICRS to GCRS covers space motion,
875           parallax, light deflection, and aberration.  From GCRS to CIRS
876           comprises frame bias and precession-nutation.  From CIRS to
877           observed takes account of Earth rotation, polar motion, diurnal
878           aberration and parallax (unless subsumed into the ICRS <-> GCRS
879           transformation), and atmospheric refraction.
880
881        4) The context structure astrom produced by this function is used by
882           eraAtciq* and eraAticq*.
883
884        Called:
885           eraApcs      astrometry parameters, ICRS-GCRS, space observer
886
887        This revision:   2013 October 9
888
889        Copyright (C) 2013-2021, NumFOCUS Foundation.
890        Derived, with permission, from the SOFA library.  See notes at end of file.
891
892    """
893    astrom = ufunc.apcg(date1, date2, ebpv, ehp)
894    return astrom
895
896
897def apcg13(date1, date2):
898    """
899    For a geocentric observer, prepare star-independent astrometry
900    parameters for transformations between ICRS and GCRS coordinates.
901
902    Parameters
903    ----------
904    date1 : double array
905    date2 : double array
906
907    Returns
908    -------
909    astrom : eraASTROM array
910
911    Notes
912    -----
913    Wraps ERFA function ``eraApcg13``. The ERFA documentation is::
914
915        - - - - - - - - - -
916         e r a A p c g 1 3
917        - - - - - - - - - -
918
919        For a geocentric observer, prepare star-independent astrometry
920        parameters for transformations between ICRS and GCRS coordinates.
921        The caller supplies the date, and ERFA models are used to predict
922        the Earth ephemeris.
923
924        The parameters produced by this function are required in the
925        parallax, light deflection and aberration parts of the astrometric
926        transformation chain.
927
928        Given:
929           date1  double     TDB as a 2-part...
930           date2  double     ...Julian Date (Note 1)
931
932        Returned:
933           astrom eraASTROM* star-independent astrometry parameters:
934            pmt    double       PM time interval (SSB, Julian years)
935            eb     double[3]    SSB to observer (vector, au)
936            eh     double[3]    Sun to observer (unit vector)
937            em     double       distance from Sun to observer (au)
938            v      double[3]    barycentric observer velocity (vector, c)
939            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
940            bpn    double[3][3] bias-precession-nutation matrix
941            along  double       unchanged
942            xpl    double       unchanged
943            ypl    double       unchanged
944            sphi   double       unchanged
945            cphi   double       unchanged
946            diurab double       unchanged
947            eral   double       unchanged
948            refa   double       unchanged
949            refb   double       unchanged
950
951        Notes:
952
953        1) The TDB date date1+date2 is a Julian Date, apportioned in any
954           convenient way between the two arguments.  For example,
955           JD(TDB)=2450123.7 could be expressed in any of these ways, among
956           others:
957
958                  date1          date2
959
960               2450123.7           0.0       (JD method)
961               2451545.0       -1421.3       (J2000 method)
962               2400000.5       50123.2       (MJD method)
963               2450123.5           0.2       (date & time method)
964
965           The JD method is the most natural and convenient to use in cases
966           where the loss of several decimal digits of resolution is
967           acceptable.  The J2000 method is best matched to the way the
968           argument is handled internally and will deliver the optimum
969           resolution.  The MJD method and the date & time methods are both
970           good compromises between resolution and convenience.  For most
971           applications of this function the choice will not be at all
972           critical.
973
974           TT can be used instead of TDB without any significant impact on
975           accuracy.
976
977        2) All the vectors are with respect to BCRS axes.
978
979        3) In cases where the caller wishes to supply his own Earth
980           ephemeris, the function eraApcg can be used instead of the present
981           function.
982
983        4) This is one of several functions that inserts into the astrom
984           structure star-independent parameters needed for the chain of
985           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
986
987           The various functions support different classes of observer and
988           portions of the transformation chain:
989
990                functions         observer        transformation
991
992             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
993             eraApci eraApci13    terrestrial     ICRS <-> CIRS
994             eraApco eraApco13    terrestrial     ICRS <-> observed
995             eraApcs eraApcs13    space           ICRS <-> GCRS
996             eraAper eraAper13    terrestrial     update Earth rotation
997             eraApio eraApio13    terrestrial     CIRS <-> observed
998
999           Those with names ending in "13" use contemporary ERFA models to
1000           compute the various ephemerides.  The others accept ephemerides
1001           supplied by the caller.
1002
1003           The transformation from ICRS to GCRS covers space motion,
1004           parallax, light deflection, and aberration.  From GCRS to CIRS
1005           comprises frame bias and precession-nutation.  From CIRS to
1006           observed takes account of Earth rotation, polar motion, diurnal
1007           aberration and parallax (unless subsumed into the ICRS <-> GCRS
1008           transformation), and atmospheric refraction.
1009
1010        5) The context structure astrom produced by this function is used by
1011           eraAtciq* and eraAticq*.
1012
1013        Called:
1014           eraEpv00     Earth position and velocity
1015           eraApcg      astrometry parameters, ICRS-GCRS, geocenter
1016
1017        This revision:   2013 October 9
1018
1019        Copyright (C) 2013-2021, NumFOCUS Foundation.
1020        Derived, with permission, from the SOFA library.  See notes at end of file.
1021
1022    """
1023    astrom = ufunc.apcg13(date1, date2)
1024    return astrom
1025
1026
1027def apci(date1, date2, ebpv, ehp, x, y, s):
1028    """
1029    For a terrestrial observer, prepare star-independent astrometry
1030    parameters for transformations between ICRS and geocentric CIRS
1031    coordinates.
1032
1033    Parameters
1034    ----------
1035    date1 : double array
1036    date2 : double array
1037    ebpv : double array
1038    ehp : double array
1039    x : double array
1040    y : double array
1041    s : double array
1042
1043    Returns
1044    -------
1045    astrom : eraASTROM array
1046
1047    Notes
1048    -----
1049    Wraps ERFA function ``eraApci``. The ERFA documentation is::
1050
1051        - - - - - - - -
1052         e r a A p c i
1053        - - - - - - - -
1054
1055        For a terrestrial observer, prepare star-independent astrometry
1056        parameters for transformations between ICRS and geocentric CIRS
1057        coordinates.  The Earth ephemeris and CIP/CIO are supplied by the
1058        caller.
1059
1060        The parameters produced by this function are required in the
1061        parallax, light deflection, aberration, and bias-precession-nutation
1062        parts of the astrometric transformation chain.
1063
1064        Given:
1065           date1  double       TDB as a 2-part...
1066           date2  double       ...Julian Date (Note 1)
1067           ebpv   double[2][3] Earth barycentric position/velocity (au, au/day)
1068           ehp    double[3]    Earth heliocentric position (au)
1069           x,y    double       CIP X,Y (components of unit vector)
1070           s      double       the CIO locator s (radians)
1071
1072        Returned:
1073           astrom eraASTROM         star-independent astrometry parameters:
1074            pmt    double       PM time interval (SSB, Julian years)
1075            eb     double[3]    SSB to observer (vector, au)
1076            eh     double[3]    Sun to observer (unit vector)
1077            em     double       distance from Sun to observer (au)
1078            v      double[3]    barycentric observer velocity (vector, c)
1079            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
1080            bpn    double[3][3] bias-precession-nutation matrix
1081            along  double       unchanged
1082            xpl    double       unchanged
1083            ypl    double       unchanged
1084            sphi   double       unchanged
1085            cphi   double       unchanged
1086            diurab double       unchanged
1087            eral   double       unchanged
1088            refa   double       unchanged
1089            refb   double       unchanged
1090
1091        Notes:
1092
1093        1) The TDB date date1+date2 is a Julian Date, apportioned in any
1094           convenient way between the two arguments.  For example,
1095           JD(TDB)=2450123.7 could be expressed in any of these ways, among
1096           others:
1097
1098                  date1          date2
1099
1100               2450123.7           0.0       (JD method)
1101               2451545.0       -1421.3       (J2000 method)
1102               2400000.5       50123.2       (MJD method)
1103               2450123.5           0.2       (date & time method)
1104
1105           The JD method is the most natural and convenient to use in cases
1106           where the loss of several decimal digits of resolution is
1107           acceptable.  The J2000 method is best matched to the way the
1108           argument is handled internally and will deliver the optimum
1109           resolution.  The MJD method and the date & time methods are both
1110           good compromises between resolution and convenience.  For most
1111           applications of this function the choice will not be at all
1112           critical.
1113
1114           TT can be used instead of TDB without any significant impact on
1115           accuracy.
1116
1117        2) All the vectors are with respect to BCRS axes.
1118
1119        3) In cases where the caller does not wish to provide the Earth
1120           ephemeris and CIP/CIO, the function eraApci13 can be used instead
1121           of the present function.  This computes the required quantities
1122           using other ERFA functions.
1123
1124        4) This is one of several functions that inserts into the astrom
1125           structure star-independent parameters needed for the chain of
1126           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
1127
1128           The various functions support different classes of observer and
1129           portions of the transformation chain:
1130
1131                functions         observer        transformation
1132
1133             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
1134             eraApci eraApci13    terrestrial     ICRS <-> CIRS
1135             eraApco eraApco13    terrestrial     ICRS <-> observed
1136             eraApcs eraApcs13    space           ICRS <-> GCRS
1137             eraAper eraAper13    terrestrial     update Earth rotation
1138             eraApio eraApio13    terrestrial     CIRS <-> observed
1139
1140           Those with names ending in "13" use contemporary ERFA models to
1141           compute the various ephemerides.  The others accept ephemerides
1142           supplied by the caller.
1143
1144           The transformation from ICRS to GCRS covers space motion,
1145           parallax, light deflection, and aberration.  From GCRS to CIRS
1146           comprises frame bias and precession-nutation.  From CIRS to
1147           observed takes account of Earth rotation, polar motion, diurnal
1148           aberration and parallax (unless subsumed into the ICRS <-> GCRS
1149           transformation), and atmospheric refraction.
1150
1151        5) The context structure astrom produced by this function is used by
1152           eraAtciq* and eraAticq*.
1153
1154        Called:
1155           eraApcg      astrometry parameters, ICRS-GCRS, geocenter
1156           eraC2ixys    celestial-to-intermediate matrix, given X,Y and s
1157
1158        This revision:   2013 September 25
1159
1160        Copyright (C) 2013-2021, NumFOCUS Foundation.
1161        Derived, with permission, from the SOFA library.  See notes at end of file.
1162
1163    """
1164    astrom = ufunc.apci(date1, date2, ebpv, ehp, x, y, s)
1165    return astrom
1166
1167
1168def apci13(date1, date2):
1169    """
1170    For a terrestrial observer, prepare star-independent astrometry
1171    parameters for transformations between ICRS and geocentric CIRS
1172    coordinates.
1173
1174    Parameters
1175    ----------
1176    date1 : double array
1177    date2 : double array
1178
1179    Returns
1180    -------
1181    astrom : eraASTROM array
1182    eo : double array
1183
1184    Notes
1185    -----
1186    Wraps ERFA function ``eraApci13``. The ERFA documentation is::
1187
1188        - - - - - - - - - -
1189         e r a A p c i 1 3
1190        - - - - - - - - - -
1191
1192        For a terrestrial observer, prepare star-independent astrometry
1193        parameters for transformations between ICRS and geocentric CIRS
1194        coordinates.  The caller supplies the date, and ERFA models are used
1195        to predict the Earth ephemeris and CIP/CIO.
1196
1197        The parameters produced by this function are required in the
1198        parallax, light deflection, aberration, and bias-precession-nutation
1199        parts of the astrometric transformation chain.
1200
1201        Given:
1202           date1  double      TDB as a 2-part...
1203           date2  double      ...Julian Date (Note 1)
1204
1205        Returned:
1206           astrom eraASTROM        star-independent astrometry parameters:
1207            pmt    double       PM time interval (SSB, Julian years)
1208            eb     double[3]    SSB to observer (vector, au)
1209            eh     double[3]    Sun to observer (unit vector)
1210            em     double       distance from Sun to observer (au)
1211            v      double[3]    barycentric observer velocity (vector, c)
1212            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
1213            bpn    double[3][3] bias-precession-nutation matrix
1214            along  double       unchanged
1215            xpl    double       unchanged
1216            ypl    double       unchanged
1217            sphi   double       unchanged
1218            cphi   double       unchanged
1219            diurab double       unchanged
1220            eral   double       unchanged
1221            refa   double       unchanged
1222            refb   double       unchanged
1223           eo     double           equation of the origins (ERA-GST)
1224
1225        Notes:
1226
1227        1) The TDB date date1+date2 is a Julian Date, apportioned in any
1228           convenient way between the two arguments.  For example,
1229           JD(TDB)=2450123.7 could be expressed in any of these ways, among
1230           others:
1231
1232                  date1          date2
1233
1234               2450123.7           0.0       (JD method)
1235               2451545.0       -1421.3       (J2000 method)
1236               2400000.5       50123.2       (MJD method)
1237               2450123.5           0.2       (date & time method)
1238
1239           The JD method is the most natural and convenient to use in cases
1240           where the loss of several decimal digits of resolution is
1241           acceptable.  The J2000 method is best matched to the way the
1242           argument is handled internally and will deliver the optimum
1243           resolution.  The MJD method and the date & time methods are both
1244           good compromises between resolution and convenience.  For most
1245           applications of this function the choice will not be at all
1246           critical.
1247
1248           TT can be used instead of TDB without any significant impact on
1249           accuracy.
1250
1251        2) All the vectors are with respect to BCRS axes.
1252
1253        3) In cases where the caller wishes to supply his own Earth
1254           ephemeris and CIP/CIO, the function eraApci can be used instead
1255           of the present function.
1256
1257        4) This is one of several functions that inserts into the astrom
1258           structure star-independent parameters needed for the chain of
1259           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
1260
1261           The various functions support different classes of observer and
1262           portions of the transformation chain:
1263
1264                functions         observer        transformation
1265
1266             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
1267             eraApci eraApci13    terrestrial     ICRS <-> CIRS
1268             eraApco eraApco13    terrestrial     ICRS <-> observed
1269             eraApcs eraApcs13    space           ICRS <-> GCRS
1270             eraAper eraAper13    terrestrial     update Earth rotation
1271             eraApio eraApio13    terrestrial     CIRS <-> observed
1272
1273           Those with names ending in "13" use contemporary ERFA models to
1274           compute the various ephemerides.  The others accept ephemerides
1275           supplied by the caller.
1276
1277           The transformation from ICRS to GCRS covers space motion,
1278           parallax, light deflection, and aberration.  From GCRS to CIRS
1279           comprises frame bias and precession-nutation.  From CIRS to
1280           observed takes account of Earth rotation, polar motion, diurnal
1281           aberration and parallax (unless subsumed into the ICRS <-> GCRS
1282           transformation), and atmospheric refraction.
1283
1284        5) The context structure astrom produced by this function is used by
1285           eraAtciq* and eraAticq*.
1286
1287        Called:
1288           eraEpv00     Earth position and velocity
1289           eraPnm06a    classical NPB matrix, IAU 2006/2000A
1290           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
1291           eraS06       the CIO locator s, given X,Y, IAU 2006
1292           eraApci      astrometry parameters, ICRS-CIRS
1293           eraEors      equation of the origins, given NPB matrix and s
1294
1295        This revision:   2013 October 9
1296
1297        Copyright (C) 2013-2021, NumFOCUS Foundation.
1298        Derived, with permission, from the SOFA library.  See notes at end of file.
1299
1300    """
1301    astrom, eo = ufunc.apci13(date1, date2)
1302    return astrom, eo
1303
1304
1305def apco(date1, date2, ebpv, ehp, x, y, s, theta, elong, phi, hm, xp, yp, sp, refa, refb):
1306    """
1307    For a terrestrial observer, prepare star-independent astrometry
1308    parameters for transformations between ICRS and observed
1309    coordinates.
1310
1311    Parameters
1312    ----------
1313    date1 : double array
1314    date2 : double array
1315    ebpv : double array
1316    ehp : double array
1317    x : double array
1318    y : double array
1319    s : double array
1320    theta : double array
1321    elong : double array
1322    phi : double array
1323    hm : double array
1324    xp : double array
1325    yp : double array
1326    sp : double array
1327    refa : double array
1328    refb : double array
1329
1330    Returns
1331    -------
1332    astrom : eraASTROM array
1333
1334    Notes
1335    -----
1336    Wraps ERFA function ``eraApco``. The ERFA documentation is::
1337
1338        - - - - - - - -
1339         e r a A p c o
1340        - - - - - - - -
1341
1342        For a terrestrial observer, prepare star-independent astrometry
1343        parameters for transformations between ICRS and observed
1344        coordinates.  The caller supplies the Earth ephemeris, the Earth
1345        rotation information and the refraction constants as well as the
1346        site coordinates.
1347
1348        Given:
1349           date1  double       TDB as a 2-part...
1350           date2  double       ...Julian Date (Note 1)
1351           ebpv   double[2][3] Earth barycentric PV (au, au/day, Note 2)
1352           ehp    double[3]    Earth heliocentric P (au, Note 2)
1353           x,y    double       CIP X,Y (components of unit vector)
1354           s      double       the CIO locator s (radians)
1355           theta  double       Earth rotation angle (radians)
1356           elong  double       longitude (radians, east +ve, Note 3)
1357           phi    double       latitude (geodetic, radians, Note 3)
1358           hm     double       height above ellipsoid (m, geodetic, Note 3)
1359           xp,yp  double       polar motion coordinates (radians, Note 4)
1360           sp     double       the TIO locator s' (radians, Note 4)
1361           refa   double       refraction constant A (radians, Note 5)
1362           refb   double       refraction constant B (radians, Note 5)
1363
1364        Returned:
1365           astrom eraASTROM         star-independent astrometry parameters:
1366            pmt    double       PM time interval (SSB, Julian years)
1367            eb     double[3]    SSB to observer (vector, au)
1368            eh     double[3]    Sun to observer (unit vector)
1369            em     double       distance from Sun to observer (au)
1370            v      double[3]    barycentric observer velocity (vector, c)
1371            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
1372            bpn    double[3][3] bias-precession-nutation matrix
1373            along  double       adjusted longitude (radians)
1374            xpl    double       polar motion xp wrt local meridian (radians)
1375            ypl    double       polar motion yp wrt local meridian (radians)
1376            sphi   double       sine of geodetic latitude
1377            cphi   double       cosine of geodetic latitude
1378            diurab double       magnitude of diurnal aberration vector
1379            eral   double       "local" Earth rotation angle (radians)
1380            refa   double       refraction constant A (radians)
1381            refb   double       refraction constant B (radians)
1382
1383        Notes:
1384
1385        1) The TDB date date1+date2 is a Julian Date, apportioned in any
1386           convenient way between the two arguments.  For example,
1387           JD(TDB)=2450123.7 could be expressed in any of these ways, among
1388           others:
1389
1390                  date1          date2
1391
1392               2450123.7           0.0       (JD method)
1393               2451545.0       -1421.3       (J2000 method)
1394               2400000.5       50123.2       (MJD method)
1395               2450123.5           0.2       (date & time method)
1396
1397           The JD method is the most natural and convenient to use in cases
1398           where the loss of several decimal digits of resolution is
1399           acceptable.  The J2000 method is best matched to the way the
1400           argument is handled internally and will deliver the optimum
1401           resolution.  The MJD method and the date & time methods are both
1402           good compromises between resolution and convenience.  For most
1403           applications of this function the choice will not be at all
1404           critical.
1405
1406           TT can be used instead of TDB without any significant impact on
1407           accuracy.
1408
1409        2) The vectors eb, eh, and all the astrom vectors, are with respect
1410           to BCRS axes.
1411
1412        3) The geographical coordinates are with respect to the ERFA_WGS84
1413           reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN
1414           CONVENTION:  the longitude required by the present function is
1415           right-handed, i.e. east-positive, in accordance with geographical
1416           convention.
1417
1418           The adjusted longitude stored in the astrom array takes into
1419           account the TIO locator and polar motion.
1420
1421        4) xp and yp are the coordinates (in radians) of the Celestial
1422           Intermediate Pole with respect to the International Terrestrial
1423           Reference System (see IERS Conventions), measured along the
1424           meridians 0 and 90 deg west respectively.  sp is the TIO locator
1425           s', in radians, which positions the Terrestrial Intermediate
1426           Origin on the equator.  For many applications, xp, yp and
1427           (especially) sp can be set to zero.
1428
1429           Internally, the polar motion is stored in a form rotated onto the
1430           local meridian.
1431
1432        5) The refraction constants refa and refb are for use in a
1433           dZ = A*tan(Z)+B*tan^3(Z) model, where Z is the observed
1434           (i.e. refracted) zenith distance and dZ is the amount of
1435           refraction.
1436
1437        6) It is advisable to take great care with units, as even unlikely
1438           values of the input parameters are accepted and processed in
1439           accordance with the models used.
1440
1441        7) In cases where the caller does not wish to provide the Earth
1442           Ephemeris, the Earth rotation information and refraction
1443           constants, the function eraApco13 can be used instead of the
1444           present function.  This starts from UTC and weather readings etc.
1445           and computes suitable values using other ERFA functions.
1446
1447        8) This is one of several functions that inserts into the astrom
1448           structure star-independent parameters needed for the chain of
1449           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
1450
1451           The various functions support different classes of observer and
1452           portions of the transformation chain:
1453
1454                functions         observer        transformation
1455
1456             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
1457             eraApci eraApci13    terrestrial     ICRS <-> CIRS
1458             eraApco eraApco13    terrestrial     ICRS <-> observed
1459             eraApcs eraApcs13    space           ICRS <-> GCRS
1460             eraAper eraAper13    terrestrial     update Earth rotation
1461             eraApio eraApio13    terrestrial     CIRS <-> observed
1462
1463           Those with names ending in "13" use contemporary ERFA models to
1464           compute the various ephemerides.  The others accept ephemerides
1465           supplied by the caller.
1466
1467           The transformation from ICRS to GCRS covers space motion,
1468           parallax, light deflection, and aberration.  From GCRS to CIRS
1469           comprises frame bias and precession-nutation.  From CIRS to
1470           observed takes account of Earth rotation, polar motion, diurnal
1471           aberration and parallax (unless subsumed into the ICRS <-> GCRS
1472           transformation), and atmospheric refraction.
1473
1474        9) The context structure astrom produced by this function is used by
1475           eraAtioq, eraAtoiq, eraAtciq* and eraAticq*.
1476
1477        Called:
1478           eraIr        initialize r-matrix to identity
1479           eraRz        rotate around Z-axis
1480           eraRy        rotate around Y-axis
1481           eraRx        rotate around X-axis
1482           eraAnpm      normalize angle into range +/- pi
1483           eraC2ixys    celestial-to-intermediate matrix, given X,Y and s
1484           eraPvtob     position/velocity of terrestrial station
1485           eraTrxpv     product of transpose of r-matrix and pv-vector
1486           eraApcs      astrometry parameters, ICRS-GCRS, space observer
1487           eraCr        copy r-matrix
1488
1489        This revision:   2021 February 24
1490
1491        Copyright (C) 2013-2021, NumFOCUS Foundation.
1492        Derived, with permission, from the SOFA library.  See notes at end of file.
1493
1494    """
1495    astrom = ufunc.apco(
1496        date1, date2, ebpv, ehp, x, y, s, theta, elong, phi, hm, xp, yp, sp, refa, refb)
1497    return astrom
1498
1499
1500def apco13(utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl):
1501    """
1502    For a terrestrial observer, prepare star-independent astrometry
1503    parameters for transformations between ICRS and observed
1504    coordinates.
1505
1506    Parameters
1507    ----------
1508    utc1 : double array
1509    utc2 : double array
1510    dut1 : double array
1511    elong : double array
1512    phi : double array
1513    hm : double array
1514    xp : double array
1515    yp : double array
1516    phpa : double array
1517    tc : double array
1518    rh : double array
1519    wl : double array
1520
1521    Returns
1522    -------
1523    astrom : eraASTROM array
1524    eo : double array
1525
1526    Notes
1527    -----
1528    Wraps ERFA function ``eraApco13``. The ERFA documentation is::
1529
1530        - - - - - - - - - -
1531         e r a A p c o 1 3
1532        - - - - - - - - - -
1533
1534        For a terrestrial observer, prepare star-independent astrometry
1535        parameters for transformations between ICRS and observed
1536        coordinates.  The caller supplies UTC, site coordinates, ambient air
1537        conditions and observing wavelength, and ERFA models are used to
1538        obtain the Earth ephemeris, CIP/CIO and refraction constants.
1539
1540        The parameters produced by this function are required in the
1541        parallax, light deflection, aberration, and bias-precession-nutation
1542        parts of the ICRS/CIRS transformations.
1543
1544        Given:
1545           utc1   double     UTC as a 2-part...
1546           utc2   double     ...quasi Julian Date (Notes 1,2)
1547           dut1   double     UT1-UTC (seconds, Note 3)
1548           elong  double     longitude (radians, east +ve, Note 4)
1549           phi    double     latitude (geodetic, radians, Note 4)
1550           hm     double     height above ellipsoid (m, geodetic, Notes 4,6)
1551           xp,yp  double     polar motion coordinates (radians, Note 5)
1552           phpa   double     pressure at the observer (hPa = mB, Note 6)
1553           tc     double     ambient temperature at the observer (deg C)
1554           rh     double     relative humidity at the observer (range 0-1)
1555           wl     double     wavelength (micrometers, Note 7)
1556
1557        Returned:
1558           astrom eraASTROM* star-independent astrometry parameters:
1559            pmt    double       PM time interval (SSB, Julian years)
1560            eb     double[3]    SSB to observer (vector, au)
1561            eh     double[3]    Sun to observer (unit vector)
1562            em     double       distance from Sun to observer (au)
1563            v      double[3]    barycentric observer velocity (vector, c)
1564            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
1565            bpn    double[3][3] bias-precession-nutation matrix
1566            along  double       longitude + s' (radians)
1567            xpl    double       polar motion xp wrt local meridian (radians)
1568            ypl    double       polar motion yp wrt local meridian (radians)
1569            sphi   double       sine of geodetic latitude
1570            cphi   double       cosine of geodetic latitude
1571            diurab double       magnitude of diurnal aberration vector
1572            eral   double       "local" Earth rotation angle (radians)
1573            refa   double       refraction constant A (radians)
1574            refb   double       refraction constant B (radians)
1575           eo     double          equation of the origins (ERA-GST)
1576
1577        Returned (function value):
1578                  int        status: +1 = dubious year (Note 2)
1579                                      0 = OK
1580                                     -1 = unacceptable date
1581
1582        Notes:
1583
1584        1)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
1585            convenient way between the two arguments, for example where utc1
1586            is the Julian Day Number and utc2 is the fraction of a day.
1587
1588            However, JD cannot unambiguously represent UTC during a leap
1589            second unless special measures are taken.  The convention in the
1590            present function is that the JD day represents UTC days whether
1591            the length is 86399, 86400 or 86401 SI seconds.
1592
1593            Applications should use the function eraDtf2d to convert from
1594            calendar date and time of day into 2-part quasi Julian Date, as
1595            it implements the leap-second-ambiguity convention just
1596            described.
1597
1598        2)  The warning status "dubious year" flags UTCs that predate the
1599            introduction of the time scale or that are too far in the
1600            future to be trusted.  See eraDat for further details.
1601
1602        3)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
1603            one second at the end of each positive UTC leap second,
1604            introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
1605            practice is under review, and in the future UT1-UTC may grow
1606            essentially without limit.
1607
1608        4)  The geographical coordinates are with respect to the ERFA_WGS84
1609            reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
1610            longitude required by the present function is east-positive
1611            (i.e. right-handed), in accordance with geographical convention.
1612
1613        5)  The polar motion xp,yp can be obtained from IERS bulletins.  The
1614            values are the coordinates (in radians) of the Celestial
1615            Intermediate Pole with respect to the International Terrestrial
1616            Reference System (see IERS Conventions 2003), measured along the
1617            meridians 0 and 90 deg west respectively.  For many
1618            applications, xp and yp can be set to zero.
1619
1620            Internally, the polar motion is stored in a form rotated onto
1621            the local meridian.
1622
1623        6)  If hm, the height above the ellipsoid of the observing station
1624            in meters, is not known but phpa, the pressure in hPa (=mB), is
1625            available, an adequate estimate of hm can be obtained from the
1626            expression
1627
1628                  hm = -29.3 * tsl * log ( phpa / 1013.25 );
1629
1630            where tsl is the approximate sea-level air temperature in K
1631            (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
1632            52).  Similarly, if the pressure phpa is not known, it can be
1633            estimated from the height of the observing station, hm, as
1634            follows:
1635
1636                  phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
1637
1638            Note, however, that the refraction is nearly proportional to
1639            the pressure and that an accurate phpa value is important for
1640            precise work.
1641
1642        7)  The argument wl specifies the observing wavelength in
1643            micrometers.  The transition from optical to radio is assumed to
1644            occur at 100 micrometers (about 3000 GHz).
1645
1646        8)  It is advisable to take great care with units, as even unlikely
1647            values of the input parameters are accepted and processed in
1648            accordance with the models used.
1649
1650        9)  In cases where the caller wishes to supply his own Earth
1651            ephemeris, Earth rotation information and refraction constants,
1652            the function eraApco can be used instead of the present function.
1653
1654        10) This is one of several functions that inserts into the astrom
1655            structure star-independent parameters needed for the chain of
1656            astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
1657
1658            The various functions support different classes of observer and
1659            portions of the transformation chain:
1660
1661                functions         observer        transformation
1662
1663             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
1664             eraApci eraApci13    terrestrial     ICRS <-> CIRS
1665             eraApco eraApco13    terrestrial     ICRS <-> observed
1666             eraApcs eraApcs13    space           ICRS <-> GCRS
1667             eraAper eraAper13    terrestrial     update Earth rotation
1668             eraApio eraApio13    terrestrial     CIRS <-> observed
1669
1670            Those with names ending in "13" use contemporary ERFA models to
1671            compute the various ephemerides.  The others accept ephemerides
1672            supplied by the caller.
1673
1674            The transformation from ICRS to GCRS covers space motion,
1675            parallax, light deflection, and aberration.  From GCRS to CIRS
1676            comprises frame bias and precession-nutation.  From CIRS to
1677            observed takes account of Earth rotation, polar motion, diurnal
1678            aberration and parallax (unless subsumed into the ICRS <-> GCRS
1679            transformation), and atmospheric refraction.
1680
1681        11) The context structure astrom produced by this function is used
1682            by eraAtioq, eraAtoiq, eraAtciq* and eraAticq*.
1683
1684        Called:
1685           eraUtctai    UTC to TAI
1686           eraTaitt     TAI to TT
1687           eraUtcut1    UTC to UT1
1688           eraEpv00     Earth position and velocity
1689           eraPnm06a    classical NPB matrix, IAU 2006/2000A
1690           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
1691           eraS06       the CIO locator s, given X,Y, IAU 2006
1692           eraEra00     Earth rotation angle, IAU 2000
1693           eraSp00      the TIO locator s', IERS 2000
1694           eraRefco     refraction constants for given ambient conditions
1695           eraApco      astrometry parameters, ICRS-observed
1696           eraEors      equation of the origins, given NPB matrix and s
1697
1698        This revision:   2021 February 24
1699
1700        Copyright (C) 2013-2021, NumFOCUS Foundation.
1701        Derived, with permission, from the SOFA library.  See notes at end of file.
1702
1703    """
1704    astrom, eo, c_retval = ufunc.apco13(
1705        utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl)
1706    check_errwarn(c_retval, 'apco13')
1707    return astrom, eo
1708
1709
1710STATUS_CODES['apco13'] = {
1711    1: 'dubious year (Note 2)',
1712    0: 'OK',
1713    -1: 'unacceptable date',
1714}
1715
1716
1717def apcs(date1, date2, pv, ebpv, ehp):
1718    """
1719    For an observer whose geocentric position and velocity are known,
1720    prepare star-independent astrometry parameters for transformations
1721    between ICRS and GCRS.
1722
1723    Parameters
1724    ----------
1725    date1 : double array
1726    date2 : double array
1727    pv : double array
1728    ebpv : double array
1729    ehp : double array
1730
1731    Returns
1732    -------
1733    astrom : eraASTROM array
1734
1735    Notes
1736    -----
1737    Wraps ERFA function ``eraApcs``. The ERFA documentation is::
1738
1739        - - - - - - - -
1740         e r a A p c s
1741        - - - - - - - -
1742
1743        For an observer whose geocentric position and velocity are known,
1744        prepare star-independent astrometry parameters for transformations
1745        between ICRS and GCRS.  The Earth ephemeris is supplied by the
1746        caller.
1747
1748        The parameters produced by this function are required in the space
1749        motion, parallax, light deflection and aberration parts of the
1750        astrometric transformation chain.
1751
1752        Given:
1753           date1  double       TDB as a 2-part...
1754           date2  double       ...Julian Date (Note 1)
1755           pv     double[2][3] observer's geocentric pos/vel (m, m/s)
1756           ebpv   double[2][3] Earth barycentric PV (au, au/day)
1757           ehp    double[3]    Earth heliocentric P (au)
1758
1759        Returned:
1760           astrom eraASTROM         star-independent astrometry parameters:
1761            pmt    double       PM time interval (SSB, Julian years)
1762            eb     double[3]    SSB to observer (vector, au)
1763            eh     double[3]    Sun to observer (unit vector)
1764            em     double       distance from Sun to observer (au)
1765            v      double[3]    barycentric observer velocity (vector, c)
1766            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
1767            bpn    double[3][3] bias-precession-nutation matrix
1768            along  double       unchanged
1769            xpl    double       unchanged
1770            ypl    double       unchanged
1771            sphi   double       unchanged
1772            cphi   double       unchanged
1773            diurab double       unchanged
1774            eral   double       unchanged
1775            refa   double       unchanged
1776            refb   double       unchanged
1777
1778        Notes:
1779
1780        1) The TDB date date1+date2 is a Julian Date, apportioned in any
1781           convenient way between the two arguments.  For example,
1782           JD(TDB)=2450123.7 could be expressed in any of these ways, among
1783           others:
1784
1785                  date1          date2
1786
1787               2450123.7           0.0       (JD method)
1788               2451545.0       -1421.3       (J2000 method)
1789               2400000.5       50123.2       (MJD method)
1790               2450123.5           0.2       (date & time method)
1791
1792           The JD method is the most natural and convenient to use in cases
1793           where the loss of several decimal digits of resolution is
1794           acceptable.  The J2000 method is best matched to the way the
1795           argument is handled internally and will deliver the optimum
1796           resolution.  The MJD method and the date & time methods are both
1797           good compromises between resolution and convenience.  For most
1798           applications of this function the choice will not be at all
1799           critical.
1800
1801           TT can be used instead of TDB without any significant impact on
1802           accuracy.
1803
1804        2) All the vectors are with respect to BCRS axes.
1805
1806        3) Providing separate arguments for (i) the observer's geocentric
1807           position and velocity and (ii) the Earth ephemeris is done for
1808           convenience in the geocentric, terrestrial and Earth orbit cases.
1809           For deep space applications it maybe more convenient to specify
1810           zero geocentric position and velocity and to supply the
1811           observer's position and velocity information directly instead of
1812           with respect to the Earth.  However, note the different units:
1813           m and m/s for the geocentric vectors, au and au/day for the
1814           heliocentric and barycentric vectors.
1815
1816        4) In cases where the caller does not wish to provide the Earth
1817           ephemeris, the function eraApcs13 can be used instead of the
1818           present function.  This computes the Earth ephemeris using the
1819           ERFA function eraEpv00.
1820
1821        5) This is one of several functions that inserts into the astrom
1822           structure star-independent parameters needed for the chain of
1823           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
1824
1825           The various functions support different classes of observer and
1826           portions of the transformation chain:
1827
1828                functions         observer        transformation
1829
1830             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
1831             eraApci eraApci13    terrestrial     ICRS <-> CIRS
1832             eraApco eraApco13    terrestrial     ICRS <-> observed
1833             eraApcs eraApcs13    space           ICRS <-> GCRS
1834             eraAper eraAper13    terrestrial     update Earth rotation
1835             eraApio eraApio13    terrestrial     CIRS <-> observed
1836
1837           Those with names ending in "13" use contemporary ERFA models to
1838           compute the various ephemerides.  The others accept ephemerides
1839           supplied by the caller.
1840
1841           The transformation from ICRS to GCRS covers space motion,
1842           parallax, light deflection, and aberration.  From GCRS to CIRS
1843           comprises frame bias and precession-nutation.  From CIRS to
1844           observed takes account of Earth rotation, polar motion, diurnal
1845           aberration and parallax (unless subsumed into the ICRS <-> GCRS
1846           transformation), and atmospheric refraction.
1847
1848        6) The context structure astrom produced by this function is used by
1849           eraAtciq* and eraAticq*.
1850
1851        Called:
1852           eraCp        copy p-vector
1853           eraPm        modulus of p-vector
1854           eraPn        decompose p-vector into modulus and direction
1855           eraIr        initialize r-matrix to identity
1856
1857        This revision:   2021 February 24
1858
1859        Copyright (C) 2013-2021, NumFOCUS Foundation.
1860        Derived, with permission, from the SOFA library.  See notes at end of file.
1861
1862    """
1863    astrom = ufunc.apcs(date1, date2, pv, ebpv, ehp)
1864    return astrom
1865
1866
1867def apcs13(date1, date2, pv):
1868    """
1869    For an observer whose geocentric position and velocity are known,
1870    prepare star-independent astrometry parameters for transformations
1871    between ICRS and GCRS.
1872
1873    Parameters
1874    ----------
1875    date1 : double array
1876    date2 : double array
1877    pv : double array
1878
1879    Returns
1880    -------
1881    astrom : eraASTROM array
1882
1883    Notes
1884    -----
1885    Wraps ERFA function ``eraApcs13``. The ERFA documentation is::
1886
1887        - - - - - - - - - -
1888         e r a A p c s 1 3
1889        - - - - - - - - - -
1890
1891        For an observer whose geocentric position and velocity are known,
1892        prepare star-independent astrometry parameters for transformations
1893        between ICRS and GCRS.  The Earth ephemeris is from ERFA models.
1894
1895        The parameters produced by this function are required in the space
1896        motion, parallax, light deflection and aberration parts of the
1897        astrometric transformation chain.
1898
1899        Given:
1900           date1  double       TDB as a 2-part...
1901           date2  double       ...Julian Date (Note 1)
1902           pv     double[2][3] observer's geocentric pos/vel (Note 3)
1903
1904        Returned:
1905           astrom eraASTROM         star-independent astrometry parameters:
1906            pmt    double       PM time interval (SSB, Julian years)
1907            eb     double[3]    SSB to observer (vector, au)
1908            eh     double[3]    Sun to observer (unit vector)
1909            em     double       distance from Sun to observer (au)
1910            v      double[3]    barycentric observer velocity (vector, c)
1911            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
1912            bpn    double[3][3] bias-precession-nutation matrix
1913            along  double       unchanged
1914            xpl    double       unchanged
1915            ypl    double       unchanged
1916            sphi   double       unchanged
1917            cphi   double       unchanged
1918            diurab double       unchanged
1919            eral   double       unchanged
1920            refa   double       unchanged
1921            refb   double       unchanged
1922
1923        Notes:
1924
1925        1) The TDB date date1+date2 is a Julian Date, apportioned in any
1926           convenient way between the two arguments.  For example,
1927           JD(TDB)=2450123.7 could be expressed in any of these ways, among
1928           others:
1929
1930                  date1          date2
1931
1932               2450123.7           0.0       (JD method)
1933               2451545.0       -1421.3       (J2000 method)
1934               2400000.5       50123.2       (MJD method)
1935               2450123.5           0.2       (date & time method)
1936
1937           The JD method is the most natural and convenient to use in cases
1938           where the loss of several decimal digits of resolution is
1939           acceptable.  The J2000 method is best matched to the way the
1940           argument is handled internally and will deliver the optimum
1941           resolution.  The MJD method and the date & time methods are both
1942           good compromises between resolution and convenience.  For most
1943           applications of this function the choice will not be at all
1944           critical.
1945
1946           TT can be used instead of TDB without any significant impact on
1947           accuracy.
1948
1949        2) All the vectors are with respect to BCRS axes.
1950
1951        3) The observer's position and velocity pv are geocentric but with
1952           respect to BCRS axes, and in units of m and m/s.  No assumptions
1953           are made about proximity to the Earth, and the function can be
1954           used for deep space applications as well as Earth orbit and
1955           terrestrial.
1956
1957        4) In cases where the caller wishes to supply his own Earth
1958           ephemeris, the function eraApcs can be used instead of the present
1959           function.
1960
1961        5) This is one of several functions that inserts into the astrom
1962           structure star-independent parameters needed for the chain of
1963           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
1964
1965           The various functions support different classes of observer and
1966           portions of the transformation chain:
1967
1968                functions         observer        transformation
1969
1970             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
1971             eraApci eraApci13    terrestrial     ICRS <-> CIRS
1972             eraApco eraApco13    terrestrial     ICRS <-> observed
1973             eraApcs eraApcs13    space           ICRS <-> GCRS
1974             eraAper eraAper13    terrestrial     update Earth rotation
1975             eraApio eraApio13    terrestrial     CIRS <-> observed
1976
1977           Those with names ending in "13" use contemporary ERFA models to
1978           compute the various ephemerides.  The others accept ephemerides
1979           supplied by the caller.
1980
1981           The transformation from ICRS to GCRS covers space motion,
1982           parallax, light deflection, and aberration.  From GCRS to CIRS
1983           comprises frame bias and precession-nutation.  From CIRS to
1984           observed takes account of Earth rotation, polar motion, diurnal
1985           aberration and parallax (unless subsumed into the ICRS <-> GCRS
1986           transformation), and atmospheric refraction.
1987
1988        6) The context structure astrom produced by this function is used by
1989           eraAtciq* and eraAticq*.
1990
1991        Called:
1992           eraEpv00     Earth position and velocity
1993           eraApcs      astrometry parameters, ICRS-GCRS, space observer
1994
1995        This revision:   2013 October 9
1996
1997        Copyright (C) 2013-2021, NumFOCUS Foundation.
1998        Derived, with permission, from the SOFA library.  See notes at end of file.
1999
2000    """
2001    astrom = ufunc.apcs13(date1, date2, pv)
2002    return astrom
2003
2004
2005def aper(theta, astrom):
2006    """
2007    In the star-independent astrometry parameters, update only the
2008    Earth rotation angle, supplied by the caller explicitly.
2009
2010    Parameters
2011    ----------
2012    theta : double array
2013    astrom : eraASTROM array
2014
2015    Returns
2016    -------
2017    astrom : eraASTROM array
2018
2019    Notes
2020    -----
2021    Wraps ERFA function ``eraAper``. Note that, unlike the erfa routine,
2022    the python wrapper does not change astrom in-place. The ERFA documentation is::
2023
2024        - - - - - - - -
2025         e r a A p e r
2026        - - - - - - - -
2027
2028        In the star-independent astrometry parameters, update only the
2029        Earth rotation angle, supplied by the caller explicitly.
2030
2031        Given:
2032           theta   double      Earth rotation angle (radians, Note 2)
2033           astrom  eraASTROM        star-independent astrometry parameters:
2034            pmt    double       not used
2035            eb     double[3]    not used
2036            eh     double[3]    not used
2037            em     double       not used
2038            v      double[3]    not used
2039            bm1    double       not used
2040            bpn    double[3][3] not used
2041            along  double       longitude + s' (radians)
2042            xpl    double       not used
2043            ypl    double       not used
2044            sphi   double       not used
2045            cphi   double       not used
2046            diurab double       not used
2047            eral   double       not used
2048            refa   double       not used
2049            refb   double       not used
2050
2051        Returned:
2052           astrom  eraASTROM        star-independent astrometry parameters:
2053            pmt    double       unchanged
2054            eb     double[3]    unchanged
2055            eh     double[3]    unchanged
2056            em     double       unchanged
2057            v      double[3]    unchanged
2058            bm1    double       unchanged
2059            bpn    double[3][3] unchanged
2060            along  double       unchanged
2061            xpl    double       unchanged
2062            ypl    double       unchanged
2063            sphi   double       unchanged
2064            cphi   double       unchanged
2065            diurab double       unchanged
2066            eral   double       "local" Earth rotation angle (radians)
2067            refa   double       unchanged
2068            refb   double       unchanged
2069
2070        Notes:
2071
2072        1) This function exists to enable sidereal-tracking applications to
2073           avoid wasteful recomputation of the bulk of the astrometry
2074           parameters:  only the Earth rotation is updated.
2075
2076        2) For targets expressed as equinox based positions, such as
2077           classical geocentric apparent (RA,Dec), the supplied theta can be
2078           Greenwich apparent sidereal time rather than Earth rotation
2079           angle.
2080
2081        3) The function eraAper13 can be used instead of the present
2082           function, and starts from UT1 rather than ERA itself.
2083
2084        4) This is one of several functions that inserts into the astrom
2085           structure star-independent parameters needed for the chain of
2086           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2087
2088           The various functions support different classes of observer and
2089           portions of the transformation chain:
2090
2091                functions         observer        transformation
2092
2093             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
2094             eraApci eraApci13    terrestrial     ICRS <-> CIRS
2095             eraApco eraApco13    terrestrial     ICRS <-> observed
2096             eraApcs eraApcs13    space           ICRS <-> GCRS
2097             eraAper eraAper13    terrestrial     update Earth rotation
2098             eraApio eraApio13    terrestrial     CIRS <-> observed
2099
2100           Those with names ending in "13" use contemporary ERFA models to
2101           compute the various ephemerides.  The others accept ephemerides
2102           supplied by the caller.
2103
2104           The transformation from ICRS to GCRS covers space motion,
2105           parallax, light deflection, and aberration.  From GCRS to CIRS
2106           comprises frame bias and precession-nutation.  From CIRS to
2107           observed takes account of Earth rotation, polar motion, diurnal
2108           aberration and parallax (unless subsumed into the ICRS <-> GCRS
2109           transformation), and atmospheric refraction.
2110
2111        This revision:   2013 September 25
2112
2113        Copyright (C) 2013-2021, NumFOCUS Foundation.
2114        Derived, with permission, from the SOFA library.  See notes at end of file.
2115
2116    """
2117    astrom = ufunc.aper(theta, astrom)
2118    return astrom
2119
2120
2121def aper13(ut11, ut12, astrom):
2122    """
2123    In the star-independent astrometry parameters, update only the
2124    Earth rotation angle.
2125
2126    Parameters
2127    ----------
2128    ut11 : double array
2129    ut12 : double array
2130    astrom : eraASTROM array
2131
2132    Returns
2133    -------
2134    astrom : eraASTROM array
2135
2136    Notes
2137    -----
2138    Wraps ERFA function ``eraAper13``. Note that, unlike the erfa routine,
2139    the python wrapper does not change astrom in-place. The ERFA documentation is::
2140
2141        - - - - - - - - - -
2142         e r a A p e r 1 3
2143        - - - - - - - - - -
2144
2145        In the star-independent astrometry parameters, update only the
2146        Earth rotation angle.  The caller provides UT1, (n.b. not UTC).
2147
2148        Given:
2149           ut11    double      UT1 as a 2-part...
2150           ut12    double      ...Julian Date (Note 1)
2151           astrom  eraASTROM        star-independent astrometry parameters:
2152            pmt    double       not used
2153            eb     double[3]    not used
2154            eh     double[3]    not used
2155            em     double       not used
2156            v      double[3]    not used
2157            bm1    double       not used
2158            bpn    double[3][3] not used
2159            along  double       longitude + s' (radians)
2160            xpl    double       not used
2161            ypl    double       not used
2162            sphi   double       not used
2163            cphi   double       not used
2164            diurab double       not used
2165            eral   double       not used
2166            refa   double       not used
2167            refb   double       not used
2168
2169        Returned:
2170           astrom  eraASTROM        star-independent astrometry parameters:
2171            pmt    double       unchanged
2172            eb     double[3]    unchanged
2173            eh     double[3]    unchanged
2174            em     double       unchanged
2175            v      double[3]    unchanged
2176            bm1    double       unchanged
2177            bpn    double[3][3] unchanged
2178            along  double       unchanged
2179            xpl    double       unchanged
2180            ypl    double       unchanged
2181            sphi   double       unchanged
2182            cphi   double       unchanged
2183            diurab double       unchanged
2184            eral   double       "local" Earth rotation angle (radians)
2185            refa   double       unchanged
2186            refb   double       unchanged
2187
2188        Notes:
2189
2190        1) The UT1 date (n.b. not UTC) ut11+ut12 is a Julian Date,
2191           apportioned in any convenient way between the arguments ut11 and
2192           ut12.  For example, JD(UT1)=2450123.7 could be expressed in any
2193           of these ways, among others:
2194
2195                  ut11           ut12
2196
2197               2450123.7           0.0       (JD method)
2198               2451545.0       -1421.3       (J2000 method)
2199               2400000.5       50123.2       (MJD method)
2200               2450123.5           0.2       (date & time method)
2201
2202           The JD method is the most natural and convenient to use in cases
2203           where the loss of several decimal digits of resolution is
2204           acceptable.  The J2000 and MJD methods are good compromises
2205           between resolution and convenience.  The date & time method is
2206           best matched to the algorithm used:  maximum precision is
2207           delivered when the ut11 argument is for 0hrs UT1 on the day in
2208           question and the ut12 argument lies in the range 0 to 1, or vice
2209           versa.
2210
2211        2) If the caller wishes to provide the Earth rotation angle itself,
2212           the function eraAper can be used instead.  One use of this
2213           technique is to substitute Greenwich apparent sidereal time and
2214           thereby to support equinox based transformations directly.
2215
2216        3) This is one of several functions that inserts into the astrom
2217           structure star-independent parameters needed for the chain of
2218           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2219
2220           The various functions support different classes of observer and
2221           portions of the transformation chain:
2222
2223                functions         observer        transformation
2224
2225             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
2226             eraApci eraApci13    terrestrial     ICRS <-> CIRS
2227             eraApco eraApco13    terrestrial     ICRS <-> observed
2228             eraApcs eraApcs13    space           ICRS <-> GCRS
2229             eraAper eraAper13    terrestrial     update Earth rotation
2230             eraApio eraApio13    terrestrial     CIRS <-> observed
2231
2232           Those with names ending in "13" use contemporary ERFA models to
2233           compute the various ephemerides.  The others accept ephemerides
2234           supplied by the caller.
2235
2236           The transformation from ICRS to GCRS covers space motion,
2237           parallax, light deflection, and aberration.  From GCRS to CIRS
2238           comprises frame bias and precession-nutation.  From CIRS to
2239           observed takes account of Earth rotation, polar motion, diurnal
2240           aberration and parallax (unless subsumed into the ICRS <-> GCRS
2241           transformation), and atmospheric refraction.
2242
2243        Called:
2244           eraAper      astrometry parameters: update ERA
2245           eraEra00     Earth rotation angle, IAU 2000
2246
2247        This revision:   2013 September 25
2248
2249        Copyright (C) 2013-2021, NumFOCUS Foundation.
2250        Derived, with permission, from the SOFA library.  See notes at end of file.
2251
2252    """
2253    astrom = ufunc.aper13(ut11, ut12, astrom)
2254    return astrom
2255
2256
2257def apio(sp, theta, elong, phi, hm, xp, yp, refa, refb):
2258    """
2259    For a terrestrial observer, prepare star-independent astrometry
2260    parameters for transformations between CIRS and observed
2261    coordinates.
2262
2263    Parameters
2264    ----------
2265    sp : double array
2266    theta : double array
2267    elong : double array
2268    phi : double array
2269    hm : double array
2270    xp : double array
2271    yp : double array
2272    refa : double array
2273    refb : double array
2274
2275    Returns
2276    -------
2277    astrom : eraASTROM array
2278
2279    Notes
2280    -----
2281    Wraps ERFA function ``eraApio``. The ERFA documentation is::
2282
2283        - - - - - - - -
2284         e r a A p i o
2285        - - - - - - - -
2286
2287        For a terrestrial observer, prepare star-independent astrometry
2288        parameters for transformations between CIRS and observed
2289        coordinates.  The caller supplies the Earth orientation information
2290        and the refraction constants as well as the site coordinates.
2291
2292        Given:
2293           sp     double      the TIO locator s' (radians, Note 1)
2294           theta  double      Earth rotation angle (radians)
2295           elong  double      longitude (radians, east +ve, Note 2)
2296           phi    double      geodetic latitude (radians, Note 2)
2297           hm     double      height above ellipsoid (m, geodetic Note 2)
2298           xp,yp  double      polar motion coordinates (radians, Note 3)
2299           refa   double      refraction constant A (radians, Note 4)
2300           refb   double      refraction constant B (radians, Note 4)
2301
2302        Returned:
2303           astrom eraASTROM        star-independent astrometry parameters:
2304            pmt    double       unchanged
2305            eb     double[3]    unchanged
2306            eh     double[3]    unchanged
2307            em     double       unchanged
2308            v      double[3]    unchanged
2309            bm1    double       unchanged
2310            bpn    double[3][3] unchanged
2311            along  double       adjusted longitude (radians)
2312            xpl    double       polar motion xp wrt local meridian (radians)
2313            ypl    double       polar motion yp wrt local meridian (radians)
2314            sphi   double       sine of geodetic latitude
2315            cphi   double       cosine of geodetic latitude
2316            diurab double       magnitude of diurnal aberration vector
2317            eral   double       "local" Earth rotation angle (radians)
2318            refa   double       refraction constant A (radians)
2319            refb   double       refraction constant B (radians)
2320
2321        Notes:
2322
2323        1) sp, the TIO locator s', is a tiny quantity needed only by the
2324           most precise applications.  It can either be set to zero or
2325           predicted using the ERFA function eraSp00.
2326
2327        2) The geographical coordinates are with respect to the ERFA_WGS84
2328           reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
2329           longitude required by the present function is east-positive
2330           (i.e. right-handed), in accordance with geographical convention.
2331
2332        3) The polar motion xp,yp can be obtained from IERS bulletins.  The
2333           values are the coordinates (in radians) of the Celestial
2334           Intermediate Pole with respect to the International Terrestrial
2335           Reference System (see IERS Conventions 2003), measured along the
2336           meridians 0 and 90 deg west respectively.  For many applications,
2337           xp and yp can be set to zero.
2338
2339           Internally, the polar motion is stored in a form rotated onto the
2340           local meridian.
2341
2342        4) The refraction constants refa and refb are for use in a
2343           dZ = A*tan(Z)+B*tan^3(Z) model, where Z is the observed
2344           (i.e. refracted) zenith distance and dZ is the amount of
2345           refraction.
2346
2347        5) It is advisable to take great care with units, as even unlikely
2348           values of the input parameters are accepted and processed in
2349           accordance with the models used.
2350
2351        6) In cases where the caller does not wish to provide the Earth
2352           rotation information and refraction constants, the function
2353           eraApio13 can be used instead of the present function.  This
2354           starts from UTC and weather readings etc. and computes suitable
2355           values using other ERFA functions.
2356
2357        7) This is one of several functions that inserts into the astrom
2358           structure star-independent parameters needed for the chain of
2359           astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2360
2361           The various functions support different classes of observer and
2362           portions of the transformation chain:
2363
2364                functions         observer        transformation
2365
2366             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
2367             eraApci eraApci13    terrestrial     ICRS <-> CIRS
2368             eraApco eraApco13    terrestrial     ICRS <-> observed
2369             eraApcs eraApcs13    space           ICRS <-> GCRS
2370             eraAper eraAper13    terrestrial     update Earth rotation
2371             eraApio eraApio13    terrestrial     CIRS <-> observed
2372
2373           Those with names ending in "13" use contemporary ERFA models to
2374           compute the various ephemerides.  The others accept ephemerides
2375           supplied by the caller.
2376
2377           The transformation from ICRS to GCRS covers space motion,
2378           parallax, light deflection, and aberration.  From GCRS to CIRS
2379           comprises frame bias and precession-nutation.  From CIRS to
2380           observed takes account of Earth rotation, polar motion, diurnal
2381           aberration and parallax (unless subsumed into the ICRS <-> GCRS
2382           transformation), and atmospheric refraction.
2383
2384        8) The context structure astrom produced by this function is used by
2385           eraAtioq and eraAtoiq.
2386
2387        Called:
2388           eraIr        initialize r-matrix to identity
2389           eraRz        rotate around Z-axis
2390           eraRy        rotate around Y-axis
2391           eraRx        rotate around X-axis
2392           eraAnpm      normalize angle into range +/- pi
2393           eraPvtob     position/velocity of terrestrial station
2394
2395        This revision:   2021 February 24
2396
2397        Copyright (C) 2013-2021, NumFOCUS Foundation.
2398        Derived, with permission, from the SOFA library.  See notes at end of file.
2399
2400    """
2401    astrom = ufunc.apio(sp, theta, elong, phi, hm, xp, yp, refa, refb)
2402    return astrom
2403
2404
2405def apio13(utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl):
2406    """
2407    For a terrestrial observer, prepare star-independent astrometry
2408    parameters for transformations between CIRS and observed
2409    coordinates.
2410
2411    Parameters
2412    ----------
2413    utc1 : double array
2414    utc2 : double array
2415    dut1 : double array
2416    elong : double array
2417    phi : double array
2418    hm : double array
2419    xp : double array
2420    yp : double array
2421    phpa : double array
2422    tc : double array
2423    rh : double array
2424    wl : double array
2425
2426    Returns
2427    -------
2428    astrom : eraASTROM array
2429
2430    Notes
2431    -----
2432    Wraps ERFA function ``eraApio13``. The ERFA documentation is::
2433
2434        - - - - - - - - - -
2435         e r a A p i o 1 3
2436        - - - - - - - - - -
2437
2438        For a terrestrial observer, prepare star-independent astrometry
2439        parameters for transformations between CIRS and observed
2440        coordinates.  The caller supplies UTC, site coordinates, ambient air
2441        conditions and observing wavelength.
2442
2443        Given:
2444           utc1   double      UTC as a 2-part...
2445           utc2   double      ...quasi Julian Date (Notes 1,2)
2446           dut1   double      UT1-UTC (seconds)
2447           elong  double      longitude (radians, east +ve, Note 3)
2448           phi    double      geodetic latitude (radians, Note 3)
2449           hm     double      height above ellipsoid (m, geodetic Notes 4,6)
2450           xp,yp  double      polar motion coordinates (radians, Note 5)
2451           phpa   double      pressure at the observer (hPa = mB, Note 6)
2452           tc     double      ambient temperature at the observer (deg C)
2453           rh     double      relative humidity at the observer (range 0-1)
2454           wl     double      wavelength (micrometers, Note 7)
2455
2456        Returned:
2457           astrom eraASTROM        star-independent astrometry parameters:
2458            pmt    double       unchanged
2459            eb     double[3]    unchanged
2460            eh     double[3]    unchanged
2461            em     double       unchanged
2462            v      double[3]    unchanged
2463            bm1    double       unchanged
2464            bpn    double[3][3] unchanged
2465            along  double       longitude + s' (radians)
2466            xpl    double       polar motion xp wrt local meridian (radians)
2467            ypl    double       polar motion yp wrt local meridian (radians)
2468            sphi   double       sine of geodetic latitude
2469            cphi   double       cosine of geodetic latitude
2470            diurab double       magnitude of diurnal aberration vector
2471            eral   double       "local" Earth rotation angle (radians)
2472            refa   double       refraction constant A (radians)
2473            refb   double       refraction constant B (radians)
2474
2475        Returned (function value):
2476                  int         status: +1 = dubious year (Note 2)
2477                                       0 = OK
2478                                      -1 = unacceptable date
2479
2480        Notes:
2481
2482        1)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
2483            convenient way between the two arguments, for example where utc1
2484            is the Julian Day Number and utc2 is the fraction of a day.
2485
2486            However, JD cannot unambiguously represent UTC during a leap
2487            second unless special measures are taken.  The convention in the
2488            present function is that the JD day represents UTC days whether
2489            the length is 86399, 86400 or 86401 SI seconds.
2490
2491            Applications should use the function eraDtf2d to convert from
2492            calendar date and time of day into 2-part quasi Julian Date, as
2493            it implements the leap-second-ambiguity convention just
2494            described.
2495
2496        2)  The warning status "dubious year" flags UTCs that predate the
2497            introduction of the time scale or that are too far in the future
2498            to be trusted.  See eraDat for further details.
2499
2500        3)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
2501            one second at the end of each positive UTC leap second,
2502            introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
2503            practice is under review, and in the future UT1-UTC may grow
2504            essentially without limit.
2505
2506        4)  The geographical coordinates are with respect to the ERFA_WGS84
2507            reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
2508            longitude required by the present function is east-positive
2509            (i.e. right-handed), in accordance with geographical convention.
2510
2511        5)  The polar motion xp,yp can be obtained from IERS bulletins.  The
2512            values are the coordinates (in radians) of the Celestial
2513            Intermediate Pole with respect to the International Terrestrial
2514            Reference System (see IERS Conventions 2003), measured along the
2515            meridians 0 and 90 deg west respectively.  For many applications,
2516            xp and yp can be set to zero.
2517
2518            Internally, the polar motion is stored in a form rotated onto
2519            the local meridian.
2520
2521        6)  If hm, the height above the ellipsoid of the observing station
2522            in meters, is not known but phpa, the pressure in hPa (=mB), is
2523            available, an adequate estimate of hm can be obtained from the
2524            expression
2525
2526                  hm = -29.3 * tsl * log ( phpa / 1013.25 );
2527
2528            where tsl is the approximate sea-level air temperature in K
2529            (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
2530            52).  Similarly, if the pressure phpa is not known, it can be
2531            estimated from the height of the observing station, hm, as
2532            follows:
2533
2534                  phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
2535
2536            Note, however, that the refraction is nearly proportional to the
2537            pressure and that an accurate phpa value is important for
2538            precise work.
2539
2540        7)  The argument wl specifies the observing wavelength in
2541            micrometers.  The transition from optical to radio is assumed to
2542            occur at 100 micrometers (about 3000 GHz).
2543
2544        8)  It is advisable to take great care with units, as even unlikely
2545            values of the input parameters are accepted and processed in
2546            accordance with the models used.
2547
2548        9)  In cases where the caller wishes to supply his own Earth
2549            rotation information and refraction constants, the function
2550            eraApc can be used instead of the present function.
2551
2552        10) This is one of several functions that inserts into the astrom
2553            structure star-independent parameters needed for the chain of
2554            astrometric transformations ICRS <-> GCRS <-> CIRS <-> observed.
2555
2556            The various functions support different classes of observer and
2557            portions of the transformation chain:
2558
2559                functions         observer        transformation
2560
2561             eraApcg eraApcg13    geocentric      ICRS <-> GCRS
2562             eraApci eraApci13    terrestrial     ICRS <-> CIRS
2563             eraApco eraApco13    terrestrial     ICRS <-> observed
2564             eraApcs eraApcs13    space           ICRS <-> GCRS
2565             eraAper eraAper13    terrestrial     update Earth rotation
2566             eraApio eraApio13    terrestrial     CIRS <-> observed
2567
2568            Those with names ending in "13" use contemporary ERFA models to
2569            compute the various ephemerides.  The others accept ephemerides
2570            supplied by the caller.
2571
2572            The transformation from ICRS to GCRS covers space motion,
2573            parallax, light deflection, and aberration.  From GCRS to CIRS
2574            comprises frame bias and precession-nutation.  From CIRS to
2575            observed takes account of Earth rotation, polar motion, diurnal
2576            aberration and parallax (unless subsumed into the ICRS <-> GCRS
2577            transformation), and atmospheric refraction.
2578
2579        11) The context structure astrom produced by this function is used
2580            by eraAtioq and eraAtoiq.
2581
2582        Called:
2583           eraUtctai    UTC to TAI
2584           eraTaitt     TAI to TT
2585           eraUtcut1    UTC to UT1
2586           eraSp00      the TIO locator s', IERS 2000
2587           eraEra00     Earth rotation angle, IAU 2000
2588           eraRefco     refraction constants for given ambient conditions
2589           eraApio      astrometry parameters, CIRS-observed
2590
2591        This revision:   2021 February 24
2592
2593        Copyright (C) 2013-2021, NumFOCUS Foundation.
2594        Derived, with permission, from the SOFA library.  See notes at end of file.
2595
2596    """
2597    astrom, c_retval = ufunc.apio13(
2598        utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl)
2599    check_errwarn(c_retval, 'apio13')
2600    return astrom
2601
2602
2603STATUS_CODES['apio13'] = {
2604    1: 'dubious year (Note 2)',
2605    0: 'OK',
2606    -1: 'unacceptable date',
2607}
2608
2609
2610def atcc13(rc, dc, pr, pd, px, rv, date1, date2):
2611    """
2612    Transform a star's ICRS catalog entry (epoch J2000.0) into ICRS
2613    astrometric place.
2614
2615    Parameters
2616    ----------
2617    rc : double array
2618    dc : double array
2619    pr : double array
2620    pd : double array
2621    px : double array
2622    rv : double array
2623    date1 : double array
2624    date2 : double array
2625
2626    Returns
2627    -------
2628    ra : double array
2629    da : double array
2630
2631    Notes
2632    -----
2633    Wraps ERFA function ``eraAtcc13``. The ERFA documentation is::
2634
2635        - - - - - - - - - -
2636         e r a A t c c 1 3
2637        - - - - - - - - - -
2638
2639        Transform a star's ICRS catalog entry (epoch J2000.0) into ICRS
2640        astrometric place.
2641
2642        Given:
2643           rc     double   ICRS right ascension at J2000.0 (radians, Note 1)
2644           dc     double   ICRS declination at J2000.0 (radians, Note 1)
2645           pr     double   RA proper motion (radians/year, Note 2)
2646           pd     double   Dec proper motion (radians/year)
2647           px     double   parallax (arcsec)
2648           rv     double   radial velocity (km/s, +ve if receding)
2649           date1  double   TDB as a 2-part...
2650           date2  double   ...Julian Date (Note 3)
2651
2652        Returned:
2653           ra,da  double        ICRS astrometric RA,Dec (radians)
2654
2655        Notes:
2656
2657        1) Star data for an epoch other than J2000.0 (for example from the
2658           Hipparcos catalog, which has an epoch of J1991.25) will require a
2659           preliminary call to eraPmsafe before use.
2660
2661        2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
2662
2663        3) The TDB date date1+date2 is a Julian Date, apportioned in any
2664           convenient way between the two arguments.  For example,
2665           JD(TDB)=2450123.7 could be expressed in any of these ways, among
2666           others:
2667
2668                  date1          date2
2669
2670               2450123.7           0.0       (JD method)
2671               2451545.0       -1421.3       (J2000 method)
2672               2400000.5       50123.2       (MJD method)
2673               2450123.5           0.2       (date & time method)
2674
2675           The JD method is the most natural and convenient to use in cases
2676           where the loss of several decimal digits of resolution is
2677           acceptable.  The J2000 method is best matched to the way the
2678           argument is handled internally and will deliver the optimum
2679           resolution.  The MJD method and the date & time methods are both
2680           good compromises between resolution and convenience.  For most
2681           applications of this function the choice will not be at all
2682           critical.
2683
2684           TT can be used instead of TDB without any significant impact on
2685           accuracy.
2686
2687        Called:
2688           eraApci13    astrometry parameters, ICRS-CIRS, 2013
2689           eraAtccq     quick catalog ICRS to astrometric
2690
2691        This revision:   2021 April 18
2692
2693        Copyright (C) 2013-2021, NumFOCUS Foundation.
2694        Derived, with permission, from the SOFA library.  See notes at end of file.
2695
2696    """
2697    ra, da = ufunc.atcc13(rc, dc, pr, pd, px, rv, date1, date2)
2698    return ra, da
2699
2700
2701def atccq(rc, dc, pr, pd, px, rv, astrom):
2702    """
2703    Quick transformation of a star's ICRS catalog entry (epoch J2000.0)
2704    into ICRS astrometric place, given precomputed star-independent
2705    astrometry parameters.
2706
2707    Parameters
2708    ----------
2709    rc : double array
2710    dc : double array
2711    pr : double array
2712    pd : double array
2713    px : double array
2714    rv : double array
2715    astrom : eraASTROM array
2716
2717    Returns
2718    -------
2719    ra : double array
2720    da : double array
2721
2722    Notes
2723    -----
2724    Wraps ERFA function ``eraAtccq``. The ERFA documentation is::
2725
2726        - - - - - - - - -
2727         e r a A t c c q
2728        - - - - - - - - -
2729
2730        Quick transformation of a star's ICRS catalog entry (epoch J2000.0)
2731        into ICRS astrometric place, given precomputed star-independent
2732        astrometry parameters.
2733
2734        Use of this function is appropriate when efficiency is important and
2735        where many star positions are to be transformed for one date.  The
2736        star-independent parameters can be obtained by calling one of the
2737        functions eraApci[13], eraApcg[13], eraApco[13] or eraApcs[13].
2738
2739        If the parallax and proper motions are zero the transformation has
2740        no effect.
2741
2742        Given:
2743           rc,dc  double     ICRS RA,Dec at J2000.0 (radians)
2744           pr     double     RA proper motion (radians/year, Note 3)
2745           pd     double     Dec proper motion (radians/year)
2746           px     double     parallax (arcsec)
2747           rv     double     radial velocity (km/s, +ve if receding)
2748           astrom eraASTROM* star-independent astrometry parameters:
2749            pmt    double       PM time interval (SSB, Julian years)
2750            eb     double[3]    SSB to observer (vector, au)
2751            eh     double[3]    Sun to observer (unit vector)
2752            em     double       distance from Sun to observer (au)
2753            v      double[3]    barycentric observer velocity (vector, c)
2754            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
2755            bpn    double[3][3] bias-precession-nutation matrix
2756            along  double       longitude + s' (radians)
2757            xpl    double       polar motion xp wrt local meridian (radians)
2758            ypl    double       polar motion yp wrt local meridian (radians)
2759            sphi   double       sine of geodetic latitude
2760            cphi   double       cosine of geodetic latitude
2761            diurab double       magnitude of diurnal aberration vector
2762            eral   double       "local" Earth rotation angle (radians)
2763            refa   double       refraction constant A (radians)
2764            refb   double       refraction constant B (radians)
2765
2766        Returned:
2767           ra,da  double          ICRS astrometric RA,Dec (radians)
2768
2769        Notes:
2770
2771        1) All the vectors are with respect to BCRS axes.
2772
2773        2) Star data for an epoch other than J2000.0 (for example from the
2774           Hipparcos catalog, which has an epoch of J1991.25) will require a
2775           preliminary call to eraPmsafe before use.
2776
2777        3) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
2778
2779        Called:
2780           eraPmpx      proper motion and parallax
2781           eraC2s       p-vector to spherical
2782           eraAnp       normalize angle into range 0 to 2pi
2783
2784        This revision:   2021 April 18
2785
2786        Copyright (C) 2013-2021, NumFOCUS Foundation.
2787        Derived, with permission, from the SOFA library.  See notes at end of file.
2788
2789    """
2790    ra, da = ufunc.atccq(rc, dc, pr, pd, px, rv, astrom)
2791    return ra, da
2792
2793
2794def atci13(rc, dc, pr, pd, px, rv, date1, date2):
2795    """
2796    Transform ICRS star data, epoch J2000.0, to CIRS.
2797
2798    Parameters
2799    ----------
2800    rc : double array
2801    dc : double array
2802    pr : double array
2803    pd : double array
2804    px : double array
2805    rv : double array
2806    date1 : double array
2807    date2 : double array
2808
2809    Returns
2810    -------
2811    ri : double array
2812    di : double array
2813    eo : double array
2814
2815    Notes
2816    -----
2817    Wraps ERFA function ``eraAtci13``. The ERFA documentation is::
2818
2819        - - - - - - - - - -
2820         e r a A t c i 1 3
2821        - - - - - - - - - -
2822
2823        Transform ICRS star data, epoch J2000.0, to CIRS.
2824
2825        Given:
2826           rc     double   ICRS right ascension at J2000.0 (radians, Note 1)
2827           dc     double   ICRS declination at J2000.0 (radians, Note 1)
2828           pr     double   RA proper motion (radians/year, Note 2)
2829           pd     double   Dec proper motion (radians/year)
2830           px     double   parallax (arcsec)
2831           rv     double   radial velocity (km/s, +ve if receding)
2832           date1  double   TDB as a 2-part...
2833           date2  double   ...Julian Date (Note 3)
2834
2835        Returned:
2836           ri,di  double        CIRS geocentric RA,Dec (radians)
2837           eo     double        equation of the origins (ERA-GST, Note 5)
2838
2839        Notes:
2840
2841        1) Star data for an epoch other than J2000.0 (for example from the
2842           Hipparcos catalog, which has an epoch of J1991.25) will require a
2843           preliminary call to eraPmsafe before use.
2844
2845        2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
2846
2847        3) The TDB date date1+date2 is a Julian Date, apportioned in any
2848           convenient way between the two arguments.  For example,
2849           JD(TDB)=2450123.7 could be expressed in any of these ways, among
2850           others:
2851
2852                  date1          date2
2853
2854               2450123.7           0.0       (JD method)
2855               2451545.0       -1421.3       (J2000 method)
2856               2400000.5       50123.2       (MJD method)
2857               2450123.5           0.2       (date & time method)
2858
2859           The JD method is the most natural and convenient to use in cases
2860           where the loss of several decimal digits of resolution is
2861           acceptable.  The J2000 method is best matched to the way the
2862           argument is handled internally and will deliver the optimum
2863           resolution.  The MJD method and the date & time methods are both
2864           good compromises between resolution and convenience.  For most
2865           applications of this function the choice will not be at all
2866           critical.
2867
2868           TT can be used instead of TDB without any significant impact on
2869           accuracy.
2870
2871        4) The available accuracy is better than 1 milliarcsecond, limited
2872           mainly by the precession-nutation model that is used, namely
2873           IAU 2000A/2006.  Very close to solar system bodies, additional
2874           errors of up to several milliarcseconds can occur because of
2875           unmodeled light deflection;  however, the Sun's contribution is
2876           taken into account, to first order.  The accuracy limitations of
2877           the ERFA function eraEpv00 (used to compute Earth position and
2878           velocity) can contribute aberration errors of up to
2879           5 microarcseconds.  Light deflection at the Sun's limb is
2880           uncertain at the 0.4 mas level.
2881
2882        5) Should the transformation to (equinox based) apparent place be
2883           required rather than (CIO based) intermediate place, subtract the
2884           equation of the origins from the returned right ascension:
2885           RA = RI - EO. (The eraAnp function can then be applied, as
2886           required, to keep the result in the conventional 0-2pi range.)
2887
2888        Called:
2889           eraApci13    astrometry parameters, ICRS-CIRS, 2013
2890           eraAtciq     quick ICRS to CIRS
2891
2892        This revision:   2021 April 3
2893
2894        Copyright (C) 2013-2021, NumFOCUS Foundation.
2895        Derived, with permission, from the SOFA library.  See notes at end of file.
2896
2897    """
2898    ri, di, eo = ufunc.atci13(rc, dc, pr, pd, px, rv, date1, date2)
2899    return ri, di, eo
2900
2901
2902def atciq(rc, dc, pr, pd, px, rv, astrom):
2903    """
2904    Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed
2905    star-independent astrometry parameters.
2906
2907    Parameters
2908    ----------
2909    rc : double array
2910    dc : double array
2911    pr : double array
2912    pd : double array
2913    px : double array
2914    rv : double array
2915    astrom : eraASTROM array
2916
2917    Returns
2918    -------
2919    ri : double array
2920    di : double array
2921
2922    Notes
2923    -----
2924    Wraps ERFA function ``eraAtciq``. The ERFA documentation is::
2925
2926        - - - - - - - - -
2927         e r a A t c i q
2928        - - - - - - - - -
2929
2930        Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed
2931        star-independent astrometry parameters.
2932
2933        Use of this function is appropriate when efficiency is important and
2934        where many star positions are to be transformed for one date.  The
2935        star-independent parameters can be obtained by calling one of the
2936        functions eraApci[13], eraApcg[13], eraApco[13] or eraApcs[13].
2937
2938        If the parallax and proper motions are zero the eraAtciqz function
2939        can be used instead.
2940
2941        Given:
2942           rc,dc  double     ICRS RA,Dec at J2000.0 (radians, Note 1)
2943           pr     double     RA proper motion (radians/year, Note 2)
2944           pd     double     Dec proper motion (radians/year)
2945           px     double     parallax (arcsec)
2946           rv     double     radial velocity (km/s, +ve if receding)
2947           astrom eraASTROM* star-independent astrometry parameters:
2948            pmt    double       PM time interval (SSB, Julian years)
2949            eb     double[3]    SSB to observer (vector, au)
2950            eh     double[3]    Sun to observer (unit vector)
2951            em     double       distance from Sun to observer (au)
2952            v      double[3]    barycentric observer velocity (vector, c)
2953            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
2954            bpn    double[3][3] bias-precession-nutation matrix
2955            along  double       longitude + s' (radians)
2956            xpl    double       polar motion xp wrt local meridian (radians)
2957            ypl    double       polar motion yp wrt local meridian (radians)
2958            sphi   double       sine of geodetic latitude
2959            cphi   double       cosine of geodetic latitude
2960            diurab double       magnitude of diurnal aberration vector
2961            eral   double       "local" Earth rotation angle (radians)
2962            refa   double       refraction constant A (radians)
2963            refb   double       refraction constant B (radians)
2964
2965        Returned:
2966           ri,di   double    CIRS RA,Dec (radians)
2967
2968        Notes:
2969
2970        1) Star data for an epoch other than J2000.0 (for example from the
2971           Hipparcos catalog, which has an epoch of J1991.25) will require a
2972           preliminary call to eraPmsafe before use.
2973
2974        2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
2975
2976        Called:
2977           eraPmpx      proper motion and parallax
2978           eraLdsun     light deflection by the Sun
2979           eraAb        stellar aberration
2980           eraRxp       product of r-matrix and pv-vector
2981           eraC2s       p-vector to spherical
2982           eraAnp       normalize angle into range 0 to 2pi
2983
2984        This revision:   2021 April 19
2985
2986        Copyright (C) 2013-2021, NumFOCUS Foundation.
2987        Derived, with permission, from the SOFA library.  See notes at end of file.
2988
2989    """
2990    ri, di = ufunc.atciq(rc, dc, pr, pd, px, rv, astrom)
2991    return ri, di
2992
2993
2994def atciqn(rc, dc, pr, pd, px, rv, astrom, b):
2995    """
2996    Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed
2997    star-independent astrometry parameters plus a list of light-
2998    deflecting bodies.
2999
3000    Parameters
3001    ----------
3002    rc : double array
3003    dc : double array
3004    pr : double array
3005    pd : double array
3006    px : double array
3007    rv : double array
3008    astrom : eraASTROM array
3009    b : eraLDBODY array
3010
3011    Returns
3012    -------
3013    ri : double array
3014    di : double array
3015
3016    Notes
3017    -----
3018    Wraps ERFA function ``eraAtciqn``. The ERFA documentation is::
3019
3020        - - - - - - - - - -
3021         e r a A t c i q n
3022        - - - - - - - - - -
3023
3024        Quick ICRS, epoch J2000.0, to CIRS transformation, given precomputed
3025        star-independent astrometry parameters plus a list of light-
3026        deflecting bodies.
3027
3028        Use of this function is appropriate when efficiency is important and
3029        where many star positions are to be transformed for one date.  The
3030        star-independent parameters can be obtained by calling one of the
3031        functions eraApci[13], eraApcg[13], eraApco[13] or eraApcs[13].
3032
3033
3034        If the only light-deflecting body to be taken into account is the
3035        Sun, the eraAtciq function can be used instead.  If in addition the
3036        parallax and proper motions are zero, the eraAtciqz function can be
3037        used.
3038
3039        Given:
3040           rc,dc  double       ICRS RA,Dec at J2000.0 (radians)
3041           pr     double       RA proper motion (radians/year, Note 3)
3042           pd     double       Dec proper motion (radians/year)
3043           px     double       parallax (arcsec)
3044           rv     double       radial velocity (km/s, +ve if receding)
3045           astrom eraASTROM         star-independent astrometry parameters:
3046            pmt    double       PM time interval (SSB, Julian years)
3047            eb     double[3]    SSB to observer (vector, au)
3048            eh     double[3]    Sun to observer (unit vector)
3049            em     double       distance from Sun to observer (au)
3050            v      double[3]    barycentric observer velocity (vector, c)
3051            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
3052            bpn    double[3][3] bias-precession-nutation matrix
3053            along  double       longitude + s' (radians)
3054            xpl    double       polar motion xp wrt local meridian (radians)
3055            ypl    double       polar motion yp wrt local meridian (radians)
3056            sphi   double       sine of geodetic latitude
3057            cphi   double       cosine of geodetic latitude
3058            diurab double       magnitude of diurnal aberration vector
3059            eral   double       "local" Earth rotation angle (radians)
3060            refa   double       refraction constant A (radians)
3061            refb   double       refraction constant B (radians)
3062           n      int          number of bodies (Note 3)
3063           b      eraLDBODY[n] data for each of the n bodies (Notes 3,4):
3064            bm     double       mass of the body (solar masses, Note 5)
3065            dl     double       deflection limiter (Note 6)
3066            pv     [2][3]       barycentric PV of the body (au, au/day)
3067
3068        Returned:
3069           ri,di   double    CIRS RA,Dec (radians)
3070
3071        Notes:
3072
3073        1) Star data for an epoch other than J2000.0 (for example from the
3074           Hipparcos catalog, which has an epoch of J1991.25) will require a
3075           preliminary call to eraPmsafe before use.
3076
3077        2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
3078
3079        3) The struct b contains n entries, one for each body to be
3080           considered.  If n = 0, no gravitational light deflection will be
3081           applied, not even for the Sun.
3082
3083        4) The struct b should include an entry for the Sun as well as for
3084           any planet or other body to be taken into account.  The entries
3085           should be in the order in which the light passes the body.
3086
3087        5) In the entry in the b struct for body i, the mass parameter
3088           b[i].bm can, as required, be adjusted in order to allow for such
3089           effects as quadrupole field.
3090
3091        6) The deflection limiter parameter b[i].dl is phi^2/2, where phi is
3092           the angular separation (in radians) between star and body at
3093           which limiting is applied.  As phi shrinks below the chosen
3094           threshold, the deflection is artificially reduced, reaching zero
3095           for phi = 0.   Example values suitable for a terrestrial
3096           observer, together with masses, are as follows:
3097
3098              body i     b[i].bm        b[i].dl
3099
3100              Sun        1.0            6e-6
3101              Jupiter    0.00095435     3e-9
3102              Saturn     0.00028574     3e-10
3103
3104        7) For efficiency, validation of the contents of the b array is
3105           omitted.  The supplied masses must be greater than zero, the
3106           position and velocity vectors must be right, and the deflection
3107           limiter greater than zero.
3108
3109        Called:
3110           eraPmpx      proper motion and parallax
3111           eraLdn       light deflection by n bodies
3112           eraAb        stellar aberration
3113           eraRxp       product of r-matrix and pv-vector
3114           eraC2s       p-vector to spherical
3115           eraAnp       normalize angle into range 0 to 2pi
3116
3117        This revision:   2021 April 3
3118
3119        Copyright (C) 2013-2021, NumFOCUS Foundation.
3120        Derived, with permission, from the SOFA library.  See notes at end of file.
3121
3122    """
3123    ri, di = ufunc.atciqn(rc, dc, pr, pd, px, rv, astrom, b)
3124    return ri, di
3125
3126
3127def atciqz(rc, dc, astrom):
3128    """
3129    Quick ICRS to CIRS transformation, given precomputed star-
3130    independent astrometry parameters, and assuming zero parallax and
3131    proper motion.
3132
3133    Parameters
3134    ----------
3135    rc : double array
3136    dc : double array
3137    astrom : eraASTROM array
3138
3139    Returns
3140    -------
3141    ri : double array
3142    di : double array
3143
3144    Notes
3145    -----
3146    Wraps ERFA function ``eraAtciqz``. The ERFA documentation is::
3147
3148        - - - - - - - - - -
3149         e r a A t c i q z
3150        - - - - - - - - - -
3151
3152        Quick ICRS to CIRS transformation, given precomputed star-
3153        independent astrometry parameters, and assuming zero parallax and
3154        proper motion.
3155
3156        Use of this function is appropriate when efficiency is important and
3157        where many star positions are to be transformed for one date.  The
3158        star-independent parameters can be obtained by calling one of the
3159        functions eraApci[13], eraApcg[13], eraApco[13] or eraApcs[13].
3160
3161        The corresponding function for the case of non-zero parallax and
3162        proper motion is eraAtciq.
3163
3164        Given:
3165           rc,dc  double     ICRS astrometric RA,Dec (radians)
3166           astrom eraASTROM* star-independent astrometry parameters:
3167            pmt    double       PM time interval (SSB, Julian years)
3168            eb     double[3]    SSB to observer (vector, au)
3169            eh     double[3]    Sun to observer (unit vector)
3170            em     double       distance from Sun to observer (au)
3171            v      double[3]    barycentric observer velocity (vector, c)
3172            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
3173            bpn    double[3][3] bias-precession-nutation matrix
3174            along  double       longitude + s' (radians)
3175            xpl    double       polar motion xp wrt local meridian (radians)
3176            ypl    double       polar motion yp wrt local meridian (radians)
3177            sphi   double       sine of geodetic latitude
3178            cphi   double       cosine of geodetic latitude
3179            diurab double       magnitude of diurnal aberration vector
3180            eral   double       "local" Earth rotation angle (radians)
3181            refa   double       refraction constant A (radians)
3182            refb   double       refraction constant B (radians)
3183
3184        Returned:
3185           ri,di  double     CIRS RA,Dec (radians)
3186
3187        Note:
3188
3189           All the vectors are with respect to BCRS axes.
3190
3191        References:
3192
3193           Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
3194           the Astronomical Almanac, 3rd ed., University Science Books
3195           (2013).
3196
3197           Klioner, Sergei A., "A practical relativistic model for micro-
3198           arcsecond astrometry in space", Astr. J. 125, 1580-1597 (2003).
3199
3200        Called:
3201           eraS2c       spherical coordinates to unit vector
3202           eraLdsun     light deflection due to Sun
3203           eraAb        stellar aberration
3204           eraRxp       product of r-matrix and p-vector
3205           eraC2s       p-vector to spherical
3206           eraAnp       normalize angle into range +/- pi
3207
3208        This revision:   2013 October 9
3209
3210        Copyright (C) 2013-2021, NumFOCUS Foundation.
3211        Derived, with permission, from the SOFA library.  See notes at end of file.
3212
3213    """
3214    ri, di = ufunc.atciqz(rc, dc, astrom)
3215    return ri, di
3216
3217
3218def atco13(rc, dc, pr, pd, px, rv, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl):
3219    """
3220    ICRS RA,Dec to observed place.  The caller supplies UTC, site
3221    coordinates, ambient air conditions and observing wavelength.
3222
3223    Parameters
3224    ----------
3225    rc : double array
3226    dc : double array
3227    pr : double array
3228    pd : double array
3229    px : double array
3230    rv : double array
3231    utc1 : double array
3232    utc2 : double array
3233    dut1 : double array
3234    elong : double array
3235    phi : double array
3236    hm : double array
3237    xp : double array
3238    yp : double array
3239    phpa : double array
3240    tc : double array
3241    rh : double array
3242    wl : double array
3243
3244    Returns
3245    -------
3246    aob : double array
3247    zob : double array
3248    hob : double array
3249    dob : double array
3250    rob : double array
3251    eo : double array
3252
3253    Notes
3254    -----
3255    Wraps ERFA function ``eraAtco13``. The ERFA documentation is::
3256
3257        - - - - - - - - - -
3258         e r a A t c o 1 3
3259        - - - - - - - - - -
3260
3261        ICRS RA,Dec to observed place.  The caller supplies UTC, site
3262        coordinates, ambient air conditions and observing wavelength.
3263
3264        ERFA models are used for the Earth ephemeris, bias-precession-
3265        nutation, Earth orientation and refraction.
3266
3267        Given:
3268           rc,dc  double   ICRS right ascension at J2000.0 (radians, Note 1)
3269           pr     double   RA proper motion (radians/year, Note 2)
3270           pd     double   Dec proper motion (radians/year)
3271           px     double   parallax (arcsec)
3272           rv     double   radial velocity (km/s, +ve if receding)
3273           utc1   double   UTC as a 2-part...
3274           utc2   double   ...quasi Julian Date (Notes 3-4)
3275           dut1   double   UT1-UTC (seconds, Note 5)
3276           elong  double   longitude (radians, east +ve, Note 6)
3277           phi    double   latitude (geodetic, radians, Note 6)
3278           hm     double   height above ellipsoid (m, geodetic, Notes 6,8)
3279           xp,yp  double   polar motion coordinates (radians, Note 7)
3280           phpa   double   pressure at the observer (hPa = mB, Note 8)
3281           tc     double   ambient temperature at the observer (deg C)
3282           rh     double   relative humidity at the observer (range 0-1)
3283           wl     double   wavelength (micrometers, Note 9)
3284
3285        Returned:
3286           aob    double        observed azimuth (radians: N=0,E=90)
3287           zob    double        observed zenith distance (radians)
3288           hob    double        observed hour angle (radians)
3289           dob    double        observed declination (radians)
3290           rob    double        observed right ascension (CIO-based, radians)
3291           eo     double        equation of the origins (ERA-GST)
3292
3293        Returned (function value):
3294                  int      status: +1 = dubious year (Note 4)
3295                                    0 = OK
3296                                   -1 = unacceptable date
3297
3298        Notes:
3299
3300        1)  Star data for an epoch other than J2000.0 (for example from the
3301            Hipparcos catalog, which has an epoch of J1991.25) will require
3302            a preliminary call to eraPmsafe before use.
3303
3304        2)  The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
3305
3306        3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
3307            convenient way between the two arguments, for example where utc1
3308            is the Julian Day Number and utc2 is the fraction of a day.
3309
3310            However, JD cannot unambiguously represent UTC during a leap
3311            second unless special measures are taken.  The convention in the
3312            present function is that the JD day represents UTC days whether
3313            the length is 86399, 86400 or 86401 SI seconds.
3314
3315            Applications should use the function eraDtf2d to convert from
3316            calendar date and time of day into 2-part quasi Julian Date, as
3317            it implements the leap-second-ambiguity convention just
3318            described.
3319
3320        4)  The warning status "dubious year" flags UTCs that predate the
3321            introduction of the time scale or that are too far in the
3322            future to be trusted.  See eraDat for further details.
3323
3324        5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
3325            one second at the end of each positive UTC leap second,
3326            introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
3327            practice is under review, and in the future UT1-UTC may grow
3328            essentially without limit.
3329
3330        6)  The geographical coordinates are with respect to the ERFA_WGS84
3331            reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
3332            longitude required by the present function is east-positive
3333            (i.e. right-handed), in accordance with geographical convention.
3334
3335        7)  The polar motion xp,yp can be obtained from IERS bulletins.  The
3336            values are the coordinates (in radians) of the Celestial
3337            Intermediate Pole with respect to the International Terrestrial
3338            Reference System (see IERS Conventions 2003), measured along the
3339            meridians 0 and 90 deg west respectively.  For many
3340            applications, xp and yp can be set to zero.
3341
3342        8)  If hm, the height above the ellipsoid of the observing station
3343            in meters, is not known but phpa, the pressure in hPa (=mB),
3344            is available, an adequate estimate of hm can be obtained from
3345            the expression
3346
3347                  hm = -29.3 * tsl * log ( phpa / 1013.25 );
3348
3349            where tsl is the approximate sea-level air temperature in K
3350            (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
3351            52).  Similarly, if the pressure phpa is not known, it can be
3352            estimated from the height of the observing station, hm, as
3353            follows:
3354
3355                  phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
3356
3357            Note, however, that the refraction is nearly proportional to
3358            the pressure and that an accurate phpa value is important for
3359            precise work.
3360
3361        9)  The argument wl specifies the observing wavelength in
3362            micrometers.  The transition from optical to radio is assumed to
3363            occur at 100 micrometers (about 3000 GHz).
3364
3365        10) The accuracy of the result is limited by the corrections for
3366            refraction, which use a simple A*tan(z) + B*tan^3(z) model.
3367            Providing the meteorological parameters are known accurately and
3368            there are no gross local effects, the predicted observed
3369            coordinates should be within 0.05 arcsec (optical) or 1 arcsec
3370            (radio) for a zenith distance of less than 70 degrees, better
3371            than 30 arcsec (optical or radio) at 85 degrees and better
3372            than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
3373
3374            Without refraction, the complementary functions eraAtco13 and
3375            eraAtoc13 are self-consistent to better than 1 microarcsecond
3376            all over the celestial sphere.  With refraction included,
3377            consistency falls off at high zenith distances, but is still
3378            better than 0.05 arcsec at 85 degrees.
3379
3380        11) "Observed" Az,ZD means the position that would be seen by a
3381            perfect geodetically aligned theodolite.  (Zenith distance is
3382            used rather than altitude in order to reflect the fact that no
3383            allowance is made for depression of the horizon.)  This is
3384            related to the observed HA,Dec via the standard rotation, using
3385            the geodetic latitude (corrected for polar motion), while the
3386            observed HA and RA are related simply through the Earth rotation
3387            angle and the site longitude.  "Observed" RA,Dec or HA,Dec thus
3388            means the position that would be seen by a perfect equatorial
3389            with its polar axis aligned to the Earth's axis of rotation.
3390
3391        12) It is advisable to take great care with units, as even unlikely
3392            values of the input parameters are accepted and processed in
3393            accordance with the models used.
3394
3395        Called:
3396           eraApco13    astrometry parameters, ICRS-observed, 2013
3397           eraAtciq     quick ICRS to CIRS
3398           eraAtioq     quick CIRS to observed
3399
3400        This revision:   2021 April 3
3401
3402        Copyright (C) 2013-2021, NumFOCUS Foundation.
3403        Derived, with permission, from the SOFA library.  See notes at end of file.
3404
3405    """
3406    aob, zob, hob, dob, rob, eo, c_retval = ufunc.atco13(
3407        rc, dc, pr, pd, px, rv, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl)
3408    check_errwarn(c_retval, 'atco13')
3409    return aob, zob, hob, dob, rob, eo
3410
3411
3412STATUS_CODES['atco13'] = {
3413    1: 'dubious year (Note 4)',
3414    0: 'OK',
3415    -1: 'unacceptable date',
3416}
3417
3418
3419def atic13(ri, di, date1, date2):
3420    """
3421    Transform star RA,Dec from geocentric CIRS to ICRS astrometric.
3422
3423    Parameters
3424    ----------
3425    ri : double array
3426    di : double array
3427    date1 : double array
3428    date2 : double array
3429
3430    Returns
3431    -------
3432    rc : double array
3433    dc : double array
3434    eo : double array
3435
3436    Notes
3437    -----
3438    Wraps ERFA function ``eraAtic13``. The ERFA documentation is::
3439
3440        - - - - - - - - - -
3441         e r a A t i c 1 3
3442        - - - - - - - - - -
3443
3444        Transform star RA,Dec from geocentric CIRS to ICRS astrometric.
3445
3446        Given:
3447           ri,di  double  CIRS geocentric RA,Dec (radians)
3448           date1  double  TDB as a 2-part...
3449           date2  double  ...Julian Date (Note 1)
3450
3451        Returned:
3452           rc,dc  double  ICRS astrometric RA,Dec (radians)
3453           eo     double  equation of the origins (ERA-GST, Note 4)
3454
3455        Notes:
3456
3457        1) The TDB date date1+date2 is a Julian Date, apportioned in any
3458           convenient way between the two arguments.  For example,
3459           JD(TDB)=2450123.7 could be expressed in any of these ways, among
3460           others:
3461
3462                  date1          date2
3463
3464               2450123.7           0.0       (JD method)
3465               2451545.0       -1421.3       (J2000 method)
3466               2400000.5       50123.2       (MJD method)
3467               2450123.5           0.2       (date & time method)
3468
3469           The JD method is the most natural and convenient to use in cases
3470           where the loss of several decimal digits of resolution is
3471           acceptable.  The J2000 method is best matched to the way the
3472           argument is handled internally and will deliver the optimum
3473           resolution.  The MJD method and the date & time methods are both
3474           good compromises between resolution and convenience.  For most
3475           applications of this function the choice will not be at all
3476           critical.
3477
3478           TT can be used instead of TDB without any significant impact on
3479           accuracy.
3480
3481        2) Iterative techniques are used for the aberration and light
3482           deflection corrections so that the functions eraAtic13 (or
3483           eraAticq) and eraAtci13 (or eraAtciq) are accurate inverses;
3484           even at the edge of the Sun's disk the discrepancy is only about
3485           1 nanoarcsecond.
3486
3487        3) The available accuracy is better than 1 milliarcsecond, limited
3488           mainly by the precession-nutation model that is used, namely
3489           IAU 2000A/2006.  Very close to solar system bodies, additional
3490           errors of up to several milliarcseconds can occur because of
3491           unmodeled light deflection;  however, the Sun's contribution is
3492           taken into account, to first order.  The accuracy limitations of
3493           the ERFA function eraEpv00 (used to compute Earth position and
3494           velocity) can contribute aberration errors of up to
3495           5 microarcseconds.  Light deflection at the Sun's limb is
3496           uncertain at the 0.4 mas level.
3497
3498        4) Should the transformation to (equinox based) J2000.0 mean place
3499           be required rather than (CIO based) ICRS coordinates, subtract the
3500           equation of the origins from the returned right ascension:
3501           RA = RI - EO.  (The eraAnp function can then be applied, as
3502           required, to keep the result in the conventional 0-2pi range.)
3503
3504        Called:
3505           eraApci13    astrometry parameters, ICRS-CIRS, 2013
3506           eraAticq     quick CIRS to ICRS astrometric
3507
3508        This revision:   2013 October 9
3509
3510        Copyright (C) 2013-2021, NumFOCUS Foundation.
3511        Derived, with permission, from the SOFA library.  See notes at end of file.
3512
3513    """
3514    rc, dc, eo = ufunc.atic13(ri, di, date1, date2)
3515    return rc, dc, eo
3516
3517
3518def aticq(ri, di, astrom):
3519    """
3520    Quick CIRS RA,Dec to ICRS astrometric place, given the star-
3521    independent astrometry parameters.
3522
3523    Parameters
3524    ----------
3525    ri : double array
3526    di : double array
3527    astrom : eraASTROM array
3528
3529    Returns
3530    -------
3531    rc : double array
3532    dc : double array
3533
3534    Notes
3535    -----
3536    Wraps ERFA function ``eraAticq``. The ERFA documentation is::
3537
3538        - - - - - - - - -
3539         e r a A t i c q
3540        - - - - - - - - -
3541
3542        Quick CIRS RA,Dec to ICRS astrometric place, given the star-
3543        independent astrometry parameters.
3544
3545        Use of this function is appropriate when efficiency is important and
3546        where many star positions are all to be transformed for one date.
3547        The star-independent astrometry parameters can be obtained by
3548        calling one of the functions eraApci[13], eraApcg[13], eraApco[13]
3549        or eraApcs[13].
3550
3551        Given:
3552           ri,di  double     CIRS RA,Dec (radians)
3553           astrom eraASTROM* star-independent astrometry parameters:
3554            pmt    double       PM time interval (SSB, Julian years)
3555            eb     double[3]    SSB to observer (vector, au)
3556            eh     double[3]    Sun to observer (unit vector)
3557            em     double       distance from Sun to observer (au)
3558            v      double[3]    barycentric observer velocity (vector, c)
3559            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
3560            bpn    double[3][3] bias-precession-nutation matrix
3561            along  double       longitude + s' (radians)
3562            xpl    double       polar motion xp wrt local meridian (radians)
3563            ypl    double       polar motion yp wrt local meridian (radians)
3564            sphi   double       sine of geodetic latitude
3565            cphi   double       cosine of geodetic latitude
3566            diurab double       magnitude of diurnal aberration vector
3567            eral   double       "local" Earth rotation angle (radians)
3568            refa   double       refraction constant A (radians)
3569            refb   double       refraction constant B (radians)
3570
3571        Returned:
3572           rc,dc  double     ICRS astrometric RA,Dec (radians)
3573
3574        Notes:
3575
3576        1) Only the Sun is taken into account in the light deflection
3577           correction.
3578
3579        2) Iterative techniques are used for the aberration and light
3580           deflection corrections so that the functions eraAtic13 (or
3581           eraAticq) and eraAtci13 (or eraAtciq) are accurate inverses;
3582           even at the edge of the Sun's disk the discrepancy is only about
3583           1 nanoarcsecond.
3584
3585        Called:
3586           eraS2c       spherical coordinates to unit vector
3587           eraTrxp      product of transpose of r-matrix and p-vector
3588           eraZp        zero p-vector
3589           eraAb        stellar aberration
3590           eraLdsun     light deflection by the Sun
3591           eraC2s       p-vector to spherical
3592           eraAnp       normalize angle into range +/- pi
3593
3594        This revision:   2013 October 9
3595
3596        Copyright (C) 2013-2021, NumFOCUS Foundation.
3597        Derived, with permission, from the SOFA library.  See notes at end of file.
3598
3599    """
3600    rc, dc = ufunc.aticq(ri, di, astrom)
3601    return rc, dc
3602
3603
3604def aticqn(ri, di, astrom, b):
3605    """
3606    Quick CIRS to ICRS astrometric place transformation, given the star-
3607    independent astrometry parameters plus a list of light-deflecting
3608    bodies.
3609
3610    Parameters
3611    ----------
3612    ri : double array
3613    di : double array
3614    astrom : eraASTROM array
3615    b : eraLDBODY array
3616
3617    Returns
3618    -------
3619    rc : double array
3620    dc : double array
3621
3622    Notes
3623    -----
3624    Wraps ERFA function ``eraAticqn``. The ERFA documentation is::
3625
3626        - - - - - - - - - -
3627         e r a A t i c q n
3628        - - - - - - - - - -
3629
3630        Quick CIRS to ICRS astrometric place transformation, given the star-
3631        independent astrometry parameters plus a list of light-deflecting
3632        bodies.
3633
3634        Use of this function is appropriate when efficiency is important and
3635        where many star positions are all to be transformed for one date.
3636        The star-independent astrometry parameters can be obtained by
3637        calling one of the functions eraApci[13], eraApcg[13], eraApco[13]
3638        or eraApcs[13].
3639
3640        If the only light-deflecting body to be taken into account is the
3641        Sun, the eraAticq function can be used instead.
3642
3643        Given:
3644           ri,di  double      CIRS RA,Dec (radians)
3645           astrom eraASTROM        star-independent astrometry parameters:
3646            pmt    double       PM time interval (SSB, Julian years)
3647            eb     double[3]    SSB to observer (vector, au)
3648            eh     double[3]    Sun to observer (unit vector)
3649            em     double       distance from Sun to observer (au)
3650            v      double[3]    barycentric observer velocity (vector, c)
3651            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
3652            bpn    double[3][3] bias-precession-nutation matrix
3653            along  double       longitude + s' (radians)
3654            xpl    double       polar motion xp wrt local meridian (radians)
3655            ypl    double       polar motion yp wrt local meridian (radians)
3656            sphi   double       sine of geodetic latitude
3657            cphi   double       cosine of geodetic latitude
3658            diurab double       magnitude of diurnal aberration vector
3659            eral   double       "local" Earth rotation angle (radians)
3660            refa   double       refraction constant A (radians)
3661            refb   double       refraction constant B (radians)
3662           n      int          number of bodies (Note 3)
3663           b      eraLDBODY[n] data for each of the n bodies (Notes 3,4):
3664            bm     double       mass of the body (solar masses, Note 5)
3665            dl     double       deflection limiter (Note 6)
3666            pv     [2][3]       barycentric PV of the body (au, au/day)
3667
3668        Returned:
3669           rc,dc  double     ICRS astrometric RA,Dec (radians)
3670
3671        Notes:
3672
3673        1) Iterative techniques are used for the aberration and light
3674           deflection corrections so that the functions eraAticqn and
3675           eraAtciqn are accurate inverses; even at the edge of the Sun's
3676           disk the discrepancy is only about 1 nanoarcsecond.
3677
3678        2) If the only light-deflecting body to be taken into account is the
3679           Sun, the eraAticq function can be used instead.
3680
3681        3) The struct b contains n entries, one for each body to be
3682           considered.  If n = 0, no gravitational light deflection will be
3683           applied, not even for the Sun.
3684
3685        4) The struct b should include an entry for the Sun as well as for
3686           any planet or other body to be taken into account.  The entries
3687           should be in the order in which the light passes the body.
3688
3689        5) In the entry in the b struct for body i, the mass parameter
3690           b[i].bm can, as required, be adjusted in order to allow for such
3691           effects as quadrupole field.
3692
3693        6) The deflection limiter parameter b[i].dl is phi^2/2, where phi is
3694           the angular separation (in radians) between star and body at
3695           which limiting is applied.  As phi shrinks below the chosen
3696           threshold, the deflection is artificially reduced, reaching zero
3697           for phi = 0.   Example values suitable for a terrestrial
3698           observer, together with masses, are as follows:
3699
3700              body i     b[i].bm        b[i].dl
3701
3702              Sun        1.0            6e-6
3703              Jupiter    0.00095435     3e-9
3704              Saturn     0.00028574     3e-10
3705
3706        7) For efficiency, validation of the contents of the b array is
3707           omitted.  The supplied masses must be greater than zero, the
3708           position and velocity vectors must be right, and the deflection
3709           limiter greater than zero.
3710
3711        Called:
3712           eraS2c       spherical coordinates to unit vector
3713           eraTrxp      product of transpose of r-matrix and p-vector
3714           eraZp        zero p-vector
3715           eraAb        stellar aberration
3716           eraLdn       light deflection by n bodies
3717           eraC2s       p-vector to spherical
3718           eraAnp       normalize angle into range +/- pi
3719
3720        This revision:   2021 January 6
3721
3722        Copyright (C) 2013-2021, NumFOCUS Foundation.
3723        Derived, with permission, from the SOFA library.  See notes at end of file.
3724
3725    """
3726    rc, dc = ufunc.aticqn(ri, di, astrom, b)
3727    return rc, dc
3728
3729
3730def atio13(ri, di, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl):
3731    """
3732    CIRS RA,Dec to observed place.  The caller supplies UTC, site
3733    coordinates, ambient air conditions and observing wavelength.
3734
3735    Parameters
3736    ----------
3737    ri : double array
3738    di : double array
3739    utc1 : double array
3740    utc2 : double array
3741    dut1 : double array
3742    elong : double array
3743    phi : double array
3744    hm : double array
3745    xp : double array
3746    yp : double array
3747    phpa : double array
3748    tc : double array
3749    rh : double array
3750    wl : double array
3751
3752    Returns
3753    -------
3754    aob : double array
3755    zob : double array
3756    hob : double array
3757    dob : double array
3758    rob : double array
3759
3760    Notes
3761    -----
3762    Wraps ERFA function ``eraAtio13``. The ERFA documentation is::
3763
3764        - - - - - - - - - -
3765         e r a A t i o 1 3
3766        - - - - - - - - - -
3767
3768        CIRS RA,Dec to observed place.  The caller supplies UTC, site
3769        coordinates, ambient air conditions and observing wavelength.
3770
3771        Given:
3772           ri     double   CIRS right ascension (CIO-based, radians)
3773           di     double   CIRS declination (radians)
3774           utc1   double   UTC as a 2-part...
3775           utc2   double   ...quasi Julian Date (Notes 1,2)
3776           dut1   double   UT1-UTC (seconds, Note 3)
3777           elong  double   longitude (radians, east +ve, Note 4)
3778           phi    double   geodetic latitude (radians, Note 4)
3779           hm     double   height above ellipsoid (m, geodetic Notes 4,6)
3780           xp,yp  double   polar motion coordinates (radians, Note 5)
3781           phpa   double   pressure at the observer (hPa = mB, Note 6)
3782           tc     double   ambient temperature at the observer (deg C)
3783           rh     double   relative humidity at the observer (range 0-1)
3784           wl     double   wavelength (micrometers, Note 7)
3785
3786        Returned:
3787           aob    double        observed azimuth (radians: N=0,E=90)
3788           zob    double        observed zenith distance (radians)
3789           hob    double        observed hour angle (radians)
3790           dob    double        observed declination (radians)
3791           rob    double        observed right ascension (CIO-based, radians)
3792
3793        Returned (function value):
3794                  int      status: +1 = dubious year (Note 2)
3795                                    0 = OK
3796                                   -1 = unacceptable date
3797
3798        Notes:
3799
3800        1)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
3801            convenient way between the two arguments, for example where utc1
3802            is the Julian Day Number and utc2 is the fraction of a day.
3803
3804            However, JD cannot unambiguously represent UTC during a leap
3805            second unless special measures are taken.  The convention in the
3806            present function is that the JD day represents UTC days whether
3807            the length is 86399, 86400 or 86401 SI seconds.
3808
3809            Applications should use the function eraDtf2d to convert from
3810            calendar date and time of day into 2-part quasi Julian Date, as
3811            it implements the leap-second-ambiguity convention just
3812            described.
3813
3814        2)  The warning status "dubious year" flags UTCs that predate the
3815            introduction of the time scale or that are too far in the
3816            future to be trusted.  See eraDat for further details.
3817
3818        3)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
3819            one second at the end of each positive UTC leap second,
3820            introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
3821            practice is under review, and in the future UT1-UTC may grow
3822            essentially without limit.
3823
3824        4)  The geographical coordinates are with respect to the ERFA_WGS84
3825            reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
3826            longitude required by the present function is east-positive
3827            (i.e. right-handed), in accordance with geographical convention.
3828
3829        5)  The polar motion xp,yp can be obtained from IERS bulletins.  The
3830            values are the coordinates (in radians) of the Celestial
3831            Intermediate Pole with respect to the International Terrestrial
3832            Reference System (see IERS Conventions 2003), measured along the
3833            meridians 0 and 90 deg west respectively.  For many
3834            applications, xp and yp can be set to zero.
3835
3836        6)  If hm, the height above the ellipsoid of the observing station
3837            in meters, is not known but phpa, the pressure in hPa (=mB), is
3838            available, an adequate estimate of hm can be obtained from the
3839            expression
3840
3841                  hm = -29.3 * tsl * log ( phpa / 1013.25 );
3842
3843            where tsl is the approximate sea-level air temperature in K
3844            (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
3845            52).  Similarly, if the pressure phpa is not known, it can be
3846            estimated from the height of the observing station, hm, as
3847            follows:
3848
3849                  phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
3850
3851            Note, however, that the refraction is nearly proportional to
3852            the pressure and that an accurate phpa value is important for
3853            precise work.
3854
3855        7)  The argument wl specifies the observing wavelength in
3856            micrometers.  The transition from optical to radio is assumed to
3857            occur at 100 micrometers (about 3000 GHz).
3858
3859        8)  "Observed" Az,ZD means the position that would be seen by a
3860            perfect geodetically aligned theodolite.  (Zenith distance is
3861            used rather than altitude in order to reflect the fact that no
3862            allowance is made for depression of the horizon.)  This is
3863            related to the observed HA,Dec via the standard rotation, using
3864            the geodetic latitude (corrected for polar motion), while the
3865            observed HA and RA are related simply through the Earth rotation
3866            angle and the site longitude.  "Observed" RA,Dec or HA,Dec thus
3867            means the position that would be seen by a perfect equatorial
3868            with its polar axis aligned to the Earth's axis of rotation.
3869
3870        9)  The accuracy of the result is limited by the corrections for
3871            refraction, which use a simple A*tan(z) + B*tan^3(z) model.
3872            Providing the meteorological parameters are known accurately and
3873            there are no gross local effects, the predicted astrometric
3874            coordinates should be within 0.05 arcsec (optical) or 1 arcsec
3875            (radio) for a zenith distance of less than 70 degrees, better
3876            than 30 arcsec (optical or radio) at 85 degrees and better
3877            than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
3878
3879        10) The complementary functions eraAtio13 and eraAtoi13 are self-
3880            consistent to better than 1 microarcsecond all over the
3881            celestial sphere.
3882
3883        11) It is advisable to take great care with units, as even unlikely
3884            values of the input parameters are accepted and processed in
3885            accordance with the models used.
3886
3887        Called:
3888           eraApio13    astrometry parameters, CIRS-observed, 2013
3889           eraAtioq     quick CIRS to observed
3890
3891        This revision:   2021 February 24
3892
3893        Copyright (C) 2013-2021, NumFOCUS Foundation.
3894        Derived, with permission, from the SOFA library.  See notes at end of file.
3895
3896    """
3897    aob, zob, hob, dob, rob, c_retval = ufunc.atio13(
3898        ri, di, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl)
3899    check_errwarn(c_retval, 'atio13')
3900    return aob, zob, hob, dob, rob
3901
3902
3903STATUS_CODES['atio13'] = {
3904    1: 'dubious year (Note 2)',
3905    0: 'OK',
3906    -1: 'unacceptable date',
3907}
3908
3909
3910def atioq(ri, di, astrom):
3911    """
3912    Quick CIRS to observed place transformation.
3913
3914    Parameters
3915    ----------
3916    ri : double array
3917    di : double array
3918    astrom : eraASTROM array
3919
3920    Returns
3921    -------
3922    aob : double array
3923    zob : double array
3924    hob : double array
3925    dob : double array
3926    rob : double array
3927
3928    Notes
3929    -----
3930    Wraps ERFA function ``eraAtioq``. The ERFA documentation is::
3931
3932        - - - - - - - - -
3933         e r a A t i o q
3934        - - - - - - - - -
3935
3936        Quick CIRS to observed place transformation.
3937
3938        Use of this function is appropriate when efficiency is important and
3939        where many star positions are all to be transformed for one date.
3940        The star-independent astrometry parameters can be obtained by
3941        calling eraApio[13] or eraApco[13].
3942
3943        Given:
3944           ri     double     CIRS right ascension
3945           di     double     CIRS declination
3946           astrom eraASTROM* star-independent astrometry parameters:
3947            pmt    double       PM time interval (SSB, Julian years)
3948            eb     double[3]    SSB to observer (vector, au)
3949            eh     double[3]    Sun to observer (unit vector)
3950            em     double       distance from Sun to observer (au)
3951            v      double[3]    barycentric observer velocity (vector, c)
3952            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
3953            bpn    double[3][3] bias-precession-nutation matrix
3954            along  double       longitude + s' (radians)
3955            xpl    double       polar motion xp wrt local meridian (radians)
3956            ypl    double       polar motion yp wrt local meridian (radians)
3957            sphi   double       sine of geodetic latitude
3958            cphi   double       cosine of geodetic latitude
3959            diurab double       magnitude of diurnal aberration vector
3960            eral   double       "local" Earth rotation angle (radians)
3961            refa   double       refraction constant A (radians)
3962            refb   double       refraction constant B (radians)
3963
3964        Returned:
3965           aob    double          observed azimuth (radians: N=0,E=90)
3966           zob    double          observed zenith distance (radians)
3967           hob    double          observed hour angle (radians)
3968           dob    double          observed declination (radians)
3969           rob    double          observed right ascension (CIO-based, radians)
3970
3971        Notes:
3972
3973        1) This function returns zenith distance rather than altitude in
3974           order to reflect the fact that no allowance is made for
3975           depression of the horizon.
3976
3977        2) The accuracy of the result is limited by the corrections for
3978           refraction, which use a simple A*tan(z) + B*tan^3(z) model.
3979           Providing the meteorological parameters are known accurately and
3980           there are no gross local effects, the predicted observed
3981           coordinates should be within 0.05 arcsec (optical) or 1 arcsec
3982           (radio) for a zenith distance of less than 70 degrees, better
3983           than 30 arcsec (optical or radio) at 85 degrees and better
3984           than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
3985
3986           Without refraction, the complementary functions eraAtioq and
3987           eraAtoiq are self-consistent to better than 1 microarcsecond all
3988           over the celestial sphere.  With refraction included, consistency
3989           falls off at high zenith distances, but is still better than
3990           0.05 arcsec at 85 degrees.
3991
3992        3) It is advisable to take great care with units, as even unlikely
3993           values of the input parameters are accepted and processed in
3994           accordance with the models used.
3995
3996        4) The CIRS RA,Dec is obtained from a star catalog mean place by
3997           allowing for space motion, parallax, the Sun's gravitational lens
3998           effect, annual aberration and precession-nutation.  For star
3999           positions in the ICRS, these effects can be applied by means of
4000           the eraAtci13 (etc.) functions.  Starting from classical "mean
4001           place" systems, additional transformations will be needed first.
4002
4003        5) "Observed" Az,El means the position that would be seen by a
4004           perfect geodetically aligned theodolite.  This is obtained from
4005           the CIRS RA,Dec by allowing for Earth orientation and diurnal
4006           aberration, rotating from equator to horizon coordinates, and
4007           then adjusting for refraction.  The HA,Dec is obtained by
4008           rotating back into equatorial coordinates, and is the position
4009           that would be seen by a perfect equatorial with its polar axis
4010           aligned to the Earth's axis of rotation.  Finally, the RA is
4011           obtained by subtracting the HA from the local ERA.
4012
4013        6) The star-independent CIRS-to-observed-place parameters in ASTROM
4014           may be computed with eraApio[13] or eraApco[13].  If nothing has
4015           changed significantly except the time, eraAper[13] may be used to
4016           perform the requisite adjustment to the astrom structure.
4017
4018        Called:
4019           eraS2c       spherical coordinates to unit vector
4020           eraC2s       p-vector to spherical
4021           eraAnp       normalize angle into range 0 to 2pi
4022
4023        This revision:   2020 December 7
4024
4025        Copyright (C) 2013-2021, NumFOCUS Foundation.
4026        Derived, with permission, from the SOFA library.  See notes at end of file.
4027
4028    """
4029    aob, zob, hob, dob, rob = ufunc.atioq(ri, di, astrom)
4030    return aob, zob, hob, dob, rob
4031
4032
4033def atoc13(type, ob1, ob2, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl):
4034    """
4035    Observed place at a groundbased site to to ICRS astrometric RA,Dec.
4036    The caller supplies UTC, site coordinates, ambient air conditions
4037    and observing wavelength.
4038
4039    Parameters
4040    ----------
4041    type : const char array
4042    ob1 : double array
4043    ob2 : double array
4044    utc1 : double array
4045    utc2 : double array
4046    dut1 : double array
4047    elong : double array
4048    phi : double array
4049    hm : double array
4050    xp : double array
4051    yp : double array
4052    phpa : double array
4053    tc : double array
4054    rh : double array
4055    wl : double array
4056
4057    Returns
4058    -------
4059    rc : double array
4060    dc : double array
4061
4062    Notes
4063    -----
4064    Wraps ERFA function ``eraAtoc13``. The ERFA documentation is::
4065
4066        - - - - - - - - - -
4067         e r a A t o c 1 3
4068        - - - - - - - - - -
4069
4070        Observed place at a groundbased site to to ICRS astrometric RA,Dec.
4071        The caller supplies UTC, site coordinates, ambient air conditions
4072        and observing wavelength.
4073
4074        Given:
4075           type   char[]   type of coordinates - "R", "H" or "A" (Notes 1,2)
4076           ob1    double   observed Az, HA or RA (radians; Az is N=0,E=90)
4077           ob2    double   observed ZD or Dec (radians)
4078           utc1   double   UTC as a 2-part...
4079           utc2   double   ...quasi Julian Date (Notes 3,4)
4080           dut1   double   UT1-UTC (seconds, Note 5)
4081           elong  double   longitude (radians, east +ve, Note 6)
4082           phi    double   geodetic latitude (radians, Note 6)
4083           hm     double   height above ellipsoid (m, geodetic Notes 6,8)
4084           xp,yp  double   polar motion coordinates (radians, Note 7)
4085           phpa   double   pressure at the observer (hPa = mB, Note 8)
4086           tc     double   ambient temperature at the observer (deg C)
4087           rh     double   relative humidity at the observer (range 0-1)
4088           wl     double   wavelength (micrometers, Note 9)
4089
4090        Returned:
4091           rc,dc  double   ICRS astrometric RA,Dec (radians)
4092
4093        Returned (function value):
4094                  int      status: +1 = dubious year (Note 4)
4095                                    0 = OK
4096                                   -1 = unacceptable date
4097
4098        Notes:
4099
4100        1)  "Observed" Az,ZD means the position that would be seen by a
4101            perfect geodetically aligned theodolite.  (Zenith distance is
4102            used rather than altitude in order to reflect the fact that no
4103            allowance is made for depression of the horizon.)  This is
4104            related to the observed HA,Dec via the standard rotation, using
4105            the geodetic latitude (corrected for polar motion), while the
4106            observed HA and RA are related simply through the Earth rotation
4107            angle and the site longitude.  "Observed" RA,Dec or HA,Dec thus
4108            means the position that would be seen by a perfect equatorial
4109            with its polar axis aligned to the Earth's axis of rotation.
4110
4111        2)  Only the first character of the type argument is significant.
4112            "R" or "r" indicates that ob1 and ob2 are the observed right
4113            ascension and declination;  "H" or "h" indicates that they are
4114            hour angle (west +ve) and declination;  anything else ("A" or
4115            "a" is recommended) indicates that ob1 and ob2 are azimuth
4116            (north zero, east 90 deg) and zenith distance.
4117
4118        3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
4119            convenient way between the two arguments, for example where utc1
4120            is the Julian Day Number and utc2 is the fraction of a day.
4121
4122            However, JD cannot unambiguously represent UTC during a leap
4123            second unless special measures are taken.  The convention in the
4124            present function is that the JD day represents UTC days whether
4125            the length is 86399, 86400 or 86401 SI seconds.
4126
4127            Applications should use the function eraDtf2d to convert from
4128            calendar date and time of day into 2-part quasi Julian Date, as
4129            it implements the leap-second-ambiguity convention just
4130            described.
4131
4132        4)  The warning status "dubious year" flags UTCs that predate the
4133            introduction of the time scale or that are too far in the
4134            future to be trusted.  See eraDat for further details.
4135
4136        5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
4137            one second at the end of each positive UTC leap second,
4138            introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
4139            practice is under review, and in the future UT1-UTC may grow
4140            essentially without limit.
4141
4142        6)  The geographical coordinates are with respect to the ERFA_WGS84
4143            reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
4144            longitude required by the present function is east-positive
4145            (i.e. right-handed), in accordance with geographical convention.
4146
4147        7)  The polar motion xp,yp can be obtained from IERS bulletins.  The
4148            values are the coordinates (in radians) of the Celestial
4149            Intermediate Pole with respect to the International Terrestrial
4150            Reference System (see IERS Conventions 2003), measured along the
4151            meridians 0 and 90 deg west respectively.  For many
4152            applications, xp and yp can be set to zero.
4153
4154        8)  If hm, the height above the ellipsoid of the observing station
4155            in meters, is not known but phpa, the pressure in hPa (=mB), is
4156            available, an adequate estimate of hm can be obtained from the
4157            expression
4158
4159                  hm = -29.3 * tsl * log ( phpa / 1013.25 );
4160
4161            where tsl is the approximate sea-level air temperature in K
4162            (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
4163            52).  Similarly, if the pressure phpa is not known, it can be
4164            estimated from the height of the observing station, hm, as
4165            follows:
4166
4167                  phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
4168
4169            Note, however, that the refraction is nearly proportional to
4170            the pressure and that an accurate phpa value is important for
4171            precise work.
4172
4173        9)  The argument wl specifies the observing wavelength in
4174            micrometers.  The transition from optical to radio is assumed to
4175            occur at 100 micrometers (about 3000 GHz).
4176
4177        10) The accuracy of the result is limited by the corrections for
4178            refraction, which use a simple A*tan(z) + B*tan^3(z) model.
4179            Providing the meteorological parameters are known accurately and
4180            there are no gross local effects, the predicted astrometric
4181            coordinates should be within 0.05 arcsec (optical) or 1 arcsec
4182            (radio) for a zenith distance of less than 70 degrees, better
4183            than 30 arcsec (optical or radio) at 85 degrees and better
4184            than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
4185
4186            Without refraction, the complementary functions eraAtco13 and
4187            eraAtoc13 are self-consistent to better than 1 microarcsecond
4188            all over the celestial sphere.  With refraction included,
4189            consistency falls off at high zenith distances, but is still
4190            better than 0.05 arcsec at 85 degrees.
4191
4192        11) It is advisable to take great care with units, as even unlikely
4193            values of the input parameters are accepted and processed in
4194            accordance with the models used.
4195
4196        Called:
4197           eraApco13    astrometry parameters, ICRS-observed
4198           eraAtoiq     quick observed to CIRS
4199           eraAticq     quick CIRS to ICRS
4200
4201        This revision:   2021 February 24
4202
4203        Copyright (C) 2013-2021, NumFOCUS Foundation.
4204        Derived, with permission, from the SOFA library.  See notes at end of file.
4205
4206    """
4207    rc, dc, c_retval = ufunc.atoc13(
4208        type, ob1, ob2, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl)
4209    check_errwarn(c_retval, 'atoc13')
4210    return rc, dc
4211
4212
4213STATUS_CODES['atoc13'] = {
4214    1: 'dubious year (Note 4)',
4215    0: 'OK',
4216    -1: 'unacceptable date',
4217}
4218
4219
4220def atoi13(type, ob1, ob2, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl):
4221    """
4222    Observed place to CIRS.  The caller supplies UTC, site coordinates,
4223    ambient air conditions and observing wavelength.
4224
4225    Parameters
4226    ----------
4227    type : const char array
4228    ob1 : double array
4229    ob2 : double array
4230    utc1 : double array
4231    utc2 : double array
4232    dut1 : double array
4233    elong : double array
4234    phi : double array
4235    hm : double array
4236    xp : double array
4237    yp : double array
4238    phpa : double array
4239    tc : double array
4240    rh : double array
4241    wl : double array
4242
4243    Returns
4244    -------
4245    ri : double array
4246    di : double array
4247
4248    Notes
4249    -----
4250    Wraps ERFA function ``eraAtoi13``. The ERFA documentation is::
4251
4252        - - - - - - - - - -
4253         e r a A t o i 1 3
4254        - - - - - - - - - -
4255
4256        Observed place to CIRS.  The caller supplies UTC, site coordinates,
4257        ambient air conditions and observing wavelength.
4258
4259        Given:
4260           type   char[]   type of coordinates - "R", "H" or "A" (Notes 1,2)
4261           ob1    double   observed Az, HA or RA (radians; Az is N=0,E=90)
4262           ob2    double   observed ZD or Dec (radians)
4263           utc1   double   UTC as a 2-part...
4264           utc2   double   ...quasi Julian Date (Notes 3,4)
4265           dut1   double   UT1-UTC (seconds, Note 5)
4266           elong  double   longitude (radians, east +ve, Note 6)
4267           phi    double   geodetic latitude (radians, Note 6)
4268           hm     double   height above the ellipsoid (meters, Notes 6,8)
4269           xp,yp  double   polar motion coordinates (radians, Note 7)
4270           phpa   double   pressure at the observer (hPa = mB, Note 8)
4271           tc     double   ambient temperature at the observer (deg C)
4272           rh     double   relative humidity at the observer (range 0-1)
4273           wl     double   wavelength (micrometers, Note 9)
4274
4275        Returned:
4276           ri     double        CIRS right ascension (CIO-based, radians)
4277           di     double        CIRS declination (radians)
4278
4279        Returned (function value):
4280                  int      status: +1 = dubious year (Note 2)
4281                                    0 = OK
4282                                   -1 = unacceptable date
4283
4284        Notes:
4285
4286        1)  "Observed" Az,ZD means the position that would be seen by a
4287            perfect geodetically aligned theodolite.  (Zenith distance is
4288            used rather than altitude in order to reflect the fact that no
4289            allowance is made for depression of the horizon.)  This is
4290            related to the observed HA,Dec via the standard rotation, using
4291            the geodetic latitude (corrected for polar motion), while the
4292            observed HA and RA are related simply through the Earth rotation
4293            angle and the site longitude.  "Observed" RA,Dec or HA,Dec thus
4294            means the position that would be seen by a perfect equatorial
4295            with its polar axis aligned to the Earth's axis of rotation.
4296
4297        2)  Only the first character of the type argument is significant.
4298            "R" or "r" indicates that ob1 and ob2 are the observed right
4299            ascension and declination;  "H" or "h" indicates that they are
4300            hour angle (west +ve) and declination;  anything else ("A" or
4301            "a" is recommended) indicates that ob1 and ob2 are azimuth
4302            (north zero, east 90 deg) and zenith distance.
4303
4304        3)  utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
4305            convenient way between the two arguments, for example where utc1
4306            is the Julian Day Number and utc2 is the fraction of a day.
4307
4308            However, JD cannot unambiguously represent UTC during a leap
4309            second unless special measures are taken.  The convention in the
4310            present function is that the JD day represents UTC days whether
4311            the length is 86399, 86400 or 86401 SI seconds.
4312
4313            Applications should use the function eraDtf2d to convert from
4314            calendar date and time of day into 2-part quasi Julian Date, as
4315            it implements the leap-second-ambiguity convention just
4316            described.
4317
4318        4)  The warning status "dubious year" flags UTCs that predate the
4319            introduction of the time scale or that are too far in the
4320            future to be trusted.  See eraDat for further details.
4321
4322        5)  UT1-UTC is tabulated in IERS bulletins.  It increases by exactly
4323            one second at the end of each positive UTC leap second,
4324            introduced in order to keep UT1-UTC within +/- 0.9s.  n.b. This
4325            practice is under review, and in the future UT1-UTC may grow
4326            essentially without limit.
4327
4328        6)  The geographical coordinates are with respect to the ERFA_WGS84
4329            reference ellipsoid.  TAKE CARE WITH THE LONGITUDE SIGN:  the
4330            longitude required by the present function is east-positive
4331            (i.e. right-handed), in accordance with geographical convention.
4332
4333        7)  The polar motion xp,yp can be obtained from IERS bulletins.  The
4334            values are the coordinates (in radians) of the Celestial
4335            Intermediate Pole with respect to the International Terrestrial
4336            Reference System (see IERS Conventions 2003), measured along the
4337            meridians 0 and 90 deg west respectively.  For many
4338            applications, xp and yp can be set to zero.
4339
4340        8)  If hm, the height above the ellipsoid of the observing station
4341            in meters, is not known but phpa, the pressure in hPa (=mB), is
4342            available, an adequate estimate of hm can be obtained from the
4343            expression
4344
4345                  hm = -29.3 * tsl * log ( phpa / 1013.25 );
4346
4347            where tsl is the approximate sea-level air temperature in K
4348            (See Astrophysical Quantities, C.W.Allen, 3rd edition, section
4349            52).  Similarly, if the pressure phpa is not known, it can be
4350            estimated from the height of the observing station, hm, as
4351            follows:
4352
4353                  phpa = 1013.25 * exp ( -hm / ( 29.3 * tsl ) );
4354
4355            Note, however, that the refraction is nearly proportional to
4356            the pressure and that an accurate phpa value is important for
4357            precise work.
4358
4359        9)  The argument wl specifies the observing wavelength in
4360            micrometers.  The transition from optical to radio is assumed to
4361            occur at 100 micrometers (about 3000 GHz).
4362
4363        10) The accuracy of the result is limited by the corrections for
4364            refraction, which use a simple A*tan(z) + B*tan^3(z) model.
4365            Providing the meteorological parameters are known accurately and
4366            there are no gross local effects, the predicted astrometric
4367            coordinates should be within 0.05 arcsec (optical) or 1 arcsec
4368            (radio) for a zenith distance of less than 70 degrees, better
4369            than 30 arcsec (optical or radio) at 85 degrees and better
4370            than 20 arcmin (optical) or 30 arcmin (radio) at the horizon.
4371
4372            Without refraction, the complementary functions eraAtio13 and
4373            eraAtoi13 are self-consistent to better than 1 microarcsecond
4374            all over the celestial sphere.  With refraction included,
4375            consistency falls off at high zenith distances, but is still
4376            better than 0.05 arcsec at 85 degrees.
4377
4378        12) It is advisable to take great care with units, as even unlikely
4379            values of the input parameters are accepted and processed in
4380            accordance with the models used.
4381
4382        Called:
4383           eraApio13    astrometry parameters, CIRS-observed, 2013
4384           eraAtoiq     quick observed to CIRS
4385
4386        This revision:   2021 February 24
4387
4388        Copyright (C) 2013-2021, NumFOCUS Foundation.
4389        Derived, with permission, from the SOFA library.  See notes at end of file.
4390
4391    """
4392    ri, di, c_retval = ufunc.atoi13(
4393        type, ob1, ob2, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl)
4394    check_errwarn(c_retval, 'atoi13')
4395    return ri, di
4396
4397
4398STATUS_CODES['atoi13'] = {
4399    1: 'dubious year (Note 2)',
4400    0: 'OK',
4401    -1: 'unacceptable date',
4402}
4403
4404
4405def atoiq(type, ob1, ob2, astrom):
4406    """
4407    Quick observed place to CIRS, given the star-independent astrometry
4408    parameters.
4409
4410    Parameters
4411    ----------
4412    type : const char array
4413    ob1 : double array
4414    ob2 : double array
4415    astrom : eraASTROM array
4416
4417    Returns
4418    -------
4419    ri : double array
4420    di : double array
4421
4422    Notes
4423    -----
4424    Wraps ERFA function ``eraAtoiq``. The ERFA documentation is::
4425
4426        - - - - - - - - -
4427         e r a A t o i q
4428        - - - - - - - - -
4429
4430        Quick observed place to CIRS, given the star-independent astrometry
4431        parameters.
4432
4433        Use of this function is appropriate when efficiency is important and
4434        where many star positions are all to be transformed for one date.
4435        The star-independent astrometry parameters can be obtained by
4436        calling eraApio[13] or eraApco[13].
4437
4438        Given:
4439           type   char[]     type of coordinates: "R", "H" or "A" (Note 1)
4440           ob1    double     observed Az, HA or RA (radians; Az is N=0,E=90)
4441           ob2    double     observed ZD or Dec (radians)
4442           astrom eraASTROM* star-independent astrometry parameters:
4443            pmt    double       PM time interval (SSB, Julian years)
4444            eb     double[3]    SSB to observer (vector, au)
4445            eh     double[3]    Sun to observer (unit vector)
4446            em     double       distance from Sun to observer (au)
4447            v      double[3]    barycentric observer velocity (vector, c)
4448            bm1    double       sqrt(1-|v|^2): reciprocal of Lorenz factor
4449            bpn    double[3][3] bias-precession-nutation matrix
4450            along  double       longitude + s' (radians)
4451            xpl    double       polar motion xp wrt local meridian (radians)
4452            ypl    double       polar motion yp wrt local meridian (radians)
4453            sphi   double       sine of geodetic latitude
4454            cphi   double       cosine of geodetic latitude
4455            diurab double       magnitude of diurnal aberration vector
4456            eral   double       "local" Earth rotation angle (radians)
4457            refa   double       refraction constant A (radians)
4458            refb   double       refraction constant B (radians)
4459
4460        Returned:
4461           ri     double          CIRS right ascension (CIO-based, radians)
4462           di     double          CIRS declination (radians)
4463
4464        Notes:
4465
4466        1) "Observed" Az,El means the position that would be seen by a
4467           perfect geodetically aligned theodolite.  This is related to
4468           the observed HA,Dec via the standard rotation, using the geodetic
4469           latitude (corrected for polar motion), while the observed HA and
4470           RA are related simply through the Earth rotation angle and the
4471           site longitude.  "Observed" RA,Dec or HA,Dec thus means the
4472           position that would be seen by a perfect equatorial with its
4473           polar axis aligned to the Earth's axis of rotation.  By removing
4474           from the observed place the effects of atmospheric refraction and
4475           diurnal aberration, the CIRS RA,Dec is obtained.
4476
4477        2) Only the first character of the type argument is significant.
4478           "R" or "r" indicates that ob1 and ob2 are the observed right
4479           ascension and declination;  "H" or "h" indicates that they are
4480           hour angle (west +ve) and declination;  anything else ("A" or
4481           "a" is recommended) indicates that ob1 and ob2 are azimuth (north
4482           zero, east 90 deg) and zenith distance.  (Zenith distance is used
4483           rather than altitude in order to reflect the fact that no
4484           allowance is made for depression of the horizon.)
4485
4486        3) The accuracy of the result is limited by the corrections for
4487           refraction, which use a simple A*tan(z) + B*tan^3(z) model.
4488           Providing the meteorological parameters are known accurately and
4489           there are no gross local effects, the predicted intermediate
4490           coordinates should be within 0.05 arcsec (optical) or 1 arcsec
4491           (radio) for a zenith distance of less than 70 degrees, better
4492           than 30 arcsec (optical or radio) at 85 degrees and better than
4493           20 arcmin (optical) or 25 arcmin (radio) at the horizon.
4494
4495           Without refraction, the complementary functions eraAtioq and
4496           eraAtoiq are self-consistent to better than 1 microarcsecond all
4497           over the celestial sphere.  With refraction included, consistency
4498           falls off at high zenith distances, but is still better than
4499           0.05 arcsec at 85 degrees.
4500
4501        4) It is advisable to take great care with units, as even unlikely
4502           values of the input parameters are accepted and processed in
4503           accordance with the models used.
4504
4505        Called:
4506           eraS2c       spherical coordinates to unit vector
4507           eraC2s       p-vector to spherical
4508           eraAnp       normalize angle into range 0 to 2pi
4509
4510        This revision:   2020 December 7
4511
4512        Copyright (C) 2013-2021, NumFOCUS Foundation.
4513        Derived, with permission, from the SOFA library.  See notes at end of file.
4514
4515    """
4516    ri, di = ufunc.atoiq(type, ob1, ob2, astrom)
4517    return ri, di
4518
4519
4520def ld(bm, p, q, e, em, dlim):
4521    """
4522    Apply light deflection by a solar-system body, as part of
4523    transforming coordinate direction into natural direction.
4524
4525    Parameters
4526    ----------
4527    bm : double array
4528    p : double array
4529    q : double array
4530    e : double array
4531    em : double array
4532    dlim : double array
4533
4534    Returns
4535    -------
4536    p1 : double array
4537
4538    Notes
4539    -----
4540    Wraps ERFA function ``eraLd``. The ERFA documentation is::
4541
4542        - - - - - -
4543         e r a L d
4544        - - - - - -
4545
4546        Apply light deflection by a solar-system body, as part of
4547        transforming coordinate direction into natural direction.
4548
4549        Given:
4550           bm     double     mass of the gravitating body (solar masses)
4551           p      double[3]  direction from observer to source (unit vector)
4552           q      double[3]  direction from body to source (unit vector)
4553           e      double[3]  direction from body to observer (unit vector)
4554           em     double     distance from body to observer (au)
4555           dlim   double     deflection limiter (Note 4)
4556
4557        Returned:
4558           p1     double[3]  observer to deflected source (unit vector)
4559
4560        Notes:
4561
4562        1) The algorithm is based on Expr. (70) in Klioner (2003) and
4563           Expr. (7.63) in the Explanatory Supplement (Urban & Seidelmann
4564           2013), with some rearrangement to minimize the effects of machine
4565           precision.
4566
4567        2) The mass parameter bm can, as required, be adjusted in order to
4568           allow for such effects as quadrupole field.
4569
4570        3) The barycentric position of the deflecting body should ideally
4571           correspond to the time of closest approach of the light ray to
4572           the body.
4573
4574        4) The deflection limiter parameter dlim is phi^2/2, where phi is
4575           the angular separation (in radians) between source and body at
4576           which limiting is applied.  As phi shrinks below the chosen
4577           threshold, the deflection is artificially reduced, reaching zero
4578           for phi = 0.
4579
4580        5) The returned vector p1 is not normalized, but the consequential
4581           departure from unit magnitude is always negligible.
4582
4583        6) The arguments p and p1 can be the same array.
4584
4585        7) To accumulate total light deflection taking into account the
4586           contributions from several bodies, call the present function for
4587           each body in succession, in decreasing order of distance from the
4588           observer.
4589
4590        8) For efficiency, validation is omitted.  The supplied vectors must
4591           be of unit magnitude, and the deflection limiter non-zero and
4592           positive.
4593
4594        References:
4595
4596           Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
4597           the Astronomical Almanac, 3rd ed., University Science Books
4598           (2013).
4599
4600           Klioner, Sergei A., "A practical relativistic model for micro-
4601           arcsecond astrometry in space", Astr. J. 125, 1580-1597 (2003).
4602
4603        Called:
4604           eraPdp       scalar product of two p-vectors
4605           eraPxp       vector product of two p-vectors
4606
4607        This revision:   2021 February 24
4608
4609        Copyright (C) 2013-2021, NumFOCUS Foundation.
4610        Derived, with permission, from the SOFA library.  See notes at end of file.
4611
4612    """
4613    p1 = ufunc.ld(bm, p, q, e, em, dlim)
4614    return p1
4615
4616
4617def ldn(b, ob, sc):
4618    """
4619    For a star, apply light deflection by multiple solar-system bodies,
4620    as part of transforming coordinate direction into natural direction.
4621
4622    Parameters
4623    ----------
4624    b : eraLDBODY array
4625    ob : double array
4626    sc : double array
4627
4628    Returns
4629    -------
4630    sn : double array
4631
4632    Notes
4633    -----
4634    Wraps ERFA function ``eraLdn``. The ERFA documentation is::
4635
4636        - - - - - - -
4637         e r a L d n
4638        - - - - - - -
4639
4640        For a star, apply light deflection by multiple solar-system bodies,
4641        as part of transforming coordinate direction into natural direction.
4642
4643        Given:
4644           n    int           number of bodies (note 1)
4645           b    eraLDBODY[n]  data for each of the n bodies (Notes 1,2):
4646            bm   double         mass of the body (solar masses, Note 3)
4647            dl   double         deflection limiter (Note 4)
4648            pv   [2][3]         barycentric PV of the body (au, au/day)
4649           ob   double[3]     barycentric position of the observer (au)
4650           sc   double[3]     observer to star coord direction (unit vector)
4651
4652        Returned:
4653           sn    double[3]      observer to deflected star (unit vector)
4654
4655        1) The array b contains n entries, one for each body to be
4656           considered.  If n = 0, no gravitational light deflection will be
4657           applied, not even for the Sun.
4658
4659        2) The array b should include an entry for the Sun as well as for
4660           any planet or other body to be taken into account.  The entries
4661           should be in the order in which the light passes the body.
4662
4663        3) In the entry in the b array for body i, the mass parameter
4664           b[i].bm can, as required, be adjusted in order to allow for such
4665           effects as quadrupole field.
4666
4667        4) The deflection limiter parameter b[i].dl is phi^2/2, where phi is
4668           the angular separation (in radians) between star and body at
4669           which limiting is applied.  As phi shrinks below the chosen
4670           threshold, the deflection is artificially reduced, reaching zero
4671           for phi = 0.   Example values suitable for a terrestrial
4672           observer, together with masses, are as follows:
4673
4674              body i     b[i].bm        b[i].dl
4675
4676              Sun        1.0            6e-6
4677              Jupiter    0.00095435     3e-9
4678              Saturn     0.00028574     3e-10
4679
4680        5) For cases where the starlight passes the body before reaching the
4681           observer, the body is placed back along its barycentric track by
4682           the light time from that point to the observer.  For cases where
4683           the body is "behind" the observer no such shift is applied.  If
4684           a different treatment is preferred, the user has the option of
4685           instead using the eraLd function.  Similarly, eraLd can be used
4686           for cases where the source is nearby, not a star.
4687
4688        6) The returned vector sn is not normalized, but the consequential
4689           departure from unit magnitude is always negligible.
4690
4691        7) The arguments sc and sn can be the same array.
4692
4693        8) For efficiency, validation is omitted.  The supplied masses must
4694           be greater than zero, the position and velocity vectors must be
4695           right, and the deflection limiter greater than zero.
4696
4697        Reference:
4698
4699           Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
4700           the Astronomical Almanac, 3rd ed., University Science Books
4701           (2013), Section 7.2.4.
4702
4703        Called:
4704           eraCp        copy p-vector
4705           eraPdp       scalar product of two p-vectors
4706           eraPmp       p-vector minus p-vector
4707           eraPpsp      p-vector plus scaled p-vector
4708           eraPn        decompose p-vector into modulus and direction
4709           eraLd        light deflection by a solar-system body
4710
4711        This revision:   2021 February 24
4712
4713        Copyright (C) 2013-2021, NumFOCUS Foundation.
4714        Derived, with permission, from the SOFA library.  See notes at end of file.
4715
4716    """
4717    sn = ufunc.ldn(b, ob, sc)
4718    return sn
4719
4720
4721def ldsun(p, e, em):
4722    """
4723    Deflection of starlight by the Sun.
4724
4725    Parameters
4726    ----------
4727    p : double array
4728    e : double array
4729    em : double array
4730
4731    Returns
4732    -------
4733    p1 : double array
4734
4735    Notes
4736    -----
4737    Wraps ERFA function ``eraLdsun``. The ERFA documentation is::
4738
4739        - - - - - - - - -
4740         e r a L d s u n
4741        - - - - - - - - -
4742
4743        Deflection of starlight by the Sun.
4744
4745        Given:
4746           p      double[3]  direction from observer to star (unit vector)
4747           e      double[3]  direction from Sun to observer (unit vector)
4748           em     double     distance from Sun to observer (au)
4749
4750        Returned:
4751           p1     double[3]  observer to deflected star (unit vector)
4752
4753        Notes:
4754
4755        1) The source is presumed to be sufficiently distant that its
4756           directions seen from the Sun and the observer are essentially
4757           the same.
4758
4759        2) The deflection is restrained when the angle between the star and
4760           the center of the Sun is less than a threshold value, falling to
4761           zero deflection for zero separation.  The chosen threshold value
4762           is within the solar limb for all solar-system applications, and
4763           is about 5 arcminutes for the case of a terrestrial observer.
4764
4765        3) The arguments p and p1 can be the same array.
4766
4767        Called:
4768           eraLd        light deflection by a solar-system body
4769
4770        This revision:   2016 June 16
4771
4772        Copyright (C) 2013-2021, NumFOCUS Foundation.
4773        Derived, with permission, from the SOFA library.  See notes at end of file.
4774
4775    """
4776    p1 = ufunc.ldsun(p, e, em)
4777    return p1
4778
4779
4780def pmpx(rc, dc, pr, pd, px, rv, pmt, pob):
4781    """
4782    Proper motion and parallax.
4783
4784    Parameters
4785    ----------
4786    rc : double array
4787    dc : double array
4788    pr : double array
4789    pd : double array
4790    px : double array
4791    rv : double array
4792    pmt : double array
4793    pob : double array
4794
4795    Returns
4796    -------
4797    pco : double array
4798
4799    Notes
4800    -----
4801    Wraps ERFA function ``eraPmpx``. The ERFA documentation is::
4802
4803        - - - - - - - -
4804         e r a P m p x
4805        - - - - - - - -
4806
4807        Proper motion and parallax.
4808
4809        Given:
4810           rc,dc  double     ICRS RA,Dec at catalog epoch (radians)
4811           pr     double     RA proper motion (radians/year, Note 1)
4812           pd     double     Dec proper motion (radians/year)
4813           px     double     parallax (arcsec)
4814           rv     double     radial velocity (km/s, +ve if receding)
4815           pmt    double     proper motion time interval (SSB, Julian years)
4816           pob    double[3]  SSB to observer vector (au)
4817
4818        Returned:
4819           pco    double[3]  coordinate direction (BCRS unit vector)
4820
4821        Notes:
4822
4823        1) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
4824
4825        2) The proper motion time interval is for when the starlight
4826           reaches the solar system barycenter.
4827
4828        3) To avoid the need for iteration, the Roemer effect (i.e. the
4829           small annual modulation of the proper motion coming from the
4830           changing light time) is applied approximately, using the
4831           direction of the star at the catalog epoch.
4832
4833        References:
4834
4835           1984 Astronomical Almanac, pp B39-B41.
4836
4837           Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
4838           the Astronomical Almanac, 3rd ed., University Science Books
4839           (2013), Section 7.2.
4840
4841        Called:
4842           eraPdp       scalar product of two p-vectors
4843           eraPn        decompose p-vector into modulus and direction
4844
4845        This revision:   2021 April 3
4846
4847        Copyright (C) 2013-2021, NumFOCUS Foundation.
4848        Derived, with permission, from the SOFA library.  See notes at end of file.
4849
4850    """
4851    pco = ufunc.pmpx(rc, dc, pr, pd, px, rv, pmt, pob)
4852    return pco
4853
4854
4855def pmsafe(ra1, dec1, pmr1, pmd1, px1, rv1, ep1a, ep1b, ep2a, ep2b):
4856    """
4857    Star proper motion:  update star catalog data for space motion, with
4858    special handling to handle the zero parallax case.
4859
4860    Parameters
4861    ----------
4862    ra1 : double array
4863    dec1 : double array
4864    pmr1 : double array
4865    pmd1 : double array
4866    px1 : double array
4867    rv1 : double array
4868    ep1a : double array
4869    ep1b : double array
4870    ep2a : double array
4871    ep2b : double array
4872
4873    Returns
4874    -------
4875    ra2 : double array
4876    dec2 : double array
4877    pmr2 : double array
4878    pmd2 : double array
4879    px2 : double array
4880    rv2 : double array
4881
4882    Notes
4883    -----
4884    Wraps ERFA function ``eraPmsafe``. The ERFA documentation is::
4885
4886        - - - - - - - - - -
4887         e r a P m s a f e
4888        - - - - - - - - - -
4889
4890        Star proper motion:  update star catalog data for space motion, with
4891        special handling to handle the zero parallax case.
4892
4893        Given:
4894           ra1    double      right ascension (radians), before
4895           dec1   double      declination (radians), before
4896           pmr1   double      RA proper motion (radians/year), before
4897           pmd1   double      Dec proper motion (radians/year), before
4898           px1    double      parallax (arcseconds), before
4899           rv1    double      radial velocity (km/s, +ve = receding), before
4900           ep1a   double      "before" epoch, part A (Note 1)
4901           ep1b   double      "before" epoch, part B (Note 1)
4902           ep2a   double      "after" epoch, part A (Note 1)
4903           ep2b   double      "after" epoch, part B (Note 1)
4904
4905        Returned:
4906           ra2    double      right ascension (radians), after
4907           dec2   double      declination (radians), after
4908           pmr2   double      RA proper motion (radians/year), after
4909           pmd2   double      Dec proper motion (radians/year), after
4910           px2    double      parallax (arcseconds), after
4911           rv2    double      radial velocity (km/s, +ve = receding), after
4912
4913        Returned (function value):
4914                  int         status:
4915                               -1 = system error (should not occur)
4916                                0 = no warnings or errors
4917                                1 = distance overridden (Note 6)
4918                                2 = excessive velocity (Note 7)
4919                                4 = solution didn't converge (Note 8)
4920                             else = binary logical OR of the above warnings
4921
4922        Notes:
4923
4924        1) The starting and ending TDB epochs ep1a+ep1b and ep2a+ep2b are
4925           Julian Dates, apportioned in any convenient way between the two
4926           parts (A and B).  For example, JD(TDB)=2450123.7 could be
4927           expressed in any of these ways, among others:
4928
4929                  epNa            epNb
4930
4931               2450123.7           0.0       (JD method)
4932               2451545.0       -1421.3       (J2000 method)
4933               2400000.5       50123.2       (MJD method)
4934               2450123.5           0.2       (date & time method)
4935
4936           The JD method is the most natural and convenient to use in cases
4937           where the loss of several decimal digits of resolution is
4938           acceptable.  The J2000 method is best matched to the way the
4939           argument is handled internally and will deliver the optimum
4940           resolution.  The MJD method and the date & time methods are both
4941           good compromises between resolution and convenience.
4942
4943        2) In accordance with normal star-catalog conventions, the object's
4944           right ascension and declination are freed from the effects of
4945           secular aberration.  The frame, which is aligned to the catalog
4946           equator and equinox, is Lorentzian and centered on the SSB.
4947
4948           The proper motions are the rate of change of the right ascension
4949           and declination at the catalog epoch and are in radians per TDB
4950           Julian year.
4951
4952           The parallax and radial velocity are in the same frame.
4953
4954        3) Care is needed with units.  The star coordinates are in radians
4955           and the proper motions in radians per Julian year, but the
4956           parallax is in arcseconds.
4957
4958        4) The RA proper motion is in terms of coordinate angle, not true
4959           angle.  If the catalog uses arcseconds for both RA and Dec proper
4960           motions, the RA proper motion will need to be divided by cos(Dec)
4961           before use.
4962
4963        5) Straight-line motion at constant speed, in the inertial frame, is
4964           assumed.
4965
4966        6) An extremely small (or zero or negative) parallax is overridden
4967           to ensure that the object is at a finite but very large distance,
4968           but not so large that the proper motion is equivalent to a large
4969           but safe speed (about 0.1c using the chosen constant).  A warning
4970           status of 1 is added to the status if this action has been taken.
4971
4972        7) If the space velocity is a significant fraction of c (see the
4973           constant VMAX in the function eraStarpv), it is arbitrarily set
4974           to zero.  When this action occurs, 2 is added to the status.
4975
4976        8) The relativistic adjustment carried out in the eraStarpv function
4977           involves an iterative calculation.  If the process fails to
4978           converge within a set number of iterations, 4 is added to the
4979           status.
4980
4981        Called:
4982           eraSeps      angle between two points
4983           eraStarpm    update star catalog data for space motion
4984
4985        This revision:   2014 July 1
4986
4987        Copyright (C) 2013-2021, NumFOCUS Foundation.
4988        Derived, with permission, from the SOFA library.  See notes at end of file.
4989
4990    """
4991    ra2, dec2, pmr2, pmd2, px2, rv2, c_retval = ufunc.pmsafe(
4992        ra1, dec1, pmr1, pmd1, px1, rv1, ep1a, ep1b, ep2a, ep2b)
4993    check_errwarn(c_retval, 'pmsafe')
4994    return ra2, dec2, pmr2, pmd2, px2, rv2
4995
4996
4997STATUS_CODES['pmsafe'] = {
4998    -1: 'system error (should not occur)',
4999    0: 'no warnings or errors',
5000    1: 'distance overridden (Note 6)',
5001    2: 'excessive velocity (Note 7)',
5002    4: "solution didn't converge (Note 8)",
5003    'else': 'binary logical OR of the above warnings',
5004}
5005
5006
5007def pvtob(elong, phi, hm, xp, yp, sp, theta):
5008    """
5009    Position and velocity of a terrestrial observing station.
5010
5011    Parameters
5012    ----------
5013    elong : double array
5014    phi : double array
5015    hm : double array
5016    xp : double array
5017    yp : double array
5018    sp : double array
5019    theta : double array
5020
5021    Returns
5022    -------
5023    pv : double array
5024
5025    Notes
5026    -----
5027    Wraps ERFA function ``eraPvtob``. The ERFA documentation is::
5028
5029        - - - - - - - - -
5030         e r a P v t o b
5031        - - - - - - - - -
5032
5033        Position and velocity of a terrestrial observing station.
5034
5035        Given:
5036           elong   double       longitude (radians, east +ve, Note 1)
5037           phi     double       latitude (geodetic, radians, Note 1)
5038           hm      double       height above ref. ellipsoid (geodetic, m)
5039           xp,yp   double       coordinates of the pole (radians, Note 2)
5040           sp      double       the TIO locator s' (radians, Note 2)
5041           theta   double       Earth rotation angle (radians, Note 3)
5042
5043        Returned:
5044           pv      double[2][3] position/velocity vector (m, m/s, CIRS)
5045
5046        Notes:
5047
5048        1) The terrestrial coordinates are with respect to the ERFA_WGS84
5049           reference ellipsoid.
5050
5051        2) xp and yp are the coordinates (in radians) of the Celestial
5052           Intermediate Pole with respect to the International Terrestrial
5053           Reference System (see IERS Conventions), measured along the
5054           meridians 0 and 90 deg west respectively.  sp is the TIO locator
5055           s', in radians, which positions the Terrestrial Intermediate
5056           Origin on the equator.  For many applications, xp, yp and
5057           (especially) sp can be set to zero.
5058
5059        3) If theta is Greenwich apparent sidereal time instead of Earth
5060           rotation angle, the result is with respect to the true equator
5061           and equinox of date, i.e. with the x-axis at the equinox rather
5062           than the celestial intermediate origin.
5063
5064        4) The velocity units are meters per UT1 second, not per SI second.
5065           This is unlikely to have any practical consequences in the modern
5066           era.
5067
5068        5) No validation is performed on the arguments.  Error cases that
5069           could lead to arithmetic exceptions are trapped by the eraGd2gc
5070           function, and the result set to zeros.
5071
5072        References:
5073
5074           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5075           IERS Technical Note No. 32, BKG (2004)
5076
5077           Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
5078           the Astronomical Almanac, 3rd ed., University Science Books
5079           (2013), Section 7.4.3.3.
5080
5081        Called:
5082           eraGd2gc     geodetic to geocentric transformation
5083           eraPom00     polar motion matrix
5084           eraTrxp      product of transpose of r-matrix and p-vector
5085
5086        This revision:   2021 February 24
5087
5088        Copyright (C) 2013-2021, NumFOCUS Foundation.
5089        Derived, with permission, from the SOFA library.  See notes at end of file.
5090
5091    """
5092    pv = ufunc.pvtob(elong, phi, hm, xp, yp, sp, theta)
5093    return pv
5094
5095
5096def refco(phpa, tc, rh, wl):
5097    """
5098    Determine the constants A and B in the atmospheric refraction model
5099    dZ = A tan Z + B tan^3 Z.
5100
5101    Parameters
5102    ----------
5103    phpa : double array
5104    tc : double array
5105    rh : double array
5106    wl : double array
5107
5108    Returns
5109    -------
5110    refa : double array
5111    refb : double array
5112
5113    Notes
5114    -----
5115    Wraps ERFA function ``eraRefco``. The ERFA documentation is::
5116
5117        - - - - - - - - -
5118         e r a R e f c o
5119        - - - - - - - - -
5120
5121        Determine the constants A and B in the atmospheric refraction model
5122        dZ = A tan Z + B tan^3 Z.
5123
5124        Z is the "observed" zenith distance (i.e. affected by refraction)
5125        and dZ is what to add to Z to give the "topocentric" (i.e. in vacuo)
5126        zenith distance.
5127
5128        Given:
5129          phpa   double    pressure at the observer (hPa = millibar)
5130          tc     double    ambient temperature at the observer (deg C)
5131          rh     double    relative humidity at the observer (range 0-1)
5132          wl     double    wavelength (micrometers)
5133
5134        Returned:
5135          refa   double         tan Z coefficient (radians)
5136          refb   double         tan^3 Z coefficient (radians)
5137
5138        Notes:
5139
5140        1) The model balances speed and accuracy to give good results in
5141           applications where performance at low altitudes is not paramount.
5142           Performance is maintained across a range of conditions, and
5143           applies to both optical/IR and radio.
5144
5145        2) The model omits the effects of (i) height above sea level (apart
5146           from the reduced pressure itself), (ii) latitude (i.e. the
5147           flattening of the Earth), (iii) variations in tropospheric lapse
5148           rate and (iv) dispersive effects in the radio.
5149
5150           The model was tested using the following range of conditions:
5151
5152             lapse rates 0.0055, 0.0065, 0.0075 deg/meter
5153             latitudes 0, 25, 50, 75 degrees
5154             heights 0, 2500, 5000 meters ASL
5155             pressures mean for height -10% to +5% in steps of 5%
5156             temperatures -10 deg to +20 deg with respect to 280 deg at SL
5157             relative humidity 0, 0.5, 1
5158             wavelengths 0.4, 0.6, ... 2 micron, + radio
5159             zenith distances 15, 45, 75 degrees
5160
5161           The accuracy with respect to raytracing through a model
5162           atmosphere was as follows:
5163
5164                                  worst         RMS
5165
5166             optical/IR           62 mas       8 mas
5167             radio               319 mas      49 mas
5168
5169           For this particular set of conditions:
5170
5171             lapse rate 0.0065 K/meter
5172             latitude 50 degrees
5173             sea level
5174             pressure 1005 mb
5175             temperature 280.15 K
5176             humidity 80%
5177             wavelength 5740 Angstroms
5178
5179           the results were as follows:
5180
5181             ZD       raytrace     eraRefco   Saastamoinen
5182
5183             10         10.27        10.27        10.27
5184             20         21.19        21.20        21.19
5185             30         33.61        33.61        33.60
5186             40         48.82        48.83        48.81
5187             45         58.16        58.18        58.16
5188             50         69.28        69.30        69.27
5189             55         82.97        82.99        82.95
5190             60        100.51       100.54       100.50
5191             65        124.23       124.26       124.20
5192             70        158.63       158.68       158.61
5193             72        177.32       177.37       177.31
5194             74        200.35       200.38       200.32
5195             76        229.45       229.43       229.42
5196             78        267.44       267.29       267.41
5197             80        319.13       318.55       319.10
5198
5199            deg        arcsec       arcsec       arcsec
5200
5201           The values for Saastamoinen's formula (which includes terms
5202           up to tan^5) are taken from Hohenkerk and Sinclair (1985).
5203
5204        3) A wl value in the range 0-100 selects the optical/IR case and is
5205           wavelength in micrometers.  Any value outside this range selects
5206           the radio case.
5207
5208        4) Outlandish input parameters are silently limited to
5209           mathematically safe values.  Zero pressure is permissible, and
5210           causes zeroes to be returned.
5211
5212        5) The algorithm draws on several sources, as follows:
5213
5214           a) The formula for the saturation vapour pressure of water as
5215              a function of temperature and temperature is taken from
5216              Equations (A4.5-A4.7) of Gill (1982).
5217
5218           b) The formula for the water vapour pressure, given the
5219              saturation pressure and the relative humidity, is from
5220              Crane (1976), Equation (2.5.5).
5221
5222           c) The refractivity of air is a function of temperature,
5223              total pressure, water-vapour pressure and, in the case
5224              of optical/IR, wavelength.  The formulae for the two cases are
5225              developed from Hohenkerk & Sinclair (1985) and Rueger (2002).
5226              The IAG (1999) optical refractivity for dry air is used.
5227
5228           d) The formula for beta, the ratio of the scale height of the
5229              atmosphere to the geocentric distance of the observer, is
5230              an adaption of Equation (9) from Stone (1996).  The
5231              adaptations, arrived at empirically, consist of (i) a small
5232              adjustment to the coefficient and (ii) a humidity term for the
5233              radio case only.
5234
5235           e) The formulae for the refraction constants as a function of
5236              n-1 and beta are from Green (1987), Equation (4.31).
5237
5238        References:
5239
5240           Crane, R.K., Meeks, M.L. (ed), "Refraction Effects in the Neutral
5241           Atmosphere", Methods of Experimental Physics: Astrophysics 12B,
5242           Academic Press, 1976.
5243
5244           Gill, Adrian E., "Atmosphere-Ocean Dynamics", Academic Press,
5245           1982.
5246
5247           Green, R.M., "Spherical Astronomy", Cambridge University Press,
5248           1987.
5249
5250           Hohenkerk, C.Y., & Sinclair, A.T., NAO Technical Note No. 63,
5251           1985.
5252
5253           IAG Resolutions adopted at the XXIIth General Assembly in
5254           Birmingham, 1999, Resolution 3.
5255
5256           Rueger, J.M., "Refractive Index Formulae for Electronic Distance
5257           Measurement with Radio and Millimetre Waves", in Unisurv Report
5258           S-68, School of Surveying and Spatial Information Systems,
5259           University of New South Wales, Sydney, Australia, 2002.
5260
5261           Stone, Ronald C., P.A.S.P. 108, 1051-1058, 1996.
5262
5263        This revision:   2021 February 24
5264
5265        Copyright (C) 2013-2021, NumFOCUS Foundation.
5266        Derived, with permission, from the SOFA library.  See notes at end of file.
5267
5268    """
5269    refa, refb = ufunc.refco(phpa, tc, rh, wl)
5270    return refa, refb
5271
5272
5273def epv00(date1, date2):
5274    """
5275    Earth position and velocity, heliocentric and barycentric, with
5276    respect to the Barycentric Celestial Reference System.
5277
5278    Parameters
5279    ----------
5280    date1 : double array
5281    date2 : double array
5282
5283    Returns
5284    -------
5285    pvh : double array
5286    pvb : double array
5287
5288    Notes
5289    -----
5290    Wraps ERFA function ``eraEpv00``. The ERFA documentation is::
5291
5292        - - - - - - - - -
5293         e r a E p v 0 0
5294        - - - - - - - - -
5295
5296        Earth position and velocity, heliocentric and barycentric, with
5297        respect to the Barycentric Celestial Reference System.
5298
5299        Given:
5300           date1,date2  double        TDB date (Note 1)
5301
5302        Returned:
5303           pvh          double[2][3]  heliocentric Earth position/velocity
5304           pvb          double[2][3]  barycentric Earth position/velocity
5305
5306        Returned (function value):
5307                        int           status: 0 = OK
5308                                             +1 = warning: date outside
5309                                                  the range 1900-2100 AD
5310
5311        Notes:
5312
5313        1) The TDB date date1+date2 is a Julian Date, apportioned in any
5314           convenient way between the two arguments.  For example,
5315           JD(TDB)=2450123.7 could be expressed in any of these ways, among
5316           others:
5317
5318                  date1          date2
5319
5320               2450123.7           0.0       (JD method)
5321               2451545.0       -1421.3       (J2000 method)
5322               2400000.5       50123.2       (MJD method)
5323               2450123.5           0.2       (date & time method)
5324
5325           The JD method is the most natural and convenient to use in cases
5326           where the loss of several decimal digits of resolution is
5327           acceptable.  The J2000 method is best matched to the way the
5328           argument is handled internally and will deliver the optimum
5329           resolution.  The MJD method and the date & time methods are both
5330           good compromises between resolution and convenience.  However,
5331           the accuracy of the result is more likely to be limited by the
5332           algorithm itself than the way the date has been expressed.
5333
5334           n.b. TT can be used instead of TDB in most applications.
5335
5336        2) On return, the arrays pvh and pvb contain the following:
5337
5338              pvh[0][0]  x       }
5339              pvh[0][1]  y       } heliocentric position, au
5340              pvh[0][2]  z       }
5341
5342              pvh[1][0]  xdot    }
5343              pvh[1][1]  ydot    } heliocentric velocity, au/d
5344              pvh[1][2]  zdot    }
5345
5346              pvb[0][0]  x       }
5347              pvb[0][1]  y       } barycentric position, au
5348              pvb[0][2]  z       }
5349
5350              pvb[1][0]  xdot    }
5351              pvb[1][1]  ydot    } barycentric velocity, au/d
5352              pvb[1][2]  zdot    }
5353
5354           The vectors are with respect to the Barycentric Celestial
5355           Reference System.  The time unit is one day in TDB.
5356
5357        3) The function is a SIMPLIFIED SOLUTION from the planetary theory
5358           VSOP2000 (X. Moisson, P. Bretagnon, 2001, Celes. Mechanics &
5359           Dyn. Astron., 80, 3/4, 205-213) and is an adaptation of original
5360           Fortran code supplied by P. Bretagnon (private comm., 2000).
5361
5362        4) Comparisons over the time span 1900-2100 with this simplified
5363           solution and the JPL DE405 ephemeris give the following results:
5364
5365                                      RMS    max
5366                 Heliocentric:
5367                    position error    3.7   11.2   km
5368                    velocity error    1.4    5.0   mm/s
5369
5370                 Barycentric:
5371                    position error    4.6   13.4   km
5372                    velocity error    1.4    4.9   mm/s
5373
5374           Comparisons with the JPL DE406 ephemeris show that by 1800 and
5375           2200 the position errors are approximately double their 1900-2100
5376           size.  By 1500 and 2500 the deterioration is a factor of 10 and
5377           by 1000 and 3000 a factor of 60.  The velocity accuracy falls off
5378           at about half that rate.
5379
5380        5) It is permissible to use the same array for pvh and pvb, which
5381           will receive the barycentric values.
5382
5383        This revision:  2021 May 11
5384
5385        Copyright (C) 2013-2021, NumFOCUS Foundation.
5386        Derived, with permission, from the SOFA library.  See notes at end of file.
5387
5388    """
5389    pvh, pvb, c_retval = ufunc.epv00(date1, date2)
5390    check_errwarn(c_retval, 'epv00')
5391    return pvh, pvb
5392
5393
5394STATUS_CODES['epv00'] = {
5395    0: 'OK',
5396    1: 'warning: date outsidethe range 1900-2100 AD',
5397}
5398
5399
5400def moon98(date1, date2):
5401    """
5402    Approximate geocentric position and velocity of the Moon.
5403
5404    Parameters
5405    ----------
5406    date1 : double array
5407    date2 : double array
5408
5409    Returns
5410    -------
5411    pv : double array
5412
5413    Notes
5414    -----
5415    Wraps ERFA function ``eraMoon98``. The ERFA documentation is::
5416
5417        - - - - - - - - - -
5418         e r a M o o n 9 8
5419        - - - - - - - - - -
5420
5421        Approximate geocentric position and velocity of the Moon.
5422
5423        n.b. Not IAU-endorsed and without canonical status.
5424
5425        Given:
5426           date1  double         TT date part A (Notes 1,4)
5427           date2  double         TT date part B (Notes 1,4)
5428
5429        Returned:
5430           pv     double[2][3]   Moon p,v, GCRS (AU, AU/d, Note 5)
5431
5432        Notes:
5433
5434        1) The TT date date1+date2 is a Julian Date, apportioned in any
5435           convenient way between the two arguments.  For example,
5436           JD(TT)=2450123.7 could be expressed in any of these ways, among
5437           others:
5438
5439                  date1          date2
5440
5441               2450123.7           0.0       (JD method)
5442               2451545.0       -1421.3       (J2000 method)
5443               2400000.5       50123.2       (MJD method)
5444               2450123.5           0.2       (date & time method)
5445
5446           The JD method is the most natural and convenient to use in cases
5447           where the loss of several decimal digits of resolution is
5448           acceptable.  The J2000 method is best matched to the way the
5449           argument is handled internally and will deliver the optimum
5450           resolution.  The MJD method and the date & time methods are both
5451           good compromises between resolution and convenience.  The limited
5452           accuracy of the present algorithm is such that any of the methods
5453           is satisfactory.
5454
5455        2) This function is a full implementation of the algorithm
5456           published by Meeus (see reference) except that the light-time
5457           correction to the Moon's mean longitude has been omitted.
5458
5459        3) Comparisons with ELP/MPP02 over the interval 1950-2100 gave RMS
5460           errors of 2.9 arcsec in geocentric direction, 6.1 km in position
5461           and 36 mm/s in velocity.  The worst case errors were 18.3 arcsec
5462           in geocentric direction, 31.7 km in position and 172 mm/s in
5463           velocity.
5464
5465        4) The original algorithm is expressed in terms of "dynamical time",
5466           which can either be TDB or TT without any significant change in
5467           accuracy.  UT cannot be used without incurring significant errors
5468           (30 arcsec in the present era) due to the Moon's 0.5 arcsec/sec
5469           movement.
5470
5471        5) The result is with respect to the GCRS (the same as J2000.0 mean
5472           equator and equinox to within 23 mas).
5473
5474        6) Velocity is obtained by a complete analytical differentiation
5475           of the Meeus model.
5476
5477        7) The Meeus algorithm generates position and velocity in mean
5478           ecliptic coordinates of date, which the present function then
5479           rotates into GCRS.  Because the ecliptic system is precessing,
5480           there is a coupling between this spin (about 1.4 degrees per
5481           century) and the Moon position that produces a small velocity
5482           contribution.  In the present function this effect is neglected
5483           as it corresponds to a maximum difference of less than 3 mm/s and
5484           increases the RMS error by only 0.4%.
5485
5486        References:
5487
5488           Meeus, J., Astronomical Algorithms, 2nd edition, Willmann-Bell,
5489           1998, p337.
5490
5491           Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
5492           Francou, G. & Laskar, J., Astron.Astrophys., 1994, 282, 663
5493
5494        Defined in erfam.h:
5495           ERFA_DAU           astronomical unit (m)
5496           ERFA_DJC           days per Julian century
5497           ERFA_DJ00          reference epoch (J2000.0), Julian Date
5498           ERFA_DD2R          degrees to radians
5499
5500        Called:
5501           eraS2pv      spherical coordinates to pv-vector
5502           eraPfw06     bias-precession F-W angles, IAU 2006
5503           eraIr        initialize r-matrix to identity
5504           eraRz        rotate around Z-axis
5505           eraRx        rotate around X-axis
5506           eraRxpv      product of r-matrix and pv-vector
5507
5508        This revision:  2021 May 11
5509
5510        Copyright (C) 2013-2021, NumFOCUS Foundation.
5511        Derived, with permission, from the SOFA library.  See notes at end of file.
5512
5513    """
5514    pv = ufunc.moon98(date1, date2)
5515    return pv
5516
5517
5518def plan94(date1, date2, np):
5519    """
5520    Approximate heliocentric position and velocity of a nominated major
5521    planet:  Mercury, Venus, EMB, Mars, Jupiter, Saturn, Uranus or
5522    Neptune (but not the Earth itself).
5523
5524    Parameters
5525    ----------
5526    date1 : double array
5527    date2 : double array
5528    np : int array
5529
5530    Returns
5531    -------
5532    pv : double array
5533
5534    Notes
5535    -----
5536    Wraps ERFA function ``eraPlan94``. The ERFA documentation is::
5537
5538        - - - - - - - - - -
5539         e r a P l a n 9 4
5540        - - - - - - - - - -
5541
5542        Approximate heliocentric position and velocity of a nominated major
5543        planet:  Mercury, Venus, EMB, Mars, Jupiter, Saturn, Uranus or
5544        Neptune (but not the Earth itself).
5545
5546        n.b. Not IAU-endorsed and without canonical status.
5547
5548        Given:
5549           date1  double       TDB date part A (Note 1)
5550           date2  double       TDB date part B (Note 1)
5551           np     int          planet (1=Mercury, 2=Venus, 3=EMB, 4=Mars,
5552                                   5=Jupiter, 6=Saturn, 7=Uranus, 8=Neptune)
5553
5554        Returned (argument):
5555           pv     double[2][3] planet p,v (heliocentric, J2000.0, au,au/d)
5556
5557        Returned (function value):
5558                  int          status: -1 = illegal NP (outside 1-8)
5559                                        0 = OK
5560                                       +1 = warning: year outside 1000-3000
5561                                       +2 = warning: failed to converge
5562
5563        Notes:
5564
5565        1) The date date1+date2 is in the TDB time scale (in practice TT can
5566           be used) and is a Julian Date, apportioned in any convenient way
5567           between the two arguments.  For example, JD(TDB)=2450123.7 could
5568           be expressed in any of these ways, among others:
5569
5570                  date1          date2
5571
5572               2450123.7           0.0       (JD method)
5573               2451545.0       -1421.3       (J2000 method)
5574               2400000.5       50123.2       (MJD method)
5575               2450123.5           0.2       (date & time method)
5576
5577           The JD method is the most natural and convenient to use in cases
5578           where the loss of several decimal digits of resolution is
5579           acceptable.  The J2000 method is best matched to the way the
5580           argument is handled internally and will deliver the optimum
5581           resolution.  The MJD method and the date & time methods are both
5582           good compromises between resolution and convenience.  The limited
5583           accuracy of the present algorithm is such that any of the methods
5584           is satisfactory.
5585
5586        2) If an np value outside the range 1-8 is supplied, an error status
5587           (function value -1) is returned and the pv vector set to zeroes.
5588
5589        3) For np=3 the result is for the Earth-Moon Barycenter.  To obtain
5590           the heliocentric position and velocity of the Earth, use instead
5591           the ERFA function eraEpv00.
5592
5593        4) On successful return, the array pv contains the following:
5594
5595              pv[0][0]   x      }
5596              pv[0][1]   y      } heliocentric position, au
5597              pv[0][2]   z      }
5598
5599              pv[1][0]   xdot   }
5600              pv[1][1]   ydot   } heliocentric velocity, au/d
5601              pv[1][2]   zdot   }
5602
5603           The reference frame is equatorial and is with respect to the
5604           mean equator and equinox of epoch J2000.0.
5605
5606        5) The algorithm is due to J.L. Simon, P. Bretagnon, J. Chapront,
5607           M. Chapront-Touze, G. Francou and J. Laskar (Bureau des
5608           Longitudes, Paris, France).  From comparisons with JPL
5609           ephemeris DE102, they quote the following maximum errors
5610           over the interval 1800-2050:
5611
5612                           L (arcsec)    B (arcsec)      R (km)
5613
5614              Mercury          4             1             300
5615              Venus            5             1             800
5616              EMB              6             1            1000
5617              Mars            17             1            7700
5618              Jupiter         71             5           76000
5619              Saturn          81            13          267000
5620              Uranus          86             7          712000
5621              Neptune         11             1          253000
5622
5623           Over the interval 1000-3000, they report that the accuracy is no
5624           worse than 1.5 times that over 1800-2050.  Outside 1000-3000 the
5625           accuracy declines.
5626
5627           Comparisons of the present function with the JPL DE200 ephemeris
5628           give the following RMS errors over the interval 1960-2025:
5629
5630                            position (km)     velocity (m/s)
5631
5632              Mercury            334               0.437
5633              Venus             1060               0.855
5634              EMB               2010               0.815
5635              Mars              7690               1.98
5636              Jupiter          71700               7.70
5637              Saturn          199000              19.4
5638              Uranus          564000              16.4
5639              Neptune         158000              14.4
5640
5641           Comparisons against DE200 over the interval 1800-2100 gave the
5642           following maximum absolute differences.  (The results using
5643           DE406 were essentially the same.)
5644
5645                         L (arcsec)   B (arcsec)     R (km)   Rdot (m/s)
5646
5647              Mercury        7            1            500       0.7
5648              Venus          7            1           1100       0.9
5649              EMB            9            1           1300       1.0
5650              Mars          26            1           9000       2.5
5651              Jupiter       78            6          82000       8.2
5652              Saturn        87           14         263000      24.6
5653              Uranus        86            7         661000      27.4
5654              Neptune       11            2         248000      21.4
5655
5656        6) The present ERFA re-implementation of the original Simon et al.
5657           Fortran code differs from the original in the following respects:
5658
5659                     C instead of Fortran.
5660
5661                     The date is supplied in two parts.
5662
5663                     The result is returned only in equatorial Cartesian form;
5664                the ecliptic longitude, latitude and radius vector are not
5665                returned.
5666
5667                     The result is in the J2000.0 equatorial frame, not ecliptic.
5668
5669                     More is done in-line: there are fewer calls to subroutines.
5670
5671                     Different error/warning status values are used.
5672
5673                     A different Kepler's-equation-solver is used (avoiding
5674                use of double precision complex).
5675
5676                     Polynomials in t are nested to minimize rounding errors.
5677
5678                     Explicit double constants are used to avoid mixed-mode
5679                expressions.
5680
5681           None of the above changes affects the result significantly.
5682
5683        7) The returned status indicates the most serious condition
5684           encountered during execution of the function.  Illegal np is
5685           considered the most serious, overriding failure to converge,
5686           which in turn takes precedence over the remote date warning.
5687
5688        Called:
5689           eraAnpm      normalize angle into range +/- pi
5690
5691        Reference:  Simon, J.L, Bretagnon, P., Chapront, J.,
5692                    Chapront-Touze, M., Francou, G., and Laskar, J.,
5693                    Astron.Astrophys., 282, 663 (1994).
5694
5695        This revision:  2021 May 11
5696
5697        Copyright (C) 2013-2021, NumFOCUS Foundation.
5698        Derived, with permission, from the SOFA library.  See notes at end of file.
5699
5700    """
5701    pv, c_retval = ufunc.plan94(date1, date2, np)
5702    check_errwarn(c_retval, 'plan94')
5703    return pv
5704
5705
5706STATUS_CODES['plan94'] = {
5707    -1: 'illegal NP (outside 1-8)',
5708    0: 'OK',
5709    1: 'warning: year outside 1000-3000',
5710    2: 'warning: failed to converge',
5711}
5712
5713
5714def fad03(t):
5715    """
5716    Fundamental argument, IERS Conventions (2003):
5717    mean elongation of the Moon from the Sun.
5718
5719    Parameters
5720    ----------
5721    t : double array
5722
5723    Returns
5724    -------
5725    c_retval : double array
5726
5727    Notes
5728    -----
5729    Wraps ERFA function ``eraFad03``. The ERFA documentation is::
5730
5731        - - - - - - - - -
5732         e r a F a d 0 3
5733        - - - - - - - - -
5734
5735        Fundamental argument, IERS Conventions (2003):
5736        mean elongation of the Moon from the Sun.
5737
5738        Given:
5739           t     double    TDB, Julian centuries since J2000.0 (Note 1)
5740
5741        Returned (function value):
5742                 double    D, radians (Note 2)
5743
5744        Notes:
5745
5746        1) Though t is strictly TDB, it is usually more convenient to use
5747           TT, which makes no significant difference.
5748
5749        2) The expression used is as adopted in IERS Conventions (2003) and
5750           is from Simon et al. (1994).
5751
5752        References:
5753
5754           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5755           IERS Technical Note No. 32, BKG (2004)
5756
5757           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
5758           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
5759
5760        This revision:  2021 May 11
5761
5762        Copyright (C) 2013-2021, NumFOCUS Foundation.
5763        Derived, with permission, from the SOFA library.  See notes at end of file.
5764
5765    """
5766    c_retval = ufunc.fad03(t)
5767    return c_retval
5768
5769
5770def fae03(t):
5771    """
5772    Fundamental argument, IERS Conventions (2003):
5773    mean longitude of Earth.
5774
5775    Parameters
5776    ----------
5777    t : double array
5778
5779    Returns
5780    -------
5781    c_retval : double array
5782
5783    Notes
5784    -----
5785    Wraps ERFA function ``eraFae03``. The ERFA documentation is::
5786
5787        - - - - - - - - -
5788         e r a F a e 0 3
5789        - - - - - - - - -
5790
5791        Fundamental argument, IERS Conventions (2003):
5792        mean longitude of Earth.
5793
5794        Given:
5795           t     double    TDB, Julian centuries since J2000.0 (Note 1)
5796
5797        Returned (function value):
5798                 double    mean longitude of Earth, radians (Note 2)
5799
5800        Notes:
5801
5802        1) Though t is strictly TDB, it is usually more convenient to use
5803           TT, which makes no significant difference.
5804
5805        2) The expression used is as adopted in IERS Conventions (2003) and
5806           comes from Souchay et al. (1999) after Simon et al. (1994).
5807
5808        References:
5809
5810           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5811           IERS Technical Note No. 32, BKG (2004)
5812
5813           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
5814           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
5815
5816           Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
5817           Astron.Astrophys.Supp.Ser. 135, 111
5818
5819        This revision:  2021 May 11
5820
5821        Copyright (C) 2013-2021, NumFOCUS Foundation.
5822        Derived, with permission, from the SOFA library.  See notes at end of file.
5823
5824    """
5825    c_retval = ufunc.fae03(t)
5826    return c_retval
5827
5828
5829def faf03(t):
5830    """
5831    Fundamental argument, IERS Conventions (2003):
5832    mean longitude of the Moon minus mean longitude of the ascending
5833    node.
5834
5835    Parameters
5836    ----------
5837    t : double array
5838
5839    Returns
5840    -------
5841    c_retval : double array
5842
5843    Notes
5844    -----
5845    Wraps ERFA function ``eraFaf03``. The ERFA documentation is::
5846
5847        - - - - - - - - -
5848         e r a F a f 0 3
5849        - - - - - - - - -
5850
5851        Fundamental argument, IERS Conventions (2003):
5852        mean longitude of the Moon minus mean longitude of the ascending
5853        node.
5854
5855        Given:
5856           t     double    TDB, Julian centuries since J2000.0 (Note 1)
5857
5858        Returned (function value):
5859                 double    F, radians (Note 2)
5860
5861        Notes:
5862
5863        1) Though t is strictly TDB, it is usually more convenient to use
5864           TT, which makes no significant difference.
5865
5866        2) The expression used is as adopted in IERS Conventions (2003) and
5867           is from Simon et al. (1994).
5868
5869        References:
5870
5871           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5872           IERS Technical Note No. 32, BKG (2004)
5873
5874           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
5875           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
5876
5877        This revision:  2021 May 11
5878
5879        Copyright (C) 2013-2021, NumFOCUS Foundation.
5880        Derived, with permission, from the SOFA library.  See notes at end of file.
5881
5882    """
5883    c_retval = ufunc.faf03(t)
5884    return c_retval
5885
5886
5887def faju03(t):
5888    """
5889    Fundamental argument, IERS Conventions (2003):
5890    mean longitude of Jupiter.
5891
5892    Parameters
5893    ----------
5894    t : double array
5895
5896    Returns
5897    -------
5898    c_retval : double array
5899
5900    Notes
5901    -----
5902    Wraps ERFA function ``eraFaju03``. The ERFA documentation is::
5903
5904        - - - - - - - - - -
5905         e r a F a j u 0 3
5906        - - - - - - - - - -
5907
5908        Fundamental argument, IERS Conventions (2003):
5909        mean longitude of Jupiter.
5910
5911        Given:
5912           t     double    TDB, Julian centuries since J2000.0 (Note 1)
5913
5914        Returned (function value):
5915                 double    mean longitude of Jupiter, radians (Note 2)
5916
5917        Notes:
5918
5919        1) Though t is strictly TDB, it is usually more convenient to use
5920           TT, which makes no significant difference.
5921
5922        2) The expression used is as adopted in IERS Conventions (2003) and
5923           comes from Souchay et al. (1999) after Simon et al. (1994).
5924
5925        References:
5926
5927           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5928           IERS Technical Note No. 32, BKG (2004)
5929
5930           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
5931           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
5932
5933           Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
5934           Astron.Astrophys.Supp.Ser. 135, 111
5935
5936        This revision:  2021 May 11
5937
5938        Copyright (C) 2013-2021, NumFOCUS Foundation.
5939        Derived, with permission, from the SOFA library.  See notes at end of file.
5940
5941    """
5942    c_retval = ufunc.faju03(t)
5943    return c_retval
5944
5945
5946def fal03(t):
5947    """
5948    Fundamental argument, IERS Conventions (2003):
5949    mean anomaly of the Moon.
5950
5951    Parameters
5952    ----------
5953    t : double array
5954
5955    Returns
5956    -------
5957    c_retval : double array
5958
5959    Notes
5960    -----
5961    Wraps ERFA function ``eraFal03``. The ERFA documentation is::
5962
5963        - - - - - - - - -
5964         e r a F a l 0 3
5965        - - - - - - - - -
5966
5967        Fundamental argument, IERS Conventions (2003):
5968        mean anomaly of the Moon.
5969
5970        Given:
5971           t     double    TDB, Julian centuries since J2000.0 (Note 1)
5972
5973        Returned (function value):
5974                 double    l, radians (Note 2)
5975
5976        Notes:
5977
5978        1) Though t is strictly TDB, it is usually more convenient to use
5979           TT, which makes no significant difference.
5980
5981        2) The expression used is as adopted in IERS Conventions (2003) and
5982           is from Simon et al. (1994).
5983
5984        References:
5985
5986           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
5987           IERS Technical Note No. 32, BKG (2004)
5988
5989           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
5990           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
5991
5992        This revision:  2021 May 11
5993
5994        Copyright (C) 2013-2021, NumFOCUS Foundation.
5995        Derived, with permission, from the SOFA library.  See notes at end of file.
5996
5997    """
5998    c_retval = ufunc.fal03(t)
5999    return c_retval
6000
6001
6002def falp03(t):
6003    """
6004    Fundamental argument, IERS Conventions (2003):
6005    mean anomaly of the Sun.
6006
6007    Parameters
6008    ----------
6009    t : double array
6010
6011    Returns
6012    -------
6013    c_retval : double array
6014
6015    Notes
6016    -----
6017    Wraps ERFA function ``eraFalp03``. The ERFA documentation is::
6018
6019        - - - - - - - - - -
6020         e r a F a l p 0 3
6021        - - - - - - - - - -
6022
6023        Fundamental argument, IERS Conventions (2003):
6024        mean anomaly of the Sun.
6025
6026        Given:
6027           t     double    TDB, Julian centuries since J2000.0 (Note 1)
6028
6029        Returned (function value):
6030                 double    l', radians (Note 2)
6031
6032        Notes:
6033
6034        1) Though t is strictly TDB, it is usually more convenient to use
6035           TT, which makes no significant difference.
6036
6037        2) The expression used is as adopted in IERS Conventions (2003) and
6038           is from Simon et al. (1994).
6039
6040        References:
6041
6042           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6043           IERS Technical Note No. 32, BKG (2004)
6044
6045           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
6046           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
6047
6048        This revision:  2021 May 11
6049
6050        Copyright (C) 2013-2021, NumFOCUS Foundation.
6051        Derived, with permission, from the SOFA library.  See notes at end of file.
6052
6053    """
6054    c_retval = ufunc.falp03(t)
6055    return c_retval
6056
6057
6058def fama03(t):
6059    """
6060    Fundamental argument, IERS Conventions (2003):
6061    mean longitude of Mars.
6062
6063    Parameters
6064    ----------
6065    t : double array
6066
6067    Returns
6068    -------
6069    c_retval : double array
6070
6071    Notes
6072    -----
6073    Wraps ERFA function ``eraFama03``. The ERFA documentation is::
6074
6075        - - - - - - - - - -
6076         e r a F a m a 0 3
6077        - - - - - - - - - -
6078
6079        Fundamental argument, IERS Conventions (2003):
6080        mean longitude of Mars.
6081
6082        Given:
6083           t     double    TDB, Julian centuries since J2000.0 (Note 1)
6084
6085        Returned (function value):
6086                 double    mean longitude of Mars, radians (Note 2)
6087
6088        Notes:
6089
6090        1) Though t is strictly TDB, it is usually more convenient to use
6091           TT, which makes no significant difference.
6092
6093        2) The expression used is as adopted in IERS Conventions (2003) and
6094           comes from Souchay et al. (1999) after Simon et al. (1994).
6095
6096        References:
6097
6098           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6099           IERS Technical Note No. 32, BKG (2004)
6100
6101           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
6102           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
6103
6104           Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
6105           Astron.Astrophys.Supp.Ser. 135, 111
6106
6107        This revision:  2021 May 11
6108
6109        Copyright (C) 2013-2021, NumFOCUS Foundation.
6110        Derived, with permission, from the SOFA library.  See notes at end of file.
6111
6112    """
6113    c_retval = ufunc.fama03(t)
6114    return c_retval
6115
6116
6117def fame03(t):
6118    """
6119    Fundamental argument, IERS Conventions (2003):
6120    mean longitude of Mercury.
6121
6122    Parameters
6123    ----------
6124    t : double array
6125
6126    Returns
6127    -------
6128    c_retval : double array
6129
6130    Notes
6131    -----
6132    Wraps ERFA function ``eraFame03``. The ERFA documentation is::
6133
6134        - - - - - - - - - -
6135         e r a F a m e 0 3
6136        - - - - - - - - - -
6137
6138        Fundamental argument, IERS Conventions (2003):
6139        mean longitude of Mercury.
6140
6141        Given:
6142           t     double    TDB, Julian centuries since J2000.0 (Note 1)
6143
6144        Returned (function value):
6145                 double    mean longitude of Mercury, radians (Note 2)
6146
6147        Notes:
6148
6149        1) Though t is strictly TDB, it is usually more convenient to use
6150           TT, which makes no significant difference.
6151
6152        2) The expression used is as adopted in IERS Conventions (2003) and
6153           comes from Souchay et al. (1999) after Simon et al. (1994).
6154
6155        References:
6156
6157           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6158           IERS Technical Note No. 32, BKG (2004)
6159
6160           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
6161           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
6162
6163           Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
6164           Astron.Astrophys.Supp.Ser. 135, 111
6165
6166        This revision:  2021 May 11
6167
6168        Copyright (C) 2013-2021, NumFOCUS Foundation.
6169        Derived, with permission, from the SOFA library.  See notes at end of file.
6170
6171    """
6172    c_retval = ufunc.fame03(t)
6173    return c_retval
6174
6175
6176def fane03(t):
6177    """
6178    Fundamental argument, IERS Conventions (2003):
6179    mean longitude of Neptune.
6180
6181    Parameters
6182    ----------
6183    t : double array
6184
6185    Returns
6186    -------
6187    c_retval : double array
6188
6189    Notes
6190    -----
6191    Wraps ERFA function ``eraFane03``. The ERFA documentation is::
6192
6193        - - - - - - - - - -
6194         e r a F a n e 0 3
6195        - - - - - - - - - -
6196
6197        Fundamental argument, IERS Conventions (2003):
6198        mean longitude of Neptune.
6199
6200        Given:
6201           t     double    TDB, Julian centuries since J2000.0 (Note 1)
6202
6203        Returned (function value):
6204                 double    mean longitude of Neptune, radians (Note 2)
6205
6206        Notes:
6207
6208        1) Though t is strictly TDB, it is usually more convenient to use
6209           TT, which makes no significant difference.
6210
6211        2) The expression used is as adopted in IERS Conventions (2003) and
6212           is adapted from Simon et al. (1994).
6213
6214        References:
6215
6216           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6217           IERS Technical Note No. 32, BKG (2004)
6218
6219           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
6220           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
6221
6222        This revision:  2021 May 11
6223
6224        Copyright (C) 2013-2021, NumFOCUS Foundation.
6225        Derived, with permission, from the SOFA library.  See notes at end of file.
6226
6227    """
6228    c_retval = ufunc.fane03(t)
6229    return c_retval
6230
6231
6232def faom03(t):
6233    """
6234    Fundamental argument, IERS Conventions (2003):
6235    mean longitude of the Moon's ascending node.
6236
6237    Parameters
6238    ----------
6239    t : double array
6240
6241    Returns
6242    -------
6243    c_retval : double array
6244
6245    Notes
6246    -----
6247    Wraps ERFA function ``eraFaom03``. The ERFA documentation is::
6248
6249        - - - - - - - - - -
6250         e r a F a o m 0 3
6251        - - - - - - - - - -
6252
6253        Fundamental argument, IERS Conventions (2003):
6254        mean longitude of the Moon's ascending node.
6255
6256        Given:
6257           t     double    TDB, Julian centuries since J2000.0 (Note 1)
6258
6259        Returned (function value):
6260                 double    Omega, radians (Note 2)
6261
6262        Notes:
6263
6264        1) Though t is strictly TDB, it is usually more convenient to use
6265           TT, which makes no significant difference.
6266
6267        2) The expression used is as adopted in IERS Conventions (2003) and
6268           is from Simon et al. (1994).
6269
6270        References:
6271
6272           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6273           IERS Technical Note No. 32, BKG (2004)
6274
6275           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
6276           Francou, G., Laskar, J., 1994, Astron.Astrophys. 282, 663-683.
6277
6278        This revision:  2021 May 11
6279
6280        Copyright (C) 2013-2021, NumFOCUS Foundation.
6281        Derived, with permission, from the SOFA library.  See notes at end of file.
6282
6283    """
6284    c_retval = ufunc.faom03(t)
6285    return c_retval
6286
6287
6288def fapa03(t):
6289    """
6290    Fundamental argument, IERS Conventions (2003):
6291    general accumulated precession in longitude.
6292
6293    Parameters
6294    ----------
6295    t : double array
6296
6297    Returns
6298    -------
6299    c_retval : double array
6300
6301    Notes
6302    -----
6303    Wraps ERFA function ``eraFapa03``. The ERFA documentation is::
6304
6305        - - - - - - - - - -
6306         e r a F a p a 0 3
6307        - - - - - - - - - -
6308
6309        Fundamental argument, IERS Conventions (2003):
6310        general accumulated precession in longitude.
6311
6312        Given:
6313           t     double    TDB, Julian centuries since J2000.0 (Note 1)
6314
6315        Returned (function value):
6316                 double    general precession in longitude, radians (Note 2)
6317
6318        Notes:
6319
6320        1) Though t is strictly TDB, it is usually more convenient to use
6321           TT, which makes no significant difference.
6322
6323        2) The expression used is as adopted in IERS Conventions (2003).  It
6324           is taken from Kinoshita & Souchay (1990) and comes originally
6325           from Lieske et al. (1977).
6326
6327        References:
6328
6329           Kinoshita, H. and Souchay J. 1990, Celest.Mech. and Dyn.Astron.
6330           48, 187
6331
6332           Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977,
6333           Astron.Astrophys. 58, 1-16
6334
6335           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6336           IERS Technical Note No. 32, BKG (2004)
6337
6338        This revision:  2021 May 11
6339
6340        Copyright (C) 2013-2021, NumFOCUS Foundation.
6341        Derived, with permission, from the SOFA library.  See notes at end of file.
6342
6343    """
6344    c_retval = ufunc.fapa03(t)
6345    return c_retval
6346
6347
6348def fasa03(t):
6349    """
6350    Fundamental argument, IERS Conventions (2003):
6351    mean longitude of Saturn.
6352
6353    Parameters
6354    ----------
6355    t : double array
6356
6357    Returns
6358    -------
6359    c_retval : double array
6360
6361    Notes
6362    -----
6363    Wraps ERFA function ``eraFasa03``. The ERFA documentation is::
6364
6365        - - - - - - - - - -
6366         e r a F a s a 0 3
6367        - - - - - - - - - -
6368
6369        Fundamental argument, IERS Conventions (2003):
6370        mean longitude of Saturn.
6371
6372        Given:
6373           t     double    TDB, Julian centuries since J2000.0 (Note 1)
6374
6375        Returned (function value):
6376                 double    mean longitude of Saturn, radians (Note 2)
6377
6378        Notes:
6379
6380        1) Though t is strictly TDB, it is usually more convenient to use
6381           TT, which makes no significant difference.
6382
6383        2) The expression used is as adopted in IERS Conventions (2003) and
6384           comes from Souchay et al. (1999) after Simon et al. (1994).
6385
6386        References:
6387
6388           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6389           IERS Technical Note No. 32, BKG (2004)
6390
6391           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
6392           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
6393
6394           Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
6395           Astron.Astrophys.Supp.Ser. 135, 111
6396
6397        This revision:  2021 May 11
6398
6399        Copyright (C) 2013-2021, NumFOCUS Foundation.
6400        Derived, with permission, from the SOFA library.  See notes at end of file.
6401
6402    """
6403    c_retval = ufunc.fasa03(t)
6404    return c_retval
6405
6406
6407def faur03(t):
6408    """
6409    Fundamental argument, IERS Conventions (2003):
6410    mean longitude of Uranus.
6411
6412    Parameters
6413    ----------
6414    t : double array
6415
6416    Returns
6417    -------
6418    c_retval : double array
6419
6420    Notes
6421    -----
6422    Wraps ERFA function ``eraFaur03``. The ERFA documentation is::
6423
6424        - - - - - - - - - -
6425         e r a F a u r 0 3
6426        - - - - - - - - - -
6427
6428        Fundamental argument, IERS Conventions (2003):
6429        mean longitude of Uranus.
6430
6431        Given:
6432           t     double    TDB, Julian centuries since J2000.0 (Note 1)
6433
6434        Returned  (function value):
6435                 double    mean longitude of Uranus, radians (Note 2)
6436
6437        Notes:
6438
6439        1) Though t is strictly TDB, it is usually more convenient to use
6440           TT, which makes no significant difference.
6441
6442        2) The expression used is as adopted in IERS Conventions (2003) and
6443           is adapted from Simon et al. (1994).
6444
6445        References:
6446
6447           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6448           IERS Technical Note No. 32, BKG (2004)
6449
6450           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
6451           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
6452
6453        This revision:  2021 May 11
6454
6455        Copyright (C) 2013-2021, NumFOCUS Foundation.
6456        Derived, with permission, from the SOFA library.  See notes at end of file.
6457
6458    """
6459    c_retval = ufunc.faur03(t)
6460    return c_retval
6461
6462
6463def fave03(t):
6464    """
6465    Fundamental argument, IERS Conventions (2003):
6466    mean longitude of Venus.
6467
6468    Parameters
6469    ----------
6470    t : double array
6471
6472    Returns
6473    -------
6474    c_retval : double array
6475
6476    Notes
6477    -----
6478    Wraps ERFA function ``eraFave03``. The ERFA documentation is::
6479
6480        - - - - - - - - - -
6481         e r a F a v e 0 3
6482        - - - - - - - - - -
6483
6484        Fundamental argument, IERS Conventions (2003):
6485        mean longitude of Venus.
6486
6487        Given:
6488           t     double    TDB, Julian centuries since J2000.0 (Note 1)
6489
6490        Returned (function value):
6491                 double    mean longitude of Venus, radians (Note 2)
6492
6493        Notes:
6494
6495        1) Though t is strictly TDB, it is usually more convenient to use
6496           TT, which makes no significant difference.
6497
6498        2) The expression used is as adopted in IERS Conventions (2003) and
6499           comes from Souchay et al. (1999) after Simon et al. (1994).
6500
6501        References:
6502
6503           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6504           IERS Technical Note No. 32, BKG (2004)
6505
6506           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
6507           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
6508
6509           Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
6510           Astron.Astrophys.Supp.Ser. 135, 111
6511
6512        This revision:  2021 May 11
6513
6514        Copyright (C) 2013-2021, NumFOCUS Foundation.
6515        Derived, with permission, from the SOFA library.  See notes at end of file.
6516
6517    """
6518    c_retval = ufunc.fave03(t)
6519    return c_retval
6520
6521
6522def bi00():
6523    """
6524    Frame bias components of IAU 2000 precession-nutation models;  part
6525    of the Mathews-Herring-Buffett (MHB2000) nutation series, with
6526    additions.
6527
6528    Parameters
6529    ----------
6530
6531    Returns
6532    -------
6533    dpsibi : double array
6534    depsbi : double array
6535    dra : double array
6536
6537    Notes
6538    -----
6539    Wraps ERFA function ``eraBi00``. The ERFA documentation is::
6540
6541        - - - - - - - -
6542         e r a B i 0 0
6543        - - - - - - - -
6544
6545        Frame bias components of IAU 2000 precession-nutation models;  part
6546        of the Mathews-Herring-Buffett (MHB2000) nutation series, with
6547        additions.
6548
6549        Returned:
6550           dpsibi,depsbi  double  longitude and obliquity corrections
6551           dra            double  the ICRS RA of the J2000.0 mean equinox
6552
6553        Notes:
6554
6555        1) The frame bias corrections in longitude and obliquity (radians)
6556           are required in order to correct for the offset between the GCRS
6557           pole and the mean J2000.0 pole.  They define, with respect to the
6558           GCRS frame, a J2000.0 mean pole that is consistent with the rest
6559           of the IAU 2000A precession-nutation model.
6560
6561        2) In addition to the displacement of the pole, the complete
6562           description of the frame bias requires also an offset in right
6563           ascension.  This is not part of the IAU 2000A model, and is from
6564           Chapront et al. (2002).  It is returned in radians.
6565
6566        3) This is a supplemented implementation of one aspect of the IAU
6567           2000A nutation model, formally adopted by the IAU General
6568           Assembly in 2000, namely MHB2000 (Mathews et al. 2002).
6569
6570        References:
6571
6572           Chapront, J., Chapront-Touze, M. & Francou, G., Astron.
6573           Astrophys., 387, 700, 2002.
6574
6575           Mathews, P.M., Herring, T.A., Buffet, B.A., "Modeling of nutation
6576           and precession:  New nutation series for nonrigid Earth and
6577           insights into the Earth's interior", J.Geophys.Res., 107, B4,
6578           2002.  The MHB2000 code itself was obtained on 2002 September 9
6579           from ftp://maia.usno.navy.mil/conv2000/chapter5/IAU2000A.
6580
6581        This revision:  2021 May 11
6582
6583        Copyright (C) 2013-2021, NumFOCUS Foundation.
6584        Derived, with permission, from the SOFA library.  See notes at end of file.
6585
6586    """
6587    dpsibi, depsbi, dra = ufunc.bi00()
6588    return dpsibi, depsbi, dra
6589
6590
6591def bp00(date1, date2):
6592    """
6593    Frame bias and precession, IAU 2000.
6594
6595    Parameters
6596    ----------
6597    date1 : double array
6598    date2 : double array
6599
6600    Returns
6601    -------
6602    rb : double array
6603    rp : double array
6604    rbp : double array
6605
6606    Notes
6607    -----
6608    Wraps ERFA function ``eraBp00``. The ERFA documentation is::
6609
6610        - - - - - - - -
6611         e r a B p 0 0
6612        - - - - - - - -
6613
6614        Frame bias and precession, IAU 2000.
6615
6616        Given:
6617           date1,date2  double         TT as a 2-part Julian Date (Note 1)
6618
6619        Returned:
6620           rb           double[3][3]   frame bias matrix (Note 2)
6621           rp           double[3][3]   precession matrix (Note 3)
6622           rbp          double[3][3]   bias-precession matrix (Note 4)
6623
6624        Notes:
6625
6626        1) The TT date date1+date2 is a Julian Date, apportioned in any
6627           convenient way between the two arguments.  For example,
6628           JD(TT)=2450123.7 could be expressed in any of these ways,
6629           among others:
6630
6631                   date1         date2
6632
6633               2450123.7           0.0       (JD method)
6634               2451545.0       -1421.3       (J2000 method)
6635               2400000.5       50123.2       (MJD method)
6636               2450123.5           0.2       (date & time method)
6637
6638           The JD method is the most natural and convenient to use in
6639           cases where the loss of several decimal digits of resolution
6640           is acceptable.  The J2000 method is best matched to the way
6641           the argument is handled internally and will deliver the
6642           optimum resolution.  The MJD method and the date & time methods
6643           are both good compromises between resolution and convenience.
6644
6645        2) The matrix rb transforms vectors from GCRS to mean J2000.0 by
6646           applying frame bias.
6647
6648        3) The matrix rp transforms vectors from J2000.0 mean equator and
6649           equinox to mean equator and equinox of date by applying
6650           precession.
6651
6652        4) The matrix rbp transforms vectors from GCRS to mean equator and
6653           equinox of date by applying frame bias then precession.  It is
6654           the product rp x rb.
6655
6656        5) It is permissible to re-use the same array in the returned
6657           arguments.  The arrays are filled in the order given.
6658
6659        Called:
6660           eraBi00      frame bias components, IAU 2000
6661           eraPr00      IAU 2000 precession adjustments
6662           eraIr        initialize r-matrix to identity
6663           eraRx        rotate around X-axis
6664           eraRy        rotate around Y-axis
6665           eraRz        rotate around Z-axis
6666           eraCr        copy r-matrix
6667           eraRxr       product of two r-matrices
6668
6669        Reference:
6670           "Expressions for the Celestial Intermediate Pole and Celestial
6671           Ephemeris Origin consistent with the IAU 2000A precession-
6672           nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
6673
6674           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
6675                intermediate origin" (CIO) by IAU 2006 Resolution 2.
6676
6677        This revision:  2021 May 11
6678
6679        Copyright (C) 2013-2021, NumFOCUS Foundation.
6680        Derived, with permission, from the SOFA library.  See notes at end of file.
6681
6682    """
6683    rb, rp, rbp = ufunc.bp00(date1, date2)
6684    return rb, rp, rbp
6685
6686
6687def bp06(date1, date2):
6688    """
6689    Frame bias and precession, IAU 2006.
6690
6691    Parameters
6692    ----------
6693    date1 : double array
6694    date2 : double array
6695
6696    Returns
6697    -------
6698    rb : double array
6699    rp : double array
6700    rbp : double array
6701
6702    Notes
6703    -----
6704    Wraps ERFA function ``eraBp06``. The ERFA documentation is::
6705
6706        - - - - - - - -
6707         e r a B p 0 6
6708        - - - - - - - -
6709
6710        Frame bias and precession, IAU 2006.
6711
6712        Given:
6713           date1,date2  double         TT as a 2-part Julian Date (Note 1)
6714
6715        Returned:
6716           rb           double[3][3]   frame bias matrix (Note 2)
6717           rp           double[3][3]   precession matrix (Note 3)
6718           rbp          double[3][3]   bias-precession matrix (Note 4)
6719
6720        Notes:
6721
6722        1) The TT date date1+date2 is a Julian Date, apportioned in any
6723           convenient way between the two arguments.  For example,
6724           JD(TT)=2450123.7 could be expressed in any of these ways,
6725           among others:
6726
6727                   date1         date2
6728
6729               2450123.7           0.0       (JD method)
6730               2451545.0       -1421.3       (J2000 method)
6731               2400000.5       50123.2       (MJD method)
6732               2450123.5           0.2       (date & time method)
6733
6734           The JD method is the most natural and convenient to use in
6735           cases where the loss of several decimal digits of resolution
6736           is acceptable.  The J2000 method is best matched to the way
6737           the argument is handled internally and will deliver the
6738           optimum resolution.  The MJD method and the date & time methods
6739           are both good compromises between resolution and convenience.
6740
6741        2) The matrix rb transforms vectors from GCRS to mean J2000.0 by
6742           applying frame bias.
6743
6744        3) The matrix rp transforms vectors from mean J2000.0 to mean of
6745           date by applying precession.
6746
6747        4) The matrix rbp transforms vectors from GCRS to mean of date by
6748           applying frame bias then precession.  It is the product rp x rb.
6749
6750        5) It is permissible to re-use the same array in the returned
6751           arguments.  The arrays are filled in the order given.
6752
6753        Called:
6754           eraPfw06     bias-precession F-W angles, IAU 2006
6755           eraFw2m      F-W angles to r-matrix
6756           eraPmat06    PB matrix, IAU 2006
6757           eraTr        transpose r-matrix
6758           eraRxr       product of two r-matrices
6759           eraCr        copy r-matrix
6760
6761        References:
6762
6763           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
6764
6765           Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
6766
6767        This revision:  2021 May 11
6768
6769        Copyright (C) 2013-2021, NumFOCUS Foundation.
6770        Derived, with permission, from the SOFA library.  See notes at end of file.
6771
6772    """
6773    rb, rp, rbp = ufunc.bp06(date1, date2)
6774    return rb, rp, rbp
6775
6776
6777def bpn2xy(rbpn):
6778    """
6779    Extract from the bias-precession-nutation matrix the X,Y coordinates
6780    of the Celestial Intermediate Pole.
6781
6782    Parameters
6783    ----------
6784    rbpn : double array
6785
6786    Returns
6787    -------
6788    x : double array
6789    y : double array
6790
6791    Notes
6792    -----
6793    Wraps ERFA function ``eraBpn2xy``. The ERFA documentation is::
6794
6795        - - - - - - - - - -
6796         e r a B p n 2 x y
6797        - - - - - - - - - -
6798
6799        Extract from the bias-precession-nutation matrix the X,Y coordinates
6800        of the Celestial Intermediate Pole.
6801
6802        Given:
6803           rbpn      double[3][3]  celestial-to-true matrix (Note 1)
6804
6805        Returned:
6806           x,y       double        Celestial Intermediate Pole (Note 2)
6807
6808        Notes:
6809
6810        1) The matrix rbpn transforms vectors from GCRS to true equator (and
6811           CIO or equinox) of date, and therefore the Celestial Intermediate
6812           Pole unit vector is the bottom row of the matrix.
6813
6814        2) The arguments x,y are components of the Celestial Intermediate
6815           Pole unit vector in the Geocentric Celestial Reference System.
6816
6817        Reference:
6818
6819           "Expressions for the Celestial Intermediate Pole and Celestial
6820           Ephemeris Origin consistent with the IAU 2000A precession-
6821           nutation model", Astron.Astrophys. 400, 1145-1154
6822           (2003)
6823
6824           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
6825                intermediate origin" (CIO) by IAU 2006 Resolution 2.
6826
6827        This revision:  2021 May 11
6828
6829        Copyright (C) 2013-2021, NumFOCUS Foundation.
6830        Derived, with permission, from the SOFA library.  See notes at end of file.
6831
6832    """
6833    x, y = ufunc.bpn2xy(rbpn)
6834    return x, y
6835
6836
6837def c2i00a(date1, date2):
6838    """
6839    Form the celestial-to-intermediate matrix for a given date using the
6840    IAU 2000A precession-nutation model.
6841
6842    Parameters
6843    ----------
6844    date1 : double array
6845    date2 : double array
6846
6847    Returns
6848    -------
6849    rc2i : double array
6850
6851    Notes
6852    -----
6853    Wraps ERFA function ``eraC2i00a``. The ERFA documentation is::
6854
6855        - - - - - - - - - -
6856         e r a C 2 i 0 0 a
6857        - - - - - - - - - -
6858
6859        Form the celestial-to-intermediate matrix for a given date using the
6860        IAU 2000A precession-nutation model.
6861
6862        Given:
6863           date1,date2 double       TT as a 2-part Julian Date (Note 1)
6864
6865        Returned:
6866           rc2i        double[3][3] celestial-to-intermediate matrix (Note 2)
6867
6868        Notes:
6869
6870        1) The TT date date1+date2 is a Julian Date, apportioned in any
6871           convenient way between the two arguments.  For example,
6872           JD(TT)=2450123.7 could be expressed in any of these ways,
6873           among others:
6874
6875                  date1          date2
6876
6877               2450123.7           0.0       (JD method)
6878               2451545.0       -1421.3       (J2000 method)
6879               2400000.5       50123.2       (MJD method)
6880               2450123.5           0.2       (date & time method)
6881
6882           The JD method is the most natural and convenient to use in
6883           cases where the loss of several decimal digits of resolution
6884           is acceptable.  The J2000 method is best matched to the way
6885           the argument is handled internally and will deliver the
6886           optimum resolution.  The MJD method and the date & time methods
6887           are both good compromises between resolution and convenience.
6888
6889        2) The matrix rc2i is the first stage in the transformation from
6890           celestial to terrestrial coordinates:
6891
6892              [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]
6893
6894                     =  rc2t * [CRS]
6895
6896           where [CRS] is a vector in the Geocentric Celestial Reference
6897           System and [TRS] is a vector in the International Terrestrial
6898           Reference System (see IERS Conventions 2003), ERA is the Earth
6899           Rotation Angle and RPOM is the polar motion matrix.
6900
6901        3) A faster, but slightly less accurate, result (about 1 mas) can be
6902           obtained by using instead the eraC2i00b function.
6903
6904        Called:
6905           eraPnm00a    classical NPB matrix, IAU 2000A
6906           eraC2ibpn    celestial-to-intermediate matrix, given NPB matrix
6907
6908        References:
6909
6910           "Expressions for the Celestial Intermediate Pole and Celestial
6911           Ephemeris Origin consistent with the IAU 2000A precession-
6912           nutation model", Astron.Astrophys. 400, 1145-1154
6913           (2003)
6914
6915           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
6916                intermediate origin" (CIO) by IAU 2006 Resolution 2.
6917
6918           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
6919           IERS Technical Note No. 32, BKG (2004)
6920
6921        This revision:  2021 May 11
6922
6923        Copyright (C) 2013-2021, NumFOCUS Foundation.
6924        Derived, with permission, from the SOFA library.  See notes at end of file.
6925
6926    """
6927    rc2i = ufunc.c2i00a(date1, date2)
6928    return rc2i
6929
6930
6931def c2i00b(date1, date2):
6932    """
6933    Form the celestial-to-intermediate matrix for a given date using the
6934    IAU 2000B precession-nutation model.
6935
6936    Parameters
6937    ----------
6938    date1 : double array
6939    date2 : double array
6940
6941    Returns
6942    -------
6943    rc2i : double array
6944
6945    Notes
6946    -----
6947    Wraps ERFA function ``eraC2i00b``. The ERFA documentation is::
6948
6949        - - - - - - - - - -
6950         e r a C 2 i 0 0 b
6951        - - - - - - - - - -
6952
6953        Form the celestial-to-intermediate matrix for a given date using the
6954        IAU 2000B precession-nutation model.
6955
6956        Given:
6957           date1,date2 double       TT as a 2-part Julian Date (Note 1)
6958
6959        Returned:
6960           rc2i        double[3][3] celestial-to-intermediate matrix (Note 2)
6961
6962        Notes:
6963
6964        1) The TT date date1+date2 is a Julian Date, apportioned in any
6965           convenient way between the two arguments.  For example,
6966           JD(TT)=2450123.7 could be expressed in any of these ways,
6967           among others:
6968
6969                  date1          date2
6970
6971               2450123.7           0.0       (JD method)
6972               2451545.0       -1421.3       (J2000 method)
6973               2400000.5       50123.2       (MJD method)
6974               2450123.5           0.2       (date & time method)
6975
6976           The JD method is the most natural and convenient to use in
6977           cases where the loss of several decimal digits of resolution
6978           is acceptable.  The J2000 method is best matched to the way
6979           the argument is handled internally and will deliver the
6980           optimum resolution.  The MJD method and the date & time methods
6981           are both good compromises between resolution and convenience.
6982
6983        2) The matrix rc2i is the first stage in the transformation from
6984           celestial to terrestrial coordinates:
6985
6986              [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]
6987
6988                     =  rc2t * [CRS]
6989
6990           where [CRS] is a vector in the Geocentric Celestial Reference
6991           System and [TRS] is a vector in the International Terrestrial
6992           Reference System (see IERS Conventions 2003), ERA is the Earth
6993           Rotation Angle and RPOM is the polar motion matrix.
6994
6995        3) The present function is faster, but slightly less accurate (about
6996           1 mas), than the eraC2i00a function.
6997
6998        Called:
6999           eraPnm00b    classical NPB matrix, IAU 2000B
7000           eraC2ibpn    celestial-to-intermediate matrix, given NPB matrix
7001
7002        References:
7003
7004           "Expressions for the Celestial Intermediate Pole and Celestial
7005           Ephemeris Origin consistent with the IAU 2000A precession-
7006           nutation model", Astron.Astrophys. 400, 1145-1154
7007           (2003)
7008
7009           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
7010                intermediate origin" (CIO) by IAU 2006 Resolution 2.
7011
7012           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7013           IERS Technical Note No. 32, BKG (2004)
7014
7015        This revision:  2021 May 11
7016
7017        Copyright (C) 2013-2021, NumFOCUS Foundation.
7018        Derived, with permission, from the SOFA library.  See notes at end of file.
7019
7020    """
7021    rc2i = ufunc.c2i00b(date1, date2)
7022    return rc2i
7023
7024
7025def c2i06a(date1, date2):
7026    """
7027    Form the celestial-to-intermediate matrix for a given date using the
7028    IAU 2006 precession and IAU 2000A nutation models.
7029
7030    Parameters
7031    ----------
7032    date1 : double array
7033    date2 : double array
7034
7035    Returns
7036    -------
7037    rc2i : double array
7038
7039    Notes
7040    -----
7041    Wraps ERFA function ``eraC2i06a``. The ERFA documentation is::
7042
7043        - - - - - - - - - -
7044         e r a C 2 i 0 6 a
7045        - - - - - - - - - -
7046
7047        Form the celestial-to-intermediate matrix for a given date using the
7048        IAU 2006 precession and IAU 2000A nutation models.
7049
7050        Given:
7051           date1,date2 double       TT as a 2-part Julian Date (Note 1)
7052
7053        Returned:
7054           rc2i        double[3][3] celestial-to-intermediate matrix (Note 2)
7055
7056        Notes:
7057
7058        1) The TT date date1+date2 is a Julian Date, apportioned in any
7059           convenient way between the two arguments.  For example,
7060           JD(TT)=2450123.7 could be expressed in any of these ways,
7061           among others:
7062
7063                  date1          date2
7064
7065               2450123.7           0.0       (JD method)
7066               2451545.0       -1421.3       (J2000 method)
7067               2400000.5       50123.2       (MJD method)
7068               2450123.5           0.2       (date & time method)
7069
7070           The JD method is the most natural and convenient to use in
7071           cases where the loss of several decimal digits of resolution
7072           is acceptable.  The J2000 method is best matched to the way
7073           the argument is handled internally and will deliver the
7074           optimum resolution.  The MJD method and the date & time methods
7075           are both good compromises between resolution and convenience.
7076
7077        2) The matrix rc2i is the first stage in the transformation from
7078           celestial to terrestrial coordinates:
7079
7080              [TRS]  =  RPOM * R_3(ERA) * rc2i * [CRS]
7081
7082                     =  RC2T * [CRS]
7083
7084           where [CRS] is a vector in the Geocentric Celestial Reference
7085           System and [TRS] is a vector in the International Terrestrial
7086           Reference System (see IERS Conventions 2003), ERA is the Earth
7087           Rotation Angle and RPOM is the polar motion matrix.
7088
7089        Called:
7090           eraPnm06a    classical NPB matrix, IAU 2006/2000A
7091           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
7092           eraS06       the CIO locator s, given X,Y, IAU 2006
7093           eraC2ixys    celestial-to-intermediate matrix, given X,Y and s
7094
7095        References:
7096
7097           McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
7098           IERS Technical Note No. 32, BKG
7099
7100        This revision:  2021 May 11
7101
7102        Copyright (C) 2013-2021, NumFOCUS Foundation.
7103        Derived, with permission, from the SOFA library.  See notes at end of file.
7104
7105    """
7106    rc2i = ufunc.c2i06a(date1, date2)
7107    return rc2i
7108
7109
7110def c2ibpn(date1, date2, rbpn):
7111    """
7112    Form the celestial-to-intermediate matrix for a given date given
7113    the bias-precession-nutation matrix.
7114
7115    Parameters
7116    ----------
7117    date1 : double array
7118    date2 : double array
7119    rbpn : double array
7120
7121    Returns
7122    -------
7123    rc2i : double array
7124
7125    Notes
7126    -----
7127    Wraps ERFA function ``eraC2ibpn``. The ERFA documentation is::
7128
7129        - - - - - - - - - -
7130         e r a C 2 i b p n
7131        - - - - - - - - - -
7132
7133        Form the celestial-to-intermediate matrix for a given date given
7134        the bias-precession-nutation matrix.  IAU 2000.
7135
7136        Given:
7137           date1,date2 double       TT as a 2-part Julian Date (Note 1)
7138           rbpn        double[3][3] celestial-to-true matrix (Note 2)
7139
7140        Returned:
7141           rc2i        double[3][3] celestial-to-intermediate matrix (Note 3)
7142
7143        Notes:
7144
7145        1) The TT date date1+date2 is a Julian Date, apportioned in any
7146           convenient way between the two arguments.  For example,
7147           JD(TT)=2450123.7 could be expressed in any of these ways,
7148           among others:
7149
7150                  date1          date2
7151
7152               2450123.7           0.0       (JD method)
7153               2451545.0       -1421.3       (J2000 method)
7154               2400000.5       50123.2       (MJD method)
7155               2450123.5           0.2       (date & time method)
7156
7157           The JD method is the most natural and convenient to use in
7158           cases where the loss of several decimal digits of resolution
7159           is acceptable.  The J2000 method is best matched to the way
7160           the argument is handled internally and will deliver the
7161           optimum resolution.  The MJD method and the date & time methods
7162           are both good compromises between resolution and convenience.
7163
7164        2) The matrix rbpn transforms vectors from GCRS to true equator (and
7165           CIO or equinox) of date.  Only the CIP (bottom row) is used.
7166
7167        3) The matrix rc2i is the first stage in the transformation from
7168           celestial to terrestrial coordinates:
7169
7170              [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]
7171
7172                    = RC2T * [CRS]
7173
7174           where [CRS] is a vector in the Geocentric Celestial Reference
7175           System and [TRS] is a vector in the International Terrestrial
7176           Reference System (see IERS Conventions 2003), ERA is the Earth
7177           Rotation Angle and RPOM is the polar motion matrix.
7178
7179        4) Although its name does not include "00", This function is in fact
7180           specific to the IAU 2000 models.
7181
7182        Called:
7183           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
7184           eraC2ixy     celestial-to-intermediate matrix, given X,Y
7185
7186        References:
7187           "Expressions for the Celestial Intermediate Pole and Celestial
7188           Ephemeris Origin consistent with the IAU 2000A precession-
7189           nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
7190
7191           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
7192                intermediate origin" (CIO) by IAU 2006 Resolution 2.
7193
7194           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7195           IERS Technical Note No. 32, BKG (2004)
7196
7197        This revision:  2021 May 11
7198
7199        Copyright (C) 2013-2021, NumFOCUS Foundation.
7200        Derived, with permission, from the SOFA library.  See notes at end of file.
7201
7202    """
7203    rc2i = ufunc.c2ibpn(date1, date2, rbpn)
7204    return rc2i
7205
7206
7207def c2ixy(date1, date2, x, y):
7208    """
7209    Form the celestial to intermediate-frame-of-date matrix for a given
7210    date when the CIP X,Y coordinates are known.
7211
7212    Parameters
7213    ----------
7214    date1 : double array
7215    date2 : double array
7216    x : double array
7217    y : double array
7218
7219    Returns
7220    -------
7221    rc2i : double array
7222
7223    Notes
7224    -----
7225    Wraps ERFA function ``eraC2ixy``. The ERFA documentation is::
7226
7227        - - - - - - - - -
7228         e r a C 2 i x y
7229        - - - - - - - - -
7230
7231        Form the celestial to intermediate-frame-of-date matrix for a given
7232        date when the CIP X,Y coordinates are known.  IAU 2000.
7233
7234        Given:
7235           date1,date2 double       TT as a 2-part Julian Date (Note 1)
7236           x,y         double       Celestial Intermediate Pole (Note 2)
7237
7238        Returned:
7239           rc2i        double[3][3] celestial-to-intermediate matrix (Note 3)
7240
7241        Notes:
7242
7243        1) The TT date date1+date2 is a Julian Date, apportioned in any
7244           convenient way between the two arguments.  For example,
7245           JD(TT)=2450123.7 could be expressed in any of these ways,
7246           among others:
7247
7248                  date1          date2
7249
7250               2450123.7           0.0       (JD method)
7251               2451545.0       -1421.3       (J2000 method)
7252               2400000.5       50123.2       (MJD method)
7253               2450123.5           0.2       (date & time method)
7254
7255           The JD method is the most natural and convenient to use in
7256           cases where the loss of several decimal digits of resolution
7257           is acceptable.  The J2000 method is best matched to the way
7258           the argument is handled internally and will deliver the
7259           optimum resolution.  The MJD method and the date & time methods
7260           are both good compromises between resolution and convenience.
7261
7262        2) The Celestial Intermediate Pole coordinates are the x,y components
7263           of the unit vector in the Geocentric Celestial Reference System.
7264
7265        3) The matrix rc2i is the first stage in the transformation from
7266           celestial to terrestrial coordinates:
7267
7268              [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]
7269
7270                    = RC2T * [CRS]
7271
7272           where [CRS] is a vector in the Geocentric Celestial Reference
7273           System and [TRS] is a vector in the International Terrestrial
7274           Reference System (see IERS Conventions 2003), ERA is the Earth
7275           Rotation Angle and RPOM is the polar motion matrix.
7276
7277        4) Although its name does not include "00", This function is in fact
7278           specific to the IAU 2000 models.
7279
7280        Called:
7281           eraC2ixys    celestial-to-intermediate matrix, given X,Y and s
7282           eraS00       the CIO locator s, given X,Y, IAU 2000A
7283
7284        Reference:
7285
7286           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7287           IERS Technical Note No. 32, BKG (2004)
7288
7289        This revision:  2021 May 11
7290
7291        Copyright (C) 2013-2021, NumFOCUS Foundation.
7292        Derived, with permission, from the SOFA library.  See notes at end of file.
7293
7294    """
7295    rc2i = ufunc.c2ixy(date1, date2, x, y)
7296    return rc2i
7297
7298
7299def c2ixys(x, y, s):
7300    """
7301    Form the celestial to intermediate-frame-of-date matrix given the CIP
7302    X,Y and the CIO locator s.
7303
7304    Parameters
7305    ----------
7306    x : double array
7307    y : double array
7308    s : double array
7309
7310    Returns
7311    -------
7312    rc2i : double array
7313
7314    Notes
7315    -----
7316    Wraps ERFA function ``eraC2ixys``. The ERFA documentation is::
7317
7318        - - - - - - - - - -
7319         e r a C 2 i x y s
7320        - - - - - - - - - -
7321
7322        Form the celestial to intermediate-frame-of-date matrix given the CIP
7323        X,Y and the CIO locator s.
7324
7325        Given:
7326           x,y      double         Celestial Intermediate Pole (Note 1)
7327           s        double         the CIO locator s (Note 2)
7328
7329        Returned:
7330           rc2i     double[3][3]   celestial-to-intermediate matrix (Note 3)
7331
7332        Notes:
7333
7334        1) The Celestial Intermediate Pole coordinates are the x,y
7335           components of the unit vector in the Geocentric Celestial
7336           Reference System.
7337
7338        2) The CIO locator s (in radians) positions the Celestial
7339           Intermediate Origin on the equator of the CIP.
7340
7341        3) The matrix rc2i is the first stage in the transformation from
7342           celestial to terrestrial coordinates:
7343
7344              [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]
7345
7346                    = RC2T * [CRS]
7347
7348           where [CRS] is a vector in the Geocentric Celestial Reference
7349           System and [TRS] is a vector in the International Terrestrial
7350           Reference System (see IERS Conventions 2003), ERA is the Earth
7351           Rotation Angle and RPOM is the polar motion matrix.
7352
7353        Called:
7354           eraIr        initialize r-matrix to identity
7355           eraRz        rotate around Z-axis
7356           eraRy        rotate around Y-axis
7357
7358        Reference:
7359
7360           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7361           IERS Technical Note No. 32, BKG (2004)
7362
7363        This revision:  2021 May 11
7364
7365        Copyright (C) 2013-2021, NumFOCUS Foundation.
7366        Derived, with permission, from the SOFA library.  See notes at end of file.
7367
7368    """
7369    rc2i = ufunc.c2ixys(x, y, s)
7370    return rc2i
7371
7372
7373def c2t00a(tta, ttb, uta, utb, xp, yp):
7374    """
7375    Form the celestial to terrestrial matrix given the date, the UT1 and
7376    the polar motion, using the IAU 2000A precession-nutation model.
7377
7378    Parameters
7379    ----------
7380    tta : double array
7381    ttb : double array
7382    uta : double array
7383    utb : double array
7384    xp : double array
7385    yp : double array
7386
7387    Returns
7388    -------
7389    rc2t : double array
7390
7391    Notes
7392    -----
7393    Wraps ERFA function ``eraC2t00a``. The ERFA documentation is::
7394
7395        - - - - - - - - - -
7396         e r a C 2 t 0 0 a
7397        - - - - - - - - - -
7398
7399        Form the celestial to terrestrial matrix given the date, the UT1 and
7400        the polar motion, using the IAU 2000A precession-nutation model.
7401
7402        Given:
7403           tta,ttb  double         TT as a 2-part Julian Date (Note 1)
7404           uta,utb  double         UT1 as a 2-part Julian Date (Note 1)
7405           xp,yp    double         CIP coordinates (radians, Note 2)
7406
7407        Returned:
7408           rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 3)
7409
7410        Notes:
7411
7412        1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
7413           apportioned in any convenient way between the arguments uta and
7414           utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
7415           these ways, among others:
7416
7417                   uta            utb
7418
7419               2450123.7           0.0       (JD method)
7420               2451545.0       -1421.3       (J2000 method)
7421               2400000.5       50123.2       (MJD method)
7422               2450123.5           0.2       (date & time method)
7423
7424           The JD method is the most natural and convenient to use in
7425           cases where the loss of several decimal digits of resolution is
7426           acceptable.  The J2000 and MJD methods are good compromises
7427           between resolution and convenience.  In the case of uta,utb, the
7428           date & time method is best matched to the Earth rotation angle
7429           algorithm used:  maximum precision is delivered when the uta
7430           argument is for 0hrs UT1 on the day in question and the utb
7431           argument lies in the range 0 to 1, or vice versa.
7432
7433        2) The arguments xp and yp are the coordinates (in radians) of the
7434           Celestial Intermediate Pole with respect to the International
7435           Terrestrial Reference System (see IERS Conventions 2003),
7436           measured along the meridians 0 and 90 deg west respectively.
7437
7438        3) The matrix rc2t transforms from celestial to terrestrial
7439           coordinates:
7440
7441              [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]
7442
7443                    = rc2t * [CRS]
7444
7445           where [CRS] is a vector in the Geocentric Celestial Reference
7446           System and [TRS] is a vector in the International Terrestrial
7447           Reference System (see IERS Conventions 2003), RC2I is the
7448           celestial-to-intermediate matrix, ERA is the Earth rotation
7449           angle and RPOM is the polar motion matrix.
7450
7451        4) A faster, but slightly less accurate, result (about 1 mas) can
7452           be obtained by using instead the eraC2t00b function.
7453
7454        Called:
7455           eraC2i00a    celestial-to-intermediate matrix, IAU 2000A
7456           eraEra00     Earth rotation angle, IAU 2000
7457           eraSp00      the TIO locator s', IERS 2000
7458           eraPom00     polar motion matrix
7459           eraC2tcio    form CIO-based celestial-to-terrestrial matrix
7460
7461        Reference:
7462
7463           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7464           IERS Technical Note No. 32, BKG (2004)
7465
7466        This revision:  2021 May 11
7467
7468        Copyright (C) 2013-2021, NumFOCUS Foundation.
7469        Derived, with permission, from the SOFA library.  See notes at end of file.
7470
7471    """
7472    rc2t = ufunc.c2t00a(tta, ttb, uta, utb, xp, yp)
7473    return rc2t
7474
7475
7476def c2t00b(tta, ttb, uta, utb, xp, yp):
7477    """
7478    Form the celestial to terrestrial matrix given the date, the UT1 and
7479    the polar motion, using the IAU 2000B precession-nutation model.
7480
7481    Parameters
7482    ----------
7483    tta : double array
7484    ttb : double array
7485    uta : double array
7486    utb : double array
7487    xp : double array
7488    yp : double array
7489
7490    Returns
7491    -------
7492    rc2t : double array
7493
7494    Notes
7495    -----
7496    Wraps ERFA function ``eraC2t00b``. The ERFA documentation is::
7497
7498        - - - - - - - - - -
7499         e r a C 2 t 0 0 b
7500        - - - - - - - - - -
7501
7502        Form the celestial to terrestrial matrix given the date, the UT1 and
7503        the polar motion, using the IAU 2000B precession-nutation model.
7504
7505        Given:
7506           tta,ttb  double         TT as a 2-part Julian Date (Note 1)
7507           uta,utb  double         UT1 as a 2-part Julian Date (Note 1)
7508           xp,yp    double         coordinates of the pole (radians, Note 2)
7509
7510        Returned:
7511           rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 3)
7512
7513        Notes:
7514
7515        1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
7516           apportioned in any convenient way between the arguments uta and
7517           utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
7518           these ways, among others:
7519
7520                   uta            utb
7521
7522               2450123.7           0.0       (JD method)
7523               2451545.0       -1421.3       (J2000 method)
7524               2400000.5       50123.2       (MJD method)
7525               2450123.5           0.2       (date & time method)
7526
7527           The JD method is the most natural and convenient to use in
7528           cases where the loss of several decimal digits of resolution is
7529           acceptable.  The J2000 and MJD methods are good compromises
7530           between resolution and convenience.  In the case of uta,utb, the
7531           date & time method is best matched to the Earth rotation angle
7532           algorithm used:  maximum precision is delivered when the uta
7533           argument is for 0hrs UT1 on the day in question and the utb
7534           argument lies in the range 0 to 1, or vice versa.
7535
7536        2) The arguments xp and yp are the coordinates (in radians) of the
7537           Celestial Intermediate Pole with respect to the International
7538           Terrestrial Reference System (see IERS Conventions 2003),
7539           measured along the meridians 0 and 90 deg west respectively.
7540
7541        3) The matrix rc2t transforms from celestial to terrestrial
7542           coordinates:
7543
7544              [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]
7545
7546                    = rc2t * [CRS]
7547
7548           where [CRS] is a vector in the Geocentric Celestial Reference
7549           System and [TRS] is a vector in the International Terrestrial
7550           Reference System (see IERS Conventions 2003), RC2I is the
7551           celestial-to-intermediate matrix, ERA is the Earth rotation
7552           angle and RPOM is the polar motion matrix.
7553
7554        4) The present function is faster, but slightly less accurate (about
7555           1 mas), than the eraC2t00a function.
7556
7557        Called:
7558           eraC2i00b    celestial-to-intermediate matrix, IAU 2000B
7559           eraEra00     Earth rotation angle, IAU 2000
7560           eraPom00     polar motion matrix
7561           eraC2tcio    form CIO-based celestial-to-terrestrial matrix
7562
7563        Reference:
7564
7565           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7566           IERS Technical Note No. 32, BKG (2004)
7567
7568        This revision:  2021 May 11
7569
7570        Copyright (C) 2013-2021, NumFOCUS Foundation.
7571        Derived, with permission, from the SOFA library.  See notes at end of file.
7572
7573    """
7574    rc2t = ufunc.c2t00b(tta, ttb, uta, utb, xp, yp)
7575    return rc2t
7576
7577
7578def c2t06a(tta, ttb, uta, utb, xp, yp):
7579    """
7580    Form the celestial to terrestrial matrix given the date, the UT1 and
7581    the polar motion, using the IAU 2006/2000A precession-nutation
7582    model.
7583
7584    Parameters
7585    ----------
7586    tta : double array
7587    ttb : double array
7588    uta : double array
7589    utb : double array
7590    xp : double array
7591    yp : double array
7592
7593    Returns
7594    -------
7595    rc2t : double array
7596
7597    Notes
7598    -----
7599    Wraps ERFA function ``eraC2t06a``. The ERFA documentation is::
7600
7601        - - - - - - - - - -
7602         e r a C 2 t 0 6 a
7603        - - - - - - - - - -
7604
7605        Form the celestial to terrestrial matrix given the date, the UT1 and
7606        the polar motion, using the IAU 2006/2000A precession-nutation
7607        model.
7608
7609        Given:
7610           tta,ttb  double         TT as a 2-part Julian Date (Note 1)
7611           uta,utb  double         UT1 as a 2-part Julian Date (Note 1)
7612           xp,yp    double         coordinates of the pole (radians, Note 2)
7613
7614        Returned:
7615           rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 3)
7616
7617        Notes:
7618
7619        1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
7620           apportioned in any convenient way between the arguments uta and
7621           utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
7622           these ways, among others:
7623
7624                   uta            utb
7625
7626               2450123.7           0.0       (JD method)
7627               2451545.0       -1421.3       (J2000 method)
7628               2400000.5       50123.2       (MJD method)
7629               2450123.5           0.2       (date & time method)
7630
7631           The JD method is the most natural and convenient to use in
7632           cases where the loss of several decimal digits of resolution is
7633           acceptable.  The J2000 and MJD methods are good compromises
7634           between resolution and convenience.  In the case of uta,utb, the
7635           date & time method is best matched to the Earth rotation angle
7636           algorithm used:  maximum precision is delivered when the uta
7637           argument is for 0hrs UT1 on the day in question and the utb
7638           argument lies in the range 0 to 1, or vice versa.
7639
7640        2) The arguments xp and yp are the coordinates (in radians) of the
7641           Celestial Intermediate Pole with respect to the International
7642           Terrestrial Reference System (see IERS Conventions 2003),
7643           measured along the meridians 0 and 90 deg west respectively.
7644
7645        3) The matrix rc2t transforms from celestial to terrestrial
7646           coordinates:
7647
7648              [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]
7649
7650                    = rc2t * [CRS]
7651
7652           where [CRS] is a vector in the Geocentric Celestial Reference
7653           System and [TRS] is a vector in the International Terrestrial
7654           Reference System (see IERS Conventions 2003), RC2I is the
7655           celestial-to-intermediate matrix, ERA is the Earth rotation
7656           angle and RPOM is the polar motion matrix.
7657
7658        Called:
7659           eraC2i06a    celestial-to-intermediate matrix, IAU 2006/2000A
7660           eraEra00     Earth rotation angle, IAU 2000
7661           eraSp00      the TIO locator s', IERS 2000
7662           eraPom00     polar motion matrix
7663           eraC2tcio    form CIO-based celestial-to-terrestrial matrix
7664
7665        Reference:
7666
7667           McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
7668           IERS Technical Note No. 32, BKG
7669
7670        This revision:  2021 May 11
7671
7672        Copyright (C) 2013-2021, NumFOCUS Foundation.
7673        Derived, with permission, from the SOFA library.  See notes at end of file.
7674
7675    """
7676    rc2t = ufunc.c2t06a(tta, ttb, uta, utb, xp, yp)
7677    return rc2t
7678
7679
7680def c2tcio(rc2i, era, rpom):
7681    """
7682    Assemble the celestial to terrestrial matrix from CIO-based
7683    components (the celestial-to-intermediate matrix, the Earth Rotation
7684    Angle and the polar motion matrix).
7685
7686    Parameters
7687    ----------
7688    rc2i : double array
7689    era : double array
7690    rpom : double array
7691
7692    Returns
7693    -------
7694    rc2t : double array
7695
7696    Notes
7697    -----
7698    Wraps ERFA function ``eraC2tcio``. The ERFA documentation is::
7699
7700        - - - - - - - - - -
7701         e r a C 2 t c i o
7702        - - - - - - - - - -
7703
7704        Assemble the celestial to terrestrial matrix from CIO-based
7705        components (the celestial-to-intermediate matrix, the Earth Rotation
7706        Angle and the polar motion matrix).
7707
7708        Given:
7709           rc2i     double[3][3]    celestial-to-intermediate matrix
7710           era      double          Earth rotation angle (radians)
7711           rpom     double[3][3]    polar-motion matrix
7712
7713        Returned:
7714           rc2t     double[3][3]    celestial-to-terrestrial matrix
7715
7716        Notes:
7717
7718        1) This function constructs the rotation matrix that transforms
7719           vectors in the celestial system into vectors in the terrestrial
7720           system.  It does so starting from precomputed components, namely
7721           the matrix which rotates from celestial coordinates to the
7722           intermediate frame, the Earth rotation angle and the polar motion
7723           matrix.  One use of the present function is when generating a
7724           series of celestial-to-terrestrial matrices where only the Earth
7725           Rotation Angle changes, avoiding the considerable overhead of
7726           recomputing the precession-nutation more often than necessary to
7727           achieve given accuracy objectives.
7728
7729        2) The relationship between the arguments is as follows:
7730
7731              [TRS] = RPOM * R_3(ERA) * rc2i * [CRS]
7732
7733                    = rc2t * [CRS]
7734
7735           where [CRS] is a vector in the Geocentric Celestial Reference
7736           System and [TRS] is a vector in the International Terrestrial
7737           Reference System (see IERS Conventions 2003).
7738
7739        Called:
7740           eraCr        copy r-matrix
7741           eraRz        rotate around Z-axis
7742           eraRxr       product of two r-matrices
7743
7744        Reference:
7745
7746           McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
7747           IERS Technical Note No. 32, BKG
7748
7749        This revision:  2021 May 11
7750
7751        Copyright (C) 2013-2021, NumFOCUS Foundation.
7752        Derived, with permission, from the SOFA library.  See notes at end of file.
7753
7754    """
7755    rc2t = ufunc.c2tcio(rc2i, era, rpom)
7756    return rc2t
7757
7758
7759def c2teqx(rbpn, gst, rpom):
7760    """
7761    Assemble the celestial to terrestrial matrix from equinox-based
7762    components (the celestial-to-true matrix, the Greenwich Apparent
7763    Sidereal Time and the polar motion matrix).
7764
7765    Parameters
7766    ----------
7767    rbpn : double array
7768    gst : double array
7769    rpom : double array
7770
7771    Returns
7772    -------
7773    rc2t : double array
7774
7775    Notes
7776    -----
7777    Wraps ERFA function ``eraC2teqx``. The ERFA documentation is::
7778
7779        - - - - - - - - - -
7780         e r a C 2 t e q x
7781        - - - - - - - - - -
7782
7783        Assemble the celestial to terrestrial matrix from equinox-based
7784        components (the celestial-to-true matrix, the Greenwich Apparent
7785        Sidereal Time and the polar motion matrix).
7786
7787        Given:
7788           rbpn   double[3][3]  celestial-to-true matrix
7789           gst    double        Greenwich (apparent) Sidereal Time (radians)
7790           rpom   double[3][3]  polar-motion matrix
7791
7792        Returned:
7793           rc2t   double[3][3]  celestial-to-terrestrial matrix (Note 2)
7794
7795        Notes:
7796
7797        1) This function constructs the rotation matrix that transforms
7798           vectors in the celestial system into vectors in the terrestrial
7799           system.  It does so starting from precomputed components, namely
7800           the matrix which rotates from celestial coordinates to the
7801           true equator and equinox of date, the Greenwich Apparent Sidereal
7802           Time and the polar motion matrix.  One use of the present function
7803           is when generating a series of celestial-to-terrestrial matrices
7804           where only the Sidereal Time changes, avoiding the considerable
7805           overhead of recomputing the precession-nutation more often than
7806           necessary to achieve given accuracy objectives.
7807
7808        2) The relationship between the arguments is as follows:
7809
7810              [TRS] = rpom * R_3(gst) * rbpn * [CRS]
7811
7812                    = rc2t * [CRS]
7813
7814           where [CRS] is a vector in the Geocentric Celestial Reference
7815           System and [TRS] is a vector in the International Terrestrial
7816           Reference System (see IERS Conventions 2003).
7817
7818        Called:
7819           eraCr        copy r-matrix
7820           eraRz        rotate around Z-axis
7821           eraRxr       product of two r-matrices
7822
7823        Reference:
7824
7825           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7826           IERS Technical Note No. 32, BKG (2004)
7827
7828        This revision:  2021 May 11
7829
7830        Copyright (C) 2013-2021, NumFOCUS Foundation.
7831        Derived, with permission, from the SOFA library.  See notes at end of file.
7832
7833    """
7834    rc2t = ufunc.c2teqx(rbpn, gst, rpom)
7835    return rc2t
7836
7837
7838def c2tpe(tta, ttb, uta, utb, dpsi, deps, xp, yp):
7839    """
7840    Form the celestial to terrestrial matrix given the date, the UT1,
7841    the nutation and the polar motion.
7842
7843    Parameters
7844    ----------
7845    tta : double array
7846    ttb : double array
7847    uta : double array
7848    utb : double array
7849    dpsi : double array
7850    deps : double array
7851    xp : double array
7852    yp : double array
7853
7854    Returns
7855    -------
7856    rc2t : double array
7857
7858    Notes
7859    -----
7860    Wraps ERFA function ``eraC2tpe``. The ERFA documentation is::
7861
7862        - - - - - - - - -
7863         e r a C 2 t p e
7864        - - - - - - - - -
7865
7866        Form the celestial to terrestrial matrix given the date, the UT1,
7867        the nutation and the polar motion.  IAU 2000.
7868
7869        Given:
7870           tta,ttb    double        TT as a 2-part Julian Date (Note 1)
7871           uta,utb    double        UT1 as a 2-part Julian Date (Note 1)
7872           dpsi,deps  double        nutation (Note 2)
7873           xp,yp      double        coordinates of the pole (radians, Note 3)
7874
7875        Returned:
7876           rc2t       double[3][3]  celestial-to-terrestrial matrix (Note 4)
7877
7878        Notes:
7879
7880        1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
7881           apportioned in any convenient way between the arguments uta and
7882           utb.  For example, JD(UT1)=2450123.7 could be expressed in any of
7883           these ways, among others:
7884
7885                   uta            utb
7886
7887               2450123.7           0.0       (JD method)
7888               2451545.0       -1421.3       (J2000 method)
7889               2400000.5       50123.2       (MJD method)
7890               2450123.5           0.2       (date & time method)
7891
7892           The JD method is the most natural and convenient to use in
7893           cases where the loss of several decimal digits of resolution is
7894           acceptable.  The J2000 and MJD methods are good compromises
7895           between resolution and convenience.  In the case of uta,utb, the
7896           date & time method is best matched to the Earth rotation angle
7897           algorithm used:  maximum precision is delivered when the uta
7898           argument is for 0hrs UT1 on the day in question and the utb
7899           argument lies in the range 0 to 1, or vice versa.
7900
7901        2) The caller is responsible for providing the nutation components;
7902           they are in longitude and obliquity, in radians and are with
7903           respect to the equinox and ecliptic of date.  For high-accuracy
7904           applications, free core nutation should be included as well as
7905           any other relevant corrections to the position of the CIP.
7906
7907        3) The arguments xp and yp are the coordinates (in radians) of the
7908           Celestial Intermediate Pole with respect to the International
7909           Terrestrial Reference System (see IERS Conventions 2003),
7910           measured along the meridians 0 and 90 deg west respectively.
7911
7912        4) The matrix rc2t transforms from celestial to terrestrial
7913           coordinates:
7914
7915              [TRS] = RPOM * R_3(GST) * RBPN * [CRS]
7916
7917                    = rc2t * [CRS]
7918
7919           where [CRS] is a vector in the Geocentric Celestial Reference
7920           System and [TRS] is a vector in the International Terrestrial
7921           Reference System (see IERS Conventions 2003), RBPN is the
7922           bias-precession-nutation matrix, GST is the Greenwich (apparent)
7923           Sidereal Time and RPOM is the polar motion matrix.
7924
7925        5) Although its name does not include "00", This function is in fact
7926           specific to the IAU 2000 models.
7927
7928        Called:
7929           eraPn00      bias/precession/nutation results, IAU 2000
7930           eraGmst00    Greenwich mean sidereal time, IAU 2000
7931           eraSp00      the TIO locator s', IERS 2000
7932           eraEe00      equation of the equinoxes, IAU 2000
7933           eraPom00     polar motion matrix
7934           eraC2teqx    form equinox-based celestial-to-terrestrial matrix
7935
7936        Reference:
7937
7938           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
7939           IERS Technical Note No. 32, BKG (2004)
7940
7941        This revision:  2021 May 11
7942
7943        Copyright (C) 2013-2021, NumFOCUS Foundation.
7944        Derived, with permission, from the SOFA library.  See notes at end of file.
7945
7946    """
7947    rc2t = ufunc.c2tpe(tta, ttb, uta, utb, dpsi, deps, xp, yp)
7948    return rc2t
7949
7950
7951def c2txy(tta, ttb, uta, utb, x, y, xp, yp):
7952    """
7953    Form the celestial to terrestrial matrix given the date, the UT1,
7954    the CIP coordinates and the polar motion.
7955
7956    Parameters
7957    ----------
7958    tta : double array
7959    ttb : double array
7960    uta : double array
7961    utb : double array
7962    x : double array
7963    y : double array
7964    xp : double array
7965    yp : double array
7966
7967    Returns
7968    -------
7969    rc2t : double array
7970
7971    Notes
7972    -----
7973    Wraps ERFA function ``eraC2txy``. The ERFA documentation is::
7974
7975        - - - - - - - - -
7976         e r a C 2 t x y
7977        - - - - - - - - -
7978
7979        Form the celestial to terrestrial matrix given the date, the UT1,
7980        the CIP coordinates and the polar motion.  IAU 2000.
7981
7982        Given:
7983           tta,ttb  double         TT as a 2-part Julian Date (Note 1)
7984           uta,utb  double         UT1 as a 2-part Julian Date (Note 1)
7985           x,y      double         Celestial Intermediate Pole (Note 2)
7986           xp,yp    double         coordinates of the pole (radians, Note 3)
7987
7988        Returned:
7989           rc2t     double[3][3]   celestial-to-terrestrial matrix (Note 4)
7990
7991        Notes:
7992
7993        1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates,
7994           apportioned in any convenient way between the arguments uta and
7995           utb.  For example, JD(UT1)=2450123.7 could be expressed in any o
7996           these ways, among others:
7997
7998                   uta            utb
7999
8000               2450123.7           0.0       (JD method)
8001               2451545.0       -1421.3       (J2000 method)
8002               2400000.5       50123.2       (MJD method)
8003               2450123.5           0.2       (date & time method)
8004
8005           The JD method is the most natural and convenient to use in
8006           cases where the loss of several decimal digits of resolution is
8007           acceptable.  The J2000 and MJD methods are good compromises
8008           between resolution and convenience.  In the case of uta,utb, the
8009           date & time method is best matched to the Earth rotation angle
8010           algorithm used:  maximum precision is delivered when the uta
8011           argument is for 0hrs UT1 on the day in question and the utb
8012           argument lies in the range 0 to 1, or vice versa.
8013
8014        2) The Celestial Intermediate Pole coordinates are the x,y
8015           components of the unit vector in the Geocentric Celestial
8016           Reference System.
8017
8018        3) The arguments xp and yp are the coordinates (in radians) of the
8019           Celestial Intermediate Pole with respect to the International
8020           Terrestrial Reference System (see IERS Conventions 2003),
8021           measured along the meridians 0 and 90 deg west respectively.
8022
8023        4) The matrix rc2t transforms from celestial to terrestrial
8024           coordinates:
8025
8026              [TRS] = RPOM * R_3(ERA) * RC2I * [CRS]
8027
8028                    = rc2t * [CRS]
8029
8030           where [CRS] is a vector in the Geocentric Celestial Reference
8031           System and [TRS] is a vector in the International Terrestrial
8032           Reference System (see IERS Conventions 2003), ERA is the Earth
8033           Rotation Angle and RPOM is the polar motion matrix.
8034
8035        5) Although its name does not include "00", This function is in fact
8036           specific to the IAU 2000 models.
8037
8038        Called:
8039           eraC2ixy     celestial-to-intermediate matrix, given X,Y
8040           eraEra00     Earth rotation angle, IAU 2000
8041           eraSp00      the TIO locator s', IERS 2000
8042           eraPom00     polar motion matrix
8043           eraC2tcio    form CIO-based celestial-to-terrestrial matrix
8044
8045       Reference:
8046
8047           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
8048           IERS Technical Note No. 32, BKG (2004)
8049
8050        This revision:  2021 May 11
8051
8052        Copyright (C) 2013-2021, NumFOCUS Foundation.
8053        Derived, with permission, from the SOFA library.  See notes at end of file.
8054
8055    """
8056    rc2t = ufunc.c2txy(tta, ttb, uta, utb, x, y, xp, yp)
8057    return rc2t
8058
8059
8060def eo06a(date1, date2):
8061    """
8062    Equation of the origins, IAU 2006 precession and IAU 2000A nutation.
8063
8064    Parameters
8065    ----------
8066    date1 : double array
8067    date2 : double array
8068
8069    Returns
8070    -------
8071    c_retval : double array
8072
8073    Notes
8074    -----
8075    Wraps ERFA function ``eraEo06a``. The ERFA documentation is::
8076
8077        - - - - - - - - -
8078         e r a E o 0 6 a
8079        - - - - - - - - -
8080
8081        Equation of the origins, IAU 2006 precession and IAU 2000A nutation.
8082
8083        Given:
8084           date1,date2  double    TT as a 2-part Julian Date (Note 1)
8085
8086        Returned (function value):
8087                        double    the equation of the origins in radians
8088
8089        Notes:
8090
8091        1) The TT date date1+date2 is a Julian Date, apportioned in any
8092           convenient way between the two arguments.  For example,
8093           JD(TT)=2450123.7 could be expressed in any of these ways,
8094           among others:
8095
8096                  date1          date2
8097
8098               2450123.7           0.0       (JD method)
8099               2451545.0       -1421.3       (J2000 method)
8100               2400000.5       50123.2       (MJD method)
8101               2450123.5           0.2       (date & time method)
8102
8103           The JD method is the most natural and convenient to use in
8104           cases where the loss of several decimal digits of resolution
8105           is acceptable.  The J2000 method is best matched to the way
8106           the argument is handled internally and will deliver the
8107           optimum resolution.  The MJD method and the date & time methods
8108           are both good compromises between resolution and convenience.
8109
8110        2) The equation of the origins is the distance between the true
8111           equinox and the celestial intermediate origin and, equivalently,
8112           the difference between Earth rotation angle and Greenwich
8113           apparent sidereal time (ERA-GST).  It comprises the precession
8114           (since J2000.0) in right ascension plus the equation of the
8115           equinoxes (including the small correction terms).
8116
8117        Called:
8118           eraPnm06a    classical NPB matrix, IAU 2006/2000A
8119           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
8120           eraS06       the CIO locator s, given X,Y, IAU 2006
8121           eraEors      equation of the origins, given NPB matrix and s
8122
8123        References:
8124
8125           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
8126
8127           Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
8128
8129        This revision:  2021 May 11
8130
8131        Copyright (C) 2013-2021, NumFOCUS Foundation.
8132        Derived, with permission, from the SOFA library.  See notes at end of file.
8133
8134    """
8135    c_retval = ufunc.eo06a(date1, date2)
8136    return c_retval
8137
8138
8139def eors(rnpb, s):
8140    """
8141    Equation of the origins, given the classical NPB matrix and the
8142    quantity s.
8143
8144    Parameters
8145    ----------
8146    rnpb : double array
8147    s : double array
8148
8149    Returns
8150    -------
8151    c_retval : double array
8152
8153    Notes
8154    -----
8155    Wraps ERFA function ``eraEors``. The ERFA documentation is::
8156
8157        - - - - - - - -
8158         e r a E o r s
8159        - - - - - - - -
8160
8161        Equation of the origins, given the classical NPB matrix and the
8162        quantity s.
8163
8164        Given:
8165           rnpb  double[3][3]  classical nutation x precession x bias matrix
8166           s     double        the quantity s (the CIO locator) in radians
8167
8168        Returned (function value):
8169                 double        the equation of the origins in radians
8170
8171        Notes:
8172
8173        1)  The equation of the origins is the distance between the true
8174            equinox and the celestial intermediate origin and, equivalently,
8175            the difference between Earth rotation angle and Greenwich
8176            apparent sidereal time (ERA-GST).  It comprises the precession
8177            (since J2000.0) in right ascension plus the equation of the
8178            equinoxes (including the small correction terms).
8179
8180        2)  The algorithm is from Wallace & Capitaine (2006).
8181
8182       References:
8183
8184           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
8185
8186           Wallace, P. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
8187
8188        This revision:  2021 May 11
8189
8190        Copyright (C) 2013-2021, NumFOCUS Foundation.
8191        Derived, with permission, from the SOFA library.  See notes at end of file.
8192
8193    """
8194    c_retval = ufunc.eors(rnpb, s)
8195    return c_retval
8196
8197
8198def fw2m(gamb, phib, psi, eps):
8199    """
8200    Form rotation matrix given the Fukushima-Williams angles.
8201
8202    Parameters
8203    ----------
8204    gamb : double array
8205    phib : double array
8206    psi : double array
8207    eps : double array
8208
8209    Returns
8210    -------
8211    r : double array
8212
8213    Notes
8214    -----
8215    Wraps ERFA function ``eraFw2m``. The ERFA documentation is::
8216
8217        - - - - - - - -
8218         e r a F w 2 m
8219        - - - - - - - -
8220
8221        Form rotation matrix given the Fukushima-Williams angles.
8222
8223        Given:
8224           gamb     double         F-W angle gamma_bar (radians)
8225           phib     double         F-W angle phi_bar (radians)
8226           psi      double         F-W angle psi (radians)
8227           eps      double         F-W angle epsilon (radians)
8228
8229        Returned:
8230           r        double[3][3]   rotation matrix
8231
8232        Notes:
8233
8234        1) Naming the following points:
8235
8236                 e = J2000.0 ecliptic pole,
8237                 p = GCRS pole,
8238                 E = ecliptic pole of date,
8239           and   P = CIP,
8240
8241           the four Fukushima-Williams angles are as follows:
8242
8243              gamb = gamma = epE
8244              phib = phi = pE
8245              psi = psi = pEP
8246              eps = epsilon = EP
8247
8248        2) The matrix representing the combined effects of frame bias,
8249           precession and nutation is:
8250
8251              NxPxB = R_1(-eps).R_3(-psi).R_1(phib).R_3(gamb)
8252
8253        3) The present function can construct three different matrices,
8254           depending on which angles are supplied as the arguments gamb,
8255           phib, psi and eps:
8256
8257           o  To obtain the nutation x precession x frame bias matrix,
8258              first generate the four precession angles known conventionally
8259              as gamma_bar, phi_bar, psi_bar and epsilon_A, then generate
8260              the nutation components Dpsi and Depsilon and add them to
8261              psi_bar and epsilon_A, and finally call the present function
8262              using those four angles as arguments.
8263
8264           o  To obtain the precession x frame bias matrix, generate the
8265              four precession angles and call the present function.
8266
8267           o  To obtain the frame bias matrix, generate the four precession
8268              angles for date J2000.0 and call the present function.
8269
8270           The nutation-only and precession-only matrices can if necessary
8271           be obtained by combining these three appropriately.
8272
8273        Called:
8274           eraIr        initialize r-matrix to identity
8275           eraRz        rotate around Z-axis
8276           eraRx        rotate around X-axis
8277
8278        References:
8279
8280           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
8281
8282           Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
8283
8284        This revision:  2021 May 11
8285
8286        Copyright (C) 2013-2021, NumFOCUS Foundation.
8287        Derived, with permission, from the SOFA library.  See notes at end of file.
8288
8289    """
8290    r = ufunc.fw2m(gamb, phib, psi, eps)
8291    return r
8292
8293
8294def fw2xy(gamb, phib, psi, eps):
8295    """
8296    CIP X,Y given Fukushima-Williams bias-precession-nutation angles.
8297
8298    Parameters
8299    ----------
8300    gamb : double array
8301    phib : double array
8302    psi : double array
8303    eps : double array
8304
8305    Returns
8306    -------
8307    x : double array
8308    y : double array
8309
8310    Notes
8311    -----
8312    Wraps ERFA function ``eraFw2xy``. The ERFA documentation is::
8313
8314        - - - - - - - - -
8315         e r a F w 2 x y
8316        - - - - - - - - -
8317
8318        CIP X,Y given Fukushima-Williams bias-precession-nutation angles.
8319
8320        Given:
8321           gamb     double    F-W angle gamma_bar (radians)
8322           phib     double    F-W angle phi_bar (radians)
8323           psi      double    F-W angle psi (radians)
8324           eps      double    F-W angle epsilon (radians)
8325
8326        Returned:
8327           x,y      double    CIP unit vector X,Y
8328
8329        Notes:
8330
8331        1) Naming the following points:
8332
8333                 e = J2000.0 ecliptic pole,
8334                 p = GCRS pole
8335                 E = ecliptic pole of date,
8336           and   P = CIP,
8337
8338           the four Fukushima-Williams angles are as follows:
8339
8340              gamb = gamma = epE
8341              phib = phi = pE
8342              psi = psi = pEP
8343              eps = epsilon = EP
8344
8345        2) The matrix representing the combined effects of frame bias,
8346           precession and nutation is:
8347
8348              NxPxB = R_1(-epsA).R_3(-psi).R_1(phib).R_3(gamb)
8349
8350           The returned values x,y are elements [2][0] and [2][1] of the
8351           matrix.  Near J2000.0, they are essentially angles in radians.
8352
8353        Called:
8354           eraFw2m      F-W angles to r-matrix
8355           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
8356
8357        Reference:
8358
8359           Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
8360
8361        This revision:  2021 May 11
8362
8363        Copyright (C) 2013-2021, NumFOCUS Foundation.
8364        Derived, with permission, from the SOFA library.  See notes at end of file.
8365
8366    """
8367    x, y = ufunc.fw2xy(gamb, phib, psi, eps)
8368    return x, y
8369
8370
8371def ltp(epj):
8372    """
8373    Long-term precession matrix.
8374
8375    Parameters
8376    ----------
8377    epj : double array
8378
8379    Returns
8380    -------
8381    rp : double array
8382
8383    Notes
8384    -----
8385    Wraps ERFA function ``eraLtp``. The ERFA documentation is::
8386
8387        - - - - - - -
8388         e r a L t p
8389        - - - - - - -
8390
8391        Long-term precession matrix.
8392
8393        Given:
8394           epj     double         Julian epoch (TT)
8395
8396        Returned:
8397           rp      double[3][3]   precession matrix, J2000.0 to date
8398
8399        Notes:
8400
8401        1) The matrix is in the sense
8402
8403              P_date = rp x P_J2000,
8404
8405           where P_J2000 is a vector with respect to the J2000.0 mean
8406           equator and equinox and P_date is the same vector with respect to
8407           the equator and equinox of epoch epj.
8408
8409        2) The Vondrak et al. (2011, 2012) 400 millennia precession model
8410           agrees with the IAU 2006 precession at J2000.0 and stays within
8411           100 microarcseconds during the 20th and 21st centuries.  It is
8412           accurate to a few arcseconds throughout the historical period,
8413           worsening to a few tenths of a degree at the end of the
8414           +/- 200,000 year time span.
8415
8416        Called:
8417           eraLtpequ    equator pole, long term
8418           eraLtpecl    ecliptic pole, long term
8419           eraPxp       vector product
8420           eraPn        normalize vector
8421
8422        References:
8423
8424          Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
8425          expressions, valid for long time intervals, Astron.Astrophys. 534,
8426          A22
8427
8428          Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
8429          expressions, valid for long time intervals (Corrigendum),
8430          Astron.Astrophys. 541, C1
8431
8432        This revision:  2021 May 11
8433
8434        Copyright (C) 2013-2021, NumFOCUS Foundation.
8435        Derived, with permission, from the SOFA library.  See notes at end of file.
8436
8437    """
8438    rp = ufunc.ltp(epj)
8439    return rp
8440
8441
8442def ltpb(epj):
8443    """
8444    Long-term precession matrix, including ICRS frame bias.
8445
8446    Parameters
8447    ----------
8448    epj : double array
8449
8450    Returns
8451    -------
8452    rpb : double array
8453
8454    Notes
8455    -----
8456    Wraps ERFA function ``eraLtpb``. The ERFA documentation is::
8457
8458        - - - - - - - -
8459         e r a L t p b
8460        - - - - - - - -
8461
8462        Long-term precession matrix, including ICRS frame bias.
8463
8464        Given:
8465           epj     double         Julian epoch (TT)
8466
8467        Returned:
8468           rpb     double[3][3]   precession-bias matrix, J2000.0 to date
8469
8470        Notes:
8471
8472        1) The matrix is in the sense
8473
8474              P_date = rpb x P_ICRS,
8475
8476           where P_ICRS is a vector in the Geocentric Celestial Reference
8477           System, and P_date is the vector with respect to the Celestial
8478           Intermediate Reference System at that date but with nutation
8479           neglected.
8480
8481        2) A first order frame bias formulation is used, of sub-
8482           microarcsecond accuracy compared with a full 3D rotation.
8483
8484        3) The Vondrak et al. (2011, 2012) 400 millennia precession model
8485           agrees with the IAU 2006 precession at J2000.0 and stays within
8486           100 microarcseconds during the 20th and 21st centuries.  It is
8487           accurate to a few arcseconds throughout the historical period,
8488           worsening to a few tenths of a degree at the end of the
8489           +/- 200,000 year time span.
8490
8491        References:
8492
8493          Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
8494          expressions, valid for long time intervals, Astron.Astrophys. 534,
8495          A22
8496
8497          Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
8498          expressions, valid for long time intervals (Corrigendum),
8499          Astron.Astrophys. 541, C1
8500
8501        This revision:  2021 May 11
8502
8503        Copyright (C) 2013-2021, NumFOCUS Foundation.
8504        Derived, with permission, from the SOFA library.  See notes at end of file.
8505
8506    """
8507    rpb = ufunc.ltpb(epj)
8508    return rpb
8509
8510
8511def ltpecl(epj):
8512    """
8513    Long-term precession of the ecliptic.
8514
8515    Parameters
8516    ----------
8517    epj : double array
8518
8519    Returns
8520    -------
8521    vec : double array
8522
8523    Notes
8524    -----
8525    Wraps ERFA function ``eraLtpecl``. The ERFA documentation is::
8526
8527        - - - - - - - - - -
8528         e r a L t p e c l
8529        - - - - - - - - - -
8530
8531        Long-term precession of the ecliptic.
8532
8533        Given:
8534           epj     double         Julian epoch (TT)
8535
8536        Returned:
8537           vec     double[3]      ecliptic pole unit vector
8538
8539        Notes:
8540
8541        1) The returned vector is with respect to the J2000.0 mean equator
8542           and equinox.
8543
8544        2) The Vondrak et al. (2011, 2012) 400 millennia precession model
8545           agrees with the IAU 2006 precession at J2000.0 and stays within
8546           100 microarcseconds during the 20th and 21st centuries.  It is
8547           accurate to a few arcseconds throughout the historical period,
8548           worsening to a few tenths of a degree at the end of the
8549           +/- 200,000 year time span.
8550
8551        References:
8552
8553          Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
8554          expressions, valid for long time intervals, Astron.Astrophys. 534,
8555          A22
8556
8557          Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
8558          expressions, valid for long time intervals (Corrigendum),
8559          Astron.Astrophys. 541, C1
8560
8561        This revision:  2021 May 11
8562
8563        Copyright (C) 2013-2021, NumFOCUS Foundation.
8564        Derived, with permission, from the SOFA library.  See notes at end of file.
8565
8566    """
8567    vec = ufunc.ltpecl(epj)
8568    return vec
8569
8570
8571def ltpequ(epj):
8572    """
8573    Long-term precession of the equator.
8574
8575    Parameters
8576    ----------
8577    epj : double array
8578
8579    Returns
8580    -------
8581    veq : double array
8582
8583    Notes
8584    -----
8585    Wraps ERFA function ``eraLtpequ``. The ERFA documentation is::
8586
8587        - - - - - - - - - -
8588         e r a L t p e q u
8589        - - - - - - - - - -
8590
8591        Long-term precession of the equator.
8592
8593        Given:
8594           epj     double         Julian epoch (TT)
8595
8596        Returned:
8597           veq     double[3]      equator pole unit vector
8598
8599        Notes:
8600
8601        1) The returned vector is with respect to the J2000.0 mean equator
8602           and equinox.
8603
8604        2) The Vondrak et al. (2011, 2012) 400 millennia precession model
8605           agrees with the IAU 2006 precession at J2000.0 and stays within
8606           100 microarcseconds during the 20th and 21st centuries.  It is
8607           accurate to a few arcseconds throughout the historical period,
8608           worsening to a few tenths of a degree at the end of the
8609           +/- 200,000 year time span.
8610
8611        References:
8612
8613          Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
8614          expressions, valid for long time intervals, Astron.Astrophys. 534,
8615          A22
8616
8617          Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
8618          expressions, valid for long time intervals (Corrigendum),
8619          Astron.Astrophys. 541, C1
8620
8621        This revision:  2021 May 11
8622
8623        Copyright (C) 2013-2021, NumFOCUS Foundation.
8624        Derived, with permission, from the SOFA library.  See notes at end of file.
8625
8626    """
8627    veq = ufunc.ltpequ(epj)
8628    return veq
8629
8630
8631def num00a(date1, date2):
8632    """
8633    Form the matrix of nutation for a given date, IAU 2000A model.
8634
8635    Parameters
8636    ----------
8637    date1 : double array
8638    date2 : double array
8639
8640    Returns
8641    -------
8642    rmatn : double array
8643
8644    Notes
8645    -----
8646    Wraps ERFA function ``eraNum00a``. The ERFA documentation is::
8647
8648        - - - - - - - - - -
8649         e r a N u m 0 0 a
8650        - - - - - - - - - -
8651
8652        Form the matrix of nutation for a given date, IAU 2000A model.
8653
8654        Given:
8655           date1,date2  double          TT as a 2-part Julian Date (Note 1)
8656
8657        Returned:
8658           rmatn        double[3][3]    nutation matrix
8659
8660        Notes:
8661
8662        1) The TT date date1+date2 is a Julian Date, apportioned in any
8663           convenient way between the two arguments.  For example,
8664           JD(TT)=2450123.7 could be expressed in any of these ways,
8665           among others:
8666
8667                  date1          date2
8668
8669               2450123.7           0.0       (JD method)
8670               2451545.0       -1421.3       (J2000 method)
8671               2400000.5       50123.2       (MJD method)
8672               2450123.5           0.2       (date & time method)
8673
8674           The JD method is the most natural and convenient to use in
8675           cases where the loss of several decimal digits of resolution
8676           is acceptable.  The J2000 method is best matched to the way
8677           the argument is handled internally and will deliver the
8678           optimum resolution.  The MJD method and the date & time methods
8679           are both good compromises between resolution and convenience.
8680
8681        2) The matrix operates in the sense V(true) = rmatn * V(mean), where
8682           the p-vector V(true) is with respect to the true equatorial triad
8683           of date and the p-vector V(mean) is with respect to the mean
8684           equatorial triad of date.
8685
8686        3) A faster, but slightly less accurate, result (about 1 mas) can be
8687           obtained by using instead the eraNum00b function.
8688
8689        Called:
8690           eraPn00a     bias/precession/nutation, IAU 2000A
8691
8692        Reference:
8693
8694           Explanatory Supplement to the Astronomical Almanac,
8695           P. Kenneth Seidelmann (ed), University Science Books (1992),
8696           Section 3.222-3 (p114).
8697
8698        This revision:  2021 May 11
8699
8700        Copyright (C) 2013-2021, NumFOCUS Foundation.
8701        Derived, with permission, from the SOFA library.  See notes at end of file.
8702
8703    """
8704    rmatn = ufunc.num00a(date1, date2)
8705    return rmatn
8706
8707
8708def num00b(date1, date2):
8709    """
8710    Form the matrix of nutation for a given date, IAU 2000B model.
8711
8712    Parameters
8713    ----------
8714    date1 : double array
8715    date2 : double array
8716
8717    Returns
8718    -------
8719    rmatn : double array
8720
8721    Notes
8722    -----
8723    Wraps ERFA function ``eraNum00b``. The ERFA documentation is::
8724
8725        - - - - - - - - - -
8726         e r a N u m 0 0 b
8727        - - - - - - - - - -
8728
8729        Form the matrix of nutation for a given date, IAU 2000B model.
8730
8731        Given:
8732           date1,date2  double         TT as a 2-part Julian Date (Note 1)
8733
8734        Returned:
8735           rmatn        double[3][3]   nutation matrix
8736
8737        Notes:
8738
8739        1) The TT date date1+date2 is a Julian Date, apportioned in any
8740           convenient way between the two arguments.  For example,
8741           JD(TT)=2450123.7 could be expressed in any of these ways,
8742           among others:
8743
8744                  date1          date2
8745
8746               2450123.7           0.0       (JD method)
8747               2451545.0       -1421.3       (J2000 method)
8748               2400000.5       50123.2       (MJD method)
8749               2450123.5           0.2       (date & time method)
8750
8751           The JD method is the most natural and convenient to use in
8752           cases where the loss of several decimal digits of resolution
8753           is acceptable.  The J2000 method is best matched to the way
8754           the argument is handled internally and will deliver the
8755           optimum resolution.  The MJD method and the date & time methods
8756           are both good compromises between resolution and convenience.
8757
8758        2) The matrix operates in the sense V(true) = rmatn * V(mean), where
8759           the p-vector V(true) is with respect to the true equatorial triad
8760           of date and the p-vector V(mean) is with respect to the mean
8761           equatorial triad of date.
8762
8763        3) The present function is faster, but slightly less accurate (about
8764           1 mas), than the eraNum00a function.
8765
8766        Called:
8767           eraPn00b     bias/precession/nutation, IAU 2000B
8768
8769        Reference:
8770
8771           Explanatory Supplement to the Astronomical Almanac,
8772           P. Kenneth Seidelmann (ed), University Science Books (1992),
8773           Section 3.222-3 (p114).
8774
8775        This revision:  2021 May 11
8776
8777        Copyright (C) 2013-2021, NumFOCUS Foundation.
8778        Derived, with permission, from the SOFA library.  See notes at end of file.
8779
8780    """
8781    rmatn = ufunc.num00b(date1, date2)
8782    return rmatn
8783
8784
8785def num06a(date1, date2):
8786    """
8787    Form the matrix of nutation for a given date, IAU 2006/2000A model.
8788
8789    Parameters
8790    ----------
8791    date1 : double array
8792    date2 : double array
8793
8794    Returns
8795    -------
8796    rmatn : double array
8797
8798    Notes
8799    -----
8800    Wraps ERFA function ``eraNum06a``. The ERFA documentation is::
8801
8802        - - - - - - - - - -
8803         e r a N u m 0 6 a
8804        - - - - - - - - - -
8805
8806        Form the matrix of nutation for a given date, IAU 2006/2000A model.
8807
8808        Given:
8809           date1,date2   double          TT as a 2-part Julian Date (Note 1)
8810
8811        Returned:
8812           rmatn         double[3][3]    nutation matrix
8813
8814        Notes:
8815
8816        1) The TT date date1+date2 is a Julian Date, apportioned in any
8817           convenient way between the two arguments.  For example,
8818           JD(TT)=2450123.7 could be expressed in any of these ways,
8819           among others:
8820
8821                  date1          date2
8822
8823               2450123.7           0.0       (JD method)
8824               2451545.0       -1421.3       (J2000 method)
8825               2400000.5       50123.2       (MJD method)
8826               2450123.5           0.2       (date & time method)
8827
8828           The JD method is the most natural and convenient to use in
8829           cases where the loss of several decimal digits of resolution
8830           is acceptable.  The J2000 method is best matched to the way
8831           the argument is handled internally and will deliver the
8832           optimum resolution.  The MJD method and the date & time methods
8833           are both good compromises between resolution and convenience.
8834
8835        2) The matrix operates in the sense V(true) = rmatn * V(mean), where
8836           the p-vector V(true) is with respect to the true equatorial triad
8837           of date and the p-vector V(mean) is with respect to the mean
8838           equatorial triad of date.
8839
8840        Called:
8841           eraObl06     mean obliquity, IAU 2006
8842           eraNut06a    nutation, IAU 2006/2000A
8843           eraNumat     form nutation matrix
8844
8845        Reference:
8846
8847           Explanatory Supplement to the Astronomical Almanac,
8848           P. Kenneth Seidelmann (ed), University Science Books (1992),
8849           Section 3.222-3 (p114).
8850
8851        This revision:  2021 May 11
8852
8853        Copyright (C) 2013-2021, NumFOCUS Foundation.
8854        Derived, with permission, from the SOFA library.  See notes at end of file.
8855
8856    """
8857    rmatn = ufunc.num06a(date1, date2)
8858    return rmatn
8859
8860
8861def numat(epsa, dpsi, deps):
8862    """
8863    Form the matrix of nutation.
8864
8865    Parameters
8866    ----------
8867    epsa : double array
8868    dpsi : double array
8869    deps : double array
8870
8871    Returns
8872    -------
8873    rmatn : double array
8874
8875    Notes
8876    -----
8877    Wraps ERFA function ``eraNumat``. The ERFA documentation is::
8878
8879        - - - - - - - - -
8880         e r a N u m a t
8881        - - - - - - - - -
8882
8883        Form the matrix of nutation.
8884
8885        Given:
8886           epsa        double         mean obliquity of date (Note 1)
8887           dpsi,deps   double         nutation (Note 2)
8888
8889        Returned:
8890           rmatn       double[3][3]   nutation matrix (Note 3)
8891
8892        Notes:
8893
8894
8895        1) The supplied mean obliquity epsa, must be consistent with the
8896           precession-nutation models from which dpsi and deps were obtained.
8897
8898        2) The caller is responsible for providing the nutation components;
8899           they are in longitude and obliquity, in radians and are with
8900           respect to the equinox and ecliptic of date.
8901
8902        3) The matrix operates in the sense V(true) = rmatn * V(mean),
8903           where the p-vector V(true) is with respect to the true
8904           equatorial triad of date and the p-vector V(mean) is with
8905           respect to the mean equatorial triad of date.
8906
8907        Called:
8908           eraIr        initialize r-matrix to identity
8909           eraRx        rotate around X-axis
8910           eraRz        rotate around Z-axis
8911
8912        Reference:
8913
8914           Explanatory Supplement to the Astronomical Almanac,
8915           P. Kenneth Seidelmann (ed), University Science Books (1992),
8916           Section 3.222-3 (p114).
8917
8918        This revision:  2021 May 11
8919
8920        Copyright (C) 2013-2021, NumFOCUS Foundation.
8921        Derived, with permission, from the SOFA library.  See notes at end of file.
8922
8923    """
8924    rmatn = ufunc.numat(epsa, dpsi, deps)
8925    return rmatn
8926
8927
8928def nut00a(date1, date2):
8929    """
8930    Nutation, IAU 2000A model (MHB2000 luni-solar and planetary nutation
8931    with free core nutation omitted).
8932
8933    Parameters
8934    ----------
8935    date1 : double array
8936    date2 : double array
8937
8938    Returns
8939    -------
8940    dpsi : double array
8941    deps : double array
8942
8943    Notes
8944    -----
8945    Wraps ERFA function ``eraNut00a``. The ERFA documentation is::
8946
8947        - - - - - - - - - -
8948         e r a N u t 0 0 a
8949        - - - - - - - - - -
8950
8951        Nutation, IAU 2000A model (MHB2000 luni-solar and planetary nutation
8952        with free core nutation omitted).
8953
8954        Given:
8955           date1,date2   double   TT as a 2-part Julian Date (Note 1)
8956
8957        Returned:
8958           dpsi,deps     double   nutation, luni-solar + planetary (Note 2)
8959
8960        Notes:
8961
8962        1) The TT date date1+date2 is a Julian Date, apportioned in any
8963           convenient way between the two arguments.  For example,
8964           JD(TT)=2450123.7 could be expressed in any of these ways,
8965           among others:
8966
8967                  date1          date2
8968
8969               2450123.7           0.0       (JD method)
8970               2451545.0       -1421.3       (J2000 method)
8971               2400000.5       50123.2       (MJD method)
8972               2450123.5           0.2       (date & time method)
8973
8974           The JD method is the most natural and convenient to use in
8975           cases where the loss of several decimal digits of resolution
8976           is acceptable.  The J2000 method is best matched to the way
8977           the argument is handled internally and will deliver the
8978           optimum resolution.  The MJD method and the date & time methods
8979           are both good compromises between resolution and convenience.
8980
8981        2) The nutation components in longitude and obliquity are in radians
8982           and with respect to the equinox and ecliptic of date.  The
8983           obliquity at J2000.0 is assumed to be the Lieske et al. (1977)
8984           value of 84381.448 arcsec.
8985
8986           Both the luni-solar and planetary nutations are included.  The
8987           latter are due to direct planetary nutations and the
8988           perturbations of the lunar and terrestrial orbits.
8989
8990        3) The function computes the MHB2000 nutation series with the
8991           associated corrections for planetary nutations.  It is an
8992           implementation of the nutation part of the IAU 2000A precession-
8993           nutation model, formally adopted by the IAU General Assembly in
8994           2000, namely MHB2000 (Mathews et al. 2002), but with the free
8995           core nutation (FCN - see Note 4) omitted.
8996
8997        4) The full MHB2000 model also contains contributions to the
8998           nutations in longitude and obliquity due to the free-excitation
8999           of the free-core-nutation during the period 1979-2000.  These FCN
9000           terms, which are time-dependent and unpredictable, are NOT
9001           included in the present function and, if required, must be
9002           independently computed.  With the FCN corrections included, the
9003           present function delivers a pole which is at current epochs
9004           accurate to a few hundred microarcseconds.  The omission of FCN
9005           introduces further errors of about that size.
9006
9007        5) The present function provides classical nutation.  The MHB2000
9008           algorithm, from which it is adapted, deals also with (i) the
9009           offsets between the GCRS and mean poles and (ii) the adjustments
9010           in longitude and obliquity due to the changed precession rates.
9011           These additional functions, namely frame bias and precession
9012           adjustments, are supported by the ERFA functions eraBi00  and
9013           eraPr00.
9014
9015        6) The MHB2000 algorithm also provides "total" nutations, comprising
9016           the arithmetic sum of the frame bias, precession adjustments,
9017           luni-solar nutation and planetary nutation.  These total
9018           nutations can be used in combination with an existing IAU 1976
9019           precession implementation, such as eraPmat76,  to deliver GCRS-
9020           to-true predictions of sub-mas accuracy at current dates.
9021           However, there are three shortcomings in the MHB2000 model that
9022           must be taken into account if more accurate or definitive results
9023           are required (see Wallace 2002):
9024
9025             (i) The MHB2000 total nutations are simply arithmetic sums,
9026                 yet in reality the various components are successive Euler
9027                 rotations.  This slight lack of rigor leads to cross terms
9028                 that exceed 1 mas after a century.  The rigorous procedure
9029                 is to form the GCRS-to-true rotation matrix by applying the
9030                 bias, precession and nutation in that order.
9031
9032            (ii) Although the precession adjustments are stated to be with
9033                 respect to Lieske et al. (1977), the MHB2000 model does
9034                 not specify which set of Euler angles are to be used and
9035                 how the adjustments are to be applied.  The most literal
9036                 and straightforward procedure is to adopt the 4-rotation
9037                 epsilon_0, psi_A, omega_A, xi_A option, and to add DPSIPR
9038                 to psi_A and DEPSPR to both omega_A and eps_A.
9039
9040           (iii) The MHB2000 model predates the determination by Chapront
9041                 et al. (2002) of a 14.6 mas displacement between the
9042                 J2000.0 mean equinox and the origin of the ICRS frame.  It
9043                 should, however, be noted that neglecting this displacement
9044                 when calculating star coordinates does not lead to a
9045                 14.6 mas change in right ascension, only a small second-
9046                 order distortion in the pattern of the precession-nutation
9047                 effect.
9048
9049           For these reasons, the ERFA functions do not generate the "total
9050           nutations" directly, though they can of course easily be
9051           generated by calling eraBi00, eraPr00 and the present function
9052           and adding the results.
9053
9054        7) The MHB2000 model contains 41 instances where the same frequency
9055           appears multiple times, of which 38 are duplicates and three are
9056           triplicates.  To keep the present code close to the original MHB
9057           algorithm, this small inefficiency has not been corrected.
9058
9059        Called:
9060           eraFal03     mean anomaly of the Moon
9061           eraFaf03     mean argument of the latitude of the Moon
9062           eraFaom03    mean longitude of the Moon's ascending node
9063           eraFame03    mean longitude of Mercury
9064           eraFave03    mean longitude of Venus
9065           eraFae03     mean longitude of Earth
9066           eraFama03    mean longitude of Mars
9067           eraFaju03    mean longitude of Jupiter
9068           eraFasa03    mean longitude of Saturn
9069           eraFaur03    mean longitude of Uranus
9070           eraFapa03    general accumulated precession in longitude
9071
9072        References:
9073
9074           Chapront, J., Chapront-Touze, M. & Francou, G. 2002,
9075           Astron.Astrophys. 387, 700
9076
9077           Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977,
9078           Astron.Astrophys. 58, 1-16
9079
9080           Mathews, P.M., Herring, T.A., Buffet, B.A. 2002, J.Geophys.Res.
9081           107, B4.  The MHB_2000 code itself was obtained on 9th September
9082           2002 from ftp//maia.usno.navy.mil/conv2000/chapter5/IAU2000A.
9083
9084           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
9085           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
9086
9087           Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
9088           Astron.Astrophys.Supp.Ser. 135, 111
9089
9090           Wallace, P.T., "Software for Implementing the IAU 2000
9091           Resolutions", in IERS Workshop 5.1 (2002)
9092
9093        This revision:  2021 May 11
9094
9095        Copyright (C) 2013-2021, NumFOCUS Foundation.
9096        Derived, with permission, from the SOFA library.  See notes at end of file.
9097
9098    """
9099    dpsi, deps = ufunc.nut00a(date1, date2)
9100    return dpsi, deps
9101
9102
9103def nut00b(date1, date2):
9104    """
9105    Nutation, IAU 2000B model.
9106
9107    Parameters
9108    ----------
9109    date1 : double array
9110    date2 : double array
9111
9112    Returns
9113    -------
9114    dpsi : double array
9115    deps : double array
9116
9117    Notes
9118    -----
9119    Wraps ERFA function ``eraNut00b``. The ERFA documentation is::
9120
9121        - - - - - - - - - -
9122         e r a N u t 0 0 b
9123        - - - - - - - - - -
9124
9125        Nutation, IAU 2000B model.
9126
9127        Given:
9128           date1,date2   double    TT as a 2-part Julian Date (Note 1)
9129
9130        Returned:
9131           dpsi,deps     double    nutation, luni-solar + planetary (Note 2)
9132
9133        Notes:
9134
9135        1) The TT date date1+date2 is a Julian Date, apportioned in any
9136           convenient way between the two arguments.  For example,
9137           JD(TT)=2450123.7 could be expressed in any of these ways,
9138           among others:
9139
9140                  date1          date2
9141
9142               2450123.7           0.0       (JD method)
9143               2451545.0       -1421.3       (J2000 method)
9144               2400000.5       50123.2       (MJD method)
9145               2450123.5           0.2       (date & time method)
9146
9147           The JD method is the most natural and convenient to use in
9148           cases where the loss of several decimal digits of resolution
9149           is acceptable.  The J2000 method is best matched to the way
9150           the argument is handled internally and will deliver the
9151           optimum resolution.  The MJD method and the date & time methods
9152           are both good compromises between resolution and convenience.
9153
9154        2) The nutation components in longitude and obliquity are in radians
9155           and with respect to the equinox and ecliptic of date.  The
9156           obliquity at J2000.0 is assumed to be the Lieske et al. (1977)
9157           value of 84381.448 arcsec.  (The errors that result from using
9158           this function with the IAU 2006 value of 84381.406 arcsec can be
9159           neglected.)
9160
9161           The nutation model consists only of luni-solar terms, but
9162           includes also a fixed offset which compensates for certain long-
9163           period planetary terms (Note 7).
9164
9165        3) This function is an implementation of the IAU 2000B abridged
9166           nutation model formally adopted by the IAU General Assembly in
9167           2000.  The function computes the MHB_2000_SHORT luni-solar
9168           nutation series (Luzum 2001), but without the associated
9169           corrections for the precession rate adjustments and the offset
9170           between the GCRS and J2000.0 mean poles.
9171
9172        4) The full IAU 2000A (MHB2000) nutation model contains nearly 1400
9173           terms.  The IAU 2000B model (McCarthy & Luzum 2003) contains only
9174           77 terms, plus additional simplifications, yet still delivers
9175           results of 1 mas accuracy at present epochs.  This combination of
9176           accuracy and size makes the IAU 2000B abridged nutation model
9177           suitable for most practical applications.
9178
9179           The function delivers a pole accurate to 1 mas from 1900 to 2100
9180           (usually better than 1 mas, very occasionally just outside
9181           1 mas).  The full IAU 2000A model, which is implemented in the
9182           function eraNut00a (q.v.), delivers considerably greater accuracy
9183           at current dates;  however, to realize this improved accuracy,
9184           corrections for the essentially unpredictable free-core-nutation
9185           (FCN) must also be included.
9186
9187        5) The present function provides classical nutation.  The
9188           MHB_2000_SHORT algorithm, from which it is adapted, deals also
9189           with (i) the offsets between the GCRS and mean poles and (ii) the
9190           adjustments in longitude and obliquity due to the changed
9191           precession rates.  These additional functions, namely frame bias
9192           and precession adjustments, are supported by the ERFA functions
9193           eraBi00  and eraPr00.
9194
9195        6) The MHB_2000_SHORT algorithm also provides "total" nutations,
9196           comprising the arithmetic sum of the frame bias, precession
9197           adjustments, and nutation (luni-solar + planetary).  These total
9198           nutations can be used in combination with an existing IAU 1976
9199           precession implementation, such as eraPmat76,  to deliver GCRS-
9200           to-true predictions of mas accuracy at current epochs.  However,
9201           for symmetry with the eraNut00a  function (q.v. for the reasons),
9202           the ERFA functions do not generate the "total nutations"
9203           directly.  Should they be required, they could of course easily
9204           be generated by calling eraBi00, eraPr00 and the present function
9205           and adding the results.
9206
9207        7) The IAU 2000B model includes "planetary bias" terms that are
9208           fixed in size but compensate for long-period nutations.  The
9209           amplitudes quoted in McCarthy & Luzum (2003), namely
9210           Dpsi = -1.5835 mas and Depsilon = +1.6339 mas, are optimized for
9211           the "total nutations" method described in Note 6.  The Luzum
9212           (2001) values used in this ERFA implementation, namely -0.135 mas
9213           and +0.388 mas, are optimized for the "rigorous" method, where
9214           frame bias, precession and nutation are applied separately and in
9215           that order.  During the interval 1995-2050, the ERFA
9216           implementation delivers a maximum error of 1.001 mas (not
9217           including FCN).
9218
9219        References:
9220
9221           Lieske, J.H., Lederle, T., Fricke, W., Morando, B., "Expressions
9222           for the precession quantities based upon the IAU /1976/ system of
9223           astronomical constants", Astron.Astrophys. 58, 1-2, 1-16. (1977)
9224
9225           Luzum, B., private communication, 2001 (Fortran code
9226           MHB_2000_SHORT)
9227
9228           McCarthy, D.D. & Luzum, B.J., "An abridged model of the
9229           precession-nutation of the celestial pole", Cel.Mech.Dyn.Astron.
9230           85, 37-49 (2003)
9231
9232           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
9233           Francou, G., Laskar, J., Astron.Astrophys. 282, 663-683 (1994)
9234
9235        This revision:  2021 May 11
9236
9237        Copyright (C) 2013-2021, NumFOCUS Foundation.
9238        Derived, with permission, from the SOFA library.  See notes at end of file.
9239
9240    """
9241    dpsi, deps = ufunc.nut00b(date1, date2)
9242    return dpsi, deps
9243
9244
9245def nut06a(date1, date2):
9246    """
9247    IAU 2000A nutation with adjustments to match the IAU 2006
9248    precession.
9249
9250    Parameters
9251    ----------
9252    date1 : double array
9253    date2 : double array
9254
9255    Returns
9256    -------
9257    dpsi : double array
9258    deps : double array
9259
9260    Notes
9261    -----
9262    Wraps ERFA function ``eraNut06a``. The ERFA documentation is::
9263
9264        - - - - - - - - - -
9265         e r a N u t 0 6 a
9266        - - - - - - - - - -
9267
9268        IAU 2000A nutation with adjustments to match the IAU 2006
9269        precession.
9270
9271        Given:
9272           date1,date2   double   TT as a 2-part Julian Date (Note 1)
9273
9274        Returned:
9275           dpsi,deps     double   nutation, luni-solar + planetary (Note 2)
9276
9277        Notes:
9278
9279        1) The TT date date1+date2 is a Julian Date, apportioned in any
9280           convenient way between the two arguments.  For example,
9281           JD(TT)=2450123.7 could be expressed in any of these ways,
9282           among others:
9283
9284                  date1          date2
9285
9286               2450123.7           0.0       (JD method)
9287               2451545.0       -1421.3       (J2000 method)
9288               2400000.5       50123.2       (MJD method)
9289               2450123.5           0.2       (date & time method)
9290
9291           The JD method is the most natural and convenient to use in
9292           cases where the loss of several decimal digits of resolution
9293           is acceptable.  The J2000 method is best matched to the way
9294           the argument is handled internally and will deliver the
9295           optimum resolution.  The MJD method and the date & time methods
9296           are both good compromises between resolution and convenience.
9297
9298        2) The nutation components in longitude and obliquity are in radians
9299           and with respect to the mean equinox and ecliptic of date,
9300           IAU 2006 precession model (Hilton et al. 2006, Capitaine et al.
9301           2005).
9302
9303        3) The function first computes the IAU 2000A nutation, then applies
9304           adjustments for (i) the consequences of the change in obliquity
9305           from the IAU 1980 ecliptic to the IAU 2006 ecliptic and (ii) the
9306           secular variation in the Earth's dynamical form factor J2.
9307
9308        4) The present function provides classical nutation, complementing
9309           the IAU 2000 frame bias and IAU 2006 precession.  It delivers a
9310           pole which is at current epochs accurate to a few tens of
9311           microarcseconds, apart from the free core nutation.
9312
9313        Called:
9314           eraNut00a    nutation, IAU 2000A
9315
9316        References:
9317
9318           Chapront, J., Chapront-Touze, M. & Francou, G. 2002,
9319           Astron.Astrophys. 387, 700
9320
9321           Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977,
9322           Astron.Astrophys. 58, 1-16
9323
9324           Mathews, P.M., Herring, T.A., Buffet, B.A. 2002, J.Geophys.Res.
9325           107, B4.  The MHB_2000 code itself was obtained on 9th September
9326           2002 from ftp//maia.usno.navy.mil/conv2000/chapter5/IAU2000A.
9327
9328           Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
9329           Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683
9330
9331           Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999,
9332           Astron.Astrophys.Supp.Ser. 135, 111
9333
9334           Wallace, P.T., "Software for Implementing the IAU 2000
9335           Resolutions", in IERS Workshop 5.1 (2002)
9336
9337        This revision:  2021 May 11
9338
9339        Copyright (C) 2013-2021, NumFOCUS Foundation.
9340        Derived, with permission, from the SOFA library.  See notes at end of file.
9341
9342    """
9343    dpsi, deps = ufunc.nut06a(date1, date2)
9344    return dpsi, deps
9345
9346
9347def nut80(date1, date2):
9348    """
9349    Nutation, IAU 1980 model.
9350
9351    Parameters
9352    ----------
9353    date1 : double array
9354    date2 : double array
9355
9356    Returns
9357    -------
9358    dpsi : double array
9359    deps : double array
9360
9361    Notes
9362    -----
9363    Wraps ERFA function ``eraNut80``. The ERFA documentation is::
9364
9365        - - - - - - - - -
9366         e r a N u t 8 0
9367        - - - - - - - - -
9368
9369        Nutation, IAU 1980 model.
9370
9371        Given:
9372           date1,date2   double    TT as a 2-part Julian Date (Note 1)
9373
9374        Returned:
9375           dpsi          double    nutation in longitude (radians)
9376           deps          double    nutation in obliquity (radians)
9377
9378        Notes:
9379
9380        1) The TT date date1+date2 is a Julian Date, apportioned in any
9381           convenient way between the two arguments.  For example,
9382           JD(TT)=2450123.7 could be expressed in any of these ways,
9383           among others:
9384
9385                  date1          date2
9386
9387               2450123.7           0.0       (JD method)
9388               2451545.0       -1421.3       (J2000 method)
9389               2400000.5       50123.2       (MJD method)
9390               2450123.5           0.2       (date & time method)
9391
9392           The JD method is the most natural and convenient to use in
9393           cases where the loss of several decimal digits of resolution
9394           is acceptable.  The J2000 method is best matched to the way
9395           the argument is handled internally and will deliver the
9396           optimum resolution.  The MJD method and the date & time methods
9397           are both good compromises between resolution and convenience.
9398
9399        2) The nutation components are with respect to the ecliptic of
9400           date.
9401
9402        Called:
9403           eraAnpm      normalize angle into range +/- pi
9404
9405        Reference:
9406
9407           Explanatory Supplement to the Astronomical Almanac,
9408           P. Kenneth Seidelmann (ed), University Science Books (1992),
9409           Section 3.222 (p111).
9410
9411        This revision:  2021 May 11
9412
9413        Copyright (C) 2013-2021, NumFOCUS Foundation.
9414        Derived, with permission, from the SOFA library.  See notes at end of file.
9415
9416    """
9417    dpsi, deps = ufunc.nut80(date1, date2)
9418    return dpsi, deps
9419
9420
9421def nutm80(date1, date2):
9422    """
9423    Form the matrix of nutation for a given date, IAU 1980 model.
9424
9425    Parameters
9426    ----------
9427    date1 : double array
9428    date2 : double array
9429
9430    Returns
9431    -------
9432    rmatn : double array
9433
9434    Notes
9435    -----
9436    Wraps ERFA function ``eraNutm80``. The ERFA documentation is::
9437
9438        - - - - - - - - - -
9439         e r a N u t m 8 0
9440        - - - - - - - - - -
9441
9442        Form the matrix of nutation for a given date, IAU 1980 model.
9443
9444        Given:
9445           date1,date2    double          TDB date (Note 1)
9446
9447        Returned:
9448           rmatn          double[3][3]    nutation matrix
9449
9450        Notes:
9451
9452        1) The TT date date1+date2 is a Julian Date, apportioned in any
9453           convenient way between the two arguments.  For example,
9454           JD(TT)=2450123.7 could be expressed in any of these ways,
9455           among others:
9456
9457                  date1          date2
9458
9459               2450123.7           0.0       (JD method)
9460               2451545.0       -1421.3       (J2000 method)
9461               2400000.5       50123.2       (MJD method)
9462               2450123.5           0.2       (date & time method)
9463
9464           The JD method is the most natural and convenient to use in
9465           cases where the loss of several decimal digits of resolution
9466           is acceptable.  The J2000 method is best matched to the way
9467           the argument is handled internally and will deliver the
9468           optimum resolution.  The MJD method and the date & time methods
9469           are both good compromises between resolution and convenience.
9470
9471        2) The matrix operates in the sense V(true) = rmatn * V(mean),
9472           where the p-vector V(true) is with respect to the true
9473           equatorial triad of date and the p-vector V(mean) is with
9474           respect to the mean equatorial triad of date.
9475
9476        Called:
9477           eraNut80     nutation, IAU 1980
9478           eraObl80     mean obliquity, IAU 1980
9479           eraNumat     form nutation matrix
9480
9481        This revision:  2021 May 11
9482
9483        Copyright (C) 2013-2021, NumFOCUS Foundation.
9484        Derived, with permission, from the SOFA library.  See notes at end of file.
9485
9486    """
9487    rmatn = ufunc.nutm80(date1, date2)
9488    return rmatn
9489
9490
9491def obl06(date1, date2):
9492    """
9493    Mean obliquity of the ecliptic, IAU 2006 precession model.
9494
9495    Parameters
9496    ----------
9497    date1 : double array
9498    date2 : double array
9499
9500    Returns
9501    -------
9502    c_retval : double array
9503
9504    Notes
9505    -----
9506    Wraps ERFA function ``eraObl06``. The ERFA documentation is::
9507
9508        - - - - - - - - -
9509         e r a O b l 0 6
9510        - - - - - - - - -
9511
9512        Mean obliquity of the ecliptic, IAU 2006 precession model.
9513
9514        Given:
9515           date1,date2  double   TT as a 2-part Julian Date (Note 1)
9516
9517        Returned (function value):
9518                        double   obliquity of the ecliptic (radians, Note 2)
9519
9520        Notes:
9521
9522        1) The TT date date1+date2 is a Julian Date, apportioned in any
9523           convenient way between the two arguments.  For example,
9524           JD(TT)=2450123.7 could be expressed in any of these ways,
9525           among others:
9526
9527                  date1          date2
9528
9529               2450123.7           0.0       (JD method)
9530               2451545.0       -1421.3       (J2000 method)
9531               2400000.5       50123.2       (MJD method)
9532               2450123.5           0.2       (date & time method)
9533
9534           The JD method is the most natural and convenient to use in
9535           cases where the loss of several decimal digits of resolution
9536           is acceptable.  The J2000 method is best matched to the way
9537           the argument is handled internally and will deliver the
9538           optimum resolution.  The MJD method and the date & time methods
9539           are both good compromises between resolution and convenience.
9540
9541        2) The result is the angle between the ecliptic and mean equator of
9542           date date1+date2.
9543
9544        Reference:
9545
9546           Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
9547
9548        This revision:  2021 May 11
9549
9550        Copyright (C) 2013-2021, NumFOCUS Foundation.
9551        Derived, with permission, from the SOFA library.  See notes at end of file.
9552
9553    """
9554    c_retval = ufunc.obl06(date1, date2)
9555    return c_retval
9556
9557
9558def obl80(date1, date2):
9559    """
9560    Mean obliquity of the ecliptic, IAU 1980 model.
9561
9562    Parameters
9563    ----------
9564    date1 : double array
9565    date2 : double array
9566
9567    Returns
9568    -------
9569    c_retval : double array
9570
9571    Notes
9572    -----
9573    Wraps ERFA function ``eraObl80``. The ERFA documentation is::
9574
9575        - - - - - - - - -
9576         e r a O b l 8 0
9577        - - - - - - - - -
9578
9579        Mean obliquity of the ecliptic, IAU 1980 model.
9580
9581        Given:
9582           date1,date2   double    TT as a 2-part Julian Date (Note 1)
9583
9584        Returned (function value):
9585                         double    obliquity of the ecliptic (radians, Note 2)
9586
9587        Notes:
9588
9589        1) The TT date date1+date2 is a Julian Date, apportioned in any
9590           convenient way between the two arguments.  For example,
9591           JD(TT)=2450123.7 could be expressed in any of these ways,
9592           among others:
9593
9594                  date1          date2
9595
9596               2450123.7           0.0       (JD method)
9597               2451545.0       -1421.3       (J2000 method)
9598               2400000.5       50123.2       (MJD method)
9599               2450123.5           0.2       (date & time method)
9600
9601           The JD method is the most natural and convenient to use in
9602           cases where the loss of several decimal digits of resolution
9603           is acceptable.  The J2000 method is best matched to the way
9604           the argument is handled internally and will deliver the
9605           optimum resolution.  The MJD method and the date & time methods
9606           are both good compromises between resolution and convenience.
9607
9608        2) The result is the angle between the ecliptic and mean equator of
9609           date date1+date2.
9610
9611        Reference:
9612
9613           Explanatory Supplement to the Astronomical Almanac,
9614           P. Kenneth Seidelmann (ed), University Science Books (1992),
9615           Expression 3.222-1 (p114).
9616
9617        This revision:  2021 May 11
9618
9619        Copyright (C) 2013-2021, NumFOCUS Foundation.
9620        Derived, with permission, from the SOFA library.  See notes at end of file.
9621
9622    """
9623    c_retval = ufunc.obl80(date1, date2)
9624    return c_retval
9625
9626
9627def p06e(date1, date2):
9628    """
9629    Precession angles, IAU 2006, equinox based.
9630
9631    Parameters
9632    ----------
9633    date1 : double array
9634    date2 : double array
9635
9636    Returns
9637    -------
9638    eps0 : double array
9639    psia : double array
9640    oma : double array
9641    bpa : double array
9642    bqa : double array
9643    pia : double array
9644    bpia : double array
9645    epsa : double array
9646    chia : double array
9647    za : double array
9648    zetaa : double array
9649    thetaa : double array
9650    pa : double array
9651    gam : double array
9652    phi : double array
9653    psi : double array
9654
9655    Notes
9656    -----
9657    Wraps ERFA function ``eraP06e``. The ERFA documentation is::
9658
9659        - - - - - - - -
9660         e r a P 0 6 e
9661        - - - - - - - -
9662
9663        Precession angles, IAU 2006, equinox based.
9664
9665        Given:
9666           date1,date2   double   TT as a 2-part Julian Date (Note 1)
9667
9668        Returned (see Note 2):
9669           eps0          double   epsilon_0
9670           psia          double   psi_A
9671           oma           double   omega_A
9672           bpa           double   P_A
9673           bqa           double   Q_A
9674           pia           double   pi_A
9675           bpia          double   Pi_A
9676           epsa          double   obliquity epsilon_A
9677           chia          double   chi_A
9678           za            double   z_A
9679           zetaa         double   zeta_A
9680           thetaa        double   theta_A
9681           pa            double   p_A
9682           gam           double   F-W angle gamma_J2000
9683           phi           double   F-W angle phi_J2000
9684           psi           double   F-W angle psi_J2000
9685
9686        Notes:
9687
9688        1) The TT date date1+date2 is a Julian Date, apportioned in any
9689           convenient way between the two arguments.  For example,
9690           JD(TT)=2450123.7 could be expressed in any of these ways,
9691           among others:
9692
9693                  date1          date2
9694
9695               2450123.7           0.0       (JD method)
9696               2451545.0       -1421.3       (J2000 method)
9697               2400000.5       50123.2       (MJD method)
9698               2450123.5           0.2       (date & time method)
9699
9700           The JD method is the most natural and convenient to use in
9701           cases where the loss of several decimal digits of resolution
9702           is acceptable.  The J2000 method is best matched to the way
9703           the argument is handled internally and will deliver the
9704           optimum resolution.  The MJD method and the date & time methods
9705           are both good compromises between resolution and convenience.
9706
9707        2) This function returns the set of equinox based angles for the
9708           Capitaine et al. "P03" precession theory, adopted by the IAU in
9709           2006.  The angles are set out in Table 1 of Hilton et al. (2006):
9710
9711           eps0   epsilon_0   obliquity at J2000.0
9712           psia   psi_A       luni-solar precession
9713           oma    omega_A     inclination of equator wrt J2000.0 ecliptic
9714           bpa    P_A         ecliptic pole x, J2000.0 ecliptic triad
9715           bqa    Q_A         ecliptic pole -y, J2000.0 ecliptic triad
9716           pia    pi_A        angle between moving and J2000.0 ecliptics
9717           bpia   Pi_A        longitude of ascending node of the ecliptic
9718           epsa   epsilon_A   obliquity of the ecliptic
9719           chia   chi_A       planetary precession
9720           za     z_A         equatorial precession: -3rd 323 Euler angle
9721           zetaa  zeta_A      equatorial precession: -1st 323 Euler angle
9722           thetaa theta_A     equatorial precession: 2nd 323 Euler angle
9723           pa     p_A         general precession (n.b. see below)
9724           gam    gamma_J2000 J2000.0 RA difference of ecliptic poles
9725           phi    phi_J2000   J2000.0 codeclination of ecliptic pole
9726           psi    psi_J2000   longitude difference of equator poles, J2000.0
9727
9728           The returned values are all radians.
9729
9730           Note that the t^5 coefficient in the series for p_A from
9731           Capitaine et al. (2003) is incorrectly signed in Hilton et al.
9732           (2006).
9733
9734        3) Hilton et al. (2006) Table 1 also contains angles that depend on
9735           models distinct from the P03 precession theory itself, namely the
9736           IAU 2000A frame bias and nutation.  The quoted polynomials are
9737           used in other ERFA functions:
9738
9739           . eraXy06  contains the polynomial parts of the X and Y series.
9740
9741           . eraS06  contains the polynomial part of the s+XY/2 series.
9742
9743           . eraPfw06  implements the series for the Fukushima-Williams
9744             angles that are with respect to the GCRS pole (i.e. the variants
9745             that include frame bias).
9746
9747        4) The IAU resolution stipulated that the choice of parameterization
9748           was left to the user, and so an IAU compliant precession
9749           implementation can be constructed using various combinations of
9750           the angles returned by the present function.
9751
9752        5) The parameterization used by ERFA is the version of the Fukushima-
9753           Williams angles that refers directly to the GCRS pole.  These
9754           angles may be calculated by calling the function eraPfw06.  ERFA
9755           also supports the direct computation of the CIP GCRS X,Y by
9756           series, available by calling eraXy06.
9757
9758        6) The agreement between the different parameterizations is at the
9759           1 microarcsecond level in the present era.
9760
9761        7) When constructing a precession formulation that refers to the GCRS
9762           pole rather than the dynamical pole, it may (depending on the
9763           choice of angles) be necessary to introduce the frame bias
9764           explicitly.
9765
9766        8) It is permissible to re-use the same variable in the returned
9767           arguments.  The quantities are stored in the stated order.
9768
9769        References:
9770
9771           Capitaine, N., Wallace, P.T. & Chapront, J., 2003,
9772           Astron.Astrophys., 412, 567
9773
9774           Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
9775
9776        Called:
9777           eraObl06     mean obliquity, IAU 2006
9778
9779        This revision:  2021 May 11
9780
9781        Copyright (C) 2013-2021, NumFOCUS Foundation.
9782        Derived, with permission, from the SOFA library.  See notes at end of file.
9783
9784    """
9785    (eps0, psia, oma, bpa, bqa, pia, bpia, epsa, chia, za, zetaa, thetaa, pa,
9786     gam, phi, psi) = ufunc.p06e(date1, date2)
9787    return eps0, psia, oma, bpa, bqa, pia, bpia, epsa, chia, za, zetaa, thetaa, pa, gam, phi, psi
9788
9789
9790def pb06(date1, date2):
9791    """
9792    This function forms three Euler angles which implement general
9793    precession from epoch J2000.0, using the IAU 2006 model.
9794
9795    Parameters
9796    ----------
9797    date1 : double array
9798    date2 : double array
9799
9800    Returns
9801    -------
9802    bzeta : double array
9803    bz : double array
9804    btheta : double array
9805
9806    Notes
9807    -----
9808    Wraps ERFA function ``eraPb06``. The ERFA documentation is::
9809
9810        - - - - - - - -
9811         e r a P b 0 6
9812        - - - - - - - -
9813
9814        This function forms three Euler angles which implement general
9815        precession from epoch J2000.0, using the IAU 2006 model.  Frame
9816        bias (the offset between ICRS and mean J2000.0) is included.
9817
9818        Given:
9819           date1,date2  double   TT as a 2-part Julian Date (Note 1)
9820
9821        Returned:
9822           bzeta        double   1st rotation: radians cw around z
9823           bz           double   3rd rotation: radians cw around z
9824           btheta       double   2nd rotation: radians ccw around y
9825
9826        Notes:
9827
9828        1) The TT date date1+date2 is a Julian Date, apportioned in any
9829           convenient way between the two arguments.  For example,
9830           JD(TT)=2450123.7 could be expressed in any of these ways,
9831           among others:
9832
9833                  date1          date2
9834
9835               2450123.7           0.0       (JD method)
9836               2451545.0       -1421.3       (J2000 method)
9837               2400000.5       50123.2       (MJD method)
9838               2450123.5           0.2       (date & time method)
9839
9840           The JD method is the most natural and convenient to use in
9841           cases where the loss of several decimal digits of resolution
9842           is acceptable.  The J2000 method is best matched to the way
9843           the argument is handled internally and will deliver the
9844           optimum resolution.  The MJD method and the date & time methods
9845           are both good compromises between resolution and convenience.
9846
9847        2) The traditional accumulated precession angles zeta_A, z_A,
9848           theta_A cannot be obtained in the usual way, namely through
9849           polynomial expressions, because of the frame bias.  The latter
9850           means that two of the angles undergo rapid changes near this
9851           date.  They are instead the results of decomposing the
9852           precession-bias matrix obtained by using the Fukushima-Williams
9853           method, which does not suffer from the problem.  The
9854           decomposition returns values which can be used in the
9855           conventional formulation and which include frame bias.
9856
9857        3) The three angles are returned in the conventional order, which
9858           is not the same as the order of the corresponding Euler
9859           rotations.  The precession-bias matrix is
9860           R_3(-z) x R_2(+theta) x R_3(-zeta).
9861
9862        4) Should zeta_A, z_A, theta_A angles be required that do not
9863           contain frame bias, they are available by calling the ERFA
9864           function eraP06e.
9865
9866        Called:
9867           eraPmat06    PB matrix, IAU 2006
9868           eraRz        rotate around Z-axis
9869
9870        This revision:  2021 May 11
9871
9872        Copyright (C) 2013-2021, NumFOCUS Foundation.
9873        Derived, with permission, from the SOFA library.  See notes at end of file.
9874
9875    """
9876    bzeta, bz, btheta = ufunc.pb06(date1, date2)
9877    return bzeta, bz, btheta
9878
9879
9880def pfw06(date1, date2):
9881    """
9882    Precession angles, IAU 2006 (Fukushima-Williams 4-angle formulation).
9883
9884    Parameters
9885    ----------
9886    date1 : double array
9887    date2 : double array
9888
9889    Returns
9890    -------
9891    gamb : double array
9892    phib : double array
9893    psib : double array
9894    epsa : double array
9895
9896    Notes
9897    -----
9898    Wraps ERFA function ``eraPfw06``. The ERFA documentation is::
9899
9900        - - - - - - - - -
9901         e r a P f w 0 6
9902        - - - - - - - - -
9903
9904        Precession angles, IAU 2006 (Fukushima-Williams 4-angle formulation).
9905
9906        Given:
9907           date1,date2  double   TT as a 2-part Julian Date (Note 1)
9908
9909        Returned:
9910           gamb         double   F-W angle gamma_bar (radians)
9911           phib         double   F-W angle phi_bar (radians)
9912           psib         double   F-W angle psi_bar (radians)
9913           epsa         double   F-W angle epsilon_A (radians)
9914
9915        Notes:
9916
9917        1) The TT date date1+date2 is a Julian Date, apportioned in any
9918           convenient way between the two arguments.  For example,
9919           JD(TT)=2450123.7 could be expressed in any of these ways,
9920           among others:
9921
9922                  date1          date2
9923
9924               2450123.7           0.0       (JD method)
9925               2451545.0       -1421.3       (J2000 method)
9926               2400000.5       50123.2       (MJD method)
9927               2450123.5           0.2       (date & time method)
9928
9929           The JD method is the most natural and convenient to use in
9930           cases where the loss of several decimal digits of resolution
9931           is acceptable.  The J2000 method is best matched to the way
9932           the argument is handled internally and will deliver the
9933           optimum resolution.  The MJD method and the date & time methods
9934           are both good compromises between resolution and convenience.
9935
9936        2) Naming the following points:
9937
9938                 e = J2000.0 ecliptic pole,
9939                 p = GCRS pole,
9940                 E = mean ecliptic pole of date,
9941           and   P = mean pole of date,
9942
9943           the four Fukushima-Williams angles are as follows:
9944
9945              gamb = gamma_bar = epE
9946              phib = phi_bar = pE
9947              psib = psi_bar = pEP
9948              epsa = epsilon_A = EP
9949
9950        3) The matrix representing the combined effects of frame bias and
9951           precession is:
9952
9953              PxB = R_1(-epsa).R_3(-psib).R_1(phib).R_3(gamb)
9954
9955        4) The matrix representing the combined effects of frame bias,
9956           precession and nutation is simply:
9957
9958              NxPxB = R_1(-epsa-dE).R_3(-psib-dP).R_1(phib).R_3(gamb)
9959
9960           where dP and dE are the nutation components with respect to the
9961           ecliptic of date.
9962
9963        Reference:
9964
9965           Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
9966
9967        Called:
9968           eraObl06     mean obliquity, IAU 2006
9969
9970        This revision:  2021 May 11
9971
9972        Copyright (C) 2013-2021, NumFOCUS Foundation.
9973        Derived, with permission, from the SOFA library.  See notes at end of file.
9974
9975    """
9976    gamb, phib, psib, epsa = ufunc.pfw06(date1, date2)
9977    return gamb, phib, psib, epsa
9978
9979
9980def pmat00(date1, date2):
9981    """
9982    Precession matrix (including frame bias) from GCRS to a specified
9983    date, IAU 2000 model.
9984
9985    Parameters
9986    ----------
9987    date1 : double array
9988    date2 : double array
9989
9990    Returns
9991    -------
9992    rbp : double array
9993
9994    Notes
9995    -----
9996    Wraps ERFA function ``eraPmat00``. The ERFA documentation is::
9997
9998        - - - - - - - - - -
9999         e r a P m a t 0 0
10000        - - - - - - - - - -
10001
10002        Precession matrix (including frame bias) from GCRS to a specified
10003        date, IAU 2000 model.
10004
10005        Given:
10006           date1,date2  double          TT as a 2-part Julian Date (Note 1)
10007
10008        Returned:
10009           rbp          double[3][3]    bias-precession matrix (Note 2)
10010
10011        Notes:
10012
10013        1) The TT date date1+date2 is a Julian Date, apportioned in any
10014           convenient way between the two arguments.  For example,
10015           JD(TT)=2450123.7 could be expressed in any of these ways,
10016           among others:
10017
10018                  date1          date2
10019
10020               2450123.7           0.0       (JD method)
10021               2451545.0       -1421.3       (J2000 method)
10022               2400000.5       50123.2       (MJD method)
10023               2450123.5           0.2       (date & time method)
10024
10025           The JD method is the most natural and convenient to use in
10026           cases where the loss of several decimal digits of resolution
10027           is acceptable.  The J2000 method is best matched to the way
10028           the argument is handled internally and will deliver the
10029           optimum resolution.  The MJD method and the date & time methods
10030           are both good compromises between resolution and convenience.
10031
10032        2) The matrix operates in the sense V(date) = rbp * V(GCRS), where
10033           the p-vector V(GCRS) is with respect to the Geocentric Celestial
10034           Reference System (IAU, 2000) and the p-vector V(date) is with
10035           respect to the mean equatorial triad of the given date.
10036
10037        Called:
10038           eraBp00      frame bias and precession matrices, IAU 2000
10039
10040        Reference:
10041
10042           IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.
10043           24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.
10044           (2000)
10045
10046        This revision:  2021 May 11
10047
10048        Copyright (C) 2013-2021, NumFOCUS Foundation.
10049        Derived, with permission, from the SOFA library.  See notes at end of file.
10050
10051    """
10052    rbp = ufunc.pmat00(date1, date2)
10053    return rbp
10054
10055
10056def pmat06(date1, date2):
10057    """
10058    Precession matrix (including frame bias) from GCRS to a specified
10059    date, IAU 2006 model.
10060
10061    Parameters
10062    ----------
10063    date1 : double array
10064    date2 : double array
10065
10066    Returns
10067    -------
10068    rbp : double array
10069
10070    Notes
10071    -----
10072    Wraps ERFA function ``eraPmat06``. The ERFA documentation is::
10073
10074        - - - - - - - - - -
10075         e r a P m a t 0 6
10076        - - - - - - - - - -
10077
10078        Precession matrix (including frame bias) from GCRS to a specified
10079        date, IAU 2006 model.
10080
10081        Given:
10082           date1,date2  double          TT as a 2-part Julian Date (Note 1)
10083
10084        Returned:
10085           rbp          double[3][3]    bias-precession matrix (Note 2)
10086
10087        Notes:
10088
10089        1) The TT date date1+date2 is a Julian Date, apportioned in any
10090           convenient way between the two arguments.  For example,
10091           JD(TT)=2450123.7 could be expressed in any of these ways,
10092           among others:
10093
10094                  date1          date2
10095
10096               2450123.7           0.0       (JD method)
10097               2451545.0       -1421.3       (J2000 method)
10098               2400000.5       50123.2       (MJD method)
10099               2450123.5           0.2       (date & time method)
10100
10101           The JD method is the most natural and convenient to use in
10102           cases where the loss of several decimal digits of resolution
10103           is acceptable.  The J2000 method is best matched to the way
10104           the argument is handled internally and will deliver the
10105           optimum resolution.  The MJD method and the date & time methods
10106           are both good compromises between resolution and convenience.
10107
10108        2) The matrix operates in the sense V(date) = rbp * V(GCRS), where
10109           the p-vector V(GCRS) is with respect to the Geocentric Celestial
10110           Reference System (IAU, 2000) and the p-vector V(date) is with
10111           respect to the mean equatorial triad of the given date.
10112
10113        Called:
10114           eraPfw06     bias-precession F-W angles, IAU 2006
10115           eraFw2m      F-W angles to r-matrix
10116
10117        References:
10118
10119           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
10120
10121           IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.
10122           24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.
10123           (2000)
10124
10125           Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
10126
10127        This revision:  2021 May 11
10128
10129        Copyright (C) 2013-2021, NumFOCUS Foundation.
10130        Derived, with permission, from the SOFA library.  See notes at end of file.
10131
10132    """
10133    rbp = ufunc.pmat06(date1, date2)
10134    return rbp
10135
10136
10137def pmat76(date1, date2):
10138    """
10139    Precession matrix from J2000.0 to a specified date, IAU 1976 model.
10140
10141    Parameters
10142    ----------
10143    date1 : double array
10144    date2 : double array
10145
10146    Returns
10147    -------
10148    rmatp : double array
10149
10150    Notes
10151    -----
10152    Wraps ERFA function ``eraPmat76``. The ERFA documentation is::
10153
10154        - - - - - - - - - -
10155         e r a P m a t 7 6
10156        - - - - - - - - - -
10157
10158        Precession matrix from J2000.0 to a specified date, IAU 1976 model.
10159
10160        Given:
10161           date1,date2 double       ending date, TT (Note 1)
10162
10163        Returned:
10164           rmatp       double[3][3] precession matrix, J2000.0 -> date1+date2
10165
10166        Notes:
10167
10168        1) The TT date date1+date2 is a Julian Date, apportioned in any
10169           convenient way between the two arguments.  For example,
10170           JD(TT)=2450123.7 could be expressed in any of these ways,
10171           among others:
10172
10173                  date1          date2
10174
10175               2450123.7           0.0       (JD method)
10176               2451545.0       -1421.3       (J2000 method)
10177               2400000.5       50123.2       (MJD method)
10178               2450123.5           0.2       (date & time method)
10179
10180           The JD method is the most natural and convenient to use in
10181           cases where the loss of several decimal digits of resolution
10182           is acceptable.  The J2000 method is best matched to the way
10183           the argument is handled internally and will deliver the
10184           optimum resolution.  The MJD method and the date & time methods
10185           are both good compromises between resolution and convenience.
10186
10187        2) The matrix operates in the sense V(date) = RMATP * V(J2000),
10188           where the p-vector V(J2000) is with respect to the mean
10189           equatorial triad of epoch J2000.0 and the p-vector V(date)
10190           is with respect to the mean equatorial triad of the given
10191           date.
10192
10193        3) Though the matrix method itself is rigorous, the precession
10194           angles are expressed through canonical polynomials which are
10195           valid only for a limited time span.  In addition, the IAU 1976
10196           precession rate is known to be imperfect.  The absolute accuracy
10197           of the present formulation is better than 0.1 arcsec from
10198           1960AD to 2040AD, better than 1 arcsec from 1640AD to 2360AD,
10199           and remains below 3 arcsec for the whole of the period
10200           500BC to 3000AD.  The errors exceed 10 arcsec outside the
10201           range 1200BC to 3900AD, exceed 100 arcsec outside 4200BC to
10202           5600AD and exceed 1000 arcsec outside 6800BC to 8200AD.
10203
10204        Called:
10205           eraPrec76    accumulated precession angles, IAU 1976
10206           eraIr        initialize r-matrix to identity
10207           eraRz        rotate around Z-axis
10208           eraRy        rotate around Y-axis
10209           eraCr        copy r-matrix
10210
10211        References:
10212
10213           Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
10214            equations (6) & (7), p283.
10215
10216           Kaplan,G.H., 1981. USNO circular no. 163, pA2.
10217
10218        This revision:  2021 May 11
10219
10220        Copyright (C) 2013-2021, NumFOCUS Foundation.
10221        Derived, with permission, from the SOFA library.  See notes at end of file.
10222
10223    """
10224    rmatp = ufunc.pmat76(date1, date2)
10225    return rmatp
10226
10227
10228def pn00(date1, date2, dpsi, deps):
10229    """
10230    Precession-nutation, IAU 2000 model:  a multi-purpose function,
10231    supporting classical (equinox-based) use directly and CIO-based
10232    use indirectly.
10233
10234    Parameters
10235    ----------
10236    date1 : double array
10237    date2 : double array
10238    dpsi : double array
10239    deps : double array
10240
10241    Returns
10242    -------
10243    epsa : double array
10244    rb : double array
10245    rp : double array
10246    rbp : double array
10247    rn : double array
10248    rbpn : double array
10249
10250    Notes
10251    -----
10252    Wraps ERFA function ``eraPn00``. The ERFA documentation is::
10253
10254        - - - - - - - -
10255         e r a P n 0 0
10256        - - - - - - - -
10257
10258        Precession-nutation, IAU 2000 model:  a multi-purpose function,
10259        supporting classical (equinox-based) use directly and CIO-based
10260        use indirectly.
10261
10262        Given:
10263           date1,date2  double          TT as a 2-part Julian Date (Note 1)
10264           dpsi,deps    double          nutation (Note 2)
10265
10266        Returned:
10267           epsa         double          mean obliquity (Note 3)
10268           rb           double[3][3]    frame bias matrix (Note 4)
10269           rp           double[3][3]    precession matrix (Note 5)
10270           rbp          double[3][3]    bias-precession matrix (Note 6)
10271           rn           double[3][3]    nutation matrix (Note 7)
10272           rbpn         double[3][3]    GCRS-to-true matrix (Note 8)
10273
10274        Notes:
10275
10276        1) The TT date date1+date2 is a Julian Date, apportioned in any
10277           convenient way between the two arguments.  For example,
10278           JD(TT)=2450123.7 could be expressed in any of these ways,
10279           among others:
10280
10281                  date1          date2
10282
10283               2450123.7           0.0       (JD method)
10284               2451545.0       -1421.3       (J2000 method)
10285               2400000.5       50123.2       (MJD method)
10286               2450123.5           0.2       (date & time method)
10287
10288           The JD method is the most natural and convenient to use in
10289           cases where the loss of several decimal digits of resolution
10290           is acceptable.  The J2000 method is best matched to the way
10291           the argument is handled internally and will deliver the
10292           optimum resolution.  The MJD method and the date & time methods
10293           are both good compromises between resolution and convenience.
10294
10295        2) The caller is responsible for providing the nutation components;
10296           they are in longitude and obliquity, in radians and are with
10297           respect to the equinox and ecliptic of date.  For high-accuracy
10298           applications, free core nutation should be included as well as
10299           any other relevant corrections to the position of the CIP.
10300
10301        3) The returned mean obliquity is consistent with the IAU 2000
10302           precession-nutation models.
10303
10304        4) The matrix rb transforms vectors from GCRS to J2000.0 mean
10305           equator and equinox by applying frame bias.
10306
10307        5) The matrix rp transforms vectors from J2000.0 mean equator and
10308           equinox to mean equator and equinox of date by applying
10309           precession.
10310
10311        6) The matrix rbp transforms vectors from GCRS to mean equator and
10312           equinox of date by applying frame bias then precession.  It is
10313           the product rp x rb.
10314
10315        7) The matrix rn transforms vectors from mean equator and equinox of
10316           date to true equator and equinox of date by applying the nutation
10317           (luni-solar + planetary).
10318
10319        8) The matrix rbpn transforms vectors from GCRS to true equator and
10320           equinox of date.  It is the product rn x rbp, applying frame
10321           bias, precession and nutation in that order.
10322
10323        9) It is permissible to re-use the same array in the returned
10324           arguments.  The arrays are filled in the order given.
10325
10326        Called:
10327           eraPr00      IAU 2000 precession adjustments
10328           eraObl80     mean obliquity, IAU 1980
10329           eraBp00      frame bias and precession matrices, IAU 2000
10330           eraCr        copy r-matrix
10331           eraNumat     form nutation matrix
10332           eraRxr       product of two r-matrices
10333
10334        Reference:
10335
10336           Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
10337           "Expressions for the Celestial Intermediate Pole and Celestial
10338           Ephemeris Origin consistent with the IAU 2000A precession-
10339           nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
10340
10341           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
10342                intermediate origin" (CIO) by IAU 2006 Resolution 2.
10343
10344        This revision:  2021 May 11
10345
10346        Copyright (C) 2013-2021, NumFOCUS Foundation.
10347        Derived, with permission, from the SOFA library.  See notes at end of file.
10348
10349    """
10350    epsa, rb, rp, rbp, rn, rbpn = ufunc.pn00(date1, date2, dpsi, deps)
10351    return epsa, rb, rp, rbp, rn, rbpn
10352
10353
10354def pn00a(date1, date2):
10355    """
10356    Precession-nutation, IAU 2000A model:  a multi-purpose function,
10357    supporting classical (equinox-based) use directly and CIO-based
10358    use indirectly.
10359
10360    Parameters
10361    ----------
10362    date1 : double array
10363    date2 : double array
10364
10365    Returns
10366    -------
10367    dpsi : double array
10368    deps : double array
10369    epsa : double array
10370    rb : double array
10371    rp : double array
10372    rbp : double array
10373    rn : double array
10374    rbpn : double array
10375
10376    Notes
10377    -----
10378    Wraps ERFA function ``eraPn00a``. The ERFA documentation is::
10379
10380        - - - - - - - - -
10381         e r a P n 0 0 a
10382        - - - - - - - - -
10383
10384        Precession-nutation, IAU 2000A model:  a multi-purpose function,
10385        supporting classical (equinox-based) use directly and CIO-based
10386        use indirectly.
10387
10388        Given:
10389           date1,date2  double          TT as a 2-part Julian Date (Note 1)
10390
10391        Returned:
10392           dpsi,deps    double          nutation (Note 2)
10393           epsa         double          mean obliquity (Note 3)
10394           rb           double[3][3]    frame bias matrix (Note 4)
10395           rp           double[3][3]    precession matrix (Note 5)
10396           rbp          double[3][3]    bias-precession matrix (Note 6)
10397           rn           double[3][3]    nutation matrix (Note 7)
10398           rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)
10399
10400        Notes:
10401
10402        1)  The TT date date1+date2 is a Julian Date, apportioned in any
10403            convenient way between the two arguments.  For example,
10404            JD(TT)=2450123.7 could be expressed in any of these ways,
10405            among others:
10406
10407                   date1          date2
10408
10409                2450123.7           0.0       (JD method)
10410                2451545.0       -1421.3       (J2000 method)
10411                2400000.5       50123.2       (MJD method)
10412                2450123.5           0.2       (date & time method)
10413
10414            The JD method is the most natural and convenient to use in
10415            cases where the loss of several decimal digits of resolution
10416            is acceptable.  The J2000 method is best matched to the way
10417            the argument is handled internally and will deliver the
10418            optimum resolution.  The MJD method and the date & time methods
10419            are both good compromises between resolution and convenience.
10420
10421        2)  The nutation components (luni-solar + planetary, IAU 2000A) in
10422            longitude and obliquity are in radians and with respect to the
10423            equinox and ecliptic of date.  Free core nutation is omitted;
10424            for the utmost accuracy, use the eraPn00 function, where the
10425            nutation components are caller-specified.  For faster but
10426            slightly less accurate results, use the eraPn00b function.
10427
10428        3)  The mean obliquity is consistent with the IAU 2000 precession.
10429
10430        4)  The matrix rb transforms vectors from GCRS to J2000.0 mean
10431            equator and equinox by applying frame bias.
10432
10433        5)  The matrix rp transforms vectors from J2000.0 mean equator and
10434            equinox to mean equator and equinox of date by applying
10435            precession.
10436
10437        6)  The matrix rbp transforms vectors from GCRS to mean equator and
10438            equinox of date by applying frame bias then precession.  It is
10439            the product rp x rb.
10440
10441        7)  The matrix rn transforms vectors from mean equator and equinox
10442            of date to true equator and equinox of date by applying the
10443            nutation (luni-solar + planetary).
10444
10445        8)  The matrix rbpn transforms vectors from GCRS to true equator and
10446            equinox of date.  It is the product rn x rbp, applying frame
10447            bias, precession and nutation in that order.
10448
10449        9)  The X,Y,Z coordinates of the IAU 2000A Celestial Intermediate
10450            Pole are elements (3,1-3) of the GCRS-to-true matrix,
10451            i.e. rbpn[2][0-2].
10452
10453        10) It is permissible to re-use the same array in the returned
10454            arguments.  The arrays are filled in the stated order.
10455
10456        Called:
10457           eraNut00a    nutation, IAU 2000A
10458           eraPn00      bias/precession/nutation results, IAU 2000
10459
10460        Reference:
10461
10462           Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
10463           "Expressions for the Celestial Intermediate Pole and Celestial
10464           Ephemeris Origin consistent with the IAU 2000A precession-
10465           nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
10466
10467           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
10468                intermediate origin" (CIO) by IAU 2006 Resolution 2.
10469
10470        This revision:  2021 May 11
10471
10472        Copyright (C) 2013-2021, NumFOCUS Foundation.
10473        Derived, with permission, from the SOFA library.  See notes at end of file.
10474
10475    """
10476    dpsi, deps, epsa, rb, rp, rbp, rn, rbpn = ufunc.pn00a(date1, date2)
10477    return dpsi, deps, epsa, rb, rp, rbp, rn, rbpn
10478
10479
10480def pn00b(date1, date2):
10481    """
10482    Precession-nutation, IAU 2000B model:  a multi-purpose function,
10483    supporting classical (equinox-based) use directly and CIO-based
10484    use indirectly.
10485
10486    Parameters
10487    ----------
10488    date1 : double array
10489    date2 : double array
10490
10491    Returns
10492    -------
10493    dpsi : double array
10494    deps : double array
10495    epsa : double array
10496    rb : double array
10497    rp : double array
10498    rbp : double array
10499    rn : double array
10500    rbpn : double array
10501
10502    Notes
10503    -----
10504    Wraps ERFA function ``eraPn00b``. The ERFA documentation is::
10505
10506        - - - - - - - - -
10507         e r a P n 0 0 b
10508        - - - - - - - - -
10509
10510        Precession-nutation, IAU 2000B model:  a multi-purpose function,
10511        supporting classical (equinox-based) use directly and CIO-based
10512        use indirectly.
10513
10514        Given:
10515           date1,date2  double          TT as a 2-part Julian Date (Note 1)
10516
10517        Returned:
10518           dpsi,deps    double          nutation (Note 2)
10519           epsa         double          mean obliquity (Note 3)
10520           rb           double[3][3]    frame bias matrix (Note 4)
10521           rp           double[3][3]    precession matrix (Note 5)
10522           rbp          double[3][3]    bias-precession matrix (Note 6)
10523           rn           double[3][3]    nutation matrix (Note 7)
10524           rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)
10525
10526        Notes:
10527
10528        1)  The TT date date1+date2 is a Julian Date, apportioned in any
10529            convenient way between the two arguments.  For example,
10530            JD(TT)=2450123.7 could be expressed in any of these ways,
10531            among others:
10532
10533                   date1          date2
10534
10535                2450123.7           0.0       (JD method)
10536                2451545.0       -1421.3       (J2000 method)
10537                2400000.5       50123.2       (MJD method)
10538                2450123.5           0.2       (date & time method)
10539
10540            The JD method is the most natural and convenient to use in
10541            cases where the loss of several decimal digits of resolution
10542            is acceptable.  The J2000 method is best matched to the way
10543            the argument is handled internally and will deliver the
10544            optimum resolution.  The MJD method and the date & time methods
10545            are both good compromises between resolution and convenience.
10546
10547        2)  The nutation components (luni-solar + planetary, IAU 2000B) in
10548            longitude and obliquity are in radians and with respect to the
10549            equinox and ecliptic of date.  For more accurate results, but
10550            at the cost of increased computation, use the eraPn00a function.
10551            For the utmost accuracy, use the eraPn00 function, where the
10552            nutation components are caller-specified.
10553
10554        3)  The mean obliquity is consistent with the IAU 2000 precession.
10555
10556        4)  The matrix rb transforms vectors from GCRS to J2000.0 mean
10557            equator and equinox by applying frame bias.
10558
10559        5)  The matrix rp transforms vectors from J2000.0 mean equator and
10560            equinox to mean equator and equinox of date by applying
10561            precession.
10562
10563        6)  The matrix rbp transforms vectors from GCRS to mean equator and
10564            equinox of date by applying frame bias then precession.  It is
10565            the product rp x rb.
10566
10567        7)  The matrix rn transforms vectors from mean equator and equinox
10568            of date to true equator and equinox of date by applying the
10569            nutation (luni-solar + planetary).
10570
10571        8)  The matrix rbpn transforms vectors from GCRS to true equator and
10572            equinox of date.  It is the product rn x rbp, applying frame
10573            bias, precession and nutation in that order.
10574
10575        9)  The X,Y,Z coordinates of the IAU 2000B Celestial Intermediate
10576            Pole are elements (3,1-3) of the GCRS-to-true matrix,
10577            i.e. rbpn[2][0-2].
10578
10579        10) It is permissible to re-use the same array in the returned
10580            arguments.  The arrays are filled in the stated order.
10581
10582        Called:
10583           eraNut00b    nutation, IAU 2000B
10584           eraPn00      bias/precession/nutation results, IAU 2000
10585
10586        Reference:
10587
10588           Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
10589           "Expressions for the Celestial Intermediate Pole and Celestial
10590           Ephemeris Origin consistent with the IAU 2000A precession-
10591           nutation model", Astron.Astrophys. 400, 1145-1154 (2003).
10592
10593           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
10594                intermediate origin" (CIO) by IAU 2006 Resolution 2.
10595
10596        This revision:  2021 May 11
10597
10598        Copyright (C) 2013-2021, NumFOCUS Foundation.
10599        Derived, with permission, from the SOFA library.  See notes at end of file.
10600
10601    """
10602    dpsi, deps, epsa, rb, rp, rbp, rn, rbpn = ufunc.pn00b(date1, date2)
10603    return dpsi, deps, epsa, rb, rp, rbp, rn, rbpn
10604
10605
10606def pn06(date1, date2, dpsi, deps):
10607    """
10608    Precession-nutation, IAU 2006 model:  a multi-purpose function,
10609    supporting classical (equinox-based) use directly and CIO-based use
10610    indirectly.
10611
10612    Parameters
10613    ----------
10614    date1 : double array
10615    date2 : double array
10616    dpsi : double array
10617    deps : double array
10618
10619    Returns
10620    -------
10621    epsa : double array
10622    rb : double array
10623    rp : double array
10624    rbp : double array
10625    rn : double array
10626    rbpn : double array
10627
10628    Notes
10629    -----
10630    Wraps ERFA function ``eraPn06``. The ERFA documentation is::
10631
10632        - - - - - - - -
10633         e r a P n 0 6
10634        - - - - - - - -
10635
10636        Precession-nutation, IAU 2006 model:  a multi-purpose function,
10637        supporting classical (equinox-based) use directly and CIO-based use
10638        indirectly.
10639
10640        Given:
10641           date1,date2  double          TT as a 2-part Julian Date (Note 1)
10642           dpsi,deps    double          nutation (Note 2)
10643
10644        Returned:
10645           epsa         double          mean obliquity (Note 3)
10646           rb           double[3][3]    frame bias matrix (Note 4)
10647           rp           double[3][3]    precession matrix (Note 5)
10648           rbp          double[3][3]    bias-precession matrix (Note 6)
10649           rn           double[3][3]    nutation matrix (Note 7)
10650           rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)
10651
10652        Notes:
10653
10654        1)  The TT date date1+date2 is a Julian Date, apportioned in any
10655            convenient way between the two arguments.  For example,
10656            JD(TT)=2450123.7 could be expressed in any of these ways,
10657            among others:
10658
10659                   date1          date2
10660
10661                2450123.7           0.0       (JD method)
10662                2451545.0       -1421.3       (J2000 method)
10663                2400000.5       50123.2       (MJD method)
10664                2450123.5           0.2       (date & time method)
10665
10666            The JD method is the most natural and convenient to use in
10667            cases where the loss of several decimal digits of resolution
10668            is acceptable.  The J2000 method is best matched to the way
10669            the argument is handled internally and will deliver the
10670            optimum resolution.  The MJD method and the date & time methods
10671            are both good compromises between resolution and convenience.
10672
10673        2)  The caller is responsible for providing the nutation components;
10674            they are in longitude and obliquity, in radians and are with
10675            respect to the equinox and ecliptic of date.  For high-accuracy
10676            applications, free core nutation should be included as well as
10677            any other relevant corrections to the position of the CIP.
10678
10679        3)  The returned mean obliquity is consistent with the IAU 2006
10680            precession.
10681
10682        4)  The matrix rb transforms vectors from GCRS to J2000.0 mean
10683            equator and equinox by applying frame bias.
10684
10685        5)  The matrix rp transforms vectors from J2000.0 mean equator and
10686            equinox to mean equator and equinox of date by applying
10687            precession.
10688
10689        6)  The matrix rbp transforms vectors from GCRS to mean equator and
10690            equinox of date by applying frame bias then precession.  It is
10691            the product rp x rb.
10692
10693        7)  The matrix rn transforms vectors from mean equator and equinox
10694            of date to true equator and equinox of date by applying the
10695            nutation (luni-solar + planetary).
10696
10697        8)  The matrix rbpn transforms vectors from GCRS to true equator and
10698            equinox of date.  It is the product rn x rbp, applying frame
10699            bias, precession and nutation in that order.
10700
10701        9)  The X,Y,Z coordinates of the Celestial Intermediate Pole are
10702            elements (3,1-3) of the GCRS-to-true matrix, i.e. rbpn[2][0-2].
10703
10704        10) It is permissible to re-use the same array in the returned
10705            arguments.  The arrays are filled in the stated order.
10706
10707        Called:
10708           eraPfw06     bias-precession F-W angles, IAU 2006
10709           eraFw2m      F-W angles to r-matrix
10710           eraCr        copy r-matrix
10711           eraTr        transpose r-matrix
10712           eraRxr       product of two r-matrices
10713
10714        References:
10715
10716           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
10717
10718           Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
10719
10720        This revision:  2021 May 11
10721
10722        Copyright (C) 2013-2021, NumFOCUS Foundation.
10723        Derived, with permission, from the SOFA library.  See notes at end of file.
10724
10725    """
10726    epsa, rb, rp, rbp, rn, rbpn = ufunc.pn06(date1, date2, dpsi, deps)
10727    return epsa, rb, rp, rbp, rn, rbpn
10728
10729
10730def pn06a(date1, date2):
10731    """
10732    Precession-nutation, IAU 2006/2000A models:  a multi-purpose function,
10733    supporting classical (equinox-based) use directly and CIO-based use
10734    indirectly.
10735
10736    Parameters
10737    ----------
10738    date1 : double array
10739    date2 : double array
10740
10741    Returns
10742    -------
10743    dpsi : double array
10744    deps : double array
10745    epsa : double array
10746    rb : double array
10747    rp : double array
10748    rbp : double array
10749    rn : double array
10750    rbpn : double array
10751
10752    Notes
10753    -----
10754    Wraps ERFA function ``eraPn06a``. The ERFA documentation is::
10755
10756        - - - - - - - - -
10757         e r a P n 0 6 a
10758        - - - - - - - - -
10759
10760        Precession-nutation, IAU 2006/2000A models:  a multi-purpose function,
10761        supporting classical (equinox-based) use directly and CIO-based use
10762        indirectly.
10763
10764        Given:
10765           date1,date2  double          TT as a 2-part Julian Date (Note 1)
10766
10767        Returned:
10768           dpsi,deps    double          nutation (Note 2)
10769           epsa         double          mean obliquity (Note 3)
10770           rb           double[3][3]    frame bias matrix (Note 4)
10771           rp           double[3][3]    precession matrix (Note 5)
10772           rbp          double[3][3]    bias-precession matrix (Note 6)
10773           rn           double[3][3]    nutation matrix (Note 7)
10774           rbpn         double[3][3]    GCRS-to-true matrix (Notes 8,9)
10775
10776        Notes:
10777
10778        1)  The TT date date1+date2 is a Julian Date, apportioned in any
10779            convenient way between the two arguments.  For example,
10780            JD(TT)=2450123.7 could be expressed in any of these ways,
10781            among others:
10782
10783                   date1          date2
10784
10785                2450123.7           0.0       (JD method)
10786                2451545.0       -1421.3       (J2000 method)
10787                2400000.5       50123.2       (MJD method)
10788                2450123.5           0.2       (date & time method)
10789
10790            The JD method is the most natural and convenient to use in
10791            cases where the loss of several decimal digits of resolution
10792            is acceptable.  The J2000 method is best matched to the way
10793            the argument is handled internally and will deliver the
10794            optimum resolution.  The MJD method and the date & time methods
10795            are both good compromises between resolution and convenience.
10796
10797        2)  The nutation components (luni-solar + planetary, IAU 2000A) in
10798            longitude and obliquity are in radians and with respect to the
10799            equinox and ecliptic of date.  Free core nutation is omitted;
10800            for the utmost accuracy, use the eraPn06 function, where the
10801            nutation components are caller-specified.
10802
10803        3)  The mean obliquity is consistent with the IAU 2006 precession.
10804
10805        4)  The matrix rb transforms vectors from GCRS to mean J2000.0 by
10806            applying frame bias.
10807
10808        5)  The matrix rp transforms vectors from mean J2000.0 to mean of
10809            date by applying precession.
10810
10811        6)  The matrix rbp transforms vectors from GCRS to mean of date by
10812            applying frame bias then precession.  It is the product rp x rb.
10813
10814        7)  The matrix rn transforms vectors from mean of date to true of
10815            date by applying the nutation (luni-solar + planetary).
10816
10817        8)  The matrix rbpn transforms vectors from GCRS to true of date
10818            (CIP/equinox).  It is the product rn x rbp, applying frame bias,
10819            precession and nutation in that order.
10820
10821        9)  The X,Y,Z coordinates of the IAU 2006/2000A Celestial
10822            Intermediate Pole are elements (3,1-3) of the GCRS-to-true
10823            matrix, i.e. rbpn[2][0-2].
10824
10825        10) It is permissible to re-use the same array in the returned
10826            arguments.  The arrays are filled in the stated order.
10827
10828        Called:
10829           eraNut06a    nutation, IAU 2006/2000A
10830           eraPn06      bias/precession/nutation results, IAU 2006
10831
10832        Reference:
10833
10834           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
10835
10836        This revision:  2021 May 11
10837
10838        Copyright (C) 2013-2021, NumFOCUS Foundation.
10839        Derived, with permission, from the SOFA library.  See notes at end of file.
10840
10841    """
10842    dpsi, deps, epsa, rb, rp, rbp, rn, rbpn = ufunc.pn06a(date1, date2)
10843    return dpsi, deps, epsa, rb, rp, rbp, rn, rbpn
10844
10845
10846def pnm00a(date1, date2):
10847    """
10848    Form the matrix of precession-nutation for a given date (including
10849    frame bias), equinox based, IAU 2000A model.
10850
10851    Parameters
10852    ----------
10853    date1 : double array
10854    date2 : double array
10855
10856    Returns
10857    -------
10858    rbpn : double array
10859
10860    Notes
10861    -----
10862    Wraps ERFA function ``eraPnm00a``. The ERFA documentation is::
10863
10864        - - - - - - - - - -
10865         e r a P n m 0 0 a
10866        - - - - - - - - - -
10867
10868        Form the matrix of precession-nutation for a given date (including
10869        frame bias), equinox based, IAU 2000A model.
10870
10871        Given:
10872           date1,date2 double       TT as a 2-part Julian Date (Note 1)
10873
10874        Returned:
10875           rbpn        double[3][3] bias-precession-nutation matrix (Note 2)
10876
10877        Notes:
10878
10879        1) The TT date date1+date2 is a Julian Date, apportioned in any
10880           convenient way between the two arguments.  For example,
10881           JD(TT)=2450123.7 could be expressed in any of these ways, among
10882           others:
10883
10884                  date1          date2
10885
10886               2450123.7           0.0       (JD method)
10887               2451545.0       -1421.3       (J2000 method)
10888               2400000.5       50123.2       (MJD method)
10889               2450123.5           0.2       (date & time method)
10890
10891           The JD method is the most natural and convenient to use in
10892           cases where the loss of several decimal digits of resolution
10893           is acceptable.  The J2000 method is best matched to the way
10894           the argument is handled internally and will deliver the
10895           optimum resolution.  The MJD method and the date & time methods
10896           are both good compromises between resolution and convenience.
10897
10898        2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where
10899           the p-vector V(date) is with respect to the true equatorial triad
10900           of date date1+date2 and the p-vector V(GCRS) is with respect to
10901           the Geocentric Celestial Reference System (IAU, 2000).
10902
10903        3) A faster, but slightly less accurate, result (about 1 mas) can be
10904           obtained by using instead the eraPnm00b function.
10905
10906        Called:
10907           eraPn00a     bias/precession/nutation, IAU 2000A
10908
10909        Reference:
10910
10911           IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.
10912           24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.
10913           (2000)
10914
10915        This revision:  2021 May 11
10916
10917        Copyright (C) 2013-2021, NumFOCUS Foundation.
10918        Derived, with permission, from the SOFA library.  See notes at end of file.
10919
10920    """
10921    rbpn = ufunc.pnm00a(date1, date2)
10922    return rbpn
10923
10924
10925def pnm00b(date1, date2):
10926    """
10927    Form the matrix of precession-nutation for a given date (including
10928    frame bias), equinox-based, IAU 2000B model.
10929
10930    Parameters
10931    ----------
10932    date1 : double array
10933    date2 : double array
10934
10935    Returns
10936    -------
10937    rbpn : double array
10938
10939    Notes
10940    -----
10941    Wraps ERFA function ``eraPnm00b``. The ERFA documentation is::
10942
10943        - - - - - - - - - -
10944         e r a P n m 0 0 b
10945        - - - - - - - - - -
10946
10947        Form the matrix of precession-nutation for a given date (including
10948        frame bias), equinox-based, IAU 2000B model.
10949
10950        Given:
10951           date1,date2 double       TT as a 2-part Julian Date (Note 1)
10952
10953        Returned:
10954           rbpn        double[3][3] bias-precession-nutation matrix (Note 2)
10955
10956        Notes:
10957
10958        1) The TT date date1+date2 is a Julian Date, apportioned in any
10959           convenient way between the two arguments.  For example,
10960           JD(TT)=2450123.7 could be expressed in any of these ways, among
10961           others:
10962
10963                  date1          date2
10964
10965               2450123.7           0.0       (JD method)
10966               2451545.0       -1421.3       (J2000 method)
10967               2400000.5       50123.2       (MJD method)
10968               2450123.5           0.2       (date & time method)
10969
10970           The JD method is the most natural and convenient to use in
10971           cases where the loss of several decimal digits of resolution
10972           is acceptable.  The J2000 method is best matched to the way
10973           the argument is handled internally and will deliver the
10974           optimum resolution.  The MJD method and the date & time methods
10975           are both good compromises between resolution and convenience.
10976
10977        2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where
10978           the p-vector V(date) is with respect to the true equatorial triad
10979           of date date1+date2 and the p-vector V(GCRS) is with respect to
10980           the Geocentric Celestial Reference System (IAU, 2000).
10981
10982        3) The present function is faster, but slightly less accurate (about
10983           1 mas), than the eraPnm00a function.
10984
10985        Called:
10986           eraPn00b     bias/precession/nutation, IAU 2000B
10987
10988        Reference:
10989
10990           IAU: Trans. International Astronomical Union, Vol. XXIVB;  Proc.
10991           24th General Assembly, Manchester, UK.  Resolutions B1.3, B1.6.
10992           (2000)
10993
10994        This revision:  2021 May 11
10995
10996        Copyright (C) 2013-2021, NumFOCUS Foundation.
10997        Derived, with permission, from the SOFA library.  See notes at end of file.
10998
10999    """
11000    rbpn = ufunc.pnm00b(date1, date2)
11001    return rbpn
11002
11003
11004def pnm06a(date1, date2):
11005    """
11006    Form the matrix of precession-nutation for a given date (including
11007    frame bias), equinox based, IAU 2006 precession and IAU 2000A
11008    nutation models.
11009
11010    Parameters
11011    ----------
11012    date1 : double array
11013    date2 : double array
11014
11015    Returns
11016    -------
11017    rbpn : double array
11018
11019    Notes
11020    -----
11021    Wraps ERFA function ``eraPnm06a``. The ERFA documentation is::
11022
11023        - - - - - - - - - -
11024         e r a P n m 0 6 a
11025        - - - - - - - - - -
11026
11027        Form the matrix of precession-nutation for a given date (including
11028        frame bias), equinox based, IAU 2006 precession and IAU 2000A
11029        nutation models.
11030
11031        Given:
11032           date1,date2 double       TT as a 2-part Julian Date (Note 1)
11033
11034        Returned:
11035           rbpn        double[3][3] bias-precession-nutation matrix (Note 2)
11036
11037        Notes:
11038
11039        1) The TT date date1+date2 is a Julian Date, apportioned in any
11040           convenient way between the two arguments.  For example,
11041           JD(TT)=2450123.7 could be expressed in any of these ways, among
11042           others:
11043
11044                  date1          date2
11045
11046               2450123.7           0.0       (JD method)
11047               2451545.0       -1421.3       (J2000 method)
11048               2400000.5       50123.2       (MJD method)
11049               2450123.5           0.2       (date & time method)
11050
11051           The JD method is the most natural and convenient to use in
11052           cases where the loss of several decimal digits of resolution
11053           is acceptable.  The J2000 method is best matched to the way
11054           the argument is handled internally and will deliver the
11055           optimum resolution.  The MJD method and the date & time methods
11056           are both good compromises between resolution and convenience.
11057
11058        2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where
11059           the p-vector V(date) is with respect to the true equatorial triad
11060           of date date1+date2 and the p-vector V(GCRS) is with respect to
11061           the Geocentric Celestial Reference System (IAU, 2000).
11062
11063        Called:
11064           eraPfw06     bias-precession F-W angles, IAU 2006
11065           eraNut06a    nutation, IAU 2006/2000A
11066           eraFw2m      F-W angles to r-matrix
11067
11068        Reference:
11069
11070           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855.
11071
11072        This revision:  2021 May 11
11073
11074        Copyright (C) 2013-2021, NumFOCUS Foundation.
11075        Derived, with permission, from the SOFA library.  See notes at end of file.
11076
11077    """
11078    rbpn = ufunc.pnm06a(date1, date2)
11079    return rbpn
11080
11081
11082def pnm80(date1, date2):
11083    """
11084    Form the matrix of precession/nutation for a given date, IAU 1976
11085    precession model, IAU 1980 nutation model.
11086
11087    Parameters
11088    ----------
11089    date1 : double array
11090    date2 : double array
11091
11092    Returns
11093    -------
11094    rmatpn : double array
11095
11096    Notes
11097    -----
11098    Wraps ERFA function ``eraPnm80``. The ERFA documentation is::
11099
11100        - - - - - - - - -
11101         e r a P n m 8 0
11102        - - - - - - - - -
11103
11104        Form the matrix of precession/nutation for a given date, IAU 1976
11105        precession model, IAU 1980 nutation model.
11106
11107        Given:
11108           date1,date2 double       TT as a 2-part Julian Date (Note 1)
11109
11110        Returned:
11111           rmatpn         double[3][3]   combined precession/nutation matrix
11112
11113        Notes:
11114
11115        1) The TT date date1+date2 is a Julian Date, apportioned in any
11116           convenient way between the two arguments.  For example,
11117           JD(TT)=2450123.7 could be expressed in any of these ways,
11118           among others:
11119
11120                  date1          date2
11121
11122               2450123.7           0.0       (JD method)
11123               2451545.0       -1421.3       (J2000 method)
11124               2400000.5       50123.2       (MJD method)
11125               2450123.5           0.2       (date & time method)
11126
11127           The JD method is the most natural and convenient to use in
11128           cases where the loss of several decimal digits of resolution
11129           is acceptable.  The J2000 method is best matched to the way
11130           the argument is handled internally and will deliver the
11131           optimum resolution.  The MJD method and the date & time methods
11132           are both good compromises between resolution and convenience.
11133
11134        2) The matrix operates in the sense V(date) = rmatpn * V(J2000),
11135           where the p-vector V(date) is with respect to the true equatorial
11136           triad of date date1+date2 and the p-vector V(J2000) is with
11137           respect to the mean equatorial triad of epoch J2000.0.
11138
11139        Called:
11140           eraPmat76    precession matrix, IAU 1976
11141           eraNutm80    nutation matrix, IAU 1980
11142           eraRxr       product of two r-matrices
11143
11144        Reference:
11145
11146           Explanatory Supplement to the Astronomical Almanac,
11147           P. Kenneth Seidelmann (ed), University Science Books (1992),
11148           Section 3.3 (p145).
11149
11150        This revision:  2021 May 11
11151
11152        Copyright (C) 2013-2021, NumFOCUS Foundation.
11153        Derived, with permission, from the SOFA library.  See notes at end of file.
11154
11155    """
11156    rmatpn = ufunc.pnm80(date1, date2)
11157    return rmatpn
11158
11159
11160def pom00(xp, yp, sp):
11161    """
11162    Form the matrix of polar motion for a given date, IAU 2000.
11163
11164    Parameters
11165    ----------
11166    xp : double array
11167    yp : double array
11168    sp : double array
11169
11170    Returns
11171    -------
11172    rpom : double array
11173
11174    Notes
11175    -----
11176    Wraps ERFA function ``eraPom00``. The ERFA documentation is::
11177
11178        - - - - - - - - - -
11179         e r a P o m 0 0
11180        - - - - - - - - - -
11181
11182        Form the matrix of polar motion for a given date, IAU 2000.
11183
11184        Given:
11185           xp,yp    double    coordinates of the pole (radians, Note 1)
11186           sp       double    the TIO locator s' (radians, Note 2)
11187
11188        Returned:
11189           rpom     double[3][3]   polar-motion matrix (Note 3)
11190
11191        Notes:
11192
11193        1) The arguments xp and yp are the coordinates (in radians) of the
11194           Celestial Intermediate Pole with respect to the International
11195           Terrestrial Reference System (see IERS Conventions 2003),
11196           measured along the meridians 0 and 90 deg west respectively.
11197
11198        2) The argument sp is the TIO locator s', in radians, which
11199           positions the Terrestrial Intermediate Origin on the equator.  It
11200           is obtained from polar motion observations by numerical
11201           integration, and so is in essence unpredictable.  However, it is
11202           dominated by a secular drift of about 47 microarcseconds per
11203           century, and so can be taken into account by using s' = -47*t,
11204           where t is centuries since J2000.0.  The function eraSp00
11205           implements this approximation.
11206
11207        3) The matrix operates in the sense V(TRS) = rpom * V(CIP), meaning
11208           that it is the final rotation when computing the pointing
11209           direction to a celestial source.
11210
11211        Called:
11212           eraIr        initialize r-matrix to identity
11213           eraRz        rotate around Z-axis
11214           eraRy        rotate around Y-axis
11215           eraRx        rotate around X-axis
11216
11217        Reference:
11218
11219           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
11220           IERS Technical Note No. 32, BKG (2004)
11221
11222        This revision:  2021 May 11
11223
11224        Copyright (C) 2013-2021, NumFOCUS Foundation.
11225        Derived, with permission, from the SOFA library.  See notes at end of file.
11226
11227    """
11228    rpom = ufunc.pom00(xp, yp, sp)
11229    return rpom
11230
11231
11232def pr00(date1, date2):
11233    """
11234    Precession-rate part of the IAU 2000 precession-nutation models
11235    (part of MHB2000).
11236
11237    Parameters
11238    ----------
11239    date1 : double array
11240    date2 : double array
11241
11242    Returns
11243    -------
11244    dpsipr : double array
11245    depspr : double array
11246
11247    Notes
11248    -----
11249    Wraps ERFA function ``eraPr00``. The ERFA documentation is::
11250
11251        - - - - - - - -
11252         e r a P r 0 0
11253        - - - - - - - -
11254
11255        Precession-rate part of the IAU 2000 precession-nutation models
11256        (part of MHB2000).
11257
11258        Given:
11259           date1,date2    double  TT as a 2-part Julian Date (Note 1)
11260
11261        Returned:
11262           dpsipr,depspr  double  precession corrections (Notes 2,3)
11263
11264        Notes:
11265
11266        1) The TT date date1+date2 is a Julian Date, apportioned in any
11267           convenient way between the two arguments.  For example,
11268           JD(TT)=2450123.7 could be expressed in any of these ways,
11269           among others:
11270
11271                  date1          date2
11272
11273               2450123.7           0.0       (JD method)
11274               2451545.0       -1421.3       (J2000 method)
11275               2400000.5       50123.2       (MJD method)
11276               2450123.5           0.2       (date & time method)
11277
11278           The JD method is the most natural and convenient to use in
11279           cases where the loss of several decimal digits of resolution
11280           is acceptable.  The J2000 method is best matched to the way
11281           the argument is handled internally and will deliver the
11282           optimum resolution.  The MJD method and the date & time methods
11283           are both good compromises between resolution and convenience.
11284
11285        2) The precession adjustments are expressed as "nutation
11286           components", corrections in longitude and obliquity with respect
11287           to the J2000.0 equinox and ecliptic.
11288
11289        3) Although the precession adjustments are stated to be with respect
11290           to Lieske et al. (1977), the MHB2000 model does not specify which
11291           set of Euler angles are to be used and how the adjustments are to
11292           be applied.  The most literal and straightforward procedure is to
11293           adopt the 4-rotation epsilon_0, psi_A, omega_A, xi_A option, and
11294           to add dpsipr to psi_A and depspr to both omega_A and eps_A.
11295
11296        4) This is an implementation of one aspect of the IAU 2000A nutation
11297           model, formally adopted by the IAU General Assembly in 2000,
11298           namely MHB2000 (Mathews et al. 2002).
11299
11300        References:
11301
11302           Lieske, J.H., Lederle, T., Fricke, W. & Morando, B., "Expressions
11303           for the precession quantities based upon the IAU (1976) System of
11304           Astronomical Constants", Astron.Astrophys., 58, 1-16 (1977)
11305
11306           Mathews, P.M., Herring, T.A., Buffet, B.A., "Modeling of nutation
11307           and precession   New nutation series for nonrigid Earth and
11308           insights into the Earth's interior", J.Geophys.Res., 107, B4,
11309           2002.  The MHB2000 code itself was obtained on 9th September 2002
11310           from ftp://maia.usno.navy.mil/conv2000/chapter5/IAU2000A.
11311
11312           Wallace, P.T., "Software for Implementing the IAU 2000
11313           Resolutions", in IERS Workshop 5.1 (2002).
11314
11315        This revision:  2021 May 11
11316
11317        Copyright (C) 2013-2021, NumFOCUS Foundation.
11318        Derived, with permission, from the SOFA library.  See notes at end of file.
11319
11320    """
11321    dpsipr, depspr = ufunc.pr00(date1, date2)
11322    return dpsipr, depspr
11323
11324
11325def prec76(date01, date02, date11, date12):
11326    """
11327    IAU 1976 precession model.
11328
11329    Parameters
11330    ----------
11331    date01 : double array
11332    date02 : double array
11333    date11 : double array
11334    date12 : double array
11335
11336    Returns
11337    -------
11338    zeta : double array
11339    z : double array
11340    theta : double array
11341
11342    Notes
11343    -----
11344    Wraps ERFA function ``eraPrec76``. The ERFA documentation is::
11345
11346        - - - - - - - - - -
11347         e r a P r e c 7 6
11348        - - - - - - - - - -
11349
11350        IAU 1976 precession model.
11351
11352        This function forms the three Euler angles which implement general
11353        precession between two dates, using the IAU 1976 model (as for the
11354        FK5 catalog).
11355
11356        Given:
11357           date01,date02   double    TDB starting date (Note 1)
11358           date11,date12   double    TDB ending date (Note 1)
11359
11360        Returned:
11361           zeta            double    1st rotation: radians cw around z
11362           z               double    3rd rotation: radians cw around z
11363           theta           double    2nd rotation: radians ccw around y
11364
11365        Notes:
11366
11367        1) The dates date01+date02 and date11+date12 are Julian Dates,
11368           apportioned in any convenient way between the arguments daten1
11369           and daten2.  For example, JD(TDB)=2450123.7 could be expressed in
11370           any of these ways, among others:
11371
11372                 daten1        daten2
11373
11374               2450123.7           0.0       (JD method)
11375               2451545.0       -1421.3       (J2000 method)
11376               2400000.5       50123.2       (MJD method)
11377               2450123.5           0.2       (date & time method)
11378
11379           The JD method is the most natural and convenient to use in cases
11380           where the loss of several decimal digits of resolution is
11381           acceptable.  The J2000 method is best matched to the way the
11382           argument is handled internally and will deliver the optimum
11383           optimum resolution.  The MJD method and the date & time methods
11384           are both good compromises between resolution and convenience.
11385           The two dates may be expressed using different methods, but at
11386           the risk of losing some resolution.
11387
11388        2) The accumulated precession angles zeta, z, theta are expressed
11389           through canonical polynomials which are valid only for a limited
11390           time span.  In addition, the IAU 1976 precession rate is known to
11391           be imperfect.  The absolute accuracy of the present formulation
11392           is better than 0.1 arcsec from 1960AD to 2040AD, better than
11393           1 arcsec from 1640AD to 2360AD, and remains below 3 arcsec for
11394           the whole of the period 500BC to 3000AD.  The errors exceed
11395           10 arcsec outside the range 1200BC to 3900AD, exceed 100 arcsec
11396           outside 4200BC to 5600AD and exceed 1000 arcsec outside 6800BC to
11397           8200AD.
11398
11399        3) The three angles are returned in the conventional order, which
11400           is not the same as the order of the corresponding Euler
11401           rotations.  The precession matrix is
11402           R_3(-z) x R_2(+theta) x R_3(-zeta).
11403
11404        Reference:
11405
11406           Lieske, J.H., 1979, Astron.Astrophys. 73, 282, equations
11407           (6) & (7), p283.
11408
11409        This revision:  2021 May 11
11410
11411        Copyright (C) 2013-2021, NumFOCUS Foundation.
11412        Derived, with permission, from the SOFA library.  See notes at end of file.
11413
11414    """
11415    zeta, z, theta = ufunc.prec76(date01, date02, date11, date12)
11416    return zeta, z, theta
11417
11418
11419def s00(date1, date2, x, y):
11420    """
11421    The CIO locator s, positioning the Celestial Intermediate Origin on
11422    the equator of the Celestial Intermediate Pole, given the CIP's X,Y
11423    coordinates.
11424
11425    Parameters
11426    ----------
11427    date1 : double array
11428    date2 : double array
11429    x : double array
11430    y : double array
11431
11432    Returns
11433    -------
11434    c_retval : double array
11435
11436    Notes
11437    -----
11438    Wraps ERFA function ``eraS00``. The ERFA documentation is::
11439
11440        - - - - - - -
11441         e r a S 0 0
11442        - - - - - - -
11443
11444        The CIO locator s, positioning the Celestial Intermediate Origin on
11445        the equator of the Celestial Intermediate Pole, given the CIP's X,Y
11446        coordinates.  Compatible with IAU 2000A precession-nutation.
11447
11448        Given:
11449           date1,date2   double    TT as a 2-part Julian Date (Note 1)
11450           x,y           double    CIP coordinates (Note 3)
11451
11452        Returned (function value):
11453                         double    the CIO locator s in radians (Note 2)
11454
11455        Notes:
11456
11457        1) The TT date date1+date2 is a Julian Date, apportioned in any
11458           convenient way between the two arguments.  For example,
11459           JD(TT)=2450123.7 could be expressed in any of these ways,
11460           among others:
11461
11462                  date1          date2
11463
11464               2450123.7           0.0       (JD method)
11465               2451545.0       -1421.3       (J2000 method)
11466               2400000.5       50123.2       (MJD method)
11467               2450123.5           0.2       (date & time method)
11468
11469           The JD method is the most natural and convenient to use in
11470           cases where the loss of several decimal digits of resolution
11471           is acceptable.  The J2000 method is best matched to the way
11472           the argument is handled internally and will deliver the
11473           optimum resolution.  The MJD method and the date & time methods
11474           are both good compromises between resolution and convenience.
11475
11476        2) The CIO locator s is the difference between the right ascensions
11477           of the same point in two systems:  the two systems are the GCRS
11478           and the CIP,CIO, and the point is the ascending node of the
11479           CIP equator.  The quantity s remains below 0.1 arcsecond
11480           throughout 1900-2100.
11481
11482        3) The series used to compute s is in fact for s+XY/2, where X and Y
11483           are the x and y components of the CIP unit vector;  this series
11484           is more compact than a direct series for s would be.  This
11485           function requires X,Y to be supplied by the caller, who is
11486           responsible for providing values that are consistent with the
11487           supplied date.
11488
11489        4) The model is consistent with the IAU 2000A precession-nutation.
11490
11491        Called:
11492           eraFal03     mean anomaly of the Moon
11493           eraFalp03    mean anomaly of the Sun
11494           eraFaf03     mean argument of the latitude of the Moon
11495           eraFad03     mean elongation of the Moon from the Sun
11496           eraFaom03    mean longitude of the Moon's ascending node
11497           eraFave03    mean longitude of Venus
11498           eraFae03     mean longitude of Earth
11499           eraFapa03    general accumulated precession in longitude
11500
11501        References:
11502
11503           Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
11504           "Expressions for the Celestial Intermediate Pole and Celestial
11505           Ephemeris Origin consistent with the IAU 2000A precession-
11506           nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
11507
11508           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
11509                intermediate origin" (CIO) by IAU 2006 Resolution 2.
11510
11511           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
11512           IERS Technical Note No. 32, BKG (2004)
11513
11514        This revision:  2021 May 11
11515
11516        Copyright (C) 2013-2021, NumFOCUS Foundation.
11517        Derived, with permission, from the SOFA library.  See notes at end of file.
11518
11519    """
11520    c_retval = ufunc.s00(date1, date2, x, y)
11521    return c_retval
11522
11523
11524def s00a(date1, date2):
11525    """
11526    The CIO locator s, positioning the Celestial Intermediate Origin on
11527    the equator of the Celestial Intermediate Pole, using the IAU 2000A
11528    precession-nutation model.
11529
11530    Parameters
11531    ----------
11532    date1 : double array
11533    date2 : double array
11534
11535    Returns
11536    -------
11537    c_retval : double array
11538
11539    Notes
11540    -----
11541    Wraps ERFA function ``eraS00a``. The ERFA documentation is::
11542
11543        - - - - - - - -
11544         e r a S 0 0 a
11545        - - - - - - - -
11546
11547        The CIO locator s, positioning the Celestial Intermediate Origin on
11548        the equator of the Celestial Intermediate Pole, using the IAU 2000A
11549        precession-nutation model.
11550
11551        Given:
11552           date1,date2  double    TT as a 2-part Julian Date (Note 1)
11553
11554        Returned (function value):
11555                        double    the CIO locator s in radians (Note 2)
11556
11557        Notes:
11558
11559        1) The TT date date1+date2 is a Julian Date, apportioned in any
11560           convenient way between the two arguments.  For example,
11561           JD(TT)=2450123.7 could be expressed in any of these ways,
11562           among others:
11563
11564                  date1          date2
11565
11566               2450123.7           0.0       (JD method)
11567               2451545.0       -1421.3       (J2000 method)
11568               2400000.5       50123.2       (MJD method)
11569               2450123.5           0.2       (date & time method)
11570
11571           The JD method is the most natural and convenient to use in
11572           cases where the loss of several decimal digits of resolution
11573           is acceptable.  The J2000 method is best matched to the way
11574           the argument is handled internally and will deliver the
11575           optimum resolution.  The MJD method and the date & time methods
11576           are both good compromises between resolution and convenience.
11577
11578        2) The CIO locator s is the difference between the right ascensions
11579           of the same point in two systems.  The two systems are the GCRS
11580           and the CIP,CIO, and the point is the ascending node of the
11581           CIP equator.  The CIO locator s remains a small fraction of
11582           1 arcsecond throughout 1900-2100.
11583
11584        3) The series used to compute s is in fact for s+XY/2, where X and Y
11585           are the x and y components of the CIP unit vector;  this series
11586           is more compact than a direct series for s would be.  The present
11587           function uses the full IAU 2000A nutation model when predicting
11588           the CIP position.  Faster results, with no significant loss of
11589           accuracy, can be obtained via the function eraS00b, which uses
11590           instead the IAU 2000B truncated model.
11591
11592        Called:
11593           eraPnm00a    classical NPB matrix, IAU 2000A
11594           eraBnp2xy    extract CIP X,Y from the BPN matrix
11595           eraS00       the CIO locator s, given X,Y, IAU 2000A
11596
11597        References:
11598
11599           Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
11600           "Expressions for the Celestial Intermediate Pole and Celestial
11601           Ephemeris Origin consistent with the IAU 2000A precession-
11602           nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
11603
11604           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
11605                intermediate origin" (CIO) by IAU 2006 Resolution 2.
11606
11607           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
11608           IERS Technical Note No. 32, BKG (2004)
11609
11610        This revision:  2021 May 11
11611
11612        Copyright (C) 2013-2021, NumFOCUS Foundation.
11613        Derived, with permission, from the SOFA library.  See notes at end of file.
11614
11615    """
11616    c_retval = ufunc.s00a(date1, date2)
11617    return c_retval
11618
11619
11620def s00b(date1, date2):
11621    """
11622    The CIO locator s, positioning the Celestial Intermediate Origin on
11623    the equator of the Celestial Intermediate Pole, using the IAU 2000B
11624    precession-nutation model.
11625
11626    Parameters
11627    ----------
11628    date1 : double array
11629    date2 : double array
11630
11631    Returns
11632    -------
11633    c_retval : double array
11634
11635    Notes
11636    -----
11637    Wraps ERFA function ``eraS00b``. The ERFA documentation is::
11638
11639        - - - - - - - -
11640         e r a S 0 0 b
11641        - - - - - - - -
11642
11643        The CIO locator s, positioning the Celestial Intermediate Origin on
11644        the equator of the Celestial Intermediate Pole, using the IAU 2000B
11645        precession-nutation model.
11646
11647        Given:
11648           date1,date2  double    TT as a 2-part Julian Date (Note 1)
11649
11650        Returned (function value):
11651                        double    the CIO locator s in radians (Note 2)
11652
11653        Notes:
11654
11655        1) The TT date date1+date2 is a Julian Date, apportioned in any
11656           convenient way between the two arguments.  For example,
11657           JD(TT)=2450123.7 could be expressed in any of these ways,
11658           among others:
11659
11660                  date1          date2
11661
11662               2450123.7           0.0       (JD method)
11663               2451545.0       -1421.3       (J2000 method)
11664               2400000.5       50123.2       (MJD method)
11665               2450123.5           0.2       (date & time method)
11666
11667           The JD method is the most natural and convenient to use in
11668           cases where the loss of several decimal digits of resolution
11669           is acceptable.  The J2000 method is best matched to the way
11670           the argument is handled internally and will deliver the
11671           optimum resolution.  The MJD method and the date & time methods
11672           are both good compromises between resolution and convenience.
11673
11674        2) The CIO locator s is the difference between the right ascensions
11675           of the same point in two systems.  The two systems are the GCRS
11676           and the CIP,CIO, and the point is the ascending node of the
11677           CIP equator.  The CIO locator s remains a small fraction of
11678           1 arcsecond throughout 1900-2100.
11679
11680        3) The series used to compute s is in fact for s+XY/2, where X and Y
11681           are the x and y components of the CIP unit vector;  this series
11682           is more compact than a direct series for s would be.  The present
11683           function uses the IAU 2000B truncated nutation model when
11684           predicting the CIP position.  The function eraS00a uses instead
11685           the full IAU 2000A model, but with no significant increase in
11686           accuracy and at some cost in speed.
11687
11688        Called:
11689           eraPnm00b    classical NPB matrix, IAU 2000B
11690           eraBnp2xy    extract CIP X,Y from the BPN matrix
11691           eraS00       the CIO locator s, given X,Y, IAU 2000A
11692
11693        References:
11694
11695           Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
11696           "Expressions for the Celestial Intermediate Pole and Celestial
11697           Ephemeris Origin consistent with the IAU 2000A precession-
11698           nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
11699
11700           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
11701                intermediate origin" (CIO) by IAU 2006 Resolution 2.
11702
11703           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
11704           IERS Technical Note No. 32, BKG (2004)
11705
11706        This revision:  2021 May 11
11707
11708        Copyright (C) 2013-2021, NumFOCUS Foundation.
11709        Derived, with permission, from the SOFA library.  See notes at end of file.
11710
11711    """
11712    c_retval = ufunc.s00b(date1, date2)
11713    return c_retval
11714
11715
11716def s06(date1, date2, x, y):
11717    """
11718    The CIO locator s, positioning the Celestial Intermediate Origin on
11719    the equator of the Celestial Intermediate Pole, given the CIP's X,Y
11720    coordinates.
11721
11722    Parameters
11723    ----------
11724    date1 : double array
11725    date2 : double array
11726    x : double array
11727    y : double array
11728
11729    Returns
11730    -------
11731    c_retval : double array
11732
11733    Notes
11734    -----
11735    Wraps ERFA function ``eraS06``. The ERFA documentation is::
11736
11737        - - - - - - -
11738         e r a S 0 6
11739        - - - - - - -
11740
11741        The CIO locator s, positioning the Celestial Intermediate Origin on
11742        the equator of the Celestial Intermediate Pole, given the CIP's X,Y
11743        coordinates.  Compatible with IAU 2006/2000A precession-nutation.
11744
11745        Given:
11746           date1,date2   double    TT as a 2-part Julian Date (Note 1)
11747           x,y           double    CIP coordinates (Note 3)
11748
11749        Returned (function value):
11750                         double    the CIO locator s in radians (Note 2)
11751
11752        Notes:
11753
11754        1) The TT date date1+date2 is a Julian Date, apportioned in any
11755           convenient way between the two arguments.  For example,
11756           JD(TT)=2450123.7 could be expressed in any of these ways,
11757           among others:
11758
11759                  date1          date2
11760
11761               2450123.7           0.0       (JD method)
11762               2451545.0       -1421.3       (J2000 method)
11763               2400000.5       50123.2       (MJD method)
11764               2450123.5           0.2       (date & time method)
11765
11766           The JD method is the most natural and convenient to use in
11767           cases where the loss of several decimal digits of resolution
11768           is acceptable.  The J2000 method is best matched to the way
11769           the argument is handled internally and will deliver the
11770           optimum resolution.  The MJD method and the date & time methods
11771           are both good compromises between resolution and convenience.
11772
11773        2) The CIO locator s is the difference between the right ascensions
11774           of the same point in two systems:  the two systems are the GCRS
11775           and the CIP,CIO, and the point is the ascending node of the
11776           CIP equator.  The quantity s remains below 0.1 arcsecond
11777           throughout 1900-2100.
11778
11779        3) The series used to compute s is in fact for s+XY/2, where X and Y
11780           are the x and y components of the CIP unit vector;  this series
11781           is more compact than a direct series for s would be.  This
11782           function requires X,Y to be supplied by the caller, who is
11783           responsible for providing values that are consistent with the
11784           supplied date.
11785
11786        4) The model is consistent with the "P03" precession (Capitaine et
11787           al. 2003), adopted by IAU 2006 Resolution 1, 2006, and the
11788           IAU 2000A nutation (with P03 adjustments).
11789
11790        Called:
11791           eraFal03     mean anomaly of the Moon
11792           eraFalp03    mean anomaly of the Sun
11793           eraFaf03     mean argument of the latitude of the Moon
11794           eraFad03     mean elongation of the Moon from the Sun
11795           eraFaom03    mean longitude of the Moon's ascending node
11796           eraFave03    mean longitude of Venus
11797           eraFae03     mean longitude of Earth
11798           eraFapa03    general accumulated precession in longitude
11799
11800        References:
11801
11802           Capitaine, N., Wallace, P.T. & Chapront, J., 2003, Astron.
11803           Astrophys. 432, 355
11804
11805           McCarthy, D.D., Petit, G. (eds.) 2004, IERS Conventions (2003),
11806           IERS Technical Note No. 32, BKG
11807
11808        This revision:  2021 May 11
11809
11810        Copyright (C) 2013-2021, NumFOCUS Foundation.
11811        Derived, with permission, from the SOFA library.  See notes at end of file.
11812
11813    """
11814    c_retval = ufunc.s06(date1, date2, x, y)
11815    return c_retval
11816
11817
11818def s06a(date1, date2):
11819    """
11820    The CIO locator s, positioning the Celestial Intermediate Origin on
11821    the equator of the Celestial Intermediate Pole, using the IAU 2006
11822    precession and IAU 2000A nutation models.
11823
11824    Parameters
11825    ----------
11826    date1 : double array
11827    date2 : double array
11828
11829    Returns
11830    -------
11831    c_retval : double array
11832
11833    Notes
11834    -----
11835    Wraps ERFA function ``eraS06a``. The ERFA documentation is::
11836
11837        - - - - - - - -
11838         e r a S 0 6 a
11839        - - - - - - - -
11840
11841        The CIO locator s, positioning the Celestial Intermediate Origin on
11842        the equator of the Celestial Intermediate Pole, using the IAU 2006
11843        precession and IAU 2000A nutation models.
11844
11845        Given:
11846           date1,date2  double    TT as a 2-part Julian Date (Note 1)
11847
11848        Returned (function value):
11849                        double    the CIO locator s in radians (Note 2)
11850
11851        Notes:
11852
11853        1) The TT date date1+date2 is a Julian Date, apportioned in any
11854           convenient way between the two arguments.  For example,
11855           JD(TT)=2450123.7 could be expressed in any of these ways,
11856           among others:
11857
11858                  date1          date2
11859
11860               2450123.7           0.0       (JD method)
11861               2451545.0       -1421.3       (J2000 method)
11862               2400000.5       50123.2       (MJD method)
11863               2450123.5           0.2       (date & time method)
11864
11865           The JD method is the most natural and convenient to use in
11866           cases where the loss of several decimal digits of resolution
11867           is acceptable.  The J2000 method is best matched to the way
11868           the argument is handled internally and will deliver the
11869           optimum resolution.  The MJD method and the date & time methods
11870           are both good compromises between resolution and convenience.
11871
11872        2) The CIO locator s is the difference between the right ascensions
11873           of the same point in two systems.  The two systems are the GCRS
11874           and the CIP,CIO, and the point is the ascending node of the
11875           CIP equator.  The CIO locator s remains a small fraction of
11876           1 arcsecond throughout 1900-2100.
11877
11878        3) The series used to compute s is in fact for s+XY/2, where X and Y
11879           are the x and y components of the CIP unit vector;  this series is
11880           more compact than a direct series for s would be.  The present
11881           function uses the full IAU 2000A nutation model when predicting
11882           the CIP position.
11883
11884        Called:
11885           eraPnm06a    classical NPB matrix, IAU 2006/2000A
11886           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
11887           eraS06       the CIO locator s, given X,Y, IAU 2006
11888
11889        References:
11890
11891           Capitaine, N., Chapront, J., Lambert, S. and Wallace, P.,
11892           "Expressions for the Celestial Intermediate Pole and Celestial
11893           Ephemeris Origin consistent with the IAU 2000A precession-
11894           nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
11895
11896           n.b. The celestial ephemeris origin (CEO) was renamed "celestial
11897                intermediate origin" (CIO) by IAU 2006 Resolution 2.
11898
11899           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
11900
11901           McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
11902           IERS Technical Note No. 32, BKG
11903
11904           Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
11905
11906        This revision:  2021 May 11
11907
11908        Copyright (C) 2013-2021, NumFOCUS Foundation.
11909        Derived, with permission, from the SOFA library.  See notes at end of file.
11910
11911    """
11912    c_retval = ufunc.s06a(date1, date2)
11913    return c_retval
11914
11915
11916def sp00(date1, date2):
11917    """
11918    The TIO locator s', positioning the Terrestrial Intermediate Origin
11919    on the equator of the Celestial Intermediate Pole.
11920
11921    Parameters
11922    ----------
11923    date1 : double array
11924    date2 : double array
11925
11926    Returns
11927    -------
11928    c_retval : double array
11929
11930    Notes
11931    -----
11932    Wraps ERFA function ``eraSp00``. The ERFA documentation is::
11933
11934        - - - - - - - -
11935         e r a S p 0 0
11936        - - - - - - - -
11937
11938        The TIO locator s', positioning the Terrestrial Intermediate Origin
11939        on the equator of the Celestial Intermediate Pole.
11940
11941        Given:
11942           date1,date2  double    TT as a 2-part Julian Date (Note 1)
11943
11944        Returned (function value):
11945                        double    the TIO locator s' in radians (Note 2)
11946
11947        Notes:
11948
11949        1) The TT date date1+date2 is a Julian Date, apportioned in any
11950           convenient way between the two arguments.  For example,
11951           JD(TT)=2450123.7 could be expressed in any of these ways,
11952           among others:
11953
11954                  date1          date2
11955
11956               2450123.7           0.0       (JD method)
11957               2451545.0       -1421.3       (J2000 method)
11958               2400000.5       50123.2       (MJD method)
11959               2450123.5           0.2       (date & time method)
11960
11961           The JD method is the most natural and convenient to use in
11962           cases where the loss of several decimal digits of resolution
11963           is acceptable.  The J2000 method is best matched to the way
11964           the argument is handled internally and will deliver the
11965           optimum resolution.  The MJD method and the date & time methods
11966           are both good compromises between resolution and convenience.
11967
11968        2) The TIO locator s' is obtained from polar motion observations by
11969           numerical integration, and so is in essence unpredictable.
11970           However, it is dominated by a secular drift of about
11971           47 microarcseconds per century, which is the approximation
11972           evaluated by the present function.
11973
11974        Reference:
11975
11976           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
11977           IERS Technical Note No. 32, BKG (2004)
11978
11979        This revision:  2021 May 11
11980
11981        Copyright (C) 2013-2021, NumFOCUS Foundation.
11982        Derived, with permission, from the SOFA library.  See notes at end of file.
11983
11984    """
11985    c_retval = ufunc.sp00(date1, date2)
11986    return c_retval
11987
11988
11989def xy06(date1, date2):
11990    """
11991    X,Y coordinates of celestial intermediate pole from series based
11992    on IAU 2006 precession and IAU 2000A nutation.
11993
11994    Parameters
11995    ----------
11996    date1 : double array
11997    date2 : double array
11998
11999    Returns
12000    -------
12001    x : double array
12002    y : double array
12003
12004    Notes
12005    -----
12006    Wraps ERFA function ``eraXy06``. The ERFA documentation is::
12007
12008        - - - - - - - -
12009         e r a X y 0 6
12010        - - - - - - - -
12011
12012        X,Y coordinates of celestial intermediate pole from series based
12013        on IAU 2006 precession and IAU 2000A nutation.
12014
12015        Given:
12016           date1,date2  double     TT as a 2-part Julian Date (Note 1)
12017
12018        Returned:
12019           x,y          double     CIP X,Y coordinates (Note 2)
12020
12021        Notes:
12022
12023        1) The TT date date1+date2 is a Julian Date, apportioned in any
12024           convenient way between the two arguments.  For example,
12025           JD(TT)=2450123.7 could be expressed in any of these ways,
12026           among others:
12027
12028                  date1          date2
12029
12030               2450123.7           0.0       (JD method)
12031               2451545.0       -1421.3       (J2000 method)
12032               2400000.5       50123.2       (MJD method)
12033               2450123.5           0.2       (date & time method)
12034
12035           The JD method is the most natural and convenient to use in
12036           cases where the loss of several decimal digits of resolution
12037           is acceptable.  The J2000 method is best matched to the way
12038           the argument is handled internally and will deliver the
12039           optimum resolution.  The MJD method and the date & time methods
12040           are both good compromises between resolution and convenience.
12041
12042        2) The X,Y coordinates are those of the unit vector towards the
12043           celestial intermediate pole.  They represent the combined effects
12044           of frame bias, precession and nutation.
12045
12046        3) The fundamental arguments used are as adopted in IERS Conventions
12047           (2003) and are from Simon et al. (1994) and Souchay et al.
12048           (1999).
12049
12050        4) This is an alternative to the angles-based method, via the ERFA
12051           function eraFw2xy and as used in eraXys06a for example.  The two
12052           methods agree at the 1 microarcsecond level (at present), a
12053           negligible amount compared with the intrinsic accuracy of the
12054           models.  However, it would be unwise to mix the two methods
12055           (angles-based and series-based) in a single application.
12056
12057        Called:
12058           eraFal03     mean anomaly of the Moon
12059           eraFalp03    mean anomaly of the Sun
12060           eraFaf03     mean argument of the latitude of the Moon
12061           eraFad03     mean elongation of the Moon from the Sun
12062           eraFaom03    mean longitude of the Moon's ascending node
12063           eraFame03    mean longitude of Mercury
12064           eraFave03    mean longitude of Venus
12065           eraFae03     mean longitude of Earth
12066           eraFama03    mean longitude of Mars
12067           eraFaju03    mean longitude of Jupiter
12068           eraFasa03    mean longitude of Saturn
12069           eraFaur03    mean longitude of Uranus
12070           eraFane03    mean longitude of Neptune
12071           eraFapa03    general accumulated precession in longitude
12072
12073        References:
12074
12075           Capitaine, N., Wallace, P.T. & Chapront, J., 2003,
12076           Astron.Astrophys., 412, 567
12077
12078           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
12079
12080           McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
12081           IERS Technical Note No. 32, BKG
12082
12083           Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
12084           Francou, G. & Laskar, J., Astron.Astrophys., 1994, 282, 663
12085
12086           Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M., 1999,
12087           Astron.Astrophys.Supp.Ser. 135, 111
12088
12089           Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
12090
12091        This revision:  2021 May 11
12092
12093        Copyright (C) 2013-2021, NumFOCUS Foundation.
12094        Derived, with permission, from the SOFA library.  See notes at end of file.
12095
12096    """
12097    x, y = ufunc.xy06(date1, date2)
12098    return x, y
12099
12100
12101def xys00a(date1, date2):
12102    """
12103    For a given TT date, compute the X,Y coordinates of the Celestial
12104    Intermediate Pole and the CIO locator s, using the IAU 2000A
12105    precession-nutation model.
12106
12107    Parameters
12108    ----------
12109    date1 : double array
12110    date2 : double array
12111
12112    Returns
12113    -------
12114    x : double array
12115    y : double array
12116    s : double array
12117
12118    Notes
12119    -----
12120    Wraps ERFA function ``eraXys00a``. The ERFA documentation is::
12121
12122        - - - - - - - - - -
12123         e r a X y s 0 0 a
12124        - - - - - - - - - -
12125
12126        For a given TT date, compute the X,Y coordinates of the Celestial
12127        Intermediate Pole and the CIO locator s, using the IAU 2000A
12128        precession-nutation model.
12129
12130        Given:
12131           date1,date2  double   TT as a 2-part Julian Date (Note 1)
12132
12133        Returned:
12134           x,y          double   Celestial Intermediate Pole (Note 2)
12135           s            double   the CIO locator s (Note 3)
12136
12137        Notes:
12138
12139        1) The TT date date1+date2 is a Julian Date, apportioned in any
12140           convenient way between the two arguments.  For example,
12141           JD(TT)=2450123.7 could be expressed in any of these ways,
12142           among others:
12143
12144                  date1          date2
12145
12146               2450123.7           0.0       (JD method)
12147               2451545.0       -1421.3       (J2000 method)
12148               2400000.5       50123.2       (MJD method)
12149               2450123.5           0.2       (date & time method)
12150
12151           The JD method is the most natural and convenient to use in
12152           cases where the loss of several decimal digits of resolution
12153           is acceptable.  The J2000 method is best matched to the way
12154           the argument is handled internally and will deliver the
12155           optimum resolution.  The MJD method and the date & time methods
12156           are both good compromises between resolution and convenience.
12157
12158        2) The Celestial Intermediate Pole coordinates are the x,y
12159           components of the unit vector in the Geocentric Celestial
12160           Reference System.
12161
12162        3) The CIO locator s (in radians) positions the Celestial
12163           Intermediate Origin on the equator of the CIP.
12164
12165        4) A faster, but slightly less accurate result (about 1 mas for
12166           X,Y), can be obtained by using instead the eraXys00b function.
12167
12168        Called:
12169           eraPnm00a    classical NPB matrix, IAU 2000A
12170           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
12171           eraS00       the CIO locator s, given X,Y, IAU 2000A
12172
12173        Reference:
12174
12175           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
12176           IERS Technical Note No. 32, BKG (2004)
12177
12178        This revision:  2021 May 11
12179
12180        Copyright (C) 2013-2021, NumFOCUS Foundation.
12181        Derived, with permission, from the SOFA library.  See notes at end of file.
12182
12183    """
12184    x, y, s = ufunc.xys00a(date1, date2)
12185    return x, y, s
12186
12187
12188def xys00b(date1, date2):
12189    """
12190    For a given TT date, compute the X,Y coordinates of the Celestial
12191    Intermediate Pole and the CIO locator s, using the IAU 2000B
12192    precession-nutation model.
12193
12194    Parameters
12195    ----------
12196    date1 : double array
12197    date2 : double array
12198
12199    Returns
12200    -------
12201    x : double array
12202    y : double array
12203    s : double array
12204
12205    Notes
12206    -----
12207    Wraps ERFA function ``eraXys00b``. The ERFA documentation is::
12208
12209        - - - - - - - - - -
12210         e r a X y s 0 0 b
12211        - - - - - - - - - -
12212
12213        For a given TT date, compute the X,Y coordinates of the Celestial
12214        Intermediate Pole and the CIO locator s, using the IAU 2000B
12215        precession-nutation model.
12216
12217        Given:
12218           date1,date2  double   TT as a 2-part Julian Date (Note 1)
12219
12220        Returned:
12221           x,y          double   Celestial Intermediate Pole (Note 2)
12222           s            double   the CIO locator s (Note 3)
12223
12224        Notes:
12225
12226        1) The TT date date1+date2 is a Julian Date, apportioned in any
12227           convenient way between the two arguments.  For example,
12228           JD(TT)=2450123.7 could be expressed in any of these ways,
12229           among others:
12230
12231                  date1          date2
12232
12233               2450123.7           0.0       (JD method)
12234               2451545.0       -1421.3       (J2000 method)
12235               2400000.5       50123.2       (MJD method)
12236               2450123.5           0.2       (date & time method)
12237
12238           The JD method is the most natural and convenient to use in
12239           cases where the loss of several decimal digits of resolution
12240           is acceptable.  The J2000 method is best matched to the way
12241           the argument is handled internally and will deliver the
12242           optimum resolution.  The MJD method and the date & time methods
12243           are both good compromises between resolution and convenience.
12244
12245        2) The Celestial Intermediate Pole coordinates are the x,y
12246           components of the unit vector in the Geocentric Celestial
12247           Reference System.
12248
12249        3) The CIO locator s (in radians) positions the Celestial
12250           Intermediate Origin on the equator of the CIP.
12251
12252        4) The present function is faster, but slightly less accurate (about
12253           1 mas in X,Y), than the eraXys00a function.
12254
12255        Called:
12256           eraPnm00b    classical NPB matrix, IAU 2000B
12257           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
12258           eraS00       the CIO locator s, given X,Y, IAU 2000A
12259
12260        Reference:
12261
12262           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
12263           IERS Technical Note No. 32, BKG (2004)
12264
12265        This revision:  2021 May 11
12266
12267        Copyright (C) 2013-2021, NumFOCUS Foundation.
12268        Derived, with permission, from the SOFA library.  See notes at end of file.
12269
12270    """
12271    x, y, s = ufunc.xys00b(date1, date2)
12272    return x, y, s
12273
12274
12275def xys06a(date1, date2):
12276    """
12277    For a given TT date, compute the X,Y coordinates of the Celestial
12278    Intermediate Pole and the CIO locator s, using the IAU 2006
12279    precession and IAU 2000A nutation models.
12280
12281    Parameters
12282    ----------
12283    date1 : double array
12284    date2 : double array
12285
12286    Returns
12287    -------
12288    x : double array
12289    y : double array
12290    s : double array
12291
12292    Notes
12293    -----
12294    Wraps ERFA function ``eraXys06a``. The ERFA documentation is::
12295
12296        - - - - - - - - - -
12297         e r a X y s 0 6 a
12298        - - - - - - - - - -
12299
12300        For a given TT date, compute the X,Y coordinates of the Celestial
12301        Intermediate Pole and the CIO locator s, using the IAU 2006
12302        precession and IAU 2000A nutation models.
12303
12304        Given:
12305           date1,date2  double  TT as a 2-part Julian Date (Note 1)
12306
12307        Returned:
12308           x,y          double  Celestial Intermediate Pole (Note 2)
12309           s            double  the CIO locator s (Note 3)
12310
12311        Notes:
12312
12313        1) The TT date date1+date2 is a Julian Date, apportioned in any
12314           convenient way between the two arguments.  For example,
12315           JD(TT)=2450123.7 could be expressed in any of these ways,
12316           among others:
12317
12318                  date1          date2
12319
12320               2450123.7           0.0       (JD method)
12321               2451545.0       -1421.3       (J2000 method)
12322               2400000.5       50123.2       (MJD method)
12323               2450123.5           0.2       (date & time method)
12324
12325           The JD method is the most natural and convenient to use in
12326           cases where the loss of several decimal digits of resolution
12327           is acceptable.  The J2000 method is best matched to the way
12328           the argument is handled internally and will deliver the
12329           optimum resolution.  The MJD method and the date & time methods
12330           are both good compromises between resolution and convenience.
12331
12332        2) The Celestial Intermediate Pole coordinates are the x,y components
12333           of the unit vector in the Geocentric Celestial Reference System.
12334
12335        3) The CIO locator s (in radians) positions the Celestial
12336           Intermediate Origin on the equator of the CIP.
12337
12338        4) Series-based solutions for generating X and Y are also available:
12339           see Capitaine & Wallace (2006) and eraXy06.
12340
12341        Called:
12342           eraPnm06a    classical NPB matrix, IAU 2006/2000A
12343           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
12344           eraS06       the CIO locator s, given X,Y, IAU 2006
12345
12346        References:
12347
12348           Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
12349
12350           Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
12351
12352        This revision:  2021 May 11
12353
12354        Copyright (C) 2013-2021, NumFOCUS Foundation.
12355        Derived, with permission, from the SOFA library.  See notes at end of file.
12356
12357    """
12358    x, y, s = ufunc.xys06a(date1, date2)
12359    return x, y, s
12360
12361
12362def ee00(date1, date2, epsa, dpsi):
12363    """
12364    The equation of the equinoxes, compatible with IAU 2000 resolutions,
12365    given the nutation in longitude and the mean obliquity.
12366
12367    Parameters
12368    ----------
12369    date1 : double array
12370    date2 : double array
12371    epsa : double array
12372    dpsi : double array
12373
12374    Returns
12375    -------
12376    c_retval : double array
12377
12378    Notes
12379    -----
12380    Wraps ERFA function ``eraEe00``. The ERFA documentation is::
12381
12382        - - - - - - - -
12383         e r a E e 0 0
12384        - - - - - - - -
12385
12386        The equation of the equinoxes, compatible with IAU 2000 resolutions,
12387        given the nutation in longitude and the mean obliquity.
12388
12389        Given:
12390           date1,date2  double    TT as a 2-part Julian Date (Note 1)
12391           epsa         double    mean obliquity (Note 2)
12392           dpsi         double    nutation in longitude (Note 3)
12393
12394        Returned (function value):
12395                        double    equation of the equinoxes (Note 4)
12396
12397        Notes:
12398
12399        1) The TT date date1+date2 is a Julian Date, apportioned in any
12400           convenient way between the two arguments.  For example,
12401           JD(TT)=2450123.7 could be expressed in any of these ways,
12402           among others:
12403
12404                  date1          date2
12405
12406               2450123.7           0.0       (JD method)
12407               2451545.0       -1421.3       (J2000 method)
12408               2400000.5       50123.2       (MJD method)
12409               2450123.5           0.2       (date & time method)
12410
12411           The JD method is the most natural and convenient to use in
12412           cases where the loss of several decimal digits of resolution
12413           is acceptable.  The J2000 method is best matched to the way
12414           the argument is handled internally and will deliver the
12415           optimum resolution.  The MJD method and the date & time methods
12416           are both good compromises between resolution and convenience.
12417
12418        2) The obliquity, in radians, is mean of date.
12419
12420        3) The result, which is in radians, operates in the following sense:
12421
12422              Greenwich apparent ST = GMST + equation of the equinoxes
12423
12424        4) The result is compatible with the IAU 2000 resolutions.  For
12425           further details, see IERS Conventions 2003 and Capitaine et al.
12426           (2002).
12427
12428        Called:
12429           eraEect00    equation of the equinoxes complementary terms
12430
12431        References:
12432
12433           Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
12434           implement the IAU 2000 definition of UT1", Astronomy &
12435           Astrophysics, 406, 1135-1149 (2003)
12436
12437           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
12438           IERS Technical Note No. 32, BKG (2004)
12439
12440        This revision:  2021 May 11
12441
12442        Copyright (C) 2013-2021, NumFOCUS Foundation.
12443        Derived, with permission, from the SOFA library.  See notes at end of file.
12444
12445    """
12446    c_retval = ufunc.ee00(date1, date2, epsa, dpsi)
12447    return c_retval
12448
12449
12450def ee00a(date1, date2):
12451    """
12452    Equation of the equinoxes, compatible with IAU 2000 resolutions.
12453
12454    Parameters
12455    ----------
12456    date1 : double array
12457    date2 : double array
12458
12459    Returns
12460    -------
12461    c_retval : double array
12462
12463    Notes
12464    -----
12465    Wraps ERFA function ``eraEe00a``. The ERFA documentation is::
12466
12467        - - - - - - - - -
12468         e r a E e 0 0 a
12469        - - - - - - - - -
12470
12471        Equation of the equinoxes, compatible with IAU 2000 resolutions.
12472
12473        Given:
12474           date1,date2  double    TT as a 2-part Julian Date (Note 1)
12475
12476        Returned (function value):
12477                        double    equation of the equinoxes (Note 2)
12478
12479        Notes:
12480
12481        1) The TT date date1+date2 is a Julian Date, apportioned in any
12482           convenient way between the two arguments.  For example,
12483           JD(TT)=2450123.7 could be expressed in any of these ways,
12484           among others:
12485
12486                  date1          date2
12487
12488               2450123.7           0.0       (JD method)
12489               2451545.0       -1421.3       (J2000 method)
12490               2400000.5       50123.2       (MJD method)
12491               2450123.5           0.2       (date & time method)
12492
12493           The JD method is the most natural and convenient to use in
12494           cases where the loss of several decimal digits of resolution
12495           is acceptable.  The J2000 method is best matched to the way
12496           the argument is handled internally and will deliver the
12497           optimum resolution.  The MJD method and the date & time methods
12498           are both good compromises between resolution and convenience.
12499
12500        2) The result, which is in radians, operates in the following sense:
12501
12502              Greenwich apparent ST = GMST + equation of the equinoxes
12503
12504        3) The result is compatible with the IAU 2000 resolutions.  For
12505           further details, see IERS Conventions 2003 and Capitaine et al.
12506           (2002).
12507
12508        Called:
12509           eraPr00      IAU 2000 precession adjustments
12510           eraObl80     mean obliquity, IAU 1980
12511           eraNut00a    nutation, IAU 2000A
12512           eraEe00      equation of the equinoxes, IAU 2000
12513
12514        References:
12515
12516           Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
12517           implement the IAU 2000 definition of UT1", Astronomy &
12518           Astrophysics, 406, 1135-1149 (2003).
12519
12520           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
12521           IERS Technical Note No. 32, BKG (2004).
12522
12523        This revision:  2021 May 11
12524
12525        Copyright (C) 2013-2021, NumFOCUS Foundation.
12526        Derived, with permission, from the SOFA library.  See notes at end of file.
12527
12528    """
12529    c_retval = ufunc.ee00a(date1, date2)
12530    return c_retval
12531
12532
12533def ee00b(date1, date2):
12534    """
12535    Equation of the equinoxes, compatible with IAU 2000 resolutions but
12536    using the truncated nutation model IAU 2000B.
12537
12538    Parameters
12539    ----------
12540    date1 : double array
12541    date2 : double array
12542
12543    Returns
12544    -------
12545    c_retval : double array
12546
12547    Notes
12548    -----
12549    Wraps ERFA function ``eraEe00b``. The ERFA documentation is::
12550
12551        - - - - - - - - -
12552         e r a E e 0 0 b
12553        - - - - - - - - -
12554
12555        Equation of the equinoxes, compatible with IAU 2000 resolutions but
12556        using the truncated nutation model IAU 2000B.
12557
12558        Given:
12559           date1,date2  double    TT as a 2-part Julian Date (Note 1)
12560
12561        Returned (function value):
12562                        double    equation of the equinoxes (Note 2)
12563
12564        Notes:
12565
12566        1) The TT date date1+date2 is a Julian Date, apportioned in any
12567           convenient way between the two arguments.  For example,
12568           JD(TT)=2450123.7 could be expressed in any of these ways,
12569           among others:
12570
12571                  date1          date2
12572
12573               2450123.7           0.0       (JD method)
12574               2451545.0       -1421.3       (J2000 method)
12575               2400000.5       50123.2       (MJD method)
12576               2450123.5           0.2       (date & time method)
12577
12578           The JD method is the most natural and convenient to use in
12579           cases where the loss of several decimal digits of resolution
12580           is acceptable.  The J2000 method is best matched to the way
12581           the argument is handled internally and will deliver the
12582           optimum resolution.  The MJD method and the date & time methods
12583           are both good compromises between resolution and convenience.
12584
12585        2) The result, which is in radians, operates in the following sense:
12586
12587              Greenwich apparent ST = GMST + equation of the equinoxes
12588
12589        3) The result is compatible with the IAU 2000 resolutions except
12590           that accuracy has been compromised (1 mas) for the sake of speed.
12591           For further details, see McCarthy & Luzum (2003), IERS
12592           Conventions 2003 and Capitaine et al. (2003).
12593
12594        Called:
12595           eraPr00      IAU 2000 precession adjustments
12596           eraObl80     mean obliquity, IAU 1980
12597           eraNut00b    nutation, IAU 2000B
12598           eraEe00      equation of the equinoxes, IAU 2000
12599
12600        References:
12601
12602           Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
12603           implement the IAU 2000 definition of UT1", Astronomy &
12604           Astrophysics, 406, 1135-1149 (2003)
12605
12606           McCarthy, D.D. & Luzum, B.J., "An abridged model of the
12607           precession-nutation of the celestial pole", Celestial Mechanics &
12608           Dynamical Astronomy, 85, 37-49 (2003)
12609
12610           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
12611           IERS Technical Note No. 32, BKG (2004)
12612
12613        This revision:  2021 May 11
12614
12615        Copyright (C) 2013-2021, NumFOCUS Foundation.
12616        Derived, with permission, from the SOFA library.  See notes at end of file.
12617
12618    """
12619    c_retval = ufunc.ee00b(date1, date2)
12620    return c_retval
12621
12622
12623def ee06a(date1, date2):
12624    """
12625    Equation of the equinoxes, compatible with IAU 2000 resolutions and
12626    IAU 2006/2000A precession-nutation.
12627
12628    Parameters
12629    ----------
12630    date1 : double array
12631    date2 : double array
12632
12633    Returns
12634    -------
12635    c_retval : double array
12636
12637    Notes
12638    -----
12639    Wraps ERFA function ``eraEe06a``. The ERFA documentation is::
12640
12641        - - - - - - - - -
12642         e r a E e 0 6 a
12643        - - - - - - - - -
12644
12645        Equation of the equinoxes, compatible with IAU 2000 resolutions and
12646        IAU 2006/2000A precession-nutation.
12647
12648        Given:
12649           date1,date2  double    TT as a 2-part Julian Date (Note 1)
12650
12651        Returned (function value):
12652                        double    equation of the equinoxes (Note 2)
12653
12654        Notes:
12655
12656        1) The TT date date1+date2 is a Julian Date, apportioned in any
12657           convenient way between the two arguments.  For example,
12658           JD(TT)=2450123.7 could be expressed in any of these ways,
12659           among others:
12660
12661                  date1          date2
12662
12663               2450123.7           0.0       (JD method)
12664               2451545.0       -1421.3       (J2000 method)
12665               2400000.5       50123.2       (MJD method)
12666               2450123.5           0.2       (date & time method)
12667
12668           The JD method is the most natural and convenient to use in
12669           cases where the loss of several decimal digits of resolution
12670           is acceptable.  The J2000 method is best matched to the way
12671           the argument is handled internally and will deliver the
12672           optimum resolution.  The MJD method and the date & time methods
12673           are both good compromises between resolution and convenience.
12674
12675        2) The result, which is in radians, operates in the following sense:
12676
12677              Greenwich apparent ST = GMST + equation of the equinoxes
12678
12679        Called:
12680           eraAnpm      normalize angle into range +/- pi
12681           eraGst06a    Greenwich apparent sidereal time, IAU 2006/2000A
12682           eraGmst06    Greenwich mean sidereal time, IAU 2006
12683
12684        Reference:
12685
12686           McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
12687           IERS Technical Note No. 32, BKG
12688
12689        This revision:  2021 May 11
12690
12691        Copyright (C) 2013-2021, NumFOCUS Foundation.
12692        Derived, with permission, from the SOFA library.  See notes at end of file.
12693
12694    """
12695    c_retval = ufunc.ee06a(date1, date2)
12696    return c_retval
12697
12698
12699def eect00(date1, date2):
12700    """
12701    Equation of the equinoxes complementary terms, consistent with
12702    IAU 2000 resolutions.
12703
12704    Parameters
12705    ----------
12706    date1 : double array
12707    date2 : double array
12708
12709    Returns
12710    -------
12711    c_retval : double array
12712
12713    Notes
12714    -----
12715    Wraps ERFA function ``eraEect00``. The ERFA documentation is::
12716
12717        - - - - - - - - - -
12718         e r a E e c t 0 0
12719        - - - - - - - - - -
12720
12721        Equation of the equinoxes complementary terms, consistent with
12722        IAU 2000 resolutions.
12723
12724        Given:
12725           date1,date2  double   TT as a 2-part Julian Date (Note 1)
12726
12727        Returned (function value):
12728                        double   complementary terms (Note 2)
12729
12730        Notes:
12731
12732        1) The TT date date1+date2 is a Julian Date, apportioned in any
12733           convenient way between the two arguments.  For example,
12734           JD(TT)=2450123.7 could be expressed in any of these ways,
12735           among others:
12736
12737                  date1          date2
12738
12739               2450123.7           0.0       (JD method)
12740               2451545.0       -1421.3       (J2000 method)
12741               2400000.5       50123.2       (MJD method)
12742               2450123.5           0.2       (date & time method)
12743
12744           The JD method is the most natural and convenient to use in
12745           cases where the loss of several decimal digits of resolution
12746           is acceptable.  The J2000 method is best matched to the way
12747           the argument is handled internally and will deliver the
12748           optimum resolution.  The MJD method and the date & time methods
12749           are both good compromises between resolution and convenience.
12750
12751        2) The "complementary terms" are part of the equation of the
12752           equinoxes (EE), classically the difference between apparent and
12753           mean Sidereal Time:
12754
12755              GAST = GMST + EE
12756
12757           with:
12758
12759              EE = dpsi * cos(eps)
12760
12761           where dpsi is the nutation in longitude and eps is the obliquity
12762           of date.  However, if the rotation of the Earth were constant in
12763           an inertial frame the classical formulation would lead to
12764           apparent irregularities in the UT1 timescale traceable to side-
12765           effects of precession-nutation.  In order to eliminate these
12766           effects from UT1, "complementary terms" were introduced in 1994
12767           (IAU, 1994) and took effect from 1997 (Capitaine and Gontier,
12768           1993):
12769
12770              GAST = GMST + CT + EE
12771
12772           By convention, the complementary terms are included as part of
12773           the equation of the equinoxes rather than as part of the mean
12774           Sidereal Time.  This slightly compromises the "geometrical"
12775           interpretation of mean sidereal time but is otherwise
12776           inconsequential.
12777
12778           The present function computes CT in the above expression,
12779           compatible with IAU 2000 resolutions (Capitaine et al., 2002, and
12780           IERS Conventions 2003).
12781
12782        Called:
12783           eraFal03     mean anomaly of the Moon
12784           eraFalp03    mean anomaly of the Sun
12785           eraFaf03     mean argument of the latitude of the Moon
12786           eraFad03     mean elongation of the Moon from the Sun
12787           eraFaom03    mean longitude of the Moon's ascending node
12788           eraFave03    mean longitude of Venus
12789           eraFae03     mean longitude of Earth
12790           eraFapa03    general accumulated precession in longitude
12791
12792        References:
12793
12794           Capitaine, N. & Gontier, A.-M., Astron.Astrophys., 275,
12795           645-650 (1993)
12796
12797           Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
12798           implement the IAU 2000 definition of UT1", Astron.Astrophys., 406,
12799           1135-1149 (2003)
12800
12801           IAU Resolution C7, Recommendation 3 (1994)
12802
12803           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
12804           IERS Technical Note No. 32, BKG (2004)
12805
12806        This revision:  2021 May 11
12807
12808        Copyright (C) 2013-2021, NumFOCUS Foundation.
12809        Derived, with permission, from the SOFA library.  See notes at end of file.
12810
12811    """
12812    c_retval = ufunc.eect00(date1, date2)
12813    return c_retval
12814
12815
12816def eqeq94(date1, date2):
12817    """
12818    Equation of the equinoxes, IAU 1994 model.
12819
12820    Parameters
12821    ----------
12822    date1 : double array
12823    date2 : double array
12824
12825    Returns
12826    -------
12827    c_retval : double array
12828
12829    Notes
12830    -----
12831    Wraps ERFA function ``eraEqeq94``. The ERFA documentation is::
12832
12833        - - - - - - - - - -
12834         e r a E q e q 9 4
12835        - - - - - - - - - -
12836
12837        Equation of the equinoxes, IAU 1994 model.
12838
12839        Given:
12840           date1,date2   double     TDB date (Note 1)
12841
12842        Returned (function value):
12843                         double     equation of the equinoxes (Note 2)
12844
12845        Notes:
12846
12847        1) The date date1+date2 is a Julian Date, apportioned in any
12848           convenient way between the two arguments.  For example,
12849           JD(TT)=2450123.7 could be expressed in any of these ways,
12850           among others:
12851
12852                  date1          date2
12853
12854               2450123.7           0.0       (JD method)
12855               2451545.0       -1421.3       (J2000 method)
12856               2400000.5       50123.2       (MJD method)
12857               2450123.5           0.2       (date & time method)
12858
12859           The JD method is the most natural and convenient to use in
12860           cases where the loss of several decimal digits of resolution
12861           is acceptable.  The J2000 method is best matched to the way
12862           the argument is handled internally and will deliver the
12863           optimum resolution.  The MJD method and the date & time methods
12864           are both good compromises between resolution and convenience.
12865
12866        2) The result, which is in radians, operates in the following sense:
12867
12868              Greenwich apparent ST = GMST + equation of the equinoxes
12869
12870        Called:
12871           eraAnpm      normalize angle into range +/- pi
12872           eraNut80     nutation, IAU 1980
12873           eraObl80     mean obliquity, IAU 1980
12874
12875        References:
12876
12877           IAU Resolution C7, Recommendation 3 (1994).
12878
12879           Capitaine, N. & Gontier, A.-M., 1993, Astron.Astrophys., 275,
12880           645-650.
12881
12882        This revision:  2021 May 11
12883
12884        Copyright (C) 2013-2021, NumFOCUS Foundation.
12885        Derived, with permission, from the SOFA library.  See notes at end of file.
12886
12887    """
12888    c_retval = ufunc.eqeq94(date1, date2)
12889    return c_retval
12890
12891
12892def era00(dj1, dj2):
12893    """
12894    Earth rotation angle (IAU 2000 model).
12895
12896    Parameters
12897    ----------
12898    dj1 : double array
12899    dj2 : double array
12900
12901    Returns
12902    -------
12903    c_retval : double array
12904
12905    Notes
12906    -----
12907    Wraps ERFA function ``eraEra00``. The ERFA documentation is::
12908
12909        - - - - - - - - -
12910         e r a E r a 0 0
12911        - - - - - - - - -
12912
12913        Earth rotation angle (IAU 2000 model).
12914
12915        Given:
12916           dj1,dj2   double    UT1 as a 2-part Julian Date (see note)
12917
12918        Returned (function value):
12919                     double    Earth rotation angle (radians), range 0-2pi
12920
12921        Notes:
12922
12923        1) The UT1 date dj1+dj2 is a Julian Date, apportioned in any
12924           convenient way between the arguments dj1 and dj2.  For example,
12925           JD(UT1)=2450123.7 could be expressed in any of these ways,
12926           among others:
12927
12928                   dj1            dj2
12929
12930               2450123.7           0.0       (JD method)
12931               2451545.0       -1421.3       (J2000 method)
12932               2400000.5       50123.2       (MJD method)
12933               2450123.5           0.2       (date & time method)
12934
12935           The JD method is the most natural and convenient to use in
12936           cases where the loss of several decimal digits of resolution
12937           is acceptable.  The J2000 and MJD methods are good compromises
12938           between resolution and convenience.  The date & time method is
12939           best matched to the algorithm used:  maximum precision is
12940           delivered when the dj1 argument is for 0hrs UT1 on the day in
12941           question and the dj2 argument lies in the range 0 to 1, or vice
12942           versa.
12943
12944        2) The algorithm is adapted from Expression 22 of Capitaine et al.
12945           2000.  The time argument has been expressed in days directly,
12946           and, to retain precision, integer contributions have been
12947           eliminated.  The same formulation is given in IERS Conventions
12948           (2003), Chap. 5, Eq. 14.
12949
12950        Called:
12951           eraAnp       normalize angle into range 0 to 2pi
12952
12953        References:
12954
12955           Capitaine N., Guinot B. and McCarthy D.D, 2000, Astron.
12956           Astrophys., 355, 398-405.
12957
12958           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
12959           IERS Technical Note No. 32, BKG (2004)
12960
12961        This revision:  2021 May 11
12962
12963        Copyright (C) 2013-2021, NumFOCUS Foundation.
12964        Derived, with permission, from the SOFA library.  See notes at end of file.
12965
12966    """
12967    c_retval = ufunc.era00(dj1, dj2)
12968    return c_retval
12969
12970
12971def gmst00(uta, utb, tta, ttb):
12972    """
12973    Greenwich mean sidereal time (model consistent with IAU 2000
12974    resolutions).
12975
12976    Parameters
12977    ----------
12978    uta : double array
12979    utb : double array
12980    tta : double array
12981    ttb : double array
12982
12983    Returns
12984    -------
12985    c_retval : double array
12986
12987    Notes
12988    -----
12989    Wraps ERFA function ``eraGmst00``. The ERFA documentation is::
12990
12991        - - - - - - - - - -
12992         e r a G m s t 0 0
12993        - - - - - - - - - -
12994
12995        Greenwich mean sidereal time (model consistent with IAU 2000
12996        resolutions).
12997
12998        Given:
12999           uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
13000           tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)
13001
13002        Returned (function value):
13003                      double    Greenwich mean sidereal time (radians)
13004
13005        Notes:
13006
13007        1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
13008           Julian Dates, apportioned in any convenient way between the
13009           argument pairs.  For example, JD(UT1)=2450123.7 could be
13010           expressed in any of these ways, among others:
13011
13012                  Part A         Part B
13013
13014               2450123.7           0.0       (JD method)
13015               2451545.0       -1421.3       (J2000 method)
13016               2400000.5       50123.2       (MJD method)
13017               2450123.5           0.2       (date & time method)
13018
13019           The JD method is the most natural and convenient to use in
13020           cases where the loss of several decimal digits of resolution
13021           is acceptable (in the case of UT;  the TT is not at all critical
13022           in this respect).  The J2000 and MJD methods are good compromises
13023           between resolution and convenience.  For UT, the date & time
13024           method is best matched to the algorithm that is used by the Earth
13025           Rotation Angle function, called internally:  maximum precision is
13026           delivered when the uta argument is for 0hrs UT1 on the day in
13027           question and the utb argument lies in the range 0 to 1, or vice
13028           versa.
13029
13030        2) Both UT1 and TT are required, UT1 to predict the Earth rotation
13031           and TT to predict the effects of precession.  If UT1 is used for
13032           both purposes, errors of order 100 microarcseconds result.
13033
13034        3) This GMST is compatible with the IAU 2000 resolutions and must be
13035           used only in conjunction with other IAU 2000 compatible
13036           components such as precession-nutation and equation of the
13037           equinoxes.
13038
13039        4) The result is returned in the range 0 to 2pi.
13040
13041        5) The algorithm is from Capitaine et al. (2003) and IERS
13042           Conventions 2003.
13043
13044        Called:
13045           eraEra00     Earth rotation angle, IAU 2000
13046           eraAnp       normalize angle into range 0 to 2pi
13047
13048        References:
13049
13050           Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
13051           implement the IAU 2000 definition of UT1", Astronomy &
13052           Astrophysics, 406, 1135-1149 (2003)
13053
13054           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
13055           IERS Technical Note No. 32, BKG (2004)
13056
13057        This revision:  2021 May 11
13058
13059        Copyright (C) 2013-2021, NumFOCUS Foundation.
13060        Derived, with permission, from the SOFA library.  See notes at end of file.
13061
13062    """
13063    c_retval = ufunc.gmst00(uta, utb, tta, ttb)
13064    return c_retval
13065
13066
13067def gmst06(uta, utb, tta, ttb):
13068    """
13069    Greenwich mean sidereal time (consistent with IAU 2006 precession).
13070
13071    Parameters
13072    ----------
13073    uta : double array
13074    utb : double array
13075    tta : double array
13076    ttb : double array
13077
13078    Returns
13079    -------
13080    c_retval : double array
13081
13082    Notes
13083    -----
13084    Wraps ERFA function ``eraGmst06``. The ERFA documentation is::
13085
13086        - - - - - - - - - -
13087         e r a G m s t 0 6
13088        - - - - - - - - - -
13089
13090        Greenwich mean sidereal time (consistent with IAU 2006 precession).
13091
13092        Given:
13093           uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
13094           tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)
13095
13096        Returned (function value):
13097                      double    Greenwich mean sidereal time (radians)
13098
13099        Notes:
13100
13101        1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
13102           Julian Dates, apportioned in any convenient way between the
13103           argument pairs.  For example, JD=2450123.7 could be expressed in
13104           any of these ways, among others:
13105
13106                  Part A        Part B
13107
13108               2450123.7           0.0       (JD method)
13109               2451545.0       -1421.3       (J2000 method)
13110               2400000.5       50123.2       (MJD method)
13111               2450123.5           0.2       (date & time method)
13112
13113           The JD method is the most natural and convenient to use in
13114           cases where the loss of several decimal digits of resolution
13115           is acceptable (in the case of UT;  the TT is not at all critical
13116           in this respect).  The J2000 and MJD methods are good compromises
13117           between resolution and convenience.  For UT, the date & time
13118           method is best matched to the algorithm that is used by the Earth
13119           rotation angle function, called internally:  maximum precision is
13120           delivered when the uta argument is for 0hrs UT1 on the day in
13121           question and the utb argument lies in the range 0 to 1, or vice
13122           versa.
13123
13124        2) Both UT1 and TT are required, UT1 to predict the Earth rotation
13125           and TT to predict the effects of precession.  If UT1 is used for
13126           both purposes, errors of order 100 microarcseconds result.
13127
13128        3) This GMST is compatible with the IAU 2006 precession and must not
13129           be used with other precession models.
13130
13131        4) The result is returned in the range 0 to 2pi.
13132
13133        Called:
13134           eraEra00     Earth rotation angle, IAU 2000
13135           eraAnp       normalize angle into range 0 to 2pi
13136
13137        Reference:
13138
13139           Capitaine, N., Wallace, P.T. & Chapront, J., 2005,
13140           Astron.Astrophys. 432, 355
13141
13142        This revision:  2021 May 11
13143
13144        Copyright (C) 2013-2021, NumFOCUS Foundation.
13145        Derived, with permission, from the SOFA library.  See notes at end of file.
13146
13147    """
13148    c_retval = ufunc.gmst06(uta, utb, tta, ttb)
13149    return c_retval
13150
13151
13152def gmst82(dj1, dj2):
13153    """
13154    Universal Time to Greenwich mean sidereal time (IAU 1982 model).
13155
13156    Parameters
13157    ----------
13158    dj1 : double array
13159    dj2 : double array
13160
13161    Returns
13162    -------
13163    c_retval : double array
13164
13165    Notes
13166    -----
13167    Wraps ERFA function ``eraGmst82``. The ERFA documentation is::
13168
13169        - - - - - - - - - -
13170         e r a G m s t 8 2
13171        - - - - - - - - - -
13172
13173        Universal Time to Greenwich mean sidereal time (IAU 1982 model).
13174
13175        Given:
13176           dj1,dj2    double    UT1 Julian Date (see note)
13177
13178        Returned (function value):
13179                      double    Greenwich mean sidereal time (radians)
13180
13181        Notes:
13182
13183        1) The UT1 date dj1+dj2 is a Julian Date, apportioned in any
13184           convenient way between the arguments dj1 and dj2.  For example,
13185           JD(UT1)=2450123.7 could be expressed in any of these ways,
13186           among others:
13187
13188                   dj1            dj2
13189
13190               2450123.7          0          (JD method)
13191                2451545        -1421.3       (J2000 method)
13192               2400000.5       50123.2       (MJD method)
13193               2450123.5         0.2         (date & time method)
13194
13195           The JD method is the most natural and convenient to use in
13196           cases where the loss of several decimal digits of resolution
13197           is acceptable.  The J2000 and MJD methods are good compromises
13198           between resolution and convenience.  The date & time method is
13199           best matched to the algorithm used:  maximum accuracy (or, at
13200           least, minimum noise) is delivered when the dj1 argument is for
13201           0hrs UT1 on the day in question and the dj2 argument lies in the
13202           range 0 to 1, or vice versa.
13203
13204        2) The algorithm is based on the IAU 1982 expression.  This is
13205           always described as giving the GMST at 0 hours UT1.  In fact, it
13206           gives the difference between the GMST and the UT, the steady
13207           4-minutes-per-day drawing-ahead of ST with respect to UT.  When
13208           whole days are ignored, the expression happens to equal the GMST
13209           at 0 hours UT1 each day.
13210
13211        3) In this function, the entire UT1 (the sum of the two arguments
13212           dj1 and dj2) is used directly as the argument for the standard
13213           formula, the constant term of which is adjusted by 12 hours to
13214           take account of the noon phasing of Julian Date.  The UT1 is then
13215           added, but omitting whole days to conserve accuracy.
13216
13217        Called:
13218           eraAnp       normalize angle into range 0 to 2pi
13219
13220        References:
13221
13222           Transactions of the International Astronomical Union,
13223           XVIII B, 67 (1983).
13224
13225           Aoki et al., Astron.Astrophys., 105, 359-361 (1982).
13226
13227        This revision:  2021 May 11
13228
13229        Copyright (C) 2013-2021, NumFOCUS Foundation.
13230        Derived, with permission, from the SOFA library.  See notes at end of file.
13231
13232    """
13233    c_retval = ufunc.gmst82(dj1, dj2)
13234    return c_retval
13235
13236
13237def gst00a(uta, utb, tta, ttb):
13238    """
13239    Greenwich apparent sidereal time (consistent with IAU 2000
13240    resolutions).
13241
13242    Parameters
13243    ----------
13244    uta : double array
13245    utb : double array
13246    tta : double array
13247    ttb : double array
13248
13249    Returns
13250    -------
13251    c_retval : double array
13252
13253    Notes
13254    -----
13255    Wraps ERFA function ``eraGst00a``. The ERFA documentation is::
13256
13257        - - - - - - - - - -
13258         e r a G s t 0 0 a
13259        - - - - - - - - - -
13260
13261        Greenwich apparent sidereal time (consistent with IAU 2000
13262        resolutions).
13263
13264        Given:
13265           uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
13266           tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)
13267
13268        Returned (function value):
13269                      double    Greenwich apparent sidereal time (radians)
13270
13271        Notes:
13272
13273        1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
13274           Julian Dates, apportioned in any convenient way between the
13275           argument pairs.  For example, JD(UT1)=2450123.7 could be
13276           expressed in any of these ways, among others:
13277
13278                   uta            utb
13279
13280               2450123.7           0.0       (JD method)
13281               2451545.0       -1421.3       (J2000 method)
13282               2400000.5       50123.2       (MJD method)
13283               2450123.5           0.2       (date & time method)
13284
13285           The JD method is the most natural and convenient to use in
13286           cases where the loss of several decimal digits of resolution
13287           is acceptable (in the case of UT;  the TT is not at all critical
13288           in this respect).  The J2000 and MJD methods are good compromises
13289           between resolution and convenience.  For UT, the date & time
13290           method is best matched to the algorithm that is used by the Earth
13291           Rotation Angle function, called internally:  maximum precision is
13292           delivered when the uta argument is for 0hrs UT1 on the day in
13293           question and the utb argument lies in the range 0 to 1, or vice
13294           versa.
13295
13296        2) Both UT1 and TT are required, UT1 to predict the Earth rotation
13297           and TT to predict the effects of precession-nutation.  If UT1 is
13298           used for both purposes, errors of order 100 microarcseconds
13299           result.
13300
13301        3) This GAST is compatible with the IAU 2000 resolutions and must be
13302           used only in conjunction with other IAU 2000 compatible
13303           components such as precession-nutation.
13304
13305        4) The result is returned in the range 0 to 2pi.
13306
13307        5) The algorithm is from Capitaine et al. (2003) and IERS
13308           Conventions 2003.
13309
13310        Called:
13311           eraGmst00    Greenwich mean sidereal time, IAU 2000
13312           eraEe00a     equation of the equinoxes, IAU 2000A
13313           eraAnp       normalize angle into range 0 to 2pi
13314
13315        References:
13316
13317           Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
13318           implement the IAU 2000 definition of UT1", Astronomy &
13319           Astrophysics, 406, 1135-1149 (2003)
13320
13321           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
13322           IERS Technical Note No. 32, BKG (2004)
13323
13324        This revision:  2021 May 11
13325
13326        Copyright (C) 2013-2021, NumFOCUS Foundation.
13327        Derived, with permission, from the SOFA library.  See notes at end of file.
13328
13329    """
13330    c_retval = ufunc.gst00a(uta, utb, tta, ttb)
13331    return c_retval
13332
13333
13334def gst00b(uta, utb):
13335    """
13336    Greenwich apparent sidereal time (consistent with IAU 2000
13337    resolutions but using the truncated nutation model IAU 2000B).
13338
13339    Parameters
13340    ----------
13341    uta : double array
13342    utb : double array
13343
13344    Returns
13345    -------
13346    c_retval : double array
13347
13348    Notes
13349    -----
13350    Wraps ERFA function ``eraGst00b``. The ERFA documentation is::
13351
13352        - - - - - - - - - -
13353         e r a G s t 0 0 b
13354        - - - - - - - - - -
13355
13356        Greenwich apparent sidereal time (consistent with IAU 2000
13357        resolutions but using the truncated nutation model IAU 2000B).
13358
13359        Given:
13360           uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
13361
13362        Returned (function value):
13363                      double    Greenwich apparent sidereal time (radians)
13364
13365        Notes:
13366
13367        1) The UT1 date uta+utb is a Julian Date, apportioned in any
13368           convenient way between the argument pair.  For example,
13369           JD(UT1)=2450123.7 could be expressed in any of these ways,
13370           among others:
13371
13372                   uta            utb
13373
13374               2450123.7           0.0       (JD method)
13375               2451545.0       -1421.3       (J2000 method)
13376               2400000.5       50123.2       (MJD method)
13377               2450123.5           0.2       (date & time method)
13378
13379           The JD method is the most natural and convenient to use in cases
13380           where the loss of several decimal digits of resolution is
13381           acceptable.  The J2000 and MJD methods are good compromises
13382           between resolution and convenience.  For UT, the date & time
13383           method is best matched to the algorithm that is used by the Earth
13384           Rotation Angle function, called internally:  maximum precision is
13385           delivered when the uta argument is for 0hrs UT1 on the day in
13386           question and the utb argument lies in the range 0 to 1, or vice
13387           versa.
13388
13389        2) The result is compatible with the IAU 2000 resolutions, except
13390           that accuracy has been compromised for the sake of speed and
13391           convenience in two respects:
13392
13393           . UT is used instead of TDB (or TT) to compute the precession
13394             component of GMST and the equation of the equinoxes.  This
13395             results in errors of order 0.1 mas at present.
13396
13397           . The IAU 2000B abridged nutation model (McCarthy & Luzum, 2003)
13398             is used, introducing errors of up to 1 mas.
13399
13400        3) This GAST is compatible with the IAU 2000 resolutions and must be
13401           used only in conjunction with other IAU 2000 compatible
13402           components such as precession-nutation.
13403
13404        4) The result is returned in the range 0 to 2pi.
13405
13406        5) The algorithm is from Capitaine et al. (2003) and IERS
13407           Conventions 2003.
13408
13409        Called:
13410           eraGmst00    Greenwich mean sidereal time, IAU 2000
13411           eraEe00b     equation of the equinoxes, IAU 2000B
13412           eraAnp       normalize angle into range 0 to 2pi
13413
13414        References:
13415
13416           Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to
13417           implement the IAU 2000 definition of UT1", Astronomy &
13418           Astrophysics, 406, 1135-1149 (2003)
13419
13420           McCarthy, D.D. & Luzum, B.J., "An abridged model of the
13421           precession-nutation of the celestial pole", Celestial Mechanics &
13422           Dynamical Astronomy, 85, 37-49 (2003)
13423
13424           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
13425           IERS Technical Note No. 32, BKG (2004)
13426
13427        This revision:  2021 May 11
13428
13429        Copyright (C) 2013-2021, NumFOCUS Foundation.
13430        Derived, with permission, from the SOFA library.  See notes at end of file.
13431
13432    """
13433    c_retval = ufunc.gst00b(uta, utb)
13434    return c_retval
13435
13436
13437def gst06(uta, utb, tta, ttb, rnpb):
13438    """
13439    Greenwich apparent sidereal time, IAU 2006, given the NPB matrix.
13440
13441    Parameters
13442    ----------
13443    uta : double array
13444    utb : double array
13445    tta : double array
13446    ttb : double array
13447    rnpb : double array
13448
13449    Returns
13450    -------
13451    c_retval : double array
13452
13453    Notes
13454    -----
13455    Wraps ERFA function ``eraGst06``. The ERFA documentation is::
13456
13457        - - - - - - - - -
13458         e r a G s t 0 6
13459        - - - - - - - - -
13460
13461        Greenwich apparent sidereal time, IAU 2006, given the NPB matrix.
13462
13463        Given:
13464           uta,utb  double        UT1 as a 2-part Julian Date (Notes 1,2)
13465           tta,ttb  double        TT as a 2-part Julian Date (Notes 1,2)
13466           rnpb     double[3][3]  nutation x precession x bias matrix
13467
13468        Returned (function value):
13469                    double        Greenwich apparent sidereal time (radians)
13470
13471        Notes:
13472
13473        1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
13474           Julian Dates, apportioned in any convenient way between the
13475           argument pairs.  For example, JD(UT1)=2450123.7 could be
13476           expressed in any of these ways, among others:
13477
13478                   uta            utb
13479
13480               2450123.7           0.0       (JD method)
13481               2451545.0       -1421.3       (J2000 method)
13482               2400000.5       50123.2       (MJD method)
13483               2450123.5           0.2       (date & time method)
13484
13485           The JD method is the most natural and convenient to use in
13486           cases where the loss of several decimal digits of resolution
13487           is acceptable (in the case of UT;  the TT is not at all critical
13488           in this respect).  The J2000 and MJD methods are good compromises
13489           between resolution and convenience.  For UT, the date & time
13490           method is best matched to the algorithm that is used by the Earth
13491           rotation angle function, called internally:  maximum precision is
13492           delivered when the uta argument is for 0hrs UT1 on the day in
13493           question and the utb argument lies in the range 0 to 1, or vice
13494           versa.
13495
13496        2) Both UT1 and TT are required, UT1 to predict the Earth rotation
13497           and TT to predict the effects of precession-nutation.  If UT1 is
13498           used for both purposes, errors of order 100 microarcseconds
13499           result.
13500
13501        3) Although the function uses the IAU 2006 series for s+XY/2, it is
13502           otherwise independent of the precession-nutation model and can in
13503           practice be used with any equinox-based NPB matrix.
13504
13505        4) The result is returned in the range 0 to 2pi.
13506
13507        Called:
13508           eraBpn2xy    extract CIP X,Y coordinates from NPB matrix
13509           eraS06       the CIO locator s, given X,Y, IAU 2006
13510           eraAnp       normalize angle into range 0 to 2pi
13511           eraEra00     Earth rotation angle, IAU 2000
13512           eraEors      equation of the origins, given NPB matrix and s
13513
13514        Reference:
13515
13516           Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
13517
13518        This revision:  2021 May 11
13519
13520        Copyright (C) 2013-2021, NumFOCUS Foundation.
13521        Derived, with permission, from the SOFA library.  See notes at end of file.
13522
13523    """
13524    c_retval = ufunc.gst06(uta, utb, tta, ttb, rnpb)
13525    return c_retval
13526
13527
13528def gst06a(uta, utb, tta, ttb):
13529    """
13530    Greenwich apparent sidereal time (consistent with IAU 2000 and 2006
13531    resolutions).
13532
13533    Parameters
13534    ----------
13535    uta : double array
13536    utb : double array
13537    tta : double array
13538    ttb : double array
13539
13540    Returns
13541    -------
13542    c_retval : double array
13543
13544    Notes
13545    -----
13546    Wraps ERFA function ``eraGst06a``. The ERFA documentation is::
13547
13548        - - - - - - - - - -
13549         e r a G s t 0 6 a
13550        - - - - - - - - - -
13551
13552        Greenwich apparent sidereal time (consistent with IAU 2000 and 2006
13553        resolutions).
13554
13555        Given:
13556           uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
13557           tta,ttb    double    TT as a 2-part Julian Date (Notes 1,2)
13558
13559        Returned (function value):
13560                      double    Greenwich apparent sidereal time (radians)
13561
13562        Notes:
13563
13564        1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
13565           Julian Dates, apportioned in any convenient way between the
13566           argument pairs.  For example, JD(UT1)=2450123.7 could be
13567           expressed in any of these ways, among others:
13568
13569                   uta            utb
13570
13571               2450123.7           0.0       (JD method)
13572               2451545.0       -1421.3       (J2000 method)
13573               2400000.5       50123.2       (MJD method)
13574               2450123.5           0.2       (date & time method)
13575
13576           The JD method is the most natural and convenient to use in
13577           cases where the loss of several decimal digits of resolution
13578           is acceptable (in the case of UT;  the TT is not at all critical
13579           in this respect).  The J2000 and MJD methods are good compromises
13580           between resolution and convenience.  For UT, the date & time
13581           method is best matched to the algorithm that is used by the Earth
13582           rotation angle function, called internally:  maximum precision is
13583           delivered when the uta argument is for 0hrs UT1 on the day in
13584           question and the utb argument lies in the range 0 to 1, or vice
13585           versa.
13586
13587        2) Both UT1 and TT are required, UT1 to predict the Earth rotation
13588           and TT to predict the effects of precession-nutation.  If UT1 is
13589           used for both purposes, errors of order 100 microarcseconds
13590           result.
13591
13592        3) This GAST is compatible with the IAU 2000/2006 resolutions and
13593           must be used only in conjunction with IAU 2006 precession and
13594           IAU 2000A nutation.
13595
13596        4) The result is returned in the range 0 to 2pi.
13597
13598        Called:
13599           eraPnm06a    classical NPB matrix, IAU 2006/2000A
13600           eraGst06     Greenwich apparent ST, IAU 2006, given NPB matrix
13601
13602        Reference:
13603
13604           Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
13605
13606        This revision:  2021 May 11
13607
13608        Copyright (C) 2013-2021, NumFOCUS Foundation.
13609        Derived, with permission, from the SOFA library.  See notes at end of file.
13610
13611    """
13612    c_retval = ufunc.gst06a(uta, utb, tta, ttb)
13613    return c_retval
13614
13615
13616def gst94(uta, utb):
13617    """
13618    Greenwich apparent sidereal time (consistent with IAU 1982/94
13619    resolutions).
13620
13621    Parameters
13622    ----------
13623    uta : double array
13624    utb : double array
13625
13626    Returns
13627    -------
13628    c_retval : double array
13629
13630    Notes
13631    -----
13632    Wraps ERFA function ``eraGst94``. The ERFA documentation is::
13633
13634        - - - - - - - - -
13635         e r a G s t 9 4
13636        - - - - - - - - -
13637
13638        Greenwich apparent sidereal time (consistent with IAU 1982/94
13639        resolutions).
13640
13641        Given:
13642           uta,utb    double    UT1 as a 2-part Julian Date (Notes 1,2)
13643
13644        Returned (function value):
13645                      double    Greenwich apparent sidereal time (radians)
13646
13647        Notes:
13648
13649        1) The UT1 date uta+utb is a Julian Date, apportioned in any
13650           convenient way between the argument pair.  For example,
13651           JD(UT1)=2450123.7 could be expressed in any of these ways, among
13652           others:
13653
13654                   uta            utb
13655
13656               2450123.7           0.0       (JD method)
13657               2451545.0       -1421.3       (J2000 method)
13658               2400000.5       50123.2       (MJD method)
13659               2450123.5           0.2       (date & time method)
13660
13661           The JD method is the most natural and convenient to use in cases
13662           where the loss of several decimal digits of resolution is
13663           acceptable.  The J2000 and MJD methods are good compromises
13664           between resolution and convenience.  For UT, the date & time
13665           method is best matched to the algorithm that is used by the Earth
13666           Rotation Angle function, called internally:  maximum precision is
13667           delivered when the uta argument is for 0hrs UT1 on the day in
13668           question and the utb argument lies in the range 0 to 1, or vice
13669           versa.
13670
13671        2) The result is compatible with the IAU 1982 and 1994 resolutions,
13672           except that accuracy has been compromised for the sake of
13673           convenience in that UT is used instead of TDB (or TT) to compute
13674           the equation of the equinoxes.
13675
13676        3) This GAST must be used only in conjunction with contemporaneous
13677           IAU standards such as 1976 precession, 1980 obliquity and 1982
13678           nutation.  It is not compatible with the IAU 2000 resolutions.
13679
13680        4) The result is returned in the range 0 to 2pi.
13681
13682        Called:
13683           eraGmst82    Greenwich mean sidereal time, IAU 1982
13684           eraEqeq94    equation of the equinoxes, IAU 1994
13685           eraAnp       normalize angle into range 0 to 2pi
13686
13687        References:
13688
13689           Explanatory Supplement to the Astronomical Almanac,
13690           P. Kenneth Seidelmann (ed), University Science Books (1992)
13691
13692           IAU Resolution C7, Recommendation 3 (1994)
13693
13694        This revision:  2021 May 11
13695
13696        Copyright (C) 2013-2021, NumFOCUS Foundation.
13697        Derived, with permission, from the SOFA library.  See notes at end of file.
13698
13699    """
13700    c_retval = ufunc.gst94(uta, utb)
13701    return c_retval
13702
13703
13704def pvstar(pv):
13705    """
13706    Convert star position+velocity vector to catalog coordinates.
13707
13708    Parameters
13709    ----------
13710    pv : double array
13711
13712    Returns
13713    -------
13714    ra : double array
13715    dec : double array
13716    pmr : double array
13717    pmd : double array
13718    px : double array
13719    rv : double array
13720
13721    Notes
13722    -----
13723    Wraps ERFA function ``eraPvstar``. The ERFA documentation is::
13724
13725        - - - - - - - - - -
13726         e r a P v s t a r
13727        - - - - - - - - - -
13728
13729        Convert star position+velocity vector to catalog coordinates.
13730
13731        Given (Note 1):
13732           pv     double[2][3]   pv-vector (au, au/day)
13733
13734        Returned (Note 2):
13735           ra     double         right ascension (radians)
13736           dec    double         declination (radians)
13737           pmr    double         RA proper motion (radians/year)
13738           pmd    double         Dec proper motion (radians/year)
13739           px     double         parallax (arcsec)
13740           rv     double         radial velocity (km/s, positive = receding)
13741
13742        Returned (function value):
13743                  int            status:
13744                                    0 = OK
13745                                   -1 = superluminal speed (Note 5)
13746                                   -2 = null position vector
13747
13748        Notes:
13749
13750        1) The specified pv-vector is the coordinate direction (and its rate
13751           of change) for the date at which the light leaving the star
13752           reached the solar-system barycenter.
13753
13754        2) The star data returned by this function are "observables" for an
13755           imaginary observer at the solar-system barycenter.  Proper motion
13756           and radial velocity are, strictly, in terms of barycentric
13757           coordinate time, TCB.  For most practical applications, it is
13758           permissible to neglect the distinction between TCB and ordinary
13759           "proper" time on Earth (TT/TAI).  The result will, as a rule, be
13760           limited by the intrinsic accuracy of the proper-motion and
13761           radial-velocity data;  moreover, the supplied pv-vector is likely
13762           to be merely an intermediate result (for example generated by the
13763           function eraStarpv), so that a change of time unit will cancel
13764           out overall.
13765
13766           In accordance with normal star-catalog conventions, the object's
13767           right ascension and declination are freed from the effects of
13768           secular aberration.  The frame, which is aligned to the catalog
13769           equator and equinox, is Lorentzian and centered on the SSB.
13770
13771           Summarizing, the specified pv-vector is for most stars almost
13772           identical to the result of applying the standard geometrical
13773           "space motion" transformation to the catalog data.  The
13774           differences, which are the subject of the Stumpff paper cited
13775           below, are:
13776
13777           (i) In stars with significant radial velocity and proper motion,
13778           the constantly changing light-time distorts the apparent proper
13779           motion.  Note that this is a classical, not a relativistic,
13780           effect.
13781
13782           (ii) The transformation complies with special relativity.
13783
13784        3) Care is needed with units.  The star coordinates are in radians
13785           and the proper motions in radians per Julian year, but the
13786           parallax is in arcseconds; the radial velocity is in km/s, but
13787           the pv-vector result is in au and au/day.
13788
13789        4) The proper motions are the rate of change of the right ascension
13790           and declination at the catalog epoch and are in radians per Julian
13791           year.  The RA proper motion is in terms of coordinate angle, not
13792           true angle, and will thus be numerically larger at high
13793           declinations.
13794
13795        5) Straight-line motion at constant speed in the inertial frame is
13796           assumed.  If the speed is greater than or equal to the speed of
13797           light, the function aborts with an error status.
13798
13799        6) The inverse transformation is performed by the function eraStarpv.
13800
13801        Called:
13802           eraPn        decompose p-vector into modulus and direction
13803           eraPdp       scalar product of two p-vectors
13804           eraSxp       multiply p-vector by scalar
13805           eraPmp       p-vector minus p-vector
13806           eraPm        modulus of p-vector
13807           eraPpp       p-vector plus p-vector
13808           eraPv2s      pv-vector to spherical
13809           eraAnp       normalize angle into range 0 to 2pi
13810
13811        Reference:
13812
13813           Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.
13814
13815        This revision:  2021 May 11
13816
13817        Copyright (C) 2013-2021, NumFOCUS Foundation.
13818        Derived, with permission, from the SOFA library.  See notes at end of file.
13819
13820    """
13821    ra, dec, pmr, pmd, px, rv, c_retval = ufunc.pvstar(pv)
13822    check_errwarn(c_retval, 'pvstar')
13823    return ra, dec, pmr, pmd, px, rv
13824
13825
13826STATUS_CODES['pvstar'] = {
13827    0: 'OK',
13828    -1: 'superluminal speed (Note 5)',
13829    -2: 'null position vector',
13830}
13831
13832
13833def starpv(ra, dec, pmr, pmd, px, rv):
13834    """
13835    Convert star catalog coordinates to position+velocity vector.
13836
13837    Parameters
13838    ----------
13839    ra : double array
13840    dec : double array
13841    pmr : double array
13842    pmd : double array
13843    px : double array
13844    rv : double array
13845
13846    Returns
13847    -------
13848    pv : double array
13849
13850    Notes
13851    -----
13852    Wraps ERFA function ``eraStarpv``. The ERFA documentation is::
13853
13854        - - - - - - - - - -
13855         e r a S t a r p v
13856        - - - - - - - - - -
13857
13858        Convert star catalog coordinates to position+velocity vector.
13859
13860        Given (Note 1):
13861           ra     double        right ascension (radians)
13862           dec    double        declination (radians)
13863           pmr    double        RA proper motion (radians/year)
13864           pmd    double        Dec proper motion (radians/year)
13865           px     double        parallax (arcseconds)
13866           rv     double        radial velocity (km/s, positive = receding)
13867
13868        Returned (Note 2):
13869           pv     double[2][3]  pv-vector (au, au/day)
13870
13871        Returned (function value):
13872                  int           status:
13873                                    0 = no warnings
13874                                    1 = distance overridden (Note 6)
13875                                    2 = excessive speed (Note 7)
13876                                    4 = solution didn't converge (Note 8)
13877                                 else = binary logical OR of the above
13878
13879        Notes:
13880
13881        1) The star data accepted by this function are "observables" for an
13882           imaginary observer at the solar-system barycenter.  Proper motion
13883           and radial velocity are, strictly, in terms of barycentric
13884           coordinate time, TCB.  For most practical applications, it is
13885           permissible to neglect the distinction between TCB and ordinary
13886           "proper" time on Earth (TT/TAI).  The result will, as a rule, be
13887           limited by the intrinsic accuracy of the proper-motion and
13888           radial-velocity data;  moreover, the pv-vector is likely to be
13889           merely an intermediate result, so that a change of time unit
13890           would cancel out overall.
13891
13892           In accordance with normal star-catalog conventions, the object's
13893           right ascension and declination are freed from the effects of
13894           secular aberration.  The frame, which is aligned to the catalog
13895           equator and equinox, is Lorentzian and centered on the SSB.
13896
13897        2) The resulting position and velocity pv-vector is with respect to
13898           the same frame and, like the catalog coordinates, is freed from
13899           the effects of secular aberration.  Should the "coordinate
13900           direction", where the object was located at the catalog epoch, be
13901           required, it may be obtained by calculating the magnitude of the
13902           position vector pv[0][0-2] dividing by the speed of light in
13903           au/day to give the light-time, and then multiplying the space
13904           velocity pv[1][0-2] by this light-time and adding the result to
13905           pv[0][0-2].
13906
13907           Summarizing, the pv-vector returned is for most stars almost
13908           identical to the result of applying the standard geometrical
13909           "space motion" transformation.  The differences, which are the
13910           subject of the Stumpff paper referenced below, are:
13911
13912           (i) In stars with significant radial velocity and proper motion,
13913           the constantly changing light-time distorts the apparent proper
13914           motion.  Note that this is a classical, not a relativistic,
13915           effect.
13916
13917           (ii) The transformation complies with special relativity.
13918
13919        3) Care is needed with units.  The star coordinates are in radians
13920           and the proper motions in radians per Julian year, but the
13921           parallax is in arcseconds; the radial velocity is in km/s, but
13922           the pv-vector result is in au and au/day.
13923
13924        4) The RA proper motion is in terms of coordinate angle, not true
13925           angle.  If the catalog uses arcseconds for both RA and Dec proper
13926           motions, the RA proper motion will need to be divided by cos(Dec)
13927           before use.
13928
13929        5) Straight-line motion at constant speed, in the inertial frame,
13930           is assumed.
13931
13932        6) An extremely small (or zero or negative) parallax is interpreted
13933           to mean that the object is on the "celestial sphere", the radius
13934           of which is an arbitrary (large) value (see the constant PXMIN).
13935           When the distance is overridden in this way, the status,
13936           initially zero, has 1 added to it.
13937
13938        7) If the space velocity is a significant fraction of c (see the
13939           constant VMAX), it is arbitrarily set to zero.  When this action
13940           occurs, 2 is added to the status.
13941
13942        8) The relativistic adjustment involves an iterative calculation.
13943           If the process fails to converge within a set number (IMAX) of
13944           iterations, 4 is added to the status.
13945
13946        9) The inverse transformation is performed by the function
13947           eraPvstar.
13948
13949        Called:
13950           eraS2pv      spherical coordinates to pv-vector
13951           eraPm        modulus of p-vector
13952           eraZp        zero p-vector
13953           eraPn        decompose p-vector into modulus and direction
13954           eraPdp       scalar product of two p-vectors
13955           eraSxp       multiply p-vector by scalar
13956           eraPmp       p-vector minus p-vector
13957           eraPpp       p-vector plus p-vector
13958
13959        Reference:
13960
13961           Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.
13962
13963        This revision:  2021 May 11
13964
13965        Copyright (C) 2013-2021, NumFOCUS Foundation.
13966        Derived, with permission, from the SOFA library.  See notes at end of file.
13967
13968    """
13969    pv, c_retval = ufunc.starpv(ra, dec, pmr, pmd, px, rv)
13970    check_errwarn(c_retval, 'starpv')
13971    return pv
13972
13973
13974STATUS_CODES['starpv'] = {
13975    0: 'no warnings',
13976    1: 'distance overridden (Note 6)',
13977    2: 'excessive speed (Note 7)',
13978    4: "solution didn't converge (Note 8)",
13979    'else': 'binary logical OR of the above',
13980}
13981
13982
13983def fk425(r1950, d1950, dr1950, dd1950, p1950, v1950):
13984    """
13985    Convert B1950.0 FK4 star catalog data to J2000.0 FK5.
13986
13987    Parameters
13988    ----------
13989    r1950 : double array
13990    d1950 : double array
13991    dr1950 : double array
13992    dd1950 : double array
13993    p1950 : double array
13994    v1950 : double array
13995
13996    Returns
13997    -------
13998    r2000 : double array
13999    d2000 : double array
14000    dr2000 : double array
14001    dd2000 : double array
14002    p2000 : double array
14003    v2000 : double array
14004
14005    Notes
14006    -----
14007    Wraps ERFA function ``eraFk425``. The ERFA documentation is::
14008
14009        - - - - - - - - -
14010         e r a F k 4 2 5
14011        - - - - - - - - -
14012
14013        Convert B1950.0 FK4 star catalog data to J2000.0 FK5.
14014
14015        This function converts a star's catalog data from the old FK4
14016       (Bessel-Newcomb) system to the later IAU 1976 FK5 (Fricke) system.
14017
14018        Given: (all B1950.0, FK4)
14019           r1950,d1950    double   B1950.0 RA,Dec (rad)
14020           dr1950,dd1950  double   B1950.0 proper motions (rad/trop.yr)
14021           p1950          double   parallax (arcsec)
14022           v1950          double   radial velocity (km/s, +ve = moving away)
14023
14024        Returned: (all J2000.0, FK5)
14025           r2000,d2000    double   J2000.0 RA,Dec (rad)
14026           dr2000,dd2000  double   J2000.0 proper motions (rad/Jul.yr)
14027           p2000          double   parallax (arcsec)
14028           v2000          double   radial velocity (km/s, +ve = moving away)
14029
14030        Notes:
14031
14032        1) The proper motions in RA are dRA/dt rather than cos(Dec)*dRA/dt,
14033           and are per year rather than per century.
14034
14035        2) The conversion is somewhat complicated, for several reasons:
14036
14037           . Change of standard epoch from B1950.0 to J2000.0.
14038
14039           . An intermediate transition date of 1984 January 1.0 TT.
14040
14041           . A change of precession model.
14042
14043           . Change of time unit for proper motion (tropical to Julian).
14044
14045           . FK4 positions include the E-terms of aberration, to simplify
14046             the hand computation of annual aberration.  FK5 positions
14047             assume a rigorous aberration computation based on the Earth's
14048             barycentric velocity.
14049
14050           . The E-terms also affect proper motions, and in particular cause
14051             objects at large distances to exhibit fictitious proper
14052             motions.
14053
14054           The algorithm is based on Smith et al. (1989) and Yallop et al.
14055           (1989), which presented a matrix method due to Standish (1982) as
14056           developed by Aoki et al. (1983), using Kinoshita's development of
14057           Andoyer's post-Newcomb precession.  The numerical constants from
14058           Seidelmann (1992) are used canonically.
14059
14060        3) Conversion from B1950.0 FK4 to J2000.0 FK5 only is provided for.
14061           Conversions for different epochs and equinoxes would require
14062           additional treatment for precession, proper motion and E-terms.
14063
14064        4) In the FK4 catalog the proper motions of stars within 10 degrees
14065           of the poles do not embody differential E-terms effects and
14066           should, strictly speaking, be handled in a different manner from
14067           stars outside these regions.  However, given the general lack of
14068           homogeneity of the star data available for routine astrometry,
14069           the difficulties of handling positions that may have been
14070           determined from astrometric fields spanning the polar and non-
14071           polar regions, the likelihood that the differential E-terms
14072           effect was not taken into account when allowing for proper motion
14073           in past astrometry, and the undesirability of a discontinuity in
14074           the algorithm, the decision has been made in this ERFA algorithm
14075           to include the effects of differential E-terms on the proper
14076           motions for all stars, whether polar or not.  At epoch J2000.0,
14077           and measuring "on the sky" rather than in terms of RA change, the
14078           errors resulting from this simplification are less than
14079           1 milliarcsecond in position and 1 milliarcsecond per century in
14080           proper motion.
14081
14082        Called:
14083           eraAnp       normalize angle into range 0 to 2pi
14084           eraPv2s      pv-vector to spherical coordinates
14085           eraPdp       scalar product of two p-vectors
14086           eraPvmpv     pv-vector minus pv_vector
14087           eraPvppv     pv-vector plus pv_vector
14088           eraS2pv      spherical coordinates to pv-vector
14089           eraSxp       multiply p-vector by scalar
14090
14091        References:
14092
14093           Aoki, S. et al., 1983, "Conversion matrix of epoch B1950.0
14094           FK4-based positions of stars to epoch J2000.0 positions in
14095           accordance with the new IAU resolutions".  Astron.Astrophys.
14096           128, 263-267.
14097
14098           Seidelmann, P.K. (ed), 1992, "Explanatory Supplement to the
14099           Astronomical Almanac", ISBN 0-935702-68-7.
14100
14101           Smith, C.A. et al., 1989, "The transformation of astrometric
14102           catalog systems to the equinox J2000.0".  Astron.J. 97, 265.
14103
14104           Standish, E.M., 1982, "Conversion of positions and proper motions
14105           from B1950.0 to the IAU system at J2000.0".  Astron.Astrophys.,
14106           115, 1, 20-22.
14107
14108           Yallop, B.D. et al., 1989, "Transformation of mean star places
14109           from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space".
14110           Astron.J. 97, 274.
14111
14112        This revision:   2021 February 24
14113
14114        Copyright (C) 2013-2021, NumFOCUS Foundation.
14115        Derived, with permission, from the SOFA library.  See notes at end of file.
14116
14117    """
14118    r2000, d2000, dr2000, dd2000, p2000, v2000 = ufunc.fk425(
14119        r1950, d1950, dr1950, dd1950, p1950, v1950)
14120    return r2000, d2000, dr2000, dd2000, p2000, v2000
14121
14122
14123def fk45z(r1950, d1950, bepoch):
14124    """
14125    Convert a B1950.0 FK4 star position to J2000.0 FK5, assuming zero
14126    proper motion in the FK5 system.
14127
14128    Parameters
14129    ----------
14130    r1950 : double array
14131    d1950 : double array
14132    bepoch : double array
14133
14134    Returns
14135    -------
14136    r2000 : double array
14137    d2000 : double array
14138
14139    Notes
14140    -----
14141    Wraps ERFA function ``eraFk45z``. The ERFA documentation is::
14142
14143        - - - - - - - - -
14144         e r a F k 4 5 z
14145        - - - - - - - - -
14146
14147        Convert a B1950.0 FK4 star position to J2000.0 FK5, assuming zero
14148        proper motion in the FK5 system.
14149
14150        This function converts a star's catalog data from the old FK4
14151        (Bessel-Newcomb) system to the later IAU 1976 FK5 (Fricke) system,
14152        in such a way that the FK5 proper motion is zero.  Because such a
14153        star has, in general, a non-zero proper motion in the FK4 system,
14154        the function requires the epoch at which the position in the FK4
14155        system was determined.
14156
14157        Given:
14158           r1950,d1950    double   B1950.0 FK4 RA,Dec at epoch (rad)
14159           bepoch         double   Besselian epoch (e.g. 1979.3)
14160
14161        Returned:
14162           r2000,d2000    double   J2000.0 FK5 RA,Dec (rad)
14163
14164        Notes:
14165
14166        1) The epoch bepoch is strictly speaking Besselian, but if a
14167           Julian epoch is supplied the result will be affected only to a
14168           negligible extent.
14169
14170        2) The method is from Appendix 2 of Aoki et al. (1983), but using
14171           the constants of Seidelmann (1992).  See the function eraFk425
14172           for a general introduction to the FK4 to FK5 conversion.
14173
14174        3) Conversion from equinox B1950.0 FK4 to equinox J2000.0 FK5 only
14175           is provided for.  Conversions for different starting and/or
14176           ending epochs would require additional treatment for precession,
14177           proper motion and E-terms.
14178
14179        4) In the FK4 catalog the proper motions of stars within 10 degrees
14180           of the poles do not embody differential E-terms effects and
14181           should, strictly speaking, be handled in a different manner from
14182           stars outside these regions.  However, given the general lack of
14183           homogeneity of the star data available for routine astrometry,
14184           the difficulties of handling positions that may have been
14185           determined from astrometric fields spanning the polar and non-
14186           polar regions, the likelihood that the differential E-terms
14187           effect was not taken into account when allowing for proper motion
14188           in past astrometry, and the undesirability of a discontinuity in
14189           the algorithm, the decision has been made in this ERFA algorithm
14190           to include the effects of differential E-terms on the proper
14191           motions for all stars, whether polar or not.  At epoch 2000.0,
14192           and measuring "on the sky" rather than in terms of RA change, the
14193           errors resulting from this simplification are less than
14194           1 milliarcsecond in position and 1 milliarcsecond per century in
14195           proper motion.
14196
14197        References:
14198
14199           Aoki, S. et al., 1983, "Conversion matrix of epoch B1950.0
14200           FK4-based positions of stars to epoch J2000.0 positions in
14201           accordance with the new IAU resolutions".  Astron.Astrophys.
14202           128, 263-267.
14203
14204           Seidelmann, P.K. (ed), 1992, "Explanatory Supplement to the
14205           Astronomical Almanac", ISBN 0-935702-68-7.
14206
14207        Called:
14208           eraAnp       normalize angle into range 0 to 2pi
14209           eraC2s       p-vector to spherical
14210           eraEpb2jd    Besselian epoch to Julian date
14211           eraEpj       Julian date to Julian epoch
14212           eraPdp       scalar product of two p-vectors
14213           eraPmp       p-vector minus p-vector
14214           eraPpsp      p-vector plus scaled p-vector
14215           eraPvu       update a pv-vector
14216           eraS2c       spherical to p-vector
14217
14218        This revision:   2021 February 24
14219
14220        Copyright (C) 2013-2021, NumFOCUS Foundation.
14221        Derived, with permission, from the SOFA library.  See notes at end of file.
14222
14223    """
14224    r2000, d2000 = ufunc.fk45z(r1950, d1950, bepoch)
14225    return r2000, d2000
14226
14227
14228def fk524(r2000, d2000, dr2000, dd2000, p2000, v2000):
14229    """
14230    Convert J2000.0 FK5 star catalog data to B1950.0 FK4.
14231
14232    Parameters
14233    ----------
14234    r2000 : double array
14235    d2000 : double array
14236    dr2000 : double array
14237    dd2000 : double array
14238    p2000 : double array
14239    v2000 : double array
14240
14241    Returns
14242    -------
14243    r1950 : double array
14244    d1950 : double array
14245    dr1950 : double array
14246    dd1950 : double array
14247    p1950 : double array
14248    v1950 : double array
14249
14250    Notes
14251    -----
14252    Wraps ERFA function ``eraFk524``. The ERFA documentation is::
14253
14254        - - - - - - - - -
14255         e r a F k 5 2 4
14256        - - - - - - - - -
14257
14258        Convert J2000.0 FK5 star catalog data to B1950.0 FK4.
14259
14260        Given: (all J2000.0, FK5)
14261           r2000,d2000    double   J2000.0 RA,Dec (rad)
14262           dr2000,dd2000  double   J2000.0 proper motions (rad/Jul.yr)
14263           p2000          double   parallax (arcsec)
14264           v2000          double   radial velocity (km/s, +ve = moving away)
14265
14266        Returned: (all B1950.0, FK4)
14267           r1950,d1950    double   B1950.0 RA,Dec (rad)
14268           dr1950,dd1950  double   B1950.0 proper motions (rad/trop.yr)
14269           p1950          double   parallax (arcsec)
14270           v1950          double   radial velocity (km/s, +ve = moving away)
14271
14272        Notes:
14273
14274        1) The proper motions in RA are dRA/dt rather than cos(Dec)*dRA/dt,
14275           and are per year rather than per century.
14276
14277        2) The conversion is somewhat complicated, for several reasons:
14278
14279           . Change of standard epoch from J2000.0 to B1950.0.
14280
14281           . An intermediate transition date of 1984 January 1.0 TT.
14282
14283           . A change of precession model.
14284
14285           . Change of time unit for proper motion (Julian to tropical).
14286
14287           . FK4 positions include the E-terms of aberration, to simplify
14288             the hand computation of annual aberration.  FK5 positions
14289             assume a rigorous aberration computation based on the Earth's
14290             barycentric velocity.
14291
14292           . The E-terms also affect proper motions, and in particular cause
14293             objects at large distances to exhibit fictitious proper
14294             motions.
14295
14296           The algorithm is based on Smith et al. (1989) and Yallop et al.
14297           (1989), which presented a matrix method due to Standish (1982) as
14298           developed by Aoki et al. (1983), using Kinoshita's development of
14299           Andoyer's post-Newcomb precession.  The numerical constants from
14300           Seidelmann (1992) are used canonically.
14301
14302        4) In the FK4 catalog the proper motions of stars within 10 degrees
14303           of the poles do not embody differential E-terms effects and
14304           should, strictly speaking, be handled in a different manner from
14305           stars outside these regions.  However, given the general lack of
14306           homogeneity of the star data available for routine astrometry,
14307           the difficulties of handling positions that may have been
14308           determined from astrometric fields spanning the polar and non-
14309           polar regions, the likelihood that the differential E-terms
14310           effect was not taken into account when allowing for proper motion
14311           in past astrometry, and the undesirability of a discontinuity in
14312           the algorithm, the decision has been made in this ERFA algorithm
14313           to include the effects of differential E-terms on the proper
14314           motions for all stars, whether polar or not.  At epoch J2000.0,
14315           and measuring "on the sky" rather than in terms of RA change, the
14316           errors resulting from this simplification are less than
14317           1 milliarcsecond in position and 1 milliarcsecond per century in
14318           proper motion.
14319
14320        Called:
14321           eraAnp       normalize angle into range 0 to 2pi
14322           eraPdp       scalar product of two p-vectors
14323           eraPm        modulus of p-vector
14324           eraPmp       p-vector minus p-vector
14325           eraPpp       p-vector pluus p-vector
14326           eraPv2s      pv-vector to spherical coordinates
14327           eraS2pv      spherical coordinates to pv-vector
14328           eraSxp       multiply p-vector by scalar
14329
14330        References:
14331
14332           Aoki, S. et al., 1983, "Conversion matrix of epoch B1950.0
14333           FK4-based positions of stars to epoch J2000.0 positions in
14334           accordance with the new IAU resolutions".  Astron.Astrophys.
14335           128, 263-267.
14336
14337           Seidelmann, P.K. (ed), 1992, "Explanatory Supplement to the
14338           Astronomical Almanac", ISBN 0-935702-68-7.
14339
14340           Smith, C.A. et al., 1989, "The transformation of astrometric
14341           catalog systems to the equinox J2000.0".  Astron.J. 97, 265.
14342
14343           Standish, E.M., 1982, "Conversion of positions and proper motions
14344           from B1950.0 to the IAU system at J2000.0".  Astron.Astrophys.,
14345           115, 1, 20-22.
14346
14347           Yallop, B.D. et al., 1989, "Transformation of mean star places
14348           from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space".
14349           Astron.J. 97, 274.
14350
14351        This revision:   2021 February 24
14352
14353        Copyright (C) 2013-2021, NumFOCUS Foundation.
14354        Derived, with permission, from the SOFA library.  See notes at end of file.
14355
14356    """
14357    r1950, d1950, dr1950, dd1950, p1950, v1950 = ufunc.fk524(
14358        r2000, d2000, dr2000, dd2000, p2000, v2000)
14359    return r1950, d1950, dr1950, dd1950, p1950, v1950
14360
14361
14362def fk52h(r5, d5, dr5, dd5, px5, rv5):
14363    """
14364    Transform FK5 (J2000.0) star data into the Hipparcos system.
14365
14366    Parameters
14367    ----------
14368    r5 : double array
14369    d5 : double array
14370    dr5 : double array
14371    dd5 : double array
14372    px5 : double array
14373    rv5 : double array
14374
14375    Returns
14376    -------
14377    rh : double array
14378    dh : double array
14379    drh : double array
14380    ddh : double array
14381    pxh : double array
14382    rvh : double array
14383
14384    Notes
14385    -----
14386    Wraps ERFA function ``eraFk52h``. The ERFA documentation is::
14387
14388        - - - - - - - - -
14389         e r a F k 5 2 h
14390        - - - - - - - - -
14391
14392        Transform FK5 (J2000.0) star data into the Hipparcos system.
14393
14394        Given (all FK5, equinox J2000.0, epoch J2000.0):
14395           r5      double    RA (radians)
14396           d5      double    Dec (radians)
14397           dr5     double    proper motion in RA (dRA/dt, rad/Jyear)
14398           dd5     double    proper motion in Dec (dDec/dt, rad/Jyear)
14399           px5     double    parallax (arcsec)
14400           rv5     double    radial velocity (km/s, positive = receding)
14401
14402        Returned (all Hipparcos, epoch J2000.0):
14403           rh      double    RA (radians)
14404           dh      double    Dec (radians)
14405           drh     double    proper motion in RA (dRA/dt, rad/Jyear)
14406           ddh     double    proper motion in Dec (dDec/dt, rad/Jyear)
14407           pxh     double    parallax (arcsec)
14408           rvh     double    radial velocity (km/s, positive = receding)
14409
14410        Notes:
14411
14412        1) This function transforms FK5 star positions and proper motions
14413           into the system of the Hipparcos catalog.
14414
14415        2) The proper motions in RA are dRA/dt rather than
14416           cos(Dec)*dRA/dt, and are per year rather than per century.
14417
14418        3) The FK5 to Hipparcos transformation is modeled as a pure
14419           rotation and spin;  zonal errors in the FK5 catalog are not
14420           taken into account.
14421
14422        4) See also eraH2fk5, eraFk5hz, eraHfk5z.
14423
14424        Called:
14425           eraStarpv    star catalog data to space motion pv-vector
14426           eraFk5hip    FK5 to Hipparcos rotation and spin
14427           eraRxp       product of r-matrix and p-vector
14428           eraPxp       vector product of two p-vectors
14429           eraPpp       p-vector plus p-vector
14430           eraPvstar    space motion pv-vector to star catalog data
14431
14432        Reference:
14433
14434           F.Mignard & M.Froeschle, Astron.Astrophys., 354, 732-739 (2000).
14435
14436        This revision:  2021 May 11
14437
14438        Copyright (C) 2013-2021, NumFOCUS Foundation.
14439        Derived, with permission, from the SOFA library.  See notes at end of file.
14440
14441    """
14442    rh, dh, drh, ddh, pxh, rvh = ufunc.fk52h(r5, d5, dr5, dd5, px5, rv5)
14443    return rh, dh, drh, ddh, pxh, rvh
14444
14445
14446def fk54z(r2000, d2000, bepoch):
14447    """
14448    Convert a J2000.0 FK5 star position to B1950.0 FK4, assuming zero
14449    proper motion in FK5 and parallax.
14450
14451    Parameters
14452    ----------
14453    r2000 : double array
14454    d2000 : double array
14455    bepoch : double array
14456
14457    Returns
14458    -------
14459    r1950 : double array
14460    d1950 : double array
14461    dr1950 : double array
14462    dd1950 : double array
14463
14464    Notes
14465    -----
14466    Wraps ERFA function ``eraFk54z``. The ERFA documentation is::
14467
14468        - - - - - - - - -
14469         e r a F k 5 4 z
14470        - - - - - - - - -
14471
14472        Convert a J2000.0 FK5 star position to B1950.0 FK4, assuming zero
14473        proper motion in FK5 and parallax.
14474
14475        Given:
14476           r2000,d2000    double   J2000.0 FK5 RA,Dec (rad)
14477           bepoch         double   Besselian epoch (e.g. 1950.0)
14478
14479        Returned:
14480           r1950,d1950    double   B1950.0 FK4 RA,Dec (rad) at epoch BEPOCH
14481           dr1950,dd1950  double   B1950.0 FK4 proper motions (rad/trop.yr)
14482
14483        Notes:
14484
14485        1) In contrast to the eraFk524 function, here the FK5 proper
14486           motions, the parallax and the radial velocity are presumed zero.
14487
14488        2) This function converts a star position from the IAU 1976 FK5
14489          (Fricke) system to the former FK4 (Bessel-Newcomb) system, for
14490           cases such as distant radio sources where it is presumed there is
14491           zero parallax and no proper motion.  Because of the E-terms of
14492           aberration, such objects have (in general) non-zero proper motion
14493           in FK4, and the present function returns those fictitious proper
14494           motions.
14495
14496        3) Conversion from B1950.0 FK4 to J2000.0 FK5 only is provided for.
14497           Conversions involving other equinoxes would require additional
14498           treatment for precession.
14499
14500        4) The position returned by this function is in the B1950.0 FK4
14501           reference system but at Besselian epoch BEPOCH.  For comparison
14502           with catalogs the BEPOCH argument will frequently be 1950.0. (In
14503           this context the distinction between Besselian and Julian epoch
14504           is insignificant.)
14505
14506        5) The RA component of the returned (fictitious) proper motion is
14507           dRA/dt rather than cos(Dec)*dRA/dt.
14508
14509        Called:
14510           eraAnp       normalize angle into range 0 to 2pi
14511           eraC2s       p-vector to spherical
14512           eraFk524     FK4 to FK5
14513           eraS2c       spherical to p-vector
14514
14515        This revision:   2020 November 19
14516
14517        Copyright (C) 2013-2021, NumFOCUS Foundation.
14518        Derived, with permission, from the SOFA library.  See notes at end of file.
14519
14520    """
14521    r1950, d1950, dr1950, dd1950 = ufunc.fk54z(r2000, d2000, bepoch)
14522    return r1950, d1950, dr1950, dd1950
14523
14524
14525def fk5hip():
14526    """
14527    FK5 to Hipparcos rotation and spin.
14528
14529    Parameters
14530    ----------
14531
14532    Returns
14533    -------
14534    r5h : double array
14535    s5h : double array
14536
14537    Notes
14538    -----
14539    Wraps ERFA function ``eraFk5hip``. The ERFA documentation is::
14540
14541        - - - - - - - - - -
14542         e r a F k 5 h i p
14543        - - - - - - - - - -
14544
14545        FK5 to Hipparcos rotation and spin.
14546
14547        Returned:
14548           r5h   double[3][3]  r-matrix: FK5 rotation wrt Hipparcos (Note 2)
14549           s5h   double[3]     r-vector: FK5 spin wrt Hipparcos (Note 3)
14550
14551        Notes:
14552
14553        1) This function models the FK5 to Hipparcos transformation as a
14554           pure rotation and spin;  zonal errors in the FK5 catalogue are
14555           not taken into account.
14556
14557        2) The r-matrix r5h operates in the sense:
14558
14559                 P_Hipparcos = r5h x P_FK5
14560
14561           where P_FK5 is a p-vector in the FK5 frame, and P_Hipparcos is
14562           the equivalent Hipparcos p-vector.
14563
14564        3) The r-vector s5h represents the time derivative of the FK5 to
14565           Hipparcos rotation.  The units are radians per year (Julian,
14566           TDB).
14567
14568        Called:
14569           eraRv2m      r-vector to r-matrix
14570
14571        Reference:
14572
14573           F.Mignard & M.Froeschle, Astron.Astrophys., 354, 732-739 (2000).
14574
14575        This revision:  2021 May 11
14576
14577        Copyright (C) 2013-2021, NumFOCUS Foundation.
14578        Derived, with permission, from the SOFA library.  See notes at end of file.
14579
14580    """
14581    r5h, s5h = ufunc.fk5hip()
14582    return r5h, s5h
14583
14584
14585def fk5hz(r5, d5, date1, date2):
14586    """
14587    Transform an FK5 (J2000.0) star position into the system of the
14588    Hipparcos catalogue, assuming zero Hipparcos proper motion.
14589
14590    Parameters
14591    ----------
14592    r5 : double array
14593    d5 : double array
14594    date1 : double array
14595    date2 : double array
14596
14597    Returns
14598    -------
14599    rh : double array
14600    dh : double array
14601
14602    Notes
14603    -----
14604    Wraps ERFA function ``eraFk5hz``. The ERFA documentation is::
14605
14606        - - - - - - - - -
14607         e r a F k 5 h z
14608        - - - - - - - - -
14609
14610        Transform an FK5 (J2000.0) star position into the system of the
14611        Hipparcos catalogue, assuming zero Hipparcos proper motion.
14612
14613        Given:
14614           r5           double   FK5 RA (radians), equinox J2000.0, at date
14615           d5           double   FK5 Dec (radians), equinox J2000.0, at date
14616           date1,date2  double   TDB date (Notes 1,2)
14617
14618        Returned:
14619           rh           double   Hipparcos RA (radians)
14620           dh           double   Hipparcos Dec (radians)
14621
14622        Notes:
14623
14624        1) This function converts a star position from the FK5 system to
14625           the Hipparcos system, in such a way that the Hipparcos proper
14626           motion is zero.  Because such a star has, in general, a non-zero
14627           proper motion in the FK5 system, the function requires the date
14628           at which the position in the FK5 system was determined.
14629
14630        2) The TT date date1+date2 is a Julian Date, apportioned in any
14631           convenient way between the two arguments.  For example,
14632           JD(TT)=2450123.7 could be expressed in any of these ways,
14633           among others:
14634
14635                  date1          date2
14636
14637               2450123.7           0.0       (JD method)
14638               2451545.0       -1421.3       (J2000 method)
14639               2400000.5       50123.2       (MJD method)
14640               2450123.5           0.2       (date & time method)
14641
14642           The JD method is the most natural and convenient to use in
14643           cases where the loss of several decimal digits of resolution
14644           is acceptable.  The J2000 method is best matched to the way
14645           the argument is handled internally and will deliver the
14646           optimum resolution.  The MJD method and the date & time methods
14647           are both good compromises between resolution and convenience.
14648
14649        3) The FK5 to Hipparcos transformation is modeled as a pure
14650           rotation and spin;  zonal errors in the FK5 catalogue are not
14651           taken into account.
14652
14653        4) The position returned by this function is in the Hipparcos
14654           reference system but at date date1+date2.
14655
14656        5) See also eraFk52h, eraH2fk5, eraHfk5z.
14657
14658        Called:
14659           eraS2c       spherical coordinates to unit vector
14660           eraFk5hip    FK5 to Hipparcos rotation and spin
14661           eraSxp       multiply p-vector by scalar
14662           eraRv2m      r-vector to r-matrix
14663           eraTrxp      product of transpose of r-matrix and p-vector
14664           eraPxp       vector product of two p-vectors
14665           eraC2s       p-vector to spherical
14666           eraAnp       normalize angle into range 0 to 2pi
14667
14668        Reference:
14669
14670           F.Mignard & M.Froeschle, 2000, Astron.Astrophys. 354, 732-739.
14671
14672        This revision:  2021 May 11
14673
14674        Copyright (C) 2013-2021, NumFOCUS Foundation.
14675        Derived, with permission, from the SOFA library.  See notes at end of file.
14676
14677    """
14678    rh, dh = ufunc.fk5hz(r5, d5, date1, date2)
14679    return rh, dh
14680
14681
14682def h2fk5(rh, dh, drh, ddh, pxh, rvh):
14683    """
14684    Transform Hipparcos star data into the FK5 (J2000.0) system.
14685
14686    Parameters
14687    ----------
14688    rh : double array
14689    dh : double array
14690    drh : double array
14691    ddh : double array
14692    pxh : double array
14693    rvh : double array
14694
14695    Returns
14696    -------
14697    r5 : double array
14698    d5 : double array
14699    dr5 : double array
14700    dd5 : double array
14701    px5 : double array
14702    rv5 : double array
14703
14704    Notes
14705    -----
14706    Wraps ERFA function ``eraH2fk5``. The ERFA documentation is::
14707
14708        - - - - - - - - -
14709         e r a H 2 f k 5
14710        - - - - - - - - -
14711
14712        Transform Hipparcos star data into the FK5 (J2000.0) system.
14713
14714        Given (all Hipparcos, epoch J2000.0):
14715           rh      double    RA (radians)
14716           dh      double    Dec (radians)
14717           drh     double    proper motion in RA (dRA/dt, rad/Jyear)
14718           ddh     double    proper motion in Dec (dDec/dt, rad/Jyear)
14719           pxh     double    parallax (arcsec)
14720           rvh     double    radial velocity (km/s, positive = receding)
14721
14722        Returned (all FK5, equinox J2000.0, epoch J2000.0):
14723           r5      double    RA (radians)
14724           d5      double    Dec (radians)
14725           dr5     double    proper motion in RA (dRA/dt, rad/Jyear)
14726           dd5     double    proper motion in Dec (dDec/dt, rad/Jyear)
14727           px5     double    parallax (arcsec)
14728           rv5     double    radial velocity (km/s, positive = receding)
14729
14730        Notes:
14731
14732        1) This function transforms Hipparcos star positions and proper
14733           motions into FK5 J2000.0.
14734
14735        2) The proper motions in RA are dRA/dt rather than
14736           cos(Dec)*dRA/dt, and are per year rather than per century.
14737
14738        3) The FK5 to Hipparcos transformation is modeled as a pure
14739           rotation and spin;  zonal errors in the FK5 catalog are not
14740           taken into account.
14741
14742        4) See also eraFk52h, eraFk5hz, eraHfk5z.
14743
14744        Called:
14745           eraStarpv    star catalog data to space motion pv-vector
14746           eraFk5hip    FK5 to Hipparcos rotation and spin
14747           eraRv2m      r-vector to r-matrix
14748           eraRxp       product of r-matrix and p-vector
14749           eraTrxp      product of transpose of r-matrix and p-vector
14750           eraPxp       vector product of two p-vectors
14751           eraPmp       p-vector minus p-vector
14752           eraPvstar    space motion pv-vector to star catalog data
14753
14754        Reference:
14755
14756           F.Mignard & M.Froeschle, Astron.Astrophys., 354, 732-739 (2000).
14757
14758        This revision:  2021 May 11
14759
14760        Copyright (C) 2013-2021, NumFOCUS Foundation.
14761        Derived, with permission, from the SOFA library.  See notes at end of file.
14762
14763    """
14764    r5, d5, dr5, dd5, px5, rv5 = ufunc.h2fk5(rh, dh, drh, ddh, pxh, rvh)
14765    return r5, d5, dr5, dd5, px5, rv5
14766
14767
14768def hfk5z(rh, dh, date1, date2):
14769    """
14770    Transform a Hipparcos star position into FK5 J2000.0, assuming
14771    zero Hipparcos proper motion.
14772
14773    Parameters
14774    ----------
14775    rh : double array
14776    dh : double array
14777    date1 : double array
14778    date2 : double array
14779
14780    Returns
14781    -------
14782    r5 : double array
14783    d5 : double array
14784    dr5 : double array
14785    dd5 : double array
14786
14787    Notes
14788    -----
14789    Wraps ERFA function ``eraHfk5z``. The ERFA documentation is::
14790
14791        - - - - - - - - -
14792         e r a H f k 5 z
14793        - - - - - - - - -
14794
14795        Transform a Hipparcos star position into FK5 J2000.0, assuming
14796        zero Hipparcos proper motion.
14797
14798        Given:
14799           rh            double    Hipparcos RA (radians)
14800           dh            double    Hipparcos Dec (radians)
14801           date1,date2   double    TDB date (Note 1)
14802
14803        Returned (all FK5, equinox J2000.0, date date1+date2):
14804           r5            double    RA (radians)
14805           d5            double    Dec (radians)
14806           dr5           double    FK5 RA proper motion (rad/year, Note 4)
14807           dd5           double    Dec proper motion (rad/year, Note 4)
14808
14809        Notes:
14810
14811        1) The TT date date1+date2 is a Julian Date, apportioned in any
14812           convenient way between the two arguments.  For example,
14813           JD(TT)=2450123.7 could be expressed in any of these ways,
14814           among others:
14815
14816                  date1          date2
14817
14818               2450123.7           0.0       (JD method)
14819               2451545.0       -1421.3       (J2000 method)
14820               2400000.5       50123.2       (MJD method)
14821               2450123.5           0.2       (date & time method)
14822
14823           The JD method is the most natural and convenient to use in
14824           cases where the loss of several decimal digits of resolution
14825           is acceptable.  The J2000 method is best matched to the way
14826           the argument is handled internally and will deliver the
14827           optimum resolution.  The MJD method and the date & time methods
14828           are both good compromises between resolution and convenience.
14829
14830        2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
14831
14832        3) The FK5 to Hipparcos transformation is modeled as a pure rotation
14833           and spin;  zonal errors in the FK5 catalogue are not taken into
14834           account.
14835
14836        4) It was the intention that Hipparcos should be a close
14837           approximation to an inertial frame, so that distant objects have
14838           zero proper motion;  such objects have (in general) non-zero
14839           proper motion in FK5, and this function returns those fictitious
14840           proper motions.
14841
14842        5) The position returned by this function is in the FK5 J2000.0
14843           reference system but at date date1+date2.
14844
14845        6) See also eraFk52h, eraH2fk5, eraFk5zhz.
14846
14847        Called:
14848           eraS2c       spherical coordinates to unit vector
14849           eraFk5hip    FK5 to Hipparcos rotation and spin
14850           eraRxp       product of r-matrix and p-vector
14851           eraSxp       multiply p-vector by scalar
14852           eraRxr       product of two r-matrices
14853           eraTrxp      product of transpose of r-matrix and p-vector
14854           eraPxp       vector product of two p-vectors
14855           eraPv2s      pv-vector to spherical
14856           eraAnp       normalize angle into range 0 to 2pi
14857
14858        Reference:
14859
14860           F.Mignard & M.Froeschle, 2000, Astron.Astrophys. 354, 732-739.
14861
14862        This revision:  2021 May 11
14863
14864        Copyright (C) 2013-2021, NumFOCUS Foundation.
14865        Derived, with permission, from the SOFA library.  See notes at end of file.
14866
14867    """
14868    r5, d5, dr5, dd5 = ufunc.hfk5z(rh, dh, date1, date2)
14869    return r5, d5, dr5, dd5
14870
14871
14872def starpm(ra1, dec1, pmr1, pmd1, px1, rv1, ep1a, ep1b, ep2a, ep2b):
14873    """
14874    Star proper motion:  update star catalog data for space motion.
14875
14876    Parameters
14877    ----------
14878    ra1 : double array
14879    dec1 : double array
14880    pmr1 : double array
14881    pmd1 : double array
14882    px1 : double array
14883    rv1 : double array
14884    ep1a : double array
14885    ep1b : double array
14886    ep2a : double array
14887    ep2b : double array
14888
14889    Returns
14890    -------
14891    ra2 : double array
14892    dec2 : double array
14893    pmr2 : double array
14894    pmd2 : double array
14895    px2 : double array
14896    rv2 : double array
14897
14898    Notes
14899    -----
14900    Wraps ERFA function ``eraStarpm``. The ERFA documentation is::
14901
14902        - - - - - - - - - -
14903         e r a S t a r p m
14904        - - - - - - - - - -
14905
14906        Star proper motion:  update star catalog data for space motion.
14907
14908        Given:
14909           ra1    double     right ascension (radians), before
14910           dec1   double     declination (radians), before
14911           pmr1   double     RA proper motion (radians/year), before
14912           pmd1   double     Dec proper motion (radians/year), before
14913           px1    double     parallax (arcseconds), before
14914           rv1    double     radial velocity (km/s, +ve = receding), before
14915           ep1a   double     "before" epoch, part A (Note 1)
14916           ep1b   double     "before" epoch, part B (Note 1)
14917           ep2a   double     "after" epoch, part A (Note 1)
14918           ep2b   double     "after" epoch, part B (Note 1)
14919
14920        Returned:
14921           ra2    double     right ascension (radians), after
14922           dec2   double     declination (radians), after
14923           pmr2   double     RA proper motion (radians/year), after
14924           pmd2   double     Dec proper motion (radians/year), after
14925           px2    double     parallax (arcseconds), after
14926           rv2    double     radial velocity (km/s, +ve = receding), after
14927
14928        Returned (function value):
14929                  int        status:
14930                                -1 = system error (should not occur)
14931                                 0 = no warnings or errors
14932                                 1 = distance overridden (Note 6)
14933                                 2 = excessive velocity (Note 7)
14934                                 4 = solution didn't converge (Note 8)
14935                              else = binary logical OR of the above warnings
14936
14937        Notes:
14938
14939        1) The starting and ending TDB dates ep1a+ep1b and ep2a+ep2b are
14940           Julian Dates, apportioned in any convenient way between the two
14941           parts (A and B).  For example, JD(TDB)=2450123.7 could be
14942           expressed in any of these ways, among others:
14943
14944                   epna          epnb
14945
14946               2450123.7           0.0       (JD method)
14947               2451545.0       -1421.3       (J2000 method)
14948               2400000.5       50123.2       (MJD method)
14949               2450123.5           0.2       (date & time method)
14950
14951           The JD method is the most natural and convenient to use in
14952           cases where the loss of several decimal digits of resolution
14953           is acceptable.  The J2000 method is best matched to the way
14954           the argument is handled internally and will deliver the
14955           optimum resolution.  The MJD method and the date & time methods
14956           are both good compromises between resolution and convenience.
14957
14958        2) In accordance with normal star-catalog conventions, the object's
14959           right ascension and declination are freed from the effects of
14960           secular aberration.  The frame, which is aligned to the catalog
14961           equator and equinox, is Lorentzian and centered on the SSB.
14962
14963           The proper motions are the rate of change of the right ascension
14964           and declination at the catalog epoch and are in radians per TDB
14965           Julian year.
14966
14967           The parallax and radial velocity are in the same frame.
14968
14969        3) Care is needed with units.  The star coordinates are in radians
14970           and the proper motions in radians per Julian year, but the
14971           parallax is in arcseconds.
14972
14973        4) The RA proper motion is in terms of coordinate angle, not true
14974           angle.  If the catalog uses arcseconds for both RA and Dec proper
14975           motions, the RA proper motion will need to be divided by cos(Dec)
14976           before use.
14977
14978        5) Straight-line motion at constant speed, in the inertial frame,
14979           is assumed.
14980
14981        6) An extremely small (or zero or negative) parallax is interpreted
14982           to mean that the object is on the "celestial sphere", the radius
14983           of which is an arbitrary (large) value (see the eraStarpv
14984           function for the value used).  When the distance is overridden in
14985           this way, the status, initially zero, has 1 added to it.
14986
14987        7) If the space velocity is a significant fraction of c (see the
14988           constant VMAX in the function eraStarpv), it is arbitrarily set
14989           to zero.  When this action occurs, 2 is added to the status.
14990
14991        8) The relativistic adjustment carried out in the eraStarpv function
14992           involves an iterative calculation.  If the process fails to
14993           converge within a set number of iterations, 4 is added to the
14994           status.
14995
14996        Called:
14997           eraStarpv    star catalog data to space motion pv-vector
14998           eraPvu       update a pv-vector
14999           eraPdp       scalar product of two p-vectors
15000           eraPvstar    space motion pv-vector to star catalog data
15001
15002        This revision:  2021 May 11
15003
15004        Copyright (C) 2013-2021, NumFOCUS Foundation.
15005        Derived, with permission, from the SOFA library.  See notes at end of file.
15006
15007    """
15008    ra2, dec2, pmr2, pmd2, px2, rv2, c_retval = ufunc.starpm(
15009        ra1, dec1, pmr1, pmd1, px1, rv1, ep1a, ep1b, ep2a, ep2b)
15010    check_errwarn(c_retval, 'starpm')
15011    return ra2, dec2, pmr2, pmd2, px2, rv2
15012
15013
15014STATUS_CODES['starpm'] = {
15015    -1: 'system error (should not occur)',
15016    0: 'no warnings or errors',
15017    1: 'distance overridden (Note 6)',
15018    2: 'excessive velocity (Note 7)',
15019    4: "solution didn't converge (Note 8)",
15020    'else': 'binary logical OR of the above warnings',
15021}
15022
15023
15024def eceq06(date1, date2, dl, db):
15025    """
15026    Transformation from ecliptic coordinates (mean equinox and ecliptic
15027    of date) to ICRS RA,Dec, using the IAU 2006 precession model.
15028
15029    Parameters
15030    ----------
15031    date1 : double array
15032    date2 : double array
15033    dl : double array
15034    db : double array
15035
15036    Returns
15037    -------
15038    dr : double array
15039    dd : double array
15040
15041    Notes
15042    -----
15043    Wraps ERFA function ``eraEceq06``. The ERFA documentation is::
15044
15045        - - - - - - - - - -
15046         e r a E c e q 0 6
15047        - - - - - - - - - -
15048
15049        Transformation from ecliptic coordinates (mean equinox and ecliptic
15050        of date) to ICRS RA,Dec, using the IAU 2006 precession model.
15051
15052        Given:
15053           date1,date2 double TT as a 2-part Julian date (Note 1)
15054           dl,db       double ecliptic longitude and latitude (radians)
15055
15056        Returned:
15057           dr,dd       double ICRS right ascension and declination (radians)
15058
15059        1) The TT date date1+date2 is a Julian Date, apportioned in any
15060           convenient way between the two arguments.  For example,
15061           JD(TT)=2450123.7 could be expressed in any of these ways,
15062           among others:
15063
15064                  date1          date2
15065
15066               2450123.7           0.0       (JD method)
15067               2451545.0       -1421.3       (J2000 method)
15068               2400000.5       50123.2       (MJD method)
15069               2450123.5           0.2       (date & time method)
15070
15071           The JD method is the most natural and convenient to use in
15072           cases where the loss of several decimal digits of resolution
15073           is acceptable.  The J2000 method is best matched to the way
15074           the argument is handled internally and will deliver the
15075           optimum resolution.  The MJD method and the date & time methods
15076           are both good compromises between resolution and convenience.
15077
15078        2) No assumptions are made about whether the coordinates represent
15079           starlight and embody astrometric effects such as parallax or
15080           aberration.
15081
15082        3) The transformation is approximately that from ecliptic longitude
15083           and latitude (mean equinox and ecliptic of date) to mean J2000.0
15084           right ascension and declination, with only frame bias (always
15085           less than 25 mas) to disturb this classical picture.
15086
15087        Called:
15088           eraS2c       spherical coordinates to unit vector
15089           eraEcm06     J2000.0 to ecliptic rotation matrix, IAU 2006
15090           eraTrxp      product of transpose of r-matrix and p-vector
15091           eraC2s       unit vector to spherical coordinates
15092           eraAnp       normalize angle into range 0 to 2pi
15093           eraAnpm      normalize angle into range +/- pi
15094
15095        This revision:  2021 May 11
15096
15097        Copyright (C) 2013-2021, NumFOCUS Foundation.
15098        Derived, with permission, from the SOFA library.  See notes at end of file.
15099
15100    """
15101    dr, dd = ufunc.eceq06(date1, date2, dl, db)
15102    return dr, dd
15103
15104
15105def ecm06(date1, date2):
15106    """
15107    ICRS equatorial to ecliptic rotation matrix, IAU 2006.
15108
15109    Parameters
15110    ----------
15111    date1 : double array
15112    date2 : double array
15113
15114    Returns
15115    -------
15116    rm : double array
15117
15118    Notes
15119    -----
15120    Wraps ERFA function ``eraEcm06``. The ERFA documentation is::
15121
15122        - - - - - - - - -
15123         e r a E c m 0 6
15124        - - - - - - - - -
15125
15126        ICRS equatorial to ecliptic rotation matrix, IAU 2006.
15127
15128        Given:
15129           date1,date2  double         TT as a 2-part Julian date (Note 1)
15130
15131        Returned:
15132           rm           double[3][3]   ICRS to ecliptic rotation matrix
15133
15134        Notes:
15135
15136        1) The TT date date1+date2 is a Julian Date, apportioned in any
15137           convenient way between the two arguments.  For example,
15138           JD(TT)=2450123.7 could be expressed in any of these ways,
15139           among others:
15140
15141                  date1          date2
15142
15143               2450123.7           0.0       (JD method)
15144               2451545.0       -1421.3       (J2000 method)
15145               2400000.5       50123.2       (MJD method)
15146               2450123.5           0.2       (date & time method)
15147
15148           The JD method is the most natural and convenient to use in
15149           cases where the loss of several decimal digits of resolution
15150           is acceptable.  The J2000 method is best matched to the way
15151           the argument is handled internally and will deliver the
15152           optimum resolution.  The MJD method and the date & time methods
15153           are both good compromises between resolution and convenience.
15154
15155        1) The matrix is in the sense
15156
15157              E_ep = rm x P_ICRS,
15158
15159           where P_ICRS is a vector with respect to ICRS right ascension
15160           and declination axes and E_ep is the same vector with respect to
15161           the (inertial) ecliptic and equinox of date.
15162
15163        2) P_ICRS is a free vector, merely a direction, typically of unit
15164           magnitude, and not bound to any particular spatial origin, such
15165           as the Earth, Sun or SSB.  No assumptions are made about whether
15166           it represents starlight and embodies astrometric effects such as
15167           parallax or aberration.  The transformation is approximately that
15168           between mean J2000.0 right ascension and declination and ecliptic
15169           longitude and latitude, with only frame bias (always less than
15170           25 mas) to disturb this classical picture.
15171
15172        Called:
15173           eraObl06     mean obliquity, IAU 2006
15174           eraPmat06    PB matrix, IAU 2006
15175           eraIr        initialize r-matrix to identity
15176           eraRx        rotate around X-axis
15177           eraRxr       product of two r-matrices
15178
15179        This revision:  2021 May 11
15180
15181        Copyright (C) 2013-2021, NumFOCUS Foundation.
15182        Derived, with permission, from the SOFA library.  See notes at end of file.
15183
15184    """
15185    rm = ufunc.ecm06(date1, date2)
15186    return rm
15187
15188
15189def eqec06(date1, date2, dr, dd):
15190    """
15191    Transformation from ICRS equatorial coordinates to ecliptic
15192    coordinates (mean equinox and ecliptic of date) using IAU 2006
15193    precession model.
15194
15195    Parameters
15196    ----------
15197    date1 : double array
15198    date2 : double array
15199    dr : double array
15200    dd : double array
15201
15202    Returns
15203    -------
15204    dl : double array
15205    db : double array
15206
15207    Notes
15208    -----
15209    Wraps ERFA function ``eraEqec06``. The ERFA documentation is::
15210
15211        - - - - - - - - - -
15212         e r a E q e c 0 6
15213        - - - - - - - - - -
15214
15215        Transformation from ICRS equatorial coordinates to ecliptic
15216        coordinates (mean equinox and ecliptic of date) using IAU 2006
15217        precession model.
15218
15219        Given:
15220           date1,date2 double TT as a 2-part Julian date (Note 1)
15221           dr,dd       double ICRS right ascension and declination (radians)
15222
15223        Returned:
15224           dl,db       double ecliptic longitude and latitude (radians)
15225
15226        1) The TT date date1+date2 is a Julian Date, apportioned in any
15227           convenient way between the two arguments.  For example,
15228           JD(TT)=2450123.7 could be expressed in any of these ways,
15229           among others:
15230
15231                  date1          date2
15232
15233               2450123.7           0.0       (JD method)
15234               2451545.0       -1421.3       (J2000 method)
15235               2400000.5       50123.2       (MJD method)
15236               2450123.5           0.2       (date & time method)
15237
15238           The JD method is the most natural and convenient to use in
15239           cases where the loss of several decimal digits of resolution
15240           is acceptable.  The J2000 method is best matched to the way
15241           the argument is handled internally and will deliver the
15242           optimum resolution.  The MJD method and the date & time methods
15243           are both good compromises between resolution and convenience.
15244
15245        2) No assumptions are made about whether the coordinates represent
15246           starlight and embody astrometric effects such as parallax or
15247           aberration.
15248
15249        3) The transformation is approximately that from mean J2000.0 right
15250           ascension and declination to ecliptic longitude and latitude
15251           (mean equinox and ecliptic of date), with only frame bias (always
15252           less than 25 mas) to disturb this classical picture.
15253
15254        Called:
15255           eraS2c       spherical coordinates to unit vector
15256           eraEcm06     J2000.0 to ecliptic rotation matrix, IAU 2006
15257           eraRxp       product of r-matrix and p-vector
15258           eraC2s       unit vector to spherical coordinates
15259           eraAnp       normalize angle into range 0 to 2pi
15260           eraAnpm      normalize angle into range +/- pi
15261
15262        This revision:  2021 May 11
15263
15264        Copyright (C) 2013-2021, NumFOCUS Foundation.
15265        Derived, with permission, from the SOFA library.  See notes at end of file.
15266
15267    """
15268    dl, db = ufunc.eqec06(date1, date2, dr, dd)
15269    return dl, db
15270
15271
15272def lteceq(epj, dl, db):
15273    """
15274    Transformation from ecliptic coordinates (mean equinox and ecliptic
15275    of date) to ICRS RA,Dec, using a long-term precession model.
15276
15277    Parameters
15278    ----------
15279    epj : double array
15280    dl : double array
15281    db : double array
15282
15283    Returns
15284    -------
15285    dr : double array
15286    dd : double array
15287
15288    Notes
15289    -----
15290    Wraps ERFA function ``eraLteceq``. The ERFA documentation is::
15291
15292        - - - - - - - - - -
15293         e r a L t e c e q
15294        - - - - - - - - - -
15295
15296        Transformation from ecliptic coordinates (mean equinox and ecliptic
15297        of date) to ICRS RA,Dec, using a long-term precession model.
15298
15299        Given:
15300           epj     double     Julian epoch (TT)
15301           dl,db   double     ecliptic longitude and latitude (radians)
15302
15303        Returned:
15304           dr,dd   double     ICRS right ascension and declination (radians)
15305
15306        1) No assumptions are made about whether the coordinates represent
15307           starlight and embody astrometric effects such as parallax or
15308           aberration.
15309
15310        2) The transformation is approximately that from ecliptic longitude
15311           and latitude (mean equinox and ecliptic of date) to mean J2000.0
15312           right ascension and declination, with only frame bias (always
15313           less than 25 mas) to disturb this classical picture.
15314
15315        3) The Vondrak et al. (2011, 2012) 400 millennia precession model
15316           agrees with the IAU 2006 precession at J2000.0 and stays within
15317           100 microarcseconds during the 20th and 21st centuries.  It is
15318           accurate to a few arcseconds throughout the historical period,
15319           worsening to a few tenths of a degree at the end of the
15320           +/- 200,000 year time span.
15321
15322        Called:
15323           eraS2c       spherical coordinates to unit vector
15324           eraLtecm     J2000.0 to ecliptic rotation matrix, long term
15325           eraTrxp      product of transpose of r-matrix and p-vector
15326           eraC2s       unit vector to spherical coordinates
15327           eraAnp       normalize angle into range 0 to 2pi
15328           eraAnpm      normalize angle into range +/- pi
15329
15330        References:
15331
15332          Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
15333          expressions, valid for long time intervals, Astron.Astrophys. 534,
15334          A22
15335
15336          Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
15337          expressions, valid for long time intervals (Corrigendum),
15338          Astron.Astrophys. 541, C1
15339
15340        This revision:  2021 May 11
15341
15342        Copyright (C) 2013-2021, NumFOCUS Foundation.
15343        Derived, with permission, from the SOFA library.  See notes at end of file.
15344
15345    """
15346    dr, dd = ufunc.lteceq(epj, dl, db)
15347    return dr, dd
15348
15349
15350def ltecm(epj):
15351    """
15352    ICRS equatorial to ecliptic rotation matrix, long-term.
15353
15354    Parameters
15355    ----------
15356    epj : double array
15357
15358    Returns
15359    -------
15360    rm : double array
15361
15362    Notes
15363    -----
15364    Wraps ERFA function ``eraLtecm``. The ERFA documentation is::
15365
15366        - - - - - - - - -
15367         e r a L t e c m
15368        - - - - - - - - -
15369
15370        ICRS equatorial to ecliptic rotation matrix, long-term.
15371
15372        Given:
15373           epj     double         Julian epoch (TT)
15374
15375        Returned:
15376           rm      double[3][3]   ICRS to ecliptic rotation matrix
15377
15378        Notes:
15379
15380        1) The matrix is in the sense
15381
15382              E_ep = rm x P_ICRS,
15383
15384           where P_ICRS is a vector with respect to ICRS right ascension
15385           and declination axes and E_ep is the same vector with respect to
15386           the (inertial) ecliptic and equinox of epoch epj.
15387
15388        2) P_ICRS is a free vector, merely a direction, typically of unit
15389           magnitude, and not bound to any particular spatial origin, such
15390           as the Earth, Sun or SSB.  No assumptions are made about whether
15391           it represents starlight and embodies astrometric effects such as
15392           parallax or aberration.  The transformation is approximately that
15393           between mean J2000.0 right ascension and declination and ecliptic
15394           longitude and latitude, with only frame bias (always less than
15395           25 mas) to disturb this classical picture.
15396
15397        3) The Vondrak et al. (2011, 2012) 400 millennia precession model
15398           agrees with the IAU 2006 precession at J2000.0 and stays within
15399           100 microarcseconds during the 20th and 21st centuries.  It is
15400           accurate to a few arcseconds throughout the historical period,
15401           worsening to a few tenths of a degree at the end of the
15402           +/- 200,000 year time span.
15403
15404        Called:
15405           eraLtpequ    equator pole, long term
15406           eraLtpecl    ecliptic pole, long term
15407           eraPxp       vector product
15408           eraPn        normalize vector
15409
15410        References:
15411
15412          Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
15413          expressions, valid for long time intervals, Astron.Astrophys. 534,
15414          A22
15415
15416          Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
15417          expressions, valid for long time intervals (Corrigendum),
15418          Astron.Astrophys. 541, C1
15419
15420        This revision:  2021 May 11
15421
15422        Copyright (C) 2013-2021, NumFOCUS Foundation.
15423        Derived, with permission, from the SOFA library.  See notes at end of file.
15424
15425    """
15426    rm = ufunc.ltecm(epj)
15427    return rm
15428
15429
15430def lteqec(epj, dr, dd):
15431    """
15432    Transformation from ICRS equatorial coordinates to ecliptic
15433    coordinates (mean equinox and ecliptic of date) using a long-term
15434    precession model.
15435
15436    Parameters
15437    ----------
15438    epj : double array
15439    dr : double array
15440    dd : double array
15441
15442    Returns
15443    -------
15444    dl : double array
15445    db : double array
15446
15447    Notes
15448    -----
15449    Wraps ERFA function ``eraLteqec``. The ERFA documentation is::
15450
15451        - - - - - - - - - -
15452         e r a L t e q e c
15453        - - - - - - - - - -
15454
15455        Transformation from ICRS equatorial coordinates to ecliptic
15456        coordinates (mean equinox and ecliptic of date) using a long-term
15457        precession model.
15458
15459        Given:
15460           epj     double     Julian epoch (TT)
15461           dr,dd   double     ICRS right ascension and declination (radians)
15462
15463        Returned:
15464           dl,db   double     ecliptic longitude and latitude (radians)
15465
15466        1) No assumptions are made about whether the coordinates represent
15467           starlight and embody astrometric effects such as parallax or
15468           aberration.
15469
15470        2) The transformation is approximately that from mean J2000.0 right
15471           ascension and declination to ecliptic longitude and latitude
15472           (mean equinox and ecliptic of date), with only frame bias (always
15473           less than 25 mas) to disturb this classical picture.
15474
15475        3) The Vondrak et al. (2011, 2012) 400 millennia precession model
15476           agrees with the IAU 2006 precession at J2000.0 and stays within
15477           100 microarcseconds during the 20th and 21st centuries.  It is
15478           accurate to a few arcseconds throughout the historical period,
15479           worsening to a few tenths of a degree at the end of the
15480           +/- 200,000 year time span.
15481
15482        Called:
15483           eraS2c       spherical coordinates to unit vector
15484           eraLtecm     J2000.0 to ecliptic rotation matrix, long term
15485           eraRxp       product of r-matrix and p-vector
15486           eraC2s       unit vector to spherical coordinates
15487           eraAnp       normalize angle into range 0 to 2pi
15488           eraAnpm      normalize angle into range +/- pi
15489
15490        References:
15491
15492          Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
15493          expressions, valid for long time intervals, Astron.Astrophys. 534,
15494          A22
15495
15496          Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
15497          expressions, valid for long time intervals (Corrigendum),
15498          Astron.Astrophys. 541, C1
15499
15500        This revision:  2021 May 11
15501
15502        Copyright (C) 2013-2021, NumFOCUS Foundation.
15503        Derived, with permission, from the SOFA library.  See notes at end of file.
15504
15505    """
15506    dl, db = ufunc.lteqec(epj, dr, dd)
15507    return dl, db
15508
15509
15510def g2icrs(dl, db):
15511    """
15512    Transformation from Galactic Coordinates to ICRS.
15513
15514    Parameters
15515    ----------
15516    dl : double array
15517    db : double array
15518
15519    Returns
15520    -------
15521    dr : double array
15522    dd : double array
15523
15524    Notes
15525    -----
15526    Wraps ERFA function ``eraG2icrs``. The ERFA documentation is::
15527
15528        - - - - - - - - - -
15529         e r a G 2 i c r s
15530        - - - - - - - - - -
15531
15532        Transformation from Galactic Coordinates to ICRS.
15533
15534        Given:
15535           dl     double      galactic longitude (radians)
15536           db     double      galactic latitude (radians)
15537
15538        Returned:
15539           dr     double      ICRS right ascension (radians)
15540           dd     double      ICRS declination (radians)
15541
15542        Notes:
15543
15544        1) The IAU 1958 system of Galactic coordinates was defined with
15545           respect to the now obsolete reference system FK4 B1950.0.  When
15546           interpreting the system in a modern context, several factors have
15547           to be taken into account:
15548
15549           . The inclusion in FK4 positions of the E-terms of aberration.
15550
15551           . The distortion of the FK4 proper motion system by differential
15552             Galactic rotation.
15553
15554           . The use of the B1950.0 equinox rather than the now-standard
15555             J2000.0.
15556
15557           . The frame bias between ICRS and the J2000.0 mean place system.
15558
15559           The Hipparcos Catalogue (Perryman & ESA 1997) provides a rotation
15560           matrix that transforms directly between ICRS and Galactic
15561           coordinates with the above factors taken into account.  The
15562           matrix is derived from three angles, namely the ICRS coordinates
15563           of the Galactic pole and the longitude of the ascending node of
15564           the galactic equator on the ICRS equator.  They are given in
15565           degrees to five decimal places and for canonical purposes are
15566           regarded as exact.  In the Hipparcos Catalogue the matrix
15567           elements are given to 10 decimal places (about 20 microarcsec).
15568           In the present ERFA function the matrix elements have been
15569           recomputed from the canonical three angles and are given to 30
15570           decimal places.
15571
15572        2) The inverse transformation is performed by the function eraIcrs2g.
15573
15574        Called:
15575           eraAnp       normalize angle into range 0 to 2pi
15576           eraAnpm      normalize angle into range +/- pi
15577           eraS2c       spherical coordinates to unit vector
15578           eraTrxp      product of transpose of r-matrix and p-vector
15579           eraC2s       p-vector to spherical
15580
15581        Reference:
15582           Perryman M.A.C. & ESA, 1997, ESA SP-1200, The Hipparcos and Tycho
15583           catalogues.  Astrometric and photometric star catalogues
15584           derived from the ESA Hipparcos Space Astrometry Mission.  ESA
15585           Publications Division, Noordwijk, Netherlands.
15586
15587        This revision:   2021 January 25
15588
15589        Copyright (C) 2013-2021, NumFOCUS Foundation.
15590        Derived, with permission, from the SOFA library.  See notes at end of file.
15591
15592    """
15593    dr, dd = ufunc.g2icrs(dl, db)
15594    return dr, dd
15595
15596
15597def icrs2g(dr, dd):
15598    """
15599    Transformation from ICRS to Galactic Coordinates.
15600
15601    Parameters
15602    ----------
15603    dr : double array
15604    dd : double array
15605
15606    Returns
15607    -------
15608    dl : double array
15609    db : double array
15610
15611    Notes
15612    -----
15613    Wraps ERFA function ``eraIcrs2g``. The ERFA documentation is::
15614
15615        - - - - - - - - - -
15616         e r a I c r s 2 g
15617        - - - - - - - - - -
15618
15619        Transformation from ICRS to Galactic Coordinates.
15620
15621        Given:
15622           dr     double      ICRS right ascension (radians)
15623           dd     double      ICRS declination (radians)
15624
15625        Returned:
15626           dl     double      galactic longitude (radians)
15627           db     double      galactic latitude (radians)
15628
15629        Notes:
15630
15631        1) The IAU 1958 system of Galactic coordinates was defined with
15632           respect to the now obsolete reference system FK4 B1950.0.  When
15633           interpreting the system in a modern context, several factors have
15634           to be taken into account:
15635
15636           . The inclusion in FK4 positions of the E-terms of aberration.
15637
15638           . The distortion of the FK4 proper motion system by differential
15639             Galactic rotation.
15640
15641           . The use of the B1950.0 equinox rather than the now-standard
15642             J2000.0.
15643
15644           . The frame bias between ICRS and the J2000.0 mean place system.
15645
15646           The Hipparcos Catalogue (Perryman & ESA 1997) provides a rotation
15647           matrix that transforms directly between ICRS and Galactic
15648           coordinates with the above factors taken into account.  The
15649           matrix is derived from three angles, namely the ICRS coordinates
15650           of the Galactic pole and the longitude of the ascending node of
15651           the galactic equator on the ICRS equator.  They are given in
15652           degrees to five decimal places and for canonical purposes are
15653           regarded as exact.  In the Hipparcos Catalogue the matrix
15654           elements are given to 10 decimal places (about 20 microarcsec).
15655           In the present ERFA function the matrix elements have been
15656           recomputed from the canonical three angles and are given to 30
15657           decimal places.
15658
15659        2) The inverse transformation is performed by the function eraG2icrs.
15660
15661        Called:
15662           eraAnp       normalize angle into range 0 to 2pi
15663           eraAnpm      normalize angle into range +/- pi
15664           eraS2c       spherical coordinates to unit vector
15665           eraRxp       product of r-matrix and p-vector
15666           eraC2s       p-vector to spherical
15667
15668        Reference:
15669           Perryman M.A.C. & ESA, 1997, ESA SP-1200, The Hipparcos and Tycho
15670           catalogues.  Astrometric and photometric star catalogues
15671           derived from the ESA Hipparcos Space Astrometry Mission.  ESA
15672           Publications Division, Noordwijk, Netherlands.
15673
15674        This revision:   2021 January 25
15675
15676        Copyright (C) 2013-2021, NumFOCUS Foundation.
15677        Derived, with permission, from the SOFA library.  See notes at end of file.
15678
15679    """
15680    dl, db = ufunc.icrs2g(dr, dd)
15681    return dl, db
15682
15683
15684def eform(n):
15685    """
15686    Earth reference ellipsoids.
15687
15688    Parameters
15689    ----------
15690    n : int array
15691
15692    Returns
15693    -------
15694    a : double array
15695    f : double array
15696
15697    Notes
15698    -----
15699    Wraps ERFA function ``eraEform``. The ERFA documentation is::
15700
15701        - - - - - - - - -
15702         e r a E f o r m
15703        - - - - - - - - -
15704
15705        Earth reference ellipsoids.
15706
15707        Given:
15708           n    int         ellipsoid identifier (Note 1)
15709
15710        Returned:
15711           a    double      equatorial radius (meters, Note 2)
15712           f    double      flattening (Note 2)
15713
15714        Returned (function value):
15715                int         status:  0 = OK
15716                                    -1 = illegal identifier (Note 3)
15717
15718        Notes:
15719
15720        1) The identifier n is a number that specifies the choice of
15721           reference ellipsoid.  The following are supported:
15722
15723              n    ellipsoid
15724
15725              1     ERFA_WGS84
15726              2     ERFA_GRS80
15727              3     ERFA_WGS72
15728
15729           The n value has no significance outside the ERFA software.  For
15730           convenience, symbols ERFA_WGS84 etc. are defined in erfam.h.
15731
15732        2) The ellipsoid parameters are returned in the form of equatorial
15733           radius in meters (a) and flattening (f).  The latter is a number
15734           around 0.00335, i.e. around 1/298.
15735
15736        3) For the case where an unsupported n value is supplied, zero a and
15737           f are returned, as well as error status.
15738
15739        References:
15740
15741           Department of Defense World Geodetic System 1984, National
15742           Imagery and Mapping Agency Technical Report 8350.2, Third
15743           Edition, p3-2.
15744
15745           Moritz, H., Bull. Geodesique 66-2, 187 (1992).
15746
15747           The Department of Defense World Geodetic System 1972, World
15748           Geodetic System Committee, May 1974.
15749
15750           Explanatory Supplement to the Astronomical Almanac,
15751           P. Kenneth Seidelmann (ed), University Science Books (1992),
15752           p220.
15753
15754        This revision:  2021 May 11
15755
15756        Copyright (C) 2013-2021, NumFOCUS Foundation.
15757        Derived, with permission, from the SOFA library.  See notes at end of file.
15758
15759    """
15760    a, f, c_retval = ufunc.eform(n)
15761    check_errwarn(c_retval, 'eform')
15762    return a, f
15763
15764
15765STATUS_CODES['eform'] = {
15766    0: 'OK',
15767    -1: 'illegal identifier (Note 3)',
15768}
15769
15770
15771def gc2gd(n, xyz):
15772    """
15773    Transform geocentric coordinates to geodetic using the specified
15774    reference ellipsoid.
15775
15776    Parameters
15777    ----------
15778    n : int array
15779    xyz : double array
15780
15781    Returns
15782    -------
15783    elong : double array
15784    phi : double array
15785    height : double array
15786
15787    Notes
15788    -----
15789    Wraps ERFA function ``eraGc2gd``. The ERFA documentation is::
15790
15791        - - - - - - - - -
15792         e r a G c 2 g d
15793        - - - - - - - - -
15794
15795        Transform geocentric coordinates to geodetic using the specified
15796        reference ellipsoid.
15797
15798        Given:
15799           n       int        ellipsoid identifier (Note 1)
15800           xyz     double[3]  geocentric vector (Note 2)
15801
15802        Returned:
15803           elong   double     longitude (radians, east +ve, Note 3)
15804           phi     double     latitude (geodetic, radians, Note 3)
15805           height  double     height above ellipsoid (geodetic, Notes 2,3)
15806
15807        Returned (function value):
15808                  int         status:  0 = OK
15809                                      -1 = illegal identifier (Note 3)
15810                                      -2 = internal error (Note 3)
15811
15812        Notes:
15813
15814        1) The identifier n is a number that specifies the choice of
15815           reference ellipsoid.  The following are supported:
15816
15817              n    ellipsoid
15818
15819              1     ERFA_WGS84
15820              2     ERFA_GRS80
15821              3     ERFA_WGS72
15822
15823           The n value has no significance outside the ERFA software.  For
15824           convenience, symbols ERFA_WGS84 etc. are defined in erfam.h.
15825
15826        2) The geocentric vector (xyz, given) and height (height, returned)
15827           are in meters.
15828
15829        3) An error status -1 means that the identifier n is illegal.  An
15830           error status -2 is theoretically impossible.  In all error cases,
15831           all three results are set to -1e9.
15832
15833        4) The inverse transformation is performed in the function eraGd2gc.
15834
15835        Called:
15836           eraEform     Earth reference ellipsoids
15837           eraGc2gde    geocentric to geodetic transformation, general
15838
15839        This revision:  2021 May 11
15840
15841        Copyright (C) 2013-2021, NumFOCUS Foundation.
15842        Derived, with permission, from the SOFA library.  See notes at end of file.
15843
15844    """
15845    elong, phi, height, c_retval = ufunc.gc2gd(n, xyz)
15846    check_errwarn(c_retval, 'gc2gd')
15847    return elong, phi, height
15848
15849
15850STATUS_CODES['gc2gd'] = {
15851    0: 'OK',
15852    -1: 'illegal identifier (Note 3)',
15853    -2: 'internal error (Note 3)',
15854}
15855
15856
15857def gc2gde(a, f, xyz):
15858    """
15859    Transform geocentric coordinates to geodetic for a reference
15860    ellipsoid of specified form.
15861
15862    Parameters
15863    ----------
15864    a : double array
15865    f : double array
15866    xyz : double array
15867
15868    Returns
15869    -------
15870    elong : double array
15871    phi : double array
15872    height : double array
15873
15874    Notes
15875    -----
15876    Wraps ERFA function ``eraGc2gde``. The ERFA documentation is::
15877
15878        - - - - - - - - - -
15879         e r a G c 2 g d e
15880        - - - - - - - - - -
15881
15882        Transform geocentric coordinates to geodetic for a reference
15883        ellipsoid of specified form.
15884
15885        Given:
15886           a       double     equatorial radius (Notes 2,4)
15887           f       double     flattening (Note 3)
15888           xyz     double[3]  geocentric vector (Note 4)
15889
15890        Returned:
15891           elong   double     longitude (radians, east +ve)
15892           phi     double     latitude (geodetic, radians)
15893           height  double     height above ellipsoid (geodetic, Note 4)
15894
15895        Returned (function value):
15896                   int        status:  0 = OK
15897                                      -1 = illegal f
15898                                      -2 = illegal a
15899
15900        Notes:
15901
15902        1) This function is based on the GCONV2H Fortran subroutine by
15903           Toshio Fukushima (see reference).
15904
15905        2) The equatorial radius, a, can be in any units, but meters is
15906           the conventional choice.
15907
15908        3) The flattening, f, is (for the Earth) a value around 0.00335,
15909           i.e. around 1/298.
15910
15911        4) The equatorial radius, a, and the geocentric vector, xyz,
15912           must be given in the same units, and determine the units of
15913           the returned height, height.
15914
15915        5) If an error occurs (status < 0), elong, phi and height are
15916           unchanged.
15917
15918        6) The inverse transformation is performed in the function
15919           eraGd2gce.
15920
15921        7) The transformation for a standard ellipsoid (such as ERFA_WGS84) can
15922           more conveniently be performed by calling eraGc2gd, which uses a
15923           numerical code to identify the required A and F values.
15924
15925        Reference:
15926
15927           Fukushima, T., "Transformation from Cartesian to geodetic
15928           coordinates accelerated by Halley's method", J.Geodesy (2006)
15929           79: 689-693
15930
15931        This revision:  2021 May 11
15932
15933        Copyright (C) 2013-2021, NumFOCUS Foundation.
15934        Derived, with permission, from the SOFA library.  See notes at end of file.
15935
15936    """
15937    elong, phi, height, c_retval = ufunc.gc2gde(a, f, xyz)
15938    check_errwarn(c_retval, 'gc2gde')
15939    return elong, phi, height
15940
15941
15942STATUS_CODES['gc2gde'] = {
15943    0: 'OK',
15944    -1: 'illegal f',
15945    -2: 'illegal a',
15946}
15947
15948
15949def gd2gc(n, elong, phi, height):
15950    """
15951    Transform geodetic coordinates to geocentric using the specified
15952    reference ellipsoid.
15953
15954    Parameters
15955    ----------
15956    n : int array
15957    elong : double array
15958    phi : double array
15959    height : double array
15960
15961    Returns
15962    -------
15963    xyz : double array
15964
15965    Notes
15966    -----
15967    Wraps ERFA function ``eraGd2gc``. The ERFA documentation is::
15968
15969        - - - - - - - - -
15970         e r a G d 2 g c
15971        - - - - - - - - -
15972
15973        Transform geodetic coordinates to geocentric using the specified
15974        reference ellipsoid.
15975
15976        Given:
15977           n       int        ellipsoid identifier (Note 1)
15978           elong   double     longitude (radians, east +ve)
15979           phi     double     latitude (geodetic, radians, Note 3)
15980           height  double     height above ellipsoid (geodetic, Notes 2,3)
15981
15982        Returned:
15983           xyz     double[3]  geocentric vector (Note 2)
15984
15985        Returned (function value):
15986                   int        status:  0 = OK
15987                                      -1 = illegal identifier (Note 3)
15988                                      -2 = illegal case (Note 3)
15989
15990        Notes:
15991
15992        1) The identifier n is a number that specifies the choice of
15993           reference ellipsoid.  The following are supported:
15994
15995              n    ellipsoid
15996
15997              1     ERFA_WGS84
15998              2     ERFA_GRS80
15999              3     ERFA_WGS72
16000
16001           The n value has no significance outside the ERFA software.  For
16002           convenience, symbols ERFA_WGS84 etc. are defined in erfam.h.
16003
16004        2) The height (height, given) and the geocentric vector (xyz,
16005           returned) are in meters.
16006
16007        3) No validation is performed on the arguments elong, phi and
16008           height.  An error status -1 means that the identifier n is
16009           illegal.  An error status -2 protects against cases that would
16010           lead to arithmetic exceptions.  In all error cases, xyz is set
16011           to zeros.
16012
16013        4) The inverse transformation is performed in the function eraGc2gd.
16014
16015        Called:
16016           eraEform     Earth reference ellipsoids
16017           eraGd2gce    geodetic to geocentric transformation, general
16018           eraZp        zero p-vector
16019
16020        This revision:  2021 May 11
16021
16022        Copyright (C) 2013-2021, NumFOCUS Foundation.
16023        Derived, with permission, from the SOFA library.  See notes at end of file.
16024
16025    """
16026    xyz, c_retval = ufunc.gd2gc(n, elong, phi, height)
16027    check_errwarn(c_retval, 'gd2gc')
16028    return xyz
16029
16030
16031STATUS_CODES['gd2gc'] = {
16032    0: 'OK',
16033    -1: 'illegal identifier (Note 3)',
16034    -2: 'illegal case (Note 3)',
16035}
16036
16037
16038def gd2gce(a, f, elong, phi, height):
16039    """
16040    Transform geodetic coordinates to geocentric for a reference
16041    ellipsoid of specified form.
16042
16043    Parameters
16044    ----------
16045    a : double array
16046    f : double array
16047    elong : double array
16048    phi : double array
16049    height : double array
16050
16051    Returns
16052    -------
16053    xyz : double array
16054
16055    Notes
16056    -----
16057    Wraps ERFA function ``eraGd2gce``. The ERFA documentation is::
16058
16059        - - - - - - - - - -
16060         e r a G d 2 g c e
16061        - - - - - - - - - -
16062
16063        Transform geodetic coordinates to geocentric for a reference
16064        ellipsoid of specified form.
16065
16066        Given:
16067           a       double     equatorial radius (Notes 1,4)
16068           f       double     flattening (Notes 2,4)
16069           elong   double     longitude (radians, east +ve)
16070           phi     double     latitude (geodetic, radians, Note 4)
16071           height  double     height above ellipsoid (geodetic, Notes 3,4)
16072
16073        Returned:
16074           xyz     double[3]  geocentric vector (Note 3)
16075
16076        Returned (function value):
16077                   int        status:  0 = OK
16078                                      -1 = illegal case (Note 4)
16079        Notes:
16080
16081        1) The equatorial radius, a, can be in any units, but meters is
16082           the conventional choice.
16083
16084        2) The flattening, f, is (for the Earth) a value around 0.00335,
16085           i.e. around 1/298.
16086
16087        3) The equatorial radius, a, and the height, height, must be
16088           given in the same units, and determine the units of the
16089           returned geocentric vector, xyz.
16090
16091        4) No validation is performed on individual arguments.  The error
16092           status -1 protects against (unrealistic) cases that would lead
16093           to arithmetic exceptions.  If an error occurs, xyz is unchanged.
16094
16095        5) The inverse transformation is performed in the function
16096           eraGc2gde.
16097
16098        6) The transformation for a standard ellipsoid (such as ERFA_WGS84) can
16099           more conveniently be performed by calling eraGd2gc,  which uses a
16100           numerical code to identify the required a and f values.
16101
16102        References:
16103
16104           Green, R.M., Spherical Astronomy, Cambridge University Press,
16105           (1985) Section 4.5, p96.
16106
16107           Explanatory Supplement to the Astronomical Almanac,
16108           P. Kenneth Seidelmann (ed), University Science Books (1992),
16109           Section 4.22, p202.
16110
16111        This revision:  2021 May 11
16112
16113        Copyright (C) 2013-2021, NumFOCUS Foundation.
16114        Derived, with permission, from the SOFA library.  See notes at end of file.
16115
16116    """
16117    xyz, c_retval = ufunc.gd2gce(a, f, elong, phi, height)
16118    check_errwarn(c_retval, 'gd2gce')
16119    return xyz
16120
16121
16122STATUS_CODES['gd2gce'] = {
16123    0: 'OK',
16124    -1: 'illegal case (Note 4)Notes:',
16125}
16126
16127
16128def d2dtf(scale, ndp, d1, d2):
16129    """
16130    Format for output a 2-part Julian Date (or in the case of UTC a
16131    quasi-JD form that includes special provision for leap seconds).
16132
16133    Parameters
16134    ----------
16135    scale : const char array
16136    ndp : int array
16137    d1 : double array
16138    d2 : double array
16139
16140    Returns
16141    -------
16142    iy : int array
16143    im : int array
16144    id : int array
16145    ihmsf : int array
16146
16147    Notes
16148    -----
16149    Wraps ERFA function ``eraD2dtf``. The ERFA documentation is::
16150
16151        - - - - - - - - -
16152         e r a D 2 d t f
16153        - - - - - - - - -
16154
16155        Format for output a 2-part Julian Date (or in the case of UTC a
16156        quasi-JD form that includes special provision for leap seconds).
16157
16158        Given:
16159           scale     char[]  time scale ID (Note 1)
16160           ndp       int     resolution (Note 2)
16161           d1,d2     double  time as a 2-part Julian Date (Notes 3,4)
16162
16163        Returned:
16164           iy,im,id  int     year, month, day in Gregorian calendar (Note 5)
16165           ihmsf     int[4]  hours, minutes, seconds, fraction (Note 1)
16166
16167        Returned (function value):
16168                     int     status: +1 = dubious year (Note 5)
16169                                      0 = OK
16170                                     -1 = unacceptable date (Note 6)
16171
16172        Notes:
16173
16174        1) scale identifies the time scale.  Only the value "UTC" (in upper
16175           case) is significant, and enables handling of leap seconds (see
16176           Note 4).
16177
16178        2) ndp is the number of decimal places in the seconds field, and can
16179           have negative as well as positive values, such as:
16180
16181           ndp         resolution
16182           -4            1 00 00
16183           -3            0 10 00
16184           -2            0 01 00
16185           -1            0 00 10
16186            0            0 00 01
16187            1            0 00 00.1
16188            2            0 00 00.01
16189            3            0 00 00.001
16190
16191           The limits are platform dependent, but a safe range is -5 to +9.
16192
16193        3) d1+d2 is Julian Date, apportioned in any convenient way between
16194           the two arguments, for example where d1 is the Julian Day Number
16195           and d2 is the fraction of a day.  In the case of UTC, where the
16196           use of JD is problematical, special conventions apply:  see the
16197           next note.
16198
16199        4) JD cannot unambiguously represent UTC during a leap second unless
16200           special measures are taken.  The ERFA internal convention is that
16201           the quasi-JD day represents UTC days whether the length is 86399,
16202           86400 or 86401 SI seconds.  In the 1960-1972 era there were
16203           smaller jumps (in either direction) each time the linear UTC(TAI)
16204           expression was changed, and these "mini-leaps" are also included
16205           in the ERFA convention.
16206
16207        5) The warning status "dubious year" flags UTCs that predate the
16208           introduction of the time scale or that are too far in the future
16209           to be trusted.  See eraDat for further details.
16210
16211        6) For calendar conventions and limitations, see eraCal2jd.
16212
16213        Called:
16214           eraJd2cal    JD to Gregorian calendar
16215           eraD2tf      decompose days to hms
16216           eraDat       delta(AT) = TAI-UTC
16217
16218        This revision:  2021 May 11
16219
16220        Copyright (C) 2013-2021, NumFOCUS Foundation.
16221        Derived, with permission, from the SOFA library.  See notes at end of file.
16222
16223    """
16224    iy, im, id, ihmsf, c_retval = ufunc.d2dtf(scale, ndp, d1, d2)
16225    check_errwarn(c_retval, 'd2dtf')
16226    return iy, im, id, ihmsf
16227
16228
16229STATUS_CODES['d2dtf'] = {
16230    1: 'dubious year (Note 5)',
16231    0: 'OK',
16232    -1: 'unacceptable date (Note 6)',
16233}
16234
16235
16236def dat(iy, im, id, fd):
16237    """
16238    For a given UTC date, calculate Delta(AT) = TAI-UTC.
16239
16240    Parameters
16241    ----------
16242    iy : int array
16243    im : int array
16244    id : int array
16245    fd : double array
16246
16247    Returns
16248    -------
16249    deltat : double array
16250
16251    Notes
16252    -----
16253    Wraps ERFA function ``eraDat``. The ERFA documentation is::
16254
16255        - - - - - - -
16256         e r a D a t
16257        - - - - - - -
16258
16259        For a given UTC date, calculate Delta(AT) = TAI-UTC.
16260
16261           :------------------------------------------:
16262           :                                          :
16263           :                 IMPORTANT                :
16264           :                                          :
16265           :  A new version of this function must be  :
16266           :  produced whenever a new leap second is  :
16267           :  announced.  There are four items to     :
16268           :  change on each such occasion:           :
16269           :                                          :
16270           :  1) A new line must be added to the set  :
16271           :     of statements that initialize the    :
16272           :     array "changes".                     :
16273           :                                          :
16274           :  2) The constant IYV must be set to the  :
16275           :     current year.                        :
16276           :                                          :
16277           :  3) The "Latest leap second" comment     :
16278           :     below must be set to the new leap    :
16279           :     second date.                         :
16280           :                                          :
16281           :  4) The "This revision" comment, later,  :
16282           :     must be set to the current date.     :
16283           :                                          :
16284           :  Change (2) must also be carried out     :
16285           :  whenever the function is re-issued,     :
16286           :  even if no leap seconds have been       :
16287           :  added.                                  :
16288           :                                          :
16289           :  Latest leap second:  2016 December 31   :
16290           :                                          :
16291           :__________________________________________:
16292
16293        Given:
16294           iy     int      UTC:  year (Notes 1 and 2)
16295           im     int            month (Note 2)
16296           id     int            day (Notes 2 and 3)
16297           fd     double         fraction of day (Note 4)
16298
16299        Returned:
16300           deltat double   TAI minus UTC, seconds
16301
16302        Returned (function value):
16303                  int      status (Note 5):
16304                             1 = dubious year (Note 1)
16305                             0 = OK
16306                            -1 = bad year
16307                            -2 = bad month
16308                            -3 = bad day (Note 3)
16309                            -4 = bad fraction (Note 4)
16310                            -5 = internal error (Note 5)
16311
16312        Notes:
16313
16314        1) UTC began at 1960 January 1.0 (JD 2436934.5) and it is improper
16315           to call the function with an earlier date.  If this is attempted,
16316           zero is returned together with a warning status.
16317
16318           Because leap seconds cannot, in principle, be predicted in
16319           advance, a reliable check for dates beyond the valid range is
16320           impossible.  To guard against gross errors, a year five or more
16321           after the release year of the present function (see the constant
16322           IYV) is considered dubious.  In this case a warning status is
16323           returned but the result is computed in the normal way.
16324
16325           For both too-early and too-late years, the warning status is +1.
16326           This is distinct from the error status -1, which signifies a year
16327           so early that JD could not be computed.
16328
16329        2) If the specified date is for a day which ends with a leap second,
16330           the TAI-UTC value returned is for the period leading up to the
16331           leap second.  If the date is for a day which begins as a leap
16332           second ends, the TAI-UTC returned is for the period following the
16333           leap second.
16334
16335        3) The day number must be in the normal calendar range, for example
16336           1 through 30 for April.  The "almanac" convention of allowing
16337           such dates as January 0 and December 32 is not supported in this
16338           function, in order to avoid confusion near leap seconds.
16339
16340        4) The fraction of day is used only for dates before the
16341           introduction of leap seconds, the first of which occurred at the
16342           end of 1971.  It is tested for validity (0 to 1 is the valid
16343           range) even if not used;  if invalid, zero is used and status -4
16344           is returned.  For many applications, setting fd to zero is
16345           acceptable;  the resulting error is always less than 3 ms (and
16346           occurs only pre-1972).
16347
16348        5) The status value returned in the case where there are multiple
16349           errors refers to the first error detected.  For example, if the
16350           month and day are 13 and 32 respectively, status -2 (bad month)
16351           will be returned.  The "internal error" status refers to a
16352           case that is impossible but causes some compilers to issue a
16353           warning.
16354
16355        6) In cases where a valid result is not available, zero is returned.
16356
16357        References:
16358
16359        1) For dates from 1961 January 1 onwards, the expressions from the
16360           file ftp://maia.usno.navy.mil/ser7/tai-utc.dat are used.
16361
16362        2) The 5ms timestep at 1961 January 1 is taken from 2.58.1 (p87) of
16363           the 1992 Explanatory Supplement.
16364
16365        Called:
16366           eraCal2jd    Gregorian calendar to JD
16367
16368        This revision:  2021 May 11
16369
16370        Copyright (C) 2013-2021, NumFOCUS Foundation.
16371        Derived, with permission, from the SOFA library.  See notes at end of file.
16372
16373    """
16374    deltat, c_retval = ufunc.dat(iy, im, id, fd)
16375    check_errwarn(c_retval, 'dat')
16376    return deltat
16377
16378
16379STATUS_CODES['dat'] = {
16380    1: 'dubious year (Note 1)',
16381    0: 'OK',
16382    -1: 'bad year',
16383    -2: 'bad month',
16384    -3: 'bad day (Note 3)',
16385    -4: 'bad fraction (Note 4)',
16386    -5: 'internal error (Note 5)',
16387}
16388
16389
16390def dtdb(date1, date2, ut, elong, u, v):
16391    """
16392    An approximation to TDB-TT, the difference between barycentric
16393    dynamical time and terrestrial time, for an observer on the Earth.
16394
16395    Parameters
16396    ----------
16397    date1 : double array
16398    date2 : double array
16399    ut : double array
16400    elong : double array
16401    u : double array
16402    v : double array
16403
16404    Returns
16405    -------
16406    c_retval : double array
16407
16408    Notes
16409    -----
16410    Wraps ERFA function ``eraDtdb``. The ERFA documentation is::
16411
16412        - - - - - - - -
16413         e r a D t d b
16414        - - - - - - - -
16415
16416        An approximation to TDB-TT, the difference between barycentric
16417        dynamical time and terrestrial time, for an observer on the Earth.
16418
16419        The different time scales - proper, coordinate and realized - are
16420        related to each other:
16421
16422                  TAI             <-  physically realized
16423                   :
16424                offset            <-  observed (nominally +32.184s)
16425                   :
16426                  TT              <-  terrestrial time
16427                   :
16428          rate adjustment (L_G)   <-  definition of TT
16429                   :
16430                  TCG             <-  time scale for GCRS
16431                   :
16432            "periodic" terms      <-  eraDtdb  is an implementation
16433                   :
16434          rate adjustment (L_C)   <-  function of solar-system ephemeris
16435                   :
16436                  TCB             <-  time scale for BCRS
16437                   :
16438          rate adjustment (-L_B)  <-  definition of TDB
16439                   :
16440                  TDB             <-  TCB scaled to track TT
16441                   :
16442            "periodic" terms      <-  -eraDtdb is an approximation
16443                   :
16444                  TT              <-  terrestrial time
16445
16446        Adopted values for the various constants can be found in the IERS
16447        Conventions (McCarthy & Petit 2003).
16448
16449        Given:
16450           date1,date2   double  date, TDB (Notes 1-3)
16451           ut            double  universal time (UT1, fraction of one day)
16452           elong         double  longitude (east positive, radians)
16453           u             double  distance from Earth spin axis (km)
16454           v             double  distance north of equatorial plane (km)
16455
16456        Returned (function value):
16457                         double  TDB-TT (seconds)
16458
16459        Notes:
16460
16461        1) The date date1+date2 is a Julian Date, apportioned in any
16462           convenient way between the two arguments.  For example,
16463           JD(TT)=2450123.7 could be expressed in any of these ways,
16464           among others:
16465
16466                  date1          date2
16467
16468               2450123.7           0.0       (JD method)
16469               2451545.0       -1421.3       (J2000 method)
16470               2400000.5       50123.2       (MJD method)
16471               2450123.5           0.2       (date & time method)
16472
16473           The JD method is the most natural and convenient to use in
16474           cases where the loss of several decimal digits of resolution
16475           is acceptable.  The J2000 method is best matched to the way
16476           the argument is handled internally and will deliver the
16477           optimum resolution.  The MJD method and the date & time methods
16478           are both good compromises between resolution and convenience.
16479
16480           Although the date is, formally, barycentric dynamical time (TDB),
16481           the terrestrial dynamical time (TT) can be used with no practical
16482           effect on the accuracy of the prediction.
16483
16484        2) TT can be regarded as a coordinate time that is realized as an
16485           offset of 32.184s from International Atomic Time, TAI.  TT is a
16486           specific linear transformation of geocentric coordinate time TCG,
16487           which is the time scale for the Geocentric Celestial Reference
16488           System, GCRS.
16489
16490        3) TDB is a coordinate time, and is a specific linear transformation
16491           of barycentric coordinate time TCB, which is the time scale for
16492           the Barycentric Celestial Reference System, BCRS.
16493
16494        4) The difference TCG-TCB depends on the masses and positions of the
16495           bodies of the solar system and the velocity of the Earth.  It is
16496           dominated by a rate difference, the residual being of a periodic
16497           character.  The latter, which is modeled by the present function,
16498           comprises a main (annual) sinusoidal term of amplitude
16499           approximately 0.00166 seconds, plus planetary terms up to about
16500           20 microseconds, and lunar and diurnal terms up to 2 microseconds.
16501           These effects come from the changing transverse Doppler effect
16502           and gravitational red-shift as the observer (on the Earth's
16503           surface) experiences variations in speed (with respect to the
16504           BCRS) and gravitational potential.
16505
16506        5) TDB can be regarded as the same as TCB but with a rate adjustment
16507           to keep it close to TT, which is convenient for many applications.
16508           The history of successive attempts to define TDB is set out in
16509           Resolution 3 adopted by the IAU General Assembly in 2006, which
16510           defines a fixed TDB(TCB) transformation that is consistent with
16511           contemporary solar-system ephemerides.  Future ephemerides will
16512           imply slightly changed transformations between TCG and TCB, which
16513           could introduce a linear drift between TDB and TT;  however, any
16514           such drift is unlikely to exceed 1 nanosecond per century.
16515
16516        6) The geocentric TDB-TT model used in the present function is that of
16517           Fairhead & Bretagnon (1990), in its full form.  It was originally
16518           supplied by Fairhead (private communications with P.T.Wallace,
16519           1990) as a Fortran subroutine.  The present C function contains an
16520           adaptation of the Fairhead code.  The numerical results are
16521           essentially unaffected by the changes, the differences with
16522           respect to the Fairhead & Bretagnon original being at the 1e-20 s
16523           level.
16524
16525           The topocentric part of the model is from Moyer (1981) and
16526           Murray (1983), with fundamental arguments adapted from
16527           Simon et al. 1994.  It is an approximation to the expression
16528           ( v / c ) . ( r / c ), where v is the barycentric velocity of
16529           the Earth, r is the geocentric position of the observer and
16530           c is the speed of light.
16531
16532           By supplying zeroes for u and v, the topocentric part of the
16533           model can be nullified, and the function will return the Fairhead
16534           & Bretagnon result alone.
16535
16536        7) During the interval 1950-2050, the absolute accuracy is better
16537           than +/- 3 nanoseconds relative to time ephemerides obtained by
16538           direct numerical integrations based on the JPL DE405 solar system
16539           ephemeris.
16540
16541        8) It must be stressed that the present function is merely a model,
16542           and that numerical integration of solar-system ephemerides is the
16543           definitive method for predicting the relationship between TCG and
16544           TCB and hence between TT and TDB.
16545
16546        References:
16547
16548           Fairhead, L., & Bretagnon, P., Astron.Astrophys., 229, 240-247
16549           (1990).
16550
16551           IAU 2006 Resolution 3.
16552
16553           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
16554           IERS Technical Note No. 32, BKG (2004)
16555
16556           Moyer, T.D., Cel.Mech., 23, 33 (1981).
16557
16558           Murray, C.A., Vectorial Astrometry, Adam Hilger (1983).
16559
16560           Seidelmann, P.K. et al., Explanatory Supplement to the
16561           Astronomical Almanac, Chapter 2, University Science Books (1992).
16562
16563           Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M.,
16564           Francou, G. & Laskar, J., Astron.Astrophys., 282, 663-683 (1994).
16565
16566        This revision:  2021 May 11
16567
16568        Copyright (C) 2013-2021, NumFOCUS Foundation.
16569        Derived, with permission, from the SOFA library.  See notes at end of file.
16570
16571    """
16572    c_retval = ufunc.dtdb(date1, date2, ut, elong, u, v)
16573    return c_retval
16574
16575
16576def dtf2d(scale, iy, im, id, ihr, imn, sec):
16577    """
16578    Encode date and time fields into 2-part Julian Date (or in the case
16579    of UTC a quasi-JD form that includes special provision for leap
16580    seconds).
16581
16582    Parameters
16583    ----------
16584    scale : const char array
16585    iy : int array
16586    im : int array
16587    id : int array
16588    ihr : int array
16589    imn : int array
16590    sec : double array
16591
16592    Returns
16593    -------
16594    d1 : double array
16595    d2 : double array
16596
16597    Notes
16598    -----
16599    Wraps ERFA function ``eraDtf2d``. The ERFA documentation is::
16600
16601        - - - - - - - - -
16602         e r a D t f 2 d
16603        - - - - - - - - -
16604
16605        Encode date and time fields into 2-part Julian Date (or in the case
16606        of UTC a quasi-JD form that includes special provision for leap
16607        seconds).
16608
16609        Given:
16610           scale     char[]  time scale ID (Note 1)
16611           iy,im,id  int     year, month, day in Gregorian calendar (Note 2)
16612           ihr,imn   int     hour, minute
16613           sec       double  seconds
16614
16615        Returned:
16616           d1,d2     double  2-part Julian Date (Notes 3,4)
16617
16618        Returned (function value):
16619                     int     status: +3 = both of next two
16620                                     +2 = time is after end of day (Note 5)
16621                                     +1 = dubious year (Note 6)
16622                                      0 = OK
16623                                     -1 = bad year
16624                                     -2 = bad month
16625                                     -3 = bad day
16626                                     -4 = bad hour
16627                                     -5 = bad minute
16628                                     -6 = bad second (<0)
16629
16630        Notes:
16631
16632        1) scale identifies the time scale.  Only the value "UTC" (in upper
16633           case) is significant, and enables handling of leap seconds (see
16634           Note 4).
16635
16636        2) For calendar conventions and limitations, see eraCal2jd.
16637
16638        3) The sum of the results, d1+d2, is Julian Date, where normally d1
16639           is the Julian Day Number and d2 is the fraction of a day.  In the
16640           case of UTC, where the use of JD is problematical, special
16641           conventions apply:  see the next note.
16642
16643        4) JD cannot unambiguously represent UTC during a leap second unless
16644           special measures are taken.  The ERFA internal convention is that
16645           the quasi-JD day represents UTC days whether the length is 86399,
16646           86400 or 86401 SI seconds.  In the 1960-1972 era there were
16647           smaller jumps (in either direction) each time the linear UTC(TAI)
16648           expression was changed, and these "mini-leaps" are also included
16649           in the ERFA convention.
16650
16651        5) The warning status "time is after end of day" usually means that
16652           the sec argument is greater than 60.0.  However, in a day ending
16653           in a leap second the limit changes to 61.0 (or 59.0 in the case
16654           of a negative leap second).
16655
16656        6) The warning status "dubious year" flags UTCs that predate the
16657           introduction of the time scale or that are too far in the future
16658           to be trusted.  See eraDat for further details.
16659
16660        7) Only in the case of continuous and regular time scales (TAI, TT,
16661           TCG, TCB and TDB) is the result d1+d2 a Julian Date, strictly
16662           speaking.  In the other cases (UT1 and UTC) the result must be
16663           used with circumspection;  in particular the difference between
16664           two such results cannot be interpreted as a precise time
16665           interval.
16666
16667        Called:
16668           eraCal2jd    Gregorian calendar to JD
16669           eraDat       delta(AT) = TAI-UTC
16670           eraJd2cal    JD to Gregorian calendar
16671
16672        This revision:  2021 May 11
16673
16674        Copyright (C) 2013-2021, NumFOCUS Foundation.
16675        Derived, with permission, from the SOFA library.  See notes at end of file.
16676
16677    """
16678    d1, d2, c_retval = ufunc.dtf2d(scale, iy, im, id, ihr, imn, sec)
16679    check_errwarn(c_retval, 'dtf2d')
16680    return d1, d2
16681
16682
16683STATUS_CODES['dtf2d'] = {
16684    3: 'both of next two',
16685    2: 'time is after end of day (Note 5)',
16686    1: 'dubious year (Note 6)',
16687    0: 'OK',
16688    -1: 'bad year',
16689    -2: 'bad month',
16690    -3: 'bad day',
16691    -4: 'bad hour',
16692    -5: 'bad minute',
16693    -6: 'bad second (<0)',
16694}
16695
16696
16697def taitt(tai1, tai2):
16698    """
16699    Time scale transformation:  International Atomic Time, TAI, to
16700    Terrestrial Time, TT.
16701
16702    Parameters
16703    ----------
16704    tai1 : double array
16705    tai2 : double array
16706
16707    Returns
16708    -------
16709    tt1 : double array
16710    tt2 : double array
16711
16712    Notes
16713    -----
16714    Wraps ERFA function ``eraTaitt``. The ERFA documentation is::
16715
16716        - - - - - - - - -
16717         e r a T a i t t
16718        - - - - - - - - -
16719
16720        Time scale transformation:  International Atomic Time, TAI, to
16721        Terrestrial Time, TT.
16722
16723        Given:
16724           tai1,tai2  double    TAI as a 2-part Julian Date
16725
16726        Returned:
16727           tt1,tt2    double    TT as a 2-part Julian Date
16728
16729        Returned (function value):
16730                      int       status:  0 = OK
16731
16732        Note:
16733
16734           tai1+tai2 is Julian Date, apportioned in any convenient way
16735           between the two arguments, for example where tai1 is the Julian
16736           Day Number and tai2 is the fraction of a day.  The returned
16737           tt1,tt2 follow suit.
16738
16739        References:
16740
16741           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
16742           IERS Technical Note No. 32, BKG (2004)
16743
16744           Explanatory Supplement to the Astronomical Almanac,
16745           P. Kenneth Seidelmann (ed), University Science Books (1992)
16746
16747        This revision:  2021 May 11
16748
16749        Copyright (C) 2013-2021, NumFOCUS Foundation.
16750        Derived, with permission, from the SOFA library.  See notes at end of file.
16751
16752    """
16753    tt1, tt2, c_retval = ufunc.taitt(tai1, tai2)
16754    check_errwarn(c_retval, 'taitt')
16755    return tt1, tt2
16756
16757
16758STATUS_CODES['taitt'] = {
16759    0: 'OK',
16760}
16761
16762
16763def taiut1(tai1, tai2, dta):
16764    """
16765    Time scale transformation:  International Atomic Time, TAI, to
16766    Universal Time, UT1.
16767
16768    Parameters
16769    ----------
16770    tai1 : double array
16771    tai2 : double array
16772    dta : double array
16773
16774    Returns
16775    -------
16776    ut11 : double array
16777    ut12 : double array
16778
16779    Notes
16780    -----
16781    Wraps ERFA function ``eraTaiut1``. The ERFA documentation is::
16782
16783        - - - - - - - - - -
16784         e r a T a i u t 1
16785        - - - - - - - - - -
16786
16787        Time scale transformation:  International Atomic Time, TAI, to
16788        Universal Time, UT1.
16789
16790        Given:
16791           tai1,tai2  double    TAI as a 2-part Julian Date
16792           dta        double    UT1-TAI in seconds
16793
16794        Returned:
16795           ut11,ut12  double    UT1 as a 2-part Julian Date
16796
16797        Returned (function value):
16798                      int       status:  0 = OK
16799
16800        Notes:
16801
16802        1) tai1+tai2 is Julian Date, apportioned in any convenient way
16803           between the two arguments, for example where tai1 is the Julian
16804           Day Number and tai2 is the fraction of a day.  The returned
16805           UT11,UT12 follow suit.
16806
16807        2) The argument dta, i.e. UT1-TAI, is an observed quantity, and is
16808           available from IERS tabulations.
16809
16810        Reference:
16811
16812           Explanatory Supplement to the Astronomical Almanac,
16813           P. Kenneth Seidelmann (ed), University Science Books (1992)
16814
16815        This revision:  2021 May 11
16816
16817        Copyright (C) 2013-2021, NumFOCUS Foundation.
16818        Derived, with permission, from the SOFA library.  See notes at end of file.
16819
16820    """
16821    ut11, ut12, c_retval = ufunc.taiut1(tai1, tai2, dta)
16822    check_errwarn(c_retval, 'taiut1')
16823    return ut11, ut12
16824
16825
16826STATUS_CODES['taiut1'] = {
16827    0: 'OK',
16828}
16829
16830
16831def taiutc(tai1, tai2):
16832    """
16833    Time scale transformation:  International Atomic Time, TAI, to
16834    Coordinated Universal Time, UTC.
16835
16836    Parameters
16837    ----------
16838    tai1 : double array
16839    tai2 : double array
16840
16841    Returns
16842    -------
16843    utc1 : double array
16844    utc2 : double array
16845
16846    Notes
16847    -----
16848    Wraps ERFA function ``eraTaiutc``. The ERFA documentation is::
16849
16850        - - - - - - - - - -
16851         e r a T a i u t c
16852        - - - - - - - - - -
16853
16854        Time scale transformation:  International Atomic Time, TAI, to
16855        Coordinated Universal Time, UTC.
16856
16857        Given:
16858           tai1,tai2  double   TAI as a 2-part Julian Date (Note 1)
16859
16860        Returned:
16861           utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 1-3)
16862
16863        Returned (function value):
16864                      int      status: +1 = dubious year (Note 4)
16865                                        0 = OK
16866                                       -1 = unacceptable date
16867
16868        Notes:
16869
16870        1) tai1+tai2 is Julian Date, apportioned in any convenient way
16871           between the two arguments, for example where tai1 is the Julian
16872           Day Number and tai2 is the fraction of a day.  The returned utc1
16873           and utc2 form an analogous pair, except that a special convention
16874           is used, to deal with the problem of leap seconds - see the next
16875           note.
16876
16877        2) JD cannot unambiguously represent UTC during a leap second unless
16878           special measures are taken.  The convention in the present
16879           function is that the JD day represents UTC days whether the
16880           length is 86399, 86400 or 86401 SI seconds.  In the 1960-1972 era
16881           there were smaller jumps (in either direction) each time the
16882           linear UTC(TAI) expression was changed, and these "mini-leaps"
16883           are also included in the ERFA convention.
16884
16885        3) The function eraD2dtf can be used to transform the UTC quasi-JD
16886           into calendar date and clock time, including UTC leap second
16887           handling.
16888
16889        4) The warning status "dubious year" flags UTCs that predate the
16890           introduction of the time scale or that are too far in the future
16891           to be trusted.  See eraDat for further details.
16892
16893        Called:
16894           eraUtctai    UTC to TAI
16895
16896        References:
16897
16898           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
16899           IERS Technical Note No. 32, BKG (2004)
16900
16901           Explanatory Supplement to the Astronomical Almanac,
16902           P. Kenneth Seidelmann (ed), University Science Books (1992)
16903
16904        This revision:  2021 May 11
16905
16906        Copyright (C) 2013-2021, NumFOCUS Foundation.
16907        Derived, with permission, from the SOFA library.  See notes at end of file.
16908
16909    """
16910    utc1, utc2, c_retval = ufunc.taiutc(tai1, tai2)
16911    check_errwarn(c_retval, 'taiutc')
16912    return utc1, utc2
16913
16914
16915STATUS_CODES['taiutc'] = {
16916    1: 'dubious year (Note 4)',
16917    0: 'OK',
16918    -1: 'unacceptable date',
16919}
16920
16921
16922def tcbtdb(tcb1, tcb2):
16923    """
16924    Time scale transformation:  Barycentric Coordinate Time, TCB, to
16925    Barycentric Dynamical Time, TDB.
16926
16927    Parameters
16928    ----------
16929    tcb1 : double array
16930    tcb2 : double array
16931
16932    Returns
16933    -------
16934    tdb1 : double array
16935    tdb2 : double array
16936
16937    Notes
16938    -----
16939    Wraps ERFA function ``eraTcbtdb``. The ERFA documentation is::
16940
16941        - - - - - - - - - -
16942         e r a T c b t d b
16943        - - - - - - - - - -
16944
16945        Time scale transformation:  Barycentric Coordinate Time, TCB, to
16946        Barycentric Dynamical Time, TDB.
16947
16948        Given:
16949           tcb1,tcb2  double    TCB as a 2-part Julian Date
16950
16951        Returned:
16952           tdb1,tdb2  double    TDB as a 2-part Julian Date
16953
16954        Returned (function value):
16955                      int       status:  0 = OK
16956
16957        Notes:
16958
16959        1) tcb1+tcb2 is Julian Date, apportioned in any convenient way
16960           between the two arguments, for example where tcb1 is the Julian
16961           Day Number and tcb2 is the fraction of a day.  The returned
16962           tdb1,tdb2 follow suit.
16963
16964        2) The 2006 IAU General Assembly introduced a conventional linear
16965           transformation between TDB and TCB.  This transformation
16966           compensates for the drift between TCB and terrestrial time TT,
16967           and keeps TDB approximately centered on TT.  Because the
16968           relationship between TT and TCB depends on the adopted solar
16969           system ephemeris, the degree of alignment between TDB and TT over
16970           long intervals will vary according to which ephemeris is used.
16971           Former definitions of TDB attempted to avoid this problem by
16972           stipulating that TDB and TT should differ only by periodic
16973           effects.  This is a good description of the nature of the
16974           relationship but eluded precise mathematical formulation.  The
16975           conventional linear relationship adopted in 2006 sidestepped
16976           these difficulties whilst delivering a TDB that in practice was
16977           consistent with values before that date.
16978
16979        3) TDB is essentially the same as Teph, the time argument for the
16980           JPL solar system ephemerides.
16981
16982        Reference:
16983
16984           IAU 2006 Resolution B3
16985
16986        This revision:  2021 May 11
16987
16988        Copyright (C) 2013-2021, NumFOCUS Foundation.
16989        Derived, with permission, from the SOFA library.  See notes at end of file.
16990
16991    """
16992    tdb1, tdb2, c_retval = ufunc.tcbtdb(tcb1, tcb2)
16993    check_errwarn(c_retval, 'tcbtdb')
16994    return tdb1, tdb2
16995
16996
16997STATUS_CODES['tcbtdb'] = {
16998    0: 'OK',
16999}
17000
17001
17002def tcgtt(tcg1, tcg2):
17003    """
17004    Time scale transformation:  Geocentric Coordinate Time, TCG, to
17005    Terrestrial Time, TT.
17006
17007    Parameters
17008    ----------
17009    tcg1 : double array
17010    tcg2 : double array
17011
17012    Returns
17013    -------
17014    tt1 : double array
17015    tt2 : double array
17016
17017    Notes
17018    -----
17019    Wraps ERFA function ``eraTcgtt``. The ERFA documentation is::
17020
17021        - - - - - - - - -
17022         e r a T c g t t
17023        - - - - - - - - -
17024
17025        Time scale transformation:  Geocentric Coordinate Time, TCG, to
17026        Terrestrial Time, TT.
17027
17028        Given:
17029           tcg1,tcg2  double    TCG as a 2-part Julian Date
17030
17031        Returned:
17032           tt1,tt2    double    TT as a 2-part Julian Date
17033
17034        Returned (function value):
17035                      int       status:  0 = OK
17036
17037        Note:
17038
17039           tcg1+tcg2 is Julian Date, apportioned in any convenient way
17040           between the two arguments, for example where tcg1 is the Julian
17041           Day Number and tcg22 is the fraction of a day.  The returned
17042           tt1,tt2 follow suit.
17043
17044        References:
17045
17046           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17047           IERS Technical Note No. 32, BKG (2004)
17048
17049           IAU 2000 Resolution B1.9
17050
17051        This revision:  2021 May 11
17052
17053        Copyright (C) 2013-2021, NumFOCUS Foundation.
17054        Derived, with permission, from the SOFA library.  See notes at end of file.
17055
17056    """
17057    tt1, tt2, c_retval = ufunc.tcgtt(tcg1, tcg2)
17058    check_errwarn(c_retval, 'tcgtt')
17059    return tt1, tt2
17060
17061
17062STATUS_CODES['tcgtt'] = {
17063    0: 'OK',
17064}
17065
17066
17067def tdbtcb(tdb1, tdb2):
17068    """
17069    Time scale transformation:  Barycentric Dynamical Time, TDB, to
17070    Barycentric Coordinate Time, TCB.
17071
17072    Parameters
17073    ----------
17074    tdb1 : double array
17075    tdb2 : double array
17076
17077    Returns
17078    -------
17079    tcb1 : double array
17080    tcb2 : double array
17081
17082    Notes
17083    -----
17084    Wraps ERFA function ``eraTdbtcb``. The ERFA documentation is::
17085
17086        - - - - - - - - - -
17087         e r a T d b t c b
17088        - - - - - - - - - -
17089
17090        Time scale transformation:  Barycentric Dynamical Time, TDB, to
17091        Barycentric Coordinate Time, TCB.
17092
17093        Given:
17094           tdb1,tdb2  double    TDB as a 2-part Julian Date
17095
17096        Returned:
17097           tcb1,tcb2  double    TCB as a 2-part Julian Date
17098
17099        Returned (function value):
17100                      int       status:  0 = OK
17101
17102        Notes:
17103
17104        1) tdb1+tdb2 is Julian Date, apportioned in any convenient way
17105           between the two arguments, for example where tdb1 is the Julian
17106           Day Number and tdb2 is the fraction of a day.  The returned
17107           tcb1,tcb2 follow suit.
17108
17109        2) The 2006 IAU General Assembly introduced a conventional linear
17110           transformation between TDB and TCB.  This transformation
17111           compensates for the drift between TCB and terrestrial time TT,
17112           and keeps TDB approximately centered on TT.  Because the
17113           relationship between TT and TCB depends on the adopted solar
17114           system ephemeris, the degree of alignment between TDB and TT over
17115           long intervals will vary according to which ephemeris is used.
17116           Former definitions of TDB attempted to avoid this problem by
17117           stipulating that TDB and TT should differ only by periodic
17118           effects.  This is a good description of the nature of the
17119           relationship but eluded precise mathematical formulation.  The
17120           conventional linear relationship adopted in 2006 sidestepped
17121           these difficulties whilst delivering a TDB that in practice was
17122           consistent with values before that date.
17123
17124        3) TDB is essentially the same as Teph, the time argument for the
17125           JPL solar system ephemerides.
17126
17127        Reference:
17128
17129           IAU 2006 Resolution B3
17130
17131        This revision:  2021 May 11
17132
17133        Copyright (C) 2013-2021, NumFOCUS Foundation.
17134        Derived, with permission, from the SOFA library.  See notes at end of file.
17135
17136    """
17137    tcb1, tcb2, c_retval = ufunc.tdbtcb(tdb1, tdb2)
17138    check_errwarn(c_retval, 'tdbtcb')
17139    return tcb1, tcb2
17140
17141
17142STATUS_CODES['tdbtcb'] = {
17143    0: 'OK',
17144}
17145
17146
17147def tdbtt(tdb1, tdb2, dtr):
17148    """
17149    Time scale transformation:  Barycentric Dynamical Time, TDB, to
17150    Terrestrial Time, TT.
17151
17152    Parameters
17153    ----------
17154    tdb1 : double array
17155    tdb2 : double array
17156    dtr : double array
17157
17158    Returns
17159    -------
17160    tt1 : double array
17161    tt2 : double array
17162
17163    Notes
17164    -----
17165    Wraps ERFA function ``eraTdbtt``. The ERFA documentation is::
17166
17167        - - - - - - - - -
17168         e r a T d b t t
17169        - - - - - - - - -
17170
17171        Time scale transformation:  Barycentric Dynamical Time, TDB, to
17172        Terrestrial Time, TT.
17173
17174        Given:
17175           tdb1,tdb2  double    TDB as a 2-part Julian Date
17176           dtr        double    TDB-TT in seconds
17177
17178        Returned:
17179           tt1,tt2    double    TT as a 2-part Julian Date
17180
17181        Returned (function value):
17182                      int       status:  0 = OK
17183
17184        Notes:
17185
17186        1) tdb1+tdb2 is Julian Date, apportioned in any convenient way
17187           between the two arguments, for example where tdb1 is the Julian
17188           Day Number and tdb2 is the fraction of a day.  The returned
17189           tt1,tt2 follow suit.
17190
17191        2) The argument dtr represents the quasi-periodic component of the
17192           GR transformation between TT and TCB.  It is dependent upon the
17193           adopted solar-system ephemeris, and can be obtained by numerical
17194           integration, by interrogating a precomputed time ephemeris or by
17195           evaluating a model such as that implemented in the ERFA function
17196           eraDtdb.   The quantity is dominated by an annual term of 1.7 ms
17197           amplitude.
17198
17199        3) TDB is essentially the same as Teph, the time argument for the
17200           JPL solar system ephemerides.
17201
17202        References:
17203
17204           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17205           IERS Technical Note No. 32, BKG (2004)
17206
17207           IAU 2006 Resolution 3
17208
17209        This revision:  2021 May 11
17210
17211        Copyright (C) 2013-2021, NumFOCUS Foundation.
17212        Derived, with permission, from the SOFA library.  See notes at end of file.
17213
17214    """
17215    tt1, tt2, c_retval = ufunc.tdbtt(tdb1, tdb2, dtr)
17216    check_errwarn(c_retval, 'tdbtt')
17217    return tt1, tt2
17218
17219
17220STATUS_CODES['tdbtt'] = {
17221    0: 'OK',
17222}
17223
17224
17225def tttai(tt1, tt2):
17226    """
17227    Time scale transformation:  Terrestrial Time, TT, to International
17228    Atomic Time, TAI.
17229
17230    Parameters
17231    ----------
17232    tt1 : double array
17233    tt2 : double array
17234
17235    Returns
17236    -------
17237    tai1 : double array
17238    tai2 : double array
17239
17240    Notes
17241    -----
17242    Wraps ERFA function ``eraTttai``. The ERFA documentation is::
17243
17244        - - - - - - - - -
17245         e r a T t t a i
17246        - - - - - - - - -
17247
17248        Time scale transformation:  Terrestrial Time, TT, to International
17249        Atomic Time, TAI.
17250
17251        Given:
17252           tt1,tt2    double    TT as a 2-part Julian Date
17253
17254        Returned:
17255           tai1,tai2  double    TAI as a 2-part Julian Date
17256
17257        Returned (function value):
17258                      int       status:  0 = OK
17259
17260        Note:
17261
17262           tt1+tt2 is Julian Date, apportioned in any convenient way between
17263           the two arguments, for example where tt1 is the Julian Day Number
17264           and tt2 is the fraction of a day.  The returned tai1,tai2 follow
17265           suit.
17266
17267        References:
17268
17269           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17270           IERS Technical Note No. 32, BKG (2004)
17271
17272           Explanatory Supplement to the Astronomical Almanac,
17273           P. Kenneth Seidelmann (ed), University Science Books (1992)
17274
17275        This revision:  2021 May 11
17276
17277        Copyright (C) 2013-2021, NumFOCUS Foundation.
17278        Derived, with permission, from the SOFA library.  See notes at end of file.
17279
17280    """
17281    tai1, tai2, c_retval = ufunc.tttai(tt1, tt2)
17282    check_errwarn(c_retval, 'tttai')
17283    return tai1, tai2
17284
17285
17286STATUS_CODES['tttai'] = {
17287    0: 'OK',
17288}
17289
17290
17291def tttcg(tt1, tt2):
17292    """
17293    Time scale transformation:  Terrestrial Time, TT, to Geocentric
17294    Coordinate Time, TCG.
17295
17296    Parameters
17297    ----------
17298    tt1 : double array
17299    tt2 : double array
17300
17301    Returns
17302    -------
17303    tcg1 : double array
17304    tcg2 : double array
17305
17306    Notes
17307    -----
17308    Wraps ERFA function ``eraTttcg``. The ERFA documentation is::
17309
17310        - - - - - - - - -
17311         e r a T t t c g
17312        - - - - - - - - -
17313
17314        Time scale transformation:  Terrestrial Time, TT, to Geocentric
17315        Coordinate Time, TCG.
17316
17317        Given:
17318           tt1,tt2    double    TT as a 2-part Julian Date
17319
17320        Returned:
17321           tcg1,tcg2  double    TCG as a 2-part Julian Date
17322
17323        Returned (function value):
17324                      int       status:  0 = OK
17325
17326        Note:
17327
17328           tt1+tt2 is Julian Date, apportioned in any convenient way between
17329           the two arguments, for example where tt1 is the Julian Day Number
17330           and tt2 is the fraction of a day.  The returned tcg1,tcg2 follow
17331           suit.
17332
17333        References:
17334
17335           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17336           IERS Technical Note No. 32, BKG (2004)
17337
17338           IAU 2000 Resolution B1.9
17339
17340        This revision:  2021 May 11
17341
17342        Copyright (C) 2013-2021, NumFOCUS Foundation.
17343        Derived, with permission, from the SOFA library.  See notes at end of file.
17344
17345    """
17346    tcg1, tcg2, c_retval = ufunc.tttcg(tt1, tt2)
17347    check_errwarn(c_retval, 'tttcg')
17348    return tcg1, tcg2
17349
17350
17351STATUS_CODES['tttcg'] = {
17352    0: 'OK',
17353}
17354
17355
17356def tttdb(tt1, tt2, dtr):
17357    """
17358    Time scale transformation:  Terrestrial Time, TT, to Barycentric
17359    Dynamical Time, TDB.
17360
17361    Parameters
17362    ----------
17363    tt1 : double array
17364    tt2 : double array
17365    dtr : double array
17366
17367    Returns
17368    -------
17369    tdb1 : double array
17370    tdb2 : double array
17371
17372    Notes
17373    -----
17374    Wraps ERFA function ``eraTttdb``. The ERFA documentation is::
17375
17376        - - - - - - - - -
17377         e r a T t t d b
17378        - - - - - - - - -
17379
17380        Time scale transformation:  Terrestrial Time, TT, to Barycentric
17381        Dynamical Time, TDB.
17382
17383        Given:
17384           tt1,tt2    double    TT as a 2-part Julian Date
17385           dtr        double    TDB-TT in seconds
17386
17387        Returned:
17388           tdb1,tdb2  double    TDB as a 2-part Julian Date
17389
17390        Returned (function value):
17391                      int       status:  0 = OK
17392
17393        Notes:
17394
17395        1) tt1+tt2 is Julian Date, apportioned in any convenient way between
17396           the two arguments, for example where tt1 is the Julian Day Number
17397           and tt2 is the fraction of a day.  The returned tdb1,tdb2 follow
17398           suit.
17399
17400        2) The argument dtr represents the quasi-periodic component of the
17401           GR transformation between TT and TCB.  It is dependent upon the
17402           adopted solar-system ephemeris, and can be obtained by numerical
17403           integration, by interrogating a precomputed time ephemeris or by
17404           evaluating a model such as that implemented in the ERFA function
17405           eraDtdb.   The quantity is dominated by an annual term of 1.7 ms
17406           amplitude.
17407
17408        3) TDB is essentially the same as Teph, the time argument for the JPL
17409           solar system ephemerides.
17410
17411        References:
17412
17413           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17414           IERS Technical Note No. 32, BKG (2004)
17415
17416           IAU 2006 Resolution 3
17417
17418        This revision:  2021 May 11
17419
17420        Copyright (C) 2013-2021, NumFOCUS Foundation.
17421        Derived, with permission, from the SOFA library.  See notes at end of file.
17422
17423    """
17424    tdb1, tdb2, c_retval = ufunc.tttdb(tt1, tt2, dtr)
17425    check_errwarn(c_retval, 'tttdb')
17426    return tdb1, tdb2
17427
17428
17429STATUS_CODES['tttdb'] = {
17430    0: 'OK',
17431}
17432
17433
17434def ttut1(tt1, tt2, dt):
17435    """
17436    Time scale transformation:  Terrestrial Time, TT, to Universal Time,
17437    UT1.
17438
17439    Parameters
17440    ----------
17441    tt1 : double array
17442    tt2 : double array
17443    dt : double array
17444
17445    Returns
17446    -------
17447    ut11 : double array
17448    ut12 : double array
17449
17450    Notes
17451    -----
17452    Wraps ERFA function ``eraTtut1``. The ERFA documentation is::
17453
17454        - - - - - - - - -
17455         e r a T t u t 1
17456        - - - - - - - - -
17457
17458        Time scale transformation:  Terrestrial Time, TT, to Universal Time,
17459        UT1.
17460
17461        Given:
17462           tt1,tt2    double    TT as a 2-part Julian Date
17463           dt         double    TT-UT1 in seconds
17464
17465        Returned:
17466           ut11,ut12  double    UT1 as a 2-part Julian Date
17467
17468        Returned (function value):
17469                      int       status:  0 = OK
17470
17471        Notes:
17472
17473        1) tt1+tt2 is Julian Date, apportioned in any convenient way between
17474           the two arguments, for example where tt1 is the Julian Day Number
17475           and tt2 is the fraction of a day.  The returned ut11,ut12 follow
17476           suit.
17477
17478        2) The argument dt is classical Delta T.
17479
17480        Reference:
17481
17482           Explanatory Supplement to the Astronomical Almanac,
17483           P. Kenneth Seidelmann (ed), University Science Books (1992)
17484
17485        This revision:  2021 May 11
17486
17487        Copyright (C) 2013-2021, NumFOCUS Foundation.
17488        Derived, with permission, from the SOFA library.  See notes at end of file.
17489
17490    """
17491    ut11, ut12, c_retval = ufunc.ttut1(tt1, tt2, dt)
17492    check_errwarn(c_retval, 'ttut1')
17493    return ut11, ut12
17494
17495
17496STATUS_CODES['ttut1'] = {
17497    0: 'OK',
17498}
17499
17500
17501def ut1tai(ut11, ut12, dta):
17502    """
17503    Time scale transformation:  Universal Time, UT1, to International
17504    Atomic Time, TAI.
17505
17506    Parameters
17507    ----------
17508    ut11 : double array
17509    ut12 : double array
17510    dta : double array
17511
17512    Returns
17513    -------
17514    tai1 : double array
17515    tai2 : double array
17516
17517    Notes
17518    -----
17519    Wraps ERFA function ``eraUt1tai``. The ERFA documentation is::
17520
17521        - - - - - - - - - -
17522         e r a U t 1 t a i
17523        - - - - - - - - - -
17524
17525        Time scale transformation:  Universal Time, UT1, to International
17526        Atomic Time, TAI.
17527
17528        Given:
17529           ut11,ut12  double    UT1 as a 2-part Julian Date
17530           dta        double    UT1-TAI in seconds
17531
17532        Returned:
17533           tai1,tai2  double    TAI as a 2-part Julian Date
17534
17535        Returned (function value):
17536                      int       status:  0 = OK
17537
17538        Notes:
17539
17540        1) ut11+ut12 is Julian Date, apportioned in any convenient way
17541           between the two arguments, for example where ut11 is the Julian
17542           Day Number and ut12 is the fraction of a day.  The returned
17543           tai1,tai2 follow suit.
17544
17545        2) The argument dta, i.e. UT1-TAI, is an observed quantity, and is
17546           available from IERS tabulations.
17547
17548        Reference:
17549
17550           Explanatory Supplement to the Astronomical Almanac,
17551           P. Kenneth Seidelmann (ed), University Science Books (1992)
17552
17553        This revision:  2021 May 11
17554
17555        Copyright (C) 2013-2021, NumFOCUS Foundation.
17556        Derived, with permission, from the SOFA library.  See notes at end of file.
17557
17558    """
17559    tai1, tai2, c_retval = ufunc.ut1tai(ut11, ut12, dta)
17560    check_errwarn(c_retval, 'ut1tai')
17561    return tai1, tai2
17562
17563
17564STATUS_CODES['ut1tai'] = {
17565    0: 'OK',
17566}
17567
17568
17569def ut1tt(ut11, ut12, dt):
17570    """
17571    Time scale transformation:  Universal Time, UT1, to Terrestrial
17572    Time, TT.
17573
17574    Parameters
17575    ----------
17576    ut11 : double array
17577    ut12 : double array
17578    dt : double array
17579
17580    Returns
17581    -------
17582    tt1 : double array
17583    tt2 : double array
17584
17585    Notes
17586    -----
17587    Wraps ERFA function ``eraUt1tt``. The ERFA documentation is::
17588
17589        - - - - - - - - -
17590         e r a U t 1 t t
17591        - - - - - - - - -
17592
17593        Time scale transformation:  Universal Time, UT1, to Terrestrial
17594        Time, TT.
17595
17596        Given:
17597           ut11,ut12  double    UT1 as a 2-part Julian Date
17598           dt         double    TT-UT1 in seconds
17599
17600        Returned:
17601           tt1,tt2    double    TT as a 2-part Julian Date
17602
17603        Returned (function value):
17604                      int       status:  0 = OK
17605
17606        Notes:
17607
17608        1) ut11+ut12 is Julian Date, apportioned in any convenient way
17609           between the two arguments, for example where ut11 is the Julian
17610           Day Number and ut12 is the fraction of a day.  The returned
17611           tt1,tt2 follow suit.
17612
17613        2) The argument dt is classical Delta T.
17614
17615        Reference:
17616
17617           Explanatory Supplement to the Astronomical Almanac,
17618           P. Kenneth Seidelmann (ed), University Science Books (1992)
17619
17620        This revision:  2021 May 11
17621
17622        Copyright (C) 2013-2021, NumFOCUS Foundation.
17623        Derived, with permission, from the SOFA library.  See notes at end of file.
17624
17625    """
17626    tt1, tt2, c_retval = ufunc.ut1tt(ut11, ut12, dt)
17627    check_errwarn(c_retval, 'ut1tt')
17628    return tt1, tt2
17629
17630
17631STATUS_CODES['ut1tt'] = {
17632    0: 'OK',
17633}
17634
17635
17636def ut1utc(ut11, ut12, dut1):
17637    """
17638    Time scale transformation:  Universal Time, UT1, to Coordinated
17639    Universal Time, UTC.
17640
17641    Parameters
17642    ----------
17643    ut11 : double array
17644    ut12 : double array
17645    dut1 : double array
17646
17647    Returns
17648    -------
17649    utc1 : double array
17650    utc2 : double array
17651
17652    Notes
17653    -----
17654    Wraps ERFA function ``eraUt1utc``. The ERFA documentation is::
17655
17656        - - - - - - - - - -
17657         e r a U t 1 u t c
17658        - - - - - - - - - -
17659
17660        Time scale transformation:  Universal Time, UT1, to Coordinated
17661        Universal Time, UTC.
17662
17663        Given:
17664           ut11,ut12  double   UT1 as a 2-part Julian Date (Note 1)
17665           dut1       double   Delta UT1: UT1-UTC in seconds (Note 2)
17666
17667        Returned:
17668           utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 3,4)
17669
17670        Returned (function value):
17671                      int      status: +1 = dubious year (Note 5)
17672                                        0 = OK
17673                                       -1 = unacceptable date
17674
17675        Notes:
17676
17677        1) ut11+ut12 is Julian Date, apportioned in any convenient way
17678           between the two arguments, for example where ut11 is the Julian
17679           Day Number and ut12 is the fraction of a day.  The returned utc1
17680           and utc2 form an analogous pair, except that a special convention
17681           is used, to deal with the problem of leap seconds - see Note 3.
17682
17683        2) Delta UT1 can be obtained from tabulations provided by the
17684           International Earth Rotation and Reference Systems Service.  The
17685           value changes abruptly by 1s at a leap second;  however, close to
17686           a leap second the algorithm used here is tolerant of the "wrong"
17687           choice of value being made.
17688
17689        3) JD cannot unambiguously represent UTC during a leap second unless
17690           special measures are taken.  The convention in the present
17691           function is that the returned quasi-JD UTC1+UTC2 represents UTC
17692           days whether the length is 86399, 86400 or 86401 SI seconds.
17693
17694        4) The function eraD2dtf can be used to transform the UTC quasi-JD
17695           into calendar date and clock time, including UTC leap second
17696           handling.
17697
17698        5) The warning status "dubious year" flags UTCs that predate the
17699           introduction of the time scale or that are too far in the future
17700           to be trusted.  See eraDat for further details.
17701
17702        Called:
17703           eraJd2cal    JD to Gregorian calendar
17704           eraDat       delta(AT) = TAI-UTC
17705           eraCal2jd    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        This revision:  2021 May 11
17716
17717        Copyright (C) 2013-2021, NumFOCUS Foundation.
17718        Derived, with permission, from the SOFA library.  See notes at end of file.
17719
17720    """
17721    utc1, utc2, c_retval = ufunc.ut1utc(ut11, ut12, dut1)
17722    check_errwarn(c_retval, 'ut1utc')
17723    return utc1, utc2
17724
17725
17726STATUS_CODES['ut1utc'] = {
17727    1: 'dubious year (Note 5)',
17728    0: 'OK',
17729    -1: 'unacceptable date',
17730}
17731
17732
17733def utctai(utc1, utc2):
17734    """
17735    Time scale transformation:  Coordinated Universal Time, UTC, to
17736    International Atomic Time, TAI.
17737
17738    Parameters
17739    ----------
17740    utc1 : double array
17741    utc2 : double array
17742
17743    Returns
17744    -------
17745    tai1 : double array
17746    tai2 : double array
17747
17748    Notes
17749    -----
17750    Wraps ERFA function ``eraUtctai``. The ERFA documentation is::
17751
17752        - - - - - - - - - -
17753         e r a U t c t a i
17754        - - - - - - - - - -
17755
17756        Time scale transformation:  Coordinated Universal Time, UTC, to
17757        International Atomic Time, TAI.
17758
17759        Given:
17760           utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 1-4)
17761
17762        Returned:
17763           tai1,tai2  double   TAI as a 2-part Julian Date (Note 5)
17764
17765        Returned (function value):
17766                      int      status: +1 = dubious year (Note 3)
17767                                        0 = OK
17768                                       -1 = unacceptable date
17769
17770        Notes:
17771
17772        1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
17773           convenient way between the two arguments, for example where utc1
17774           is the Julian Day Number and utc2 is the fraction of a day.
17775
17776        2) JD cannot unambiguously represent UTC during a leap second unless
17777           special measures are taken.  The convention in the present
17778           function is that the JD day represents UTC days whether the
17779           length is 86399, 86400 or 86401 SI seconds.  In the 1960-1972 era
17780           there were smaller jumps (in either direction) each time the
17781           linear UTC(TAI) expression was changed, and these "mini-leaps"
17782           are also included in the ERFA convention.
17783
17784        3) The warning status "dubious year" flags UTCs that predate the
17785           introduction of the time scale or that are too far in the future
17786           to be trusted.  See eraDat for further details.
17787
17788        4) The function eraDtf2d converts from calendar date and time of day
17789           into 2-part Julian Date, and in the case of UTC implements the
17790           leap-second-ambiguity convention described above.
17791
17792        5) The returned TAI1,TAI2 are such that their sum is the TAI Julian
17793           Date.
17794
17795        Called:
17796           eraJd2cal    JD to Gregorian calendar
17797           eraDat       delta(AT) = TAI-UTC
17798           eraCal2jd    Gregorian calendar to JD
17799
17800        References:
17801
17802           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17803           IERS Technical Note No. 32, BKG (2004)
17804
17805           Explanatory Supplement to the Astronomical Almanac,
17806           P. Kenneth Seidelmann (ed), University Science Books (1992)
17807
17808        This revision:  2021 May 11
17809
17810        Copyright (C) 2013-2021, NumFOCUS Foundation.
17811        Derived, with permission, from the SOFA library.  See notes at end of file.
17812
17813    """
17814    tai1, tai2, c_retval = ufunc.utctai(utc1, utc2)
17815    check_errwarn(c_retval, 'utctai')
17816    return tai1, tai2
17817
17818
17819STATUS_CODES['utctai'] = {
17820    1: 'dubious year (Note 3)',
17821    0: 'OK',
17822    -1: 'unacceptable date',
17823}
17824
17825
17826def utcut1(utc1, utc2, dut1):
17827    """
17828    Time scale transformation:  Coordinated Universal Time, UTC, to
17829    Universal Time, UT1.
17830
17831    Parameters
17832    ----------
17833    utc1 : double array
17834    utc2 : double array
17835    dut1 : double array
17836
17837    Returns
17838    -------
17839    ut11 : double array
17840    ut12 : double array
17841
17842    Notes
17843    -----
17844    Wraps ERFA function ``eraUtcut1``. The ERFA documentation is::
17845
17846        - - - - - - - - - -
17847         e r a U t c u t 1
17848        - - - - - - - - - -
17849
17850        Time scale transformation:  Coordinated Universal Time, UTC, to
17851        Universal Time, UT1.
17852
17853        Given:
17854           utc1,utc2  double   UTC as a 2-part quasi Julian Date (Notes 1-4)
17855           dut1       double   Delta UT1 = UT1-UTC in seconds (Note 5)
17856
17857        Returned:
17858           ut11,ut12  double   UT1 as a 2-part Julian Date (Note 6)
17859
17860        Returned (function value):
17861                      int      status: +1 = dubious year (Note 3)
17862                                        0 = OK
17863                                       -1 = unacceptable date
17864
17865        Notes:
17866
17867        1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
17868           convenient way between the two arguments, for example where utc1
17869           is the Julian Day Number and utc2 is the fraction of a day.
17870
17871        2) JD cannot unambiguously represent UTC during a leap second unless
17872           special measures are taken.  The convention in the present
17873           function is that the JD day represents UTC days whether the
17874           length is 86399, 86400 or 86401 SI seconds.
17875
17876        3) The warning status "dubious year" flags UTCs that predate the
17877           introduction of the time scale or that are too far in the future
17878           to be trusted.  See eraDat for further details.
17879
17880        4) The function eraDtf2d converts from calendar date and time of
17881           day into 2-part Julian Date, and in the case of UTC implements
17882           the leap-second-ambiguity convention described above.
17883
17884        5) Delta UT1 can be obtained from tabulations provided by the
17885           International Earth Rotation and Reference Systems Service.
17886           It is the caller's responsibility to supply a dut1 argument
17887           containing the UT1-UTC value that matches the given UTC.
17888
17889        6) The returned ut11,ut12 are such that their sum is the UT1 Julian
17890           Date.
17891
17892        References:
17893
17894           McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
17895           IERS Technical Note No. 32, BKG (2004)
17896
17897           Explanatory Supplement to the Astronomical Almanac,
17898           P. Kenneth Seidelmann (ed), University Science Books (1992)
17899
17900        Called:
17901           eraJd2cal    JD to Gregorian calendar
17902           eraDat       delta(AT) = TAI-UTC
17903           eraUtctai    UTC to TAI
17904           eraTaiut1    TAI to UT1
17905
17906        This revision:  2021 May 11
17907
17908        Copyright (C) 2013-2021, NumFOCUS Foundation.
17909        Derived, with permission, from the SOFA library.  See notes at end of file.
17910
17911    """
17912    ut11, ut12, c_retval = ufunc.utcut1(utc1, utc2, dut1)
17913    check_errwarn(c_retval, 'utcut1')
17914    return ut11, ut12
17915
17916
17917STATUS_CODES['utcut1'] = {
17918    1: 'dubious year (Note 3)',
17919    0: 'OK',
17920    -1: 'unacceptable date',
17921}
17922
17923
17924def ae2hd(az, el, phi):
17925    """
17926    Horizon to equatorial coordinates:  transform azimuth and altitude
17927    to hour angle and declination.
17928
17929    Parameters
17930    ----------
17931    az : double array
17932    el : double array
17933    phi : double array
17934
17935    Returns
17936    -------
17937    ha : double array
17938    dec : double array
17939
17940    Notes
17941    -----
17942    Wraps ERFA function ``eraAe2hd``. The ERFA documentation is::
17943
17944        - - - - - - - - -
17945         e r a A e 2 h d
17946        - - - - - - - - -
17947
17948        Horizon to equatorial coordinates:  transform azimuth and altitude
17949        to hour angle and declination.
17950
17951        Given:
17952           az       double       azimuth
17953           el       double       altitude (informally, elevation)
17954           phi      double       site latitude
17955
17956        Returned:
17957           ha       double       hour angle (local)
17958           dec      double       declination
17959
17960        Notes:
17961
17962        1)  All the arguments are angles in radians.
17963
17964        2)  The sign convention for azimuth is north zero, east +pi/2.
17965
17966        3)  HA is returned in the range +/-pi.  Declination is returned in
17967            the range +/-pi/2.
17968
17969        4)  The latitude phi is pi/2 minus the angle between the Earth's
17970            rotation axis and the adopted zenith.  In many applications it
17971            will be sufficient to use the published geodetic latitude of the
17972            site.  In very precise (sub-arcsecond) applications, phi can be
17973            corrected for polar motion.
17974
17975        5)  The azimuth az must be with respect to the rotational north pole,
17976            as opposed to the ITRS pole, and an azimuth with respect to north
17977            on a map of the Earth's surface will need to be adjusted for
17978            polar motion if sub-arcsecond accuracy is required.
17979
17980        6)  Should the user wish to work with respect to the astronomical
17981            zenith rather than the geodetic zenith, phi will need to be
17982            adjusted for deflection of the vertical (often tens of
17983            arcseconds), and the zero point of ha will also be affected.
17984
17985        7)  The transformation is the same as Ve = Ry(phi-pi/2)*Rz(pi)*Vh,
17986            where Ve and Vh are lefthanded unit vectors in the (ha,dec) and
17987            (az,el) systems respectively and Rz and Ry are rotations about
17988            first the z-axis and then the y-axis.  (n.b. Rz(pi) simply
17989            reverses the signs of the x and y components.)  For efficiency,
17990            the algorithm is written out rather than calling other utility
17991            functions.  For applications that require even greater
17992            efficiency, additional savings are possible if constant terms
17993            such as functions of latitude are computed once and for all.
17994
17995        8)  Again for efficiency, no range checking of arguments is carried
17996            out.
17997
17998        Last revision:   2017 September 12
17999
18000        ERFA release 2021-05-12
18001
18002        Copyright (C) 2021 IAU ERFA Board.  See notes at end.
18003
18004    """
18005    ha, dec = ufunc.ae2hd(az, el, phi)
18006    return ha, dec
18007
18008
18009def hd2ae(ha, dec, phi):
18010    """
18011    Equatorial to horizon coordinates:  transform hour angle and
18012    declination to azimuth and altitude.
18013
18014    Parameters
18015    ----------
18016    ha : double array
18017    dec : double array
18018    phi : double array
18019
18020    Returns
18021    -------
18022    az : double array
18023    el : double array
18024
18025    Notes
18026    -----
18027    Wraps ERFA function ``eraHd2ae``. The ERFA documentation is::
18028
18029        - - - - - - - - -
18030         e r a H d 2 a e
18031        - - - - - - - - -
18032
18033        Equatorial to horizon coordinates:  transform hour angle and
18034        declination to azimuth and altitude.
18035
18036        Given:
18037           ha       double       hour angle (local)
18038           dec      double       declination
18039           phi      double       site latitude
18040
18041        Returned:
18042           *az      double       azimuth
18043           *el      double       altitude (informally, elevation)
18044
18045        Notes:
18046
18047        1)  All the arguments are angles in radians.
18048
18049        2)  Azimuth is returned in the range 0-2pi;  north is zero, and east
18050            is +pi/2.  Altitude is returned in the range +/- pi/2.
18051
18052        3)  The latitude phi is pi/2 minus the angle between the Earth's
18053            rotation axis and the adopted zenith.  In many applications it
18054            will be sufficient to use the published geodetic latitude of the
18055            site.  In very precise (sub-arcsecond) applications, phi can be
18056            corrected for polar motion.
18057
18058        4)  The returned azimuth az is with respect to the rotational north
18059            pole, as opposed to the ITRS pole, and for sub-arcsecond
18060            accuracy will need to be adjusted for polar motion if it is to
18061            be with respect to north on a map of the Earth's surface.
18062
18063        5)  Should the user wish to work with respect to the astronomical
18064            zenith rather than the geodetic zenith, phi will need to be
18065            adjusted for deflection of the vertical (often tens of
18066            arcseconds), and the zero point of the hour angle ha will also
18067            be affected.
18068
18069        6)  The transformation is the same as Vh = Rz(pi)*Ry(pi/2-phi)*Ve,
18070            where Vh and Ve are lefthanded unit vectors in the (az,el) and
18071            (ha,dec) systems respectively and Ry and Rz are rotations about
18072            first the y-axis and then the z-axis.  (n.b. Rz(pi) simply
18073            reverses the signs of the x and y components.)  For efficiency,
18074            the algorithm is written out rather than calling other utility
18075            functions.  For applications that require even greater
18076            efficiency, additional savings are possible if constant terms
18077            such as functions of latitude are computed once and for all.
18078
18079        7)  Again for efficiency, no range checking of arguments is carried
18080            out.
18081
18082        Last revision:   2021 February 24
18083
18084        ERFA release 2021-05-12
18085
18086        Copyright (C) 2021 IAU ERFA Board.  See notes at end.
18087
18088    """
18089    az, el = ufunc.hd2ae(ha, dec, phi)
18090    return az, el
18091
18092
18093def hd2pa(ha, dec, phi):
18094    """
18095    Parallactic angle for a given hour angle and declination.
18096
18097    Parameters
18098    ----------
18099    ha : double array
18100    dec : double array
18101    phi : double array
18102
18103    Returns
18104    -------
18105    c_retval : double array
18106
18107    Notes
18108    -----
18109    Wraps ERFA function ``eraHd2pa``. The ERFA documentation is::
18110
18111        - - - - - - - - -
18112         e r a H d 2 p a
18113        - - - - - - - - -
18114
18115        Parallactic angle for a given hour angle and declination.
18116
18117        Given:
18118           ha     double     hour angle
18119           dec    double     declination
18120           phi    double     site latitude
18121
18122        Returned (function value):
18123                  double     parallactic angle
18124
18125        Notes:
18126
18127        1)  All the arguments are angles in radians.
18128
18129        2)  The parallactic angle at a point in the sky is the position
18130            angle of the vertical, i.e. the angle between the directions to
18131            the north celestial pole and to the zenith respectively.
18132
18133        3)  The result is returned in the range -pi to +pi.
18134
18135        4)  At the pole itself a zero result is returned.
18136
18137        5)  The latitude phi is pi/2 minus the angle between the Earth's
18138            rotation axis and the adopted zenith.  In many applications it
18139            will be sufficient to use the published geodetic latitude of the
18140            site.  In very precise (sub-arcsecond) applications, phi can be
18141            corrected for polar motion.
18142
18143        6)  Should the user wish to work with respect to the astronomical
18144            zenith rather than the geodetic zenith, phi will need to be
18145            adjusted for deflection of the vertical (often tens of
18146            arcseconds), and the zero point of the hour angle ha will also
18147            be affected.
18148
18149        Reference:
18150           Smart, W.M., "Spherical Astronomy", Cambridge University Press,
18151           6th edition (Green, 1977), p49.
18152
18153        Last revision:   2017 September 12
18154
18155        ERFA release 2021-05-12
18156
18157        Copyright (C) 2021 IAU ERFA Board.  See notes at end.
18158
18159    """
18160    c_retval = ufunc.hd2pa(ha, dec, phi)
18161    return c_retval
18162
18163
18164def tpors(xi, eta, a, b):
18165    """
18166    In the tangent plane projection, given the rectangular coordinates
18167    of a star and its spherical coordinates, determine the spherical
18168    coordinates of the tangent point.
18169
18170    Parameters
18171    ----------
18172    xi : double array
18173    eta : double array
18174    a : double array
18175    b : double array
18176
18177    Returns
18178    -------
18179    a01 : double array
18180    b01 : double array
18181    a02 : double array
18182    b02 : double array
18183
18184    Notes
18185    -----
18186    Wraps ERFA function ``eraTpors``. The ERFA documentation is::
18187
18188        - - - - - - - - -
18189         e r a T p o r s
18190        - - - - - - - - -
18191
18192        In the tangent plane projection, given the rectangular coordinates
18193        of a star and its spherical coordinates, determine the spherical
18194        coordinates of the tangent point.
18195
18196        Given:
18197           xi,eta     double  rectangular coordinates of star image (Note 2)
18198           a,b        double  star's spherical coordinates (Note 3)
18199
18200        Returned:
18201           *a01,*b01  double  tangent point's spherical coordinates, Soln. 1
18202           *a02,*b02  double  tangent point's spherical coordinates, Soln. 2
18203
18204        Returned (function value):
18205                      int     number of solutions:
18206                              0 = no solutions returned (Note 5)
18207                              1 = only the first solution is useful (Note 6)
18208                              2 = both solutions are useful (Note 6)
18209
18210        Notes:
18211
18212        1) The tangent plane projection is also called the "gnomonic
18213           projection" and the "central projection".
18214
18215        2) The eta axis points due north in the adopted coordinate system.
18216           If the spherical coordinates are observed (RA,Dec), the tangent
18217           plane coordinates (xi,eta) are conventionally called the
18218           "standard coordinates".  If the spherical coordinates are with
18219           respect to a right-handed triad, (xi,eta) are also right-handed.
18220           The units of (xi,eta) are, effectively, radians at the tangent
18221           point.
18222
18223        3) All angular arguments are in radians.
18224
18225        4) The angles a01 and a02 are returned in the range 0-2pi.  The
18226           angles b01 and b02 are returned in the range +/-pi, but in the
18227           usual, non-pole-crossing, case, the range is +/-pi/2.
18228
18229        5) Cases where there is no solution can arise only near the poles.
18230           For example, it is clearly impossible for a star at the pole
18231           itself to have a non-zero xi value, and hence it is meaningless
18232           to ask where the tangent point would have to be to bring about
18233           this combination of xi and dec.
18234
18235        6) Also near the poles, cases can arise where there are two useful
18236           solutions.  The return value indicates whether the second of the
18237           two solutions returned is useful;  1 indicates only one useful
18238           solution, the usual case.
18239
18240        7) The basis of the algorithm is to solve the spherical triangle PSC,
18241           where P is the north celestial pole, S is the star and C is the
18242           tangent point.  The spherical coordinates of the tangent point are
18243           [a0,b0];  writing rho^2 = (xi^2+eta^2) and r^2 = (1+rho^2), side c
18244           is then (pi/2-b), side p is sqrt(xi^2+eta^2) and side s (to be
18245           found) is (pi/2-b0).  Angle C is given by sin(C) = xi/rho and
18246           cos(C) = eta/rho.  Angle P (to be found) is the longitude
18247           difference between star and tangent point (a-a0).
18248
18249        8) This function is a member of the following set:
18250
18251               spherical      vector         solve for
18252
18253               eraTpxes      eraTpxev         xi,eta
18254               eraTpsts      eraTpstv          star
18255             > eraTpors <    eraTporv         origin
18256
18257        Called:
18258           eraAnp       normalize angle into range 0 to 2pi
18259
18260        References:
18261
18262           Calabretta M.R. & Greisen, E.W., 2002, "Representations of
18263           celestial coordinates in FITS", Astron.Astrophys. 395, 1077
18264
18265           Green, R.M., "Spherical Astronomy", Cambridge University Press,
18266           1987, Chapter 13.
18267
18268        This revision:   2018 January 2
18269
18270        Copyright (C) 2013-2021, NumFOCUS Foundation.
18271        Derived, with permission, from the SOFA library.  See notes at end of file.
18272
18273    """
18274    a01, b01, a02, b02, c_retval = ufunc.tpors(xi, eta, a, b)
18275    check_errwarn(c_retval, 'tpors')
18276    return a01, b01, a02, b02
18277
18278
18279def tporv(xi, eta, v):
18280    """
18281    In the tangent plane projection, given the rectangular coordinates
18282    of a star and its direction cosines, determine the direction
18283    cosines of the tangent point.
18284
18285    Parameters
18286    ----------
18287    xi : double array
18288    eta : double array
18289    v : double array
18290
18291    Returns
18292    -------
18293    v01 : double array
18294    v02 : double array
18295
18296    Notes
18297    -----
18298    Wraps ERFA function ``eraTporv``. The ERFA documentation is::
18299
18300        - - - - - - - - -
18301         e r a T p o r v
18302        - - - - - - - - -
18303
18304        In the tangent plane projection, given the rectangular coordinates
18305        of a star and its direction cosines, determine the direction
18306        cosines of the tangent point.
18307
18308        Given:
18309           xi,eta   double    rectangular coordinates of star image (Note 2)
18310           v        double[3] star's direction cosines (Note 3)
18311
18312        Returned:
18313           v01      double[3] tangent point's direction cosines, Solution 1
18314           v02      double[3] tangent point's direction cosines, Solution 2
18315
18316        Returned (function value):
18317                      int     number of solutions:
18318                              0 = no solutions returned (Note 4)
18319                              1 = only the first solution is useful (Note 5)
18320                              2 = both solutions are useful (Note 5)
18321
18322        Notes:
18323
18324        1) The tangent plane projection is also called the "gnomonic
18325           projection" and the "central projection".
18326
18327        2) The eta axis points due north in the adopted coordinate system.
18328           If the direction cosines represent observed (RA,Dec), the tangent
18329           plane coordinates (xi,eta) are conventionally called the
18330           "standard coordinates".  If the direction cosines are with
18331           respect to a right-handed triad, (xi,eta) are also right-handed.
18332           The units of (xi,eta) are, effectively, radians at the tangent
18333           point.
18334
18335        3) The vector v must be of unit length or the result will be wrong.
18336
18337        4) Cases where there is no solution can arise only near the poles.
18338           For example, it is clearly impossible for a star at the pole
18339           itself to have a non-zero xi value, and hence it is meaningless
18340           to ask where the tangent point would have to be.
18341
18342        5) Also near the poles, cases can arise where there are two useful
18343           solutions.  The return value indicates whether the second of the
18344           two solutions returned is useful;  1 indicates only one useful
18345           solution, the usual case.
18346
18347        6) The basis of the algorithm is to solve the spherical triangle
18348           PSC, where P is the north celestial pole, S is the star and C is
18349           the tangent point.  Calling the celestial spherical coordinates
18350           of the star and tangent point (a,b) and (a0,b0) respectively, and
18351           writing rho^2 = (xi^2+eta^2) and r^2 = (1+rho^2), and
18352           transforming the vector v into (a,b) in the normal way, side c is
18353           then (pi/2-b), side p is sqrt(xi^2+eta^2) and side s (to be
18354           found) is (pi/2-b0), while angle C is given by sin(C) = xi/rho
18355           and cos(C) = eta/rho;  angle P (to be found) is (a-a0).  After
18356           solving the spherical triangle, the result (a0,b0) can be
18357           expressed in vector form as v0.
18358
18359        7) This function is a member of the following set:
18360
18361               spherical      vector         solve for
18362
18363               eraTpxes      eraTpxev         xi,eta
18364               eraTpsts      eraTpstv          star
18365               eraTpors    > eraTporv <       origin
18366
18367        References:
18368
18369           Calabretta M.R. & Greisen, E.W., 2002, "Representations of
18370           celestial coordinates in FITS", Astron.Astrophys. 395, 1077
18371
18372           Green, R.M., "Spherical Astronomy", Cambridge University Press,
18373           1987, Chapter 13.
18374
18375        This revision:   2018 January 2
18376
18377        Copyright (C) 2013-2021, NumFOCUS Foundation.
18378        Derived, with permission, from the SOFA library.  See notes at end of file.
18379
18380    """
18381    v01, v02, c_retval = ufunc.tporv(xi, eta, v)
18382    check_errwarn(c_retval, 'tporv')
18383    return v01, v02
18384
18385
18386def tpsts(xi, eta, a0, b0):
18387    """
18388    In the tangent plane projection, given the star's rectangular
18389    coordinates and the spherical coordinates of the tangent point,
18390    solve for the spherical coordinates of the star.
18391
18392    Parameters
18393    ----------
18394    xi : double array
18395    eta : double array
18396    a0 : double array
18397    b0 : double array
18398
18399    Returns
18400    -------
18401    a : double array
18402    b : double array
18403
18404    Notes
18405    -----
18406    Wraps ERFA function ``eraTpsts``. The ERFA documentation is::
18407
18408        - - - - - - - - -
18409         e r a T p s t s
18410        - - - - - - - - -
18411
18412        In the tangent plane projection, given the star's rectangular
18413        coordinates and the spherical coordinates of the tangent point,
18414        solve for the spherical coordinates of the star.
18415
18416        Given:
18417           xi,eta    double  rectangular coordinates of star image (Note 2)
18418           a0,b0     double  tangent point's spherical coordinates
18419
18420        Returned:
18421           *a,*b     double  star's spherical coordinates
18422
18423        1) The tangent plane projection is also called the "gnomonic
18424           projection" and the "central projection".
18425
18426        2) The eta axis points due north in the adopted coordinate system.
18427           If the spherical coordinates are observed (RA,Dec), the tangent
18428           plane coordinates (xi,eta) are conventionally called the
18429           "standard coordinates".  If the spherical coordinates are with
18430           respect to a right-handed triad, (xi,eta) are also right-handed.
18431           The units of (xi,eta) are, effectively, radians at the tangent
18432           point.
18433
18434        3) All angular arguments are in radians.
18435
18436        4) This function is a member of the following set:
18437
18438               spherical      vector         solve for
18439
18440               eraTpxes      eraTpxev         xi,eta
18441             > eraTpsts <    eraTpstv          star
18442               eraTpors      eraTporv         origin
18443
18444        Called:
18445           eraAnp       normalize angle into range 0 to 2pi
18446
18447        References:
18448
18449           Calabretta M.R. & Greisen, E.W., 2002, "Representations of
18450           celestial coordinates in FITS", Astron.Astrophys. 395, 1077
18451
18452           Green, R.M., "Spherical Astronomy", Cambridge University Press,
18453           1987, Chapter 13.
18454
18455        This revision:   2018 January 2
18456
18457        Copyright (C) 2013-2021, NumFOCUS Foundation.
18458        Derived, with permission, from the SOFA library.  See notes at end of file.
18459
18460    """
18461    a, b = ufunc.tpsts(xi, eta, a0, b0)
18462    return a, b
18463
18464
18465def tpstv(xi, eta, v0):
18466    """
18467    In the tangent plane projection, given the star's rectangular
18468    coordinates and the direction cosines of the tangent point, solve
18469    for the direction cosines of the star.
18470
18471    Parameters
18472    ----------
18473    xi : double array
18474    eta : double array
18475    v0 : double array
18476
18477    Returns
18478    -------
18479    v : double array
18480
18481    Notes
18482    -----
18483    Wraps ERFA function ``eraTpstv``. The ERFA documentation is::
18484
18485        - - - - - - - - -
18486         e r a T p s t v
18487        - - - - - - - - -
18488
18489        In the tangent plane projection, given the star's rectangular
18490        coordinates and the direction cosines of the tangent point, solve
18491        for the direction cosines of the star.
18492
18493        Given:
18494           xi,eta  double     rectangular coordinates of star image (Note 2)
18495           v0      double[3]  tangent point's direction cosines
18496
18497        Returned:
18498           v       double[3]  star's direction cosines
18499
18500        1) The tangent plane projection is also called the "gnomonic
18501           projection" and the "central projection".
18502
18503        2) The eta axis points due north in the adopted coordinate system.
18504           If the direction cosines represent observed (RA,Dec), the tangent
18505           plane coordinates (xi,eta) are conventionally called the
18506           "standard coordinates".  If the direction cosines are with
18507           respect to a right-handed triad, (xi,eta) are also right-handed.
18508           The units of (xi,eta) are, effectively, radians at the tangent
18509           point.
18510
18511        3) The method used is to complete the star vector in the (xi,eta)
18512           based triad and normalize it, then rotate the triad to put the
18513           tangent point at the pole with the x-axis aligned to zero
18514           longitude.  Writing (a0,b0) for the celestial spherical
18515           coordinates of the tangent point, the sequence of rotations is
18516           (b-pi/2) around the x-axis followed by (-a-pi/2) around the
18517           z-axis.
18518
18519        4) If vector v0 is not of unit length, the returned vector v will
18520           be wrong.
18521
18522        5) If vector v0 points at a pole, the returned vector v will be
18523           based on the arbitrary assumption that the longitude coordinate
18524           of the tangent point is zero.
18525
18526        6) This function is a member of the following set:
18527
18528               spherical      vector         solve for
18529
18530               eraTpxes      eraTpxev         xi,eta
18531               eraTpsts    > eraTpstv <        star
18532               eraTpors      eraTporv         origin
18533
18534        References:
18535
18536           Calabretta M.R. & Greisen, E.W., 2002, "Representations of
18537           celestial coordinates in FITS", Astron.Astrophys. 395, 1077
18538
18539           Green, R.M., "Spherical Astronomy", Cambridge University Press,
18540           1987, Chapter 13.
18541
18542        This revision:   2018 January 2
18543
18544        Copyright (C) 2013-2021, NumFOCUS Foundation.
18545        Derived, with permission, from the SOFA library.  See notes at end of file.
18546
18547    """
18548    v = ufunc.tpstv(xi, eta, v0)
18549    return v
18550
18551
18552def tpxes(a, b, a0, b0):
18553    """
18554    In the tangent plane projection, given celestial spherical
18555    coordinates for a star and the tangent point, solve for the star's
18556    rectangular coordinates in the tangent plane.
18557
18558    Parameters
18559    ----------
18560    a : double array
18561    b : double array
18562    a0 : double array
18563    b0 : double array
18564
18565    Returns
18566    -------
18567    xi : double array
18568    eta : double array
18569
18570    Notes
18571    -----
18572    Wraps ERFA function ``eraTpxes``. The ERFA documentation is::
18573
18574        - - - - - - - - -
18575         e r a T p x e s
18576        - - - - - - - - -
18577
18578        In the tangent plane projection, given celestial spherical
18579        coordinates for a star and the tangent point, solve for the star's
18580        rectangular coordinates in the tangent plane.
18581
18582        Given:
18583           a,b       double  star's spherical coordinates
18584           a0,b0     double  tangent point's spherical coordinates
18585
18586        Returned:
18587           *xi,*eta  double  rectangular coordinates of star image (Note 2)
18588
18589        Returned (function value):
18590                     int     status:  0 = OK
18591                                      1 = star too far from axis
18592                                      2 = antistar on tangent plane
18593                                      3 = antistar too far from axis
18594
18595        Notes:
18596
18597        1) The tangent plane projection is also called the "gnomonic
18598           projection" and the "central projection".
18599
18600        2) The eta axis points due north in the adopted coordinate system.
18601           If the spherical coordinates are observed (RA,Dec), the tangent
18602           plane coordinates (xi,eta) are conventionally called the
18603           "standard coordinates".  For right-handed spherical coordinates,
18604           (xi,eta) are also right-handed.  The units of (xi,eta) are,
18605           effectively, radians at the tangent point.
18606
18607        3) All angular arguments are in radians.
18608
18609        4) This function is a member of the following set:
18610
18611               spherical      vector         solve for
18612
18613             > eraTpxes <    eraTpxev         xi,eta
18614               eraTpsts      eraTpstv          star
18615               eraTpors      eraTporv         origin
18616
18617        References:
18618
18619           Calabretta M.R. & Greisen, E.W., 2002, "Representations of
18620           celestial coordinates in FITS", Astron.Astrophys. 395, 1077
18621
18622           Green, R.M., "Spherical Astronomy", Cambridge University Press,
18623           1987, Chapter 13.
18624
18625        This revision:   2018 January 2
18626
18627        Copyright (C) 2013-2021, NumFOCUS Foundation.
18628        Derived, with permission, from the SOFA library.  See notes at end of file.
18629
18630    """
18631    xi, eta, c_retval = ufunc.tpxes(a, b, a0, b0)
18632    check_errwarn(c_retval, 'tpxes')
18633    return xi, eta
18634
18635
18636STATUS_CODES['tpxes'] = {
18637    0: 'OK',
18638    1: 'star too far from axis',
18639    2: 'antistar on tangent plane',
18640    3: 'antistar too far from axis',
18641}
18642
18643
18644def tpxev(v, v0):
18645    """
18646    In the tangent plane projection, given celestial direction cosines
18647    for a star and the tangent point, solve for the star's rectangular
18648    coordinates in the tangent plane.
18649
18650    Parameters
18651    ----------
18652    v : double array
18653    v0 : double array
18654
18655    Returns
18656    -------
18657    xi : double array
18658    eta : double array
18659
18660    Notes
18661    -----
18662    Wraps ERFA function ``eraTpxev``. The ERFA documentation is::
18663
18664        - - - - - - - - -
18665         e r a T p x e v
18666        - - - - - - - - -
18667
18668        In the tangent plane projection, given celestial direction cosines
18669        for a star and the tangent point, solve for the star's rectangular
18670        coordinates in the tangent plane.
18671
18672        Given:
18673           v         double[3]  direction cosines of star (Note 4)
18674           v0        double[3]  direction cosines of tangent point (Note 4)
18675
18676        Returned:
18677           *xi,*eta  double     tangent plane coordinates of star
18678
18679        Returned (function value):
18680                     int        status: 0 = OK
18681                                        1 = star too far from axis
18682                                        2 = antistar on tangent plane
18683                                        3 = antistar too far from axis
18684
18685        Notes:
18686
18687        1) The tangent plane projection is also called the "gnomonic
18688           projection" and the "central projection".
18689
18690        2) The eta axis points due north in the adopted coordinate system.
18691           If the direction cosines represent observed (RA,Dec), the tangent
18692           plane coordinates (xi,eta) are conventionally called the
18693           "standard coordinates".  If the direction cosines are with
18694           respect to a right-handed triad, (xi,eta) are also right-handed.
18695           The units of (xi,eta) are, effectively, radians at the tangent
18696           point.
18697
18698        3) The method used is to extend the star vector to the tangent
18699           plane and then rotate the triad so that (x,y) becomes (xi,eta).
18700           Writing (a,b) for the celestial spherical coordinates of the
18701           star, the sequence of rotations is (a+pi/2) around the z-axis
18702           followed by (pi/2-b) around the x-axis.
18703
18704        4) If vector v0 is not of unit length, or if vector v is of zero
18705           length, the results will be wrong.
18706
18707        5) If v0 points at a pole, the returned (xi,eta) will be based on
18708           the arbitrary assumption that the longitude coordinate of the
18709           tangent point is zero.
18710
18711        6) This function is a member of the following set:
18712
18713               spherical      vector         solve for
18714
18715               eraTpxes    > eraTpxev <       xi,eta
18716               eraTpsts      eraTpstv          star
18717               eraTpors      eraTporv         origin
18718
18719        References:
18720
18721           Calabretta M.R. & Greisen, E.W., 2002, "Representations of
18722           celestial coordinates in FITS", Astron.Astrophys. 395, 1077
18723
18724           Green, R.M., "Spherical Astronomy", Cambridge University Press,
18725           1987, Chapter 13.
18726
18727        This revision:   2018 January 2
18728
18729        Copyright (C) 2013-2021, NumFOCUS Foundation.
18730        Derived, with permission, from the SOFA library.  See notes at end of file.
18731
18732    """
18733    xi, eta, c_retval = ufunc.tpxev(v, v0)
18734    check_errwarn(c_retval, 'tpxev')
18735    return xi, eta
18736
18737
18738STATUS_CODES['tpxev'] = {
18739    0: 'OK',
18740    1: 'star too far from axis',
18741    2: 'antistar on tangent plane',
18742    3: 'antistar too far from axis',
18743}
18744
18745
18746def a2af(ndp, angle):
18747    """
18748    Decompose radians into degrees, arcminutes, arcseconds, fraction.
18749
18750    Parameters
18751    ----------
18752    ndp : int array
18753    angle : double array
18754
18755    Returns
18756    -------
18757    sign : char array
18758    idmsf : int array
18759
18760    Notes
18761    -----
18762    Wraps ERFA function ``eraA2af``. The ERFA documentation is::
18763
18764        - - - - - - - -
18765         e r a A 2 a f
18766        - - - - - - - -
18767
18768        Decompose radians into degrees, arcminutes, arcseconds, fraction.
18769
18770        Given:
18771           ndp     int     resolution (Note 1)
18772           angle   double  angle in radians
18773
18774        Returned:
18775           sign    char         '+' or '-'
18776           idmsf   int[4]  degrees, arcminutes, arcseconds, fraction
18777
18778        Notes:
18779
18780        1) The argument ndp is interpreted as follows:
18781
18782           ndp         resolution
18783            :      ...0000 00 00
18784           -7         1000 00 00
18785           -6          100 00 00
18786           -5           10 00 00
18787           -4            1 00 00
18788           -3            0 10 00
18789           -2            0 01 00
18790           -1            0 00 10
18791            0            0 00 01
18792            1            0 00 00.1
18793            2            0 00 00.01
18794            3            0 00 00.001
18795            :            0 00 00.000...
18796
18797        2) The largest positive useful value for ndp is determined by the
18798           size of angle, the format of doubles on the target platform, and
18799           the risk of overflowing idmsf[3].  On a typical platform, for
18800           angle up to 2pi, the available floating-point precision might
18801           correspond to ndp=12.  However, the practical limit is typically
18802           ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is
18803           only 16 bits.
18804
18805        3) The absolute value of angle may exceed 2pi.  In cases where it
18806           does not, it is up to the caller to test for and handle the
18807           case where angle is very nearly 2pi and rounds up to 360 degrees,
18808           by testing for idmsf[0]=360 and setting idmsf[0-3] to zero.
18809
18810        Called:
18811           eraD2tf      decompose days to hms
18812
18813        This revision:  2021 May 11
18814
18815        Copyright (C) 2013-2021, NumFOCUS Foundation.
18816        Derived, with permission, from the SOFA library.  See notes at end of file.
18817
18818    """
18819    sign, idmsf = ufunc.a2af(ndp, angle)
18820    sign = sign.view(dt_bytes1)
18821    return sign, idmsf
18822
18823
18824def a2tf(ndp, angle):
18825    """
18826    Decompose radians into hours, minutes, seconds, fraction.
18827
18828    Parameters
18829    ----------
18830    ndp : int array
18831    angle : double array
18832
18833    Returns
18834    -------
18835    sign : char array
18836    ihmsf : int array
18837
18838    Notes
18839    -----
18840    Wraps ERFA function ``eraA2tf``. The ERFA documentation is::
18841
18842        - - - - - - - -
18843         e r a A 2 t f
18844        - - - - - - - -
18845
18846        Decompose radians into hours, minutes, seconds, fraction.
18847
18848        Given:
18849           ndp     int     resolution (Note 1)
18850           angle   double  angle in radians
18851
18852        Returned:
18853           sign    char         '+' or '-'
18854           ihmsf   int[4]  hours, minutes, seconds, fraction
18855
18856        Notes:
18857
18858        1) The argument ndp is interpreted as follows:
18859
18860           ndp         resolution
18861            :      ...0000 00 00
18862           -7         1000 00 00
18863           -6          100 00 00
18864           -5           10 00 00
18865           -4            1 00 00
18866           -3            0 10 00
18867           -2            0 01 00
18868           -1            0 00 10
18869            0            0 00 01
18870            1            0 00 00.1
18871            2            0 00 00.01
18872            3            0 00 00.001
18873            :            0 00 00.000...
18874
18875        2) The largest positive useful value for ndp is determined by the
18876           size of angle, the format of doubles on the target platform, and
18877           the risk of overflowing ihmsf[3].  On a typical platform, for
18878           angle up to 2pi, the available floating-point precision might
18879           correspond to ndp=12.  However, the practical limit is typically
18880           ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is
18881           only 16 bits.
18882
18883        3) The absolute value of angle may exceed 2pi.  In cases where it
18884           does not, it is up to the caller to test for and handle the
18885           case where angle is very nearly 2pi and rounds up to 24 hours,
18886           by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
18887
18888        Called:
18889           eraD2tf      decompose days to hms
18890
18891        This revision:  2021 May 11
18892
18893        Copyright (C) 2013-2021, NumFOCUS Foundation.
18894        Derived, with permission, from the SOFA library.  See notes at end of file.
18895
18896    """
18897    sign, ihmsf = ufunc.a2tf(ndp, angle)
18898    sign = sign.view(dt_bytes1)
18899    return sign, ihmsf
18900
18901
18902def af2a(s, ideg, iamin, asec):
18903    """
18904    Convert degrees, arcminutes, arcseconds to radians.
18905
18906    Parameters
18907    ----------
18908    s : char array
18909    ideg : int array
18910    iamin : int array
18911    asec : double array
18912
18913    Returns
18914    -------
18915    rad : double array
18916
18917    Notes
18918    -----
18919    Wraps ERFA function ``eraAf2a``. The ERFA documentation is::
18920
18921        - - - - - - - -
18922         e r a A f 2 a
18923        - - - - - - - -
18924
18925        Convert degrees, arcminutes, arcseconds to radians.
18926
18927        Given:
18928           s         char    sign:  '-' = negative, otherwise positive
18929           ideg      int     degrees
18930           iamin     int     arcminutes
18931           asec      double  arcseconds
18932
18933        Returned:
18934           rad       double  angle in radians
18935
18936        Returned (function value):
18937                     int     status:  0 = OK
18938                                      1 = ideg outside range 0-359
18939                                      2 = iamin outside range 0-59
18940                                      3 = asec outside range 0-59.999...
18941
18942        Notes:
18943
18944        1)  The result is computed even if any of the range checks fail.
18945
18946        2)  Negative ideg, iamin and/or asec produce a warning status, but
18947            the absolute value is used in the conversion.
18948
18949        3)  If there are multiple errors, the status value reflects only the
18950            first, the smallest taking precedence.
18951
18952        This revision:  2021 May 11
18953
18954        Copyright (C) 2013-2021, NumFOCUS Foundation.
18955        Derived, with permission, from the SOFA library.  See notes at end of file.
18956
18957    """
18958    rad, c_retval = ufunc.af2a(s, ideg, iamin, asec)
18959    check_errwarn(c_retval, 'af2a')
18960    return rad
18961
18962
18963STATUS_CODES['af2a'] = {
18964    0: 'OK',
18965    1: 'ideg outside range 0-359',
18966    2: 'iamin outside range 0-59',
18967    3: 'asec outside range 0-59.999...',
18968}
18969
18970
18971def anp(a):
18972    """
18973    Normalize angle into the range 0 <= a < 2pi.
18974
18975    Parameters
18976    ----------
18977    a : double array
18978
18979    Returns
18980    -------
18981    c_retval : double array
18982
18983    Notes
18984    -----
18985    Wraps ERFA function ``eraAnp``. The ERFA documentation is::
18986
18987        - - - - - - -
18988         e r a A n p
18989        - - - - - - -
18990
18991        Normalize angle into the range 0 <= a < 2pi.
18992
18993        Given:
18994           a        double     angle (radians)
18995
18996        Returned (function value):
18997                    double     angle in range 0-2pi
18998
18999        This revision:  2021 May 11
19000
19001        Copyright (C) 2013-2021, NumFOCUS Foundation.
19002        Derived, with permission, from the SOFA library.  See notes at end of file.
19003
19004    """
19005    c_retval = ufunc.anp(a)
19006    return c_retval
19007
19008
19009def anpm(a):
19010    """
19011    Normalize angle into the range -pi <= a < +pi.
19012
19013    Parameters
19014    ----------
19015    a : double array
19016
19017    Returns
19018    -------
19019    c_retval : double array
19020
19021    Notes
19022    -----
19023    Wraps ERFA function ``eraAnpm``. The ERFA documentation is::
19024
19025        - - - - - - - -
19026         e r a A n p m
19027        - - - - - - - -
19028
19029        Normalize angle into the range -pi <= a < +pi.
19030
19031        Given:
19032           a        double     angle (radians)
19033
19034        Returned (function value):
19035                    double     angle in range +/-pi
19036
19037        This revision:  2021 May 11
19038
19039        Copyright (C) 2013-2021, NumFOCUS Foundation.
19040        Derived, with permission, from the SOFA library.  See notes at end of file.
19041
19042    """
19043    c_retval = ufunc.anpm(a)
19044    return c_retval
19045
19046
19047def d2tf(ndp, days):
19048    """
19049    Decompose days to hours, minutes, seconds, fraction.
19050
19051    Parameters
19052    ----------
19053    ndp : int array
19054    days : double array
19055
19056    Returns
19057    -------
19058    sign : char array
19059    ihmsf : int array
19060
19061    Notes
19062    -----
19063    Wraps ERFA function ``eraD2tf``. The ERFA documentation is::
19064
19065        - - - - - - - -
19066         e r a D 2 t f
19067        - - - - - - - -
19068
19069        Decompose days to hours, minutes, seconds, fraction.
19070
19071        Given:
19072           ndp     int     resolution (Note 1)
19073           days    double  interval in days
19074
19075        Returned:
19076           sign    char         '+' or '-'
19077           ihmsf   int[4]  hours, minutes, seconds, fraction
19078
19079        Notes:
19080
19081        1) The argument ndp is interpreted as follows:
19082
19083           ndp         resolution
19084            :      ...0000 00 00
19085           -7         1000 00 00
19086           -6          100 00 00
19087           -5           10 00 00
19088           -4            1 00 00
19089           -3            0 10 00
19090           -2            0 01 00
19091           -1            0 00 10
19092            0            0 00 01
19093            1            0 00 00.1
19094            2            0 00 00.01
19095            3            0 00 00.001
19096            :            0 00 00.000...
19097
19098        2) The largest positive useful value for ndp is determined by the
19099           size of days, the format of double on the target platform, and
19100           the risk of overflowing ihmsf[3].  On a typical platform, for
19101           days up to 1.0, the available floating-point precision might
19102           correspond to ndp=12.  However, the practical limit is typically
19103           ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is
19104           only 16 bits.
19105
19106        3) The absolute value of days may exceed 1.0.  In cases where it
19107           does not, it is up to the caller to test for and handle the
19108           case where days is very nearly 1.0 and rounds up to 24 hours,
19109           by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
19110
19111        This revision:  2021 May 11
19112
19113        Copyright (C) 2013-2021, NumFOCUS Foundation.
19114        Derived, with permission, from the SOFA library.  See notes at end of file.
19115
19116    """
19117    sign, ihmsf = ufunc.d2tf(ndp, days)
19118    sign = sign.view(dt_bytes1)
19119    return sign, ihmsf
19120
19121
19122def tf2a(s, ihour, imin, sec):
19123    """
19124    Convert hours, minutes, seconds to radians.
19125
19126    Parameters
19127    ----------
19128    s : char array
19129    ihour : int array
19130    imin : int array
19131    sec : double array
19132
19133    Returns
19134    -------
19135    rad : double array
19136
19137    Notes
19138    -----
19139    Wraps ERFA function ``eraTf2a``. The ERFA documentation is::
19140
19141        - - - - - - - -
19142         e r a T f 2 a
19143        - - - - - - - -
19144
19145        Convert hours, minutes, seconds to radians.
19146
19147        Given:
19148           s         char    sign:  '-' = negative, otherwise positive
19149           ihour     int     hours
19150           imin      int     minutes
19151           sec       double  seconds
19152
19153        Returned:
19154           rad       double  angle in radians
19155
19156        Returned (function value):
19157                     int     status:  0 = OK
19158                                      1 = ihour outside range 0-23
19159                                      2 = imin outside range 0-59
19160                                      3 = sec outside range 0-59.999...
19161
19162        Notes:
19163
19164        1)  The result is computed even if any of the range checks fail.
19165
19166        2)  Negative ihour, imin and/or sec produce a warning status, but
19167            the absolute value is used in the conversion.
19168
19169        3)  If there are multiple errors, the status value reflects only the
19170            first, the smallest taking precedence.
19171
19172        This revision:  2021 May 11
19173
19174        Copyright (C) 2013-2021, NumFOCUS Foundation.
19175        Derived, with permission, from the SOFA library.  See notes at end of file.
19176
19177    """
19178    rad, c_retval = ufunc.tf2a(s, ihour, imin, sec)
19179    check_errwarn(c_retval, 'tf2a')
19180    return rad
19181
19182
19183STATUS_CODES['tf2a'] = {
19184    0: 'OK',
19185    1: 'ihour outside range 0-23',
19186    2: 'imin outside range 0-59',
19187    3: 'sec outside range 0-59.999...',
19188}
19189
19190
19191def tf2d(s, ihour, imin, sec):
19192    """
19193    Convert hours, minutes, seconds to days.
19194
19195    Parameters
19196    ----------
19197    s : char array
19198    ihour : int array
19199    imin : int array
19200    sec : double array
19201
19202    Returns
19203    -------
19204    days : double array
19205
19206    Notes
19207    -----
19208    Wraps ERFA function ``eraTf2d``. The ERFA documentation is::
19209
19210        - - - - - - - -
19211         e r a T f 2 d
19212        - - - - - - - -
19213
19214        Convert hours, minutes, seconds to days.
19215
19216        Given:
19217           s         char    sign:  '-' = negative, otherwise positive
19218           ihour     int     hours
19219           imin      int     minutes
19220           sec       double  seconds
19221
19222        Returned:
19223           days      double  interval in days
19224
19225        Returned (function value):
19226                     int     status:  0 = OK
19227                                      1 = ihour outside range 0-23
19228                                      2 = imin outside range 0-59
19229                                      3 = sec outside range 0-59.999...
19230
19231        Notes:
19232
19233        1)  The result is computed even if any of the range checks fail.
19234
19235        2)  Negative ihour, imin and/or sec produce a warning status, but
19236            the absolute value is used in the conversion.
19237
19238        3)  If there are multiple errors, the status value reflects only the
19239            first, the smallest taking precedence.
19240
19241        This revision:  2021 May 11
19242
19243        Copyright (C) 2013-2021, NumFOCUS Foundation.
19244        Derived, with permission, from the SOFA library.  See notes at end of file.
19245
19246    """
19247    days, c_retval = ufunc.tf2d(s, ihour, imin, sec)
19248    check_errwarn(c_retval, 'tf2d')
19249    return days
19250
19251
19252STATUS_CODES['tf2d'] = {
19253    0: 'OK',
19254    1: 'ihour outside range 0-23',
19255    2: 'imin outside range 0-59',
19256    3: 'sec outside range 0-59.999...',
19257}
19258
19259
19260def rx(phi, r):
19261    """
19262    Rotate an r-matrix about the x-axis.
19263
19264    Parameters
19265    ----------
19266    phi : double array
19267    r : double array
19268
19269    Returns
19270    -------
19271    r : double array
19272
19273    Notes
19274    -----
19275    Wraps ERFA function ``eraRx``. Note that, unlike the erfa routine,
19276    the python wrapper does not change r in-place. The ERFA documentation is::
19277
19278        - - - - - -
19279         e r a R x
19280        - - - - - -
19281
19282        Rotate an r-matrix about the x-axis.
19283
19284        Given:
19285           phi    double          angle (radians)
19286
19287        Given and returned:
19288           r      double[3][3]    r-matrix, rotated
19289
19290        Notes:
19291
19292        1) Calling this function with positive phi incorporates in the
19293           supplied r-matrix r an additional rotation, about the x-axis,
19294           anticlockwise as seen looking towards the origin from positive x.
19295
19296        2) The additional rotation can be represented by this matrix:
19297
19298               (  1        0            0      )
19299               (                               )
19300               (  0   + cos(phi)   + sin(phi)  )
19301               (                               )
19302               (  0   - sin(phi)   + cos(phi)  )
19303
19304        This revision:  2021 May 11
19305
19306        Copyright (C) 2013-2021, NumFOCUS Foundation.
19307        Derived, with permission, from the SOFA library.  See notes at end of file.
19308
19309    """
19310    r = ufunc.rx(phi, r)
19311    return r
19312
19313
19314def ry(theta, r):
19315    """
19316    Rotate an r-matrix about the y-axis.
19317
19318    Parameters
19319    ----------
19320    theta : double array
19321    r : double array
19322
19323    Returns
19324    -------
19325    r : double array
19326
19327    Notes
19328    -----
19329    Wraps ERFA function ``eraRy``. Note that, unlike the erfa routine,
19330    the python wrapper does not change r in-place. The ERFA documentation is::
19331
19332        - - - - - -
19333         e r a R y
19334        - - - - - -
19335
19336        Rotate an r-matrix about the y-axis.
19337
19338        Given:
19339           theta  double          angle (radians)
19340
19341        Given and returned:
19342           r      double[3][3]    r-matrix, rotated
19343
19344        Notes:
19345
19346        1) Calling this function with positive theta incorporates in the
19347           supplied r-matrix r an additional rotation, about the y-axis,
19348           anticlockwise as seen looking towards the origin from positive y.
19349
19350        2) The additional rotation can be represented by this matrix:
19351
19352               (  + cos(theta)     0      - sin(theta)  )
19353               (                                        )
19354               (       0           1           0        )
19355               (                                        )
19356               (  + sin(theta)     0      + cos(theta)  )
19357
19358        This revision:  2021 May 11
19359
19360        Copyright (C) 2013-2021, NumFOCUS Foundation.
19361        Derived, with permission, from the SOFA library.  See notes at end of file.
19362
19363    """
19364    r = ufunc.ry(theta, r)
19365    return r
19366
19367
19368def rz(psi, r):
19369    """
19370    Rotate an r-matrix about the z-axis.
19371
19372    Parameters
19373    ----------
19374    psi : double array
19375    r : double array
19376
19377    Returns
19378    -------
19379    r : double array
19380
19381    Notes
19382    -----
19383    Wraps ERFA function ``eraRz``. Note that, unlike the erfa routine,
19384    the python wrapper does not change r in-place. The ERFA documentation is::
19385
19386        - - - - - -
19387         e r a R z
19388        - - - - - -
19389
19390        Rotate an r-matrix about the z-axis.
19391
19392        Given:
19393           psi    double          angle (radians)
19394
19395        Given and returned:
19396           r      double[3][3]    r-matrix, rotated
19397
19398        Notes:
19399
19400        1) Calling this function with positive psi incorporates in the
19401           supplied r-matrix r an additional rotation, about the z-axis,
19402           anticlockwise as seen looking towards the origin from positive z.
19403
19404        2) The additional rotation can be represented by this matrix:
19405
19406               (  + cos(psi)   + sin(psi)     0  )
19407               (                                 )
19408               (  - sin(psi)   + cos(psi)     0  )
19409               (                                 )
19410               (       0            0         1  )
19411
19412        This revision:  2021 May 11
19413
19414        Copyright (C) 2013-2021, NumFOCUS Foundation.
19415        Derived, with permission, from the SOFA library.  See notes at end of file.
19416
19417    """
19418    r = ufunc.rz(psi, r)
19419    return r
19420
19421
19422def cp(p):
19423    """
19424    Copy a p-vector.
19425
19426    Parameters
19427    ----------
19428    p : double array
19429
19430    Returns
19431    -------
19432    c : double array
19433
19434    Notes
19435    -----
19436    Wraps ERFA function ``eraCp``. The ERFA documentation is::
19437
19438        - - - - - -
19439         e r a C p
19440        - - - - - -
19441
19442        Copy a p-vector.
19443
19444        Given:
19445           p        double[3]     p-vector to be copied
19446
19447        Returned:
19448           c        double[3]     copy
19449
19450        This revision:  2021 May 11
19451
19452        Copyright (C) 2013-2021, NumFOCUS Foundation.
19453        Derived, with permission, from the SOFA library.  See notes at end of file.
19454
19455    """
19456    c = ufunc.cp(p)
19457    return c
19458
19459
19460def cpv(pv):
19461    """
19462    Copy a position/velocity vector.
19463
19464    Parameters
19465    ----------
19466    pv : double array
19467
19468    Returns
19469    -------
19470    c : double array
19471
19472    Notes
19473    -----
19474    Wraps ERFA function ``eraCpv``. The ERFA documentation is::
19475
19476        - - - - - - -
19477         e r a C p v
19478        - - - - - - -
19479
19480        Copy a position/velocity vector.
19481
19482        Given:
19483           pv     double[2][3]    position/velocity vector to be copied
19484
19485        Returned:
19486           c      double[2][3]    copy
19487
19488        Called:
19489           eraCp        copy p-vector
19490
19491        This revision:  2021 May 11
19492
19493        Copyright (C) 2013-2021, NumFOCUS Foundation.
19494        Derived, with permission, from the SOFA library.  See notes at end of file.
19495
19496    """
19497    c = ufunc.cpv(pv)
19498    return c
19499
19500
19501def cr(r):
19502    """
19503    Copy an r-matrix.
19504
19505    Parameters
19506    ----------
19507    r : double array
19508
19509    Returns
19510    -------
19511    c : double array
19512
19513    Notes
19514    -----
19515    Wraps ERFA function ``eraCr``. The ERFA documentation is::
19516
19517        - - - - - -
19518         e r a C r
19519        - - - - - -
19520
19521        Copy an r-matrix.
19522
19523        Given:
19524           r        double[3][3]    r-matrix to be copied
19525
19526        Returned:
19527           c        double[3][3]    copy
19528
19529        Called:
19530           eraCp        copy p-vector
19531
19532        This revision:  2021 May 11
19533
19534        Copyright (C) 2013-2021, NumFOCUS Foundation.
19535        Derived, with permission, from the SOFA library.  See notes at end of file.
19536
19537    """
19538    c = ufunc.cr(r)
19539    return c
19540
19541
19542def p2pv(p):
19543    """
19544    Extend a p-vector to a pv-vector by appending a zero velocity.
19545
19546    Parameters
19547    ----------
19548    p : double array
19549
19550    Returns
19551    -------
19552    pv : double array
19553
19554    Notes
19555    -----
19556    Wraps ERFA function ``eraP2pv``. The ERFA documentation is::
19557
19558        - - - - - - - -
19559         e r a P 2 p v
19560        - - - - - - - -
19561
19562        Extend a p-vector to a pv-vector by appending a zero velocity.
19563
19564        Given:
19565           p        double[3]       p-vector
19566
19567        Returned:
19568           pv       double[2][3]    pv-vector
19569
19570        Called:
19571           eraCp        copy p-vector
19572           eraZp        zero p-vector
19573
19574        This revision:  2021 May 11
19575
19576        Copyright (C) 2013-2021, NumFOCUS Foundation.
19577        Derived, with permission, from the SOFA library.  See notes at end of file.
19578
19579    """
19580    pv = ufunc.p2pv(p)
19581    return pv
19582
19583
19584def pv2p(pv):
19585    """
19586    Discard velocity component of a pv-vector.
19587
19588    Parameters
19589    ----------
19590    pv : double array
19591
19592    Returns
19593    -------
19594    p : double array
19595
19596    Notes
19597    -----
19598    Wraps ERFA function ``eraPv2p``. The ERFA documentation is::
19599
19600        - - - - - - - -
19601         e r a P v 2 p
19602        - - - - - - - -
19603
19604        Discard velocity component of a pv-vector.
19605
19606        Given:
19607           pv      double[2][3]     pv-vector
19608
19609        Returned:
19610           p       double[3]        p-vector
19611
19612        Called:
19613           eraCp        copy p-vector
19614
19615        This revision:  2021 May 11
19616
19617        Copyright (C) 2013-2021, NumFOCUS Foundation.
19618        Derived, with permission, from the SOFA library.  See notes at end of file.
19619
19620    """
19621    p = ufunc.pv2p(pv)
19622    return p
19623
19624
19625def ir():
19626    """
19627    Initialize an r-matrix to the identity matrix.
19628
19629    Parameters
19630    ----------
19631
19632    Returns
19633    -------
19634    r : double array
19635
19636    Notes
19637    -----
19638    Wraps ERFA function ``eraIr``. The ERFA documentation is::
19639
19640        - - - - - -
19641         e r a I r
19642        - - - - - -
19643
19644        Initialize an r-matrix to the identity matrix.
19645
19646        Returned:
19647           r       double[3][3]    r-matrix
19648
19649        This revision:  2021 May 11
19650
19651        Copyright (C) 2013-2021, NumFOCUS Foundation.
19652        Derived, with permission, from the SOFA library.  See notes at end of file.
19653
19654    """
19655    r = ufunc.ir()
19656    return r
19657
19658
19659def zp():
19660    """
19661    Zero a p-vector.
19662
19663    Parameters
19664    ----------
19665
19666    Returns
19667    -------
19668    p : double array
19669
19670    Notes
19671    -----
19672    Wraps ERFA function ``eraZp``. The ERFA documentation is::
19673
19674        - - - - - -
19675         e r a Z p
19676        - - - - - -
19677
19678        Zero a p-vector.
19679
19680        Returned:
19681           p        double[3]      zero p-vector
19682
19683        This revision:  2021 May 11
19684
19685        Copyright (C) 2013-2021, NumFOCUS Foundation.
19686        Derived, with permission, from the SOFA library.  See notes at end of file.
19687
19688    """
19689    p = ufunc.zp()
19690    return p
19691
19692
19693def zpv():
19694    """
19695    Zero a pv-vector.
19696
19697    Parameters
19698    ----------
19699
19700    Returns
19701    -------
19702    pv : double array
19703
19704    Notes
19705    -----
19706    Wraps ERFA function ``eraZpv``. The ERFA documentation is::
19707
19708        - - - - - - -
19709         e r a Z p v
19710        - - - - - - -
19711
19712        Zero a pv-vector.
19713
19714        Returned:
19715           pv       double[2][3]      zero pv-vector
19716
19717        Called:
19718           eraZp        zero p-vector
19719
19720        This revision:  2021 May 11
19721
19722        Copyright (C) 2013-2021, NumFOCUS Foundation.
19723        Derived, with permission, from the SOFA library.  See notes at end of file.
19724
19725    """
19726    pv = ufunc.zpv()
19727    return pv
19728
19729
19730def zr():
19731    """
19732    Initialize an r-matrix to the null matrix.
19733
19734    Parameters
19735    ----------
19736
19737    Returns
19738    -------
19739    r : double array
19740
19741    Notes
19742    -----
19743    Wraps ERFA function ``eraZr``. The ERFA documentation is::
19744
19745        - - - - - -
19746         e r a Z r
19747        - - - - - -
19748
19749        Initialize an r-matrix to the null matrix.
19750
19751        Returned:
19752           r        double[3][3]    r-matrix
19753
19754        This revision:  2021 May 11
19755
19756        Copyright (C) 2013-2021, NumFOCUS Foundation.
19757        Derived, with permission, from the SOFA library.  See notes at end of file.
19758
19759    """
19760    r = ufunc.zr()
19761    return r
19762
19763
19764def rxr(a, b):
19765    """
19766    Multiply two r-matrices.
19767
19768    Parameters
19769    ----------
19770    a : double array
19771    b : double array
19772
19773    Returns
19774    -------
19775    atb : double array
19776
19777    Notes
19778    -----
19779    Wraps ERFA function ``eraRxr``. The ERFA documentation is::
19780
19781        - - - - - - -
19782         e r a R x r
19783        - - - - - - -
19784
19785        Multiply two r-matrices.
19786
19787        Given:
19788           a        double[3][3]    first r-matrix
19789           b        double[3][3]    second r-matrix
19790
19791        Returned:
19792           atb      double[3][3]    a * b
19793
19794        Note:
19795           It is permissible to re-use the same array for any of the
19796           arguments.
19797
19798        Called:
19799           eraCr        copy r-matrix
19800
19801        This revision:  2021 May 11
19802
19803        Copyright (C) 2013-2021, NumFOCUS Foundation.
19804        Derived, with permission, from the SOFA library.  See notes at end of file.
19805
19806    """
19807    atb = ufunc.rxr(a, b)
19808    return atb
19809
19810
19811def tr(r):
19812    """
19813    Transpose an r-matrix.
19814
19815    Parameters
19816    ----------
19817    r : double array
19818
19819    Returns
19820    -------
19821    rt : double array
19822
19823    Notes
19824    -----
19825    Wraps ERFA function ``eraTr``. The ERFA documentation is::
19826
19827        - - - - - -
19828         e r a T r
19829        - - - - - -
19830
19831        Transpose an r-matrix.
19832
19833        Given:
19834           r        double[3][3]    r-matrix
19835
19836        Returned:
19837           rt       double[3][3]    transpose
19838
19839        Note:
19840           It is permissible for r and rt to be the same array.
19841
19842        Called:
19843           eraCr        copy r-matrix
19844
19845        This revision:  2021 May 11
19846
19847        Copyright (C) 2013-2021, NumFOCUS Foundation.
19848        Derived, with permission, from the SOFA library.  See notes at end of file.
19849
19850    """
19851    rt = ufunc.tr(r)
19852    return rt
19853
19854
19855def rxp(r, p):
19856    """
19857    Multiply a p-vector by an r-matrix.
19858
19859    Parameters
19860    ----------
19861    r : double array
19862    p : double array
19863
19864    Returns
19865    -------
19866    rp : double array
19867
19868    Notes
19869    -----
19870    Wraps ERFA function ``eraRxp``. The ERFA documentation is::
19871
19872        - - - - - - -
19873         e r a R x p
19874        - - - - - - -
19875
19876        Multiply a p-vector by an r-matrix.
19877
19878        Given:
19879           r        double[3][3]    r-matrix
19880           p        double[3]       p-vector
19881
19882        Returned:
19883           rp       double[3]       r * p
19884
19885        Note:
19886           It is permissible for p and rp to be the same array.
19887
19888        Called:
19889           eraCp        copy p-vector
19890
19891        This revision:  2021 May 11
19892
19893        Copyright (C) 2013-2021, NumFOCUS Foundation.
19894        Derived, with permission, from the SOFA library.  See notes at end of file.
19895
19896    """
19897    rp = ufunc.rxp(r, p)
19898    return rp
19899
19900
19901def rxpv(r, pv):
19902    """
19903    Multiply a pv-vector by an r-matrix.
19904
19905    Parameters
19906    ----------
19907    r : double array
19908    pv : double array
19909
19910    Returns
19911    -------
19912    rpv : double array
19913
19914    Notes
19915    -----
19916    Wraps ERFA function ``eraRxpv``. The ERFA documentation is::
19917
19918        - - - - - - - -
19919         e r a R x p v
19920        - - - - - - - -
19921
19922        Multiply a pv-vector by an r-matrix.
19923
19924        Given:
19925           r        double[3][3]    r-matrix
19926           pv       double[2][3]    pv-vector
19927
19928        Returned:
19929           rpv      double[2][3]    r * pv
19930
19931        Notes:
19932
19933        1) The algorithm is for the simple case where the r-matrix r is not
19934           a function of time.  The case where r is a function of time leads
19935           to an additional velocity component equal to the product of the
19936           derivative of r and the position vector.
19937
19938        2) It is permissible for pv and rpv to be the same array.
19939
19940        Called:
19941           eraRxp       product of r-matrix and p-vector
19942
19943        This revision:  2021 May 11
19944
19945        Copyright (C) 2013-2021, NumFOCUS Foundation.
19946        Derived, with permission, from the SOFA library.  See notes at end of file.
19947
19948    """
19949    rpv = ufunc.rxpv(r, pv)
19950    return rpv
19951
19952
19953def trxp(r, p):
19954    """
19955    Multiply a p-vector by the transpose of an r-matrix.
19956
19957    Parameters
19958    ----------
19959    r : double array
19960    p : double array
19961
19962    Returns
19963    -------
19964    trp : double array
19965
19966    Notes
19967    -----
19968    Wraps ERFA function ``eraTrxp``. The ERFA documentation is::
19969
19970        - - - - - - - -
19971         e r a T r x p
19972        - - - - - - - -
19973
19974        Multiply a p-vector by the transpose of an r-matrix.
19975
19976        Given:
19977           r        double[3][3]   r-matrix
19978           p        double[3]      p-vector
19979
19980        Returned:
19981           trp      double[3]      r^T * p
19982
19983        Note:
19984           It is permissible for p and trp to be the same array.
19985
19986        Called:
19987           eraTr        transpose r-matrix
19988           eraRxp       product of r-matrix and p-vector
19989
19990        This revision:  2021 May 11
19991
19992        Copyright (C) 2013-2021, NumFOCUS Foundation.
19993        Derived, with permission, from the SOFA library.  See notes at end of file.
19994
19995    """
19996    trp = ufunc.trxp(r, p)
19997    return trp
19998
19999
20000def trxpv(r, pv):
20001    """
20002    Multiply a pv-vector by the transpose of an r-matrix.
20003
20004    Parameters
20005    ----------
20006    r : double array
20007    pv : double array
20008
20009    Returns
20010    -------
20011    trpv : double array
20012
20013    Notes
20014    -----
20015    Wraps ERFA function ``eraTrxpv``. The ERFA documentation is::
20016
20017        - - - - - - - - -
20018         e r a T r x p v
20019        - - - - - - - - -
20020
20021        Multiply a pv-vector by the transpose of an r-matrix.
20022
20023        Given:
20024           r        double[3][3]    r-matrix
20025           pv       double[2][3]    pv-vector
20026
20027        Returned:
20028           trpv     double[2][3]    r^T * pv
20029
20030        Notes:
20031
20032        1) The algorithm is for the simple case where the r-matrix r is not
20033           a function of time.  The case where r is a function of time leads
20034           to an additional velocity component equal to the product of the
20035           derivative of the transpose of r and the position vector.
20036
20037        2) It is permissible for pv and rpv to be the same array.
20038
20039        Called:
20040           eraTr        transpose r-matrix
20041           eraRxpv      product of r-matrix and pv-vector
20042
20043        This revision:  2021 May 11
20044
20045        Copyright (C) 2013-2021, NumFOCUS Foundation.
20046        Derived, with permission, from the SOFA library.  See notes at end of file.
20047
20048    """
20049    trpv = ufunc.trxpv(r, pv)
20050    return trpv
20051
20052
20053def rm2v(r):
20054    """
20055    Express an r-matrix as an r-vector.
20056
20057    Parameters
20058    ----------
20059    r : double array
20060
20061    Returns
20062    -------
20063    w : double array
20064
20065    Notes
20066    -----
20067    Wraps ERFA function ``eraRm2v``. The ERFA documentation is::
20068
20069        - - - - - - - -
20070         e r a R m 2 v
20071        - - - - - - - -
20072
20073        Express an r-matrix as an r-vector.
20074
20075        Given:
20076           r        double[3][3]    rotation matrix
20077
20078        Returned:
20079           w        double[3]       rotation vector (Note 1)
20080
20081        Notes:
20082
20083        1) A rotation matrix describes a rotation through some angle about
20084           some arbitrary axis called the Euler axis.  The "rotation vector"
20085           returned by this function has the same direction as the Euler axis,
20086           and its magnitude is the angle in radians.  (The magnitude and
20087           direction can be separated by means of the function eraPn.)
20088
20089        2) If r is null, so is the result.  If r is not a rotation matrix
20090           the result is undefined;  r must be proper (i.e. have a positive
20091           determinant) and real orthogonal (inverse = transpose).
20092
20093        3) The reference frame rotates clockwise as seen looking along
20094           the rotation vector from the origin.
20095
20096        This revision:  2021 May 11
20097
20098        Copyright (C) 2013-2021, NumFOCUS Foundation.
20099        Derived, with permission, from the SOFA library.  See notes at end of file.
20100
20101    """
20102    w = ufunc.rm2v(r)
20103    return w
20104
20105
20106def rv2m(w):
20107    """
20108    Form the r-matrix corresponding to a given r-vector.
20109
20110    Parameters
20111    ----------
20112    w : double array
20113
20114    Returns
20115    -------
20116    r : double array
20117
20118    Notes
20119    -----
20120    Wraps ERFA function ``eraRv2m``. The ERFA documentation is::
20121
20122        - - - - - - - -
20123         e r a R v 2 m
20124        - - - - - - - -
20125
20126        Form the r-matrix corresponding to a given r-vector.
20127
20128        Given:
20129           w        double[3]      rotation vector (Note 1)
20130
20131        Returned:
20132           r        double[3][3]    rotation matrix
20133
20134        Notes:
20135
20136        1) A rotation matrix describes a rotation through some angle about
20137           some arbitrary axis called the Euler axis.  The "rotation vector"
20138           supplied to This function has the same direction as the Euler
20139           axis, and its magnitude is the angle in radians.
20140
20141        2) If w is null, the identity matrix is returned.
20142
20143        3) The reference frame rotates clockwise as seen looking along the
20144           rotation vector from the origin.
20145
20146        This revision:  2021 May 11
20147
20148        Copyright (C) 2013-2021, NumFOCUS Foundation.
20149        Derived, with permission, from the SOFA library.  See notes at end of file.
20150
20151    """
20152    r = ufunc.rv2m(w)
20153    return r
20154
20155
20156def pap(a, b):
20157    """
20158    Position-angle from two p-vectors.
20159
20160    Parameters
20161    ----------
20162    a : double array
20163    b : double array
20164
20165    Returns
20166    -------
20167    c_retval : double array
20168
20169    Notes
20170    -----
20171    Wraps ERFA function ``eraPap``. The ERFA documentation is::
20172
20173        - - - - - - -
20174         e r a P a p
20175        - - - - - - -
20176
20177        Position-angle from two p-vectors.
20178
20179        Given:
20180           a      double[3]  direction of reference point
20181           b      double[3]  direction of point whose PA is required
20182
20183        Returned (function value):
20184                  double     position angle of b with respect to a (radians)
20185
20186        Notes:
20187
20188        1) The result is the position angle, in radians, of direction b with
20189           respect to direction a.  It is in the range -pi to +pi.  The
20190           sense is such that if b is a small distance "north" of a the
20191           position angle is approximately zero, and if b is a small
20192           distance "east" of a the position angle is approximately +pi/2.
20193
20194        2) The vectors a and b need not be of unit length.
20195
20196        3) Zero is returned if the two directions are the same or if either
20197           vector is null.
20198
20199        4) If vector a is at a pole, the result is ill-defined.
20200
20201        Called:
20202           eraPn        decompose p-vector into modulus and direction
20203           eraPm        modulus of p-vector
20204           eraPxp       vector product of two p-vectors
20205           eraPmp       p-vector minus p-vector
20206           eraPdp       scalar product of two p-vectors
20207
20208        This revision:  2021 May 11
20209
20210        Copyright (C) 2013-2021, NumFOCUS Foundation.
20211        Derived, with permission, from the SOFA library.  See notes at end of file.
20212
20213    """
20214    c_retval = ufunc.pap(a, b)
20215    return c_retval
20216
20217
20218def pas(al, ap, bl, bp):
20219    """
20220    Position-angle from spherical coordinates.
20221
20222    Parameters
20223    ----------
20224    al : double array
20225    ap : double array
20226    bl : double array
20227    bp : double array
20228
20229    Returns
20230    -------
20231    c_retval : double array
20232
20233    Notes
20234    -----
20235    Wraps ERFA function ``eraPas``. The ERFA documentation is::
20236
20237        - - - - - - -
20238         e r a P a s
20239        - - - - - - -
20240
20241        Position-angle from spherical coordinates.
20242
20243        Given:
20244           al     double     longitude of point A (e.g. RA) in radians
20245           ap     double     latitude of point A (e.g. Dec) in radians
20246           bl     double     longitude of point B
20247           bp     double     latitude of point B
20248
20249        Returned (function value):
20250                  double     position angle of B with respect to A
20251
20252        Notes:
20253
20254        1) The result is the bearing (position angle), in radians, of point
20255           B with respect to point A.  It is in the range -pi to +pi.  The
20256           sense is such that if B is a small distance "east" of point A,
20257           the bearing is approximately +pi/2.
20258
20259        2) Zero is returned if the two points are coincident.
20260
20261        This revision:  2021 May 11
20262
20263        Copyright (C) 2013-2021, NumFOCUS Foundation.
20264        Derived, with permission, from the SOFA library.  See notes at end of file.
20265
20266    """
20267    c_retval = ufunc.pas(al, ap, bl, bp)
20268    return c_retval
20269
20270
20271def sepp(a, b):
20272    """
20273    Angular separation between two p-vectors.
20274
20275    Parameters
20276    ----------
20277    a : double array
20278    b : double array
20279
20280    Returns
20281    -------
20282    c_retval : double array
20283
20284    Notes
20285    -----
20286    Wraps ERFA function ``eraSepp``. The ERFA documentation is::
20287
20288        - - - - - - - -
20289         e r a S e p p
20290        - - - - - - - -
20291
20292        Angular separation between two p-vectors.
20293
20294        Given:
20295           a      double[3]    first p-vector (not necessarily unit length)
20296           b      double[3]    second p-vector (not necessarily unit length)
20297
20298        Returned (function value):
20299                  double       angular separation (radians, always positive)
20300
20301        Notes:
20302
20303        1) If either vector is null, a zero result is returned.
20304
20305        2) The angular separation is most simply formulated in terms of
20306           scalar product.  However, this gives poor accuracy for angles
20307           near zero and pi.  The present algorithm uses both cross product
20308           and dot product, to deliver full accuracy whatever the size of
20309           the angle.
20310
20311        Called:
20312           eraPxp       vector product of two p-vectors
20313           eraPm        modulus of p-vector
20314           eraPdp       scalar product of two p-vectors
20315
20316        This revision:  2021 May 11
20317
20318        Copyright (C) 2013-2021, NumFOCUS Foundation.
20319        Derived, with permission, from the SOFA library.  See notes at end of file.
20320
20321    """
20322    c_retval = ufunc.sepp(a, b)
20323    return c_retval
20324
20325
20326def seps(al, ap, bl, bp):
20327    """
20328    Angular separation between two sets of spherical coordinates.
20329
20330    Parameters
20331    ----------
20332    al : double array
20333    ap : double array
20334    bl : double array
20335    bp : double array
20336
20337    Returns
20338    -------
20339    c_retval : double array
20340
20341    Notes
20342    -----
20343    Wraps ERFA function ``eraSeps``. The ERFA documentation is::
20344
20345        - - - - - - - -
20346         e r a S e p s
20347        - - - - - - - -
20348
20349        Angular separation between two sets of spherical coordinates.
20350
20351        Given:
20352           al     double       first longitude (radians)
20353           ap     double       first latitude (radians)
20354           bl     double       second longitude (radians)
20355           bp     double       second latitude (radians)
20356
20357        Returned (function value):
20358                  double       angular separation (radians)
20359
20360        Called:
20361           eraS2c       spherical coordinates to unit vector
20362           eraSepp      angular separation between two p-vectors
20363
20364        This revision:  2021 May 11
20365
20366        Copyright (C) 2013-2021, NumFOCUS Foundation.
20367        Derived, with permission, from the SOFA library.  See notes at end of file.
20368
20369    """
20370    c_retval = ufunc.seps(al, ap, bl, bp)
20371    return c_retval
20372
20373
20374def c2s(p):
20375    """
20376    P-vector to spherical coordinates.
20377
20378    Parameters
20379    ----------
20380    p : double array
20381
20382    Returns
20383    -------
20384    theta : double array
20385    phi : double array
20386
20387    Notes
20388    -----
20389    Wraps ERFA function ``eraC2s``. The ERFA documentation is::
20390
20391        - - - - - - -
20392         e r a C 2 s
20393        - - - - - - -
20394
20395        P-vector to spherical coordinates.
20396
20397        Given:
20398           p      double[3]    p-vector
20399
20400        Returned:
20401           theta  double       longitude angle (radians)
20402           phi    double       latitude angle (radians)
20403
20404        Notes:
20405
20406        1) The vector p can have any magnitude; only its direction is used.
20407
20408        2) If p is null, zero theta and phi are returned.
20409
20410        3) At either pole, zero theta is returned.
20411
20412        This revision:  2021 May 11
20413
20414        Copyright (C) 2013-2021, NumFOCUS Foundation.
20415        Derived, with permission, from the SOFA library.  See notes at end of file.
20416
20417    """
20418    theta, phi = ufunc.c2s(p)
20419    return theta, phi
20420
20421
20422def p2s(p):
20423    """
20424    P-vector to spherical polar coordinates.
20425
20426    Parameters
20427    ----------
20428    p : double array
20429
20430    Returns
20431    -------
20432    theta : double array
20433    phi : double array
20434    r : double array
20435
20436    Notes
20437    -----
20438    Wraps ERFA function ``eraP2s``. The ERFA documentation is::
20439
20440        - - - - - - -
20441         e r a P 2 s
20442        - - - - - - -
20443
20444        P-vector to spherical polar coordinates.
20445
20446        Given:
20447           p        double[3]    p-vector
20448
20449        Returned:
20450           theta    double       longitude angle (radians)
20451           phi      double       latitude angle (radians)
20452           r        double       radial distance
20453
20454        Notes:
20455
20456        1) If P is null, zero theta, phi and r are returned.
20457
20458        2) At either pole, zero theta is returned.
20459
20460        Called:
20461           eraC2s       p-vector to spherical
20462           eraPm        modulus of p-vector
20463
20464        This revision:  2021 May 11
20465
20466        Copyright (C) 2013-2021, NumFOCUS Foundation.
20467        Derived, with permission, from the SOFA library.  See notes at end of file.
20468
20469    """
20470    theta, phi, r = ufunc.p2s(p)
20471    return theta, phi, r
20472
20473
20474def pv2s(pv):
20475    """
20476    Convert position/velocity from Cartesian to spherical coordinates.
20477
20478    Parameters
20479    ----------
20480    pv : double array
20481
20482    Returns
20483    -------
20484    theta : double array
20485    phi : double array
20486    r : double array
20487    td : double array
20488    pd : double array
20489    rd : double array
20490
20491    Notes
20492    -----
20493    Wraps ERFA function ``eraPv2s``. The ERFA documentation is::
20494
20495        - - - - - - - -
20496         e r a P v 2 s
20497        - - - - - - - -
20498
20499        Convert position/velocity from Cartesian to spherical coordinates.
20500
20501        Given:
20502           pv       double[2][3]  pv-vector
20503
20504        Returned:
20505           theta    double        longitude angle (radians)
20506           phi      double        latitude angle (radians)
20507           r        double        radial distance
20508           td       double        rate of change of theta
20509           pd       double        rate of change of phi
20510           rd       double        rate of change of r
20511
20512        Notes:
20513
20514        1) If the position part of pv is null, theta, phi, td and pd
20515           are indeterminate.  This is handled by extrapolating the
20516           position through unit time by using the velocity part of
20517           pv.  This moves the origin without changing the direction
20518           of the velocity component.  If the position and velocity
20519           components of pv are both null, zeroes are returned for all
20520           six results.
20521
20522        2) If the position is a pole, theta, td and pd are indeterminate.
20523           In such cases zeroes are returned for all three.
20524
20525        This revision:  2021 May 11
20526
20527        Copyright (C) 2013-2021, NumFOCUS Foundation.
20528        Derived, with permission, from the SOFA library.  See notes at end of file.
20529
20530    """
20531    theta, phi, r, td, pd, rd = ufunc.pv2s(pv)
20532    return theta, phi, r, td, pd, rd
20533
20534
20535def s2c(theta, phi):
20536    """
20537    Convert spherical coordinates to Cartesian.
20538
20539    Parameters
20540    ----------
20541    theta : double array
20542    phi : double array
20543
20544    Returns
20545    -------
20546    c : double array
20547
20548    Notes
20549    -----
20550    Wraps ERFA function ``eraS2c``. The ERFA documentation is::
20551
20552        - - - - - - -
20553         e r a S 2 c
20554        - - - - - - -
20555
20556        Convert spherical coordinates to Cartesian.
20557
20558        Given:
20559           theta    double       longitude angle (radians)
20560           phi      double       latitude angle (radians)
20561
20562        Returned:
20563           c        double[3]    direction cosines
20564
20565        This revision:  2021 May 11
20566
20567        Copyright (C) 2013-2021, NumFOCUS Foundation.
20568        Derived, with permission, from the SOFA library.  See notes at end of file.
20569
20570    """
20571    c = ufunc.s2c(theta, phi)
20572    return c
20573
20574
20575def s2p(theta, phi, r):
20576    """
20577    Convert spherical polar coordinates to p-vector.
20578
20579    Parameters
20580    ----------
20581    theta : double array
20582    phi : double array
20583    r : double array
20584
20585    Returns
20586    -------
20587    p : double array
20588
20589    Notes
20590    -----
20591    Wraps ERFA function ``eraS2p``. The ERFA documentation is::
20592
20593        - - - - - - -
20594         e r a S 2 p
20595        - - - - - - -
20596
20597        Convert spherical polar coordinates to p-vector.
20598
20599        Given:
20600           theta   double       longitude angle (radians)
20601           phi     double       latitude angle (radians)
20602           r       double       radial distance
20603
20604        Returned:
20605           p       double[3]    Cartesian coordinates
20606
20607        Called:
20608           eraS2c       spherical coordinates to unit vector
20609           eraSxp       multiply p-vector by scalar
20610
20611        This revision:  2021 May 11
20612
20613        Copyright (C) 2013-2021, NumFOCUS Foundation.
20614        Derived, with permission, from the SOFA library.  See notes at end of file.
20615
20616    """
20617    p = ufunc.s2p(theta, phi, r)
20618    return p
20619
20620
20621def s2pv(theta, phi, r, td, pd, rd):
20622    """
20623    Convert position/velocity from spherical to Cartesian coordinates.
20624
20625    Parameters
20626    ----------
20627    theta : double array
20628    phi : double array
20629    r : double array
20630    td : double array
20631    pd : double array
20632    rd : double array
20633
20634    Returns
20635    -------
20636    pv : double array
20637
20638    Notes
20639    -----
20640    Wraps ERFA function ``eraS2pv``. The ERFA documentation is::
20641
20642        - - - - - - - -
20643         e r a S 2 p v
20644        - - - - - - - -
20645
20646        Convert position/velocity from spherical to Cartesian coordinates.
20647
20648        Given:
20649           theta    double          longitude angle (radians)
20650           phi      double          latitude angle (radians)
20651           r        double          radial distance
20652           td       double          rate of change of theta
20653           pd       double          rate of change of phi
20654           rd       double          rate of change of r
20655
20656        Returned:
20657           pv       double[2][3]    pv-vector
20658
20659        This revision:  2021 May 11
20660
20661        Copyright (C) 2013-2021, NumFOCUS Foundation.
20662        Derived, with permission, from the SOFA library.  See notes at end of file.
20663
20664    """
20665    pv = ufunc.s2pv(theta, phi, r, td, pd, rd)
20666    return pv
20667
20668
20669def pdp(a, b):
20670    """
20671    p-vector inner (=scalar=dot) product.
20672
20673    Parameters
20674    ----------
20675    a : double array
20676    b : double array
20677
20678    Returns
20679    -------
20680    c_retval : double array
20681
20682    Notes
20683    -----
20684    Wraps ERFA function ``eraPdp``. The ERFA documentation is::
20685
20686        - - - - - - -
20687         e r a P d p
20688        - - - - - - -
20689
20690        p-vector inner (=scalar=dot) product.
20691
20692        Given:
20693           a      double[3]     first p-vector
20694           b      double[3]     second p-vector
20695
20696        Returned (function value):
20697                  double        a . b
20698
20699        This revision:  2021 May 11
20700
20701        Copyright (C) 2013-2021, NumFOCUS Foundation.
20702        Derived, with permission, from the SOFA library.  See notes at end of file.
20703
20704    """
20705    c_retval = ufunc.pdp(a, b)
20706    return c_retval
20707
20708
20709def pm(p):
20710    """
20711    Modulus of p-vector.
20712
20713    Parameters
20714    ----------
20715    p : double array
20716
20717    Returns
20718    -------
20719    c_retval : double array
20720
20721    Notes
20722    -----
20723    Wraps ERFA function ``eraPm``. The ERFA documentation is::
20724
20725        - - - - - -
20726         e r a P m
20727        - - - - - -
20728
20729        Modulus of p-vector.
20730
20731        Given:
20732           p      double[3]     p-vector
20733
20734        Returned (function value):
20735                  double        modulus
20736
20737        This revision:  2021 May 11
20738
20739        Copyright (C) 2013-2021, NumFOCUS Foundation.
20740        Derived, with permission, from the SOFA library.  See notes at end of file.
20741
20742    """
20743    c_retval = ufunc.pm(p)
20744    return c_retval
20745
20746
20747def pmp(a, b):
20748    """
20749    P-vector subtraction.
20750
20751    Parameters
20752    ----------
20753    a : double array
20754    b : double array
20755
20756    Returns
20757    -------
20758    amb : double array
20759
20760    Notes
20761    -----
20762    Wraps ERFA function ``eraPmp``. The ERFA documentation is::
20763
20764        - - - - - - -
20765         e r a P m p
20766        - - - - - - -
20767
20768        P-vector subtraction.
20769
20770        Given:
20771           a        double[3]      first p-vector
20772           b        double[3]      second p-vector
20773
20774        Returned:
20775           amb      double[3]      a - b
20776
20777        Note:
20778           It is permissible to re-use the same array for any of the
20779           arguments.
20780
20781        This revision:  2021 May 11
20782
20783        Copyright (C) 2013-2021, NumFOCUS Foundation.
20784        Derived, with permission, from the SOFA library.  See notes at end of file.
20785
20786    """
20787    amb = ufunc.pmp(a, b)
20788    return amb
20789
20790
20791def pn(p):
20792    """
20793    Convert a p-vector into modulus and unit vector.
20794
20795    Parameters
20796    ----------
20797    p : double array
20798
20799    Returns
20800    -------
20801    r : double array
20802    u : double array
20803
20804    Notes
20805    -----
20806    Wraps ERFA function ``eraPn``. The ERFA documentation is::
20807
20808        - - - - - -
20809         e r a P n
20810        - - - - - -
20811
20812        Convert a p-vector into modulus and unit vector.
20813
20814        Given:
20815           p        double[3]      p-vector
20816
20817        Returned:
20818           r        double         modulus
20819           u        double[3]      unit vector
20820
20821        Notes:
20822
20823        1) If p is null, the result is null.  Otherwise the result is a unit
20824           vector.
20825
20826        2) It is permissible to re-use the same array for any of the
20827           arguments.
20828
20829        Called:
20830           eraPm        modulus of p-vector
20831           eraZp        zero p-vector
20832           eraSxp       multiply p-vector by scalar
20833
20834        This revision:  2021 May 11
20835
20836        Copyright (C) 2013-2021, NumFOCUS Foundation.
20837        Derived, with permission, from the SOFA library.  See notes at end of file.
20838
20839    """
20840    r, u = ufunc.pn(p)
20841    return r, u
20842
20843
20844def ppp(a, b):
20845    """
20846    P-vector addition.
20847
20848    Parameters
20849    ----------
20850    a : double array
20851    b : double array
20852
20853    Returns
20854    -------
20855    apb : double array
20856
20857    Notes
20858    -----
20859    Wraps ERFA function ``eraPpp``. The ERFA documentation is::
20860
20861        - - - - - - -
20862         e r a P p p
20863        - - - - - - -
20864
20865        P-vector addition.
20866
20867        Given:
20868           a        double[3]      first p-vector
20869           b        double[3]      second p-vector
20870
20871        Returned:
20872           apb      double[3]      a + b
20873
20874        Note:
20875           It is permissible to re-use the same array for any of the
20876           arguments.
20877
20878        This revision:  2021 May 11
20879
20880        Copyright (C) 2013-2021, NumFOCUS Foundation.
20881        Derived, with permission, from the SOFA library.  See notes at end of file.
20882
20883    """
20884    apb = ufunc.ppp(a, b)
20885    return apb
20886
20887
20888def ppsp(a, s, b):
20889    """
20890    P-vector plus scaled p-vector.
20891
20892    Parameters
20893    ----------
20894    a : double array
20895    s : double array
20896    b : double array
20897
20898    Returns
20899    -------
20900    apsb : double array
20901
20902    Notes
20903    -----
20904    Wraps ERFA function ``eraPpsp``. The ERFA documentation is::
20905
20906        - - - - - - - -
20907         e r a P p s p
20908        - - - - - - - -
20909
20910        P-vector plus scaled p-vector.
20911
20912        Given:
20913           a      double[3]     first p-vector
20914           s      double        scalar (multiplier for b)
20915           b      double[3]     second p-vector
20916
20917        Returned:
20918           apsb   double[3]     a + s*b
20919
20920        Note:
20921           It is permissible for any of a, b and apsb to be the same array.
20922
20923        Called:
20924           eraSxp       multiply p-vector by scalar
20925           eraPpp       p-vector plus p-vector
20926
20927        This revision:  2021 May 11
20928
20929        Copyright (C) 2013-2021, NumFOCUS Foundation.
20930        Derived, with permission, from the SOFA library.  See notes at end of file.
20931
20932    """
20933    apsb = ufunc.ppsp(a, s, b)
20934    return apsb
20935
20936
20937def pvdpv(a, b):
20938    """
20939    Inner (=scalar=dot) product of two pv-vectors.
20940
20941    Parameters
20942    ----------
20943    a : double array
20944    b : double array
20945
20946    Returns
20947    -------
20948    adb : double array
20949
20950    Notes
20951    -----
20952    Wraps ERFA function ``eraPvdpv``. The ERFA documentation is::
20953
20954        - - - - - - - - -
20955         e r a P v d p v
20956        - - - - - - - - -
20957
20958        Inner (=scalar=dot) product of two pv-vectors.
20959
20960        Given:
20961           a        double[2][3]      first pv-vector
20962           b        double[2][3]      second pv-vector
20963
20964        Returned:
20965           adb      double[2]         a . b (see note)
20966
20967        Note:
20968
20969           If the position and velocity components of the two pv-vectors are
20970           ( ap, av ) and ( bp, bv ), the result, a . b, is the pair of
20971           numbers ( ap . bp , ap . bv + av . bp ).  The two numbers are the
20972           dot-product of the two p-vectors and its derivative.
20973
20974        Called:
20975           eraPdp       scalar product of two p-vectors
20976
20977        This revision:  2021 May 11
20978
20979        Copyright (C) 2013-2021, NumFOCUS Foundation.
20980        Derived, with permission, from the SOFA library.  See notes at end of file.
20981
20982    """
20983    adb = ufunc.pvdpv(a, b)
20984    return adb
20985
20986
20987def pvm(pv):
20988    """
20989    Modulus of pv-vector.
20990
20991    Parameters
20992    ----------
20993    pv : double array
20994
20995    Returns
20996    -------
20997    r : double array
20998    s : double array
20999
21000    Notes
21001    -----
21002    Wraps ERFA function ``eraPvm``. The ERFA documentation is::
21003
21004        - - - - - - -
21005         e r a P v m
21006        - - - - - - -
21007
21008        Modulus of pv-vector.
21009
21010        Given:
21011           pv     double[2][3]   pv-vector
21012
21013        Returned:
21014           r      double         modulus of position component
21015           s      double         modulus of velocity component
21016
21017        Called:
21018           eraPm        modulus of p-vector
21019
21020        This revision:  2021 May 11
21021
21022        Copyright (C) 2013-2021, NumFOCUS Foundation.
21023        Derived, with permission, from the SOFA library.  See notes at end of file.
21024
21025    """
21026    r, s = ufunc.pvm(pv)
21027    return r, s
21028
21029
21030def pvmpv(a, b):
21031    """
21032    Subtract one pv-vector from another.
21033
21034    Parameters
21035    ----------
21036    a : double array
21037    b : double array
21038
21039    Returns
21040    -------
21041    amb : double array
21042
21043    Notes
21044    -----
21045    Wraps ERFA function ``eraPvmpv``. The ERFA documentation is::
21046
21047        - - - - - - - - -
21048         e r a P v m p v
21049        - - - - - - - - -
21050
21051        Subtract one pv-vector from another.
21052
21053        Given:
21054           a       double[2][3]      first pv-vector
21055           b       double[2][3]      second pv-vector
21056
21057        Returned:
21058           amb     double[2][3]      a - b
21059
21060        Note:
21061           It is permissible to re-use the same array for any of the
21062           arguments.
21063
21064        Called:
21065           eraPmp       p-vector minus p-vector
21066
21067        This revision:  2021 May 11
21068
21069        Copyright (C) 2013-2021, NumFOCUS Foundation.
21070        Derived, with permission, from the SOFA library.  See notes at end of file.
21071
21072    """
21073    amb = ufunc.pvmpv(a, b)
21074    return amb
21075
21076
21077def pvppv(a, b):
21078    """
21079    Add one pv-vector to another.
21080
21081    Parameters
21082    ----------
21083    a : double array
21084    b : double array
21085
21086    Returns
21087    -------
21088    apb : double array
21089
21090    Notes
21091    -----
21092    Wraps ERFA function ``eraPvppv``. The ERFA documentation is::
21093
21094        - - - - - - - - -
21095         e r a P v p p v
21096        - - - - - - - - -
21097
21098        Add one pv-vector to another.
21099
21100        Given:
21101           a        double[2][3]      first pv-vector
21102           b        double[2][3]      second pv-vector
21103
21104        Returned:
21105           apb      double[2][3]      a + b
21106
21107        Note:
21108           It is permissible to re-use the same array for any of the
21109           arguments.
21110
21111        Called:
21112           eraPpp       p-vector plus p-vector
21113
21114        This revision:  2021 May 11
21115
21116        Copyright (C) 2013-2021, NumFOCUS Foundation.
21117        Derived, with permission, from the SOFA library.  See notes at end of file.
21118
21119    """
21120    apb = ufunc.pvppv(a, b)
21121    return apb
21122
21123
21124def pvu(dt, pv):
21125    """
21126    Update a pv-vector.
21127
21128    Parameters
21129    ----------
21130    dt : double array
21131    pv : double array
21132
21133    Returns
21134    -------
21135    upv : double array
21136
21137    Notes
21138    -----
21139    Wraps ERFA function ``eraPvu``. The ERFA documentation is::
21140
21141        - - - - - - -
21142         e r a P v u
21143        - - - - - - -
21144
21145        Update a pv-vector.
21146
21147        Given:
21148           dt       double           time interval
21149           pv       double[2][3]     pv-vector
21150
21151        Returned:
21152           upv      double[2][3]     p updated, v unchanged
21153
21154        Notes:
21155
21156        1) "Update" means "refer the position component of the vector
21157           to a new date dt time units from the existing date".
21158
21159        2) The time units of dt must match those of the velocity.
21160
21161        3) It is permissible for pv and upv to be the same array.
21162
21163        Called:
21164           eraPpsp      p-vector plus scaled p-vector
21165           eraCp        copy p-vector
21166
21167        This revision:  2021 May 11
21168
21169        Copyright (C) 2013-2021, NumFOCUS Foundation.
21170        Derived, with permission, from the SOFA library.  See notes at end of file.
21171
21172    """
21173    upv = ufunc.pvu(dt, pv)
21174    return upv
21175
21176
21177def pvup(dt, pv):
21178    """
21179    Update a pv-vector, discarding the velocity component.
21180
21181    Parameters
21182    ----------
21183    dt : double array
21184    pv : double array
21185
21186    Returns
21187    -------
21188    p : double array
21189
21190    Notes
21191    -----
21192    Wraps ERFA function ``eraPvup``. The ERFA documentation is::
21193
21194        - - - - - - - -
21195         e r a P v u p
21196        - - - - - - - -
21197
21198        Update a pv-vector, discarding the velocity component.
21199
21200        Given:
21201           dt       double            time interval
21202           pv       double[2][3]      pv-vector
21203
21204        Returned:
21205           p        double[3]         p-vector
21206
21207        Notes:
21208
21209        1) "Update" means "refer the position component of the vector to a
21210           new date dt time units from the existing date".
21211
21212        2) The time units of dt must match those of the velocity.
21213
21214        This revision:  2021 May 11
21215
21216        Copyright (C) 2013-2021, NumFOCUS Foundation.
21217        Derived, with permission, from the SOFA library.  See notes at end of file.
21218
21219    """
21220    p = ufunc.pvup(dt, pv)
21221    return p
21222
21223
21224def pvxpv(a, b):
21225    """
21226    Outer (=vector=cross) product of two pv-vectors.
21227
21228    Parameters
21229    ----------
21230    a : double array
21231    b : double array
21232
21233    Returns
21234    -------
21235    axb : double array
21236
21237    Notes
21238    -----
21239    Wraps ERFA function ``eraPvxpv``. The ERFA documentation is::
21240
21241        - - - - - - - - -
21242         e r a P v x p v
21243        - - - - - - - - -
21244
21245        Outer (=vector=cross) product of two pv-vectors.
21246
21247        Given:
21248           a        double[2][3]      first pv-vector
21249           b        double[2][3]      second pv-vector
21250
21251        Returned:
21252           axb      double[2][3]      a x b
21253
21254        Notes:
21255
21256        1) If the position and velocity components of the two pv-vectors are
21257           ( ap, av ) and ( bp, bv ), the result, a x b, is the pair of
21258           vectors ( ap x bp, ap x bv + av x bp ).  The two vectors are the
21259           cross-product of the two p-vectors and its derivative.
21260
21261        2) It is permissible to re-use the same array for any of the
21262           arguments.
21263
21264        Called:
21265           eraCpv       copy pv-vector
21266           eraPxp       vector product of two p-vectors
21267           eraPpp       p-vector plus p-vector
21268
21269        This revision:  2021 May 11
21270
21271        Copyright (C) 2013-2021, NumFOCUS Foundation.
21272        Derived, with permission, from the SOFA library.  See notes at end of file.
21273
21274    """
21275    axb = ufunc.pvxpv(a, b)
21276    return axb
21277
21278
21279def pxp(a, b):
21280    """
21281    p-vector outer (=vector=cross) product.
21282
21283    Parameters
21284    ----------
21285    a : double array
21286    b : double array
21287
21288    Returns
21289    -------
21290    axb : double array
21291
21292    Notes
21293    -----
21294    Wraps ERFA function ``eraPxp``. The ERFA documentation is::
21295
21296        - - - - - - -
21297         e r a P x p
21298        - - - - - - -
21299
21300        p-vector outer (=vector=cross) product.
21301
21302        Given:
21303           a        double[3]      first p-vector
21304           b        double[3]      second p-vector
21305
21306        Returned:
21307           axb      double[3]      a x b
21308
21309        Note:
21310           It is permissible to re-use the same array for any of the
21311           arguments.
21312
21313        This revision:  2021 May 11
21314
21315        Copyright (C) 2013-2021, NumFOCUS Foundation.
21316        Derived, with permission, from the SOFA library.  See notes at end of file.
21317
21318    """
21319    axb = ufunc.pxp(a, b)
21320    return axb
21321
21322
21323def s2xpv(s1, s2, pv):
21324    """
21325    Multiply a pv-vector by two scalars.
21326
21327    Parameters
21328    ----------
21329    s1 : double array
21330    s2 : double array
21331    pv : double array
21332
21333    Returns
21334    -------
21335    spv : double array
21336
21337    Notes
21338    -----
21339    Wraps ERFA function ``eraS2xpv``. The ERFA documentation is::
21340
21341        - - - - - - - - -
21342         e r a S 2 x p v
21343        - - - - - - - - -
21344
21345        Multiply a pv-vector by two scalars.
21346
21347        Given:
21348           s1     double         scalar to multiply position component by
21349           s2     double         scalar to multiply velocity component by
21350           pv     double[2][3]   pv-vector
21351
21352        Returned:
21353           spv    double[2][3]   pv-vector: p scaled by s1, v scaled by s2
21354
21355        Note:
21356           It is permissible for pv and spv to be the same array.
21357
21358        Called:
21359           eraSxp       multiply p-vector by scalar
21360
21361        This revision:  2021 May 11
21362
21363        Copyright (C) 2013-2021, NumFOCUS Foundation.
21364        Derived, with permission, from the SOFA library.  See notes at end of file.
21365
21366    """
21367    spv = ufunc.s2xpv(s1, s2, pv)
21368    return spv
21369
21370
21371def sxp(s, p):
21372    """
21373    Multiply a p-vector by a scalar.
21374
21375    Parameters
21376    ----------
21377    s : double array
21378    p : double array
21379
21380    Returns
21381    -------
21382    sp : double array
21383
21384    Notes
21385    -----
21386    Wraps ERFA function ``eraSxp``. The ERFA documentation is::
21387
21388        - - - - - - -
21389         e r a S x p
21390        - - - - - - -
21391
21392        Multiply a p-vector by a scalar.
21393
21394        Given:
21395           s      double        scalar
21396           p      double[3]     p-vector
21397
21398        Returned:
21399           sp     double[3]     s * p
21400
21401        Note:
21402           It is permissible for p and sp to be the same array.
21403
21404        This revision:  2021 May 11
21405
21406        Copyright (C) 2013-2021, NumFOCUS Foundation.
21407        Derived, with permission, from the SOFA library.  See notes at end of file.
21408
21409    """
21410    sp = ufunc.sxp(s, p)
21411    return sp
21412
21413
21414def sxpv(s, pv):
21415    """
21416    Multiply a pv-vector by a scalar.
21417
21418    Parameters
21419    ----------
21420    s : double array
21421    pv : double array
21422
21423    Returns
21424    -------
21425    spv : double array
21426
21427    Notes
21428    -----
21429    Wraps ERFA function ``eraSxpv``. The ERFA documentation is::
21430
21431        - - - - - - - -
21432         e r a S x p v
21433        - - - - - - - -
21434
21435        Multiply a pv-vector by a scalar.
21436
21437        Given:
21438           s       double          scalar
21439           pv      double[2][3]    pv-vector
21440
21441        Returned:
21442           spv     double[2][3]    s * pv
21443
21444        Note:
21445           It is permissible for pv and spv to be the same array.
21446
21447        Called:
21448           eraS2xpv     multiply pv-vector by two scalars
21449
21450        This revision:  2021 May 11
21451
21452        Copyright (C) 2013-2021, NumFOCUS Foundation.
21453        Derived, with permission, from the SOFA library.  See notes at end of file.
21454
21455    """
21456    spv = ufunc.sxpv(s, pv)
21457    return spv
21458