erfa.h | erfa.h | |||
---|---|---|---|---|
#ifndef ERFAHDEF | #ifndef ERFAHDEF | |||
#define ERFAHDEF | #define ERFAHDEF | |||
/* | /* | |||
** - - - - - - - | ** - - - - - - - | |||
** e r f a . h | ** e r f a . h | |||
** - - - - - - - | ** - - - - - - - | |||
** | ** | |||
** Prototype function declarations for ERFA library. | ** Prototype function declarations for ERFA library. | |||
** | ** | |||
** Copyright (C) 2013, NumFOCUS Foundation. | ** Copyright (C) 2013-2014, NumFOCUS Foundation. | |||
** Derived, with permission, from the SOFA library. See notes at end of f ile. | ** Derived, with permission, from the SOFA library. See notes at end of f ile. | |||
*/ | */ | |||
#include "erfam.h" | ||||
#include "math.h" | #include "math.h" | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* Astronomy/Calendars */ | /* Astronomy/Calendars */ | |||
int eraCal2jd(int iy, int im, int id, double *djm0, double *djm); | int eraCal2jd(int iy, int im, int id, double *djm0, double *djm); | |||
double eraEpb(double dj1, double dj2); | double eraEpb(double dj1, double dj2); | |||
void eraEpb2jd(double epb, double *djm0, double *djm); | void eraEpb2jd(double epb, double *djm0, double *djm); | |||
double eraEpj(double dj1, double dj2); | double eraEpj(double dj1, double dj2); | |||
void eraEpj2jd(double epj, double *djm0, double *djm); | void eraEpj2jd(double epj, double *djm0, double *djm); | |||
int eraJd2cal(double dj1, double dj2, | int eraJd2cal(double dj1, double dj2, | |||
int *iy, int *im, int *id, double *fd); | int *iy, int *im, int *id, double *fd); | |||
int eraJdcalf(int ndp, double dj1, double dj2, int iymdf[4]); | int eraJdcalf(int ndp, double dj1, double dj2, int iymdf[4]); | |||
/* Astronomy/Astrometry */ | ||||
void eraAb(double pnat[3], double v[3], double s, double bm1, | ||||
double ppr[3]); | ||||
void eraApcg(double date1, double date2, | ||||
double ebpv[2][3], double ehp[3], | ||||
eraASTROM *astrom); | ||||
void eraApcg13(double date1, double date2, eraASTROM *astrom); | ||||
void eraApci(double date1, double date2, | ||||
double ebpv[2][3], double ehp[3], | ||||
double x, double y, double s, | ||||
eraASTROM *astrom); | ||||
void eraApci13(double date1, double date2, | ||||
eraASTROM *astrom, double *eo); | ||||
void eraApco(double date1, double date2, | ||||
double ebpv[2][3], double ehp[3], | ||||
double x, double y, double s, double theta, | ||||
double elong, double phi, double hm, | ||||
double xp, double yp, double sp, | ||||
double refa, double refb, | ||||
eraASTROM *astrom); | ||||
int eraApco13(double utc1, double utc2, double dut1, | ||||
double elong, double phi, double hm, double xp, double yp, | ||||
double phpa, double tk, double rh, double wl, | ||||
eraASTROM *astrom, double *eo); | ||||
void eraApcs(double date1, double date2, double pv[2][3], | ||||
double ebpv[2][3], double ehp[3], | ||||
eraASTROM *astrom); | ||||
void eraApcs13(double date1, double date2, double pv[2][3], | ||||
eraASTROM *astrom); | ||||
void eraAper(double theta, eraASTROM *astrom); | ||||
void eraAper13(double ut11, double ut12, eraASTROM *astrom); | ||||
void eraApio(double sp, double theta, | ||||
double elong, double phi, double hm, double xp, double yp, | ||||
double refa, double refb, | ||||
eraASTROM *astrom); | ||||
int eraApio13(double utc1, double utc2, double dut1, | ||||
double elong, double phi, double hm, double xp, double yp, | ||||
double phpa, double tk, double rh, double wl, | ||||
eraASTROM *astrom); | ||||
void eraAtci13(double rc, double dc, | ||||
double pr, double pd, double px, double rv, | ||||
double date1, double date2, | ||||
double *ri, double *di, double *eo); | ||||
void eraAtciq(double rc, double dc, double pr, double pd, | ||||
double px, double rv, eraASTROM *astrom, | ||||
double *ri, double *di); | ||||
void eraAtciqn(double rc, double dc, double pr, double pd, | ||||
double px, double rv, eraASTROM *astrom, | ||||
int n, eraLDBODY b[], double *ri, double *di); | ||||
void eraAtciqz(double rc, double dc, eraASTROM *astrom, | ||||
double *ri, double *di); | ||||
int eraAtco13(double rc, double dc, | ||||
double pr, double pd, double px, double rv, | ||||
double utc1, double utc2, double dut1, | ||||
double elong, double phi, double hm, double xp, double yp, | ||||
double phpa, double tk, double rh, double wl, | ||||
double *aob, double *zob, double *hob, | ||||
double *dob, double *rob, double *eo); | ||||
void eraAtic13(double ri, double di, | ||||
double date1, double date2, | ||||
double *rc, double *dc, double *eo); | ||||
void eraAticq(double ri, double di, eraASTROM *astrom, | ||||
double *rc, double *dc); | ||||
void eraAticqn(double ri, double di, eraASTROM *astrom, | ||||
int n, eraLDBODY b[], double *rc, double *dc); | ||||
int eraAtio13(double ri, double di, | ||||
double utc1, double utc2, double dut1, | ||||
double elong, double phi, double hm, double xp, double yp, | ||||
double phpa, double tk, double rh, double wl, | ||||
double *aob, double *zob, double *hob, | ||||
double *dob, double *rob); | ||||
void eraAtioq(double ri, double di, eraASTROM *astrom, | ||||
double *aob, double *zob, | ||||
double *hob, double *dob, double *rob); | ||||
int eraAtoc13(const char *type, double ob1, double ob2, | ||||
double utc1, double utc2, double dut1, | ||||
double elong, double phi, double hm, double xp, double yp, | ||||
double phpa, double tk, double rh, double wl, | ||||
double *rc, double *dc); | ||||
int eraAtoi13(const char *type, double ob1, double ob2, | ||||
double utc1, double utc2, double dut1, | ||||
double elong, double phi, double hm, double xp, double yp, | ||||
double phpa, double tk, double rh, double wl, | ||||
double *ri, double *di); | ||||
void eraAtoiq(const char *type, | ||||
double ob1, double ob2, eraASTROM *astrom, | ||||
double *ri, double *di); | ||||
void eraLd(double bm, double p[3], double q[3], double e[3], | ||||
double em, double dlim, double p1[3]); | ||||
void eraLdn(int n, eraLDBODY b[], double ob[3], double sc[3], | ||||
double sn[3]); | ||||
void eraLdsun(double p[3], double e[3], double em, double p1[3]); | ||||
void eraPmpx(double rc, double dc, double pr, double pd, | ||||
double px, double rv, double pmt, double vob[3], | ||||
double pco[3]); | ||||
int eraPmsafe(double ra1, double dec1, double pmr1, double pmd1, | ||||
double px1, double rv1, | ||||
double ep1a, double ep1b, double ep2a, double ep2b, | ||||
double *ra2, double *dec2, double *pmr2, double *pmd2, | ||||
double *px2, double *rv2); | ||||
void eraPvtob(double elong, double phi, double hm, | ||||
double xp, double yp, double sp, double theta, | ||||
double pv[2][3]); | ||||
void eraRefco(double phpa, double tk, double rh, double wl, | ||||
double *refa, double *refb); | ||||
/* Astronomy/Ephemerides */ | /* Astronomy/Ephemerides */ | |||
int eraEpv00(double date1, double date2, | int eraEpv00(double date1, double date2, | |||
double pvh[2][3], double pvb[2][3]); | double pvh[2][3], double pvb[2][3]); | |||
int eraPlan94(double date1, double date2, int np, double pv[2][3]); | int eraPlan94(double date1, double date2, int np, double pv[2][3]); | |||
/* Astronomy/FundamentalArgs */ | /* Astronomy/FundamentalArgs */ | |||
double eraFad03(double t); | double eraFad03(double t); | |||
double eraFae03(double t); | double eraFae03(double t); | |||
double eraFaf03(double t); | double eraFaf03(double t); | |||
double eraFaju03(double t); | double eraFaju03(double t); | |||
skipping to change at line 174 | skipping to change at line 281 | |||
double eraGmst06(double uta, double utb, double tta, double ttb); | double eraGmst06(double uta, double utb, double tta, double ttb); | |||
double eraGmst82(double dj1, double dj2); | double eraGmst82(double dj1, double dj2); | |||
double eraGst00a(double uta, double utb, double tta, double ttb); | double eraGst00a(double uta, double utb, double tta, double ttb); | |||
double eraGst00b(double uta, double utb); | double eraGst00b(double uta, double utb); | |||
double eraGst06(double uta, double utb, double tta, double ttb, | double eraGst06(double uta, double utb, double tta, double ttb, | |||
double rnpb[3][3]); | double rnpb[3][3]); | |||
double eraGst06a(double uta, double utb, double tta, double ttb); | double eraGst06a(double uta, double utb, double tta, double ttb); | |||
double eraGst94(double uta, double utb); | double eraGst94(double uta, double utb); | |||
/* Astronomy/SpaceMotion */ | /* Astronomy/SpaceMotion */ | |||
int eraPmsafe(double ra1, double dec1, double pmr1, double pmd1, | ||||
double px1, double rv1, double ep1a, double ep1b, | ||||
double ep2a, double ep2b, double *ra2, double *dec2, | ||||
double *pmr2, double *pmd2, double *px2, double *rv2); | ||||
int eraPvstar(double pv[2][3], double *ra, double *dec, | int eraPvstar(double pv[2][3], double *ra, double *dec, | |||
double *pmr, double *pmd, double *px, double *rv); | double *pmr, double *pmd, double *px, double *rv); | |||
int eraStarpv(double ra, double dec, | int eraStarpv(double ra, double dec, | |||
double pmr, double pmd, double px, double rv, | double pmr, double pmd, double px, double rv, | |||
double pv[2][3]); | double pv[2][3]); | |||
/* Astronomy/StarCatalogs */ | /* Astronomy/StarCatalogs */ | |||
void eraFk52h(double r5, double d5, | void eraFk52h(double r5, double d5, | |||
double dr5, double dd5, double px5, double rv5, | double dr5, double dd5, double px5, double rv5, | |||
double *rh, double *dh, | double *rh, double *dh, | |||
skipping to change at line 200 | skipping to change at line 311 | |||
double *r5, double *d5, | double *r5, double *d5, | |||
double *dr5, double *dd5, double *px5, double *rv5); | double *dr5, double *dd5, double *px5, double *rv5); | |||
void eraHfk5z(double rh, double dh, double date1, double date2, | void eraHfk5z(double rh, double dh, double date1, double date2, | |||
double *r5, double *d5, double *dr5, double *dd5); | double *r5, double *d5, double *dr5, double *dd5); | |||
int eraStarpm(double ra1, double dec1, | int eraStarpm(double ra1, double dec1, | |||
double pmr1, double pmd1, double px1, double rv1, | double pmr1, double pmd1, double px1, double rv1, | |||
double ep1a, double ep1b, double ep2a, double ep2b, | double ep1a, double ep1b, double ep2a, double ep2b, | |||
double *ra2, double *dec2, | double *ra2, double *dec2, | |||
double *pmr2, double *pmd2, double *px2, double *rv2); | double *pmr2, double *pmd2, double *px2, double *rv2); | |||
/* Astronomy/Geodetic/Geocentric */ | /* Astronomy/GeodeticGeocentric */ | |||
int eraEform(int n, double *a, double *f); | int eraEform(int n, double *a, double *f); | |||
int eraGc2gd(int n, double xyz[3], | int eraGc2gd(int n, double xyz[3], | |||
double *elong, double *phi, double *height); | double *elong, double *phi, double *height); | |||
int eraGc2gde(double a, double f, double xyz[3], | int eraGc2gde(double a, double f, double xyz[3], | |||
double *elong, double *phi, double *height); | double *elong, double *phi, double *height); | |||
int eraGd2gc(int n, double elong, double phi, double height, | int eraGd2gc(int n, double elong, double phi, double height, | |||
double xyz[3]); | double xyz[3]); | |||
int eraGd2gce(double a, double f, | int eraGd2gce(double a, double f, | |||
double elong, double phi, double height, double xyz[3]); | double elong, double phi, double height, double xyz[3]); | |||
void eraPvtob(double elong, double phi, double height, double xp, | ||||
double yp, double sp, double theta, double pv[2][3]); | ||||
/* Astronomy/Timescales */ | /* Astronomy/Timescales */ | |||
int eraD2dtf(const char *scale, int ndp, double d1, double d2, | int eraD2dtf(const char *scale, int ndp, double d1, double d2, | |||
int *iy, int *im, int *id, int ihmsf[4]); | int *iy, int *im, int *id, int ihmsf[4]); | |||
int eraDat(int iy, int im, int id, double fd, double *deltat); | int eraDat(int iy, int im, int id, double fd, double *deltat); | |||
double eraDtdb(double date1, double date2, | double eraDtdb(double date1, double date2, | |||
double ut, double elong, double u, double v); | double ut, double elong, double u, double v); | |||
int eraDtf2d(const char *scale, int iy, int im, int id, | int eraDtf2d(const char *scale, int iy, int im, int id, | |||
int ihr, int imn, double sec, double *d1, double *d2); | int ihr, int imn, double sec, double *d1, double *d2); | |||
int eraTaitt(double tai1, double tai2, double *tt1, double *tt2); | int eraTaitt(double tai1, double tai2, double *tt1, double *tt2); | |||
skipping to change at line 332 | skipping to change at line 445 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
/*---------------------------------------------------------------------- | /*---------------------------------------------------------------------- | |||
** | ** | |||
** | ** | |||
** Copyright (C) 2013, NumFOCUS Foundation. | ** Copyright (C) 2013-2014, NumFOCUS Foundation. | |||
** All rights reserved. | ** All rights reserved. | |||
** | ** | |||
** This library is derived, with permission, from the International | ** This library is derived, with permission, from the International | |||
** Astronomical Union's "Standards of Fundamental Astronomy" library, | ** Astronomical Union's "Standards of Fundamental Astronomy" library, | |||
** available from http://www.iausofa.org. | ** available from http://www.iausofa.org. | |||
** | ** | |||
** The ERFA version is intended to retain identical functionality to | ** The ERFA version is intended to retain identical functionality to | |||
** the SOFA library, but made distinct through different function and | ** the SOFA library, but made distinct through different function and | |||
** file names, as set out in the SOFA license conditions. The SOFA | ** file names, as set out in the SOFA license conditions. The SOFA | |||
** original has a role as a reference standard for the IAU and IERS, | ** original has a role as a reference standard for the IAU and IERS, | |||
End of changes. 7 change blocks. | ||||
3 lines changed or deleted | 116 lines changed or added | |||
erfam.h | erfam.h | |||
---|---|---|---|---|
#ifndef ERFAMHDEF | #ifndef ERFAMHDEF | |||
#define ERFAMHDEF | #define ERFAMHDEF | |||
/* | /* | |||
** - - - - - - - - | ** - - - - - - - - | |||
** e r f a m . h | ** e r f a m . h | |||
** - - - - - - - - | ** - - - - - - - - | |||
** | ** | |||
** Macros used by ERFA library. | ** Macros used by ERFA library. | |||
** | ** | |||
** Copyright (C) 2013, NumFOCUS Foundation. | ** Copyright (C) 2013-2014, NumFOCUS Foundation. | |||
** Derived, with permission, from the SOFA library. See notes at end of f ile. | ** Derived, with permission, from the SOFA library. See notes at end of f ile. | |||
*/ | */ | |||
#include "erfa.h" | /* Star-independent astrometry parameters */ | |||
typedef struct { | ||||
double pmt; /* PM time interval (SSB, Julian years) */ | ||||
double eb[3]; /* SSB to observer (vector, au) */ | ||||
double eh[3]; /* Sun to observer (unit vector) */ | ||||
double em; /* distance from Sun to observer (au) */ | ||||
double v[3]; /* barycentric observer velocity (vector, c) */ | ||||
double bm1; /* sqrt(1-|v|^2): reciprocal of Lorenz factor */ | ||||
double bpn[3][3]; /* bias-precession-nutation matrix */ | ||||
double along; /* longitude + s' + dERA(DUT) (radians) */ | ||||
double phi; /* geodetic latitude (radians) */ | ||||
double xpl; /* polar motion xp wrt local meridian (radians) */ | ||||
double ypl; /* polar motion yp wrt local meridian (radians) */ | ||||
double sphi; /* sine of geodetic latitude */ | ||||
double cphi; /* cosine of geodetic latitude */ | ||||
double diurab; /* magnitude of diurnal aberration vector */ | ||||
double eral; /* "local" Earth rotation angle (radians) */ | ||||
double refa; /* refraction constant A (radians) */ | ||||
double refb; /* refraction constant B (radians) */ | ||||
} eraASTROM; | ||||
/* (Vectors eb, eh, em and v are all with respect to BCRS axes.) */ | ||||
/* Body parameters for light deflection */ | ||||
typedef struct { | ||||
double bm; /* mass of the body (solar masses) */ | ||||
double dl; /* deflection limiter (radians^2/2) */ | ||||
double pv[2][3]; /* barycentric PV of the body (au, au/day) */ | ||||
} eraLDBODY; | ||||
/* Pi */ | /* Pi */ | |||
#define ERFA_DPI (3.141592653589793238462643) | #define ERFA_DPI (3.141592653589793238462643) | |||
/* 2Pi */ | /* 2Pi */ | |||
#define ERFA_D2PI (6.283185307179586476925287) | #define ERFA_D2PI (6.283185307179586476925287) | |||
/* Radians to degrees */ | ||||
#define ERFA_DR2D (57.29577951308232087679815) | ||||
/* Degrees to radians */ | /* Degrees to radians */ | |||
#define ERFA_DD2R (1.745329251994329576923691e-2) | #define ERFA_DD2R (1.745329251994329576923691e-2) | |||
/* Radians to arcseconds */ | /* Radians to arcseconds */ | |||
#define ERFA_DR2AS (206264.8062470963551564734) | #define ERFA_DR2AS (206264.8062470963551564734) | |||
/* Arcseconds to radians */ | /* Arcseconds to radians */ | |||
#define ERFA_DAS2R (4.848136811095359935899141e-6) | #define ERFA_DAS2R (4.848136811095359935899141e-6) | |||
/* Seconds of time to radians */ | /* Seconds of time to radians */ | |||
skipping to change at line 71 | skipping to change at line 101 | |||
/* Reference epoch (J2000.0), Modified Julian Date */ | /* Reference epoch (J2000.0), Modified Julian Date */ | |||
#define ERFA_DJM00 (51544.5) | #define ERFA_DJM00 (51544.5) | |||
/* 1977 Jan 1.0 as MJD */ | /* 1977 Jan 1.0 as MJD */ | |||
#define ERFA_DJM77 (43144.0) | #define ERFA_DJM77 (43144.0) | |||
/* TT minus TAI (s) */ | /* TT minus TAI (s) */ | |||
#define ERFA_TTMTAI (32.184) | #define ERFA_TTMTAI (32.184) | |||
/* AU (m) */ | /* Astronomical unit (m) */ | |||
#define ERFA_DAU (149597870e3) | #define ERFA_DAU (149597870e3) | |||
/* Speed of light (m/s) */ | ||||
#define ERFA_CMPS 299792458.0 | ||||
/* Light time for 1 au (s) */ | ||||
#define ERFA_AULT 499.004782 | ||||
/* Speed of light (AU per day) */ | /* Speed of light (AU per day) */ | |||
#define ERFA_DC (ERFA_DAYSEC / 499.004782) | #define ERFA_DC (ERFA_DAYSEC / ERFA_AULT) | |||
/* L_G = 1 - d(TT)/d(TCG) */ | /* L_G = 1 - d(TT)/d(TCG) */ | |||
#define ERFA_ELG (6.969290134e-10) | #define ERFA_ELG (6.969290134e-10) | |||
/* L_B = 1 - d(TDB)/d(TCB), and TDB (s) at TAI 1977/1/1.0 */ | /* L_B = 1 - d(TDB)/d(TCB), and TDB (s) at TAI 1977/1/1.0 */ | |||
#define ERFA_ELB (1.550519768e-8) | #define ERFA_ELB (1.550519768e-8) | |||
#define ERFA_TDB0 (-6.55e-5) | #define ERFA_TDB0 (-6.55e-5) | |||
/* Schwarzschild radius of the Sun (au) */ | ||||
/* = 2 * 1.32712440041e20 / (2.99792458e8)^2 / 1.49597870700e11 */ | ||||
#define ERFA_SRS 1.97412574336e-8 | ||||
/* ERFA_DINT(A) - truncate to nearest whole number towards zero (double) */ | /* ERFA_DINT(A) - truncate to nearest whole number towards zero (double) */ | |||
#define ERFA_DINT(A) ((A)<0.0?ceil(A):floor(A)) | #define ERFA_DINT(A) ((A)<0.0?ceil(A):floor(A)) | |||
/* ERFA_DNINT(A) - round to nearest whole number (double) */ | /* ERFA_DNINT(A) - round to nearest whole number (double) */ | |||
#define ERFA_DNINT(A) ((A)<0.0?ceil((A)-0.5):floor((A)+0.5)) | #define ERFA_DNINT(A) ((A)<0.0?ceil((A)-0.5):floor((A)+0.5)) | |||
/* ERFA_DSIGN(A,B) - magnitude of A with sign of B (double) */ | /* ERFA_DSIGN(A,B) - magnitude of A with sign of B (double) */ | |||
#define ERFA_DSIGN(A,B) ((B)<0.0?-fabs(A):fabs(A)) | #define ERFA_DSIGN(A,B) ((B)<0.0?-fabs(A):fabs(A)) | |||
/* max(A,B) - larger (most +ve) of two numbers (generic) */ | ||||
#define ERFA_GMAX(A,B) (((A)>(B))?(A):(B)) | ||||
/* min(A,B) - smaller (least +ve) of two numbers (generic) */ | ||||
#define ERFA_GMIN(A,B) (((A)<(B))?(A):(B)) | ||||
/* Reference ellipsoids */ | /* Reference ellipsoids */ | |||
#define ERFA_WGS84 1 | #define ERFA_WGS84 1 | |||
#define ERFA_GRS80 2 | #define ERFA_GRS80 2 | |||
#define ERFA_WGS72 3 | #define ERFA_WGS72 3 | |||
#endif | #endif | |||
/*---------------------------------------------------------------------- | /*---------------------------------------------------------------------- | |||
** | ** | |||
** | ** | |||
** Copyright (C) 2013, NumFOCUS Foundation. | ** Copyright (C) 2013-2014, NumFOCUS Foundation. | |||
** All rights reserved. | ** All rights reserved. | |||
** | ** | |||
** This library is derived, with permission, from the International | ** This library is derived, with permission, from the International | |||
** Astronomical Union's "Standards of Fundamental Astronomy" library, | ** Astronomical Union's "Standards of Fundamental Astronomy" library, | |||
** available from http://www.iausofa.org. | ** available from http://www.iausofa.org. | |||
** | ** | |||
** The ERFA version is intended to retain identical functionality to | ** The ERFA version is intended to retain identical functionality to | |||
** the SOFA library, but made distinct through different function and | ** the SOFA library, but made distinct through different function and | |||
** file names, as set out in the SOFA license conditions. The SOFA | ** file names, as set out in the SOFA license conditions. The SOFA | |||
** original has a role as a reference standard for the IAU and IERS, | ** original has a role as a reference standard for the IAU and IERS, | |||
End of changes. 9 change blocks. | ||||
5 lines changed or deleted | 51 lines changed or added | |||