@arcosmos/erfa 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +56 -0
- package/README.md +109 -2
- package/dist/a2af.d.ts +36 -0
- package/dist/a2af.d.ts.map +1 -0
- package/dist/a2af.js +44 -0
- package/dist/a2af.js.map +1 -0
- package/dist/a2tf.d.ts +36 -0
- package/dist/a2tf.d.ts.map +1 -0
- package/dist/a2tf.js +42 -0
- package/dist/a2tf.js.map +1 -0
- package/dist/af2a.d.ts +19 -0
- package/dist/af2a.d.ts.map +1 -0
- package/dist/af2a.js +34 -0
- package/dist/af2a.js.map +1 -0
- package/dist/anp.d.ts +8 -0
- package/dist/anp.d.ts.map +1 -0
- package/dist/anp.js +16 -0
- package/dist/anp.js.map +1 -0
- package/dist/anpm.d.ts +8 -0
- package/dist/anpm.d.ts.map +1 -0
- package/dist/anpm.js +16 -0
- package/dist/anpm.js.map +1 -0
- package/dist/bi00.d.ts +27 -0
- package/dist/bi00.d.ts.map +1 -0
- package/dist/bi00.js +40 -0
- package/dist/bi00.js.map +1 -0
- package/dist/bp06.d.ts +27 -0
- package/dist/bp06.d.ts.map +1 -0
- package/dist/bp06.js +46 -0
- package/dist/bp06.js.map +1 -0
- package/dist/c2s.d.ts +14 -0
- package/dist/c2s.d.ts.map +1 -0
- package/dist/c2s.js +21 -0
- package/dist/c2s.js.map +1 -0
- package/dist/cal2jd.d.ts +27 -0
- package/dist/cal2jd.d.ts.map +1 -0
- package/dist/cal2jd.js +58 -0
- package/dist/cal2jd.js.map +1 -0
- package/dist/constants.d.ts +59 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +60 -0
- package/dist/constants.js.map +1 -0
- package/dist/cp.d.ts +9 -0
- package/dist/cp.d.ts.map +1 -0
- package/dist/cp.js +10 -0
- package/dist/cp.js.map +1 -0
- package/dist/cpv.d.ts +9 -0
- package/dist/cpv.d.ts.map +1 -0
- package/dist/cpv.js +12 -0
- package/dist/cpv.js.map +1 -0
- package/dist/cr.d.ts +9 -0
- package/dist/cr.d.ts.map +1 -0
- package/dist/cr.js +12 -0
- package/dist/cr.js.map +1 -0
- package/dist/d2dtf.d.ts +49 -0
- package/dist/d2dtf.d.ts.map +1 -0
- package/dist/d2dtf.js +142 -0
- package/dist/d2dtf.js.map +1 -0
- package/dist/d2tf.d.ts +36 -0
- package/dist/d2tf.d.ts.map +1 -0
- package/dist/d2tf.js +77 -0
- package/dist/d2tf.js.map +1 -0
- package/dist/dat.d.ts +55 -0
- package/dist/dat.d.ts.map +1 -0
- package/dist/dat.js +168 -0
- package/dist/dat.js.map +1 -0
- package/dist/datini.d.ts +26 -0
- package/dist/datini.d.ts.map +1 -0
- package/dist/datini.js +37 -0
- package/dist/datini.js.map +1 -0
- package/dist/dtdb.d.ts +105 -0
- package/dist/dtdb.d.ts.map +1 -0
- package/dist/dtdb.js +1076 -0
- package/dist/dtdb.js.map +1 -0
- package/dist/dtf2d.d.ts +45 -0
- package/dist/dtf2d.d.ts.map +1 -0
- package/dist/dtf2d.js +112 -0
- package/dist/dtf2d.js.map +1 -0
- package/dist/eceq06.d.ts +24 -0
- package/dist/eceq06.d.ts.map +1 -0
- package/dist/eceq06.js +44 -0
- package/dist/eceq06.js.map +1 -0
- package/dist/ecm06.d.ts +30 -0
- package/dist/ecm06.d.ts.map +1 -0
- package/dist/ecm06.js +45 -0
- package/dist/ecm06.js.map +1 -0
- package/dist/epb.d.ts +24 -0
- package/dist/epb.d.ts.map +1 -0
- package/dist/epb.js +30 -0
- package/dist/epb.js.map +1 -0
- package/dist/epb2jd.d.ts +14 -0
- package/dist/epb2jd.d.ts.map +1 -0
- package/dist/epb2jd.js +20 -0
- package/dist/epb2jd.js.map +1 -0
- package/dist/epj.d.ts +24 -0
- package/dist/epj.d.ts.map +1 -0
- package/dist/epj.js +29 -0
- package/dist/epj.js.map +1 -0
- package/dist/epj2jd.d.ts +14 -0
- package/dist/epj2jd.d.ts.map +1 -0
- package/dist/epj2jd.js +20 -0
- package/dist/epj2jd.js.map +1 -0
- package/dist/eqec06.d.ts +24 -0
- package/dist/eqec06.d.ts.map +1 -0
- package/dist/eqec06.js +44 -0
- package/dist/eqec06.js.map +1 -0
- package/dist/era00.d.ts +29 -0
- package/dist/era00.d.ts.map +1 -0
- package/dist/era00.js +51 -0
- package/dist/era00.js.map +1 -0
- package/dist/fw2m.d.ts +51 -0
- package/dist/fw2m.d.ts.map +1 -0
- package/dist/fw2m.js +61 -0
- package/dist/fw2m.js.map +1 -0
- package/dist/g2icrs.d.ts +33 -0
- package/dist/g2icrs.d.ts.map +1 -0
- package/dist/g2icrs.js +69 -0
- package/dist/g2icrs.js.map +1 -0
- package/dist/gmst06.d.ts +32 -0
- package/dist/gmst06.d.ts.map +1 -0
- package/dist/gmst06.js +49 -0
- package/dist/gmst06.js.map +1 -0
- package/dist/icrs2g.d.ts +33 -0
- package/dist/icrs2g.d.ts.map +1 -0
- package/dist/icrs2g.js +69 -0
- package/dist/icrs2g.js.map +1 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +23 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +32 -0
- package/dist/internal.js.map +1 -0
- package/dist/ir.d.ts +9 -0
- package/dist/ir.d.ts.map +1 -0
- package/dist/ir.js +14 -0
- package/dist/ir.js.map +1 -0
- package/dist/jd2cal.d.ts +31 -0
- package/dist/jd2cal.d.ts.map +1 -0
- package/dist/jd2cal.js +106 -0
- package/dist/jd2cal.js.map +1 -0
- package/dist/jdcalf.d.ts +28 -0
- package/dist/jdcalf.d.ts.map +1 -0
- package/dist/jdcalf.js +84 -0
- package/dist/jdcalf.js.map +1 -0
- package/dist/leap-seconds.d.ts +30 -0
- package/dist/leap-seconds.d.ts.map +1 -0
- package/dist/leap-seconds.js +42 -0
- package/dist/leap-seconds.js.map +1 -0
- package/dist/obl06.d.ts +19 -0
- package/dist/obl06.d.ts.map +1 -0
- package/dist/obl06.js +32 -0
- package/dist/obl06.js.map +1 -0
- package/dist/pap.d.ts +19 -0
- package/dist/pap.d.ts.map +1 -0
- package/dist/pap.js +45 -0
- package/dist/pap.js.map +1 -0
- package/dist/pas.d.ts +17 -0
- package/dist/pas.d.ts.map +1 -0
- package/dist/pas.js +24 -0
- package/dist/pas.js.map +1 -0
- package/dist/pdp.d.ts +8 -0
- package/dist/pdp.d.ts.map +1 -0
- package/dist/pdp.js +9 -0
- package/dist/pdp.js.map +1 -0
- package/dist/pfw06.d.ts +43 -0
- package/dist/pfw06.d.ts.map +1 -0
- package/dist/pfw06.js +73 -0
- package/dist/pfw06.js.map +1 -0
- package/dist/pm.d.ts +8 -0
- package/dist/pm.d.ts.map +1 -0
- package/dist/pm.js +9 -0
- package/dist/pm.js.map +1 -0
- package/dist/pmat06.d.ts +26 -0
- package/dist/pmat06.d.ts.map +1 -0
- package/dist/pmat06.js +34 -0
- package/dist/pmat06.js.map +1 -0
- package/dist/pmp.d.ts +10 -0
- package/dist/pmp.d.ts.map +1 -0
- package/dist/pmp.js +11 -0
- package/dist/pmp.js.map +1 -0
- package/dist/pmpx.d.ts +29 -0
- package/dist/pmpx.d.ts.map +1 -0
- package/dist/pmpx.js +59 -0
- package/dist/pmpx.js.map +1 -0
- package/dist/pmsafe.d.ts +60 -0
- package/dist/pmsafe.d.ts.map +1 -0
- package/dist/pmsafe.js +91 -0
- package/dist/pmsafe.js.map +1 -0
- package/dist/pn.d.ts +12 -0
- package/dist/pn.d.ts.map +1 -0
- package/dist/pn.js +25 -0
- package/dist/pn.js.map +1 -0
- package/dist/ppp.d.ts +10 -0
- package/dist/ppp.d.ts.map +1 -0
- package/dist/ppp.js +11 -0
- package/dist/ppp.js.map +1 -0
- package/dist/ppsp.d.ts +11 -0
- package/dist/ppsp.d.ts.map +1 -0
- package/dist/ppsp.js +17 -0
- package/dist/ppsp.js.map +1 -0
- package/dist/pv2s.d.ts +19 -0
- package/dist/pv2s.d.ts.map +1 -0
- package/dist/pv2s.js +61 -0
- package/dist/pv2s.js.map +1 -0
- package/dist/pvdpv.d.ts +14 -0
- package/dist/pvdpv.d.ts.map +1 -0
- package/dist/pvdpv.js +24 -0
- package/dist/pvdpv.js.map +1 -0
- package/dist/pvm.d.ts +9 -0
- package/dist/pvm.d.ts.map +1 -0
- package/dist/pvm.js +15 -0
- package/dist/pvm.js.map +1 -0
- package/dist/pvmpv.d.ts +10 -0
- package/dist/pvmpv.d.ts.map +1 -0
- package/dist/pvmpv.js +12 -0
- package/dist/pvmpv.js.map +1 -0
- package/dist/pvppv.d.ts +10 -0
- package/dist/pvppv.d.ts.map +1 -0
- package/dist/pvppv.js +12 -0
- package/dist/pvppv.js.map +1 -0
- package/dist/pvstar.d.ts +51 -0
- package/dist/pvstar.d.ts.map +1 -0
- package/dist/pvstar.js +97 -0
- package/dist/pvstar.js.map +1 -0
- package/dist/pvu.d.ts +15 -0
- package/dist/pvu.d.ts.map +1 -0
- package/dist/pvu.js +19 -0
- package/dist/pvu.js.map +1 -0
- package/dist/pvxpv.d.ts +15 -0
- package/dist/pvxpv.d.ts.map +1 -0
- package/dist/pvxpv.js +29 -0
- package/dist/pvxpv.js.map +1 -0
- package/dist/pxp.d.ts +8 -0
- package/dist/pxp.d.ts.map +1 -0
- package/dist/pxp.js +15 -0
- package/dist/pxp.js.map +1 -0
- package/dist/rx.d.ts +21 -0
- package/dist/rx.d.ts.map +1 -0
- package/dist/rx.js +30 -0
- package/dist/rx.js.map +1 -0
- package/dist/rxp.d.ts +10 -0
- package/dist/rxp.d.ts.map +1 -0
- package/dist/rxp.js +21 -0
- package/dist/rxp.js.map +1 -0
- package/dist/rxr.d.ts +10 -0
- package/dist/rxr.d.ts.map +1 -0
- package/dist/rxr.js +27 -0
- package/dist/rxr.js.map +1 -0
- package/dist/ry.d.ts +21 -0
- package/dist/ry.d.ts.map +1 -0
- package/dist/ry.js +30 -0
- package/dist/ry.js.map +1 -0
- package/dist/rz.d.ts +21 -0
- package/dist/rz.d.ts.map +1 -0
- package/dist/rz.js +30 -0
- package/dist/rz.js.map +1 -0
- package/dist/s2c.d.ts +10 -0
- package/dist/s2c.d.ts.map +1 -0
- package/dist/s2c.js +12 -0
- package/dist/s2c.js.map +1 -0
- package/dist/s2pv.d.ts +14 -0
- package/dist/s2pv.d.ts.map +1 -0
- package/dist/s2pv.js +27 -0
- package/dist/s2pv.js.map +1 -0
- package/dist/s2xpv.d.ts +11 -0
- package/dist/s2xpv.d.ts.map +1 -0
- package/dist/s2xpv.js +13 -0
- package/dist/s2xpv.js.map +1 -0
- package/dist/sepp.d.ts +16 -0
- package/dist/sepp.d.ts.map +1 -0
- package/dist/sepp.js +26 -0
- package/dist/sepp.js.map +1 -0
- package/dist/seps.d.ts +11 -0
- package/dist/seps.d.ts.map +1 -0
- package/dist/seps.js +20 -0
- package/dist/seps.js.map +1 -0
- package/dist/starpm.d.ts +56 -0
- package/dist/starpm.d.ts.map +1 -0
- package/dist/starpm.js +90 -0
- package/dist/starpm.js.map +1 -0
- package/dist/starpv.d.ts +62 -0
- package/dist/starpv.d.ts.map +1 -0
- package/dist/starpv.js +147 -0
- package/dist/starpv.js.map +1 -0
- package/dist/sxp.d.ts +10 -0
- package/dist/sxp.d.ts.map +1 -0
- package/dist/sxp.js +11 -0
- package/dist/sxp.js.map +1 -0
- package/dist/sxpv.d.ts +10 -0
- package/dist/sxpv.d.ts.map +1 -0
- package/dist/sxpv.js +12 -0
- package/dist/sxpv.js.map +1 -0
- package/dist/taitt.d.ts +19 -0
- package/dist/taitt.d.ts.map +1 -0
- package/dist/taitt.js +36 -0
- package/dist/taitt.js.map +1 -0
- package/dist/taiut1.d.ts +20 -0
- package/dist/taiut1.d.ts.map +1 -0
- package/dist/taiut1.js +36 -0
- package/dist/taiut1.js.map +1 -0
- package/dist/taiutc.d.ts +33 -0
- package/dist/taiutc.d.ts.map +1 -0
- package/dist/taiutc.js +73 -0
- package/dist/taiutc.js.map +1 -0
- package/dist/tcbtdb.d.ts +29 -0
- package/dist/tcbtdb.d.ts.map +1 -0
- package/dist/tcbtdb.js +51 -0
- package/dist/tcbtdb.js.map +1 -0
- package/dist/tcgtt.d.ts +18 -0
- package/dist/tcgtt.d.ts.map +1 -0
- package/dist/tcgtt.js +35 -0
- package/dist/tcgtt.js.map +1 -0
- package/dist/tdbtcb.d.ts +29 -0
- package/dist/tdbtcb.d.ts.map +1 -0
- package/dist/tdbtcb.js +55 -0
- package/dist/tdbtcb.js.map +1 -0
- package/dist/tdbtt.d.ts +27 -0
- package/dist/tdbtt.d.ts.map +1 -0
- package/dist/tdbtt.js +43 -0
- package/dist/tdbtt.js.map +1 -0
- package/dist/tf2a.d.ts +19 -0
- package/dist/tf2a.d.ts.map +1 -0
- package/dist/tf2a.js +34 -0
- package/dist/tf2a.js.map +1 -0
- package/dist/tr.d.ts +9 -0
- package/dist/tr.d.ts.map +1 -0
- package/dist/tr.js +22 -0
- package/dist/tr.js.map +1 -0
- package/dist/trxp.d.ts +10 -0
- package/dist/trxp.d.ts.map +1 -0
- package/dist/trxp.js +15 -0
- package/dist/trxp.js.map +1 -0
- package/dist/tttai.d.ts +19 -0
- package/dist/tttai.d.ts.map +1 -0
- package/dist/tttai.js +36 -0
- package/dist/tttai.js.map +1 -0
- package/dist/tttcg.d.ts +18 -0
- package/dist/tttcg.d.ts.map +1 -0
- package/dist/tttcg.js +37 -0
- package/dist/tttcg.js.map +1 -0
- package/dist/tttdb.d.ts +27 -0
- package/dist/tttdb.d.ts.map +1 -0
- package/dist/tttdb.js +43 -0
- package/dist/tttdb.js.map +1 -0
- package/dist/ttut1.d.ts +19 -0
- package/dist/ttut1.d.ts.map +1 -0
- package/dist/ttut1.js +35 -0
- package/dist/ttut1.js.map +1 -0
- package/dist/ut1tai.d.ts +20 -0
- package/dist/ut1tai.d.ts.map +1 -0
- package/dist/ut1tai.js +36 -0
- package/dist/ut1tai.js.map +1 -0
- package/dist/ut1tt.d.ts +19 -0
- package/dist/ut1tt.d.ts.map +1 -0
- package/dist/ut1tt.js +35 -0
- package/dist/ut1tt.js.map +1 -0
- package/dist/ut1utc.d.ts +35 -0
- package/dist/ut1utc.d.ts.map +1 -0
- package/dist/ut1utc.js +107 -0
- package/dist/ut1utc.js.map +1 -0
- package/dist/utctai.d.ts +33 -0
- package/dist/utctai.d.ts.map +1 -0
- package/dist/utctai.js +94 -0
- package/dist/utctai.js.map +1 -0
- package/dist/utcut1.d.ts +34 -0
- package/dist/utcut1.d.ts.map +1 -0
- package/dist/utcut1.js +63 -0
- package/dist/utcut1.js.map +1 -0
- package/dist/zp.d.ts +8 -0
- package/dist/zp.d.ts.map +1 -0
- package/dist/zp.js +9 -0
- package/dist/zp.js.map +1 -0
- package/dist/zpv.d.ts +8 -0
- package/dist/zpv.d.ts.map +1 -0
- package/dist/zpv.js +10 -0
- package/dist/zpv.js.map +1 -0
- package/dist/zr.d.ts +9 -0
- package/dist/zr.d.ts.map +1 -0
- package/dist/zr.js +14 -0
- package/dist/zr.js.map +1 -0
- package/package.json +42 -3
- package/src/a2af.ts +48 -0
- package/src/a2tf.ts +45 -0
- package/src/af2a.ts +38 -0
- package/src/anp.ts +15 -0
- package/src/anpm.ts +15 -0
- package/src/bi00.ts +42 -0
- package/src/bp06.ts +51 -0
- package/src/c2s.ts +23 -0
- package/src/cal2jd.ts +67 -0
- package/src/constants.ts +60 -0
- package/src/cp.ts +12 -0
- package/src/cpv.ts +13 -0
- package/src/cr.ts +13 -0
- package/src/d2dtf.ts +153 -0
- package/src/d2tf.ts +87 -0
- package/src/dat.ts +186 -0
- package/src/datini.ts +49 -0
- package/src/dtdb.ts +1110 -0
- package/src/dtf2d.ts +124 -0
- package/src/eceq06.ts +54 -0
- package/src/ecm06.ts +51 -0
- package/src/epb.ts +31 -0
- package/src/epb2jd.ts +21 -0
- package/src/epj.ts +30 -0
- package/src/epj2jd.ts +21 -0
- package/src/eqec06.ts +54 -0
- package/src/era00.ts +54 -0
- package/src/fw2m.ts +64 -0
- package/src/g2icrs.ts +74 -0
- package/src/gmst06.ts +51 -0
- package/src/icrs2g.ts +74 -0
- package/src/index.ts +108 -0
- package/src/internal.ts +46 -0
- package/src/ir.ts +16 -0
- package/src/jd2cal.ts +117 -0
- package/src/jdcalf.ts +93 -0
- package/src/leap-seconds.ts +47 -0
- package/src/obl06.ts +34 -0
- package/src/pap.ts +54 -0
- package/src/pas.ts +25 -0
- package/src/pdp.ts +11 -0
- package/src/pfw06.ts +78 -0
- package/src/pm.ts +11 -0
- package/src/pmat06.ts +37 -0
- package/src/pmp.ts +13 -0
- package/src/pmpx.ts +75 -0
- package/src/pmsafe.ts +109 -0
- package/src/pn.ts +26 -0
- package/src/ppp.ts +13 -0
- package/src/ppsp.ts +20 -0
- package/src/pv2s.ts +71 -0
- package/src/pvdpv.ts +30 -0
- package/src/pvm.ts +19 -0
- package/src/pvmpv.ts +14 -0
- package/src/pvppv.ts +14 -0
- package/src/pvstar.ts +113 -0
- package/src/pvu.ts +20 -0
- package/src/pvxpv.ts +33 -0
- package/src/pxp.ts +17 -0
- package/src/rx.ts +32 -0
- package/src/rxp.ts +24 -0
- package/src/rxr.ts +29 -0
- package/src/ry.ts +32 -0
- package/src/rz.ts +32 -0
- package/src/s2c.ts +14 -0
- package/src/s2pv.ts +30 -0
- package/src/s2xpv.ts +15 -0
- package/src/sepp.ts +28 -0
- package/src/seps.ts +20 -0
- package/src/starpm.ts +108 -0
- package/src/starpv.ts +167 -0
- package/src/sxp.ts +13 -0
- package/src/sxpv.ts +14 -0
- package/src/taitt.ts +38 -0
- package/src/taiut1.ts +41 -0
- package/src/taiutc.ts +76 -0
- package/src/tcbtdb.ts +54 -0
- package/src/tcgtt.ts +37 -0
- package/src/tdbtcb.ts +59 -0
- package/src/tdbtt.ts +48 -0
- package/src/tf2a.ts +38 -0
- package/src/tr.ts +24 -0
- package/src/trxp.ts +18 -0
- package/src/tttai.ts +38 -0
- package/src/tttcg.ts +40 -0
- package/src/tttdb.ts +48 -0
- package/src/ttut1.ts +40 -0
- package/src/ut1tai.ts +41 -0
- package/src/ut1tt.ts +40 -0
- package/src/ut1utc.ts +115 -0
- package/src/utctai.ts +97 -0
- package/src/utcut1.ts +66 -0
- package/src/zp.ts +11 -0
- package/src/zpv.ts +12 -0
- package/src/zr.ts +16 -0
package/src/dtf2d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraDtf2d (dtf2d.c); see LICENSE.
|
|
2
|
+
import { cal2jd } from './cal2jd.ts'
|
|
3
|
+
import { DAYSEC } from './constants.ts'
|
|
4
|
+
import { dat } from './dat.ts'
|
|
5
|
+
import { jd2cal } from './jd2cal.ts'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Encode date and time fields into 2-part Julian Date (or in the case of UTC a quasi-JD
|
|
9
|
+
* form that includes special provision for leap seconds).
|
|
10
|
+
*
|
|
11
|
+
* Notes:
|
|
12
|
+
* 1. scale identifies the time scale. Only the value "UTC" (in upper case) is significant,
|
|
13
|
+
* and enables handling of leap seconds (see Note 4). It is compared as C's strcmp does,
|
|
14
|
+
* exactly.
|
|
15
|
+
* 2. For calendar conventions and limitations, see cal2jd.
|
|
16
|
+
* 3. The sum of the results, d1+d2, is Julian Date, where normally d1 is the Julian Day
|
|
17
|
+
* Number and d2 is the fraction of a day. In the case of UTC, where the use of JD is
|
|
18
|
+
* problematical, special conventions apply: see the next note.
|
|
19
|
+
* 4. JD cannot unambiguously represent UTC during a leap second unless special measures are
|
|
20
|
+
* taken. The ERFA internal convention is that the quasi-JD day represents UTC days
|
|
21
|
+
* whether the length is 86399, 86400 or 86401 SI seconds. In the 1960-1972 era there
|
|
22
|
+
* were smaller jumps (in either direction) each time the linear UTC(TAI) expression was
|
|
23
|
+
* changed, and these "mini-leaps" are also included in the ERFA convention. So d2 is the
|
|
24
|
+
* time of day in seconds divided by that day's length: 23:59:60.5 on a day ending in a
|
|
25
|
+
* leap second is 86400.5/86401 of a day.
|
|
26
|
+
* 5. The warning status "time is after end of day" usually means that the sec argument is
|
|
27
|
+
* greater than 60.0. However, in a day ending in a leap second the limit changes to 61.0
|
|
28
|
+
* (or 59.0 in the case of a negative leap second).
|
|
29
|
+
* 6. The warning status "dubious year" flags UTCs that predate the introduction of the time
|
|
30
|
+
* scale or that are too far in the future to be trusted. See dat for further details.
|
|
31
|
+
* 7. Only in the case of continuous and regular time scales (TAI, TT, TCG, TCB and TDB) is
|
|
32
|
+
* the result d1+d2 a Julian Date, strictly speaking. In the other cases (UT1 and UTC) the
|
|
33
|
+
* result must be used with circumspection; in particular the difference between two such
|
|
34
|
+
* results cannot be interpreted as a precise time interval.
|
|
35
|
+
* 8. The year, month, day, hour and minute are integers in C. Where the status is
|
|
36
|
+
* negative, d1 and d2 are NaN.
|
|
37
|
+
*
|
|
38
|
+
* @param scale time scale ID (Note 1)
|
|
39
|
+
* @param iy year in Gregorian calendar (Note 2)
|
|
40
|
+
* @param im month in Gregorian calendar (Note 2)
|
|
41
|
+
* @param id day in Gregorian calendar (Note 2)
|
|
42
|
+
* @param ihr hour
|
|
43
|
+
* @param imn minute
|
|
44
|
+
* @param sec seconds
|
|
45
|
+
* @returns [d1, d2, status]: 2-part Julian Date (Notes 3, 4), and status: +3 = both of next
|
|
46
|
+
* two, +2 = time is after end of day (Note 5), +1 = dubious year (Note 6), 0 = OK, -1 =
|
|
47
|
+
* bad year, -2 = bad month, -3 = bad day, -4 = bad hour, -5 = bad minute, -6 = bad second
|
|
48
|
+
* (<0)
|
|
49
|
+
*/
|
|
50
|
+
export function dtf2d(
|
|
51
|
+
scale: string,
|
|
52
|
+
iy: number,
|
|
53
|
+
im: number,
|
|
54
|
+
id: number,
|
|
55
|
+
ihr: number,
|
|
56
|
+
imn: number,
|
|
57
|
+
sec: number,
|
|
58
|
+
): [d1: number, d2: number, status: number] {
|
|
59
|
+
let js: number, iy2: number, im2: number, id2: number
|
|
60
|
+
let dj: number, w: number, dat0: number, dat12: number, dat24: number
|
|
61
|
+
|
|
62
|
+
// Today's Julian Day Number.
|
|
63
|
+
;[dj, w, js] = cal2jd(iy, im, id)
|
|
64
|
+
if (js) return [NaN, NaN, js]
|
|
65
|
+
dj += w
|
|
66
|
+
|
|
67
|
+
// Day length and final minute length in seconds (provisional).
|
|
68
|
+
let day = DAYSEC
|
|
69
|
+
let seclim = 60.0
|
|
70
|
+
|
|
71
|
+
// Deal with the UTC leap second case.
|
|
72
|
+
if (scale === 'UTC') {
|
|
73
|
+
// TAI-UTC at 0h today.
|
|
74
|
+
;[dat0, js] = dat(iy, im, id, 0.0)
|
|
75
|
+
if (js < 0) return [NaN, NaN, js]
|
|
76
|
+
|
|
77
|
+
// TAI-UTC at 12h today (to detect drift).
|
|
78
|
+
;[dat12, js] = dat(iy, im, id, 0.5)
|
|
79
|
+
if (js < 0) return [NaN, NaN, js]
|
|
80
|
+
|
|
81
|
+
// TAI-UTC at 0h tomorrow (to detect jumps).
|
|
82
|
+
;[iy2, im2, id2, w, js] = jd2cal(dj, 1.5)
|
|
83
|
+
if (js) return [NaN, NaN, js]
|
|
84
|
+
;[dat24, js] = dat(iy2, im2, id2, 0.0)
|
|
85
|
+
if (js < 0) return [NaN, NaN, js]
|
|
86
|
+
|
|
87
|
+
// Any sudden change in TAI-UTC between today and tomorrow.
|
|
88
|
+
const dleap = dat24 - (2.0 * dat12 - dat0)
|
|
89
|
+
|
|
90
|
+
// If leap second day, correct the day and final minute lengths.
|
|
91
|
+
day += dleap
|
|
92
|
+
if (ihr === 23 && imn === 59) seclim += dleap
|
|
93
|
+
|
|
94
|
+
// End of UTC-specific actions.
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Validate the time.
|
|
98
|
+
if (ihr >= 0 && ihr <= 23) {
|
|
99
|
+
if (imn >= 0 && imn <= 59) {
|
|
100
|
+
if (sec >= 0.0) {
|
|
101
|
+
if (sec >= seclim) {
|
|
102
|
+
js += 2
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
js = -6
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
js = -5
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
js = -4
|
|
112
|
+
}
|
|
113
|
+
if (js < 0) return [NaN, NaN, js]
|
|
114
|
+
|
|
115
|
+
// The time in days.
|
|
116
|
+
const time = (60.0 * (60 * ihr + imn) + sec) / day
|
|
117
|
+
|
|
118
|
+
// Return the date and time.
|
|
119
|
+
const d1 = dj
|
|
120
|
+
const d2 = time
|
|
121
|
+
|
|
122
|
+
// Status.
|
|
123
|
+
return [d1, d2, js]
|
|
124
|
+
}
|
package/src/eceq06.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraEceq06 (eceq06.c); see LICENSE.
|
|
2
|
+
import { anp } from './anp.ts'
|
|
3
|
+
import { anpm } from './anpm.ts'
|
|
4
|
+
import { c2s } from './c2s.ts'
|
|
5
|
+
import { ecm06 } from './ecm06.ts'
|
|
6
|
+
import { s2c } from './s2c.ts'
|
|
7
|
+
import { trxp } from './trxp.ts'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Transformation from ecliptic coordinates (mean equinox and ecliptic of date) to ICRS
|
|
11
|
+
* RA,Dec, using the IAU 2006 precession model.
|
|
12
|
+
*
|
|
13
|
+
* Notes:
|
|
14
|
+
* 1. The TT date date1+date2 is a Julian Date, apportioned in any convenient way between
|
|
15
|
+
* the two arguments. For example, JD(TT)=2450123.7 could be given as (2450123.7, 0.0),
|
|
16
|
+
* the JD method; (2451545.0, -1421.3), the J2000 method; (2400000.5, 50123.2), the MJD
|
|
17
|
+
* method; or (2450123.5, 0.2), the date and time method. The J2000 method is best matched
|
|
18
|
+
* to the way the argument is handled internally and will deliver the optimum resolution.
|
|
19
|
+
* 2. No assumptions are made about whether the coordinates represent starlight and embody
|
|
20
|
+
* astrometric effects such as parallax or aberration.
|
|
21
|
+
* 3. The transformation is approximately that from ecliptic longitude and latitude (mean
|
|
22
|
+
* equinox and ecliptic of date) to mean J2000.0 right ascension and declination, with
|
|
23
|
+
* only frame bias (always less than 25 mas) to disturb this classical picture.
|
|
24
|
+
*
|
|
25
|
+
* @param date1 TT as a 2-part Julian date (Note 1)
|
|
26
|
+
* @param date2 TT as a 2-part Julian date (Note 1)
|
|
27
|
+
* @param dl ecliptic longitude (radians)
|
|
28
|
+
* @param db ecliptic latitude (radians)
|
|
29
|
+
* @returns [dr, dd]: ICRS right ascension and declination (radians)
|
|
30
|
+
*/
|
|
31
|
+
export function eceq06(
|
|
32
|
+
date1: number,
|
|
33
|
+
date2: number,
|
|
34
|
+
dl: number,
|
|
35
|
+
db: number,
|
|
36
|
+
): [dr: number, dd: number] {
|
|
37
|
+
// Spherical to Cartesian.
|
|
38
|
+
const v1 = s2c(dl, db)
|
|
39
|
+
|
|
40
|
+
// Rotation matrix, ICRS equatorial to ecliptic.
|
|
41
|
+
const rm = ecm06(date1, date2)
|
|
42
|
+
|
|
43
|
+
// The transformation from ecliptic to ICRS.
|
|
44
|
+
const v2 = trxp(rm, v1)
|
|
45
|
+
|
|
46
|
+
// Cartesian to spherical.
|
|
47
|
+
const [a, b] = c2s(v2)
|
|
48
|
+
|
|
49
|
+
// Express in conventional ranges.
|
|
50
|
+
const dr = anp(a)
|
|
51
|
+
const dd = anpm(b)
|
|
52
|
+
|
|
53
|
+
return [dr, dd]
|
|
54
|
+
}
|
package/src/ecm06.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraEcm06 (ecm06.c); see LICENSE.
|
|
2
|
+
import type { Mat3 } from './internal.ts'
|
|
3
|
+
import { ir } from './ir.ts'
|
|
4
|
+
import { obl06 } from './obl06.ts'
|
|
5
|
+
import { pmat06 } from './pmat06.ts'
|
|
6
|
+
import { rx } from './rx.ts'
|
|
7
|
+
import { rxr } from './rxr.ts'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ICRS equatorial to ecliptic rotation matrix, IAU 2006.
|
|
11
|
+
*
|
|
12
|
+
* Notes:
|
|
13
|
+
* 1. The TT date date1+date2 is a Julian Date, apportioned in any convenient way between
|
|
14
|
+
* the two arguments. For example, JD(TT)=2450123.7 could be given as (2450123.7, 0.0),
|
|
15
|
+
* the JD method; (2451545.0, -1421.3), the J2000 method; (2400000.5, 50123.2), the MJD
|
|
16
|
+
* method; or (2450123.5, 0.2), the date and time method. The J2000 method is best matched
|
|
17
|
+
* to the way the argument is handled internally and will deliver the optimum resolution.
|
|
18
|
+
* 2. The matrix is in the sense
|
|
19
|
+
*
|
|
20
|
+
* E_ep = rm x P_ICRS,
|
|
21
|
+
*
|
|
22
|
+
* where P_ICRS is a vector with respect to ICRS right ascension and declination axes and
|
|
23
|
+
* E_ep is the same vector with respect to the (inertial) ecliptic and equinox of date.
|
|
24
|
+
*
|
|
25
|
+
* P_ICRS is a free vector, merely a direction, typically of unit magnitude, and not bound
|
|
26
|
+
* to any particular spatial origin, such as the Earth, Sun or SSB. No assumptions are
|
|
27
|
+
* made about whether it represents starlight and embodies astrometric effects such as
|
|
28
|
+
* parallax or aberration. The transformation is approximately that between mean J2000.0
|
|
29
|
+
* right ascension and declination and ecliptic longitude and latitude, with only frame
|
|
30
|
+
* bias (always less than 25 mas) to disturb this classical picture.
|
|
31
|
+
*
|
|
32
|
+
* @param date1 TT as a 2-part Julian date (Note 1)
|
|
33
|
+
* @param date2 TT as a 2-part Julian date (Note 1)
|
|
34
|
+
* @returns rm: ICRS to ecliptic rotation matrix
|
|
35
|
+
*/
|
|
36
|
+
export function ecm06(date1: number, date2: number): Mat3 {
|
|
37
|
+
// Obliquity, IAU 2006.
|
|
38
|
+
const ob = obl06(date1, date2)
|
|
39
|
+
|
|
40
|
+
// Precession-bias matrix, IAU 2006.
|
|
41
|
+
const bp = pmat06(date1, date2)
|
|
42
|
+
|
|
43
|
+
// Equatorial of date to ecliptic matrix.
|
|
44
|
+
let e = ir()
|
|
45
|
+
e = rx(ob, e)
|
|
46
|
+
|
|
47
|
+
// ICRS to ecliptic coordinates rotation matrix, IAU 2006.
|
|
48
|
+
const rm = rxr(e, bp)
|
|
49
|
+
|
|
50
|
+
return rm
|
|
51
|
+
}
|
package/src/epb.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraEpb (epb.c); see LICENSE.
|
|
2
|
+
import { DJ00, DTY } from './constants.ts'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Julian Date to Besselian Epoch.
|
|
6
|
+
*
|
|
7
|
+
* Notes:
|
|
8
|
+
* 1. Besselian Epoch is a method of expressing a moment in time as a year plus fraction.
|
|
9
|
+
* It was superseded by Julian Year (see the function epj).
|
|
10
|
+
* 2. The start of a Besselian year is when the right ascension of the fictitious mean Sun
|
|
11
|
+
* is 18h 40m, and the unit is the tropical year. The conventional definition (see Lieske
|
|
12
|
+
* 1979) is that Besselian Epoch B1900.0 is JD 2415020.31352 and the length of the year
|
|
13
|
+
* is 365.242198781 days.
|
|
14
|
+
* 3. The time scale for the JD, originally Ephemeris Time, is TDB, which for all practical
|
|
15
|
+
* purposes in the present context is indistinguishable from TT.
|
|
16
|
+
* 4. The Julian Date is supplied in two pieces, in the usual ERFA manner, which is designed
|
|
17
|
+
* to preserve time resolution. The Julian Date is available as a single number by adding
|
|
18
|
+
* dj1 and dj2. The maximum resolution is achieved if dj1 is 2451545.0 (J2000.0).
|
|
19
|
+
*
|
|
20
|
+
* Reference: Lieske, J.H., 1979. Astron.Astrophys., 73, 282.
|
|
21
|
+
*
|
|
22
|
+
* @param dj1 Julian Date (Notes 3,4)
|
|
23
|
+
* @param dj2 Julian Date (Notes 3,4)
|
|
24
|
+
* @returns Besselian Epoch
|
|
25
|
+
*/
|
|
26
|
+
export function epb(dj1: number, dj2: number): number {
|
|
27
|
+
// J2000.0-B1900.0 (2415019.81352) in days
|
|
28
|
+
const D1900 = 36524.68648
|
|
29
|
+
|
|
30
|
+
return 1900.0 + ((dj1 - DJ00) + (dj2 + D1900)) / DTY
|
|
31
|
+
}
|
package/src/epb2jd.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraEpb2jd (epb2jd.c); see LICENSE.
|
|
2
|
+
import { DJM0, DTY } from './constants.ts'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Besselian Epoch to Julian Date.
|
|
6
|
+
*
|
|
7
|
+
* Note: The Julian Date is returned in two pieces, in the usual ERFA manner, which is
|
|
8
|
+
* designed to preserve time resolution. The Julian Date is available as a single number by
|
|
9
|
+
* adding djm0 and djm.
|
|
10
|
+
*
|
|
11
|
+
* Reference: Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
|
|
12
|
+
*
|
|
13
|
+
* @param epb Besselian Epoch (e.g. 1957.3)
|
|
14
|
+
* @returns [djm0, djm]: MJD zero-point (always 2400000.5) and Modified Julian Date
|
|
15
|
+
*/
|
|
16
|
+
export function epb2jd(epb: number): [djm0: number, djm: number] {
|
|
17
|
+
const djm0 = DJM0
|
|
18
|
+
const djm = 15019.81352 + (epb - 1900.0) * DTY
|
|
19
|
+
|
|
20
|
+
return [djm0, djm]
|
|
21
|
+
}
|
package/src/epj.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraEpj (epj.c); see LICENSE.
|
|
2
|
+
import { DJ00, DJY } from './constants.ts'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Julian Date to Julian Epoch.
|
|
6
|
+
*
|
|
7
|
+
* Notes:
|
|
8
|
+
* 1. Julian Epoch is a method of expressing a moment in time as a year plus fraction.
|
|
9
|
+
* 2. Julian Epoch J2000.0 is 2000 Jan 1.5, and the length of the year is 365.25 days.
|
|
10
|
+
* 3. For historical reasons, the time scale formally associated with Julian Epoch is TDB
|
|
11
|
+
* (or TT, near enough). However, Julian Epoch can be used more generally as a
|
|
12
|
+
* calendrical convention to represent other time scales such as TAI and TCB. This is
|
|
13
|
+
* analogous to Julian Date, which was originally defined specifically as a way of
|
|
14
|
+
* representing Universal Times but is now routinely used for any of the regular time
|
|
15
|
+
* scales.
|
|
16
|
+
* 4. The Julian Date is supplied in two pieces, in the usual ERFA manner, which is designed
|
|
17
|
+
* to preserve time resolution. The Julian Date is available as a single number by adding
|
|
18
|
+
* dj1 and dj2. The maximum resolution is achieved if dj1 is 2451545.0 (J2000.0).
|
|
19
|
+
*
|
|
20
|
+
* Reference: Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
|
|
21
|
+
*
|
|
22
|
+
* @param dj1 Julian Date (Note 4)
|
|
23
|
+
* @param dj2 Julian Date (Note 4)
|
|
24
|
+
* @returns Julian Epoch
|
|
25
|
+
*/
|
|
26
|
+
export function epj(dj1: number, dj2: number): number {
|
|
27
|
+
const epj = 2000.0 + ((dj1 - DJ00) + dj2) / DJY
|
|
28
|
+
|
|
29
|
+
return epj
|
|
30
|
+
}
|
package/src/epj2jd.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraEpj2jd (epj2jd.c); see LICENSE.
|
|
2
|
+
import { DJM0, DJM00 } from './constants.ts'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Julian Epoch to Julian Date.
|
|
6
|
+
*
|
|
7
|
+
* Note: The Julian Date is returned in two pieces, in the usual ERFA manner, which is
|
|
8
|
+
* designed to preserve time resolution. The Julian Date is available as a single number by
|
|
9
|
+
* adding djm0 and djm.
|
|
10
|
+
*
|
|
11
|
+
* Reference: Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
|
|
12
|
+
*
|
|
13
|
+
* @param epj Julian Epoch (e.g. 1996.8)
|
|
14
|
+
* @returns [djm0, djm]: MJD zero-point (always 2400000.5) and Modified Julian Date
|
|
15
|
+
*/
|
|
16
|
+
export function epj2jd(epj: number): [djm0: number, djm: number] {
|
|
17
|
+
const djm0 = DJM0
|
|
18
|
+
const djm = DJM00 + (epj - 2000.0) * 365.25
|
|
19
|
+
|
|
20
|
+
return [djm0, djm]
|
|
21
|
+
}
|
package/src/eqec06.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraEqec06 (eqec06.c); see LICENSE.
|
|
2
|
+
import { anp } from './anp.ts'
|
|
3
|
+
import { anpm } from './anpm.ts'
|
|
4
|
+
import { c2s } from './c2s.ts'
|
|
5
|
+
import { ecm06 } from './ecm06.ts'
|
|
6
|
+
import { rxp } from './rxp.ts'
|
|
7
|
+
import { s2c } from './s2c.ts'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Transformation from ICRS equatorial coordinates to ecliptic coordinates (mean equinox and
|
|
11
|
+
* ecliptic of date) using IAU 2006 precession model.
|
|
12
|
+
*
|
|
13
|
+
* Notes:
|
|
14
|
+
* 1. The TT date date1+date2 is a Julian Date, apportioned in any convenient way between
|
|
15
|
+
* the two arguments. For example, JD(TT)=2450123.7 could be given as (2450123.7, 0.0),
|
|
16
|
+
* the JD method; (2451545.0, -1421.3), the J2000 method; (2400000.5, 50123.2), the MJD
|
|
17
|
+
* method; or (2450123.5, 0.2), the date and time method. The J2000 method is best matched
|
|
18
|
+
* to the way the argument is handled internally and will deliver the optimum resolution.
|
|
19
|
+
* 2. No assumptions are made about whether the coordinates represent starlight and embody
|
|
20
|
+
* astrometric effects such as parallax or aberration.
|
|
21
|
+
* 3. The transformation is approximately that from mean J2000.0 right ascension and
|
|
22
|
+
* declination to ecliptic longitude and latitude (mean equinox and ecliptic of date),
|
|
23
|
+
* with only frame bias (always less than 25 mas) to disturb this classical picture.
|
|
24
|
+
*
|
|
25
|
+
* @param date1 TT as a 2-part Julian date (Note 1)
|
|
26
|
+
* @param date2 TT as a 2-part Julian date (Note 1)
|
|
27
|
+
* @param dr ICRS right ascension (radians)
|
|
28
|
+
* @param dd ICRS declination (radians)
|
|
29
|
+
* @returns [dl, db]: ecliptic longitude and latitude (radians)
|
|
30
|
+
*/
|
|
31
|
+
export function eqec06(
|
|
32
|
+
date1: number,
|
|
33
|
+
date2: number,
|
|
34
|
+
dr: number,
|
|
35
|
+
dd: number,
|
|
36
|
+
): [dl: number, db: number] {
|
|
37
|
+
// Spherical to Cartesian.
|
|
38
|
+
const v1 = s2c(dr, dd)
|
|
39
|
+
|
|
40
|
+
// Rotation matrix, ICRS equatorial to ecliptic.
|
|
41
|
+
const rm = ecm06(date1, date2)
|
|
42
|
+
|
|
43
|
+
// The transformation from ICRS to ecliptic.
|
|
44
|
+
const v2 = rxp(rm, v1)
|
|
45
|
+
|
|
46
|
+
// Cartesian to spherical.
|
|
47
|
+
const [a, b] = c2s(v2)
|
|
48
|
+
|
|
49
|
+
// Express in conventional ranges.
|
|
50
|
+
const dl = anp(a)
|
|
51
|
+
const db = anpm(b)
|
|
52
|
+
|
|
53
|
+
return [dl, db]
|
|
54
|
+
}
|
package/src/era00.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraEra00 (era00.c); see LICENSE.
|
|
2
|
+
import { anp } from './anp.ts'
|
|
3
|
+
import { D2PI, DJ00 } from './constants.ts'
|
|
4
|
+
import { fmod } from './internal.ts'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Earth rotation angle (IAU 2000 model).
|
|
8
|
+
*
|
|
9
|
+
* Notes:
|
|
10
|
+
* 1. The UT1 date dj1+dj2 is a Julian Date, apportioned in any convenient way between the
|
|
11
|
+
* arguments dj1 and dj2. For example, JD(UT1)=2450123.7 could be given as (2450123.7,
|
|
12
|
+
* 0.0), the JD method; (2451545.0, -1421.3), the J2000 method; (2400000.5, 50123.2), the
|
|
13
|
+
* MJD method; or (2450123.5, 0.2), the date and time method. The JD method is the most
|
|
14
|
+
* natural and convenient to use in cases where the loss of several decimal digits of
|
|
15
|
+
* resolution is acceptable. The J2000 and MJD methods are good compromises between
|
|
16
|
+
* resolution and convenience. The date & time method is best matched to the algorithm
|
|
17
|
+
* used: maximum precision is delivered when the dj1 argument is for 0hrs UT1 on the day
|
|
18
|
+
* in question and the dj2 argument lies in the range 0 to 1, or vice versa.
|
|
19
|
+
* 2. The algorithm is adapted from Expression 22 of Capitaine et al. 2000. The time argument
|
|
20
|
+
* has been expressed in days directly, and, to retain precision, integer contributions
|
|
21
|
+
* have been eliminated. The same formulation is given in IERS Conventions (2003), Chap.
|
|
22
|
+
* 5, Eq. 14.
|
|
23
|
+
*
|
|
24
|
+
* References:
|
|
25
|
+
* - Capitaine N., Guinot B. and McCarthy D.D, 2000, Astron. Astrophys., 355, 398-405.
|
|
26
|
+
* - McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), IERS Technical Note No. 32,
|
|
27
|
+
* BKG (2004)
|
|
28
|
+
*
|
|
29
|
+
* @param dj1 UT1 as a 2-part Julian Date (see note)
|
|
30
|
+
* @param dj2 UT1 as a 2-part Julian Date (see note)
|
|
31
|
+
* @returns Earth rotation angle (radians), range 0-2pi
|
|
32
|
+
*/
|
|
33
|
+
export function era00(dj1: number, dj2: number): number {
|
|
34
|
+
let d1: number, d2: number
|
|
35
|
+
|
|
36
|
+
// Days since fundamental epoch.
|
|
37
|
+
if (dj1 < dj2) {
|
|
38
|
+
d1 = dj1
|
|
39
|
+
d2 = dj2
|
|
40
|
+
} else {
|
|
41
|
+
d1 = dj2
|
|
42
|
+
d2 = dj1
|
|
43
|
+
}
|
|
44
|
+
const t = d1 + (d2 - DJ00)
|
|
45
|
+
|
|
46
|
+
// Fractional part of T (days).
|
|
47
|
+
const f = fmod(d1, 1.0) + fmod(d2, 1.0)
|
|
48
|
+
|
|
49
|
+
// Earth rotation angle at this UT1.
|
|
50
|
+
const theta = anp(D2PI * (f + 0.7790572732640
|
|
51
|
+
+ 0.00273781191135448 * t))
|
|
52
|
+
|
|
53
|
+
return theta
|
|
54
|
+
}
|
package/src/fw2m.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraFw2m (fw2m.c); see LICENSE.
|
|
2
|
+
import type { Mat3 } from './internal.ts'
|
|
3
|
+
import { ir } from './ir.ts'
|
|
4
|
+
import { rx } from './rx.ts'
|
|
5
|
+
import { rz } from './rz.ts'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Form rotation matrix given the Fukushima-Williams angles.
|
|
9
|
+
*
|
|
10
|
+
* Notes:
|
|
11
|
+
* 1. Naming the following points:
|
|
12
|
+
*
|
|
13
|
+
* e = J2000.0 ecliptic pole,
|
|
14
|
+
* p = GCRS pole,
|
|
15
|
+
* E = ecliptic pole of date,
|
|
16
|
+
* and P = CIP,
|
|
17
|
+
*
|
|
18
|
+
* the four Fukushima-Williams angles are as follows:
|
|
19
|
+
*
|
|
20
|
+
* gamb = gamma = epE
|
|
21
|
+
* phib = phi = pE
|
|
22
|
+
* psi = psi = pEP
|
|
23
|
+
* eps = epsilon = EP
|
|
24
|
+
*
|
|
25
|
+
* 2. The matrix representing the combined effects of frame bias, precession and nutation
|
|
26
|
+
* is:
|
|
27
|
+
*
|
|
28
|
+
* NxPxB = R_1(-eps).R_3(-psi).R_1(phib).R_3(gamb)
|
|
29
|
+
*
|
|
30
|
+
* 3. The present function can construct three different matrices, depending on which
|
|
31
|
+
* angles are supplied as the arguments gamb, phib, psi and eps:
|
|
32
|
+
* - To obtain the nutation x precession x frame bias matrix, first generate the four
|
|
33
|
+
* precession angles known conventionally as gamma_bar, phi_bar, psi_bar and
|
|
34
|
+
* epsilon_A, then generate the nutation components Dpsi and Depsilon and add them to
|
|
35
|
+
* psi_bar and epsilon_A, and finally call the present function using those four
|
|
36
|
+
* angles as arguments.
|
|
37
|
+
* - To obtain the precession x frame bias matrix, generate the four precession angles
|
|
38
|
+
* and call the present function.
|
|
39
|
+
* - To obtain the frame bias matrix, generate the four precession angles for date
|
|
40
|
+
* J2000.0 and call the present function.
|
|
41
|
+
*
|
|
42
|
+
* The nutation-only and precession-only matrices can if necessary be obtained by
|
|
43
|
+
* combining these three appropriately.
|
|
44
|
+
*
|
|
45
|
+
* References:
|
|
46
|
+
* - Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
|
|
47
|
+
* - Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
|
|
48
|
+
*
|
|
49
|
+
* @param gamb F-W angle gamma_bar (radians)
|
|
50
|
+
* @param phib F-W angle phi_bar (radians)
|
|
51
|
+
* @param psi F-W angle psi (radians)
|
|
52
|
+
* @param eps F-W angle epsilon (radians)
|
|
53
|
+
* @returns r: rotation matrix
|
|
54
|
+
*/
|
|
55
|
+
export function fw2m(gamb: number, phib: number, psi: number, eps: number): Mat3 {
|
|
56
|
+
// Construct the matrix.
|
|
57
|
+
let r = ir()
|
|
58
|
+
r = rz(gamb, r)
|
|
59
|
+
r = rx(phib, r)
|
|
60
|
+
r = rz(-psi, r)
|
|
61
|
+
r = rx(-eps, r)
|
|
62
|
+
|
|
63
|
+
return r
|
|
64
|
+
}
|
package/src/g2icrs.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraG2icrs (g2icrs.c); see LICENSE.
|
|
2
|
+
import { anp } from './anp.ts'
|
|
3
|
+
import { anpm } from './anpm.ts'
|
|
4
|
+
import { c2s } from './c2s.ts'
|
|
5
|
+
import type { Mat3 } from './internal.ts'
|
|
6
|
+
import { s2c } from './s2c.ts'
|
|
7
|
+
import { trxp } from './trxp.ts'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Transformation from Galactic coordinates to ICRS.
|
|
11
|
+
*
|
|
12
|
+
* Notes:
|
|
13
|
+
* 1. The IAU 1958 system of Galactic coordinates was defined with respect to the now
|
|
14
|
+
* obsolete reference system FK4 B1950.0. When interpreting the system in a modern
|
|
15
|
+
* context, several factors have to be taken into account:
|
|
16
|
+
* - The inclusion in FK4 positions of the E-terms of aberration.
|
|
17
|
+
* - The distortion of the FK4 proper motion system by differential Galactic rotation.
|
|
18
|
+
* - The use of the B1950.0 equinox rather than the now-standard J2000.0.
|
|
19
|
+
* - The frame bias between ICRS and the J2000.0 mean place system.
|
|
20
|
+
*
|
|
21
|
+
* The Hipparcos Catalogue (Perryman & ESA 1997) provides a rotation matrix that
|
|
22
|
+
* transforms directly between ICRS and Galactic coordinates with the above factors
|
|
23
|
+
* taken into account. The matrix is derived from three angles, namely the ICRS
|
|
24
|
+
* coordinates of the Galactic pole and the longitude of the ascending node of the
|
|
25
|
+
* Galactic equator on the ICRS equator. They are given in degrees to five decimal places
|
|
26
|
+
* and for canonical purposes are regarded as exact. In the Hipparcos Catalogue the
|
|
27
|
+
* matrix elements are given to 10 decimal places (about 20 microarcsec). In the present
|
|
28
|
+
* ERFA function the matrix elements have been recomputed from the canonical three angles
|
|
29
|
+
* and are given to 30 decimal places.
|
|
30
|
+
* 2. The inverse transformation is performed by the function icrs2g.
|
|
31
|
+
*
|
|
32
|
+
* Reference: Perryman M.A.C. & ESA, 1997, ESA SP-1200, The Hipparcos and Tycho catalogues.
|
|
33
|
+
* Astrometric and photometric star catalogues derived from the ESA Hipparcos Space Astrometry
|
|
34
|
+
* Mission. ESA Publications Division, Noordwijk, Netherlands.
|
|
35
|
+
*
|
|
36
|
+
* @param dl Galactic longitude (radians)
|
|
37
|
+
* @param db Galactic latitude (radians)
|
|
38
|
+
* @returns [dr, dd]: ICRS right ascension and declination (radians)
|
|
39
|
+
*/
|
|
40
|
+
export function g2icrs(dl: number, db: number): [dr: number, dd: number] {
|
|
41
|
+
/*
|
|
42
|
+
* L2,B2 system of Galactic coordinates in the form presented in the Hipparcos Catalogue.
|
|
43
|
+
* In degrees:
|
|
44
|
+
*
|
|
45
|
+
* P = 192.85948 right ascension of the Galactic north pole in ICRS
|
|
46
|
+
* Q = 27.12825 declination of the Galactic north pole in ICRS
|
|
47
|
+
* R = 32.93192 Galactic longitude of the ascending node of
|
|
48
|
+
* the Galactic equator on the ICRS equator
|
|
49
|
+
*
|
|
50
|
+
* ICRS to Galactic rotation matrix, obtained by computing
|
|
51
|
+
* R_3(-R) R_1(pi/2-Q) R_3(pi/2+P) to the full precision shown:
|
|
52
|
+
*/
|
|
53
|
+
const r: Mat3 = [ [ -0.054875560416215368492398900454,
|
|
54
|
+
-0.873437090234885048760383168409,
|
|
55
|
+
-0.483835015548713226831774175116 ],
|
|
56
|
+
[ +0.494109427875583673525222371358,
|
|
57
|
+
-0.444829629960011178146614061616,
|
|
58
|
+
+0.746982244497218890527388004556 ],
|
|
59
|
+
[ -0.867666149019004701181616534570,
|
|
60
|
+
-0.198076373431201528180486091412,
|
|
61
|
+
+0.455983776175066922272100478348 ] ]
|
|
62
|
+
|
|
63
|
+
// Spherical to Cartesian.
|
|
64
|
+
const v1 = s2c(dl, db)
|
|
65
|
+
|
|
66
|
+
// Galactic to ICRS.
|
|
67
|
+
const v2 = trxp(r, v1)
|
|
68
|
+
|
|
69
|
+
// Cartesian to spherical.
|
|
70
|
+
const [dr, dd] = c2s(v2)
|
|
71
|
+
|
|
72
|
+
// Express in conventional ranges.
|
|
73
|
+
return [anp(dr), anpm(dd)]
|
|
74
|
+
}
|
package/src/gmst06.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraGmst06 (gmst06.c); see LICENSE.
|
|
2
|
+
import { anp } from './anp.ts'
|
|
3
|
+
import { DAS2R, DJ00, DJC } from './constants.ts'
|
|
4
|
+
import { era00 } from './era00.ts'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Greenwich mean sidereal time (consistent with IAU 2006 precession).
|
|
8
|
+
*
|
|
9
|
+
* Notes:
|
|
10
|
+
* 1. The UT1 and TT dates uta+utb and tta+ttb respectively, are both Julian Dates,
|
|
11
|
+
* apportioned in any convenient way between the argument pairs. For example, JD=2450123.7
|
|
12
|
+
* could be given as (2450123.7, 0.0), the JD method; (2451545.0, -1421.3), the J2000
|
|
13
|
+
* method; (2400000.5, 50123.2), the MJD method; or (2450123.5, 0.2), the date and time
|
|
14
|
+
* method. The JD method is the most natural and convenient to use in cases where the loss
|
|
15
|
+
* of several decimal digits of resolution is acceptable (in the case of UT; the TT is not
|
|
16
|
+
* at all critical in this respect). The J2000 and MJD methods are good compromises
|
|
17
|
+
* between resolution and convenience. For UT, the date & time method is best matched to
|
|
18
|
+
* the algorithm that is used by the Earth rotation angle function, called internally:
|
|
19
|
+
* maximum precision is delivered when the uta argument is for 0hrs UT1 on the day in
|
|
20
|
+
* question and the utb argument lies in the range 0 to 1, or vice versa.
|
|
21
|
+
* 2. Both UT1 and TT are required, UT1 to predict the Earth rotation and TT to predict the
|
|
22
|
+
* effects of precession. If UT1 is used for both purposes, errors of order 100
|
|
23
|
+
* microarcseconds result.
|
|
24
|
+
* 3. This GMST is compatible with the IAU 2006 precession and must not be used with other
|
|
25
|
+
* precession models.
|
|
26
|
+
* 4. The result is returned in the range 0 to 2pi.
|
|
27
|
+
*
|
|
28
|
+
* Reference: Capitaine, N., Wallace, P.T. & Chapront, J., 2005, Astron.Astrophys. 432, 355
|
|
29
|
+
*
|
|
30
|
+
* @param uta UT1 as a 2-part Julian Date (Notes 1, 2)
|
|
31
|
+
* @param utb UT1 as a 2-part Julian Date (Notes 1, 2)
|
|
32
|
+
* @param tta TT as a 2-part Julian Date (Notes 1, 2)
|
|
33
|
+
* @param ttb TT as a 2-part Julian Date (Notes 1, 2)
|
|
34
|
+
* @returns Greenwich mean sidereal time (radians)
|
|
35
|
+
*/
|
|
36
|
+
export function gmst06(uta: number, utb: number, tta: number, ttb: number): number {
|
|
37
|
+
// TT Julian centuries since J2000.0.
|
|
38
|
+
const t = ((tta - DJ00) + ttb) / DJC
|
|
39
|
+
|
|
40
|
+
// Greenwich mean sidereal time, IAU 2006.
|
|
41
|
+
const gmst = anp(era00(uta, utb) +
|
|
42
|
+
( 0.014506 +
|
|
43
|
+
( 4612.156534 +
|
|
44
|
+
( 1.3915817 +
|
|
45
|
+
( -0.00000044 +
|
|
46
|
+
( -0.000029956 +
|
|
47
|
+
( -0.0000000368 )
|
|
48
|
+
* t) * t) * t) * t) * t) * DAS2R)
|
|
49
|
+
|
|
50
|
+
return gmst
|
|
51
|
+
}
|