@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/dist/utctai.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraUtctai (utctai.c); see LICENSE.
|
|
2
|
+
import { cal2jd } from './cal2jd.js';
|
|
3
|
+
import { DAYSEC } from './constants.js';
|
|
4
|
+
import { dat } from './dat.js';
|
|
5
|
+
import { jd2cal } from './jd2cal.js';
|
|
6
|
+
/**
|
|
7
|
+
* Time scale transformation: Coordinated Universal Time, UTC, to International Atomic Time,
|
|
8
|
+
* TAI.
|
|
9
|
+
*
|
|
10
|
+
* Notes:
|
|
11
|
+
* 1. utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any convenient way between
|
|
12
|
+
* the two arguments, for example where utc1 is the Julian Day Number and utc2 is the
|
|
13
|
+
* fraction of a day.
|
|
14
|
+
* 2. JD cannot unambiguously represent UTC during a leap second unless special measures are
|
|
15
|
+
* taken. The convention in the present function is that the JD day represents UTC days
|
|
16
|
+
* whether the length is 86399, 86400 or 86401 SI seconds. In the 1960-1972 era there
|
|
17
|
+
* were smaller jumps (in either direction) each time the linear UTC(TAI) expression was
|
|
18
|
+
* changed, and these "mini-leaps" are also included in the ERFA convention.
|
|
19
|
+
* 3. The warning status "dubious year" flags UTCs that predate the introduction of the time
|
|
20
|
+
* scale or that are too far in the future to be trusted. See dat for further details.
|
|
21
|
+
* 4. The function dtf2d converts from calendar date and time of day into 2-part Julian Date,
|
|
22
|
+
* and in the case of UTC implements the leap-second-ambiguity convention described above.
|
|
23
|
+
* 5. The returned tai1,tai2 are such that their sum is the TAI Julian Date.
|
|
24
|
+
* 6. Where the status is negative, tai1 and tai2 are NaN.
|
|
25
|
+
*
|
|
26
|
+
* References:
|
|
27
|
+
* - McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), IERS Technical Note No. 32,
|
|
28
|
+
* BKG (2004)
|
|
29
|
+
* - Explanatory Supplement to the Astronomical Almanac, P. Kenneth Seidelmann (ed),
|
|
30
|
+
* University Science Books (1992)
|
|
31
|
+
*
|
|
32
|
+
* @param utc1 UTC as a 2-part quasi Julian Date (Notes 1-4)
|
|
33
|
+
* @param utc2 UTC as a 2-part quasi Julian Date (Notes 1-4)
|
|
34
|
+
* @returns [tai1, tai2, status]: TAI as a 2-part Julian Date (Note 5), and status: +1 =
|
|
35
|
+
* dubious year (Note 3), 0 = OK, -1 = unacceptable date
|
|
36
|
+
*/
|
|
37
|
+
export function utctai(utc1, utc2) {
|
|
38
|
+
let u1, u2, tai1, tai2;
|
|
39
|
+
let iy, im, id, j, iyt, imt, idt;
|
|
40
|
+
let fd, dat0, dat12, dat24;
|
|
41
|
+
// Put the two parts of the UTC into big-first order.
|
|
42
|
+
const big1 = Math.abs(utc1) >= Math.abs(utc2);
|
|
43
|
+
if (big1) {
|
|
44
|
+
u1 = utc1;
|
|
45
|
+
u2 = utc2;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
u1 = utc2;
|
|
49
|
+
u2 = utc1;
|
|
50
|
+
}
|
|
51
|
+
// Get TAI-UTC at 0h today.
|
|
52
|
+
;
|
|
53
|
+
[iy, im, id, fd, j] = jd2cal(u1, u2);
|
|
54
|
+
if (j)
|
|
55
|
+
return [NaN, NaN, j];
|
|
56
|
+
[dat0, j] = dat(iy, im, id, 0.0);
|
|
57
|
+
if (j < 0)
|
|
58
|
+
return [NaN, NaN, j];
|
|
59
|
+
[dat12, j] = dat(iy, im, id, 0.5);
|
|
60
|
+
if (j < 0)
|
|
61
|
+
return [NaN, NaN, j];
|
|
62
|
+
[iyt, imt, idt, , j] = jd2cal(u1 + 1.5, u2 - fd);
|
|
63
|
+
if (j)
|
|
64
|
+
return [NaN, NaN, j];
|
|
65
|
+
[dat24, j] = dat(iyt, imt, idt, 0.0);
|
|
66
|
+
if (j < 0)
|
|
67
|
+
return [NaN, NaN, j];
|
|
68
|
+
// Separate TAI-UTC change into per-day (DLOD) and any jump (DLEAP).
|
|
69
|
+
const dlod = 2.0 * (dat12 - dat0);
|
|
70
|
+
const dleap = dat24 - (dat0 + dlod);
|
|
71
|
+
// Remove any scaling applied to spread leap into preceding day.
|
|
72
|
+
fd *= (DAYSEC + dleap) / DAYSEC;
|
|
73
|
+
// Scale from (pre-1972) UTC seconds to SI seconds.
|
|
74
|
+
fd *= (DAYSEC + dlod) / DAYSEC;
|
|
75
|
+
// Today's calendar date to 2-part JD.
|
|
76
|
+
const [z1, z2, jc] = cal2jd(iy, im, id);
|
|
77
|
+
if (jc)
|
|
78
|
+
return [NaN, NaN, -1];
|
|
79
|
+
// Assemble the TAI result, preserving the UTC split and order.
|
|
80
|
+
let a2 = z1 - u1;
|
|
81
|
+
a2 += z2;
|
|
82
|
+
a2 += fd + dat0 / DAYSEC;
|
|
83
|
+
if (big1) {
|
|
84
|
+
tai1 = u1;
|
|
85
|
+
tai2 = a2;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
tai1 = a2;
|
|
89
|
+
tai2 = u1;
|
|
90
|
+
}
|
|
91
|
+
// Status.
|
|
92
|
+
return [tai1, tai2, j];
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=utctai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utctai.js","sourceRoot":"","sources":["../src/utctai.ts"],"names":[],"mappings":"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"}
|
package/dist/utcut1.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time scale transformation: Coordinated Universal Time, UTC, to Universal Time, UT1.
|
|
3
|
+
*
|
|
4
|
+
* Notes:
|
|
5
|
+
* 1. utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any convenient way between
|
|
6
|
+
* the two arguments, for example where utc1 is the Julian Day Number and utc2 is the
|
|
7
|
+
* fraction of a day.
|
|
8
|
+
* 2. JD cannot unambiguously represent UTC during a leap second unless special measures are
|
|
9
|
+
* taken. The convention in the present function is that the JD day represents UTC days
|
|
10
|
+
* whether the length is 86399, 86400 or 86401 SI seconds.
|
|
11
|
+
* 3. The warning status "dubious year" flags UTCs that predate the introduction of the time
|
|
12
|
+
* scale or that are too far in the future to be trusted. See dat for further details.
|
|
13
|
+
* 4. The function dtf2d converts from calendar date and time of day into 2-part Julian Date,
|
|
14
|
+
* and in the case of UTC implements the leap-second-ambiguity convention described above.
|
|
15
|
+
* 5. Delta UT1 can be obtained from tabulations provided by the International Earth Rotation
|
|
16
|
+
* and Reference Systems Service. It is the caller's responsibility to supply a dut1
|
|
17
|
+
* argument containing the UT1-UTC value that matches the given UTC.
|
|
18
|
+
* 6. The returned ut11,ut12 are such that their sum is the UT1 Julian Date.
|
|
19
|
+
* 7. Where the status is negative, ut11 and ut12 are NaN.
|
|
20
|
+
*
|
|
21
|
+
* References:
|
|
22
|
+
* - McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), IERS Technical Note No. 32,
|
|
23
|
+
* BKG (2004)
|
|
24
|
+
* - Explanatory Supplement to the Astronomical Almanac, P. Kenneth Seidelmann (ed),
|
|
25
|
+
* University Science Books (1992)
|
|
26
|
+
*
|
|
27
|
+
* @param utc1 UTC as a 2-part quasi Julian Date (Notes 1-4)
|
|
28
|
+
* @param utc2 UTC as a 2-part quasi Julian Date (Notes 1-4)
|
|
29
|
+
* @param dut1 Delta UT1 = UT1-UTC in seconds (Note 5)
|
|
30
|
+
* @returns [ut11, ut12, status]: UT1 as a 2-part Julian Date (Note 6), and status: +1 =
|
|
31
|
+
* dubious year (Note 3), 0 = OK, -1 = unacceptable date
|
|
32
|
+
*/
|
|
33
|
+
export declare function utcut1(utc1: number, utc2: number, dut1: number): [ut11: number, ut12: number, status: number];
|
|
34
|
+
//# sourceMappingURL=utcut1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utcut1.d.ts","sourceRoot":"","sources":["../src/utcut1.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAsB9C"}
|
package/dist/utcut1.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraUtcut1 (utcut1.c); see LICENSE.
|
|
2
|
+
// eraDat's result is the variable dat in C, so the function is imported as eraDat here.
|
|
3
|
+
import { dat as eraDat } from './dat.js';
|
|
4
|
+
import { jd2cal } from './jd2cal.js';
|
|
5
|
+
import { taiut1 } from './taiut1.js';
|
|
6
|
+
import { utctai } from './utctai.js';
|
|
7
|
+
/**
|
|
8
|
+
* Time scale transformation: Coordinated Universal Time, UTC, to Universal Time, UT1.
|
|
9
|
+
*
|
|
10
|
+
* Notes:
|
|
11
|
+
* 1. utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any convenient way between
|
|
12
|
+
* the two arguments, for example where utc1 is the Julian Day Number and utc2 is the
|
|
13
|
+
* fraction of a day.
|
|
14
|
+
* 2. JD cannot unambiguously represent UTC during a leap second unless special measures are
|
|
15
|
+
* taken. The convention in the present function is that the JD day represents UTC days
|
|
16
|
+
* whether the length is 86399, 86400 or 86401 SI seconds.
|
|
17
|
+
* 3. The warning status "dubious year" flags UTCs that predate the introduction of the time
|
|
18
|
+
* scale or that are too far in the future to be trusted. See dat for further details.
|
|
19
|
+
* 4. The function dtf2d converts from calendar date and time of day into 2-part Julian Date,
|
|
20
|
+
* and in the case of UTC implements the leap-second-ambiguity convention described above.
|
|
21
|
+
* 5. Delta UT1 can be obtained from tabulations provided by the International Earth Rotation
|
|
22
|
+
* and Reference Systems Service. It is the caller's responsibility to supply a dut1
|
|
23
|
+
* argument containing the UT1-UTC value that matches the given UTC.
|
|
24
|
+
* 6. The returned ut11,ut12 are such that their sum is the UT1 Julian Date.
|
|
25
|
+
* 7. Where the status is negative, ut11 and ut12 are NaN.
|
|
26
|
+
*
|
|
27
|
+
* References:
|
|
28
|
+
* - McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), IERS Technical Note No. 32,
|
|
29
|
+
* BKG (2004)
|
|
30
|
+
* - Explanatory Supplement to the Astronomical Almanac, P. Kenneth Seidelmann (ed),
|
|
31
|
+
* University Science Books (1992)
|
|
32
|
+
*
|
|
33
|
+
* @param utc1 UTC as a 2-part quasi Julian Date (Notes 1-4)
|
|
34
|
+
* @param utc2 UTC as a 2-part quasi Julian Date (Notes 1-4)
|
|
35
|
+
* @param dut1 Delta UT1 = UT1-UTC in seconds (Note 5)
|
|
36
|
+
* @returns [ut11, ut12, status]: UT1 as a 2-part Julian Date (Note 6), and status: +1 =
|
|
37
|
+
* dubious year (Note 3), 0 = OK, -1 = unacceptable date
|
|
38
|
+
*/
|
|
39
|
+
export function utcut1(utc1, utc2, dut1) {
|
|
40
|
+
// Look up TAI-UTC.
|
|
41
|
+
const [iy, im, id, , jc] = jd2cal(utc1, utc2);
|
|
42
|
+
if (jc)
|
|
43
|
+
return [NaN, NaN, -1];
|
|
44
|
+
let [dat, js] = eraDat(iy, im, id, 0.0);
|
|
45
|
+
if (js < 0)
|
|
46
|
+
return [NaN, NaN, -1];
|
|
47
|
+
// Form UT1-TAI.
|
|
48
|
+
const dta = dut1 - dat;
|
|
49
|
+
// UTC to TAI to UT1.
|
|
50
|
+
const [tai1, tai2, jw] = utctai(utc1, utc2);
|
|
51
|
+
if (jw < 0) {
|
|
52
|
+
return [NaN, NaN, -1];
|
|
53
|
+
}
|
|
54
|
+
else if (jw > 0) {
|
|
55
|
+
js = jw;
|
|
56
|
+
}
|
|
57
|
+
const [ut11, ut12, jt] = taiut1(tai1, tai2, dta);
|
|
58
|
+
if (jt)
|
|
59
|
+
return [NaN, NaN, -1];
|
|
60
|
+
// Status.
|
|
61
|
+
return [ut11, ut12, js];
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=utcut1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utcut1.js","sourceRoot":"","sources":["../src/utcut1.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,wFAAwF;AACxF,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,MAAM,CACpB,IAAY,EACZ,IAAY,EACZ,IAAY;IAEZ,mBAAmB;IACnB,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,AAAD,EAAG,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAC7C,IAAI,EAAE;QAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IAC7B,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IACvC,IAAI,EAAE,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IAEjC,gBAAgB;IAChB,MAAM,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;IAEtB,qBAAqB;IACrB,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAC3C,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;SAAM,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QAClB,EAAE,GAAG,EAAE,CAAA;IACT,CAAC;IACD,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAChD,IAAI,EAAE;QAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IAE7B,UAAU;IACV,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;AACzB,CAAC"}
|
package/dist/zp.d.ts
ADDED
package/dist/zp.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zp.d.ts","sourceRoot":"","sources":["../src/zp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEzC;;;;GAIG;AACH,wBAAgB,EAAE,IAAI,IAAI,CAEzB"}
|
package/dist/zp.js
ADDED
package/dist/zp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zp.js","sourceRoot":"","sources":["../src/zp.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,UAAU,EAAE;IAChB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AACxB,CAAC"}
|
package/dist/zpv.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zpv.d.ts","sourceRoot":"","sources":["../src/zpv.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAGvC;;;;GAIG;AACH,wBAAgB,GAAG,IAAI,EAAE,CAExB"}
|
package/dist/zpv.js
ADDED
package/dist/zpv.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zpv.js","sourceRoot":"","sources":["../src/zpv.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B;;;;GAIG;AACH,MAAM,UAAU,GAAG;IACjB,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AACrB,CAAC"}
|
package/dist/zr.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Mat3 } from './internal.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Initialize an r-matrix to the null matrix. ERFA sets its argument in place; this returns
|
|
4
|
+
* a new null matrix.
|
|
5
|
+
*
|
|
6
|
+
* @returns r: r-matrix
|
|
7
|
+
*/
|
|
8
|
+
export declare function zr(): Mat3;
|
|
9
|
+
//# sourceMappingURL=zr.d.ts.map
|
package/dist/zr.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zr.d.ts","sourceRoot":"","sources":["../src/zr.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEzC;;;;;GAKG;AACH,wBAAgB,EAAE,IAAI,IAAI,CAMzB"}
|
package/dist/zr.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize an r-matrix to the null matrix. ERFA sets its argument in place; this returns
|
|
3
|
+
* a new null matrix.
|
|
4
|
+
*
|
|
5
|
+
* @returns r: r-matrix
|
|
6
|
+
*/
|
|
7
|
+
export function zr() {
|
|
8
|
+
return [
|
|
9
|
+
[0.0, 0.0, 0.0],
|
|
10
|
+
[0.0, 0.0, 0.0],
|
|
11
|
+
[0.0, 0.0, 0.0],
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=zr.js.map
|
package/dist/zr.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zr.js","sourceRoot":"","sources":["../src/zr.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,UAAU,EAAE;IAChB,OAAO;QACL,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;QACf,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;QACf,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;KAChB,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcosmos/erfa",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "ERFA, the Essential Routines for Fundamental Astronomy, translated line for line to TypeScript. One module per function.",
|
|
5
|
+
"license": "BSD-3-Clause",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Arcvos/arcosmos.git",
|
|
9
|
+
"directory": "packages/erfa"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Arcvos/arcosmos/tree/master/packages/erfa#readme",
|
|
12
|
+
"bugs": "https://github.com/Arcvos/arcosmos/issues",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"astronomy",
|
|
15
|
+
"erfa",
|
|
16
|
+
"sofa",
|
|
17
|
+
"iau",
|
|
18
|
+
"astrometry",
|
|
19
|
+
"time-scales",
|
|
20
|
+
"precession",
|
|
21
|
+
"coordinates"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"typescript": "^7.0.2",
|
|
38
|
+
"vitest": "4.1.12"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc -p tsconfig.build.json",
|
|
42
|
+
"typecheck": "tsc --noEmit -p .",
|
|
43
|
+
"test": "vitest run"
|
|
44
|
+
}
|
|
6
45
|
}
|
package/src/a2af.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraA2af (a2af.c); see LICENSE.
|
|
2
|
+
import { D2PI } from './constants.ts'
|
|
3
|
+
import { d2tf } from './d2tf.ts'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Decompose radians into degrees, arcminutes, arcseconds, fraction.
|
|
7
|
+
*
|
|
8
|
+
* Notes:
|
|
9
|
+
* 1. The argument ndp is interpreted as follows:
|
|
10
|
+
*
|
|
11
|
+
* ndp resolution
|
|
12
|
+
* : ...0000 00 00
|
|
13
|
+
* -7 1000 00 00
|
|
14
|
+
* -6 100 00 00
|
|
15
|
+
* -5 10 00 00
|
|
16
|
+
* -4 1 00 00
|
|
17
|
+
* -3 0 10 00
|
|
18
|
+
* -2 0 01 00
|
|
19
|
+
* -1 0 00 10
|
|
20
|
+
* 0 0 00 01
|
|
21
|
+
* 1 0 00 00.1
|
|
22
|
+
* 2 0 00 00.01
|
|
23
|
+
* 3 0 00 00.001
|
|
24
|
+
* : 0 00 00.000...
|
|
25
|
+
*
|
|
26
|
+
* 2. The largest positive useful value for ndp is determined by the size of angle, the
|
|
27
|
+
* format of doubles on the target platform, and the risk of overflowing idmsf[3]. On a
|
|
28
|
+
* typical platform, for angle up to 2pi, the available floating-point precision might
|
|
29
|
+
* correspond to ndp=12. In C the practical limit is typically ndp=9, set by the capacity
|
|
30
|
+
* of a 32-bit int; here the fields are numbers, exact as integers up to 2^53.
|
|
31
|
+
* 3. The absolute value of angle may exceed 2pi. In cases where it does not, it is up to
|
|
32
|
+
* the caller to test for and handle the case where angle is very nearly 2pi and rounds
|
|
33
|
+
* up to 360 degrees, by testing for idmsf[0]=360 and setting idmsf[0-3] to zero.
|
|
34
|
+
*
|
|
35
|
+
* @param ndp resolution (Note 1)
|
|
36
|
+
* @param angle angle in radians
|
|
37
|
+
* @returns [sign, idmsf]: '+' or '-', and degrees, arcminutes, arcseconds, fraction
|
|
38
|
+
*/
|
|
39
|
+
export function a2af(
|
|
40
|
+
ndp: number,
|
|
41
|
+
angle: number,
|
|
42
|
+
): [sign: '+' | '-', idmsf: [number, number, number, number]] {
|
|
43
|
+
// Hours to degrees * radians to turns
|
|
44
|
+
const F = 15.0 / D2PI
|
|
45
|
+
|
|
46
|
+
// Scale then use days to h,m,s function.
|
|
47
|
+
return d2tf(ndp, angle * F)
|
|
48
|
+
}
|
package/src/a2tf.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraA2tf (a2tf.c); see LICENSE.
|
|
2
|
+
import { D2PI } from './constants.ts'
|
|
3
|
+
import { d2tf } from './d2tf.ts'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Decompose radians into hours, minutes, seconds, fraction.
|
|
7
|
+
*
|
|
8
|
+
* Notes:
|
|
9
|
+
* 1. The argument ndp is interpreted as follows:
|
|
10
|
+
*
|
|
11
|
+
* ndp resolution
|
|
12
|
+
* : ...0000 00 00
|
|
13
|
+
* -7 1000 00 00
|
|
14
|
+
* -6 100 00 00
|
|
15
|
+
* -5 10 00 00
|
|
16
|
+
* -4 1 00 00
|
|
17
|
+
* -3 0 10 00
|
|
18
|
+
* -2 0 01 00
|
|
19
|
+
* -1 0 00 10
|
|
20
|
+
* 0 0 00 01
|
|
21
|
+
* 1 0 00 00.1
|
|
22
|
+
* 2 0 00 00.01
|
|
23
|
+
* 3 0 00 00.001
|
|
24
|
+
* : 0 00 00.000...
|
|
25
|
+
*
|
|
26
|
+
* 2. The largest positive useful value for ndp is determined by the size of angle, the
|
|
27
|
+
* format of doubles on the target platform, and the risk of overflowing ihmsf[3]. On a
|
|
28
|
+
* typical platform, for angle up to 2pi, the available floating-point precision might
|
|
29
|
+
* correspond to ndp=12. In C the practical limit is typically ndp=9, set by the capacity
|
|
30
|
+
* of a 32-bit int; here the fields are numbers, exact as integers up to 2^53.
|
|
31
|
+
* 3. The absolute value of angle may exceed 2pi. In cases where it does not, it is up to
|
|
32
|
+
* the caller to test for and handle the case where angle is very nearly 2pi and rounds
|
|
33
|
+
* up to 24 hours, by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero.
|
|
34
|
+
*
|
|
35
|
+
* @param ndp resolution (Note 1)
|
|
36
|
+
* @param angle angle in radians
|
|
37
|
+
* @returns [sign, ihmsf]: '+' or '-', and hours, minutes, seconds, fraction
|
|
38
|
+
*/
|
|
39
|
+
export function a2tf(
|
|
40
|
+
ndp: number,
|
|
41
|
+
angle: number,
|
|
42
|
+
): [sign: '+' | '-', ihmsf: [number, number, number, number]] {
|
|
43
|
+
// Scale then use days to h,m,s function.
|
|
44
|
+
return d2tf(ndp, angle / D2PI)
|
|
45
|
+
}
|
package/src/af2a.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraAf2a (af2a.c); see LICENSE.
|
|
2
|
+
import { DAS2R } from './constants.ts'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Convert degrees, arcminutes, arcseconds to radians.
|
|
6
|
+
*
|
|
7
|
+
* Notes:
|
|
8
|
+
* 1. The result is computed even if any of the range checks fail.
|
|
9
|
+
* 2. Negative ideg, iamin and/or asec produce a warning status, but the absolute value is
|
|
10
|
+
* used in the conversion.
|
|
11
|
+
* 3. If there are multiple errors, the status value reflects only the first, the smallest
|
|
12
|
+
* taking precedence.
|
|
13
|
+
*
|
|
14
|
+
* @param s sign: '-' = negative, otherwise positive
|
|
15
|
+
* @param ideg degrees (an integer in C)
|
|
16
|
+
* @param iamin arcminutes (an integer in C)
|
|
17
|
+
* @param asec arcseconds
|
|
18
|
+
* @returns [rad, status]: angle in radians, and status: 0 = OK, 1 = ideg outside range
|
|
19
|
+
* 0-359, 2 = iamin outside range 0-59, 3 = asec outside range 0-59.999...
|
|
20
|
+
*/
|
|
21
|
+
export function af2a(
|
|
22
|
+
s: string,
|
|
23
|
+
ideg: number,
|
|
24
|
+
iamin: number,
|
|
25
|
+
asec: number,
|
|
26
|
+
): [rad: number, status: number] {
|
|
27
|
+
// Compute the interval.
|
|
28
|
+
const rad =
|
|
29
|
+
(s === '-' ? -1.0 : 1.0) *
|
|
30
|
+
(60.0 * (60.0 * Math.abs(ideg) + Math.abs(iamin)) + Math.abs(asec)) *
|
|
31
|
+
DAS2R
|
|
32
|
+
|
|
33
|
+
// Validate arguments and return status.
|
|
34
|
+
if (ideg < 0 || ideg > 359) return [rad, 1]
|
|
35
|
+
if (iamin < 0 || iamin > 59) return [rad, 2]
|
|
36
|
+
if (asec < 0.0 || asec >= 60.0) return [rad, 3]
|
|
37
|
+
return [rad, 0]
|
|
38
|
+
}
|
package/src/anp.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraAnp (anp.c); see LICENSE.
|
|
2
|
+
import { D2PI } from './constants.ts'
|
|
3
|
+
import { fmod } from './internal.ts'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Normalize angle into the range 0 <= a < 2pi.
|
|
7
|
+
*
|
|
8
|
+
* @param a angle (radians)
|
|
9
|
+
* @returns angle in range 0-2pi
|
|
10
|
+
*/
|
|
11
|
+
export function anp(a: number): number {
|
|
12
|
+
let w = fmod(a, D2PI)
|
|
13
|
+
if (w < 0) w += D2PI
|
|
14
|
+
return w
|
|
15
|
+
}
|
package/src/anpm.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraAnpm (anpm.c); see LICENSE.
|
|
2
|
+
import { D2PI, DPI } from './constants.ts'
|
|
3
|
+
import { dsign, fmod } from './internal.ts'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Normalize angle into the range -pi <= a < +pi.
|
|
7
|
+
*
|
|
8
|
+
* @param a angle (radians)
|
|
9
|
+
* @returns angle in range +/-pi
|
|
10
|
+
*/
|
|
11
|
+
export function anpm(a: number): number {
|
|
12
|
+
let w = fmod(a, D2PI)
|
|
13
|
+
if (Math.abs(w) >= DPI) w -= dsign(D2PI, a)
|
|
14
|
+
return w
|
|
15
|
+
}
|
package/src/bi00.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraBi00 (bi00.c); see LICENSE.
|
|
2
|
+
import { DAS2R } from './constants.ts'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Frame bias components of IAU 2000 precession-nutation models; part of the
|
|
6
|
+
* Mathews-Herring-Buffett (MHB2000) nutation series, with additions.
|
|
7
|
+
*
|
|
8
|
+
* Notes:
|
|
9
|
+
* 1. The frame bias corrections in longitude and obliquity (radians) are required in order
|
|
10
|
+
* to correct for the offset between the GCRS pole and the mean J2000.0 pole. They
|
|
11
|
+
* define, with respect to the GCRS frame, a J2000.0 mean pole that is consistent with
|
|
12
|
+
* the rest of the IAU 2000A precession-nutation model.
|
|
13
|
+
* 2. In addition to the displacement of the pole, the complete description of the frame
|
|
14
|
+
* bias requires also an offset in right ascension. This is not part of the IAU 2000A
|
|
15
|
+
* model, and is from Chapront et al. (2002). It is returned in radians.
|
|
16
|
+
* 3. This is a supplemented implementation of one aspect of the IAU 2000A nutation model,
|
|
17
|
+
* formally adopted by the IAU General Assembly in 2000, namely MHB2000 (Mathews et al.
|
|
18
|
+
* 2002).
|
|
19
|
+
*
|
|
20
|
+
* References:
|
|
21
|
+
* - Chapront, J., Chapront-Touze, M. & Francou, G., Astron.Astrophys., 387, 700, 2002.
|
|
22
|
+
* - Mathews, P.M., Herring, T.A., Buffet, B.A., "Modeling of nutation and precession: New
|
|
23
|
+
* nutation series for nonrigid Earth and insights into the Earth's interior",
|
|
24
|
+
* J.Geophys.Res., 107, B4, 2002.
|
|
25
|
+
*
|
|
26
|
+
* @returns [dpsibi, depsbi, dra]: longitude and obliquity corrections, and the ICRS RA of
|
|
27
|
+
* the J2000.0 mean equinox (radians)
|
|
28
|
+
*/
|
|
29
|
+
export function bi00(): [dpsibi: number, depsbi: number, dra: number] {
|
|
30
|
+
// The frame bias corrections in longitude and obliquity
|
|
31
|
+
const DPBIAS = -0.041775 * DAS2R
|
|
32
|
+
const DEBIAS = -0.0068192 * DAS2R
|
|
33
|
+
|
|
34
|
+
// The ICRS RA of the J2000.0 equinox (Chapront et al., 2002)
|
|
35
|
+
const DRA0 = -0.0146 * DAS2R
|
|
36
|
+
|
|
37
|
+
// Return the results (which are fixed).
|
|
38
|
+
const dpsibi = DPBIAS
|
|
39
|
+
const depsbi = DEBIAS
|
|
40
|
+
const dra = DRA0
|
|
41
|
+
return [dpsibi, depsbi, dra]
|
|
42
|
+
}
|
package/src/bp06.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraBp06 (bp06.c); see LICENSE.
|
|
2
|
+
import { DJM0, DJM00 } from './constants.ts'
|
|
3
|
+
import { cr } from './cr.ts'
|
|
4
|
+
import { fw2m } from './fw2m.ts'
|
|
5
|
+
import type { Mat3 } from './internal.ts'
|
|
6
|
+
import { pfw06 } from './pfw06.ts'
|
|
7
|
+
import { pmat06 } from './pmat06.ts'
|
|
8
|
+
import { rxr } from './rxr.ts'
|
|
9
|
+
import { tr } from './tr.ts'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Frame bias and precession, IAU 2006.
|
|
13
|
+
*
|
|
14
|
+
* Notes:
|
|
15
|
+
* 1. The TT date date1+date2 is a Julian Date, apportioned in any convenient way between
|
|
16
|
+
* the two arguments. For example, JD(TT)=2450123.7 could be given as (2450123.7, 0.0),
|
|
17
|
+
* the JD method; (2451545.0, -1421.3), the J2000 method; (2400000.5, 50123.2), the MJD
|
|
18
|
+
* method; or (2450123.5, 0.2), the date and time method. The J2000 method is best matched
|
|
19
|
+
* to the way the argument is handled internally and will deliver the optimum resolution.
|
|
20
|
+
* 2. The matrix rb transforms vectors from GCRS to mean J2000.0 by applying frame bias.
|
|
21
|
+
* 3. The matrix rp transforms vectors from mean J2000.0 to mean of date by applying
|
|
22
|
+
* precession.
|
|
23
|
+
* 4. The matrix rbp transforms vectors from GCRS to mean of date by applying frame bias then
|
|
24
|
+
* precession. It is the product rp x rb.
|
|
25
|
+
*
|
|
26
|
+
* References:
|
|
27
|
+
* - Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
|
|
28
|
+
* - Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981
|
|
29
|
+
*
|
|
30
|
+
* @param date1 TT as a 2-part Julian Date (Note 1)
|
|
31
|
+
* @param date2 TT as a 2-part Julian Date (Note 1)
|
|
32
|
+
* @returns [rb, rp, rbp]: frame bias matrix (Note 2), precession matrix (Note 3) and
|
|
33
|
+
* bias-precession matrix (Note 4)
|
|
34
|
+
*/
|
|
35
|
+
export function bp06(date1: number, date2: number): [rb: Mat3, rp: Mat3, rbp: Mat3] {
|
|
36
|
+
// B matrix.
|
|
37
|
+
const [gamb, phib, psib, epsa] = pfw06(DJM0, DJM00)
|
|
38
|
+
const rb = fw2m(gamb, phib, psib, epsa)
|
|
39
|
+
|
|
40
|
+
// PxB matrix (temporary).
|
|
41
|
+
const rbpw = pmat06(date1, date2)
|
|
42
|
+
|
|
43
|
+
// P matrix.
|
|
44
|
+
const rbt = tr(rb)
|
|
45
|
+
const rp = rxr(rbpw, rbt)
|
|
46
|
+
|
|
47
|
+
// PxB matrix.
|
|
48
|
+
const rbp = cr(rbpw)
|
|
49
|
+
|
|
50
|
+
return [rb, rp, rbp]
|
|
51
|
+
}
|
package/src/c2s.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Translated from ERFA 2.0.1 eraC2s (c2s.c); see LICENSE.
|
|
2
|
+
import type { Vec3 } from './internal.ts'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* P-vector to spherical coordinates.
|
|
6
|
+
*
|
|
7
|
+
* Notes:
|
|
8
|
+
* 1. The vector p can have any magnitude; only its direction is used.
|
|
9
|
+
* 2. If p is null, zero theta and phi are returned.
|
|
10
|
+
* 3. At either pole, zero theta is returned.
|
|
11
|
+
*
|
|
12
|
+
* @param p p-vector
|
|
13
|
+
* @returns [theta, phi]: longitude angle and latitude angle (radians)
|
|
14
|
+
*/
|
|
15
|
+
export function c2s(p: Vec3): [theta: number, phi: number] {
|
|
16
|
+
const x = p[0]
|
|
17
|
+
const y = p[1]
|
|
18
|
+
const z = p[2]
|
|
19
|
+
const d2 = x * x + y * y
|
|
20
|
+
const theta = d2 === 0.0 ? 0.0 : Math.atan2(y, x)
|
|
21
|
+
const phi = z === 0.0 ? 0.0 : Math.atan2(z, Math.sqrt(d2))
|
|
22
|
+
return [theta, phi]
|
|
23
|
+
}
|