Skip to content

Commit a5a74f4

Browse files
committedNov 18, 2014
Add palEcleq
1 parent 6cba483 commit a5a74f4

File tree

4 files changed

+151
-0
lines changed

4 files changed

+151
-0
lines changed
 

‎Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ palDt.c \
5858
palDtp2s.c \
5959
palDtps2c.c \
6060
palDtt.c \
61+
palEcleq.c \
6162
palEcmat.c \
6263
palEl2ue.c \
6364
palEpco.c \

‎palEcleq.c

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
*+
3+
* Name:
4+
* palEcleq
5+
6+
* Purpose:
7+
* Transform from ecliptic coordinates to J2000.0 equatorial coordinates
8+
9+
* Language:
10+
* Starlink ANSI C
11+
12+
* Type of Module:
13+
* Library routine
14+
15+
* Invocation:
16+
* void palEcleq ( double dl, double db, double date,
17+
* double *dr, double *dd );
18+
19+
* Arguments:
20+
* dl = double (Given)
21+
* Ecliptic longitude (mean of date, IAU 1980 theory, radians)
22+
* db = double (Given)
23+
* Ecliptic latitude (mean of date, IAU 1980 theory, radians)
24+
* date = double (Given)
25+
* TT as Modified Julian Date (JD-2400000.5). The difference
26+
* between TT and TDB is of the order of a millisecond or two
27+
* (i.e. about 0.02 arc-seconds).
28+
* dr = double * (Returned)
29+
* J2000.0 mean RA (radians)
30+
* dd = double * (Returned)
31+
* J2000.0 mean Dec (Radians)
32+
33+
* Description:
34+
* Transform from ecliptic coordinate to J2000.0 equatorial coordinates.
35+
36+
* Authors:
37+
* PTW: Patrick T. Wallace
38+
* TIMJ: Tim Jenness (Cornell University)
39+
* {enter_new_authors_here}
40+
41+
* History:
42+
* 2014-11-18 (TIMJ):
43+
* Initial version
44+
* Adapted with permission from the Fortran SLALIB library.
45+
* {enter_further_changes_here}
46+
47+
* Copyright:
48+
* Copyright (C) 1995 Rutherford Appleton Laboratory
49+
* Copyright (C) 2014 Cornell University
50+
* All Rights Reserved.
51+
52+
* Licence:
53+
* This program is free software; you can redistribute it and/or
54+
* modify it under the terms of the GNU General Public License as
55+
* published by the Free Software Foundation; either version 3 of
56+
* the License, or (at your option) any later version.
57+
*
58+
* This program is distributed in the hope that it will be
59+
* useful, but WITHOUT ANY WARRANTY; without even the implied
60+
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
61+
* PURPOSE. See the GNU General Public License for more details.
62+
*
63+
* You should have received a copy of the GNU General Public License
64+
* along with this program; if not, write to the Free Software
65+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
66+
* MA 02110-1301, USA.
67+
68+
* Bugs:
69+
* {note_any_bugs_here}
70+
*-
71+
*/
72+
73+
#include "pal.h"
74+
#include "pal1sofa.h"
75+
76+
void palEcleq ( double dl, double db, double date, double *dr, double *dd ) {
77+
double v1[3], v2[3];
78+
double rmat[3][3];
79+
80+
/* Spherical to Cartesian */
81+
eraS2c( dl, db, v1 );
82+
83+
/* Ecliptic to equatorial */
84+
palEcmat( date, rmat );
85+
eraTrxp( rmat, v1, v2 );
86+
87+
/* Mean of date to J2000 */
88+
palPrec( 2000.0, palEpj(date), rmat );
89+
eraTrxp( rmat, v2, v1 );
90+
91+
/* Cartesian to spherical */
92+
eraC2s( v1, dr, dd );
93+
94+
/* Express in conventional range */
95+
*dr = eraAnp( *dr );
96+
*dd = palDrange( *dd );
97+
}

‎palTest.c

+11
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,16 @@ static void t_vecmat( int * status ) {
11091109

11101110
}
11111111

1112+
static void t_ecleq( int *status ) {
1113+
double dr;
1114+
double dd;
1115+
palEcleq( 1.234, -0.123, 43210.0, &dr, &dd );
1116+
vvd( dr, 1.229910118208851, 1e-5, "palEcleq",
1117+
"RA", status );
1118+
vvd( dd, 0.2638461400411088, 1e-5, "palEcleq",
1119+
"Dec", status );
1120+
}
1121+
11121122
static void t_ecmat( int *status ) {
11131123
double rmat[3][3];
11141124
double expected[3][3] = {
@@ -1975,6 +1985,7 @@ int main (void) {
19751985
t_intin(&status);
19761986
t_prec(&status);
19771987
t_preces(&status);
1988+
t_ecleq(&status);
19781989
t_ecmat(&status);
19791990
t_e2h(&status);
19801991
t_map(&status);

‎sun267.tex

+42
Original file line numberDiff line numberDiff line change
@@ -4054,6 +4054,48 @@ \subsection{More complex functions}
40544054
}
40554055
}
40564056
}
4057+
\sstroutine{
4058+
palEcleq
4059+
}{
4060+
Transform from ecliptic coordinates to J2000.0 equatorial coordinates
4061+
}{
4062+
\sstdescription{
4063+
Transform from ecliptic coordinate to J2000.0 equatorial coordinates.
4064+
}
4065+
\sstinvocation{
4066+
void palEcleq ( double dl, double db, double date,
4067+
double $*$dr, double $*$dd );
4068+
}
4069+
\sstarguments{
4070+
\sstsubsection{
4071+
dl = double (Given)
4072+
}{
4073+
Ecliptic longitude (mean of date, IAU 1980 theory, radians)
4074+
}
4075+
\sstsubsection{
4076+
db = double (Given)
4077+
}{
4078+
Ecliptic latitude (mean of date, IAU 1980 theory, radians)
4079+
}
4080+
\sstsubsection{
4081+
date = double (Given)
4082+
}{
4083+
TT as Modified Julian Date (JD-2400000.5). The difference
4084+
between TT and TDB is of the order of a millisecond or two
4085+
(i.e. about 0.02 arc-seconds).
4086+
}
4087+
\sstsubsection{
4088+
dr = double $*$ (Returned)
4089+
}{
4090+
J2000.0 mean RA (radians)
4091+
}
4092+
\sstsubsection{
4093+
dd = double $*$ (Returned)
4094+
}{
4095+
J2000.0 mean Dec (Radians)
4096+
}
4097+
}
4098+
}
40574099
\sstroutine{
40584100
palEcmat
40594101
}{

0 commit comments

Comments
 (0)