-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheckout-mp.c
168 lines (137 loc) · 3.71 KB
/
checkout-mp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
Naval Observatory Vector Astrometry Software (NOVAS)
C Edition, Version 3.1
checkout-mp.c: Checkout program for use with minor planet ephemerides
U. S. Naval Observatory
Astronomical Applications Dept.
Washington, DC
http://www.usno.navy.mil/USNO/astronomical-applications
*/
#include <stdio.h>
#include <stdlib.h>
#include "eph_manager.h"
#include "novas.h"
#define N_TIMES 4
int main (void)
{
/*
Main function to check out many parts of NOVAS-C by computing the
places of a minor planet and the Moon. The USNO/AE98 minor planet
ephemerides and DE405 are used along with version 1 of function
'solarsystem'.
For use with NOVAS-C Version 3.1.
*/
short int error = 0;
short int accuracy = 0;
short int i, de_num;
/*
'deltat' is the difference in time scales, TT - UT1.
The array 'tjd' contains four selected Julian dates at which the
minor planet positions will be evaluated.
*/
double deltat = 60.0;
double tjd_tt[N_TIMES] = {2450203.5, 2450203.5, 2450417.5,
2450300.5};
double jd_beg, jd_end, ra, dec, dis;
on_surface geo_loc;
cat_entry dummy_star;
object pallas, moon;
/*
The observer's terrestrial coordinates (latitude, longitude, height).
*/
make_on_surface (45.0, -75.0, 0.0, 10.0, 1010.0, &geo_loc);
/*
Set up the structure containing the body designation for Pallas.
First, create a dummy star-catalog entry.
*/
make_cat_entry ("dummy"," ",0,0.0,0.0,0.0,0.0,0.0,0.0,
&dummy_star);
if ((error = make_object (1,2,"Pallas",&dummy_star, &pallas)))
{
printf ("Error %d from set_body.\n", error);
exit (1);
}
/*
Open the JPL ephemeris file.
*/
if ((error = ephem_open ("JPLEPH", &jd_beg,&jd_end,&de_num)) != 0)
{
printf ("Error %d from ephem_open\n", error);
return (error);
}
else
{
printf ("JPL Ephemeris DE%d open. jd_beg = %10.2f jd_end = %10.2f\n",
de_num, jd_beg, jd_end);
printf ("\n");
}
/*
Compute the apparent place of Pallas at the four selected Julian
dates.
*/
printf ("\nPallas:\n\n");
printf ("Apparent Places:\n");
for (i = 0; i < N_TIMES; i++)
{
if ((error = app_planet (tjd_tt[i],&pallas,accuracy,
&ra,&dec,&dis)) != 0)
{
printf ("Error %d from app_planet.\n", error);
exit (1);
}
else
{
printf ("JD = %f RA = %12.9f Dec = %12.8f Dis = %12.10f\n",
tjd_tt[i], ra, dec, dis);
}
}
/*
Compute the topocentric place of Pallas at the four selected Julian
dates.
*/
printf ("\nTopocentric Places:\n");
for (i = 0; i < N_TIMES; i++)
{
if ((error = topo_planet (tjd_tt[i],&pallas,deltat,&geo_loc,
accuracy, &ra,&dec,&dis)) != 0)
{
printf ("Error %d from topo_planet.\n", error);
return (error);
}
else
{
printf ("JD = %f RA = %12.9f Dec = %12.8f Dis = %12.10f\n",
tjd_tt[i], ra, dec, dis);
}
}
/*
Make an 'object' structure for the Moon.
*/
if ((error = make_object (0,11,"Moon",&dummy_star, &moon)) != 0)
{
printf ("Error %d from make_object\n", error);
return (error);
}
/*
Compute the topocentric place of the Moon at the four selected Julian
dates.
*/
printf ("\nMoon:\n\n");
printf ("Apparent Places:\n");
for (i = 0; i < N_TIMES; i++)
{
if ((error = app_planet (tjd_tt[i],&moon,accuracy,
&ra,&dec,&dis)) != 0)
{
printf ("Error %d from app_planet. Time %d\n", error, i);
return (error);
}
else
{
printf ("JD = %f RA = %12.9f Dec = %12.8f Dis = %12.10f\n",
tjd_tt[i], ra, dec, dis);
}
}
ephem_close ();
return (0);
}