-
Notifications
You must be signed in to change notification settings - Fork 4
/
NOVAS_novas.h
551 lines (379 loc) · 16.3 KB
/
NOVAS_novas.h
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
/*
Naval Observatory Vector Astrometry Software (NOVAS)
C Edition, Version 3.1
novas.h: Header file for novas.c
U. S. Naval Observatory
Astronomical Applications Dept.
Washington, DC
http://www.usno.navy.mil/USNO/astronomical-applications
*/
#ifndef _NOVAS_
#define _NOVAS_
#ifndef __STDIO__
#include <stdio.h>
#endif
#ifndef __MATH__
#include <math.h>
#endif
#ifndef __STRING__
#include <string.h>
#endif
#ifndef __STDLIB__
#include <stdlib.h>
#endif
#ifndef __CTYPE__
#include <ctype.h>
#endif
#ifndef _CONSTS_
#include "NOVAS_novascon.h"
#endif
#ifndef _SOLSYS_
#include "NOVAS_solarsystem.h"
#endif
#ifndef _NUTATION_
#include "NOVAS_nutation.h"
#endif
/*
Structures
*/
/*
struct cat_entry: basic astrometric data for any celestial object
located outside the solar system; the catalog
data for a star
starname[SIZE_OF_OBJ_NAME] = name of celestial object
catalog[SIZE_OF_CAT_NAME] = catalog designator (e.g., HIP)
starnumber = integer identifier assigned to object
ra = ICRS right ascension (hours)
dec = ICRS declination (degrees)
promora = ICRS proper motion in right ascension
(milliarcseconds/year)
promodec = ICRS proper motion in declination
(milliarcseconds/year)
parallax = parallax (milliarcseconds)
radialvelocity = radial velocity (km/s)
SIZE_OF_OBJ_NAME and SIZE_OF_CAT_NAME are defined below. Each is the
number of characters in the string (the string length) plus the null
terminator.
*/
#define SIZE_OF_OBJ_NAME 51
#define SIZE_OF_CAT_NAME 4
typedef struct
{
char starname[SIZE_OF_OBJ_NAME];
char catalog[SIZE_OF_CAT_NAME];
long int starnumber;
double ra;
double dec;
double promora;
double promodec;
double parallax;
double radialvelocity;
} cat_entry;
/*
struct object: specifies the celestial object of interest
type = type of object
= 0 ... major planet, Pluto, Sun, or Moon
= 1 ... minor planet
= 2 ... object located outside the solar system
(star, nebula, galaxy, etc.)
number = object number
For 'type' = 0: Mercury = 1, ..., Pluto = 9,
Sun = 10, Moon = 11
For 'type' = 1: minor planet number
For 'type' = 2: set to 0 (object is
fully specified in 'struct cat_entry')
name = name of the object (limited to
(SIZE_OF_OBJ_NAME - 1) characters)
star = basic astrometric data for any celestial object
located outside the solar system; the catalog
data for a star
*/
typedef struct
{
short int type;
short int number;
char name[SIZE_OF_OBJ_NAME];
cat_entry star;
} object;
/*
struct on_surface: data for an observer's location on the surface of
the Earth. The atmospheric parameters are used
only by the refraction function called from
function 'equ2hor'. Additional parameters can be
added to this structure if a more sophisticated
refraction model is employed.
latitude = geodetic (ITRS) latitude; north positive (degrees)
longitude = geodetic (ITRS) longitude; east positive (degrees)
height = height of the observer (meters)
temperature = temperature (degrees Celsius)
pressure = atmospheric pressure (millibars)
*/
typedef struct
{
double latitude;
double longitude;
double height;
double temperature;
double pressure;
} on_surface;
/*
struct in_space: data for an observer's location on a near-Earth
spacecraft
sc_pos[3] = geocentric position vector (x, y, z), components
in km
sc_vel[3] = geocentric velocity vector (x_dot, y_dot,
z_dot), components in km/s
Both vectors with respect to true equator and
equinox of date
*/
typedef struct
{
double sc_pos[3];
double sc_vel[3];
} in_space;
/*
struct observer: data specifying the location of the observer
where = integer code specifying location of observer
= 0: observer at geocenter
= 1: observer on surface of earth
= 2: observer on near-earth spacecraft
on_surface = structure containing data for an observer's
location on the surface of the Earth (where = 1)
near_earth = data for an observer's location on a near-Earth
spacecraft (where = 2)
*/
typedef struct
{
short int where;
on_surface on_surf;
in_space near_earth;
} observer;
/*
struct sky_pos: data specifying a celestial object's place on the
sky; contains the output from function 'place'
r_hat[3] = unit vector toward object (dimensionless)
ra = apparent, topocentric, or astrometric
right ascension (hours)
dec = apparent, topocentric, or astrometric
declination (degrees)
dis = true (geometric, Euclidian) distance to solar
system body or 0.0 for star (AU)
rv = radial velocity (km/s)
*/
typedef struct
{
double r_hat[3];
double ra;
double dec;
double dis;
double rv;
} sky_pos;
/*
struct ra_of_cio: right ascension of the Celestial Intermediate
Origin (CIO) with respect to the GCRS
jd_tdb = TDB Julian date
ra_cio = right ascension of the CIO with respect
to the GCRS (arcseconds)
*/
typedef struct
{
double jd_tdb;
double ra_cio;
} ra_of_cio;
/*
Define "origin" constants.
*/
#define BARYC 0
#define HELIOC 1
/*
Function prototypes
*/
double *readeph (int mp, char *name, double jd,
int *err);
short int app_star (double jd_tt, cat_entry *star,
short int accuracy,
double *ra, double *dec);
short int virtual_star (double jd_tt, cat_entry *star,
short int accuracy,
double *ra, double *dec);
short int astro_star (double jd_tt, cat_entry *star,
short int accuracy,
double *ra, double *dec);
short int app_planet (double jd_tt, object *ss_body,
short int accuracy,
double *ra, double *dec, double *dis);
short int virtual_planet (double jd_tt, object *ss_body,
short int accuracy,
double *ra, double *dec, double *dis);
short int astro_planet (double jd_tt, object *ss_body,
short int accuracy,
double *ra, double *dec, double *dis);
short int topo_star (double jd_tt, double delta_t, cat_entry *star,
on_surface *position, short int accuracy,
double *ra, double *dec);
short int local_star (double jd_tt, double delta_t, cat_entry *star,
on_surface *position, short int accuracy,
double *ra, double *dec);
short int topo_planet (double jd_tt, object *ss_body, double delta_t,
on_surface *position, short int accuracy,
double *ra, double *dec, double *dis);
short int local_planet (double jd_tt, object *ss_body,
double delta_t, on_surface *position,
short int accuracy,
double *ra, double *dec, double *dis);
short int mean_star (double jd_tt, double ra, double dec,
short int accuracy,
double *ira, double *idec);
short int place (double jd_tt, object *cel_object,
observer *location, double delta_t,
short int coord_sys, short int accuracy,
sky_pos *output);
void equ2gal (double rai, double deci,
double *glon, double *glat);
short int equ2ecl (double jd_tt, short int coord_sys,
short int accuracy, double ra, double dec,
double *elon, double *elat);
short int equ2ecl_vec (double jd_tt, short int coord_sys,
short int accuracy, double *pos1,
double *pos2);
short int ecl2equ_vec (double jd_tt, short int coord_sys,
short int accuracy, double *pos1,
double *pos2);
void equ2hor (double jd_ut1, double delta_t, short int accuracy,
double xp, double yp, on_surface *location, double ra,
double dec, short int ref_option,
double *zd, double *az, double *rar, double *decr);
short int gcrs2equ (double jd_tt, short int coord_sys,
short int accuracy, double rag, double decg,
double *ra, double *dec);
short int sidereal_time (double jd_high, double jd_low,
double delta_t, short int gst_type,
short int method, short int accuracy,
double *gst);
double era (double jd_high, double jd_low);
short int ter2cel (double jd_ut_high, double jd_ut_low,
double delta_t, short int method,
short int accuracy, short int option, double xp,
double yp, double *vec1,
double *vec2);
short int cel2ter (double jd_ut_high, double jd_ut_low,
double delta_t, short int method,
short int accuracy, short int option,
double xp, double yp, double *vec1,
double *vec2);
void spin (double angle, double *pos1,
double *pos2);
void wobble (double tjd, short int direction, double xp, double yp,
double *pos1,
double *pos2);
void terra (on_surface *location, double st,
double *pos, double *vel);
void e_tilt (double jd_tdb, short int accuracy,
double *mobl, double *tobl, double *ee, double *dpsi,
double *deps);
short int cel_pole (double tjd, short int type, double dpole1,
double dpole2);
double ee_ct (double jd_high, double jd_low, short int accuracy);
void frame_tie (double *pos1, short int direction,
double *pos2);
void proper_motion (double jd_tdb1, double *pos, double *vel,
double jd_tdb2,
double *pos2);
void bary2obs (double *pos, double *pos_obs,
double *pos2, double *lighttime);
short int geo_posvel (double jd_tt, double delta_t,
short int accuracy, observer *obs,
double *pos, double *vel);
short int light_time (double jd_tdb, object *ss_object,
double pos_obs[3], double tlight0,
short int accuracy,
double pos[3], double *tlight);
double d_light (double *pos1, double *pos_obs);
short int grav_def (double jd_tdb, short int loc_code,
short int accuracy, double *pos1, double *pos_obs,
double *pos2);
void grav_vec (double *pos1, double *pos_obs, double *pos_body,
double rmass,
double *pos2);
void aberration (double *pos, double *ve, double lighttime,
double *pos2);
void rad_vel (object *cel_object, double *pos, double *vel,
double *vel_obs, double d_obs_geo, double d_obs_sun,
double d_obj_sun,
double *rv);
short int precession (double jd_tdb1, double *pos1, double jd_tdb2,
double *pos2);
void nutation (double jd_tdb, short int direction, short int accuracy,
double *pos,
double *pos2);
void nutation_angles (double t, short int accuracy,
double *dpsi, double *deps);
void fund_args (double t,
double a[5]);
double mean_obliq (double jd_tdb);
short int vector2radec (double *pos,
double *ra, double *dec);
void radec2vector (double ra, double dec, double dist,
double *vector);
void starvectors (cat_entry *star,
double *pos, double *vel);
void tdb2tt (double tdb_jd,
double *tt_jd, double *secdiff);
short int cio_ra (double jd_tt, short int accuracy,
double *ra_cio);
short int cio_location (double jd_tdb, short int accuracy,
double *ra_cio, short int *ref_sys);
short int cio_basis (double jd_tdb, double ra_cio, short int ref_sys,
short int accuracy,
double *x, double *y, double *z);
short int cio_array (double jd_tdb, long int n_pts,
ra_of_cio *cio);
double ira_equinox (double jd_tdb, short int equinox,
short int accuracy);
short int ephemeris (double jd[2], object *cel_obj, short int origin,
short int accuracy,
double *pos, double *vel);
void transform_hip (cat_entry *hipparcos,
cat_entry *hip_2000);
short int transform_cat (short int option, double date_incat,
cat_entry *incat, double date_newcat,
char newcat_id[SIZE_OF_CAT_NAME],
cat_entry *newcat);
void limb_angle (double pos_obj[3], double pos_obs[3],
double *limb_ang, double *nadir_ang);
double refract (on_surface *location, short int ref_option,
double zd_obs);
double julian_date (short int year, short int month, short int day,
double hour);
void cal_date (double tjd,
short int *year, short int *month, short int *day,
double *hour);
double norm_ang (double angle);
short int make_cat_entry (char star_name[SIZE_OF_OBJ_NAME],
char catalog[SIZE_OF_CAT_NAME],
long int star_num, double ra, double dec,
double pm_ra, double pm_dec, double parallax,
double rad_vel,
cat_entry *star);
short int make_object (short int type, short int number,
char name[SIZE_OF_OBJ_NAME],
cat_entry *star_data,
object *cel_obj);
short int make_observer (short int where, on_surface *obs_surface,
in_space *obs_space,
observer *obs);
void make_observer_at_geocenter (
observer *obs_at_geocenter);
void make_observer_on_surface (double latitude, double longitude,
double height, double temperature,
double pressure,
observer *obs_on_surface);
void make_observer_in_space (double sc_pos[3], double sc_vel[3],
observer *obs_in_space);
void make_on_surface (double latitude, double longitude,
double height,
double temperature, double pressure,
on_surface *obs_surface);
void make_in_space (double sc_pos[3], double sc_vel[3],
in_space *obs_space);
#endif