From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- math/slalib/Makefile.am | 76 + math/slalib/Notes | 23 + math/slalib/README | 233 + math/slalib/SED1 | 214 + math/slalib/SED2 | 132 + math/slalib/SLA_CONDITIONS | 280 + math/slalib/addet.f | 85 + math/slalib/afin.f | 120 + math/slalib/airmas.f | 76 + math/slalib/altaz.f | 163 + math/slalib/amp.f | 89 + math/slalib/ampqk.f | 140 + math/slalib/aop.f | 192 + math/slalib/aoppa.f | 194 + math/slalib/aoppat.f | 63 + math/slalib/aopqk.f | 260 + math/slalib/atmdsp.f | 141 + math/slalib/atms.f | 58 + math/slalib/atmt.f | 72 + math/slalib/av2m.f | 85 + math/slalib/bear.f | 60 + math/slalib/caf2r.f | 75 + math/slalib/caldj.f | 75 + math/slalib/calyd.f | 83 + math/slalib/cc2s.f | 70 + math/slalib/cc62s.f | 100 + math/slalib/cd2tf.f | 73 + math/slalib/cldj.f | 95 + math/slalib/clyd.f | 119 + math/slalib/combn.f | 160 + math/slalib/configure.ac | 134 + math/slalib/cr2af.f | 76 + math/slalib/cr2tf.f | 76 + math/slalib/cs2c.f | 58 + math/slalib/cs2c6.f | 73 + math/slalib/ctf2d.f | 74 + math/slalib/ctf2r.f | 72 + math/slalib/daf2r.f | 73 + math/slalib/dafin.f | 181 + math/slalib/dat.f | 232 + math/slalib/dav2m.f | 84 + math/slalib/dbear.f | 60 + math/slalib/dbjin.f | 131 + math/slalib/dc62s.f | 100 + math/slalib/dcc2s.f | 70 + math/slalib/dcmpf.f | 160 + math/slalib/dcs2c.f | 57 + math/slalib/dd2tf.f | 107 + math/slalib/de2h.f | 107 + math/slalib/deuler.f | 181 + math/slalib/dfltin.f | 298 + math/slalib/dh2e.f | 101 + math/slalib/dimxv.f | 69 + math/slalib/djcal.f | 93 + math/slalib/djcl.f | 84 + math/slalib/dm2av.f | 75 + math/slalib/dmat.f | 158 + math/slalib/dmoon.f | 659 ++ math/slalib/dmxm.f | 73 + math/slalib/dmxv.f | 69 + math/slalib/doc/addet.hlp | 42 + math/slalib/doc/afin.hlp | 91 + math/slalib/doc/airmas.hlp | 51 + math/slalib/doc/altaz.hlp | 79 + math/slalib/doc/amp.hlp | 61 + math/slalib/doc/ampqk.hlp | 65 + math/slalib/doc/aop.hlp | 166 + math/slalib/doc/aoppa.hlp | 114 + math/slalib/doc/aoppat.hlp | 39 + math/slalib/doc/aopqk.hlp | 131 + math/slalib/doc/atmdsp.hlp | 75 + math/slalib/doc/av2m.hlp | 37 + math/slalib/doc/bear.hlp | 30 + math/slalib/doc/caf2r.hlp | 38 + math/slalib/doc/caldj.hlp | 38 + math/slalib/doc/calyd.hlp | 49 + math/slalib/doc/cc2s.hlp | 33 + math/slalib/doc/cc62s.hlp | 30 + math/slalib/doc/cd2tf.hlp | 47 + math/slalib/doc/cldj.hlp | 34 + math/slalib/doc/clyd.hlp | 50 + math/slalib/doc/cr2af.hlp | 46 + math/slalib/doc/cr2tf.hlp | 46 + math/slalib/doc/cs2c.hlp | 31 + math/slalib/doc/cs2c6.hlp | 30 + math/slalib/doc/ctf2d.hlp | 37 + math/slalib/doc/ctf2r.hlp | 40 + math/slalib/doc/daf2r.hlp | 36 + math/slalib/doc/dafin.hlp | 90 + math/slalib/doc/dat.hlp | 55 + math/slalib/doc/dav2m.hlp | 36 + math/slalib/doc/dbear.hlp | 30 + math/slalib/doc/dbjin.hlp | 52 + math/slalib/doc/dc62s.hlp | 30 + math/slalib/doc/dcc2s.hlp | 33 + math/slalib/doc/dcmpf.hlp | 70 + math/slalib/doc/dcs2c.hlp | 31 + math/slalib/doc/dd2tf.hlp | 44 + math/slalib/doc/de2h.hlp | 59 + math/slalib/doc/deuler.hlp | 50 + math/slalib/doc/dfltin.hlp | 118 + math/slalib/doc/dh2e.hlp | 58 + math/slalib/doc/dimxv.hlp | 32 + math/slalib/doc/djcal.hlp | 38 + math/slalib/doc/djcl.hlp | 34 + math/slalib/doc/dm2av.hlp | 38 + math/slalib/doc/dmat.hlp | 58 + math/slalib/doc/dmoon.hlp | 58 + math/slalib/doc/dmxm.hlp | 34 + math/slalib/doc/dmxv.hlp | 29 + math/slalib/doc/dpav.hlp | 38 + math/slalib/doc/dr2af.hlp | 46 + math/slalib/doc/dr2tf.hlp | 46 + math/slalib/doc/drange.hlp | 23 + math/slalib/doc/dranrm.hlp | 24 + math/slalib/doc/ds2c6.hlp | 32 + math/slalib/doc/ds2tp.hlp | 30 + math/slalib/doc/dsep.hlp | 29 + math/slalib/doc/dt.hlp | 55 + math/slalib/doc/dtf2d.hlp | 36 + math/slalib/doc/dtf2r.hlp | 39 + math/slalib/doc/dtp2s.hlp | 28 + math/slalib/doc/dtp2v.hlp | 40 + math/slalib/doc/dtps2c.hlp | 58 + math/slalib/doc/dtpv2c.hlp | 51 + math/slalib/doc/dtt.hlp | 41 + math/slalib/doc/dv2tp.hlp | 42 + math/slalib/doc/dvdv.hlp | 24 + math/slalib/doc/dvn.hlp | 27 + math/slalib/doc/dvxv.hlp | 25 + math/slalib/doc/e2h.hlp | 59 + math/slalib/doc/earth.hlp | 44 + math/slalib/doc/ecleq.hlp | 31 + math/slalib/doc/ecmat.hlp | 34 + math/slalib/doc/ecor.hlp | 54 + math/slalib/doc/eg50.hlp | 38 + math/slalib/doc/el2ue.hlp | 133 + math/slalib/doc/epb.hlp | 27 + math/slalib/doc/epb2d.hlp | 27 + math/slalib/doc/epco.hlp | 40 + math/slalib/doc/epj.hlp | 26 + math/slalib/doc/epj2d.hlp | 26 + math/slalib/doc/eqecl.hlp | 31 + math/slalib/doc/eqeqx.hlp | 33 + math/slalib/doc/eqgal.hlp | 38 + math/slalib/doc/etrms.hlp | 35 + math/slalib/doc/euler.hlp | 52 + math/slalib/doc/evp.hlp | 66 + math/slalib/doc/fitxy.hlp | 76 + math/slalib/doc/fk425.hlp | 81 + math/slalib/doc/fk45z.hlp | 83 + math/slalib/doc/fk524.hlp | 81 + math/slalib/doc/fk52h.hlp | 56 + math/slalib/doc/fk54z.hlp | 56 + math/slalib/doc/fk5hz.hlp | 54 + math/slalib/doc/flotin.hlp | 118 + math/slalib/doc/galeq.hlp | 38 + math/slalib/doc/galsup.hlp | 43 + math/slalib/doc/ge50.hlp | 38 + math/slalib/doc/geoc.hlp | 33 + math/slalib/doc/gmst.hlp | 41 + math/slalib/doc/gmsta.hlp | 55 + math/slalib/doc/h2e.hlp | 58 + math/slalib/doc/h2fk5.hlp | 57 + math/slalib/doc/hfk5z.hlp | 60 + math/slalib/doc/imxv.hlp | 32 + math/slalib/doc/intin.hlp | 90 + math/slalib/doc/invf.hlp | 66 + math/slalib/doc/kbj.hlp | 28 + math/slalib/doc/m2av.hlp | 38 + math/slalib/doc/map.hlp | 65 + math/slalib/doc/mappa.hlp | 69 + math/slalib/doc/mapqk.hlp | 76 + math/slalib/doc/mapqkz.hlp | 68 + math/slalib/doc/moon.hlp | 59 + math/slalib/doc/mxm.hlp | 33 + math/slalib/doc/mxv.hlp | 29 + math/slalib/doc/nut.hlp | 34 + math/slalib/doc/nutc.hlp | 33 + math/slalib/doc/oap.hlp | 163 + math/slalib/doc/oapqk.hlp | 114 + math/slalib/doc/obs.hlp | 83 + math/slalib/doc/pa.hlp | 36 + math/slalib/doc/pav.hlp | 40 + math/slalib/doc/pcd.hlp | 51 + math/slalib/doc/pda2h.hlp | 33 + math/slalib/doc/pdq2h.hlp | 33 + math/slalib/doc/pertel.hlp | 121 + math/slalib/doc/pertue.hlp | 152 + math/slalib/doc/planel.hlp | 96 + math/slalib/doc/planet.hlp | 130 + math/slalib/doc/plante.hlp | 97 + math/slalib/doc/pm.hlp | 45 + math/slalib/doc/polmo.hlp | 87 + math/slalib/doc/prebn.hlp | 36 + math/slalib/doc/prec.hlp | 53 + math/slalib/doc/preces.hlp | 47 + math/slalib/doc/precl.hlp | 47 + math/slalib/doc/precss.hlp | 44 + math/slalib/doc/prenut.hlp | 35 + math/slalib/doc/pv2el.hlp | 145 + math/slalib/doc/pv2ue.hlp | 70 + math/slalib/doc/pvobs.hlp | 31 + math/slalib/doc/pxy.hlp | 56 + math/slalib/doc/range.hlp | 24 + math/slalib/doc/ranorm.hlp | 24 + math/slalib/doc/rcc.hlp | 83 + math/slalib/doc/rdplan.hlp | 73 + math/slalib/doc/read.me | 437 ++ math/slalib/doc/refco.hlp | 54 + math/slalib/doc/refcoq.hlp | 167 + math/slalib/doc/refro.hlp | 123 + math/slalib/doc/refv.hlp | 79 + math/slalib/doc/refz.hlp | 78 + math/slalib/doc/rverot.hlp | 40 + math/slalib/doc/rvgalc.hlp | 42 + math/slalib/doc/rvlg.hlp | 36 + math/slalib/doc/rvlsrd.hlp | 51 + math/slalib/doc/rvlsrk.hlp | 50 + math/slalib/doc/s2tp.hlp | 31 + math/slalib/doc/sedscript | 35 + math/slalib/doc/sep.hlp | 29 + math/slalib/doc/sla.news | 36 + math/slalib/doc/slalib.hd | 183 + math/slalib/doc/slalib.hlp | 591 ++ math/slalib/doc/slalib.hlp.sav | 591 ++ math/slalib/doc/slalib.men | 179 + math/slalib/doc/smat.hlp | 60 + math/slalib/doc/subet.hlp | 41 + math/slalib/doc/sun67.tex | 12311 ++++++++++++++++++++++++++++++++++++ math/slalib/doc/supgal.hlp | 43 + math/slalib/doc/svd.hlp | 73 + math/slalib/doc/svdcov.hlp | 35 + math/slalib/doc/svdsol.hlp | 82 + math/slalib/doc/tp2s.hlp | 28 + math/slalib/doc/tp2v.hlp | 40 + math/slalib/doc/tps2c.hlp | 58 + math/slalib/doc/tpv2c.hlp | 51 + math/slalib/doc/ue2el.hlp | 167 + math/slalib/doc/ue2pv.hlp | 87 + math/slalib/doc/unpcd.hlp | 57 + math/slalib/doc/v2tp.hlp | 42 + math/slalib/doc/vdv.hlp | 24 + math/slalib/doc/vn.hlp | 27 + math/slalib/doc/vxv.hlp | 25 + math/slalib/doc/xy2xy.hlp | 45 + math/slalib/doc/zd.hlp | 48 + math/slalib/dpav.f | 82 + math/slalib/dr2af.f | 76 + math/slalib/dr2tf.f | 76 + math/slalib/drange.f | 50 + math/slalib/dranrm.f | 48 + math/slalib/ds2c6.f | 75 + math/slalib/ds2tp.f | 85 + math/slalib/dsep.f | 61 + math/slalib/dsepv.f | 77 + math/slalib/dt.f | 97 + math/slalib/dtf2d.f | 73 + math/slalib/dtf2r.f | 71 + math/slalib/dtp2s.f | 60 + math/slalib/dtp2v.f | 74 + math/slalib/dtps2c.f | 109 + math/slalib/dtpv2c.f | 101 + math/slalib/dtt.f | 64 + math/slalib/dv2tp.f | 96 + math/slalib/dvdv.f | 45 + math/slalib/dvn.f | 70 + math/slalib/dvxv.f | 57 + math/slalib/e2h.f | 107 + math/slalib/earth.f | 130 + math/slalib/ecleq.f | 73 + math/slalib/ecmat.f | 70 + math/slalib/ecor.f | 96 + math/slalib/eg50.f | 108 + math/slalib/el2ue.f | 329 + math/slalib/epb.f | 48 + math/slalib/epb2d.f | 48 + math/slalib/epco.f | 69 + math/slalib/epj.f | 47 + math/slalib/epj2d.f | 47 + math/slalib/epv.f | 2509 ++++++++ math/slalib/eqecl.f | 73 + math/slalib/eqeqx.f | 75 + math/slalib/eqgal.f | 97 + math/slalib/etrms.f | 80 + math/slalib/euler.f | 86 + math/slalib/evp.f | 457 ++ math/slalib/f77.h.in | 956 +++ math/slalib/fitxy.f | 329 + math/slalib/fk425.f | 267 + math/slalib/fk45z.f | 183 + math/slalib/fk524.f | 275 + math/slalib/fk52h.f | 123 + math/slalib/fk54z.f | 87 + math/slalib/fk5hz.f | 125 + math/slalib/flotin.f | 146 + math/slalib/galeq.f | 97 + math/slalib/galsup.f | 97 + math/slalib/ge50.f | 108 + math/slalib/geoc.f | 78 + math/slalib/gmst.f | 78 + math/slalib/gmsta.f | 100 + math/slalib/gresid.F__vms | 89 + math/slalib/gresid.F__win | 90 + math/slalib/gresid.Fdefault | 113 + math/slalib/h2e.f | 101 + math/slalib/h2fk5.f | 127 + math/slalib/hfk5z.f | 140 + math/slalib/idchf.f | 112 + math/slalib/idchi.f | 109 + math/slalib/imxv.f | 69 + math/slalib/intin.f | 194 + math/slalib/invf.f | 106 + math/slalib/kbj.f | 74 + math/slalib/m2av.f | 75 + math/slalib/map.f | 99 + math/slalib/mappa.f | 129 + math/slalib/mapqk.f | 160 + math/slalib/mapqkz.f | 131 + math/slalib/mkpkg | 193 + math/slalib/moon.f | 380 ++ math/slalib/mxm.f | 72 + math/slalib/mxv.f | 69 + math/slalib/newnames | 205 + math/slalib/nut.f | 76 + math/slalib/nutc.f | 831 +++ math/slalib/nutc80.f | 476 ++ math/slalib/oap.f | 193 + math/slalib/oapqk.f | 251 + math/slalib/obs.f | 943 +++ math/slalib/pa.f | 64 + math/slalib/pav.f | 71 + math/slalib/pcd.f | 77 + math/slalib/pda2h.f | 118 + math/slalib/pdq2h.f | 116 + math/slalib/permut.f | 160 + math/slalib/pertel.f | 182 + math/slalib/pertue.f | 644 ++ math/slalib/planel.f | 184 + math/slalib/planet.f | 725 +++ math/slalib/plante.f | 251 + math/slalib/plantu.f | 156 + math/slalib/pm.f | 98 + math/slalib/polmo.f | 159 + math/slalib/prebn.f | 80 + math/slalib/prec.f | 97 + math/slalib/preces.f | 102 + math/slalib/precl.f | 143 + math/slalib/precss.f | 76 + math/slalib/precss.f.sav | 76 + math/slalib/prenut.f | 67 + math/slalib/pv2el.f | 380 ++ math/slalib/pv2ue.f | 168 + math/slalib/pvobs.f | 77 + math/slalib/pxy.f | 110 + math/slalib/random.F__vms | 69 + math/slalib/random.F__win | 59 + math/slalib/random.Fdefault | 87 + math/slalib/range.f | 51 + math/slalib/ranorm.f | 49 + math/slalib/rcc.f | 1110 ++++ math/slalib/rdplan.f | 201 + math/slalib/read.me | 443 ++ math/slalib/refco.f | 88 + math/slalib/refcoq.f | 227 + math/slalib/refro.f | 402 ++ math/slalib/refv.f | 129 + math/slalib/refz.f | 170 + math/slalib/rtl_random.c | 33 + math/slalib/rverot.f | 66 + math/slalib/rvgalc.f | 87 + math/slalib/rvlg.f | 82 + math/slalib/rvlsrd.f | 96 + math/slalib/rvlsrk.f | 95 + math/slalib/s2tp.f | 85 + math/slalib/sedscript | 17 + math/slalib/sep.f | 56 + math/slalib/sepv.f | 71 + math/slalib/sla.c | 2338 +++++++ math/slalib/sla.news | 88 + math/slalib/slaTest.c | 112 + math/slalib/sla_link | 1 + math/slalib/sla_link_adam | 1 + math/slalib/sla_test.f | 6655 ++++++++++++++++++++ math/slalib/slalib.h | 509 ++ math/slalib/smat.f | 159 + math/slalib/subet.f | 84 + math/slalib/sun67.tex | 13140 +++++++++++++++++++++++++++++++++++++++ math/slalib/supgal.f | 97 + math/slalib/svd.f | 401 ++ math/slalib/svdcov.f | 78 + math/slalib/svdsol.f | 127 + math/slalib/tp2s.f | 60 + math/slalib/tp2v.f | 74 + math/slalib/tps2c.f | 109 + math/slalib/tpv2c.f | 101 + math/slalib/ue2el.f | 212 + math/slalib/ue2pv.f | 253 + math/slalib/unpcd.f | 145 + math/slalib/v2tp.f | 96 + math/slalib/vdv.f | 45 + math/slalib/veri.f.in | 52 + math/slalib/vers.f.in | 58 + math/slalib/vn.f | 64 + math/slalib/vxv.f | 57 + math/slalib/wait.f__vms | 60 + math/slalib/wait.f__win | 83 + math/slalib/wait.fdefault | 49 + math/slalib/xy2xy.f | 67 + math/slalib/zd.f | 80 + 410 files changed, 79896 insertions(+) create mode 100644 math/slalib/Makefile.am create mode 100644 math/slalib/Notes create mode 100644 math/slalib/README create mode 100644 math/slalib/SED1 create mode 100644 math/slalib/SED2 create mode 100644 math/slalib/SLA_CONDITIONS create mode 100644 math/slalib/addet.f create mode 100644 math/slalib/afin.f create mode 100644 math/slalib/airmas.f create mode 100644 math/slalib/altaz.f create mode 100644 math/slalib/amp.f create mode 100644 math/slalib/ampqk.f create mode 100644 math/slalib/aop.f create mode 100644 math/slalib/aoppa.f create mode 100644 math/slalib/aoppat.f create mode 100644 math/slalib/aopqk.f create mode 100644 math/slalib/atmdsp.f create mode 100644 math/slalib/atms.f create mode 100644 math/slalib/atmt.f create mode 100644 math/slalib/av2m.f create mode 100644 math/slalib/bear.f create mode 100644 math/slalib/caf2r.f create mode 100644 math/slalib/caldj.f create mode 100644 math/slalib/calyd.f create mode 100644 math/slalib/cc2s.f create mode 100644 math/slalib/cc62s.f create mode 100644 math/slalib/cd2tf.f create mode 100644 math/slalib/cldj.f create mode 100644 math/slalib/clyd.f create mode 100644 math/slalib/combn.f create mode 100644 math/slalib/configure.ac create mode 100644 math/slalib/cr2af.f create mode 100644 math/slalib/cr2tf.f create mode 100644 math/slalib/cs2c.f create mode 100644 math/slalib/cs2c6.f create mode 100644 math/slalib/ctf2d.f create mode 100644 math/slalib/ctf2r.f create mode 100644 math/slalib/daf2r.f create mode 100644 math/slalib/dafin.f create mode 100644 math/slalib/dat.f create mode 100644 math/slalib/dav2m.f create mode 100644 math/slalib/dbear.f create mode 100644 math/slalib/dbjin.f create mode 100644 math/slalib/dc62s.f create mode 100644 math/slalib/dcc2s.f create mode 100644 math/slalib/dcmpf.f create mode 100644 math/slalib/dcs2c.f create mode 100644 math/slalib/dd2tf.f create mode 100644 math/slalib/de2h.f create mode 100644 math/slalib/deuler.f create mode 100644 math/slalib/dfltin.f create mode 100644 math/slalib/dh2e.f create mode 100644 math/slalib/dimxv.f create mode 100644 math/slalib/djcal.f create mode 100644 math/slalib/djcl.f create mode 100644 math/slalib/dm2av.f create mode 100644 math/slalib/dmat.f create mode 100644 math/slalib/dmoon.f create mode 100644 math/slalib/dmxm.f create mode 100644 math/slalib/dmxv.f create mode 100644 math/slalib/doc/addet.hlp create mode 100644 math/slalib/doc/afin.hlp create mode 100644 math/slalib/doc/airmas.hlp create mode 100644 math/slalib/doc/altaz.hlp create mode 100644 math/slalib/doc/amp.hlp create mode 100644 math/slalib/doc/ampqk.hlp create mode 100644 math/slalib/doc/aop.hlp create mode 100644 math/slalib/doc/aoppa.hlp create mode 100644 math/slalib/doc/aoppat.hlp create mode 100644 math/slalib/doc/aopqk.hlp create mode 100644 math/slalib/doc/atmdsp.hlp create mode 100644 math/slalib/doc/av2m.hlp create mode 100644 math/slalib/doc/bear.hlp create mode 100644 math/slalib/doc/caf2r.hlp create mode 100644 math/slalib/doc/caldj.hlp create mode 100644 math/slalib/doc/calyd.hlp create mode 100644 math/slalib/doc/cc2s.hlp create mode 100644 math/slalib/doc/cc62s.hlp create mode 100644 math/slalib/doc/cd2tf.hlp create mode 100644 math/slalib/doc/cldj.hlp create mode 100644 math/slalib/doc/clyd.hlp create mode 100644 math/slalib/doc/cr2af.hlp create mode 100644 math/slalib/doc/cr2tf.hlp create mode 100644 math/slalib/doc/cs2c.hlp create mode 100644 math/slalib/doc/cs2c6.hlp create mode 100644 math/slalib/doc/ctf2d.hlp create mode 100644 math/slalib/doc/ctf2r.hlp create mode 100644 math/slalib/doc/daf2r.hlp create mode 100644 math/slalib/doc/dafin.hlp create mode 100644 math/slalib/doc/dat.hlp create mode 100644 math/slalib/doc/dav2m.hlp create mode 100644 math/slalib/doc/dbear.hlp create mode 100644 math/slalib/doc/dbjin.hlp create mode 100644 math/slalib/doc/dc62s.hlp create mode 100644 math/slalib/doc/dcc2s.hlp create mode 100644 math/slalib/doc/dcmpf.hlp create mode 100644 math/slalib/doc/dcs2c.hlp create mode 100644 math/slalib/doc/dd2tf.hlp create mode 100644 math/slalib/doc/de2h.hlp create mode 100644 math/slalib/doc/deuler.hlp create mode 100644 math/slalib/doc/dfltin.hlp create mode 100644 math/slalib/doc/dh2e.hlp create mode 100644 math/slalib/doc/dimxv.hlp create mode 100644 math/slalib/doc/djcal.hlp create mode 100644 math/slalib/doc/djcl.hlp create mode 100644 math/slalib/doc/dm2av.hlp create mode 100644 math/slalib/doc/dmat.hlp create mode 100644 math/slalib/doc/dmoon.hlp create mode 100644 math/slalib/doc/dmxm.hlp create mode 100644 math/slalib/doc/dmxv.hlp create mode 100644 math/slalib/doc/dpav.hlp create mode 100644 math/slalib/doc/dr2af.hlp create mode 100644 math/slalib/doc/dr2tf.hlp create mode 100644 math/slalib/doc/drange.hlp create mode 100644 math/slalib/doc/dranrm.hlp create mode 100644 math/slalib/doc/ds2c6.hlp create mode 100644 math/slalib/doc/ds2tp.hlp create mode 100644 math/slalib/doc/dsep.hlp create mode 100644 math/slalib/doc/dt.hlp create mode 100644 math/slalib/doc/dtf2d.hlp create mode 100644 math/slalib/doc/dtf2r.hlp create mode 100644 math/slalib/doc/dtp2s.hlp create mode 100644 math/slalib/doc/dtp2v.hlp create mode 100644 math/slalib/doc/dtps2c.hlp create mode 100644 math/slalib/doc/dtpv2c.hlp create mode 100644 math/slalib/doc/dtt.hlp create mode 100644 math/slalib/doc/dv2tp.hlp create mode 100644 math/slalib/doc/dvdv.hlp create mode 100644 math/slalib/doc/dvn.hlp create mode 100644 math/slalib/doc/dvxv.hlp create mode 100644 math/slalib/doc/e2h.hlp create mode 100644 math/slalib/doc/earth.hlp create mode 100644 math/slalib/doc/ecleq.hlp create mode 100644 math/slalib/doc/ecmat.hlp create mode 100644 math/slalib/doc/ecor.hlp create mode 100644 math/slalib/doc/eg50.hlp create mode 100644 math/slalib/doc/el2ue.hlp create mode 100644 math/slalib/doc/epb.hlp create mode 100644 math/slalib/doc/epb2d.hlp create mode 100644 math/slalib/doc/epco.hlp create mode 100644 math/slalib/doc/epj.hlp create mode 100644 math/slalib/doc/epj2d.hlp create mode 100644 math/slalib/doc/eqecl.hlp create mode 100644 math/slalib/doc/eqeqx.hlp create mode 100644 math/slalib/doc/eqgal.hlp create mode 100644 math/slalib/doc/etrms.hlp create mode 100644 math/slalib/doc/euler.hlp create mode 100644 math/slalib/doc/evp.hlp create mode 100644 math/slalib/doc/fitxy.hlp create mode 100644 math/slalib/doc/fk425.hlp create mode 100644 math/slalib/doc/fk45z.hlp create mode 100644 math/slalib/doc/fk524.hlp create mode 100644 math/slalib/doc/fk52h.hlp create mode 100644 math/slalib/doc/fk54z.hlp create mode 100644 math/slalib/doc/fk5hz.hlp create mode 100644 math/slalib/doc/flotin.hlp create mode 100644 math/slalib/doc/galeq.hlp create mode 100644 math/slalib/doc/galsup.hlp create mode 100644 math/slalib/doc/ge50.hlp create mode 100644 math/slalib/doc/geoc.hlp create mode 100644 math/slalib/doc/gmst.hlp create mode 100644 math/slalib/doc/gmsta.hlp create mode 100644 math/slalib/doc/h2e.hlp create mode 100644 math/slalib/doc/h2fk5.hlp create mode 100644 math/slalib/doc/hfk5z.hlp create mode 100644 math/slalib/doc/imxv.hlp create mode 100644 math/slalib/doc/intin.hlp create mode 100644 math/slalib/doc/invf.hlp create mode 100644 math/slalib/doc/kbj.hlp create mode 100644 math/slalib/doc/m2av.hlp create mode 100644 math/slalib/doc/map.hlp create mode 100644 math/slalib/doc/mappa.hlp create mode 100644 math/slalib/doc/mapqk.hlp create mode 100644 math/slalib/doc/mapqkz.hlp create mode 100644 math/slalib/doc/moon.hlp create mode 100644 math/slalib/doc/mxm.hlp create mode 100644 math/slalib/doc/mxv.hlp create mode 100644 math/slalib/doc/nut.hlp create mode 100644 math/slalib/doc/nutc.hlp create mode 100644 math/slalib/doc/oap.hlp create mode 100644 math/slalib/doc/oapqk.hlp create mode 100644 math/slalib/doc/obs.hlp create mode 100644 math/slalib/doc/pa.hlp create mode 100644 math/slalib/doc/pav.hlp create mode 100644 math/slalib/doc/pcd.hlp create mode 100644 math/slalib/doc/pda2h.hlp create mode 100644 math/slalib/doc/pdq2h.hlp create mode 100644 math/slalib/doc/pertel.hlp create mode 100644 math/slalib/doc/pertue.hlp create mode 100644 math/slalib/doc/planel.hlp create mode 100644 math/slalib/doc/planet.hlp create mode 100644 math/slalib/doc/plante.hlp create mode 100644 math/slalib/doc/pm.hlp create mode 100644 math/slalib/doc/polmo.hlp create mode 100644 math/slalib/doc/prebn.hlp create mode 100644 math/slalib/doc/prec.hlp create mode 100644 math/slalib/doc/preces.hlp create mode 100644 math/slalib/doc/precl.hlp create mode 100644 math/slalib/doc/precss.hlp create mode 100644 math/slalib/doc/prenut.hlp create mode 100644 math/slalib/doc/pv2el.hlp create mode 100644 math/slalib/doc/pv2ue.hlp create mode 100644 math/slalib/doc/pvobs.hlp create mode 100644 math/slalib/doc/pxy.hlp create mode 100644 math/slalib/doc/range.hlp create mode 100644 math/slalib/doc/ranorm.hlp create mode 100644 math/slalib/doc/rcc.hlp create mode 100644 math/slalib/doc/rdplan.hlp create mode 100644 math/slalib/doc/read.me create mode 100644 math/slalib/doc/refco.hlp create mode 100644 math/slalib/doc/refcoq.hlp create mode 100644 math/slalib/doc/refro.hlp create mode 100644 math/slalib/doc/refv.hlp create mode 100644 math/slalib/doc/refz.hlp create mode 100644 math/slalib/doc/rverot.hlp create mode 100644 math/slalib/doc/rvgalc.hlp create mode 100644 math/slalib/doc/rvlg.hlp create mode 100644 math/slalib/doc/rvlsrd.hlp create mode 100644 math/slalib/doc/rvlsrk.hlp create mode 100644 math/slalib/doc/s2tp.hlp create mode 100755 math/slalib/doc/sedscript create mode 100644 math/slalib/doc/sep.hlp create mode 100644 math/slalib/doc/sla.news create mode 100644 math/slalib/doc/slalib.hd create mode 100644 math/slalib/doc/slalib.hlp create mode 100644 math/slalib/doc/slalib.hlp.sav create mode 100644 math/slalib/doc/slalib.men create mode 100644 math/slalib/doc/smat.hlp create mode 100644 math/slalib/doc/subet.hlp create mode 100644 math/slalib/doc/sun67.tex create mode 100644 math/slalib/doc/supgal.hlp create mode 100644 math/slalib/doc/svd.hlp create mode 100644 math/slalib/doc/svdcov.hlp create mode 100644 math/slalib/doc/svdsol.hlp create mode 100644 math/slalib/doc/tp2s.hlp create mode 100644 math/slalib/doc/tp2v.hlp create mode 100644 math/slalib/doc/tps2c.hlp create mode 100644 math/slalib/doc/tpv2c.hlp create mode 100644 math/slalib/doc/ue2el.hlp create mode 100644 math/slalib/doc/ue2pv.hlp create mode 100644 math/slalib/doc/unpcd.hlp create mode 100644 math/slalib/doc/v2tp.hlp create mode 100644 math/slalib/doc/vdv.hlp create mode 100644 math/slalib/doc/vn.hlp create mode 100644 math/slalib/doc/vxv.hlp create mode 100644 math/slalib/doc/xy2xy.hlp create mode 100644 math/slalib/doc/zd.hlp create mode 100644 math/slalib/dpav.f create mode 100644 math/slalib/dr2af.f create mode 100644 math/slalib/dr2tf.f create mode 100644 math/slalib/drange.f create mode 100644 math/slalib/dranrm.f create mode 100644 math/slalib/ds2c6.f create mode 100644 math/slalib/ds2tp.f create mode 100644 math/slalib/dsep.f create mode 100644 math/slalib/dsepv.f create mode 100644 math/slalib/dt.f create mode 100644 math/slalib/dtf2d.f create mode 100644 math/slalib/dtf2r.f create mode 100644 math/slalib/dtp2s.f create mode 100644 math/slalib/dtp2v.f create mode 100644 math/slalib/dtps2c.f create mode 100644 math/slalib/dtpv2c.f create mode 100644 math/slalib/dtt.f create mode 100644 math/slalib/dv2tp.f create mode 100644 math/slalib/dvdv.f create mode 100644 math/slalib/dvn.f create mode 100644 math/slalib/dvxv.f create mode 100644 math/slalib/e2h.f create mode 100644 math/slalib/earth.f create mode 100644 math/slalib/ecleq.f create mode 100644 math/slalib/ecmat.f create mode 100644 math/slalib/ecor.f create mode 100644 math/slalib/eg50.f create mode 100644 math/slalib/el2ue.f create mode 100644 math/slalib/epb.f create mode 100644 math/slalib/epb2d.f create mode 100644 math/slalib/epco.f create mode 100644 math/slalib/epj.f create mode 100644 math/slalib/epj2d.f create mode 100644 math/slalib/epv.f create mode 100644 math/slalib/eqecl.f create mode 100644 math/slalib/eqeqx.f create mode 100644 math/slalib/eqgal.f create mode 100644 math/slalib/etrms.f create mode 100644 math/slalib/euler.f create mode 100644 math/slalib/evp.f create mode 100644 math/slalib/f77.h.in create mode 100644 math/slalib/fitxy.f create mode 100644 math/slalib/fk425.f create mode 100644 math/slalib/fk45z.f create mode 100644 math/slalib/fk524.f create mode 100644 math/slalib/fk52h.f create mode 100644 math/slalib/fk54z.f create mode 100644 math/slalib/fk5hz.f create mode 100644 math/slalib/flotin.f create mode 100644 math/slalib/galeq.f create mode 100644 math/slalib/galsup.f create mode 100644 math/slalib/ge50.f create mode 100644 math/slalib/geoc.f create mode 100644 math/slalib/gmst.f create mode 100644 math/slalib/gmsta.f create mode 100644 math/slalib/gresid.F__vms create mode 100644 math/slalib/gresid.F__win create mode 100644 math/slalib/gresid.Fdefault create mode 100644 math/slalib/h2e.f create mode 100644 math/slalib/h2fk5.f create mode 100644 math/slalib/hfk5z.f create mode 100644 math/slalib/idchf.f create mode 100644 math/slalib/idchi.f create mode 100644 math/slalib/imxv.f create mode 100644 math/slalib/intin.f create mode 100644 math/slalib/invf.f create mode 100644 math/slalib/kbj.f create mode 100644 math/slalib/m2av.f create mode 100644 math/slalib/map.f create mode 100644 math/slalib/mappa.f create mode 100644 math/slalib/mapqk.f create mode 100644 math/slalib/mapqkz.f create mode 100644 math/slalib/mkpkg create mode 100644 math/slalib/moon.f create mode 100644 math/slalib/mxm.f create mode 100644 math/slalib/mxv.f create mode 100644 math/slalib/newnames create mode 100644 math/slalib/nut.f create mode 100644 math/slalib/nutc.f create mode 100644 math/slalib/nutc80.f create mode 100644 math/slalib/oap.f create mode 100644 math/slalib/oapqk.f create mode 100644 math/slalib/obs.f create mode 100644 math/slalib/pa.f create mode 100644 math/slalib/pav.f create mode 100644 math/slalib/pcd.f create mode 100644 math/slalib/pda2h.f create mode 100644 math/slalib/pdq2h.f create mode 100644 math/slalib/permut.f create mode 100644 math/slalib/pertel.f create mode 100644 math/slalib/pertue.f create mode 100644 math/slalib/planel.f create mode 100644 math/slalib/planet.f create mode 100644 math/slalib/plante.f create mode 100644 math/slalib/plantu.f create mode 100644 math/slalib/pm.f create mode 100644 math/slalib/polmo.f create mode 100644 math/slalib/prebn.f create mode 100644 math/slalib/prec.f create mode 100644 math/slalib/preces.f create mode 100644 math/slalib/precl.f create mode 100644 math/slalib/precss.f create mode 100644 math/slalib/precss.f.sav create mode 100644 math/slalib/prenut.f create mode 100644 math/slalib/pv2el.f create mode 100644 math/slalib/pv2ue.f create mode 100644 math/slalib/pvobs.f create mode 100644 math/slalib/pxy.f create mode 100644 math/slalib/random.F__vms create mode 100644 math/slalib/random.F__win create mode 100644 math/slalib/random.Fdefault create mode 100644 math/slalib/range.f create mode 100644 math/slalib/ranorm.f create mode 100644 math/slalib/rcc.f create mode 100644 math/slalib/rdplan.f create mode 100644 math/slalib/read.me create mode 100644 math/slalib/refco.f create mode 100644 math/slalib/refcoq.f create mode 100644 math/slalib/refro.f create mode 100644 math/slalib/refv.f create mode 100644 math/slalib/refz.f create mode 100644 math/slalib/rtl_random.c create mode 100644 math/slalib/rverot.f create mode 100644 math/slalib/rvgalc.f create mode 100644 math/slalib/rvlg.f create mode 100644 math/slalib/rvlsrd.f create mode 100644 math/slalib/rvlsrk.f create mode 100644 math/slalib/s2tp.f create mode 100755 math/slalib/sedscript create mode 100644 math/slalib/sep.f create mode 100644 math/slalib/sepv.f create mode 100644 math/slalib/sla.c create mode 100644 math/slalib/sla.news create mode 100644 math/slalib/slaTest.c create mode 100755 math/slalib/sla_link create mode 100755 math/slalib/sla_link_adam create mode 100644 math/slalib/sla_test.f create mode 100644 math/slalib/slalib.h create mode 100644 math/slalib/smat.f create mode 100644 math/slalib/subet.f create mode 100644 math/slalib/sun67.tex create mode 100644 math/slalib/supgal.f create mode 100644 math/slalib/svd.f create mode 100644 math/slalib/svdcov.f create mode 100644 math/slalib/svdsol.f create mode 100644 math/slalib/tp2s.f create mode 100644 math/slalib/tp2v.f create mode 100644 math/slalib/tps2c.f create mode 100644 math/slalib/tpv2c.f create mode 100644 math/slalib/ue2el.f create mode 100644 math/slalib/ue2pv.f create mode 100644 math/slalib/unpcd.f create mode 100644 math/slalib/v2tp.f create mode 100644 math/slalib/vdv.f create mode 100644 math/slalib/veri.f.in create mode 100644 math/slalib/vers.f.in create mode 100644 math/slalib/vn.f create mode 100644 math/slalib/vxv.f create mode 100644 math/slalib/wait.f__vms create mode 100644 math/slalib/wait.f__win create mode 100644 math/slalib/wait.fdefault create mode 100644 math/slalib/xy2xy.f create mode 100644 math/slalib/zd.f (limited to 'math/slalib') diff --git a/math/slalib/Makefile.am b/math/slalib/Makefile.am new file mode 100644 index 00000000..547240a7 --- /dev/null +++ b/math/slalib/Makefile.am @@ -0,0 +1,76 @@ +## Process this file with automake to produce Makefile.in + +cincludedir = $(includedir)/star +dist_bin_SCRIPTS = sla_link sla_link_adam +dist_pkgdata_DATA = SLA_CONDITIONS read.me + +EXTRA_DIST = Notes + +lib_LTLIBRARIES = libsla.la + +stardocs_DATA = @STAR_LATEX_DOCUMENTATION@ + +libsla_la_SOURCES = \ + $(PRIVATE_INCLUDES) \ + $(PUBLIC_INCLUDES) \ + $(F_ROUTINES) \ + $(C_ROUTINES) \ + $(FPP_ROUTINES) +libsla_la_LIBADD = $(LTLIBOBJS) +libsla_la_LDFLAGS = -version-info $(libsla_la_version_info) + +cinclude_HEADERS = $(PUBLIC_C_INCLUDES) + +# Make all library code position independent. This is handy for creating +# shareable libraries from the static ones (Java JNI libraries). +if !NOPIC +libsla_la_FCFLAGS = $(AM_FCFLAGS) -prefer-pic +endif + +PUBLIC_F_INCLUDES = +PUBLIC_C_INCLUDES = slalib.h +PRIVATE_INCLUDES = f77.h +PUBLIC_INCLUDES = $(PUBLIC_F_INCLUDES) $(PUBLIC_C_INCLUDES) + +FPP_ROUTINES = \ + random.F \ + gresid.F + +C_ROUTINES = sla.c + +F_ROUTINES = addet.f afin.f airmas.f altaz.f amp.f ampqk.f aop.f \ + aoppa.f aoppat.f aopqk.f atmdsp.f atms.f atmt.f av2m.f bear.f \ + caf2r.f caldj.f calyd.f cc2s.f cc62s.f cd2tf.f cldj.f clyd.f \ + combn.f cr2af.f cr2tf.f cs2c.f cs2c6.f ctf2d.f ctf2r.f daf2r.f \ + dafin.f dat.f dav2m.f dbear.f dbjin.f dc62s.f dcc2s.f dcmpf.f \ + dcs2c.f dd2tf.f de2h.f deuler.f dfltin.f dh2e.f dimxv.f djcal.f \ + djcl.f dm2av.f dmat.f dmoon.f dmxm.f dmxv.f dpav.f dr2af.f dr2tf.f \ + drange.f dranrm.f ds2c6.f ds2tp.f dsep.f dsepv.f dt.f dtf2d.f \ + dtf2r.f dtp2s.f dtp2v.f dtps2c.f dtpv2c.f dtt.f dv2tp.f dvdv.f \ + dvn.f dvxv.f e2h.f earth.f ecleq.f ecmat.f ecor.f eg50.f el2ue.f \ + epb.f epb2d.f epco.f epj.f epj2d.f epv.f eqecl.f eqeqx.f eqgal.f \ + etrms.f euler.f evp.f fitxy.f fk425.f fk45z.f fk524.f fk52h.f \ + fk54z.f fk5hz.f flotin.f galeq.f galsup.f ge50.f geoc.f gmst.f \ + gmsta.f h2e.f h2fk5.f hfk5z.f idchf.f idchi.f imxv.f intin.f \ + invf.f kbj.f m2av.f map.f mappa.f mapqk.f mapqkz.f moon.f mxm.f \ + mxv.f nut.f nutc.f nutc80.f oap.f oapqk.f obs.f pa.f pav.f pcd.f \ + pda2h.f pdq2h.f permut.f pertel.f pertue.f planel.f planet.f \ + plante.f plantu.f pm.f polmo.f prebn.f prec.f precl.f preces.f \ + prenut.f pv2el.f pv2ue.f pvobs.f pxy.f range.f ranorm.f rcc.f \ + rdplan.f refco.f refcoq.f refro.f refv.f refz.f rverot.f rvgalc.f \ + rvlg.f rvlsrd.f rvlsrk.f s2tp.f sep.f sepv.f smat.f subet.f \ + supgal.f svd.f svdcov.f svdsol.f tp2s.f tp2v.f tps2c.f tpv2c.f \ + ue2el.f ue2pv.f unpcd.f v2tp.f vdv.f veri.f vers.f vn.f vxv.f \ + wait.f xy2xy.f zd.f + +TESTS = sla_test slaTest +check_PROGRAMS = sla_test slaTest + +sla_test_SOURCES = sla_test.f +sla_test_LDADD = libsla.la + +slaTest_SOURCES = slaTest.c +slaTest_LDADD = libsla.la @FCLIBS@ + +dist_starnews_DATA = sla.news +DISTCLEANFILES = gresid.F random.F wait.f diff --git a/math/slalib/Notes b/math/slalib/Notes new file mode 100644 index 00000000..ffb5efca --- /dev/null +++ b/math/slalib/Notes @@ -0,0 +1,23 @@ + +SLALIB imported into CVS and autoconfed, January 2003. + +Platform-dependencies: there were three platform-dependent files, for +random.f, gresid.f (both requiring a random number function) and +wait.f (sleeps). The original set of files had extensions alpha_OSF1, +convex, ix86_Linux, mips, pcm, sun4, sun4_Solaris, and vax. In each +case, there were a number of files for unix-like platforms, one +Windows/MSFortran (pcm) and one VAX one. For random and gresid, the +unix ones were largely the same, differing only in whether they called +a function random() or ran(), and with different calls -- these could +be handled using fpp. + +The Windows and VMS ones were sufficiently different that they've +remained in separate files. Each of the three has a __win file, +specific to MSFortran (or to Windows, I'm not sure). In each of the +three cases, the __vms file is the original _vax file -- it's specific +to VMS, not the VAX. For random and gresid, the files are called +random.fpp{__win,_dec_osf} even though there's nothing preprocessable +in them. + +I _think_ I've got the __vms and __win dependencies right, but I've no +way of testing them. diff --git a/math/slalib/README b/math/slalib/README new file mode 100644 index 00000000..606d3784 --- /dev/null +++ b/math/slalib/README @@ -0,0 +1,233 @@ +This directory contains the Fortran source for the SLALIB version 2.5-2 +routines. The SLALIB Fortran library has been made available to the IRAF +project courtesy of Patrick Wallace of the Starlink project, the version +distributed here is derived from the Starlink 2012 release in order to +include the GPL'd version of the code. All the documentation normally +provided with the Starlink routines can be found in the doc subdirectory, +and in the sun67.tex file. See the 'read.me' and 'SLA_CONDITIONS' file +in this directory for additional information and license restrictions. + +In order to complete the port to iraf the following name changes were +made to the package routines. The package prefix was changed from "sla_" +to "sl". Routines with root names that were longer than four characters +have been renamed so that all the package routines have unique six +character names. The complete name change list is shown below. +A Unix sed script for implementing the changes automatically can be found +in the file sedscript, using the editing commands in the files SED1, +SED2, SED3. + +The machine dependent routines gresid, random, and wait have been removed +from the IRAF version of SLALIB. The IRAF routines urand in osb$urand.x +and tsleep in etc$tsleep.x can be used to replace the SLALIB routines +random and wait. + +No other changes have been made to any of the routines. However a new +routine precss.f has been added to the package. Precss.f is identical to +preces.f except that the system argument is an integer code rather +than a Fortran string. This avoids having to deal with Fortran strings +and conversions in spp programs for this commonly used routine. + +The complete name translation list. + +sla_ADDET slADET +sla_AFIN slAFIN +sla_AIRMAS slARMS +sla_ALTAZ slALAZ +sla_AMP slAMP +sla_AMPQK slAMPQ +sla_AOP slAOP +sla_AOPPA slAOPA +sla_AOPPAT slAOPT +sla_AOPQK slAOPQ +sla__ATMS slATMS +sla__ATMT slATMT +sla_ATMDSP slATMD +sla_AV2M slAV2M + +sla_BEAR slBEAR + +sla_CAF2R slCAFR +sla_CALDJ slCADJ +sla_CALYD slCAYD +sla_CC2S slCC2S +sla_CC62S slC62S +sla_CD2TF slCDTF +sla_CLDJ slCLDJ +sla_CLYD slCLYD +sla_CR2AF slCRAF +sla_CR2TF slCRTF +sla_CS2C slCS2C +sla_CS2C6 slS2C6 +sla_CTF2D slCTFD +sla_CTF2R slCTFR + +sla_DAF2R slDAFR +sla_DAFIN slDAFN +sla_DAT slDAT +sla_DAV2M slDAVM +sla_DBEAR slDBER +sla_DBJIN slDBJI +sla_DC62S slDC6S +sla_DCC2S slDC2S +sla_DCMPF slDCMF +sla_DCS2C slDS2C +sla_DD2TF slDDTF +sla_DE2H slDE2H +sla_DEULER slDEUL +sla_DFLTIN slDFLI +sla_DH2E slDH2E +sla_DIMXV slDIMV +sla_DJCAL slDJCA +sla_DJCL slDJCL +sla_DM2AV slDMAV +sla_DMAT slDMAT +sla_DMOON slDMON +sla_DMXM slDMXM +sla_DMXV slDMXV +sla_DPAV slDPAV +sla_DR2AF slDRAF +sla_DR2TF slDRTF +sla_DRANGE slDA1P +sla_DRANRM slDA2P +sla_DS2C6 slDSC6 +sla_DS2TP slDSTP +sla_DSEP slDSEP +sla_DT slDT +sla_DTF2D slDTFD +sla_DTF2R slDTFR +sla_DTP2S slDTPS +sla_DTP2V slDTPV +sla_DTPS2C slDPSC +sla_DTPV2C slDPVC +sla_DTT slDTT +sla_DV2TP slDVTP +sla_DVDV slDVDV +sla_DVN slDVN +sla_DVXV slDVXV + +sla_E2H slE2H +sla_EARTH slERTH +sla_ECLEQ slECEQ +sla_ECMAT slECMA +sla_ECOR slECOR +sla_EG50 slEG50 +sla_EL2UE slELUE +sla_EPB slEPB +sla_EPB2D slEB2D +sla_EPCO slEPCO +sla_EPJ slEPJ +sla_EPJ2D slEJ2D +sla_EQECL slEQEC +sla_EQEQX slEQEX +sla_EQGAL slEQGA +sla_ETRMS slETRM +sla_EULER slEULR +sla_EVP slEVP + +sla_FITXY slFTXY +sla_FK425 slFK45 +sla_FK45Z slF45Z +sla_FK524 slFK54 +sla_FK52H slFK5H +sla_FK54Z slF54Z +sla_FK5HZ slF5HZ +sla_FLOTIN slRFLI + +sla_GALEQ slGAEQ +sla_GALSUP slGASU +sla_GE50 slGE50 +sla_GEOC slGEOC +sla_GMST slGMST +sla_GMSTA slGMSA + +sla_H2E slH2E +sla_H2FK5 slHFK5 +sla_HFK5Z slHF5Z + +sla__IDCHI slICHI +sla__IDCHF slICHF +sla_IMXV slIMXV +sla_INTIN slINTI +sla_INVF slINVF + +sla_KBJ slKBJ + +sla_M2AV slM2AV +sla_MAP slMAP +sla_MAPPA slMAPA +sla_MAPQK slMAPQ +sla_MAPQKZ slMAPZ +sla_MOON slMOON +sla_MXM slMXM +sla_MXV slMXV + +sla_NUT slNUT +sla_NUTC slNUTC + +sla_OBS slOBS +sla_OAP slOAP +sla_OAPQK slOAPQ + +sla_PA slPA +sla_PAV slPAV +sla_PCD slPCD +sla_PDA2H slPDAH +sla_PDQ2H slPDQH +sla_PERTEL slPRTL +sla_PERTUE slPRTE +sla_PLANEL slPLNE +sla_PLANET slPLNT +sla_PLANTE slPLTE +sla_PM slPM +sla_POLMO slPLMO +sla_PREBN slPRBN +sla_PREC slPREC +sla_PRECES slPRCE +sla_PRECL slPREL +sla_PRECSS slPRCS # no SLALIB version +sla_PRENUT slPRNU +sla_PV2EL slPVEL +sla_PV2UE slPVUE +sla_PVOBS slPVOB +sla_PXY slPXY + +sla_RANGE slRA1P +sla_RANORM slRA2P +sla_RCC slRCC +sla_RDPLAN slRDPL +sla_REFCO slRFCO +sla_REFCOQ slRFCQ +sla_REFRO slRFRO +sla_REFV slREFV +sla_REFZ slREFZ +sla_RVEROT slRVER +sla_RVGALC slRVGA +sla_RVLG slRVLG +sla_RVLSRD slRVLD +sla_RVLSRK slRVLK + +sla_S2TP slS2TP +sla_SEP slSEP +sla_SMAT slSMAT +sla_SUBET slSUET +sla_SUPGAL slSUGA +sla_SVD slSVD +sla_SVDCOV slSVDC +sla_SVDSOL slSVDS + +sla_TP2S slTP2S +sla_TP2V slTP2V +sla_TPS2C slTPSC +sla_TPV2C slTPVC + +sla_UE2EL slUEEL +sla_UE2PV slUEPV +sla_UNPCD slUPCD + +sla_V2TP slV2TP +sla_VDV slVDV +sla_VN slVN +sla_VXV slVXV + +sla_XY2XY slXYXY +sla_ZD slZD diff --git a/math/slalib/SED1 b/math/slalib/SED1 new file mode 100644 index 00000000..8fdff423 --- /dev/null +++ b/math/slalib/SED1 @@ -0,0 +1,214 @@ +1,$s/sla_ADDET/slADET/g +1,$s/sla_AFIN/slAFIN/g +1,$s/sla_AIRMAS/slARMS/g +1,$s/sla_ALTAZ/slALAZ/g +1,$s/sla_AMPQK/slAMPQ/g +1,$s/sla_AMP/slAMP/g +1,$s/sla_AOPPAT/slAOPT/g +1,$s/sla_AOPPA/slAOPA/g +1,$s/sla_AOPQK/slAOPQ/g +1,$s/sla_AOP/slAOP/g +1,$s/sla_ATMDSP/slATMD/g +1,$s/sla__ATMS/slATMS/g +1,$s/sla__ATMT/slATMT/g +1,$s/sla_AV2M/slAV2M/g + +1,$s/sla_BEAR/slBEAR/g + +1,$s/sla_CAF2R/slCAFR/g +1,$s/sla_CALDJ/slCADJ/g +1,$s/sla_CALYD/slCAYD/g +1,$s/sla_CC2S/slCC2S/g +1,$s/sla_CC62S/slC62S/g +1,$s/sla_CD2TF/slCDTF/g +1,$s/sla_CLDJ/slCLDJ/g +1,$s/sla_CLYD/slCLYD/g +1,$s/sla_CR2AF/slCRAF/g +1,$s/sla_CR2TF/slCRTF/g +1,$s/sla_CS2C6/slS2C6/g +1,$s/sla_CS2C/slCS2C/g +1,$s/sla_CTF2D/slCTFD/g +1,$s/sla_CTF2R/slCTFR/g + +1,$s/sla_DAF2R/slDAFR/g +1,$s/sla_DAFIN/slDAFN/g +1,$s/sla_DAT/slDAT/g +1,$s/sla_DAV2M/slDAVM/g +1,$s/sla_DBEAR/slDBER/g +1,$s/sla_DBJIN/slDBJI/g +1,$s/sla_DC62S/slDC6S/g +1,$s/sla_DCC2S/slDC2S/g +1,$s/sla_DCMPF/slDCMF/g +1,$s/sla_DCS2C/slDS2C/g +1,$s/sla_DD2TF/slDDTF/g +1,$s/sla_DE2H/slDE2H/g +1,$s/sla_DEULER/slDEUL/g +1,$s/sla_DFLTIN/slDFLI/g +1,$s/sla_DH2E/slDH2E/g +1,$s/sla_DIMXV/slDIMV/g +1,$s/sla_DJCAL/slDJCA/g +1,$s/sla_DJCL/slDJCL/g +1,$s/sla_DM2AV/slDMAV/g +1,$s/sla_DMAT/slDMAT/g +1,$s/sla_DMOON/slDMON/g +1,$s/sla_DMXM/slDMXM/g +1,$s/sla_DMXV/slDMXV/g +1,$s/sla_DPAV/slDPAV/g +1,$s/sla_DR2AF/slDRAF/g +1,$s/sla_DR2TF/slDRTF/g +1,$s/sla_DRANGE/slDA1P/g +1,$s/sla_DRANRM/slDA2P/g +1,$s/sla_DS2C6/slDSC6/g +1,$s/sla_DS2TP/slDSTP/g +1,$s/sla_DSEP/slDSEP/g +1,$s/sla_DTF2D/slDTFD/g +1,$s/sla_DTF2R/slDTFR/g +1,$s/sla_DTP2S/slDTPS/g +1,$s/sla_DTP2V/slDTPV/g +1,$s/sla_DTPS2C/slDPSC/g +1,$s/sla_DTPV2C/slDPVC/g +1,$s/sla_DTT/slDTT/g +1,$s/sla_DT/slDT/g + +1,$s/sla_DV2TP/slDVTP/g +1,$s/sla_DVDV/slDVDV/g +1,$s/sla_DVN/slDVN/g +1,$s/sla_DVXV/slDVXV/g + +1,$s/sla_E2H/slE2H/g +1,$s/sla_EARTH/slERTH/g +1,$s/sla_ECLEQ/slECEQ/g +1,$s/sla_ECMAT/slECMA/g +1,$s/sla_ECOR/slECOR/g +1,$s/sla_EG50/slEG50/g +1,$s/sla_EL2UE/slELUE/g +1,$s/sla_EPB2D/slEB2D/g +1,$s/sla_EPB/slEPB/g +1,$s/sla_EPCO/slEPCO/g +1,$s/sla_EPJ2D/slEJ2D/g +1,$s/sla_EPJ/slEPJ/g +1,$s/sla_EQECL/slEQEC/g +1,$s/sla_EQEQX/slEQEX/g +1,$s/sla_EQGAL/slEQGA/g +1,$s/sla_ETRMS/slETRM/g +1,$s/sla_EULER/slEULR/g +1,$s/sla_EVP/slEVP/g + +1,$s/sla_FITXY/slFTXY/g +1,$s/sla_FK425/slFK45/g +1,$s/sla_FK45Z/slF45Z/g +1,$s/sla_FK524/slFK54/g +1,$s/sla_FK52H/slFK5H/g +1,$s/sla_FK54Z/slF54Z/g +1,$s/sla_FK5HZ/slF5HZ/g +1,$s/sla_FLOTIN/slRFLI/g + +1,$s/sla_GALEQ/slGAEQ/g +1,$s/sla_GALSUP/slGASU/g +1,$s/sla_GE50/slGE50/g +1,$s/sla_GEOC/slGEOC/g +1,$s/sla_GMSTA/slGMSA/g +1,$s/sla_GMST/slGMST/g +1,$s/sla_GRESID/slGRES/g + +1,$s/sla_H2E/slH2E/g +1,$s/sla_H2FK5/slHFK5/g +1,$s/sla_HFK5Z/slHF5Z/g + +1,$s/sla__IDCHI/slICHI/g +1,$s/sla__IDCHF/slICHF/g +1,$s/sla_IMXV/slIMXV/g +1,$s/sla_INTIN/slINTI/g +1,$s/sla_INVF/slINVF/g + +1,$s/sla_KBJ/slKBJ/g + +1,$s/sla_M2AV/slM2AV/g +1,$s/sla_MAPPA/slMAPA/g +1,$s/sla_MAPQKZ/slMAPZ/g +1,$s/sla_MAPQK/slMAPQ/g +1,$s/sla_MAP/slMAP/g +1,$s/sla_MOON/slMOON/g +1,$s/sla_MXM/slMXM/g +1,$s/sla_MXV/slMXV/g + +1,$s/sla_NUTC/slNUTC/g +1,$s/sla_NUT/slNUT/g + +1,$s/sla_OAPQK/slOAPQ/g +1,$s/sla_OAP/slOAP/g +1,$s/sla_OBS/slOBS/g + +1,$s/sla_PA/slPA/g +1,$s/sla_PAV/slPAV/g +1,$s/sla_PCD/slPCD/g +1,$s/sla_PDA2H/slPDAH/g +1,$s/sla_PDQ2H/slPDQH/g +1,$s/sla_PERTEL/slPRTL/g +1,$s/sla_PERTUE/slPRTE/g +1,$s/sla_PLANEL/slPLNE/g +1,$s/sla_PLANET/slPLNT/g +1,$s/sla_PLANTE/slPLTE/g +1,$s/sla_PM/slPM/g +1,$s/sla_POLMO/slPLMO/g +1,$s/sla_PREBN/slPRBN/g +1,$s/sla_PRECES/slPRCE/g +1,$s/sla_PRECL/slPREL/g +1,$s/sla_PREC/slPREC/g +1,$s/sla_PRENUT/slPRNU/g +1,$s/sla_PV2EL/slPVEL/g +1,$s/sla_PV2UE/slPVUE/g +1,$s/sla_PVOBS/slPVOB/g +1,$s/sla_PXY/slPXY/g + +1,$s/sla_RANDOM/slRNDM/g +1,$s/sla_RANGE/slRA1P/g +1,$s/sla_RANORM/slRA2P/g +1,$s/sla_RCC/slRCC/g +1,$s/sla_RDPLAN/slRDPL/g +1,$s/sla_REFCOQ/slRFCQ/g +1,$s/sla_REFCO/slRFCO/g +1,$s/sla_REFRO/slRFRO/g +1,$s/sla_REFV/slREFV/g +1,$s/sla_REFZ/slREFZ/g +1,$s/sla_RVEROT/slRVER/g +1,$s/sla_RVGALC/slRVGA/g +1,$s/sla_RVLG/slRVLG/g +1,$s/sla_RVLSRD/slRVLD/g +1,$s/sla_RVLSRK/slRVLK/g + +1,$s/sla_S2TP/slS2TP/g +1,$s/sla_SEP/slSEP/g +1,$s/sla_SMAT/slSMAT/g +1,$s/sla_SUBET/slSUET/g +1,$s/sla_SUPGAL/slSUGA/g +1,$s/sla_SVDCOV/slSVDC/g +1,$s/sla_SVDSOL/slSVDS/g +1,$s/sla_SVD/slSVD/g + +1,$s/sla_TP2S/slTP2S/g +1,$s/sla_TP2V/slTP2V/g +1,$s/sla_TPS2C/slTPSC/g +1,$s/sla_TPV2C/slTPVC/g + +1,$s/sla_UE2EL/slUEEL/g +1,$s/sla_UE2PV/slUEPV/g +1,$s/sla_UNPCD/slUPCD/g + +1,$s/sla_V2TP/slV2TP/g +1,$s/sla_VDV/slVDV/g +1,$s/sla_VN/slVN/g +1,$s/sla_VXV/slVXV/g + +1,$s/sla_WAIT/slWAIT/g +1,$s/sla_XY2XY/slXYXY/g + +1,$s/sla_ZD/slZD/g + + +1,$s/sla_COMBN/slCMBN/g +1,$s/sla_EPV/slEPV/g +1,$s/sla_PERMUT/slPERM/g +1,$s/sla_PLANTU/slPLTU/g +1,$s/sla_VERI/slVERI/g +1,$s/sla_WAIT/slWAIT/g diff --git a/math/slalib/SED2 b/math/slalib/SED2 new file mode 100644 index 00000000..e63ffd7a --- /dev/null +++ b/math/slalib/SED2 @@ -0,0 +1,132 @@ +1,$s/A D D E T/A D E T/g +1,$s/A I R M A S/A R M S/g +1,$s/A L T A Z/A L A Z/g +1,$s/A M P Q K/A M P Q/g +1,$s/A O P P A T/A O P T/g +1,$s/A O P P A/A O P A/g +1,$s/A O P Q K/A O P Q/g +1,$s/A T M D S P/A T M D/g + + +1,$s/C A F 2 R/C A F R/g +1,$s/C A L D J/C A D J/g +1,$s/C A L Y D/C A Y D/g +1,$s/C C 6 2 S/C 6 2 S/g +1,$s/C D 2 T F/C D T F/g +1,$s/C R 2 A F/C R A F/g +1,$s/C R 2 T F/C R T F/g +1,$s/C S 2 C 6/S 2 C 6/g +1,$s/C T F 2 D/C T F D/g +1,$s/C T F 2 R/C T F R/g + +1,$s/D A F 2 R/D A F R/g +1,$s/D A F I N/D A F N/g +1,$s/D A V 2 M/D A V M/g +1,$s/D B E A R/D B E R/g +1,$s/D B J I N/D B J I/g +1,$s/D C 6 2 S/D C 6 S/g +1,$s/D C C 2 S/D C 2 S/g +1,$s/D C M P F/D C M F/g +1,$s/D C S 2 C/D S 2 C/g +1,$s/D D 2 T F/D D T F/g +1,$s/D E U L E R/D E U L/g +1,$s/D F L T I N/D F L I/g +1,$s/D I M X V/D I M V/g +1,$s/D J C A L/D J C A/g +1,$s/D M 2 A V/D M A V/g +1,$s/D M O O N/D M O N/g +1,$s/D R 2 A F/D R A F/g +1,$s/D R 2 T F/D R T F/g +1,$s/D R A N G E/D A 1 P/g +1,$s/D R A N R M/D A 2 P/g +1,$s/D S 2 C 6/D S C 6/g +1,$s/D S 2 T P/D S T P/g +1,$s/D T F 2 D/D T F D/g +1,$s/D T F 2 R/D T F R/g +1,$s/D T P 2 S/D T P S/g +1,$s/D T P 2 V/D T P V/g +1,$s/D T P S 2 C/D P S C/g +1,$s/D T P V 2 C/D P V C/g +1,$s/D V 2 T P/D V T P/g + +1,$s/E A R T H/E R T H/g +1,$s/E C L E Q/E C E Q/g +1,$s/E C M A T/E C M A/g +1,$s/E L 2 U E/E L U E/g +1,$s/E P B 2 D/E B 2 D/g +1,$s/E P J 2 D/E J 2 D/g +1,$s/E Q E C L/E Q E C/g +1,$s/E Q E Q X/E Q E X/g +1,$s/E Q G A L/E Q G A/g +1,$s/E T R M S/E T R M/g +1,$s/E U L E R/E U L R/g + +1,$s/F I T X Y/F T X Y/g +1,$s/F K 4 2 5/F K 4 5/g +1,$s/F K 4 5 Z/F 4 5 Z/g +1,$s/F K 5 2 4/F K 5 4/g +1,$s/F K 5 2 H/F K 5 H/g +1,$s/F K 5 4 Z/F 5 4 Z/g +1,$s/F K 5 H Z/F 5 H Z/g + +1,$s/F L O T I N/R F L I/g + +1,$s/G A L E Q/G A E Q/g +1,$s/G A L S U P/G A S U/g +1,$s/G M S T A/G M S A/g +1,$s/G R E S I D/G R E S/g + +1,$s/H 2 F K 5/H F K 5/g +1,$s/H F K 5 Z/H F 5 Z/g + +1,$s/I D C H I/I C H I/g +1,$s/I D C H F/I C H F/g +1,$s/I N T I N/I N T I/g + +1,$s/M A P P A/M A P A/g +1,$s/M A P Q K Z/M A P Z/g +1,$s/M A P Q K/M A P Q/g + +1,$s/O A P Q K/O A P Q/g + +1,$s/P D A 2 H/P D A H/g +1,$s/P D Q 2 H/P D Q H/g +1,$s/P E R T E L/P R T L/g +1,$s/P E R T U E/P R T E/g +1,$s/P L A N E L/P L N L/g +1,$s/P L A N E T/P L N T/g +1,$s/P L A N T E/P L T E/g +1,$s/P O L M O/P L M O/g +1,$s/P R E B N/P R B N/g +1,$s/P R E C E S/P R C E/g +1,$s/P R E C L/P R E L/g +1,$s/P R E N U T/P R N U/g +1,$s/P V 2 U E/P V U E/g +1,$s/P V 2 E L/P V E L/g +1,$s/P V O B S/P V O B/g + +1,$s/R A N D O M/R N D M/g +1,$s/R A N G E/R A 1 P/g +1,$s/R A N O R M/R A 2 P/g +1,$s/R D P L A N/R D P L/g +1,$s/R E F C O Q/R F C Q/g +1,$s/R E F C O/R F C O/g +1,$s/R E F R O/R F R O/g +1,$s/R V E R O T/R V E R/g +1,$s/R V G A L C/R V G A/g +1,$s/R V L S R D/R V L D/g +1,$s/R V L S R K/R V L K/g + +1,$s/S U B E T/S U E T/g +1,$s/S U P G A L/S U G A/g +1,$s/S V D C O V/S V D C/g +1,$s/S V D S O L/S V D S/g + +1,$s/T P S 2 C/T P S C/g +1,$s/T P V 2 C/T P V C/g + +1,$s/U E 2 E L/U E E L/g +1,$s/U E 2 P V/U E P V/g +1,$s/U N P C D/U P C D/g + +1,$s/X Y 2 X Y/X Y X Y/g diff --git a/math/slalib/SLA_CONDITIONS b/math/slalib/SLA_CONDITIONS new file mode 100644 index 00000000..2bc1e36b --- /dev/null +++ b/math/slalib/SLA_CONDITIONS @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/math/slalib/addet.f b/math/slalib/addet.f new file mode 100644 index 00000000..4c58c8a8 --- /dev/null +++ b/math/slalib/addet.f @@ -0,0 +1,85 @@ + SUBROUTINE slADET (RM, DM, EQ, RC, DC) +*+ +* - - - - - - +* A D E T +* - - - - - - +* +* Add the E-terms (elliptic component of annual aberration) +* to a pre IAU 1976 mean place to conform to the old +* catalogue convention (double precision) +* +* Given: +* RM,DM dp RA,Dec (radians) without E-terms +* EQ dp Besselian epoch of mean equator and equinox +* +* Returned: +* RC,DC dp RA,Dec (radians) with E-terms included +* +* Note: +* +* Most star positions from pre-1984 optical catalogues (or +* derived from astrometry using such stars) embody the +* E-terms. If it is necessary to convert a formal mean +* place (for example a pulsar timing position) to one +* consistent with such a star catalogue, then the RA,Dec +* should be adjusted using this routine. +* +* Reference: +* Explanatory Supplement to the Astronomical Ephemeris, +* section 2D, page 48. +* +* Called: slETRM, slDS2C, slDC2S, slDA2P, slDA1P +* +* P.T.Wallace Starlink 18 March 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RM,DM,EQ,RC,DC + + DOUBLE PRECISION slDA2P + + DOUBLE PRECISION A(3),V(3) + + INTEGER I + + + +* E-terms vector + CALL slETRM(EQ,A) + +* Spherical to Cartesian + CALL slDS2C(RM,DM,V) + +* Include the E-terms + DO I=1,3 + V(I)=V(I)+A(I) + END DO + +* Cartesian to spherical + CALL slDC2S(V,RC,DC) + +* Bring RA into conventional range + RC=slDA2P(RC) + + END diff --git a/math/slalib/afin.f b/math/slalib/afin.f new file mode 100644 index 00000000..7e7fac4f --- /dev/null +++ b/math/slalib/afin.f @@ -0,0 +1,120 @@ + SUBROUTINE slAFIN (STRING, IPTR, A, J) +*+ +* - - - - - +* A F I N +* - - - - - +* +* Sexagesimal character string to angle (single precision) +* +* Given: +* STRING c*(*) string containing deg, arcmin, arcsec fields +* IPTR i pointer to start of decode (1st = 1) +* +* Returned: +* IPTR i advanced past the decoded angle +* A r angle in radians +* J i status: 0 = OK +* +1 = default, A unchanged +* -1 = bad degrees ) +* -2 = bad arcminutes ) (note 3) +* -3 = bad arcseconds ) +* +* Example: +* +* argument before after +* +* STRING '-57 17 44.806 12 34 56.7' unchanged +* IPTR 1 16 (points to 12...) +* A ? -1.00000 +* J ? 0 +* +* A further call to slAFIN, without adjustment of IPTR, will +* decode the second angle, 12deg 34min 56.7sec. +* +* Notes: +* +* 1) The first three "fields" in STRING are degrees, arcminutes, +* arcseconds, separated by spaces or commas. The degrees field +* may be signed, but not the others. The decoding is carried +* out by the DFLTIN routine and is free-format. +* +* 2) Successive fields may be absent, defaulting to zero. For +* zero status, the only combinations allowed are degrees alone, +* degrees and arcminutes, and all three fields present. If all +* three fields are omitted, a status of +1 is returned and A is +* unchanged. In all other cases A is changed. +* +* 3) Range checking: +* +* The degrees field is not range checked. However, it is +* expected to be integral unless the other two fields are +* absent. +* +* The arcminutes field is expected to be 0-59, and integral if +* the arcseconds field is present. If the arcseconds field +* is absent, the arcminutes is expected to be 0-59.9999... +* +* The arcseconds field is expected to be 0-59.9999... +* +* 4) Decoding continues even when a check has failed. Under these +* circumstances the field takes the supplied value, defaulting +* to zero, and the result A is computed and returned. +* +* 5) Further fields after the three expected ones are not treated +* as an error. The pointer IPTR is left in the correct state +* for further decoding with the present routine or with DFLTIN +* etc. See the example, above. +* +* 6) If STRING contains hours, minutes, seconds instead of degrees +* etc, or if the required units are turns (or days) instead of +* radians, the result A should be multiplied as follows: +* +* for to obtain multiply +* STRING A in A by +* +* d ' " radians 1 = 1.0 +* d ' " turns 1/2pi = 0.1591549430918953358 +* h m s radians 15 = 15.0 +* h m s days 15/2pi = 2.3873241463784300365 +* +* Called: slDAFN +* +* P.T.Wallace Starlink 13 September 1990 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) STRING + INTEGER IPTR + REAL A + INTEGER J + + DOUBLE PRECISION AD + + + +* Call the double precision version + CALL slDAFN(STRING,IPTR,AD,J) + IF (J.LE.0) A=REAL(AD) + + END diff --git a/math/slalib/airmas.f b/math/slalib/airmas.f new file mode 100644 index 00000000..aa9d08f0 --- /dev/null +++ b/math/slalib/airmas.f @@ -0,0 +1,76 @@ + DOUBLE PRECISION FUNCTION slARMS (ZD) +*+ +* - - - - - - - +* A R M S +* - - - - - - - +* +* Air mass at given zenith distance (double precision) +* +* Given: +* ZD d Observed zenith distance (radians) +* +* The result is an estimate of the air mass, in units of that +* at the zenith. +* +* Notes: +* +* 1) The "observed" zenith distance referred to above means "as +* affected by refraction". +* +* 2) Uses Hardie's (1962) polynomial fit to Bemporad's data for +* the relative air mass, X, in units of thickness at the zenith +* as tabulated by Schoenberg (1929). This is adequate for all +* normal needs as it is accurate to better than 0.1% up to X = +* 6.8 and better than 1% up to X = 10. Bemporad's tabulated +* values are unlikely to be trustworthy to such accuracy +* because of variations in density, pressure and other +* conditions in the atmosphere from those assumed in his work. +* +* 3) The sign of the ZD is ignored. +* +* 4) At zenith distances greater than about ZD = 87 degrees the +* air mass is held constant to avoid arithmetic overflows. +* +* References: +* Hardie, R.H., 1962, in "Astronomical Techniques" +* ed. W.A. Hiltner, University of Chicago Press, p180. +* Schoenberg, E., 1929, Hdb. d. Ap., +* Berlin, Julius Springer, 2, 268. +* +* Original code by P.W.Hill, St Andrews +* +* P.T.Wallace Starlink 18 March 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION ZD + + DOUBLE PRECISION SECZM1 + + + SECZM1 = 1D0/(COS(MIN(1.52D0,ABS(ZD))))-1D0 + slARMS = 1D0 + SECZM1*(0.9981833D0 + : - SECZM1*(0.002875D0 + 0.0008083D0*SECZM1)) + + END diff --git a/math/slalib/altaz.f b/math/slalib/altaz.f new file mode 100644 index 00000000..ca34a0d4 --- /dev/null +++ b/math/slalib/altaz.f @@ -0,0 +1,163 @@ + SUBROUTINE slALAZ (HA, DEC, PHI, + : AZ, AZD, AZDD, EL, ELD, ELDD, PA, PAD, PADD) +*+ +* - - - - - - +* A L A Z +* - - - - - - +* +* Positions, velocities and accelerations for an altazimuth +* telescope mount. +* +* (double precision) +* +* Given: +* HA d hour angle +* DEC d declination +* PHI d observatory latitude +* +* Returned: +* AZ d azimuth +* AZD d " velocity +* AZDD d " acceleration +* EL d elevation +* ELD d " velocity +* ELDD d " acceleration +* PA d parallactic angle +* PAD d " " velocity +* PADD d " " acceleration +* +* Notes: +* +* 1) Natural units are used throughout. HA, DEC, PHI, AZ, EL +* and ZD are in radians. The velocities and accelerations +* assume constant declination and constant rate of change of +* hour angle (as for tracking a star); the units of AZD, ELD +* and PAD are radians per radian of HA, while the units of AZDD, +* ELDD and PADD are radians per radian of HA squared. To +* convert into practical degree- and second-based units: +* +* angles * 360/2pi -> degrees +* velocities * (2pi/86400)*(360/2pi) -> degree/sec +* accelerations * ((2pi/86400)**2)*(360/2pi) -> degree/sec/sec +* +* Note that the seconds here are sidereal rather than SI. One +* sidereal second is about 0.99727 SI seconds. +* +* The velocity and acceleration factors assume the sidereal +* tracking case. Their respective numerical values are (exactly) +* 1/240 and (approximately) 1/3300236.9. +* +* 2) Azimuth is returned in the range 0-2pi; north is zero, +* and east is +pi/2. Elevation and parallactic angle are +* returned in the range +/-pi. Parallactic angle is +ve for +* a star west of the meridian and is the angle NP-star-zenith. +* +* 3) The latitude is geodetic as opposed to geocentric. The +* hour angle and declination are topocentric. Refraction and +* deficiencies in the telescope mounting are ignored. The +* purpose of the routine is to give the general form of the +* quantities. The details of a real telescope could profoundly +* change the results, especially close to the zenith. +* +* 4) No range checking of arguments is carried out. +* +* 5) In applications which involve many such calculations, rather +* than calling the present routine it will be more efficient to +* use inline code, having previously computed fixed terms such +* as sine and cosine of latitude, and (for tracking a star) +* sine and cosine of declination. +* +* This revision: 29 October 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION HA,DEC,PHI,AZ,AZD,AZDD,EL,ELD,ELDD,PA,PAD,PADD + + DOUBLE PRECISION DPI,D2PI,TINY + PARAMETER (DPI=3.1415926535897932384626433832795D0, + : D2PI=6.283185307179586476925286766559D0, + : TINY=1D-30) + + DOUBLE PRECISION SH,CH,SD,CD,SP,CP,CHCD,SDCP,X,Y,Z,RSQ,R,A,E,C,S, + : Q,QD,AD,ED,EDR,ADD,EDD,QDD + + +* Useful functions + SH=SIN(HA) + CH=COS(HA) + SD=SIN(DEC) + CD=COS(DEC) + SP=SIN(PHI) + CP=COS(PHI) + CHCD=CH*CD + SDCP=SD*CP + X=-CHCD*SP+SDCP + Y=-SH*CD + Z=CHCD*CP+SD*SP + RSQ=X*X+Y*Y + R=SQRT(RSQ) + +* Azimuth and elevation + IF (RSQ.EQ.0D0) THEN + A=0D0 + ELSE + A=ATAN2(Y,X) + END IF + IF (A.LT.0D0) A=A+D2PI + E=ATAN2(Z,R) + +* Parallactic angle + C=CD*SP-CH*SDCP + S=SH*CP + IF (C*C+S*S.GT.0) THEN + Q=ATAN2(S,C) + ELSE + Q=DPI-HA + END IF + +* Velocities and accelerations (clamped at zenith/nadir) + IF (RSQ.LT.TINY) THEN + RSQ=TINY + R=SQRT(RSQ) + END IF + QD=-X*CP/RSQ + AD=SP+Z*QD + ED=CP*Y/R + EDR=ED/R + ADD=EDR*(Z*SP+(2D0-RSQ)*QD) + EDD=-R*QD*AD + QDD=EDR*(SP+2D0*Z*QD) + +* Results + AZ=A + AZD=AD + AZDD=ADD + EL=E + ELD=ED + ELDD=EDD + PA=Q + PAD=QD + PADD=QDD + + END diff --git a/math/slalib/amp.f b/math/slalib/amp.f new file mode 100644 index 00000000..d6aff8df --- /dev/null +++ b/math/slalib/amp.f @@ -0,0 +1,89 @@ + SUBROUTINE slAMP (RA, DA, DATE, EQ, RM, DM) +*+ +* - - - - +* A M P +* - - - - +* +* Convert star RA,Dec from geocentric apparent to mean place +* +* The mean coordinate system is the post IAU 1976 system, +* loosely called FK5. +* +* Given: +* RA d apparent RA (radians) +* DA d apparent Dec (radians) +* DATE d TDB for apparent place (JD-2400000.5) +* EQ d equinox: Julian epoch of mean place +* +* Returned: +* RM d mean RA (radians) +* DM d mean Dec (radians) +* +* References: +* 1984 Astronomical Almanac, pp B39-B41. +* (also Lederle & Schwan, Astron. Astrophys. 134, +* 1-6, 1984) +* +* Notes: +* +* 1) The distinction between the required TDB and TT is always +* negligible. Moreover, for all but the most critical +* applications UTC is adequate. +* +* 2) Iterative techniques are used for the aberration and light +* deflection corrections so that the routines slAMP (or +* slAMPQ) and slMAP (or slMAPQ) are accurate inverses; +* even at the edge of the Sun's disc the discrepancy is only +* about 1 nanoarcsecond. +* +* 3) Where multiple apparent places are to be converted to mean +* places, for a fixed date and equinox, it is more efficient to +* use the slMAPA routine to compute the required parameters +* once, followed by one call to slAMPQ per star. +* +* 4) The accuracy is sub-milliarcsecond, limited by the +* precession-nutation model (IAU 1976 precession, Shirai & +* Fukushima 2001 forced nutation and precession corrections). +* +* 5) The accuracy is further limited by the routine slEVP, called +* by slMAPA, which computes the Earth position and velocity +* using the methods of Stumpff. The maximum error is about +* 0.3 mas. +* +* Called: slMAPA, slAMPQ +* +* P.T.Wallace Starlink 17 September 2001 +* +* Copyright (C) 2001 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RA,DA,DATE,EQ,RM,DM + + DOUBLE PRECISION AMPRMS(21) + + + + CALL slMAPA(EQ,DATE,AMPRMS) + CALL slAMPQ(RA,DA,AMPRMS,RM,DM) + + END diff --git a/math/slalib/ampqk.f b/math/slalib/ampqk.f new file mode 100644 index 00000000..4bf95b69 --- /dev/null +++ b/math/slalib/ampqk.f @@ -0,0 +1,140 @@ + SUBROUTINE slAMPQ (RA, DA, AMPRMS, RM, DM) +*+ +* - - - - - - +* A M P Q +* - - - - - - +* +* Convert star RA,Dec from geocentric apparent to mean place +* +* The mean coordinate system is the post IAU 1976 system, +* loosely called FK5. +* +* Use of this routine is appropriate when efficiency is important +* and where many star positions are all to be transformed for +* one epoch and equinox. The star-independent parameters can be +* obtained by calling the slMAPA routine. +* +* Given: +* RA d apparent RA (radians) +* DA d apparent Dec (radians) +* +* AMPRMS d(21) star-independent mean-to-apparent parameters: +* +* (1) time interval for proper motion (Julian years) +* (2-4) barycentric position of the Earth (AU) +* (5-7) heliocentric direction of the Earth (unit vector) +* (8) (grav rad Sun)*2/(Sun-Earth distance) +* (9-11) ABV: barycentric Earth velocity in units of c +* (12) sqrt(1-v**2) where v=modulus(ABV) +* (13-21) precession/nutation (3,3) matrix +* +* Returned: +* RM d mean RA (radians) +* DM d mean Dec (radians) +* +* References: +* 1984 Astronomical Almanac, pp B39-B41. +* (also Lederle & Schwan, Astron. Astrophys. 134, +* 1-6, 1984) +* +* Note: +* +* Iterative techniques are used for the aberration and +* light deflection corrections so that the routines +* slAMP (or slAMPQ) and slMAP (or slMAPQ) are +* accurate inverses; even at the edge of the Sun's disc +* the discrepancy is only about 1 nanoarcsecond. +* +* Called: slDS2C, slDIMV, slDVDV, slDVN, slDC2S, +* slDA2P +* +* P.T.Wallace Starlink 7 May 2000 +* +* Copyright (C) 2000 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RA,DA,AMPRMS(21),RM,DM + + INTEGER I,J + + DOUBLE PRECISION GR2E,AB1,EHN(3),ABV(3),P3(3),P2(3), + : AB1P1,P1DV,P1DVP1,P1(3),W,PDE,PDEP1,P(3) + + DOUBLE PRECISION slDVDV,slDA2P + + + +* Unpack scalar and vector parameters + GR2E = AMPRMS(8) + AB1 = AMPRMS(12) + DO I=1,3 + EHN(I) = AMPRMS(I+4) + ABV(I) = AMPRMS(I+8) + END DO + +* Apparent RA,Dec to Cartesian + CALL slDS2C(RA,DA,P3) + +* Precession and nutation + CALL slDIMV(AMPRMS(13),P3,P2) + +* Aberration + AB1P1 = AB1+1D0 + DO I=1,3 + P1(I) = P2(I) + END DO + DO J=1,2 + P1DV = slDVDV(P1,ABV) + P1DVP1 = 1D0+P1DV + W = 1D0+P1DV/AB1P1 + DO I=1,3 + P1(I) = (P1DVP1*P2(I)-W*ABV(I))/AB1 + END DO + CALL slDVN(P1,P3,W) + DO I=1,3 + P1(I) = P3(I) + END DO + END DO + +* Light deflection + DO I=1,3 + P(I) = P1(I) + END DO + DO J=1,5 + PDE = slDVDV(P,EHN) + PDEP1 = 1D0+PDE + W = PDEP1-GR2E*PDE + DO I=1,3 + P(I) = (PDEP1*P1(I)-GR2E*EHN(I))/W + END DO + CALL slDVN(P,P2,W) + DO I=1,3 + P(I) = P2(I) + END DO + END DO + +* Mean RA,Dec + CALL slDC2S(P,RM,DM) + RM = slDA2P(RM) + + END diff --git a/math/slalib/aop.f b/math/slalib/aop.f new file mode 100644 index 00000000..0155deb1 --- /dev/null +++ b/math/slalib/aop.f @@ -0,0 +1,192 @@ + SUBROUTINE slAOP ( RAP, DAP, DATE, DUT, ELONGM, PHIM, HM, + : XP, YP, TDK, PMB, RH, WL, TLR, + : AOB, ZOB, HOB, DOB, ROB ) +*+ +* - - - - +* A O P +* - - - - +* +* Apparent to observed place, for sources distant from the solar +* system. +* +* Given: +* RAP d geocentric apparent right ascension +* DAP d geocentric apparent declination +* DATE d UTC date/time (Modified Julian Date, JD-2400000.5) +* DUT d delta UT: UT1-UTC (UTC seconds) +* ELONGM d mean longitude of the observer (radians, east +ve) +* PHIM d mean geodetic latitude of the observer (radians) +* HM d observer's height above sea level (metres) +* XP d polar motion x-coordinate (radians) +* YP d polar motion y-coordinate (radians) +* TDK d local ambient temperature (K; std=273.15D0) +* PMB d local atmospheric pressure (mb; std=1013.25D0) +* RH d local relative humidity (in the range 0D0-1D0) +* WL d effective wavelength (micron, e.g. 0.55D0) +* TLR d tropospheric lapse rate (K/metre, e.g. 0.0065D0) +* +* Returned: +* AOB d observed azimuth (radians: N=0,E=90) +* ZOB d observed zenith distance (radians) +* HOB d observed Hour Angle (radians) +* DOB d observed Declination (radians) +* ROB d observed Right Ascension (radians) +* +* Notes: +* +* 1) This routine returns zenith distance rather than elevation +* in order to reflect the fact that no allowance is made for +* depression of the horizon. +* +* 2) The accuracy of the result is limited by the corrections for +* refraction. Providing the meteorological parameters are +* known accurately and there are no gross local effects, the +* predicted apparent RA,Dec should be within about 0.1 arcsec +* for a zenith distance of less than 70 degrees. Even at a +* topocentric zenith distance of 90 degrees, the accuracy in +* elevation should be better than 1 arcmin; useful results +* are available for a further 3 degrees, beyond which the +* slRFRO routine returns a fixed value of the refraction. +* The complementary routines slAOP (or slAOPQ) and slOAP +* (or slOAPQ) are self-consistent to better than 1 micro- +* arcsecond all over the celestial sphere. +* +* 3) It is advisable to take great care with units, as even +* unlikely values of the input parameters are accepted and +* processed in accordance with the models used. +* +* 4) "Apparent" place means the geocentric apparent right ascension +* and declination, which is obtained from a catalogue mean place +* by allowing for space motion, parallax, precession, nutation, +* annual aberration, and the Sun's gravitational lens effect. For +* star positions in the FK5 system (i.e. J2000), these effects can +* be applied by means of the slMAP etc routines. Starting from +* other mean place systems, additional transformations will be +* needed; for example, FK4 (i.e. B1950) mean places would first +* have to be converted to FK5, which can be done with the +* slFK45 etc routines. +* +* 5) "Observed" Az,El means the position that would be seen by a +* perfect theodolite located at the observer. This is obtained +* from the geocentric apparent RA,Dec by allowing for Earth +* orientation and diurnal aberration, rotating from equator +* to horizon coordinates, and then adjusting for refraction. +* The HA,Dec is obtained by rotating back into equatorial +* coordinates, using the geodetic latitude corrected for polar +* motion, and is the position that would be seen by a perfect +* equatorial located at the observer and with its polar axis +* aligned to the Earth's axis of rotation (n.b. not to the +* refracted pole). Finally, the RA is obtained by subtracting +* the HA from the local apparent ST. +* +* 6) To predict the required setting of a real telescope, the +* observed place produced by this routine would have to be +* adjusted for the tilt of the azimuth or polar axis of the +* mounting (with appropriate corrections for mount flexures), +* for non-perpendicularity between the mounting axes, for the +* position of the rotator axis and the pointing axis relative +* to it, for tube flexure, for gear and encoder errors, and +* finally for encoder zero points. Some telescopes would, of +* course, exhibit other properties which would need to be +* accounted for at the appropriate point in the sequence. +* +* 7) This routine takes time to execute, due mainly to the +* rigorous integration used to evaluate the refraction. +* For processing multiple stars for one location and time, +* call slAOPA once followed by one call per star to slAOPQ. +* Where a range of times within a limited period of a few hours +* is involved, and the highest precision is not required, call +* slAOPA once, followed by a call to slAOPT each time the +* time changes, followed by one call per star to slAOPQ. +* +* 8) The DATE argument is UTC expressed as an MJD. This is, +* strictly speaking, wrong, because of leap seconds. However, +* as long as the delta UT and the UTC are consistent there +* are no difficulties, except during a leap second. In this +* case, the start of the 61st second of the final minute should +* begin a new MJD day and the old pre-leap delta UT should +* continue to be used. As the 61st second completes, the MJD +* should revert to the start of the day as, simultaneously, +* the delta UTC changes by one second to its post-leap new value. +* +* 9) The delta UT (UT1-UTC) is tabulated in IERS circulars and +* elsewhere. It increases by exactly one second at the end of +* each UTC leap second, introduced in order to keep delta UT +* within +/- 0.9 seconds. +* +* 10) IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. +* The longitude required by the present routine is east-positive, +* in accordance with geographical convention (and right-handed). +* In particular, note that the longitudes returned by the +* slOBS routine are west-positive, following astronomical +* usage, and must be reversed in sign before use in the present +* routine. +* +* 11) The polar coordinates XP,YP can be obtained from IERS +* circulars and equivalent publications. The maximum amplitude +* is about 0.3 arcseconds. If XP,YP values are unavailable, +* use XP=YP=0D0. See page B60 of the 1988 Astronomical Almanac +* for a definition of the two angles. +* +* 12) The height above sea level of the observing station, HM, +* can be obtained from the Astronomical Almanac (Section J +* in the 1988 edition), or via the routine slOBS. If P, +* the pressure in millibars, is available, an adequate +* estimate of HM can be obtained from the expression +* +* HM ~ -29.3D0*TSL*LOG(P/1013.25D0). +* +* where TSL is the approximate sea-level air temperature in K +* (see Astrophysical Quantities, C.W.Allen, 3rd edition, +* section 52). Similarly, if the pressure P is not known, +* it can be estimated from the height of the observing +* station, HM, as follows: +* +* P ~ 1013.25D0*EXP(-HM/(29.3D0*TSL)). +* +* Note, however, that the refraction is nearly proportional to the +* pressure and that an accurate P value is important for precise +* work. +* +* 13) The azimuths etc produced by the present routine are with +* respect to the celestial pole. Corrections to the terrestrial +* pole can be computed using slPLMO. +* +* Called: slAOPA, slAOPQ +* +* Last revision: 2 December 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RAP,DAP,DATE,DUT,ELONGM,PHIM,HM, + : XP,YP,TDK,PMB,RH,WL,TLR,AOB,ZOB,HOB,DOB,ROB + + DOUBLE PRECISION AOPRMS(14) + + + CALL slAOPA(DATE,DUT,ELONGM,PHIM,HM,XP,YP,TDK,PMB,RH,WL,TLR, + : AOPRMS) + CALL slAOPQ(RAP,DAP,AOPRMS,AOB,ZOB,HOB,DOB,ROB) + + END diff --git a/math/slalib/aoppa.f b/math/slalib/aoppa.f new file mode 100644 index 00000000..a8d51ccc --- /dev/null +++ b/math/slalib/aoppa.f @@ -0,0 +1,194 @@ + SUBROUTINE slAOPA ( DATE, DUT, ELONGM, PHIM, HM, + : XP, YP, TDK, PMB, RH, WL, TLR, AOPRMS ) +*+ +* - - - - - - +* A O P A +* - - - - - - +* +* Precompute apparent to observed place parameters required by +* slAOPQ and slOAPQ. +* +* Given: +* DATE d UTC date/time (modified Julian Date, JD-2400000.5) +* DUT d delta UT: UT1-UTC (UTC seconds) +* ELONGM d mean longitude of the observer (radians, east +ve) +* PHIM d mean geodetic latitude of the observer (radians) +* HM d observer's height above sea level (metres) +* XP d polar motion x-coordinate (radians) +* YP d polar motion y-coordinate (radians) +* TDK d local ambient temperature (K; std=273.15D0) +* PMB d local atmospheric pressure (mb; std=1013.25D0) +* RH d local relative humidity (in the range 0D0-1D0) +* WL d effective wavelength (micron, e.g. 0.55D0) +* TLR d tropospheric lapse rate (K/metre, e.g. 0.0065D0) +* +* Returned: +* AOPRMS d(14) star-independent apparent-to-observed parameters: +* +* (1) geodetic latitude (radians) +* (2,3) sine and cosine of geodetic latitude +* (4) magnitude of diurnal aberration vector +* (5) height (HM) +* (6) ambient temperature (TDK) +* (7) pressure (PMB) +* (8) relative humidity (RH) +* (9) wavelength (WL) +* (10) lapse rate (TLR) +* (11,12) refraction constants A and B (radians) +* (13) longitude + eqn of equinoxes + sidereal DUT (radians) +* (14) local apparent sidereal time (radians) +* +* Notes: +* +* 1) It is advisable to take great care with units, as even +* unlikely values of the input parameters are accepted and +* processed in accordance with the models used. +* +* 2) The DATE argument is UTC expressed as an MJD. This is, +* strictly speaking, improper, because of leap seconds. However, +* as long as the delta UT and the UTC are consistent there +* are no difficulties, except during a leap second. In this +* case, the start of the 61st second of the final minute should +* begin a new MJD day and the old pre-leap delta UT should +* continue to be used. As the 61st second completes, the MJD +* should revert to the start of the day as, simultaneously, +* the delta UTC changes by one second to its post-leap new value. +* +* 3) The delta UT (UT1-UTC) is tabulated in IERS circulars and +* elsewhere. It increases by exactly one second at the end of +* each UTC leap second, introduced in order to keep delta UT +* within +/- 0.9 seconds. +* +* 4) IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. +* The longitude required by the present routine is east-positive, +* in accordance with geographical convention (and right-handed). +* In particular, note that the longitudes returned by the +* slOBS routine are west-positive, following astronomical +* usage, and must be reversed in sign before use in the present +* routine. +* +* 5) The polar coordinates XP,YP can be obtained from IERS +* circulars and equivalent publications. The maximum amplitude +* is about 0.3 arcseconds. If XP,YP values are unavailable, +* use XP=YP=0D0. See page B60 of the 1988 Astronomical Almanac +* for a definition of the two angles. +* +* 6) The height above sea level of the observing station, HM, +* can be obtained from the Astronomical Almanac (Section J +* in the 1988 edition), or via the routine slOBS. If P, +* the pressure in millibars, is available, an adequate +* estimate of HM can be obtained from the expression +* +* HM ~ -29.3D0*TSL*LOG(P/1013.25D0). +* +* where TSL is the approximate sea-level air temperature in K +* (see Astrophysical Quantities, C.W.Allen, 3rd edition, +* section 52). Similarly, if the pressure P is not known, +* it can be estimated from the height of the observing +* station, HM, as follows: +* +* P ~ 1013.25D0*EXP(-HM/(29.3D0*TSL)). +* +* Note, however, that the refraction is nearly proportional to the +* pressure and that an accurate P value is important for precise +* work. +* +* 7) Repeated, computationally-expensive, calls to slAOPA for +* times that are very close together can be avoided by calling +* slAOPA just once and then using slAOPT for the subsequent +* times. Fresh calls to slAOPA will be needed only when +* changes in the precession have grown to unacceptable levels or +* when anything affecting the refraction has changed. +* +* Called: slGEOC, slRFCO, slEQEX, slAOPT +* +* Last revision: 2 December 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,DUT,ELONGM,PHIM,HM,XP,YP,TDK,PMB, + : RH,WL,TLR,AOPRMS(14) + + DOUBLE PRECISION slEQEX + +* 2Pi + DOUBLE PRECISION D2PI + PARAMETER (D2PI=6.283185307179586476925287D0) + +* Seconds of time to radians + DOUBLE PRECISION S2R + PARAMETER (S2R=7.272205216643039903848712D-5) + +* Speed of light (AU per day) + DOUBLE PRECISION C + PARAMETER (C=173.14463331D0) + +* Ratio between solar and sidereal time + DOUBLE PRECISION SOLSID + PARAMETER (SOLSID=1.00273790935D0) + + DOUBLE PRECISION CPHIM,XT,YT,ZT,XC,YC,ZC,ELONG,PHI,UAU,VAU + + + +* Observer's location corrected for polar motion + CPHIM = COS(PHIM) + XT = COS(ELONGM)*CPHIM + YT = SIN(ELONGM)*CPHIM + ZT = SIN(PHIM) + XC = XT-XP*ZT + YC = YT+YP*ZT + ZC = XP*XT-YP*YT+ZT + IF (XC.EQ.0D0.AND.YC.EQ.0D0) THEN + ELONG = 0D0 + ELSE + ELONG = ATAN2(YC,XC) + END IF + PHI = ATAN2(ZC,SQRT(XC*XC+YC*YC)) + AOPRMS(1) = PHI + AOPRMS(2) = SIN(PHI) + AOPRMS(3) = COS(PHI) + +* Magnitude of the diurnal aberration vector + CALL slGEOC(PHI,HM,UAU,VAU) + AOPRMS(4) = D2PI*UAU*SOLSID/C + +* Copy the refraction parameters and compute the A & B constants + AOPRMS(5) = HM + AOPRMS(6) = TDK + AOPRMS(7) = PMB + AOPRMS(8) = RH + AOPRMS(9) = WL + AOPRMS(10) = TLR + CALL slRFCO(HM,TDK,PMB,RH,WL,PHI,TLR,1D-10, + : AOPRMS(11),AOPRMS(12)) + +* Longitude + equation of the equinoxes + sidereal equivalent of DUT +* (ignoring change in equation of the equinoxes between UTC and TDB) + AOPRMS(13) = ELONG+slEQEX(DATE)+DUT*SOLSID*S2R + +* Sidereal time + CALL slAOPT(DATE,AOPRMS) + + END diff --git a/math/slalib/aoppat.f b/math/slalib/aoppat.f new file mode 100644 index 00000000..f086f7f7 --- /dev/null +++ b/math/slalib/aoppat.f @@ -0,0 +1,63 @@ + SUBROUTINE slAOPT (DATE, AOPRMS) +*+ +* - - - - - - - +* A O P T +* - - - - - - - +* +* Recompute the sidereal time in the apparent to observed place +* star-independent parameter block. +* +* Given: +* DATE d UTC date/time (modified Julian Date, JD-2400000.5) +* (see AOPPA source for comments on leap seconds) +* +* AOPRMS d(14) star-independent apparent-to-observed parameters +* +* (1-12) not required +* (13) longitude + eqn of equinoxes + sidereal DUT +* (14) not required +* +* Returned: +* AOPRMS d(14) star-independent apparent-to-observed parameters: +* +* (1-13) not changed +* (14) local apparent sidereal time (radians) +* +* For more information, see slAOPA. +* +* Called: slGMST +* +* P.T.Wallace Starlink 1 July 1993 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,AOPRMS(14) + + DOUBLE PRECISION slGMST + + + + AOPRMS(14) = slGMST(DATE)+AOPRMS(13) + + END diff --git a/math/slalib/aopqk.f b/math/slalib/aopqk.f new file mode 100644 index 00000000..5e327d34 --- /dev/null +++ b/math/slalib/aopqk.f @@ -0,0 +1,260 @@ + SUBROUTINE slAOPQ (RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB) +*+ +* - - - - - - +* A O P Q +* - - - - - - +* +* Quick apparent to observed place (but see note 8, below, for +* remarks about speed). +* +* Given: +* RAP d geocentric apparent right ascension +* DAP d geocentric apparent declination +* AOPRMS d(14) star-independent apparent-to-observed parameters: +* +* (1) geodetic latitude (radians) +* (2,3) sine and cosine of geodetic latitude +* (4) magnitude of diurnal aberration vector +* (5) height (HM) +* (6) ambient temperature (T) +* (7) pressure (P) +* (8) relative humidity (RH) +* (9) wavelength (WL) +* (10) lapse rate (TLR) +* (11,12) refraction constants A and B (radians) +* (13) longitude + eqn of equinoxes + sidereal DUT (radians) +* (14) local apparent sidereal time (radians) +* +* Returned: +* AOB d observed azimuth (radians: N=0,E=90) +* ZOB d observed zenith distance (radians) +* HOB d observed Hour Angle (radians) +* DOB d observed Declination (radians) +* ROB d observed Right Ascension (radians) +* +* Notes: +* +* 1) This routine returns zenith distance rather than elevation +* in order to reflect the fact that no allowance is made for +* depression of the horizon. +* +* 2) The accuracy of the result is limited by the corrections for +* refraction. Providing the meteorological parameters are +* known accurately and there are no gross local effects, the +* observed RA,Dec predicted by this routine should be within +* about 0.1 arcsec for a zenith distance of less than 70 degrees. +* Even at a topocentric zenith distance of 90 degrees, the +* accuracy in elevation should be better than 1 arcmin; useful +* results are available for a further 3 degrees, beyond which +* the slRFRO routine returns a fixed value of the refraction. +* The complementary routines slAOP (or slAOPQ) and sla_OaAP +* (or slOAPQ) are self-consistent to better than 1 micro- +* arcsecond all over the celestial sphere. +* +* 3) It is advisable to take great care with units, as even +* unlikely values of the input parameters are accepted and +* processed in accordance with the models used. +* +* 4) "Apparent" place means the geocentric apparent right ascension +* and declination, which is obtained from a catalogue mean place +* by allowing for space motion, parallax, precession, nutation, +* annual aberration, and the Sun's gravitational lens effect. For +* star positions in the FK5 system (i.e. J2000), these effects can +* be applied by means of the slMAP etc routines. Starting from +* other mean place systems, additional transformations will be +* needed; for example, FK4 (i.e. B1950) mean places would first +* have to be converted to FK5, which can be done with the +* slFK45 etc routines. +* +* 5) "Observed" Az,El means the position that would be seen by a +* perfect theodolite located at the observer. This is obtained +* from the geocentric apparent RA,Dec by allowing for Earth +* orientation and diurnal aberration, rotating from equator +* to horizon coordinates, and then adjusting for refraction. +* The HA,Dec is obtained by rotating back into equatorial +* coordinates, using the geodetic latitude corrected for polar +* motion, and is the position that would be seen by a perfect +* equatorial located at the observer and with its polar axis +* aligned to the Earth's axis of rotation (n.b. not to the +* refracted pole). Finally, the RA is obtained by subtracting +* the HA from the local apparent ST. +* +* 6) To predict the required setting of a real telescope, the +* observed place produced by this routine would have to be +* adjusted for the tilt of the azimuth or polar axis of the +* mounting (with appropriate corrections for mount flexures), +* for non-perpendicularity between the mounting axes, for the +* position of the rotator axis and the pointing axis relative +* to it, for tube flexure, for gear and encoder errors, and +* finally for encoder zero points. Some telescopes would, of +* course, exhibit other properties which would need to be +* accounted for at the appropriate point in the sequence. +* +* 7) The star-independent apparent-to-observed-place parameters +* in AOPRMS may be computed by means of the slAOPA routine. +* If nothing has changed significantly except the time, the +* slAOPT routine may be used to perform the requisite +* partial recomputation of AOPRMS. +* +* 8) At zenith distances beyond about 76 degrees, the need for +* special care with the corrections for refraction causes a +* marked increase in execution time. Moreover, the effect +* gets worse with increasing zenith distance. Adroit +* programming in the calling application may allow the +* problem to be reduced. Prepare an alternative AOPRMS array, +* computed for zero air-pressure; this will disable the +* refraction corrections and cause rapid execution. Using +* this AOPRMS array, a preliminary call to the present routine +* will, depending on the application, produce a rough position +* which may be enough to establish whether the full, slow +* calculation (using the real AOPRMS array) is worthwhile. +* For example, there would be no need for the full calculation +* if the preliminary call had already established that the +* source was well below the elevation limits for a particular +* telescope. +* +* 9) The azimuths etc produced by the present routine are with +* respect to the celestial pole. Corrections to the terrestrial +* pole can be computed using slPLMO. +* +* Called: slDS2C, slREFZ, slRFRO, slDC2S, slDA2P +* +* P.T.Wallace Starlink 24 October 2003 +* +* Copyright (C) 2003 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RAP,DAP,AOPRMS(14),AOB,ZOB,HOB,DOB,ROB + +* Breakpoint for fast/slow refraction algorithm: +* ZD greater than arctan(4), (see slRFCO routine) +* or vector Z less than cosine(arctan(Z)) = 1/sqrt(17) + DOUBLE PRECISION ZBREAK + PARAMETER (ZBREAK=0.242535625D0) + + INTEGER I + + DOUBLE PRECISION SPHI,CPHI,ST,V(3),XHD,YHD,ZHD,DIURAB,F, + : XHDT,YHDT,ZHDT,XAET,YAET,ZAET,AZOBS, + : ZDT,REFA,REFB,ZDOBS,DZD,DREF,CE, + : XAEO,YAEO,ZAEO,HMOBS,DCOBS,RAOBS + + DOUBLE PRECISION slDA2P + + + +* Sin, cos of latitude + SPHI = AOPRMS(2) + CPHI = AOPRMS(3) + +* Local apparent sidereal time + ST = AOPRMS(14) + +* Apparent RA,Dec to Cartesian -HA,Dec + CALL slDS2C(RAP-ST,DAP,V) + XHD = V(1) + YHD = V(2) + ZHD = V(3) + +* Diurnal aberration + DIURAB = AOPRMS(4) + F = (1D0-DIURAB*YHD) + XHDT = F*XHD + YHDT = F*(YHD+DIURAB) + ZHDT = F*ZHD + +* Cartesian -HA,Dec to Cartesian Az,El (S=0,E=90) + XAET = SPHI*XHDT-CPHI*ZHDT + YAET = YHDT + ZAET = CPHI*XHDT+SPHI*ZHDT + +* Azimuth (N=0,E=90) + IF (XAET.EQ.0D0.AND.YAET.EQ.0D0) THEN + AZOBS = 0D0 + ELSE + AZOBS = ATAN2(YAET,-XAET) + END IF + +* Topocentric zenith distance + ZDT = ATAN2(SQRT(XAET*XAET+YAET*YAET),ZAET) + +* +* Refraction +* ---------- + +* Fast algorithm using two constant model + REFA = AOPRMS(11) + REFB = AOPRMS(12) + CALL slREFZ(ZDT,REFA,REFB,ZDOBS) + +* Large zenith distance? + IF (COS(ZDOBS).LT.ZBREAK) THEN + +* Yes: use rigorous algorithm + +* Initialize loop (maximum of 10 iterations) + I = 1 + DZD = 1D1 + DO WHILE (ABS(DZD).GT.1D-10.AND.I.LE.10) + +* Compute refraction using current estimate of observed ZD + CALL slRFRO(ZDOBS,AOPRMS(5),AOPRMS(6),AOPRMS(7), + : AOPRMS(8),AOPRMS(9),AOPRMS(1), + : AOPRMS(10),1D-8,DREF) + +* Remaining discrepancy + DZD = ZDOBS+DREF-ZDT + +* Update the estimate + ZDOBS = ZDOBS-DZD + +* Increment the iteration counter + I = I+1 + END DO + END IF + +* To Cartesian Az/ZD + CE = SIN(ZDOBS) + XAEO = -COS(AZOBS)*CE + YAEO = SIN(AZOBS)*CE + ZAEO = COS(ZDOBS) + +* Cartesian Az/ZD to Cartesian -HA,Dec + V(1) = SPHI*XAEO+CPHI*ZAEO + V(2) = YAEO + V(3) = -CPHI*XAEO+SPHI*ZAEO + +* To spherical -HA,Dec + CALL slDC2S(V,HMOBS,DCOBS) + +* Right Ascension + RAOBS = slDA2P(ST+HMOBS) + +* Return the results + AOB = AZOBS + ZOB = ZDOBS + HOB = -HMOBS + DOB = DCOBS + ROB = RAOBS + + END diff --git a/math/slalib/atmdsp.f b/math/slalib/atmdsp.f new file mode 100644 index 00000000..76d43261 --- /dev/null +++ b/math/slalib/atmdsp.f @@ -0,0 +1,141 @@ + SUBROUTINE slATMD (TDK, PMB, RH, WL1, A1, B1, WL2, A2, B2) +*+ +* - - - - - - - +* A T M D +* - - - - - - - +* +* Apply atmospheric-dispersion adjustments to refraction coefficients. +* +* Given: +* TDK d ambient temperature, K +* PMB d ambient pressure, millibars +* RH d ambient relative humidity, 0-1 +* WL1 d reference wavelength, micrometre (0.4D0 recommended) +* A1 d refraction coefficient A for wavelength WL1 (radians) +* B1 d refraction coefficient B for wavelength WL1 (radians) +* WL2 d wavelength for which adjusted A,B required +* +* Returned: +* A2 d refraction coefficient A for wavelength WL2 (radians) +* B2 d refraction coefficient B for wavelength WL2 (radians) +* +* Notes: +* +* 1 To use this routine, first call slRFCO specifying WL1 as the +* wavelength. This yields refraction coefficients A1,B1, correct +* for that wavelength. Subsequently, calls to slATMD specifying +* different wavelengths will produce new, slightly adjusted +* refraction coefficients which apply to the specified wavelength. +* +* 2 Most of the atmospheric dispersion happens between 0.7 micrometre +* and the UV atmospheric cutoff, and the effect increases strongly +* towards the UV end. For this reason a blue reference wavelength +* is recommended, for example 0.4 micrometres. +* +* 3 The accuracy, for this set of conditions: +* +* height above sea level 2000 m +* latitude 29 deg +* pressure 793 mb +* temperature 17 degC +* humidity 50% +* lapse rate 0.0065 degC/m +* reference wavelength 0.4 micrometre +* star elevation 15 deg +* +* is about 2.5 mas RMS between 0.3 and 1.0 micrometres, and stays +* within 4 mas for the whole range longward of 0.3 micrometres +* (compared with a total dispersion from 0.3 to 20.0 micrometres +* of about 11 arcsec). These errors are typical for ordinary +* conditions and the given elevation; in extreme conditions values +* a few times this size may occur, while at higher elevations the +* errors become much smaller. +* +* 4 If either wavelength exceeds 100 micrometres, the radio case +* is assumed and the returned refraction coefficients are the +* same as the given ones. Note that radio refraction coefficients +* cannot be turned into optical values using this routine, nor +* vice versa. +* +* 5 The algorithm consists of calculation of the refractivity of the +* air at the observer for the two wavelengths, using the methods +* of the slRFRO routine, and then scaling of the two refraction +* coefficients according to classical refraction theory. This +* amounts to scaling the A coefficient in proportion to (n-1) and +* the B coefficient almost in the same ratio (see R.M.Green, +* "Spherical Astronomy", Cambridge University Press, 1985). +* +* Last revision 2 December 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION TDK,PMB,RH,WL1,A1,B1,WL2,A2,B2 + + DOUBLE PRECISION F,TDKOK,PMBOK,RHOK, + : PSAT,PWO,W1,WLOK,WLSQ,W2,DN1,DN2 + + +* Check for radio wavelengths + IF (WL1.GT.100D0.OR.WL2.GT.100D0) THEN + +* Radio: no dispersion + A2 = A1 + B2 = B1 + ELSE + +* Optical: keep arguments within safe bounds + TDKOK = MIN(MAX(TDK,100D0),500D0) + PMBOK = MIN(MAX(PMB,0D0),10000D0) + RHOK = MIN(MAX(RH,0D0),1D0) + +* Atmosphere parameters at the observer + PSAT = 10D0**(-8.7115D0+0.03477D0*TDKOK) + PWO = RHOK*PSAT + W1 = 11.2684D-6*PWO + +* Refractivity at the observer for first wavelength + WLOK = MAX(WL1,0.1D0) + WLSQ = WLOK*WLOK + W2 = 77.5317D-6+(0.43909D-6+0.00367D-6/WLSQ)/WLSQ + DN1 = (W2*PMBOK-W1)/TDKOK + +* Refractivity at the observer for second wavelength + WLOK = MAX(WL2,0.1D0) + WLSQ = WLOK*WLOK + W2 = 77.5317D-6+(0.43909D-6+0.00367D-6/WLSQ)/WLSQ + DN2 = (W2*PMBOK-W1)/TDKOK + +* Scale the refraction coefficients (see Green 4.31, p93) + IF (DN1.NE.0D0) THEN + F = DN2/DN1 + A2 = A1*F + B2 = B1*F + IF (DN1.NE.A1) B2=B2*(1D0+DN1*(DN1-DN2)/(2D0*(DN1-A1))) + ELSE + A2 = A1 + B2 = B1 + END IF + END IF + + END diff --git a/math/slalib/atms.f b/math/slalib/atms.f new file mode 100644 index 00000000..fcee9c68 --- /dev/null +++ b/math/slalib/atms.f @@ -0,0 +1,58 @@ + SUBROUTINE slATMS (RT, TT, DNT, GAMAL, R, DN, RDNDR) +*+ +* - - - - - +* A T M S +* - - - - - +* +* Internal routine used by REFRO +* +* Refractive index and derivative with respect to height for the +* stratosphere. +* +* Given: +* RT d height of tropopause from centre of the Earth (metre) +* TT d temperature at the tropopause (K) +* DNT d refractive index at the tropopause +* GAMAL d constant of the atmospheric model = G*MD/R +* R d current distance from the centre of the Earth (metre) +* +* Returned: +* DN d refractive index at R +* RDNDR d R * rate the refractive index is changing at R +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RT,TT,DNT,GAMAL,R,DN,RDNDR + + DOUBLE PRECISION B,W + + + B = GAMAL/TT + W = (DNT-1D0)*EXP(-B*(R-RT)) + DN = 1D0+W + RDNDR = -R*B*W + + END diff --git a/math/slalib/atmt.f b/math/slalib/atmt.f new file mode 100644 index 00000000..4534e7ed --- /dev/null +++ b/math/slalib/atmt.f @@ -0,0 +1,72 @@ + SUBROUTINE slATMT (R0, T0, ALPHA, GAMM2, DELM2, + : C1, C2, C3, C4, C5, C6, R, T, DN, RDNDR) +*+ +* - - - - - +* A T M T +* - - - - - +* +* Internal routine used by REFRO +* +* Refractive index and derivative with respect to height for the +* troposphere. +* +* Given: +* R0 d height of observer from centre of the Earth (metre) +* T0 d temperature at the observer (K) +* ALPHA d alpha ) +* GAMM2 d gamma minus 2 ) see HMNAO paper +* DELM2 d delta minus 2 ) +* C1 d useful term ) +* C2 d useful term ) +* C3 d useful term ) see source +* C4 d useful term ) of slRFRO +* C5 d useful term ) +* C6 d useful term ) +* R d current distance from the centre of the Earth (metre) +* +* Returned: +* T d temperature at R (K) +* DN d refractive index at R +* RDNDR d R * rate the refractive index is changing at R +* +* Note that in the optical case C5 and C6 are zero. +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION R0,T0,ALPHA,GAMM2,DELM2,C1,C2,C3,C4,C5,C6, + : R,T,DN,RDNDR + + DOUBLE PRECISION TT0,TT0GM2,TT0DM2 + + + T = MAX(MIN(T0-ALPHA*(R-R0),320D0),100D0) + TT0 = T/T0 + TT0GM2 = TT0**GAMM2 + TT0DM2 = TT0**DELM2 + DN = 1D0+(C1*TT0GM2-(C2-C5/T)*TT0DM2)*TT0 + RDNDR = R*(-C3*TT0GM2+(C4-C6/TT0)*TT0DM2) + + END diff --git a/math/slalib/av2m.f b/math/slalib/av2m.f new file mode 100644 index 00000000..69dab510 --- /dev/null +++ b/math/slalib/av2m.f @@ -0,0 +1,85 @@ + SUBROUTINE slAV2M (AXVEC, RMAT) +*+ +* - - - - - +* A V 2 M +* - - - - - +* +* Form the rotation matrix corresponding to a given axial vector. +* +* (single precision) +* +* A rotation matrix describes a rotation about some arbitrary axis, +* called the Euler axis. The "axial vector" supplied to this routine +* has the same direction as the Euler axis, and its magnitude is the +* amount of rotation in radians. +* +* Given: +* AXVEC r(3) axial vector (radians) +* +* Returned: +* RMAT r(3,3) rotation matrix +* +* If AXVEC is null, the unit matrix is returned. +* +* The reference frame rotates clockwise as seen looking along +* the axial vector from the origin. +* +* Last revision: 26 November 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL AXVEC(3),RMAT(3,3) + + REAL X,Y,Z,PHI,S,C,W + + + +* Rotation angle - magnitude of axial vector - and functions + X = AXVEC(1) + Y = AXVEC(2) + Z = AXVEC(3) + PHI = SQRT(X*X+Y*Y+Z*Z) + S = SIN(PHI) + C = COS(PHI) + W = 1.0-C + +* Euler axis - direction of axial vector (perhaps null) + IF (PHI.NE.0.0) THEN + X = X/PHI + Y = Y/PHI + Z = Z/PHI + END IF + +* Compute the rotation matrix + RMAT(1,1) = X*X*W+C + RMAT(1,2) = X*Y*W+Z*S + RMAT(1,3) = X*Z*W-Y*S + RMAT(2,1) = X*Y*W-Z*S + RMAT(2,2) = Y*Y*W+C + RMAT(2,3) = Y*Z*W+X*S + RMAT(3,1) = X*Z*W+Y*S + RMAT(3,2) = Y*Z*W-X*S + RMAT(3,3) = Z*Z*W+C + + END diff --git a/math/slalib/bear.f b/math/slalib/bear.f new file mode 100644 index 00000000..e023d533 --- /dev/null +++ b/math/slalib/bear.f @@ -0,0 +1,60 @@ + REAL FUNCTION slBEAR (A1, B1, A2, B2) +*+ +* - - - - - +* B E A R +* - - - - - +* +* Bearing (position angle) of one point on a sphere relative to another +* (single precision) +* +* Given: +* A1,B1 r spherical coordinates of one point +* A2,B2 r spherical coordinates of the other point +* +* (The spherical coordinates are RA,Dec, Long,Lat etc, in radians.) +* +* The result is the bearing (position angle), in radians, of point +* A2,B2 as seen from point A1,B1. It is in the range +/- pi. If +* A2,B2 is due east of A1,B1 the bearing is +pi/2. Zero is returned +* if the two points are coincident. +* +* P.T.Wallace Starlink 23 March 1991 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL A1,B1,A2,B2 + + REAL DA,X,Y + + + DA=A2-A1 + Y=SIN(DA)*COS(B2) + X=SIN(B2)*COS(B1)-COS(B2)*SIN(B1)*COS(DA) + IF (X.NE.0.0.OR.Y.NE.0.0) THEN + slBEAR=ATAN2(Y,X) + ELSE + slBEAR=0.0 + END IF + + END diff --git a/math/slalib/caf2r.f b/math/slalib/caf2r.f new file mode 100644 index 00000000..59a6c908 --- /dev/null +++ b/math/slalib/caf2r.f @@ -0,0 +1,75 @@ + SUBROUTINE slCAFR (IDEG, IAMIN, ASEC, RAD, J) +*+ +* - - - - - - +* C A F R +* - - - - - - +* +* Convert degrees, arcminutes, arcseconds to radians +* (single precision) +* +* Given: +* IDEG int degrees +* IAMIN int arcminutes +* ASEC real arcseconds +* +* Returned: +* RAD real angle in radians +* J int status: 0 = OK +* 1 = IDEG outside range 0-359 +* 2 = IAMIN outside range 0-59 +* 3 = ASEC outside range 0-59.999... +* +* Notes: +* +* 1) The result is computed even if any of the range checks +* fail. +* +* 2) The sign must be dealt with outside this routine. +* +* P.T.Wallace Starlink 23 August 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IDEG,IAMIN + REAL ASEC,RAD + INTEGER J + +* Arc seconds to radians + REAL AS2R + PARAMETER (AS2R=0.484813681109535994E-5) + + + +* Preset status + J=0 + +* Validate arcsec, arcmin, deg + IF (ASEC.LT.0.0.OR.ASEC.GE.60.0) J=3 + IF (IAMIN.LT.0.OR.IAMIN.GT.59) J=2 + IF (IDEG.LT.0.OR.IDEG.GT.359) J=1 + +* Compute angle + RAD=AS2R*(60.0*(60.0*REAL(IDEG)+REAL(IAMIN))+ASEC) + + END diff --git a/math/slalib/caldj.f b/math/slalib/caldj.f new file mode 100644 index 00000000..34104ca8 --- /dev/null +++ b/math/slalib/caldj.f @@ -0,0 +1,75 @@ + SUBROUTINE slCADJ (IY, IM, ID, DJM, J) +*+ +* - - - - - - +* C A D J +* - - - - - - +* +* Gregorian Calendar to Modified Julian Date +* +* (Includes century default feature: use slCLDJ for years +* before 100AD.) +* +* Given: +* IY,IM,ID int year, month, day in Gregorian calendar +* +* Returned: +* DJM dp modified Julian Date (JD-2400000.5) for 0 hrs +* J int status: +* 0 = OK +* 1 = bad year (MJD not computed) +* 2 = bad month (MJD not computed) +* 3 = bad day (MJD computed) +* +* Acceptable years are 00-49, interpreted as 2000-2049, +* 50-99, " " 1950-1999, +* 100 upwards, interpreted literally. +* +* Called: slCLDJ +* +* P.T.Wallace Starlink November 1985 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IY,IM,ID + DOUBLE PRECISION DJM + INTEGER J + + INTEGER NY + + + + +* Default century if appropriate + IF (IY.GE.0.AND.IY.LE.49) THEN + NY=IY+2000 + ELSE IF (IY.GE.50.AND.IY.LE.99) THEN + NY=IY+1900 + ELSE + NY=IY + END IF + +* Modified Julian Date + CALL slCLDJ(NY,IM,ID,DJM,J) + + END diff --git a/math/slalib/calyd.f b/math/slalib/calyd.f new file mode 100644 index 00000000..0f65cb98 --- /dev/null +++ b/math/slalib/calyd.f @@ -0,0 +1,83 @@ + SUBROUTINE slCAYD (IY, IM, ID, NY, ND, J) +*+ +* - - - - - - +* C A Y D +* - - - - - - +* +* Gregorian calendar date to year and day in year (in a Julian +* calendar aligned to the 20th/21st century Gregorian calendar). +* +* (Includes century default feature: use slCLYD for years +* before 100AD.) +* +* Given: +* IY,IM,ID int year, month, day in Gregorian calendar +* (year may optionally omit the century) +* Returned: +* NY int year (re-aligned Julian calendar) +* ND int day in year (1 = January 1st) +* J int status: +* 0 = OK +* 1 = bad year (before -4711) +* 2 = bad month +* 3 = bad day (but conversion performed) +* +* Notes: +* +* 1 This routine exists to support the low-precision routines +* slERTH, slMOON and slECOR. +* +* 2 Between 1900 March 1 and 2100 February 28 it returns answers +* which are consistent with the ordinary Gregorian calendar. +* Outside this range there will be a discrepancy which increases +* by one day for every non-leap century year. +* +* 3 Years in the range 50-99 are interpreted as 1950-1999, and +* years in the range 00-49 are interpreted as 2000-2049. +* +* Called: slCLYD +* +* P.T.Wallace Starlink 23 November 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IY,IM,ID,NY,ND,J + + INTEGER I + + + +* Default century if appropriate + IF (IY.GE.0.AND.IY.LE.49) THEN + I=IY+2000 + ELSE IF (IY.GE.50.AND.IY.LE.99) THEN + I=IY+1900 + ELSE + I=IY + END IF + +* Perform the conversion + CALL slCLYD(I,IM,ID,NY,ND,J) + + END diff --git a/math/slalib/cc2s.f b/math/slalib/cc2s.f new file mode 100644 index 00000000..c9187e3a --- /dev/null +++ b/math/slalib/cc2s.f @@ -0,0 +1,70 @@ + SUBROUTINE slCC2S (V, A, B) +*+ +* - - - - - +* C C 2 S +* - - - - - +* +* Cartesian to spherical coordinates (single precision) +* +* Given: +* V r(3) x,y,z vector +* +* Returned: +* A,B r spherical coordinates in radians +* +* The spherical coordinates are longitude (+ve anticlockwise looking +* from the +ve latitude pole) and latitude. The Cartesian coordinates +* are right handed, with the x axis at zero longitude and latitude, and +* the z axis at the +ve latitude pole. +* +* If V is null, zero A and B are returned. At either pole, zero A is +* returned. +* +* Last revision: 22 July 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL V(3),A,B + + REAL X,Y,Z,R + + + X = V(1) + Y = V(2) + Z = V(3) + R = SQRT(X*X+Y*Y) + + IF (R.EQ.0.0) THEN + A = 0.0 + ELSE + A = ATAN2(Y,X) + END IF + + IF (Z.EQ.0.0) THEN + B = 0.0 + ELSE + B = ATAN2(Z,R) + END IF + + END diff --git a/math/slalib/cc62s.f b/math/slalib/cc62s.f new file mode 100644 index 00000000..a3ad4f38 --- /dev/null +++ b/math/slalib/cc62s.f @@ -0,0 +1,100 @@ + SUBROUTINE slC62S (V, A, B, R, AD, BD, RD) +*+ +* - - - - - - +* C 6 2 S +* - - - - - - +* +* Conversion of position & velocity in Cartesian coordinates +* to spherical coordinates (single precision) +* +* Given: +* V r(6) Cartesian position & velocity vector +* +* Returned: +* A r longitude (radians) +* B r latitude (radians) +* R r radial coordinate +* AD r longitude derivative (radians per unit time) +* BD r latitude derivative (radians per unit time) +* RD r radial derivative +* +* P.T.Wallace Starlink 28 April 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL V(6),A,B,R,AD,BD,RD + + REAL X,Y,Z,XD,YD,ZD,RXY2,RXY,R2,XYP + + + +* Components of position/velocity vector + X=V(1) + Y=V(2) + Z=V(3) + XD=V(4) + YD=V(5) + ZD=V(6) + +* Component of R in XY plane squared + RXY2=X*X+Y*Y + +* Modulus squared + R2=RXY2+Z*Z + +* Protection against null vector + IF (R2.EQ.0.0) THEN + X=XD + Y=YD + Z=ZD + RXY2=X*X+Y*Y + R2=RXY2+Z*Z + END IF + +* Position and velocity in spherical coordinates + RXY=SQRT(RXY2) + XYP=X*XD+Y*YD + IF (RXY2.NE.0.0) THEN + A=ATAN2(Y,X) + B=ATAN2(Z,RXY) + AD=(X*YD-Y*XD)/RXY2 + BD=(ZD*RXY2-Z*XYP)/(R2*RXY) + ELSE + A=0.0 + IF (Z.NE.0.0) THEN + B=ATAN2(Z,RXY) + ELSE + B=0.0 + END IF + AD=0.0 + BD=0.0 + END IF + R=SQRT(R2) + IF (R.NE.0.0) THEN + RD=(XYP+Z*ZD)/R + ELSE + RD=0.0 + END IF + + END diff --git a/math/slalib/cd2tf.f b/math/slalib/cd2tf.f new file mode 100644 index 00000000..87884372 --- /dev/null +++ b/math/slalib/cd2tf.f @@ -0,0 +1,73 @@ + SUBROUTINE slCDTF (NDP, DAYS, SIGN, IHMSF) +*+ +* - - - - - - +* C D T F +* - - - - - - +* +* Convert an interval in days into hours, minutes, seconds +* +* (single precision) +* +* Given: +* NDP int number of decimal places of seconds +* DAYS real interval in days +* +* Returned: +* SIGN char '+' or '-' +* IHMSF int(4) hours, minutes, seconds, fraction +* +* Notes: +* +* 1) NDP less than zero is interpreted as zero. +* +* 2) The largest useful value for NDP is determined by the size of +* DAYS, the format of REAL floating-point numbers on the target +* machine, and the risk of overflowing IHMSF(4). On some +* architectures, for DAYS up to 1.0, the available floating- +* point precision corresponds roughly to NDP=3. This is well +* below the ultimate limit of NDP=9 set by the capacity of a +* typical 32-bit IHMSF(4). +* +* 3) The absolute value of DAYS may exceed 1.0. In cases where it +* does not, it is up to the caller to test for and handle the +* case where DAYS is very nearly 1.0 and rounds up to 24 hours, +* by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +* +* Called: slDDTF +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER NDP + REAL DAYS + CHARACTER SIGN*(*) + INTEGER IHMSF(4) + + + +* Call double precision version + CALL slDDTF(NDP,DBLE(DAYS),SIGN,IHMSF) + + END diff --git a/math/slalib/cldj.f b/math/slalib/cldj.f new file mode 100644 index 00000000..ed593ca3 --- /dev/null +++ b/math/slalib/cldj.f @@ -0,0 +1,95 @@ + SUBROUTINE slCLDJ (IY, IM, ID, DJM, J) +*+ +* - - - - - +* C L D J +* - - - - - +* +* Gregorian Calendar to Modified Julian Date +* +* Given: +* IY,IM,ID int year, month, day in Gregorian calendar +* +* Returned: +* DJM dp modified Julian Date (JD-2400000.5) for 0 hrs +* J int status: +* 0 = OK +* 1 = bad year (MJD not computed) +* 2 = bad month (MJD not computed) +* 3 = bad day (MJD computed) +* +* The year must be -4699 (i.e. 4700BC) or later. +* +* The algorithm is adapted from Hatcher 1984 (QJRAS 25, 53-55). +* +* Last revision: 27 July 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IY,IM,ID + DOUBLE PRECISION DJM + INTEGER J + +* Month lengths in days + INTEGER MTAB(12) + DATA MTAB / 31,28,31,30,31,30,31,31,30,31,30,31 / + + + +* Preset status. + J = 0 + +* Validate year. + IF ( IY .LT. -4699 ) THEN + J = 1 + ELSE + +* Validate month. + IF ( IM.GE.1 .AND. IM.LE.12 ) THEN + +* Allow for leap year. + IF ( MOD(IY,4) .EQ. 0 ) THEN + MTAB(2) = 29 + ELSE + MTAB(2) = 28 + END IF + IF ( MOD(IY,100).EQ.0 .AND. MOD(IY,400).NE.0 ) + : MTAB(2) = 28 + +* Validate day. + IF ( ID.LT.1 .OR. ID.GT.MTAB(IM) ) J=3 + +* Modified Julian Date. + DJM = DBLE ( ( 1461 * ( IY - (12-IM)/10 + 4712 ) ) / 4 + : + ( 306 * MOD ( IM+9, 12 ) + 5 ) / 10 + : - ( 3 * ( ( IY - (12-IM)/10 + 4900 ) / 100 ) ) / 4 + : + ID - 2399904 ) + +* Bad month. + ELSE + J=2 + END IF + + END IF + + END diff --git a/math/slalib/clyd.f b/math/slalib/clyd.f new file mode 100644 index 00000000..957a6ec8 --- /dev/null +++ b/math/slalib/clyd.f @@ -0,0 +1,119 @@ + SUBROUTINE slCLYD (IY, IM, ID, NY, ND, JSTAT) +*+ +* - - - - - +* C L Y D +* - - - - - +* +* Gregorian calendar to year and day in year (in a Julian calendar +* aligned to the 20th/21st century Gregorian calendar). +* +* Given: +* IY,IM,ID i year, month, day in Gregorian calendar +* +* Returned: +* NY i year (re-aligned Julian calendar) +* ND i day in year (1 = January 1st) +* JSTAT i status: +* 0 = OK +* 1 = bad year (before -4711) +* 2 = bad month +* 3 = bad day (but conversion performed) +* +* Notes: +* +* 1 This routine exists to support the low-precision routines +* slERTH, slMOON and slECOR. +* +* 2 Between 1900 March 1 and 2100 February 28 it returns answers +* which are consistent with the ordinary Gregorian calendar. +* Outside this range there will be a discrepancy which increases +* by one day for every non-leap century year. +* +* 3 The essence of the algorithm is first to express the Gregorian +* date as a Julian Day Number and then to convert this back to +* a Julian calendar date, with day-in-year instead of month and +* day. See 12.92-1 and 12.95-1 in the reference. +* +* Reference: Explanatory Supplement to the Astronomical Almanac, +* ed P.K.Seidelmann, University Science Books (1992), +* p604-606. +* +* P.T.Wallace Starlink 26 November 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IY,IM,ID,NY,ND,JSTAT + + INTEGER I,J,K,L,N + +* Month lengths in days + INTEGER MTAB(12) + DATA MTAB/31,28,31,30,31,30,31,31,30,31,30,31/ + + + +* Preset status + JSTAT=0 + +* Validate year + IF (IY.GE.-4711) THEN + +* Validate month + IF (IM.GE.1.AND.IM.LE.12) THEN + +* Allow for (Gregorian) leap year + IF (MOD(IY,4).EQ.0.AND. + : (MOD(IY,100).NE.0.OR.MOD(IY,400).EQ.0)) THEN + MTAB(2)=29 + ELSE + MTAB(2)=28 + END IF + +* Validate day + IF (ID.LT.1.OR.ID.GT.MTAB(IM)) JSTAT=3 + +* Perform the conversion + I=(14-IM)/12 + K=IY-I + J=(1461*(K+4800))/4+(367*(IM-2+12*I))/12 + : -(3*((K+4900)/100))/4+ID-30660 + K=(J-1)/1461 + L=J-1461*K + N=(L-1)/365-L/1461 + J=((80*(L-365*N+30))/2447)/11 + I=N+J + ND=59+L-365*I+((4-N)/4)*(1-J) + NY=4*K+I-4716 + +* Bad month + ELSE + JSTAT=2 + END IF + ELSE + +* Bad year + JSTAT=1 + END IF + + END diff --git a/math/slalib/combn.f b/math/slalib/combn.f new file mode 100644 index 00000000..8f0dd64b --- /dev/null +++ b/math/slalib/combn.f @@ -0,0 +1,160 @@ + SUBROUTINE slCMBN ( NSEL, NCAND, LIST, J ) +*+ +* - - - - - - +* C O M B N +* - - - - - - +* +* Generate the next combination, a subset of a specified size chosen +* from a specified number of items. +* +* Given: +* NSEL i number of items (subset size) +* NCAND i number of candidates (set size) +* +* Given and returned: +* LIST i(NSEL) latest combination, LIST(1)=0 to initialize +* +* Returned: +* J i status: -1 = illegal NSEL or NCAND +* 0 = OK +* +1 = no more combinations available +* +* Notes: +* +* 1) NSEL and NCAND must both be at least 1, and NSEL must be less +* than or equal to NCAND. +* +* 2) This routine returns, in the LIST array, a subset of NSEL integers +* chosen from the range 1 to NCAND inclusive, in ascending order. +* Before calling the routine for the first time, the caller must set +* the first element of the LIST array to zero (any value less than 1 +* will do) to cause initialization. +* +* 2) The first combination to be generated is: +* +* LIST(1)=1, LIST(2)=2, ..., LIST(NSEL)=NSEL +* +* This is also the combination returned for the "finished" (J=1) +* case. +* +* The final permutation to be generated is: +* +* LIST(1)=NCAND, LIST(2)=NCAND-1, ..., LIST(NSEL)=NCAND-NSEL+1 +* +* 3) If the "finished" (J=1) status is ignored, the routine +* continues to deliver combinations, the pattern repeating +* every NCAND!/(NSEL!*(NCAND-NSEL)!) calls. +* +* 4) The algorithm is by R.F.Warren-Smith (private communication). +* +* P.T.Wallace Starlink 25 August 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER NSEL,NCAND,LIST(NSEL),J + + INTEGER I,LISTI,NMAX,M + LOGICAL MORE + + +* Validate, and set status. + IF (NSEL.LT.1.OR.NCAND.LT.1.OR.NSEL.GT.NCAND) THEN + J = -1 + GO TO 9999 + ELSE + J = 0 + END IF + +* Just starting? + IF (LIST(1).LT.1) THEN + +* Yes: return 1,2,3... + DO I=1,NSEL + LIST(I) = I + END DO + + ELSE + +* No: find the first selection that we can increment. + +* Start with the first list item. + I = 1 + +* Loop. + MORE = .TRUE. + DO WHILE (MORE) + +* Current list item. + LISTI = LIST(I) + +* Is this the final list item? + IF (I.GE.NSEL) THEN + +* Yes: comparison value is number of candidates plus one. + NMAX = NCAND+1 + ELSE + +* No: comparison value is next list item. + NMAX = LIST(I+1) + END IF + +* Can the current item be incremented? + IF (NMAX-LISTI.GT.1) THEN + +* Yes: increment it. + LIST(I) = LISTI+1 + +* Reinitialize the preceding items. + DO M=1,I-1 + LIST(M) = M + END DO + +* Break. + MORE = .FALSE. + ELSE + +* Can't increment the current item: is it the final one? + IF (I.GE.NSEL) THEN + +* Yes: set the status. + J = 1 + +* Restart the sequence. + DO I=1,NSEL + LIST(I) = I + END DO + +* Break. + MORE = .FALSE. + ELSE + +* No: next list item. + I = I+1 + END IF + END IF + END DO + END IF + 9999 CONTINUE + + END diff --git a/math/slalib/configure.ac b/math/slalib/configure.ac new file mode 100644 index 00000000..deeead59 --- /dev/null +++ b/math/slalib/configure.ac @@ -0,0 +1,134 @@ +dnl Process this file with autoconf to produce a configure script +AC_REVISION($Revision$) + +dnl Initialisation: package name and version number +AC_INIT(sla, 2.5-7, starlink@jiscmail.ac.uk) +# Version-info specifications. See SSN/78 for guidelines, and update the table +# below for ANY change of version number. +# +# The library version numbers below match PTW's LIB_VERS 1.6 and 1.7 +# respectively, as it happens. There is no need to continue this pattern +# with any future changes, since these should respect the rather different +# rules for the -version-info numbers. Instead the PTW makefile LIB_VERS +# changes should be regarded as guidelines for which changes are and are +# not backwards-compatible. +# +# Release libsla.la +# 2.4-12 6:0:0 +# 2.5-2 7:0:0 +AC_SUBST(libsla_la_version_info, 7:0:0) + +dnl Require autoconf-2.50 at least +AC_PREREQ(2.50) +dnl Require automake-1.8.2-starlink at least +AM_INIT_AUTOMAKE(1.8.2-starlink) + +dnl Sanity-check: name a file in the source directory -- if this +dnl isn't found then configure will complain +AC_CONFIG_SRCDIR([sla_link]) + +dnl Include defaults for Starlink configurations +STAR_DEFAULTS + +dnl Find required versions of the programs we need for configuration +AC_PROG_FC +AC_PROG_FPP +AC_PROG_LIBTOOL + +dnl If --with-pic=no is set we should honour that. +AM_CONDITIONAL(NOPIC, test x$pic_mode = xno) + +dnl Platform-dependent/preprocessed sources. This is slightly +dnl subtle: file random.F is a preprocessable file. However, +dnl there are also versions available for VAX/VMS +dnl (random.F__vms) and Microsoft Fortran (random.F__win), and +dnl these are sufficiently distinct that it's not worth just +dnl configuring the function name. +dnl +dnl The random and gresid VMS and Windows files have a .F +dnl extension: there's no preprocessable code in them, but they +dnl have to have the same name as the file which does have. +dnl +dnl Problem: Is the code in the *__win files specific to Windows +dnl or to MSFortran? Since you'd only get MSFortran on Windows, I +dnl suppose it's the former (or might as well be). +dnl +dnl The __vms files will never be matched by this macro (will the +dnl __win files?), since config.guess doesn't cover VMS at all, but +dnl the following, as well as documenting the relationship, also +dnl causes the corresponding files to be included in the +dnl distribution, where they might be of use to someone. +STAR_PLATFORM_SOURCES([random.F gresid.F wait.f], + [__vms __win default]) + +if cmp -s random.F random.Fdefault; then + # The unix version, to be configured + found_random=false + AC_CHECK_FUNCS([rand random], [found_random=true]) + if $found_random; then + : OK + else + AC_LIBOBJ([rtl_random]) + fi +fi + +dnl Conditional defining whether we build the thread-safe C wrappers +AC_ARG_WITH([pthreads], + [ --with-pthreads Build package with POSIX threads support], + if test "$withval" = "yes"; then + use_pthreads="yes" + else + use_pthreads="no" + fi, + use_pthreads="no") +if test "$use_pthreads" = "yes"; then +AC_CHECK_LIB([pthread], [pthread_create], ,[use_pthreads="no"]) + if test "$use_pthreads" = "yes"; then + AC_DEFINE([USE_PTHREADS], [1], [Build with POSIX threads support]) + fi +fi + +dnl Conditional defining whether we use CNF or not +AC_ARG_WITH([cnf], + [ --with-cnf Use Starlink CNF library for thread locking], + if test "$withval" = "yes"; then + use_cnf="yes" + else + use_cnf="no" + fi, + use_cnf="yes") +if test "$use_cnf" = "yes"; then + AC_DEFINE([USE_CNF], [1], [Use Starlink CNF library for thread locking]) +fi + +STAR_CNF_COMPATIBLE_SYMBOLS + +dnl We need this for the tests +AC_FC_MAIN +AC_FC_LIBRARY_LDFLAGS + +# Perform the check that configures f77.h.in for the return type of REAL +# Fortran functions. On 64-bit g77 with f2c compatibility this is double +# not float. +STAR_CNF_F2C_COMPATIBLE + +# Determine type of Fortran character string lengths. +STAR_CNF_TRAIL_TYPE + +AC_CONFIG_HEADERS([config.h]) + +dnl Declare the build and use dependencies for this package +dnl There are neither build nor use dependencies + +STAR_LATEX_DOCUMENTATION(sun67) + +dnl Declare the build and use dependencies for this package +dnl NOTE, cnf should be a link dependency rather than a build +dnl dependency, but there is clearly a bug in starconf somewhere +dbl because making it a link dependency results in no CNF dependency +dnl being added to Makefile.dependencies. +STAR_DECLARE_DEPENDENCIES([build], [cnf]) + +AC_CONFIG_FILES(Makefile component.xml vers.f veri.f f77.h) + +AC_OUTPUT diff --git a/math/slalib/cr2af.f b/math/slalib/cr2af.f new file mode 100644 index 00000000..f12058a1 --- /dev/null +++ b/math/slalib/cr2af.f @@ -0,0 +1,76 @@ + SUBROUTINE slCRAF (NDP, ANGLE, SIGN, IDMSF) +*+ +* - - - - - - +* C R A F +* - - - - - - +* +* Convert an angle in radians into degrees, arcminutes, arcseconds +* (single precision) +* +* Given: +* NDP int number of decimal places of arcseconds +* ANGLE real angle in radians +* +* Returned: +* SIGN char '+' or '-' +* IDMSF int(4) degrees, arcminutes, arcseconds, fraction +* +* Notes: +* +* 1) NDP less than zero is interpreted as zero. +* +* 2) The largest useful value for NDP is determined by the size of +* ANGLE, the format of REAL floating-point numbers on the target +* machine, and the risk of overflowing IDMSF(4). On some +* architectures, for ANGLE up to 2pi, the available floating- +* point precision corresponds roughly to NDP=3. This is well +* below the ultimate limit of NDP=9 set by the capacity of a +* typical 32-bit IDMSF(4). +* +* 3) The absolute value of ANGLE may exceed 2pi. In cases where it +* does not, it is up to the caller to test for and handle the +* case where ANGLE is very nearly 2pi and rounds up to 360 deg, +* by testing for IDMSF(1)=360 and setting IDMSF(1-4) to zero. +* +* Called: slCDTF +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER NDP + REAL ANGLE + CHARACTER SIGN*(*) + INTEGER IDMSF(4) + +* Hours to degrees * radians to turns + REAL F + PARAMETER (F=15.0/6.283185307179586476925287) + + + +* Scale then use days to h,m,s routine + CALL slCDTF(NDP,ANGLE*F,SIGN,IDMSF) + + END diff --git a/math/slalib/cr2tf.f b/math/slalib/cr2tf.f new file mode 100644 index 00000000..b23cbd2e --- /dev/null +++ b/math/slalib/cr2tf.f @@ -0,0 +1,76 @@ + SUBROUTINE slCRTF (NDP, ANGLE, SIGN, IHMSF) +*+ +* - - - - - - +* C R T F +* - - - - - - +* +* Convert an angle in radians into hours, minutes, seconds +* (single precision) +* +* Given: +* NDP int number of decimal places of seconds +* ANGLE real angle in radians +* +* Returned: +* SIGN char '+' or '-' +* IHMSF int(4) hours, minutes, seconds, fraction +* +* Notes: +* +* 1) NDP less than zero is interpreted as zero. +* +* 2) The largest useful value for NDP is determined by the size of +* ANGLE, the format of REAL floating-point numbers on the target +* machine, and the risk of overflowing IHMSF(4). On some +* architectures, for ANGLE up to 2pi, the available floating-point +* precision corresponds roughly to NDP=3. This is well below +* the ultimate limit of NDP=9 set by the capacity of a typical +* 32-bit IHMSF(4). +* +* 3) The absolute value of ANGLE may exceed 2pi. In cases where it +* does not, it is up to the caller to test for and handle the +* case where ANGLE is very nearly 2pi and rounds up to 24 hours, +* by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +* +* Called: slCDTF +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER NDP + REAL ANGLE + CHARACTER SIGN*(*) + INTEGER IHMSF(4) + +* Turns to radians + REAL T2R + PARAMETER (T2R=6.283185307179586476925287) + + + +* Scale then use days to h,m,s routine + CALL slCDTF(NDP,ANGLE/T2R,SIGN,IHMSF) + + END diff --git a/math/slalib/cs2c.f b/math/slalib/cs2c.f new file mode 100644 index 00000000..a74ac4bd --- /dev/null +++ b/math/slalib/cs2c.f @@ -0,0 +1,58 @@ + SUBROUTINE slCS2C (A, B, V) +*+ +* - - - - - +* C S 2 C +* - - - - - +* +* Spherical coordinates to direction cosines (single precision) +* +* Given: +* A,B real spherical coordinates in radians +* (RA,Dec), (long,lat) etc. +* +* Returned: +* V real(3) x,y,z unit vector +* +* The spherical coordinates are longitude (+ve anticlockwise looking +* from the +ve latitude pole) and latitude. The Cartesian coordinates +* are right handed, with the x axis at zero longitude and latitude, and +* the z axis at the +ve latitude pole. +* +* Last revision: 22 July 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL A,B,V(3) + + REAL COSB + + + + COSB = COS(B) + + V(1) = COS(A)*COSB + V(2) = SIN(A)*COSB + V(3) = SIN(B) + + END diff --git a/math/slalib/cs2c6.f b/math/slalib/cs2c6.f new file mode 100644 index 00000000..a8c4d402 --- /dev/null +++ b/math/slalib/cs2c6.f @@ -0,0 +1,73 @@ + SUBROUTINE slS2C6 ( A, B, R, AD, BD, RD, V ) +*+ +* - - - - - - +* S 2 C 6 +* - - - - - - +* +* Conversion of position & velocity in spherical coordinates +* to Cartesian coordinates (single precision) +* +* Given: +* A r longitude (radians) +* B r latitude (radians) +* R r radial coordinate +* AD r longitude derivative (radians per unit time) +* BD r latitude derivative (radians per unit time) +* RD r radial derivative +* +* Returned: +* V r(6) Cartesian position & velocity vector +* +* Last revision: 11 September 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL A, B, R, AD, BD, RD, V(6) + + REAL SA, CA, SB, CB, RCB, X, Y, RBD, W + + + +* Useful functions. + SA = SIN(A) + CA = COS(A) + SB = SIN(B) + CB = COS(B) + RCB = R*CB + X = RCB*CA + Y = RCB*SA + RBD = R*BD + W = RBD*SB-CB*RD + +* Position. + V(1) = X + V(2) = Y + V(3) = R*SB + +* Velocity. + V(4) = -Y*AD-W*CA + V(5) = X*AD-W*SA + V(6) = RBD*CB+SB*RD + + END diff --git a/math/slalib/ctf2d.f b/math/slalib/ctf2d.f new file mode 100644 index 00000000..a427c38d --- /dev/null +++ b/math/slalib/ctf2d.f @@ -0,0 +1,74 @@ + SUBROUTINE slCTFD (IHOUR, IMIN, SEC, DAYS, J) +*+ +* - - - - - - +* C T F D +* - - - - - - +* +* Convert hours, minutes, seconds to days (single precision) +* +* Given: +* IHOUR int hours +* IMIN int minutes +* SEC real seconds +* +* Returned: +* DAYS real interval in days +* J int status: 0 = OK +* 1 = IHOUR outside range 0-23 +* 2 = IMIN outside range 0-59 +* 3 = SEC outside range 0-59.999... +* +* Notes: +* +* 1) The result is computed even if any of the range checks +* fail. +* +* 2) The sign must be dealt with outside this routine. +* +* P.T.Wallace Starlink November 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IHOUR,IMIN + REAL SEC,DAYS + INTEGER J + +* Seconds per day + REAL D2S + PARAMETER (D2S=86400.0) + + + +* Preset status + J=0 + +* Validate sec, min, hour + IF (SEC.LT.0.0.OR.SEC.GE.60.0) J=3 + IF (IMIN.LT.0.OR.IMIN.GT.59) J=2 + IF (IHOUR.LT.0.OR.IHOUR.GT.23) J=1 + +* Compute interval + DAYS=(60.0*(60.0*REAL(IHOUR)+REAL(IMIN))+SEC)/D2S + + END diff --git a/math/slalib/ctf2r.f b/math/slalib/ctf2r.f new file mode 100644 index 00000000..fb841054 --- /dev/null +++ b/math/slalib/ctf2r.f @@ -0,0 +1,72 @@ + SUBROUTINE slCTFR (IHOUR, IMIN, SEC, RAD, J) +*+ +* - - - - - - +* C T F R +* - - - - - - +* +* Convert hours, minutes, seconds to radians (single precision) +* +* Given: +* IHOUR int hours +* IMIN int minutes +* SEC real seconds +* +* Returned: +* RAD real angle in radians +* J int status: 0 = OK +* 1 = IHOUR outside range 0-23 +* 2 = IMIN outside range 0-59 +* 3 = SEC outside range 0-59.999... +* +* Called: +* slCTFD +* +* Notes: +* +* 1) The result is computed even if any of the range checks +* fail. +* +* 2) The sign must be dealt with outside this routine. +* +* P.T.Wallace Starlink November 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IHOUR,IMIN + REAL SEC,RAD + INTEGER J + + REAL TURNS + +* Turns to radians + REAL T2R + PARAMETER (T2R=6.283185307179586476925287) + + + +* Convert to turns then radians + CALL slCTFD(IHOUR,IMIN,SEC,TURNS,J) + RAD=T2R*TURNS + + END diff --git a/math/slalib/daf2r.f b/math/slalib/daf2r.f new file mode 100644 index 00000000..ddd07b74 --- /dev/null +++ b/math/slalib/daf2r.f @@ -0,0 +1,73 @@ + SUBROUTINE slDAFR (IDEG, IAMIN, ASEC, RAD, J) +*+ +* - - - - - - +* D A F R +* - - - - - - +* +* Convert degrees, arcminutes, arcseconds to radians +* (double precision) +* +* Given: +* IDEG int degrees +* IAMIN int arcminutes +* ASEC dp arcseconds +* +* Returned: +* RAD dp angle in radians +* J int status: 0 = OK +* 1 = IDEG outside range 0-359 +* 2 = IAMIN outside range 0-59 +* 3 = ASEC outside range 0-59.999... +* +* Notes: +* 1) The result is computed even if any of the range checks +* fail. +* 2) The sign must be dealt with outside this routine. +* +* P.T.Wallace Starlink 23 August 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IDEG,IAMIN + DOUBLE PRECISION ASEC,RAD + INTEGER J + +* Arc seconds to radians + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + + + +* Preset status + J=0 + +* Validate arcsec, arcmin, deg + IF (ASEC.LT.0D0.OR.ASEC.GE.60D0) J=3 + IF (IAMIN.LT.0.OR.IAMIN.GT.59) J=2 + IF (IDEG.LT.0.OR.IDEG.GT.359) J=1 + +* Compute angle + RAD=AS2R*(60D0*(60D0*DBLE(IDEG)+DBLE(IAMIN))+ASEC) + + END diff --git a/math/slalib/dafin.f b/math/slalib/dafin.f new file mode 100644 index 00000000..68ecc5f9 --- /dev/null +++ b/math/slalib/dafin.f @@ -0,0 +1,181 @@ + SUBROUTINE slDAFN (STRING, IPTR, A, J) +*+ +* - - - - - - +* D A F N +* - - - - - - +* +* Sexagesimal character string to angle (double precision) +* +* Given: +* STRING c*(*) string containing deg, arcmin, arcsec fields +* IPTR i pointer to start of decode (1st = 1) +* +* Returned: +* IPTR i advanced past the decoded angle +* A d angle in radians +* J i status: 0 = OK +* +1 = default, A unchanged +* -1 = bad degrees ) +* -2 = bad arcminutes ) (note 3) +* -3 = bad arcseconds ) +* +* Example: +* +* argument before after +* +* STRING '-57 17 44.806 12 34 56.7' unchanged +* IPTR 1 16 (points to 12...) +* A ? -1.00000D0 +* J ? 0 +* +* A further call to slDAFN, without adjustment of IPTR, will +* decode the second angle, 12deg 34min 56.7sec. +* +* Notes: +* +* 1) The first three "fields" in STRING are degrees, arcminutes, +* arcseconds, separated by spaces or commas. The degrees field +* may be signed, but not the others. The decoding is carried +* out by the DFLTIN routine and is free-format. +* +* 2) Successive fields may be absent, defaulting to zero. For +* zero status, the only combinations allowed are degrees alone, +* degrees and arcminutes, and all three fields present. If all +* three fields are omitted, a status of +1 is returned and A is +* unchanged. In all other cases A is changed. +* +* 3) Range checking: +* +* The degrees field is not range checked. However, it is +* expected to be integral unless the other two fields are absent. +* +* The arcminutes field is expected to be 0-59, and integral if +* the arcseconds field is present. If the arcseconds field +* is absent, the arcminutes is expected to be 0-59.9999... +* +* The arcseconds field is expected to be 0-59.9999... +* +* 4) Decoding continues even when a check has failed. Under these +* circumstances the field takes the supplied value, defaulting +* to zero, and the result A is computed and returned. +* +* 5) Further fields after the three expected ones are not treated +* as an error. The pointer IPTR is left in the correct state +* for further decoding with the present routine or with DFLTIN +* etc. See the example, above. +* +* 6) If STRING contains hours, minutes, seconds instead of degrees +* etc, or if the required units are turns (or days) instead of +* radians, the result A should be multiplied as follows: +* +* for to obtain multiply +* STRING A in A by +* +* d ' " radians 1 = 1D0 +* d ' " turns 1/2pi = 0.1591549430918953358D0 +* h m s radians 15 = 15D0 +* h m s days 15/2pi = 2.3873241463784300365D0 +* +* Called: slDFLI +* +* P.T.Wallace Starlink 1 August 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) STRING + INTEGER IPTR + DOUBLE PRECISION A + INTEGER J + + DOUBLE PRECISION AS2R + PARAMETER (AS2R=4.84813681109535993589914102358D-6) + INTEGER JF,JD,JM,JS + DOUBLE PRECISION DEG,ARCMIN,ARCSEC + + + +* Preset the status to OK + JF=0 + +* Defaults + DEG=0D0 + ARCMIN=0D0 + ARCSEC=0D0 + +* Decode degrees, arcminutes, arcseconds + CALL slDFLI(STRING,IPTR,DEG,JD) + IF (JD.GT.1) THEN + JF=-1 + ELSE + CALL slDFLI(STRING,IPTR,ARCMIN,JM) + IF (JM.LT.0.OR.JM.GT.1) THEN + JF=-2 + ELSE + CALL slDFLI(STRING,IPTR,ARCSEC,JS) + IF (JS.LT.0.OR.JS.GT.1) THEN + JF=-3 + +* See if the combination of fields is credible + ELSE IF (JD.GT.0) THEN +* No degrees: arcmin, arcsec ought also to be absent + IF (JM.EQ.0) THEN +* Suspect arcmin + JF=-2 + ELSE IF (JS.EQ.0) THEN +* Suspect arcsec + JF=-3 + ELSE +* All three fields absent + JF=1 + END IF +* Degrees present: if arcsec present so ought arcmin to be + ELSE IF (JM.NE.0.AND.JS.EQ.0) THEN + JF=-3 + +* Tests for range and integrality + +* Degrees + ELSE IF (JM.EQ.0.AND.DINT(DEG).NE.DEG) THEN + JF=-1 +* Arcminutes + ELSE IF ((JS.EQ.0.AND.DINT(ARCMIN).NE.ARCMIN).OR. + : ARCMIN.GE.60D0) THEN + JF=-2 +* Arcseconds + ELSE IF (ARCSEC.GE.60D0) THEN + JF=-3 + END IF + END IF + END IF + +* Unless all three fields absent, compute angle value + IF (JF.LE.0) THEN + A=AS2R*(60D0*(60D0*ABS(DEG)+ARCMIN)+ARCSEC) + IF (JD.LT.0) A=-A + END IF + +* Return the status + J=JF + + END diff --git a/math/slalib/dat.f b/math/slalib/dat.f new file mode 100644 index 00000000..67620144 --- /dev/null +++ b/math/slalib/dat.f @@ -0,0 +1,232 @@ + DOUBLE PRECISION FUNCTION slDAT (UTC) +*+ +* - - - - +* D A T +* - - - - +* +* Increment to be applied to Coordinated Universal Time UTC to give +* International Atomic Time TAI (double precision) +* +* Given: +* UTC d UTC date as a modified JD (JD-2400000.5) +* +* Result: TAI-UTC in seconds +* +* Notes: +* +* 1 The UTC is specified to be a date rather than a time to indicate +* that care needs to be taken not to specify an instant which lies +* within a leap second. Though in most cases UTC can include the +* fractional part, correct behaviour on the day of a leap second +* can only be guaranteed up to the end of the second 23:59:59. +* +* 2 For epochs from 1961 January 1 onwards, the expressions from the +* file ftp://maia.usno.navy.mil/ser7/tai-utc.dat are used. +* +* 3 The 5ms time step at 1961 January 1 is taken from 2.58.1 (p87) of +* the 1992 Explanatory Supplement. +* +* 4 UTC began at 1960 January 1.0 (JD 2436934.5) and it is improper +* to call the routine with an earlier epoch. However, if this +* is attempted, the TAI-UTC expression for the year 1960 is used. +* +* +* :-----------------------------------------: +* : : +* : IMPORTANT : +* : : +* : This routine must be updated on each : +* : occasion that a leap second is : +* : announced : +* : : +* : Latest leap second: 2012 July 1 : +* : : +* :-----------------------------------------: +* +* Last revision: 5 July 2008 +* +* Copyright P.T.Wallace. All rights reserved. +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION UTC + + DOUBLE PRECISION DT + + + + IF (.FALSE.) THEN + +* - - - - - - - - - - - - - - - - - - - - - - * +* Add new code here on each occasion that a * +* leap second is announced, and update the * +* preamble comments appropriately. * +* - - - - - - - - - - - - - - - - - - - - - - * + +* 2012 July 1 + ELSE IF (UTC.GE.56109D0) THEN + DT=35D0 + +* 2009 January 1 + ELSE IF (UTC.GE.54832D0) THEN + DT=34D0 + +* 2006 January 1 + ELSE IF (UTC.GE.53736D0) THEN + DT=33D0 + +* 1999 January 1 + ELSE IF (UTC.GE.51179D0) THEN + DT=32D0 + +* 1997 July 1 + ELSE IF (UTC.GE.50630D0) THEN + DT=31D0 + +* 1996 January 1 + ELSE IF (UTC.GE.50083D0) THEN + DT=30D0 + +* 1994 July 1 + ELSE IF (UTC.GE.49534D0) THEN + DT=29D0 + +* 1993 July 1 + ELSE IF (UTC.GE.49169D0) THEN + DT=28D0 + +* 1992 July 1 + ELSE IF (UTC.GE.48804D0) THEN + DT=27D0 + +* 1991 January 1 + ELSE IF (UTC.GE.48257D0) THEN + DT=26D0 + +* 1990 January 1 + ELSE IF (UTC.GE.47892D0) THEN + DT=25D0 + +* 1988 January 1 + ELSE IF (UTC.GE.47161D0) THEN + DT=24D0 + +* 1985 July 1 + ELSE IF (UTC.GE.46247D0) THEN + DT=23D0 + +* 1983 July 1 + ELSE IF (UTC.GE.45516D0) THEN + DT=22D0 + +* 1982 July 1 + ELSE IF (UTC.GE.45151D0) THEN + DT=21D0 + +* 1981 July 1 + ELSE IF (UTC.GE.44786D0) THEN + DT=20D0 + +* 1980 January 1 + ELSE IF (UTC.GE.44239D0) THEN + DT=19D0 + +* 1979 January 1 + ELSE IF (UTC.GE.43874D0) THEN + DT=18D0 + +* 1978 January 1 + ELSE IF (UTC.GE.43509D0) THEN + DT=17D0 + +* 1977 January 1 + ELSE IF (UTC.GE.43144D0) THEN + DT=16D0 + +* 1976 January 1 + ELSE IF (UTC.GE.42778D0) THEN + DT=15D0 + +* 1975 January 1 + ELSE IF (UTC.GE.42413D0) THEN + DT=14D0 + +* 1974 January 1 + ELSE IF (UTC.GE.42048D0) THEN + DT=13D0 + +* 1973 January 1 + ELSE IF (UTC.GE.41683D0) THEN + DT=12D0 + +* 1972 July 1 + ELSE IF (UTC.GE.41499D0) THEN + DT=11D0 + +* 1972 January 1 + ELSE IF (UTC.GE.41317D0) THEN + DT=10D0 + +* 1968 February 1 + ELSE IF (UTC.GE.39887D0) THEN + DT=4.2131700D0+(UTC-39126D0)*0.002592D0 + +* 1966 January 1 + ELSE IF (UTC.GE.39126D0) THEN + DT=4.3131700D0+(UTC-39126D0)*0.002592D0 + +* 1965 September 1 + ELSE IF (UTC.GE.39004D0) THEN + DT=3.8401300D0+(UTC-38761D0)*0.001296D0 + +* 1965 July 1 + ELSE IF (UTC.GE.38942D0) THEN + DT=3.7401300D0+(UTC-38761D0)*0.001296D0 + +* 1965 March 1 + ELSE IF (UTC.GE.38820D0) THEN + DT=3.6401300D0+(UTC-38761D0)*0.001296D0 + +* 1965 January 1 + ELSE IF (UTC.GE.38761D0) THEN + DT=3.5401300D0+(UTC-38761D0)*0.001296D0 + +* 1964 September 1 + ELSE IF (UTC.GE.38639D0) THEN + DT=3.4401300D0+(UTC-38761D0)*0.001296D0 + +* 1964 April 1 + ELSE IF (UTC.GE.38486D0) THEN + DT=3.3401300D0+(UTC-38761D0)*0.001296D0 + +* 1964 January 1 + ELSE IF (UTC.GE.38395D0) THEN + DT=3.2401300D0+(UTC-38761D0)*0.001296D0 + +* 1963 November 1 + ELSE IF (UTC.GE.38334D0) THEN + DT=1.9458580D0+(UTC-37665D0)*0.0011232D0 + +* 1962 January 1 + ELSE IF (UTC.GE.37665D0) THEN + DT=1.8458580D0+(UTC-37665D0)*0.0011232D0 + +* 1961 August 1 + ELSE IF (UTC.GE.37512D0) THEN + DT=1.3728180D0+(UTC-37300D0)*0.001296D0 + +* 1961 January 1 + ELSE IF (UTC.GE.37300D0) THEN + DT=1.4228180D0+(UTC-37300D0)*0.001296D0 + +* Before that + ELSE + DT=1.4178180D0+(UTC-37300D0)*0.001296D0 + + END IF + + slDAT=DT + + END diff --git a/math/slalib/dav2m.f b/math/slalib/dav2m.f new file mode 100644 index 00000000..7eb1f68b --- /dev/null +++ b/math/slalib/dav2m.f @@ -0,0 +1,84 @@ + SUBROUTINE slDAVM (AXVEC, RMAT) +*+ +* - - - - - - +* D A V M +* - - - - - - +* +* Form the rotation matrix corresponding to a given axial vector. +* (double precision) +* +* A rotation matrix describes a rotation about some arbitrary axis, +* called the Euler axis. The "axial vector" supplied to this routine +* has the same direction as the Euler axis, and its magnitude is the +* amount of rotation in radians. +* +* Given: +* AXVEC d(3) axial vector (radians) +* +* Returned: +* RMAT d(3,3) rotation matrix +* +* If AXVEC is null, the unit matrix is returned. +* +* The reference frame rotates clockwise as seen looking along +* the axial vector from the origin. +* +* Last revision: 26 November 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION AXVEC(3),RMAT(3,3) + + DOUBLE PRECISION X,Y,Z,PHI,S,C,W + + + +* Rotation angle - magnitude of axial vector - and functions + X = AXVEC(1) + Y = AXVEC(2) + Z = AXVEC(3) + PHI = SQRT(X*X+Y*Y+Z*Z) + S = SIN(PHI) + C = COS(PHI) + W = 1D0-C + +* Euler axis - direction of axial vector (perhaps null) + IF (PHI.NE.0D0) THEN + X = X/PHI + Y = Y/PHI + Z = Z/PHI + END IF + +* Compute the rotation matrix + RMAT(1,1) = X*X*W+C + RMAT(1,2) = X*Y*W+Z*S + RMAT(1,3) = X*Z*W-Y*S + RMAT(2,1) = X*Y*W-Z*S + RMAT(2,2) = Y*Y*W+C + RMAT(2,3) = Y*Z*W+X*S + RMAT(3,1) = X*Z*W+Y*S + RMAT(3,2) = Y*Z*W-X*S + RMAT(3,3) = Z*Z*W+C + + END diff --git a/math/slalib/dbear.f b/math/slalib/dbear.f new file mode 100644 index 00000000..417c4bdf --- /dev/null +++ b/math/slalib/dbear.f @@ -0,0 +1,60 @@ + DOUBLE PRECISION FUNCTION slDBER (A1, B1, A2, B2) +*+ +* - - - - - - +* D B E R +* - - - - - - +* +* Bearing (position angle) of one point on a sphere relative to another +* (double precision) +* +* Given: +* A1,B1 d spherical coordinates of one point +* A2,B2 d spherical coordinates of the other point +* +* (The spherical coordinates are RA,Dec, Long,Lat etc, in radians.) +* +* The result is the bearing (position angle), in radians, of point +* A2,B2 as seen from point A1,B1. It is in the range +/- pi. If +* A2,B2 is due east of A1,B1 the bearing is +pi/2. Zero is returned +* if the two points are coincident. +* +* P.T.Wallace Starlink 23 March 1991 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION A1,B1,A2,B2 + + DOUBLE PRECISION DA,X,Y + + + DA=A2-A1 + Y=SIN(DA)*COS(B2) + X=SIN(B2)*COS(B1)-COS(B2)*SIN(B1)*COS(DA) + IF (X.NE.0D0.OR.Y.NE.0D0) THEN + slDBER=ATAN2(Y,X) + ELSE + slDBER=0D0 + END IF + + END diff --git a/math/slalib/dbjin.f b/math/slalib/dbjin.f new file mode 100644 index 00000000..6c4b31f5 --- /dev/null +++ b/math/slalib/dbjin.f @@ -0,0 +1,131 @@ + SUBROUTINE slDBJI (STRING, NSTRT, DRESLT, J1, J2) +*+ +* - - - - - - +* D B J I +* - - - - - - +* +* Convert free-format input into double precision floating point, +* using DFLTIN but with special syntax extensions. +* +* The purpose of the syntax extensions is to help cope with mixed +* FK4 and FK5 data. In addition to the syntax accepted by DFLTIN, +* the following two extensions are recognized by DBJIN: +* +* 1) A valid non-null field preceded by the character 'B' +* (or 'b') is accepted. +* +* 2) A valid non-null field preceded by the character 'J' +* (or 'j') is accepted. +* +* The calling program is notified of the incidence of either of these +* extensions through an supplementary status argument. The rest of +* the arguments are as for DFLTIN. +* +* Given: +* STRING char string containing field to be decoded +* NSTRT int pointer to 1st character of field in string +* +* Returned: +* NSTRT int incremented +* DRESLT double result +* J1 int DFLTIN status: -1 = -OK +* 0 = +OK +* +1 = null field +* +2 = error +* J2 int syntax flag: 0 = normal DFLTIN syntax +* +1 = 'B' or 'b' +* +2 = 'J' or 'j' +* +* Called: slDFLI +* +* For details of the basic syntax, see slDFLI. +* +* P.T.Wallace Starlink 23 November 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) STRING + INTEGER NSTRT + DOUBLE PRECISION DRESLT + INTEGER J1,J2 + + INTEGER J2A,LENSTR,NA,J1A,NB,J1B + CHARACTER C + + + +* Preset syntax flag + J2A=0 + +* Length of string + LENSTR=LEN(STRING) + +* Pointer to current character + NA=NSTRT + +* Attempt normal decode + CALL slDFLI(STRING,NA,DRESLT,J1A) + +* Proceed only if pointer still within string + IF (NA.GE.1.AND.NA.LE.LENSTR) THEN + +* See if DFLTIN reported a null field + IF (J1A.EQ.1) THEN + +* It did: examine character it stuck on + C=STRING(NA:NA) + IF (C.EQ.'B'.OR.C.EQ.'b') THEN +* 'B' - provisionally note + J2A=1 + ELSE IF (C.EQ.'J'.OR.C.EQ.'j') THEN +* 'J' - provisionally note + J2A=2 + END IF + +* Following B or J, attempt to decode a number + IF (J2A.EQ.1.OR.J2A.EQ.2) THEN + NB=NA+1 + CALL slDFLI(STRING,NB,DRESLT,J1B) + +* If successful, copy pointer and status + IF (J1B.LE.0) THEN + NA=NB + J1A=J1B +* If not, forget about the B or J + ELSE + J2A=0 + END IF + + END IF + + END IF + + END IF + +* Return argument values and exit + NSTRT=NA + J1=J1A + J2=J2A + + END diff --git a/math/slalib/dc62s.f b/math/slalib/dc62s.f new file mode 100644 index 00000000..7bb64e0d --- /dev/null +++ b/math/slalib/dc62s.f @@ -0,0 +1,100 @@ + SUBROUTINE slDC6S (V, A, B, R, AD, BD, RD) +*+ +* - - - - - - +* D C 6 S +* - - - - - - +* +* Conversion of position & velocity in Cartesian coordinates +* to spherical coordinates (double precision) +* +* Given: +* V d(6) Cartesian position & velocity vector +* +* Returned: +* A d longitude (radians) +* B d latitude (radians) +* R d radial coordinate +* AD d longitude derivative (radians per unit time) +* BD d latitude derivative (radians per unit time) +* RD d radial derivative +* +* P.T.Wallace Starlink 28 April 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION V(6),A,B,R,AD,BD,RD + + DOUBLE PRECISION X,Y,Z,XD,YD,ZD,RXY2,RXY,R2,XYP + + + +* Components of position/velocity vector + X=V(1) + Y=V(2) + Z=V(3) + XD=V(4) + YD=V(5) + ZD=V(6) + +* Component of R in XY plane squared + RXY2=X*X+Y*Y + +* Modulus squared + R2=RXY2+Z*Z + +* Protection against null vector + IF (R2.EQ.0D0) THEN + X=XD + Y=YD + Z=ZD + RXY2=X*X+Y*Y + R2=RXY2+Z*Z + END IF + +* Position and velocity in spherical coordinates + RXY=SQRT(RXY2) + XYP=X*XD+Y*YD + IF (RXY2.NE.0D0) THEN + A=ATAN2(Y,X) + B=ATAN2(Z,RXY) + AD=(X*YD-Y*XD)/RXY2 + BD=(ZD*RXY2-Z*XYP)/(R2*RXY) + ELSE + A=0D0 + IF (Z.NE.0D0) THEN + B=ATAN2(Z,RXY) + ELSE + B=0D0 + END IF + AD=0D0 + BD=0D0 + END IF + R=SQRT(R2) + IF (R.NE.0D0) THEN + RD=(XYP+Z*ZD)/R + ELSE + RD=0D0 + END IF + + END diff --git a/math/slalib/dcc2s.f b/math/slalib/dcc2s.f new file mode 100644 index 00000000..cbbbd625 --- /dev/null +++ b/math/slalib/dcc2s.f @@ -0,0 +1,70 @@ + SUBROUTINE slDC2S (V, A, B) +*+ +* - - - - - - +* D C 2 S +* - - - - - - +* +* Cartesian to spherical coordinates (double precision) +* +* Given: +* V d(3) x,y,z vector +* +* Returned: +* A,B d spherical coordinates in radians +* +* The spherical coordinates are longitude (+ve anticlockwise looking +* from the +ve latitude pole) and latitude. The Cartesian coordinates +* are right handed, with the x axis at zero longitude and latitude, and +* the z axis at the +ve latitude pole. +* +* If V is null, zero A and B are returned. At either pole, zero A is +* returned. +* +* Last revision: 22 July 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION V(3),A,B + + DOUBLE PRECISION X,Y,Z,R + + + X = V(1) + Y = V(2) + Z = V(3) + R = SQRT(X*X+Y*Y) + + IF (R.EQ.0D0) THEN + A = 0D0 + ELSE + A = ATAN2(Y,X) + END IF + + IF (Z.EQ.0D0) THEN + B = 0D0 + ELSE + B = ATAN2(Z,R) + END IF + + END diff --git a/math/slalib/dcmpf.f b/math/slalib/dcmpf.f new file mode 100644 index 00000000..93d0d0c2 --- /dev/null +++ b/math/slalib/dcmpf.f @@ -0,0 +1,160 @@ + SUBROUTINE slDCMF (COEFFS,XZ,YZ,XS,YS,PERP,ORIENT) +*+ +* - - - - - - +* D C M F +* - - - - - - +* +* Decompose an [X,Y] linear fit into its constituent parameters: +* zero points, scales, nonperpendicularity and orientation. +* +* Given: +* COEFFS d(6) transformation coefficients (see note) +* +* Returned: +* XZ d x zero point +* YZ d y zero point +* XS d x scale +* YS d y scale +* PERP d nonperpendicularity (radians) +* ORIENT d orientation (radians) +* +* Called: slDA1P +* +* The model relates two sets of [X,Y] coordinates as follows. +* Naming the elements of COEFFS: +* +* COEFFS(1) = A +* COEFFS(2) = B +* COEFFS(3) = C +* COEFFS(4) = D +* COEFFS(5) = E +* COEFFS(6) = F +* +* the model transforms coordinates [X1,Y1] into coordinates +* [X2,Y2] as follows: +* +* X2 = A + B*X1 + C*Y1 +* Y2 = D + E*X1 + F*Y1 +* +* The transformation can be decomposed into four steps: +* +* 1) Zero points: +* +* x' = XZ + X1 +* y' = YZ + Y1 +* +* 2) Scales: +* +* x'' = XS*x' +* y'' = YS*y' +* +* 3) Nonperpendicularity: +* +* x''' = cos(PERP/2)*x'' + sin(PERP/2)*y'' +* y''' = sin(PERP/2)*x'' + cos(PERP/2)*y'' +* +* 4) Orientation: +* +* X2 = cos(ORIENT)*x''' + sin(ORIENT)*y''' +* Y2 =-sin(ORIENT)*y''' + cos(ORIENT)*y''' +* +* See also slFTXY, slPXY, slINVF, slXYXY +* +* P.T.Wallace Starlink 19 December 2001 +* +* Copyright (C) 2001 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION COEFFS(6),XZ,YZ,XS,YS,PERP,ORIENT + + DOUBLE PRECISION A,B,C,D,E,F,RB2E2,RC2F2,XSC,YSC,P1,P2,P,WS,WC, + : OR,HP,SHP,CHP,SOR,COR,DET,X0,Y0,slDA1P + + + +* Copy the six coefficients. + A = COEFFS(1) + B = COEFFS(2) + C = COEFFS(3) + D = COEFFS(4) + E = COEFFS(5) + F = COEFFS(6) + +* Scales. + RB2E2 = SQRT(B*B+E*E) + RC2F2 = SQRT(C*C+F*F) + IF (B*F-C*E.GE.0D0) THEN + XSC = RB2E2 + ELSE + B = -B + E = -E + XSC = -RB2E2 + END IF + YSC = RC2F2 + +* Non-perpendicularity. + IF (C.NE.0D0.OR.F.NE.0D0) THEN + P1 = ATAN2(C,F) + ELSE + P1 = 0D0 + END IF + IF (E.NE.0D0.OR.B.NE.0D0) THEN + P2 = ATAN2(E,B) + ELSE + P2 = 0D0 + END IF + P = slDA1P(P1+P2) + +* Orientation. + WS = C*RB2E2-E*RC2F2 + WC = B*RC2F2+F*RB2E2 + IF (WS.NE.0D0.OR.WC.NE.0D0) THEN + OR = ATAN2(WS,WC) + ELSE + OR = 0D0 + END IF + +* Zero points. + HP = P/2D0 + SHP = SIN(HP) + CHP = COS(HP) + SOR = SIN(OR) + COR = COS(OR) + DET = XSC*YSC*(CHP+SHP)*(CHP-SHP) + IF (ABS(DET).GT.0D0) THEN + X0 = YSC*(A*(CHP*COR-SHP*SOR)-D*(CHP*SOR+SHP*COR))/DET + Y0 = XSC*(A*(CHP*SOR-SHP*COR)+D*(CHP*COR+SHP*SOR))/DET + ELSE + X0 = 0D0 + Y0 = 0D0 + END IF + +* Results. + XZ = X0 + YZ = Y0 + XS = XSC + YS = YSC + PERP = P + ORIENT = OR + + END diff --git a/math/slalib/dcs2c.f b/math/slalib/dcs2c.f new file mode 100644 index 00000000..59a70b98 --- /dev/null +++ b/math/slalib/dcs2c.f @@ -0,0 +1,57 @@ + SUBROUTINE slDS2C (A, B, V) +*+ +* - - - - - - +* D S 2 C +* - - - - - - +* +* Spherical coordinates to direction cosines (double precision) +* +* Given: +* A,B d spherical coordinates in radians +* (RA,Dec), (long,lat) etc. +* +* Returned: +* V d(3) x,y,z unit vector +* +* The spherical coordinates are longitude (+ve anticlockwise looking +* from the +ve latitude pole) and latitude. The Cartesian coordinates +* are right handed, with the x axis at zero longitude and latitude, and +* the z axis at the +ve latitude pole. +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION A,B,V(3) + + DOUBLE PRECISION COSB + + + COSB = COS(B) + + V(1) = COS(A)*COSB + V(2) = SIN(A)*COSB + V(3) = SIN(B) + + END diff --git a/math/slalib/dd2tf.f b/math/slalib/dd2tf.f new file mode 100644 index 00000000..e3227631 --- /dev/null +++ b/math/slalib/dd2tf.f @@ -0,0 +1,107 @@ + SUBROUTINE slDDTF (NDP, DAYS, SIGN, IHMSF) +*+ +* - - - - - - +* D D T F +* - - - - - - +* +* Convert an interval in days into hours, minutes, seconds +* (double precision) +* +* Given: +* NDP i number of decimal places of seconds +* DAYS d interval in days +* +* Returned: +* SIGN c '+' or '-' +* IHMSF i(4) hours, minutes, seconds, fraction +* +* Notes: +* +* 1) NDP less than zero is interpreted as zero. +* +* 2) The largest useful value for NDP is determined by the size +* of DAYS, the format of DOUBLE PRECISION floating-point numbers +* on the target machine, and the risk of overflowing IHMSF(4). +* On some architectures, for DAYS up to 1D0, the available +* floating-point precision corresponds roughly to NDP=12. +* However, the practical limit is NDP=9, set by the capacity of +* a typical 32-bit IHMSF(4). +* +* 3) The absolute value of DAYS may exceed 1D0. In cases where it +* does not, it is up to the caller to test for and handle the +* case where DAYS is very nearly 1D0 and rounds up to 24 hours, +* by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER NDP + DOUBLE PRECISION DAYS + CHARACTER SIGN*(*) + INTEGER IHMSF(4) + +* Days to seconds + DOUBLE PRECISION D2S + PARAMETER (D2S=86400D0) + + INTEGER NRS,N + DOUBLE PRECISION RS,RM,RH,A,AH,AM,AS,AF + + + +* Handle sign + IF (DAYS.GE.0D0) THEN + SIGN='+' + ELSE + SIGN='-' + END IF + +* Field units in terms of least significant figure + NRS=1 + DO N=1,NDP + NRS=NRS*10 + END DO + RS=DBLE(NRS) + RM=RS*60D0 + RH=RM*60D0 + +* Round interval and express in smallest units required + A=ANINT(RS*D2S*ABS(DAYS)) + +* Separate into fields + AH=AINT(A/RH) + A=A-AH*RH + AM=AINT(A/RM) + A=A-AM*RM + AS=AINT(A/RS) + AF=A-AS*RS + +* Return results + IHMSF(1)=MAX(NINT(AH),0) + IHMSF(2)=MAX(MIN(NINT(AM),59),0) + IHMSF(3)=MAX(MIN(NINT(AS),59),0) + IHMSF(4)=MAX(NINT(MIN(AF,RS-1D0)),0) + + END diff --git a/math/slalib/de2h.f b/math/slalib/de2h.f new file mode 100644 index 00000000..9d023e9f --- /dev/null +++ b/math/slalib/de2h.f @@ -0,0 +1,107 @@ + SUBROUTINE slDE2H (HA, DEC, PHI, AZ, EL) +*+ +* - - - - - +* D E 2 H +* - - - - - +* +* Equatorial to horizon coordinates: HA,Dec to Az,El +* +* (double precision) +* +* Given: +* HA d hour angle +* DEC d declination +* PHI d observatory latitude +* +* Returned: +* AZ d azimuth +* EL d elevation +* +* Notes: +* +* 1) All the arguments are angles in radians. +* +* 2) Azimuth is returned in the range 0-2pi; north is zero, +* and east is +pi/2. Elevation is returned in the range +* +/-pi/2. +* +* 3) The latitude must be geodetic. In critical applications, +* corrections for polar motion should be applied. +* +* 4) In some applications it will be important to specify the +* correct type of hour angle and declination in order to +* produce the required type of azimuth and elevation. In +* particular, it may be important to distinguish between +* elevation as affected by refraction, which would +* require the "observed" HA,Dec, and the elevation +* in vacuo, which would require the "topocentric" HA,Dec. +* If the effects of diurnal aberration can be neglected, the +* "apparent" HA,Dec may be used instead of the topocentric +* HA,Dec. +* +* 5) No range checking of arguments is carried out. +* +* 6) In applications which involve many such calculations, rather +* than calling the present routine it will be more efficient to +* use inline code, having previously computed fixed terms such +* as sine and cosine of latitude, and (for tracking a star) +* sine and cosine of declination. +* +* P.T.Wallace Starlink 9 July 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION HA,DEC,PHI,AZ,EL + + DOUBLE PRECISION D2PI + PARAMETER (D2PI=6.283185307179586476925286766559D0) + + DOUBLE PRECISION SH,CH,SD,CD,SP,CP,X,Y,Z,R,A + + +* Useful trig functions + SH=SIN(HA) + CH=COS(HA) + SD=SIN(DEC) + CD=COS(DEC) + SP=SIN(PHI) + CP=COS(PHI) + +* Az,El as x,y,z + X=-CH*CD*SP+SD*CP + Y=-SH*CD + Z=CH*CD*CP+SD*SP + +* To spherical + R=SQRT(X*X+Y*Y) + IF (R.EQ.0D0) THEN + A=0D0 + ELSE + A=ATAN2(Y,X) + END IF + IF (A.LT.0D0) A=A+D2PI + AZ=A + EL=ATAN2(Z,R) + + END diff --git a/math/slalib/deuler.f b/math/slalib/deuler.f new file mode 100644 index 00000000..1ae50acf --- /dev/null +++ b/math/slalib/deuler.f @@ -0,0 +1,181 @@ + SUBROUTINE slDEUL (ORDER, PHI, THETA, PSI, RMAT) +*+ +* - - - - - - - +* D E U L +* - - - - - - - +* +* Form a rotation matrix from the Euler angles - three successive +* rotations about specified Cartesian axes (double precision) +* +* Given: +* ORDER c*(*) specifies about which axes the rotations occur +* PHI d 1st rotation (radians) +* THETA d 2nd rotation ( " ) +* PSI d 3rd rotation ( " ) +* +* Returned: +* RMAT d(3,3) rotation matrix +* +* A rotation is positive when the reference frame rotates +* anticlockwise as seen looking towards the origin from the +* positive region of the specified axis. +* +* The characters of ORDER define which axes the three successive +* rotations are about. A typical value is 'ZXZ', indicating that +* RMAT is to become the direction cosine matrix corresponding to +* rotations of the reference frame through PHI radians about the +* old Z-axis, followed by THETA radians about the resulting X-axis, +* then PSI radians about the resulting Z-axis. +* +* The axis names can be any of the following, in any order or +* combination: X, Y, Z, uppercase or lowercase, 1, 2, 3. Normal +* axis labelling/numbering conventions apply; the xyz (=123) +* triad is right-handed. Thus, the 'ZXZ' example given above +* could be written 'zxz' or '313' (or even 'ZxZ' or '3xZ'). ORDER +* is terminated by length or by the first unrecognized character. +* +* Fewer than three rotations are acceptable, in which case the later +* angle arguments are ignored. If all rotations are zero, the +* identity matrix is produced. +* +* P.T.Wallace Starlink 23 May 1997 +* +* Copyright (C) 1997 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) ORDER + DOUBLE PRECISION PHI,THETA,PSI,RMAT(3,3) + + INTEGER J,I,L,N,K + DOUBLE PRECISION RESULT(3,3),ROTN(3,3),ANGLE,S,C,W,WM(3,3) + CHARACTER AXIS + + + +* Initialize result matrix + DO J=1,3 + DO I=1,3 + IF (I.NE.J) THEN + RESULT(I,J) = 0D0 + ELSE + RESULT(I,J) = 1D0 + END IF + END DO + END DO + +* Establish length of axis string + L = LEN(ORDER) + +* Look at each character of axis string until finished + DO N=1,3 + IF (N.LE.L) THEN + +* Initialize rotation matrix for the current rotation + DO J=1,3 + DO I=1,3 + IF (I.NE.J) THEN + ROTN(I,J) = 0D0 + ELSE + ROTN(I,J) = 1D0 + END IF + END DO + END DO + +* Pick up the appropriate Euler angle and take sine & cosine + IF (N.EQ.1) THEN + ANGLE = PHI + ELSE IF (N.EQ.2) THEN + ANGLE = THETA + ELSE + ANGLE = PSI + END IF + S = SIN(ANGLE) + C = COS(ANGLE) + +* Identify the axis + AXIS = ORDER(N:N) + IF (AXIS.EQ.'X'.OR. + : AXIS.EQ.'x'.OR. + : AXIS.EQ.'1') THEN + +* Matrix for x-rotation + ROTN(2,2) = C + ROTN(2,3) = S + ROTN(3,2) = -S + ROTN(3,3) = C + + ELSE IF (AXIS.EQ.'Y'.OR. + : AXIS.EQ.'y'.OR. + : AXIS.EQ.'2') THEN + +* Matrix for y-rotation + ROTN(1,1) = C + ROTN(1,3) = -S + ROTN(3,1) = S + ROTN(3,3) = C + + ELSE IF (AXIS.EQ.'Z'.OR. + : AXIS.EQ.'z'.OR. + : AXIS.EQ.'3') THEN + +* Matrix for z-rotation + ROTN(1,1) = C + ROTN(1,2) = S + ROTN(2,1) = -S + ROTN(2,2) = C + + ELSE + +* Unrecognized character - fake end of string + L = 0 + + END IF + +* Apply the current rotation (matrix ROTN x matrix RESULT) + DO I=1,3 + DO J=1,3 + W = 0D0 + DO K=1,3 + W = W+ROTN(I,K)*RESULT(K,J) + END DO + WM(I,J) = W + END DO + END DO + DO J=1,3 + DO I=1,3 + RESULT(I,J) = WM(I,J) + END DO + END DO + + END IF + + END DO + +* Copy the result + DO J=1,3 + DO I=1,3 + RMAT(I,J) = RESULT(I,J) + END DO + END DO + + END diff --git a/math/slalib/dfltin.f b/math/slalib/dfltin.f new file mode 100644 index 00000000..7d514f39 --- /dev/null +++ b/math/slalib/dfltin.f @@ -0,0 +1,298 @@ + SUBROUTINE slDFLI (STRING, NSTRT, DRESLT, JFLAG) +*+ +* - - - - - - - +* D F L I +* - - - - - - - +* +* Convert free-format input into double precision floating point +* +* Given: +* STRING c string containing number to be decoded +* NSTRT i pointer to where decoding is to start +* DRESLT d current value of result +* +* Returned: +* NSTRT i advanced to next number +* DRESLT d result +* JFLAG i status: -1 = -OK, 0 = +OK, 1 = null, 2 = error +* +* Notes: +* +* 1 The reason DFLTIN has separate OK status values for + +* and - is to enable minus zero to be detected. This is +* of crucial importance when decoding mixed-radix numbers. +* For example, an angle expressed as deg, arcmin, arcsec +* may have a leading minus sign but a zero degrees field. +* +* 2 A TAB is interpreted as a space, and lowercase characters +* are interpreted as uppercase. +* +* 3 The basic format is the sequence of fields #^.^@#^, where +* # is a sign character + or -, ^ means a string of decimal +* digits, and @, which indicates an exponent, means D or E. +* Various combinations of these fields can be omitted, and +* embedded blanks are permissible in certain places. +* +* 4 Spaces: +* +* . Leading spaces are ignored. +* +* . Embedded spaces are allowed only after +, -, D or E, +* and after the decomal point if the first sequence of +* digits is absent. +* +* . Trailing spaces are ignored; the first signifies +* end of decoding and subsequent ones are skipped. +* +* 5 Delimiters: +* +* . Any character other than +,-,0-9,.,D,E or space may be +* used to signal the end of the number and terminate +* decoding. +* +* . Comma is recognized by DFLTIN as a special case; it +* is skipped, leaving the pointer on the next character. +* See 13, below. +* +* 6 Both signs are optional. The default is +. +* +* 7 The mantissa ^.^ defaults to 1. +* +* 8 The exponent @#^ defaults to D0. +* +* 9 The strings of decimal digits may be of any length. +* +* 10 The decimal point is optional for whole numbers. +* +* 11 A "null result" occurs when the string of characters being +* decoded does not begin with +,-,0-9,.,D or E, or consists +* entirely of spaces. When this condition is detected, JFLAG +* is set to 1 and DRESLT is left untouched. +* +* 12 NSTRT = 1 for the first character in the string. +* +* 13 On return from DFLTIN, NSTRT is set ready for the next +* decode - following trailing blanks and any comma. If a +* delimiter other than comma is being used, NSTRT must be +* incremented before the next call to DFLTIN, otherwise +* all subsequent calls will return a null result. +* +* 14 Errors (JFLAG=2) occur when: +* +* . a +, -, D or E is left unsatisfied; or +* +* . the decimal point is present without at least +* one decimal digit before or after it; or +* +* . an exponent more than 100 has been presented. +* +* 15 When an error has been detected, NSTRT is left +* pointing to the character following the last +* one used before the error came to light. This +* may be after the point at which a more sophisticated +* program could have detected the error. For example, +* DFLTIN does not detect that '1D999' is unacceptable +* (on a computer where this is so) until the entire number +* has been decoded. +* +* 16 Certain highly unlikely combinations of mantissa & +* exponent can cause arithmetic faults during the +* decode, in some cases despite the fact that they +* together could be construed as a valid number. +* +* 17 Decoding is left to right, one pass. +* +* 18 See also FLOTIN and INTIN +* +* Called: slICHF +* +* P.T.Wallace Starlink 18 March 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) STRING + INTEGER NSTRT + DOUBLE PRECISION DRESLT + INTEGER JFLAG + + INTEGER NPTR,MSIGN,NEXP,NDP,NVEC,NDIGIT,ISIGNX,J + DOUBLE PRECISION DMANT,DIGIT + + + +* Current character + NPTR=NSTRT + +* Set defaults: mantissa & sign, exponent & sign, decimal place count + DMANT=0D0 + MSIGN=1 + NEXP=0 + ISIGNX=1 + NDP=0 + +* Look for sign + 100 CONTINUE + CALL slICHF(STRING,NPTR,NVEC,NDIGIT,DIGIT) + GO TO ( 400, 100, 800, 500, 300, 200, 9110, 9100, 9110),NVEC +* 0-9 SP D/E . + - , ELSE END + +* Negative + 200 CONTINUE + MSIGN=-1 + +* Look for first leading decimal + 300 CONTINUE + CALL slICHF(STRING,NPTR,NVEC,NDIGIT,DIGIT) + GO TO ( 400, 300, 800, 500, 9200, 9200, 9200, 9200, 9210),NVEC +* 0-9 SP D/E . + - , ELSE END + +* Accept leading decimals + 400 CONTINUE + DMANT=DMANT*1D1+DIGIT + CALL slICHF(STRING,NPTR,NVEC,NDIGIT,DIGIT) + GO TO ( 400, 1310, 900, 600, 1300, 1300, 1300, 1300, 1310),NVEC +* 0-9 SP D/E . + - , ELSE END + +* Look for decimal when none preceded the point + 500 CONTINUE + CALL slICHF(STRING,NPTR,NVEC,NDIGIT,DIGIT) + GO TO ( 700, 500, 9200, 9200, 9200, 9200, 9200, 9200, 9210),NVEC +* 0-9 SP D/E . + - , ELSE END + +* Look for trailing decimals + 600 CONTINUE + CALL slICHF(STRING,NPTR,NVEC,NDIGIT,DIGIT) + GO TO ( 700, 1310, 900, 1300, 1300, 1300, 1300, 1300, 1310),NVEC +* 0-9 SP D/E . + - , ELSE END + +* Accept trailing decimals + 700 CONTINUE + NDP=NDP+1 + DMANT=DMANT*1D1+DIGIT + GO TO 600 + +* Exponent symbol first in field: default mantissa to 1 + 800 CONTINUE + DMANT=1D0 + +* Look for sign of exponent + 900 CONTINUE + CALL slICHF(STRING,NPTR,NVEC,NDIGIT,DIGIT) + GO TO (1200, 900, 9200, 9200, 1100, 1000, 9200, 9200, 9210),NVEC +* 0-9 SP D/E . + - , ELSE END + +* Exponent negative + 1000 CONTINUE + ISIGNX=-1 + +* Look for first digit of exponent + 1100 CONTINUE + CALL slICHF(STRING,NPTR,NVEC,NDIGIT,DIGIT) + GO TO (1200, 1100, 9200, 9200, 9200, 9200, 9200, 9200, 9210),NVEC +* 0-9 SP D/E . + - , ELSE END + +* Use exponent digit + 1200 CONTINUE + NEXP=NEXP*10+NDIGIT + IF (NEXP.GT.100) GO TO 9200 + +* Look for subsequent digits of exponent + CALL slICHF(STRING,NPTR,NVEC,NDIGIT,DIGIT) + GO TO (1200, 1310, 1300, 1300, 1300, 1300, 1300, 1300, 1310),NVEC +* 0-9 SP D/E . + - , ELSE END + +* Combine exponent and decimal place count + 1300 CONTINUE + NPTR=NPTR-1 + 1310 CONTINUE + NEXP=NEXP*ISIGNX-NDP + +* Skip if net exponent negative + IF (NEXP.LT.0) GO TO 1500 + +* Positive exponent: scale up + 1400 CONTINUE + IF (NEXP.LT.10) GO TO 1410 + DMANT=DMANT*1D10 + NEXP=NEXP-10 + GO TO 1400 + 1410 CONTINUE + IF (NEXP.LT.1) GO TO 1600 + DMANT=DMANT*1D1 + NEXP=NEXP-1 + GO TO 1410 + +* Negative exponent: scale down + 1500 CONTINUE + IF (NEXP.GT.-10) GO TO 1510 + DMANT=DMANT/1D10 + NEXP=NEXP+10 + GO TO 1500 + 1510 CONTINUE + IF (NEXP.GT.-1) GO TO 1600 + DMANT=DMANT/1D1 + NEXP=NEXP+1 + GO TO 1510 + +* Get result & status + 1600 CONTINUE + J=0 + IF (MSIGN.EQ.1) GO TO 1610 + J=-1 + DMANT=-DMANT + 1610 CONTINUE + DRESLT=DMANT + +* Skip to end of field + 1620 CONTINUE + CALL slICHF(STRING,NPTR,NVEC,NDIGIT,DIGIT) + GO TO (1720, 1620, 1720, 1720, 1720, 1720, 9900, 1720, 9900),NVEC +* 0-9 SP D/E . + - , ELSE END + + 1720 CONTINUE + NPTR=NPTR-1 + GO TO 9900 + + +* Exits + +* Null field + 9100 CONTINUE + NPTR=NPTR-1 + 9110 CONTINUE + J=1 + GO TO 9900 + +* Errors + 9200 CONTINUE + NPTR=NPTR-1 + 9210 CONTINUE + J=2 + +* Return + 9900 CONTINUE + NSTRT=NPTR + JFLAG=J + + END diff --git a/math/slalib/dh2e.f b/math/slalib/dh2e.f new file mode 100644 index 00000000..0ef9946c --- /dev/null +++ b/math/slalib/dh2e.f @@ -0,0 +1,101 @@ + SUBROUTINE slDH2E (AZ, EL, PHI, HA, DEC) +*+ +* - - - - - +* D E 2 H +* - - - - - +* +* Horizon to equatorial coordinates: Az,El to HA,Dec +* +* (double precision) +* +* Given: +* AZ d azimuth +* EL d elevation +* PHI d observatory latitude +* +* Returned: +* HA d hour angle +* DEC d declination +* +* Notes: +* +* 1) All the arguments are angles in radians. +* +* 2) The sign convention for azimuth is north zero, east +pi/2. +* +* 3) HA is returned in the range +/-pi. Declination is returned +* in the range +/-pi/2. +* +* 4) The latitude is (in principle) geodetic. In critical +* applications, corrections for polar motion should be applied. +* +* 5) In some applications it will be important to specify the +* correct type of elevation in order to produce the required +* type of HA,Dec. In particular, it may be important to +* distinguish between the elevation as affected by refraction, +* which will yield the "observed" HA,Dec, and the elevation +* in vacuo, which will yield the "topocentric" HA,Dec. If the +* effects of diurnal aberration can be neglected, the +* topocentric HA,Dec may be used as an approximation to the +* "apparent" HA,Dec. +* +* 6) No range checking of arguments is done. +* +* 7) In applications which involve many such calculations, rather +* than calling the present routine it will be more efficient to +* use inline code, having previously computed fixed terms such +* as sine and cosine of latitude. +* +* P.T.Wallace Starlink 21 February 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION AZ,EL,PHI,HA,DEC + + DOUBLE PRECISION SA,CA,SE,CE,SP,CP,X,Y,Z,R + + +* Useful trig functions + SA=SIN(AZ) + CA=COS(AZ) + SE=SIN(EL) + CE=COS(EL) + SP=SIN(PHI) + CP=COS(PHI) + +* HA,Dec as x,y,z + X=-CA*CE*SP+SE*CP + Y=-SA*CE + Z=CA*CE*CP+SE*SP + +* To HA,Dec + R=SQRT(X*X+Y*Y) + IF (R.EQ.0D0) THEN + HA=0D0 + ELSE + HA=ATAN2(Y,X) + END IF + DEC=ATAN2(Z,R) + + END diff --git a/math/slalib/dimxv.f b/math/slalib/dimxv.f new file mode 100644 index 00000000..3eec08e4 --- /dev/null +++ b/math/slalib/dimxv.f @@ -0,0 +1,69 @@ + SUBROUTINE slDIMV (DM, VA, VB) +*+ +* - - - - - - +* D I M V +* - - - - - - +* +* Performs the 3-D backward unitary transformation: +* +* vector VB = (inverse of matrix DM) * vector VA +* +* (double precision) +* +* (n.b. the matrix must be unitary, as this routine assumes that +* the inverse and transpose are identical) +* +* Given: +* DM dp(3,3) matrix +* VA dp(3) vector +* +* Returned: +* VB dp(3) result vector +* +* P.T.Wallace Starlink March 1986 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DM(3,3),VA(3),VB(3) + + INTEGER I,J + DOUBLE PRECISION W,VW(3) + + + +* Inverse of matrix DM * vector VA -> vector VW + DO J=1,3 + W=0D0 + DO I=1,3 + W=W+DM(I,J)*VA(I) + END DO + VW(J)=W + END DO + +* Vector VW -> vector VB + DO J=1,3 + VB(J)=VW(J) + END DO + + END diff --git a/math/slalib/djcal.f b/math/slalib/djcal.f new file mode 100644 index 00000000..31766d18 --- /dev/null +++ b/math/slalib/djcal.f @@ -0,0 +1,93 @@ + SUBROUTINE slDJCA (NDP, DJM, IYMDF, J) +*+ +* - - - - - - +* D J C A +* - - - - - - +* +* Modified Julian Date to Gregorian Calendar, expressed +* in a form convenient for formatting messages (namely +* rounded to a specified precision, and with the fields +* stored in a single array) +* +* Given: +* NDP i number of decimal places of days in fraction +* DJM d modified Julian Date (JD-2400000.5) +* +* Returned: +* IYMDF i(4) year, month, day, fraction in Gregorian +* calendar +* J i status: nonzero = out of range +* +* Any date after 4701BC March 1 is accepted. +* +* NDP should be 4 or less if internal overflows are to be avoided +* on machines which use 32-bit integers. +* +* The algorithm is adapted from Hatcher 1984 (QJRAS 25, 53-55). +* +* Last revision: 22 July 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER NDP + DOUBLE PRECISION DJM + INTEGER IYMDF(4),J + + INTEGER NFD + DOUBLE PRECISION FD,DF,F,D + INTEGER JD,N4,ND10 + + +* Validate. + IF ( DJM.LE.-2395520D0 .OR. DJM.GE.1D9 ) THEN + J = -1 + ELSE + J = 0 + +* Denominator of fraction. + NFD = 10**MAX(NDP,0) + FD = DBLE(NFD) + +* Round date and express in units of fraction. + DF = ANINT(DJM*FD) + +* Separate day and fraction. + F = MOD(DF,FD) + IF (F.LT.0D0) F = F+FD + D = (DF-F)/FD + +* Express day in Gregorian calendar. + JD = NINT(D)+2400001 + + N4 = 4*(JD+((2*((4*JD-17918)/146097)*3)/4+1)/2-37) + ND10 = 10*(MOD(N4-237,1461)/4)+5 + + IYMDF(1) = N4/1461-4712 + IYMDF(2) = MOD(ND10/306+2,12)+1 + IYMDF(3) = MOD(ND10,306)/10+1 + IYMDF(4) = NINT(F) + + END IF + + END diff --git a/math/slalib/djcl.f b/math/slalib/djcl.f new file mode 100644 index 00000000..7164ea37 --- /dev/null +++ b/math/slalib/djcl.f @@ -0,0 +1,84 @@ + SUBROUTINE slDJCL (DJM, IY, IM, ID, FD, J) +*+ +* - - - - - +* D J C L +* - - - - - +* +* Modified Julian Date to Gregorian year, month, day, +* and fraction of a day. +* +* Given: +* DJM dp modified Julian Date (JD-2400000.5) +* +* Returned: +* IY int year +* IM int month +* ID int day +* FD dp fraction of day +* J int status: +* 0 = OK +* -1 = unacceptable date (before 4701BC March 1) +* +* The algorithm is adapted from Hatcher 1984 (QJRAS 25, 53-55). +* +* Last revision: 22 July 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DJM + INTEGER IY,IM,ID + DOUBLE PRECISION FD + INTEGER J + + DOUBLE PRECISION F,D + INTEGER JD,N4,ND10 + + +* Check if date is acceptable. + IF ( DJM.LE.-2395520D0 .OR. DJM.GE.1D9 ) THEN + J = -1 + ELSE + J = 0 + +* Separate day and fraction. + F = MOD(DJM,1D0) + IF (F.LT.0D0) F = F+1D0 + D = ANINT(DJM-F) + +* Express day in Gregorian calendar. + JD = NINT(D)+2400001 + + N4 = 4*(JD+((6*((4*JD-17918)/146097))/4+1)/2-37) + ND10 = 10*(MOD(N4-237,1461)/4)+5 + + IY = N4/1461-4712 + IM = MOD(ND10/306+2,12)+1 + ID = MOD(ND10,306)/10+1 + FD = F + + J=0 + + END IF + + END diff --git a/math/slalib/dm2av.f b/math/slalib/dm2av.f new file mode 100644 index 00000000..5cabe620 --- /dev/null +++ b/math/slalib/dm2av.f @@ -0,0 +1,75 @@ + SUBROUTINE slDMAV (RMAT, AXVEC) +*+ +* - - - - - - +* D M A V +* - - - - - - +* +* From a rotation matrix, determine the corresponding axial vector. +* (double precision) +* +* A rotation matrix describes a rotation about some arbitrary axis, +* called the Euler axis. The "axial vector" returned by this routine +* has the same direction as the Euler axis, and its magnitude is the +* amount of rotation in radians. (The magnitude and direction can be +* separated by means of the routine slDVN.) +* +* Given: +* RMAT d(3,3) rotation matrix +* +* Returned: +* AXVEC d(3) axial vector (radians) +* +* The reference frame rotates clockwise as seen looking along +* the axial vector from the origin. +* +* If RMAT is null, so is the result. +* +* Last revision: 26 November 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RMAT(3,3),AXVEC(3) + + DOUBLE PRECISION X,Y,Z,S2,C2,PHI,F + + + + X = RMAT(2,3)-RMAT(3,2) + Y = RMAT(3,1)-RMAT(1,3) + Z = RMAT(1,2)-RMAT(2,1) + S2 = SQRT(X*X+Y*Y+Z*Z) + IF (S2.NE.0D0) THEN + C2 = RMAT(1,1)+RMAT(2,2)+RMAT(3,3)-1D0 + PHI = ATAN2(S2,C2) + F = PHI/S2 + AXVEC(1) = X*F + AXVEC(2) = Y*F + AXVEC(3) = Z*F + ELSE + AXVEC(1) = 0D0 + AXVEC(2) = 0D0 + AXVEC(3) = 0D0 + END IF + + END diff --git a/math/slalib/dmat.f b/math/slalib/dmat.f new file mode 100644 index 00000000..9209b062 --- /dev/null +++ b/math/slalib/dmat.f @@ -0,0 +1,158 @@ + SUBROUTINE slDMAT (N, A, Y, D, JF, IW) +*+ +* - - - - - +* D M A T +* - - - - - +* +* Matrix inversion & solution of simultaneous equations +* (double precision) +* +* For the set of n simultaneous equations in n unknowns: +* A.Y = X +* +* where: +* A is a non-singular N x N matrix +* Y is the vector of N unknowns +* X is the known vector +* +* DMATRX computes: +* the inverse of matrix A +* the determinant of matrix A +* the vector of N unknowns +* +* Arguments: +* +* symbol type dimension before after +* +* N i no. of unknowns unchanged +* A d (N,N) matrix inverse +* Y d (N) known vector solution vector +* D d - determinant +* * JF i - singularity flag +* IW i (N) - workspace +* +* * JF is the singularity flag. If the matrix is non-singular, JF=0 +* is returned. If the matrix is singular, JF=-1 & D=0D0 are +* returned. In the latter case, the contents of array A on return +* are undefined. +* +* Algorithm: +* Gaussian elimination with partial pivoting. +* +* Speed: +* Very fast. +* +* Accuracy: +* Fairly accurate - errors 1 to 4 times those of routines optimized +* for accuracy. +* +* P.T.Wallace Starlink 4 December 2001 +* +* Copyright (C) 2001 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER N + DOUBLE PRECISION A(N,N),Y(N),D + INTEGER JF + INTEGER IW(N) + + DOUBLE PRECISION SFA + PARAMETER (SFA=1D-20) + + INTEGER K,IMX,I,J,NP1MK,KI + DOUBLE PRECISION AMX,T,AKK,YK,AIK + + + JF=0 + D=1D0 + DO K=1,N + AMX=DABS(A(K,K)) + IMX=K + IF (K.NE.N) THEN + DO I=K+1,N + T=DABS(A(I,K)) + IF (T.GT.AMX) THEN + AMX=T + IMX=I + END IF + END DO + END IF + IF (AMX.LT.SFA) THEN + JF=-1 + ELSE + IF (IMX.NE.K) THEN + DO J=1,N + T=A(K,J) + A(K,J)=A(IMX,J) + A(IMX,J)=T + END DO + T=Y(K) + Y(K)=Y(IMX) + Y(IMX)=T + D=-D + END IF + IW(K)=IMX + AKK=A(K,K) + D=D*AKK + IF (DABS(D).LT.SFA) THEN + JF=-1 + ELSE + AKK=1D0/AKK + A(K,K)=AKK + DO J=1,N + IF (J.NE.K) A(K,J)=A(K,J)*AKK + END DO + YK=Y(K)*AKK + Y(K)=YK + DO I=1,N + AIK=A(I,K) + IF (I.NE.K) THEN + DO J=1,N + IF (J.NE.K) A(I,J)=A(I,J)-AIK*A(K,J) + END DO + Y(I)=Y(I)-AIK*YK + END IF + END DO + DO I=1,N + IF (I.NE.K) A(I,K)=-A(I,K)*AKK + END DO + END IF + END IF + END DO + IF (JF.NE.0) THEN + D=0D0 + ELSE + DO K=1,N + NP1MK=N+1-K + KI=IW(NP1MK) + IF (NP1MK.NE.KI) THEN + DO I=1,N + T=A(I,NP1MK) + A(I,NP1MK)=A(I,KI) + A(I,KI)=T + END DO + END IF + END DO + END IF + + END diff --git a/math/slalib/dmoon.f b/math/slalib/dmoon.f new file mode 100644 index 00000000..f16aadf1 --- /dev/null +++ b/math/slalib/dmoon.f @@ -0,0 +1,659 @@ + SUBROUTINE slDMON (DATE, PV) +*+ +* - - - - - - +* D M O N +* - - - - - - +* +* Approximate geocentric position and velocity of the Moon +* (double precision) +* +* Given: +* DATE D TDB (loosely ET) as a Modified Julian Date +* (JD-2400000.5) +* +* Returned: +* PV D(6) Moon x,y,z,xdot,ydot,zdot, mean equator and +* equinox of date (AU, AU/s) +* +* Notes: +* +* 1 This routine is a full implementation of the algorithm +* published by Meeus (see reference). +* +* 2 Meeus quotes accuracies of 10 arcsec in longitude, 3 arcsec in +* latitude and 0.2 arcsec in HP (equivalent to about 20 km in +* distance). Comparison with JPL DE200 over the interval +* 1960-2025 gives RMS errors of 3.7 arcsec and 83 mas/hour in +* longitude, 2.3 arcsec and 48 mas/hour in latitude, 11 km +* and 81 mm/s in distance. The maximum errors over the same +* interval are 18 arcsec and 0.50 arcsec/hour in longitude, +* 11 arcsec and 0.24 arcsec/hour in latitude, 40 km and 0.29 m/s +* in distance. +* +* 3 The original algorithm is expressed in terms of the obsolete +* timescale Ephemeris Time. Either TDB or TT can be used, but +* not UT without incurring significant errors (30 arcsec at +* the present time) due to the Moon's 0.5 arcsec/sec movement. +* +* 4 The algorithm is based on pre IAU 1976 standards. However, +* the result has been moved onto the new (FK5) equinox, an +* adjustment which is in any case much smaller than the +* intrinsic accuracy of the procedure. +* +* 5 Velocity is obtained by a complete analytical differentiation +* of the Meeus model. +* +* Reference: +* Meeus, l'Astronomie, June 1984, p348. +* +* P.T.Wallace Starlink 22 January 1998 +* +* Copyright (C) 1998 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,PV(6) + +* Degrees, arcseconds and seconds of time to radians + DOUBLE PRECISION D2R,DAS2R,DS2R + PARAMETER (D2R=0.0174532925199432957692369D0, + : DAS2R=4.848136811095359935899141D-6, + : DS2R=7.272205216643039903848712D-5) + +* Seconds per Julian century (86400*36525) + DOUBLE PRECISION CJ + PARAMETER (CJ=3155760000D0) + +* Julian epoch of B1950 + DOUBLE PRECISION B1950 + PARAMETER (B1950=1949.9997904423D0) + +* Earth equatorial radius in AU ( = 6378.137 / 149597870 ) + DOUBLE PRECISION ERADAU + PARAMETER (ERADAU=4.2635212653763D-5) + + DOUBLE PRECISION T,THETA,SINOM,COSOM,DOMCOM,WA,DWA,WB,DWB,WOM, + : DWOM,SINWOM,COSWOM,V,DV,COEFF,EMN,EMPN,DN,FN,EN, + : DEN,DTHETA,FTHETA,EL,DEL,B,DB,BF,DBF,P,DP,SP,R, + : DR,X,Y,Z,XD,YD,ZD,SEL,CEL,SB,CB,RCB,RBD,W,EPJ, + : EQCOR,EPS,SINEPS,COSEPS,ES,EC + INTEGER N,I + +* +* Coefficients for fundamental arguments +* +* at J1900: T**0, T**1, T**2, T**3 +* at epoch: T**0, T**1 +* +* Units are degrees for position and Julian centuries for time +* + +* Moon's mean longitude + DOUBLE PRECISION ELP0,ELP1,ELP2,ELP3,ELP,DELP + PARAMETER (ELP0=270.434164D0, + : ELP1=481267.8831D0, + : ELP2=-0.001133D0, + : ELP3=0.0000019D0) + +* Sun's mean anomaly + DOUBLE PRECISION EM0,EM1,EM2,EM3,EM,DEM + PARAMETER (EM0=358.475833D0, + : EM1=35999.0498D0, + : EM2=-0.000150D0, + : EM3=-0.0000033D0) + +* Moon's mean anomaly + DOUBLE PRECISION EMP0,EMP1,EMP2,EMP3,EMP,DEMP + PARAMETER (EMP0=296.104608D0, + : EMP1=477198.8491D0, + : EMP2=0.009192D0, + : EMP3=0.0000144D0) + +* Moon's mean elongation + DOUBLE PRECISION D0,D1,D2,D3,D,DD + PARAMETER (D0=350.737486D0, + : D1=445267.1142D0, + : D2=-0.001436D0, + : D3=0.0000019D0) + +* Mean distance of the Moon from its ascending node + DOUBLE PRECISION F0,F1,F2,F3,F,DF + PARAMETER (F0=11.250889D0, + : F1=483202.0251D0, + : F2=-0.003211D0, + : F3=-0.0000003D0) + +* Longitude of the Moon's ascending node + DOUBLE PRECISION OM0,OM1,OM2,OM3,OM,DOM + PARAMETER (OM0=259.183275D0, + : OM1=-1934.1420D0, + : OM2=0.002078D0, + : OM3=0.0000022D0) + +* Coefficients for (dimensionless) E factor + DOUBLE PRECISION E1,E2,E,DE,ESQ,DESQ + PARAMETER (E1=-0.002495D0,E2=-0.00000752D0) + +* Coefficients for periodic variations etc + DOUBLE PRECISION PAC,PA0,PA1 + PARAMETER (PAC=0.000233D0,PA0=51.2D0,PA1=20.2D0) + DOUBLE PRECISION PBC + PARAMETER (PBC=-0.001778D0) + DOUBLE PRECISION PCC + PARAMETER (PCC=0.000817D0) + DOUBLE PRECISION PDC + PARAMETER (PDC=0.002011D0) + DOUBLE PRECISION PEC,PE0,PE1,PE2 + PARAMETER (PEC=0.003964D0, + : PE0=346.560D0,PE1=132.870D0,PE2=-0.0091731D0) + DOUBLE PRECISION PFC + PARAMETER (PFC=0.001964D0) + DOUBLE PRECISION PGC + PARAMETER (PGC=0.002541D0) + DOUBLE PRECISION PHC + PARAMETER (PHC=0.001964D0) + DOUBLE PRECISION PIC + PARAMETER (PIC=-0.024691D0) + DOUBLE PRECISION PJC,PJ0,PJ1 + PARAMETER (PJC=-0.004328D0,PJ0=275.05D0,PJ1=-2.30D0) + DOUBLE PRECISION CW1 + PARAMETER (CW1=0.0004664D0) + DOUBLE PRECISION CW2 + PARAMETER (CW2=0.0000754D0) + +* +* Coefficients for Moon position +* +* Tx(N) = coefficient of L, B or P term (deg) +* ITx(N,1-5) = coefficients of M, M', D, F, E**n in argument +* + INTEGER NL,NB,NP + PARAMETER (NL=50,NB=45,NP=31) + DOUBLE PRECISION TL(NL),TB(NB),TP(NP) + INTEGER ITL(5,NL),ITB(5,NB),ITP(5,NP) +* +* Longitude +* M M' D F n + DATA TL( 1)/ +6.288750D0 /, + : (ITL(I, 1),I=1,5)/ +0, +1, +0, +0, 0 / + DATA TL( 2)/ +1.274018D0 /, + : (ITL(I, 2),I=1,5)/ +0, -1, +2, +0, 0 / + DATA TL( 3)/ +0.658309D0 /, + : (ITL(I, 3),I=1,5)/ +0, +0, +2, +0, 0 / + DATA TL( 4)/ +0.213616D0 /, + : (ITL(I, 4),I=1,5)/ +0, +2, +0, +0, 0 / + DATA TL( 5)/ -0.185596D0 /, + : (ITL(I, 5),I=1,5)/ +1, +0, +0, +0, 1 / + DATA TL( 6)/ -0.114336D0 /, + : (ITL(I, 6),I=1,5)/ +0, +0, +0, +2, 0 / + DATA TL( 7)/ +0.058793D0 /, + : (ITL(I, 7),I=1,5)/ +0, -2, +2, +0, 0 / + DATA TL( 8)/ +0.057212D0 /, + : (ITL(I, 8),I=1,5)/ -1, -1, +2, +0, 1 / + DATA TL( 9)/ +0.053320D0 /, + : (ITL(I, 9),I=1,5)/ +0, +1, +2, +0, 0 / + DATA TL(10)/ +0.045874D0 /, + : (ITL(I,10),I=1,5)/ -1, +0, +2, +0, 1 / + DATA TL(11)/ +0.041024D0 /, + : (ITL(I,11),I=1,5)/ -1, +1, +0, +0, 1 / + DATA TL(12)/ -0.034718D0 /, + : (ITL(I,12),I=1,5)/ +0, +0, +1, +0, 0 / + DATA TL(13)/ -0.030465D0 /, + : (ITL(I,13),I=1,5)/ +1, +1, +0, +0, 1 / + DATA TL(14)/ +0.015326D0 /, + : (ITL(I,14),I=1,5)/ +0, +0, +2, -2, 0 / + DATA TL(15)/ -0.012528D0 /, + : (ITL(I,15),I=1,5)/ +0, +1, +0, +2, 0 / + DATA TL(16)/ -0.010980D0 /, + : (ITL(I,16),I=1,5)/ +0, -1, +0, +2, 0 / + DATA TL(17)/ +0.010674D0 /, + : (ITL(I,17),I=1,5)/ +0, -1, +4, +0, 0 / + DATA TL(18)/ +0.010034D0 /, + : (ITL(I,18),I=1,5)/ +0, +3, +0, +0, 0 / + DATA TL(19)/ +0.008548D0 /, + : (ITL(I,19),I=1,5)/ +0, -2, +4, +0, 0 / + DATA TL(20)/ -0.007910D0 /, + : (ITL(I,20),I=1,5)/ +1, -1, +2, +0, 1 / + DATA TL(21)/ -0.006783D0 /, + : (ITL(I,21),I=1,5)/ +1, +0, +2, +0, 1 / + DATA TL(22)/ +0.005162D0 /, + : (ITL(I,22),I=1,5)/ +0, +1, -1, +0, 0 / + DATA TL(23)/ +0.005000D0 /, + : (ITL(I,23),I=1,5)/ +1, +0, +1, +0, 1 / + DATA TL(24)/ +0.004049D0 /, + : (ITL(I,24),I=1,5)/ -1, +1, +2, +0, 1 / + DATA TL(25)/ +0.003996D0 /, + : (ITL(I,25),I=1,5)/ +0, +2, +2, +0, 0 / + DATA TL(26)/ +0.003862D0 /, + : (ITL(I,26),I=1,5)/ +0, +0, +4, +0, 0 / + DATA TL(27)/ +0.003665D0 /, + : (ITL(I,27),I=1,5)/ +0, -3, +2, +0, 0 / + DATA TL(28)/ +0.002695D0 /, + : (ITL(I,28),I=1,5)/ -1, +2, +0, +0, 1 / + DATA TL(29)/ +0.002602D0 /, + : (ITL(I,29),I=1,5)/ +0, +1, -2, -2, 0 / + DATA TL(30)/ +0.002396D0 /, + : (ITL(I,30),I=1,5)/ -1, -2, +2, +0, 1 / + DATA TL(31)/ -0.002349D0 /, + : (ITL(I,31),I=1,5)/ +0, +1, +1, +0, 0 / + DATA TL(32)/ +0.002249D0 /, + : (ITL(I,32),I=1,5)/ -2, +0, +2, +0, 2 / + DATA TL(33)/ -0.002125D0 /, + : (ITL(I,33),I=1,5)/ +1, +2, +0, +0, 1 / + DATA TL(34)/ -0.002079D0 /, + : (ITL(I,34),I=1,5)/ +2, +0, +0, +0, 2 / + DATA TL(35)/ +0.002059D0 /, + : (ITL(I,35),I=1,5)/ -2, -1, +2, +0, 2 / + DATA TL(36)/ -0.001773D0 /, + : (ITL(I,36),I=1,5)/ +0, +1, +2, -2, 0 / + DATA TL(37)/ -0.001595D0 /, + : (ITL(I,37),I=1,5)/ +0, +0, +2, +2, 0 / + DATA TL(38)/ +0.001220D0 /, + : (ITL(I,38),I=1,5)/ -1, -1, +4, +0, 1 / + DATA TL(39)/ -0.001110D0 /, + : (ITL(I,39),I=1,5)/ +0, +2, +0, +2, 0 / + DATA TL(40)/ +0.000892D0 /, + : (ITL(I,40),I=1,5)/ +0, +1, -3, +0, 0 / + DATA TL(41)/ -0.000811D0 /, + : (ITL(I,41),I=1,5)/ +1, +1, +2, +0, 1 / + DATA TL(42)/ +0.000761D0 /, + : (ITL(I,42),I=1,5)/ -1, -2, +4, +0, 1 / + DATA TL(43)/ +0.000717D0 /, + : (ITL(I,43),I=1,5)/ -2, +1, +0, +0, 2 / + DATA TL(44)/ +0.000704D0 /, + : (ITL(I,44),I=1,5)/ -2, +1, -2, +0, 2 / + DATA TL(45)/ +0.000693D0 /, + : (ITL(I,45),I=1,5)/ +1, -2, +2, +0, 1 / + DATA TL(46)/ +0.000598D0 /, + : (ITL(I,46),I=1,5)/ -1, +0, +2, -2, 1 / + DATA TL(47)/ +0.000550D0 /, + : (ITL(I,47),I=1,5)/ +0, +1, +4, +0, 0 / + DATA TL(48)/ +0.000538D0 /, + : (ITL(I,48),I=1,5)/ +0, +4, +0, +0, 0 / + DATA TL(49)/ +0.000521D0 /, + : (ITL(I,49),I=1,5)/ -1, +0, +4, +0, 1 / + DATA TL(50)/ +0.000486D0 /, + : (ITL(I,50),I=1,5)/ +0, +2, -1, +0, 0 / +* +* Latitude +* M M' D F n + DATA TB( 1)/ +5.128189D0 /, + : (ITB(I, 1),I=1,5)/ +0, +0, +0, +1, 0 / + DATA TB( 2)/ +0.280606D0 /, + : (ITB(I, 2),I=1,5)/ +0, +1, +0, +1, 0 / + DATA TB( 3)/ +0.277693D0 /, + : (ITB(I, 3),I=1,5)/ +0, +1, +0, -1, 0 / + DATA TB( 4)/ +0.173238D0 /, + : (ITB(I, 4),I=1,5)/ +0, +0, +2, -1, 0 / + DATA TB( 5)/ +0.055413D0 /, + : (ITB(I, 5),I=1,5)/ +0, -1, +2, +1, 0 / + DATA TB( 6)/ +0.046272D0 /, + : (ITB(I, 6),I=1,5)/ +0, -1, +2, -1, 0 / + DATA TB( 7)/ +0.032573D0 /, + : (ITB(I, 7),I=1,5)/ +0, +0, +2, +1, 0 / + DATA TB( 8)/ +0.017198D0 /, + : (ITB(I, 8),I=1,5)/ +0, +2, +0, +1, 0 / + DATA TB( 9)/ +0.009267D0 /, + : (ITB(I, 9),I=1,5)/ +0, +1, +2, -1, 0 / + DATA TB(10)/ +0.008823D0 /, + : (ITB(I,10),I=1,5)/ +0, +2, +0, -1, 0 / + DATA TB(11)/ +0.008247D0 /, + : (ITB(I,11),I=1,5)/ -1, +0, +2, -1, 1 / + DATA TB(12)/ +0.004323D0 /, + : (ITB(I,12),I=1,5)/ +0, -2, +2, -1, 0 / + DATA TB(13)/ +0.004200D0 /, + : (ITB(I,13),I=1,5)/ +0, +1, +2, +1, 0 / + DATA TB(14)/ +0.003372D0 /, + : (ITB(I,14),I=1,5)/ -1, +0, -2, +1, 1 / + DATA TB(15)/ +0.002472D0 /, + : (ITB(I,15),I=1,5)/ -1, -1, +2, +1, 1 / + DATA TB(16)/ +0.002222D0 /, + : (ITB(I,16),I=1,5)/ -1, +0, +2, +1, 1 / + DATA TB(17)/ +0.002072D0 /, + : (ITB(I,17),I=1,5)/ -1, -1, +2, -1, 1 / + DATA TB(18)/ +0.001877D0 /, + : (ITB(I,18),I=1,5)/ -1, +1, +0, +1, 1 / + DATA TB(19)/ +0.001828D0 /, + : (ITB(I,19),I=1,5)/ +0, -1, +4, -1, 0 / + DATA TB(20)/ -0.001803D0 /, + : (ITB(I,20),I=1,5)/ +1, +0, +0, +1, 1 / + DATA TB(21)/ -0.001750D0 /, + : (ITB(I,21),I=1,5)/ +0, +0, +0, +3, 0 / + DATA TB(22)/ +0.001570D0 /, + : (ITB(I,22),I=1,5)/ -1, +1, +0, -1, 1 / + DATA TB(23)/ -0.001487D0 /, + : (ITB(I,23),I=1,5)/ +0, +0, +1, +1, 0 / + DATA TB(24)/ -0.001481D0 /, + : (ITB(I,24),I=1,5)/ +1, +1, +0, +1, 1 / + DATA TB(25)/ +0.001417D0 /, + : (ITB(I,25),I=1,5)/ -1, -1, +0, +1, 1 / + DATA TB(26)/ +0.001350D0 /, + : (ITB(I,26),I=1,5)/ -1, +0, +0, +1, 1 / + DATA TB(27)/ +0.001330D0 /, + : (ITB(I,27),I=1,5)/ +0, +0, -1, +1, 0 / + DATA TB(28)/ +0.001106D0 /, + : (ITB(I,28),I=1,5)/ +0, +3, +0, +1, 0 / + DATA TB(29)/ +0.001020D0 /, + : (ITB(I,29),I=1,5)/ +0, +0, +4, -1, 0 / + DATA TB(30)/ +0.000833D0 /, + : (ITB(I,30),I=1,5)/ +0, -1, +4, +1, 0 / + DATA TB(31)/ +0.000781D0 /, + : (ITB(I,31),I=1,5)/ +0, +1, +0, -3, 0 / + DATA TB(32)/ +0.000670D0 /, + : (ITB(I,32),I=1,5)/ +0, -2, +4, +1, 0 / + DATA TB(33)/ +0.000606D0 /, + : (ITB(I,33),I=1,5)/ +0, +0, +2, -3, 0 / + DATA TB(34)/ +0.000597D0 /, + : (ITB(I,34),I=1,5)/ +0, +2, +2, -1, 0 / + DATA TB(35)/ +0.000492D0 /, + : (ITB(I,35),I=1,5)/ -1, +1, +2, -1, 1 / + DATA TB(36)/ +0.000450D0 /, + : (ITB(I,36),I=1,5)/ +0, +2, -2, -1, 0 / + DATA TB(37)/ +0.000439D0 /, + : (ITB(I,37),I=1,5)/ +0, +3, +0, -1, 0 / + DATA TB(38)/ +0.000423D0 /, + : (ITB(I,38),I=1,5)/ +0, +2, +2, +1, 0 / + DATA TB(39)/ +0.000422D0 /, + : (ITB(I,39),I=1,5)/ +0, -3, +2, -1, 0 / + DATA TB(40)/ -0.000367D0 /, + : (ITB(I,40),I=1,5)/ +1, -1, +2, +1, 1 / + DATA TB(41)/ -0.000353D0 /, + : (ITB(I,41),I=1,5)/ +1, +0, +2, +1, 1 / + DATA TB(42)/ +0.000331D0 /, + : (ITB(I,42),I=1,5)/ +0, +0, +4, +1, 0 / + DATA TB(43)/ +0.000317D0 /, + : (ITB(I,43),I=1,5)/ -1, +1, +2, +1, 1 / + DATA TB(44)/ +0.000306D0 /, + : (ITB(I,44),I=1,5)/ -2, +0, +2, -1, 2 / + DATA TB(45)/ -0.000283D0 /, + : (ITB(I,45),I=1,5)/ +0, +1, +0, +3, 0 / +* +* Parallax +* M M' D F n + DATA TP( 1)/ +0.950724D0 /, + : (ITP(I, 1),I=1,5)/ +0, +0, +0, +0, 0 / + DATA TP( 2)/ +0.051818D0 /, + : (ITP(I, 2),I=1,5)/ +0, +1, +0, +0, 0 / + DATA TP( 3)/ +0.009531D0 /, + : (ITP(I, 3),I=1,5)/ +0, -1, +2, +0, 0 / + DATA TP( 4)/ +0.007843D0 /, + : (ITP(I, 4),I=1,5)/ +0, +0, +2, +0, 0 / + DATA TP( 5)/ +0.002824D0 /, + : (ITP(I, 5),I=1,5)/ +0, +2, +0, +0, 0 / + DATA TP( 6)/ +0.000857D0 /, + : (ITP(I, 6),I=1,5)/ +0, +1, +2, +0, 0 / + DATA TP( 7)/ +0.000533D0 /, + : (ITP(I, 7),I=1,5)/ -1, +0, +2, +0, 1 / + DATA TP( 8)/ +0.000401D0 /, + : (ITP(I, 8),I=1,5)/ -1, -1, +2, +0, 1 / + DATA TP( 9)/ +0.000320D0 /, + : (ITP(I, 9),I=1,5)/ -1, +1, +0, +0, 1 / + DATA TP(10)/ -0.000271D0 /, + : (ITP(I,10),I=1,5)/ +0, +0, +1, +0, 0 / + DATA TP(11)/ -0.000264D0 /, + : (ITP(I,11),I=1,5)/ +1, +1, +0, +0, 1 / + DATA TP(12)/ -0.000198D0 /, + : (ITP(I,12),I=1,5)/ +0, -1, +0, +2, 0 / + DATA TP(13)/ +0.000173D0 /, + : (ITP(I,13),I=1,5)/ +0, +3, +0, +0, 0 / + DATA TP(14)/ +0.000167D0 /, + : (ITP(I,14),I=1,5)/ +0, -1, +4, +0, 0 / + DATA TP(15)/ -0.000111D0 /, + : (ITP(I,15),I=1,5)/ +1, +0, +0, +0, 1 / + DATA TP(16)/ +0.000103D0 /, + : (ITP(I,16),I=1,5)/ +0, -2, +4, +0, 0 / + DATA TP(17)/ -0.000084D0 /, + : (ITP(I,17),I=1,5)/ +0, +2, -2, +0, 0 / + DATA TP(18)/ -0.000083D0 /, + : (ITP(I,18),I=1,5)/ +1, +0, +2, +0, 1 / + DATA TP(19)/ +0.000079D0 /, + : (ITP(I,19),I=1,5)/ +0, +2, +2, +0, 0 / + DATA TP(20)/ +0.000072D0 /, + : (ITP(I,20),I=1,5)/ +0, +0, +4, +0, 0 / + DATA TP(21)/ +0.000064D0 /, + : (ITP(I,21),I=1,5)/ -1, +1, +2, +0, 1 / + DATA TP(22)/ -0.000063D0 /, + : (ITP(I,22),I=1,5)/ +1, -1, +2, +0, 1 / + DATA TP(23)/ +0.000041D0 /, + : (ITP(I,23),I=1,5)/ +1, +0, +1, +0, 1 / + DATA TP(24)/ +0.000035D0 /, + : (ITP(I,24),I=1,5)/ -1, +2, +0, +0, 1 / + DATA TP(25)/ -0.000033D0 /, + : (ITP(I,25),I=1,5)/ +0, +3, -2, +0, 0 / + DATA TP(26)/ -0.000030D0 /, + : (ITP(I,26),I=1,5)/ +0, +1, +1, +0, 0 / + DATA TP(27)/ -0.000029D0 /, + : (ITP(I,27),I=1,5)/ +0, +0, -2, +2, 0 / + DATA TP(28)/ -0.000029D0 /, + : (ITP(I,28),I=1,5)/ +1, +2, +0, +0, 1 / + DATA TP(29)/ +0.000026D0 /, + : (ITP(I,29),I=1,5)/ -2, +0, +2, +0, 2 / + DATA TP(30)/ -0.000023D0 /, + : (ITP(I,30),I=1,5)/ +0, +1, -2, +2, 0 / + DATA TP(31)/ +0.000019D0 /, + : (ITP(I,31),I=1,5)/ -1, -1, +4, +0, 1 / + + + +* Centuries since J1900 + T=(DATE-15019.5D0)/36525D0 + +* +* Fundamental arguments (radians) and derivatives (radians per +* Julian century) for the current epoch +* + +* Moon's mean longitude + ELP=D2R*MOD(ELP0+(ELP1+(ELP2+ELP3*T)*T)*T,360D0) + DELP=D2R*(ELP1+(2D0*ELP2+3D0*ELP3*T)*T) + +* Sun's mean anomaly + EM=D2R*MOD(EM0+(EM1+(EM2+EM3*T)*T)*T,360D0) + DEM=D2R*(EM1+(2D0*EM2+3D0*EM3*T)*T) + +* Moon's mean anomaly + EMP=D2R*MOD(EMP0+(EMP1+(EMP2+EMP3*T)*T)*T,360D0) + DEMP=D2R*(EMP1+(2D0*EMP2+3D0*EMP3*T)*T) + +* Moon's mean elongation + D=D2R*MOD(D0+(D1+(D2+D3*T)*T)*T,360D0) + DD=D2R*(D1+(2D0*D2+3D0*D3*T)*T) + +* Mean distance of the Moon from its ascending node + F=D2R*MOD(F0+(F1+(F2+F3*T)*T)*T,360D0) + DF=D2R*(F1+(2D0*F2+3D0*F3*T)*T) + +* Longitude of the Moon's ascending node + OM=D2R*MOD(OM0+(OM1+(OM2+OM3*T)*T)*T,360D0) + DOM=D2R*(OM1+(2D0*OM2+3D0*OM3*T)*T) + SINOM=SIN(OM) + COSOM=COS(OM) + DOMCOM=DOM*COSOM + +* Add the periodic variations + THETA=D2R*(PA0+PA1*T) + WA=SIN(THETA) + DWA=D2R*PA1*COS(THETA) + THETA=D2R*(PE0+(PE1+PE2*T)*T) + WB=PEC*SIN(THETA) + DWB=D2R*PEC*(PE1+2D0*PE2*T)*COS(THETA) + ELP=ELP+D2R*(PAC*WA+WB+PFC*SINOM) + DELP=DELP+D2R*(PAC*DWA+DWB+PFC*DOMCOM) + EM=EM+D2R*PBC*WA + DEM=DEM+D2R*PBC*DWA + EMP=EMP+D2R*(PCC*WA+WB+PGC*SINOM) + DEMP=DEMP+D2R*(PCC*DWA+DWB+PGC*DOMCOM) + D=D+D2R*(PDC*WA+WB+PHC*SINOM) + DD=DD+D2R*(PDC*DWA+DWB+PHC*DOMCOM) + WOM=OM+D2R*(PJ0+PJ1*T) + DWOM=DOM+D2R*PJ1 + SINWOM=SIN(WOM) + COSWOM=COS(WOM) + F=F+D2R*(WB+PIC*SINOM+PJC*SINWOM) + DF=DF+D2R*(DWB+PIC*DOMCOM+PJC*DWOM*COSWOM) + +* E-factor, and square + E=1D0+(E1+E2*T)*T + DE=E1+2D0*E2*T + ESQ=E*E + DESQ=2D0*E*DE + +* +* Series expansions +* + +* Longitude + V=0D0 + DV=0D0 + DO N=NL,1,-1 + COEFF=TL(N) + EMN=DBLE(ITL(1,N)) + EMPN=DBLE(ITL(2,N)) + DN=DBLE(ITL(3,N)) + FN=DBLE(ITL(4,N)) + I=ITL(5,N) + IF (I.EQ.0) THEN + EN=1D0 + DEN=0D0 + ELSE IF (I.EQ.1) THEN + EN=E + DEN=DE + ELSE + EN=ESQ + DEN=DESQ + END IF + THETA=EMN*EM+EMPN*EMP+DN*D+FN*F + DTHETA=EMN*DEM+EMPN*DEMP+DN*DD+FN*DF + FTHETA=SIN(THETA) + V=V+COEFF*FTHETA*EN + DV=DV+COEFF*(COS(THETA)*DTHETA*EN+FTHETA*DEN) + END DO + EL=ELP+D2R*V + DEL=(DELP+D2R*DV)/CJ + +* Latitude + V=0D0 + DV=0D0 + DO N=NB,1,-1 + COEFF=TB(N) + EMN=DBLE(ITB(1,N)) + EMPN=DBLE(ITB(2,N)) + DN=DBLE(ITB(3,N)) + FN=DBLE(ITB(4,N)) + I=ITB(5,N) + IF (I.EQ.0) THEN + EN=1D0 + DEN=0D0 + ELSE IF (I.EQ.1) THEN + EN=E + DEN=DE + ELSE + EN=ESQ + DEN=DESQ + END IF + THETA=EMN*EM+EMPN*EMP+DN*D+FN*F + DTHETA=EMN*DEM+EMPN*DEMP+DN*DD+FN*DF + FTHETA=SIN(THETA) + V=V+COEFF*FTHETA*EN + DV=DV+COEFF*(COS(THETA)*DTHETA*EN+FTHETA*DEN) + END DO + BF=1D0-CW1*COSOM-CW2*COSWOM + DBF=CW1*DOM*SINOM+CW2*DWOM*SINWOM + B=D2R*V*BF + DB=D2R*(DV*BF+V*DBF)/CJ + +* Parallax + V=0D0 + DV=0D0 + DO N=NP,1,-1 + COEFF=TP(N) + EMN=DBLE(ITP(1,N)) + EMPN=DBLE(ITP(2,N)) + DN=DBLE(ITP(3,N)) + FN=DBLE(ITP(4,N)) + I=ITP(5,N) + IF (I.EQ.0) THEN + EN=1D0 + DEN=0D0 + ELSE IF (I.EQ.1) THEN + EN=E + DEN=DE + ELSE + EN=ESQ + DEN=DESQ + END IF + THETA=EMN*EM+EMPN*EMP+DN*D+FN*F + DTHETA=EMN*DEM+EMPN*DEMP+DN*DD+FN*DF + FTHETA=COS(THETA) + V=V+COEFF*FTHETA*EN + DV=DV+COEFF*(-SIN(THETA)*DTHETA*EN+FTHETA*DEN) + END DO + P=D2R*V + DP=D2R*DV/CJ + +* +* Transformation into final form +* + +* Parallax to distance (AU, AU/sec) + SP=SIN(P) + R=ERADAU/SP + DR=-R*DP*COS(P)/SP + +* Longitude, latitude to x,y,z (AU) + SEL=SIN(EL) + CEL=COS(EL) + SB=SIN(B) + CB=COS(B) + RCB=R*CB + RBD=R*DB + W=RBD*SB-CB*DR + X=RCB*CEL + Y=RCB*SEL + Z=R*SB + XD=-Y*DEL-W*CEL + YD=X*DEL-W*SEL + ZD=RBD*CB+SB*DR + +* Julian centuries since J2000 + T=(DATE-51544.5D0)/36525D0 + +* Fricke equinox correction + EPJ=2000D0+T*100D0 + EQCOR=DS2R*(0.035D0+0.00085D0*(EPJ-B1950)) + +* Mean obliquity (IAU 1976) + EPS=DAS2R*(84381.448D0+(-46.8150D0+(-0.00059D0+0.001813D0*T)*T)*T) + +* To the equatorial system, mean of date, FK5 system + SINEPS=SIN(EPS) + COSEPS=COS(EPS) + ES=EQCOR*SINEPS + EC=EQCOR*COSEPS + PV(1)=X-EC*Y+ES*Z + PV(2)=EQCOR*X+Y*COSEPS-Z*SINEPS + PV(3)=Y*SINEPS+Z*COSEPS + PV(4)=XD-EC*YD+ES*ZD + PV(5)=EQCOR*XD+YD*COSEPS-ZD*SINEPS + PV(6)=YD*SINEPS+ZD*COSEPS + + END diff --git a/math/slalib/dmxm.f b/math/slalib/dmxm.f new file mode 100644 index 00000000..0d319eef --- /dev/null +++ b/math/slalib/dmxm.f @@ -0,0 +1,73 @@ + SUBROUTINE slDMXM (A, B, C) +*+ +* - - - - - +* D M X M +* - - - - - +* +* Product of two 3x3 matrices: +* +* matrix C = matrix A x matrix B +* +* (double precision) +* +* Given: +* A dp(3,3) matrix +* B dp(3,3) matrix +* +* Returned: +* C dp(3,3) matrix result +* +* To comply with the ANSI Fortran 77 standard, A, B and C must +* be different arrays. However, the routine is coded so as to +* work properly on many platforms even if this rule is violated. +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION A(3,3),B(3,3),C(3,3) + + INTEGER I,J,K + DOUBLE PRECISION W,WM(3,3) + + +* Multiply into scratch matrix + DO I=1,3 + DO J=1,3 + W=0D0 + DO K=1,3 + W=W+A(I,K)*B(K,J) + END DO + WM(I,J)=W + END DO + END DO + +* Return the result + DO J=1,3 + DO I=1,3 + C(I,J)=WM(I,J) + END DO + END DO + + END diff --git a/math/slalib/dmxv.f b/math/slalib/dmxv.f new file mode 100644 index 00000000..28b8102d --- /dev/null +++ b/math/slalib/dmxv.f @@ -0,0 +1,69 @@ + SUBROUTINE slDMXV (DM, VA, VB) +*+ +* - - - - - +* D M X V +* - - - - - +* +* Performs the 3-D forward unitary transformation: +* +* vector VB = matrix DM * vector VA +* +* (double precision) +* +* Given: +* DM dp(3,3) matrix +* VA dp(3) vector +* +* Returned: +* VB dp(3) result vector +* +* To comply with the ANSI Fortran 77 standard, VA and VB must be +* different arrays. However, the routine is coded so as to work +* properly on many platforms even if this rule is violated. +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DM(3,3),VA(3),VB(3) + + INTEGER I,J + DOUBLE PRECISION W,VW(3) + + +* Matrix DM * vector VA -> vector VW + DO J=1,3 + W=0D0 + DO I=1,3 + W=W+DM(J,I)*VA(I) + END DO + VW(J)=W + END DO + +* Vector VW -> vector VB + DO J=1,3 + VB(J)=VW(J) + END DO + + END diff --git a/math/slalib/doc/addet.hlp b/math/slalib/doc/addet.hlp new file mode 100644 index 00000000..464dd86a --- /dev/null +++ b/math/slalib/doc/addet.hlp @@ -0,0 +1,42 @@ +.help addet Jun99 "Slalib Package" +.nf + + SUBROUTINE slADET (RM, DM, EQ, RC, DC) + + - - - - - - + A D E T + - - - - - - + + Add the E-terms (elliptic component of annual aberration) + to a pre IAU 1976 mean place to conform to the old + catalogue convention (double precision) + + Given: + RM,DM dp RA,Dec (radians) without E-terms + EQ dp Besselian epoch of mean equator and equinox + + Returned: + RC,DC dp RA,Dec (radians) with E-terms included + + Note: + + Most star positions from pre-1984 optical catalogues (or + derived from astrometry using such stars) embody the + E-terms. If it is necessary to convert a formal mean + place (for example a pulsar timing position) to one + consistent with such a star catalogue, then the RA,Dec + should be adjusted using this routine. + + Reference: + Explanatory Supplement to the Astronomical Ephemeris, + section 2D, page 48. + + Called: slETRM, slDS2C, slDC2S, slDA2P, slDA1P + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/afin.hlp b/math/slalib/doc/afin.hlp new file mode 100644 index 00000000..f3c5a22c --- /dev/null +++ b/math/slalib/doc/afin.hlp @@ -0,0 +1,91 @@ +.help afin Jun99 "Slalib Package" +.nf + + SUBROUTINE slAFIN (STRING, IPTR, A, J) + + - - - - - + A F I N + - - - - - + + Sexagesimal character string to angle (single precision) + + Given: + STRING c*(*) string containing deg, arcmin, arcsec fields + IPTR i pointer to start of decode (1st = 1) + + Returned: + IPTR i advanced past the decoded angle + A r angle in radians + J i status: 0 = OK + +1 = default, A unchanged + -1 = bad degrees ) + -2 = bad arcminutes ) (note 3) + -3 = bad arcseconds ) + + Example: + + argument before after + + STRING '-57 17 44.806 12 34 56.7' unchanged + IPTR 1 16 (points to 12...) + A ? -1.00000 + J ? 0 + + A further call to slAFIN, without adjustment of IPTR, will + decode the second angle, 12deg 34min 56.7sec. + + Notes: + + 1) The first three "fields" in STRING are degrees, arcminutes, + arcseconds, separated by spaces or commas. The degrees field + may be signed, but not the others. The decoding is carried + out by the DFLTIN routine and is free-format. + + 2) Successive fields may be absent, defaulting to zero. For + zero status, the only combinations allowed are degrees alone, + degrees and arcminutes, and all three fields present. If all + three fields are omitted, a status of +1 is returned and A is + unchanged. In all other cases A is changed. + + 3) Range checking: + + The degrees field is not range checked. However, it is + expected to be integral unless the other two fields are + absent. + + The arcminutes field is expected to be 0-59, and integral if + the arcseconds field is present. If the arcseconds field + is absent, the arcminutes is expected to be 0-59.9999... + + The arcseconds field is expected to be 0-59.9999... + + 4) Decoding continues even when a check has failed. Under these + circumstances the field takes the supplied value, defaulting + to zero, and the result A is computed and returned. + + 5) Further fields after the three expected ones are not treated + as an error. The pointer IPTR is left in the correct state + for further decoding with the present routine or with DFLTIN + etc. See the example, above. + + 6) If STRING contains hours, minutes, seconds instead of degrees + etc, or if the required units are turns (or days) instead of + radians, the result A should be multiplied as follows: + + for to obtain multiply + STRING A in A by + + d ' " radians 1 = 1.0 + d ' " turns 1/2pi = 0.1591549430918953358 + h m s radians 15 = 15.0 + h m s days 15/2pi = 2.3873241463784300365 + + Called: slDAFN + + P.T.Wallace Starlink 13 September 1990 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/airmas.hlp b/math/slalib/doc/airmas.hlp new file mode 100644 index 00000000..c347bb50 --- /dev/null +++ b/math/slalib/doc/airmas.hlp @@ -0,0 +1,51 @@ +.help airmas Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slARMS (ZD) + + - - - - - - - + A R M S + - - - - - - - + + Air mass at given zenith distance (double precision) + + Given: + ZD d Observed zenith distance (radians) + + The result is an estimate of the air mass, in units of that + at the zenith. + + Notes: + + 1) The "observed" zenith distance referred to above means "as + affected by refraction". + + 2) Uses Hardie's (1962) polynomial fit to Bemporad's data for + the relative air mass, X, in units of thickness at the zenith + as tabulated by Schoenberg (1929). This is adequate for all + normal needs as it is accurate to better than 0.1% up to X = + 6.8 and better than 1% up to X = 10. Bemporad's tabulated + values are unlikely to be trustworthy to such accuracy + because of variations in density, pressure and other + conditions in the atmosphere from those assumed in his work. + + 3) The sign of the ZD is ignored. + + 4) At zenith distances greater than about ZD = 87 degrees the + air mass is held constant to avoid arithmetic overflows. + + References: + Hardie, R.H., 1962, in "Astronomical Techniques" + ed. W.A. Hiltner, University of Chicago Press, p180. + Schoenberg, E., 1929, Hdb. d. Ap., + Berlin, Julius Springer, 2, 268. + + Original code by P.W.Hill, St Andrews + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/altaz.hlp b/math/slalib/doc/altaz.hlp new file mode 100644 index 00000000..0f701093 --- /dev/null +++ b/math/slalib/doc/altaz.hlp @@ -0,0 +1,79 @@ +.help altaz Jun99 "Slalib Package" +.nf + + SUBROUTINE slALAZ (HA, DEC, PHI, + : AZ, AZD, AZDD, EL, ELD, ELDD, PA, PAD, PADD) + + - - - - - - + A L A Z + - - - - - - + + Positions, velocities and accelerations for an altazimuth + telescope mount. + + (double precision) + + Given: + HA d hour angle + DEC d declination + PHI d observatory latitude + + Returned: + AZ d azimuth + AZD d " velocity + AZDD d " acceleration + EL d elevation + ELD d " velocity + ELDD d " acceleration + PA d parallactic angle + PAD d " " velocity + PADD d " " acceleration + + Notes: + + 1) Natural units are used throughout. HA, DEC, PHI, AZ, EL + and ZD are in radians. The velocities and accelerations + assume constant declination and constant rate of change of + hour angle (as for tracking a star); the units of AZD, ELD + and PAD are radians per radian of HA, while the units of AZDD, + ELDD and PADD are radians per radian of HA squared. To + convert into practical degree- and second-based units: + + angles * 360/2pi -> degrees + velocities * (2pi/86400)*(360/2pi) -> degree/sec + accelerations * ((2pi/86400)**2)*(360/2pi) -> degree/sec/sec + + Note that the seconds here are sidereal rather than SI. One + sidereal second is about 0.99727 SI seconds. + + The velocity and acceleration factors assume the sidereal + tracking case. Their respective numerical values are (exactly) + 1/240 and (approximately) 1/3300236.9. + + 2) Azimuth is returned in the range 0-2pi; north is zero, + and east is +pi/2. Elevation and parallactic angle are + returned in the range +/-pi/2. Position angle is +ve + for a star west of the meridian and is the angle NP-star-zenith. + + 3) The latitude is geodetic as opposed to geocentric. The + hour angle and declination are topocentric. Refraction and + deficiencies in the telescope mounting are ignored. The + purpose of the routine is to give the general form of the + quantities. The details of a real telescope could profoundly + change the results, especially close to the zenith. + + 4) No range checking of arguments is carried out. + + 5) In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and (for tracking a star) + sine and cosine of declination. + + P.T.Wallace Starlink 14 March 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/amp.hlp b/math/slalib/doc/amp.hlp new file mode 100644 index 00000000..f5d4dfc4 --- /dev/null +++ b/math/slalib/doc/amp.hlp @@ -0,0 +1,61 @@ +.help amp Jun99 "Slalib Package" +.nf + + SUBROUTINE slAMP (RA, DA, DATE, EQ, RM, DM) + + - - - - + A M P + - - - - + + Convert star RA,Dec from geocentric apparent to mean place + + The mean coordinate system is the post IAU 1976 system, + loosely called FK5. + + Given: + RA d apparent RA (radians) + DA d apparent Dec (radians) + DATE d TDB for apparent place (JD-2400000.5) + EQ d equinox: Julian epoch of mean place + + Returned: + RM d mean RA (radians) + DM d mean Dec (radians) + + References: + 1984 Astronomical Almanac, pp B39-B41. + (also Lederle & Schwan, Astron. Astrophys. 134, + 1-6, 1984) + + Notes: + + 1) The distinction between the required TDB and TT is + always negligible. Moreover, for all but the most + critical applications UTC is adequate. + + 2) The accuracy is limited by the routine slEVP, called + by slMAPA, which computes the Earth position and + velocity using the methods of Stumpff. The maximum + error is about 0.3 milliarcsecond. + + 3) Iterative techniques are used for the aberration and + light deflection corrections so that the routines + slAMP (or slAMPQ) and slMAP (or slMAPQ) are + accurate inverses; even at the edge of the Sun's disc + the discrepancy is only about 1 nanoarcsecond. + + 4) Where multiple apparent places are to be converted to + mean places, for a fixed date and equinox, it is more + efficient to use the slMAPA routine to compute the + required parameters once, followed by one call to + slAMPQ per star. + + Called: slMAPA, slAMPQ + + P.T.Wallace Starlink 19 January 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ampqk.hlp b/math/slalib/doc/ampqk.hlp new file mode 100644 index 00000000..a4b8dee6 --- /dev/null +++ b/math/slalib/doc/ampqk.hlp @@ -0,0 +1,65 @@ +.help ampqk Jun99 "Slalib Package" +.nf + + SUBROUTINE slAMPQ (RA, DA, AMPRMS, RM, DM) + + - - - - - - + A M P Q + - - - - - - + + Convert star RA,Dec from geocentric apparent to mean place + + The mean coordinate system is the post IAU 1976 system, + loosely called FK5. + + Use of this routine is appropriate when efficiency is important + and where many star positions are all to be transformed for + one epoch and equinox. The star-independent parameters can be + obtained by calling the slMAPA routine. + + Given: + RA d apparent RA (radians) + DA d apparent Dec (radians) + + AMPRMS d(21) star-independent mean-to-apparent parameters: + + (1) time interval for proper motion (Julian years) + (2-4) barycentric position of the Earth (AU) + (5-7) heliocentric direction of the Earth (unit vector) + (8) (grav rad Sun)*2/(Sun-Earth distance) + (9-11) ABV: barycentric Earth velocity in units of c + (12) sqrt(1-v**2) where v=modulus(ABV) + (13-21) precession/nutation (3,3) matrix + + Returned: + RM d mean RA (radians) + DM d mean Dec (radians) + + References: + 1984 Astronomical Almanac, pp B39-B41. + (also Lederle & Schwan, Astron. Astrophys. 134, + 1-6, 1984) + + Notes: + + 1) The accuracy is limited by the routine slEVP, called + by slMAPA, which computes the Earth position and + velocity using the methods of Stumpff. The maximum + error is about 0.3 milliarcsecond. + + 2) Iterative techniques are used for the aberration and + light deflection corrections so that the routines + slAMP (or slAMPQ) and slMAP (or slMAPQ) are + accurate inverses; even at the edge of the Sun's disc + the discrepancy is only about 1 nanoarcsecond. + + Called: slDS2C, slDIMV, slDVDV, slDVN, slDC2S, + slDA2P + + P.T.Wallace Starlink 21 June 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/aop.hlp b/math/slalib/doc/aop.hlp new file mode 100644 index 00000000..dc3343bf --- /dev/null +++ b/math/slalib/doc/aop.hlp @@ -0,0 +1,166 @@ +.help aop Jun99 "Slalib Package" +.nf + + SUBROUTINE slAOP (RAP, DAP, DATE, DUT, ELONGM, PHIM, HM, + : XP, YP, TDK, PMB, RH, WL, TLR, + : AOB, ZOB, HOB, DOB, ROB) + + - - - - + A O P + - - - - + + Apparent to observed place, for optical sources distant from + the solar system. + + Given: + RAP d geocentric apparent right ascension + DAP d geocentric apparent declination + DATE d UTC date/time (Modified Julian Date, JD-2400000.5) + DUT d delta UT: UT1-UTC (UTC seconds) + ELONGM d mean longitude of the observer (radians, east +ve) + PHIM d mean geodetic latitude of the observer (radians) + HM d observer's height above sea level (metres) + XP d polar motion x-coordinate (radians) + YP d polar motion y-coordinate (radians) + TDK d local ambient temperature (DegK; std=273.155D0) + PMB d local atmospheric pressure (mB; std=1013.25D0) + RH d local relative humidity (in the range 0D0-1D0) + WL d effective wavelength (micron, e.g. 0.55D0) + TLR d tropospheric lapse rate (DegK/metre, e.g. 0.0065D0) + + Returned: + AOB d observed azimuth (radians: N=0,E=90) + ZOB d observed zenith distance (radians) + HOB d observed Hour Angle (radians) + DOB d observed Declination (radians) + ROB d observed Right Ascension (radians) + + Notes: + + 1) This routine returns zenith distance rather than elevation + in order to reflect the fact that no allowance is made for + depression of the horizon. + + 2) The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted apparent RA,Dec should be within about 0.1 arcsec + for a zenith distance of less than 70 degrees. Even at a + topocentric zenith distance of 90 degrees, the accuracy in + elevation should be better than 1 arcmin; useful results + are available for a further 3 degrees, beyond which the + slRFRO routine returns a fixed value of the refraction. + The complementary routines slAOP (or slAOPQ) and slOAP + (or slOAPQ) are self-consistent to better than 1 micro- + arcsecond all over the celestial sphere. + + 3) It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + + 4) "Apparent" place means the geocentric apparent right ascension + and declination, which is obtained from a catalogue mean place + by allowing for space motion, parallax, precession, nutation, + annual aberration, and the Sun's gravitational lens effect. For + star positions in the FK5 system (i.e. J2000), these effects can + be applied by means of the slMAP etc routines. Starting from + other mean place systems, additional transformations will be + needed; for example, FK4 (i.e. B1950) mean places would first + have to be converted to FK5, which can be done with the + slFK45 etc routines. + + 5) "Observed" Az,El means the position that would be seen by a + perfect theodolite located at the observer. This is obtained + from the geocentric apparent RA,Dec by allowing for Earth + orientation and diurnal aberration, rotating from equator + to horizon coordinates, and then adjusting for refraction. + The HA,Dec is obtained by rotating back into equatorial + coordinates, using the geodetic latitude corrected for polar + motion, and is the position that would be seen by a perfect + equatorial located at the observer and with its polar axis + aligned to the Earth's axis of rotation (n.b. not to the + refracted pole). Finally, the RA is obtained by subtracting + the HA from the local apparent ST. + + 6) To predict the required setting of a real telescope, the + observed place produced by this routine would have to be + adjusted for the tilt of the azimuth or polar axis of the + mounting (with appropriate corrections for mount flexures), + for non-perpendicularity between the mounting axes, for the + position of the rotator axis and the pointing axis relative + to it, for tube flexure, for gear and encoder errors, and + finally for encoder zero points. Some telescopes would, of + course, exhibit other properties which would need to be + accounted for at the appropriate point in the sequence. + + 7) This routine takes time to execute, due mainly to the + rigorous integration used to evaluate the refraction. + For processing multiple stars for one location and time, + call slAOPA once followed by one call per star to slAOPQ. + Where a range of times within a limited period of a few hours + is involved, and the highest precision is not required, call + slAOPA once, followed by a call to slAOPT each time the + time changes, followed by one call per star to slAOPQ. + + 8) The DATE argument is UTC expressed as an MJD. This is, + strictly speaking, wrong, because of leap seconds. However, + as long as the delta UT and the UTC are consistent there + are no difficulties, except during a leap second. In this + case, the start of the 61st second of the final minute should + begin a new MJD day and the old pre-leap delta UT should + continue to be used. As the 61st second completes, the MJD + should revert to the start of the day as, simultaneously, + the delta UTC changes by one second to its post-leap new value. + + 9) The delta UT (UT1-UTC) is tabulated in IERS circulars and + elsewhere. It increases by exactly one second at the end of + each UTC leap second, introduced in order to keep delta UT + within +/- 0.9 seconds. + + 10) IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. + The longitude required by the present routine is east-positive, + in accordance with geographical convention (and right-handed). + In particular, note that the longitudes returned by the + slOBS routine are west-positive, following astronomical + usage, and must be reversed in sign before use in the present + routine. + + 11) The polar coordinates XP,YP can be obtained from IERS + circulars and equivalent publications. The maximum amplitude + is about 0.3 arcseconds. If XP,YP values are unavailable, + use XP=YP=0D0. See page B60 of the 1988 Astronomical Almanac + for a definition of the two angles. + + 12) The height above sea level of the observing station, HM, + can be obtained from the Astronomical Almanac (Section J + in the 1988 edition), or via the routine slOBS. If P, + the pressure in millibars, is available, an adequate + estimate of HM can be obtained from the expression + + HM ~ -29.3D0*TSL*LOG(P/1013.25D0). + + where TSL is the approximate sea-level air temperature in + deg K (see Astrophysical Quantities, C.W.Allen, 3rd edition, + section 52.) Similarly, if the pressure P is not known, + it can be estimated from the height of the observing + station, HM as follows: + + P ~ 1013.25D0*EXP(-HM/(29.3D0*TSL)). + + Note, however, that the refraction is proportional to the + pressure and that an accurate P value is important for + precise work. + + 13) The azimuths etc produced by the present routine are with + respect to the celestial pole. Corrections to the terrestrial + pole can be computed using slPLMO. + + Called: slAOPA, slAOPQ + + P.T.Wallace Starlink 9 June 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/aoppa.hlp b/math/slalib/doc/aoppa.hlp new file mode 100644 index 00000000..f96d835b --- /dev/null +++ b/math/slalib/doc/aoppa.hlp @@ -0,0 +1,114 @@ +.help aoppa Jun99 "Slalib Package" +.nf + + SUBROUTINE slAOPA (DATE, DUT, ELONGM, PHIM, HM, + : XP, YP, TDK, PMB, RH, WL, TLR, AOPRMS) + + - - - - - - + A O P A + - - - - - - + + Precompute apparent to observed place parameters required by + slAOPQ and slOAPQ. + + Given: + DATE d UTC date/time (modified Julian Date, JD-2400000.5) + DUT d delta UT: UT1-UTC (UTC seconds) + ELONGM d mean longitude of the observer (radians, east +ve) + PHIM d mean geodetic latitude of the observer (radians) + HM d observer's height above sea level (metres) + XP d polar motion x-coordinate (radians) + YP d polar motion y-coordinate (radians) + TDK d local ambient temperature (DegK; std=273.155D0) + PMB d local atmospheric pressure (mB; std=1013.25D0) + RH d local relative humidity (in the range 0D0-1D0) + WL d effective wavelength (micron, e.g. 0.55D0) + TLR d tropospheric lapse rate (DegK/metre, e.g. 0.0065D0) + + Returned: + AOPRMS d(14) star-independent apparent-to-observed parameters: + + (1) geodetic latitude (radians) + (2,3) sine and cosine of geodetic latitude + (4) magnitude of diurnal aberration vector + (5) height (HM) + (6) ambient temperature (TDK) + (7) pressure (PMB) + (8) relative humidity (RH) + (9) wavelength (WL) + (10) lapse rate (TLR) + (11,12) refraction constants A and B (radians) + (13) longitude + eqn of equinoxes + sidereal DUT (radians) + (14) local apparent sidereal time (radians) + + Notes: + + 1) It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + + 2) The DATE argument is UTC expressed as an MJD. This is, + strictly speaking, improper, because of leap seconds. However, + as long as the delta UT and the UTC are consistent there + are no difficulties, except during a leap second. In this + case, the start of the 61st second of the final minute should + begin a new MJD day and the old pre-leap delta UT should + continue to be used. As the 61st second completes, the MJD + should revert to the start of the day as, simultaneously, + the delta UTC changes by one second to its post-leap new value. + + 3) The delta UT (UT1-UTC) is tabulated in IERS circulars and + elsewhere. It increases by exactly one second at the end of + each UTC leap second, introduced in order to keep delta UT + within +/- 0.9 seconds. + + 4) IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. + The longitude required by the present routine is east-positive, + in accordance with geographical convention (and right-handed). + In particular, note that the longitudes returned by the + slOBS routine are west-positive, following astronomical + usage, and must be reversed in sign before use in the present + routine. + + 5) The polar coordinates XP,YP can be obtained from IERS + circulars and equivalent publications. The maximum amplitude + is about 0.3 arcseconds. If XP,YP values are unavailable, + use XP=YP=0D0. See page B60 of the 1988 Astronomical Almanac + for a definition of the two angles. + + 6) The height above sea level of the observing station, HM, + can be obtained from the Astronomical Almanac (Section J + in the 1988 edition), or via the routine slOBS. If P, + the pressure in millibars, is available, an adequate + estimate of HM can be obtained from the expression + + HM ~ -29.3D0*TSL*LOG(P/1013.25D0). + + where TSL is the approximate sea-level air temperature in + deg K (see Astrophysical Quantities, C.W.Allen, 3rd edition, + section 52.) Similarly, if the pressure P is not known, + it can be estimated from the height of the observing + station, HM as follows: + + P ~ 1013.25D0*EXP(-HM/(29.3D0*TSL)). + + Note, however, that the refraction is proportional to the + pressure and that an accurate P value is important for + precise work. + + 7) Repeated, computationally-expensive, calls to slAOPA for + times that are very close together can be avoided by calling + slAOPA just once and then using slAOPT for the subsequent + times. Fresh calls to slAOPA will be needed only when changes + in the precession have grown to unacceptable levels or when + anything affecting the refraction has changed. + + Called: slGEOC, slRFCO, slEQEX, slAOPT + + P.T.Wallace Starlink 9 June 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/aoppat.hlp b/math/slalib/doc/aoppat.hlp new file mode 100644 index 00000000..c5d6f9c8 --- /dev/null +++ b/math/slalib/doc/aoppat.hlp @@ -0,0 +1,39 @@ +.help aoppat Jun99 "Slalib Package" +.nf + + SUBROUTINE slAOPT (DATE, AOPRMS) + + - - - - - - - + A O P T + - - - - - - - + + Recompute the sidereal time in the apparent to observed place + star-independent parameter block. + + Given: + DATE d UTC date/time (modified Julian Date, JD-2400000.5) + (see AOPPA source for comments on leap seconds) + + AOPRMS d(14) star-independent apparent-to-observed parameters + + (1-12) not required + (13) longitude + eqn of equinoxes + sidereal DUT + (14) not required + + Returned: + AOPRMS d(14) star-independent apparent-to-observed parameters: + + (1-13) not changed + (14) local apparent sidereal time (radians) + + For more information, see slAOPA. + + Called: slGMST + + P.T.Wallace Starlink 1 July 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/aopqk.hlp b/math/slalib/doc/aopqk.hlp new file mode 100644 index 00000000..aa916a5d --- /dev/null +++ b/math/slalib/doc/aopqk.hlp @@ -0,0 +1,131 @@ +.help aopqk Jun99 "Slalib Package" +.nf + + SUBROUTINE slAOPQ (RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB) + + - - - - - - + A O P Q + - - - - - - + + Quick apparent to observed place (but see note 8, below, for + remarks about speed). + + Given: + RAP d geocentric apparent right ascension + DAP d geocentric apparent declination + AOPRMS d(14) star-independent apparent-to-observed parameters: + + (1) geodetic latitude (radians) + (2,3) sine and cosine of geodetic latitude + (4) magnitude of diurnal aberration vector + (5) height (HM) + (6) ambient temperature (T) + (7) pressure (P) + (8) relative humidity (RH) + (9) wavelength (WL) + (10) lapse rate (TLR) + (11,12) refraction constants A and B (radians) + (13) longitude + eqn of equinoxes + sidereal DUT (radians) + (14) local apparent sidereal time (radians) + + Returned: + AOB d observed azimuth (radians: N=0,E=90) + ZOB d observed zenith distance (radians) + HOB d observed Hour Angle (radians) + DOB d observed Declination (radians) + ROB d observed Right Ascension (radians) + + Notes: + + 1) This routine returns zenith distance rather than elevation + in order to reflect the fact that no allowance is made for + depression of the horizon. + + 2) The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + observed RA,Dec predicted by this routine should be within + about 0.1 arcsec for a zenith distance of less than 70 degrees. + Even at a topocentric zenith distance of 90 degrees, the + accuracy in elevation should be better than 1 arcmin; useful + results are available for a further 3 degrees, beyond which + the slaRefro routine returns a fixed value of the refraction. + The complementary routines slaAop (or slaAopqk) and slaOap + (or slaOapqk) are self-consistent to better than 1 micro- + arcsecond all over the celestial sphere. + + 3) It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + + 4) "Apparent" place means the geocentric apparent right ascension + and declination, which is obtained from a catalogue mean place + by allowing for space motion, parallax, precession, nutation, + annual aberration, and the Sun's gravitational lens effect. For + star positions in the FK5 system (i.e. J2000), these effects can + be applied by means of the slMAP etc routines. Starting from + other mean place systems, additional transformations will be + needed; for example, FK4 (i.e. B1950) mean places would first + have to be converted to FK5, which can be done with the + slFK45 etc routines. + + 5) "Observed" Az,El means the position that would be seen by a + perfect theodolite located at the observer. This is obtained + from the geocentric apparent RA,Dec by allowing for Earth + orientation and diurnal aberration, rotating from equator + to horizon coordinates, and then adjusting for refraction. + The HA,Dec is obtained by rotating back into equatorial + coordinates, using the geodetic latitude corrected for polar + motion, and is the position that would be seen by a perfect + equatorial located at the observer and with its polar axis + aligned to the Earth's axis of rotation (n.b. not to the + refracted pole). Finally, the RA is obtained by subtracting + the HA from the local apparent ST. + + 6) To predict the required setting of a real telescope, the + observed place produced by this routine would have to be + adjusted for the tilt of the azimuth or polar axis of the + mounting (with appropriate corrections for mount flexures), + for non-perpendicularity between the mounting axes, for the + position of the rotator axis and the pointing axis relative + to it, for tube flexure, for gear and encoder errors, and + finally for encoder zero points. Some telescopes would, of + course, exhibit other properties which would need to be + accounted for at the appropriate point in the sequence. + + 7) The star-independent apparent-to-observed-place parameters + in AOPRMS may be computed by means of the slAOPA routine. + If nothing has changed significantly except the time, the + slAOPT routine may be used to perform the requisite + partial recomputation of AOPRMS. + + 8) At zenith distances beyond about 76 degrees, the need for + special care with the corrections for refraction causes a + marked increase in execution time. Moreover, the effect + gets worse with increasing zenith distance. Adroit + programming in the calling application may allow the + problem to be reduced. Prepare an alternative AOPRMS array, + computed for zero air-pressure; this will disable the + refraction corrections and cause rapid execution. Using + this AOPRMS array, a preliminary call to the present routine + will, depending on the application, produce a rough position + which may be enough to establish whether the full, slow + calculation (using the real AOPRMS array) is worthwhile. + For example, there would be no need for the full calculation + if the preliminary call had already established that the + source was well below the elevation limits for a particular + telescope. + + 9) The azimuths etc produced by the present routine are with + respect to the celestial pole. Corrections to the terrestrial + pole can be computed using slPLMO. + + Called: slDS2C, slREFZ, slRFRO, slDC2S, slDA2P + + P.T.Wallace Starlink 22 February 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/atmdsp.hlp b/math/slalib/doc/atmdsp.hlp new file mode 100644 index 00000000..eaa2b411 --- /dev/null +++ b/math/slalib/doc/atmdsp.hlp @@ -0,0 +1,75 @@ +.help atmdsp Jun99 "Slalib Package" +.nf + + SUBROUTINE slATMD (TDK, PMB, RH, WL1, A1, B1, WL2, A2, B2) + + - - - - - - - + A T M D + - - - - - - - + + Apply atmospheric-dispersion adjustments to refraction coefficients. + + Given: + TDK d ambient temperature, degrees K + PMB d ambient pressure, millibars + RH d ambient relative humidity, 0-1 + WL1 d reference wavelength, micrometre (0.4D0 recommended) + A1 d refraction coefficient A for wavelength WL1 (radians) + B1 d refraction coefficient B for wavelength WL1 (radians) + WL2 d wavelength for which adjusted A,B required + + Returned: + A2 d refraction coefficient A for wavelength WL2 (radians) + B2 d refraction coefficient B for wavelength WL2 (radians) + + Notes: + + 1 To use this routine, first call slRFCO specifying WL1 as the + wavelength. This yields refraction coefficients A1,B1, correct + for that wavelength. Subsequently, calls to slATMD specifying + different wavelengths will produce new, slightly adjusted + refraction coefficients which apply to the specified wavelength. + + 2 Most of the atmospheric dispersion happens between 0.7 micrometre + and the UV atmospheric cutoff, and the effect increases strongly + towards the UV end. For this reason a blue reference wavelength + is recommended, for example 0.4 micrometres. + + 3 The accuracy, for this set of conditions: + + height above sea level 2000 m + latitude 29 deg + pressure 793 mB + temperature 17 degC + humidity 50% + lapse rate 0.0065 degC/m + reference wavelength 0.4 micrometre + star elevation 15 deg + + is about 2.5 mas RMS between 0.3 and 1.0 micrometres, and stays + within 4 mas for the whole range longward of 0.3 micrometres + (compared with a total dispersion from 0.3 to 20.0 micrometres + of about 11 arcsec). These errors are typical for ordinary + conditions and the given elevation; in extreme conditions values + a few times this size may occur, while at higher elevations the + errors become much smaller. + + 4 If either wavelength exceeds 100 micrometres, the radio case + is assumed and the returned refraction coefficients are the + same as the given ones. + + 5 The algorithm consists of calculation of the refractivity of the + air at the observer for the two wavelengths, using the methods + of the slRFRO routine, and then scaling of the two refraction + coefficients according to classical refraction theory. This + amounts to scaling the A coefficient in proportion to (n-1) and + the B coefficient almost in the same ratio (see R.M.Green, + "Spherical Astronomy", Cambridge University Press, 1985). + + P.T.Wallace Starlink 6 October 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/av2m.hlp b/math/slalib/doc/av2m.hlp new file mode 100644 index 00000000..0a98df84 --- /dev/null +++ b/math/slalib/doc/av2m.hlp @@ -0,0 +1,37 @@ +.help av2m Jun99 "Slalib Package" +.nf + + SUBROUTINE slAV2M (AXVEC, RMAT) + + - - - - - + A V 2 M + - - - - - + + Form the rotation matrix corresponding to a given axial vector. + + (single precision) + + A rotation matrix describes a rotation about some arbitrary axis. + The axis is called the Euler axis, and the angle through which the + reference frame rotates is called the Euler angle. The axial + vector supplied to this routine has the same direction as the + Euler axis, and its magnitude is the Euler angle in radians. + + Given: + AXVEC r(3) axial vector (radians) + + Returned: + RMAT r(3,3) rotation matrix + + If AXVEC is null, the unit matrix is returned. + + The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + + P.T.Wallace Starlink June 1989 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/bear.hlp b/math/slalib/doc/bear.hlp new file mode 100644 index 00000000..97e4f13d --- /dev/null +++ b/math/slalib/doc/bear.hlp @@ -0,0 +1,30 @@ +.help bear Jun99 "Slalib Package" +.nf + + REAL FUNCTION slBEAR (A1, B1, A2, B2) + + - - - - - + B E A R + - - - - - + + Bearing (position angle) of one point on a sphere relative to another + (single precision) + + Given: + A1,B1 r spherical coordinates of one point + A2,B2 r spherical coordinates of the other point + + (The spherical coordinates are RA,Dec, Long,Lat etc, in radians.) + + The result is the bearing (position angle), in radians, of point + A2,B2 as seen from point A1,B1. It is in the range +/- pi. If + A2,B2 is due east of A1,B1 the bearing is +pi/2. Zero is returned + if the two points are coincident. + + P.T.Wallace Starlink 23 March 1991 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/caf2r.hlp b/math/slalib/doc/caf2r.hlp new file mode 100644 index 00000000..7533ff94 --- /dev/null +++ b/math/slalib/doc/caf2r.hlp @@ -0,0 +1,38 @@ +.help caf2r Jun99 "Slalib Package" +.nf + + SUBROUTINE slCAFR (IDEG, IAMIN, ASEC, RAD, J) + + - - - - - - + C A F R + - - - - - - + + Convert degrees, arcminutes, arcseconds to radians + (single precision) + + Given: + IDEG int degrees + IAMIN int arcminutes + ASEC real arcseconds + + Returned: + RAD real angle in radians + J int status: 0 = OK + 1 = IDEG outside range 0-359 + 2 = IAMIN outside range 0-59 + 3 = ASEC outside range 0-59.999... + + Notes: + + 1) The result is computed even if any of the range checks + fail. + + 2) The sign must be dealt with outside this routine. + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/caldj.hlp b/math/slalib/doc/caldj.hlp new file mode 100644 index 00000000..1504c667 --- /dev/null +++ b/math/slalib/doc/caldj.hlp @@ -0,0 +1,38 @@ +.help caldj Jun99 "Slalib Package" +.nf + + SUBROUTINE slCADJ (IY, IM, ID, DJM, J) + + - - - - - - + C A D J + - - - - - - + + Gregorian Calendar to Modified Julian Date + + (Includes century default feature: use slCLDJ for years + before 100AD.) + + Given: + IY,IM,ID int year, month, day in Gregorian calendar + + Returned: + DJM dp modified Julian Date (JD-2400000.5) for 0 hrs + J int status: + 0 = OK + 1 = bad year (MJD not computed) + 2 = bad month (MJD not computed) + 3 = bad day (MJD computed) + + Acceptable years are 00-49, interpreted as 2000-2049, + 50-99, " " 1950-1999, + 100 upwards, interpreted literally. + + Called: slCLDJ + + P.T.Wallace Starlink November 1985 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/calyd.hlp b/math/slalib/doc/calyd.hlp new file mode 100644 index 00000000..7011cc41 --- /dev/null +++ b/math/slalib/doc/calyd.hlp @@ -0,0 +1,49 @@ +.help calyd Jun99 "Slalib Package" +.nf + + SUBROUTINE slCAYD (IY, IM, ID, NY, ND, J) + + - - - - - - + C A Y D + - - - - - - + + Gregorian calendar date to year and day in year (in a Julian + calendar aligned to the 20th/21st century Gregorian calendar). + + (Includes century default feature: use slCLYD for years + before 100AD.) + + Given: + IY,IM,ID int year, month, day in Gregorian calendar + (year may optionally omit the century) + Returned: + NY int year (re-aligned Julian calendar) + ND int day in year (1 = January 1st) + J int status: + 0 = OK + 1 = bad year (before -4711) + 2 = bad month + 3 = bad day (but conversion performed) + + Notes: + + 1 This routine exists to support the low-precision routines + slERTH, slMOON and slECOR. + + 2 Between 1900 March 1 and 2100 February 28 it returns answers + which are consistent with the ordinary Gregorian calendar. + Outside this range there will be a discrepancy which increases + by one day for every non-leap century year. + + 3 Years in the range 50-99 are interpreted as 1950-1999, and + years in the range 00-49 are interpreted as 2000-2049. + + Called: slCLYD + + P.T.Wallace Starlink 23 November 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/cc2s.hlp b/math/slalib/doc/cc2s.hlp new file mode 100644 index 00000000..8a16e76e --- /dev/null +++ b/math/slalib/doc/cc2s.hlp @@ -0,0 +1,33 @@ +.help cc2s Jun99 "Slalib Package" +.nf + + SUBROUTINE slCC2S (V, A, B) + + - - - - - + C C 2 S + - - - - - + + Direction cosines to spherical coordinates (single precision) + + Given: + V r(3) x,y,z vector + + Returned: + A,B r spherical coordinates in radians + + The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the x axis + at zero longitude and latitude, and the z axis at the + +ve latitude pole. + + If V is null, zero A and B are returned. + At either pole, zero A is returned. + + P.T.Wallace Starlink July 1989 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/cc62s.hlp b/math/slalib/doc/cc62s.hlp new file mode 100644 index 00000000..ffd20cb8 --- /dev/null +++ b/math/slalib/doc/cc62s.hlp @@ -0,0 +1,30 @@ +.help cc62s Jun99 "Slalib Package" +.nf + + SUBROUTINE slC62S (V, A, B, R, AD, BD, RD) + + - - - - - - + C 6 2 S + - - - - - - + + Conversion of position & velocity in Cartesian coordinates + to spherical coordinates (single precision) + + Given: + V r(6) Cartesian position & velocity vector + + Returned: + A r longitude (radians) + B r latitude (radians) + R r radial coordinate + AD r longitude derivative (radians per unit time) + BD r latitude derivative (radians per unit time) + RD r radial derivative + + P.T.Wallace Starlink 28 April 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/cd2tf.hlp b/math/slalib/doc/cd2tf.hlp new file mode 100644 index 00000000..52e66f62 --- /dev/null +++ b/math/slalib/doc/cd2tf.hlp @@ -0,0 +1,47 @@ +.help cd2tf Jun99 "Slalib Package" +.nf + + SUBROUTINE slCDTF (NDP, DAYS, SIGN, IHMSF) + + - - - - - - + C D T F + - - - - - - + + Convert an interval in days into hours, minutes, seconds + + (single precision) + + Given: + NDP int number of decimal places of seconds + DAYS real interval in days + + Returned: + SIGN char '+' or '-' + IHMSF int(4) hours, minutes, seconds, fraction + + Notes: + + 1) NDP less than zero is interpreted as zero. + + 2) The largest useful value for NDP is determined by the size of + DAYS, the format of REAL floating-point numbers on the target + machine, and the risk of overflowing IHMSF(4). For example, + on the VAX, for DAYS up to 1.0, the available floating-point + precision corresponds roughly to NDP=3. This is well below + the ultimate limit of NDP=9 set by the capacity of the 32-bit + integer IHMSF(4). + + 3) The absolute value of DAYS may exceed 1.0. In cases where it + does not, it is up to the caller to test for and handle the + case where DAYS is very nearly 1.0 and rounds up to 24 hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. + + Called: slDDTF + + P.T.Wallace Starlink 12 December 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/cldj.hlp b/math/slalib/doc/cldj.hlp new file mode 100644 index 00000000..3f65adb1 --- /dev/null +++ b/math/slalib/doc/cldj.hlp @@ -0,0 +1,34 @@ +.help cldj Jun99 "Slalib Package" +.nf + + SUBROUTINE slCLDJ (IY, IM, ID, DJM, J) + + - - - - - + C L D J + - - - - - + + Gregorian Calendar to Modified Julian Date + + Given: + IY,IM,ID int year, month, day in Gregorian calendar + + Returned: + DJM dp modified Julian Date (JD-2400000.5) for 0 hrs + J int status: + 0 = OK + 1 = bad year (MJD not computed) + 2 = bad month (MJD not computed) + 3 = bad day (MJD computed) + + The year must be -4699 (i.e. 4700BC) or later. + + The algorithm is derived from that of Hatcher 1984 + (QJRAS 25, 53-55). + + P.T.Wallace Starlink 11 March 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/clyd.hlp b/math/slalib/doc/clyd.hlp new file mode 100644 index 00000000..7afbe1aa --- /dev/null +++ b/math/slalib/doc/clyd.hlp @@ -0,0 +1,50 @@ +.help clyd Jun99 "Slalib Package" +.nf + + SUBROUTINE slCLYD (IY, IM, ID, NY, ND, JSTAT) + + - - - - - + C L Y D + - - - - - + + Gregorian calendar to year and day in year (in a Julian calendar + aligned to the 20th/21st century Gregorian calendar). + + Given: + IY,IM,ID i year, month, day in Gregorian calendar + + Returned: + NY i year (re-aligned Julian calendar) + ND i day in year (1 = January 1st) + JSTAT i status: + 0 = OK + 1 = bad year (before -4711) + 2 = bad month + 3 = bad day (but conversion performed) + + Notes: + + 1 This routine exists to support the low-precision routines + slERTH, slMOON and slECOR. + + 2 Between 1900 March 1 and 2100 February 28 it returns answers + which are consistent with the ordinary Gregorian calendar. + Outside this range there will be a discrepancy which increases + by one day for every non-leap century year. + + 3 The essence of the algorithm is first to express the Gregorian + date as a Julian Day Number and then to convert this back to + a Julian calendar date, with day-in-year instead of month and + day. See 12.92-1 and 12.95-1 in the reference. + + Reference: Explanatory Supplement to the Astronomical Almanac, + ed P.K.Seidelmann, University Science Books (1992), + p604-606. + + P.T.Wallace Starlink 26 November 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/cr2af.hlp b/math/slalib/doc/cr2af.hlp new file mode 100644 index 00000000..2a1863ca --- /dev/null +++ b/math/slalib/doc/cr2af.hlp @@ -0,0 +1,46 @@ +.help cr2af Jun99 "Slalib Package" +.nf + + SUBROUTINE slCRAF (NDP, ANGLE, SIGN, IDMSF) + + - - - - - - + C R A F + - - - - - - + + Convert an angle in radians into degrees, arcminutes, arcseconds + (single precision) + + Given: + NDP int number of decimal places of arcseconds + ANGLE real angle in radians + + Returned: + SIGN char '+' or '-' + IDMSF int(4) degrees, arcminutes, arcseconds, fraction + + Notes: + + 1) NDP less than zero is interpreted as zero. + + 2) The largest useful value for NDP is determined by the size of + ANGLE, the format of REAL floating-point numbers on the target + machine, and the risk of overflowing IDMSF(4). For example, + on the VAX, for ANGLE up to 2pi, the available floating-point + precision corresponds roughly to NDP=3. This is well below + the ultimate limit of NDP=9 set by the capacity of the 32-bit + integer IHMSF(4). + + 3) The absolute value of ANGLE may exceed 2pi. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly 2pi and rounds up to 360 deg, + by testing for IDMSF(1)=360 and setting IDMSF(1-4) to zero. + + Called: slCDTF + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/cr2tf.hlp b/math/slalib/doc/cr2tf.hlp new file mode 100644 index 00000000..719db50e --- /dev/null +++ b/math/slalib/doc/cr2tf.hlp @@ -0,0 +1,46 @@ +.help cr2tf Jun99 "Slalib Package" +.nf + + SUBROUTINE slCRTF (NDP, ANGLE, SIGN, IHMSF) + + - - - - - - + C R T F + - - - - - - + + Convert an angle in radians into hours, minutes, seconds + (single precision) + + Given: + NDP int number of decimal places of seconds + ANGLE real angle in radians + + Returned: + SIGN char '+' or '-' + IHMSF int(4) hours, minutes, seconds, fraction + + Notes: + + 1) NDP less than zero is interpreted as zero. + + 2) The largest useful value for NDP is determined by the size of + ANGLE, the format of REAL floating-point numbers on the target + machine, and the risk of overflowing IHMSF(4). For example, + on the VAX, for ANGLE up to 2pi, the available floating-point + precision corresponds roughly to NDP=3. This is well below + the ultimate limit of NDP=9 set by the capacity of the 32-bit + integer IHMSF(4). + + 3) The absolute value of ANGLE may exceed 2pi. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly 2pi and rounds up to 24 hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. + + Called: slCDTF + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/cs2c.hlp b/math/slalib/doc/cs2c.hlp new file mode 100644 index 00000000..df71c82c --- /dev/null +++ b/math/slalib/doc/cs2c.hlp @@ -0,0 +1,31 @@ +.help cs2c Jun99 "Slalib Package" +.nf + + SUBROUTINE slCS2C (A, B, V) + + - - - - - + C S 2 C + - - - - - + + Spherical coordinates to direction cosines (single precision) + + Given: + A,B real spherical coordinates in radians + (RA,Dec), (Long,Lat) etc + + Returned: + V real(3) x,y,z unit vector + + The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the x axis + at zero longitude and latitude, and the z axis at the + +ve latitude pole. + + P.T.Wallace Starlink October 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/cs2c6.hlp b/math/slalib/doc/cs2c6.hlp new file mode 100644 index 00000000..0b69377d --- /dev/null +++ b/math/slalib/doc/cs2c6.hlp @@ -0,0 +1,30 @@ +.help cs2c6 Jun99 "Slalib Package" +.nf + + SUBROUTINE slS2C6 (A, B, R, AD, BD, RD, V) + + - - - - - - + S 2 C 6 + - - - - - - + + Conversion of position & velocity in spherical coordinates + to Cartesian coordinates (single precision) + + Given: + A r longitude (radians) + B r latitude (radians) + R r radial coordinate + AD r longitude derivative (radians per unit time) + BD r latitude derivative (radians per unit time) + RD r radial derivative + + Returned: + V r(6) Cartesian position & velocity vector + + P.T.Wallace Starlink November 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ctf2d.hlp b/math/slalib/doc/ctf2d.hlp new file mode 100644 index 00000000..e8c985c3 --- /dev/null +++ b/math/slalib/doc/ctf2d.hlp @@ -0,0 +1,37 @@ +.help ctf2d Jun99 "Slalib Package" +.nf + + SUBROUTINE slCTFD (IHOUR, IMIN, SEC, DAYS, J) + + - - - - - - + C T F D + - - - - - - + + Convert hours, minutes, seconds to days (single precision) + + Given: + IHOUR int hours + IMIN int minutes + SEC real seconds + + Returned: + DAYS real interval in days + J int status: 0 = OK + 1 = IHOUR outside range 0-23 + 2 = IMIN outside range 0-59 + 3 = SEC outside range 0-59.999... + + Notes: + + 1) The result is computed even if any of the range checks + fail. + + 2) The sign must be dealt with outside this routine. + + P.T.Wallace Starlink November 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ctf2r.hlp b/math/slalib/doc/ctf2r.hlp new file mode 100644 index 00000000..72a1fb56 --- /dev/null +++ b/math/slalib/doc/ctf2r.hlp @@ -0,0 +1,40 @@ +.help ctf2r Jun99 "Slalib Package" +.nf + + SUBROUTINE slCTFR (IHOUR, IMIN, SEC, RAD, J) + + - - - - - - + C T F R + - - - - - - + + Convert hours, minutes, seconds to radians (single precision) + + Given: + IHOUR int hours + IMIN int minutes + SEC real seconds + + Returned: + RAD real angle in radians + J int status: 0 = OK + 1 = IHOUR outside range 0-23 + 2 = IMIN outside range 0-59 + 3 = SEC outside range 0-59.999... + + Called: + slCTFD + + Notes: + + 1) The result is computed even if any of the range checks + fail. + + 2) The sign must be dealt with outside this routine. + + P.T.Wallace Starlink November 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/daf2r.hlp b/math/slalib/doc/daf2r.hlp new file mode 100644 index 00000000..f0cf7434 --- /dev/null +++ b/math/slalib/doc/daf2r.hlp @@ -0,0 +1,36 @@ +.help daf2r Jun99 "Slalib Package" +.nf + + SUBROUTINE slDAFR (IDEG, IAMIN, ASEC, RAD, J) + + - - - - - - + D A F R + - - - - - - + + Convert degrees, arcminutes, arcseconds to radians + (double precision) + + Given: + IDEG int degrees + IAMIN int arcminutes + ASEC dp arcseconds + + Returned: + RAD dp angle in radians + J int status: 0 = OK + 1 = IDEG outside range 0-359 + 2 = IAMIN outside range 0-59 + 3 = ASEC outside range 0-59.999... + + Notes: + 1) The result is computed even if any of the range checks + fail. + 2) The sign must be dealt with outside this routine. + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dafin.hlp b/math/slalib/doc/dafin.hlp new file mode 100644 index 00000000..2fa24d5c --- /dev/null +++ b/math/slalib/doc/dafin.hlp @@ -0,0 +1,90 @@ +.help dafin Jun99 "Slalib Package" +.nf + + SUBROUTINE slDAFN (STRING, IPTR, A, J) + + - - - - - - + D A F N + - - - - - - + + Sexagesimal character string to angle (double precision) + + Given: + STRING c*(*) string containing deg, arcmin, arcsec fields + IPTR i pointer to start of decode (1st = 1) + + Returned: + IPTR i advanced past the decoded angle + A d angle in radians + J i status: 0 = OK + +1 = default, A unchanged + -1 = bad degrees ) + -2 = bad arcminutes ) (note 3) + -3 = bad arcseconds ) + + Example: + + argument before after + + STRING '-57 17 44.806 12 34 56.7' unchanged + IPTR 1 16 (points to 12...) + A ? -1.00000D0 + J ? 0 + + A further call to slDAFN, without adjustment of IPTR, will + decode the second angle, 12deg 34min 56.7sec. + + Notes: + + 1) The first three "fields" in STRING are degrees, arcminutes, + arcseconds, separated by spaces or commas. The degrees field + may be signed, but not the others. The decoding is carried + out by the DFLTIN routine and is free-format. + + 2) Successive fields may be absent, defaulting to zero. For + zero status, the only combinations allowed are degrees alone, + degrees and arcminutes, and all three fields present. If all + three fields are omitted, a status of +1 is returned and A is + unchanged. In all other cases A is changed. + + 3) Range checking: + + The degrees field is not range checked. However, it is + expected to be integral unless the other two fields are absent. + + The arcminutes field is expected to be 0-59, and integral if + the arcseconds field is present. If the arcseconds field + is absent, the arcminutes is expected to be 0-59.9999... + + The arcseconds field is expected to be 0-59.9999... + + 4) Decoding continues even when a check has failed. Under these + circumstances the field takes the supplied value, defaulting + to zero, and the result A is computed and returned. + + 5) Further fields after the three expected ones are not treated + as an error. The pointer IPTR is left in the correct state + for further decoding with the present routine or with DFLTIN + etc. See the example, above. + + 6) If STRING contains hours, minutes, seconds instead of degrees + etc, or if the required units are turns (or days) instead of + radians, the result A should be multiplied as follows: + + for to obtain multiply + STRING A in A by + + d ' " radians 1 = 1D0 + d ' " turns 1/2pi = 0.1591549430918953358D0 + h m s radians 15 = 15D0 + h m s days 15/2pi = 2.3873241463784300365D0 + + Called: slDFLI + + P.T.Wallace Starlink 1 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dat.hlp b/math/slalib/doc/dat.hlp new file mode 100644 index 00000000..20777dc5 --- /dev/null +++ b/math/slalib/doc/dat.hlp @@ -0,0 +1,55 @@ +.help dat Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slDAT (UTC) + + - - - - + D A T + - - - - + + Increment to be applied to Coordinated Universal Time UTC to give + International Atomic Time TAI (double precision) + + Given: + UTC d UTC date as a modified JD (JD-2400000.5) + + Result: TAI-UTC in seconds + + Notes: + + 1 The UTC is specified to be a date rather than a time to indicate + that care needs to be taken not to specify an instant which lies + within a leap second. Though in most cases UTC can include the + fractional part, correct behaviour on the day of a leap second + can only be guaranteed up to the end of the second 23:59:59. + + 2 For epochs from 1961 January 1 onwards, the expressions from the + file ftp://maia.usno.navy.mil/ser7/tai-utc.dat are used. + + 3 The 5ms timestep at 1961 January 1 is taken from 2.58.1 (p87) of + the 1992 Explanatory Supplement. + + 4 UTC began at 1960 January 1.0 (JD 2436934.5) and it is improper + to call the routine with an earlier epoch. However, if this + is attempted, the TAI-UTC expression for the year 1960 is used. + + + :-----------------------------------------: + : : + : IMPORTANT : + : : + : This routine must be updated on each : + : occasion that a leap second is : + : announced : + : : + : Latest leap second: 1999 January 1 : + : : + :-----------------------------------------: + + P.T.Wallace Starlink 31 May 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dav2m.hlp b/math/slalib/doc/dav2m.hlp new file mode 100644 index 00000000..26d5fae6 --- /dev/null +++ b/math/slalib/doc/dav2m.hlp @@ -0,0 +1,36 @@ +.help dav2m Jun99 "Slalib Package" +.nf + + SUBROUTINE slDAVM (AXVEC, RMAT) + + - - - - - - + D A V M + - - - - - - + + Form the rotation matrix corresponding to a given axial vector. + (double precision) + + A rotation matrix describes a rotation about some arbitrary axis. + The axis is called the Euler axis, and the angle through which the + reference frame rotates is called the Euler angle. The axial + vector supplied to this routine has the same direction as the + Euler axis, and its magnitude is the Euler angle in radians. + + Given: + AXVEC d(3) axial vector (radians) + + Returned: + RMAT d(3,3) rotation matrix + + If AXVEC is null, the unit matrix is returned. + + The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + + P.T.Wallace Starlink June 1989 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dbear.hlp b/math/slalib/doc/dbear.hlp new file mode 100644 index 00000000..8d796e61 --- /dev/null +++ b/math/slalib/doc/dbear.hlp @@ -0,0 +1,30 @@ +.help dbear Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slDBER (A1, B1, A2, B2) + + - - - - - - + D B E R + - - - - - - + + Bearing (position angle) of one point on a sphere relative to another + (double precision) + + Given: + A1,B1 d spherical coordinates of one point + A2,B2 d spherical coordinates of the other point + + (The spherical coordinates are RA,Dec, Long,Lat etc, in radians.) + + The result is the bearing (position angle), in radians, of point + A2,B2 as seen from point A1,B1. It is in the range +/- pi. If + A2,B2 is due east of A1,B1 the bearing is +pi/2. Zero is returned + if the two points are coincident. + + P.T.Wallace Starlink 23 March 1991 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dbjin.hlp b/math/slalib/doc/dbjin.hlp new file mode 100644 index 00000000..017333dd --- /dev/null +++ b/math/slalib/doc/dbjin.hlp @@ -0,0 +1,52 @@ +.help dbjin Jun99 "Slalib Package" +.nf + + SUBROUTINE slDBJI (STRING, NSTRT, DRESLT, J1, J2) + + - - - - - - + D B J I + - - - - - - + + Convert free-format input into double precision floating point, + using DFLTIN but with special syntax extensions. + + The purpose of the syntax extensions is to help cope with mixed + FK4 and FK5 data. In addition to the syntax accepted by DFLTIN, + the following two extensions are recognized by DBJIN: + + 1) A valid non-null field preceded by the character 'B' + (or 'b') is accepted. + + 2) A valid non-null field preceded by the character 'J' + (or 'j') is accepted. + + The calling program is notified of the incidence of either of these + extensions through an supplementary status argument. The rest of + the arguments are as for DFLTIN. + + Given: + STRING char string containing field to be decoded + NSTRT int pointer to 1st character of field in string + + Returned: + NSTRT int incremented + DRESLT double result + J1 int DFLTIN status: -1 = -OK + 0 = +OK + +1 = null field + +2 = error + J2 int syntax flag: 0 = normal DFLTIN syntax + +1 = 'B' or 'b' + +2 = 'J' or 'j' + + Called: slDFLI + + For details of the basic syntax, see slDFLI. + + P.T.Wallace Starlink 23 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dc62s.hlp b/math/slalib/doc/dc62s.hlp new file mode 100644 index 00000000..0294205b --- /dev/null +++ b/math/slalib/doc/dc62s.hlp @@ -0,0 +1,30 @@ +.help dc62s Jun99 "Slalib Package" +.nf + + SUBROUTINE slDC6S (V, A, B, R, AD, BD, RD) + + - - - - - - + D C 6 S + - - - - - - + + Conversion of position & velocity in Cartesian coordinates + to spherical coordinates (double precision) + + Given: + V d(6) Cartesian position & velocity vector + + Returned: + A d longitude (radians) + B d latitude (radians) + R d radial coordinate + AD d longitude derivative (radians per unit time) + BD d latitude derivative (radians per unit time) + RD d radial derivative + + P.T.Wallace Starlink 28 April 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dcc2s.hlp b/math/slalib/doc/dcc2s.hlp new file mode 100644 index 00000000..ace02cf7 --- /dev/null +++ b/math/slalib/doc/dcc2s.hlp @@ -0,0 +1,33 @@ +.help dcc2s Jun99 "Slalib Package" +.nf + + SUBROUTINE slDC2S (V, A, B) + + - - - - - - + D C 2 S + - - - - - - + + Direction cosines to spherical coordinates (double precision) + + Given: + V d(3) x,y,z vector + + Returned: + A,B d spherical coordinates in radians + + The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the x axis + at zero longitude and latitude, and the z axis at the + +ve latitude pole. + + If V is null, zero A and B are returned. + At either pole, zero A is returned. + + P.T.Wallace Starlink July 1989 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dcmpf.hlp b/math/slalib/doc/dcmpf.hlp new file mode 100644 index 00000000..914addfd --- /dev/null +++ b/math/slalib/doc/dcmpf.hlp @@ -0,0 +1,70 @@ +.help dcmpf Jun99 "Slalib Package" +.nf + + SUBROUTINE slDCMF (COEFFS,XZ,YZ,XS,YS,PERP,ORIENT) + + - - - - - - + D C M F + - - - - - - + + Decompose an [X,Y] linear fit into its constituent parameters: + zero points, scales, nonperpendicularity and orientation. + + Given: + COEFFS d(6) transformation coefficients (see note) + + Returned: + XZ d x zero point + YZ d y zero point + XS d x scale + YS d y scale + PERP d nonperpendicularity (radians) + ORIENT d orientation (radians) + + The model relates two sets of [X,Y] coordinates as follows. + Naming the elements of COEFFS: + + COEFFS(1) = A + COEFFS(2) = B + COEFFS(3) = C + COEFFS(4) = D + COEFFS(5) = E + COEFFS(6) = F + + the model transforms coordinates [X1,Y1] into coordinates + [X2,Y2] as follows: + + X2 = A + B*X1 + C*Y1 + Y2 = D + E*X1 + F*Y1 + + The transformation can be decomposed into four steps: + + 1) Zero points: + + x' = XZ + X1 + y' = YZ + Y1 + + 2) Scales: + + x'' = XS*x' + y'' = YS*y' + + 3) Nonperpendicularity: + + x''' = cos(PERP/2)*x'' + sin(PERP/2)*y'' + y''' = sin(PERP/2)*x'' + cos(PERP/2)*y'' + + 4) Orientation: + + X2 = cos(ORIENT)*x''' + sin(ORIENT)*y''' + Y2 =-sin(ORIENT)*y''' + cos(ORIENT)*y''' + + See also slFTXY, slPXY, slINVF, slXYXY + + P.T.Wallace Starlink 14 August 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dcs2c.hlp b/math/slalib/doc/dcs2c.hlp new file mode 100644 index 00000000..50010ea4 --- /dev/null +++ b/math/slalib/doc/dcs2c.hlp @@ -0,0 +1,31 @@ +.help dcs2c Jun99 "Slalib Package" +.nf + + SUBROUTINE slDS2C (A, B, V) + + - - - - - - + D S 2 C + - - - - - - + + Spherical coordinates to direction cosines (double precision) + + Given: + A,B dp spherical coordinates in radians + (RA,Dec), (Long,Lat) etc + + Returned: + V dp(3) x,y,z unit vector + + The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the x axis + at zero longitude and latitude, and the z axis at the + +ve latitude pole. + + P.T.Wallace Starlink October 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dd2tf.hlp b/math/slalib/doc/dd2tf.hlp new file mode 100644 index 00000000..124a7fcc --- /dev/null +++ b/math/slalib/doc/dd2tf.hlp @@ -0,0 +1,44 @@ +.help dd2tf Jun99 "Slalib Package" +.nf + + SUBROUTINE slDDTF (NDP, DAYS, SIGN, IHMSF) + + - - - - - - + D D T F + - - - - - - + + Convert an interval in days into hours, minutes, seconds + (double precision) + + Given: + NDP i number of decimal places of seconds + DAYS d interval in days + + Returned: + SIGN c '+' or '-' + IHMSF i(4) hours, minutes, seconds, fraction + + Notes: + + 1) NDP less than zero is interpreted as zero. + + 2) The largest useful value for NDP is determined by the size + of DAYS, the format of DOUBLE PRECISION floating-point numbers + on the target machine, and the risk of overflowing IHMSF(4). + For example, on the VAX, for DAYS up to 1D0, the available + floating-point precision corresponds roughly to NDP=12. + However, the practical limit is NDP=9, set by the capacity of + the 32-bit integer IHMSF(4). + + 3) The absolute value of DAYS may exceed 1D0. In cases where it + does not, it is up to the caller to test for and handle the + case where DAYS is very nearly 1D0 and rounds up to 24 hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. + + P.T.Wallace Starlink 19 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/de2h.hlp b/math/slalib/doc/de2h.hlp new file mode 100644 index 00000000..7e5bcb06 --- /dev/null +++ b/math/slalib/doc/de2h.hlp @@ -0,0 +1,59 @@ +.help de2h Jun99 "Slalib Package" +.nf + + SUBROUTINE slDE2H (HA, DEC, PHI, AZ, EL) + + - - - - - + D E 2 H + - - - - - + + Equatorial to horizon coordinates: HA,Dec to Az,El + + (double precision) + + Given: + HA d hour angle + DEC d declination + PHI d observatory latitude + + Returned: + AZ d azimuth + EL d elevation + + Notes: + + 1) All the arguments are angles in radians. + + 2) Azimuth is returned in the range 0-2pi; north is zero, + and east is +pi/2. Elevation is returned in the range + +/-pi/2. + + 3) The latitude must be geodetic. In critical applications, + corrections for polar motion should be applied. + + 4) In some applications it will be important to specify the + correct type of hour angle and declination in order to + produce the required type of azimuth and elevation. In + particular, it may be important to distinguish between + elevation as affected by refraction, which would + require the "observed" HA,Dec, and the elevation + in vacuo, which would require the "topocentric" HA,Dec. + If the effects of diurnal aberration can be neglected, the + "apparent" HA,Dec may be used instead of the topocentric + HA,Dec. + + 5) No range checking of arguments is carried out. + + 6) In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and (for tracking a star) + sine and cosine of declination. + + P.T.Wallace Starlink 9 July 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/deuler.hlp b/math/slalib/doc/deuler.hlp new file mode 100644 index 00000000..1dc55844 --- /dev/null +++ b/math/slalib/doc/deuler.hlp @@ -0,0 +1,50 @@ +.help deuler Jun99 "Slalib Package" +.nf + + SUBROUTINE slDEUL (ORDER, PHI, THETA, PSI, RMAT) + + - - - - - - - + D E U L + - - - - - - - + + Form a rotation matrix from the Euler angles - three successive + rotations about specified Cartesian axes (double precision) + + Given: + ORDER c*(*) specifies about which axes the rotations occur + PHI d 1st rotation (radians) + THETA d 2nd rotation ( " ) + PSI d 3rd rotation ( " ) + + Returned: + RMAT d(3,3) rotation matrix + + A rotation is positive when the reference frame rotates + anticlockwise as seen looking towards the origin from the + positive region of the specified axis. + + The characters of ORDER define which axes the three successive + rotations are about. A typical value is 'ZXZ', indicating that + RMAT is to become the direction cosine matrix corresponding to + rotations of the reference frame through PHI radians about the + old Z-axis, followed by THETA radians about the resulting X-axis, + then PSI radians about the resulting Z-axis. + + The axis names can be any of the following, in any order or + combination: X, Y, Z, uppercase or lowercase, 1, 2, 3. Normal + axis labeling/numbering conventions apply; the xyz (=123) + triad is right-handed. Thus, the 'ZXZ' example given above + could be written 'zxz' or '313' (or even 'ZxZ' or '3xZ'). ORDER + is terminated by length or by the first unrecognized character. + + Fewer than three rotations are acceptable, in which case the later + angle arguments are ignored. If all rotations are zero, the + identity matrix is produced. + + P.T.Wallace Starlink 23 May 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dfltin.hlp b/math/slalib/doc/dfltin.hlp new file mode 100644 index 00000000..be42311f --- /dev/null +++ b/math/slalib/doc/dfltin.hlp @@ -0,0 +1,118 @@ +.help dfltin Jun99 "Slalib Package" +.nf + + SUBROUTINE slDFLI (STRING, NSTRT, DRESLT, JFLAG) + + - - - - - - - + D F L I + - - - - - - - + + Convert free-format input into double precision floating point + + Given: + STRING c string containing number to be decoded + NSTRT i pointer to where decoding is to start + DRESLT d current value of result + + Returned: + NSTRT i advanced to next number + DRESLT d result + JFLAG i status: -1 = -OK, 0 = +OK, 1 = null, 2 = error + + Notes: + + 1 The reason DFLTIN has separate OK status values for + + and - is to enable minus zero to be detected. This is + of crucial importance when decoding mixed-radix numbers. + For example, an angle expressed as deg, arcmin, arcsec + may have a leading minus sign but a zero degrees field. + + 2 A TAB is interpreted as a space, and lowercase characters + are interpreted as uppercase. + + 3 The basic format is the sequence of fields #^.^@#^, where + # is a sign character + or -, ^ means a string of decimal + digits, and @, which indicates an exponent, means D or E. + Various combinations of these fields can be omitted, and + embedded blanks are permissible in certain places. + + 4 Spaces: + + . Leading spaces are ignored. + + . Embedded spaces are allowed only after +, -, D or E, + and after the decomal point if the first sequence of + digits is absent. + + . Trailing spaces are ignored; the first signifies + end of decoding and subsequent ones are skipped. + + 5 Delimiters: + + . Any character other than +,-,0-9,.,D,E or space may be + used to signal the end of the number and terminate + decoding. + + . Comma is recognized by DFLTIN as a special case; it + is skipped, leaving the pointer on the next character. + See 13, below. + + 6 Both signs are optional. The default is +. + + 7 The mantissa ^.^ defaults to 1. + + 8 The exponent @#^ defaults to D0. + + 9 The strings of decimal digits may be of any length. + + 10 The decimal point is optional for whole numbers. + + 11 A "null result" occurs when the string of characters being + decoded does not begin with +,-,0-9,.,D or E, or consists + entirely of spaces. When this condition is detected, JFLAG + is set to 1 and DRESLT is left untouched. + + 12 NSTRT = 1 for the first character in the string. + + 13 On return from DFLTIN, NSTRT is set ready for the next + decode - following trailing blanks and any comma. If a + delimiter other than comma is being used, NSTRT must be + incremented before the next call to DFLTIN, otherwise + all subsequent calls will return a null result. + + 14 Errors (JFLAG=2) occur when: + + . a +, -, D or E is left unsatisfied; or + + . the decimal point is present without at least + one decimal digit before or after it; or + + . an exponent more than 100 has been presented. + + 15 When an error has been detected, NSTRT is left + pointing to the character following the last + one used before the error came to light. This + may be after the point at which a more sophisticated + program could have detected the error. For example, + DFLTIN does not detect that '1D999' is unacceptable + (on a computer where this is so) until the entire number + has been decoded. + + 16 Certain highly unlikely combinations of mantissa & + exponent can cause arithmetic faults during the + decode, in some cases despite the fact that they + together could be construed as a valid number. + + 17 Decoding is left to right, one pass. + + 18 See also FLOTIN and INTIN + + Called: slICHF + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dh2e.hlp b/math/slalib/doc/dh2e.hlp new file mode 100644 index 00000000..965653c8 --- /dev/null +++ b/math/slalib/doc/dh2e.hlp @@ -0,0 +1,58 @@ +.help dh2e Jun99 "Slalib Package" +.nf + + SUBROUTINE slDH2E (AZ, EL, PHI, HA, DEC) + + - - - - - + D E 2 H + - - - - - + + Horizon to equatorial coordinates: Az,El to HA,Dec + + (double precision) + + Given: + AZ d azimuth + EL d elevation + PHI d observatory latitude + + Returned: + HA d hour angle + DEC d declination + + Notes: + + 1) All the arguments are angles in radians. + + 2) The sign convention for azimuth is north zero, east +pi/2. + + 3) HA is returned in the range +/-pi. Declination is returned + in the range +/-pi/2. + + 4) The latitude is (in principle) geodetic. In critical + applications, corrections for polar motion should be applied. + + 5) In some applications it will be important to specify the + correct type of elevation in order to produce the required + type of HA,Dec. In particular, it may be important to + distinguish between the elevation as affected by refraction, + which will yield the "observed" HA,Dec, and the elevation + in vacuo, which will yield the "topocentric" HA,Dec. If the + effects of diurnal aberration can be neglected, the + topocentric HA,Dec may be used as an approximation to the + "apparent" HA,Dec. + + 6) No range checking of arguments is done. + + 7) In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude. + + P.T.Wallace Starlink 21 February 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dimxv.hlp b/math/slalib/doc/dimxv.hlp new file mode 100644 index 00000000..805f124a --- /dev/null +++ b/math/slalib/doc/dimxv.hlp @@ -0,0 +1,32 @@ +.help dimxv Jun99 "Slalib Package" +.nf + + SUBROUTINE slDIMV (DM, VA, VB) + + - - - - - - + D I M V + - - - - - - + + Performs the 3-D backward unitary transformation: + + vector VB = (inverse of matrix DM) * vector VA + + (double precision) + + (n.b. the matrix must be unitary, as this routine assumes that + the inverse and transpose are identical) + + Given: + DM dp(3,3) matrix + VA dp(3) vector + + Returned: + VB dp(3) result vector + + P.T.Wallace Starlink March 1986 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/djcal.hlp b/math/slalib/doc/djcal.hlp new file mode 100644 index 00000000..d65c81bd --- /dev/null +++ b/math/slalib/doc/djcal.hlp @@ -0,0 +1,38 @@ +.help djcal Jun99 "Slalib Package" +.nf + + SUBROUTINE slDJCA (NDP, DJM, IYMDF, J) + + - - - - - - + D J C A + - - - - - - + + Modified Julian Date to Gregorian Calendar, expressed + in a form convenient for formatting messages (namely + rounded to a specified precision, and with the fields + stored in a single array) + + Given: + NDP i number of decimal places of days in fraction + DJM d modified Julian Date (JD-2400000.5) + + Returned: + IYMDF i(4) year, month, day, fraction in Gregorian + calendar + J i status: nonzero = out of range + + Any date after 4701BC March 1 is accepted. + + NDP should be 4 or less if internal overflows are to be avoided + on machines which use 32-bit integers. + + The algorithm is derived from that of Hatcher 1984 + (QJRAS 25, 53-55). + + P.T.Wallace Starlink 27 April 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/djcl.hlp b/math/slalib/doc/djcl.hlp new file mode 100644 index 00000000..a6327c1d --- /dev/null +++ b/math/slalib/doc/djcl.hlp @@ -0,0 +1,34 @@ +.help djcl Jun99 "Slalib Package" +.nf + + SUBROUTINE slDJCL (DJM, IY, IM, ID, FD, J) + + - - - - - + D J C L + - - - - - + + Modified Julian Date to Gregorian year, month, day, + and fraction of a day. + + Given: + DJM dp modified Julian Date (JD-2400000.5) + + Returned: + IY int year + IM int month + ID int day + FD dp fraction of day + J int status: + 0 = OK + -1 = unacceptable date (before 4701BC March 1) + + The algorithm is derived from that of Hatcher 1984 + (QJRAS 25, 53-55). + + P.T.Wallace Starlink 27 April 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dm2av.hlp b/math/slalib/doc/dm2av.hlp new file mode 100644 index 00000000..6448b842 --- /dev/null +++ b/math/slalib/doc/dm2av.hlp @@ -0,0 +1,38 @@ +.help dm2av Jun99 "Slalib Package" +.nf + + SUBROUTINE slDMAV (RMAT, AXVEC) + + - - - - - - + D M A V + - - - - - - + + From a rotation matrix, determine the corresponding axial vector. + (double precision) + + A rotation matrix describes a rotation about some arbitrary axis. + The axis is called the Euler axis, and the angle through which the + reference frame rotates is called the Euler angle. The axial + vector returned by this routine has the same direction as the + Euler axis, and its magnitude is the Euler angle in radians. (The + magnitude and direction can be separated by means of the routine + slDVN.) + + Given: + RMAT d(3,3) rotation matrix + + Returned: + AXVEC d(3) axial vector (radians) + + The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + + If RMAT is null, so is the result. + + P.T.Wallace Starlink 24 December 1992 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dmat.hlp b/math/slalib/doc/dmat.hlp new file mode 100644 index 00000000..7d496345 --- /dev/null +++ b/math/slalib/doc/dmat.hlp @@ -0,0 +1,58 @@ +.help dmat Jun99 "Slalib Package" +.nf + + SUBROUTINE slDMAT (N, A, Y, D, JF, IW) + + - - - - - + D M A T + - - - - - + + Matrix inversion & solution of simultaneous equations + (double precision) + + For the set of n simultaneous equations in n unknowns: + A.Y = X + + where: + A is a non-singular N x N matrix + Y is the vector of N unknowns + X is the known vector + + DMATRX computes: + the inverse of matrix A + the determinant of matrix A + the vector of N unknowns + + Arguments: + + symbol type dimension before after + + N i no. of unknowns unchanged + A d (N,N) matrix inverse + Y d (N) vector solution + D d - determinant + * JF i - singularity flag + IW i (N) - workspace + + * JF is the singularity flag. If the matrix is non-singular, + JF=0 is returned. If the matrix is singular, JF=-1 & D=0D0 are + returned. In the latter case, the contents of array A on return + are undefined. + + Algorithm: + Gaussian elimination with partial pivoting. + + Speed: + Very fast. + + Accuracy: + Fairly accurate - errors 1 to 4 times those of routines optimized + for accuracy. + + P.T.Wallace Starlink 7 February 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dmoon.hlp b/math/slalib/doc/dmoon.hlp new file mode 100644 index 00000000..5afe24ce --- /dev/null +++ b/math/slalib/doc/dmoon.hlp @@ -0,0 +1,58 @@ +.help dmoon Jun99 "Slalib Package" +.nf + + SUBROUTINE slDMON (DATE, PV) + + - - - - - - + D M O N + - - - - - - + + Approximate geocentric position and velocity of the Moon + (double precision) + + Given: + DATE D TDB (loosely ET) as a Modified Julian Date + (JD-2400000.5) + + Returned: + PV D(6) Moon x,y,z,xdot,ydot,zdot, mean equator and + equinox of date (AU, AU/s) + + Notes: + + 1 This routine is a full implementation of the algorithm + published by Meeus (see reference). + + 2 Meeus quotes accuracies of 10 arcsec in longitude, 3 arcsec in + latitude and 0.2 arcsec in HP (equivalent to about 20 km in + distance). Comparison with JPL DE200 over the interval + 1960-2025 gives RMS errors of 3.7 arcsec and 83 mas/hour in + longitude, 2.3 arcsec and 48 mas/hour in latitude, 11 km + and 81 mm/s in distance. The maximum errors over the same + interval are 18 arcsec and 0.50 arcsec/hour in longitude, + 11 arcsec and 0.24 arcsec/hour in latitude, 40 km and 0.29 m/s + in distance. + + 3 The original algorithm is expressed in terms of the obsolete + timescale Ephemeris Time. Either TDB or TT can be used, but + not UT without incurring significant errors (30 arcsec at + the present time) due to the Moon's 0.5 arcsec/sec movement. + + 4 The algorithm is based on pre IAU 1976 standards. However, + the result has been moved onto the new (FK5) equinox, an + adjustment which is in any case much smaller than the + intrinsic accuracy of the procedure. + + 5 Velocity is obtained by a complete analytical differentiation + of the Meeus model. + + Reference: + Meeus, l'Astronomie, June 1984, p348. + + P.T.Wallace Starlink 22 January 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dmxm.hlp b/math/slalib/doc/dmxm.hlp new file mode 100644 index 00000000..6eeea162 --- /dev/null +++ b/math/slalib/doc/dmxm.hlp @@ -0,0 +1,34 @@ +.help dmxm Jun99 "Slalib Package" +.nf + + SUBROUTINE slDMXM (A, B, C) + + - - - - - + D M X M + - - - - - + + Product of two 3x3 matrices: + + matrix C = matrix A x matrix B + + (double precision) + + Given: + A dp(3,3) matrix + B dp(3,3) matrix + + Returned: + C dp(3,3) matrix result + + To comply with the ANSI Fortran 77 standard, A, B and C must + be different arrays. However, the routine is coded so as to + work properly on the VAX and many other systems even if this + rule is violated. + + P.T.Wallace Starlink 5 April 1990 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dmxv.hlp b/math/slalib/doc/dmxv.hlp new file mode 100644 index 00000000..025fd396 --- /dev/null +++ b/math/slalib/doc/dmxv.hlp @@ -0,0 +1,29 @@ +.help dmxv Jun99 "Slalib Package" +.nf + + SUBROUTINE slDMXV (DM, VA, VB) + + - - - - - + D M X V + - - - - - + + Performs the 3-D forward unitary transformation: + + vector VB = matrix DM * vector VA + + (double precision) + + Given: + DM dp(3,3) matrix + VA dp(3) vector + + Returned: + VB dp(3) result vector + + P.T.Wallace Starlink March 1986 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dpav.hlp b/math/slalib/doc/dpav.hlp new file mode 100644 index 00000000..d0111a2d --- /dev/null +++ b/math/slalib/doc/dpav.hlp @@ -0,0 +1,38 @@ +.help dpav Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slDPAV ( V1, V2 ) + + - - - - - + D P A V + - - - - - + + Position angle of one celestial direction with respect to another. + + (double precision) + + Given: + V1 d(3) direction cosines of one point + V2 d(3) direction cosines of the other point + + (The coordinate frames correspond to RA,Dec, Long,Lat etc.) + + The result is the bearing (position angle), in radians, of point + V2 with respect to point V1. It is in the range +/- pi. The + sense is such that if V2 is a small distance east of V1, the + bearing is about +pi/2. Zero is returned if the two points + are coincident. + + V1 and V2 need not be unit vectors. + + The routine slDBER performs an equivalent function except + that the points are specified in the form of spherical + coordinates. + + Patrick Wallace Starlink 13 July 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dr2af.hlp b/math/slalib/doc/dr2af.hlp new file mode 100644 index 00000000..b12d75c0 --- /dev/null +++ b/math/slalib/doc/dr2af.hlp @@ -0,0 +1,46 @@ +.help dr2af Jun99 "Slalib Package" +.nf + + SUBROUTINE slDRAF (NDP, ANGLE, SIGN, IDMSF) + + - - - - - - + D R A F + - - - - - - + + Convert an angle in radians to degrees, arcminutes, arcseconds + (double precision) + + Given: + NDP i number of decimal places of arcseconds + ANGLE d angle in radians + + Returned: + SIGN c '+' or '-' + IDMSF i(4) degrees, arcminutes, arcseconds, fraction + + Notes: + + 1) NDP less than zero is interpreted as zero. + + 2) The largest useful value for NDP is determined by the size + of ANGLE, the format of DOUBLE PRECISION floating-point + numbers on the target machine, and the risk of overflowing + IDMSF(4). For example, on the VAX, for ANGLE up to 2pi, the + available floating-point precision corresponds roughly to + NDP=12. However, the practical limit is NDP=9, set by the + capacity of the 32-bit integer IDMSF(4). + + 3) The absolute value of ANGLE may exceed 2pi. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly 2pi and rounds up to 360 deg, + by testing for IDMSF(1)=360 and setting IDMSF(1-4) to zero. + + Called: slDDTF + + P.T.Wallace Starlink 19 March 1999 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dr2tf.hlp b/math/slalib/doc/dr2tf.hlp new file mode 100644 index 00000000..49decabc --- /dev/null +++ b/math/slalib/doc/dr2tf.hlp @@ -0,0 +1,46 @@ +.help dr2tf Jun99 "Slalib Package" +.nf + + SUBROUTINE slDRTF (NDP, ANGLE, SIGN, IHMSF) + + - - - - - - + D R T F + - - - - - - + + Convert an angle in radians to hours, minutes, seconds + (double precision) + + Given: + NDP i number of decimal places of seconds + ANGLE d angle in radians + + Returned: + SIGN c '+' or '-' + IHMSF i(4) hours, minutes, seconds, fraction + + Notes: + + 1) NDP less than zero is interpreted as zero. + + 2) The largest useful value for NDP is determined by the size + of ANGLE, the format of DOUBLE PRECISION floating-point + numbers on the target machine, and the risk of overflowing + IHMSF(4). For example, on the VAX, for ANGLE up to 2pi, the + available floating-point precision corresponds roughly to + NDP=12. However, the practical limit is NDP=9, set by the + capacity of the 32-bit integer IHMSF(4). + + 3) The absolute value of ANGLE may exceed 2pi. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly 2pi and rounds up to 24 hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. + + Called: slDDTF + + P.T.Wallace Starlink 19 March 1999 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/drange.hlp b/math/slalib/doc/drange.hlp new file mode 100644 index 00000000..025b6c08 --- /dev/null +++ b/math/slalib/doc/drange.hlp @@ -0,0 +1,23 @@ +.help drange Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slDA1P (ANGLE) + + - - - - - - - + D A 1 P + - - - - - - - + + Normalize angle into range +/- pi (double precision) + + Given: + ANGLE dp the angle in radians + + The result (double precision) is ANGLE expressed in the range +/- pi. + + P.T.Wallace Starlink 23 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dranrm.hlp b/math/slalib/doc/dranrm.hlp new file mode 100644 index 00000000..a479127e --- /dev/null +++ b/math/slalib/doc/dranrm.hlp @@ -0,0 +1,24 @@ +.help dranrm Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slDA2P (ANGLE) + + - - - - - - - + D A 2 P + - - - - - - - + + Normalize angle into range 0-2 pi (double precision) + + Given: + ANGLE dp the angle in radians + + The result is ANGLE expressed in the range 0-2 pi (double + precision). + + P.T.Wallace Starlink 23 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ds2c6.hlp b/math/slalib/doc/ds2c6.hlp new file mode 100644 index 00000000..23d3442e --- /dev/null +++ b/math/slalib/doc/ds2c6.hlp @@ -0,0 +1,32 @@ +.help ds2c6 Jun99 "Slalib Package" +.nf + + SUBROUTINE slDSC6 (A, B, R, AD, BD, RD, V) + + - - - - - - + D S C 6 + - - - - - - + + Conversion of position & velocity in spherical coordinates + to Cartesian coordinates + + (double precision) + + Given: + A dp longitude (radians) + B dp latitude (radians) + R dp radial coordinate + AD dp longitude derivative (radians per unit time) + BD dp latitude derivative (radians per unit time) + RD dp radial derivative + + Returned: + V dp(6) Cartesian position & velocity vector + + P.T.Wallace Starlink 10 July 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ds2tp.hlp b/math/slalib/doc/ds2tp.hlp new file mode 100644 index 00000000..ff772145 --- /dev/null +++ b/math/slalib/doc/ds2tp.hlp @@ -0,0 +1,30 @@ +.help ds2tp Jun99 "Slalib Package" +.nf + + SUBROUTINE slDSTP (RA, DEC, RAZ, DECZ, XI, ETA, J) + + - - - - - - + D S T P + - - - - - - + + Projection of spherical coordinates onto tangent plane: + "gnomonic" projection - "standard coordinates" (double precision) + + Given: + RA,DEC dp spherical coordinates of point to be projected + RAZ,DECZ dp spherical coordinates of tangent point + + Returned: + XI,ETA dp rectangular coordinates on tangent plane + J int status: 0 = OK, star on tangent plane + 1 = error, star too far from axis + 2 = error, antistar on tangent plane + 3 = error, antistar too far from axis + + P.T.Wallace Starlink 18 July 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dsep.hlp b/math/slalib/doc/dsep.hlp new file mode 100644 index 00000000..9b0f1117 --- /dev/null +++ b/math/slalib/doc/dsep.hlp @@ -0,0 +1,29 @@ +.help dsep Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slDSEP (A1, B1, A2, B2) + + - - - - - + D S E P + - - - - - + + Angle between two points on a sphere (double precision) + + Given: + A1,B1 dp spherical coordinates of one point + A2,B2 dp spherical coordinates of the other point + + (The spherical coordinates are RA,Dec, Long,Lat etc, in radians.) + + The result is the angle, in radians, between the two points. It + is always positive. + + Called: slDS2C + + P.T.Wallace Starlink April 1985 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dt.hlp b/math/slalib/doc/dt.hlp new file mode 100644 index 00000000..65ddca29 --- /dev/null +++ b/math/slalib/doc/dt.hlp @@ -0,0 +1,55 @@ +.help dt Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slDT (EPOCH) + + - - - + D T + - - - + + Estimate the offset between dynamical time and Universal Time + for a given historical epoch. + + Given: + EPOCH d (Julian) epoch (e.g. 1850D0) + + The result is a rough estimate of ET-UT (after 1984, TT-UT) at + the given epoch, in seconds. + + Notes: + + 1 Depending on the epoch, one of three parabolic approximations + is used: + + before 979 Stephenson & Morrison's 390 BC to AD 948 model + 979 to 1708 Stephenson & Morrison's 948 to 1600 model + after 1708 McCarthy & Babcock's post-1650 model + + The breakpoints are chosen to ensure continuity: they occur + at places where the adjacent models give the same answer as + each other. + + 2 The accuracy is modest, with errors of up to 20 sec during + the interval since 1650, rising to perhaps 30 min by 1000 BC. + Comparatively accurate values from AD 1600 are tabulated in + the Astronomical Almanac (see section K8 of the 1995 AA). + + 3 The use of double-precision for both argument and result is + purely for compatibility with other SLALIB time routines. + + 4 The models used are based on a lunar tidal acceleration value + of -26.00 arcsec per century. + + Reference: Explanatory Supplement to the Astronomical Almanac, + ed P.K.Seidelmann, University Science Books (1992), + section 2.553, p83. This contains references to + the Stephenson & Morrison and McCarthy & Babcock + papers. + + P.T.Wallace Starlink 1 March 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dtf2d.hlp b/math/slalib/doc/dtf2d.hlp new file mode 100644 index 00000000..eef108f4 --- /dev/null +++ b/math/slalib/doc/dtf2d.hlp @@ -0,0 +1,36 @@ +.help dtf2d Jun99 "Slalib Package" +.nf + + SUBROUTINE slDTFD (IHOUR, IMIN, SEC, DAYS, J) + + - - - - - - + D T F D + - - - - - - + + Convert hours, minutes, seconds to days (double precision) + + Given: + IHOUR int hours + IMIN int minutes + SEC dp seconds + + Returned: + DAYS dp interval in days + J int status: 0 = OK + 1 = IHOUR outside range 0-23 + 2 = IMIN outside range 0-59 + 3 = SEC outside range 0-59.999... + + Notes: + + 1) The result is computed even if any of the range checks fail. + + 2) The sign must be dealt with outside this routine. + + P.T.Wallace Starlink July 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dtf2r.hlp b/math/slalib/doc/dtf2r.hlp new file mode 100644 index 00000000..ff3fcfbe --- /dev/null +++ b/math/slalib/doc/dtf2r.hlp @@ -0,0 +1,39 @@ +.help dtf2r Jun99 "Slalib Package" +.nf + + SUBROUTINE slDTFR (IHOUR, IMIN, SEC, RAD, J) + + - - - - - - + D T F R + - - - - - - + + Convert hours, minutes, seconds to radians (double precision) + + Given: + IHOUR int hours + IMIN int minutes + SEC dp seconds + + Returned: + RAD dp angle in radians + J int status: 0 = OK + 1 = IHOUR outside range 0-23 + 2 = IMIN outside range 0-59 + 3 = SEC outside range 0-59.999... + + Called: + slDTFD + + Notes: + + 1) The result is computed even if any of the range checks fail. + + 2) The sign must be dealt with outside this routine. + + P.T.Wallace Starlink July 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dtp2s.hlp b/math/slalib/doc/dtp2s.hlp new file mode 100644 index 00000000..73010651 --- /dev/null +++ b/math/slalib/doc/dtp2s.hlp @@ -0,0 +1,28 @@ +.help dtp2s Jun99 "Slalib Package" +.nf + + SUBROUTINE slDTPS (XI, ETA, RAZ, DECZ, RA, DEC) + + - - - - - - + D T P S + - - - - - - + + Transform tangent plane coordinates into spherical + (double precision) + + Given: + XI,ETA dp tangent plane rectangular coordinates + RAZ,DECZ dp spherical coordinates of tangent point + + Returned: + RA,DEC dp spherical coordinates (0-2pi,+/-pi/2) + + Called: slDA2P + + P.T.Wallace Starlink 24 July 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dtp2v.hlp b/math/slalib/doc/dtp2v.hlp new file mode 100644 index 00000000..efd928ab --- /dev/null +++ b/math/slalib/doc/dtp2v.hlp @@ -0,0 +1,40 @@ +.help dtp2v Jun99 "Slalib Package" +.nf + + SUBROUTINE slDTPV (XI, ETA, V0, V) + + - - - - - - + D T P V + - - - - - - + + Given the tangent-plane coordinates of a star and the direction + cosines of the tangent point, determine the direction cosines + of the star. + + (double precision) + + Given: + XI,ETA d tangent plane coordinates of star + V0 d(3) direction cosines of tangent point + + Returned: + V d(3) direction cosines of star + + Notes: + + 1 If vector V0 is not of unit length, the returned vector V will + be wrong. + + 2 If vector V0 points at a pole, the returned vector V will be + based on the arbitrary assumption that the RA of the tangent + point is zero. + + 3 This routine is the Cartesian equivalent of the routine slDTPS. + + P.T.Wallace Starlink 11 February 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dtps2c.hlp b/math/slalib/doc/dtps2c.hlp new file mode 100644 index 00000000..f0207d86 --- /dev/null +++ b/math/slalib/doc/dtps2c.hlp @@ -0,0 +1,58 @@ +.help dtps2c Jun99 "Slalib Package" +.nf + + SUBROUTINE slDPSC (XI, ETA, RA, DEC, RAZ1, DECZ1, + : RAZ2, DECZ2, N) + + - - - - - - - + D P S C + - - - - - - - + + From the tangent plane coordinates of a star of known RA,Dec, + determine the RA,Dec of the tangent point. + + (double precision) + + Given: + XI,ETA d tangent plane rectangular coordinates + RA,DEC d spherical coordinates + + Returned: + RAZ1,DECZ1 d spherical coordinates of tangent point, solution 1 + RAZ2,DECZ2 d spherical coordinates of tangent point, solution 2 + N i number of solutions: + 0 = no solutions returned (note 2) + 1 = only the first solution is useful (note 3) + 2 = both solutions are useful (note 3) + + Notes: + + 1 The RAZ1 and RAZ2 values are returned in the range 0-2pi. + + 2 Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero XI value, and hence it is + meaningless to ask where the tangent point would have to be + to bring about this combination of XI and DEC. + + 3 Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. N=1 indicates only one useful + solution, the usual case; under these circumstances, the second + solution corresponds to the "over-the-pole" case, and this is + reflected in the values of RAZ2 and DECZ2 which are returned. + + 4 The DECZ1 and DECZ2 values are returned in the range +/-pi, but + in the usual, non-pole-crossing, case, the range is +/-pi/2. + + 5 This routine is the spherical equivalent of the routine slDPVC. + + Called: slDA2P + + P.T.Wallace Starlink 5 June 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dtpv2c.hlp b/math/slalib/doc/dtpv2c.hlp new file mode 100644 index 00000000..acc94985 --- /dev/null +++ b/math/slalib/doc/dtpv2c.hlp @@ -0,0 +1,51 @@ +.help dtpv2c Jun99 "Slalib Package" +.nf + + SUBROUTINE slDPVC (XI, ETA, V, V01, V02, N) + + - - - - - - - + D P V C + - - - - - - - + + Given the tangent-plane coordinates of a star and its direction + cosines, determine the direction cosines of the tangent-point. + + (double precision) + + Given: + XI,ETA d tangent plane coordinates of star + V d(3) direction cosines of star + + Returned: + V01 d(3) direction cosines of tangent point, solution 1 + V02 d(3) direction cosines of tangent point, solution 2 + N i number of solutions: + 0 = no solutions returned (note 2) + 1 = only the first solution is useful (note 3) + 2 = both solutions are useful (note 3) + + Notes: + + 1 The vector V must be of unit length or the result will be wrong. + + 2 Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero XI value, and hence it is meaningless + to ask where the tangent point would have to be. + + 3 Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. N=1 indicates only one useful + solution, the usual case; under these circumstances, the second + solution can be regarded as valid if the vector V02 is interpreted + as the "over-the-pole" case. + + 4 This routine is the Cartesian equivalent of the routine slDPSC. + + P.T.Wallace Starlink 5 June 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dtt.hlp b/math/slalib/doc/dtt.hlp new file mode 100644 index 00000000..67c2b1ae --- /dev/null +++ b/math/slalib/doc/dtt.hlp @@ -0,0 +1,41 @@ +.help dtt Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slDTT (UTC) + + - - - - + D T T + - - - - + + Increment to be applied to Coordinated Universal Time UTC to give + Terrestrial Time TT (formerly Ephemeris Time ET) + + (double precision) + + Given: + UTC d UTC date as a modified JD (JD-2400000.5) + + Result: TT-UTC in seconds + + Notes: + + 1 The UTC is specified to be a date rather than a time to indicate + that care needs to be taken not to specify an instant which lies + within a leap second. Though in most cases UTC can include the + fractional part, correct behaviour on the day of a leap second + can only be guaranteed up to the end of the second 23:59:59. + + 2 Pre 1972 January 1 a fixed value of 10 + ET-TAI is returned. + + 3 See also the routine slDT, which roughly estimates ET-UT for + historical epochs. + + Called: slDAT + + P.T.Wallace Starlink 6 December 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dv2tp.hlp b/math/slalib/doc/dv2tp.hlp new file mode 100644 index 00000000..6b927741 --- /dev/null +++ b/math/slalib/doc/dv2tp.hlp @@ -0,0 +1,42 @@ +.help dv2tp Jun99 "Slalib Package" +.nf + + SUBROUTINE slDVTP (V, V0, XI, ETA, J) + + - - - - - - + D V T P + - - - - - - + + Given the direction cosines of a star and of the tangent point, + determine the star's tangent-plane coordinates. + + (double precision) + + Given: + V d(3) direction cosines of star + V0 d(3) direction cosines of tangent point + + Returned: + XI,ETA d tangent plane coordinates of star + J i status: 0 = OK + 1 = error, star too far from axis + 2 = error, antistar on tangent plane + 3 = error, antistar too far from axis + + Notes: + + 1 If vector V0 is not of unit length, or if vector V is of zero + length, the results will be wrong. + + 2 If V0 points at a pole, the returned XI,ETA will be based on the + arbitrary assumption that the RA of the tangent point is zero. + + 3 This routine is the Cartesian equivalent of the routine slDSTP. + + P.T.Wallace Starlink 27 November 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dvdv.hlp b/math/slalib/doc/dvdv.hlp new file mode 100644 index 00000000..d3c566dd --- /dev/null +++ b/math/slalib/doc/dvdv.hlp @@ -0,0 +1,24 @@ +.help dvdv Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slDVDV (VA, VB) + + - - - - - + D V D V + - - - - - + + Scalar product of two 3-vectors (double precision) + + Given: + VA dp(3) first vector + VB dp(3) second vector + + The result is the scalar product VA.VB (double precision) + + P.T.Wallace Starlink November 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dvn.hlp b/math/slalib/doc/dvn.hlp new file mode 100644 index 00000000..295937e6 --- /dev/null +++ b/math/slalib/doc/dvn.hlp @@ -0,0 +1,27 @@ +.help dvn Jun99 "Slalib Package" +.nf + + SUBROUTINE slDVN (V, UV, VM) + + - - - - + D V N + - - - - + + Normalizes a 3-vector also giving the modulus (double precision) + + Given: + V dp(3) vector + + Returned: + UV dp(3) unit vector in direction of V + VM dp modulus of V + + If the modulus of V is zero, UV is set to zero as well + + P.T.Wallace Starlink 23 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/dvxv.hlp b/math/slalib/doc/dvxv.hlp new file mode 100644 index 00000000..a7db5344 --- /dev/null +++ b/math/slalib/doc/dvxv.hlp @@ -0,0 +1,25 @@ +.help dvxv Jun99 "Slalib Package" +.nf + + SUBROUTINE slDVXV (VA, VB, VC) + + - - - - - + D V X V + - - - - - + + Vector product of two 3-vectors (double precision) + + Given: + VA dp(3) first vector + VB dp(3) second vector + + Returned: + VC dp(3) vector result + + P.T.Wallace Starlink March 1986 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/e2h.hlp b/math/slalib/doc/e2h.hlp new file mode 100644 index 00000000..f962d80a --- /dev/null +++ b/math/slalib/doc/e2h.hlp @@ -0,0 +1,59 @@ +.help e2h Jun99 "Slalib Package" +.nf + + SUBROUTINE slE2H (HA, DEC, PHI, AZ, EL) + + - - - - + E 2 H + - - - - + + Equatorial to horizon coordinates: HA,Dec to Az,El + + (single precision) + + Given: + HA r hour angle + DEC r declination + PHI r observatory latitude + + Returned: + AZ r azimuth + EL r elevation + + Notes: + + 1) All the arguments are angles in radians. + + 2) Azimuth is returned in the range 0-2pi; north is zero, + and east is +pi/2. Elevation is returned in the range + +/-pi/2. + + 3) The latitude must be geodetic. In critical applications, + corrections for polar motion should be applied. + + 4) In some applications it will be important to specify the + correct type of hour angle and declination in order to + produce the required type of azimuth and elevation. In + particular, it may be important to distinguish between + elevation as affected by refraction, which would + require the "observed" HA,Dec, and the elevation + in vacuo, which would require the "topocentric" HA,Dec. + If the effects of diurnal aberration can be neglected, the + "apparent" HA,Dec may be used instead of the topocentric + HA,Dec. + + 5) No range checking of arguments is carried out. + + 6) In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and (for tracking a star) + sine and cosine of declination. + + P.T.Wallace Starlink 9 July 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/earth.hlp b/math/slalib/doc/earth.hlp new file mode 100644 index 00000000..ea0eccd6 --- /dev/null +++ b/math/slalib/doc/earth.hlp @@ -0,0 +1,44 @@ +.help earth Jun99 "Slalib Package" +.nf + + SUBROUTINE slERTH (IY, ID, FD, PV) + + - - - - - - + E R T H + - - - - - - + + Approximate heliocentric position and velocity of the Earth + + Given: + IY I year + ID I day in year (1 = Jan 1st) + FD R fraction of day + + Returned: + PV R(6) Earth position & velocity vector + + Notes: + + 1 The date and time is TDB (loosely ET) in a Julian calendar + which has been aligned to the ordinary Gregorian + calendar for the interval 1900 March 1 to 2100 February 28. + The year and day can be obtained by calling slCAYD or + slCLYD. + + 2 The Earth heliocentric 6-vector is mean equator and equinox + of date. Position part, PV(1-3), is in AU; velocity part, + PV(4-6), is in AU/sec. + + 3 Max/RMS errors 1950-2050: + 13/5 E-5 AU = 19200/7600 km in position + 47/26 E-10 AU/s = 0.0070/0.0039 km/s in speed + + 4 More precise results are obtainable with the routine slEVP. + + P.T.Wallace Starlink 23 November 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ecleq.hlp b/math/slalib/doc/ecleq.hlp new file mode 100644 index 00000000..02fc6c50 --- /dev/null +++ b/math/slalib/doc/ecleq.hlp @@ -0,0 +1,31 @@ +.help ecleq Jun99 "Slalib Package" +.nf + + SUBROUTINE slECEQ (DL, DB, DATE, DR, DD) + + - - - - - - + E C E Q + - - - - - - + + Transformation from ecliptic coordinates to + J2000.0 equatorial coordinates (double precision) + + Given: + DL,DB dp ecliptic longitude and latitude + (mean of date, IAU 1980 theory, radians) + DATE dp TDB (loosely ET) as Modified Julian Date + (JD-2400000.5) + Returned: + DR,DD dp J2000.0 mean RA,Dec (radians) + + Called: + slDS2C, slECMA, slDIMV, slPREC, slEPJ, slDC2S, + slDA2P, slDA1P + + P.T.Wallace Starlink March 1986 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ecmat.hlp b/math/slalib/doc/ecmat.hlp new file mode 100644 index 00000000..a9be4579 --- /dev/null +++ b/math/slalib/doc/ecmat.hlp @@ -0,0 +1,34 @@ +.help ecmat Jun99 "Slalib Package" +.nf + + SUBROUTINE slECMA (DATE, RMAT) + + - - - - - - + E C M A + - - - - - - + + Form the equatorial to ecliptic rotation matrix - IAU 1980 theory + (double precision) + + Given: + DATE dp TDB (loosely ET) as Modified Julian Date + (JD-2400000.5) + Returned: + RMAT dp(3,3) matrix + + Reference: + Murray,C.A., Vectorial Astrometry, section 4.3. + + Note: + The matrix is in the sense V(ecl) = RMAT * V(equ); the + equator, equinox and ecliptic are mean of date. + + Called: slDEUL + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ecor.hlp b/math/slalib/doc/ecor.hlp new file mode 100644 index 00000000..07cf410f --- /dev/null +++ b/math/slalib/doc/ecor.hlp @@ -0,0 +1,54 @@ +.help ecor Jun99 "Slalib Package" +.nf + + SUBROUTINE slECOR (RM, DM, IY, ID, FD, RV, TL) + + - - - - - + E C O R + - - - - - + + Component of Earth orbit velocity and heliocentric + light time in a given direction (single precision) + + Given: + RM,DM real mean RA, Dec of date (radians) + IY int year + ID int day in year (1 = Jan 1st) + FD real fraction of day + + Returned: + RV real component of Earth orbital velocity (km/sec) + TL real component of heliocentric light time (sec) + + Notes: + + 1 The date and time is TDB (loosely ET) in a Julian calendar + which has been aligned to the ordinary Gregorian + calendar for the interval 1900 March 1 to 2100 February 28. + The year and day can be obtained by calling slCAYD or + slCLYD. + + 2 Sign convention: + + The velocity component is +ve when the Earth is receding from + the given point on the sky. The light time component is +ve + when the Earth lies between the Sun and the given point on + the sky. + + 3 Accuracy: + + The velocity component is usually within 0.004 km/s of the + correct value and is never in error by more than 0.007 km/s. + The error in light time correction is about 0.03s at worst, + but is usually better than 0.01s. For applications requiring + higher accuracy, see the slEVP routine. + + Called: slERTH, slCS2C, slVDV + + P.T.Wallace Starlink 24 November 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/eg50.hlp b/math/slalib/doc/eg50.hlp new file mode 100644 index 00000000..da2c0fa3 --- /dev/null +++ b/math/slalib/doc/eg50.hlp @@ -0,0 +1,38 @@ +.help eg50 Jun99 "Slalib Package" +.nf + + SUBROUTINE slEG50 (DR, DD, DL, DB) + + - - - - - + E G 5 0 + - - - - - + + Transformation from B1950.0 'FK4' equatorial coordinates to + IAU 1958 galactic coordinates (double precision) + + Given: + DR,DD dp B1950.0 'FK4' RA,Dec + + Returned: + DL,DB dp galactic longitude and latitude L2,B2 + + (all arguments are radians) + + Called: + slDS2C, slDMXV, slDC2S, slSUET, slDA2P, slDA1P + + Note: + The equatorial coordinates are B1950.0 'FK4'. Use the + routine slEQGA if conversion from J2000.0 coordinates + is required. + + Reference: + Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960) + + P.T.Wallace Starlink 5 September 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/el2ue.hlp b/math/slalib/doc/el2ue.hlp new file mode 100644 index 00000000..9271fff6 --- /dev/null +++ b/math/slalib/doc/el2ue.hlp @@ -0,0 +1,133 @@ +.help el2ue Jun99 "Slalib Package" +.nf + + SUBROUTINE slELUE (DATE, JFORM, EPOCH, ORBINC, ANODE, + : PERIH, AORQ, E, AORL, DM, + : U, JSTAT) + + - - - - - - + E L U E + - - - - - - + + Transform conventional osculating orbital elements into "universal" form. + + Given: + DATE d epoch (TT MJD) of osculation (Note 3) + JFORM i choice of element set (1-3, Note 6) + EPOCH d epoch (TT MJD) of the elements + ORBINC d inclination (radians) + ANODE d longitude of the ascending node (radians) + PERIH d longitude or argument of perihelion (radians) + AORQ d mean distance or perihelion distance (AU) + E d eccentricity + AORL d mean anomaly or longitude (radians, JFORM=1,2 only) + DM d daily motion (radians, JFORM=1 only) + + Returned: + U d(13) universal orbital elements (Note 1) + + (1) combined mass (M+m) + (2) total energy of the orbit (alpha) + (3) reference (osculating) epoch (t0) + (4-6) position at reference epoch (r0) + (7-9) velocity at reference epoch (v0) + (10) heliocentric distance at reference epoch + (11) r0.v0 + (12) date (t) + (13) universal eccentric anomaly (psi) of date, approx + + JSTAT i status: 0 = OK + -1 = illegal JFORM + -2 = illegal E + -3 = illegal AORQ + -4 = illegal DM + -5 = numerical error + + Called: slUEPV, slPVUE + + Notes + + 1 The "universal" elements are those which define the orbit for the + purposes of the method of universal variables (see reference). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i) alpha, which is proportional to the total energy of the + orbit, (ii) the heliocentric distance at epoch, (iii) the + outwards component of the velocity at the given epoch, (iv) an + estimate of psi, the "universal eccentric anomaly" at a given + date and (v) that date. + + 2 The companion routine is slUEPV. This takes the set of numbers + that the present routine outputs and uses them to derive the + object's position and velocity. A single prediction requires one + call to the present routine followed by one call to slUEPV; + for convenience, the two calls are packaged as the routine + slPLNE. Multiple predictions may be made by again calling the + present routine once, but then calling slUEPV multiple times, + which is faster than multiple calls to slPLNE. + + 3 DATE is the epoch of osculation. It is in the TT timescale + (formerly Ephemeris Time, ET) and is a Modified Julian Date + (JD-2400000.5). + + 4 The supplied orbital elements are with respect to the J2000 + ecliptic and equinox. The position and velocity parameters + returned in the array U are with respect to the mean equator and + equinox of epoch J2000, and are for the perihelion prior to the + specified epoch. + + 5 The universal elements returned in the array U are in canonical + units (solar masses, AU and canonical days). + + 6 Three different element-format options are available: + + Option JFORM=1, suitable for the major planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = longitude of perihelion, curly pi (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e (range 0 to <1) + AORL = mean longitude L (radians) + DM = daily motion (radians) + + Option JFORM=2, suitable for minor planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e (range 0 to <1) + AORL = mean anomaly M (radians) + + Option JFORM=3, suitable for comets: + + EPOCH = epoch of perihelion (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = perihelion distance, q (AU) + E = eccentricity, e (range 0 to 10) + + 7 Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are + not accessed. + + 8 The algorithm was originally adapted from the EPHSLA program of + D.H.P.Jones (private communication, 1996). The method is based + on Stumpff's Universal Variables. + + Reference: Everhart & Pitkin, Am.J.Phys. 51, 712 (1983). + + P.T.Wallace Starlink 18 February 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/epb.hlp b/math/slalib/doc/epb.hlp new file mode 100644 index 00000000..6c7ed368 --- /dev/null +++ b/math/slalib/doc/epb.hlp @@ -0,0 +1,27 @@ +.help epb Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slEPB (DATE) + + - - - - + E P B + - - - - + + Conversion of Modified Julian Date to Besselian Epoch + (double precision) + + Given: + DATE dp Modified Julian Date (JD - 2400000.5) + + The result is the Besselian Epoch. + + Reference: + Lieske,J.H., 1979. Astron.Astrophys.,73,282. + + P.T.Wallace Starlink February 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/epb2d.hlp b/math/slalib/doc/epb2d.hlp new file mode 100644 index 00000000..b0ded162 --- /dev/null +++ b/math/slalib/doc/epb2d.hlp @@ -0,0 +1,27 @@ +.help epb2d Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slEB2D (EPB) + + - - - - - - + E B 2 D + - - - - - - + + Conversion of Besselian Epoch to Modified Julian Date + (double precision) + + Given: + EPB dp Besselian Epoch + + The result is the Modified Julian Date (JD - 2400000.5). + + Reference: + Lieske,J.H., 1979. Astron.Astrophys.,73,282. + + P.T.Wallace Starlink February 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/epco.hlp b/math/slalib/doc/epco.hlp new file mode 100644 index 00000000..d92bfde2 --- /dev/null +++ b/math/slalib/doc/epco.hlp @@ -0,0 +1,40 @@ +.help epco Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slEPCO (K0, K, E) + + - - - - - + E P C O + - - - - - + + Convert an epoch into the appropriate form - 'B' or 'J' + + Given: + K0 char form of result: 'B'=Besselian, 'J'=Julian + K char form of given epoch: 'B' or 'J' + E dp epoch + + Called: slEPB, slEJ2D, slEPJ, slEB2D + + Notes: + + 1) The result is always either equal to or very close to + the given epoch E. The routine is required only in + applications where punctilious treatment of heterogeneous + mixtures of star positions is necessary. + + 2) K0 and K are not validated. They are interpreted as follows: + + o If K0 and K are the same the result is E. + o If K0 is 'B' or 'b' and K isn't, the conversion is J to B. + o In all other cases, the conversion is B to J. + + Note that K0 and K won't match if their cases differ. + + P.T.Wallace Starlink 5 September 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/epj.hlp b/math/slalib/doc/epj.hlp new file mode 100644 index 00000000..34d47ec7 --- /dev/null +++ b/math/slalib/doc/epj.hlp @@ -0,0 +1,26 @@ +.help epj Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slEPJ (DATE) + + - - - - + E P J + - - - - + + Conversion of Modified Julian Date to Julian Epoch (double precision) + + Given: + DATE dp Modified Julian Date (JD - 2400000.5) + + The result is the Julian Epoch. + + Reference: + Lieske,J.H., 1979. Astron.Astrophys.,73,282. + + P.T.Wallace Starlink February 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/epj2d.hlp b/math/slalib/doc/epj2d.hlp new file mode 100644 index 00000000..ceadf7ab --- /dev/null +++ b/math/slalib/doc/epj2d.hlp @@ -0,0 +1,26 @@ +.help epj2d Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slEJ2D (EPJ) + + - - - - - - + E J 2 D + - - - - - - + + Conversion of Julian Epoch to Modified Julian Date (double precision) + + Given: + EPJ dp Julian Epoch + + The result is the Modified Julian Date (JD - 2400000.5). + + Reference: + Lieske,J.H., 1979. Astron.Astrophys.,73,282. + + P.T.Wallace Starlink February 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/eqecl.hlp b/math/slalib/doc/eqecl.hlp new file mode 100644 index 00000000..a8266afe --- /dev/null +++ b/math/slalib/doc/eqecl.hlp @@ -0,0 +1,31 @@ +.help eqecl Jun99 "Slalib Package" +.nf + + SUBROUTINE slEQEC (DR, DD, DATE, DL, DB) + + - - - - - - + E Q E C + - - - - - - + + Transformation from J2000.0 equatorial coordinates to + ecliptic coordinates (double precision) + + Given: + DR,DD dp J2000.0 mean RA,Dec (radians) + DATE dp TDB (loosely ET) as Modified Julian Date + (JD-2400000.5) + Returned: + DL,DB dp ecliptic longitude and latitude + (mean of date, IAU 1980 theory, radians) + + Called: + slDS2C, slPREC, slEPJ, slDMXV, slECMA, slDC2S, + slDA2P, slDA1P + + P.T.Wallace Starlink March 1986 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/eqeqx.hlp b/math/slalib/doc/eqeqx.hlp new file mode 100644 index 00000000..35da9ab4 --- /dev/null +++ b/math/slalib/doc/eqeqx.hlp @@ -0,0 +1,33 @@ +.help eqeqx Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slEQEX (DATE) + + - - - - - - + E Q E X + - - - - - - + + Equation of the equinoxes (IAU 1994, double precision) + + Given: + DATE dp TDB (loosely ET) as Modified Julian Date + (JD-2400000.5) + + The result is the equation of the equinoxes (double precision) + in radians: + + Greenwich apparent ST = GMST + slEQEX + + References: IAU Resolution C7, Recommendation 3 (1994) + Capitaine, N. & Gontier, A.-M., Astron. Astrophys., + 275, 645-650 (1993) + + Called: slNUTC + + Patrick Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/eqgal.hlp b/math/slalib/doc/eqgal.hlp new file mode 100644 index 00000000..1f37716f --- /dev/null +++ b/math/slalib/doc/eqgal.hlp @@ -0,0 +1,38 @@ +.help eqgal Jun99 "Slalib Package" +.nf + + SUBROUTINE slEQGA (DR, DD, DL, DB) + + - - - - - - + E Q G A + - - - - - - + + Transformation from J2000.0 equatorial coordinates to + IAU 1958 galactic coordinates (double precision) + + Given: + DR,DD dp J2000.0 RA,Dec + + Returned: + DL,DB dp galactic longitude and latitude L2,B2 + + (all arguments are radians) + + Called: + slDS2C, slDMXV, slDC2S, slDA2P, slDA1P + + Note: + The equatorial coordinates are J2000.0. Use the routine + slEG50 if conversion from B1950.0 'FK4' coordinates is + required. + + Reference: + Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960) + + P.T.Wallace Starlink 21 September 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/etrms.hlp b/math/slalib/doc/etrms.hlp new file mode 100644 index 00000000..bc14b655 --- /dev/null +++ b/math/slalib/doc/etrms.hlp @@ -0,0 +1,35 @@ +.help etrms Jun99 "Slalib Package" +.nf + + SUBROUTINE slETRM (EP, EV) + + - - - - - - + E T R M + - - - - - - + + Compute the E-terms (elliptic component of annual aberration) + vector (double precision) + + Given: + EP dp Besselian epoch + + Returned: + EV dp(3) E-terms as (dx,dy,dz) + + Note the use of the J2000 aberration constant (20.49552 arcsec). + This is a reflection of the fact that the E-terms embodied in + existing star catalogues were computed from a variety of + aberration constants. Rather than adopting one of the old + constants the latest value is used here. + + References: + 1 Smith, C.A. et al., 1989. Astr.J. 97, 265. + 2 Yallop, B.D. et al., 1989. Astr.J. 97, 274. + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/euler.hlp b/math/slalib/doc/euler.hlp new file mode 100644 index 00000000..7ae2fedc --- /dev/null +++ b/math/slalib/doc/euler.hlp @@ -0,0 +1,52 @@ +.help euler Jun99 "Slalib Package" +.nf + + SUBROUTINE slEULR (ORDER, PHI, THETA, PSI, RMAT) + + - - - - - - + E U L R + - - - - - - + + Form a rotation matrix from the Euler angles - three successive + rotations about specified Cartesian axes (single precision) + + Given: + ORDER c*(*) specifies about which axes the rotations occur + PHI r 1st rotation (radians) + THETA r 2nd rotation ( " ) + PSI r 3rd rotation ( " ) + + Returned: + RMAT r(3,3) rotation matrix + + A rotation is positive when the reference frame rotates + anticlockwise as seen looking towards the origin from the + positive region of the specified axis. + + The characters of ORDER define which axes the three successive + rotations are about. A typical value is 'ZXZ', indicating that + RMAT is to become the direction cosine matrix corresponding to + rotations of the reference frame through PHI radians about the + old Z-axis, followed by THETA radians about the resulting X-axis, + then PSI radians about the resulting Z-axis. + + The axis names can be any of the following, in any order or + combination: X, Y, Z, uppercase or lowercase, 1, 2, 3. Normal + axis labeling/numbering conventions apply; the xyz (=123) + triad is right-handed. Thus, the 'ZXZ' example given above + could be written 'zxz' or '313' (or even 'ZxZ' or '3xZ'). ORDER + is terminated by length or by the first unrecognized character. + + Fewer than three rotations are acceptable, in which case the later + angle arguments are ignored. If all rotations are zero, the + identity matrix is produced. + + Called: slDEUL + + P.T.Wallace Starlink 23 May 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/evp.hlp b/math/slalib/doc/evp.hlp new file mode 100644 index 00000000..e7fa04cf --- /dev/null +++ b/math/slalib/doc/evp.hlp @@ -0,0 +1,66 @@ +.help evp Jun99 "Slalib Package" +.nf + + SUBROUTINE slEVP (DATE, DEQX, DVB, DPB, DVH, DPH) + + - - - - + E V P + - - - - + + Barycentric and heliocentric velocity and position of the Earth + + All arguments are double precision + + Given: + + DATE TDB (loosely ET) as a Modified Julian Date + (JD-2400000.5) + + DEQX Julian Epoch (e.g. 2000.0D0) of mean equator and + equinox of the vectors returned. If DEQX .LE. 0D0, + all vectors are referred to the mean equator and + equinox (FK5) of epoch DATE. + + Returned (all 3D Cartesian vectors): + + DVB,DPB barycentric velocity, position + + DVH,DPH heliocentric velocity, position + + (Units are AU/s for velocity and AU for position) + + Called: slEPJ, slPREC + + Accuracy: + + The maximum deviations from the JPL DE96 ephemeris are as + follows: + + barycentric velocity 0.42 m/s + barycentric position 6900 km + + heliocentric velocity 0.42 m/s + heliocentric position 1600 km + + This routine is adapted from the BARVEL and BARCOR + subroutines of P.Stumpff, which are described in + Astron. Astrophys. Suppl. Ser. 41, 1-8 (1980). Most of the + changes are merely cosmetic and do not affect the results at + all. However, some adjustments have been made so as to give + results that refer to the new (IAU 1976 'FK5') equinox + and precession, although the differences these changes make + relative to the results from Stumpff's original 'FK4' version + are smaller than the inherent accuracy of the algorithm. One + minor shortcoming in the original routines that has NOT been + corrected is that better numerical accuracy could be achieved + if the various polynomial evaluations were nested. Note also + that one of Stumpff's precession constants differs by 0.001 arcsec + from the value given in the Explanatory Supplement to the A.E. + + P.T.Wallace Starlink 21 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/fitxy.hlp b/math/slalib/doc/fitxy.hlp new file mode 100644 index 00000000..814deb9f --- /dev/null +++ b/math/slalib/doc/fitxy.hlp @@ -0,0 +1,76 @@ +.help fitxy Jun99 "Slalib Package" +.nf + + SUBROUTINE slFTXY (ITYPE,NP,XYE,XYM,COEFFS,J) + + - - - - - - + F T X Y + - - - - - - + + Fit a linear model to relate two sets of [X,Y] coordinates. + + Given: + ITYPE i type of model: 4 or 6 (note 1) + NP i number of samples (note 2) + XYE d(2,np) expected [X,Y] for each sample + XYM d(2,np) measured [X,Y] for each sample + + Returned: + COEFFS d(6) coefficients of model (note 3) + J i status: 0 = OK + -1 = illegal ITYPE + -2 = insufficient data + -3 = singular solution + + Notes: + + 1) ITYPE, which must be either 4 or 6, selects the type of model + fitted. Both allowed ITYPE values produce a model COEFFS which + consists of six coefficients, namely the zero points and, for + each of XE and YE, the coefficient of XM and YM. For ITYPE=6, + all six coefficients are independent, modelling squash and shear + as well as origin, scale, and orientation. However, ITYPE=4 + selects the "solid body rotation" option; the model COEFFS + still consists of the same six coefficients, but now two of + them are used twice (appropriately signed). Origin, scale + and orientation are still modelled, but not squash or shear - + the units of X and Y have to be the same. + + 2) For NC=4, NP must be at least 2. For NC=6, NP must be at + least 3. + + 3) The model is returned in the array COEFFS. Naming the + elements of COEFFS as follows: + + COEFFS(1) = A + COEFFS(2) = B + COEFFS(3) = C + COEFFS(4) = D + COEFFS(5) = E + COEFFS(6) = F + + the model is: + + XE = A + B*XM + C*YM + YE = D + E*XM + F*YM + + For the "solid body rotation" option (ITYPE=4), the + magnitudes of B and F, and of C and E, are equal. The + signs of these coefficients depend on whether there is a + sign reversal between XE,YE and XM,YM; fits are performed + with and without a sign reversal and the best one chosen. + + 4) Error status values J=-1 and -2 leave COEFFS unchanged; + if J=-3 COEFFS may have been changed. + + See also slPXY, slINVF, slXYXY, slDCMF + + Called: slDMAT, slDMXV + + P.T.Wallace Starlink 11 February 1991 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/fk425.hlp b/math/slalib/doc/fk425.hlp new file mode 100644 index 00000000..808dcb7b --- /dev/null +++ b/math/slalib/doc/fk425.hlp @@ -0,0 +1,81 @@ +.help fk425 Jun99 "Slalib Package" +.nf + + SUBROUTINE slFK45 (R1950,D1950,DR1950,DD1950,P1950,V1950, + : R2000,D2000,DR2000,DD2000,P2000,V2000) + + - - - - - - + F K 4 5 + - - - - - - + + Convert B1950.0 FK4 star data to J2000.0 FK5 (double precision) + + This routine converts stars from the old, Bessel-Newcomb, FK4 + system to the new, IAU 1976, FK5, Fricke system. The precepts + of Smith et al (Ref 1) are followed, using the implementation + by Yallop et al (Ref 2) of a matrix method due to Standish. + Kinoshita's development of Andoyer's post-Newcomb precession is + used. The numerical constants from Seidelmann et al (Ref 3) are + used canonically. + + Given: (all B1950.0,FK4) + R1950,D1950 dp B1950.0 RA,Dec (rad) + DR1950,DD1950 dp B1950.0 proper motions (rad/trop.yr) + P1950 dp parallax (arcsec) + V1950 dp radial velocity (km/s, +ve = moving away) + + Returned: (all J2000.0,FK5) + R2000,D2000 dp J2000.0 RA,Dec (rad) + DR2000,DD2000 dp J2000.0 proper motions (rad/Jul.yr) + P2000 dp parallax (arcsec) + V2000 dp radial velocity (km/s, +ve = moving away) + + Notes: + + 1) The proper motions in RA are dRA/dt rather than + cos(Dec)*dRA/dt, and are per year rather than per century. + + 2) Conversion from Besselian epoch 1950.0 to Julian epoch + 2000.0 only is provided for. Conversions involving other + epochs will require use of the appropriate precession, + proper motion, and E-terms routines before and/or + after FK425 is called. + + 3) In the FK4 catalogue the proper motions of stars within + 10 degrees of the poles do not embody the differential + E-term effect and should, strictly speaking, be handled + in a different manner from stars outside these regions. + However, given the general lack of homogeneity of the star + data available for routine astrometry, the difficulties of + handling positions that may have been determined from + astrometric fields spanning the polar and non-polar regions, + the likelihood that the differential E-terms effect was not + taken into account when allowing for proper motion in past + astrometry, and the undesirability of a discontinuity in + the algorithm, the decision has been made in this routine to + include the effect of differential E-terms on the proper + motions for all stars, whether polar or not. At epoch 2000, + and measuring on the sky rather than in terms of dRA, the + errors resulting from this simplification are less than + 1 milliarcsecond in position and 1 milliarcsecond per + century in proper motion. + + References: + + 1 Smith, C.A. et al, 1989. "The transformation of astrometric + catalog systems to the equinox J2000.0". Astron.J. 97, 265. + + 2 Yallop, B.D. et al, 1989. "Transformation of mean star places + from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space". + Astron.J. 97, 274. + + 3 Seidelmann, P.K. (ed), 1992. "Explanatory Supplement to + the Astronomical Almanac", ISBN 0-935702-68-7. + + P.T.Wallace Starlink 19 December 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/fk45z.hlp b/math/slalib/doc/fk45z.hlp new file mode 100644 index 00000000..6994302f --- /dev/null +++ b/math/slalib/doc/fk45z.hlp @@ -0,0 +1,83 @@ +.help fk45z Jun99 "Slalib Package" +.nf + + SUBROUTINE slF45Z (R1950,D1950,BEPOCH,R2000,D2000) + + - - - - - - + F 4 5 Z + - - - - - - + + Convert B1950.0 FK4 star data to J2000.0 FK5 assuming zero + proper motion in the FK5 frame (double precision) + + This routine converts stars from the old, Bessel-Newcomb, FK4 + system to the new, IAU 1976, FK5, Fricke system, in such a + way that the FK5 proper motion is zero. Because such a star + has, in general, a non-zero proper motion in the FK4 system, + the routine requires the epoch at which the position in the + FK4 system was determined. + + The method is from Appendix 2 of Ref 1, but using the constants + of Ref 4. + + Given: + R1950,D1950 dp B1950.0 FK4 RA,Dec at epoch (rad) + BEPOCH dp Besselian epoch (e.g. 1979.3D0) + + Returned: + R2000,D2000 dp J2000.0 FK5 RA,Dec (rad) + + Notes: + + 1) The epoch BEPOCH is strictly speaking Besselian, but + if a Julian epoch is supplied the result will be + affected only to a negligible extent. + + 2) Conversion from Besselian epoch 1950.0 to Julian epoch + 2000.0 only is provided for. Conversions involving other + epochs will require use of the appropriate precession, + proper motion, and E-terms routines before and/or + after FK45Z is called. + + 3) In the FK4 catalogue the proper motions of stars within + 10 degrees of the poles do not embody the differential + E-term effect and should, strictly speaking, be handled + in a different manner from stars outside these regions. + However, given the general lack of homogeneity of the star + data available for routine astrometry, the difficulties of + handling positions that may have been determined from + astrometric fields spanning the polar and non-polar regions, + the likelihood that the differential E-terms effect was not + taken into account when allowing for proper motion in past + astrometry, and the undesirability of a discontinuity in + the algorithm, the decision has been made in this routine to + include the effect of differential E-terms on the proper + motions for all stars, whether polar or not. At epoch 2000, + and measuring on the sky rather than in terms of dRA, the + errors resulting from this simplification are less than + 1 milliarcsecond in position and 1 milliarcsecond per + century in proper motion. + + References: + + 1 Aoki,S., et al, 1983. Astron.Astrophys., 128, 263. + + 2 Smith, C.A. et al, 1989. "The transformation of astrometric + catalog systems to the equinox J2000.0". Astron.J. 97, 265. + + 3 Yallop, B.D. et al, 1989. "Transformation of mean star places + from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space". + Astron.J. 97, 274. + + 4 Seidelmann, P.K. (ed), 1992. "Explanatory Supplement to + the Astronomical Almanac", ISBN 0-935702-68-7. + + Called: slDS2C, slEPJ, slEB2D, slDC2S, slDA2P + + P.T.Wallace Starlink 21 September 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/fk524.hlp b/math/slalib/doc/fk524.hlp new file mode 100644 index 00000000..ed86273b --- /dev/null +++ b/math/slalib/doc/fk524.hlp @@ -0,0 +1,81 @@ +.help fk524 Jun99 "Slalib Package" +.nf + + SUBROUTINE slFK54 (R2000,D2000,DR2000,DD2000,P2000,V2000, + : R1950,D1950,DR1950,DD1950,P1950,V1950) + + - - - - - - + F K 5 4 + - - - - - - + + Convert J2000.0 FK5 star data to B1950.0 FK4 (double precision) + + This routine converts stars from the new, IAU 1976, FK5, Fricke + system, to the old, Bessel-Newcomb, FK4 system. The precepts + of Smith et al (Ref 1) are followed, using the implementation + by Yallop et al (Ref 2) of a matrix method due to Standish. + Kinoshita's development of Andoyer's post-Newcomb precession is + used. The numerical constants from Seidelmann et al (Ref 3) are + used canonically. + + Given: (all J2000.0,FK5) + R2000,D2000 dp J2000.0 RA,Dec (rad) + DR2000,DD2000 dp J2000.0 proper motions (rad/Jul.yr) + P2000 dp parallax (arcsec) + V2000 dp radial velocity (km/s, +ve = moving away) + + Returned: (all B1950.0,FK4) + R1950,D1950 dp B1950.0 RA,Dec (rad) + DR1950,DD1950 dp B1950.0 proper motions (rad/trop.yr) + P1950 dp parallax (arcsec) + V1950 dp radial velocity (km/s, +ve = moving away) + + Notes: + + 1) The proper motions in RA are dRA/dt rather than + cos(Dec)*dRA/dt, and are per year rather than per century. + + 2) Note that conversion from Julian epoch 2000.0 to Besselian + epoch 1950.0 only is provided for. Conversions involving + other epochs will require use of the appropriate precession, + proper motion, and E-terms routines before and/or after + FK524 is called. + + 3) In the FK4 catalogue the proper motions of stars within + 10 degrees of the poles do not embody the differential + E-term effect and should, strictly speaking, be handled + in a different manner from stars outside these regions. + However, given the general lack of homogeneity of the star + data available for routine astrometry, the difficulties of + handling positions that may have been determined from + astrometric fields spanning the polar and non-polar regions, + the likelihood that the differential E-terms effect was not + taken into account when allowing for proper motion in past + astrometry, and the undesirability of a discontinuity in + the algorithm, the decision has been made in this routine to + include the effect of differential E-terms on the proper + motions for all stars, whether polar or not. At epoch 2000, + and measuring on the sky rather than in terms of dRA, the + errors resulting from this simplification are less than + 1 milliarcsecond in position and 1 milliarcsecond per + century in proper motion. + + References: + + 1 Smith, C.A. et al, 1989. "The transformation of astrometric + catalog systems to the equinox J2000.0". Astron.J. 97, 265. + + 2 Yallop, B.D. et al, 1989. "Transformation of mean star places + from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space". + Astron.J. 97, 274. + + 3 Seidelmann, P.K. (ed), 1992. "Explanatory Supplement to + the Astronomical Almanac", ISBN 0-935702-68-7. + + P.T.Wallace Starlink 19 December 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/fk52h.hlp b/math/slalib/doc/fk52h.hlp new file mode 100644 index 00000000..ad7cb724 --- /dev/null +++ b/math/slalib/doc/fk52h.hlp @@ -0,0 +1,56 @@ +.help fk52h Jun99 "Slalib Package" +.nf + + SUBROUTINE slFK5H (R5,D5,DR5,DD5,RH,DH,DRH,DDH) + + - - - - - - + F K 5 H + - - - - - - + + Transform FK5 (J2000) star data into the Hipparcos frame. + + (double precision) + + This routine transforms FK5 star positions and proper motions + into the frame of the Hipparcos catalogue. + + Given (all FK5, equinox J2000, epoch J2000): + R5 d RA (radians) + D5 d Dec (radians) + DR5 d proper motion in RA (dRA/dt, rad/Jyear) + DD5 d proper motion in Dec (dDec/dt, rad/Jyear) + + Returned (all Hipparcos, epoch J2000): + RH d RA (radians) + DH d Dec (radians) + DRH d proper motion in RA (dRA/dt, rad/Jyear) + DDH d proper motion in Dec (dDec/dt, rad/Jyear) + + Called: slDSC6, slDAVM, slDMXV, slDVXV, slDC6S + + Notes: + + 1) The proper motions in RA are dRA/dt rather than + cos(Dec)*dRA/dt, and are per year rather than per century. + + 2) The FK5 to Hipparcos transformation consists of a pure + rotation and spin; zonal errors in the FK5 catalogue are + not taken into account. + + 3) The published orientation and spin components are interpreted + as "axial vectors". An axial vector points at the pole of the + rotation and its length is the amount of rotation in radians. + + 4) See also slHFK5, slF5HZ, slHF5Z. + + Reference: + + M.Feissel & F.Mignard, Astron. Astrophys. 331, L33-L36 (1998). + + P.T.Wallace Starlink 7 October 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/fk54z.hlp b/math/slalib/doc/fk54z.hlp new file mode 100644 index 00000000..b453bad9 --- /dev/null +++ b/math/slalib/doc/fk54z.hlp @@ -0,0 +1,56 @@ +.help fk54z Jun99 "Slalib Package" +.nf + + SUBROUTINE slF54Z (R2000,D2000,BEPOCH, + : R1950,D1950,DR1950,DD1950) + + - - - - - - + F 5 4 Z + - - - - - - + + Convert a J2000.0 FK5 star position to B1950.0 FK4 assuming + zero proper motion and parallax (double precision) + + This routine converts star positions from the new, IAU 1976, + FK5, Fricke system to the old, Bessel-Newcomb, FK4 system. + + Given: + R2000,D2000 dp J2000.0 FK5 RA,Dec (rad) + BEPOCH dp Besselian epoch (e.g. 1950D0) + + Returned: + R1950,D1950 dp B1950.0 FK4 RA,Dec (rad) at epoch BEPOCH + DR1950,DD1950 dp B1950.0 FK4 proper motions (rad/trop.yr) + + Notes: + + 1) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt. + + 2) Conversion from Julian epoch 2000.0 to Besselian epoch 1950.0 + only is provided for. Conversions involving other epochs will + require use of the appropriate precession routines before and + after this routine is called. + + 3) Unlike in the slFK54 routine, the FK5 proper motions, the + parallax and the radial velocity are presumed zero. + + 4) It is the intention that FK5 should be a close approximation + to an inertial frame, so that distant objects have zero proper + motion; such objects have (in general) non-zero proper motion + in FK4, and this routine returns those fictitious proper + motions. + + 5) The position returned by this routine is in the B1950 + reference frame but at Besselian epoch BEPOCH. For + comparison with catalogues the BEPOCH argument will + frequently be 1950D0. + + Called: slFK54, slPM + + P.T.Wallace Starlink 10 April 1990 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/fk5hz.hlp b/math/slalib/doc/fk5hz.hlp new file mode 100644 index 00000000..4d5e5ab0 --- /dev/null +++ b/math/slalib/doc/fk5hz.hlp @@ -0,0 +1,54 @@ +.help fk5hz Jun99 "Slalib Package" +.nf + + SUBROUTINE slF5HZ (R5,D5,EPOCH,RH,DH) + + - - - - - - + F 5 H Z + - - - - - - + + Transform an FK5 (J2000) star position into the frame of the + Hipparcos catalogue, assuming zero Hipparcos proper motion. + + (double precision) + + This routine converts a star position from the FK5 system to + the Hipparcos system, in such a way that the Hipparcos proper + motion is zero. Because such a star has, in general, a non-zero + proper motion in the FK5 system, the routine requires the epoch + at which the position in the FK5 system was determined. + + Given: + R5 d FK5 RA (radians), equinox J2000, epoch EPOCH + D5 d FK5 Dec (radians), equinox J2000, epoch EPOCH + EPOCH d Julian epoch (TDB) + + Returned (all Hipparcos): + RH d RA (radians) + DH d Dec (radians) + + Called: slDS2C, slDAVM, slDIMV, slDMXV, slDC2S + + Notes: + + 1) The FK5 to Hipparcos transformation consists of a pure + rotation and spin; zonal errors in the FK5 catalogue are + not taken into account. + + 2) The published orientation and spin components are interpreted + as "axial vectors". An axial vector points at the pole of the + rotation and its length is the amount of rotation in radians. + + 3) See also slFK5H, slHFK5, slHF5Z. + + Reference: + + M.Feissel & F.Mignard, Astron. Astrophys. 331, L33-L36 (1998). + + P.T.Wallace Starlink 7 October 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/flotin.hlp b/math/slalib/doc/flotin.hlp new file mode 100644 index 00000000..5e3d8bd6 --- /dev/null +++ b/math/slalib/doc/flotin.hlp @@ -0,0 +1,118 @@ +.help flotin Jun99 "Slalib Package" +.nf + + SUBROUTINE slRFLI (STRING, NSTRT, RESLT, JFLAG) + + - - - - - - - + R F L I + - - - - - - - + + Convert free-format input into single precision floating point + + Given: + STRING c string containing number to be decoded + NSTRT i pointer to where decoding is to start + RESLT r current value of result + + Returned: + NSTRT i advanced to next number + RESLT r result + JFLAG i status: -1 = -OK, 0 = +OK, 1 = null, 2 = error + + Called: slDFLI + + Notes: + + 1 The reason FLOTIN has separate OK status values for + + and - is to enable minus zero to be detected. This is + of crucial importance when decoding mixed-radix numbers. + For example, an angle expressed as deg, arcmin, arcsec + may have a leading minus sign but a zero degrees field. + + 2 A TAB is interpreted as a space, and lowercase characters + are interpreted as uppercase. + + 3 The basic format is the sequence of fields #^.^@#^, where + # is a sign character + or -, ^ means a string of decimal + digits, and @, which indicates an exponent, means D or E. + Various combinations of these fields can be omitted, and + embedded blanks are permissible in certain places. + + 4 Spaces: + + . Leading spaces are ignored. + + . Embedded spaces are allowed only after +, -, D or E, + and after the decomal point if the first sequence of + digits is absent. + + . Trailing spaces are ignored; the first signifies + end of decoding and subsequent ones are skipped. + + 5 Delimiters: + + . Any character other than +,-,0-9,.,D,E or space may be + used to signal the end of the number and terminate + decoding. + + . Comma is recognized by FLOTIN as a special case; it + is skipped, leaving the pointer on the next character. + See 13, below. + + 6 Both signs are optional. The default is +. + + 7 The mantissa ^.^ defaults to 1. + + 8 The exponent @#^ defaults to E0. + + 9 The strings of decimal digits may be of any length. + + 10 The decimal point is optional for whole numbers. + + 11 A "null result" occurs when the string of characters being + decoded does not begin with +,-,0-9,.,D or E, or consists + entirely of spaces. When this condition is detected, JFLAG + is set to 1 and RESLT is left untouched. + + 12 NSTRT = 1 for the first character in the string. + + 13 On return from FLOTIN, NSTRT is set ready for the next + decode - following trailing blanks and any comma. If a + delimiter other than comma is being used, NSTRT must be + incremented before the next call to FLOTIN, otherwise + all subsequent calls will return a null result. + + 14 Errors (JFLAG=2) occur when: + + . a +, -, D or E is left unsatisfied; or + + . the decimal point is present without at least + one decimal digit before or after it; or + + . an exponent more than 100 has been presented. + + 15 When an error has been detected, NSTRT is left + pointing to the character following the last + one used before the error came to light. This + may be after the point at which a more sophisticated + program could have detected the error. For example, + FLOTIN does not detect that '1E999' is unacceptable + (on a computer where this is so) until the entire number + has been decoded. + + 16 Certain highly unlikely combinations of mantissa & + exponent can cause arithmetic faults during the + decode, in some cases despite the fact that they + together could be construed as a valid number. + + 17 Decoding is left to right, one pass. + + 18 See also DFLTIN and INTIN + + P.T.Wallace Starlink 23 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/galeq.hlp b/math/slalib/doc/galeq.hlp new file mode 100644 index 00000000..6bda60d1 --- /dev/null +++ b/math/slalib/doc/galeq.hlp @@ -0,0 +1,38 @@ +.help galeq Jun99 "Slalib Package" +.nf + + SUBROUTINE slGAEQ (DL, DB, DR, DD) + + - - - - - - + G A E Q + - - - - - - + + Transformation from IAU 1958 galactic coordinates to + J2000.0 equatorial coordinates (double precision) + + Given: + DL,DB dp galactic longitude and latitude L2,B2 + + Returned: + DR,DD dp J2000.0 RA,Dec + + (all arguments are radians) + + Called: + slDS2C, slDIMV, slDC2S, slDA2P, slDA1P + + Note: + The equatorial coordinates are J2000.0. Use the routine + slGE50 if conversion to B1950.0 'FK4' coordinates is + required. + + Reference: + Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960) + + P.T.Wallace Starlink 21 September 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/galsup.hlp b/math/slalib/doc/galsup.hlp new file mode 100644 index 00000000..497211ac --- /dev/null +++ b/math/slalib/doc/galsup.hlp @@ -0,0 +1,43 @@ +.help galsup Jun99 "Slalib Package" +.nf + + SUBROUTINE slGASU (DL, DB, DSL, DSB) + + - - - - - - - + G A S U + - - - - - - - + + Transformation from IAU 1958 galactic coordinates to + de Vaucouleurs supergalactic coordinates (double precision) + + Given: + DL,DB dp galactic longitude and latitude L2,B2 + + Returned: + DSL,DSB dp supergalactic longitude and latitude + + (all arguments are radians) + + Called: + slDS2C, slDMXV, slDC2S, slDA2P, slDA1P + + References: + + de Vaucouleurs, de Vaucouleurs, & Corwin, Second Reference + Catalogue of Bright Galaxies, U. Texas, page 8. + + Systems & Applied Sciences Corp., Documentation for the + machine-readable version of the above catalogue, + Contract NAS 5-26490. + + (These two references give different values for the galactic + longitude of the supergalactic origin. Both are wrong; the + correct value is L2=137.37.) + + P.T.Wallace Starlink 25 January 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ge50.hlp b/math/slalib/doc/ge50.hlp new file mode 100644 index 00000000..b064e834 --- /dev/null +++ b/math/slalib/doc/ge50.hlp @@ -0,0 +1,38 @@ +.help ge50 Jun99 "Slalib Package" +.nf + + SUBROUTINE slGE50 (DL, DB, DR, DD) + + - - - - - + G E 5 0 + - - - - - + + Transformation from IAU 1958 galactic coordinates to + B1950.0 'FK4' equatorial coordinates (double precision) + + Given: + DL,DB dp galactic longitude and latitude L2,B2 + + Returned: + DR,DD dp B1950.0 'FK4' RA,Dec + + (all arguments are radians) + + Called: + slDS2C, slDIMV, slDC2S, slADET, slDA2P, slDA1P + + Note: + The equatorial coordinates are B1950.0 'FK4'. Use the + routine slGAEQ if conversion to J2000.0 coordinates + is required. + + Reference: + Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960) + + P.T.Wallace Starlink 5 September 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/geoc.hlp b/math/slalib/doc/geoc.hlp new file mode 100644 index 00000000..538474d1 --- /dev/null +++ b/math/slalib/doc/geoc.hlp @@ -0,0 +1,33 @@ +.help geoc Jun99 "Slalib Package" +.nf + + SUBROUTINE slGEOC (P, H, R, Z) + + - - - - - + G E O C + - - - - - + + Convert geodetic position to geocentric (double precision) + + Given: + P dp latitude (geodetic, radians) + H dp height above reference spheroid (geodetic, metres) + + Returned: + R dp distance from Earth axis (AU) + Z dp distance from plane of Earth equator (AU) + + Notes: + 1) Geocentric latitude can be obtained by evaluating ATAN2(Z,R). + 2) IAU 1976 constants are used. + + Reference: + Green,R.M., Spherical Astronomy, CUP 1985, p98. + + P.T.Wallace Starlink 4th October 1989 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/gmst.hlp b/math/slalib/doc/gmst.hlp new file mode 100644 index 00000000..7e58aec9 --- /dev/null +++ b/math/slalib/doc/gmst.hlp @@ -0,0 +1,41 @@ +.help gmst Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slGMST (UT1) + + - - - - - + G M S T + - - - - - + + Conversion from universal time to sidereal time (double precision) + + Given: + UT1 dp universal time (strictly UT1) expressed as + modified Julian Date (JD-2400000.5) + + The result is the Greenwich mean sidereal time (double + precision, radians). + + The IAU 1982 expression (see page S15 of 1984 Astronomical + Almanac) is used, but rearranged to reduce rounding errors. + This expression is always described as giving the GMST at + 0 hours UT. In fact, it gives the difference between the + GMST and the UT, which happens to equal the GMST (modulo + 24 hours) at 0 hours UT each day. In this routine, the + entire UT is used directly as the argument for the + standard formula, and the fractional part of the UT is + added separately; note that the factor 1.0027379... does + not appear. + + See also the routine slGMSA, which delivers better numerical + precision by accepting the UT date and time as separate arguments. + + Called: slDA2P + + P.T.Wallace Starlink 14 September 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/gmsta.hlp b/math/slalib/doc/gmsta.hlp new file mode 100644 index 00000000..e959d6cc --- /dev/null +++ b/math/slalib/doc/gmsta.hlp @@ -0,0 +1,55 @@ +.help gmsta Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slGMSA (DATE, UT) + + - - - - - - + G M S A + - - - - - - + + Conversion from Universal Time to Greenwich mean sidereal time, + with rounding errors minimized. + + double precision + + Given: + DATE d UT1 date (MJD: integer part of JD-2400000.5)) + UT d UT1 time (fraction of a day) + + The result is the Greenwich mean sidereal time (double precision, + radians, in the range 0 to 2pi). + + There is no restriction on how the UT is apportioned between the + DATE and UT arguments. Either of the two arguments could, for + example, be zero and the entire date+time supplied in the other. + However, the routine is designed to deliver maximum accuracy when + the DATE argument is a whole number and the UT lies in the range + 0 to 1 (or vice versa). + + The algorithm is based on the IAU 1982 expression (see page S15 of + the 1984 Astronomical Almanac). This is always described as giving + the GMST at 0 hours UT1. In fact, it gives the difference between + the GMST and the UT, the steady 4-minutes-per-day drawing-ahead of + ST with respect to UT. When whole days are ignored, the expression + happens to equal the GMST at 0 hours UT1 each day. + + In this routine, the entire UT1 (the sum of the two arguments DATE + and UT) is used directly as the argument for the standard formula. + The UT1 is then added, but omitting whole days to conserve accuracy. + + See also the routine slGMST, which accepts the UT as a single + argument. Compared with slGMST, the extra numerical precision + delivered by the present routine is unlikely to be important in + an absolute sense, but may be useful when critically comparing + algorithms and in applications where two sidereal times close + together are differenced. + + Called: slDA2P + + P.T.Wallace Starlink 13 April 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/h2e.hlp b/math/slalib/doc/h2e.hlp new file mode 100644 index 00000000..06fd4282 --- /dev/null +++ b/math/slalib/doc/h2e.hlp @@ -0,0 +1,58 @@ +.help h2e Jun99 "Slalib Package" +.nf + + SUBROUTINE slH2E (AZ, EL, PHI, HA, DEC) + + - - - - - + D E 2 H + - - - - - + + Horizon to equatorial coordinates: Az,El to HA,Dec + + (single precision) + + Given: + AZ r azimuth + EL r elevation + PHI r observatory latitude + + Returned: + HA r hour angle + DEC r declination + + Notes: + + 1) All the arguments are angles in radians. + + 2) The sign convention for azimuth is north zero, east +pi/2. + + 3) HA is returned in the range +/-pi. Declination is returned + in the range +/-pi/2. + + 4) The latitude is (in principle) geodetic. In critical + applications, corrections for polar motion should be applied. + + 5) In some applications it will be important to specify the + correct type of elevation in order to produce the required + type of HA,Dec. In particular, it may be important to + distinguish between the elevation as affected by refraction, + which will yield the "observed" HA,Dec, and the elevation + in vacuo, which will yield the "topocentric" HA,Dec. If the + effects of diurnal aberration can be neglected, the + topocentric HA,Dec may be used as an approximation to the + "apparent" HA,Dec. + + 6) No range checking of arguments is done. + + 7) In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude. + + P.T.Wallace Starlink 21 February 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/h2fk5.hlp b/math/slalib/doc/h2fk5.hlp new file mode 100644 index 00000000..158d9cfb --- /dev/null +++ b/math/slalib/doc/h2fk5.hlp @@ -0,0 +1,57 @@ +.help h2fk5 Jun99 "Slalib Package" +.nf + + SUBROUTINE slHFK5 (RH,DH,DRH,DDH,R5,D5,DR5,DD5) + + - - - - - - + H F K 5 + - - - - - - + + Transform Hipparcos star data into the FK5 (J2000) system. + + (double precision) + + This routine transforms Hipparcos star positions and proper + motions into FK5 J2000. + + Given (all Hipparcos, epoch J2000): + RH d RA (radians) + DH d Dec (radians) + DRH d proper motion in RA (dRA/dt, rad/Jyear) + DDH d proper motion in Dec (dDec/dt, rad/Jyear) + + Returned (all FK5, equinox J2000, epoch J2000): + R5 d RA (radians) + D5 d Dec (radians) + DR5 d proper motion in RA (dRA/dt, rad/Jyear) + DD5 d proper motion in Dec (dDec/dt, rad/Jyear) + + Called: slDSC6, slDAVM, slDMXV, slDIMV, slDVXV, + slDC6S + + Notes: + + 1) The proper motions in RA are dRA/dt rather than + cos(Dec)*dRA/dt, and are per year rather than per century. + + 2) The FK5 to Hipparcos transformation consists of a pure + rotation and spin; zonal errors in the FK5 catalogue are + not taken into account. + + 3) The published orientation and spin components are interpreted + as "axial vectors". An axial vector points at the pole of the + rotation and its length is the amount of rotation in radians. + + 4) See also slFK5H, slF5HZ, slHF5Z. + + Reference: + + M.Feissel & F.Mignard, Astron. Astrophys. 331, L33-L36 (1998). + + P.T.Wallace Starlink 7 October 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/hfk5z.hlp b/math/slalib/doc/hfk5z.hlp new file mode 100644 index 00000000..a2bea786 --- /dev/null +++ b/math/slalib/doc/hfk5z.hlp @@ -0,0 +1,60 @@ +.help hfk5z Jun99 "Slalib Package" +.nf + + SUBROUTINE slHF5Z (RH,DH,EPOCH,R5,D5,DR5,DD5) + + - - - - - - + H F 5 Z + - - - - - - + + Transform a Hipparcos star position into FK5 J2000, assuming + zero Hipparcos proper motion. + + (double precision) + + Given: + RH d Hipparcos RA (radians) + DH d Hipparcos Dec (radians) + EPOCH d Julian epoch (TDB) + + Returned (all FK5, equinox J2000, epoch EPOCH): + R5 d RA (radians) + D5 d Dec (radians) + + Called: slDS2C, slDAVM, slDMXV, slDAVM, slDMXM, + slDIMV, slDVXV, slDC6S + + Notes: + + 1) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt. + + 2) The FK5 to Hipparcos transformation consists of a pure + rotation and spin; zonal errors in the FK5 catalogue are + not taken into account. + + 3) The published orientation and spin components are interpreted + as "axial vectors". An axial vector points at the pole of the + rotation and its length is the amount of rotation in radians. + + 4) It was the intention that Hipparcos should be a close + approximation to an inertial frame, so that distant objects + have zero proper motion; such objects have (in general) + non-zero proper motion in FK5, and this routine returns those + fictitious proper motions. + + 5) The position returned by this routine is in the FK5 J2000 + reference frame but at Julian epoch EPOCH. + + 6) See also slFK5H, slHFK5, slF5HZ. + + Reference: + + M.Feissel & F.Mignard, Astron. Astrophys. 331, L33-L36 (1998). + + P.T.Wallace Starlink 7 October 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/imxv.hlp b/math/slalib/doc/imxv.hlp new file mode 100644 index 00000000..025c7122 --- /dev/null +++ b/math/slalib/doc/imxv.hlp @@ -0,0 +1,32 @@ +.help imxv Jun99 "Slalib Package" +.nf + + SUBROUTINE slIMXV (RM, VA, VB) + + - - - - - + I M X V + - - - - - + + Performs the 3-D backward unitary transformation: + + vector VB = (inverse of matrix RM) * vector VA + + (single precision) + + (n.b. the matrix must be unitary, as this routine assumes that + the inverse and transpose are identical) + + Given: + RM real(3,3) matrix + VA real(3) vector + + Returned: + VB real(3) result vector + + P.T.Wallace Starlink November 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/intin.hlp b/math/slalib/doc/intin.hlp new file mode 100644 index 00000000..f0b0c8ee --- /dev/null +++ b/math/slalib/doc/intin.hlp @@ -0,0 +1,90 @@ +.help intin Jun99 "Slalib Package" +.nf + + SUBROUTINE slINTI (STRING, NSTRT, IRESLT, JFLAG) + + - - - - - - + I N T I + - - - - - - + + Convert free-format input into an integer + + Given: + STRING c string containing number to be decoded + NSTRT i pointer to where decoding is to start + IRESLT i current value of result + + Returned: + NSTRT i advanced to next number + IRESLT i result + JFLAG i status: -1 = -OK, 0 = +OK, 1 = null, 2 = error + + Called: slICHI + + Notes: + + 1 The reason INTIN has separate OK status values for + + and - is to enable minus zero to be detected. This is + of crucial importance when decoding mixed-radix numbers. + For example, an angle expressed as deg, arcmin, arcsec + may have a leading minus sign but a zero degrees field. + + 2 A TAB is interpreted as a space. + + 3 The basic format is the sequence of fields #^, where + # is a sign character + or -, and ^ means a string of + decimal digits. + + 4 Spaces: + + . Leading spaces are ignored. + + . Spaces between the sign and the number are allowed. + + . Trailing spaces are ignored; the first signifies + end of decoding and subsequent ones are skipped. + + 5 Delimiters: + + . Any character other than +,-,0-9 or space may be + used to signal the end of the number and terminate + decoding. + + . Comma is recognized by INTIN as a special case; it + is skipped, leaving the pointer on the next character. + See 9, below. + + 6 The sign is optional. The default is +. + + 7 A "null result" occurs when the string of characters being + decoded does not begin with +,- or 0-9, or consists + entirely of spaces. When this condition is detected, JFLAG + is set to 1 and IRESLT is left untouched. + + 8 NSTRT = 1 for the first character in the string. + + 9 On return from INTIN, NSTRT is set ready for the next + decode - following trailing blanks and any comma. If a + delimiter other than comma is being used, NSTRT must be + incremented before the next call to INTIN, otherwise + all subsequent calls will return a null result. + + 10 Errors (JFLAG=2) occur when: + + . there is a + or - but no number; or + + . the number is greater than BIG (defined below). + + 11 When an error has been detected, NSTRT is left + pointing to the character following the last + one used before the error came to light. + + 12 See also FLOTIN and DFLTIN. + + P.T.Wallace Starlink 27 April 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/invf.hlp b/math/slalib/doc/invf.hlp new file mode 100644 index 00000000..e1d8588e --- /dev/null +++ b/math/slalib/doc/invf.hlp @@ -0,0 +1,66 @@ +.help invf Jun99 "Slalib Package" +.nf + + SUBROUTINE slINVF (FWDS,BKWDS,J) + + - - - - - + I N V F + - - - - - + + Invert a linear model of the type produced by the + slFTXY routine. + + Given: + FWDS d(6) model coefficients + + Returned: + BKWDS d(6) inverse model + J i status: 0 = OK, -1 = no inverse + + The models relate two sets of [X,Y] coordinates as follows. + Naming the elements of FWDS: + + FWDS(1) = A + FWDS(2) = B + FWDS(3) = C + FWDS(4) = D + FWDS(5) = E + FWDS(6) = F + + where two sets of coordinates [X1,Y1] and [X2,Y1] are related + thus: + + X2 = A + B*X1 + C*Y1 + Y2 = D + E*X1 + F*Y1 + + the present routine generates a new set of coefficients: + + BKWDS(1) = P + BKWDS(2) = Q + BKWDS(3) = R + BKWDS(4) = S + BKWDS(5) = T + BKWDS(6) = U + + such that: + + X1 = P + Q*X2 + R*Y2 + Y1 = S + T*X2 + U*Y2 + + Two successive calls to slINVF will thus deliver a set + of coefficients equal to the starting values. + + To comply with the ANSI Fortran standard, FWDS and BKWDS must + not be the same array, even though the routine is coded to + work on the VAX and most other computers even if this rule + is violated. + + See also slFTXY, slPXY, slXYXY, slDCMF + + P.T.Wallace Starlink 11 April 1990 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/kbj.hlp b/math/slalib/doc/kbj.hlp new file mode 100644 index 00000000..519868a7 --- /dev/null +++ b/math/slalib/doc/kbj.hlp @@ -0,0 +1,28 @@ +.help kbj Jun99 "Slalib Package" +.nf + + SUBROUTINE slKBJ (JB, E, K, J) + + - - - - + K B J + - - - - + + Select epoch prefix 'B' or 'J' + + Given: + JB int slDBJI prefix status: 0=none, 1='B', 2='J' + E dp epoch - Besselian or Julian + + Returned: + K char 'B' or 'J' + J int status: 0=OK + + If JB=0, B is assumed for E < 1984D0, otherwise J. + + P.T.Wallace Starlink 31 July 1989 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/m2av.hlp b/math/slalib/doc/m2av.hlp new file mode 100644 index 00000000..51d04343 --- /dev/null +++ b/math/slalib/doc/m2av.hlp @@ -0,0 +1,38 @@ +.help m2av Jun99 "Slalib Package" +.nf + + SUBROUTINE slM2AV (RMAT, AXVEC) + + - - - - - + M 2 A V + - - - - - + + From a rotation matrix, determine the corresponding axial vector + (single precision) + + A rotation matrix describes a rotation about some arbitrary axis. + The axis is called the Euler axis, and the angle through which the + reference frame rotates is called the Euler angle. The axial + vector returned by this routine has the same direction as the + Euler axis, and its magnitude is the Euler angle in radians. (The + magnitude and direction can be separated by means of the routine + slVN.) + + Given: + RMAT r(3,3) rotation matrix + + Returned: + AXVEC r(3) axial vector (radians) + + The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + + If RMAT is null, so is the result. + + P.T.Wallace Starlink 11 April 1990 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/map.hlp b/math/slalib/doc/map.hlp new file mode 100644 index 00000000..4a66189b --- /dev/null +++ b/math/slalib/doc/map.hlp @@ -0,0 +1,65 @@ +.help map Jun99 "Slalib Package" +.nf + + SUBROUTINE slMAP (RM, DM, PR, PD, PX, RV, EQ, DATE, RA, DA) + + - - - - + M A P + - - - - + + Transform star RA,Dec from mean place to geocentric apparent + + The reference frames and timescales used are post IAU 1976. + + References: + 1984 Astronomical Almanac, pp B39-B41. + (also Lederle & Schwan, Astron. Astrophys. 134, + 1-6, 1984) + + Given: + RM,DM dp mean RA,Dec (rad) + PR,PD dp proper motions: RA,Dec changes per Julian year + PX dp parallax (arcsec) + RV dp radial velocity (km/sec, +ve if receding) + EQ dp epoch and equinox of star data (Julian) + DATE dp TDB for apparent place (JD-2400000.5) + + Returned: + RA,DA dp apparent RA,Dec (rad) + + Called: + slMAPA star-independent parameters + slMAPQ quick mean to apparent + + Notes: + + 1) EQ is the Julian epoch specifying both the reference + frame and the epoch of the position - usually 2000. + For positions where the epoch and equinox are + different, use the routine slPM to apply proper + motion corrections before using this routine. + + 2) The distinction between the required TDB and TT is + always negligible. Moreover, for all but the most + critical applications UTC is adequate. + + 3) The proper motions in RA are dRA/dt rather than + cos(Dec)*dRA/dt. + + 4) This routine may be wasteful for some applications + because it recomputes the Earth position/velocity and + the precession/nutation matrix each time, and because + it allows for parallax and proper motion. Where + multiple transformations are to be carried out for one + epoch, a faster method is to call the slMAPA routine + once and then either the slMAPQ routine (which includes + parallax and proper motion) or slMAPZ (which assumes + zero parallax and proper motion). + + P.T.Wallace Starlink 19 January 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/mappa.hlp b/math/slalib/doc/mappa.hlp new file mode 100644 index 00000000..7a2bf727 --- /dev/null +++ b/math/slalib/doc/mappa.hlp @@ -0,0 +1,69 @@ +.help mappa Jun99 "Slalib Package" +.nf + + SUBROUTINE slMAPA (EQ, DATE, AMPRMS) + + - - - - - - + M A P A + - - - - - - + + Compute star-independent parameters in preparation for + conversions between mean place and geocentric apparent place. + + The parameters produced by this routine are required in the + parallax, light deflection, aberration, and precession/nutation + parts of the mean/apparent transformations. + + The reference frames and timescales used are post IAU 1976. + + Given: + EQ d epoch of mean equinox to be used (Julian) + DATE d TDB (JD-2400000.5) + + Returned: + AMPRMS d(21) star-independent mean-to-apparent parameters: + + (1) time interval for proper motion (Julian years) + (2-4) barycentric position of the Earth (AU) + (5-7) heliocentric direction of the Earth (unit vector) + (8) (grav rad Sun)*2/(Sun-Earth distance) + (9-11) ABV: barycentric Earth velocity in units of c + (12) sqrt(1-v**2) where v=modulus(ABV) + (13-21) precession/nutation (3,3) matrix + + References: + 1984 Astronomical Almanac, pp B39-B41. + (also Lederle & Schwan, Astron. Astrophys. 134, + 1-6, 1984) + + Notes: + + 1) For DATE, the distinction between the required TDB and TT + is always negligible. Moreover, for all but the most + critical applications UTC is adequate. + + 2) The accuracy of the routines using the parameters AMPRMS is + limited by the routine slEVP, used here to compute the + Earth position and velocity by the methods of Stumpff. + The maximum error in the resulting aberration corrections is + about 0.3 milliarcsecond. + + 3) The vectors AMPRMS(2-4) and AMPRMS(5-7) are referred to + the mean equinox and equator of epoch EQ. + + 4) The parameters AMPRMS produced by this routine are used by + slMAPQ and slMAPZ. + + Called: + slEPJ MDJ to Julian epoch + slEVP earth position & velocity + slDVN normalize vector + slPRNU precession/nutation matrix + + P.T.Wallace Starlink 23 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/mapqk.hlp b/math/slalib/doc/mapqk.hlp new file mode 100644 index 00000000..adfa1f3d --- /dev/null +++ b/math/slalib/doc/mapqk.hlp @@ -0,0 +1,76 @@ +.help mapqk Jun99 "Slalib Package" +.nf + + SUBROUTINE slMAPQ (RM, DM, PR, PD, PX, RV, AMPRMS, RA, DA) + + - - - - - - + M A P Q + - - - - - - + + Quick mean to apparent place: transform a star RA,Dec from + mean place to geocentric apparent place, given the + star-independent parameters. + + Use of this routine is appropriate when efficiency is important + and where many star positions, all referred to the same equator + and equinox, are to be transformed for one epoch. The + star-independent parameters can be obtained by calling the + slMAPA routine. + + If the parallax and proper motions are zero the slMAPZ + routine can be used instead. + + The reference frames and timescales used are post IAU 1976. + + Given: + RM,DM d mean RA,Dec (rad) + PR,PD d proper motions: RA,Dec changes per Julian year + PX d parallax (arcsec) + RV d radial velocity (km/sec, +ve if receding) + + AMPRMS d(21) star-independent mean-to-apparent parameters: + + (1) time interval for proper motion (Julian years) + (2-4) barycentric position of the Earth (AU) + (5-7) heliocentric direction of the Earth (unit vector) + (8) (grav rad Sun)*2/(Sun-Earth distance) + (9-11) barycentric Earth velocity in units of c + (12) sqrt(1-v**2) where v=modulus(ABV) + (13-21) precession/nutation (3,3) matrix + + Returned: + RA,DA d apparent RA,Dec (rad) + + References: + 1984 Astronomical Almanac, pp B39-B41. + (also Lederle & Schwan, Astron. Astrophys. 134, + 1-6, 1984) + + Notes: + + 1) The vectors AMPRMS(2-4) and AMPRMS(5-7) are referred to + the mean equinox and equator of epoch EQ. + + 2) Strictly speaking, the routine is not valid for solar-system + sources, though the error will usually be extremely small. + However, to prevent gross errors in the case where the + position of the Sun is specified, the gravitational + deflection term is restrained within about 920 arcsec of the + centre of the Sun's disc. The term has a maximum value of + about 1.85 arcsec at this radius, and decreases to zero as + the centre of the disc is approached. + + Called: + slDS2C spherical to Cartesian + slDVDV dot product + slDMXV matrix x vector + slDC2S Cartesian to spherical + slDA2P normalize angle 0-2Pi + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/mapqkz.hlp b/math/slalib/doc/mapqkz.hlp new file mode 100644 index 00000000..2ca9b493 --- /dev/null +++ b/math/slalib/doc/mapqkz.hlp @@ -0,0 +1,68 @@ +.help mapqkz Jun99 "Slalib Package" +.nf + + SUBROUTINE slMAPZ (RM, DM, AMPRMS, RA, DA) + + - - - - - - - + M A P Z + - - - - - - - + + Quick mean to apparent place: transform a star RA,Dec from + mean place to geocentric apparent place, given the + star-independent parameters, and assuming zero parallax + and proper motion. + + Use of this routine is appropriate when efficiency is important + and where many star positions, all with parallax and proper + motion either zero or already allowed for, and all referred to + the same equator and equinox, are to be transformed for one + epoch. The star-independent parameters can be obtained by + calling the slMAPA routine. + + The corresponding routine for the case of non-zero parallax + and proper motion is slMAPQ. + + The reference frames and timescales used are post IAU 1976. + + Given: + RM,DM d mean RA,Dec (rad) + AMPRMS d(21) star-independent mean-to-apparent parameters: + + (1-4) not used + (5-7) heliocentric direction of the Earth (unit vector) + (8) (grav rad Sun)*2/(Sun-Earth distance) + (9-11) ABV: barycentric Earth velocity in units of c + (12) sqrt(1-v**2) where v=modulus(ABV) + (13-21) precession/nutation (3,3) matrix + + Returned: + RA,DA d apparent RA,Dec (rad) + + References: + 1984 Astronomical Almanac, pp B39-B41. + (also Lederle & Schwan, Astron. Astrophys. 134, + 1-6, 1984) + + Notes: + + 1) The vectors AMPRMS(2-4) and AMPRMS(5-7) are referred to the + mean equinox and equator of epoch EQ. + + 2) Strictly speaking, the routine is not valid for solar-system + sources, though the error will usually be extremely small. + However, to prevent gross errors in the case where the + position of the Sun is specified, the gravitational + deflection term is restrained within about 920 arcsec of the + centre of the Sun's disc. The term has a maximum value of + about 1.85 arcsec at this radius, and decreases to zero as + the centre of the disc is approached. + + Called: slDS2C, slDVDV, slDMXV, slDC2S, slDA2P + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/moon.hlp b/math/slalib/doc/moon.hlp new file mode 100644 index 00000000..403984eb --- /dev/null +++ b/math/slalib/doc/moon.hlp @@ -0,0 +1,59 @@ +.help moon Jun99 "Slalib Package" +.nf + + SUBROUTINE slMOON (IY, ID, FD, PV) + + - - - - - + M O O N + - - - - - + + Approximate geocentric position and velocity of the Moon + (single precision). + + Given: + IY i year + ID i day in year (1 = Jan 1st) + FD r fraction of day + + Returned: + PV r(6) Moon position & velocity vector + + Notes: + + 1 The date and time is TDB (loosely ET) in a Julian calendar + which has been aligned to the ordinary Gregorian + calendar for the interval 1900 March 1 to 2100 February 28. + The year and day can be obtained by calling slCAYD or + slCLYD. + + 2 The Moon 6-vector is Moon centre relative to Earth centre, + mean equator and equinox of date. Position part, PV(1-3), + is in AU; velocity part, PV(4-6), is in AU/sec. + + 3 The position is accurate to better than 0.5 arcminute + in direction and 1000 km in distance. The velocity + is accurate to better than 0.5"/hour in direction and + 4 m/s in distance. (RMS figures with respect to JPL DE200 + for the interval 1960-2025 are 14 arcsec and 0.2 arcsec/hour in + longitude, 9 arcsec and 0.2 arcsec/hour in latitude, 350 km and + 2 m/s in distance.) Note that the distance accuracy is + comparatively poor because this routine is principally intended + for computing topocentric direction. + + 4 This routine is only a partial implementation of the original + Meeus algorithm (reference below), which offers 4 times the + accuracy in direction and 30 times the accuracy in distance + when fully implemented (as it is in slDMON). + + Reference: + Meeus, l'Astronomie, June 1984, p348. + + Called: slS2C6 + + P.T.Wallace Starlink 8 December 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/mxm.hlp b/math/slalib/doc/mxm.hlp new file mode 100644 index 00000000..7ee561e4 --- /dev/null +++ b/math/slalib/doc/mxm.hlp @@ -0,0 +1,33 @@ +.help mxm Jun99 "Slalib Package" +.nf + + SUBROUTINE slMXM (A, B, C) + + - - - - + M X M + - - - - + + Product of two 3x3 matrices: + matrix C = matrix A x matrix B + + (single precision) + + Given: + A real(3,3) matrix + B real(3,3) matrix + + Returned: + C real(3,3) matrix result + + To comply with the ANSI Fortran 77 standard, A, B and C must + be different arrays. However, the routine is coded so as to + work properly on the VAX and many other systems even if this + rule is violated. + + P.T.Wallace Starlink 5 April 1990 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/mxv.hlp b/math/slalib/doc/mxv.hlp new file mode 100644 index 00000000..bacba504 --- /dev/null +++ b/math/slalib/doc/mxv.hlp @@ -0,0 +1,29 @@ +.help mxv Jun99 "Slalib Package" +.nf + + SUBROUTINE slMXV (RM, VA, VB) + + - - - - + M X V + - - - - + + Performs the 3-D forward unitary transformation: + + vector VB = matrix RM * vector VA + + (single precision) + + Given: + RM real(3,3) matrix + VA real(3) vector + + Returned: + VB real(3) result vector + + P.T.Wallace Starlink March 1986 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/nut.hlp b/math/slalib/doc/nut.hlp new file mode 100644 index 00000000..95ea2ff0 --- /dev/null +++ b/math/slalib/doc/nut.hlp @@ -0,0 +1,34 @@ +.help nut Jun99 "Slalib Package" +.nf + + SUBROUTINE slNUT (DATE, RMATN) + + - - - - + N U T + - - - - + + Form the matrix of nutation for a given date - IAU 1980 theory + (double precision) + + References: + Final report of the IAU Working Group on Nutation, + chairman P.K.Seidelmann, 1980. + Kaplan,G.H., 1981, USNO circular no. 163, pA3-6. + + Given: + DATE dp TDB (loosely ET) as Modified Julian Date + (=JD-2400000.5) + Returned: + RMATN dp(3,3) nutation matrix + + The matrix is in the sense V(true) = RMATN * V(mean) + + Called: slNUTC, slDEUL + + P.T.Wallace Starlink 1 January 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/nutc.hlp b/math/slalib/doc/nutc.hlp new file mode 100644 index 00000000..b028219d --- /dev/null +++ b/math/slalib/doc/nutc.hlp @@ -0,0 +1,33 @@ +.help nutc Jun99 "Slalib Package" +.nf + + SUBROUTINE slNUTC (DATE, DPSI, DEPS, EPS0) + + - - - - - + N U T C + - - - - - + + Nutation: longitude & obliquity components and mean + obliquity - IAU 1980 theory (double precision) + + Given: + + DATE dp TDB (loosely ET) as Modified Julian Date + (JD-2400000.5) + Returned: + + DPSI,DEPS dp nutation in longitude,obliquity + EPS0 dp mean obliquity + + References: + Final report of the IAU Working Group on Nutation, + chairman P.K.Seidelmann, 1980. + Kaplan,G.H., 1981, USNO circular no. 163, pA3-6. + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/oap.hlp b/math/slalib/doc/oap.hlp new file mode 100644 index 00000000..7322c0ee --- /dev/null +++ b/math/slalib/doc/oap.hlp @@ -0,0 +1,163 @@ +.help oap Jun99 "Slalib Package" +.nf + + SUBROUTINE slOAP (TYPE, OB1, OB2, DATE, DUT, ELONGM, PHIM, + : HM, XP, YP, TDK, PMB, RH, WL, TLR, + : RAP, DAP) + + - - - - + O A P + - - - - + + Observed to apparent place + + Given: + TYPE c*(*) type of coordinates - 'R', 'H' or 'A' (see below) + OB1 d observed Az, HA or RA (radians; Az is N=0,E=90) + OB2 d observed ZD or Dec (radians) + DATE d UTC date/time (modified Julian Date, JD-2400000.5) + DUT d delta UT: UT1-UTC (UTC seconds) + ELONGM d mean longitude of the observer (radians, east +ve) + PHIM d mean geodetic latitude of the observer (radians) + HM d observer's height above sea level (metres) + XP d polar motion x-coordinate (radians) + YP d polar motion y-coordinate (radians) + TDK d local ambient temperature (DegK; std=273.155D0) + PMB d local atmospheric pressure (mB; std=1013.25D0) + RH d local relative humidity (in the range 0D0-1D0) + WL d effective wavelength (micron, e.g. 0.55D0) + TLR d tropospheric lapse rate (DegK/metre, e.g. 0.0065D0) + + Returned: + RAP d geocentric apparent right ascension + DAP d geocentric apparent declination + + Notes: + + 1) Only the first character of the TYPE argument is significant. + 'R' or 'r' indicates that OBS1 and OBS2 are the observed Right + Ascension and Declination; 'H' or 'h' indicates that they are + Hour Angle (West +ve) and Declination; anything else ('A' or + 'a' is recommended) indicates that OBS1 and OBS2 are Azimuth + (North zero, East is 90 deg) and zenith distance. (Zenith + distance is used rather than elevation in order to reflect the + fact that no allowance is made for depression of the horizon.) + + 2) The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted apparent RA,Dec should be within about 0.1 arcsec + for a zenith distance of less than 70 degrees. Even at a + topocentric zenith distance of 90 degrees, the accuracy in + elevation should be better than 1 arcmin; useful results + are available for a further 3 degrees, beyond which the + slRFRO routine returns a fixed value of the refraction. + The complementary routines slAOP (or slAOPQ) and slOAP + (or slOAPQ) are self-consistent to better than 1 micro- + arcsecond all over the celestial sphere. + + 3) It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + + 4) "Observed" Az,El means the position that would be seen by a + perfect theodolite located at the observer. This is + related to the observed HA,Dec via the standard rotation, using + the geodetic latitude (corrected for polar motion), while the + observed HA and RA are related simply through the local + apparent ST. "Observed" RA,Dec or HA,Dec thus means the + position that would be seen by a perfect equatorial located + at the observer and with its polar axis aligned to the + Earth's axis of rotation (n.b. not to the refracted pole). + By removing from the observed place the effects of + atmospheric refraction and diurnal aberration, the + geocentric apparent RA,Dec is obtained. + + 5) Frequently, mean rather than apparent RA,Dec will be required, + in which case further transformations will be necessary. The + slAMP etc routines will convert the apparent RA,Dec produced + by the present routine into an "FK5" (J2000) mean place, by + allowing for the Sun's gravitational lens effect, annual + aberration, nutation and precession. Should "FK4" (1950) + coordinates be needed, the routines slFK54 etc will also + need to be applied. + + 6) To convert to apparent RA,Dec the coordinates read from a + real telescope, corrections would have to be applied for + encoder zero points, gear and encoder errors, tube flexure, + the position of the rotator axis and the pointing axis + relative to it, non-perpendicularity between the mounting + axes, and finally for the tilt of the azimuth or polar axis + of the mounting (with appropriate corrections for mount + flexures). Some telescopes would, of course, exhibit other + properties which would need to be accounted for at the + appropriate point in the sequence. + + 7) The star-independent apparent-to-observed-place parameters + in AOPRMS may be computed by means of the slAOPA routine. + If nothing has changed significantly except the time, the + slAOPT routine may be used to perform the requisite + partial recomputation of AOPRMS. + + 8) The DATE argument is UTC expressed as an MJD. This is, + strictly speaking, wrong, because of leap seconds. However, + as long as the delta UT and the UTC are consistent there + are no difficulties, except during a leap second. In this + case, the start of the 61st second of the final minute should + begin a new MJD day and the old pre-leap delta UT should + continue to be used. As the 61st second completes, the MJD + should revert to the start of the day as, simultaneously, + the delta UTC changes by one second to its post-leap new value. + + 9) The delta UT (UT1-UTC) is tabulated in IERS circulars and + elsewhere. It increases by exactly one second at the end of + each UTC leap second, introduced in order to keep delta UT + within +/- 0.9 seconds. + + 10) IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. + The longitude required by the present routine is east-positive, + in accordance with geographical convention (and right-handed). + In particular, note that the longitudes returned by the + slOBS routine are west-positive, following astronomical + usage, and must be reversed in sign before use in the present + routine. + + 11) The polar coordinates XP,YP can be obtained from IERS + circulars and equivalent publications. The maximum amplitude + is about 0.3 arcseconds. If XP,YP values are unavailable, + use XP=YP=0D0. See page B60 of the 1988 Astronomical Almanac + for a definition of the two angles. + + 12) The height above sea level of the observing station, HM, + can be obtained from the Astronomical Almanac (Section J + in the 1988 edition), or via the routine slOBS. If P, + the pressure in millibars, is available, an adequate + estimate of HM can be obtained from the expression + + HM ~ -29.3D0*TSL*LOG(P/1013.25D0). + + where TSL is the approximate sea-level air temperature in + deg K (see Astrophysical Quantities, C.W.Allen, 3rd edition, + section 52.) Similarly, if the pressure P is not known, + it can be estimated from the height of the observing + station, HM as follows: + + P ~ 1013.25D0*EXP(-HM/(29.3D0*TSL)). + + Note, however, that the refraction is proportional to the + pressure and that an accurate P value is important for + precise work. + + 13) The azimuths etc used by the present routine are with respect + to the celestial pole. Corrections from the terrestrial pole + can be computed using slPLMO. + + Called: slAOPA, slOAPQ + + P.T.Wallace Starlink 9 June 1998 + + Copyright (C) 1998 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/oapqk.hlp b/math/slalib/doc/oapqk.hlp new file mode 100644 index 00000000..70a37f86 --- /dev/null +++ b/math/slalib/doc/oapqk.hlp @@ -0,0 +1,114 @@ +.help oapqk Jun99 "Slalib Package" +.nf + + SUBROUTINE slOAPQ (TYPE, OB1, OB2, AOPRMS, RAP, DAP) + + - - - - - - + O A P Q + - - - - - - + + Quick observed to apparent place + + Given: + TYPE c*(*) type of coordinates - 'R', 'H' or 'A' (see below) + OB1 d observed Az, HA or RA (radians; Az is N=0,E=90) + OB2 d observed ZD or Dec (radians) + AOPRMS d(14) star-independent apparent-to-observed parameters: + + (1) geodetic latitude (radians) + (2,3) sine and cosine of geodetic latitude + (4) magnitude of diurnal aberration vector + (5) height (HM) + (6) ambient temperature (T) + (7) pressure (P) + (8) relative humidity (RH) + (9) wavelength (WL) + (10) lapse rate (TLR) + (11,12) refraction constants A and B (radians) + (13) longitude + eqn of equinoxes + sidereal DUT (radians) + (14) local apparent sidereal time (radians) + + Returned: + RAP d geocentric apparent right ascension + DAP d geocentric apparent declination + + Notes: + + 1) Only the first character of the TYPE argument is significant. + 'R' or 'r' indicates that OBS1 and OBS2 are the observed Right + Ascension and Declination; 'H' or 'h' indicates that they are + Hour Angle (West +ve) and Declination; anything else ('A' or + 'a' is recommended) indicates that OBS1 and OBS2 are Azimuth + (North zero, East is 90 deg) and zenith distance. (Zenith + distance is used rather than elevation in order to reflect the + fact that no allowance is made for depression of the horizon.) + + 2) The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted apparent RA,Dec should be within about 0.1 arcsec + for a zenith distance of less than 70 degrees. Even at a + topocentric zenith distance of 90 degrees, the accuracy in + elevation should be better than 1 arcmin; useful results + are available for a further 3 degrees, beyond which the + slRFRO routine returns a fixed value of the refraction. + The complementary routines slAOP (or slAOPQ) and slOAP + (or slOAPQ) are self-consistent to better than 1 micro- + arcsecond all over the celestial sphere. + + 3) It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + + 5) "Observed" Az,El means the position that would be seen by a + perfect theodolite located at the observer. This is + related to the observed HA,Dec via the standard rotation, using + the geodetic latitude (corrected for polar motion), while the + observed HA and RA are related simply through the local + apparent ST. "Observed" RA,Dec or HA,Dec thus means the + position that would be seen by a perfect equatorial located + at the observer and with its polar axis aligned to the + Earth's axis of rotation (n.b. not to the refracted pole). + By removing from the observed place the effects of + atmospheric refraction and diurnal aberration, the + geocentric apparent RA,Dec is obtained. + + 5) Frequently, mean rather than apparent RA,Dec will be required, + in which case further transformations will be necessary. The + slAMP etc routines will convert the apparent RA,Dec produced + by the present routine into an "FK5" (J2000) mean place, by + allowing for the Sun's gravitational lens effect, annual + aberration, nutation and precession. Should "FK4" (1950) + coordinates be needed, the routines slFK54 etc will also + need to be applied. + + 6) To convert to apparent RA,Dec the coordinates read from a + real telescope, corrections would have to be applied for + encoder zero points, gear and encoder errors, tube flexure, + the position of the rotator axis and the pointing axis + relative to it, non-perpendicularity between the mounting + axes, and finally for the tilt of the azimuth or polar axis + of the mounting (with appropriate corrections for mount + flexures). Some telescopes would, of course, exhibit other + properties which would need to be accounted for at the + appropriate point in the sequence. + + 7) The star-independent apparent-to-observed-place parameters + in AOPRMS may be computed by means of the slAOPA routine. + If nothing has changed significantly except the time, the + slAOPT routine may be used to perform the requisite + partial recomputation of AOPRMS. + + 8) The azimuths etc used by the present routine are with respect + to the celestial pole. Corrections from the terrestrial pole + can be computed using slPLMO. + + Called: slDS2C, slDC2S, slRFRO, slDA2P + + P.T.Wallace Starlink 23 June 1997 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/obs.hlp b/math/slalib/doc/obs.hlp new file mode 100644 index 00000000..bce6404e --- /dev/null +++ b/math/slalib/doc/obs.hlp @@ -0,0 +1,83 @@ +.help obs Jun99 "Slalib Package" +.nf + + SUBROUTINE slOBS (N, C, NAME, W, P, H) + + - - - - + O B S + - - - - + + Parameters of selected groundbased observing stations + + Given: + N int number specifying observing station + + Either given or returned + C c*(*) identifier specifying observing station + + Returned: + NAME c*(*) name of specified observing station + W dp longitude (radians, West +ve) + P dp geodetic latitude (radians, North +ve) + H dp height above sea level (metres) + + Notes: + + Station identifiers C may be up to 10 characters long, + and station names NAME may be up to 40 characters long. + + C and N are alternative ways of specifying the observing + station. The C option, which is the most generally useful, + may be selected by specifying an N value of zero or less. + If N is 1 or more, the parameters of the Nth station + in the currently supported list are interrogated, and + the station identifier C is returned as well as NAME, W, + P and H. + + If the station parameters are not available, either because + the station identifier C is not recognized, or because an + N value greater than the number of stations supported is + given, a name of '?' is returned and C, W, P and H are left + in their current states. + + Programs can obtain a list of all currently supported + stations by calling the routine repeatedly, with N=1,2,3... + When NAME='?' is seen, the list of stations has been + exhausted. + + Station numbers, identifiers, names and other details are + subject to change and should not be hardwired into + application programs. + + All station identifiers C are uppercase only; lowercase + characters must be converted to uppercase by the calling + program. The station names returned may contain both upper- + and lowercase. All characters up to the first space are + checked; thus an abbreviated ID will return the parameters + for the first station in the list which matches the + abbreviation supplied, and no station in the list will ever + contain embedded spaces. C must not have leading spaces. + + IMPORTANT -- BEWARE OF THE LONGITUDE SIGN CONVENTION. The + longitude returned by slOBS is west-positive in accordance + with astronomical usage. However, this sign convention is + left-handed and is the opposite of the one used by geographers; + elsewhere in SLALIB the preferable east-positive convention is + used. In particular, note that for use in slAOP, slAOPA + and slOAP the sign of the longitude must be reversed. + + Users are urged to inform the author of any improvements + they would like to see made. For example: + + typographical corrections + more accurate parameters + better station identifiers or names + additional stations + + P.T.Wallace Starlink 21 April 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pa.hlp b/math/slalib/doc/pa.hlp new file mode 100644 index 00000000..a7ee7357 --- /dev/null +++ b/math/slalib/doc/pa.hlp @@ -0,0 +1,36 @@ +.help pa Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slPA (HA, DEC, PHI) + + - - - + P A + - - - + + HA, Dec to Parallactic Angle (double precision) + + Given: + HA d hour angle in radians (geocentric apparent) + DEC d declination in radians (geocentric apparent) + PHI d observatory latitude in radians (geodetic) + + The result is in the range -pi to +pi + + Notes: + + 1) The parallactic angle at a point in the sky is the position + angle of the vertical, i.e. the angle between the direction to + the pole and to the zenith. In precise applications care must + be taken only to use geocentric apparent HA,Dec and to consider + separately the effects of atmospheric refraction and telescope + mount errors. + + 2) At the pole a zero result is returned. + + P.T.Wallace Starlink 16 August 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pav.hlp b/math/slalib/doc/pav.hlp new file mode 100644 index 00000000..a74d3ca3 --- /dev/null +++ b/math/slalib/doc/pav.hlp @@ -0,0 +1,40 @@ +.help pav Jun99 "Slalib Package" +.nf + + REAL FUNCTION slPAV ( V1, V2 ) + + - - - - + P A V + - - - - + + Position angle of one celestial direction with respect to another. + + (single precision) + + Given: + V1 r(3) direction cosines of one point + V2 r(3) direction cosines of the other point + + (The coordinate frames correspond to RA,Dec, Long,Lat etc.) + + The result is the bearing (position angle), in radians, of point + V2 with respect to point V1. It is in the range +/- pi. The + sense is such that if V2 is a small distance east of V1, the + bearing is about +pi/2. Zero is returned if the two points + are coincident. + + V1 and V2 do not have to be unit vectors. + + The routine slBEAR performs an equivalent function except + that the points are specified in the form of spherical + coordinates. + + Called: slDPAV + + Patrick Wallace Starlink 23 May 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pcd.hlp b/math/slalib/doc/pcd.hlp new file mode 100644 index 00000000..dd6263a4 --- /dev/null +++ b/math/slalib/doc/pcd.hlp @@ -0,0 +1,51 @@ +.help pcd Jun99 "Slalib Package" +.nf + + SUBROUTINE slPCD (DISCO,X,Y) + + - - - - + P C D + - - - - + + Apply pincushion/barrel distortion to a tangent-plane [x,y]. + + Given: + DISCO d pincushion/barrel distortion coefficient + X,Y d tangent-plane coordinates + + Returned: + X,Y d distorted coordinates + + Notes: + + 1) The distortion is of the form RP = R*(1 + C*R**2), where R is + the radial distance from the tangent point, C is the DISCO + argument, and RP is the radial distance in the presence of + the distortion. + + 2) For pincushion distortion, C is +ve; for barrel distortion, + C is -ve. + + 3) For X,Y in units of one projection radius (in the case of + a photographic plate, the focal length), the following + DISCO values apply: + + Geometry DISCO + + astrograph 0.0 + Schmidt -0.3333 + AAT PF doublet +147.069 + AAT PF triplet +178.585 + AAT f/8 +21.20 + JKT f/8 +13.32 + + 4) There is a companion routine, slUPCD, which performs + an approximately inverse operation. + + P.T.Wallace Starlink 31 December 1992 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pda2h.hlp b/math/slalib/doc/pda2h.hlp new file mode 100644 index 00000000..6a5a7dc4 --- /dev/null +++ b/math/slalib/doc/pda2h.hlp @@ -0,0 +1,33 @@ +.help pda2h Jun99 "Slalib Package" +.nf + + SUBROUTINE slPDAH (P, D, A, H1, J1, H2, J2) + + - - - - - - + P D A H + - - - - - - + + Hour Angle corresponding to a given azimuth + + (double precision) + + Given: + P d latitude + D d declination + A d azimuth + + Returned: + H1 d hour angle: first solution if any + J1 i flag: 0 = solution 1 is valid + H2 d hour angle: second solution if any + J2 i flag: 0 = solution 2 is valid + + Called: slDA1P + + P.T.Wallace Starlink 6 October 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pdq2h.hlp b/math/slalib/doc/pdq2h.hlp new file mode 100644 index 00000000..cdb0702f --- /dev/null +++ b/math/slalib/doc/pdq2h.hlp @@ -0,0 +1,33 @@ +.help pdq2h Jun99 "Slalib Package" +.nf + + SUBROUTINE slPDQH (P, D, Q, H1, J1, H2, J2) + + - - - - - - + P D Q H + - - - - - - + + Hour Angle corresponding to a given parallactic angle + + (double precision) + + Given: + P d latitude + D d declination + Q d parallactic angle + + Returned: + H1 d hour angle: first solution if any + J1 i flag: 0 = solution 1 is valid + H2 d hour angle: second solution if any + J2 i flag: 0 = solution 2 is valid + + Called: slDA1P + + P.T.Wallace Starlink 6 October 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pertel.hlp b/math/slalib/doc/pertel.hlp new file mode 100644 index 00000000..c1685eca --- /dev/null +++ b/math/slalib/doc/pertel.hlp @@ -0,0 +1,121 @@ +.help pertel Jun99 "Slalib Package" +.nf + + SUBROUTINE slPRTL (JFORM, DATE0, DATE1, + : EPOCH0, ORBI0, ANODE0, PERIH0, AORQ0, E0, AM0, + : EPOCH1, ORBI1, ANODE1, PERIH1, AORQ1, E1, AM1, + : JSTAT) + + - - - - - - - + P R T L + - - - - - - - + + Update the osculating orbital elements of an asteroid or comet by + applying planetary perturbations. + + Given (format and dates): + JFORM i choice of element set (2 or 3; Note 1) + DATE0 d date of osculation (TT MJD) for the given elements + DATE1 d date of osculation (TT MJD) for the updated elements + + Given (the unperturbed elements): + EPOCH0 d epoch (TT MJD) of the given element set (Note 2) + ORBI0 d inclination (radians) + ANODE0 d longitude of the ascending node (radians) + PERIH0 d argument of perihelion (radians) + AORQ0 d mean distance or perihelion distance (AU) + E0 d eccentricity + AM0 d mean anomaly (radians, JFORM=2 only) + + Returned (the updated elements): + EPOCH1 d epoch (TT MJD) of the updated element set (Note 2) + ORBI1 d inclination (radians) + ANODE1 d longitude of the ascending node (radians) + PERIH1 d argument of perihelion (radians) + AORQ1 d mean distance or perihelion distance (AU) + E1 d eccentricity + AM1 d mean anomaly (radians, JFORM=2 only) + + Returned (status flag): + JSTAT i status: +102 = warning, distant epoch + +101 = warning, large timespan ( > 100 years) + +1 to +8 = coincident with major planet (Note 6) + 0 = OK + -1 = illegal JFORM + -2 = illegal E0 + -3 = illegal AORQ0 + -4 = internal error + -5 = numerical error + + Notes: + + 1 Two different element-format options are available: + + Option JFORM=2, suitable for minor planets: + + EPOCH = epoch of elements (TT MJD) + ORBI = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e + AM = mean anomaly M (radians) + + Option JFORM=3, suitable for comets: + + EPOCH = epoch of perihelion (TT MJD) + ORBI = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = perihelion distance, q (AU) + E = eccentricity, e + + 2 DATE0, DATE1, EPOCH0 and EPOCH1 are all instants of time in + the TT timescale (formerly Ephemeris Time, ET), expressed + as Modified Julian Dates (JD-2400000.5). + + DATE0 is the instant at which the given (i.e. unperturbed) + osculating elements are correct. + + DATE1 is the specified instant at which the updated osculating + elements are correct. + + EPOCH0 and EPOCH1 will be the same as DATE0 and DATE1 + (respectively) for the JFORM=2 case, normally used for minor + planets. For the JFORM=3 case, the two epochs will refer to + perihelion passage and so will not, in general, be the same as + DATE0 and/or DATE1 though they may be similar to one another. + + 3 The elements are with respect to the J2000 ecliptic and equinox. + + 4 Unused elements (AM0 and AM1 for JFORM=3) are not accessed. + + 5 See the slPRTE routine for details of the algorithm used. + + 6 This routine is not intended to be used for major planets, which + is why JFORM=1 is not available and why there is no opportunity + to specify either the longitude of perihelion or the daily + motion. However, if JFORM=2 elements are somehow obtained for a + major planet and supplied to the routine, sensible results will, + in fact, be produced. This happens because the slPRTE routine + that is called to perform the calculations checks the separation + between the body and each of the planets and interprets a + suspiciously small value (0.001 AU) as an attempt to apply it to + the planet concerned. If this condition is detected, the + contribution from that planet is ignored, and the status is set to + the planet number (Mercury=1,...,Neptune=8) as a warning. + + Reference: + + Sterne, Theodore E., "An Introduction to Celestial Mechanics", + Interscience Publishers Inc., 1960. Section 6.7, p199. + + Called: slELUE, slPRTE, slUEEL + + P.T.Wallace Starlink 14 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pertue.hlp b/math/slalib/doc/pertue.hlp new file mode 100644 index 00000000..4f5cf166 --- /dev/null +++ b/math/slalib/doc/pertue.hlp @@ -0,0 +1,152 @@ +.help pertue Jun99 "Slalib Package" +.nf + + SUBROUTINE slPRTE (DATE, U, JSTAT) + + - - - - - - - + P R T E + - - - - - - - + + Update the universal elements of an asteroid or comet by applying + planetary perturbations. + + Given: + DATE d final epoch (TT MJD) for the updated elements + + Given and returned: + U d(13) universal elements (updated in place) + + (1) combined mass (M+m) + (2) total energy of the orbit (alpha) + (3) reference (osculating) epoch (t0) + (4-6) position at reference epoch (r0) + (7-9) velocity at reference epoch (v0) + (10) heliocentric distance at reference epoch + (11) r0.v0 + (12) date (t) + (13) universal eccentric anomaly (psi) of date, approx + + Returned: + JSTAT i status: + +102 = warning, distant epoch + +101 = warning, large timespan ( > 100 years) + +1 to +8 = coincident with major planet (Note 5) + 0 = OK + -1 = numerical error + + Called: slPLNT, slUEPV, slPVUE + + Notes: + + 1 The "universal" elements are those which define the orbit for the + purposes of the method of universal variables (see reference 2). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i) alpha, which is proportional to the total energy of the + orbit, (ii) the heliocentric distance at epoch, (iii) the + outwards component of the velocity at the given epoch, (iv) an + estimate of psi, the "universal eccentric anomaly" at a given + date and (v) that date. + + 2 The universal elements are with respect to the J2000 equator and + equinox. + + 3 The epochs DATE, U(3) and U(12) are all Modified Julian Dates + (JD-2400000.5). + + 4 The algorithm is a simplified form of Encke's method. It takes as + a basis the unperturbed motion of the body, and numerically + integrates the perturbing accelerations from the major planets. + The expression used is essentially Sterne's 6.7-2 (reference 1). + Everhart and Pitkin (reference 2) suggest rectifying the orbit at + each integration step by propagating the new perturbed position + and velocity as the new universal variables. In the present + routine the orbit is rectified less frequently than this, in order + to gain a slight speed advantage. However, the rectification is + done directly in terms of position and velocity, as suggested by + Everhart and Pitkin, bypassing the use of conventional orbital + elements. + + The f(q) part of the full Encke method is not used. The purpose + of this part is to avoid subtracting two nearly equal quantities + when calculating the "indirect member", which takes account of the + small change in the Sun's attraction due to the slightly displaced + position of the perturbed body. A simpler, direct calculation in + double precision proves to be faster and not significantly less + accurate. + + Apart from employing a variable timestep, and occasionally + "rectifying the orbit" to keep the indirect member small, the + integration is done in a fairly straightforward way. The + acceleration estimated for the middle of the timestep is assumed + to apply throughout that timestep; it is also used in the + extrapolation of the perturbations to the middle of the next + timestep, to predict the new disturbed position. There is no + iteration within a timestep. + + Measures are taken to reach a compromise between execution time + and accuracy. The starting-point is the goal of achieving + arcsecond accuracy for ordinary minor planets over a ten-year + timespan. This goal dictates how large the timesteps can be, + which in turn dictates how frequently the unperturbed motion has + to be recalculated from the osculating elements. + + Within predetermined limits, the timestep for the numerical + integration is varied in length in inverse proportion to the + magnitude of the net acceleration on the body from the major + planets. + + The numerical integration requires estimates of the major-planet + motions. Approximate positions for the major planets (Pluto + alone is omitted) are obtained from the routine slPLNT. Two + levels of interpolation are used, to enhance speed without + significantly degrading accuracy. At a low frequency, the routine + slPLNT is called to generate updated position+velocity "state + vectors". The only task remaining to be carried out at the full + frequency (i.e. at each integration step) is to use the state + vectors to extrapolate the planetary positions. In place of a + strictly linear extrapolation, some allowance is made for the + curvature of the orbit by scaling back the radius vector as the + linear extrapolation goes off at a tangent. + + Various other approximations are made. For example, perturbations + by Pluto and the minor planets are neglected, relativistic effects + are not taken into account and the Earth-Moon system is treated as + a single body. + + In the interests of simplicity, the background calculations for + the major planets are carried out en masse. The mean elements and + state vectors for all the planets are refreshed at the same time, + without regard for orbit curvature, mass or proximity. + + 5 This routine is not intended to be used for major planets. + However, if major-planet elements are supplied, sensible results + will, in fact, be produced. This happens because the routine + checks the separation between the body and each of the planets and + interprets a suspiciously small value (0.001 AU) as an attempt to + apply the routine to the planet concerned. If this condition is + detected, the contribution from that planet is ignored, and the + status is set to the planet number (Mercury=1,...,Neptune=8) as a + warning. + + References: + + 1 Sterne, Theodore E., "An Introduction to Celestial Mechanics", + Interscience Publishers Inc., 1960. Section 6.7, p199. + + 2 Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp + +.fi +.endhelp diff --git a/math/slalib/doc/planel.hlp b/math/slalib/doc/planel.hlp new file mode 100644 index 00000000..c5a0f02f --- /dev/null +++ b/math/slalib/doc/planel.hlp @@ -0,0 +1,96 @@ +.help planel Jun99 "Slalib Package" +.nf + + SUBROUTINE slPLNE (DATE, JFORM, EPOCH, ORBINC, ANODE, PERIH, + : AORQ, E, AORL, DM, PV, JSTAT) + + - - - - - - - + P L N L + - - - - - - - + + Heliocentric position and velocity of a planet, asteroid or comet, + starting from orbital elements. + + Given: + DATE d date, Modified Julian Date (JD - 2400000.5) + JFORM i choice of element set (1-3; Note 3) + EPOCH d epoch of elements (TT MJD) + ORBINC d inclination (radians) + ANODE d longitude of the ascending node (radians) + PERIH d longitude or argument of perihelion (radians) + AORQ d mean distance or perihelion distance (AU) + E d eccentricity + AORL d mean anomaly or longitude (radians, JFORM=1,2 only) + DM d daily motion (radians, JFORM=1 only) + + Returned: + PV d(6) heliocentric x,y,z,xdot,ydot,zdot of date, + J2000 equatorial triad (AU,AU/s) + JSTAT i status: 0 = OK + -1 = illegal JFORM + -2 = illegal E + -3 = illegal AORQ + -4 = illegal DM + -5 = numerical error + + Called: slELUE, slUEPV + + Notes + + 1 DATE is the instant for which the prediction is required. It is + in the TT timescale (formerly Ephemeris Time, ET) and is a + Modified Julian Date (JD-2400000.5). + + 2 The elements are with respect to the J2000 ecliptic and equinox. + + 3 Three different element-format options are available: + + Option JFORM=1, suitable for the major planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = longitude of perihelion, curly pi (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e (range 0 to <1) + AORL = mean longitude L (radians) + DM = daily motion (radians) + + Option JFORM=2, suitable for minor planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e (range 0 to <1) + AORL = mean anomaly M (radians) + + Option JFORM=3, suitable for comets: + + EPOCH = epoch of perihelion (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = perihelion distance, q (AU) + E = eccentricity, e (range 0 to 10) + + 4 Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are + not accessed. + + 5 The reference frame for the result is with respect to the mean + equator and equinox of epoch J2000. + + 6 The algorithm was originally adapted from the EPHSLA program of + D.H.P.Jones (private communication, 1996). The method is based + on Stumpff's Universal Variables. + + Reference: Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/planet.hlp b/math/slalib/doc/planet.hlp new file mode 100644 index 00000000..3bdb7b9f --- /dev/null +++ b/math/slalib/doc/planet.hlp @@ -0,0 +1,130 @@ +.help planet Jun99 "Slalib Package" +.nf + + SUBROUTINE slPLNT (DATE, NP, PV, JSTAT) + + - - - - - - - + P L N T + - - - - - - - + + Approximate heliocentric position and velocity of a specified + major planet. + + Given: + DATE d Modified Julian Date (JD - 2400000.5) + NP i planet (1=Mercury, 2=Venus, 3=EMB ... 9=Pluto) + + Returned: + PV d(6) heliocentric x,y,z,xdot,ydot,zdot, J2000 + equatorial triad (AU,AU/s) + JSTAT i status: +1 = warning: date out of range + 0 = OK + -1 = illegal NP (outside 1-9) + -2 = solution didn't converge + + Called: slPLNE + + Notes + + 1 The epoch, DATE, is in the TDB timescale and is a Modified + Julian Date (JD-2400000.5). + + 2 The reference frame is equatorial and is with respect to the + mean equinox and ecliptic of epoch J2000. + + 3 If an NP value outside the range 1-9 is supplied, an error + status (JSTAT = -1) is returned and the PV vector set to zeroes. + + 4 The algorithm for obtaining the mean elements of the planets + from Mercury to Neptune is due to J.L. Simon, P. Bretagnon, + J. Chapront, M. Chapront-Touze, G. Francou and J. Laskar + (Bureau des Longitudes, Paris). The (completely different) + algorithm for calculating the ecliptic coordinates of Pluto + is by Meeus. + + 5 Comparisons of the present routine with the JPL DE200 ephemeris + give the following RMS errors over the interval 1960-2025: + + position (km) speed (metre/sec) + + Mercury 334 0.437 + Venus 1060 0.855 + EMB 2010 0.815 + Mars 7690 1.98 + Jupiter 71700 7.70 + Saturn 199000 19.4 + Uranus 564000 16.4 + Neptune 158000 14.4 + Pluto 36400 0.137 + + From comparisons with DE102, Simon et al quote the following + longitude accuracies over the interval 1800-2200: + + Mercury 4" + Venus 5" + EMB 6" + Mars 17" + Jupiter 71" + Saturn 81" + Uranus 86" + Neptune 11" + + In the case of Pluto, Meeus quotes an accuracy of 0.6 arcsec + in longitude and 0.2 arcsec in latitude for the period + 1885-2099. + + For all except Pluto, over the period 1000-3000 the accuracy + is better than 1.5 times that over 1800-2200. Outside the + period 1000-3000 the accuracy declines. For Pluto the + accuracy declines rapidly outside the period 1885-2099. + Outside these ranges (1885-2099 for Pluto, 1000-3000 for + the rest) a "date out of range" warning status (JSTAT=+1) + is returned. + + 6 The algorithms for (i) Mercury through Neptune and (ii) Pluto + are completely independent. In the Mercury through Neptune + case, the present SLALIB implementation differs from the + original Simon et al Fortran code in the following respects. + + * The date is supplied as a Modified Julian Date rather + than a Julian Date (MJD = JD - 2400000.5). + + * The result is returned only in equatorial Cartesian form; + the ecliptic longitude, latitude and radius vector are not + returned. + + * The velocity is in AU per second, not AU per day. + + * Different error/warning status values are used. + + * Kepler's equation is not solved inline. + + * Polynomials in T are nested to minimize rounding errors. + + * Explicit double-precision constants are used to avoid + mixed-mode expressions. + + * There are other, cosmetic, changes to comply with + Starlink/SLALIB style guidelines. + + None of the above changes affects the result significantly. + + 7 For NP=3 the result is for the Earth-Moon Barycentre. To + obtain the heliocentric position and velocity of the Earth, + either use the SLALIB routine slEVP or call slDMON and + subtract 0.012150581 times the geocentric Moon vector from + the EMB vector produced by the present routine. (The Moon + vector should be precessed to J2000 first, but this can + be omitted for modern epochs without introducing significant + inaccuracy.) + + References: Simon et al., Astron. Astrophys. 282, 663 (1994). + Meeus, Astronomical Algorithms, Willmann-Bell (1991). + + P.T.Wallace Starlink 27 May 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/plante.hlp b/math/slalib/doc/plante.hlp new file mode 100644 index 00000000..a801ca51 --- /dev/null +++ b/math/slalib/doc/plante.hlp @@ -0,0 +1,97 @@ +.help plante Jun99 "Slalib Package" +.nf + + SUBROUTINE slPLTE (DATE, ELONG, PHI, JFORM, EPOCH, + : ORBINC, ANODE, PERIH, AORQ, E, + : AORL, DM, RA, DEC, R, JSTAT) + + - - - - - - - + P L T E + - - - - - - - + + Topocentric apparent RA,Dec of a Solar-System object whose + heliocentric orbital elements are known. + + Given: + DATE d MJD of observation (JD - 2400000.5) + ELONG d observer's east longitude (radians) + PHI d observer's geodetic latitude (radians) + JFORM i choice of element set (1-3; Note 4) + EPOCH d epoch of elements (TT MJD) + ORBINC d inclination (radians) + ANODE d longitude of the ascending node (radians) + PERIH d longitude or argument of perihelion (radians) + AORQ d mean distance or perihelion distance (AU) + E d eccentricity + AORL d mean anomaly or longitude (radians, JFORM=1,2 only) + DM d daily motion (radians, JFORM=1 only ) + + Returned: + RA,DEC d RA, Dec (topocentric apparent, radians) + R d distance from observer (AU) + JSTAT i status: 0 = OK + -1 = illegal JFORM + -2 = illegal E + -3 = illegal AORQ + -4 = illegal DM + -5 = numerical error + + Notes: + + 1 DATE is the instant for which the prediction is required. It is + in the TT timescale (formerly Ephemeris Time, ET) and is a + Modified Julian Date (JD-2400000.5). + + 2 The longitude and latitude allow correction for geocentric + parallax. This is usually a small effect, but can become + important for Earth-crossing asteroids. Geocentric positions + can be generated by appropriate use of routines slEVP and + slPLNE. + + 3 The elements are with respect to the J2000 ecliptic and equinox. + + 4 Three different element-format options are available: + + Option JFORM=1, suitable for the major planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = longitude of perihelion, curly pi (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e + AORL = mean longitude L (radians) + DM = daily motion (radians) + + Option JFORM=2, suitable for minor planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e + AORL = mean anomaly M (radians) + + Option JFORM=3, suitable for comets: + + EPOCH = epoch of perihelion (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = perihelion distance, q (AU) + E = eccentricity, e + + 5 Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are + not accessed. + + Called: slGMST, slDT, slEPJ, slPVOB, slPRNU, + slPLNE, slDMXV, slDC2S, slDA2P + + P.T.Wallace Starlink 17 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pm.hlp b/math/slalib/doc/pm.hlp new file mode 100644 index 00000000..a6d755ff --- /dev/null +++ b/math/slalib/doc/pm.hlp @@ -0,0 +1,45 @@ +.help pm Jun99 "Slalib Package" +.nf + + SUBROUTINE slPM (R0, D0, PR, PD, PX, RV, EP0, EP1, R1, D1) + + - - - + P M + - - - + + Apply corrections for proper motion to a star RA,Dec + (double precision) + + References: + 1984 Astronomical Almanac, pp B39-B41. + (also Lederle & Schwan, Astron. Astrophys. 134, + 1-6, 1984) + + Given: + R0,D0 dp RA,Dec at epoch EP0 (rad) + PR,PD dp proper motions: RA,Dec changes per year of epoch + PX dp parallax (arcsec) + RV dp radial velocity (km/sec, +ve if receding) + EP0 dp start epoch in years (e.g. Julian epoch) + EP1 dp end epoch in years (same system as EP0) + + Returned: + R1,D1 dp RA,Dec at epoch EP1 (rad) + + Called: + slDS2C spherical to Cartesian + slDC2S Cartesian to spherical + slDA2P normalize angle 0-2Pi + + Note: + The proper motions in RA are dRA/dt rather than + cos(Dec)*dRA/dt, and are in the same coordinate + system as R0,D0. + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/polmo.hlp b/math/slalib/doc/polmo.hlp new file mode 100644 index 00000000..b3f68383 --- /dev/null +++ b/math/slalib/doc/polmo.hlp @@ -0,0 +1,87 @@ +.help polmo Jun99 "Slalib Package" +.nf + + SUBROUTINE slPLMO ( ELONGM, PHIM, XP, YP, ELONG, PHI, DAZ ) + + - - - - - - + P L M O + - - - - - - + + Polar motion: correct site longitude and latitude for polar + motion and calculate azimuth difference between celestial and + terrestrial poles. + + Given: + ELONGM d mean longitude of the observer (radians, east +ve) + PHIM d mean geodetic latitude of the observer (radians) + XP d polar motion x-coordinate (radians) + YP d polar motion y-coordinate (radians) + + Returned: + ELONG d true longitude of the observer (radians, east +ve) + PHI d true geodetic latitude of the observer (radians) + DAZ d azimuth correction (terrestrial-celestial, radians) + + Notes: + + 1) "Mean" longitude and latitude are the (fixed) values for the + site's location with respect to the IERS terrestrial reference + frame; the latitude is geodetic. TAKE CARE WITH THE LONGITUDE + SIGN CONVENTION. The longitudes used by the present routine + are east-positive, in accordance with geographical convention + (and right-handed). In particular, note that the longitudes + returned by the slOBS routine are west-positive, following + astronomical usage, and must be reversed in sign before use in + the present routine. + + 2) XP and YP are the (changing) coordinates of the Celestial + Ephemeris Pole with respect to the IERS Reference Pole. + XP is positive along the meridian at longitude 0 degrees, + and YP is positive along the meridian at longitude + 270 degrees (i.e. 90 degrees west). Values for XP,YP can + be obtained from IERS circulars and equivalent publications; + the maximum amplitude observed so far is about 0.3 arcseconds. + + 3) "True" longitude and latitude are the (moving) values for + the site's location with respect to the celestial ephemeris + pole and the meridian which corresponds to the Greenwich + apparent sidereal time. The true longitude and latitude + link the terrestrial coordinates with the standard celestial + models (for precession, nutation, sidereal time etc). + + 4) The azimuths produced by slAOP and slAOPQ are with + respect to due north as defined by the Celestial Ephemeris + Pole, and can therefore be called "celestial azimuths". + However, a telescope fixed to the Earth measures azimuth + essentially with respect to due north as defined by the + IERS Reference Pole, and can therefore be called "terrestrial + azimuth". Uncorrected, this would manifest itself as a + changing "azimuth zero-point error". The value DAZ is the + correction to be added to a celestial azimuth to produce + a terrestrial azimuth. + + 5) The present routine is rigorous. For most practical + purposes, the following simplified formulae provide an + adequate approximation: + + ELONG = ELONGM+XP*COS(ELONGM)-YP*SIN(ELONGM) + PHI = PHIM+(XP*SIN(ELONGM)+YP*COS(ELONGM))*TAN(PHIM) + DAZ = -SQRT(XP*XP+YP*YP)*COS(ELONGM-ATAN2(XP,YP))/COS(PHIM) + + An alternative formulation for DAZ is: + + X = COS(ELONGM)*COS(PHIM) + Y = SIN(ELONGM)*COS(PHIM) + DAZ = ATAN2(-X*YP-Y*XP,X*X+Y*Y) + + Reference: Seidelmann, P.K. (ed), 1992. "Explanatory Supplement + to the Astronomical Almanac", ISBN 0-935702-68-7, + sections 3.27, 4.25, 4.52. + + P.T.Wallace Starlink 22 February 1996 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/prebn.hlp b/math/slalib/doc/prebn.hlp new file mode 100644 index 00000000..e2c1991b --- /dev/null +++ b/math/slalib/doc/prebn.hlp @@ -0,0 +1,36 @@ +.help prebn Jun99 "Slalib Package" +.nf + + SUBROUTINE slPRBN (BEP0, BEP1, RMATP) + + - - - - - - + P R B N + - - - - - - + + Generate the matrix of precession between two epochs, + using the old, pre-IAU1976, Bessel-Newcomb model, using + Kinoshita's formulation (double precision) + + Given: + BEP0 dp beginning Besselian epoch + BEP1 dp ending Besselian epoch + + Returned: + RMATP dp(3,3) precession matrix + + The matrix is in the sense V(BEP1) = RMATP * V(BEP0) + + Reference: + Kinoshita, H. (1975) 'Formulas for precession', SAO Special + Report No. 364, Smithsonian Institution Astrophysical + Observatory, Cambridge, Massachusetts. + + Called: slDEUL + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/prec.hlp b/math/slalib/doc/prec.hlp new file mode 100644 index 00000000..4b12d918 --- /dev/null +++ b/math/slalib/doc/prec.hlp @@ -0,0 +1,53 @@ +.help prec Jun99 "Slalib Package" +.nf + + SUBROUTINE slPREC (EP0, EP1, RMATP) + + - - - - - + P R E C + - - - - - + + Form the matrix of precession between two epochs (IAU 1976, FK5) + (double precision) + + Given: + EP0 dp beginning epoch + EP1 dp ending epoch + + Returned: + RMATP dp(3,3) precession matrix + + Notes: + + 1) The epochs are TDB (loosely ET) Julian epochs. + + 2) The matrix is in the sense V(EP1) = RMATP * V(EP0) + + 3) Though the matrix method itself is rigorous, the precession + angles are expressed through canonical polynomials which are + valid only for a limited time span. There are also known + errors in the IAU precession rate. The absolute accuracy + of the present formulation is better than 0.1 arcsec from + 1960AD to 2040AD, better than 1 arcsec from 1640AD to 2360AD, + and remains below 3 arcsec for the whole of the period + 500BC to 3000AD. The errors exceed 10 arcsec outside the + range 1200BC to 3900AD, exceed 100 arcsec outside 4200BC to + 5600AD and exceed 1000 arcsec outside 6800BC to 8200AD. + The SLALIB routine slPREL implements a more elaborate + model which is suitable for problems spanning several + thousand years. + + References: + Lieske,J.H., 1979. Astron.Astrophys.,73,282. + equations (6) & (7), p283. + Kaplan,G.H., 1981. USNO circular no. 163, pA2. + + Called: slDEUL + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/preces.hlp b/math/slalib/doc/preces.hlp new file mode 100644 index 00000000..7652ea8a --- /dev/null +++ b/math/slalib/doc/preces.hlp @@ -0,0 +1,47 @@ +.help preces Jun99 "Slalib Package" +.nf + + SUBROUTINE slPRCE (SYSTEM, EP0, EP1, RA, DC) + + - - - - - - - + P R C E + - - - - - - - + + Precession - either FK4 (Bessel-Newcomb, pre IAU 1976) or + FK5 (Fricke, post IAU 1976) as required. + + Given: + SYSTEM char precession to be applied: 'FK4' or 'FK5' + EP0,EP1 dp starting and ending epoch + RA,DC dp RA,Dec, mean equator & equinox of epoch EP0 + + Returned: + RA,DC dp RA,Dec, mean equator & equinox of epoch EP1 + + Called: slDA2P, slPRBN, slPREC, slDS2C, + slDMXV, slDC2S + + Notes: + + 1) Lowercase characters in SYSTEM are acceptable. + + 2) The epochs are Besselian if SYSTEM='FK4' and Julian if 'FK5'. + For example, to precess coordinates in the old system from + equinox 1900.0 to 1950.0 the call would be: + CALL slPRCE ('FK4', 1900D0, 1950D0, RA, DC) + + 3) This routine will NOT correctly convert between the old and + the new systems - for example conversion from B1950 to J2000. + For these purposes see slFK45, slFK54, slF45Z and + slF54Z. + + 4) If an invalid SYSTEM is supplied, values of -99D0,-99D0 will + be returned for both RA and DC. + + P.T.Wallace Starlink 20 April 1990 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/precl.hlp b/math/slalib/doc/precl.hlp new file mode 100644 index 00000000..b715172a --- /dev/null +++ b/math/slalib/doc/precl.hlp @@ -0,0 +1,47 @@ +.help precl Jun99 "Slalib Package" +.nf + + SUBROUTINE slPREL (EP0, EP1, RMATP) + + - - - - - - + P R E L + - - - - - - + + Form the matrix of precession between two epochs, using the + model of Simon et al (1994), which is suitable for long + periods of time. + + (double precision) + + Given: + EP0 dp beginning epoch + EP1 dp ending epoch + + Returned: + RMATP dp(3,3) precession matrix + + Notes: + + 1) The epochs are TDB Julian epochs. + + 2) The matrix is in the sense V(EP1) = RMATP * V(EP0) + + 3) The absolute accuracy of the model is limited by the + uncertainty in the general precession, about 0.3 arcsec per + 1000 years. The remainder of the formulation provides a + precision of 1 mas over the interval from 1000AD to 3000AD, + 0.1 arcsec from 1000BC to 5000AD and 1 arcsec from + 4000BC to 8000AD. + + Reference: + Simon, J.L. et al., 1994. Astron.Astrophys., 282, 663-683. + + Called: slDEUL + + P.T.Wallace Starlink 23 August 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/precss.hlp b/math/slalib/doc/precss.hlp new file mode 100644 index 00000000..ab244cf5 --- /dev/null +++ b/math/slalib/doc/precss.hlp @@ -0,0 +1,44 @@ +.help precss Jun99 "Slalib Package" +.nf + + SUBROUTINE slPRCS (SYSTEM, EP0, EP1, RA, DC) + + - - - - - - - + P R C E + - - - - - - - + + Precession - either FK4 (Bessel-Newcomb, pre IAU 1976) or + FK5 (Fricke, post IAU 1976) as required. + + Given: + SYSTEM int precession to be applied: 1 = FK4 or 2 = FK5 + EP0,EP1 dp starting and ending epoch + RA,DC dp RA,Dec, mean equator & equinox of epoch EP0 + + Returned: + RA,DC dp RA,Dec, mean equator & equinox of epoch EP1 + + Called: slDA2P, slPRBN, slPREC, slDS2C, + slDMXV, slDC2S + + Notes: + + 1) Lowercase characters in SYSTEM are acceptable. + + 2) The epochs are Besselian if SYSTEM=FK4 and Julian if FK5. + For example, to precess coordinates in the old system from + equinox 1900.0 to 1950.0 the call would be: + CALL slPRCS (1, 1900D0, 1950D0, RA, DC) + + 3) This routine will NOT correctly convert between the old and + the new systems - for example conversion from B1950 to J2000. + For these purposes see slFK45, slFK54, slF45Z and + slF54Z. + + 4) If an invalid SYSTEM is supplied, values of -99D0,-99D0 will + be returned for both RA and DC. + + P.T.Wallace Starlink 20 April 1990 + +.fi +.endhelp diff --git a/math/slalib/doc/prenut.hlp b/math/slalib/doc/prenut.hlp new file mode 100644 index 00000000..bbe3ceff --- /dev/null +++ b/math/slalib/doc/prenut.hlp @@ -0,0 +1,35 @@ +.help prenut Jun99 "Slalib Package" +.nf + + SUBROUTINE slPRNU (EPOCH, DATE, RMATPN) + + - - - - - - - + P R N U + - - - - - - - + + Form the matrix of precession and nutation (IAU1976/FK5) + (double precision) + + Given: + EPOCH dp Julian Epoch for mean coordinates + DATE dp Modified Julian Date (JD-2400000.5) + for true coordinates + + Returned: + RMATPN dp(3,3) combined precession/nutation matrix + + Called: slPREC, slEPJ, slNUT, slDMXM + + Notes: + + 1) The epoch and date are TDB (loosely ET). + + 2) The matrix is in the sense V(true) = RMATPN * V(mean) + + P.T.Wallace Starlink April 1987 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pv2el.hlp b/math/slalib/doc/pv2el.hlp new file mode 100644 index 00000000..ef027a38 --- /dev/null +++ b/math/slalib/doc/pv2el.hlp @@ -0,0 +1,145 @@ +.help pv2el Jun99 "Slalib Package" +.nf + + SUBROUTINE slPVEL (PV, DATE, PMASS, JFORMR, + : JFORM, EPOCH, ORBINC, ANODE, PERIH, + : AORQ, E, AORL, DM, JSTAT) + + - - - - - - + P V E L + - - - - - - + + Heliocentric osculating elements obtained from instantaneous position + and velocity. + + Given: + PV d(6) heliocentric x,y,z,xdot,ydot,zdot of date, + J2000 equatorial triad (AU,AU/s; Note 1) + DATE d date (TT Modified Julian Date = JD-2400000.5) + PMASS d mass of the planet (Sun=1; Note 2) + JFORMR i requested element set (1-3; Note 3) + + Returned: + JFORM d element set actually returned (1-3; Note 4) + EPOCH d epoch of elements (TT MJD) + ORBINC d inclination (radians) + ANODE d longitude of the ascending node (radians) + PERIH d longitude or argument of perihelion (radians) + AORQ d mean distance or perihelion distance (AU) + E d eccentricity + AORL d mean anomaly or longitude (radians, JFORM=1,2 only) + DM d daily motion (radians, JFORM=1 only) + JSTAT i status: 0 = OK + -1 = illegal PMASS + -2 = illegal JFORMR + -3 = position/velocity out of range + + Notes + + 1 The PV 6-vector is with respect to the mean equator and equinox of + epoch J2000. The orbital elements produced are with respect to + the J2000 ecliptic and mean equinox. + + 2 The mass, PMASS, is important only for the larger planets. For + most purposes (e.g. asteroids) use 0D0. Values less than zero + are illegal. + + 3 Three different element-format options are supported: + + Option JFORM=1, suitable for the major planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = longitude of perihelion, curly pi (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e + AORL = mean longitude L (radians) + DM = daily motion (radians) + + Option JFORM=2, suitable for minor planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e + AORL = mean anomaly M (radians) + + Option JFORM=3, suitable for comets: + + EPOCH = epoch of perihelion (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = perihelion distance, q (AU) + E = eccentricity, e + + 4 It may not be possible to generate elements in the form + requested through JFORMR. The caller is notified of the form + of elements actually returned by means of the JFORM argument: + + JFORMR JFORM meaning + + 1 1 OK - elements are in the requested format + 1 2 never happens + 1 3 orbit not elliptical + + 2 1 never happens + 2 2 OK - elements are in the requested format + 2 3 orbit not elliptical + + 3 1 never happens + 3 2 never happens + 3 3 OK - elements are in the requested format + + 5 The arguments returned for each value of JFORM (cf Note 5: JFORM + may not be the same as JFORMR) are as follows: + + JFORM 1 2 3 + EPOCH t0 t0 T + ORBINC i i i + ANODE Omega Omega Omega + PERIH curly pi omega omega + AORQ a a q + E e e e + AORL L M - + DM n - - + + where: + + t0 is the epoch of the elements (MJD, TT) + T " epoch of perihelion (MJD, TT) + i " inclination (radians) + Omega " longitude of the ascending node (radians) + curly pi " longitude of perihelion (radians) + omega " argument of perihelion (radians) + a " mean distance (AU) + q " perihelion distance (AU) + e " eccentricity + L " longitude (radians, 0-2pi) + M " mean anomaly (radians, 0-2pi) + n " daily motion (radians) + - means no value is set + + 6 At very small inclinations, the longitude of the ascending node + ANODE becomes indeterminate and under some circumstances may be + set arbitrarily to zero. Similarly, if the orbit is close to + circular, the true anomaly becomes indeterminate and under some + circumstances may be set arbitrarily to zero. In such cases, + the other elements are automatically adjusted to compensate, + and so the elements remain a valid description of the orbit. + + Reference: Sterne, Theodore E., "An Introduction to Celestial + Mechanics", Interscience Publishers, 1960 + + Called: slDA2P + + P.T.Wallace Starlink 13 February 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pv2ue.hlp b/math/slalib/doc/pv2ue.hlp new file mode 100644 index 00000000..776f877a --- /dev/null +++ b/math/slalib/doc/pv2ue.hlp @@ -0,0 +1,70 @@ +.help pv2ue Jun99 "Slalib Package" +.nf + + SUBROUTINE slPVUE (PV, DATE, PMASS, U, JSTAT) + + - - - - - - + P V U E + - - - - - - + + Construct a universal element set based on an instantaneous position + and velocity. + + Given: + PV d(6) heliocentric x,y,z,xdot,ydot,zdot of date, + (AU,AU/s; Note 1) + DATE d date (TT Modified Julian Date = JD-2400000.5) + PMASS d mass of the planet (Sun=1; Note 2) + + Returned: + U d(13) universal orbital elements (Note 3) + + (1) combined mass (M+m) + (2) total energy of the orbit (alpha) + (3) reference (osculating) epoch (t0) + (4-6) position at reference epoch (r0) + (7-9) velocity at reference epoch (v0) + (10) heliocentric distance at reference epoch + (11) r0.v0 + (12) date (t) + (13) universal eccentric anomaly (psi) of date, approx + + JSTAT i status: 0 = OK + -1 = illegal PMASS + -2 = too close to Sun + -3 = too slow + + Notes + + 1 The PV 6-vector can be with respect to any chosen inertial frame, + and the resulting universal-element set will be with respect to + the same frame. A common choice will be mean equator and ecliptic + of epoch J2000. + + 2 The mass, PMASS, is important only for the larger planets. For + most purposes (e.g. asteroids) use 0D0. Values less than zero + are illegal. + + 3 The "universal" elements are those which define the orbit for the + purposes of the method of universal variables (see reference). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i) alpha, which is proportional to the total energy of the + orbit, (ii) the heliocentric distance at epoch, (iii) the + outwards component of the velocity at the given epoch, (iv) an + estimate of psi, the "universal eccentric anomaly" at a given + date and (v) that date. + + Reference: Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pvobs.hlp b/math/slalib/doc/pvobs.hlp new file mode 100644 index 00000000..607d73a5 --- /dev/null +++ b/math/slalib/doc/pvobs.hlp @@ -0,0 +1,31 @@ +.help pvobs Jun99 "Slalib Package" +.nf + + SUBROUTINE slPVOB (P, H, STL, PV) + + - - - - - - + P V O B + - - - - - - + + Position and velocity of an observing station (double precision) + + Given: + P dp latitude (geodetic, radians) + H dp height above reference spheroid (geodetic, metres) + STL dp local apparent sidereal time (radians) + + Returned: + PV dp(6) position/velocity 6-vector (AU, AU/s, true equator + and equinox of date) + + Called: slGEOC + + IAU 1976 constants are used. + + P.T.Wallace Starlink 14 November 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/pxy.hlp b/math/slalib/doc/pxy.hlp new file mode 100644 index 00000000..e2764150 --- /dev/null +++ b/math/slalib/doc/pxy.hlp @@ -0,0 +1,56 @@ +.help pxy Jun99 "Slalib Package" +.nf + + SUBROUTINE slPXY (NP,XYE,XYM,COEFFS,XYP,XRMS,YRMS,RRMS) + + - - - - + P X Y + - - - - + + Given arrays of "expected" and "measured" [X,Y] coordinates, and a + linear model relating them (as produced by slFTXY), compute + the array of "predicted" coordinates and the RMS residuals. + + Given: + NP i number of samples + XYE d(2,np) expected [X,Y] for each sample + XYM d(2,np) measured [X,Y] for each sample + COEFFS d(6) coefficients of model (see below) + + Returned: + XYP d(2,np) predicted [X,Y] for each sample + XRMS d RMS in X + YRMS d RMS in Y + RRMS d total RMS (vector sum of XRMS and YRMS) + + The model is supplied in the array COEFFS. Naming the + elements of COEFF as follows: + + COEFFS(1) = A + COEFFS(2) = B + COEFFS(3) = C + COEFFS(4) = D + COEFFS(5) = E + COEFFS(6) = F + + the model is applied thus: + + XP = A + B*XM + C*YM + YP = D + E*XM + F*YM + + The residuals are (XP-XE) and (YP-YE). + + If NP is less than or equal to zero, no coordinates are + transformed, and the RMS residuals are all zero. + + See also slFTXY, slINVF, slXYXY, slDCMF + + Called: slXYXY + + P.T.Wallace Starlink 22 May 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/range.hlp b/math/slalib/doc/range.hlp new file mode 100644 index 00000000..b65a1a92 --- /dev/null +++ b/math/slalib/doc/range.hlp @@ -0,0 +1,24 @@ +.help range Jun99 "Slalib Package" +.nf + + REAL FUNCTION slRA1P (ANGLE) + + - - - - - - + R A 1 P + - - - - - - + + Normalize angle into range +/- pi (single precision) + + Given: + ANGLE dp the angle in radians + + The result is ANGLE expressed in the +/- pi (single + precision). + + P.T.Wallace Starlink 23 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ranorm.hlp b/math/slalib/doc/ranorm.hlp new file mode 100644 index 00000000..5ee46937 --- /dev/null +++ b/math/slalib/doc/ranorm.hlp @@ -0,0 +1,24 @@ +.help ranorm Jun99 "Slalib Package" +.nf + + REAL FUNCTION slRA2P (ANGLE) + + - - - - - - - + R A 2 P + - - - - - - - + + Normalize angle into range 0-2 pi (single precision) + + Given: + ANGLE dp the angle in radians + + The result is ANGLE expressed in the range 0-2 pi (single + precision). + + P.T.Wallace Starlink 23 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/rcc.hlp b/math/slalib/doc/rcc.hlp new file mode 100644 index 00000000..fef7f578 --- /dev/null +++ b/math/slalib/doc/rcc.hlp @@ -0,0 +1,83 @@ +.help rcc Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slRCC (TDB, UT1, WL, U, V) + + - - - - + R C C + - - - - + + Relativistic clock correction: the difference between proper time at + a point on the surface of the Earth and coordinate time in the Solar + System barycentric space-time frame of reference. + + The proper time is Terrestrial Time TT; the coordinate + time is an implementation of the Barycentric Dynamical Time TDB. + + Given: + TDB dp coordinate time (MJD: JD-2400000.5) + UT1 dp universal time (fraction of one day) + WL dp clock longitude (radians west) + U dp clock distance from Earth spin axis (km) + V dp clock distance north of Earth equatorial plane (km) + + Returned: + The clock correction, TDB-TT, in seconds. TDB may be considered + to be the coordinate time in the Solar System barycentre frame of + reference, and TT is the proper time given by clocks at mean sea + level on the Earth. + + The result has a main (annual) sinusoidal term of amplitude + approximately 0.00166 seconds, plus planetary terms up to about + 20 microseconds, and lunar and diurnal terms up to 2 microseconds. + The variation arises from the transverse Doppler effect and the + gravitational red-shift as the observer varies in speed and moves + through different gravitational potentials. + + The argument TDB is, strictly, the barycentric coordinate time; + however, the terrestrial proper time (TT) can in practice be used. + + The geocentric model is that of Fairhead & Bretagnon (1990), in its + full form. It was supplied by Fairhead (private communication) as a + FORTRAN subroutine. The original Fairhead routine used explicit + formulae, in such large numbers that problems were experienced with + certain compilers (Microsoft Fortran on PC aborted with stack + overflow, Convex compiled successfully but extremely slowly). The + present implementation is a complete recoding, with the original + Fairhead coefficients held in a table. To optimize arithmetic + precision, the terms are accumulated in reverse order, smallest + first. A number of other coding changes were made, in order to match + the calling sequence of previous versions of the present routine, and + to comply with Starlink programming standards. Under VAX/VMS, the + numerical results compared with those from the Fairhead form are + essentially unaffected by the changes, the differences being at the + 10^-20 sec level. + + The topocentric part of the model is from Moyer (1981) and + Murray (1983). + + During the interval 1950-2050, the absolute accuracy is better + than +/- 3 nanoseconds relative to direct numerical integrations + using the JPL DE200/LE200 solar system ephemeris. + + The IAU definition of TDB is that it must differ from TT only by + periodic terms. Though practical, this is an imprecise definition + which ignores the existence of very long-period and secular effects + in the dynamics of the solar system. As a consequence, different + implementations of TDB will, in general, differ in zero-point and + will drift linearly relative to one other. + + References: + Bretagnon P, 1982 Astron. Astrophys., 114, 278-288. + Fairhead L & Bretagnon P, 1990, Astron. Astrophys., 229, 240-247. + Meeus J, 1984, l'Astronomie, 348-354. + Moyer T D, 1981, Cel. Mech., 23, 33. + Murray C A, 1983, Vectorial Astrometry, Adam Hilger. + + P.T.Wallace Starlink 10 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/rdplan.hlp b/math/slalib/doc/rdplan.hlp new file mode 100644 index 00000000..5b9d560a --- /dev/null +++ b/math/slalib/doc/rdplan.hlp @@ -0,0 +1,73 @@ +.help rdplan Jun99 "Slalib Package" +.nf + + SUBROUTINE slRDPL (DATE, NP, ELONG, PHI, RA, DEC, DIAM) + + - - - - - - - + R D P L + - - - - - - - + + Approximate topocentric apparent RA,Dec of a planet, and its + angular diameter. + + Given: + DATE d MJD of observation (JD - 2400000.5) + NP i planet: 1 = Mercury + 2 = Venus + 3 = Moon + 4 = Mars + 5 = Jupiter + 6 = Saturn + 7 = Uranus + 8 = Neptune + 9 = Pluto + else = Sun + ELONG,PHI d observer's east longitude and geodetic + latitude (radians) + + Returned: + RA,DEC d RA, Dec (topocentric apparent, radians) + DIAM d angular diameter (equatorial, radians) + + Notes: + + 1 The date is in a dynamical timescale (TDB, formerly ET) and is + in the form of a Modified Julian Date (JD-2400000.5). For all + practical purposes, TT can be used instead of TDB, and for many + applications UT will do (except for the Moon). + + 2 The longitude and latitude allow correction for geocentric + parallax. This is a major effect for the Moon, but in the + context of the limited accuracy of the present routine its + effect on planetary positions is small (negligible for the + outer planets). Geocentric positions can be generated by + appropriate use of the routines slDMON and slPLNT. + + 3 The direction accuracy (arcsec, 1000-3000AD) is of order: + + Sun 5 + Mercury 2 + Venus 10 + Moon 30 + Mars 50 + Jupiter 90 + Saturn 90 + Uranus 90 + Neptune 10 + Pluto 1 (1885-2099AD only) + + The angular diameter accuracy is about 0.4% for the Moon, + and 0.01% or better for the Sun and planets. + + See the slPLNT routine for references. + + Called: slGMST, slDT, slEPJ, slDMON, slPVOB, slPRNU, + slPLNT, slDMXV, slDC2S, slDA2P + + P.T.Wallace Starlink 26 May 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/read.me b/math/slalib/doc/read.me new file mode 100644 index 00000000..e7f5f358 --- /dev/null +++ b/math/slalib/doc/read.me @@ -0,0 +1,437 @@ +READ.ME + +Revision date 31 May 1999 SLALIB Version 2.3-0 + +----------------------------------------------------------------------- + +FILES IN THE ORIGINAL SOURCE DIRECTORY (VAX) + + READ.ME this file + *.FOR Fortran source (separate modules) + *.OBS ditto, but obsolete routines + *.NEW ditto, but new and not yet ready for release + *.VAX Fortran source for VAX/VMS + *.CNVX Fortran source for Convex + *.MIPS Fortran source for DECstation + *.SUN4 Fortran source for Sun SPARCstation + *.LNX Fortran source for Linux + *.PCM Microsoft Fortran source for PC + *.C C functions needed for Linux version + PC.BAT rebuilds PC version + REP.BAT on PC, compiles one module and updates library + CREATE.COM complete rebuild of VAX and Unix releases + PUT.COM compile one module and update libraries + VAX_TO_UNIX.USH script to complete transfer to Unix platforms + SLA.NEWS NEWS item for latest release + MAKEFILE Unix make file + MK C-shell script to run make + SUN67.TEX document + +FILES IN [.RELEASE] DIRECTORY ON VAX + + SLALIB.OLB object library + SLALIB.TLB source library + SUN67.TEX document + +FILES IN [.UNIX] DIRECTORY ON VAX + + MAKEFILE make file for DECstation and Sun SPARC + MK C-shell script to run make + SLA.A archive file containing everything else + VAX_TO_UNIX script to complete transfer to Unix platforms + SLA.NEWS NEWS item for latest release + SUN67.TEX document + +FILES IN (INFORMAL) FTP DIRECTORIES + + The files distributed informally through anonymous FTP may differ + slightly in both content and name from the ones listed above. For + example the PC Fortran modules may be stored in archive files and + called xxx.f_pcm rather than XXX.PCM etc. + +----------------------------------------------------------------------- + +DISTRIBUTION - THIS DIRECTORY + + Nothing from this directory needs to be distributed. + +DISTRIBUTION - [.RELEASE] DIRECTORY + + SLALIB.* SLALIB_DIR + SLA.NEWS SLALIB_DIR + SUN67.TEX DOCSDIR + +INSTRUCTIONS FOR SAVING SPACE + + Extract from the SLALIB_DIR BACKUP save set only the file SLALIB.OLB. + +----------------------------------------------------------------------- + +PORTING FORTRAN SLALIB TO OTHER SYSTEMS + +FORTRAN SLALIB runs on VAX (VMS), PC (Linux+f2c), PC (Microsoft FORTRAN), +Convex (ConvexOS), DECstation (Ultrix), DEC Alpha (OSF-1) and Sun +SPARCstation (SunOS and Solaris). + +For most platforms, the required changes are confined to these routines: + + sla_GRESID + sla_RANDOM + sla_WAIT + +VAX, CONVEX, DECSTATION/ALPHA, SUN & PC + +Versions suitable for the above platforms are supplied in the +development directory as *.VAX, *,CNVX, *.MIPS, *.SUN4, *.PCM and +*.LNX respectively. + + +----------------------------------------------------------------------- + +LATEST RELEASE INFORMATION + +The latest release of SLALIB includes the following changes (most recent +at the end): + +* In sla_RCC, the topocentric term of coefficient 1.3184D-10 sec + had the wrong sign. Minus is correct. + +* The IAU decided in 1991 to rename the Terrestrial Dynamical + Time, TDT, which is now called "Terrestrial Time" or TT. + Appropriate changes have been made in the SLALIB documentation. + The same IAU resolutions introduced the timescales TCG and TCB; + there are at present no SLALIB routines to handle these new + timescales. + +* The Keck 1 Telescope has been added to sla_OBS. + +* The handling of the random-number seed in the PC versions of + sla_RANDOM and sla_GRESID was flawed and has been improved. + +* The UTC leap second at the end of June 1993 has been added to the + routine sla_DAT. Existing applications which call sla_DAT or + sla_DTT require relinking. + +* Some unnecessary code in sla_AMPQK has been removed. + +* Minor reorganization of the sla_REFRO code has led to an improvement + in speed of about 20%, and precautions have been taken against + potential arithmetic errors. + +* There have been small revisions to sla_FK425 and sla_FK524. The + results are not significantly affected, except in the pathological + case of large proper motion combined with immense distance, where + sla_FK524 could produce erroneous radial velocity values. The + latest versions are close to the algorithms published in the 1992 + Explanatory Supplement to the Astronomical Almanac. + +* The leap second at the end of June 1994 has been added to sla_DAT. + +* THE SLA_RVLSR ROUTINE HAS BEEN RETIRED. Its place has been taken + by two new routines: sla_RVLSRK and sla_RVLSRD. The original + sla_RVLSR had used a "kinematical" LSR. When this was later changed + to a "dynamical" LSR for (what seemed liked good reasons at the time), + the small differences were noticed by spectral-line radio observers, + who had to fall back on old copies of the routine to remain consistent + with existing practice. The new routines provide both sorts of LSR: + sla_RVLSRK uses a kinematical LSR and sla_RVLSRD uses the dynamical LSR. + +* The sla_PA routine (computation of parallactic angle) used an + unnecessarily complicated formulation, which has been simplified. + The results are unaffected. + +* The sla_ZD routine (computation of zenith distance) used a + straightforward cosine-formula-based method, which suffered from + decreased accuracy near the zenith. A better, vector-derived, + formulation has been substituted, without materially affecting + the results. Because sla_ZD is double precision, the old + formulation was always adequate; however, had anyone transcribed + the code in single precision errors approaching 1 arcmin could + have resulted. The new formulation delivers good results all + over the sky even in a single precision version. + +* Routines have been added to transform equatorial coordinates + (HA,Dec) to horizon coordinates (Az,El) and back. Single and + double precision are both supported. The routines are called + sla_E2H, sla_DE2H, sla_H2E, sla_DH2E. + +* A new routine has been added to the tangent-plane projection set. + The single and double precision versions are called sla_TPRD and + sla_DTPRD respectively. Given the RA,Dec of a star and its + xi,eta coordinates, the routine determines the "plate centre". + +* The existing routine sla_PREC for obtaining the precession matrix + uses the official IAU model and should continue to be used for + canonical purposes. A new version, called sla_PRECL, uses a + more up-to-date model which delivers better accuracy, especially + over intervals of millennia. + +* The routine sla_PVOBS was returning velocities in AU per sidereal + second rather than per UT second. This has been corrected. The + maximum error was equivalent to about 0.001 km/s. + +* In sla_MAPQK and sla_MAPQKZ, the area within which the gravitional + light-deflection term is restrained has been extended from its + original 300 arcsec radius to about 920 arcsec, just inside the + Sun's disc. + +* A chapter of explanation, with examples, has been added to SUN/67, + which has also undergone various cosmetic revisions. + +* There were two discrepancies between the documentation of sla_DCMPF + (program comments and SUN/67) and the code. The first was that the + formulae for the nonperpendicularity used PERP instead of PERP/2; + the documentation has been corrected. The other was that the + documentation showed the zero point corrections being applied first, + whereas the code returned zero point corrections corresponding to + being applied last. The code has been corrected to match the + documentation. + +* The C module slaCldj gave incorrect answers for dates during + January and February. The error, which did not affect the Fortran + version, has been corrected. + +* THE CALL FOR TPRD AND DTPRD HAS BEEN CHANGED. An integer status + argument has been added; non-zero means the supplied RA,Dec + and Xi,Eta describe an impossible case. (This can only happen + near the pole and with non-zero Xi.) Also, a slightly neater + formulation has been introduced. + +* Three new routines have been added. ALTAZ takes a star's HA,Dec + and produces position, velocity and acceleration for azimuth, + elevation and parallactic angle. PDA2H predicts the HA at which + a given azimuth will be reached. PDQ2H does the same for + position angle. + +* In the OBS routine, the wrong sign was returned for the Perkins + 72 inch telescope at Lowell - fixed. + +* A revised model for the equation of the equinoxes has been + installed in EQEQX, in line with recent IAU resolutions. The + change amounts to less than 3 mas. + +* A bug in DFLTIN has been corrected. A negative number following + an E- or D-format number without intervening spaces lost its + sign. + +* Four stations have been added to OBS: + + TAUTENBERG Tautenberg 1.34 metre Schmidt + PALOMAR48 Palomar 48-inch Schmidt + UKST UK 1.2 metre Schmidt, Siding Spring + KISO Kiso 1.05 metre Schmidt, Japan + ESOSCHMIDT ESO 1 metre Schmidt, La Silla + +* The EARTH and MOON routines could give an integer divide by zero + for years before 1 BC. This has been corrected. + +* CALYD (provided to support the EARTH and MOON routines) has been + upgraded to work outside the interval 1900 March 1 to + 2100 February 28. The status value indicating dates outside that + range has been dropped; a new error value for year before -4711 + has been introduced. + +* A new routine, CLYD, has been added. It is a version of CALYD + without the century-default feature and is to enable 1st-century + dates to be supplied to EARTH and MOON. + +* Two new routines, PLANETS and RDPLAN, have been added, which + compute approximate planetary ephemerides. + +* A new routine, DMOON, implements the same (Meeus) model as the + MOON routine, but in full and in double precision. The time + argument is a straightforward MJD rather than MOON's year and + day-in-year. + +* The REFRO code has been speeded up by a factor of two (and is + also clearer). + +* REFV and REFZ have, in different ways, been made more accurate for + cases close to the horizon. The improvement to REFV is relatively + modest, but REFZ is now capable of delivering useful results for + rise/set phenomena. + +* AOPQK has been speeded up for low-elevation cases. + +* Versions of the tangent-plane routines working directly in x,y,z + instead of spherical coordinates have been added. They may be + faster in some applications. The routines are DV2TP, V2TP, DTP2V, + TP2V, DTPXYZ, TPXYZ. + +* The coordinates of the Australia Telescope Compact Array have been + added to OBS. The name is 'ATCA'. + +* Despite their recent introduction THE ROUTINES DTPRD, DTPXYZ, TPRD + AND TPXYZ HAVE BEEN WITHDRAWN. They have been replaced by the new + routines DTPS2C, DTPV2C, TPS2C and TPV2C. These are functionally + equivalent to the earlier routines but return two solutions instead + of one: the second solution can arise near a pole. + +* The UTC leap second at the end of 1995 has been added to sla_DAT. + +* The refraction routine REFRO has been extensively revised. The + principal motivation was to improve the radio predictions by + introducing better humidity models. The models previously in + use had been entirely adequate for the optical case, for which + they had been devised, but improved models were required for + the radio case. None of the changes significantly affects the + optical results with respect to the earlier version of the REFRO + routine. For example, at 70 deg zenith distance the new version + agrees with the old version to better than 0.05 arcsec for any + reasonable combination of parameters. However, the improved + water-vapour expressions do make a significant difference in the + radio band, at 70 deg zenith distance reaching almost 4 arcsec + for a hot, humid, low-altitude site during a period of low pressure. + +* There was a bug in the (private) C version of RDPLAN. The + answers were unaffected but there could be floating-point + problems on some platforms. + +* A new routine has been added, GMSTA. This gives greater numerical + precision than the existing GMST function by allowing the date and + time to be specified separately rather than as a single MJD. + +* Measures taken in MAPQK to avoid trouble when processing Solar + positions had not been carried through into MAPQKZ. The two + routines now use the same strategy. + +* In REFRO, at zenith distances well beyond 90 deg and under some + conditions, it was possible to encounter arithmetic errors due to + failure of the tropospheric model-atmosphere to deliver sensible + temperatures. This is inherent in the published algorithm. To + avoid the problem, the temperature delivered by the model has been + constrained to the range 200 to 320 deg K. + +* A new routine has been added, ATMDSP, for rapidly recalculating + the A,B refraction coefficients for different wavelengths. + +* The first UTC leap-second date in the DAT routine was one day early. + This will have had no effect on the results for more recent epochs. + +* The C version of OBS had some problems related to character string + handling. A call using the "number" option retured an invalid + station ID, and station ID and name strings of the stipulated 10 + and 40 character lengths were improperly terminated. + +* A new routine, POLMO has been added. This is a specialist tool + to do with Earth polar motion. + +* DC62S and CC62S could give floating point errors if vectors in + unlikely units were supplied. The handling of difficult cases + has been improved. + +* Support for Linux has been added. + +* The C version of REFRO was not re-entrant. It is now; there has + been a small (4%) speed penalty. + +* RANDOM, GRESID and WAIT have been dropped from the C version. They + could not easily be made re-entrant and posed perennial platform- + dependency problems. + +* The value for the arcsec to radians factor in several routines + had an incorrect (and superfluous) 19th digit, which has been + removed. + +* There was a minor bug in DV2TP and V2TP, to do with protection + against the special case where the tangent point is the pole. + +* In OBS, the position of the Parkes radiotelescope has been revised, + and the ATNF Mopra observatory has been added. + +* Two new routines have been added. PAV (single precision) and DPAV + (double precision) are like BEAR and DBEAR but start with direction + cosines rather than spherical coordinates - they return the position + angle of one point with respect to the other. + +* The C version of REFRO still wasn't re-entrant, but is now. + +* The C version of DTF2D used to accept 60.0 in the seconds field; + this has been corrected. + +* The PLANET and RDPLAN routines now include Pluto. The ephemeris + is accurate (sub-arcsecond) but covers the 20th and 21st centuries + only. + + !!! IMPORTANT NOTE !!! + + RDPLAN used to interpret any planet number outside the range 1-8 + as meaning the Sun. The new version uses planet number 9. Existing + programs using 9 for the Sun should be changed to use 0. The rule + has not been changed, except that the range is now 1-9 instead of + 1-8, as it is unlikely that the equivalent problem will arise in the + future. + +* Two new routines have been added, PLANEL and PLANTE. They are + analogues of PLANET and RDPLAN but for the case where orbital + elements are available. They can be used for predicting the + positions of asteroids and comets, and, if up-to-date osculating + elements are supplied, more accurate positions for the major + planets than can be provided through the PLANET and RDPLAN + routines. + +* The REFRO routine could give inaccurate results for low temperatures + (subzero C). This was caused by over-cautious defensive programming, + which prevented the tropospheric temperature falling below 200 K. + +* A new routine has been added, REFCOQ. This calculates the coefficients + of a two-term refraction model. It complements the existing REFCO + routine, being much faster at the expense of some accuracy. + +* The 1997 July 1 UTC leap second has been added to the DAT routine. + +* A bug in the C version of SVD (slaSvd) caused occasional false + indications of ill-conditioning. The results of least-squares + fits do not seem to have been affected. The Fortran version + (sla_SVD) did not have the bug. + +* The Subaru telescope (Japanese National 8-metre telescope, Mauna Kea) + has been added to the OBS routine. + +* The DAT routine has been extended back to the inception of UTC in + 1960. + +* The "earliest date possible" in DJCL was two days out (disagreeing + with DJCAL, which had the correct value). + +* The GMSTA code has been improved. + +* A new routine, PV2EL, takes a heliocentric J2000 equatorial position + and velocity and produces the equivalent set of osculating elements. + +* The 1999 January 1 UTC leap second has been added to the DAT routine. + +* Four new routines have been introduced which transform between the + FK5 system and the ICRS (Hipparcos) system. FK52H and H2FK5 transform + star positions and proper motions from FK5 coordinates to Hipparcos + coordinates and vice versa. FK5HZ and HFK5Z do the same but for the + case where the Hipparcos proper motions are zero. + +* Six new routines have been introduced for dealing with orbital elements. + Four of them (sla_EL2UE, sla_PV2UE, sla_UE2EL and sla_UE2PV) provide + applications with direct access to the "universal variables" method + that was already being used internally. Compared with using conventional + (angular) elements and solving Kepler's equation, the universal variables + approach has a number of advantages, including better handling of near- + parabolic orbits and greater efficiency. The remaining two routines + (sla_PERTEL and sla_PERTUE) generate updated elements by applying + major-planet perturbations. The new elements can then be used to + predict positions that are much more accurate. For minor planets, + sub-arcsecond accuracy over a decade is achievable. + +* Several observatory sites have been added to the OBS routine: CFHT, + Keck 2, Gemini North, FCRAO, IRTF and CSO. The coordinates for all + the Mauna Kea sites have been updated in accordance with recent aerial + photography results made available by the Institute for Astronomy, + University of Hawaii. + +* A coding error in DAT produced incorrect results for dates in the + first 54 days of 1972. + +----------------------------------------------------------------------- + + + P.T.Wallace + + ptw@star.rl.ac.uk + +44-1235-44-5372 diff --git a/math/slalib/doc/refco.hlp b/math/slalib/doc/refco.hlp new file mode 100644 index 00000000..98be6d4c --- /dev/null +++ b/math/slalib/doc/refco.hlp @@ -0,0 +1,54 @@ +.help refco Jun99 "Slalib Package" +.nf + + SUBROUTINE slRFCO (HM, TDK, PMB, RH, WL, PHI, TLR, EPS, + : REFA, REFB) + + - - - - - - + R F C O + - - - - - - + + Determine the constants A and B in the atmospheric refraction + model dZ = A tan Z + B tan**3 Z. + + Z is the "observed" zenith distance (i.e. affected by refraction) + and dZ is what to add to Z to give the "topocentric" (i.e. in vacuo) + zenith distance. + + Given: + HM d height of the observer above sea level (metre) + TDK d ambient temperature at the observer (deg K) + PMB d pressure at the observer (millibar) + RH d relative humidity at the observer (range 0-1) + WL d effective wavelength of the source (micrometre) + PHI d latitude of the observer (radian, astronomical) + TLR d temperature lapse rate in the troposphere (degK/metre) + EPS d precision required to terminate iteration (radian) + + Returned: + REFA d tan Z coefficient (radian) + REFB d tan**3 Z coefficient (radian) + + Called: slRFRO + + Notes: + + 1 Typical values for the TLR and EPS arguments might be 0.0065D0 and + 1D-10 respectively. + + 2 The radio refraction is chosen by specifying WL > 100 micrometres. + + 3 The routine is a slower but more accurate alternative to the + slRFCQ routine. The constants it produces give perfect + agreement with slRFRO at zenith distances arctan(1) (45 deg) + and arctan(4) (about 76 deg). It achieves 0.5 arcsec accuracy + for ZD < 80 deg, 0.01 arcsec accuracy for ZD < 60 deg, and + 0.001 arcsec accuracy for ZD < 45 deg. + + P.T.Wallace Starlink 3 June 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/refcoq.hlp b/math/slalib/doc/refcoq.hlp new file mode 100644 index 00000000..153ed66e --- /dev/null +++ b/math/slalib/doc/refcoq.hlp @@ -0,0 +1,167 @@ +.help refcoq Jun99 "Slalib Package" +.nf + + SUBROUTINE slRFCQ (TDK, PMB, RH, WL, REFA, REFB) + + - - - - - - - + R F C Q + - - - - - - - + + Determine the constants A and B in the atmospheric refraction + model dZ = A tan Z + B tan**3 Z. This is a fast alternative + to the slRFCO routine - see notes. + + Z is the "observed" zenith distance (i.e. affected by refraction) + and dZ is what to add to Z to give the "topocentric" (i.e. in vacuo) + zenith distance. + + Given: + TDK d ambient temperature at the observer (deg K) + PMB d pressure at the observer (millibar) + RH d relative humidity at the observer (range 0-1) + WL d effective wavelength of the source (micrometre) + + Returned: + REFA d tan Z coefficient (radian) + REFB d tan**3 Z coefficient (radian) + + The radio refraction is chosen by specifying WL > 100 micrometres. + + Notes: + + 1 The model is an approximation, for moderate zenith distances, + to the predictions of the slRFRO routine. The approximation + is maintained across a range of conditions, and applies to + both optical/IR and radio. + + 2 The algorithm is a fast alternative to the slRFCO routine. + The latter calls the slRFRO routine itself: this involves + integrations through a model atmosphere, and is costly in + processor time. However, the model which is produced is precisely + correct for two zenith distance (45 degrees and about 76 degrees) + and at other zenith distances is limited in accuracy only by the + A tan Z + B tan**3 Z formulation itself. The present routine + is not as accurate, though it satisfies most practical + requirements. + + 3 The model omits the effects of (i) height above sea level (apart + from the reduced pressure itself), (ii) latitude (i.e. the + flattening of the Earth) and (iii) variations in tropospheric + lapse rate. + + The model was tested using the following range of conditions: + + lapse rates 0.0055, 0.0065, 0.0075 deg/metre + latitudes 0, 25, 50, 75 degrees + heights 0, 2500, 5000 metres ASL + pressures mean for height -10% to +5% in steps of 5% + temperatures -10 deg to +20 deg with respect to 280 deg at SL + relative humidity 0, 0.5, 1 + wavelengths 0.4, 0.6, ... 2 micron, + radio + zenith distances 15, 45, 75 degrees + + The accuracy with respect to direct use of the slRFRO routine + was as follows: + + worst RMS + + optical/IR 62 mas 8 mas + radio 319 mas 49 mas + + For this particular set of conditions: + + lapse rate 0.0065 degK/metre + latitude 50 degrees + sea level + pressure 1005 mB + temperature 280.15 degK + humidity 80% + wavelength 5740 Angstroms + + the results were as follows: + + ZD slRFRO slRFCQ Saastamoinen + + 10 10.27 10.27 10.27 + 20 21.19 21.20 21.19 + 30 33.61 33.61 33.60 + 40 48.82 48.83 48.81 + 45 58.16 58.18 58.16 + 50 69.28 69.30 69.27 + 55 82.97 82.99 82.95 + 60 100.51 100.54 100.50 + 65 124.23 124.26 124.20 + 70 158.63 158.68 158.61 + 72 177.32 177.37 177.31 + 74 200.35 200.38 200.32 + 76 229.45 229.43 229.42 + 78 267.44 267.29 267.41 + 80 319.13 318.55 319.10 + + deg arcsec arcsec arcsec + + The values for Saastamoinen's formula (which includes terms + up to tan^5) are taken from Hohenkerk and Sinclair (1985). + + The results from the much slower but more accurate slRFCO + routine have not been included in the tabulation as they are + identical to those in the slRFRO column to the 0.01 arcsec + resolution used. + + 4 Outlandish input parameters are silently limited to mathematically + safe values. Zero pressure is permissible, and causes zeroes to + be returned. + + 5 The algorithm draws on several sources, as follows: + + a) The formula for the saturation vapour pressure of water as + a function of temperature and temperature is taken from + expressions A4.5-A4.7 of Gill (1982). + + b) The formula for the water vapour pressure, given the + saturation pressure and the relative humidity, is from + Crane (1976), expression 2.5.5. + + c) The refractivity of air is a function of temperature, + total pressure, water-vapour pressure and, in the case + of optical/IR but not radio, wavelength. The formulae + for the two cases are developed from the Essen and Froome + expressions adopted in Resolution 1 of the 12th International + Geodesy Association General Assembly (1963). + + The above three items are as used in the slRFRO routine. + + d) The formula for beta, the ratio of the scale height of the + atmosphere to the geocentric distance of the observer, is + an adaption of expression 9 from Stone (1996). The + adaptations, arrived at empirically, consist of (i) a + small adjustment to the coefficient and (ii) a humidity + term for the radio case only. + + e) The formulae for the refraction constants as a function of + n-1 and beta are from Green (1987), expression 4.31. + + References: + + Crane, R.K., Meeks, M.L. (ed), "Refraction Effects in the Neutral + Atmosphere", Methods of Experimental Physics: Astrophysics 12B, + Academic Press, 1976. + + Gill, Adrian E., "Atmosphere-Ocean Dynamics", Academic Press, 1982. + + Hohenkerk, C.Y., & Sinclair, A.T., NAO Technical Note No. 63, 1985. + + International Geodesy Association General Assembly, Bulletin + Geodesique 70 p390, 1963. + + Stone, Ronald C., P.A.S.P. 108 1051-1058, 1996. + + Green, R.M., "Spherical Astronomy", Cambridge University Press, 1987. + + P.T.Wallace Starlink 4 June 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/refro.hlp b/math/slalib/doc/refro.hlp new file mode 100644 index 00000000..8b66c95d --- /dev/null +++ b/math/slalib/doc/refro.hlp @@ -0,0 +1,123 @@ +.help refro Jun99 "Slalib Package" +.nf + + SUBROUTINE slRFRO (ZOBS, HM, TDK, PMB, RH, WL, PHI, TLR, + : EPS, REF) + + - - - - - - + R F R O + - - - - - - + + Atmospheric refraction for radio and optical/IR wavelengths. + + Given: + ZOBS d observed zenith distance of the source (radian) + HM d height of the observer above sea level (metre) + TDK d ambient temperature at the observer (deg K) + PMB d pressure at the observer (millibar) + RH d relative humidity at the observer (range 0-1) + WL d effective wavelength of the source (micrometre) + PHI d latitude of the observer (radian, astronomical) + TLR d temperature lapse rate in the troposphere (degK/metre) + EPS d precision required to terminate iteration (radian) + + Returned: + REF d refraction: in vacuo ZD minus observed ZD (radian) + + Notes: + + 1 A suggested value for the TLR argument is 0.0065D0. The + refraction is significantly affected by TLR, and if studies + of the local atmosphere have been carried out a better TLR + value may be available. + + 2 A suggested value for the EPS argument is 1D-8. The result is + usually at least two orders of magnitude more computationally + precise than the supplied EPS value. + + 3 The routine computes the refraction for zenith distances up + to and a little beyond 90 deg using the method of Hohenkerk + and Sinclair (NAO Technical Notes 59 and 63, subsequently adopted + in the Explanatory Supplement, 1992 edition - see section 3.281). + + 4 The code is a development of the optical/IR refraction subroutine + AREF of C.Hohenkerk (HMNAO, September 1984), with extensions to + support the radio case. Apart from merely cosmetic changes, the + following modifications to the original HMNAO optical/IR refraction + code have been made: + + . The angle arguments have been changed to radians. + + . Any value of ZOBS is allowed (see note 6, below). + + . Other argument values have been limited to safe values. + + . Murray's values for the gas constants have been used + (Vectorial Astrometry, Adam Hilger, 1983). + + . The numerical integration phase has been rearranged for + extra clarity. + + . A better model for Ps(T) has been adopted (taken from + Gill, Atmosphere-Ocean Dynamics, Academic Press, 1982). + + . More accurate expressions for Pwo have been adopted + (again from Gill 1982). + + . Provision for radio wavelengths has been added using + expressions devised by A.T.Sinclair, RGO (private + communication 1989), based on the Essen & Froome + refractivity formula adopted in Resolution 1 of the + 13th International Geodesy Association General Assembly + (Bulletin Geodesique 70 p390, 1963). + + . Various small changes have been made to gain speed. + + None of the changes significantly affects the optical/IR results + with respect to the algorithm given in the 1992 Explanatory + Supplement. For example, at 70 deg zenith distance the present + routine agrees with the ES algorithm to better than 0.05 arcsec + for any reasonable combination of parameters. However, the + improved water-vapour expressions do make a significant difference + in the radio band, at 70 deg zenith distance reaching almost + 4 arcsec for a hot, humid, low-altitude site during a period of + low pressure. + + 5 The radio refraction is chosen by specifying WL > 100 micrometres. + Because the algorithm takes no account of the ionosphere, the + accuracy deteriorates at low frequencies, below about 30 MHz. + + 6 Before use, the value of ZOBS is expressed in the range +/- pi. + If this ranged ZOBS is -ve, the result REF is computed from its + absolute value before being made -ve to match. In addition, if + it has an absolute value greater than 93 deg, a fixed REF value + equal to the result for ZOBS = 93 deg is returned, appropriately + signed. + + 7 As in the original Hohenkerk and Sinclair algorithm, fixed values + of the water vapour polytrope exponent, the height of the + tropopause, and the height at which refraction is negligible are + used. + + 8 The radio refraction has been tested against work done by + Iain Coulson, JACH, (private communication 1995) for the + James Clerk Maxwell Telescope, Mauna Kea. For typical conditions, + agreement at the 0.1 arcsec level is achieved for moderate ZD, + worsening to perhaps 0.5-1.0 arcsec at ZD 80 deg. At hot and + humid sea-level sites the accuracy will not be as good. + + 9 It should be noted that the relative humidity RH is formally + defined in terms of "mixing ratio" rather than pressures or + densities as is often stated. It is the mass of water per unit + mass of dry air divided by that for saturated air at the same + temperature and pressure (see Gill 1982). + + Called: slDA1P, slATMT, slATMS + + P.T.Wallace Starlink 3 June 1997 + + Copyright (C) 1997 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/refv.hlp b/math/slalib/doc/refv.hlp new file mode 100644 index 00000000..104736a5 --- /dev/null +++ b/math/slalib/doc/refv.hlp @@ -0,0 +1,79 @@ +.help refv Jun99 "Slalib Package" +.nf + + SUBROUTINE slREFV (VU, REFA, REFB, VR) + + - - - - - + R E F V + - - - - - + + Adjust an unrefracted Cartesian vector to include the effect of + atmospheric refraction, using the simple A tan Z + B tan**3 Z + model. + + Given: + VU dp unrefracted position of the source (Az/El 3-vector) + REFA dp tan Z coefficient (radian) + REFB dp tan**3 Z coefficient (radian) + + Returned: + VR dp refracted position of the source (Az/El 3-vector) + + Notes: + + 1 This routine applies the adjustment for refraction in the + opposite sense to the usual one - it takes an unrefracted + (in vacuo) position and produces an observed (refracted) + position, whereas the A tan Z + B tan**3 Z model strictly + applies to the case where an observed position is to have the + refraction removed. The unrefracted to refracted case is + harder, and requires an inverted form of the text-book + refraction models; the algorithm used here is equivalent to + one iteration of the Newton-Raphson method applied to the above + formula. + + 2 Though optimized for speed rather than precision, the present + routine achieves consistency with the refracted-to-unrefracted + A tan Z + B tan**3 Z model at better than 1 micro-arcsecond within + 30 degrees of the zenith and remains within 1 milliarcsecond to + beyond ZD 70 degrees. The inherent accuracy of the model is, of + course, far worse than this - see the documentation for slRFCO + for more information. + + 3 At low elevations (below about 3 degrees) the refraction + correction is held back to prevent arithmetic problems and + wildly wrong results. Over a wide range of observer heights + and corresponding temperatures and pressures, the following + levels of accuracy (arcsec) are achieved, relative to numerical + integration through a model atmosphere: + + ZD error + + 80 0.4 + 81 0.8 + 82 1.6 + 83 3 + 84 7 + 85 17 + 86 45 + 87 150 + 88 340 + 89 620 + 90 1100 + 91 1900 } relevant only to + 92 3200 } high-elevation sites + + 4 See also the routine slREFZ, which performs the adjustment to + the zenith distance rather than in Cartesian Az/El coordinates. + The present routine is faster than slREFZ and, except very low down, + is equally accurate for all practical purposes. However, beyond + about ZD 84 degrees slREFZ should be used, and for the utmost + accuracy iterative use of slRFRO should be considered. + + P.T.Wallace Starlink 26 December 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/refz.hlp b/math/slalib/doc/refz.hlp new file mode 100644 index 00000000..5c91ab03 --- /dev/null +++ b/math/slalib/doc/refz.hlp @@ -0,0 +1,78 @@ +.help refz Jun99 "Slalib Package" +.nf + + SUBROUTINE slREFZ (ZU, REFA, REFB, ZR) + + - - - - - + R E F Z + - - - - - + + Adjust an unrefracted zenith distance to include the effect of + atmospheric refraction, using the simple A tan Z + B tan**3 Z + model (plus special handling for large ZDs). + + Given: + ZU dp unrefracted zenith distance of the source (radian) + REFA dp tan Z coefficient (radian) + REFB dp tan**3 Z coefficient (radian) + + Returned: + ZR dp refracted zenith distance (radian) + + Notes: + + 1 This routine applies the adjustment for refraction in the + opposite sense to the usual one - it takes an unrefracted + (in vacuo) position and produces an observed (refracted) + position, whereas the A tan Z + B tan**3 Z model strictly + applies to the case where an observed position is to have the + refraction removed. The unrefracted to refracted case is + harder, and requires an inverted form of the text-book + refraction models; the formula used here is based on the + Newton-Raphson method. For the utmost numerical consistency + with the refracted to unrefracted model, two iterations are + carried out, achieving agreement at the 1D-11 arcseconds level + for a ZD of 80 degrees. The inherent accuracy of the model + is, of course, far worse than this - see the documentation for + slRFCO for more information. + + 2 At ZD 83 degrees, the rapidly-worsening A tan Z + B tan**3 Z + model is abandoned and an empirical formula takes over. Over a + wide range of observer heights and corresponding temperatures and + pressures, the following levels of accuracy (arcsec) are + typically achieved, relative to numerical integration through a + model atmosphere: + + ZR error + + 80 0.4 + 81 0.8 + 82 1.5 + 83 3.2 + 84 4.9 + 85 5.8 + 86 6.1 + 87 7.1 + 88 10 + 89 20 + 90 40 + 91 100 } relevant only to + 92 200 } high-elevation sites + + The high-ZD model is scaled to match the normal model at the + transition point; there is no glitch. + + 3 Beyond 93 deg zenith distance, the refraction is held at its + 93 deg value. + + 4 See also the routine slREFV, which performs the adjustment in + Cartesian Az/El coordinates, and with the emphasis on speed + rather than numerical accuracy. + + P.T.Wallace Starlink 19 September 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/rverot.hlp b/math/slalib/doc/rverot.hlp new file mode 100644 index 00000000..5f61abd7 --- /dev/null +++ b/math/slalib/doc/rverot.hlp @@ -0,0 +1,40 @@ +.help rverot Jun99 "Slalib Package" +.nf + + REAL FUNCTION slRVER (PHI, RA, DA, ST) + + - - - - - - - + R V E R + - - - - - - - + + Velocity component in a given direction due to Earth rotation + (single precision) + + Given: + PHI real latitude of observing station (geodetic) + RA,DA real apparent RA,DEC + ST real local apparent sidereal time + + PHI, RA, DEC and ST are all in radians. + + Result: + Component of Earth rotation in direction RA,DA (km/s) + + Sign convention: + The result is +ve when the observatory is receding from the + given point on the sky. + + Accuracy: + The simple algorithm used assumes a spherical Earth, of + a radius chosen to give results accurate to about 0.0005 km/s + for observing stations at typical latitudes and heights. For + applications requiring greater precision, use the routine + slPVOB. + + P.T.Wallace Starlink 20 July 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/rvgalc.hlp b/math/slalib/doc/rvgalc.hlp new file mode 100644 index 00000000..b0e2773e --- /dev/null +++ b/math/slalib/doc/rvgalc.hlp @@ -0,0 +1,42 @@ +.help rvgalc Jun99 "Slalib Package" +.nf + + REAL FUNCTION slRVGA (R2000, D2000) + + - - - - - - - + R V G A + - - - - - - - + + Velocity component in a given direction due to the rotation + of the Galaxy (single precision) + + Given: + R2000,D2000 real J2000.0 mean RA,Dec (radians) + + Result: + Component of dynamical LSR motion in direction R2000,D2000 (km/s) + + Sign convention: + The result is +ve when the dynamical LSR is receding from the + given point on the sky. + + Note: The Local Standard of Rest used here is a point in the + vicinity of the Sun which is in a circular orbit around + the Galactic centre. Sometimes called the "dynamical" LSR, + it is not to be confused with a "kinematical" LSR, which + is the mean standard of rest of star catalogues or stellar + populations. + + Reference: The orbital speed of 220 km/s used here comes from + Kerr & Lynden-Bell (1986), MNRAS, 221, p1023. + + Called: + slCS2C, slVDV + + P.T.Wallace Starlink 23 March 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/rvlg.hlp b/math/slalib/doc/rvlg.hlp new file mode 100644 index 00000000..e333c1e4 --- /dev/null +++ b/math/slalib/doc/rvlg.hlp @@ -0,0 +1,36 @@ +.help rvlg Jun99 "Slalib Package" +.nf + + REAL FUNCTION slRVLG (R2000, D2000) + + - - - - - + R V L G + - - - - - + + Velocity component in a given direction due to the combination + of the rotation of the Galaxy and the motion of the Galaxy + relative to the mean motion of the local group (single precision) + + Given: + R2000,D2000 real J2000.0 mean RA,Dec (radians) + + Result: + Component of SOLAR motion in direction R2000,D2000 (km/s) + + Sign convention: + The result is +ve when the Sun is receding from the + given point on the sky. + + Reference: + IAU Trans 1976, 168, p201. + + Called: + slCS2C, slVDV + + P.T.Wallace Starlink June 1985 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/rvlsrd.hlp b/math/slalib/doc/rvlsrd.hlp new file mode 100644 index 00000000..f7539867 --- /dev/null +++ b/math/slalib/doc/rvlsrd.hlp @@ -0,0 +1,51 @@ +.help rvlsrd Jun99 "Slalib Package" +.nf + + REAL FUNCTION slRVLD (R2000, D2000) + + - - - - - - - + R V L D + - - - - - - - + + Velocity component in a given direction due to the Sun's motion + with respect to the dynamical Local Standard of Rest. + + (single precision) + + Given: + R2000,D2000 r J2000.0 mean RA,Dec (radians) + + Result: + Component of "peculiar" solar motion in direction R2000,D2000 (km/s) + + Sign convention: + The result is +ve when the Sun is receding from the given point on + the sky. + + Note: The Local Standard of Rest used here is the "dynamical" LSR, + a point in the vicinity of the Sun which is in a circular + orbit around the Galactic centre. The Sun's motion with + respect to the dynamical LSR is called the "peculiar" solar + motion. + + There is another type of LSR, called a "kinematical" LSR. A + kinematical LSR is the mean standard of rest of specified star + catalogues or stellar populations, and several slightly + different kinematical LSRs are in use. The Sun's motion with + respect to an agreed kinematical LSR is known as the "standard" + solar motion. To obtain a radial velocity correction with + respect to an adopted kinematical LSR use the routine slRVLK. + + Reference: Delhaye (1965), in "Stars and Stellar Systems", vol 5, + p73. + + Called: + slCS2C, slVDV + + P.T.Wallace Starlink 9 March 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/rvlsrk.hlp b/math/slalib/doc/rvlsrk.hlp new file mode 100644 index 00000000..04cbca89 --- /dev/null +++ b/math/slalib/doc/rvlsrk.hlp @@ -0,0 +1,50 @@ +.help rvlsrk Jun99 "Slalib Package" +.nf + + REAL FUNCTION slRVLK (R2000, D2000) + + - - - - - - - + R V L K + - - - - - - - + + Velocity component in a given direction due to the Sun's motion + with respect to an adopted kinematic Local Standard of Rest. + + (single precision) + + Given: + R2000,D2000 r J2000.0 mean RA,Dec (radians) + + Result: + Component of "standard" solar motion in direction R2000,D2000 (km/s) + + Sign convention: + The result is +ve when the Sun is receding from the given point on + the sky. + + Note: The Local Standard of Rest used here is one of several + "kinematical" LSRs in common use. A kinematical LSR is the + mean standard of rest of specified star catalogues or stellar + populations. The Sun's motion with respect to a kinematical + LSR is known as the "standard" solar motion. + + There is another sort of LSR, the "dynamical" LSR, which is a + point in the vicinity of the Sun which is in a circular orbit + around the Galactic centre. The Sun's motion with respect to + the dynamical LSR is called the "peculiar" solar motion. To + obtain a radial velocity correction with respect to the + dynamical LSR use the routine slRVLD. + + Reference: Delhaye (1965), in "Stars and Stellar Systems", vol 5, + p73. + + Called: + slCS2C, slVDV + + P.T.Wallace Starlink 11 March 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/s2tp.hlp b/math/slalib/doc/s2tp.hlp new file mode 100644 index 00000000..fb92a6f9 --- /dev/null +++ b/math/slalib/doc/s2tp.hlp @@ -0,0 +1,31 @@ +.help s2tp Jun99 "Slalib Package" +.nf + + SUBROUTINE slS2TP (RA, DEC, RAZ, DECZ, XI, ETA, J) + + - - - - - + S 2 T P + - - - - - + + Projection of spherical coordinates onto tangent plane: + "gnomonic" projection - "standard coordinates" + (single precision) + + Given: + RA,DEC real spherical coordinates of point to be projected + RAZ,DECZ real spherical coordinates of tangent point + + Returned: + XI,ETA real rectangular coordinates on tangent plane + J int status: 0 = OK, star on tangent plane + 1 = error, star too far from axis + 2 = error, antistar on tangent plane + 3 = error, antistar too far from axis + + P.T.Wallace Starlink 18 July 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/sedscript b/math/slalib/doc/sedscript new file mode 100755 index 00000000..3797f980 --- /dev/null +++ b/math/slalib/doc/sedscript @@ -0,0 +1,35 @@ +#!/bin/csh + +# EZSEDSCRIPT -- Script for automatically creating simple help for the +# SLALIB FORTRAN routines. +# +# First argument $1 is the month and year combined, e.g. Jun84 + +foreach file (../*.f) + set rootfile = `basename $file .f` + set package = '"Slalib Package"' + set outfile = $rootfile.hlp + set d = `echo \$d` + set s = `echo \$s` + echo $outfile + echo "1i\\ +.help $rootfile $1 $package\\ +.nf\\ +\ +/^\*-/a\\ +\\ +.fi\\ +.endhelp\ +/^\*-/,$d\ +1,$s/^*+//\ +1,$s/^*//" > tmpfile + sed -f tmpfile $file > $outfile + rm tmpfile +end + +rm atms.hlp +rm atmt.hlp +rm idchf.hlp +rm idchi.hlp +rm sla_test.hlp +cp slalib.hlp.sav slalib.hlp diff --git a/math/slalib/doc/sep.hlp b/math/slalib/doc/sep.hlp new file mode 100644 index 00000000..71808737 --- /dev/null +++ b/math/slalib/doc/sep.hlp @@ -0,0 +1,29 @@ +.help sep Jun99 "Slalib Package" +.nf + + REAL FUNCTION slSEP (A1, B1, A2, B2) + + - - - - + S E P + - - - - + + Angle between two points on a sphere (single precision) + + Given: + A1,B1 real spherical coordinates of one point + A2,B2 real spherical coordinates of the other point + + (The spherical coordinates are RA,Dec, Long,Lat etc, in radians.) + + The result is the angle, in radians, between the two points. It + is always positive. + + Called: slCS2C + + P.T.Wallace Starlink April 1985 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/sla.news b/math/slalib/doc/sla.news new file mode 100644 index 00000000..541b6c8a --- /dev/null +++ b/math/slalib/doc/sla.news @@ -0,0 +1,36 @@ +SLALIB_Version_2.3-0 Expiry 30 September 1999 + +The latest releases of SLALIB include the following changes: + +* The 1999 January 1 UTC leap second has been added to the DAT routine. + +* Four new routines have been introduced which transform between the + FK5 system and the ICRS (Hipparcos) system. FK52H and H2FK5 transform + star positions and proper motions from FK5 coordinates to Hipparcos + coordinates and vice versa. FK5HZ and HFK5Z do the same but for the + case where the Hipparcos proper motions are zero. + +* Six new routines have been introduced for dealing with orbital elements. + Four of them (sla_EL2UE, sla_PV2UE, sla_UE2EL and sla_UE2PV) provide + applications with direct access to the "universal variables" method + that was already being used internally. Compared with using conventional + (angular) elements and solving Kepler's equation, the universal variables + approach has a number of advantages, including better handling of near- + parabolic orbits and greater efficiency. The remaining two routines + (sla_PERTEL and sla_PERTUE) generate updated elements by applying + major-planet perturbations. The new elements can then be used to + predict positions that are much more accurate. For minor planets, + sub-arcsecond accuracy over a decade is achievable. + +* Several observatory sites have been added to the OBS routine: CFHT, + Keck 2, Gemini North, FCRAO, IRTF and CSO. The coordinates for all + the Mauna Kea sites have been updated in accordance with recent aerial + photography results made available by the Institute for Astronomy, + University of Hawaii. + + P.T.Wallace + 21 April 1999 + + ptw@star.rl.ac.uk + +44-1235-44-5372 +-------------------------------------------------------------------------- diff --git a/math/slalib/doc/slalib.hd b/math/slalib/doc/slalib.hd new file mode 100644 index 00000000..35fe8ea0 --- /dev/null +++ b/math/slalib/doc/slalib.hd @@ -0,0 +1,183 @@ +# Help directory the SLALIB library + +$slalib = "math$slalib/" + +addet hlp=addet.hlp, src=slalib$addet.f +afin hlp=afin.hlp, src=slalib$afin.f +airmas hlp=airmas.hlp, src=slalib$airmas.f +altaz hlp=altaz.hlp, src=slalib$altaz.f +amp hlp=amp.hlp, src=slalib$amp.f +ampqk hlp=ampqk.hlp, src=slalib$ampqk.f +aop hlp=aop.hlp, src=slalib$aop.f +aoppa hlp=aoppa.hlp, src=slalib$aoppa.f +aoppat hlp=aoppat.hlp, src=slalib$aoppat.f +aopqk hlp=aopqk.hlp, src=slalib$aopqk.f +atmdsp hlp=atmdsp.hlp, src=slalib$atmdsp.f +av2m hlp=av2m.hlp, src=slalib$av2m.f +bear hlp=bear.hlp, src=slalib$bear.f +caf2r hlp=caf2r.hlp, src=slalib$caf2r.f +caldj hlp=caldj.hlp, src=slalib$caldj.f +calyd hlp=calyd.hlp, src=slalib$calyd.f +cc2s hlp=cc2s.hlp, src=slalib$cc2s.f +cc62s hlp=cc62s.hlp, src=slalib$cc62s.f +cd2tf hlp=cd2tf.hlp, src=slalib$cd2tf.f +cldj hlp=cldj.hlp, src=slalib$cldj.f +clyd hlp=clyd.hlp, src=slalib$clyd.f +cr2af hlp=cr2af.hlp, src=slalib$cr2af.f +cr2tf hlp=cr2tf.hlp, src=slalib$cr2tf.f +cs2c hlp=cs2c.hlp, src=slalib$cs2c.f +cs2c6 hlp=cs2c6.hlp, src=slalib$cs2c6.f +ctf2d hlp=ctf2d.hlp, src=slalib$ctf2d.f +ctf2r hlp=ctf2r.hlp, src=slalib$ctf2r.f +daf2r hlp=daf2r.hlp, src=slalib$daf2r.f +dafin hlp=dafin.hlp, src=slalib$dafin.f +dat hlp=dat.hlp, src=slalib$dat.f +dav2m hlp=dav2m.hlp, src=slalib$dav2m.f +dbear hlp=dbear.hlp, src=slalib$dbear.f +dbjin hlp=dbjin.hlp, src=slalib$dbjin.f +dc62s hlp=dc62s.hlp, src=slalib$dc62s.f +dcc2s hlp=dcc2s.hlp, src=slalib$dcc2s.f +dcmpf hlp=dcmpf.hlp, src=slalib$dcmpf.f +dcs2c hlp=dcs2c.hlp, src=slalib$dcs2c.f +dd2tf hlp=dd2tf.hlp, src=slalib$dd2tf.f +de2h hlp=de2h.hlp, src=slalib$de2h.f +deuler hlp=deuler.hlp, src=slalib$deuler.f +dfltin hlp=dfltin.hlp, src=slalib$dfltin.f +dh2e hlp=dh2e.hlp, src=slalib$dh2e.f +dimxv hlp=dimxv.hlp, src=slalib$dimxv.f +djcal hlp=djcal.hlp, src=slalib$djcal.f +djcl hlp=djcl.hlp, src=slalib$djcl.f +dm2av hlp=dm2av.hlp, src=slalib$dm2av.f +dmat hlp=dmat.hlp, src=slalib$dmat.f +dmoon hlp=dmoon.hlp, src=slalib$dmoon.f +dmxm hlp=dmxm.hlp, src=slalib$dmxm.f +dmxv hlp=dmxv.hlp, src=slalib$dmxv.f +dpav hlp=dpav.hlp, src=slalib$dpav.f +dr2af hlp=dr2af.hlp, src=slalib$dr2af.f +dr2tf hlp=dr2tf.hlp, src=slalib$dr2tf.f +drange hlp=drange.hlp, src=slalib$drange.f +dranrm hlp=dranrm.hlp, src=slalib$dranrm.f +ds2c6 hlp=ds2c6.hlp, src=slalib$ds2c6.f +ds2tp hlp=ds2tp.hlp, src=slalib$ds2tp.f +dsep hlp=dsep.hlp, src=slalib$dsep.f +dt hlp=dt.hlp, src=slalib$dt.f +dtf2d hlp=dtf2d.hlp, src=slalib$dtf2d.f +dtf2r hlp=dtf2r.hlp, src=slalib$dtf2r.f +dtp2s hlp=dtp2s.hlp, src=slalib$dtp2s.f +dtp2v hlp=dtp2v.hlp, src=slalib$dtp2v.f +dtps2c hlp=dtps2c.hlp, src=slalib$dtps2c.f +dtpv2c hlp=dtpv2c.hlp, src=slalib$dtpv2c.f +dtt hlp=dtt.hlp, src=slalib$dtt.f +dv2tp hlp=dv2tp.hlp, src=slalib$dv2tp.f +dvdv hlp=dvdv.hlp, src=slalib$dvdv.f +dvn hlp=dvn.hlp, src=slalib$dvn.f +dvxv hlp=dvxv.hlp, src=slalib$dvxv.f +e2h hlp=e2h.hlp, src=slalib$e2h.f +earth hlp=earth.hlp, src=slalib$earth.f +ecleq hlp=ecleq.hlp, src=slalib$ecleq.f +ecmat hlp=ecmat.hlp, src=slalib$ecmat.f +ecor hlp=ecor.hlp, src=slalib$ecor.f +eg50 hlp=eg50.hlp, src=slalib$eg50.f +el2ue hlp=el2ue.hlp, src=slalib$el2ue.f +epb hlp=epb.hlp, src=slalib$epb.f +epb2d hlp=epb2d.hlp, src=slalib$epb2d.f +epco hlp=epco.hlp, src=slalib$epco.f +epj hlp=epj.hlp, src=slalib$epj.f +epj2d hlp=epj2d.hlp, src=slalib$epj2d.f +eqecl hlp=eqecl.hlp, src=slalib$eqecl.f +eqeqx hlp=eqeqx.hlp, src=slalib$eqeqx.f +eqgal hlp=eqgal.hlp, src=slalib$eqgal.f +etrms hlp=etrms.hlp, src=slalib$etrms.f +euler hlp=euler.hlp, src=slalib$euler.f +evp hlp=evp.hlp, src=slalib$evp.f +fitxy hlp=fitxy.hlp, src=slalib$fitxy.f +fk425 hlp=fk425.hlp, src=slalib$fk425.f +fk45z hlp=fk45z.hlp, src=slalib$fk45z.f +fk524 hlp=fk524.hlp, src=slalib$fk524.f +fk54z hlp=fk54z.hlp, src=slalib$fk54z.f +fk52h hlp=fk52h.hlp, src=slalib$fk52h.f +fk5hz hlp=fk5hz.hlp, src=slalib$fk5hz.f +flotin hlp=flotin.hlp, src=slalib$flotin.f +galeq hlp=galeq.hlp, src=slalib$galeq.f +galsup hlp=galsup.hlp, src=slalib$galsup.f +ge50 hlp=ge50.hlp, src=slalib$ge50.f +geoc hlp=geoc.hlp, src=slalib$geoc.f +gmst hlp=gmst.hlp, src=slalib$gmst.f +gmsta hlp=gmsta.hlp, src=slalib$gmsta.f +h2e hlp=h2e.hlp, src=slalib$h2e.f +h2fk5 hlp=h2fk5.hlp, src=slalib$h2fk5.f +hfk5z hlp=hfk5z.hlp, src=slalib$hfk5z.f +imxv hlp=imxv.hlp, src=slalib$imxv.f +intin hlp=intin.hlp, src=slalib$intin.f +invf hlp=invf.hlp, src=slalib$invf.f +kbj hlp=kbj.hlp, src=slalib$kbj.f +m2av hlp=m2av.hlp, src=slalib$m2av.f +map hlp=map.hlp, src=slalib$map.f +mappa hlp=mappa.hlp, src=slalib$mappa.f +mapqk hlp=mapqk.hlp, src=slalib$mapqk.f +mapqkz hlp=mapqkz.hlp, src=slalib$mapqkz.f +moon hlp=moon.hlp, src=slalib$moon.f +mxm hlp=mxm.hlp, src=slalib$mxm.f +mxv hlp=mxv.hlp, src=slalib$mxv.f +nut hlp=nut.hlp, src=slalib$nut.f +nutc hlp=nutc.hlp, src=slalib$nutc.f +oap hlp=oap.hlp, src=slalib$oap.f +oapqk hlp=oapqk.hlp, src=slalib$oapqk.f +obs hlp=obs.hlp, src=slalib$obs.f +pa hlp=pa.hlp, src=slalib$pa.f +pav hlp=pav.hlp, src=slalib$pav.f +pcd hlp=pcd.hlp, src=slalib$pcd.f +pda2h hlp=pda2h.hlp, src=slalib$pda2h.f +pdq2h hlp=pdq2h.hlp, src=slalib$pdq2h.f +pertel hlp=pertel.hlp, src=slalib$pertel.f +pertue hlp=pertue.hlp, src=slalib$pertue.f +planel hlp=planel.hlp, src=slalib$planel.f +planet hlp=planet.hlp, src=slalib$planet.f +plante hlp=plante.hlp, src=slalib$plante.f +pm hlp=pm.hlp, src=slalib$pm.f +polmo hlp=polmo.hlp, src=slalib$polmo.f +prebn hlp=prebn.hlp, src=slalib$prebn.f +prec hlp=prec.hlp, src=slalib$prec.f +preces hlp=preces.hlp, src=slalib$preces.f +precl hlp=precl.hlp, src=slalib$precl.f +precss hlp=precss.hlp, src=slalib$precss.f +prenut hlp=prenut.hlp, src=slalib$prenut.f +pv2ue hlp=pv2ue.hlp, src=slalib$pv2ue.f +pv2el hlp=pv2el.hlp, src=slalib$pv2el.f +pvobs hlp=pvobs.hlp, src=slalib$pvobs.f +pxy hlp=pxy.hlp, src=slalib$pxy.f +range hlp=range.hlp, src=slalib$range.f +ranorm hlp=ranorm.hlp, src=slalib$ranorm.f +rcc hlp=rcc.hlp, src=slalib$rcc.f +rdplan hlp=rdplan.hlp, src=slalib$rdplan.f +refco hlp=refco.hlp, src=slalib$refco.f +refcoq hlp=refcoq.hlp, src=slalib$refcoq.f +refro hlp=refro.hlp, src=slalib$refro.f +refv hlp=refv.hlp, src=slalib$refv.f +refz hlp=refz.hlp, src=slalib$refz.f +rverot hlp=rverot.hlp, src=slalib$rverot.f +rvgalc hlp=rvgalc.hlp, src=slalib$rvgalc.f +rvlg hlp=rvlg.hlp, src=slalib$rvlg.f +rvlsrd hlp=rvlsrd.hlp, src=slalib$rvlsrd.f +rvlsrk hlp=rvlsrk.hlp, src=slalib$rvlsrk.f +s2tp hlp=s2tp.hlp, src=slalib$s2tp.f +sep hlp=sep.hlp, src=slalib$sep.f +smat hlp=smat.hlp, src=slalib$smat.f +subet hlp=subet.hlp, src=slalib$subet.f +supgal hlp=supgal.hlp, src=slalib$supgal.f +svd hlp=svd.hlp, src=slalib$svd.f +svdcov hlp=svdcov.hlp, src=slalib$svdcov.f +svdsol hlp=svdsol.hlp, src=slalib$svdsol.f +tp2s hlp=tp2s.hlp, src=slalib$tp2s.f +tp2v hlp=tp2v.hlp, src=slalib$tp2v.f +tps2c hlp=tps2c.hlp, src=slalib$tps2c.f +tpv2c hlp=tpv2c.hlp, src=slalib$tpv2c.f +ue2el hlp=ue2el.hlp, src=slalib$ue2el.f +ue2pv hlp=ue2pv.hlp, src=slalib$ue2pv.f +unpcd hlp=unpcd.hlp, src=slalib$unpcd.f +v2tp hlp=v2tp.hlp, src=slalib$v2tp.f +vdv hlp=vdv.hlp, src=slalib$vdv.f +vn hlp=vn.hlp, src=slalib$vn.f +vxv hlp=vxv.hlp, src=slalib$vxv.f +xy2xy hlp=xy2xy.hlp, src=slalib$xy2xy.f +zd hlp=zd.hlp, src=slalib$zd.f diff --git a/math/slalib/doc/slalib.hlp b/math/slalib/doc/slalib.hlp new file mode 100644 index 00000000..8da465cf --- /dev/null +++ b/math/slalib/doc/slalib.hlp @@ -0,0 +1,591 @@ +.help slalib Nov95 "Immatch Package" +.ih +NAME +slalib -- Starlink library of positional astronomy routines + +.ih +DESCRIPTION +SLALIB is a library of Fortran 77 routines intended to make accurate +and reliable positional-astronomy applications easier to write. Most +SLALIB library routines are concerned with astronomical position and time, +but a number have wider trigonometrical, numerical or general applications. +SLALIB contains routines covering the following topics: 1) string +decoding and sexagesimal conversions, 2) angles, vectors and rotation +matrices, 3) calendars and timescales, 4) precession and nutation, 5) +proper motion, 6) FK4/5 and elliptic aberration, 7) geocentric coordinates, +8) apparent and observed place, 9) azimuth and elevation, 10) refraction +and air mass, 11) ecliptic, galactic, and supergalactic coordinates, +12) ephemerides, 13) astrometry, and 14) numerical methods. + +The labels and calling sequences of the SLALIB are listed below grouped +by function. To get more detailed help on any individual routine type +the help command followed by the label, e.g the command "help flotin" +will give detailed help on the subroutine slrfli. + +.ih +STRING DECODING +.nf + intin -- call subroutine slinti (string, nstrt, ireslt, jflag) + Convert free-format string into integer + +flotin -- call subroutine slrfli (string, nstrt, reslt, jflag) +dfltin -- call subroutine sldfli (string, nstrt, dreslt, jflag) + Convert free-format string into floating point number + + afin -- call subroutine slafin (string, iptr, a, j) + dafin -- call subroutine sldafn (string, iptr, a, j) + Convert free-format string from deg, armin, arcsec to radians +.fi +.ih +SEXAGESIMAL CONVERSIONS +.nf + ctf2d -- call subroutine slctfd (ihour, imin, sec, days, j) + dtf2d -- call subroutine sldtfd (ihour, imin, sec, days, j) + Hours, minutes, seconds to days + + cd2tf -- call subroutine slcdtf (ndp, days, sign, ihmsf) + dd2tf -- call subroutine slddtf (ndp, days, sign, ihmsf) + Days to hours, minutes, and seconds + + ctf2r -- call subroutine slctfr (ihour, imin, sec, rad, j) + dtf2r -- call subroutine sldtfr (ihour, imin, sec, rad, j) + Hours, minutes, seconds to radians + + cr2tf -- call subroutine slcrtf (ndp, angle, sign, ihmsf) + dr2tf -- call subroutine sldrtf (ndp, angle, sign, ihmsf) + Radians to hours, minutes, seconds + + caf2r -- call subroutine slcafr (ideg, iamin, asec, rad, j) + daf2r -- call subroutine sldafr (ideg, iamin, asec, rad, j) + Degrees, arcminutes, arcseconds to radians + + cr2af -- call subroutine slcraf (ndp, angle, sign, idmsf) + dr2af -- call subroutine sldraf (ndp, angle, sign, idmsf) + Radians to degrees, arcminutes, arcseconds +.fi +.ih +ANGLES, VECTORS AND ROTATION MATRICES +.nf + range -- r = slra1p (angle) +drange -- d = slda1p (angle) + Normalize angle into range [-pi,pi] + +ranorm -- r = slra2p (angle) +dranrm -- d = slda2p (angle) + Normalize angle into range [0,2pi] + + cs2c -- call subroutine slcs2c (a, b, v) + dcs2c -- call subroutine slds2c (a, b, v) + Spherical coordinates to [x,y,z] + + cc2s -- call subroutine slcc2s (v, a, b) + dcc2s -- call subroutine sldc2s (v, a, b) + [x,y,z] to spherical coordinates + + vdv -- r = slvdv (va, vb) + dvdv -- d = sldvdv (va, vb) + Scalar product of two 3-vectors + + vxv -- call subroutine slvxv (va, vb, vc) + dvxv -- call subroutine sldvxv (va, vb, vc) + Vector product of two 3-vectors + + vn -- call subroutine slvn (v, uv, vm) + dvn -- call subroutine sldvn (v, uv, vm) + Normalize a 3-vector also giving the modulus + + sep -- s = slsep (a1, b1, a2, b2) + dsep -- d = sldsep (a1, b1, a2, b2) + Angle between two points on a sphere + + bear -- s = slbear (a1, b1, a2, b2) + dbear -- d = sldber (a1, b1, a2, b2) + pav -- s = slpav (v1, v2) + dpav -- d = sldpav (v1, v2) + Direction of one point on a sphere seen from another + + euler -- call subroutine sleulr (order, phi, theta, psi, rmat) +deuler -- call subroutine sldeul (order, phi, theta, psi, rmat) + Form form rotation matrix from three Euler angles + + + av2m -- call subroutine slav2m (axvec, rmat) + dav2m -- call subroutine sldavm (axvec, rmat) + Form rotation matrix from axial vector + + m2av -- call subroutine slm2av (rmat, axvec) + dm2av -- call subroutine sldmav (rmat, axvec) + Determine axial vector from rotation matrix + + dmxv -- call subroutine sldmxv (dm, va, vb) + mxv -- call subroutine slmxv (rm, va, vb) + Rotate vector forwards + + imxv -- call subroutine slimxv (rm, va, vb) + dimxv -- call subroutine sldimv (dm, va, vb) + Rotate vector backwards + + dmxm -- call subroutine sldmxm (a, b, c) + mxm -- call subroutine slmxm (a, b, c) + Product of two 3X3 matrices + + cs2c6 -- call subroutine sls2c6 (a, b, r, ad, bd, rd, v) + ds2c6 -- call subroutine sldsc6 (a, b, r, ad, bd, rd, v) + Conversion of position/velocity from spherical to Cartesian + coordinates + + cc62s -- call subroutine slc62s (v, a, b, r, ad, bd, rd) + dc62s -- call subroutine sldc6s (v, a, b, r, ad, bd, rd) + Conversion of position/velocity from Cartesian to spherical + coordinates +.fi +.ih +CALENDARS +.nf + cldj -- call subroutine slcadj (iy, im, id, djm, j) + Gregorian calendar to Modified Julian Date + + caldj -- call subroutine slcadj (iy, im, id, djm, j) + Gregorian calendar to Modified Julian Date, permitting century by + default + + djcal -- call subroutine sldjca (ndp, djm, iymdf, j) + Modified Julian Date to Gregorian calendar, in a from convenient + for formatted output + + djcl -- call subroutine sldjcl (djm, iy, im, id, fd, j) + Modified Julian Date to Gregorian Year, Month, Day, Fraction + + calyd -- call subroutine slcayd (iy, im, id, ny, nd, j) + Calendar to year and day in year, permitting century default + + clyd -- call subroutine slclyd (iy, im, id, ny, nd, jstat) + Calendar to year and day in year + + epb -- d = slepb (date) + Modified Julian Date to Besselian Epoch + + epb2d -- d = sleb2d (epb) + Besselian epoch to Modified Julian Date + + epj -- d = slepj (date) + Modified Julian Date to Julian Epoch + + epj2d -- d = slej2d (epj) + Julian epoch to Modified Julian Date +.fi +.fi +.ih +TIMESCALES +.nf + gmst -- d = slgmst (ut1) + Conversion from Universal Time to siderial time + + gmsta -- d = slgmsa (date, ut) + Conversion from Universal Time to siderial time, rounding errors + minimized + + eqeqx -- d = sleqex (date) + Equation of the equinoxes + + dat -- d = sldat (utc) + Offset of Atomic Time from Coordinated Universal Time: + TAI - UTC + + dt -- d = sldt (epoch) + Approximate offset between dynamical time and universal time + + dtt -- d = sldtt (utc) + Offset of Terrestrial Time from Coordinated Universal Time: + TT - UTC + + rcc -- d = slrcc (tdb, ut1, wl, u, v) + Relativistic clock correction: TDB - TT +.fi +.ih +PRECESSION AND NUTATION +.nf + nut -- call subroutine slnut (date, rmatn) + Nutation matrix + + nutc -- call subroutine slnutc (date, dpsi, deps, eps0) + Longitude and obliquity components of nutation, mean obliquity + + prec -- call subroutine slprec (ep0, ep1, rmatp) + Precession matrix (IAU) + + precl -- call subroutine slprel (ep0, ep1, rmatp) + Precession matrix (suitable for long periods) + +prenut -- call subroutine slprnu (epoch, date, rmatpn) + Combined precession/nutation matrix + + prebn -- call subroutine slprbn (bep0, bep1, rmatp) + Precession matrix (old system) + +preces -- call subroutine slprce (system, ep0, ep1, ra, dc) + Precession in either the old or new system, character string + ep0 and ep1 + +precss -- call subroutine slprcs (system, ep0, ep1, ra, dc) + Precession in either the old or new system, integer ep0 and ep1 +.fi +.fi +.ih +PROPER MOTION +.nf + pm -- call subroutine slpm (r0, d0, pr, pd, px, rv, ep0, ep1, r1, d1) + Adjust for proper motion +.fi +.ih +FK4/5/ICRS CONVERSIONS +.nf + fk425 -- call subroutine slfk45 (r1950, d1950, dr1950, dd1950, + p1950, v1950, r2000, d2000, dr2000, dd2000, p2000, v2000) + Convert B1950.0 FK4 star data to J2000.0 FK5 + + fk45z -- call subroutine slf45z (r1950, d1950, bepoch, r2000, d2000) + Convert B1950.0 FK4 position to J2000.0 FK5 assuming zero proper + motion in an inertial frame and no parallax + + fk524 -- call subroutine slfk54 (r2000, d2000, dr2000, dd2000, + p2000, v2000, r1950, d1950, dr1950, dd1950, p1950, v1950) + Convert J2000.0 FK5 star data to B1950.0 FK4 + + fk54z -- call subroutine slf54z (r2000, d2000, bepoch, r1950, d1950, + dr1950, dd1950) + Convert J2000.0 FK5 star data to B1950.0 FK4 assuming zero proper + motion in an inertial frame and no parallax + + fk52h -- call subroutine slfk5h (r5, d5, dr5, dd5, rh, dh, drh, ddh) + Convert J2000.0 FK5 star data to ICRS J2000.0 data + + fk5hz -- call subroutine slf5hz (r5, d5, epoch, rh, dh) + Convert J2000.0 FK5 star data to ICRS J2000.0 data assuming + no Hipparcos proper motion. + + h2fk5 -- call subroutine slhfk5 (rh, dh, drh, ddh, r5, d5, dr5, dd5) + Convert ICRS J2000.0 data to J2000.0 Fk5 star data. + + hfk5z -- call subroutine slhf5z (rh, dh, epoch, r5, d5) + Convert ICRS J2000.0 data to J2000.0 Fk5 star data assuming no + Hipparchos proper motion. + + dbjin -- call subroutine sldbji (string, nstrt, dreslt, j1, j2) + Like dfltin but with extensions to accept leading 'B' and 'J' + + kbj -- call subroutine slkbj (jb, e, k, j) + Select epoch prefix 'B' or 'J' + + epco -- d = slepco (k0, k, e) + Convert an epoch into the appropriate form 'B' or 'J' +.fi +.ih +ELLIPTIC ABERRATIONS +.nf + etrms -- call subroutine sletrm (ep, ev) + E-terms + + subet -- call subroutine slsuet (rc, dc, eq, rm, dm) + Remove the E-terms + + addet -- call subroutine sladet (rm, dm, eq, rc, dc) + Add the E-terms +.fi +.ih +GEOCENTRIC COORDINATES +.nf + obs -- call subroutine slobs (n, c, name, w, p, h) + Interrogate list of observatory parameters + + geoc -- call subroutine slgeoc (p, h, r, z) + Convert geodetic position to geocentric + + pvobs -- call subroutine slpvob (p, h, stl, pv) + Position and velocity of observatory +.fi +.ih +APPARENT AND OBSERVED PLACE +.nf + map -- call subroutine slmap (rm, dm, pr, pd, px, rv, eq, date, ra, da) + Mean place to geocentric apparent place + + mappa -- call subroutine slmapa (eq, date, amprms) + Precompute mean to apparent parameters + + mapqk -- call subroutine slmapq (rm, dm, pr, pd, px, rv, amprms, ra, da) + Mean to apparent place using precomputed parameters + +mapqkz -- call subroutine slmapz (rm, dm, amprms, ra, da) + Mean to apparent place using precomputed parameters, for zero + proper motion, parallax, and radial velocity + + amp -- call subroutine slamp (ra, da, date, eq, rm, dm) + Geocentric apparent place to mean place + + ampqk -- call subroutine slampq (ra, da, amprms, rm, dm) + Apparent to mean place using precomputed parameters + + aop -- call subroutine slaop (rap, dap, date, dut, elongm, phim, hm, + xp, yp, tdk, pmb, rh, wl, tlr, aob, zob, hob, dob, rob) + Apparent place to observed place + + aoppa -- call subroutine slaopa (date, dut, elongm, phim, hm, xy, yp, + tdk, pmb, rh, wl, tlr, aoprms) + Precompute apparent to observed parameters + +aoppat -- call subroutine slaopt (date, aoprms) + Update siderial time in apparent to observed parameters + + aopqk -- call subroutine slaopq (rap, dap, aoprms, aob, zob, hob, dob, rob) + Apparent to observed using precomputed parameters + + oap -- call subroutine sloap (type, ob1, ob2, date, dut, elongm, phim, + xp, yp, tdk, pmb, rh, wl, tlr, rap, dap) + Observed to apparent + + oapqk -- call subroutine sloapq (type, ob1, ob2, aoprms, rap, dap) + Observed to apparent using precomputed parameters + + polmo -- call subroutine slplmo (elongim, phim, xp, yp, elong, phi, daz) + Correct site longitude and latitude for polar motion +.fi +.ih +AZIMUTH AND ELEVATION +.nf + altaz -- call subroutine slalaz (ha, dec, phi, + Positions, velocities, etc. for an altazimuth mount + + e2h -- call subroutine sle2h (ha, dec, phi, az, el) + de2h -- call subroutine slde2h (ha, dec, phi, az, el) + Hour angle and declination to azimuth and elevation + + h2e -- call subroutine slh2e (az, el, phi, ha, dec) + dh2e -- call subroutine sldh2e (az, el, phi, ha, dec) + Azimuth and elevation to hour angle and declination + + pda2h -- call subroutine slpdah (p, d, a, h1, j1, h2, j2) + Hour angle corresponding to a given azimuth + + pdq2h -- call subroutine slpdqh (p, d, q, h1, j1, h2, j2) + Hour angle corresponding to a given parallactic angle + + pa -- d = slpa (ha, dec, phi) + Hour angle and declination to parallactic angle + + zd -- d = slzd (ha, dec, phi) + Hour angle and declination to zenith distance +.fi +.ih +REFRACTION AND AIR MASS +.nf + refro -- call subroutine slrfro (zobs, hm, tdk, pmb, rh, wl, phi, tlr, + eps, ref) + Change in zenith distance due to refraction + + refco -- call subroutine slrfco (hm, tdk, pmb, rh, wl, phi, tlr, eps, + refa, refb) + Constants for simple refraction model + +refcoq -- call subroutine slrfcq (tdk, pmb, rl, wl, refa, refb) + Constants for simple refraction model (quick version) + +atmdsp -- call subroutine slatmd (tdk, pmb, rh, wl1, a1, b1, wl2, a2, b2) + Adjust refraction constants for color + + refz -- call subroutine slrefz (zu, refa, refb, zr) + Unrefracted to refracted zenith distance, simple model + + refv -- call subroutine slrefv (vu, refa, refb, vr) + Unrefracted to refracted azimuth and elevation, simple model + +airmas -- d = slarms (zd) + Air mass +.fi +.ih +ECLIPTIC COORDINATES +.nf + ecmat -- call subroutine slecma (date, rmat) + Equatorial to ecliptic rotation matrix + + eqecl -- call subroutine sleqec (dr, dd, date, dl, db) + J2000.0 FK5 to ecliptic coordinates + + ecleq -- call subroutine sleceq (dl, db, date, dr, dd) + Ecliptic to J2000.0 FK5 coordinates +.fi +.ih +GALACTIC COORDINATES +.nf + eg50 -- call subroutine sleg50 (dr, dd, dl, db) + B1950.0 FK4 to galactic coordinates + + ge50 -- call subroutine slge50 (dl, db, dr, dd) + Galactic to B1950.0 FK4 coordinates + + eqgal -- call subroutine sleqga (dr, dd, dl, db) + J2000.0 FK5 to galactic coordinates + + galeq -- call subroutine slgaeq (dl, db, dr, dd) + Galactic to J2000.0 FK5 coordinates +.fi +.ih +SUPERGALACTIC COORDINATES +.nf +galsup -- call subroutine slgasu (dl, db, dsl, dsb) + Galactic to supergalactic coordinates + +supgal -- call subroutine slsuga (dsl, dsb, dl, db) + Supergalactic to galactic coordinates +.fi +.ih +EPHEMERIDES +.nf + dmoon -- call subroutine sldmon (date, pv) + Approximate geocentric position and velocity of moon + + earth -- call subroutine slerth (iy, id, fd, pv) + Approximate heliocentric position and velocity of earth + + evp -- call subroutine slevp (date, deqx, dvb, dpb, dvh, dph) + Barycentric and heliocentric velocity and position of earth + + moon -- call subroutine slmoon (iy, id, fd, pv) + Approximate geocentric position and velocity of moon + +planet -- call subroutine slplnt (date, np, pv, jstat) + Approximate heliocentric position and velocity of planet + +rdplan -- call subroutine slrdpl (date, np, elong, phi, ra, dec, diam) + Approximate topocentric apparent place of a planet + +planel -- call subroutine slplnl (date, jform, epoch, orbinc, anode, + perih, aorg, e, aorl, dm, pv, jstat) + Approximate heliocentric position and velocity of planet + +plante -- call subroutine slplte (date, elong, phi, jform, epoch, orbinc, + anode, perih, aorq, e, aorl, dm, ra, dec, r, jstat) + Approximate topocentric apparent place of a planet + + pv2el -- call subroutine slpvel (pv, date, pmass, jformr, jform, epoch, + orbinc, anode, perih, aorg, e, aorl, dm, jstat) + Convert J2000 position and velocity to equivalent osculating elements + + el2ue -- call subroutine slelue (date, jform, epoch, orbinc, anode, perih, + aorq, e, aorl, dm, u, jstat) + Convert conventional osculating orbital elements into universal + form. + + ue2el -- call subroutine slueel (u, jformr, jform, epoch, orbinc, anode, + perih, aorq, e, aorl, dm, jstat) + Convert universal elements into conventional heliocentric osculating + form. + + pv2ue -- call subroutine slpvue (pv, date, pmass, u, jstat) + Construct a universal element set based on instantaneous position + and velocity. + + ue2pv -- call subroutine sluepv (date, u, pv, jstat) + Compute heliocentric position and velocity of a planet, asteroid, or + comet, starting from orbital elements in the "universal variables" + form. + +pertel -- call subroutine slprtl (jform, date0, date1, epoch0, epoch1, + orbi0, anode0, perih0, aorq0, e0, am0, epoch1, orbi1, anode1, + perih1, aorq1m e1, am1, jstat) + Update the osculating elements of a comet or asteroid by applying + planetary perturbations. + +pertue -- call subroutine slprue (date, u, jstat) + Update universal elements of a comet or asteroid by applying planetary + perturbations. +.fi +.ih +RADIAL VELOCITIES +rverot -- s = slrver (phi, ra, da, st) + Velocity component due to rotation of the earth + + ecor -- call subroutine slecor (rm, dm, iy, id, fd, rv, tl) + Components of velocity and light time due to earth orbital motion + +rvlsrd -- r = slrvld (r2000, d2000) + Velocity component due to solar motion wrt dynamical LSR + +rvlsrk -- r = slrvlk (r2000, d2000) + Velocity component due to solar motion wrt kinematical LSR + +rvgalc -- r = slrvga (r2000, d2000) + Velocity component due to rotation of the Galaxy + + rvlg -- r = slrvlg (r2000, d2000) + Velocity component due to rotation and translation of the Galaxy, + relative to the mean motion of the local group +.fi +.ih +ASTROMETRY +.nf + s2tp -- call subroutine sls2tp (ra, dec, raz, decz, xi, eta, j) + ds2tp -- call subroutine sldstp (ra, dec, raz, decz, xi, eta, j) + Transform spherical into tangent plane coordinates + + v2tp -- call subroutine slv2tp (v, v0, xi, eta, j) + dv2tp -- call subroutine sldvtp (v, v0, xi, eta, j) + Transform [x,y,z] into tangent plane coordinates + + tp2s -- call subroutine sltp2s (xi, eta, raz, decz, ra, dec) + dtp2s -- call subroutine sldtps (xi, eta, raz, decz, ra, dec) + Transform tangent plane into spherical coordinates + + tp2v -- call subroutine sltp2v (xi, eta, v0, v) + dtp2v -- call subroutine sldtpv (xi, eta, v0, v) + Transform tangent plane coordinates into [x,y,z] + + tps2c -- call subroutine sltpsc (xi, eta, ra, dec, raz1, decz1, + raz2, decz2, n) +dtps2c -- call subroutine sldpsc (xi, eta, ra, dec, raz1, decz1, + raz2, decz2, n) + Get plate center from tangent plane and spherical coordinates + + tpv2c -- call subroutine sltpvc (xi, eta, v, v01, v02, n) +dtpv2c -- call subroutine sldpvc (xi, eta, v, v01, v02, n) + Get plate center from [x,y,x] and tangent plane coordinates + + pcd -- call subroutine slpcd (disco, x, y) + Apply pincushion/barrel distortion + + unpcd -- call subroutine slupcd (disco, x, y) + Remove pincushion/barrel distortion + + fitxy -- call subroutine slftxy (itype, np, xye, xym, coeffs, j) + Fit a linear model to relate two sets of [x,y] coordinates + + pxy -- call subroutine slpxy (np, xye, xym, coeffs, xyp, + xrms, yrms, rrms) + Compute predicted coordinates and residuals + + invf -- call subroutine slinvf (fwds, bkwds, j) + Invert a linear model + + xy2xy -- call subroutine slxyxy (x1, y1, coeffs, x2, y2) + Transform one set of [x,y] coordinates + + dcmpf -- call subroutine sldcmf (coeffs, xz, yz, xs, ys, perp, orient) + Decompose a linear fit into geometric parameters +.fi +.ih +NUMERICAL METHODS +.nf + smat -- call subroutine slsmat (n, a, y, d, jf, iw) + dmat -- call subroutine sldmat (n, a, y, d, jf, iw) + Matrix inversion and solution of simultaneous equations + + svd -- call subroutine slsvd (m, n, mp, np, a, w, v, work, jstat) + Singular value decomposition of a matrix + +svdsol -- call subroutine slsvds (m, n, mp, np, b, u, w, v, work, x) + Solution from a given vector plus SVD + +svdcov -- call subroutine slsvdc (n, np, nc, w, v, work, cvm) + Covariance matrix from SVD +.fi +.endhelp diff --git a/math/slalib/doc/slalib.hlp.sav b/math/slalib/doc/slalib.hlp.sav new file mode 100644 index 00000000..8da465cf --- /dev/null +++ b/math/slalib/doc/slalib.hlp.sav @@ -0,0 +1,591 @@ +.help slalib Nov95 "Immatch Package" +.ih +NAME +slalib -- Starlink library of positional astronomy routines + +.ih +DESCRIPTION +SLALIB is a library of Fortran 77 routines intended to make accurate +and reliable positional-astronomy applications easier to write. Most +SLALIB library routines are concerned with astronomical position and time, +but a number have wider trigonometrical, numerical or general applications. +SLALIB contains routines covering the following topics: 1) string +decoding and sexagesimal conversions, 2) angles, vectors and rotation +matrices, 3) calendars and timescales, 4) precession and nutation, 5) +proper motion, 6) FK4/5 and elliptic aberration, 7) geocentric coordinates, +8) apparent and observed place, 9) azimuth and elevation, 10) refraction +and air mass, 11) ecliptic, galactic, and supergalactic coordinates, +12) ephemerides, 13) astrometry, and 14) numerical methods. + +The labels and calling sequences of the SLALIB are listed below grouped +by function. To get more detailed help on any individual routine type +the help command followed by the label, e.g the command "help flotin" +will give detailed help on the subroutine slrfli. + +.ih +STRING DECODING +.nf + intin -- call subroutine slinti (string, nstrt, ireslt, jflag) + Convert free-format string into integer + +flotin -- call subroutine slrfli (string, nstrt, reslt, jflag) +dfltin -- call subroutine sldfli (string, nstrt, dreslt, jflag) + Convert free-format string into floating point number + + afin -- call subroutine slafin (string, iptr, a, j) + dafin -- call subroutine sldafn (string, iptr, a, j) + Convert free-format string from deg, armin, arcsec to radians +.fi +.ih +SEXAGESIMAL CONVERSIONS +.nf + ctf2d -- call subroutine slctfd (ihour, imin, sec, days, j) + dtf2d -- call subroutine sldtfd (ihour, imin, sec, days, j) + Hours, minutes, seconds to days + + cd2tf -- call subroutine slcdtf (ndp, days, sign, ihmsf) + dd2tf -- call subroutine slddtf (ndp, days, sign, ihmsf) + Days to hours, minutes, and seconds + + ctf2r -- call subroutine slctfr (ihour, imin, sec, rad, j) + dtf2r -- call subroutine sldtfr (ihour, imin, sec, rad, j) + Hours, minutes, seconds to radians + + cr2tf -- call subroutine slcrtf (ndp, angle, sign, ihmsf) + dr2tf -- call subroutine sldrtf (ndp, angle, sign, ihmsf) + Radians to hours, minutes, seconds + + caf2r -- call subroutine slcafr (ideg, iamin, asec, rad, j) + daf2r -- call subroutine sldafr (ideg, iamin, asec, rad, j) + Degrees, arcminutes, arcseconds to radians + + cr2af -- call subroutine slcraf (ndp, angle, sign, idmsf) + dr2af -- call subroutine sldraf (ndp, angle, sign, idmsf) + Radians to degrees, arcminutes, arcseconds +.fi +.ih +ANGLES, VECTORS AND ROTATION MATRICES +.nf + range -- r = slra1p (angle) +drange -- d = slda1p (angle) + Normalize angle into range [-pi,pi] + +ranorm -- r = slra2p (angle) +dranrm -- d = slda2p (angle) + Normalize angle into range [0,2pi] + + cs2c -- call subroutine slcs2c (a, b, v) + dcs2c -- call subroutine slds2c (a, b, v) + Spherical coordinates to [x,y,z] + + cc2s -- call subroutine slcc2s (v, a, b) + dcc2s -- call subroutine sldc2s (v, a, b) + [x,y,z] to spherical coordinates + + vdv -- r = slvdv (va, vb) + dvdv -- d = sldvdv (va, vb) + Scalar product of two 3-vectors + + vxv -- call subroutine slvxv (va, vb, vc) + dvxv -- call subroutine sldvxv (va, vb, vc) + Vector product of two 3-vectors + + vn -- call subroutine slvn (v, uv, vm) + dvn -- call subroutine sldvn (v, uv, vm) + Normalize a 3-vector also giving the modulus + + sep -- s = slsep (a1, b1, a2, b2) + dsep -- d = sldsep (a1, b1, a2, b2) + Angle between two points on a sphere + + bear -- s = slbear (a1, b1, a2, b2) + dbear -- d = sldber (a1, b1, a2, b2) + pav -- s = slpav (v1, v2) + dpav -- d = sldpav (v1, v2) + Direction of one point on a sphere seen from another + + euler -- call subroutine sleulr (order, phi, theta, psi, rmat) +deuler -- call subroutine sldeul (order, phi, theta, psi, rmat) + Form form rotation matrix from three Euler angles + + + av2m -- call subroutine slav2m (axvec, rmat) + dav2m -- call subroutine sldavm (axvec, rmat) + Form rotation matrix from axial vector + + m2av -- call subroutine slm2av (rmat, axvec) + dm2av -- call subroutine sldmav (rmat, axvec) + Determine axial vector from rotation matrix + + dmxv -- call subroutine sldmxv (dm, va, vb) + mxv -- call subroutine slmxv (rm, va, vb) + Rotate vector forwards + + imxv -- call subroutine slimxv (rm, va, vb) + dimxv -- call subroutine sldimv (dm, va, vb) + Rotate vector backwards + + dmxm -- call subroutine sldmxm (a, b, c) + mxm -- call subroutine slmxm (a, b, c) + Product of two 3X3 matrices + + cs2c6 -- call subroutine sls2c6 (a, b, r, ad, bd, rd, v) + ds2c6 -- call subroutine sldsc6 (a, b, r, ad, bd, rd, v) + Conversion of position/velocity from spherical to Cartesian + coordinates + + cc62s -- call subroutine slc62s (v, a, b, r, ad, bd, rd) + dc62s -- call subroutine sldc6s (v, a, b, r, ad, bd, rd) + Conversion of position/velocity from Cartesian to spherical + coordinates +.fi +.ih +CALENDARS +.nf + cldj -- call subroutine slcadj (iy, im, id, djm, j) + Gregorian calendar to Modified Julian Date + + caldj -- call subroutine slcadj (iy, im, id, djm, j) + Gregorian calendar to Modified Julian Date, permitting century by + default + + djcal -- call subroutine sldjca (ndp, djm, iymdf, j) + Modified Julian Date to Gregorian calendar, in a from convenient + for formatted output + + djcl -- call subroutine sldjcl (djm, iy, im, id, fd, j) + Modified Julian Date to Gregorian Year, Month, Day, Fraction + + calyd -- call subroutine slcayd (iy, im, id, ny, nd, j) + Calendar to year and day in year, permitting century default + + clyd -- call subroutine slclyd (iy, im, id, ny, nd, jstat) + Calendar to year and day in year + + epb -- d = slepb (date) + Modified Julian Date to Besselian Epoch + + epb2d -- d = sleb2d (epb) + Besselian epoch to Modified Julian Date + + epj -- d = slepj (date) + Modified Julian Date to Julian Epoch + + epj2d -- d = slej2d (epj) + Julian epoch to Modified Julian Date +.fi +.fi +.ih +TIMESCALES +.nf + gmst -- d = slgmst (ut1) + Conversion from Universal Time to siderial time + + gmsta -- d = slgmsa (date, ut) + Conversion from Universal Time to siderial time, rounding errors + minimized + + eqeqx -- d = sleqex (date) + Equation of the equinoxes + + dat -- d = sldat (utc) + Offset of Atomic Time from Coordinated Universal Time: + TAI - UTC + + dt -- d = sldt (epoch) + Approximate offset between dynamical time and universal time + + dtt -- d = sldtt (utc) + Offset of Terrestrial Time from Coordinated Universal Time: + TT - UTC + + rcc -- d = slrcc (tdb, ut1, wl, u, v) + Relativistic clock correction: TDB - TT +.fi +.ih +PRECESSION AND NUTATION +.nf + nut -- call subroutine slnut (date, rmatn) + Nutation matrix + + nutc -- call subroutine slnutc (date, dpsi, deps, eps0) + Longitude and obliquity components of nutation, mean obliquity + + prec -- call subroutine slprec (ep0, ep1, rmatp) + Precession matrix (IAU) + + precl -- call subroutine slprel (ep0, ep1, rmatp) + Precession matrix (suitable for long periods) + +prenut -- call subroutine slprnu (epoch, date, rmatpn) + Combined precession/nutation matrix + + prebn -- call subroutine slprbn (bep0, bep1, rmatp) + Precession matrix (old system) + +preces -- call subroutine slprce (system, ep0, ep1, ra, dc) + Precession in either the old or new system, character string + ep0 and ep1 + +precss -- call subroutine slprcs (system, ep0, ep1, ra, dc) + Precession in either the old or new system, integer ep0 and ep1 +.fi +.fi +.ih +PROPER MOTION +.nf + pm -- call subroutine slpm (r0, d0, pr, pd, px, rv, ep0, ep1, r1, d1) + Adjust for proper motion +.fi +.ih +FK4/5/ICRS CONVERSIONS +.nf + fk425 -- call subroutine slfk45 (r1950, d1950, dr1950, dd1950, + p1950, v1950, r2000, d2000, dr2000, dd2000, p2000, v2000) + Convert B1950.0 FK4 star data to J2000.0 FK5 + + fk45z -- call subroutine slf45z (r1950, d1950, bepoch, r2000, d2000) + Convert B1950.0 FK4 position to J2000.0 FK5 assuming zero proper + motion in an inertial frame and no parallax + + fk524 -- call subroutine slfk54 (r2000, d2000, dr2000, dd2000, + p2000, v2000, r1950, d1950, dr1950, dd1950, p1950, v1950) + Convert J2000.0 FK5 star data to B1950.0 FK4 + + fk54z -- call subroutine slf54z (r2000, d2000, bepoch, r1950, d1950, + dr1950, dd1950) + Convert J2000.0 FK5 star data to B1950.0 FK4 assuming zero proper + motion in an inertial frame and no parallax + + fk52h -- call subroutine slfk5h (r5, d5, dr5, dd5, rh, dh, drh, ddh) + Convert J2000.0 FK5 star data to ICRS J2000.0 data + + fk5hz -- call subroutine slf5hz (r5, d5, epoch, rh, dh) + Convert J2000.0 FK5 star data to ICRS J2000.0 data assuming + no Hipparcos proper motion. + + h2fk5 -- call subroutine slhfk5 (rh, dh, drh, ddh, r5, d5, dr5, dd5) + Convert ICRS J2000.0 data to J2000.0 Fk5 star data. + + hfk5z -- call subroutine slhf5z (rh, dh, epoch, r5, d5) + Convert ICRS J2000.0 data to J2000.0 Fk5 star data assuming no + Hipparchos proper motion. + + dbjin -- call subroutine sldbji (string, nstrt, dreslt, j1, j2) + Like dfltin but with extensions to accept leading 'B' and 'J' + + kbj -- call subroutine slkbj (jb, e, k, j) + Select epoch prefix 'B' or 'J' + + epco -- d = slepco (k0, k, e) + Convert an epoch into the appropriate form 'B' or 'J' +.fi +.ih +ELLIPTIC ABERRATIONS +.nf + etrms -- call subroutine sletrm (ep, ev) + E-terms + + subet -- call subroutine slsuet (rc, dc, eq, rm, dm) + Remove the E-terms + + addet -- call subroutine sladet (rm, dm, eq, rc, dc) + Add the E-terms +.fi +.ih +GEOCENTRIC COORDINATES +.nf + obs -- call subroutine slobs (n, c, name, w, p, h) + Interrogate list of observatory parameters + + geoc -- call subroutine slgeoc (p, h, r, z) + Convert geodetic position to geocentric + + pvobs -- call subroutine slpvob (p, h, stl, pv) + Position and velocity of observatory +.fi +.ih +APPARENT AND OBSERVED PLACE +.nf + map -- call subroutine slmap (rm, dm, pr, pd, px, rv, eq, date, ra, da) + Mean place to geocentric apparent place + + mappa -- call subroutine slmapa (eq, date, amprms) + Precompute mean to apparent parameters + + mapqk -- call subroutine slmapq (rm, dm, pr, pd, px, rv, amprms, ra, da) + Mean to apparent place using precomputed parameters + +mapqkz -- call subroutine slmapz (rm, dm, amprms, ra, da) + Mean to apparent place using precomputed parameters, for zero + proper motion, parallax, and radial velocity + + amp -- call subroutine slamp (ra, da, date, eq, rm, dm) + Geocentric apparent place to mean place + + ampqk -- call subroutine slampq (ra, da, amprms, rm, dm) + Apparent to mean place using precomputed parameters + + aop -- call subroutine slaop (rap, dap, date, dut, elongm, phim, hm, + xp, yp, tdk, pmb, rh, wl, tlr, aob, zob, hob, dob, rob) + Apparent place to observed place + + aoppa -- call subroutine slaopa (date, dut, elongm, phim, hm, xy, yp, + tdk, pmb, rh, wl, tlr, aoprms) + Precompute apparent to observed parameters + +aoppat -- call subroutine slaopt (date, aoprms) + Update siderial time in apparent to observed parameters + + aopqk -- call subroutine slaopq (rap, dap, aoprms, aob, zob, hob, dob, rob) + Apparent to observed using precomputed parameters + + oap -- call subroutine sloap (type, ob1, ob2, date, dut, elongm, phim, + xp, yp, tdk, pmb, rh, wl, tlr, rap, dap) + Observed to apparent + + oapqk -- call subroutine sloapq (type, ob1, ob2, aoprms, rap, dap) + Observed to apparent using precomputed parameters + + polmo -- call subroutine slplmo (elongim, phim, xp, yp, elong, phi, daz) + Correct site longitude and latitude for polar motion +.fi +.ih +AZIMUTH AND ELEVATION +.nf + altaz -- call subroutine slalaz (ha, dec, phi, + Positions, velocities, etc. for an altazimuth mount + + e2h -- call subroutine sle2h (ha, dec, phi, az, el) + de2h -- call subroutine slde2h (ha, dec, phi, az, el) + Hour angle and declination to azimuth and elevation + + h2e -- call subroutine slh2e (az, el, phi, ha, dec) + dh2e -- call subroutine sldh2e (az, el, phi, ha, dec) + Azimuth and elevation to hour angle and declination + + pda2h -- call subroutine slpdah (p, d, a, h1, j1, h2, j2) + Hour angle corresponding to a given azimuth + + pdq2h -- call subroutine slpdqh (p, d, q, h1, j1, h2, j2) + Hour angle corresponding to a given parallactic angle + + pa -- d = slpa (ha, dec, phi) + Hour angle and declination to parallactic angle + + zd -- d = slzd (ha, dec, phi) + Hour angle and declination to zenith distance +.fi +.ih +REFRACTION AND AIR MASS +.nf + refro -- call subroutine slrfro (zobs, hm, tdk, pmb, rh, wl, phi, tlr, + eps, ref) + Change in zenith distance due to refraction + + refco -- call subroutine slrfco (hm, tdk, pmb, rh, wl, phi, tlr, eps, + refa, refb) + Constants for simple refraction model + +refcoq -- call subroutine slrfcq (tdk, pmb, rl, wl, refa, refb) + Constants for simple refraction model (quick version) + +atmdsp -- call subroutine slatmd (tdk, pmb, rh, wl1, a1, b1, wl2, a2, b2) + Adjust refraction constants for color + + refz -- call subroutine slrefz (zu, refa, refb, zr) + Unrefracted to refracted zenith distance, simple model + + refv -- call subroutine slrefv (vu, refa, refb, vr) + Unrefracted to refracted azimuth and elevation, simple model + +airmas -- d = slarms (zd) + Air mass +.fi +.ih +ECLIPTIC COORDINATES +.nf + ecmat -- call subroutine slecma (date, rmat) + Equatorial to ecliptic rotation matrix + + eqecl -- call subroutine sleqec (dr, dd, date, dl, db) + J2000.0 FK5 to ecliptic coordinates + + ecleq -- call subroutine sleceq (dl, db, date, dr, dd) + Ecliptic to J2000.0 FK5 coordinates +.fi +.ih +GALACTIC COORDINATES +.nf + eg50 -- call subroutine sleg50 (dr, dd, dl, db) + B1950.0 FK4 to galactic coordinates + + ge50 -- call subroutine slge50 (dl, db, dr, dd) + Galactic to B1950.0 FK4 coordinates + + eqgal -- call subroutine sleqga (dr, dd, dl, db) + J2000.0 FK5 to galactic coordinates + + galeq -- call subroutine slgaeq (dl, db, dr, dd) + Galactic to J2000.0 FK5 coordinates +.fi +.ih +SUPERGALACTIC COORDINATES +.nf +galsup -- call subroutine slgasu (dl, db, dsl, dsb) + Galactic to supergalactic coordinates + +supgal -- call subroutine slsuga (dsl, dsb, dl, db) + Supergalactic to galactic coordinates +.fi +.ih +EPHEMERIDES +.nf + dmoon -- call subroutine sldmon (date, pv) + Approximate geocentric position and velocity of moon + + earth -- call subroutine slerth (iy, id, fd, pv) + Approximate heliocentric position and velocity of earth + + evp -- call subroutine slevp (date, deqx, dvb, dpb, dvh, dph) + Barycentric and heliocentric velocity and position of earth + + moon -- call subroutine slmoon (iy, id, fd, pv) + Approximate geocentric position and velocity of moon + +planet -- call subroutine slplnt (date, np, pv, jstat) + Approximate heliocentric position and velocity of planet + +rdplan -- call subroutine slrdpl (date, np, elong, phi, ra, dec, diam) + Approximate topocentric apparent place of a planet + +planel -- call subroutine slplnl (date, jform, epoch, orbinc, anode, + perih, aorg, e, aorl, dm, pv, jstat) + Approximate heliocentric position and velocity of planet + +plante -- call subroutine slplte (date, elong, phi, jform, epoch, orbinc, + anode, perih, aorq, e, aorl, dm, ra, dec, r, jstat) + Approximate topocentric apparent place of a planet + + pv2el -- call subroutine slpvel (pv, date, pmass, jformr, jform, epoch, + orbinc, anode, perih, aorg, e, aorl, dm, jstat) + Convert J2000 position and velocity to equivalent osculating elements + + el2ue -- call subroutine slelue (date, jform, epoch, orbinc, anode, perih, + aorq, e, aorl, dm, u, jstat) + Convert conventional osculating orbital elements into universal + form. + + ue2el -- call subroutine slueel (u, jformr, jform, epoch, orbinc, anode, + perih, aorq, e, aorl, dm, jstat) + Convert universal elements into conventional heliocentric osculating + form. + + pv2ue -- call subroutine slpvue (pv, date, pmass, u, jstat) + Construct a universal element set based on instantaneous position + and velocity. + + ue2pv -- call subroutine sluepv (date, u, pv, jstat) + Compute heliocentric position and velocity of a planet, asteroid, or + comet, starting from orbital elements in the "universal variables" + form. + +pertel -- call subroutine slprtl (jform, date0, date1, epoch0, epoch1, + orbi0, anode0, perih0, aorq0, e0, am0, epoch1, orbi1, anode1, + perih1, aorq1m e1, am1, jstat) + Update the osculating elements of a comet or asteroid by applying + planetary perturbations. + +pertue -- call subroutine slprue (date, u, jstat) + Update universal elements of a comet or asteroid by applying planetary + perturbations. +.fi +.ih +RADIAL VELOCITIES +rverot -- s = slrver (phi, ra, da, st) + Velocity component due to rotation of the earth + + ecor -- call subroutine slecor (rm, dm, iy, id, fd, rv, tl) + Components of velocity and light time due to earth orbital motion + +rvlsrd -- r = slrvld (r2000, d2000) + Velocity component due to solar motion wrt dynamical LSR + +rvlsrk -- r = slrvlk (r2000, d2000) + Velocity component due to solar motion wrt kinematical LSR + +rvgalc -- r = slrvga (r2000, d2000) + Velocity component due to rotation of the Galaxy + + rvlg -- r = slrvlg (r2000, d2000) + Velocity component due to rotation and translation of the Galaxy, + relative to the mean motion of the local group +.fi +.ih +ASTROMETRY +.nf + s2tp -- call subroutine sls2tp (ra, dec, raz, decz, xi, eta, j) + ds2tp -- call subroutine sldstp (ra, dec, raz, decz, xi, eta, j) + Transform spherical into tangent plane coordinates + + v2tp -- call subroutine slv2tp (v, v0, xi, eta, j) + dv2tp -- call subroutine sldvtp (v, v0, xi, eta, j) + Transform [x,y,z] into tangent plane coordinates + + tp2s -- call subroutine sltp2s (xi, eta, raz, decz, ra, dec) + dtp2s -- call subroutine sldtps (xi, eta, raz, decz, ra, dec) + Transform tangent plane into spherical coordinates + + tp2v -- call subroutine sltp2v (xi, eta, v0, v) + dtp2v -- call subroutine sldtpv (xi, eta, v0, v) + Transform tangent plane coordinates into [x,y,z] + + tps2c -- call subroutine sltpsc (xi, eta, ra, dec, raz1, decz1, + raz2, decz2, n) +dtps2c -- call subroutine sldpsc (xi, eta, ra, dec, raz1, decz1, + raz2, decz2, n) + Get plate center from tangent plane and spherical coordinates + + tpv2c -- call subroutine sltpvc (xi, eta, v, v01, v02, n) +dtpv2c -- call subroutine sldpvc (xi, eta, v, v01, v02, n) + Get plate center from [x,y,x] and tangent plane coordinates + + pcd -- call subroutine slpcd (disco, x, y) + Apply pincushion/barrel distortion + + unpcd -- call subroutine slupcd (disco, x, y) + Remove pincushion/barrel distortion + + fitxy -- call subroutine slftxy (itype, np, xye, xym, coeffs, j) + Fit a linear model to relate two sets of [x,y] coordinates + + pxy -- call subroutine slpxy (np, xye, xym, coeffs, xyp, + xrms, yrms, rrms) + Compute predicted coordinates and residuals + + invf -- call subroutine slinvf (fwds, bkwds, j) + Invert a linear model + + xy2xy -- call subroutine slxyxy (x1, y1, coeffs, x2, y2) + Transform one set of [x,y] coordinates + + dcmpf -- call subroutine sldcmf (coeffs, xz, yz, xs, ys, perp, orient) + Decompose a linear fit into geometric parameters +.fi +.ih +NUMERICAL METHODS +.nf + smat -- call subroutine slsmat (n, a, y, d, jf, iw) + dmat -- call subroutine sldmat (n, a, y, d, jf, iw) + Matrix inversion and solution of simultaneous equations + + svd -- call subroutine slsvd (m, n, mp, np, a, w, v, work, jstat) + Singular value decomposition of a matrix + +svdsol -- call subroutine slsvds (m, n, mp, np, b, u, w, v, work, x) + Solution from a given vector plus SVD + +svdcov -- call subroutine slsvdc (n, np, nc, w, v, work, cvm) + Covariance matrix from SVD +.fi +.endhelp diff --git a/math/slalib/doc/slalib.men b/math/slalib/doc/slalib.men new file mode 100644 index 00000000..2288c0aa --- /dev/null +++ b/math/slalib/doc/slalib.men @@ -0,0 +1,179 @@ + addet - add the E-terms to a pre IAU 1976 mean place + afin - convert a sexagesimal character string to radians (s.p.) + airmas - compute the airmass at a given zenith distance + altaz - compute altazimuth positions, velocities, accelerations + amp - convert a geocentric apparent to post IAU 1976 mean place + ampqk - convert a geocentric apparent to post IAU 1976 mean place + aop - convert an apparent to observed place + aoppa - pre-compute the set of apparent to observed place parameters + aoppat - recompute the apparent to observed place sidereal time parameter + aopqk - convert an apparent to observed place + atmdsp - apply atmospheric dispersion terms to refraction coefficients + av2m - compute a rotation matrix from an axial vector (s.p.) + bear - compute the bearing of a point on a sphere w.r.t. another + caf2r - convert degrees, arcminutes, and arcseconds to radians + caldj - convert a Gregorian calendar date to a modified Julian date + calyd - convert a Gregorian calendar date to a Julian calendar year, day + cc2s - convert Cartesian to spherical coordinates (s.p.) + cc62s - convert a 6-vector from Cartesian to spherical coordinates + cd2tf - convert an interval in days to hours, minutes, and seconds + cldj - convert a Gregorian calendar date to a modified Julian date + clyd - convert a Gregorian calendar date a Julian calendar year, day + cr2af - convert radians to degrees, arcminutes, and arcseconds + cr2tf - convert radians to hours, minutes, and seconds + cs2c - convert spherical to Cartesian coordinates (s.p.) + cs2c6 - convert spherical position/velocity to Cartesian coordinates + ctf2d - convert hours, minutes, and seconds to days + ctf2r - convert hours, minutes, and seconds to radians + daf2r - convert degrees, arcminutes, and arcseconds to radians (d.p) + dafin - convert a sexagesimal character string to radians (d.p.) + dat - compute difference between TAI and UTC in seconds + dav2m - compute a rotation matrix from an axial vector (d.p) + dbear - compute the bearing of a point on a sphere w.r.t. another (d.p.) + dbjin - convert a character string to a Besselian/Julian epoch + dc62s - convert Cartesian position/velocity to spherical coordinates (d.p.) + dcc2s - convert Cartesian to spherical coordinates (d.p) + dcmpf - convert linear fit coefficients to geometric parameters + dcs2c - convert spherical to Cartesian coordinates (d.p) + dd2tf - convert interval in days to hours, minutes, and seconds (d.p.) + de2h - convert hour angle and declination to azimuth and elevation (d.p.) + deuler - convert Euler angles to a rotation matrix (d.p.) + dfltin - convert a character string to a floating point number (d.p.) + dh2e - convert azimuth and elevation to hour angle and declination (d.p.) + dimxv - apply a 3D reverse rotation to a 3-vector (d.p.) + djcal - convert an MJD to a Gregorian calendar date + djcl - convert an MJD to a Gregorian year, month, and day + dm2av - convert a rotation matrix to an axial vector (d.p) + dmat - solve a set of simultaneous equations (d.p.) + dmoon - compute approximate geocentric position/velocity of moon (d.p.) + dmxm - compute the product of two 3X3 matrices (d.p.) + dmxv - multiple a 3-vector by a rotation matrix (d.p.) + dpav - compute the bearing of a point on a sphere w.r.t. another (d.p.) + dr2af - convert radians to degrees, arcminutes, and arcseconds (d.p) + dr2tf - convert radians to hours, minutes, and seconds (d.p.) + drange - normalize an angle to the range -pi <= angle <= pi (d.p.) + dranrm - normalize an angle to the range 0 <= angle <= 2pi (d.p.) + ds2c6 - convert spherical position/velocity to Cartesian coordinates (d.p.) + ds2tp - project spherical coordinates onto the tangent plane (d.p) + dsep - compute the angle between two points on a sphere (d.p.) + dt - estimate the approximate difference between ET and UT in seconds + dtf2d - convert hours, minutes, and seconds to days (d.p) + dtf2r - convert hours, minutes, and seconds to radians (d.p.) + dtp2s - convert tangent plane to spherical coordinates (d.p.) + dtp2v - convert tangent plane coordinates to direction cosines (d.p.) + dtps2c - compute the spherical coordinates of the tangent point (d.p.) + dtpv2c - compute the direction cosines of the tangent point (d.p.) + dtt - compute the difference between TT and UTC in seconds + dv2tp - convert direction cosines to tangent plane coordinates (d.p) + dvdv - compute the scalar product of 2 3-vectors (d.p.) + dvn - normalize a 3-vector and compute the modulus (d.p.) + dvxv - compute the vector product of 2 3-vectors (d.p.) + e2h - convert hour angle and declination to azimuth and elevation (d.p.) + earth - compute approximate heliocentric position/velocity of earth + ecleq - convert from ecliptic to equatorial FK5 coordinates + ecmat - compute the equatorial FK5 to ecliptic coordinates rotation matrix + ecor - compute rv of earth and time correction to sun in given direction + eg50 - convert equatorial FK4 to IAU 1958 galactic coordinates + el2ue - convert osculating orbital elements into universal form + epb - convert an MJD to a Besselian epoch + epb2d - convert a Besselian epoch to an MJD + epco - convert a Besselian/Julian epoch to match a given epoch + epj - convert an MJD to a Julian epoch + epj2d - convert a Julian epoch to an MJD + eqecl - convert equatorial FK5 to ecliptic coordinates + eqeqx - compute the equation of the equinoxes + eqgal - convert equatorial FK5 to IAU 1958 galactic coordinates + etrms - compute the E-terms vector + euler - convert Euler angles to a rotation matrix (s.p.) + evp - compute the barycentric/heliocentric velocity/position of earth + fitxy - fit a linear model to 2 sets of [x,y] coordinates + fk425 - convert equatorial FK4 to FK5 coordinates + fk45z - convert equatorial FK4 to FK5 coordinates excluding proper motion + fk524 - convert equatorial FK5 to FK4 coordinates + fk54z - convert equatorial FK5 to FK4 coordinates excluding proper motion + fk52h - convert equatorial FK5 to ICRS coordinates + fk5hz - Convert equatorial FK5 to ICRS coordinates (0 ICRS proper motions) + flotin - convert a character string to a floating point number + galeq - convert IAU 1958 galactic to equatorial FK5 coordinates + galsup - convert IAU 1958 galactic to deVaucouleurs supergalactic coordinates + ge50 - convert IAU 1958 galactic to equatorial FK4 coordinates + geoc - convert geodetic to geocentric position + gmst - convert from UT1 to GMST + gmsta - convert from UT1 to GMST while minimizing rounding errors + h2e - convert azimuth and elevation to hour angle and declination (s.p.) + h2fk5 - Convert equatorial ICRS to FK5 coordinates + hfk5z - Convert equatorial ICRS to FK5 coordinates (0 ICRS proper motions) + imxv - apply a 3D reverse rotation to a 3-vector (s.p.) + intin - convert a character string into an integer + invf - invert the linear model computed from 2 sets of [x,y] coordinates + kbj - select the epoch prefix B or J + m2av - convert a rotation matrix to an axial vector (s.p.) + map - convert a post IAU 1976 mean to geocentric apparent place + mappa - precompute the set of mean to geocentric apparent place parameters + mapqk - convert a post IAU 1976 mean to geocentric apparent place + mapqkz - convert a post IAU 1976 mean to geocentric apparent place + moon - compute approximate geocentric position/velocity of moon + mxm - compute the product of two 3X3 matrices (s.p.) + mxv - multiply a 3-vector by a rotation matrix (s.p.) + nut - compute the nutation matrix for a given date + nutc - compute the nutation components for a given date + oap - convert from observed to apparent place + oapqk - convert from observed to apparent place + obs - look up an entry in a list of groundbased observing stations + pa - compute the parallactic angle from the hour angle and declination + pav - compute the bearing of a point on a sphere w.r.t. another + pcd - apply pincushion/barrel distortion to tangent plane coordinates + pda2h - compute the hour angle corresponding to a given azimuth + pdq2h - compute the hour angle corresponding to a given parallactic angle + pertel - update osculating orbital elements by applying perturbations + pertue - update universal elements by applying perturbations + planel - compute the approximate heliocentric position/velocity of a planet + planet - compute the approximate heliocentric position/velocity of a planet + plante - compute approximate topocentric apparent position of a planet + pm - apply the correction for proper motion to a star + polmo - correct site longitude and latitude for polar motion + prebn - compute the FK4 matrix of precession between two epochs + prec - compute the FK5 matrix of precession between two epochs + preces - precess coordinates in either the FK4 or FK5 systems + precl - compute the longterm matrix of precession between two epochs + precss - precess coordinates in either the FK4 or FK5 systems + prenut - compute the FK5 matrix of precession and nutation + pv2el - convert J2000 position and velocity to osculating elements + pv2ue - convert instantaneous position and velocity to universal element set + pvobs - compute the geocentric position / velocity of an observing station + pxy - apply a linear model to a set of expected and measured [x,y] + range - normalize an angle to the range -pi <= angle <= pi (s.p.) + ranorm - normalize an angle to the range 0 <= angle <= 2pi (s.p.) + rcc - compute the difference between TDB and TT in seconds + rdplan - compute approximate topocentric apparent position of a planet + refco - compute the refraction coefficients + refcoq - compute the refraction coefficients (fast version) + refro - compute the atmospheric refraction for optical and radio wavelengths + refv - apply the refraction correction to a Cartesian 3-vector + refz - apply the refraction correction to a zenith distance + rverot - compute the earth rotation velocity component in a given direction + rvgalc - compute the dynamical LSR velocity component in a given direction + rvlg - compute the solar velocity component in a given direction + rvlsrd - compute the peculiar solar velocity component in a given direction + rvlsrk - compute the standard solar velocity component in a given direction + s2tp - project spherical coordinates onto the tangent plane (s.p.) + sep - compute the angle between two points on a sphere (s.p.) + smat - solve a set of simultaneous equations (s.p.) + subet - remove the E-terms from a pre IAU 1976 catalog position + supgal - convert deVaucouleurs supergalactic to IAU 1958 galactic coordinates + svd - compute the SVD factorization of a matrix + svdcov - compute the covariance matrix from the SVD factorization + svdsol - solve a set of simultaneous equations using SVD factorization + tp2s - convert tangent plane to spherical coordinates (s.p.) + tp2v - convert tangent plane coordinates to direction cosines (s.p.) + tps2c - compute the spherical coordinates of the tangent point (s.p.) + tpv2c - compute the direction cosines of the tangent point (s.p.) + ue2el - convert universal elements into heliocentric osculating elements + ue2pv - compute heliocentric position and velocity from universal form + unpcd - remove pincushion/barrel distortion from distorted coordinates + v2tp - convert direction cosines to tangent plane coordinates (s.p.) + vdv - convert the scale production of two 3-vectors (s.p.) + vn - normalize a 3-vector and compute the modulus (s.p.) + vxv - compute the vector product of two 3-vectors (s.p.) + xy2xy - apply a computed linear model to a set of [x,y] + zd - convert hour angle and declination to zenith distance diff --git a/math/slalib/doc/smat.hlp b/math/slalib/doc/smat.hlp new file mode 100644 index 00000000..ad2b1f2d --- /dev/null +++ b/math/slalib/doc/smat.hlp @@ -0,0 +1,60 @@ +.help smat Jun99 "Slalib Package" +.nf + + SUBROUTINE slSMAT (N, A, Y, D, JF, IW) + + - - - - - + S M A T + - - - - - + + Matrix inversion & solution of simultaneous equations + (single precision) + + For the set of n simultaneous equations in n unknowns: + A.Y = X + + where: + A is a non-singular N x N matrix + Y is the vector of N unknowns + X is the known vector + + SMATRX computes: + the inverse of matrix A + the determinant of matrix A + the vector of N unknowns + + Arguments: + + symbol type dimension before after + + N int no. of unknowns unchanged + A real (N,N) matrix inverse + Y real (N) vector solution + D real - determinant + * JF int - singularity flag + IW int (N) - workspace + + * JF is the singularity flag. If the matrix is non-singular, + JF=0 is returned. If the matrix is singular, JF=-1 & D=0.0 are + returned. In the latter case, the contents of array A on return + are undefined. + + Algorithm: + Gaussian elimination with partial pivoting. + + Speed: + Very fast. + + Accuracy: + Fairly accurate - errors 1 to 4 times those of routines optimized + for accuracy. + + Note: replaces the obsolete slSMATRX routine. + + P.T.Wallace Starlink 10 September 1990 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/subet.hlp b/math/slalib/doc/subet.hlp new file mode 100644 index 00000000..42d74ccf --- /dev/null +++ b/math/slalib/doc/subet.hlp @@ -0,0 +1,41 @@ +.help subet Jun99 "Slalib Package" +.nf + + SUBROUTINE slSUET (RC, DC, EQ, RM, DM) + + - - - - - - + S U E T + - - - - - - + + Remove the E-terms (elliptic component of annual aberration) + from a pre IAU 1976 catalogue RA,Dec to give a mean place + (double precision) + + Given: + RC,DC dp RA,Dec (radians) with E-terms included + EQ dp Besselian epoch of mean equator and equinox + + Returned: + RM,DM dp RA,Dec (radians) without E-terms + + Called: + slETRM, slDS2C, sla_,DVDV, slDC2S, slDA2P + + Explanation: + Most star positions from pre-1984 optical catalogues (or + derived from astrometry using such stars) embody the + E-terms. This routine converts such a position to a + formal mean place (allowing, for example, comparison with a + pulsar timing position). + + Reference: + Explanatory Supplement to the Astronomical Ephemeris, + section 2D, page 48. + + P.T.Wallace Starlink 10 May 1990 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/sun67.tex b/math/slalib/doc/sun67.tex new file mode 100644 index 00000000..3e586f5e --- /dev/null +++ b/math/slalib/doc/sun67.tex @@ -0,0 +1,12311 @@ +\documentclass[11pt,twoside]{article} +\setcounter{tocdepth}{2} +\pagestyle{myheadings} + +% ----------------------------------------------------------------------------- +% ? Document identification +\newcommand{\stardoccategory} {Starlink User Note} +\newcommand{\stardocinitials} {SUN} +\newcommand{\stardocsource} {sun67.44} +\newcommand{\stardocnumber} {67.44} +\newcommand{\stardocauthors} {P.\,T.\,Wallace} +\newcommand{\stardocdate} {29 April 1999} +\newcommand{\stardoctitle} {SLALIB --- Positional Astronomy Library} +\newcommand{\stardocversion} {2.3-0} +\newcommand{\stardocmanual} {Programmer's Manual} +% ? End of document identification + +%%% Also see \nroutines definition later %%% + +% ----------------------------------------------------------------------------- + +\newcommand{\stardocname}{\stardocinitials /\stardocnumber} +\markright{\stardocname} +\setlength{\textwidth}{160mm} +\setlength{\textheight}{230mm} +\setlength{\topmargin}{-2mm} +\setlength{\oddsidemargin}{0mm} +\setlength{\evensidemargin}{0mm} +\setlength{\parindent}{0mm} +\setlength{\parskip}{\medskipamount} +\setlength{\unitlength}{1mm} + +% ----------------------------------------------------------------------------- +% Hypertext definitions. +% ====================== +% These are used by the LaTeX2HTML translator in conjunction with star2html. + +% Comment.sty: version 2.0, 19 June 1992 +% Selectively in/exclude pieces of text. +% +% Author +% Victor Eijkhout +% Department of Computer Science +% University Tennessee at Knoxville +% 104 Ayres Hall +% Knoxville, TN 37996 +% USA + +% Do not remove the %\begin{rawtex} and %\end{rawtex} lines (used by +% star2html to signify raw TeX that latex2html cannot process). +%\begin{rawtex} +\makeatletter +\def\makeinnocent#1{\catcode`#1=12 } +\def\csarg#1#2{\expandafter#1\csname#2\endcsname} + +\def\ThrowAwayComment#1{\begingroup + \def\CurrentComment{#1}% + \let\do\makeinnocent \dospecials + \makeinnocent\^^L% and whatever other special cases + \endlinechar`\^^M \catcode`\^^M=12 \xComment} +{\catcode`\^^M=12 \endlinechar=-1 % + \gdef\xComment#1^^M{\def\test{#1} + \csarg\ifx{PlainEnd\CurrentComment Test}\test + \let\html@next\endgroup + \else \csarg\ifx{LaLaEnd\CurrentComment Test}\test + \edef\html@next{\endgroup\noexpand\end{\CurrentComment}} + \else \let\html@next\xComment + \fi \fi \html@next} +} +\makeatother + +\def\includecomment + #1{\expandafter\def\csname#1\endcsname{}% + \expandafter\def\csname end#1\endcsname{}} +\def\excludecomment + #1{\expandafter\def\csname#1\endcsname{\ThrowAwayComment{#1}}% + {\escapechar=-1\relax + \csarg\xdef{PlainEnd#1Test}{\string\\end#1}% + \csarg\xdef{LaLaEnd#1Test}{\string\\end\string\{#1\string\}}% + }} + +% Define environments that ignore their contents. +\excludecomment{comment} +\excludecomment{rawhtml} +\excludecomment{htmlonly} +%\end{rawtex} + +% Hypertext commands etc. This is a condensed version of the html.sty +% file supplied with LaTeX2HTML by: Nikos Drakos & +% Jelle van Zeijl . The LaTeX2HTML documentation +% should be consulted about all commands (and the environments defined above) +% except \xref and \xlabel which are Starlink specific. + +\newcommand{\htmladdnormallinkfoot}[2]{#1\footnote{#2}} +\newcommand{\htmladdnormallink}[2]{#1} +\newcommand{\htmladdimg}[1]{} +\newenvironment{latexonly}{}{} +\newcommand{\hyperref}[4]{#2\ref{#4}#3} +\newcommand{\htmlref}[2]{#1} +\newcommand{\htmlimage}[1]{} +\newcommand{\htmladdtonavigation}[1]{} + +% Starlink cross-references and labels. +\newcommand{\xref}[3]{#1} +\newcommand{\xlabel}[1]{} + +% LaTeX2HTML symbol. +\newcommand{\latextohtml}{{\bf LaTeX}{2}{\tt{HTML}}} + +% Define command to re-centre underscore for Latex and leave as normal +% for HTML (severe problems with \_ in tabbing environments and \_\_ +% generally otherwise). +\newcommand{\latex}[1]{#1} +\newcommand{\setunderscore}{\renewcommand{\_}{{\tt\symbol{95}}}} +\latex{\setunderscore} + +% Redefine the \tableofcontents command. This procrastination is necessary +% to stop the automatic creation of a second table of contents page +% by latex2html. +\newcommand{\latexonlytoc}[0]{\tableofcontents} + +% ----------------------------------------------------------------------------- +% Debugging. +% ========= +% Remove % on the following to debug links in the HTML version using Latex. + +% \newcommand{\hotlink}[2]{\fbox{\begin{tabular}[t]{@{}c@{}}#1\\\hline{\footnotesize #2}\end{tabular}}} +% \renewcommand{\htmladdnormallinkfoot}[2]{\hotlink{#1}{#2}} +% \renewcommand{\htmladdnormallink}[2]{\hotlink{#1}{#2}} +% \renewcommand{\hyperref}[4]{\hotlink{#1}{\S\ref{#4}}} +% \renewcommand{\htmlref}[2]{\hotlink{#1}{\S\ref{#2}}} +% \renewcommand{\xref}[3]{\hotlink{#1}{#2 -- #3}} +% ----------------------------------------------------------------------------- +% ? Document specific \newcommand or \newenvironment commands. +%------------------------------------------------------------------------------ + +\newcommand{\nroutines} {181} +\newcommand{\radec} {$[\,\alpha,\delta\,]$} +\newcommand{\hadec} {$[\,h,\delta\,]$} +\newcommand{\xieta} {$[\,\xi,\eta\,]$} +\newcommand{\azel} {$[\,Az,El~]$} +\newcommand{\ecl} {$[\,\lambda,\beta~]$} +\newcommand{\gal} {$[\,l^{I\!I},b^{I\!I}\,]$} +\newcommand{\xy} {$[\,x,y\,]$} +\newcommand{\xyz} {$[\,x,y,z\,]$} +\newcommand{\xyzd} {$[\,\dot{x},\dot{y},\dot{z}\,]$} +\newcommand{\xyzxyzd} {$[\,x,y,z,\dot{x},\dot{y},\dot{z}\,]$} +\newcommand{\degree}[2] {$#1^{\circ} + \hspace{-0.37em}.\hspace{0.02em}#2$} + +\newcommand{\arcsec}[2] {\arcseci{#1}$\hspace{-0.4em}.#2$} +\begin{htmlonly} + \newcommand{\arcsec}[2] { + {$#1\hspace{-0.05em}^{'\hspace{-0.1em}'}\hspace{-0.4em}.#2$} + } +\end{htmlonly} + +\newcommand{\arcseci}[1] {$#1\hspace{-0.05em}$\raisebox{-0.5ex} + {$^{'\hspace{-0.1em}'}$}} +\begin{htmlonly} + \renewcommand{\arcseci}[1] {$#1\hspace{-0.05em}^{'\hspace{-0.1em}'}$} +\end{htmlonly} + +\newcommand{\dms}[4] {$#1^{\circ}\,#2\raisebox{-0.5ex} + {$^{'}$}\,$\arcsec{#3}{#4}} +\begin{htmlonly} + \renewcommand{\dms}[4]{$#1^{\circ}\,#2^{'}\,#3^{''}.#4$} +\end{htmlonly} + +\newcommand{\tseci}[1] {$#1$\mbox{$^{\rm s}$}} +\newcommand{\tsec}[2] {\tseci{#1}$\hspace{-0.3em}.#2$} +\begin{htmlonly} + \renewcommand{\tsec}[2] {$#1^{\rm s}\hspace{-0.3em}.#2$} +\end{htmlonly} + +\newcommand{\hms}[4] {$#1^{\rm h}\,#2^{\rm m}\,$\tsec{#3}{#4}} +\begin{htmlonly} + \renewcommand{\hms}[4] {$#1^{h}\,#2^{m}\,#3^{s}.#4$} +\end{htmlonly} + +\newcommand{\callhead}[1]{\goodbreak\vspace{\bigskipamount}{\large\bf{#1}}} +\newenvironment{callset}{\begin{list}{}{\setlength{\leftmargin}{2cm} + \setlength{\parsep}{\smallskipamount}}}{\end{list}} +\newcommand{\subp}[1]{\item\hspace{-1cm}#1\\} +\newcommand{\subq}[2]{\item\hspace{-1cm}#1\\\hspace*{-1cm}#2\\} +\newcommand{\name}[1]{\mbox{#1}} +\newcommand{\fortvar}[1]{\mbox{\em #1}} + +\newcommand{\routine}[3] +{\hbadness=10000 + \vbox + { + \rule{\textwidth}{0.3mm}\\ + {\Large {\bf #1} \hfill #2 \hfill {\bf #1}}\\ + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + #3 + \end{description} + \setlength{\topsep}{\oldspacing} + } +} + +% Replacement for HTML version (each routine in own subsection). +\begin{htmlonly} + \renewcommand{\routine}[3] + { + \subsection{#1\xlabel{#1} - #2\label{#1}} + \begin{description} + #3 + \end{description} + } +\end{htmlonly} + +\newcommand{\action}[1] +{\item[ACTION]: #1} + +\begin{htmlonly} + \newcommand{\action}[1] + {\item[ACTION:] #1} +\end{htmlonly} + +\newcommand{\call}[1] +{\item[CALL]: \hspace{0.4em}{\tt #1}} +\newlength{\oldspacing} + +\begin{htmlonly} + \renewcommand{\call}[1] + { + \item[CALL:] {\tt #1} + } +\end{htmlonly} + +\newcommand{\args}[2] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[#1]:\\[1.5ex] + \begin{tabular}{p{7em}p{6em}p{22em}} + #2 + \end{tabular} + \end{description} + \setlength{\topsep}{\oldspacing} +} +\begin{htmlonly} + \renewcommand{\args}[2] + { + \begin{description} + \item[#1:]\\ + \begin{tabular}{p{7em}p{6em}l} + #2 + \end{tabular} + \end{description} + } +\end{htmlonly} + +\newcommand{\spec}[3] +{ + {\em {#1}} & {\bf \mbox{#2}} & {#3} +} + +\newcommand{\specel}[2] +{ + \multicolumn{1}{c}{#1} & {} & {#2} +} + +\newcommand{\anote}[1] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[NOTE]: + #1 + \end{description} + \setlength{\topsep}{\oldspacing} +} + +\begin{htmlonly} + \renewcommand{\anote}[1] + { + \begin{description} + \item[NOTE:] + #1 + \end{description} + } +\end{htmlonly} + +\newcommand{\notes}[1] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[NOTES]: + #1 + \end{description} + \setlength{\topsep}{\oldspacing} +} + +\begin{htmlonly} + \renewcommand{\notes}[1] + { + \begin{description} + \item[NOTES:] + #1 + \end{description} + } +\end{htmlonly} + +\newcommand{\aref}[1] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[REFERENCE]: + #1 + \end{description} + \setlength{\topsep}{\oldspacing} +} + +\begin{htmlonly} + \newcommand{\aref}[1] + { + \begin{description} + \item[REFERENCE:] + #1 + \end{description} + } +\end{htmlonly} + +\newcommand{\refs}[1] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[REFERENCES]: + #1 + \end{description} + \setlength{\topsep}{\oldspacing} +} +\begin{htmlonly} + \newcommand{\refs}[1] + { + \begin{description} + \item[REFERENCES:] + #1 + \end{description} + } +\end{htmlonly} + +\newcommand{\exampleitem}{\item [EXAMPLE]:} +\begin{htmlonly} + \renewcommand{\exampleitem}{\item [EXAMPLE:]} +\end{htmlonly} + +%------------------------------------------------------------------------------ +% ? End of document specific commands +% ----------------------------------------------------------------------------- +% Title Page. +% =========== +\renewcommand{\thepage}{\roman{page}} +\begin{document} +\thispagestyle{empty} + +% Latex document header. +% ====================== +\begin{latexonly} + CCLRC / {\sc Rutherford Appleton Laboratory} \hfill {\bf \stardocname}\\ + {\large Particle Physics \& Astronomy Research Council}\\ + {\large Starlink Project\\} + {\large \stardoccategory\ \stardocnumber} + \begin{flushright} + \stardocauthors\\ + \stardocdate + \end{flushright} + \vspace{-4mm} + \rule{\textwidth}{0.5mm} + \vspace{5mm} + \begin{center} + {\Huge\bf \stardoctitle \\ [2.5ex]} + {\LARGE\bf \stardocversion \\ [4ex]} + {\Huge\bf \stardocmanual} + \end{center} + \vspace{5mm} + +% ? Heading for abstract if used. + \vspace{10mm} + \begin{center} + {\Large\bf Abstract} + \end{center} +% ? End of heading for abstract. +\end{latexonly} + +% HTML documentation header. +% ========================== +\begin{htmlonly} + \xlabel{} + \begin{rawhtml}

\end{rawhtml} + \stardoctitle\\ + \stardocversion\\ + \stardocmanual + \begin{rawhtml}

\end{rawhtml} + +% ? Add picture here if required. +% ? End of picture + + \begin{rawhtml}

\end{rawhtml} + \stardoccategory \stardocnumber \\ + \stardocauthors \\ + \stardocdate + \begin{rawhtml}

\end{rawhtml} + \htmladdnormallink{CCLRC}{http://www.cclrc.ac.uk} / + \htmladdnormallink{Rutherford Appleton Laboratory} + {http://www.cclrc.ac.uk/ral} \\ + \htmladdnormallink{Particle Physics \& Astronomy Research Council} + {http://www.pparc.ac.uk} \\ + \begin{rawhtml}

\end{rawhtml} + \htmladdnormallink{Starlink Project}{http://star-www.rl.ac.uk/} + \begin{rawhtml}

\end{rawhtml} + \htmladdnormallink{\htmladdimg{source.gif} Retrieve hardcopy} + {http://star-www.rl.ac.uk/cgi-bin/hcserver?\stardocsource}\\ + +% HTML document table of contents. +% ================================ +% Add table of contents header and a navigation button to return to this +% point in the document (this should always go before the abstract \section). + \label{stardoccontents} + \begin{rawhtml} +
+

Contents

+ \end{rawhtml} + \renewcommand{\latexonlytoc}[0]{} + \htmladdtonavigation{\htmlref{\htmladdimg{contents_motif.gif}} + {stardoccontents}} + +% ? New section for abstract if used. + \section{\xlabel{abstract}Abstract} +% ? End of new section for abstract +\end{htmlonly} + +% ----------------------------------------------------------------------------- +% ? Document Abstract. (if used) +% ================== +SLALIB is a library used by writers of positional-astronomy applications. +Most of the \nroutines\ routines are concerned with astronomical position and time, +but a number have wider trigonometrical, numerical or general applications. +% ? End of document abstract +% ----------------------------------------------------------------------------- +% ? Latex document Table of Contents (if used). +% =========================================== + \newpage + \begin{latexonly} + \setlength{\parskip}{0mm} + \latexonlytoc + \setlength{\parskip}{\medskipamount} + \markright{\stardocname} + \end{latexonly} +% ? End of Latex document table of contents +% ----------------------------------------------------------------------------- +\newpage +\renewcommand{\thepage}{\arabic{page}} +\setcounter{page}{1} + +\section{INTRODUCTION} +\subsection{Purpose} +SLALIB\footnote{The name isn't an acronym; +it just stands for ``Subprogram Library~A''.} +is a library of routines +intended to make accurate and reliable positional-astronomy +applications easier to write. +Most SLALIB routines are concerned with astronomical position and time, but a +number have wider trigonometrical, numerical or general applications. +The applications ASTROM, COCO, RV and TPOINT +all make extensive use of the SLALIB +routines, as do a number of telescope control systems around the world. +The SLALIB versions currently in service are written in +Fortran~77 and run on VAX/VMS, several Unix platforms and PC. +A generic ANSI~C version is also available from the author; it is +functionally similar to the Fortran version upon which the present +document concentrates. + +\subsection{Example Application} +Here is a simple example of an application program written +using SLALIB calls: + +\begin{verbatim} + PROGRAM FK4FK5 + * + * Read a B1950 position from I/O unit 5 and reply on I/O unit 6 + * with the J2000 equivalent. Enter a period to quit. + * + IMPLICIT NONE + CHARACTER C*80,S + INTEGER I,J,IHMSF(4),IDMSF(4) + DOUBLE PRECISION R4,D4,R5,D5 + LOGICAL BAD + + * Loop until a period is entered + C = ' ' + DO WHILE (C(:1).NE.'.') + + * Read h m s d ' " + READ (5,'(A)') C + IF (C(:1).NE.'.') THEN + BAD = .TRUE. + + * Decode the RA + I = 1 + CALL sla_DAFIN(C,I,R4,J) + IF (J.EQ.0) THEN + R4 = 15D0*R4 + + * Decode the Dec + CALL sla_DAFIN(C,I,D4,J) + IF (J.EQ.0) THEN + + * FK4 to FK5 + CALL sla_FK45Z(R4,D4,1950D0,R5,D5) + + * Format and output the result + CALL sla_DR2TF(2,R5,S,IHMSF) + CALL sla_DR2AF(1,D5,S,IDMSF) + WRITE (6, + : '(1X,I2.2,2I3.2,''.'',I2.2,2X,A,I2.2,2I3.2,''.'',I1)') + : IHMSF,S,IDMSF + BAD = .FALSE. + END IF + END IF + IF (BAD) WRITE (6,'(1X,''?'')') + END IF + END DO + + END +\end{verbatim} +In this example, SLALIB not only provides the complicated FK4 to +FK5 transformation but also +simplifies the tedious and error-prone tasks +of decoding and formatting angles +expressed as hours, minutes {\it etc}. The +example incorporates range checking, and avoids the +notorious ``minus zero'' problem (an often-perpetrated bug where +declinations between $0^{\circ}$ and $-1^{\circ}$ lose their minus +sign). +With a little extra elaboration and a few more calls to SLALIB, +defaulting can be provided (enabling unused fields to +be replaced with commas to avoid retyping), proper motions +can be handled, different epochs can be specified, and +so on. See the program COCO (SUN/56) for further ideas. + +\subsection{Scope} +SLALIB contains \nroutines\ routines covering the following topics: +\begin{itemize} +\item String Decoding, + Sexagesimal Conversions +\item Angles, Vectors \& Rotation Matrices +\item Calendars, + Timescales +\item Precession \& Nutation +\item Proper Motion +\item FK4/FK5/Hipparcos, + Elliptic Aberration +\item Geocentric Coordinates +\item Apparent \& Observed Place +\item Azimuth \& Elevation +\item Refraction \& Air Mass +\item Ecliptic, + Galactic, + Supergalactic Coordinates +\item Ephemerides +\item Astrometry +\item Numerical Methods +\end{itemize} + +\subsection{Objectives} +SLALIB was designed to give application programmers +a basic set of positional-astronomy tools which were +accurate and easy to use. To this end, the library is: +\begin{itemize} +\item Readily available, including source code and documentation. +\item Supported and maintained. +\item Portable -- coded in standard languages and available for +multiple computers and operating systems. +\item Thoroughly commented, both for maintainability and to +assist those wishing to cannibalize the code. +\item Stable. +\item Trustworthy -- some care has gone into +testing SLALIB, both by comparison with published data and +by checks for internal consistency. +\item Rigorous -- corners are not cut, +even where the practical consequences would, as a rule, be +negligible. +\item Comprehensive, without including too many esoteric features +required only by specialists. +\item Practical -- almost all the routines have been written to +satisfy real needs encountered during the development of +real-life applications. +\item Environment-independent -- the package is +completely free of pauses, stops, I/O {\it etc}. +\item Self-contained -- SLALIB calls no other libraries. +\end{itemize} +A few {\it caveats}: +\begin{itemize} +\item SLALIB does not pretend to be canonical. It is in essence +an anthology, and the adopted algorithms are liable +to change as more up-to-date ones become available. +\item The functions aren't orthogonal -- there are several +cases of different +routines doing similar things, and many examples where +sequences of SLALIB calls have simply been packaged, all to +make applications less trouble to write. +\item There are omissions -- for example there are no +routines for calculating physical ephemerides of +Solar-System bodies. +\item SLALIB is not homogeneous, though important subsets +(for example the FK4/FK5 routines) are. +\item The library is not foolproof. You have to know what +you are trying to do ({\it e.g.}\ by reading textbooks on positional +astronomy), and it is the caller's responsibility to supply +sensible arguments (although enough internal validation is done to +avoid arithmetic errors). +\item Without being written in a wasteful +manner, SLALIB is nonetheless optimized for maintainability +rather than speed. In addition, there are many places +where considerable simplification would be possible if some +specified amount of accuracy could be sacrificed; such +compromises are left to the individual programmer and +are not allowed to limit SLALIB's value as a source +of comparison results. +\end{itemize} + +\subsection{Fortran Version} +The Fortran versions of SLALIB use ANSI Fortran~77 with a few +commonplace extensions. Just three out of the \nroutines\ routines require +platform-specific techniques and accordingly are supplied +in different forms. +SLALIB has been implemented on the following platforms: +VAX/VMS, +PC (Microsoft Fortran, Linux), +DECstation (Ultrix), +DEC Alpha (DEC Unix), +Sun (SunOS, Solaris), +Hewlett Packard (HP-UX), +CONVEX, +Perkin-Elmer and +Fujitsu. + +\subsection{C Version} +An ANSI C version of SLALIB is available from the author +but is not part of the Starlink release. +The functionality of this (proprietary) C version closely matches +that of the Starlink Fortran SLALIB, partly for the convenience of +existing users of the Fortran version, some of whom have in the past +implemented C ``wrappers''. The function names +cannot be the same as the Fortran versions because of potential +linking problems when +both forms of the library are present; the C routine which +is the equivalent of (for example) {\tt SLA\_REFRO} is {\tt slaRefro}. +The types of arguments follow the Fortran version, except +that integers are {\tt int} rather than {\tt long}. +Argument passing is by value +(except for arrays and strings of course) +for given arguments and by pointer for returned arguments. +All the C functions are re-entrant. + +The Fortran routines {\tt sla\_GRESID}, {\tt sla\_RANDOM} and +{\tt sla\_WAIT} have no C counterparts. + +Further details of the C version of SLALIB are available +from the author. The definitive guide to +the calling sequences is the file {\tt slalib.h}. + +\subsection{Future Versions} +The homogeneity and ease of use of SLALIB could perhaps be improved +in the future +by turning to C++ and object-oriented techniques. For example ``celestial +position'' could be a class and many of the transformations +could happen automatically. This requires further study and +would almost certainly result in a complete redesign. +Similarly, +the impact of Fortran~90 has yet to be assessed. Once compilers +become widely available, some internal recoding may be worthwhile +in order to simplify parts of the code. However, as with C++, +a redesign of the +application interfaces will be needed if the capabilities of the +new language are to be exploited to the full. + +\subsection{New Functions} +In a package like SLALIB it is difficult to know how far to go. Is it +enough to provide the primitive operations, or should more +complicated functions be packaged? Is it worth encroaching on +specialist areas, where individual experts have all written their +own software already? To what extent should CPU efficiency be +an issue? How much support of different numerical precisions is +required? And so on. + +In practice, almost all the routines in SLALIB are there because they were +needed for some specific application, and this is likely to remain the +pattern for any enhancements in the future. +Suggestions for additional SLALIB routines should be addressed to the +author. + +\subsection{Acknowledgements} +SLALIB is descended from a package of routines written +for the AAO 16-bit minicomputers +in the mid-1970s. The coming of the VAX +allowed a much more comprehensive and thorough package +to be designed for Starlink, especially important +at a time when the adoption +of the IAU 1976 resolutions meant that astronomers +would have to cope with a mixture of reference frames, +timescales and nomenclature. + +Much of the preparatory work on SLALIB was done by +Althea~Wilkinson of Manchester University. +During its development, +Andrew~Murray, +Catherine~Hohenkerk, +Andrew~Sinclair, +Bernard~Yallop +and +Brian~Emerson of Her Majesty's Nautical Almanac Office were consulted +on many occasions; their advice was indispensable. +I am especially grateful to +Catherine~Hohenkerk +for supplying preprints of papers, and test data. A number of +enhancements to SLALIB were at the suggestion of +Russell~Owen, University of Washington, +Phil~Hill, St~Andrews University, +Bill~Vacca, JILA, Boulder and +Ron~Maddalena, NRAO. +Mark~Calabretta, CSIRO Radiophysics, Sydney supplied changes to suit Convex. +I am indebted to Derek~Jones (RGO) for providing algorithms for +calculating 2-body orbital motion. + +The first C version of SLALIB was a hand-coded transcription +of the Starlink Fortran version carried out by +Steve~Eaton (University of Leeds) in the course of +MSc work. This was later +enhanced by John~Straede (AAO) and Martin~Shepherd (Caltech). +The current C SLALIB is a complete rewrite by the present author and +includes a comprehensive validation suite. +Additional comments on the C version came from Bob~Payne (NRAO) and +Jeremy~Bailey (AAO). + +\section{LINKING} + +On Unix systems (Sun, DEC Alpha {\it etc.}): +\begin{verse} +{\tt \%~~f77 progname.o -L/star/lib `sla\_link` -o progname} +\end{verse} +(The above assumes that all Starlink directories have been added to +the {\tt LD\_LIBRARY\_PATH} and {\tt PATH} environment variables +as described in SUN/202.) + +On VAX/VMS: +\begin{verse} +{\tt \$~~LINK progname,SLALIB\_DIR:SLALIB/LIB} +\end{verse} + +\pagebreak + +\section{SUBPROGRAM SPECIFICATIONS} +%----------------------------------------------------------------------- +\routine{SLA\_ADDET}{Add E-terms of Aberration} +{ + \action{Add the E-terms (elliptic component of annual aberration) to a + pre IAU 1976 mean place to conform to the old catalogue convention.} + \call{CALL sla\_ADDET (RM, DM, EQ, RC, DC)} +} +\args{GIVEN} +{ + \spec{RM,DM}{D}{\radec\ without E-terms (radians)} \\ + \spec{EQ}{D}{Besselian epoch of mean equator and equinox} +} +\args{RETURNED} +{ + \spec{RC,DC}{D}{\radec\ with E-terms included (radians)} +} +\anote{Most star positions from pre-1984 optical catalogues (or + obtained by astrometry with respect to such stars) have the + E-terms built-in. If it is necessary to convert a formal mean + place (for example a pulsar timing position) to one + consistent with such a star catalogue, then the + \radec\ should be adjusted using this routine.} +\aref{{\it Explanatory Supplement to the Astronomical Ephemeris}, + section 2D, page 48.} +%----------------------------------------------------------------------- +\routine{SLA\_AFIN}{Sexagesimal character string to angle} +{ + \action{Decode a free-format sexagesimal string (degrees, arcminutes, + arcseconds) into a single precision floating point + number (radians).} + \call{CALL sla\_AFIN (STRING, NSTRT, RESLT, JF)} +} +\args{GIVEN} +{ + \spec{STRING}{C*(*)}{string containing deg, arcmin, arcsec fields} \\ + \spec{NSTRT}{I}{pointer to start of decode (beginning of STRING = 1)} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced past the decoded angle} \\ + \spec{RESLT}{R}{angle in radians} \\ + \spec{JF}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{0.7em} $+1$ = default, RESLT unchanged (note 2)} \\ + \spec{}{}{\hspace{0.7em} $-1$ = bad degrees (note 3)} \\ + \spec{}{}{\hspace{0.7em} $-2$ = bad arcminutes (note 3)} \\ + \spec{}{}{\hspace{0.7em} $-3$ = bad arcseconds (note 3)} \\ +} +\goodbreak +\setlength{\oldspacing}{\topsep} +\setlength{\topsep}{0.3ex} +\begin{description} + \exampleitem \\ [1.5ex] + \begin{tabular}{p{7em}p{15em}p{12em}} + {\it argument} & {\it before} & {\it after} \\ \\ + STRING & $'$\verb*}-57 17 44.806 12 34 56.7}$'$ & unchanged \\ + NSTRT & 1 & 16 ({\it i.e.}\ pointing to 12...) \\ + RESLT & - & $-1.00000$ \\ + JF & - & 0 + \end{tabular} + \item A further call to sla\_AFIN, without adjustment of NSTRT, will + decode the second angle, \dms{12}{34}{56}{7}. +\end{description} +\setlength{\topsep}{\oldspacing} +\notes +{ + \begin{enumerate} + \item The first three ``fields'' in STRING are degrees, arcminutes, + arcseconds, separated by spaces or commas. The degrees field + may be signed, but not the others. The decoding is carried + out by the sla\_DFLTIN routine and is free-format. + \item Successive fields may be absent, defaulting to zero. For + zero status, the only combinations allowed are degrees alone, + degrees and arcminutes, and all three fields present. If all + three fields are omitted, a status of +1 is returned and RESLT is + unchanged. In all other cases RESLT is changed. + \item Range checking: + \begin{itemize} + \item The degrees field is not range checked. However, it is + expected to be integral unless the other two fields are absent. + \item The arcminutes field is expected to be 0-59, and integral if + the arcseconds field is present. If the arcseconds field + is absent, the arcminutes is expected to be 0-59.9999... + \item The arcseconds field is expected to be 0-59.9999... + \item Decoding continues even when a check has failed. Under these + circumstances the field takes the supplied value, defaulting to + zero, and the result RESLT is computed and returned. + \end{itemize} + \item Further fields after the three expected ones are not treated as + an error. The pointer NSTRT is left in the correct state for + further decoding with the present routine or with sla\_DFLTIN + {\it etc}. See the example, above. + \item If STRING contains hours, minutes, seconds instead of + degrees {\it etc}, + or if the required units are turns (or days) instead of radians, + the result RESLT should be multiplied as follows: \\ [1.5ex] + \begin{tabular}{p{6em}p{5em}p{15em}} + {\it for STRING} & {\it to obtain} & {\it multiply RESLT by} \\ \\ + ${\circ}$~~\raisebox{-0.7ex}{$'$}~~\raisebox{-0.7ex}{$''$} + & radians & $1.0$ \\ + ${\circ}$~~\raisebox{-0.7ex}{$'$}~~\raisebox{-0.7ex}{$''$} + & turns & $1/{2 \pi} = 0.1591549430918953358$ \\ + h m s & radians & $15.0$ \\ + h m s & days & $15/{2\pi} = 2.3873241463784300365$ \\ + \end{tabular} + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AIRMAS}{Air Mass} +{ + \action{Air mass at given zenith distance (double precision).} + \call{D~=~sla\_AIRMAS (ZD)} +} +\args{GIVEN} +{ + \spec{ZD}{D}{observed zenith distance (radians)} +} +\args{RETURNED} +{ + \spec{sla\_AIRMAS}{D}{air mass (1 at zenith)} +} +\notes +{ + \begin{enumerate} + \item The {\it observed}\/ zenith distance referred to above means + ``as affected by refraction''. + \item The routine uses Hardie's (1962) polynomial fit to Bemporad's + data for the relative air mass, $X$, in units of thickness at the + zenith as tabulated by Schoenberg (1929). This is adequate for all + normal needs as it is accurate to better than + 0.1\% up to $X = 6.8$ and better than 1\% up to $X = 10$. + Bemporad's tabulated values are unlikely to be trustworthy + to such accuracy + because of variations in density, pressure and other + conditions in the atmosphere from those assumed in his work. + \item The sign of the ZD is ignored. + \item At zenith distances greater than about $\zeta = 87^{\circ}$ the + air mass is held constant to avoid arithmetic overflows. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Hardie, R.H., 1962, in {\it Astronomical Techniques}\, + ed. W.A.\ Hiltner, University of Chicago Press, p180. + \item Schoenberg, E., 1929, Hdb.\ d.\ Ap., + Berlin, Julius Springer, 2, 268. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_ALTAZ}{Velocities {\it etc.}\ for Altazimuth Mount} +{ + \action{Positions, velocities and accelerations for an altazimuth + telescope mount tracking a star (double precision).} + \call{CALL sla\_ALTAZ (\vtop{ + \hbox{HA, DEC, PHI,} + \hbox{AZ, AZD, AZDD, EL, ELD, ELDD, PA, PAD, PADD)}}} +} +\args{GIVEN} +{ + \spec{HA}{D}{hour angle} \\ + \spec{DEC}{D}{declination} \\ + \spec{PHI}{D}{observatory latitude} +} +\args{RETURNED} +{ + \spec{AZ}{D}{azimuth} \\ + \spec{AZD}{D}{azimuth velocity} \\ + \spec{AZDD}{D}{azimuth acceleration} \\ + \spec{EL}{D}{elevation} \\ + \spec{ELD}{D}{elevation velocity} \\ + \spec{ELDD}{D}{elevation acceleration} \\ + \spec{PA}{D}{parallactic angle} \\ + \spec{PAD}{D}{parallactic angle velocity} \\ + \spec{PADD}{D}{parallactic angle acceleration} +} +\notes +{ + \begin{enumerate} + \setlength{\parskip}{\medskipamount} + \item Natural units are used throughout. HA, DEC, PHI, AZ, EL + and ZD are in radians. The velocities and accelerations + assume constant declination and constant rate of change of + hour angle (as for tracking a star); the units of AZD, ELD + and PAD are radians per radian of HA, while the units of AZDD, + ELDD and PADD are radians per radian of HA squared. To + convert into practical degree- and second-based units: + + \begin{center} + \begin{tabular}{rlcl} + angles & $\times 360/2\pi$ & $\rightarrow$ & degrees \\ + velocities & $\times (2\pi/86400) \times (360/2\pi)$ + & $\rightarrow$ & degree/sec \\ + accelerations & $\times (2\pi/86400)^2 \times (360/2\pi)$ + & $\rightarrow$ & degree/sec/sec \\ + \end{tabular} + \end{center} + + Note that the seconds here are sidereal rather than SI. One + sidereal second is about 0.99727 SI seconds. + + The velocity and acceleration factors assume the sidereal + tracking case. Their respective numerical values are (exactly) + 1/240 and (approximately) 1/3300236.9. + \item Azimuth is returned in the range $[\,0,2\pi\,]$; north is zero, + and east is $+\pi/2$. Elevation and parallactic angle are + returned in the range $\pm\pi/2$. Position angle is +ve + for a star west of the meridian and is the angle NP--star--zenith. + \item The latitude is geodetic as opposed to geocentric. The + hour angle and declination are topocentric. Refraction and + deficiencies in the telescope mounting are ignored. The + purpose of the routine is to give the general form of the + quantities. The details of a real telescope could profoundly + change the results, especially close to the zenith. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and (for tracking a star) + sine and cosine of declination. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AMP}{Apparent to Mean} +{ + \action{Convert star \radec\ from geocentric apparent to + mean place (post IAU 1976).} + \call{CALL sla\_AMP (RA, DA, DATE, EQ, RM, DM)} +} +\args{GIVEN} +{ + \spec{RA,DA}{D}{apparent \radec\ (radians)} \\ + \spec{DATE}{D}{TDB for apparent place (JD$-$2400000.5)} \\ + \spec{EQ}{D}{equinox: Julian epoch of mean place} +} +\args{RETURNED} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item The distinction between the required TDB and TT is + always negligible. Moreover, for all but the most + critical applications UTC is adequate. + \item The accuracy is limited by the routine sla\_EVP, called + by sla\_MAPPA, which computes the Earth position and + velocity using the methods of Stumpff. The maximum + error is about 0.3~milliarcsecond. + \item Iterative techniques are used for the aberration and + light deflection corrections so that the routines + sla\_AMP (or sla\_AMPQK) and sla\_MAP (or sla\_MAPQK) are + accurate inverses; even at the edge of the Sun's disc + the discrepancy is only about 1~nanoarcsecond. + \item Where multiple apparent places are to be converted to + mean places, for a fixed date and equinox, it is more + efficient to use the sla\_MAPPA routine to compute the + required parameters once, followed by one call to + sla\_AMPQK per star. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AMPQK}{Quick Apparent to Mean} +{ + \action{Convert star \radec\ from geocentric apparent to mean place + (post IAU 1976). Use of this routine is appropriate when + efficiency is important and where many star positions are + all to be transformed for one epoch and equinox. The + star-independent parameters can be obtained by calling + the sla\_MAPPA routine.} + \call{CALL sla\_AMPQK (RA, DA, AMPRMS, RM, DM)} +} +\args{GIVEN} +{ + \spec{RA,DA}{D}{apparent \radec\ (radians)} \\ + \spec{AMPRMS}{D(21)}{star-independent mean-to-apparent parameters:} \\ + \specel {(1)} {time interval for proper motion (Julian years)} \\ + \specel {(2-4)} {barycentric position of the Earth (AU)} \\ + \specel {(5-7)} {heliocentric direction of the Earth (unit vector)} \\ + \specel {(8)} {(gravitational radius of + Sun)$\times 2 / $(Sun-Earth distance)} \\ + \specel {(9-11)} {{\bf v}: barycentric Earth velocity in units of c} \\ + \specel {(12)} {$\sqrt{1-\left|\mbox{\bf v}\right|^2}$} \\ + \specel {(13-21)} {precession/nutation $3\times3$ matrix} +} +\args{RETURNED} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item The accuracy is limited by the routine sla\_EVP, called + by sla\_MAPPA, which computes the Earth position and + velocity using the methods of Stumpff. The maximum + error is about 0.3~milliarcsecond. + \item Iterative techniques are used for the aberration and + light deflection corrections so that the routines + sla\_AMP (or sla\_AMPQK) and sla\_MAP (or sla\_MAPQK) are + accurate inverses; even at the edge of the Sun's disc + the discrepancy is only about 1~nanoarcsecond. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AOP}{Apparent to Observed} +{ + \action{Apparent to observed place, for optical sources distant from + the solar system.} + \call{CALL sla\_AOP (\vtop{ + \hbox{RAP, DAP, DATE, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, AOB, ZOB, HOB, DOB, ROB)}}} +} +\args{GIVEN} +{ + \spec{RAP,DAP}{D}{geocentric apparent \radec\ (radians)} \\ + \spec{DATE}{D}{UTC date/time (Modified Julian Date, JD$-$2400000.5)} \\ + \spec{DUT}{D}{$\Delta$UT: UT1$-$UTC (UTC seconds)} \\ + \spec{ELONGM}{D}{observer's mean longitude (radians, east +ve)} \\ + \spec{PHIM}{D}{observer's mean geodetic latitude (radians)} \\ + \spec{HM}{D}{observer's height above sea level (metres)} \\ + \spec{XP,YP}{D}{polar motion \xy\ coordinates (radians)} \\ + \spec{TDK}{D}{local ambient temperature (degrees K; std=273.155D0)} \\ + \spec{PMB}{D}{local atmospheric pressure (mB; std=1013.25D0)} \\ + \spec{RH}{D}{local relative humidity (in the range 0D0\,--\,1D0)} \\ + \spec{WL}{D}{effective wavelength ($\mu{\rm m}$, {\it e.g.}\ 0.55D0)} \\ + \spec{TLR}{D}{tropospheric lapse rate (degrees K per metre, + {\it e.g.}\ 0.0065D0)} +} +\args{RETURNED} +{ + \spec{AOB}{D}{observed azimuth (radians: N=0, E=$90^{\circ}$)} \\ + \spec{ZOB}{D}{observed zenith distance (radians)} \\ + \spec{HOB}{D}{observed Hour Angle (radians)} \\ + \spec{DOB}{D}{observed $\delta$ (radians)} \\ + \spec{ROB}{D}{observed $\alpha$ (radians)} +} +\notes +{ + \begin{enumerate} + \item This routine returns zenith distance rather than elevation + in order to reflect the fact that no allowance is made for + depression of the horizon. + \item The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted azimuth and elevation should be within about + \arcsec{0}{1} for $\zeta<70^{\circ}$. Even + at a topocentric zenith distance of + $90^{\circ}$, the accuracy in elevation should be better than + 1~arcminute; useful results are available for a further + $3^{\circ}$, beyond which the sla\_REFRO routine returns a + fixed value of the refraction. The complementary + routines sla\_AOP (or sla\_AOPQK) and sla\_OAP (or sla\_OAPQK) + are self-consistent to better than 1~microarcsecond all over + the celestial sphere. + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item {\it Apparent}\/ \radec\ means the geocentric apparent right ascension + and declination, which is obtained from a catalogue mean place + by allowing for space motion, parallax, precession, nutation, + annual aberration, and the Sun's gravitational lens effect. For + star positions in the FK5 system ({\it i.e.}\ J2000), these effects can + be applied by means of the sla\_MAP {\it etc.}\ routines. Starting from + other mean place systems, additional transformations will be + needed; for example, FK4 ({\it i.e.}\ B1950) mean places would first + have to be converted to FK5, which can be done with the + sla\_FK425 {\it etc.}\ routines. + \item {\it Observed}\/ \azel\ means the position that would be seen by a + perfect theodolite located at the observer. This is obtained + from the geocentric apparent \radec\ by allowing for Earth + orientation and diurnal aberration, rotating from equator + to horizon coordinates, and then adjusting for refraction. + The \hadec\ is obtained by rotating back into equatorial + coordinates, using the geodetic latitude corrected for polar + motion, and is the position that would be seen by a perfect + equatorial located at the observer and with its polar axis + aligned to the Earth's axis of rotation ({\it n.b.}\ not to the + refracted pole). Finally, the $\alpha$ is obtained by subtracting + the {\it h}\/ from the local apparent ST. + \item To predict the required setting of a real telescope, the + observed place produced by this routine would have to be + adjusted for the tilt of the azimuth or polar axis of the + mounting (with appropriate corrections for mount flexures), + for non-perpendicularity between the mounting axes, for the + position of the rotator axis and the pointing axis relative + to it, for tube flexure, for gear and encoder errors, and + finally for encoder zero points. Some telescopes would, of + course, exhibit other properties which would need to be + accounted for at the appropriate point in the sequence. + \item This routine takes time to execute, due mainly to the + rigorous integration used to evaluate the refraction. + For processing multiple stars for one location and time, + call sla\_AOPPA once followed by one call per star to sla\_AOPQK. + Where a range of times within a limited period of a few hours + is involved, and the highest precision is not required, call + sla\_AOPPA once, followed by a call to sla\_AOPPAT each time the + time changes, followed by one call per star to sla\_AOPQK. + \item The DATE argument is UTC expressed as an MJD. This is, + strictly speaking, wrong, because of leap seconds. However, + as long as the $\Delta$UT and the UTC are consistent there + are no difficulties, except during a leap second. In this + case, the start of the 61st second of the final minute should + begin a new MJD day and the old pre-leap $\Delta$UT should + continue to be used. As the 61st second completes, the MJD + should revert to the start of the day as, simultaneously, + the $\Delta$UT changes by one second to its post-leap new value. + \item The $\Delta$UT (UT1$-$UTC) is tabulated in IERS circulars and + elsewhere. It increases by exactly one second at the end of + each UTC leap second, introduced in order to keep $\Delta$UT + within $\pm$\tsec{0}{9}. + \item IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. The + longitude required by the present routine is {\bf east-positive}, + in accordance with geographical convention (and right-handed). + In particular, note that the longitudes returned by the + sla\_OBS routine are west-positive (as in the {\it Astronomical + Almanac}\/ before 1984) and must be reversed in sign before use + in the present routine. + \item The polar coordinates XP,YP can be obtained from IERS + circulars and equivalent publications. The + maximum amplitude is about \arcsec{0}{3}. If XP,YP values + are unavailable, use XP=YP=0D0. See page B60 of the 1988 + {\it Astronomical Almanac}\/ for a definition of the two angles. + \item The height above sea level of the observing station, HM, + can be obtained from the {\it Astronomical Almanac}\/ (Section J + in the 1988 edition), or via the routine sla\_OBS. If P, + the pressure in mB, is available, an adequate + estimate of HM can be obtained from the following expression: + \begin{quote} + {\tt HM=-29.3D0*TSL*LOG(P/1013.25D0)} + \end{quote} + where TSL is the approximate sea-level air temperature in degrees K + (see {\it Astrophysical Quantities}, C.W.Allen, 3rd~edition, + \S 52.) Similarly, if the pressure P is not known, + it can be estimated from the height of the observing + station, HM as follows: + \begin{quote} + {\tt P=1013.25D0*EXP(-HM/(29.3D0*TSL))} + \end{quote} + Note, however, that the refraction is proportional to the + pressure and that an accurate P value is important for + precise work. + \item The azimuths {\it etc.}\ used by the present routine are with + respect to the celestial pole. Corrections to the terrestrial pole + can be computed using sla\_POLMO. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AOPPA}{Appt-to-Obs Parameters} +{ + \action{Pre-compute the set of apparent to observed place parameters + required by the ``quick'' routines sla\_AOPQK and sla\_OAPQK.} + \call{CALL sla\_AOPPA (\vtop{ + \hbox{DATE, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, AOPRMS)}}} +} +\args{GIVEN} +{ + \spec{DATE}{D}{UTC date/time (Modified Julian Date, JD$-$2400000.5)} \\ + \spec{DUT}{D}{$\Delta$UT: UT1$-$UTC (UTC seconds)} \\ + \spec{ELONGM}{D}{observer's mean longitude (radians, east +ve)} \\ + \spec{PHIM}{D}{observer's mean geodetic latitude (radians)} \\ + \spec{HM}{D}{observer's height above sea level (metres)} \\ + \spec{XP,YP}{D}{polar motion \xy\ coordinates (radians)} \\ + \spec{TDK}{D}{local ambient temperature (degrees K; std=273.155D0)} \\ + \spec{PMB}{D}{local atmospheric pressure (mB; std=1013.25D0)} \\ + \spec{RH}{D}{local relative humidity (in the range 0D0\,--\,1D0)} \\ + \spec{WL}{D}{effective wavelength ($\mu{\rm m}$, {\it e.g.}\ 0.55D0)} \\ + \spec{TLR}{D}{tropospheric lapse rate (degrees K per metre, + {\it e.g.}\ 0.0065D0)} +} +\args{RETURNED} +{ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel {(1)} {geodetic latitude (radians)} \\ + \specel {(2,3)} {sine and cosine of geodetic latitude} \\ + \specel {(4)} {magnitude of diurnal aberration vector} \\ + \specel {(5)} {height (HM)} \\ + \specel {(6)} {ambient temperature (TDK)} \\ + \specel {(7)} {pressure (PMB)} \\ + \specel {(8)} {relative humidity (RH)} \\ + \specel {(9)} {wavelength (WL)} \\ + \specel {(10)} {lapse rate (TLR)} \\ + \specel {(11,12)} {refraction constants A and B (radians)} \\ + \specel {(13)} {longitude + eqn of equinoxes + + ``sidereal $\Delta$UT'' (radians)} \\ + \specel {(14)} {local apparent sidereal time (radians)} +} +\notes +{ + \begin{enumerate} + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item The DATE argument is UTC expressed as an MJD. This is, + strictly speaking, wrong, because of leap seconds. However, + as long as the $\Delta$UT and the UTC are consistent there + are no difficulties, except during a leap second. In this + case, the start of the 61st second of the final minute should + begin a new MJD day and the old pre-leap $\Delta$UT should + continue to be used. As the 61st second completes, the MJD + should revert to the start of the day as, simultaneously, + the $\Delta$UT changes by one second to its post-leap new value. + \item The $\Delta$UT (UT1$-$UTC) is tabulated in IERS circulars and + elsewhere. It increases by exactly one second at the end of + each UTC leap second, introduced in order to keep $\Delta$UT + within $\pm$\tsec{0}{9}. The ``sidereal $\Delta$UT'' which forms + part of AOPRMS(13) is the same quantity, but converted from solar + to sidereal seconds and expressed in radians. + \item IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. The + longitude required by the present routine is {\bf east-positive}, + in accordance with geographical convention (and right-handed). + In particular, note that the longitudes returned by the + sla\_OBS routine are west-positive (as in the {\it Astronomical + Almanac}\/ before 1984) and must be reversed in sign before use in + the present routine. + \item The polar coordinates XP,YP can be obtained from IERS + circulars and equivalent publications. The + maximum amplitude is about \arcsec{0}{3}. If XP,YP values + are unavailable, use XP=YP=0D0. See page B60 of the 1988 + {\it Astronomical Almanac}\/ for a definition of the two angles. + \item The height above sea level of the observing station, HM, + can be obtained from the {\it Astronomical Almanac}\/ (Section J + in the 1988 edition), or via the routine sla\_OBS. If P, + the pressure in mB, is available, an adequate + estimate of HM can be obtained from the following expression: + \begin{quote} + {\tt HM=-29.3D0*TSL*LOG(P/1013.25D0)} + \end{quote} + where TSL is the approximate sea-level air temperature in degrees K + (see {\it Astrophysical Quantities}, C.W.Allen, 3rd~edition, + \S 52.) Similarly, if the pressure P is not known, + it can be estimated from the height of the observing + station, HM as follows: + \begin{quote} + {\tt P=1013.25D0*EXP(-HM/(29.3D0*TSL))} + \end{quote} + Note, however, that the refraction is proportional to the + pressure and that an accurate P value is important for + precise work. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AOPPAT}{Update Appt-to-Obs Parameters} +{ + \action{Recompute the sidereal time in the apparent to observed place + star-independent parameter block.} + \call{CALL sla\_AOPPAT (DATE, AOPRMS)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{UTC date/time (Modified Julian Date, JD$-$2400000.5)} \\ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel{(1-12)}{not required} \\ + \specel{(13)}{longitude + eqn of equinoxes + + ``sidereal $\Delta$UT'' (radians)} \\ + \specel{(14)}{not required} +} +\args{RETURNED} +{ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel{(1-13)}{not changed} \\ + \specel{(14)}{local apparent sidereal time (radians)} +} +\anote{For more information, see sla\_AOPPA.} +%----------------------------------------------------------------------- +\routine{SLA\_AOPQK}{Quick Appt-to-Observed} +{ + \action{Quick apparent to observed place (but see Note~8, below).} + \call{CALL sla\_AOPQK (RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB)} +} +\args{GIVEN} +{ + \spec{RAP,DAP}{D}{geocentric apparent \radec\ (radians)} \\ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel{(1)}{geodetic latitude (radians)} \\ + \specel{(2,3)}{sine and cosine of geodetic latitude} \\ + \specel{(4)}{magnitude of diurnal aberration vector} \\ + \specel{(5)}{height (metres)} \\ + \specel{(6)}{ambient temperature (degrees K)} \\ + \specel{(7)}{pressure (mB)} \\ + \specel{(8)}{relative humidity (0\,--\,1)} \\ + \specel{(9)}{wavelength ($\mu{\rm m}$)} \\ + \specel{(10)}{lapse rate (degrees K per metre)} \\ + \specel{(11,12)}{refraction constants A and B (radians)} \\ + \specel{(13)}{longitude + eqn of equinoxes + + ``sidereal $\Delta$UT'' (radians)} \\ + \specel{(14)}{local apparent sidereal time (radians)} +} +\args{RETURNED} +{ + \spec{AOB}{D}{observed azimuth (radians: N=0, E=$90^{\circ}$)} \\ + \spec{ZOB}{D}{observed zenith distance (radians)} \\ + \spec{HOB}{D}{observed Hour Angle (radians)} \\ + \spec{DOB}{D}{observed Declination (radians)} \\ + \spec{ROB}{D}{observed Right Ascension (radians)} +} +\notes +{ + \begin{enumerate} + \item This routine returns zenith distance rather than elevation + in order to reflect the fact that no allowance is made for + depression of the horizon. + \item The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted azimuth and elevation should be within about + \arcsec{0}{1} for $\zeta<70^{\circ}$. Even + at a topocentric zenith distance of + $90^{\circ}$, the accuracy in elevation should be better than + 1~arcminute; useful results are available for a further + $3^{\circ}$, beyond which the sla\_REFRO routine returns a + fixed value of the refraction. The complementary + routines sla\_AOP (or sla\_AOPQK) and sla\_OAP (or sla\_OAPQK) + are self-consistent to better than 1~microarcsecond all over + the celestial sphere. + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item {\it Apparent}\/ \radec\ means the geocentric apparent right ascension + and declination, which is obtained from a catalogue mean place + by allowing for space motion, parallax, precession, nutation, + annual aberration, and the Sun's gravitational lens effect. For + star positions in the FK5 system ({\it i.e.}\ J2000), these effects can + be applied by means of the sla\_MAP {\it etc.}\ routines. Starting from + other mean place systems, additional transformations will be + needed; for example, FK4 ({\it i.e.}\ B1950) mean places would first + have to be converted to FK5, which can be done with the + sla\_FK425 {\it etc.}\ routines. + \item {\it Observed}\/ \azel\ means the position that would be seen by a + perfect theodolite located at the observer. This is obtained + from the geocentric apparent \radec\ by allowing for Earth + orientation and diurnal aberration, rotating from equator + to horizon coordinates, and then adjusting for refraction. + The \hadec\ is obtained by rotating back into equatorial + coordinates, using the geodetic latitude corrected for polar + motion, and is the position that would be seen by a perfect + equatorial located at the observer and with its polar axis + aligned to the Earth's axis of rotation ({\it n.b.}\ not to the + refracted pole). Finally, the $\alpha$ is obtained by subtracting + the {\it h}\/ from the local apparent ST. + \item To predict the required setting of a real telescope, the + observed place produced by this routine would have to be + adjusted for the tilt of the azimuth or polar axis of the + mounting (with appropriate corrections for mount flexures), + for non-perpendicularity between the mounting axes, for the + position of the rotator axis and the pointing axis relative + to it, for tube flexure, for gear and encoder errors, and + finally for encoder zero points. Some telescopes would, of + course, exhibit other properties which would need to be + accounted for at the appropriate point in the sequence. + \item The star-independent apparent-to-observed-place parameters + in AOPRMS may be computed by means of the sla\_AOPPA routine. + If nothing has changed significantly except the time, the + sla\_AOPPAT routine may be used to perform the requisite + partial recomputation of AOPRMS. + \item The ``sidereal $\Delta$UT'' which forms part of AOPRMS(13) + is UT1$-$UTC converted from solar to + sidereal seconds and expressed in radians. + \item At zenith distances beyond about $76^\circ$, the need for + special care with the corrections for refraction causes a + marked increase in execution time. Moreover, the effect + gets worse with increasing zenith distance. Adroit + programming in the calling application may allow the + problem to be reduced. Prepare an alternative AOPRMS array, + computed for zero air-pressure; this will disable the + refraction corrections and cause rapid execution. Using + this AOPRMS array, a preliminary call to the present routine + will, depending on the application, produce a rough position + which may be enough to establish whether the full, slow + calculation (using the real AOPRMS array) is worthwhile. + For example, there would be no need for the full calculation + if the preliminary call had already established that the + source was well below the elevation limits for a particular + telescope. + \item The azimuths {\it etc.}\ used by the present routine are with + respect to the celestial pole. Corrections to the terrestrial pole + can be computed using sla\_POLMO. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_ATMDSP}{Atmospheric Dispersion} +{ + \action{Apply atmospheric-dispersion adjustments to refraction coefficients.} + \call{CALL sla\_ATMDSP (TDK, PMB, RH, WL1, A1, B1, WL2, A2, B2)} +} +\args{GIVEN} +{ + \spec{TDK}{D}{ambient temperature at the observer (degrees K)} \\ + \spec{PMB}{D}{pressure at the observer (mB)} \\ + \spec{RH}{D}{relative humidity at the observer (range 0\,--\,1)} \\ + \spec{WL1}{D}{base wavelength ($\mu{\rm m}$)} \\ + \spec{A1}{D}{refraction coefficient A for wavelength WL1 (radians)} \\ + \spec{B1}{D}{refraction coefficient B for wavelength WL1 (radians)} \\ + \spec{WL2}{D}{wavelength for which adjusted A,B required ($\mu{\rm m}$)} +} +\args{RETURNED} +{ + \spec{A2}{D}{refraction coefficient A for wavelength WL2 (radians)} \\ + \spec{B2}{D}{refraction coefficient B for wavelength WL2 (radians)} +} +\notes +{ + \begin{enumerate} + \item To use this routine, first call sla\_REFCO specifying WL1 as the + wavelength. This yields refraction coefficients A1, B1, correct + for that wavelength. Subsequently, calls to sla\_ATMDSP specifying + different wavelengths will produce new, slightly adjusted + refraction coefficients A2, B2, which apply to the specified wavelength. + \item Most of the atmospheric dispersion happens between $0.7\,\mu{\rm m}$ + and the UV atmospheric cutoff, and the effect increases strongly + towards the UV end. For this reason a blue reference wavelength + is recommended, for example $0.4\,\mu{\rm m}$. + \item The accuracy, for this set of conditions: \\[1pc] + \hspace*{5ex} \begin{tabular}{rcl} + height above sea level & ~ & 2000\,m \\ + latitude & ~ & $29^\circ$ \\ + pressure & ~ & 793\,mB \\ + temperature & ~ & $290^\circ$\,K \\ + humidity & ~ & 0.5 (50\%) \\ + lapse rate & ~ & $0.0065^\circ m^{-1}$ \\ + reference wavelength & ~ & $0.4\,\mu{\rm m}$ \\ + star elevation & ~ & $15^\circ$ \\ + \end{tabular}\\[1pc] + is about 2.5\,mas RMS between 0.3 and $1.0\,\mu{\rm m}$, and stays + within 4\,mas for the whole range longward of $0.3\,\mu{\rm m}$ + (compared with a total dispersion from 0.3 to $20\,\mu{\rm m}$ + of about \arcseci{11}). These errors are typical for ordinary + conditions; in extreme conditions values a few times this size + may occur. + \item If either wavelength exceeds $100\,\mu{\rm m}$, the radio case + is assumed and the returned refraction coefficients are the + same as the given ones. + \item The algorithm consists of calculation of the refractivity of the + air at the observer for the two wavelengths, using the methods + of the sla\_REFRO routine, and then scaling of the two refraction + coefficients according to classical refraction theory. This + amounts to scaling the A coefficient in proportion to $(\mu-1)$ and + the B coefficient almost in the same ratio (see R.M.Green, + {\it Spherical Astronomy,}\/ Cambridge University Press, 1985). + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AV2M}{Rotation Matrix from Axial Vector} +{ + \action{Form the rotation matrix corresponding to a given axial vector + (single precision).} + \call{CALL sla\_AV2M (AXVEC, RMAT)} +} +\args{GIVEN} +{ + \spec{AXVEC}{R(3)}{axial vector (radians)} +} +\args{RETURNED} +{ + \spec{RMAT}{R(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item A rotation matrix describes a rotation about some arbitrary axis. + The axis is called the {\it Euler axis}, and the angle through which the + reference frame rotates is called the Euler angle. The axial + vector supplied to this routine has the same direction as the + Euler axis, and its magnitude is the Euler angle in radians. + \item If AXVEC is null, the unit matrix is returned. + \item The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_BEAR}{Direction Between Points on a Sphere} +{ + \action{Returns the bearing (position angle) of one point on a + sphere seen from another (single precision).} + \call{R~=~sla\_BEAR (A1, B1, A2, B2)} +} +\args{GIVEN} +{ + \spec{A1,B1}{R}{spherical coordinates of one point} \\ + \spec{A2,B2}{R}{spherical coordinates of the other point} +} +\args{RETURNED} +{ + \spec{sla\_BEAR}{R}{bearing from first point to second} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are \radec, + $[\lambda,\phi]$ {\it etc.}, in radians. + \item The result is the bearing (position angle), in radians, + of point [A2,B2] as seen + from point [A1,B1]. It is in the range $\pm \pi$. The sense + is such that if [A2,B2] + is a small distance due east of [A1,B1] the result + is about $+\pi/2$. Zero is returned + if the two points are coincident. + \item If either B-coordinate is outside the range $\pm\pi/2$, the + result may correspond to ``the long way round''. + \item The routine sla\_PAV performs an equivalent function except + that the points are specified in the form of Cartesian unit + vectors. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CAF2R}{Deg,Arcmin,Arcsec to Radians} +{ + \action{Convert degrees, arcminutes, arcseconds to radians + (single precision).} + \call{CALL sla\_CAF2R (IDEG, IAMIN, ASEC, RAD, J)} +} +\args{GIVEN} +{ + \spec{IDEG}{I}{degrees} \\ + \spec{IAMIN}{I}{arcminutes} \\ + \spec{ASEC}{R}{arcseconds} +} +\args{RETURNED} +{ + \spec{RAD}{R}{angle in radians} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 1 = IDEG outside range 0$-$359} \\ + \spec{}{}{\hspace{1.5em} 2 = IAMIN outside range 0$-$59} \\ + \spec{}{}{\hspace{1.5em} 3 = ASEC outside range 0$-$59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CALDJ}{Calendar Date to MJD} +{ + \action{Gregorian Calendar to Modified Julian Date, with century default.} + \call{CALL sla\_CALDJ (IY, IM, ID, DJM, J)} +} +\args{GIVEN} +{ + \spec{IY,IM,ID}{I}{year, month, day in Gregorian calendar} +} +\args{RETURNED} +{ + \spec{DJM}{D}{modified Julian Date (JD$-$2400000.5) for $0^{\rm h}$} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = bad year (MJD not computed)} \\ + \spec{}{}{\hspace{1.5em} 2 = bad month (MJD not computed)} \\ + \spec{}{}{\hspace{1.5em} 3 = bad day (MJD computed)} \\ +} +\notes +{ + \begin{enumerate} + \item This routine supports the {\it century default}\/ feature. + Acceptable years are: + \begin{itemize} + \item 00-49, interpreted as 2000\,--\,2049, + \item 50-99, interpreted as 1950\,--\,1999, and + \item 100 upwards, interpreted literally. + \end{itemize} + For 1-100AD use the routine sla\_CLDJ instead. + \item For year $n$BC use IY = $-(n-1)$. + \item When an invalid year or month is supplied (status J~=~1~or~2) + the MJD is {\bf not} computed. When an invalid day is supplied + (status J~=~3) the MJD {\bf is} computed. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CALYD}{Calendar to Year, Day} +{ + \action{Gregorian calendar date to year and day in year, in a Julian + calendar aligned to the 20th/21st century Gregorian calendar, + with century default.} + \call{CALL sla\_CALYD (IY, IM, ID, NY, ND, J)} +} +\args{GIVEN} +{ + \spec{IY,IM,ID}{I}{year, month, day in Gregorian calendar: + year may optionally omit the century} +} +\args{RETURNED} +{ + \spec{NY}{I}{year (re-aligned Julian calendar)} \\ + \spec{ND}{I}{day in year (1 = January 1st)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = bad year (before $-4711$)} \\ + \spec{}{}{\hspace{1.5em} 2 = bad month} \\ + \spec{}{}{\hspace{1.5em} 3 = bad day} +} +\notes +{ + \begin{enumerate} + \item This routine supports the {\it century default}\/ feature. + Acceptable years are: + \begin{itemize} + \item 00-49, interpreted as 2000\,--\,2049, + \item 50-99, interpreted as 1950\,--\,1999, and + \item other years after -4712 , interpreted literally. + \end{itemize} + Use sla\_CLYD for years before 100AD. + \item The purpose of sla\_CALDJ is to support + sla\_EARTH, sla\_MOON and sla\_ECOR. + \item Between 1900~March~1 and 2100~February~28 it returns answers + which are consistent with the ordinary Gregorian calendar. + Outside this range there will be a discrepancy which increases + by one day for every non-leap century year. + \item When an invalid year or month is supplied (status J~=~1 or J~=~2) + the results are {\bf not} computed. When a day is + supplied which is outside the conventional range (status J~=~3) + the results {\bf are} computed. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CC2S}{Cartesian to Spherical} +{ + \action{Cartesian coordinates to spherical coordinates (single precision).} + \call{CALL sla\_CC2S (V, A, B)} +} +\args{GIVEN} +{ + \spec{V}{R(3)}{\xyz\ vector} +} +\args{RETURNED} +{ + \spec{A,B}{R}{spherical coordinates in radians} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the {\it x}-axis + at zero longitude and latitude, and the {\it z}-axis at the + +ve latitude pole. + \item If V is null, zero A and B are returned. + \item At either pole, zero A is returned. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CC62S}{Cartesian 6-Vector to Spherical} +{ + \action{Conversion of position \& velocity in Cartesian coordinates + to spherical coordinates (single precision).} + \call{CALL sla\_CC62S (V, A, B, R, AD, BD, RD)} +} +\args{GIVEN} +{ + \spec{V}{R(6)}{\xyzxyzd} +} +\args{RETURNED} +{ + \spec{A}{R}{longitude (radians) -- for example $\alpha$} \\ + \spec{B}{R}{latitude (radians) -- for example $\delta$} \\ + \spec{R}{R}{radial coordinate} \\ + \spec{AD}{R}{longitude derivative (radians per unit time)} \\ + \spec{BD}{R}{latitude derivative (radians per unit time)} \\ + \spec{RD}{R}{radial derivative} +} +%----------------------------------------------------------------------- +\routine{SLA\_CD2TF}{Days to Hour,Min,Sec} +{ + \action{Convert an interval in days to hours, minutes, seconds + (single precision).} + \call{CALL sla\_CD2TF (NDP, DAYS, SIGN, IHMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of seconds} \\ + \spec{DAYS}{R}{interval in days} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IHMSF}{I(4)}{hours, minutes, seconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size of + DAYS, the format of REAL floating-point numbers on the target + machine, and the risk of overflowing IHMSF(4). For example, + on a VAX computer, for DAYS up to 1.0, the available floating-point + precision corresponds roughly to NDP=3. This is well below + the ultimate limit of NDP=9 set by the capacity of the 32-bit + integer IHMSF(4). + \item The absolute value of DAYS may exceed 1.0. In cases where it + does not, it is up to the caller to test for and handle the + case where DAYS is very nearly 1.0 and rounds up to 24~hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +\end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CLDJ}{Calendar to MJD} +{ + \action{Gregorian Calendar to Modified Julian Date.} + \call{CALL sla\_CLDJ (IY, IM, ID, DJM, J)} +} +\args{GIVEN} +{ + \spec{IY,IM,ID}{I}{year, month, day in Gregorian calendar} +} +\args{RETURNED} +{ + \spec{DJM}{D}{modified Julian Date (JD$-$2400000.5) for $0^{\rm h}$} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = bad year} \\ + \spec{}{}{\hspace{1.5em} 2 = bad month} \\ + \spec{}{}{\hspace{1.5em} 3 = bad day} +} +\notes +{ + \begin{enumerate} + \item When an invalid year or month is supplied (status J~=~1~or~2) + the MJD is {\bf not} computed. When an invalid day is supplied + (status J~=~3) the MJD {\bf is} computed. + \item The year must be $-$4699 ({\it i.e.}\ 4700BC) or later. + For year $n$BC use IY = $-(n-1)$. + \item An alternative to the present routine is sla\_CALDJ, which + accepts a year with the century missing. + \end{enumerate} +} +\aref{The algorithm is derived from that of Hatcher, + {\it Q.\,Jl.\,R.\,astr.\,Soc.}\ (1984) {\bf 25}, 53-55.} +%----------------------------------------------------------------------- +\routine{SLA\_CLYD}{Calendar to Year, Day} +{ + \action{Gregorian calendar date to year and day in year, in a Julian + calendar aligned to the 20th/21st century Gregorian calendar.} + \call{CALL sla\_CLYD (IY, IM, ID, NY, ND, J)} +} +\args{GIVEN} +{ + \spec{IY,IM,ID}{I}{year, month, day in Gregorian calendar} +} +\args{RETURNED} +{ + \spec{NY}{I}{year (re-aligned Julian calendar)} \\ + \spec{ND}{I}{day in year (1 = January 1st)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = bad year (before $-4711$)} \\ + \spec{}{}{\hspace{1.5em} 2 = bad month} \\ + \spec{}{}{\hspace{1.5em} 3 = bad day} +} +\notes +{ + \begin{enumerate} + \item The purpose of sla\_CLYD is to support sla\_EARTH, + sla\_MOON and sla\_ECOR. + \item Between 1900~March~1 and 2100~February~28 it returns answers + which are consistent with the ordinary Gregorian calendar. + Outside this range there will be a discrepancy which increases + by one day for every non-leap century year. + \item When an invalid year or month is supplied (status J~=~1 or J~=~2) + the results are {\bf not} computed. When a day is + supplied which is outside the conventional range (status J~=~3) + the results {\bf are} computed. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CR2AF}{Radians to Deg,Arcmin,Arcsec} +{ + \action{Convert an angle in radians to degrees, arcminutes, + arcseconds (single precision).} + \call{CALL sla\_CR2AF (NDP, ANGLE, SIGN, IDMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of arcseconds} \\ + \spec{ANGLE}{R}{angle in radians} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IDMSF}{I(4)}{degrees, arcminutes, arcseconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size of + ANGLE, the format of REAL floating-point numbers on the target + machine, and the risk of overflowing IDMSF(4). For example, + on a VAX computer, for ANGLE up to $2\pi$, the available floating-point + precision corresponds roughly to NDP=3. This is well below + the ultimate limit of NDP=9 set by the capacity of the 32-bit + integer IHMSF(4). + \item The absolute value of ANGLE may exceed $2\pi$. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly $2\pi$ and rounds up to $360^{\circ}$, + by testing for IDMSF(1)=360 and setting IDMSF(1-4) to zero. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CR2TF}{Radians to Hour,Min,Sec} +{ + \action{Convert an angle in radians to hours, minutes, seconds + (single precision).} + \call{CALL sla\_CR2TF (NDP, ANGLE, SIGN, IHMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of seconds} \\ + \spec{ANGLE}{R}{angle in radians} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IHMSF}{I(4)}{hours, minutes, seconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size of + ANGLE, the format of REAL floating-point numbers on the target + machine, and the risk of overflowing IHMSF(4). For example, + on a VAX computer, for ANGLE up to $2\pi$, the available floating-point + precision corresponds roughly to NDP=3. This is well below + the ultimate limit of NDP=9 set by the capacity of the 32-bit + integer IHMSF(4). + \item The absolute value of ANGLE may exceed $2\pi$. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly $2\pi$ and rounds up to 24~hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +\end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CS2C}{Spherical to Cartesian} +{ + \action{Spherical coordinates to Cartesian coordinates (single precision).} + \call{CALL sla\_CS2C (A, B, V)} +} +\args{GIVEN} +{ + \spec{A,B}{R}{spherical coordinates in radians: \radec\ {\it etc.}} +} +\args{RETURNED} +{ + \spec{V}{R(3)}{\xyz\ unit vector} +} +\anote{The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the {\it x}-axis + at zero longitude and latitude, and the {\it z}-axis at the + +ve latitude pole.} +%----------------------------------------------------------------------- +\routine{SLA\_CS2C6}{Spherical Pos/Vel to Cartesian} +{ + \action{Conversion of position \& velocity in spherical coordinates + to Cartesian coordinates (single precision).} + \call{CALL sla\_CS2C6 (A, B, R, AD, BD, RD, V)} +} +\args{GIVEN} +{ + \spec{A}{R}{longitude (radians) -- for example $\alpha$} \\ + \spec{B}{R}{latitude (radians) -- for example $\delta$} \\ + \spec{R}{R}{radial coordinate} \\ + \spec{AD}{R}{longitude derivative (radians per unit time)} \\ + \spec{BD}{R}{latitude derivative (radians per unit time)} \\ + \spec{RD}{R}{radial derivative} +} +\args{RETURNED} +{ + \spec{V}{R(6)}{\xyzxyzd} +} +%----------------------------------------------------------------------- +\routine{SLA\_CTF2D}{Hour,Min,Sec to Days} +{ + \action{Convert hours, minutes, seconds to days (single precision).} + \call{CALL sla\_CTF2D (IHOUR, IMIN, SEC, DAYS, J)} +} +\args{GIVEN} +{ + \spec{IHOUR}{I}{hours} \\ + \spec{IMIN}{I}{minutes} \\ + \spec{SEC}{R}{seconds} +} +\args{RETURNED} +{ + \spec{DAYS}{R}{interval in days} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = IHOUR outside range 0-23} \\ + \spec{}{}{\hspace{1.5em} 2 = IMIN outside range 0-59} \\ + \spec{}{}{\hspace{1.5em} 3 = SEC outside range 0-59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CTF2R}{Hour,Min,Sec to Radians} +{ + \action{Convert hours, minutes, seconds to radians (single precision).} + \call{CALL sla\_CTF2R (IHOUR, IMIN, SEC, RAD, J)} +} +\args{GIVEN} +{ + \spec{IHOUR}{I}{hours} \\ + \spec{IMIN}{I}{minutes} \\ + \spec{SEC}{R}{seconds} +} +\args{RETURNED} +{ + \spec{RAD}{R}{angle in radians} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = IHOUR outside range 0-23} \\ + \spec{}{}{\hspace{1.5em} 2 = IMIN outside range 0-59} \\ + \spec{}{}{\hspace{1.5em} 3 = SEC outside range 0-59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DAF2R}{Deg,Arcmin,Arcsec to Radians} +{ + \action{Convert degrees, arcminutes, arcseconds to radians + (double precision).} + \call{CALL sla\_DAF2R (IDEG, IAMIN, ASEC, RAD, J)} +} +\args{GIVEN} +{ + \spec{IDEG}{I}{degrees} \\ + \spec{IAMIN}{I}{arcminutes} \\ + \spec{ASEC}{D}{arcseconds} +} +\args{RETURNED} +{ + \spec{RAD}{D}{angle in radians} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 1 = IDEG outside range 0$-$359} \\ + \spec{}{}{\hspace{1.5em} 2 = IAMIN outside range 0$-$59} \\ + \spec{}{}{\hspace{1.5em} 3 = ASEC outside range 0$-$59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DAFIN}{Sexagesimal character string to angle} +{ + \action{Decode a free-format sexagesimal string (degrees, arcminutes, + arcseconds) into a double precision floating point + number (radians).} + \call{CALL sla\_DAFIN (STRING, NSTRT, DRESLT, JF)} +} +\args{GIVEN} +{ + \spec{STRING}{C*(*)}{string containing deg, arcmin, arcsec fields} \\ + \spec{NSTRT}{I}{pointer to start of decode (beginning of STRING = 1)} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced past the decoded angle} \\ + \spec{DRESLT}{D}{angle in radians} \\ + \spec{JF}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{0.7em} $+1$ = default, DRESLT unchanged (note 2)} \\ + \spec{}{}{\hspace{0.7em} $-1$ = bad degrees (note 3)} \\ + \spec{}{}{\hspace{0.7em} $-2$ = bad arcminutes (note 3)} \\ + \spec{}{}{\hspace{0.7em} $-3$ = bad arcseconds (note 3)} \\ +} +\goodbreak +\setlength{\oldspacing}{\topsep} +\setlength{\topsep}{0.3ex} +\begin{description} + \item [EXAMPLE]: \\ [1.5ex] + \begin{tabular}{p{7em}p{15em}p{12em}} + {\it argument} & {\it before} & {\it after} \\ \\ + STRING & $'$\verb*}-57 17 44.806 12 34 56.7}$'$ & unchanged \\ + NSTRT & 1 & 16 ({\it i.e.}\ pointing to 12...) \\ + RESLT & - & $-1.00000${\tt D0} \\ + JF & - & 0 + \end{tabular} + \item A further call to sla\_DAFIN, without adjustment of NSTRT, will + decode the second angle, \dms{12}{34}{56}{7}. +\end{description} +\setlength{\topsep}{\oldspacing} +\notes +{ + \begin{enumerate} + \item The first three ``fields'' in STRING are degrees, arcminutes, + arcseconds, separated by spaces or commas. The degrees field + may be signed, but not the others. The decoding is carried + out by the sla\_DFLTIN routine and is free-format. + \item Successive fields may be absent, defaulting to zero. For + zero status, the only combinations allowed are degrees alone, + degrees and arcminutes, and all three fields present. If all + three fields are omitted, a status of +1 is returned and DRESLT is + unchanged. In all other cases DRESLT is changed. + \item Range checking: + \begin{itemize} + \item The degrees field is not range checked. However, it is + expected to be integral unless the other two fields are absent. + \item The arcminutes field is expected to be 0-59, and integral if + the arcseconds field is present. If the arcseconds field + is absent, the arcminutes is expected to be 0-59.9999... + \item The arcseconds field is expected to be 0-59.9999... + \item Decoding continues even when a check has failed. Under these + circumstances the field takes the supplied value, defaulting to + zero, and the result DRESLT is computed and returned. + \end{itemize} + \item Further fields after the three expected ones are not treated as + an error. The pointer NSTRT is left in the correct state for + further decoding with the present routine or with sla\_DFLTIN + {\it etc}. See the example, above. + \item If STRING contains hours, minutes, seconds instead of + degrees {\it etc}, + or if the required units are turns (or days) instead of radians, + the result DRESLT should be multiplied as follows: \\ [1.5ex] + \begin{tabular}{p{6em}p{5em}p{18em}} + {\it for STRING} & {\it to obtain} & {\it multiply DRESLT by} \\ \\ + ${\circ}$~~\raisebox{-0.7ex}{$'$}~~\raisebox{-0.7ex}{$''$} + & radians & $1.0${\tt D0} \\ + ${\circ}$~~\raisebox{-0.7ex}{$'$}~~\raisebox{-0.7ex}{$''$} + & turns & $1/{2 \pi} = 0.1591549430918953358${\tt D0} \\ + h m s & radians & $15.0${\tt D0} \\ + h m s & days & $15/{2\pi} = 2.3873241463784300365${\tt D0} + \end{tabular} + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_DAT}{TAI$-$UTC} +{ + \action{Increment to be applied to Coordinated Universal Time UTC to give + International Atomic Time TAI.} + \call{D~=~sla\_DAT (UTC)} +} +\args{GIVEN} +{ + \spec{UTC}{D}{UTC date as a modified JD (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_DAT}{D}{TAI$-$UTC in seconds} +} +\notes +{ + \begin{enumerate} + \item The UTC is specified to be a date rather than a time to indicate + that care needs to be taken not to specify an instant which lies + within a leap second. Though in most cases UTC can include the + fractional part, correct behaviour on the day of a leap second + can be guaranteed only up to the end of the second + $23^{\rm h}\,59^{\rm m}\,59^{\rm s}$. + \item UTC began at 1960 January 1. To specify a UTC prior to this + date would be meaningless; in such cases the parameters + for the year 1960 are used by default. + \item This routine has to be updated on each occasion that a + leap second is announced, and programs using it relinked. + Refer to the program source code for information on when the + most recent leap second was added. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DAV2M}{Rotation Matrix from Axial Vector} +{ + \action{Form the rotation matrix corresponding to a given axial vector + (double precision).} + \call{CALL sla\_DAV2M (AXVEC, RMAT)} +} +\args{GIVEN} +{ + \spec{AXVEC}{D(3)}{axial vector (radians)} +} +\args{RETURNED} +{ + \spec{RMAT}{D(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item A rotation matrix describes a rotation about some arbitrary axis. + The axis is called the {\it Euler axis}, and the angle through which the + reference frame rotates is called the {\it Euler angle}. The axial + vector supplied to this routine has the same direction as the + Euler axis, and its magnitude is the Euler angle in radians. + \item If AXVEC is null, the unit matrix is returned. + \item The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DBEAR}{Direction Between Points on a Sphere} +{ + \action{Returns the bearing (position angle) of one point on a + sphere relative to another (double precision).} + \call{D~=~sla\_DBEAR (A1, B1, A2, B2)} +} +\args{GIVEN} +{ + \spec{A1,B1}{D}{spherical coordinates of one point} \\ + \spec{A2,B2}{D}{spherical coordinates of the other point} +} +\args{RETURNED} +{ + \spec{sla\_DBEAR}{D}{bearing from first point to second} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are \radec, + $[\lambda,\phi]$ {\it etc.}, in radians. + \item The result is the bearing (position angle), in radians, + of point [A2,B2] as seen + from point [A1,B1]. It is in the range $\pm \pi$. The sense + is such that if [A2,B2] + is a small distance due east of [A1,B1] the result + is about $+\pi/2$. Zero is returned + if the two points are coincident. + \item If either B-coordinate is outside the range $\pm\pi/2$, the + result may correspond to ``the long way round''. + \item The routine sla\_DPAV performs an equivalent function except + that the points are specified in the form of Cartesian unit + vectors. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DBJIN}{Decode String to B/J Epoch (DP)} +{ + \action{Decode a character string into a DOUBLE PRECISION number, + with special provision for Besselian and Julian epochs. + The string syntax is as for sla\_DFLTIN, prefixed by + an optional `B' or `J'.} + \call{CALL sla\_DBJIN (STRING, NSTRT, DRESLT, J1, J2)} +} +\args{GIVEN} +{ + \spec{STRING}{C}{string containing field to be decoded} \\ + \spec{NSTRT}{I}{pointer to first character of field in string} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{incremented past the decoded field} \\ + \spec{DRESLT}{D}{result} \\ + \spec{J1}{I}{DFLTIN status:} \\ + \spec{}{}{\hspace{0.7em} $-$1 = $-$OK} \\ + \spec{}{}{\hspace{1.5em} 0 = +OK} \\ + \spec{}{}{\hspace{1.5em} 1 = null field} \\ + \spec{}{}{\hspace{1.5em} 2 = error} \\ + \spec{J2}{I}{syntax flag:} \\ + \spec{}{}{\hspace{1.5em} 0 = normal DFLTIN syntax} \\ + \spec{}{}{\hspace{1.5em} 1 = `B' or `b'} \\ + \spec{}{}{\hspace{1.5em} 2 = `J' or `j'} +} +\notes +{ + \begin{enumerate} + \item The purpose of the syntax extensions is to help cope with mixed + FK4 and FK5 data, allowing fields such as `B1950' or `J2000' + to be decoded. + \item In addition to the syntax accepted by sla\_DFLTIN, + the following two extensions are recognized by sla\_DBJIN: + \begin{enumerate} + \item A valid non-null field preceded by the character `B' + (or `b') is accepted. + \item A valid non-null field preceded by the character `J' + (or `j') is accepted. + \end{enumerate} + \item The calling program is told of the `B' or `J' through an + supplementary status argument. The rest of + the arguments are as for sla\_DFLTIN. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DC62S}{Cartesian 6-Vector to Spherical} +{ + \action{Conversion of position \& velocity in Cartesian coordinates + to spherical coordinates (double precision).} + \call{CALL sla\_DC62S (V, A, B, R, AD, BD, RD)} +} +\args{GIVEN} +{ + \spec{V}{D(6)}{\xyzxyzd} +} +\args{RETURNED} +{ + \spec{A}{D}{longitude (radians)} \\ + \spec{B}{D}{latitude (radians)} \\ + \spec{R}{D}{radial coordinate} \\ + \spec{AD}{D}{longitude derivative (radians per unit time)} \\ + \spec{BD}{D}{latitude derivative (radians per unit time)} \\ + \spec{RD}{D}{radial derivative} +} +%----------------------------------------------------------------------- +\routine{SLA\_DCC2S}{Cartesian to Spherical} +{ + \action{Cartesian coordinates to spherical coordinates (double precision).} + \call{CALL sla\_DCC2S (V, A, B)} +} +\args{GIVEN} +{ + \spec{V}{D(3)}{\xyz\ vector} +} +\args{RETURNED} +{ + \spec{A,B}{D}{spherical coordinates in radians} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the {\it x}-axis + at zero longitude and latitude, and the {\it z}-axis at the + +ve latitude pole. + \item If V is null, zero A and B are returned. + \item At either pole, zero A is returned. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DCMPF}{Interpret Linear Fit} +{ + \action{Decompose an \xy\ linear fit into its constituent parameters: + zero points, scales, nonperpendicularity and orientation.} + \call{CALL sla\_DCMPF (COEFFS,XZ,YZ,XS,YS,PERP,ORIENT)} +} +\args{GIVEN} +{ + \spec{COEFFS}{D(6)}{transformation coefficients (see note)} +} +\args{RETURNED} +{ + \spec{XZ}{D}{{\it x} zero point} \\ + \spec{YZ}{D}{{\it y} zero point} \\ + \spec{XS}{D}{{\it x} scale} \\ + \spec{YS}{D}{{\it y} scale} \\ + \spec{PERP}{D}{nonperpendicularity (radians)} \\ + \spec{ORIENT}{D}{orientation (radians)} +} +\notes +{ + \begin{enumerate} + \item The model relates two sets of \xy\ coordinates as follows. + Naming the six elements of COEFFS $a,b,c,d,e$ \& $f$, + the model transforms coordinates $[x_{1},y_{1}\,]$ into coordinates + $[x_{2},y_{2}\,]$ as follows: + \begin{verse} + $x_{2} = a + bx_{1} + cy_{1}$ \\ + $y_{2} = d + ex_{1} + fy_{1}$ + \end{verse} + The sla\_DCMPF routine decomposes this transformation + into four steps: + \begin{enumerate} + \item Zero points: + \begin{verse} + $x' = x_{1} + {\rm XZ}$ \\ + $y' = y_{1} + {\rm YZ}$ + \end{verse} + \item Scales: + \begin{verse} + $x'' = x' {\rm XS}$ \\ + $y'' = y' {\rm YS}$ + \end{verse} + \item Nonperpendicularity: + \begin{verse} + $x''' = + x'' \cos {\rm PERP}/2 + y'' \sin {\rm PERP}/2$ \\ + $y''' = + x'' \sin {\rm PERP}/2 + y'' \cos {\rm PERP}/2$ + \end{verse} + \item Orientation: + \begin{verse} + $x_{2} = + x''' \cos {\rm ORIENT} + + y''' \sin {\rm ORIENT}$ \\ + $y_{2} = - x''' \sin {\rm ORIENT} + + y''' \cos {\rm ORIENT}$ + \end{verse} + \end{enumerate} + \item See also sla\_FITXY, sla\_PXY, sla\_INVF, sla\_XY2XY. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DCS2C}{Spherical to Cartesian} +{ + \action{Spherical coordinates to Cartesian coordinates (double precision).} + \call{CALL sla\_DCS2C (A, B, V)} +} +\args{GIVEN} +{ + \spec{A,B}{D}{spherical coordinates in radians: \radec\ {\it etc.}} +} +\args{RETURNED} +{ + \spec{V}{D(3)}{\xyz\ unit vector} +} +\anote{The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the {\it x}-axis + at zero longitude and latitude, and the {\it z}-axis at the + +ve latitude pole.} +%----------------------------------------------------------------------- +\routine{SLA\_DD2TF}{Days to Hour,Min,Sec} +{ + \action{Convert an interval in days into hours, minutes, seconds + (double precision).} + \call{CALL sla\_DD2TF (NDP, DAYS, SIGN, IHMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of seconds} \\ + \spec{DAYS}{D}{interval in days} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IHMSF}{I(4)}{hours, minutes, seconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size + of DAYS, the format of DOUBLE PRECISION floating-point numbers + on the target machine, and the risk of overflowing IHMSF(4). + For example, on a VAX computer, for DAYS up to 1D0, the available + floating-point precision corresponds roughly to NDP=12. However, + the practical limit is NDP=9, set by the capacity of the 32-bit + integer IHMSF(4). + \item The absolute value of DAYS may exceed 1D0. In cases where it + does not, it is up to the caller to test for and handle the + case where DAYS is very nearly 1D0 and rounds up to 24~hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +\end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DE2H}{$h,\delta$ to Az,El} +{ + \action{Equatorial to horizon coordinates + (double precision).} + \call{CALL sla\_DE2H (HA, DEC, PHI, AZ, EL)} +} +\args{GIVEN} +{ + \spec{HA}{D}{hour angle (radians)} \\ + \spec{DEC}{D}{declination (radians)} \\ + \spec{PHI}{D}{latitude (radians)} +} +\args{RETURNED} +{ + \spec{AZ}{D}{azimuth (radians)} \\ + \spec{EL}{D}{elevation (radians)} +} +\notes +{ + \begin{enumerate} + \item Azimuth is returned in the range $0\!-\!2\pi$; north is zero, + and east is $+\pi/2$. Elevation is returned in the range + $\pm\pi$. + \item The latitude must be geodetic. In critical applications, + corrections for polar motion should be applied. + \item In some applications it will be important to specify the + correct type of hour angle and declination in order to + produce the required type of azimuth and elevation. In + particular, it may be important to distinguish between + elevation as affected by refraction, which would + require the {\it observed} \hadec, and the elevation + {\it in vacuo}, which would require the {\it topocentric} + \hadec. + If the effects of diurnal aberration can be neglected, the + {\it apparent} \hadec\ may be used instead of the topocentric + \hadec. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and (for tracking a star) + sine and cosine of declination. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DEULER}{Euler Angles to Rotation Matrix} +{ + \action{Form a rotation matrix from the Euler angles -- three + successive rotations about specified Cartesian axes + (double precision).} + \call{CALL sla\_DEULER (ORDER, PHI, THETA, PSI, RMAT)} +} +\args{GIVEN} +{ + \spec{ORDER}{C}{specifies about which axes the rotations occur} \\ + \spec{PHI}{D}{1st rotation (radians)} \\ + \spec{THETA}{D}{2nd rotation (radians)} \\ + \spec{PSI}{D}{3rd rotation (radians)} +} +\args{RETURNED} +{ + \spec{RMAT}{D(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item A rotation is positive when the reference frame rotates + anticlockwise as seen looking towards the origin from the + positive region of the specified axis. + \item The characters of ORDER define which axes the three successive + rotations are about. A typical value is `ZXZ', indicating that + RMAT is to become the direction cosine matrix corresponding to + rotations of the reference frame through PHI radians about the + old {\it z}-axis, followed by THETA radians about the resulting + {\it x}-axis, + then PSI radians about the resulting {\it z}-axis. + \item The axis names can be any of the following, in any order or + combination: X, Y, Z, uppercase or lowercase, 1, 2, 3. Normal + axis labelling/numbering conventions apply; the {\it xyz} ($\equiv123$) + triad is right-handed. Thus, the `ZXZ' example given above + could be written `zxz' or `313' (or even `ZxZ' or `3xZ'). ORDER + is terminated by length or by the first unrecognized character. + Fewer than three rotations are acceptable, in which case the later + angle arguments are ignored. Zero rotations produces a unit RMAT. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DFLTIN}{Decode a Double Precision Number} +{ + \action{Convert free-format input into double precision floating point.} + \call{CALL sla\_DFLTIN (STRING, NSTRT, DRESLT, JFLAG)} +} +\args{GIVEN} +{ + \spec{STRING}{C}{string containing number to be decoded} \\ + \spec{NSTRT}{I}{pointer to where decoding is to commence} \\ + \spec{DRESLT}{D}{current value of result} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced to next number} \\ + \spec{DRESLT}{D}{result} \\ + \spec{JFLAG}{I}{status: $-$1~=~$-$OK, 0~=~+OK, 1~=~null result, 2~=~error} +} +\notes +{ + \begin{enumerate} + \item The reason sla\_DFLTIN has separate `OK' status values + for + and $-$ is to enable minus zero to be detected. + This is of crucial importance + when decoding mixed-radix numbers. For example, an angle + expressed as degrees, arcminutes and arcseconds may have a + leading minus sign but a zero degrees field. + \item A TAB is interpreted as a space, and lowercase characters are + interpreted as uppercase. {\it n.b.}\ The test for TAB is + ASCII-specific. + \item The basic format is the sequence of fields $\pm n.n x \pm n$, + where $\pm$ is a sign + character `+' or `$-$', $n$ means a string of decimal digits, + `.' is a decimal point, and $x$, which indicates an exponent, + means `D' or `E'. Various combinations of these fields can be + omitted, and embedded blanks are permissible in certain places. + \item Spaces: + \begin{itemize} + \item Leading spaces are ignored. + \item Embedded spaces are allowed only after +, $-$, D or E, + and after the decimal point if the first sequence of + digits is absent. + \item Trailing spaces are ignored; the first signifies + end of decoding and subsequent ones are skipped. + \end{itemize} + \item Delimiters: + \begin{itemize} + \item Any character other than +,$-$,0-9,.,D,E or space may be + used to signal the end of the number and terminate decoding. + \item Comma is recognized by sla\_DFLTIN as a special case; it + is skipped, leaving the pointer on the next character. See + 13, below. + \item Decoding will in all cases terminate if end of string + is reached. + \end{itemize} + \item Both signs are optional. The default is +. + \item The mantissa $n.n$ defaults to unity. + \item The exponent $x\!\pm\!n$ defaults to `D0'. + \item The strings of decimal digits may be of any length. + \item The decimal point is optional for whole numbers. + \item A {\it null result}\/ occurs when the string of characters + being decoded does not begin with +,$-$,0-9,.,D or E, or + consists entirely of spaces. When this condition is + detected, JFLAG is set to 1 and DRESLT is left untouched. + \item NSTRT = 1 for the first character in the string. + \item On return from sla\_DFLTIN, NSTRT is set ready for the next + decode -- following trailing blanks and any comma. If a + delimiter other than comma is being used, NSTRT must be + incremented before the next call to sla\_DFLTIN, otherwise + all subsequent calls will return a null result. + \item Errors (JFLAG=2) occur when: + \begin{itemize} + \item a +, $-$, D or E is left unsatisfied; or + \item the decimal point is present without at least + one decimal digit before or after it; or + \item an exponent more than 100 has been presented. + \end{itemize} + \item When an error has been detected, NSTRT is left + pointing to the character following the last + one used before the error came to light. This + may be after the point at which a more sophisticated + program could have detected the error. For example, + sla\_DFLTIN does not detect that `1D999' is unacceptable + (on a computer where this is so) until the entire number + has been decoded. + \item Certain highly unlikely combinations of mantissa and + exponent can cause arithmetic faults during the + decode, in some cases despite the fact that they + together could be construed as a valid number. + \item Decoding is left to right, one pass. + \item See also sla\_FLOTIN and sla\_INTIN. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DH2E}{Az,El to $h,\delta$} +{ + \action{Horizon to equatorial coordinates + (double precision).} + \call{CALL sla\_DH2E (AZ, EL, PHI, HA, DEC)} +} +\args{GIVEN} +{ + \spec{AZ}{D}{azimuth (radians)} \\ + \spec{EL}{D}{elevation (radians)} \\ + \spec{PHI}{D}{latitude (radians)} +} +\args{RETURNED} +{ + \spec{HA}{D}{hour angle (radians)} \\ + \spec{DEC}{D}{declination (radians)} +} +\notes +{ + \begin{enumerate} + \item The sign convention for azimuth is north zero, east $+\pi/2$. + \item HA is returned in the range $\pm\pi$. Declination is returned + in the range $\pm\pi$. + \item The latitude is (in principle) geodetic. In critical + applications, corrections for polar motion should be applied + (see sla\_POLMO). + \item In some applications it will be important to specify the + correct type of elevation in order to produce the required + type of \hadec. In particular, it may be important to + distinguish between the elevation as affected by refraction, + which will yield the {\it observed} \hadec, and the elevation + {\it in vacuo}, which will yield the {\it topocentric} + \hadec. If the + effects of diurnal aberration can be neglected, the + topocentric \hadec\ may be used as an approximation to the + {\it apparent} \hadec. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DIMXV}{Apply 3D Reverse Rotation} +{ + \action{Multiply a 3-vector by the inverse of a rotation + matrix (double precision).} + \call{CALL sla\_DIMXV (DM, VA, VB)} +} +\args{GIVEN} +{ + \spec{DM}{D(3,3)}{rotation matrix} \\ + \spec{VA}{D(3)}{vector to be rotated} +} +\args{RETURNED} +{ + \spec{VB}{D(3)}{result vector} +} +\notes +{ + \begin{enumerate} + \item This routine performs the operation: + \begin{verse} + {\bf b} = {\bf M}$^{T}\cdot${\bf a} + \end{verse} + where {\bf a} and {\bf b} are the 3-vectors VA and VB + respectively, and {\bf M} is the $3\times3$ matrix DM. + \item The main function of this routine is apply an inverse + rotation; under these circumstances, ${\bf \rm M}$ is + {\it orthogonal}, with its inverse the same as its transpose. + \item To comply with the ANSI Fortran 77 standard, VA and VB must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly on the VAX and many other systems even + if this rule is violated, something that is {\bf not}, however, + recommended. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DJCAL}{MJD to Gregorian for Output} +{ + \action{Modified Julian Date to Gregorian Calendar Date, expressed + in a form convenient for formatting messages (namely + rounded to a specified precision, and with the fields + stored in a single array).} + \call{CALL sla\_DJCAL (NDP, DJM, IYMDF, J)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of days in fraction} \\ + \spec{DJM}{D}{modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{IYMDF}{I(4)}{year, month, day, fraction in Gregorian calendar} \\ + \spec{J}{I}{status: nonzero = out of range} +} +\notes +{ + \begin{enumerate} + \item Any date after 4701BC March 1 is accepted. + \item NDP should be 4 or less to avoid overflow on machines which + use 32-bit integers. + \end{enumerate} +} +\aref{The algorithm is derived from that of Hatcher, + {\it Q.\,Jl.\,R.\,astr.\,Soc.}\ (1984) {\bf 25}, 53-55.} +%----------------------------------------------------------------------- +\routine{SLA\_DJCL}{MJD to Year,Month,Day,Frac} +{ + \action{Modified Julian Date to Gregorian year, month, day, + and fraction of a day.} + \call{CALL sla\_DJCL (DJM, IY, IM, ID, FD, J)} +} +\args{GIVEN} +{ + \spec{DJM}{D}{modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{IY}{I}{year} \\ + \spec{IM}{I}{month} \\ + \spec{ID}{I}{day} \\ + \spec{FD}{D}{fraction of day} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{0.7em} $-$1 = unacceptable date (before 4701BC March 1)} +} +\aref{The algorithm is derived from that of Hatcher, + {\it Q.\,Jl.\,R.\,astr.\,Soc.}\ (1984) {\bf 25}, 53-55.} +%----------------------------------------------------------------------- +\routine{SLA\_DM2AV}{Rotation Matrix to Axial Vector} +{ + \action{From a rotation matrix, determine the corresponding axial vector + (double precision).} + \call{CALL sla\_DM2AV (RMAT, AXVEC)} +} +\args{GIVEN} +{ + \spec{RMAT}{D(3,3)}{rotation matrix} +} +\args{RETURNED} +{ + \spec{AXVEC}{D(3)}{axial vector (radians)} +} +\notes +{ + \begin{enumerate} + \item A rotation matrix describes a rotation about some arbitrary axis. + The axis is called the {\it Euler axis}, and the angle through + which the reference frame rotates is called the {\it Euler angle}. + The {\it axial vector}\/ returned by this routine has the same + direction as the Euler axis, and its magnitude is the Euler angle + in radians. + \item The magnitude and direction of the axial vector can be separated + by means of the routine sla\_DVN. + \item The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + \item If RMAT is null, so is the result. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DMAT}{Solve Simultaneous Equations} +{ + \action{Matrix inversion and solution of simultaneous equations + (double precision).} + \call{CALL sla\_DMAT (N, A, Y, D, JF, IW)} +} +\args{GIVEN} +{ + \spec{N}{I}{number of unknowns} \\ + \spec{A}{D(N,N)}{matrix} \\ + \spec{Y}{D(N)}{vector} +} +\args{RETURNED} +{ + \spec{A}{D(N,N)}{matrix inverse} \\ + \spec{Y}{D(N)}{solution} \\ + \spec{D}{D}{determinant} \\ + \spec{JF}{I}{singularity flag: 0=OK} \\ + \spec{IW}{I(N)}{workspace} +} +\notes +{ + \begin{enumerate} + \item For the set of $n$ simultaneous linear equations in $n$ unknowns: + \begin{verse} + {\bf A}$\cdot${\bf y} = {\bf x} + \end{verse} + where: + \begin{itemize} + \item {\bf A} is a non-singular $n \times n$ matrix, + \item {\bf y} is the vector of $n$ unknowns, and + \item {\bf x} is the known vector, + \end{itemize} + sla\_DMAT computes: + \begin{itemize} + \item the inverse of matrix {\bf A}, + \item the determinant of matrix {\bf A}, and + \item the vector of $n$ unknowns {\bf y}. + \end{itemize} + Argument N is the order $n$, A (given) is the matrix {\bf A}, + Y (given) is the vector {\bf x} and Y (returned) + is the vector {\bf y}. + The argument A (returned) is the inverse matrix {\bf A}$^{-1}$, + and D is {\it det}\/({\bf A}). + \item JF is the singularity flag. If the matrix is non-singular, + JF=0 is returned. If the matrix is singular, JF=$-$1 + and D=0D0 are returned. In the latter case, the contents + of array A on return are undefined. + \item The algorithm is Gaussian elimination with partial pivoting. + This method is very fast; some much slower algorithms can give + better accuracy, but only by a small factor. + \item This routine replaces the obsolete sla\_DMATRX. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DMOON}{Approx Moon Pos/Vel} +{ + \action{Approximate geocentric position and velocity of the Moon + (double precision).} + \call{CALL sla\_DMOON (DATE, PV)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (loosely ET) as a Modified Julian Date (JD$-$2400000.5) +} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{Moon \xyzxyzd, mean equator and equinox + of date (AU, AU~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item This routine is a full implementation of the algorithm + published by Meeus (see reference). + \item Meeus quotes accuracies of \arcseci{10} in longitude, + \arcseci{3} in latitude and \arcsec{0}{2} arcsec in HP + (equivalent to about 20~km in distance). Comparison with + JPL~DE200 over the interval 1960-2025 gives RMS errors of + \arcsec{3}{7} and 83~mas/hour in longitude, + \arcsec{2}{3} arcsec and 48~mas/hour in latitude, + 11~km and 81~mm/s in distance. + The maximum errors over the same interval are + \arcseci{18} and \arcsec{0}{50}/hour in longitude, + \arcseci{11} and \arcsec{0}{24}/hour in latitude, + 40~km and 0.29~m/s in distance. + \item The original algorithm is expressed in terms of the obsolete + timescale {\it Ephemeris Time}. Either TDB or TT can be used, + but not UT without incurring significant errors (\arcseci{30} at + the present time) due to the Moon's \arcsec{0}{5}/s movement. + \item The algorithm is based on pre IAU 1976 standards. However, + the result has been moved onto the new (FK5) equinox, an + adjustment which is in any case much smaller than the + intrinsic accuracy of the procedure. + \item Velocity is obtained by a complete analytical differentiation + of the Meeus model. + \end{enumerate} +} +\aref{Meeus, {\it l'Astronomie}, June 1984, p348.} +%----------------------------------------------------------------------- +\routine{SLA\_DMXM}{Multiply $3\times3$ Matrices} +{ + \action{Product of two $3\times3$ matrices (double precision).} + \call{CALL sla\_DMXM (A, B, C)} +} +\args{GIVEN} +{ + \spec{A}{D(3,3)}{matrix {\bf A}} \\ + \spec{B}{D(3,3)}{matrix {\bf B}} +} +\args{RETURNED} +{ + \spec{C}{D(3,3)}{matrix result: {\bf A}$\times${\bf B}} +} +\anote{To comply with the ANSI Fortran 77 standard, A, B and C must + be different arrays. The routine is, in fact, coded + so as to work properly on the VAX and many other systems even + if this rule is violated, something that is {\bf not}, however, + recommended.} +%----------------------------------------------------------------------- +\routine{SLA\_DMXV}{Apply 3D Rotation} +{ + \action{Multiply a 3-vector by a rotation matrix (double precision).} + \call{CALL sla\_DMXV (DM, VA, VB)} +} +\args{GIVEN} +{ + \spec{DM}{D(3,3)}{rotation matrix} \\ + \spec{VA}{D(3)}{vector to be rotated} +} +\args{RETURNED} +{ + \spec{VB}{D(3)}{result vector} +} +\notes +{ + \begin{enumerate} + \item This routine performs the operation: + \begin{verse} + {\bf b} = {\bf M}$\cdot${\bf a} + \end{verse} + where {\bf a} and {\bf b} are the 3-vectors VA and VB + respectively, and {\bf M} is the $3\times3$ matrix DM. + \item The main function of this routine is apply a + rotation; under these circumstances, {\bf M} is a + {\it proper real orthogonal}\/ matrix. + \item To comply with the ANSI Fortran 77 standard, VA and VB must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly on the VAX and many other systems even + if this rule is violated, something that is {\bf not}, however, + recommended. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DPAV}{Position-Angle Between Two Directions} +{ + \action{Returns the bearing (position angle) of one celestial + direction with respect to another (double precision).} + \call{D~=~sla\_DPAV (V1, V2)} +} +\args{GIVEN} +{ + \spec{V1}{D(3)}{direction cosines of one point} \\ + \spec{V2}{D(3)}{directions cosines of the other point} +} +\args{RETURNED} +{ + \spec{sla\_DPAV}{D}{position-angle of 2nd point with respect to 1st} +} +\notes +{ + \begin{enumerate} + \item The coordinate frames correspond to \radec, + $[\lambda,\phi]$ {\it etc.}. + \item The result is the bearing (position angle), in radians, + of point V2 as seen + from point V1. It is in the range $\pm \pi$. The sense + is such that if V2 + is a small distance due east of V1 the result + is about $+\pi/2$. Zero is returned + if the two points are coincident. + \item The routine sla\_DBEAR performs an equivalent function except + that the points are specified in the form of spherical coordinates. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_DR2AF}{Radians to Deg,Min,Sec,Frac} +{ + \action{Convert an angle in radians to degrees, arcminutes, arcseconds, + fraction (double precision).} + \call{CALL sla\_DR2AF (NDP, ANGLE, SIGN, IDMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of arcseconds} \\ + \spec{ANGLE}{D}{angle in radians} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IDMSF}{I(4)}{degrees, arcminutes, arcseconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size + of ANGLE, the format of DOUBLE~PRECISION floating-point numbers + on the target machine, and the risk of overflowing IDMSF(4). + For example, on a VAX computer, for ANGLE up to $2\pi$, the available + floating-point precision corresponds roughly to NDP=12. However, + the practical limit is NDP=9, set by the capacity of the 32-bit + integer IDMSF(4). + \item The absolute value of ANGLE may exceed $2\pi$. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly $2\pi$ and rounds up to $360^{\circ}$, + by testing for IDMSF(1)=360 and setting IDMSF(1-4) to zero. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DR2TF}{Radians to Hour,Min,Sec,Frac} +{ + \action{Convert an angle in radians to hours, minutes, seconds, + fraction (double precision).} + \call{CALL sla\_DR2TF (NDP, ANGLE, SIGN, IHMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of seconds} \\ + \spec{ANGLE}{D}{angle in radians} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IHMSF}{I(4)}{hours, minutes, seconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size + of ANGLE, the format of DOUBLE PRECISION floating-point numbers + on the target machine, and the risk of overflowing IHMSF(4). + For example, on a VAX computer, for ANGLE up to $2\pi$, the available + floating-point precision corresponds roughly to NDP=12. However, + the practical limit is NDP=9, set by the capacity of the 32-bit + integer IHMSF(4). + \item The absolute value of ANGLE may exceed $2\pi$. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly $2\pi$ and rounds up to 24~hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DRANGE}{Put Angle into Range $\pm\pi$} +{ + \action{Normalize an angle into the range $\pm\pi$ (double precision).} + \call{D~=~sla\_DRANGE (ANGLE)} +} +\args{GIVEN} +{ + \spec{ANGLE}{D}{angle in radians} +} +\args{RETURNED} +{ + \spec{sla\_DRANGE}{D}{ANGLE expressed in the range $\pm\pi$.} +} +%----------------------------------------------------------------------- +\routine{SLA\_DRANRM}{Put Angle into Range $0\!-\!2\pi$} +{ + \action{Normalize an angle into the range $0\!-\!2\pi$ + (double precision).} + \call{D~=~sla\_DRANRM (ANGLE)} +} +\args{GIVEN} +{ + \spec{ANGLE}{D}{angle in radians} +} +\args{RETURNED} +{ + \spec{sla\_DRANRM}{D}{ANGLE expressed in the range $0\!-\!2\pi$} +} +%----------------------------------------------------------------------- +\routine{SLA\_DS2C6}{Spherical Pos/Vel to Cartesian} +{ + \action{Conversion of position \& velocity in spherical coordinates + to Cartesian coordinates (double precision).} + \call{CALL sla\_DS2C6 (A, B, R, AD, BD, RD, V)} +} +\args{GIVEN} +{ + \spec{A}{D}{longitude (radians) -- for example $\alpha$} \\ + \spec{B}{D}{latitude (radians) -- for example $\delta$} \\ + \spec{R}{D}{radial coordinate} \\ + \spec{AD}{D}{longitude derivative (radians per unit time)} \\ + \spec{BD}{D}{latitude derivative (radians per unit time)} \\ + \spec{RD}{D}{radial derivative} +} +\args{RETURNED} +{ + \spec{V}{D(6)}{\xyzxyzd} +} +%----------------------------------------------------------------------- +\routine{SLA\_DS2TP}{Spherical to Tangent Plane} +{ + \action{Projection of spherical coordinates onto the tangent plane + (double precision).} + \call{CALL sla\_DS2TP (RA, DEC, RAZ, DECZ, XI, ETA, J)} +} +\args{GIVEN} +{ + \spec{RA,DEC}{D}{spherical coordinates of star (radians)} \\ + \spec{RAZ,DECZ}{D}{spherical coordinates of tangent point (radians)} +} +\args{RETURNED} +{ + \spec{XI,ETA}{D}{tangent plane coordinates (radians)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK, star on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 1 = error, star too far from axis} \\ + \spec{}{}{\hspace{1.5em} 2 = error, antistar on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 3 = error, antistar too far from axis} +} +\notes +{ + \begin{enumerate} + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_DV2TP is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DSEP}{Angle Between 2 Points on Sphere} +{ + \action{Angle between two points on a sphere (double precision).} + \call{D~=~sla\_DSEP (A1, B1, A2, B2)} +} +\args{GIVEN} +{ + \spec{A1,B1}{D}{spherical coordinates of one point (radians)} \\ + \spec{A2,B2}{D}{spherical coordinates of the other point (radians)} +} +\args{RETURNED} +{ + \spec{sla\_DSEP}{D}{angle between [A1,B1] and [A2,B2] in radians} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are right ascension and declination, + longitude and latitude, {\it etc.}, in radians. + \item The result is always positive. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DT}{Approximate ET minus UT} +{ + \action{Estimate $\Delta$T, the offset between dynamical time + and Universal Time, for a given historical epoch.} + \call{D~=~sla\_DT (EPOCH)} +} +\args{GIVEN} +{ + \spec{EPOCH}{D}{(Julian) epoch ({\it e.g.}\ 1850D0)} +} +\args{RETURNED} +{ + \spec{sla\_DT}{D}{approximate ET$-$UT (after 1984, TT$-$UT1) in seconds} +} +\notes +{ + \begin{enumerate} + \item Depending on the epoch, one of three parabolic approximations + is used: +\begin{tabbing} +xx \= xxxxxxxxxxxxxxxxxx \= \kill +\> before AD 979 \> Stephenson \& Morrison's 390 BC to AD 948 model \\ +\> AD 979 to AD 1708 \> Stephenson \& Morrison's AD 948 to AD 1600 model \\ +\> after AD 1708 \> McCarthy \& Babcock's post-1650 model +\end{tabbing} + The breakpoints are chosen to ensure continuity: they occur + at places where the adjacent models give the same answer as + each other. + \item The accuracy is modest, with errors of up to $20^{\rm s}$ during + the interval since 1650, rising to perhaps $30^{\rm m}$ + by 1000~BC. Comparatively accurate values from AD~1600 + are tabulated in + the {\it Astronomical Almanac}\/ (see section K8 of the 1995 + edition). + \item The use of {\tt DOUBLE PRECISION} for both argument and result is + simply for compatibility with other SLALIB time routines. + \item The models used are based on a lunar tidal acceleration value + of \arcsec{-26}{00} per century. + \end{enumerate} +} +\aref{Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7. + This contains references to the papers by Stephenson \& Morrison + and by McCarthy \& Babcock which describe the models used here.} +%----------------------------------------------------------------------- +\routine{SLA\_DTF2D}{Hour,Min,Sec to Days} +{ + \action{Convert hours, minutes, seconds to days (double precision).} + \call{CALL sla\_DTF2D (IHOUR, IMIN, SEC, DAYS, J)} +} +\args{GIVEN} +{ + \spec{IHOUR}{I}{hours} \\ + \spec{IMIN}{I}{minutes} \\ + \spec{SEC}{D}{seconds} +} +\args{RETURNED} +{ + \spec{DAYS}{D}{interval in days} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = IHOUR outside range 0-23} \\ + \spec{}{}{\hspace{1.5em} 2 = IMIN outside range 0-59} \\ + \spec{}{}{\hspace{1.5em} 3 = SEC outside range 0-59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTF2R}{Hour,Min,Sec to Radians} +{ + \action{Convert hours, minutes, seconds to radians (double precision).} + \call{CALL sla\_DTF2R (IHOUR, IMIN, SEC, RAD, J)} +} +\args{GIVEN} +{ + \spec{IHOUR}{I}{hours} \\ + \spec{IMIN}{I}{minutes} \\ + \spec{SEC}{D}{seconds} +} +\args{RETURNED} +{ + \spec{RAD}{D}{angle in radians} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = IHOUR outside range 0-23} \\ + \spec{}{}{\hspace{1.5em} 2 = IMIN outside range 0-59} \\ + \spec{}{}{\hspace{1.5em} 3 = SEC outside range 0-59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTP2S}{Tangent Plane to Spherical} +{ + \action{Transform tangent plane coordinates into spherical + coordinates (double precision)} + \call{CALL sla\_DTP2S (XI, ETA, RAZ, DECZ, RA, DEC)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{D}{tangent plane rectangular coordinates (radians)} \\ + \spec{RAZ,DECZ}{D}{spherical coordinates of tangent point (radians)} +} +\args{RETURNED} +{ + \spec{RA,DEC}{D}{spherical coordinates (radians)} +} +\notes +{ + \begin{enumerate} + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_DTP2V is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTP2V}{Tangent Plane to Direction Cosines} +{ + \action{Given the tangent-plane coordinates of a star and the direction + cosines of the tangent point, determine the direction cosines + of the star + (double precision).} + \call{CALL sla\_DTP2V (XI, ETA, V0, V)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{D}{tangent plane coordinates of star (radians)} \\ + \spec{V0}{D(3)}{direction cosines of tangent point} +} +\args{RETURNED} +{ + \spec{V}{D(3)}{direction cosines of star} +} +\notes +{ + \begin{enumerate} + \item If vector V0 is not of unit length, the returned vector V will + be wrong. + \item If vector V0 points at a pole, the returned vector V will be + based on the arbitrary assumption that $\alpha=0$ at + the tangent point. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_DTP2S. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTPS2C}{Plate centre from $\xi,\eta$ and $\alpha,\delta$} +{ + \action{From the tangent plane coordinates of a star of known \radec, + determine the \radec\ of the tangent point (double precision)} + \call{CALL sla\_DTPS2C (XI, ETA, RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2, N)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{D}{tangent plane rectangular coordinates (radians)} \\ + \spec{RA,DEC}{D}{spherical coordinates (radians)} +} +\args{RETURNED} +{ + \spec{RAZ1,DECZ1}{D}{spherical coordinates of tangent point, + solution 1} \\ + \spec{RAZ2,DECZ2}{D}{spherical coordinates of tangent point, + solution 2} \\ + \spec{N}{I}{number of solutions:} \\ + \spec{}{}{\hspace{1em} 0 = no solutions returned (note 2)} \\ + \spec{}{}{\hspace{1em} 1 = only the first solution is useful (note 3)} \\ + \spec{}{}{\hspace{1em} 2 = there are two useful solutions (note 3)} +} +\notes +{ + \begin{enumerate} + \item The RAZ1 and RAZ2 values returned are in the range $0\!-\!2\pi$. + \item Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero $\xi$ value, and hence it is + meaningless to ask where the tangent point would have to be + to bring about this combination of $\xi$ and $\delta$. + \item Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. N\,=\,1 + indicates only one useful solution, the usual case; under + these circumstances, the second solution corresponds to the + ``over-the-pole'' case, and this is reflected in the values + of RAZ2 and DECZ2 which are returned. + \item The DECZ1 and DECZ2 values returned are in the range $\pm\pi$, + but in the ordinary, non-pole-crossing, case, the range is + $\pm\pi/2$. + \item RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2 are all in radians. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_DTPV2C is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTPV2C}{Plate centre from $\xi,\eta$ and $x,y,z$} +{ + \action{From the tangent plane coordinates of a star of known + direction cosines, determine the direction cosines + of the tangent point (double precision)} + \call{CALL sla\_DTPV2C (XI, ETA, V, V01, V02, N)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{D}{tangent plane coordinates of star (radians)} \\ + \spec{V}{D(3)}{direction cosines of star} +} +\args{RETURNED} +{ + \spec{V01}{D(3)}{direction cosines of tangent point, solution 1} \\ + \spec{V01}{D(3)}{direction cosines of tangent point, solution 2} \\ + \spec{N}{I}{number of solutions:} \\ + \spec{}{}{\hspace{1em} 0 = no solutions returned (note 2)} \\ + \spec{}{}{\hspace{1em} 1 = only the first solution is useful (note 3)} \\ + \spec{}{}{\hspace{1em} 2 = there are two useful solutions (note 3)} +} +\notes +{ + \begin{enumerate} + \item The vector V must be of unit length or the result will be wrong. + \item Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero XI value. + \item Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. + N\,=\,1 + indicates only one useful solution, the usual case; under these + circumstances, the second solution can be regarded as valid if + the vector V02 is interpreted as the ``over-the-pole'' case. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_DTPS2C. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTT}{TT minus UTC} +{ + \action{Compute $\Delta$TT, the increment to be applied to + Coordinated Universal Time UTC to give + Terrestrial Time TT.} + \call{D~=~sla\_DTT (DJU)} +} +\args{GIVEN} +{ + \spec{DJU}{D}{UTC date as a modified JD (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_DTT}{D}{TT$-$UTC in seconds} +} +\notes +{ + \begin{enumerate} + \item The UTC is specified to be a date rather than a time to indicate + that care needs to be taken not to specify an instant which lies + within a leap second. Though in most cases UTC can include the + fractional part, correct behaviour on the day of a leap second + can be guaranteed only up to the end of the second + $23^{\rm h}\,59^{\rm m}\,59^{\rm s}$. + \item Pre 1972 January 1 a fixed value of 10 + ET$-$TAI is returned. + \item TT is one interpretation of the defunct timescale + {\it Ephemeris Time}, ET. + \item See also the routine sla\_DT, which roughly estimates ET$-$UT for + historical epochs. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DV2TP}{Direction Cosines to Tangent Plane} +{ + \action{Given the direction cosines of a star and of the tangent point, + determine the star's tangent-plane coordinates + (double precision).} + \call{CALL sla\_DV2TP (V, V0, XI, ETA, J)} +} +\args{GIVEN} +{ + \spec{V}{D(3)}{direction cosines of star} \\ + \spec{V0}{D(3)}{direction cosines of tangent point} +} +\args{RETURNED} +{ + \spec{XI,ETA}{D}{tangent plane coordinates (radians)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK, star on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 1 = error, star too far from axis} \\ + \spec{}{}{\hspace{1.5em} 2 = error, antistar on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 3 = error, antistar too far from axis} +} +\notes +{ + \begin{enumerate} + \item If vector V0 is not of unit length, or if vector V is of zero + length, the results will be wrong. + \item If V0 points at a pole, the returned $\xi,\eta$ + will be based on the + arbitrary assumption that $\alpha=0$ at the tangent point. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_DS2TP. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DVDV}{Scalar Product} +{ + \action{Scalar product of two 3-vectors (double precision).} + \call{D~=~sla\_DVDV (VA, VB)} +} +\args{GIVEN} +{ + \spec{VA}{D(3)}{first vector} \\ + \spec{VB}{D(3)}{second vector} +} +\args{RETURNED} +{ + \spec{sla\_DVDV}{D}{scalar product VA.VB} +} +%----------------------------------------------------------------------- +\routine{SLA\_DVN}{Normalize Vector} +{ + \action{Normalize a 3-vector, also giving the modulus (double precision).} + \call{CALL sla\_DVN (V, UV, VM)} +} +\args{GIVEN} +{ + \spec{V}{D(3)}{vector} +} +\args{RETURNED} +{ + \spec{UV}{D(3)}{unit vector in direction of V} \\ + \spec{VM}{D}{modulus of V} +} +\anote{If the modulus of V is zero, UV is set to zero as well.} +%----------------------------------------------------------------------- +\routine{SLA\_DVXV}{Vector Product} +{ + \action{Vector product of two 3-vectors (double precision).} + \call{CALL sla\_DVXV (VA, VB, VC)} +} +\args{GIVEN} +{ + \spec{VA}{D(3)}{first vector} \\ + \spec{VB}{D(3)}{second vector} +} +\args{RETURNED} +{ + \spec{VC}{D(3)}{vector product VA$\times$VB} +} +%----------------------------------------------------------------------- +\routine{SLA\_E2H}{$h,\delta$ to Az,El} +{ + \action{Equatorial to horizon coordinates + (single precision).} + \call{CALL sla\_DE2H (HA, DEC, PHI, AZ, EL)} +} +\args{GIVEN} +{ + \spec{HA}{R}{hour angle (radians)} \\ + \spec{DEC}{R}{declination (radians)} \\ + \spec{PHI}{R}{latitude (radians)} +} +\args{RETURNED} +{ + \spec{AZ}{R}{azimuth (radians)} \\ + \spec{EL}{R}{elevation (radians)} +} +\notes +{ + \begin{enumerate} + \item Azimuth is returned in the range $0\!-\!2\pi$; north is zero, + and east is $+\pi/2$. Elevation is returned in the range + $\pm\pi$. + \item The latitude must be geodetic. In critical applications, + corrections for polar motion should be applied. + \item In some applications it will be important to specify the + correct type of hour angle and declination in order to + produce the required type of azimuth and elevation. In + particular, it may be important to distinguish between + elevation as affected by refraction, which would + require the {\it observed} \hadec, and the elevation + {\it in vacuo}, which would require the {\it topocentric} + \hadec. + If the effects of diurnal aberration can be neglected, the + {\it apparent} \hadec\ may be used instead of the topocentric + \hadec. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and (for tracking a star) + sine and cosine of declination. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EARTH}{Approx Earth Pos/Vel} +{ + \action{Approximate heliocentric position and velocity of the Earth + (single precision).} + \call{CALL sla\_EARTH (IY, ID, FD, PV)} +} +\args{GIVEN} +{ + \spec{IY}{I}{year} \\ + \spec{ID}{I}{day in year (1 = Jan 1st)} \\ + \spec{FD}{R}{fraction of day} +} +\args{RETURNED} +{ + \spec{PV}{R(6)}{Earth \xyzxyzd\ (AU, AU~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item The date and time is TDB (loosely ET) in a Julian calendar + which has been aligned to the ordinary Gregorian + calendar for the interval 1900~March~1 to 2100~February~28. + The year and day can be obtained by calling sla\_CALYD or + sla\_CLYD. + \item The Earth heliocentric 6-vector is referred to the + FK4 mean equator and equinox of date. + \item Maximum/RMS errors 1950-2050: + \begin{itemize} + \item 13/5~$\times10^{-5}$~AU = 19200/7600~km in position + \item 47/26~$\times10^{-10}$~AU~s$^{-1}$ = + 0.0070/0.0039~km~s$^{-1}$ in speed + \end{itemize} + \item More accurate results are obtainable with the routine sla\_EVP. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_ECLEQ}{Ecliptic to Equatorial} +{ + \action{Transformation from ecliptic longitude and latitude to + J2000.0 \radec.} + \call{CALL sla\_ECLEQ (DL, DB, DATE, DR, DD)} +} +\args{GIVEN} +{ + \spec{DL,DB}{D}{ecliptic longitude and latitude + (mean of date, IAU 1980 theory, radians)} \\ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date + (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{DR,DD}{D}{J2000.0 mean \radec\ (radians)} +} +%----------------------------------------------------------------------- +\routine{SLA\_ECMAT}{Form $\alpha,\delta\rightarrow\lambda,\beta$ Matrix} +{ + \action{Form the equatorial to ecliptic rotation matrix (IAU 1980 theory).} + \call{CALL sla\_ECMAT (DATE, RMAT)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date + (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{RMAT}{D(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item RMAT is matrix {\bf M} in the expression + {\bf v}$_{ecl}$~=~{\bf M}$\cdot${\bf v}$_{equ}$. + \item The equator, equinox and ecliptic are mean of date. + \end{enumerate} +} +\aref{Murray, C.A., {\it Vectorial Astrometry}, section 4.3.} +%----------------------------------------------------------------------- +\routine{SLA\_ECOR}{RV \& Time Corrns to Sun} +{ + \action{Component of Earth orbit velocity and heliocentric + light time in a given direction.} + \call{CALL sla\_ECOR (RM, DM, IY, ID, FD, RV, TL)} +} +\args{GIVEN} +{ + \spec{RM,DM}{R}{mean \radec\ of date (radians)} \\ + \spec{IY}{I}{year} \\ + \spec{ID}{I}{day in year (1 = Jan 1st)} \\ + \spec{FD}{R}{fraction of day} +} +\args{RETURNED} +{ + \spec{RV}{R}{component of Earth orbital velocity (km~s$^{-1}$)} \\ + \spec{TL}{R}{component of heliocentric light time (s)} +} +\notes +{ + \begin{enumerate} + \item The date and time is TDB (loosely ET) in a Julian calendar + which has been aligned to the ordinary Gregorian + calendar for the interval 1900 March 1 to 2100 February 28. + The year and day can be obtained by calling sla\_CALYD or + sla\_CLYD. + \item Sign convention: + \begin{itemize} + \item The velocity component is +ve when the + Earth is receding from + the given point on the sky. + \item The light time component is +ve + when the Earth lies between the Sun and + the given point on the sky. + \end{itemize} + \item Accuracy: + \begin{itemize} + \item The velocity component is usually within 0.004~km~s$^{-1}$ + of the correct value and is never in error by more than + 0.007~km~s$^{-1}$. + \item The error in light time correction is about + \tsec{0}{03} at worst, + but is usually better than \tsec{0}{01}. + \end{itemize} + For applications requiring higher accuracy, see the sla\_EVP routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EG50}{B1950 $\alpha,\delta$ to Galactic} +{ + \action{Transformation from B1950.0 FK4 equatorial coordinates to + IAU 1958 galactic coordinates.} + \call{CALL sla\_EG50 (DR, DD, DL, DB)} +} +\args{GIVEN} +{ + \spec{DR,DD}{D}{B1950.0 \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal\ (radians)} +} +\anote{The equatorial coordinates are B1950.0 FK4. Use the + routine sla\_EQGAL if conversion from J2000.0 FK5 coordinates + is required.} +\aref{Blaauw {\it et al.}, 1960, {\it Mon.Not.R.astr.Soc.}, + {\bf 121}, 123.} +%----------------------------------------------------------------------- +\routine{SLA\_EL2UE}{Conventional to Universal Elements} +{ + \action{Transform conventional osculating orbital elements + into ``universal'' form.} + \call{CALL sla\_EL2UE (\vtop{ + \hbox{DATE, JFORM, EPOCH, ORBINC, ANODE,} + \hbox{PERIH, AORQ, E, AORL, DM,} + \hbox{U, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{DATE}{D}{epoch (TT MJD) of osculation (Note~3)} \\ + \spec{JFORM}{I}{choice of element set (1-3; Note~6)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude + ($M$ or $L$, radians,} \\ + \spec{}{}{\hspace{1.5em} JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} +} +\args{RETURNED} +{ + \spec{U}{D(13)}{universal orbital elements (Note~1)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v}_0$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, + approx} \\ \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = illegal JFORM} \\ + \spec{}{}{\hspace{1.2em} $-$2 = illegal E} \\ + \spec{}{}{\hspace{1.2em} $-$3 = illegal AORQ} \\ + \spec{}{}{\hspace{1.2em} $-$4 = illegal DM} \\ + \spec{}{}{\hspace{1.2em} $-$5 = numerical error} +} +\notes +{ + \begin{enumerate} + \item The ``universal'' elements are those which define the orbit for + the purposes of the method of universal variables (see reference). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \item The companion routine is sla\_UE2PV. This takes the set of numbers + that the present routine outputs and uses them to derive the + object's position and velocity. A single prediction requires one + call to the present routine followed by one call to sla\_UE2PV; + for convenience, the two calls are packaged as the routine + sla\_PLANEL. Multiple predictions may be made by again calling the + present routine once, but then calling sla\_UE2PV multiple times, + which is faster than multiple calls to sla\_PLANEL. + \item DATE is the epoch of osculation. It is in the TT timescale + (formerly Ephemeris Time, ET) and is a Modified Julian Date + (JD$-$2400000.5). + \item The supplied orbital elements are with respect to the J2000 + ecliptic and equinox. The position and velocity parameters + returned in the array U are with respect to the mean equator and + equinox of epoch J2000, and are for the perihelion prior to the + specified epoch. + \item The universal elements returned in the array U are in canonical + units (solar masses, AU and canonical days). + \item Three different element-format options are supported, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> longitude of perihelion $\varpi$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e < 1 )$ \\ + \> AORL \> = \> mean longitude $L$ (radians) \\ + \> DM \> = \> daily motion $n$ (radians) + \end{tabbing} + + JFORM=2, suitable for minor planets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e < 1 )$ \\ + \> AORL \> = \> mean anomaly $M$ (radians) + \end{tabbing} + + JFORM=3, suitable for comets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of perihelion $T$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> perihelion distance $q$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e \leq 10 )$ + \end{tabbing} + \item Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are + not accessed. + \item The algorithm was originally adapted from the EPHSLA program of + D.\,H.\,P.\,Jones (private communication, 1996). The method + is based on Stumpff's Universal Variables. + \end{enumerate} +} +\aref{Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983.} +%------------------------------------------------------------------------------ +\routine{SLA\_EPB}{MJD to Besselian Epoch} +{ + \action{Conversion of Modified Julian Date to Besselian Epoch.} + \call{D~=~sla\_EPB (DATE)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{Modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_EPB}{D}{Besselian Epoch} +} +\aref{Lieske, J.H., 1979, {\it Astr.Astrophys.}\ {\bf 73}, 282.} +%----------------------------------------------------------------------- +\routine{SLA\_EPB2D}{Besselian Epoch to MJD} +{ + \action{Conversion of Besselian Epoch to Modified Julian Date.} + \call{D~=~sla\_EPB2D (EPB)} +} +\args{GIVEN} +{ + \spec{EPB}{D}{Besselian Epoch} +} +\args{RETURNED} +{ + \spec{sla\_EPB2D}{D}{Modified Julian Date (JD$-$2400000.5)} +} +\aref{Lieske, J.H., 1979. {\it Astr.Astrophys.}\ {\bf 73}, 282.} +%----------------------------------------------------------------------- +\routine{SLA\_EPCO}{Convert Epoch to B or J} +{ + \action{Convert an epoch to Besselian or Julian to match another one.} + \call{D~=~sla\_EPCO (K0, K, E)} + +} +\args{GIVEN} +{ + \spec{K0}{C}{form of result: `B'=Besselian, `J'=Julian} \\ + \spec{K}{C}{form of given epoch: `B' or `J'} \\ + \spec{E}{D}{epoch} +} +\args{RETURNED} +{ + \spec{sla\_EPCO}{D}{the given epoch converted as necessary} +} +\notes +{ + \begin{enumerate} + \item The result is always either equal to or very close to + the given epoch E. The routine is required only in + applications where punctilious treatment of heterogeneous + mixtures of star positions is necessary. + \item K0 and K are not validated. They are interpreted as follows: + \begin{itemize} + \item If K0 and K are the same, the result is E. + \item If K0 is `B' and K isn't, the conversion is J to B. + \item In all other cases, the conversion is B to J. + \end{itemize} + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EPJ}{MJD to Julian Epoch} +{ + \action{Convert Modified Julian Date to Julian Epoch.} + \call{D~=~sla\_EPJ (DATE)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{Modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_EPJ}{D}{Julian Epoch} +} +\aref{Lieske, J.H., 1979.\ {\it Astr.Astrophys.}, {\bf 73}, 282.} +%----------------------------------------------------------------------- +\routine{SLA\_EPJ2D}{Julian Epoch to MJD} +{ + \action{Convert Julian Epoch to Modified Julian Date.} + \call{D~=~sla\_EPJ2D (EPJ)} +} +\args{GIVEN} +{ + \spec{EPJ}{D}{Julian Epoch} +} +\args{RETURNED} +{ + \spec{sla\_EPJ2D}{D}{Modified Julian Date (JD$-$2400000.5)} +} +\aref{Lieske, J.H., 1979.\ {\it Astr.Astrophys.}, {\bf 73}, 282.} +%----------------------------------------------------------------------- +\routine{SLA\_EQECL}{J2000 $\alpha,\delta$ to Ecliptic} +{ + \action{Transformation from J2000.0 equatorial coordinates to + ecliptic longitude and latitude.} + \call{CALL sla\_EQECL (DR, DD, DATE, DL, DB)} +} +\args{GIVEN} +{ + \spec{DR,DD}{D}{J2000.0 mean \radec\ (radians)} \\ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{DL,DB}{D}{ecliptic longitude and latitude + (mean of date, IAU 1980 theory, radians)} +} +%----------------------------------------------------------------------- +\routine{SLA\_EQEQX}{Equation of the Equinoxes} +{ + \action{Equation of the equinoxes (IAU 1994).} + \call{D~=~sla\_EQEQX (DATE)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_EQEQX}{D}{The equation of the equinoxes (radians)} +} +\notes{ + \begin{enumerate} + \item The equation of the equinoxes is defined here as GAST~$-$~GMST: + it is added to a {\it mean}\/ sidereal time to give the + {\it apparent}\/ sidereal time. + \item The change from the classic ``textbook'' expression + $\Delta\psi\,cos\,\epsilon$ occurred with IAU Resolution C7, + Recommendation~3 (1994). The new formulation takes into + account cross-terms between the various precession and + nutation quantities, amounting to about 3~milliarcsec. + The transition from the old to the new model officially + takes place on 1997 February~27. + \end{enumerate} +} +\aref{Capitaine, N.\ \& Gontier, A.-M.\ (1993), + {\it Astron. Astrophys.}, + {\bf 275}, 645-650.} +%----------------------------------------------------------------------- +\routine{SLA\_EQGAL}{J2000 $\alpha,\delta$ to Galactic} +{ + \action{Transformation from J2000.0 FK5 equatorial coordinates to + IAU 1958 galactic coordinates.} + \call{CALL sla\_EQGAL (DR, DD, DL, DB)} +} +\args{GIVEN} +{ + \spec{DR,DD}{D}{J2000.0 \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal\ (radians)} +} +\anote{The equatorial coordinates are J2000.0 FK5. Use the routine + sla\_EG50 if conversion from B1950.0 FK4 coordinates is required.} +\aref{Blaauw {\it et al.}, 1960, {\it Mon.Not.R.astr.Soc.}, + {\bf 121}, 123.} +%----------------------------------------------------------------------- +\routine{SLA\_ETRMS}{E-terms of Aberration} +{ + \action{Compute the E-terms vector -- the part of the annual + aberration which arises from the eccentricity of the + Earth's orbit.} + \call{CALL sla\_ETRMS (EP, EV)} +} +\args{GIVEN} +{ + \spec{EP}{D}{Besselian epoch} +} +\args{RETURNED} +{ + \spec{EV}{D(3)}{E-terms as $[\Delta x, \Delta y, \Delta z\,]$} +} +\anote{Note the use of the J2000 aberration constant (\arcsec{20}{49552}). + This is a reflection of the fact that the E-terms embodied in + existing star catalogues were computed from a variety of + aberration constants. Rather than adopting one of the old + constants the latest value is used here.} +\refs +{ + \begin{enumerate} + \item Smith, C.A.\ {\it et al.}, 1989. {\it Astr.J.}\ {\bf 97}, 265. + \item Yallop, B.D.\ {\it et al.}, 1989. {\it Astr.J.}\ {\bf 97}, 274. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EULER}{Rotation Matrix from Euler Angles} +{ + \action{Form a rotation matrix from the Euler angles -- three + successive rotations about specified Cartesian axes + (single precision).} + \call{CALL sla\_EULER (ORDER, PHI, THETA, PSI, RMAT)} +} +\args{GIVEN} +{ + \spec{ORDER}{C*(*)}{specifies about which axes the rotations occur} \\ + \spec{PHI}{R}{1st rotation (radians)} \\ + \spec{THETA}{R}{2nd rotation (radians)} \\ + \spec{PSI}{R}{3rd rotation (radians)} +} +\args{RETURNED} +{ + \spec{RMAT}{R(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item A rotation is positive when the reference frame rotates + anticlockwise as seen looking towards the origin from the + positive region of the specified axis. + \item The characters of ORDER define which axes the three successive + rotations are about. A typical value is `ZXZ', indicating that + RMAT is to become the direction cosine matrix corresponding to + rotations of the reference frame through PHI radians about the + old {\it z}-axis, followed by THETA radians about the resulting + {\it x}-axis, + then PSI radians about the resulting {\it z}-axis. In detail: + \begin{itemize} + \item The axis names can be any of the following, in any order or + combination: X, Y, Z, uppercase or lowercase, 1, 2, 3. Normal + axis labelling/numbering conventions apply; + the {\it xyz} ($\equiv123$) + triad is right-handed. Thus, the `ZXZ' example given above + could be written `zxz' or `313' (or even `ZxZ' or `3xZ'). + \item ORDER is terminated by length or by the first unrecognized + character. + \item Fewer than three rotations are acceptable, in which case + the later angle arguments are ignored. + \end{itemize} + \item Zero rotations produces a unit RMAT. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EVP}{Earth Position \& Velocity} +{ + \action{Barycentric and heliocentric velocity and position of the Earth.} + \call{CALL sla\_EVP (DATE, DEQX, DVB, DPB, DVH, DPH)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as a Modified Julian Date + (JD$-$2400000.5)} \\ + \spec{DEQX}{D}{Julian Epoch ({\it e.g.}\ 2000D0) of mean equator and + equinox of the vectors returned. If DEQX~$<0$, + all vectors are referred to the mean equator and + equinox (FK5) of date DATE.} +} +\args{RETURNED} +{ + \spec{DVB}{D(3)}{barycentric \xyzd, AU~s$^{-1}$} \\ + \spec{DPB}{D(3)}{barycentric \xyz, AU} \\ + \spec{DVH}{D(3)}{heliocentric \xyzd, AU~s$^{-1}$} \\ + \spec{DPH}{D(3)}{heliocentric \xyz, AU} +} +\notes +{ + \begin{enumerate} + \item This routine is used when accuracy is more important + than CPU time, yet the extra complication of reading a + pre-computed ephemeris is not justified. The maximum + deviations from the JPL~DE96 ephemeris are as follows: + \begin{itemize} + \item velocity (barycentric or heliocentric): 420~mm~s$^{-1}$ + \item position (barycentric): 6900~km + \item position (heliocentric): 1600~km + \end{itemize} + \item The routine is an adaption of the BARVEL and BARCOR + subroutines of P.Stumpff, which are described in + {\it Astr.Astrophys.Suppl.Ser.}\ {\bf 41}, 1-8 (1980). + Most of the changes are merely cosmetic and do not affect + the results at all. However, some adjustments have been + made so as to give results that refer to the new (IAU 1976 + `FK5') equinox and precession, although the differences these + changes make relative to the results from Stumpff's original + `FK4' version are smaller than the inherent accuracy of the + algorithm. One minor shortcoming in the original routines + that has {\bf not} been corrected is that slightly better + numerical accuracy could be achieved if the various polynomial + evaluations were to be so arranged that the smallest terms were + computed first. Note also that one of Stumpff's precession + constants differs by \arcsec{0}{001} from the value given in the + {\it Explanatory Supplement}. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FITXY}{Fit Linear Model to Two \xy\ Sets} +{ + \action{Fit a linear model to relate two sets of \xy\ coordinates.} + \call{CALL sla\_FITXY (ITYPE,NP,XYE,XYM,COEFFS,J)} +} +\args{GIVEN} +{ + \spec{ITYPE}{I}{type of model: 4 or 6 (note 1)} \\ + \spec{NP}{I}{number of samples (note 2)} \\ + \spec{XYE}{D(2,NP)}{expected \xy\ for each sample} \\ + \spec{XYM}{D(2,NP)}{measured \xy\ for each sample} +} +\args{RETURNED} +{ + \spec{COEFFS}{D(6)}{coefficients of model (note 3)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{0.7em} $-$1 = illegal ITYPE} \\ + \spec{}{}{\hspace{0.7em} $-$2 = insufficient data} \\ + \spec{}{}{\hspace{0.7em} $-$3 = singular solution} +} +\notes +{ + \begin{enumerate} + \item ITYPE, which must be either 4 or 6, selects the type of model + fitted. Both allowed ITYPE values produce a model COEFFS which + consists of six coefficients, namely the zero points and, for + each of XE and YE, the coefficient of XM and YM. For ITYPE=6, + all six coefficients are independent, modelling squash and shear + as well as origin, scale, and orientation. However, ITYPE=4 + selects the {\it solid body rotation}\/ option; the model COEFFS + still consists of the same six coefficients, but now two of + them are used twice (appropriately signed). Origin, scale + and orientation are still modelled, but not squash or shear -- + the units of X and Y have to be the same. + \item For NC=4, NP must be at least 2. For NC=6, NP must be at + least 3. + \item The model is returned in the array COEFFS. Naming the + six elements of COEFFS $a,b,c,d,e$ \& $f$, + the model transforms {\it measured}\/ coordinates + $[x_{m},y_{m}\,]$ into {\it expected}\/ coordinates + $[x_{e},y_{e}\,]$ as follows: + \begin{verse} + $x_{e} = a + bx_{m} + cy_{m}$ \\ + $y_{e} = d + ex_{m} + fy_{m}$ + \end{verse} + For the {\it solid body rotation}\/ option (ITYPE=4), the + magnitudes of $b$ and $f$, and of $c$ and $e$, are equal. The + signs of these coefficients depend on whether there is a + sign reversal between $[x_{e},y_{e}]$ and $[x_{m},y_{m}]$; + fits are performed + with and without a sign reversal and the best one chosen. + \item Error status values J=$-$1 and $-$2 leave COEFFS unchanged; + if J=$-$3 COEFFS may have been changed. + \item See also sla\_PXY, sla\_INVF, sla\_XY2XY, sla\_DCMPF. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK425}{FK4 to FK5} +{ + \action{Convert B1950.0 FK4 star data to J2000.0 FK5. + This routine converts stars from the old, Bessel-Newcomb, FK4 + system to the new, IAU~1976, FK5, Fricke system. The precepts + of Smith~{\it et~al.}\ (see reference~1) are followed, + using the implementation + by Yallop~{\it et~al.}\ (reference~2) of a matrix method + due to Standish. + Kinoshita's development of Andoyer's post-Newcomb precession is + used. The numerical constants from + Seidelmann~{\it et~al.}\ (reference~3) are used canonically.} + \call{CALL sla\_FK425 (\vtop{ + \hbox{R1950,D1950,DR1950,DD1950,P1950,V1950,} + \hbox{R2000,D2000,DR2000,DD2000,P2000,V2000)}}} +} +\args{GIVEN} +{ + \spec{R1950}{D}{B1950.0 $\alpha$ (radians)} \\ + \spec{D1950}{D}{B1950.0 $\delta$ (radians)} \\ + \spec{DR1950}{D}{B1950.0 proper motion in $\alpha$ + (radians per tropical year)} \\ + \spec{DD1950}{D}{B1950.0 proper motion in $\delta$ + (radians per tropical year)} \\ + \spec{P1950}{D}{B1950.0 parallax (arcsec)} \\ + \spec{V1950}{D}{B1950.0 radial velocity (km~s$^{-1}$, +ve = moving away)} +} +\args{RETURNED} +{ + \spec{R2000}{D}{J2000.0 $\alpha$ (radians)} \\ + \spec{D2000}{D}{J2000.0 $\delta$ (radians)} \\ + \spec{DR2000}{D}{J2000.0 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD2000}{D}{J2000.0 proper motion in $\delta$ + (radians per Julian year)} \\ + \spec{P2000}{D}{J2000.0 parallax (arcsec)} \\ + \spec{V2000}{D}{J2000.0 radial velocity (km~s$^{-1}$, +ve = moving away)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item Conversion from Besselian epoch 1950.0 to Julian epoch + 2000.0 only is provided for. Conversions involving other + epochs will require use of the appropriate precession, + proper motion, and E-terms routines before and/or after FK425 + is called. + \item In the FK4 catalogue the proper motions of stars within + $10^{\circ}$ of the poles do not include the {\it differential + E-terms}\/ effect and should, strictly speaking, be handled + in a different manner from stars outside these regions. + However, given the general lack of homogeneity of the star + data available for routine astrometry, the difficulties of + handling positions that may have been determined from + astrometric fields spanning the polar and non-polar regions, + the likelihood that the differential E-terms effect was not + taken into account when allowing for proper motion in past + astrometry, and the undesirability of a discontinuity in + the algorithm, the decision has been made in this routine to + include the effect of differential E-terms on the proper + motions for all stars, whether polar or not. At epoch J2000, + and measuring on the sky rather than in terms of $\Delta\alpha$, + the errors resulting from this simplification are less than + 1~milliarcsecond in position and 1~milliarcsecond per + century in proper motion. + \item See also sla\_FK45Z, sla\_FK524, sla\_FK54Z. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Smith, C.A.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 265. + \item Yallop, B.D.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 274. + \item Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK45Z}{FK4 to FK5, no P.M. or Parallax} +{ + \action{Convert B1950.0 FK4 star data to J2000.0 FK5 assuming zero + proper motion in the FK5 frame. + This routine converts stars from the old, Bessel-Newcomb, FK4 + system to the new, IAU~1976, FK5, Fricke system, in such a + way that the FK5 proper motion is zero. Because such a star + has, in general, a non-zero proper motion in the FK4 system, + the routine requires the epoch at which the position in the + FK4 system was determined. The method is from appendix~2 of + reference~1, but using the constants of reference~4.} + \call{CALL sla\_FK45Z (R1950,D1950,BEPOCH,R2000,D2000)} +} +\args{GIVEN} +{ + \spec{R1950}{D}{B1950.0 FK4 $\alpha$ at epoch BEPOCH (radians)} \\ + \spec{D1950}{D}{B1950.0 FK4 $\delta$ at epoch BEPOCH (radians)} \\ + \spec{BEPOCH}{D}{Besselian epoch ({\it e.g.}\ 1979.3D0)} +} +\args{RETURNED} +{ + \spec{R2000}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D2000}{D}{J2000.0 FK5 $\delta$ (radians)} +} +\notes +{ + \begin{enumerate} + \item The epoch BEPOCH is strictly speaking Besselian, but + if a Julian epoch is supplied the result will be + affected only to a negligible extent. + \item Conversion from Besselian epoch 1950.0 to Julian epoch + 2000.0 only is provided for. Conversions involving other + epochs will require use of the appropriate precession, + proper motion, and E-terms routines before and/or + after FK45Z is called. + \item In the FK4 catalogue the proper motions of stars within + $10^{\circ}$ of the poles do not include the {\it differential + E-terms}\/ effect and should, strictly speaking, be handled + in a different manner from stars outside these regions. + However, given the general lack of homogeneity of the star + data available for routine astrometry, the difficulties of + handling positions that may have been determined from + astrometric fields spanning the polar and non-polar regions, + the likelihood that the differential E-terms effect was not + taken into account when allowing for proper motion in past + astrometry, and the undesirability of a discontinuity in + the algorithm, the decision has been made in this routine to + include the effect of differential E-terms on the proper + motions for all stars, whether polar or not. At epoch 2000, + and measuring on the sky rather than in terms of $\Delta\alpha$, + the errors resulting from this simplification are less than + 1~milliarcsecond in position and 1~milliarcsecond per + century in proper motion. + \item See also sla\_FK425, sla\_FK524, sla\_FK54Z. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Aoki, S., {\it et al.}, 1983.\ {\it Astr.Astrophys.}, {\bf 128}, 263. + \item Smith, C.A.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 265. + \item Yallop, B.D.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 274. + \item Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK524}{FK5 to FK4} +{ + \action{Convert J2000.0 FK5 star data to B1950.0 FK4. + This routine converts stars from the new, IAU~1976, FK5, Fricke + system, to the old, Bessel-Newcomb, FK4 system. + The precepts of Smith~{\it et~al.}\ (reference~1) are followed, + using the implementation by Yallop~{\it et~al.}\ (reference~2) + of a matrix method due to Standish. Kinoshita's development of + Andoyer's post-Newcomb precession is used. The numerical + constants from Seidelmann~{\it et~al.}\ (reference~3) are + used canonically.} + \call{CALL sla\_FK524 (\vtop{ + \hbox{R2000,D2000,DR2000,DD2000,P2000,V2000,} + \hbox{R1950,D1950,DR1950,DD1950,P1950,V1950)}}} +} +\args{GIVEN} +{ + \spec{R2000}{D}{J2000.0 $\alpha$ (radians)} \\ + \spec{D2000}{D}{J2000.0 $\delta$ (radians)} \\ + \spec{DR2000}{D}{J2000.0 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD2000}{D}{J2000.0 proper motion in $\delta$ + (radians per Julian year)} \\ + \spec{P2000}{D}{J2000.0 parallax (arcsec)} \\ + \spec{V2000}{D}{J2000 radial velocity (km~s$^{-1}$, +ve = moving away)} +} +\args{RETURNED} +{ + \spec{R1950}{D}{B1950.0 $\alpha$ (radians)} \\ + \spec{D1950}{D}{B1950.0 $\delta$ (radians)} \\ + \spec{DR1950}{D}{B1950.0 proper motion in $\alpha$ + (radians per tropical year)} \\ + \spec{DD1950}{D}{B1950.0 proper motion in $\delta$ + (radians per tropical year)} \\ + \spec{P1950}{D}{B1950.0 parallax (arcsec)} \\ + \spec{V1950}{D}{radial velocity (km~s$^{-1}$, +ve = moving away)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item Note that conversion from Julian epoch 2000.0 to Besselian + epoch 1950.0 only is provided for. Conversions involving + other epochs will require use of the appropriate precession, + proper motion, and E-terms routines before and/or after + FK524 is called. + \item In the FK4 catalogue the proper motions of stars within + $10^{\circ}$ of the poles do not include the {\it differential + E-terms}\/ effect and should, strictly speaking, be handled + in a different manner from stars outside these regions. + However, given the general lack of homogeneity of the star + data available for routine astrometry, the difficulties of + handling positions that may have been determined from + astrometric fields spanning the polar and non-polar regions, + the likelihood that the differential E-terms effect was not + taken into account when allowing for proper motion in past + astrometry, and the undesirability of a discontinuity in + the algorithm, the decision has been made in this routine to + include the effect of differential E-terms on the proper + motions for all stars, whether polar or not. At epoch 2000, + and measuring on the sky rather than in terms of $\Delta\alpha$, + the errors resulting from this simplification are less than + 1~milliarcsecond in position and 1~milliarcsecond per + century in proper motion. + \item See also sla\_FK425, sla\_FK45Z, sla\_FK54Z. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Smith, C.A.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 265. + \item Yallop, B.D.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 274. + \item Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK52H}{FK5 to Hipparcos} +{ + \action{Transform an FK5 (J2000) position and proper motion + into the frame of the Hipparcos catalogue.} + \call{CALL sla\_FK52H (R5,D5,DR5,DD5,RH,DH,DRH,DDH)} +} +\args{GIVEN} +{ + \spec{R5}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D5}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{DR5}{D}{J2000.0 FK5 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD5}{D}{J2000.0 FK5 proper motion in $\delta$ + (radians per Julian year)} +} +\args{RETURNED} +{ + \spec{RH}{D}{Hipparcos $\alpha$ (radians)} \\ + \spec{DH}{D}{Hipparcos $\delta$ (radians)} \\ + \spec{DRH}{D}{Hipparcos proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DDH}{D}{Hipparcos proper motion in $\delta$ + (radians per Julian year)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item The FK5 to Hipparcos + transformation consists of a pure rotation and spin; + zonal errors in the FK5 catalogue are not taken into account. + \item The adopted epoch J2000.0 FK5 to Hipparcos orientation and spin + values are as follows (see reference): + + \vspace{2ex} + + ~~~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & + \multicolumn{1}{|c}{\it orientation} & + \multicolumn{1}{|c|}{\it ~~~spin~~~} \\ \hline + $x$ & $-19.9$~~~~ & ~$-0.30$~~ \\ + $y$ & $-9.1$~~~~ & ~$+0.60$~~ \\ + $z$ & $+22.9$~~~~ & ~$+0.70$~~ \\ \hline + & {\it mas}~~~~~ & ~{\it mas/y}~ \\ \hline + \end{tabular} + + \vspace{3ex} + + These orientation and spin components are interpreted as + {\it axial vectors.} An axial vector points at the pole of + the rotation and its length is the amount of rotation in radians. + \item See also sla\_FK5HZ, sla\_H2FK5, sla\_HFK5Z. + \end{enumerate} +} +\aref {Feissel, M.\ \& Mignard, F., 1998., {\it Astron.Astrophys.}\ + {\bf 331}, L33-L36.} +%----------------------------------------------------------------------- +\routine{SLA\_FK54Z}{FK5 to FK4, no P.M. or Parallax} +{ + \action{Convert a J2000.0 FK5 star position to B1950.0 FK4 assuming + FK5 zero proper motion and parallax. + This routine converts star positions from the new, IAU~1976, + FK5, Fricke system to the old, Bessel-Newcomb, FK4 system.} + \call{CALL sla\_FK54Z (R2000,D2000,BEPOCH,R1950,D1950,DR1950,DD1950)} +} +\args{GIVEN} +{ + \spec{R2000}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D2000}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{BEPOCH}{D}{Besselian epoch ({\it e.g.}\ 1950D0)} +} +\args{RETURNED} +{ + \spec{R1950}{D}{B1950.0 FK4 $\alpha$ at epoch BEPOCH (radians)} \\ + \spec{D1950}{D}{B1950.0 FK4 $\delta$ at epoch BEPOCH (radians)} \\ + \spec{DR1950}{D}{B1950.0 FK4 proper motion in $\alpha$ + (radians per tropical year)} \\ + \spec{DD1950}{D}{B1950.0 FK4 proper motion in $\delta$ + (radians per tropical year)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item Conversion from Julian epoch 2000.0 to Besselian epoch 1950.0 + only is provided for. Conversions involving other epochs will + require use of the appropriate precession routines before and + after this routine is called. + \item Unlike in the sla\_FK524 routine, the FK5 proper motions, the + parallax and the radial velocity are presumed zero. + \item It was the intention that FK5 should be a close approximation + to an inertial frame, so that distant objects have zero proper + motion; such objects have (in general) non-zero proper motion + in FK4, and this routine returns those {\it fictitious proper + motions}. + \item The position returned by this routine is in the B1950 + reference frame but at Besselian epoch BEPOCH. For + comparison with catalogues the BEPOCH argument will + frequently be 1950D0. + \item See also sla\_FK425, sla\_FK45Z, sla\_FK524. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK5HZ}{FK5 to Hipparcos, no P.M.} +{ + \action{Transform an FK5 (J2000) star position into the frame of the + Hipparcos catalogue, assuming zero Hipparcos proper motion.} + \call{CALL sla\_FK52H (R5,D5,EPOCH,RH,DH)} +} +\args{GIVEN} +{ + \spec{R5}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D5}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{EPOCH}{D}{Julian epoch (TDB)} +} +\args{RETURNED} +{ + \spec{RH}{D}{Hipparcos $\alpha$ (radians)} \\ + \spec{DH}{D}{Hipparcos $\delta$ (radians)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item The FK5 to Hipparcos + transformation consists of a pure rotation and spin; + zonal errors in the FK5 catalogue are not taken into account. + \item The adopted epoch J2000.0 FK5 to Hipparcos orientation and spin + values are as follows (see reference): + + \vspace{2ex} + + ~~~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & + \multicolumn{1}{|c}{\it orientation} & + \multicolumn{1}{|c|}{\it ~~~spin~~~} \\ \hline + $x$ & $-19.9$~~~~ & ~$-0.30$~~ \\ + $y$ & $-9.1$~~~~ & ~$+0.60$~~ \\ + $z$ & $+22.9$~~~~ & ~$+0.70$~~ \\ \hline + & {\it mas}~~~~~ & ~{\it mas/y}~ \\ \hline + \end{tabular} + + \vspace{3ex} + + These orientation and spin components are interpreted as + {\it axial vectors.} An axial vector points at the pole of + the rotation and its length is the amount of rotation in radians. + \item See also sla\_FK52H, sla\_H2FK5, sla\_HFK5Z. + \end{enumerate} +} +\aref {Feissel, M.\ \& Mignard, F., 1998., {\it Astron.Astrophys.}\ + {\bf 331}, L33-L36.} +%----------------------------------------------------------------------- +\routine{SLA\_FLOTIN}{Decode a Real Number} +{ + \action{Convert free-format input into single precision floating point.} + \call{CALL sla\_FLOTIN (STRING, NSTRT, RESLT, JFLAG)} +} +\args{GIVEN} +{ + \spec{STRING}{C}{string containing number to be decoded} \\ + \spec{NSTRT}{I}{pointer to where decoding is to commence} \\ + \spec{RESLT}{R}{current value of result} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced to next number} \\ + \spec{RESLT}{R}{result} \\ + \spec{JFLAG}{I}{status: $-$1~=~$-$OK, 0~=~+OK, 1~=~null result, 2~=~error} +} +\notes +{ + \begin{enumerate} + \item The reason sla\_FLOTIN has separate `OK' status values + for + and $-$ is to enable minus zero to be detected. + This is of crucial importance + when decoding mixed-radix numbers. For example, an angle + expressed as degrees, arcminutes and arcseconds may have a + leading minus sign but a zero degrees field. + \item A TAB is interpreted as a space, and lowercase characters are + interpreted as uppercase. {\it n.b.}\ The test for TAB is + ASCII-specific. + \item The basic format is the sequence of fields $\pm n.n x \pm n$, + where $\pm$ is a sign + character `+' or `$-$', $n$ means a string of decimal digits, + `.' is a decimal point, and $x$, which indicates an exponent, + means `D' or `E'. Various combinations of these fields can be + omitted, and embedded blanks are permissible in certain places. + \item Spaces: + \begin{itemize} + \item Leading spaces are ignored. + \item Embedded spaces are allowed only after +, $-$, D or E, + and after the decimal point if the first sequence of + digits is absent. + \item Trailing spaces are ignored; the first signifies + end of decoding and subsequent ones are skipped. + \end{itemize} + \item Delimiters: + \begin{itemize} + \item Any character other than +,$-$,0-9,.,D,E or space may be + used to signal the end of the number and terminate decoding. + \item Comma is recognized by sla\_FLOTIN as a special case; it + is skipped, leaving the pointer on the next character. See + 13, below. + \item Decoding will in all cases terminate if end of string + is reached. + \end{itemize} + \item Both signs are optional. The default is +. + \item The mantissa $n.n$ defaults to unity. + \item The exponent $x\!\pm\!n$ defaults to `E0'. + \item The strings of decimal digits may be of any length. + \item The decimal point is optional for whole numbers. + \item A {\it null result}\/ occurs when the string of characters + being decoded does not begin with +,$-$,0-9,.,D or E, or + consists entirely of spaces. When this condition is + detected, JFLAG is set to 1 and RESLT is left untouched. + \item NSTRT = 1 for the first character in the string. + \item On return from sla\_FLOTIN, NSTRT is set ready for the next + decode -- following trailing blanks and any comma. If a + delimiter other than comma is being used, NSTRT must be + incremented before the next call to sla\_FLOTIN, otherwise + all subsequent calls will return a null result. + \item Errors (JFLAG=2) occur when: + \begin{itemize} + \item a +, $-$, D or E is left unsatisfied; or + \item the decimal point is present without at least + one decimal digit before or after it; or + \item an exponent more than 100 has been presented. + \end{itemize} + \item When an error has been detected, NSTRT is left + pointing to the character following the last + one used before the error came to light. This + may be after the point at which a more sophisticated + program could have detected the error. For example, + sla\_FLOTIN does not detect that `1E999' is unacceptable + (on a computer where this is so) + until the entire number has been decoded. + \item Certain highly unlikely combinations of mantissa and + exponent can cause arithmetic faults during the + decode, in some cases despite the fact that they + together could be construed as a valid number. + \item Decoding is left to right, one pass. + \item See also sla\_DFLTIN and sla\_INTIN. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_GALEQ}{Galactic to J2000 $\alpha,\delta$} +{ + \action{Transformation from IAU 1958 galactic coordinates + to J2000.0 FK5 equatorial coordinates.} + \call{CALL sla\_GALEQ (DL, DB, DR, DD)} +} +\args{GIVEN} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal} +} +\args{RETURNED} +{ + \spec{DR,DD}{D}{J2000.0 \radec} +} +\notes +{ + \begin{enumerate} + \item All arguments are in radians. + \item The equatorial coordinates are J2000.0 FK5. Use the routine + sla\_GE50 if conversion to B1950.0 FK4 coordinates is + required. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_GALSUP}{Galactic to Supergalactic} +{ + \action{Transformation from IAU 1958 galactic coordinates to + de Vaucouleurs supergalactic coordinates.} + \call{CALL sla\_GALSUP (DL, DB, DSL, DSB)} +} +\args{GIVEN} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal\ (radians)} +} +\args{RETURNED} +{ + \spec{DSL,DSB}{D}{supergalactic longitude and latitude (radians)} +} +\refs +{ + \begin{enumerate} + \item de Vaucouleurs, de Vaucouleurs, \& Corwin, {\it Second Reference + Catalogue of Bright Galaxies}, U.Texas, p8. + \item Systems \& Applied Sciences Corp., documentation for the + machine-readable version of the above catalogue, + Contract NAS 5-26490. + \end{enumerate} + (These two references give different values for the galactic + longitude of the supergalactic origin. Both are wrong; the + correct value is $l^{I\!I}=137.37$.) +} +%----------------------------------------------------------------------- +\routine{SLA\_GE50}{B1950 $\alpha,\delta$ to Galactic} +{ + \action{Transformation from IAU 1958 galactic coordinates to + B1950.0 FK4 equatorial coordinates.} + \call{CALL sla\_GE50 (DL, DB, DR, DD)} +} +\args{GIVEN} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal} +} +\args{RETURNED} +{ + \spec{DR,DD}{D}{B1950.0 \radec} +} +\notes +{ + \begin{enumerate} + \item All arguments are in radians. + \item The equatorial coordinates are B1950.0 FK4. Use the + routine sla\_GALEQ if conversion to J2000.0 FK5 coordinates + is required. + \end{enumerate} +} +\aref{Blaauw {\it et al.}, 1960, {\it Mon.Not.R.astr.Soc.}, + {\bf 121}, 123.} +%----------------------------------------------------------------------- +\routine{SLA\_GEOC}{Geodetic to Geocentric} +{ + \action{Convert geodetic position to geocentric.} + \call{CALL sla\_GEOC (P, H, R, Z)} +} +\args{GIVEN} +{ + \spec{P}{D}{latitude (geodetic, radians)} \\ + \spec{H}{D}{height above reference spheroid (geodetic, metres)} +} +\args{RETURNED} +{ + \spec{R}{D}{distance from Earth axis (AU)} \\ + \spec{Z}{D}{distance from plane of Earth equator (AU)} +} +\notes +{ + \begin{enumerate} + \item Geocentric latitude can be obtained by evaluating {\tt ATAN2(Z,R)}. + \item IAU 1976 constants are used. + \end{enumerate} +} +\aref{Green, R.M., 1985.\ {\it Spherical Astronomy}, Cambridge U.P., p98.} +%----------------------------------------------------------------------- +\routine{SLA\_GMST}{UT to GMST} +{ + \action{Conversion from universal time UT1 to Greenwich mean + sidereal time.} + \call{D~=~sla\_GMST (UT1)} +} +\args{GIVEN} +{ + \spec{UT1}{D}{universal time (strictly UT1) expressed as + modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_GMST}{D}{Greenwich mean sidereal time (radians)} +} +\notes +{ + \begin{enumerate} + \item The IAU~1982 expression + (see page~S15 of the 1984 {\it Astronomical + Almanac})\/ is used, but rearranged to reduce rounding errors. This + expression is always described as giving the GMST at $0^{\rm h}$UT; + in fact, it gives the difference between the + GMST and the UT, which happens to equal the GMST (modulo + 24~hours) at $0^{\rm h}$UT each day. In sla\_GMST, the + entire UT is used directly as the argument for the + canonical formula, and the fractional part of the UT is + added separately; note that the factor $1.0027379\cdots$ does + not appear. + \item See also the routine sla\_GMSTA, which + delivers better numerical + precision by accepting the UT date and time as separate arguments. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_GMSTA}{UT to GMST (extra precision)} +{ + \action{Conversion from universal time UT1 to Greenwich Mean + sidereal time, with rounding errors minimized.} + \call{D~=~sla\_GMSTA (DATE, UT1)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{UT1 date as Modified Julian Date (integer part + of JD$-$2400000.5)} \\ + \spec{UT1}{D}{UT1 time (fraction of a day)} +} +\args{RETURNED} +{ + \spec{sla\_GMST}{D}{Greenwich mean sidereal time (radians)} +} +\notes +{ + \begin{enumerate} + \item The algorithm is derived from the IAU 1982 expression + (see page~S15 of the 1984 Astronomical Almanac). + \item There is no restriction on how the UT is apportioned between the + DATE and UT1 arguments. Either of the two arguments could, for + example, be zero and the entire date\,+\,time supplied in the other. + However, the routine is designed to deliver maximum accuracy when + the DATE argument is a whole number and the UT1 argument + lies in the range $[\,0,\,1\,]$, or {\it vice versa}. + \item See also the routine sla\_GMST, which accepts the UT1 as a single + argument. Compared with sla\_GMST, the extra numerical precision + delivered by the present routine is unlikely to be important in + an absolute sense, but may be useful when critically comparing + algorithms and in applications where two sidereal times close + together are differenced. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_GRESID}{Gaussian Residual} +{ + \action{Generate pseudo-random normal deviate or {\it Gaussian residual}.} + \call{R~=~sla\_GRESID (S)} +} +\args{GIVEN} +{ + \spec{S}{R}{standard deviation} +} +\notes +{ + \begin{enumerate} + \item The results of many calls to this routine will be + normally distributed with mean zero and standard deviation S. + \item The Box-Muller algorithm is used. + \item The implementation is machine-dependent. + \end{enumerate} +} +\aref{Ahrens \& Dieter, 1972.\ {\it Comm.A.C.M.}\ {\bf 15}, 873.} +%----------------------------------------------------------------------- +\routine{SLA\_H2E}{Az,El to $h,\delta$} +{ + \action{Horizon to equatorial coordinates + (single precision).} + \call{CALL sla\_H2E (AZ, EL, PHI, HA, DEC)} +} +\args{GIVEN} +{ + \spec{AZ}{R}{azimuth (radians)} \\ + \spec{EL}{R}{elevation (radians)} \\ + \spec{PHI}{R}{latitude (radians)} +} +\args{RETURNED} +{ + \spec{HA}{R}{hour angle (radians)} \\ + \spec{DEC}{R}{declination (radians)} +} +\notes +{ + \begin{enumerate} + \item The sign convention for azimuth is north zero, east $+\pi/2$. + \item HA is returned in the range $\pm\pi$. Declination is returned + in the range $\pm\pi$. + \item The latitude is (in principle) geodetic. In critical + applications, corrections for polar motion should be applied + (see sla\_POLMO). + \item In some applications it will be important to specify the + correct type of elevation in order to produce the required + type of \hadec. In particular, it may be important to + distinguish between the elevation as affected by refraction, + which will yield the {\it observed} \hadec, and the elevation + {\it in vacuo}, which will yield the {\it topocentric} + \hadec. If the + effects of diurnal aberration can be neglected, the + topocentric \hadec\ may be used as an approximation to the + {\it apparent} \hadec. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_H2FK5}{Hipparcos to FK5} +{ + \action{Transform a Hipparcos star position and proper motion + into the FK5 (J2000) frame.} + \call{CALL sla\_H2FK5 (RH,DH,DRH,DDH,R5,D5,DR5,DD5)} +} +\args{GIVEN} +{ + \spec{RH}{D}{Hipparcos $\alpha$ (radians)} \\ + \spec{DH}{D}{Hipparcos $\delta$ (radians)} \\ + \spec{DRH}{D}{Hipparcos proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DDH}{D}{Hipparcos proper motion in $\delta$ + (radians per Julian year)} +} +\args{RETURNED} +{ + \spec{R5}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D5}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{DR5}{D}{J2000.0 FK5 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD5}{D}{FK5 J2000.0 proper motion in $\delta$ + (radians per Julian year)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item The FK5 to Hipparcos + transformation consists of a pure rotation and spin; + zonal errors in the FK5 catalogue are not taken into account. + \item The adopted epoch J2000.0 FK5 to Hipparcos orientation and spin + values are as follows (see reference): + + \vspace{2ex} + + ~~~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & + \multicolumn{1}{|c}{\it orientation} & + \multicolumn{1}{|c|}{\it ~~~spin~~~} \\ \hline + $x$ & $-19.9$~~~~ & ~$-0.30$~~ \\ + $y$ & $-9.1$~~~~ & ~$+0.60$~~ \\ + $z$ & $+22.9$~~~~ & ~$+0.70$~~ \\ \hline + & {\it mas}~~~~~ & ~{\it mas/y}~ \\ \hline + \end{tabular} + + \vspace{3ex} + + These orientation and spin components are interpreted as + {\it axial vectors.} An axial vector points at the pole of + the rotation and its length is the amount of rotation in radians. + \item See also sla\_FK52H, sla\_FK5HZ, sla\_HFK5Z. + \end{enumerate} +} +\aref {Feissel, M.\ \& Mignard, F., 1998., {\it Astron.Astrophys.}\ + {\bf 331}, L33-L36.} +%----------------------------------------------------------------------- +\routine{SLA\_HFK5Z}{Hipparcos to FK5, no P.M.} +{ + \action{Transform a Hipparcos star position + into the FK5 (J2000) frame assuming zero Hipparcos proper motion.} + \call{CALL sla\_HFK5Z (RH,DH,EPOCH,R5,D5,DR5,DD5)} +} +\args{GIVEN} +{ + \spec{RH}{D}{Hipparcos $\alpha$ (radians)} \\ + \spec{DH}{D}{Hipparcos $\delta$ (radians)} \\ + \spec{EPOCH}{D}{Julian epoch (TDB)} +} +\args{RETURNED} +{ + \spec{R5}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D5}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{DR5}{D}{J2000.0 FK5 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD5}{D}{FK5 J2000.0 proper motion in $\delta$ + (radians per Julian year)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item The FK5 to Hipparcos + transformation consists of a pure rotation and spin; + zonal errors in the FK5 catalogue are not taken into account. + \item The adopted epoch J2000.0 FK5 to Hipparcos orientation and spin + values are as follows (see reference): + + \vspace{2ex} + + ~~~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & + \multicolumn{1}{|c}{\it orientation} & + \multicolumn{1}{|c|}{\it ~~~spin~~~} \\ \hline + $x$ & $-19.9$~~~~ & ~$-0.30$~~ \\ + $y$ & $-9.1$~~~~ & ~$+0.60$~~ \\ + $z$ & $+22.9$~~~~ & ~$+0.70$~~ \\ \hline + & {\it mas}~~~~~ & ~{\it mas/y}~ \\ \hline + \end{tabular} + + \vspace{3ex} + + These orientation and spin components are interpreted as + {\it axial vectors.} An axial vector points at the pole of + the rotation and its length is the amount of rotation in radians. + The order of the rotations, which are very small, + \item It was the intention that Hipparcos should be a close + approximation to an inertial frame, so that distant objects + have zero proper motion; such objects have (in general) + non-zero proper motion in FK5, and this routine returns those + {\it fictitious proper motions.} + \item The position returned by this routine is in the FK5 J2000 + reference frame but at Julian epoch EPOCH. + \item See also sla\_FK52H, sla\_FK5HZ, sla\_H2FK5. + \end{enumerate} +} +\aref {Feissel, M.\ \& Mignard, F., 1998., {\it Astron.Astrophys.}\ + {\bf 331}, L33-L36.} +%----------------------------------------------------------------------- +\routine{SLA\_IMXV}{Apply 3D Reverse Rotation} +{ + \action{Multiply a 3-vector by the inverse of a rotation + matrix (single precision).} + \call{CALL sla\_IMXV (RM, VA, VB)} +} +\args{GIVEN} +{ + \spec{RM}{R(3,3)}{rotation matrix} \\ + \spec{VA}{R(3)}{vector to be rotated} +} +\args{RETURNED} +{ + \spec{VB}{R(3)}{result vector} +} +\notes +{ + \begin{enumerate} + \item This routine performs the operation: + \begin{verse} + {\bf b} = {\bf M}$^{T}\cdot${\bf a} + \end{verse} + where {\bf a} and {\bf b} are the 3-vectors VA and VB + respectively, and {\bf M} is the $3\times3$ matrix RM. + \item The main function of this routine is apply an inverse + rotation; under these circumstances, ${\bf M}$ is + {\it orthogonal}, with its inverse the same as its transpose. + \item To comply with the ANSI Fortran 77 standard, VA and VB must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly on the VAX and many other systems even + if this rule is violated, something that is {\bf not}, however, + recommended. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_INTIN}{Decode an Integer Number} +{ + \action{Convert free-format input into an integer.} + \call{CALL sla\_INTIN (STRING, NSTRT, IRESLT, JFLAG)} +} +\args{GIVEN} +{ + \spec{STRING}{C}{string containing number to be decoded} \\ + \spec{NSTRT}{I}{pointer to where decoding is to commence} \\ + \spec{IRESLT}{I}{current value of result} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced to next number} \\ + \spec{IRESLT}{I}{result} \\ + \spec{JFLAG}{I}{status: $-$1 = $-$OK, 0~=~+OK, 1~=~null result, 2~=~error} +} +\notes +{ + \begin{enumerate} + \item The reason sla\_INTIN has separate `OK' status values + for + and $-$ is to enable minus zero to be detected. + This is of crucial importance + when decoding mixed-radix numbers. For example, an angle + expressed as degrees, arcminutes and arcseconds may have a + leading minus sign but a zero degrees field. + \item A TAB is interpreted as a space. {\it n.b.}\ The test for TAB is + ASCII-specific. + \item The basic format is the sequence of fields $\pm n$, + where $\pm$ is a sign + character `+' or `$-$', and $n$ means a string of decimal digits. + \item Spaces: + \begin{itemize} + \item Leading spaces are ignored. + \item Spaces between the sign and the number are allowed. + \item Trailing spaces are ignored; the first signifies + end of decoding and subsequent ones are skipped. + \end{itemize} + \item Delimiters: + \begin{itemize} + \item Any character other than +,$-$,0-9 or space may be + used to signal the end of the number and terminate decoding. + \item Comma is recognized by sla\_INTIN as a special case; it + is skipped, leaving the pointer on the next character. See + 9, below. + \item Decoding will in all cases terminate if end of string + is reached. + \end{itemize} + \item The sign is optional. The default is +. + \item A {\it null result}\/ occurs when the string of characters + being decoded does not begin with +,$-$ or 0-9, or + consists entirely of spaces. When this condition is + detected, JFLAG is set to 1 and IRESLT is left untouched. + \item NSTRT = 1 for the first character in the string. + \item On return from sla\_INTIN, NSTRT is set ready for the next + decode -- following trailing blanks and any comma. If a + delimiter other than comma is being used, NSTRT must be + incremented before the next call to sla\_INTIN, otherwise + all subsequent calls will return a null result. + \item Errors (JFLAG=2) occur when: + \begin{itemize} + \item there is a + or $-$ but no number; or + \item the number is greater than $2^{31}-1$. + \end{itemize} + \item When an error has been detected, NSTRT is left + pointing to the character following the last + one used before the error came to light. + \item See also sla\_FLOTIN and sla\_DFLTIN. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_INVF}{Invert Linear Model} +{ + \action{Invert a linear model of the type produced by the + sla\_FITXY routine.} + \call{CALL sla\_INVF (FWDS,BKWDS,J)} +} +\args{GIVEN} +{ + \spec{FWDS}{D(6)}{model coefficients} +} +\args{RETURNED} +{ + \spec{BKWDS}{D(6)}{inverse model} \\ + \spec{J}{I}{status: 0 = OK, $-$1 = no inverse} +} +\notes +{ + \begin{enumerate} + \item The models relate two sets of \xy\ coordinates as follows. + Naming the six elements of FWDS $a,b,c,d,e$ \& $f$, + where two sets of coordinates $[x_{1},y_{1}]$ and + $[x_{2},y_{2}\,]$ are related thus: + \begin{verse} + $x_{2} = a + bx_{1} + cy_{1}$ \\ + $y_{2} = d + ex_{1} + fy_{1}$ + \end{verse} + The present routine generates a new set of coefficients + $p,q,r,s,t$ \& $u$ (the array BKWDS) such that: + \begin{verse} + $x_{1} = p + qx_{2} + ry_{2}$ \\ + $y_{1} = s + tx_{2} + uy_{2}$ + \end{verse} + \item Two successive calls to this routine will deliver a set + of coefficients equal to the starting values. + \item To comply with the ANSI Fortran 77 standard, FWDS and BKWDS must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly on the VAX and many other systems even + if this rule is violated, something that is {\bf not}, however, + recommended. + \item See also sla\_FITXY, sla\_PXY, sla\_XY2XY, sla\_DCMPF. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_KBJ}{Select Epoch Prefix} +{ + \action{Select epoch prefix `B' or `J'.} + \call{CALL sla\_KBJ (JB, E, K, J)} +} +\args{GIVEN} +{ + \spec{JB}{I}{sla\_DBJIN prefix status: 0=none, 1=`B', 2=`J'} \\ + \spec{E}{D}{epoch -- Besselian or Julian} +} +\args{RETURNED} +{ + \spec{K}{C}{`B' or `J'} \\ + \spec{J}{I}{status: 0=OK} +} +\anote{The routine is mainly intended for use in conjunction with the + sla\_DBJIN routine. If the value of JB indicates that an explicit + B or J prefix was detected by sla\_DBJIN, a `B' or `J' + is returned to match. If JB indicates that no explicit B or J + was supplied, the choice is made on the basis of the epoch + itself; B is assumed for E $<1984$, otherwise J.} +%----------------------------------------------------------------------- +\routine{SLA\_M2AV}{Rotation Matrix to Axial Vector} +{ + \action{From a rotation matrix, determine the corresponding axial vector + (single precision).} + \call{CALL sla\_M2AV (RMAT, AXVEC)} +} +\args{GIVEN} +{ + \spec{RMAT}{R(3,3)}{rotation matrix} +} +\args{RETURNED} +{ + \spec{AXVEC}{R(3)}{axial vector (radians)} +} +\notes +{ + \begin{enumerate} + \item A rotation matrix describes a rotation about some arbitrary axis. + The axis is called the {\it Euler axis}, and the angle through + which the reference frame rotates is called the {\it Euler angle}. + The {\it axial vector}\/ returned by this routine has the same + direction as the Euler axis, and its magnitude is the Euler angle + in radians. + \item The magnitude and direction of the axial vector can be separated + by means of the routine sla\_VN. + \item The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + \item If RMAT is null, so is the result. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MAP}{Mean to Apparent} +{ + \action{Transform star \radec\ from mean place to geocentric apparent. + The reference frames and timescales used are post IAU~1976.} + \call{CALL sla\_MAP (RM, DM, PR, PD, PX, RV, EQ, DATE, RA, DA)} +} +\args{GIVEN} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} \\ + \spec{PR,PD}{D}{proper motions: \radec\ changes per Julian year} \\ + \spec{PX}{D}{parallax (arcsec)} \\ + \spec{RV}{D}{radial velocity (km~s$^{-1}$, +ve if receding)} \\ + \spec{EQ}{D}{epoch and equinox of star data (Julian)} \\ + \spec{DATE}{D}{TDB for apparent place (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{RA,DA}{D}{apparent \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item EQ is the Julian epoch specifying both the reference + frame and the epoch of the position -- usually 2000. + For positions where the epoch and equinox are + different, use the routine sla\_PM to apply proper + motion corrections before using this routine. + \item The distinction between the required TDB and TT is + always negligible. Moreover, for all but the most + critical applications UTC is adequate. + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item This routine may be wasteful for some applications + because it recomputes the Earth position/velocity and + the precession/nutation matrix each time, and because + it allows for parallax and proper motion. Where + multiple transformations are to be carried out for one + epoch, a faster method is to call the sla\_MAPPA routine + once and then either the sla\_MAPQK routine (which includes + parallax and proper motion) or sla\_MAPQKZ (which assumes + zero parallax and FK5 proper motion). + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MAPPA}{Mean to Apparent Parameters} +{ + \action{Compute star-independent parameters in preparation for + conversions between mean place and geocentric apparent place. + The parameters produced by this routine are required in the + parallax, light deflection, aberration, and precession/nutation + parts of the mean/apparent transformations. + The reference frames and timescales used are post IAU~1976.} + \call{CALL sla\_MAPPA (EQ, DATE, AMPRMS)} +} +\args{GIVEN} +{ + \spec{EQ}{D}{epoch of mean equinox to be used (Julian)} \\ + \spec{DATE}{D}{TDB (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{AMPRMS}{D(21)}{star-independent mean-to-apparent parameters:} \\ + \specel {(1)} {time interval for proper motion (Julian years)} \\ + \specel {(2-4)} {barycentric position of the Earth (AU)} \\ + \specel {(5-7)} {heliocentric direction of the Earth (unit vector)} \\ + \specel {(8)} {(gravitational radius of + Sun)$\times 2 / $(Sun-Earth distance)} \\ + \specel {(9-11)} {{\bf v}: barycentric Earth velocity in units of c} \\ + \specel {(12)} {$\sqrt{1-\left|\mbox{\bf v}\right|^2}$} \\ + \specel {(13-21)} {precession/nutation $3\times3$ matrix} +} +\notes +{ + \begin{enumerate} + \item For DATE, the distinction between the required TDB and TT + is always negligible. Moreover, for all but the most + critical applications UTC is adequate. + \item The accuracy of the routines using the parameters AMPRMS is + limited by the routine sla\_EVP, used here to compute the + Earth position and velocity by the methods of Stumpff. + The maximum error in the resulting aberration corrections is + about 0.3 milliarcsecond. + \item The vectors AMPRMS(2-4) and AMPRMS(5-7) are referred to + the mean equinox and equator of epoch EQ. + \item The parameters produced by this routine are used by + sla\_MAPQK and sla\_MAPQKZ. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MAPQK}{Quick Mean to Apparent} +{ + \action{Quick mean to apparent place: transform a star \radec\ from + mean place to geocentric apparent place, given the + star-independent parameters. The reference frames and + timescales used are post IAU 1976.} + \call{CALL sla\_MAPQK (RM, DM, PR, PD, PX, RV, AMPRMS, RA, DA)} +} +\args{GIVEN} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} \\ + \spec{PR,PD}{D}{proper motions: \radec\ changes per Julian year} \\ + \spec{PX}{D}{parallax (arcsec)} \\ + \spec{RV}{D}{radial velocity (km~s$^{-1}$, +ve if receding)} \\ + \spec{AMPRMS}{D(21)}{star-independent mean-to-apparent parameters:} \\ + \specel {(1)} {time interval for proper motion (Julian years)} \\ + \specel {(2-4)} {barycentric position of the Earth (AU)} \\ + \specel {(5-7)} {heliocentric direction of the Earth (unit vector)} \\ + \specel {(8)} {(gravitational radius of + Sun)$\times 2 / $(Sun-Earth distance)} \\ + \specel {(9-11)} {{\bf v}: barycentric Earth velocity in units of c} \\ + \specel {(12)} {$\sqrt{1-\left|\mbox{\bf v}\right|^2}$} \\ + \specel {(13-21)} {precession/nutation $3\times3$ matrix} +} +\args{RETURNED} +{ + \spec{RA,DA}{D }{apparent \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item Use of this routine is appropriate when efficiency is important + and where many star positions, all referred to the same equator + and equinox, are to be transformed for one epoch. The + star-independent parameters can be obtained by calling the + sla\_MAPPA routine. + \item If the parallax and proper motions are zero the sla\_MAPQKZ + routine can be used instead. + \item The vectors AMPRMS(2-4) and AMPRMS(5-7) are referred to + the mean equinox and equator of epoch EQ. + \item Strictly speaking, the routine is not valid for solar-system + sources, though the error will usually be extremely small. + However, to prevent gross errors in the case where the + position of the Sun is specified, the gravitational + deflection term is restrained within about \arcseci{920} of the + centre of the Sun's disc. The term has a maximum value of + about \arcsec{1}{85} at this radius, and decreases to zero as + the centre of the disc is approached. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MAPQKZ}{Quick Mean-Appt, no PM {\it etc.}} +{ + \action{Quick mean to apparent place: transform a star \radec\ from + mean place to geocentric apparent place, given the + star-independent parameters, and assuming zero parallax + and FK5 proper motion. + The reference frames and timescales used are post IAU~1976.} + \call{CALL sla\_MAPQKZ (RM, DM, AMPRMS, RA, DA)} +} +\args{GIVEN} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} \\ + \spec{AMPRMS}{D(21)}{star-independent mean-to-apparent parameters:} \\ + \specel {(1)} {time interval for proper motion (Julian years)} \\ + \specel {(2-4)} {barycentric position of the Earth (AU)} \\ + \specel {(5-7)} {heliocentric direction of the Earth (unit vector)} \\ + \specel {(8)} {(gravitational radius of + Sun)$\times 2 / $(Sun-Earth distance)} \\ + \specel {(9-11)} {{\bf v}: barycentric Earth velocity in units of c} \\ + \specel {(12)} {$\sqrt{1-\left|\mbox{\bf v}\right|^2}$} \\ + \specel {(13-21)} {precession/nutation $3\times3$ matrix} +} +\args{RETURNED} +{ + \spec{RA,DA}{D}{apparent \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item Use of this routine is appropriate when efficiency is important + and where many star positions, all with parallax and proper + motion either zero or already allowed for, and all referred to + the same equator and equinox, are to be transformed for one + epoch. The star-independent parameters can be obtained by + calling the sla\_MAPPA routine. + \item The corresponding routine for the case of non-zero parallax + and FK5 proper motion is sla\_MAPQK. + \item The vectors AMPRMS(2-4) and AMPRMS(5-7) are referred to the + mean equinox and equator of epoch EQ. + \item Strictly speaking, the routine is not valid for solar-system + sources, though the error will usually be extremely small. + However, to prevent gross errors in the case where the + position of the Sun is specified, the gravitational + deflection term is restrained within about \arcseci{920} of the + centre of the Sun's disc. The term has a maximum value of + about \arcsec{1}{85} at this radius, and decreases to zero as + the centre of the disc is approached. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MOON}{Approx Moon Pos/Vel} +{ + \action{Approximate geocentric position and velocity of the Moon + (single precision).} + \call{CALL sla\_MOON (IY, ID, FD, PV)} +} +\args{GIVEN} +{ + \spec{IY}{I}{year} \\ + \spec{ID}{I}{day in year (1 = Jan 1st)} \\ + \spec{FD}{R }{fraction of day} +} +\args{RETURNED} +{ + \spec{PV}{R(6)}{Moon \xyzxyzd, mean equator and equinox of + date (AU, AU~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item The date and time is TDB (loosely ET) in a Julian calendar + which has been aligned to the ordinary Gregorian + calendar for the interval 1900 March 1 to 2100 February 28. + The year and day can be obtained by calling sla\_CALYD or + sla\_CLYD. + \item The position is accurate to better than 0.5~arcminute + in direction and 1000~km in distance. The velocity + is accurate to better than \arcsec{0}{5} per hour in direction + and 4~metres per socond in distance. (RMS figures with respect + to JPL DE200 for the interval 1960-2025 are \arcseci{14} and + \arcsec{0}{2} per hour in longitude, \arcseci{9} and \arcsec{0}{2} + per hour in latitude, 350~km and 2~metres per second in distance.) + Note that the distance accuracy is comparatively poor because this + routine is principally intended for computing topocentric direction. + \item This routine is only a partial implementation of the original + Meeus algorithm (reference below), which offers 4 times the + accuracy in direction and 20 times the accuracy in distance + when fully implemented (as it is in sla\_DMOON). + \end{enumerate} +} +\aref{Meeus, {\it l'Astronomie}, June 1984, p348.} +%----------------------------------------------------------------------- +\routine{SLA\_MXM}{Multiply $3\times3$ Matrices} +{ + \action{Product of two $3\times3$ matrices (single precision).} + \call{CALL sla\_MXM (A, B, C)} +} +\args{GIVEN} +{ + \spec{A}{R(3,3)}{matrix {\bf A}} \\ + \spec{B}{R(3,3)}{matrix {\bf B}} +} +\args{RETURNED} +{ + \spec{C}{R(3,3)}{matrix result: {\bf A}$\times${\bf B}} +} +\anote{To comply with the ANSI Fortran 77 standard, A, B and C must + be different arrays. The routine is, in fact, coded + so as to work properly on the VAX and many other systems even + if this rule is violated, something that is {\bf not}, however, + recommended.} +%----------------------------------------------------------------------- +\routine{SLA\_MXV}{Apply 3D Rotation} +{ + \action{Multiply a 3-vector by a rotation matrix (single precision).} + \call{CALL sla\_MXV (RM, VA, VB)} +} +\args{GIVEN} +{ + \spec{RM}{R(3,3)}{rotation matrix} \\ + \spec{VA}{R(3)}{vector to be rotated} +} +\args{RETURNED} +{ + \spec{VB}{R(3)}{result vector} +} +\notes +{ + \begin{enumerate} + \item This routine performs the operation: + \begin{verse} + {\bf b} = {\bf M}$\cdot${\bf a} + \end{verse} + where {\bf a} and {\bf b} are the 3-vectors VA and VB + respectively, and {\bf M} is the $3\times3$ matrix RM. + \item The main function of this routine is apply a + rotation; under these circumstances, ${\bf M}$ is a + {\it proper real orthogonal}\/ matrix. + \item To comply with the ANSI Fortran 77 standard, VA and VB must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly on the VAX and many other systems even + if this rule is violated, something that is {\bf not}, however, + recommended. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_NUT}{Nutation Matrix} +{ + \action{Form the matrix of nutation (IAU 1980 theory) for a given date.} + \call{CALL sla\_NUT (DATE, RMATN)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date + (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{RMATN}{D(3,3)}{nutation matrix} +} +\anote{The matrix is in the sense: + \begin{verse} + {\bf v}$_{true}$ = {\bf M}$\cdot${\bf v}$_{mean}$ + \end{verse} + where {\bf v}$_{true}$ is the star vector relative to the + true equator and equinox of date, {\bf M} is the + $3\times3$ matrix RMATN and + {\bf v}$_{mean}$ is the star vector relative to the + mean equator and equinox of date.} +\refs +{ + \begin{enumerate} + \item Final report of the IAU Working Group on Nutation, + chairman P.K.Seidelmann, 1980. + \item Kaplan, G.H., 1981.\ {\it USNO circular No.\ 163}, pA3-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_NUTC}{Nutation Components} +{ + \action{Nutation (IAU 1980 theory): longitude \& obliquity + components, and mean obliquity.} + \call{CALL sla\_NUTC (DATE, DPSI, DEPS, EPS0)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date + (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{DPSI,DEPS}{D}{nutation in longitude and obliquity (radians)} \\ + \spec{EPS0}{D}{mean obliquity (radians)} +} +\refs +{ + \begin{enumerate} + \item Final report of the IAU Working Group on Nutation, + chairman P.K.Seidelmann, 1980. + \item Kaplan, G.H., 1981.\ {\it USNO circular no.\ 163}, pA3-6. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_OAP}{Observed to Apparent} +{ + \action{Observed to apparent place.} + \call{CALL sla\_OAP (\vtop{ + \hbox{TYPE, OB1, OB2, DATE, DUT, ELONGM, PHIM,} + \hbox{HM, XP, YP, TDK, PMB, RH, WL, TLR, RAP, DAP)}}} +} +\args{GIVEN} +{ + \spec{TYPE}{C*(*)}{type of coordinates -- `R', `H' or `A' (see below)} \\ + \spec{OB1}{D}{observed Az, HA or RA (radians; Az is N=0, E=$90^{\circ}$)} \\ + \spec{OB2}{D}{observed zenith distance or $\delta$ (radians)} \\ + \spec{DATE}{D }{UTC date/time (Modified Julian Date, JD$-$2400000.5)} \\ + \spec{DUT}{D}{$\Delta$UT: UT1$-$UTC (UTC seconds)} \\ + \spec{ELONGM}{D}{observer's mean longitude (radians, east +ve)} \\ + \spec{PHIM}{D}{observer's mean geodetic latitude (radians)} \\ + \spec{HM}{D}{observer's height above sea level (metres)} \\ + \spec{XP,YP}{D}{polar motion \xy\ coordinates (radians)} \\ + \spec{TDK}{D}{local ambient temperature (degrees K; std=273.155D0)} \\ + \spec{PMB}{D}{local atmospheric pressure (mB; std=1013.25D0)} \\ + \spec{RH}{D}{local relative humidity (in the range 0D0\,--\,1D0)} \\ + \spec{WL}{D}{effective wavelength ($\mu{\rm m}$, {\it e.g.}\ 0.55D0)} \\ + \spec{TLR}{D}{tropospheric lapse rate (degrees K per metre, + {\it e.g.}\ 0.0065D0)} +} +\args{RETURNED} +{ + \spec{RAP,DAP}{D}{geocentric apparent \radec} +} +\notes +{ + \begin{enumerate} + \item Only the first character of the TYPE argument is significant. + `R' or `r' indicates that OBS1 and OBS2 are the observed Right + Ascension and Declination; `H' or `h' indicates that they are + Hour Angle (west +ve) and Declination; anything else (`A' or + `a' is recommended) indicates that OBS1 and OBS2 are Azimuth + (north zero, east is $90^{\circ}$) and Zenith Distance. (Zenith + distance is used rather than elevation in order to reflect the + fact that no allowance is made for depression of the horizon.) + \item The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted azimuth and elevation should be within about + \arcsec{0}{1} for $\zeta<70^{\circ}$. Even + at a topocentric zenith distance of + $90^{\circ}$, the accuracy in elevation should be better than + 1~arcminute; useful results are available for a further + $3^{\circ}$, beyond which the sla\_REFRO routine returns a + fixed value of the refraction. The complementary + routines sla\_AOP (or sla\_AOPQK) and sla\_OAP (or sla\_OAPQK) + are self-consistent to better than 1~microarcsecond all over + the celestial sphere. + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item {\it Observed}\/ \azel\ means the position that would be seen by a + perfect theodolite located at the observer. This is + related to the observed \hadec\ via the standard rotation, using + the geodetic latitude (corrected for polar motion), while the + observed HA and RA are related simply through the local + apparent ST. {\it Observed}\/ \radec\ or \hadec\ thus means the + position that would be seen by a perfect equatorial located + at the observer and with its polar axis aligned to the + Earth's axis of rotation ({\it n.b.}\ not to the refracted pole). + By removing from the observed place the effects of + atmospheric refraction and diurnal aberration, the + geocentric apparent \radec\ is obtained. + \item Frequently, {\it mean}\/ rather than {\it apparent}\, + \radec\ will be required, + in which case further transformations will be necessary. The + sla\_AMP {\it etc.}\ routines will convert + the apparent \radec\ produced + by the present routine into an FK5 J2000 mean place, by + allowing for the Sun's gravitational lens effect, annual + aberration, nutation and precession. Should FK4 B1950 + coordinates be needed, the routines sla\_FK524 {\it etc.}\ will also + need to be applied. + \item To convert to apparent \radec\ the coordinates read from a + real telescope, corrections would have to be applied for + encoder zero points, gear and encoder errors, tube flexure, + the position of the rotator axis and the pointing axis + relative to it, non-perpendicularity between the mounting + axes, and finally for the tilt of the azimuth or polar axis + of the mounting (with appropriate corrections for mount + flexures). Some telescopes would, of course, exhibit other + properties which would need to be accounted for at the + appropriate point in the sequence. + \item The star-independent apparent-to-observed-place parameters + in AOPRMS may be computed by means of the sla\_AOPPA routine. + If nothing has changed significantly except the time, the + sla\_AOPPAT routine may be used to perform the requisite + partial recomputation of AOPRMS. + \item The DATE argument is UTC expressed as an MJD. This is, + strictly speaking, wrong, because of leap seconds. However, + as long as the $\Delta$UT and the UTC are consistent there + are no difficulties, except during a leap second. In this + case, the start of the 61st second of the final minute should + begin a new MJD day and the old pre-leap $\Delta$UT should + continue to be used. As the 61st second completes, the MJD + should revert to the start of the day as, simultaneously, + the $\Delta$UT changes by one second to its post-leap new value. + \item The $\Delta$UT (UT1$-$UTC) is tabulated in IERS circulars and + elsewhere. It increases by exactly one second at the end of + each UTC leap second, introduced in order to keep $\Delta$UT + within $\pm$\tsec{0}{9}. + \item IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. The + longitude required by the present routine is {\bf east-positive}, + in accordance with geographical convention (and right-handed). + In particular, note that the longitudes returned by the + sla\_OBS routine are west-positive (as in the {\it Astronomical + Almanac}\/ before 1984) and must be reversed in sign before use + in the present routine. + \item The polar coordinates XP,YP can be obtained from IERS + circulars and equivalent publications. The + maximum amplitude is about \arcsec{0}{3}. If XP,YP values + are unavailable, use XP=YP=0D0. See page B60 of the 1988 + {\it Astronomical Almanac}\/ for a definition of the two angles. + \item The height above sea level of the observing station, HM, + can be obtained from the {\it Astronomical Almanac}\/ (Section J + in the 1988 edition), or via the routine sla\_OBS. If P, + the pressure in mB, is available, an adequate + estimate of HM can be obtained from the following expression: + \begin{quote} + {\tt HM=-29.3D0*TSL*LOG(P/1013.25D0)} + \end{quote} + where TSL is the approximate sea-level air temperature in degrees K + (see {\it Astrophysical Quantities}, C.W.Allen, 3rd~edition, + \S 52.) Similarly, if the pressure P is not known, + it can be estimated from the height of the observing + station, HM as follows: + \begin{quote} + {\tt P=1013.25D0*EXP(-HM/(29.3D0*TSL))} + \end{quote} + Note, however, that the refraction is proportional to the + pressure and that an accurate P value is important for + precise work. + \item The azimuths {\it etc.}\ used by the present routine are with + respect to the celestial pole. Corrections from the terrestrial pole + can be computed using sla\_POLMO. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_OAPQK}{Quick Observed to Apparent} +{ + \action{Quick observed to apparent place.} + \call{CALL sla\_OAPQK (TYPE, OB1, OB2, AOPRMS, RAP, DAP)} +} +\args{GIVEN} +{ + \spec{TYPE}{C*(*)}{type of coordinates -- `R', `H' or `A' (see below)} \\ + \spec{OB1}{D}{observed Az, HA or RA (radians; Az is N=0, E=$90^{\circ}$)} \\ + \spec{OB2}{D}{observed zenith distance or $\delta$ (radians)} \\ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel {(1)} {geodetic latitude (radians)} \\ + \specel {(2,3)} {sine and cosine of geodetic latitude} \\ + \specel {(4)} {magnitude of diurnal aberration vector} \\ + \specel {(5)} {height (HM)} \\ + \specel {(6)} {ambient temperature (TDK)} \\ + \specel {(7)} {pressure (PMB)} \\ + \specel {(8)} {relative humidity (RH)} \\ + \specel {(9)} {wavelength (WL)} \\ + \specel {(10)} {lapse rate (TLR)} \\ + \specel {(11,12)} {refraction constants A and B (radians)} \\ + \specel {(13)} {longitude + eqn of equinoxes + + ``sidereal $\Delta$UT'' (radians)} \\ + \specel {(14)} {local apparent sidereal time (radians)} +} +\args{RETURNED} +{ + \spec{RAP,DAP}{D}{geocentric apparent \radec} +} +\notes +{ + \begin{enumerate} + \item Only the first character of the TYPE argument is significant. + `R' or `r' indicates that OBS1 and OBS2 are the observed Right + Ascension and Declination; `H' or `h' indicates that they are + Hour Angle (west +ve) and Declination; anything else (`A' or + `a' is recommended) indicates that OBS1 and OBS2 are Azimuth + (north zero, east is $90^{\circ}$) and Zenith Distance. (Zenith + distance is used rather than elevation in order to reflect the + fact that no allowance is made for depression of the horizon.) + \item The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted azimuth and elevation should be within about + \arcsec{0}{1} for $\zeta<70^{\circ}$. Even + at a topocentric zenith distance of + $90^{\circ}$, the accuracy in elevation should be better than + 1~arcminute; useful results are available for a further + $3^{\circ}$, beyond which the sla\_REFRO routine returns a + fixed value of the refraction. The complementary + routines sla\_AOP (or sla\_AOPQK) and sla\_OAP (or sla\_OAPQK) + are self-consistent to better than 1~microarcsecond all over + the celestial sphere. + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item {\it Observed}\/ \azel\ means the position that would be seen by a + perfect theodolite located at the observer. This is + related to the observed \hadec\ via the standard rotation, using + the geodetic latitude (corrected for polar motion), while the + observed HA and RA are related simply through the local + apparent ST. {\it Observed}\/ \radec\ or \hadec\ thus means the + position that would be seen by a perfect equatorial located + at the observer and with its polar axis aligned to the + Earth's axis of rotation ({\it n.b.}\ not to the refracted pole). + By removing from the observed place the effects of + atmospheric refraction and diurnal aberration, the + geocentric apparent \radec\ is obtained. + \item Frequently, {\it mean}\/ rather than {\it apparent}\, + \radec\ will be required, + in which case further transformations will be necessary. The + sla\_AMP {\it etc.}\ routines will convert + the apparent \radec\ produced + by the present routine into an FK5 J2000 mean place, by + allowing for the Sun's gravitational lens effect, annual + aberration, nutation and precession. Should FK4 B1950 + coordinates be needed, the routines sla\_FK524 {\it etc.}\ will also + need to be applied. + \item To convert to apparent \radec\ the coordinates read from a + real telescope, corrections would have to be applied for + encoder zero points, gear and encoder errors, tube flexure, + the position of the rotator axis and the pointing axis + relative to it, non-perpendicularity between the mounting + axes, and finally for the tilt of the azimuth or polar axis + of the mounting (with appropriate corrections for mount + flexures). Some telescopes would, of course, exhibit other + properties which would need to be accounted for at the + appropriate point in the sequence. + \item The star-independent apparent-to-observed-place parameters + in AOPRMS may be computed by means of the sla\_AOPPA routine. + If nothing has changed significantly except the time, the + sla\_AOPPAT routine may be used to perform the requisite + partial recomputation of AOPRMS. + \item The azimuths {\it etc.}\ used by the present routine are with + respect to the celestial pole. Corrections from the terrestrial pole + can be computed using sla\_POLMO. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_OBS}{Observatory Parameters} +{ + \action{Look up an entry in a standard list of + groundbased observing stations parameters.} + \call{CALL sla\_OBS (N, C, NAME, W, P, H)} +} +\args{GIVEN} +{ + \spec{N}{I}{number specifying observing station} +} +\args{GIVEN or RETURNED} +{ + \spec{C}{C*(*)}{identifier specifying observing station} +} +\args{RETURNED} +{ + \spec{NAME}{C*(*)}{name of specified observing station} \\ + \spec{W}{D}{longitude (radians, west +ve)} \\ + \spec{P}{D}{geodetic latitude (radians, north +ve)} \\ + \spec{H}{D}{height above sea level (metres)} +} +\notes +{ + \begin{enumerate} + \item Station identifiers C may be up to 10 characters long, + and station names NAME may be up to 40 characters long. + \item C and N are {\it alternative}\/ ways of specifying the observing + station. The C option, which is the most generally useful, + may be selected by specifying an N value of zero or less. + If N is 1 or more, the parameters of the Nth station + in the currently supported list are interrogated, and + the station identifier C is returned as well as NAME, W, + P and H. + \item If the station parameters are not available, either because + the station identifier C is not recognized, or because an + N value greater than the number of stations supported is + given, a name of `?' is returned and W, P and H are left in + their current states. + \item Programs can obtain a list of all currently supported + stations by calling the routine repeatedly, with N=1,2,3... + When NAME=`?' is seen, the list of stations has been + exhausted. The stations at the time of writing are listed + below. + \item Station numbers, identifiers, names and other details are + subject to change and should not be hardwired into + application programs. + \item All station identifiers C are uppercase only; lower case + characters must be converted to uppercase by the calling + program. The station names returned may contain both upper- + and lowercase. All characters up to the first space are + checked; thus an abbreviated ID will return the parameters + for the first station in the list which matches the + abbreviation supplied, and no station in the list will ever + contain embedded spaces. C must not have leading spaces. + \item IMPORTANT -- BEWARE OF THE LONGITUDE SIGN CONVENTION. The + longitude returned by sla\_OBS is + {\bf west-positive}, following the pre-1984 {\it Astronomical + Almanac}. However, this sign convention is left-handed and is + the opposite of the one now used; elsewhere in + SLALIB the preferable east-positive convention is used. In + particular, note that for use in sla\_AOP, sla\_AOPPA and + sla\_OAP the sign of the longitude must be reversed. + \item Users are urged to inform the author of any improvements + they would like to see made. For example: + \begin{itemize} + \item typographical corrections + \item more accurate parameters + \item better station identifiers or names + \item additional stations + \end{itemize} + \end{enumerate} +Stations supported by sla\_OBS at the time of writing: +\begin{tabbing} +xxxxxxxxxxxxxxxxx \= \kill +{\it ID} \> {\it NAME} \\ \\ +AAT \> Anglo-Australian 3.9m Telescope \\ +ANU2.3 \> Siding Spring 2.3 metre \\ +APO3.5 \> Apache Point 3.5m \\ +ARECIBO \> Arecibo 1000 foot \\ +ATCA \> Australia Telescope Compact Array \\ +BLOEMF \> Bloemfontein 1.52 metre \\ +BOSQALEGRE \> Bosque Alegre 1.54 metre \\ +CAMB1MILE \> Cambridge 1 mile \\ +CAMB5KM \> Cambridge 5km \\ +CATALINA61 \> Catalina 61 inch \\ +CFHT \> Canada-France-Hawaii 3.6m Telescope \\ +CSO \> Caltech Sub-mm Observatory, Mauna Kea \\ +DAO72 \> DAO Victoria BC 1.85 metre \\ +DUNLAP74 \> David Dunlap 74 inch \\ +DUPONT \> Du Pont 2.5m Telescope, Las Campanas \\ +EFFELSBERG \> Effelsberg 100 metre \\ +ESO3.6 \> ESO 3.6 metre \\ +ESONTT \> ESO 3.5 metre NTT \\ +ESOSCHM \> ESO 1 metre Schmidt, La Silla \\ +FCRAO \> Five College Radio Astronomy Obs \\ +FLAGSTF61 \> USNO 61 inch astrograph, Flagstaff \\ +GBVA140 \> Greenbank 140 foot \\ +GBVA300 \> Greenbank 300 foot \\ +GEMININ \> Gemini North 8-m telescope \\ +HARVARD \> Harvard College Observatory 1.55m \\ +HPROV1.52 \> Haute Provence 1.52 metre \\ +HPROV1.93 \> Haute Provence 1.93 metre \\ +IRTF \> NASA IR Telescope Facility, Mauna Kea \\ +JCMT \> JCMT 15 metre \\ +JODRELL1 \> Jodrell Bank 250 foot \\ +KECK1 \> Keck 10m Telescope 1 \\ +KECK2 \> Keck 10m Telescope 2 \\ +KISO \> Kiso 1.05 metre Schmidt, Japan \\ +KOTTAMIA \> Kottamia 74 inch \\ +KPNO158 \> Kitt Peak 158 inch \\ +KPNO36FT \> Kitt Peak 36 foot \\ +KPNO84 \> Kitt Peak 84 inch \\ +KPNO90 \> Kitt Peak 90 inch \\ +LICK120 \> Lick 120 inch \\ +LOWELL72 \> Perkins 72 inch, Lowell \\ +LPO1 \> Jacobus Kapteyn 1m Telescope \\ +LPO2.5 \> Isaac Newton 2.5m Telescope \\ +LPO4.2 \> William Herschel 4.2m Telescope \\ +MAUNAK88 \> Mauna Kea 88 inch \\ +MCDONLD2.1 \> McDonald 2.1 metre \\ +MCDONLD2.7 \> McDonald 2.7 metre \\ +MMT \> MMT, Mt Hopkins \\ +MOPRA \> ATNF Mopra Observatory \\ +MTEKAR \> Mt Ekar 1.82 metre \\ +MTHOP1.5 \> Mt Hopkins 1.5 metre \\ +MTLEMMON60 \> Mt Lemmon 60 inch \\ +NOBEYAMA \> Nobeyama 45 metre \\ +OKAYAMA \> Okayama 1.88 metre \\ +PALOMAR200 \> Palomar 200 inch \\ +PALOMAR48 \> Palomar 48-inch Schmidt \\ +PALOMAR60 \> Palomar 60 inch \\ +PARKES \> Parkes 64 metre \\ +QUEBEC1.6 \> Quebec 1.6 metre \\ +SAAO74 \> Sutherland 74 inch \\ +SANPM83 \> San Pedro Martir 83 inch \\ +ST.ANDREWS \> St Andrews University Observatory \\ +STEWARD90 \> Steward 90 inch \\ +STROMLO74 \> Mount Stromlo 74 inch \\ +SUBARU \> Subaru 8 metre \\ +SUGARGROVE \> Sugar Grove 150 foot \\ +TAUTNBG \> Tautenburg 2 metre \\ +TAUTSCHM \> Tautenberg 1.34 metre Schmidt \\ +TIDBINBLA \> Tidbinbilla 64 metre \\ +TOLOLO1.5M \> Cerro Tololo 1.5 metre \\ +TOLOLO4M \> Cerro Tololo 4 metre \\ +UKIRT \> UK Infra Red Telescope \\ +UKST \> UK 1.2 metre Schmidt, Siding Spring \\ +USSR6 \> USSR 6 metre \\ +USSR600 \> USSR 600 foot \\ +VLA \> Very Large Array +\end{tabbing} +} +%----------------------------------------------------------------------- +\routine{SLA\_PA}{$h,\delta$ to Parallactic Angle} +{ + \action{Hour angle and declination to parallactic angle + (double precision).} + \call{D~=~sla\_PA (HA, DEC, PHI)} +} +\args{GIVEN} +{ + \spec{HA}{D}{hour angle in radians (geocentric apparent)} \\ + \spec{DEC}{D}{declination in radians (geocentric apparent)} \\ + \spec{PHI}{D}{latitude in radians (geodetic)} +} +\args{RETURNED} +{ + \spec{sla\_PA}{D}{parallactic angle (radians, in the range $\pm \pi$)} +} +\notes +{ + \begin{enumerate} + \item The parallactic angle at a point in the sky is the position + angle of the vertical, {\it i.e.}\ the angle between the direction to + the pole and to the zenith. In precise applications care must + be taken only to use geocentric apparent \hadec\ and to consider + separately the effects of atmospheric refraction and telescope + mount errors. + \item At the pole a zero result is returned. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PAV}{Position-Angle Between Two Directions} +{ + \action{Returns the bearing (position angle) of one celestial + direction with respect to another (single precision).} + \call{R~=~sla\_PAV (V1, V2)} +} +\args{GIVEN} +{ + \spec{V1}{R(3)}{direction cosines of one point} \\ + \spec{V2}{R(3)}{directions cosines of the other point} +} +\args{RETURNED} +{ + \spec{sla\_PAV}{R}{position-angle of 2nd point with respect to 1st} +} +\notes +{ + \begin{enumerate} + \item The coordinate frames correspond to \radec, + $[\lambda,\phi]$ {\it etc.}. + \item The result is the bearing (position angle), in radians, + of point V2 as seen + from point V1. It is in the range $\pm \pi$. The sense + is such that if V2 + is a small distance due east of V1 the result + is about $+\pi/2$. Zero is returned + if the two points are coincident. + \item The routine sla\_BEAR performs an equivalent function except + that the points are specified in the form of spherical coordinates. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_PCD}{Apply Radial Distortion} +{ + \action{Apply pincushion/barrel distortion to a tangent-plane \xy.} + \call{CALL sla\_PCD (DISCO,X,Y)} +} +\args{GIVEN} +{ + \spec{DISCO}{D}{pincushion/barrel distortion coefficient} \\ + \spec{X,Y}{D}{tangent-plane \xy} +} +\args{RETURNED} +{ + \spec{X,Y}{D}{distorted \xy} +} +\notes +{ + \begin{enumerate} + \item The distortion is of the form $\rho = r (1 + c r^{2})$, where $r$ is + the radial distance from the tangent point, $c$ is the DISCO + argument, and $\rho$ is the radial distance in the presence of + the distortion. + \item For {\it pincushion}\/ distortion, C is +ve; for + {\it barrel}\/ distortion, C is $-$ve. + \item For X,Y in units of one projection radius (in the case of + a photographic plate, the focal length), the following + DISCO values apply: + + \vspace{2ex} + + \hspace{5em} + \begin{tabular}{|l|c|} \hline + Geometry & DISCO \\ \hline \hline + astrograph & 0.0 \\ \hline + Schmidt & $-$0.3333 \\ \hline + AAT PF doublet & +147.069 \\ \hline + AAT PF triplet & +178.585 \\ \hline + AAT f/8 & +21.20 \\ \hline + JKT f/8 & +14.6 \\ \hline + \end{tabular} + + \vspace{2ex} + + \item There is a companion routine, sla\_UNPCD, which performs + an approximately inverse operation. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PDA2H}{H.A.\ for a Given Azimuth} +{ + \action{Hour Angle corresponding to a given azimuth (double precision).} + \call{CALL sla\_PDA2H (P, D, A, H1, J1, H2, J2)} +} +\args{GIVEN} +{ + \spec{P}{D}{latitude} \\ + \spec{D}{D}{declination} \\ + \spec{A}{D}{azimuth} +} +\args{RETURNED} +{ + \spec{H1}{D}{hour angle: first solution if any} \\ + \spec{J1}{I}{flag: 0 = solution 1 is valid} \\ + \spec{H2}{D}{hour angle: second solution if any} \\ + \spec{J2}{I}{flag: 0 = solution 2 is valid} +} +%----------------------------------------------------------------------- +\routine{SLA\_PDQ2H}{H.A.\ for a Given P.A.} +{ + \action{Hour Angle corresponding to a given parallactic angle + (double precision).} + \call{CALL sla\_PDQ2H (P, D, Q, H1, J1, H2, J2)} +} +\args{GIVEN} +{ + \spec{P}{D}{latitude} \\ + \spec{D}{D}{declination} \\ + \spec{Q}{D}{azimuth} +} +\args{RETURNED} +{ + \spec{H1}{D}{hour angle: first solution if any} \\ + \spec{J1}{I}{flag: 0 = solution 1 is valid} \\ + \spec{H2}{D}{hour angle: second solution if any} \\ + \spec{J2}{I}{flag: 0 = solution 2 is valid} +} +%------------------------------------------------------------------------------ +\routine{SLA\_PERTEL}{Perturbed Orbital Elements} +{ + \action{Update the osculating elements of an asteroid or comet by + applying planetary perturbations.} + \call{CALL sla\_PERTEL (\vtop{ + \hbox{JFORM, DATE0, DATE1,} + \hbox{EPOCH0, ORBI0, ANODE0, PERIH0, AORQ0, E0, AM0,} + \hbox{EPOCH1, ORBI1, ANODE1, PERIH1, AORQ1, E1, AM1,} + \hbox{JSTAT)}}} +} +\args{GIVEN (format and dates)} +{ + \spec{JFORM}{I}{choice of element set (2 or 3; Note~1)} \\ + \spec{DATE0}{D}{date of osculation (TT MJD) for the given} \\ + \spec{}{}{\hspace{1.5em} elements} \\ + \spec{DATE1}{D}{date of osculation (TT MJD) for the updated} \\ + \spec{}{}{\hspace{1.5em} elements} +} +\args{GIVEN (the unperturbed elements)} +{ + \spec{EPOCH0}{D}{epoch of the given element set + ($t_0$ or $T$, TT MJD;} \\ + \spec{}{}{\hspace{1.5em} Note~2)} \\ + \spec{ORBI0}{D}{inclination ($i$, radians)} \\ + \spec{ANODE0}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH0}{D}{argument of perihelion + ($\omega$, radians)} \\ + \spec{AORQ0}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E0}{D}{eccentricity ($e$)} \\ + \spec{AM0}{D}{mean anomaly ($M$, radians, JFORM=2 only)} +} +\args{RETURNED (the updated elements)} +{ + \spec{EPOCH1}{D}{epoch of the updated element set + ($t_0$ or $T$,} \\ + \spec{}{}{\hspace{1.5em} TT MJD; Note~2)} \\ + \spec{ORBI1}{D}{inclination ($i$, radians)} \\ + \spec{ANODE1}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH1}{D}{argument of perihelion + ($\omega$, radians)} \\ + \spec{AORQ1}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E1}{D}{eccentricity ($e$)} \\ + \spec{AM1}{D}{mean anomaly ($M$, radians, JFORM=2 only)} +} +\args{RETURNED (status flag)} +{ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{0.5em}+102 = warning, distant epoch} \\ + \spec{}{}{\hspace{0.5em}+101 = warning, large timespan + ($>100$ years)} \\ + \spec{}{}{\hspace{-1.3em}+1 to +8 = coincident with major planet + (Note~6)} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = illegal JFORM} \\ + \spec{}{}{\hspace{1.2em} $-$2 = illegal E0} \\ + \spec{}{}{\hspace{1.2em} $-$3 = illegal AORQ0} \\ + \spec{}{}{\hspace{1.2em} $-$4 = internal error} \\ + \spec{}{}{\hspace{1.2em} $-$5 = numerical error} +} +\notes +{ + \begin{enumerate} + \item Two different element-format options are supported, as follows. \\ + + JFORM=2, suitable for minor planets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e < 1 )$ \\ + \> AORL \> = \> mean anomaly $M$ (radians) + \end{tabbing} + + JFORM=3, suitable for comets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of perihelion $T$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> perihelion distance $q$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e \leq 10 )$ + \end{tabbing} + \item DATE0, DATE1, EPOCH0 and EPOCH1 are all instants of time in + the TT timescale (formerly Ephemeris Time, ET), expressed + as Modified Julian Dates (JD$-$2400000.5). + \begin{itemize} + \item DATE0 is the instant at which the given + ({\it i.e.}\ unperturbed) osculating elements are correct. + \item DATE1 is the specified instant at which the updated osculating + elements are correct. + \item EPOCH0 and EPOCH1 will be the same as DATE0 and DATE1 + (respectively) for the JFORM=2 case, normally used for minor + planets. For the JFORM=3 case, the two epochs will refer to + perihelion passage and so will not, in general, be the same as + DATE0 and/or DATE1 though they may be similar to one another. + \end{itemize} + \item The elements are with respect to the J2000 ecliptic and mean equinox. + \item Unused elements (AM0 and AM1 for JFORM=3) are not accessed. + \item See the sla\_PERTUE routine for details of the algorithm used. + \item This routine is not intended to be used for major planets, which + is why JFORM=1 is not available and why there is no opportunity + to specify either the longitude of perihelion or the daily + motion. However, if JFORM=2 elements are somehow obtained for a + major planet and supplied to the routine, sensible results will, + in fact, be produced. This happens because the sla\_PERTUE routine + that is called to perform the calculations checks the separation + between the body and each of the planets and interprets a + suspiciously small value (0.001~AU) as an attempt to apply it to + the planet concerned. If this condition is detected, the + contribution from that planet is ignored, and the status is set to + the planet number (Mercury=1,\ldots,Neptune=8) as a warning. + \end{enumerate} +} +\aref{Sterne, Theodore E., {\it An Introduction to Celestial Mechanics,}\/ + Interscience Publishers, 1960. Section 6.7, p199.} +%------------------------------------------------------------------------------ +\routine{SLA\_PERTUE}{Perturbed Universal Elements} +{ + \action{Update the universal elements of an asteroid or comet by + applying planetary perturbations.} + \call{CALL sla\_PERTUE (DATE, U, JSTAT)} +} +\args{GIVEN} +{ + \spec{DATE1}{D}{final epoch (TT MJD) for the updated elements} +} +\args{GIVEN and RETURNED} +{ + \spec{U}{D(13)}{universal elements (updated in place)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v_0}$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, approx} +} +\args{RETURNED} +{ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{0.5em}+102 = warning, distant epoch} \\ + \spec{}{}{\hspace{0.5em}+101 = warning, large timespan + ($>100$ years)} \\ + \spec{}{}{\hspace{-1.3em}+1 to +8 = coincident with major planet + (Note~5)} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = numerical error} +} +\notes +{ + \begin{enumerate} + \setlength{\parskip}{\medskipamount} + \item The ``universal'' elements are those which define the orbit for the + purposes of the method of universal variables (see reference 2). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \item The universal elements are with respect to the J2000 equator and + equinox. + \item The epochs DATE, U(3) and U(12) are all Modified Julian Dates + (JD$-$2400000.5). + \item The algorithm is a simplified form of Encke's method. It takes as + a basis the unperturbed motion of the body, and numerically + integrates the perturbing accelerations from the major planets. + The expression used is essentially Sterne's 6.7-2 (reference 1). + Everhart and Pitkin (reference 2) suggest rectifying the orbit at + each integration step by propagating the new perturbed position + and velocity as the new universal variables. In the present + routine the orbit is rectified less frequently than this, in order + to gain a slight speed advantage. However, the rectification is + done directly in terms of position and velocity, as suggested by + Everhart and Pitkin, bypassing the use of conventional orbital + elements. + + The $f(q)$ part of the full Encke method is not used. The purpose + of this part is to avoid subtracting two nearly equal quantities + when calculating the ``indirect member'', which takes account of the + small change in the Sun's attraction due to the slightly displaced + position of the perturbed body. A simpler, direct calculation in + double precision proves to be faster and not significantly less + accurate. + + Apart from employing a variable timestep, and occasionally + ``rectifying the orbit'' to keep the indirect member small, the + integration is done in a fairly straightforward way. The + acceleration estimated for the middle of the timestep is assumed + to apply throughout that timestep; it is also used in the + extrapolation of the perturbations to the middle of the next + timestep, to predict the new disturbed position. There is no + iteration within a timestep. + + Measures are taken to reach a compromise between execution time + and accuracy. The starting-point is the goal of achieving + arcsecond accuracy for ordinary minor planets over a ten-year + timespan. This goal dictates how large the timesteps can be, + which in turn dictates how frequently the unperturbed motion has + to be recalculated from the osculating elements. + + Within predetermined limits, the timestep for the numerical + integration is varied in length in inverse proportion to the + magnitude of the net acceleration on the body from the major + planets. + + The numerical integration requires estimates of the major-planet + motions. Approximate positions for the major planets (Pluto + alone is omitted) are obtained from the routine sla\_PLANET. Two + levels of interpolation are used, to enhance speed without + significantly degrading accuracy. At a low frequency, the routine + sla\_PLANET is called to generate updated position+velocity ``state + vectors''. The only task remaining to be carried out at the full + frequency ({\it i.e.}\ at each integration step) is to use the state + vectors to extrapolate the planetary positions. In place of a + strictly linear extrapolation, some allowance is made for the + curvature of the orbit by scaling back the radius vector as the + linear extrapolation goes off at a tangent. + + Various other approximations are made. For example, perturbations + by Pluto and the minor planets are neglected, relativistic effects + are not taken into account and the Earth-Moon system is treated as + a single body. + + In the interests of simplicity, the background calculations for + the major planets are carried out {\it en masse.} + The mean elements and + state vectors for all the planets are refreshed at the same time, + without regard for orbit curvature, mass or proximity. + + \item This routine is not intended to be used for major planets. + However, if major-planet elements are supplied, sensible results + will, in fact, be produced. This happens because the routine + checks the separation between the body and each of the planets and + interprets a suspiciously small value (0.001~AU) as an attempt to + apply the routine to the planet concerned. If this condition + is detected, the + contribution from that planet is ignored, and the status is set to + the planet number (Mercury=1,\ldots,Neptune=8) as a warning. + \end{enumerate} +} +\refs{ + \begin{enumerate} + \item Sterne, Theodore E., {\it An Introduction to Celestial Mechanics,}\/ + Interscience Publishers, 1960. Section 6.7, p199. + \item Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PLANEL}{Planet Position from Elements} +{ + \action{Heliocentric position and velocity of a planet, + asteroid or comet, starting from orbital elements.} + \call{CALL sla\_PLANEL (\vtop{ + \hbox{DATE, JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, PV, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{DATE}{D}{Modified Julian Date (JD$-$2400000.5)} \\ + \spec{JFORM}{I}{choice of element set (1-3, see Note~3, below)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude + ($M$ or $L$, radians,} \\ + \spec{}{}{\hspace{1.5em} JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal JFORM} \\ + \spec{}{}{\hspace{1.5em} $-$2 = illegal E} \\ + \spec{}{}{\hspace{1.5em} $-$3 = illegal AORQ} \\ + \spec{}{}{\hspace{1.5em} $-$4 = illegal DM} \\ + \spec{}{}{\hspace{1.5em} $-$5 = numerical error} +} +\notes +{ + \begin{enumerate} + \item DATE is the instant for which the prediction is + required. It is in the TT timescale (formerly + Ephemeris Time, ET) and is a + Modified Julian Date (JD$-$2400000.5). + \item The elements are with respect to + the J2000 ecliptic and equinox. + \item Three different element-format options are available, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> longitude of perihelion $\varpi$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e < 1 )$ \\ + \> AORL \> = \> mean longitude $L$ (radians) \\ + \> DM \> = \> daily motion $n$ (radians) + \end{tabbing} + + JFORM=2, suitable for minor planets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e < 1 )$ \\ + \> AORL \> = \> mean anomaly $M$ (radians) + \end{tabbing} + + JFORM=3, suitable for comets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of perihelion $T$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> perihelion distance $q$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e \leq 10 )$ + \end{tabbing} + \item Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are + not accessed. + \item The reference frame for the result is equatorial and is with + respect to the mean equinox and ecliptic of epoch J2000. + \item The algorithm was originally adapted from the EPHSLA program of + D.\,H.\,P.\,Jones (private communication, 1996). The method + is based on Stumpff's Universal Variables. + \end{enumerate} +} +\aref{Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983.} +%------------------------------------------------------------------------------ +\routine{SLA\_PLANET}{Planetary Ephemerides} +{ + \action{Approximate heliocentric position and velocity of a planet.} + \call{CALL sla\_PLANET (DATE, NP, PV, JSTAT)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{Modified Julian Date (JD$-$2400000.5)} \\ + \spec{NP}{I}{planet:} \\ + \spec{}{}{\hspace{1.5em} 1\,=\,Mercury} \\ + \spec{}{}{\hspace{1.5em} 2\,=\,Venus} \\ + \spec{}{}{\hspace{1.5em} 3\,=\,Earth-Moon Barycentre} \\ + \spec{}{}{\hspace{1.5em} 4\,=\,Mars} \\ + \spec{}{}{\hspace{1.5em} 5\,=\,Jupiter} \\ + \spec{}{}{\hspace{1.5em} 6\,=\,Saturn} \\ + \spec{}{}{\hspace{1.5em} 7\,=\,Uranus} \\ + \spec{}{}{\hspace{1.5em} 8\,=\,Neptune} \\ + \spec{}{}{\hspace{1.5em} 9\,=\,Pluto} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} $+$1 = warning: date outside of range} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal NP (outside 1-9)} \\ + \spec{}{}{\hspace{1.5em} $-$2 = solution didn't converge} +} +\notes +{ + \begin{enumerate} + \item The epoch, DATE, is in the TDB timescale and is in the form + of a Modified Julian Date (JD$-$2400000.5). + \item The reference frame is equatorial and is with respect to + the mean equinox and ecliptic of epoch J2000. + \item If a planet number, NP, outside the range 1-9 is supplied, an error + status is returned (JSTAT~=~$-1$) and the PV vector + is set to zeroes. + \item The algorithm for obtaining the mean elements of the + planets from Mercury to Neptune is due to + J.\,L.\,Simon, P.\,Bretagnon, J.\,Chapront, + M.\,Chapront-Touze, G.\,Francou and J.\,Laskar (Bureau des + Longitudes, Paris, France). The (completely different) + algorithm for calculating the ecliptic coordinates of + Pluto is by Meeus. + \item Comparisons of the present routine with the JPL DE200 ephemeris + give the following RMS errors over the interval 1960-2025: + \begin{tabbing} + xxxxx \= xxxxxxxxxxxxxxxxx \= xxxxxxxxxxxxxx \= \kill + \> \> {\it position (km)} \> {\it speed (metre/sec)} \\ \\ + \> Mercury \> \hspace{2em}334 \> \hspace{2.5em}0.437 \\ + \> Venus \> \hspace{1.5em}1060 \> \hspace{2.5em}0.855 \\ + \> EMB \> \hspace{1.5em}2010 \> \hspace{2.5em}0.815 \\ + \> Mars \> \hspace{1.5em}7690 \> \hspace{2.5em}1.98 \\ + \> Jupiter \> \hspace{1em}71700 \> \hspace{2.5em}7.70 \\ + \> Saturn \> \hspace{0.5em}199000 \> \hspace{2em}19.4 \\ + \> Uranus \> \hspace{0.5em}564000 \> \hspace{2em}16.4 \\ + \> Neptune \> \hspace{0.5em}158000 \> \hspace{2em}14.4 \\ + \> Pluto \> \hspace{1em}36400 \> \hspace{2.5em}0.137 + \end{tabbing} + From comparisons with DE102, Simon {\it et al.}\/ quote the following + longitude accuracies over the interval 1800-2200: + \begin{tabbing} + xxxxx \= xxxxxxxxxxxxxxxxxxxx \= \kill + \> Mercury \> \hspace{0.5em}\arcseci{4} \\ + \> Venus \> \hspace{0.5em}\arcseci{5} \\ + \> EMB \> \hspace{0.5em}\arcseci{6} \\ + \> Mars \> \arcseci{17} \\ + \> Jupiter \> \arcseci{71} \\ + \> Saturn \> \arcseci{81} \\ + \> Uranus \> \arcseci{86} \\ + \> Neptune \> \arcseci{11} + \end{tabbing} + In the case of Pluto, Meeus quotes an accuracy of \arcsec{0}{6} + in longitude and \arcsec{0}{2} in latitude for the period + 1885-2099. + + For all except Pluto, over the period 1000-3000, + the accuracy is better than 1.5 + times that over 1800-2200. Outside the interval 1000-3000 the + accuracy declines. For Pluto the accuracy declines rapidly + outside the period 1885-2099. Outside these ranges + (1885-2099 for Pluto, 1000-3000 for the rest) a ``date out + of range'' warning status ({\tt JSTAT=+1}) is returned. + \item The algorithms for (i)~Mercury through Neptune and + (ii)~Pluto are completely independent. In the Mercury + through Neptune case, the present SLALIB + implementation differs from the original + Simon {\it et al.}\/ Fortran code in the following respects: + \begin{itemize} + \item The date is supplied as a Modified Julian Date rather + a Julian Date (${\rm MJD} = ({\rm JD} - 2400000.5$). + \item The result is returned only in equatorial + Cartesian form; the ecliptic + longitude, latitude and radius vector are not returned. + \item The velocity is in AU per second, not AU per day. + \item Different error/warning status values are used. + \item Kepler's Equation is not solved inline. + \item Polynomials in T are nested to minimize rounding errors. + \item Explicit double-precision constants are used to avoid + mixed-mode expressions. + \item There are other, cosmetic, changes to comply with + Starlink/SLALIB style guidelines. + \end{itemize} + None of the above changes affects the result significantly. + \item NP\,=\,3 the result is for the Earth-Moon Barycentre. To + obtain the heliocentric position and velocity of the Earth, + either use the SLALIB routine sla\_EVP or call sla\_DMOON and + subtract 0.012150581 times the geocentric Moon vector from + the EMB vector produced by the present routine. (The Moon + vector should be precessed to J2000 first, but this can + be omitted for modern epochs without introducing significant + inaccuracy.) + \end{enumerate} +\refs +{ + \begin{enumerate} + \item Simon {\it et al.,}\/ + Astron.\ Astrophys.\ {\bf 282}, 663 (1994). + \item Meeus, J., + {\it Astronomical Algorithms,}\/ Willmann-Bell (1991). + \end{enumerate} +} +} +%------------------------------------------------------------------------------ +\routine{SLA\_PLANTE}{\radec\ of Planet from Elements} +{ + \action{Topocentric apparent \radec\ of a Solar-System object whose + heliocentric orbital elements are known.} + \call{CALL sla\_PLANTE (\vtop{ + \hbox{DATE, ELONG, PHI, JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, RA, DEC, R, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{DATE}{D}{MJD of observation (JD$-$2400000.5)} \\ + \spec{ELONG,PHI}{D}{observer's longitude (east +ve) and latitude} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{JFORM}{I}{choice of element set (1-3, see Note~4, below)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude ($M$ or $L$,} \\ + \spec{}{}{\hspace{1.5em} radians, JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} +} +\args{RETURNED} +{ + \spec{RA,DEC}{D}{topocentric apparent \radec\ (radians)} \\ + \spec{R}{D}{distance from observer (AU)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal JFORM} \\ + \spec{}{}{\hspace{1.5em} $-$2 = illegal E} \\ + \spec{}{}{\hspace{1.5em} $-$3 = illegal AORQ} \\ + \spec{}{}{\hspace{1.5em} $-$4 = illegal DM} \\ + \spec{}{}{\hspace{1.5em} $-$5 = numerical error} +} +\notes +{ + \begin{enumerate} + \item DATE is the instant for which the prediction is + required. It is in the TT timescale (formerly + Ephemeris Time, ET) and is a + Modified Julian Date (JD$-$2400000.5). + \item The longitude and latitude allow correction for geocentric + parallax. This is usually a small effect, but can become + important for Earth-crossing asteroids. Geocentric positions + can be generated by appropriate use of the routines + sla\_EVP and sla\_PLANEL. + \item The elements are with respect to the J2000 ecliptic and equinox. + \item Three different element-format options are available, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabbing} + xxx \= xxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> longitude of perihelion $\varpi$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ \\ + \> AORL \> = \> mean longitude $L$ (radians) \\ + \> DM \> = \> daily motion $n$ (radians) + \end{tabbing} + + JFORM=2, suitable for minor planets: + + \begin{tabbing} + xxx \= xxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ \\ + \> AORL \> = \> mean anomaly $M$ (radians) + \end{tabbing} + + JFORM=3, suitable for comets: + + \begin{tabbing} + xxx \= xxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of perihelion $T$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> perihelion distance $q$ (AU) \\ + \> E \> = \> eccentricity $e$ + \end{tabbing} + \item Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are + not accessed. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_PM}{Proper Motion} +{ + \action{Apply corrections for proper motion to a star \radec.} + \call{CALL sla\_PM (R0, D0, PR, PD, PX, RV, EP0, EP1, R1, D1)} +} +\args{GIVEN} +{ + \spec{R0,D0}{D}{\radec\ at epoch EP0 (radians)} \\ + \spec{PR,PD}{D}{proper motions: rate of change of + \radec\ (radians per year)} \\ + \spec{PX}{D}{parallax (arcsec)} \\ + \spec{RV}{D}{radial velocity (km~s$^{-1}$, +ve if receding)} \\ + \spec{EP0}{D}{start epoch in years ({\it e.g.}\ Julian epoch)} \\ + \spec{EP1}{D}{end epoch in years (same system as EP0)} +} +\args{RETURNED} +{ + \spec{R1,D1}{D}{\radec\ at epoch EP1 (radians)} +} +\anote{The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are in the same coordinate + system as R0,D0.} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr. Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_POLMO}{Polar Motion} +{ + \action{Polar motion: correct site longitude and latitude for polar + motion and calculate azimuth difference between celestial and + terrestrial poles.} + \call{CALL sla\_POLMO (ELONGM, PHIM, XP, YP, ELONG, PHI, DAZ)} +} +\args{GIVEN} +{ + \spec{ELONGM}{D}{mean longitude of the site (radians, east +ve)} \\ + \spec{PHIM}{D}{mean geodetic latitude of the site (radians)} \\ + \spec{XP}{D}{polar motion $x$-coordinate (radians)} \\ + \spec{YP}{D}{polar motion $y$-coordinate (radians)} +} +\args{RETURNED} +{ + \spec{ELONG}{D}{true longitude of the site (radians, east +ve)} \\ + \spec{PHI}{D}{true geodetic latitude of the site (radians)} \\ + \spec{DAZ}{D}{azimuth correction (terrestrial$-$celestial, radians)} +} +\notes +{ +\begin{enumerate} +\item ``Mean'' longitude and latitude are the (fixed) values for the + site's location with respect to the IERS terrestrial reference + frame; the latitude is geodetic. TAKE CARE WITH THE LONGITUDE + SIGN CONVENTION. The longitudes used by the present routine + are east-positive, in accordance with geographical convention + (and right-handed). In particular, note that the longitudes + returned by the sla\_OBS routine are west-positive, following + astronomical usage, and must be reversed in sign before use in + the present routine. +\item XP and YP are the (changing) coordinates of the Celestial + Ephemeris Pole with respect to the IERS Reference Pole. + XP is positive along the meridian at longitude $0^\circ$, + and YP is positive along the meridian at longitude + $270^\circ$ ({\it i.e.}\ $90^\circ$ west). Values for XP,YP can + be obtained from IERS circulars and equivalent publications; + the maximum amplitude observed so far is about \arcsec{0}{3}. +\item ``True'' longitude and latitude are the (moving) values for + the site's location with respect to the celestial ephemeris + pole and the meridian which corresponds to the Greenwich + apparent sidereal time. The true longitude and latitude + link the terrestrial coordinates with the standard celestial + models (for precession, nutation, sidereal time {\it etc}). +\item The azimuths produced by sla\_AOP and sla\_AOPQK are with + respect to due north as defined by the Celestial Ephemeris + Pole, and can therefore be called ``celestial azimuths''. + However, a telescope fixed to the Earth measures azimuth + essentially with respect to due north as defined by the + IERS Reference Pole, and can therefore be called ``terrestrial + azimuth''. Uncorrected, this would manifest itself as a + changing ``azimuth zero-point error''. The value DAZ is the + correction to be added to a celestial azimuth to produce + a terrestrial azimuth. +\item The present routine is rigorous. For most practical + purposes, the following simplified formulae provide an + adequate approximation: \\[2ex] + \hspace*{1em}\begin{tabular}{lll} + {\tt ELONG} & {\tt =} & + {\tt ELONGM+XP*COS(ELONGM)-YP*SIN(ELONGM)} \\ + {\tt PHI } & {\tt =} & + {\tt PHIM+(XP*SIN(ELONGM)+YP*COS(ELONGM))*TAN(PHIM)} \\ + {\tt DAZ } & {\tt =} & + {\tt -SQRT(XP*XP+YP*YP)*COS(ELONGM-ATAN2(XP,YP))/COS(PHIM)} \\ + \end{tabular} \\[2ex] + An alternative formulation for DAZ is:\\[2ex] + \hspace*{1em}\begin{tabular}{lll} + {\tt X } & {\tt =} & {\tt COS(ELONGM)*COS(PHIM)} \\ + {\tt Y } & {\tt =} & {\tt SIN(ELONGM)*COS(PHIM)} \\ + {\tt DAZ} & {\tt =} & {\tt ATAN2(-X*YP-Y*XP,X*X+Y*Y)} \\ + \end{tabular} +\end{enumerate} +} +\aref{Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7, + sections 3.27, 4.25, 4.52.} +%----------------------------------------------------------------------- +\routine{SLA\_PREBN}{Precession Matrix (FK4)} +{ + \action{Generate the matrix of precession between two epochs, + using the old, pre IAU~1976, Bessel-Newcomb model, in + Andoyer's formulation.} + \call{CALL sla\_PREBN (BEP0, BEP1, RMATP)} +} +\args{GIVEN} +{ + \spec{BEP0}{D}{beginning Besselian epoch} \\ + \spec{BEP1}{D}{ending Besselian epoch} +} +\args{RETURNED} +{ + \spec{RMATP}{D(3,3)}{precession matrix} +} +\anote{The matrix is in the sense: + \begin{verse} + {\bf v}$_{1}$ = {\bf M}$\cdot${\bf v}$_{0}$ + \end{verse} + where {\bf v}$_{1}$ is the star vector relative to the + mean equator and equinox of epoch BEP1, {\bf M} is the + $3\times3$ matrix RMATP and + {\bf v}$_{0}$ is the star vector relative to the + mean equator and equinox of epoch BEP0.} +\aref{Smith {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 269.} +%----------------------------------------------------------------------- +\routine{SLA\_PREC}{Precession Matrix (FK5)} +{ + \action{Form the matrix of precession between two epochs (IAU 1976, FK5).} + \call{CALL sla\_PREC (EP0, EP1, RMATP)} +} +\args{GIVEN} +{ + \spec{EP0}{D}{beginning epoch} \\ + \spec{EP1}{D}{ending epoch} +} +\args{RETURNED} +{ + \spec{RMATP}{D(3,3)}{precession matrix} +} +\notes +{ + \begin{enumerate} + \item The epochs are TDB Julian epochs. + \item The matrix is in the sense: + \begin{verse} + {\bf v}$_{1}$ = {\bf M}$\cdot${\bf v}$_{0}$ + \end{verse} + where {\bf v}$_{1}$ is the star vector relative to the + mean equator and equinox of epoch EP1, {\bf M} is the + $3\times3$ matrix RMATP and + {\bf v}$_{0}$ is the star vector relative to the + mean equator and equinox of epoch EP0. + \item Though the matrix method itself is rigorous, the precession + angles are expressed through canonical polynomials which are + valid only for a limited time span. There are also known + errors in the IAU precession rate. The absolute accuracy + of the present formulation is better than \arcsec{0}{1} from + 1960\,AD to 2040\,AD, better than \arcseci{1} from 1640\,AD to 2360\,AD, + and remains below \arcseci{3} for the whole of the period + 500\,BC to 3000\,AD. The errors exceed \arcseci{10} outside the + range 1200\,BC to 3900\,AD, exceed \arcseci{100} outside 4200\,BC to + 5600\,AD and exceed \arcseci{1000} outside 6800\,BC to 8200\,AD. + The SLALIB routine sla\_PRECL implements a more elaborate + model which is suitable for problems spanning several + thousand years. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Lieske, J.H., 1979.\ {\it Astr.Astrophys.}\ {\bf 73}, 282; + equations 6 \& 7, p283. + \item Kaplan, G.H., 1981.\ {\it USNO circular no.\ 163}, pA2. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PRECES}{Precession} +{ + \action{Precession -- either the old ``FK4'' (Bessel-Newcomb, pre~IAU~1976) + or new ``FK5'' (Fricke, post~IAU~1976) as required.} + \call{CALL sla\_PRECES (SYSTEM, EP0, EP1, RA, DC)} +} +\args{GIVEN} +{ + \spec{SYSTEM}{C}{precession to be applied: `FK4' or `FK5'} \\ + \spec{EP0,EP1}{D}{starting and ending epoch} \\ + \spec{RA,DC}{D}{\radec, mean equator \& equinox of epoch EP0} +} +\args{RETURNED} +{ + \spec{RA,DC}{D}{\radec, mean equator \& equinox of epoch EP1} +} +\notes +{ + \begin{enumerate} + \item Lowercase characters in SYSTEM are acceptable. + \item The epochs are Besselian if SYSTEM=`FK4' and Julian if `FK5'. + For example, to precess coordinates in the old system from + equinox 1900.0 to 1950.0 the call would be: + \begin{quote} + {\tt CALL sla\_PRECES ('FK4', 1900D0, 1950D0, RA, DC)} + \end{quote} + \item This routine will {\bf NOT} correctly convert between the old and + the new systems -- for example conversion from B1950 to J2000. + For these purposes see sla\_FK425, sla\_FK524, sla\_FK45Z and + sla\_FK54Z. + \item If an invalid SYSTEM is supplied, values of $-$99D0,$-$99D0 are + returned for both RA and DC. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PRECL}{Precession Matrix (latest)} +{ + \action{Form the matrix of precession between two epochs, using the + model of Simon {\it et al}.\ (1994), which is suitable for long + periods of time.} + \call{CALL sla\_PRECL (EP0, EP1, RMATP)} +} +\args{GIVEN} +{ + \spec{EP0}{D}{beginning epoch} \\ + \spec{EP1}{D}{ending epoch} +} +\args{RETURNED} +{ + \spec{RMATP}{D(3,3)}{precession matrix} +} +\notes +{ + \begin{enumerate} + \item The epochs are TDB Julian epochs. + \item The matrix is in the sense: + \begin{verse} + {\bf v}$_{1}$ = {\bf M}$\cdot${\bf v}$_{0}$ + \end{verse} + where {\bf v}$_{1}$ is the star vector relative to the + mean equator and equinox of epoch EP1, {\bf M} is the + $3\times3$ matrix RMATP and + {\bf v}$_{0}$ is the star vector relative to the + mean equator and equinox of epoch EP0. + \item The absolute accuracy of the model is limited by the + uncertainty in the general precession, about \arcsec{0}{3} per + 1000~years. The remainder of the formulation provides a + precision of 1~milliarcsecond over the interval from 1000\,AD + to 3000\,AD, \arcsec{0}{1} from 1000\,BC to 5000\,AD and + \arcseci{1} from 4000\,BC to 8000\,AD. + \end{enumerate} +} +\aref{Simon, J.L.\ {\it et al}., 1994.\ {\it Astr.Astrophys.}\ {\bf 282}, + 663.} +%----------------------------------------------------------------------- +\routine{SLA\_PRENUT}{Precession/Nutation Matrix} +{ + \action{Form the matrix of precession and nutation (IAU~1976, FK5).} + \call{CALL sla\_PRENUT (EPOCH, DATE, RMATPN)} +} +\args{GIVEN} +{ + \spec{EPOCH}{D}{Julian Epoch for mean coordinates} \\ + \spec{DATE}{D}{Modified Julian Date (JD$-$2400000.5) + for true coordinates} +} +\args{RETURNED} +{ + \spec{RMATPN}{D(3,3)}{combined precession/nutation matrix} +} +\notes +{ + \begin{enumerate} + \item The epoch and date are TDB. + \item The matrix is in the sense: + \begin{verse} + {\bf v}$_{true}$ = {\bf M}$\cdot${\bf v}$_{mean}$ + \end{verse} + where {\bf v}$_{true}$ is the star vector relative to the + true equator and equinox of epoch DATE, {\bf M} is the + $3\times3$ matrix RMATPN and + {\bf v}$_{mean}$ is the star vector relative to the + mean equator and equinox of epoch EPOCH. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PV2EL}{Orbital Elements from Position/Velocity} +{ + \action{Heliocentric osculating elements obtained from instantaneous + position and velocity.} + \call{CALL sla\_PV2EL (\vtop{ + \hbox{PV, DATE, PMASS, JFORMR, JFORM, EPOCH, ORBINC,} + \hbox{ANODE, PERIH, AORQ, E, AORL, DM, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s; Note~1)} \\ + \spec{DATE}{D}{date (TT Modified Julian Date = JD$-$2400000.5)} \\ + \spec{PMASS}{D}{mass of the planet (Sun = 1; Note~2)} \\ + \spec{JFORMR}{I}{requested element set (1-3; Note~3)} +} +\args{RETURNED} +{ + \spec{JFORM}{I}{element set actually returned (1-3; Note~4)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude + ($M$ or $L$, radians,} \\ + \spec{}{}{\hspace{1.5em} JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal PMASS} \\ + \spec{}{}{\hspace{1.5em} $-$2 = illegal JFORMR} \\ + \spec{}{}{\hspace{1.5em} $-$3 = position/velocity out of allowed range} +} +\notes +{ + \begin{enumerate} + \item The PV 6-vector is with respect to the mean equator and equinox of + epoch J2000. The orbital elements produced are with respect to + the J2000 ecliptic and mean equinox. + \item The mass, PMASS, is important only for the larger planets. For + most purposes ({\it e.g.}~asteroids) use 0D0. Values less than zero + are illegal. + \item Three different element-format options are supported, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> longitude of perihelion $\varpi$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e < 1 )$ \\ + \> AORL \> = \> mean longitude $L$ (radians) \\ + \> DM \> = \> daily motion $n$ (radians) + \end{tabbing} + + JFORM=2, suitable for minor planets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e < 1 )$ \\ + \> AORL \> = \> mean anomaly $M$ (radians) + \end{tabbing} + + JFORM=3, suitable for comets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of perihelion $T$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> perihelion distance $q$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e \leq 10 )$ + \end{tabbing} + \item It may not be possible to generate elements in the form + requested through JFORMR. The caller is notified of the form + of elements actually returned by means of the JFORM argument: + + \begin{tabbing} + xx \= xxxxxxxxxx \= xxxxxxxxxxx \= \kill + \> JFORMR \> JFORM \> meaning \\ \\ + \> ~~~~~1 \> ~~~~~1 \> OK: elements are in the requested format \\ + \> ~~~~~1 \> ~~~~~2 \> never happens \\ + \> ~~~~~1 \> ~~~~~3 \> orbit not elliptical \\ + \> ~~~~~2 \> ~~~~~1 \> never happens \\ + \> ~~~~~2 \> ~~~~~2 \> OK: elements are in the requested format \\ + \> ~~~~~2 \> ~~~~~3 \> orbit not elliptical \\ + \> ~~~~~3 \> ~~~~~1 \> never happens \\ + \> ~~~~~3 \> ~~~~~2 \> never happens \\ + \> ~~~~~3 \> ~~~~~3 \> OK: elements are in the requested format + \end{tabbing} + \item The arguments returned for each value of JFORM ({\it cf}\/ Note~5: + JFORM may not be the same as JFORMR) are as follows: + + \begin{tabbing} + xxx \= xxxxxxxxxxxx \= xxxxxx \= xxxxxx \= \kill + \> JFORM \> 1 \> 2 \> 3 \\ \\ + \> EPOCH \> $t_0$ \> $t_0$ \> $T$ \\ + \> ORBINC \> $i$ \> $i$ \> $i$ \\ + \> ANODE \> $\Omega$ \> $\Omega$ \> $\Omega$ \\ + \> PERIH \> $\varpi$ \> $\omega$ \> $\omega$ \\ + \> AORQ \> $a$ \> $a$ \> $q$ \\ + \> E \> $e$ \> $e$ \> $e$ \\ + \> AORL \> $L$ \> $M$ \> - \\ + \> DM \> $n$ \> - \> - + \end{tabbing} + + where: + \begin{tabbing} + xxx \= xxxxxxxx \= xxx \= \kill + \> $t_0$ \> is the epoch of the elements (MJD, TT) \\ + \> $T$ \> is the epoch of perihelion (MJD, TT) \\ + \> $i$ \> is the inclination (radians) \\ + \> $\Omega$ \> is the longitude of the ascending node (radians) \\ + \> $\varpi$ \> is the longitude of perihelion (radians) \\ + \> $\omega$ \> is the argument of perihelion (radians) \\ + \> $a$ \> is the mean distance (AU) \\ + \> $q$ \> is the perihelion distance (AU) \\ + \> $e$ \> is the eccentricity \\ + \> $L$ \> is the longitude (radians, $0-2\pi$) \\ + \> $M$ \> is the mean anomaly (radians, $0-2\pi$) \\ + \> $n$ \> is the daily motion (radians) \\ + \> - \> means no value is set + \end{tabbing} + \item At very small inclinations, the longitude of the ascending node + ANODE becomes indeterminate and under some circumstances may be + set arbitrarily to zero. Similarly, if the orbit is close to + circular, the true anomaly becomes indeterminate and under some + circumstances may be set arbitrarily to zero. In such cases, + the other elements are automatically adjusted to compensate, + and so the elements remain a valid description of the orbit. + \end{enumerate} +} +\aref{Sterne, Theodore E., {\it An Introduction to Celestial Mechanics,}\/ + Interscience Publishers, 1960.} +%----------------------------------------------------------------------- +\routine{SLA\_PV2UE}{Position/Velocity to Universal Elements} +{ + \action{Construct a universal element set based on an instantaneous + position and velocity.} + \call{CALL sla\_PV2UE (PV, DATE, PMASS, U, JSTAT)} +} +\args{GIVEN} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s; Note~1)} \\ + \spec{DATE}{D}{date (TT Modified Julian Date = JD$-$2400000.5)} \\ + \spec{PMASS}{D}{mass of the planet (Sun = 1; Note~2)} +} +\args{RETURNED} +{ + \spec{U}{D(13)}{universal orbital elements (Note~3)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v}_0$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, approx} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = illegal PMASS} \\ + \spec{}{}{\hspace{1.2em} $-$2 = too close to Sun} \\ + \spec{}{}{\hspace{1.2em} $-$3 = too slow} +} +\notes +{ + \begin{enumerate} + \item The PV 6-vector can be with respect to any chosen inertial frame, + and the resulting universal-element set will be with respect to + the same frame. A common choice will be mean equator and ecliptic + of epoch J2000. + \item The mass, PMASS, is important only for the larger planets. For + most purposes ({\it e.g.}~asteroids) use 0D0. Values less than zero + are illegal. + \item The ``universal'' elements are those which define the orbit for the + purposes of the method of universal variables (see reference). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \end{enumerate} +} +\aref{Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983.} +%----------------------------------------------------------------------- +\routine{SLA\_PVOBS}{Observatory Position \& Velocity} +{ + \action{Position and velocity of an observing station.} + \call{CALL sla\_PVOBS (P, H, STL, PV)} +} +\args{GIVEN} +{ + \spec{P}{D}{latitude (geodetic, radians)} \\ + \spec{H}{D}{height above reference spheroid (geodetic, metres)} \\ + \spec{STL}{D}{local apparent sidereal time (radians)} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{\xyzxyzd\ (AU, AU~s$^{-1}$, true equator and equinox + of date)} +} +\anote{IAU 1976 constants are used.} +%----------------------------------------------------------------------- +\routine{SLA\_PXY}{Apply Linear Model} +{ + \action{Given arrays of {\it expected}\/ and {\it measured}\, + \xy\ coordinates, and a + linear model relating them (as produced by sla\_FITXY), compute + the array of {\it predicted}\/ coordinates and the RMS residuals.} + \call{CALL sla\_PXY (NP,XYE,XYM,COEFFS,XYP,XRMS,YRMS,RRMS)} +} +\args{GIVEN} +{ + \spec{NP}{I}{number of samples} \\ + \spec{XYE}{D(2,NP)}{expected \xy\ for each sample} \\ + \spec{XYM}{D(2,NP)}{measured \xy\ for each sample} \\ + \spec{COEFFS}{D(6)}{coefficients of model (see below)} +} +\args{RETURNED} +{ + \spec{XYP}{D(2,NP)}{predicted \xy\ for each sample} \\ + \spec{XRMS}{D}{RMS in X} \\ + \spec{YRMS}{D}{RMS in Y} \\ + \spec{RRMS}{D }{total RMS (vector sum of XRMS and YRMS)} +} +\notes +{ + \begin{enumerate} + \item The model is supplied in the array COEFFS. Naming the + six elements of COEFFS $a,b,c,d,e$ \& $f$, + the model transforms {\it measured}\/ coordinates + $[x_{m},y_{m}\,]$ into {\it predicted}\/ coordinates + $[x_{p},y_{p}\,]$ as follows: + \begin{verse} + $x_{p} = a + bx_{m} + cy_{m}$ \\ + $y_{p} = d + ex_{m} + fy_{m}$ + \end{verse} + \item The residuals are $(x_{p}-x_{e})$ and $(y_{p}-y_{e})$. + \item If NP is less than or equal to zero, no coordinates are + transformed, and the RMS residuals are all zero. + \item See also sla\_FITXY, sla\_INVF, sla\_XY2XY, sla\_DCMPF + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_RANDOM}{Random Number} +{ + \action{Generate pseudo-random real number in the range $0 \leq x < 1$.} + \call{R~=~sla\_RANDOM (SEED)} +} +\args{GIVEN} +{ + \spec{SEED}{R}{an arbitrary real number} +} +\args{RETURNED} +{ + \spec{SEED}{R}{a new arbitrary value} \\ + \spec{sla\_RANDOM}{R}{Pseudo-random real number $0 \leq x < 1$.} +} +\anote{The implementation is machine-dependent.} +%----------------------------------------------------------------------- +\routine{SLA\_RANGE}{Put Angle into Range $\pm\pi$} +{ + \action{Normalize an angle into the range $\pm\pi$ (single precision).} + \call{R~=~sla\_RANGE (ANGLE)} +} +\args{GIVEN} +{ + \spec{ANGLE}{R}{angle in radians} +} +\args{RETURNED} +{ + \spec{sla\_RANGE}{R}{ANGLE expressed in the range $\pm\pi$.} +} +%----------------------------------------------------------------------- +\routine{SLA\_RANORM}{Put Angle into Range $0\!-\!2\pi$} +{ + \action{Normalize an angle into the range $0\!-\!2\pi$ (single precision).} + \call{R~=~sla\_RANORM (ANGLE)} +} +\args{GIVEN} +{ + \spec{ANGLE}{R}{angle in radians} +} +\args{RETURNED} +{ + \spec{sla\_RANORM}{R}{ANGLE expressed in the range $0\!-\!2\pi$} +} +%----------------------------------------------------------------------- +\routine{SLA\_RCC}{Barycentric Coordinate Time} +{ + \call{D~=~sla\_RCC (TDB, UT1, WL, U, V)} + \action{The relativistic clock correction TDB$-$TT, the + difference between {\it proper time}\, + on Earth and {\it coordinate time}\/ in the solar system barycentric + space-time frame of reference. The proper time is TT; the + coordinate time is {\it an implementation}\/ of TDB.} +} +\args{GIVEN} +{ + \spec{TDB}{D}{coordinate time (MJD: JD$-$2400000.5)} \\ + \spec{UT1}{D}{universal time (fraction of one day)} \\ + \spec{WL}{D}{clock longitude (radians west)} \\ + \spec{U}{D}{clock distance from Earth spin axis (km)} \\ + \spec{V}{D}{clock distance north of Earth equatorial plane (km)} +} +\args{RETURNED} +{ + \spec{sla\_RCC}{D}{TDB$-$TT (sec)} +} +\notes +{ + \begin{enumerate} + \item TDB may be considered to + be the coordinate time in the solar system barycentre frame of + reference, and TT is the proper time given by clocks at mean sea + level on the Earth. + \item The result has a main (annual) sinusoidal term of amplitude + approximately 1.66ms, plus planetary terms up to about + 20$\mu$s, and lunar and diurnal terms up to 2$\mu$s. The + variation arises from the transverse Doppler effect and the + gravitational red-shift as the observer varies in speed and + moves through different gravitational potentials. + \item The argument TDB is, strictly, the barycentric coordinate time; + however, the terrestrial proper time (TT) can in practice be used. + \item The geocentric model is that of Fairhead \& Bretagnon (1990), + in its full + form. It was supplied by Fairhead (private communication) + as a Fortran subroutine. A number of coding changes were made to + this subroutine in order + match the calling sequence of previous versions of the present + routine, to comply with Starlink programming standards and to + avoid compilation problems on certain machines. On the supported + computer types, + the numerical results are essentially unaffected by the + changes. The topocentric model is from Moyer (1981) and Murray (1983). + During the interval 1950-2050, the absolute accuracy of the + geocentric model is better than $\pm3$~nanoseconds + relative to direct numerical integrations using the JPL DE200/LE200 + solar system ephemeris. + \item The IAU definition of TDB is that it must differ from TT only by + periodic terms. Though practical, this is an imprecise definition + which ignores the existence of very long-period and secular effects + in the dynamics of the solar system. As a consequence, different + implementations of TDB will, in general, differ in zero-point and + will drift linearly relative to one other. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Fairhead, L.\ \& + Bretagnon, P., 1990.\ {\it Astr.Astrophys.}\ {\bf 229}, 240-247. + \item Moyer, T.D., 1981.\ {\it Cel.Mech.}\ {\bf 23}, 33. + \item Murray, C.A., 1983,\ {\it Vectorial Astrometry}, Adam Hilger. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_RDPLAN}{Apparent \radec\ of Planet} +{ + \action{Approximate topocentric apparent \radec\ and angular + size of a planet.} + \call{CALL sla\_RDPLAN (DATE, NP, ELONG, PHI, RA, DEC, DIAM)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{MJD of observation (JD$-$2400000.5)} \\ + \spec{NP}{I}{planet:} \\ + \spec{}{}{\hspace{1.5em} 1\,=\,Mercury} \\ + \spec{}{}{\hspace{1.5em} 2\,=\,Venus} \\ + \spec{}{}{\hspace{1.5em} 3\,=\,Moon} \\ + \spec{}{}{\hspace{1.5em} 4\,=\,Mars} \\ + \spec{}{}{\hspace{1.5em} 5\,=\,Jupiter} \\ + \spec{}{}{\hspace{1.5em} 6\,=\,Saturn} \\ + \spec{}{}{\hspace{1.5em} 7\,=\,Uranus} \\ + \spec{}{}{\hspace{1.5em} 8\,=\,Neptune} \\ + \spec{}{}{\hspace{1.5em} 9\,=\,Pluto} \\ + \spec{}{}{\hspace{0.44em} else\,=\,Sun} \\ + \spec{ELONG,PHI}{D}{observer's longitude (east +ve) and latitude + (radians)} +} +\args{RETURNED} +{ + \spec{RA,DEC}{D}{topocentric apparent \radec\ (radians)} \\ + \spec{DIAM}{D}{angular diameter (equatorial, radians)} +} +\notes +{ + \begin{enumerate} + \item The date is in a dynamical timescale (TDB, formerly ET) + and is in the form of a Modified + Julian Date (JD$-$2400000.5). For all practical purposes, TT can + be used instead of TDB, and for many applications UT will do + (except for the Moon). + \item The longitude and latitude allow correction for geocentric + parallax. This is a major effect for the Moon, but in the + context of the limited accuracy of the present routine its + effect on planetary positions is small (negligible for the + outer planets). Geocentric positions can be generated by + appropriate use of the routines sla\_DMOON and sla\_PLANET. + \item The direction accuracy (arcsec, 1000-3000\,AD) is of order: + \begin{tabbing} + xxxxxxx \= xxxxxxxxxxxxxxxxxx \= \kill + \> Sun \> \hspace{0.5em}5 \\ + \> Mercury \> \hspace{0.5em}2 \\ + \> Venus \> 10 \\ + \> Moon \> 30 \\ + \> Mars \> 50 \\ + \> Jupiter \> 90 \\ + \> Saturn \> 90 \\ + \> Uranus \> 90 \\ + \> Neptune \> 10 \\ + \> Pluto \> \hspace{0.5em}1~~~(1885-2099\,AD only) + \end{tabbing} + The angular diameter accuracy is about 0.4\% for the Moon, + and 0.01\% or better for the Sun and planets. + For more information on accuracy, + refer to the routines sla\_PLANET and sla\_DMOON, + which the present routine uses. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFCO}{Refraction Constants} +{ + \action{Determine the constants $a$ and $b$ in the + atmospheric refraction model + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$, + where $\zeta$ is the {\it observed}\/ zenith distance + ({\it i.e.}\ affected by refraction) and $\Delta \zeta$ is + what to add to $\zeta$ to give the {\it topocentric}\, + ({\it i.e.\ in vacuo}) zenith distance.} + \call{CALL sla\_REFCO (HM, TDK, PMB, RH, WL, PHI, TLR, EPS, REFA, REFB)} +} +\args{GIVEN} +{ + \spec{HM}{D}{height of the observer above sea level (metre)} \\ + \spec{TDK}{D}{ambient temperature at the observer (degrees K)} \\ + \spec{PMB}{D}{pressure at the observer (mB)} \\ + \spec{RH}{D}{relative humidity at the observer (range 0\,--\,1)} \\ + \spec{WL}{D}{effective wavelength of the source ($\mu{\rm m}$)} \\ + \spec{PHI}{D}{latitude of the observer (radian, astronomical)} \\ + \spec{TLR}{D}{temperature lapse rate in the troposphere + (degrees K per metre)} \\ + \spec{EPS}{D}{precision required to terminate iteration (radian)} +} +\args{RETURNED} +{ + \spec{REFA}{D}{$\tan \zeta$ coefficient (radians)} \\ + \spec{REFB}{D}{$\tan^{3} \zeta$ coefficient (radians)} +} +\notes +{ + \begin{enumerate} + \item Suggested values for the TLR and EPS arguments are 0.0065D0 and + 1D$-$8 respectively. + \item The radio refraction is chosen by specifying WL $>100$~$\mu{\rm m}$. + \item The routine is a slower but more accurate alternative to the + sla\_REFCOQ routine. The constants it produces give perfect + agreement with sla\_REFRO at zenith distances + $\tan^{-1} 1$ ($45^\circ$) and $\tan^{-1} 4$ ($\sim 76^\circ$). + At other zenith distances, the model achieves: + \arcsec{0}{5} accuracy for $\zeta<80^{\circ}$, + \arcsec{0}{01} accuracy for $\zeta<60^{\circ}$, and + \arcsec{0}{001} accuracy for $\zeta<45^{\circ}$. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFCOQ}{Refraction Constants (fast)} +{ + \action{Determine the constants $a$ and $b$ in the + atmospheric refraction model + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$, + where $\zeta$ is the {\it observed}\/ zenith distance + ({\it i.e.}\ affected by refraction) and $\Delta \zeta$ is + what to add to $\zeta$ to give the {\it topocentric}\, + ({\it i.e.\ in vacuo}) zenith distance. (This is a fast + alternative to the sla\_REFCO routine -- see notes.)} + \call{CALL sla\_REFCOQ (TDK, PMB, RH, WL, REFA, REFB)} +} +\args{GIVEN} +{ + \spec{TDK}{D}{ambient temperature at the observer (degrees K)} \\ + \spec{PMB}{D}{pressure at the observer (mB)} \\ + \spec{RH}{D}{relative humidity at the observer (range 0\,--\,1)} \\ + \spec{WL}{D}{effective wavelength of the source ($\mu{\rm m}$)} +} +\args{RETURNED} +{ + \spec{REFA}{D}{$\tan \zeta$ coefficient (radians)} \\ + \spec{REFB}{D}{$\tan^{3} \zeta$ coefficient (radians)} +} +\notes +{ + \begin{enumerate} + \item The radio refraction is chosen by specifying WL $>100$~$\mu{\rm m}$. + \item The model is an approximation, for moderate zenith distances, + to the predictions of the sla\_REFRO routine. The approximation + is maintained across a range of conditions, and applies to + both optical/IR and radio. + \item The algorithm is a fast alternative to the sla\_REFCO routine. + The latter calls the sla\_REFRO routine itself: this involves + integrations through a model atmosphere, and is costly in + processor time. However, the model which is produced is precisely + correct for two zenith distances ($45^\circ$ and $\sim\!76^\circ$) + and at other zenith distances is limited in accuracy only by the + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ formulation + itself. The present routine is not as accurate, though it + satisfies most practical requirements. + \item The model omits the effects of (i)~height above sea level (apart + from the reduced pressure itself), (ii)~latitude ({\it i.e.}\ the + flattening of the Earth) and (iii)~variations in tropospheric + lapse rate. + \item The model has been tested using the following range of conditions: + \begin{itemize} + \item [$\cdot$] lapse rates 0.0055, 0.0065, 0.0075~degrees K per metre + \item [$\cdot$] latitudes $0^\circ$, $25^\circ$, $50^\circ$, $75^\circ$ + \item [$\cdot$] heights 0, 2500, 5000 metres above sea level + \item [$\cdot$] pressures mean for height $-10$\% to $+5$\% in steps of $5$\% + \item [$\cdot$] temperatures $-10^\circ$ to $+20^\circ$ with respect to + $280^\circ$K at sea level + \item [$\cdot$] relative humidity 0, 0.5, 1 + \item [$\cdot$] wavelength 0.4, 0.6, \ldots\ $2\mu{\rm m}$, + radio + \item [$\cdot$] zenith distances $15^\circ$, $45^\circ$, $75^\circ$ + \end{itemize} + For the above conditions, the comparison with sla\_REFRO + was as follows: + + \vspace{2ex} + + ~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & {\it worst} & {\it RMS} \\ \hline + optical/IR & 62 & 8 \\ + radio & 319 & 49 \\ \hline + & mas & mas \\ \hline + \end{tabular} + + \vspace{3ex} + + For this particular set of conditions: + \begin{itemize} + \item [$\cdot$] lapse rate $6.5^\circ K km^{-1}$ + \item [$\cdot$] latitude $50^\circ$ + \item [$\cdot$] sea level + \item [$\cdot$] pressure 1005\,mB + \item [$\cdot$] temperature $7^\circ$C + \item [$\cdot$] humidity 80\% + \item [$\cdot$] wavelength 5740\,\.{A} + \end{itemize} + the results were as follows: + + \vspace{2ex} + + ~~~~~~~~~~ + \begin{tabular}{|r|r|r|r|} \hline + \multicolumn{1}{|c}{$\zeta$} & + \multicolumn{1}{|c}{sla\_REFRO} & + \multicolumn{1}{|c}{sla\_REFCOQ} & + \multicolumn{1}{|c|}{Saastamoinen} \\ \hline + 10 & 10.27 & 10.27 & 10.27 \\ + 20 & 21.19 & 21.20 & 21.19 \\ + 30 & 33.61 & 33.61 & 33.60 \\ + 40 & 48.82 & 48.83 & 48.81 \\ + 45 & 58.16 & 58.18 & 58.16 \\ + 50 & 69.28 & 69.30 & 69.27 \\ + 55 & 82.97 & 82.99 & 82.95 \\ + 60 & 100.51 & 100.54 & 100.50 \\ + 65 & 124.23 & 124.26 & 124.20 \\ + 70 & 158.63 & 158.68 & 158.61 \\ + 72 & 177.32 & 177.37 & 177.31 \\ + 74 & 200.35 & 200.38 & 200.32 \\ + 76 & 229.45 & 229.43 & 229.42 \\ + 78 & 267.44 & 267.29 & 267.41 \\ + 80 & 319.13 & 318.55 & 319.10 \\ \hline + deg & arcsec & arcsec & arcsec \\ \hline + \end{tabular} + + \vspace{3ex} + + The values for Saastamoinen's formula (which includes terms + up to $\tan^5$) are taken from Hohenkerk and Sinclair (1985). + + The results from the much slower but more accurate sla\_REFCO + routine have not been included in the tabulation as they are + identical to those in the sla\_REFRO column to the \arcsec{0}{01} + resolution used. + \item Outlandish input parameters are silently limited + to mathematically safe values. Zero pressure is permissible, + and causes zeroes to be returned. + \item The algorithm draws on several sources, as follows: + \begin{itemize} + \item The formula for the saturation vapour pressure of water as + a function of temperature and temperature is taken from + expressions A4.5-A4.7 of Gill (1982). + \item The formula for the water vapour pressure, given the + saturation pressure and the relative humidity is from + Crane (1976), expression 2.5.5. + \item The refractivity of air is a function of temperature, + total pressure, water-vapour pressure and, in the case + of optical/IR but not radio, wavelength. The formulae + for the two cases are developed from the Essen and Froome + expressions adopted in Resolution 1 of the 12th International + Geodesy Association General Assembly (1963). + \end{itemize} + The above three items are as used in the sla\_REFRO routine. + \begin{itemize} + \item The formula for $\beta~(=H_0/r_0)$ is + an adaption of expression 9 from Stone (1996). The + adaptations, arrived at empirically, consist of (i)~a + small adjustment to the coefficient and (ii)~a humidity + term for the radio case only. + \item The formulae for the refraction constants as a function of + $n-1$ and $\beta$ are from Green (1987), expression 4.31. + \end{itemize} + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Crane, R.K., Meeks, M.L.\ (ed), ``Refraction Effects in + the Neutral Atmosphere'', + {\it Methods of Experimental Physics: Astrophysics 12B,}\/ + Academic Press, 1976. + \item Gill, Adrian E., {\it Atmosphere-Ocean Dynamics,}\/ + Academic Press, 1982. + \item Hohenkerk, C.Y., \& Sinclair, A.T., NAO Technical Note + No.~63, 1985. + \item International Geodesy Association General Assembly, Bulletin + G\'{e}od\'{e}sique {\bf 70} p390, 1963. + \item Stone, Ronald C., P.A.S.P.~{\bf 108} 1051-1058, 1996. + \item Green, R.M., {\it Spherical Astronomy,}\/ Cambridge + University Press, 1987. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFRO}{Refraction} +{ + \action{Atmospheric refraction, for radio or optical/IR wavelengths.} + \call{CALL sla\_REFRO (ZOBS, HM, TDK, PMB, RH, WL, PHI, TLR, EPS, REF)} +} +\args{GIVEN} +{ + \spec{ZOBS}{D}{observed zenith distance of the source (radians)} \\ + \spec{HM}{D}{height of the observer above sea level (metre)} \\ + \spec{TDK}{D}{ambient temperature at the observer (degrees K)} \\ + \spec{PMB}{D}{pressure at the observer (mB)} \\ + \spec{RH}{D}{relative humidity at the observer (range 0\,--\,1)} \\ + \spec{WL}{D}{effective wavelength of the source ($\mu{\rm m}$)} \\ + \spec{PHI}{D}{latitude of the observer (radian, astronomical)} \\ + \spec{TLR}{D}{temperature lapse rate in the troposphere + (degrees K per metre)} \\ + \spec{EPS}{D}{precision required to terminate iteration (radian)} +} +\args{RETURNED} +{ + \spec{REF}{D}{refraction: {\it in vacuo}\/ ZD minus observed ZD (radians)} +} +\notes +{ + \begin{enumerate} + \item A suggested value for the TLR argument is 0.0065D0. The + refraction is significantly affected by TLR, and if studies + of the local atmosphere have been carried out a better TLR + value may be available. + \item A suggested value for the EPS argument is 1D$-$8. The result is + usually at least two orders of magnitude more computationally + precise than the supplied EPS value. + \item The routine computes the refraction for zenith distances up + to and a little beyond $90^\circ$ using the method of Hohenkerk + \& Sinclair (NAO Technical Notes 59 and 63, subsequently adopted + in the {\it Explanatory Supplement to the Astronomical Almanac,}\/ + 1992 -- see section 3.281). + \item The code is based on the AREF optical/IR refraction subroutine + of C.\,Hohenkerk (HMNAO, September 1984), with extensions to + support the radio case. The modifications to the original HMNAO + optical/IR refraction code which affect the results are: + \begin{itemize} + \item Murray's values for the gas constants have been used + ({\it Vectorial Astrometry,}\/ Adam Hilger, 1983). + \item A better model for $P_s(T)$ has been adopted (taken from + Gill, {\it Atmosphere-Ocean Dynamics,}\/ Academic Press, 1982). + \item More accurate expressions for $Pw_o$ have been adopted + (again from Gill 1982). + \item Provision for radio wavelengths has been added using + expressions devised by A.\,T.\,Sinclair, RGO (private + communication 1989), based on the Essen \& Froome + refractivity formula adopted in Resolution~1 of the + 12th International Geodesy Association General Assembly + (Bulletin G\'{e}od\'{e}sique {\bf 70} p390, 1963). + \end{itemize} + None of the changes significantly affects the optical/IR results + with respect to the algorithm given in the 1992 {\it Explanatory + Supplement.}\/ For example, at $70^\circ$ zenith distance the present + routine agrees with the ES algorithm to better than \arcsec{0}{05} + for any reasonable combination of parameters. However, the + improved water-vapour expressions do make a significant difference + in the radio band, at $70^\circ$ zenith distance reaching almost + \arcseci{4} for a hot, humid, low-altitude site during a period of + low pressure. + \item The radio refraction is chosen by specifying WL $>100$~$\mu{\rm m}$. + Because the algorithm takes no account of the ionosphere, the + accuracy deteriorates at low frequencies, below about 30\,MHz. + \item Before use, the value of ZOBS is expressed in the range $\pm\pi$. + If this ranged ZOBS is negative, the result REF is computed from its + absolute value before being made negative to match. In addition, if + it has an absolute value greater than $93^\circ$, a fixed REF value + equal to the result for ZOBS~$=93^\circ$ is returned, appropriately + signed. + \item As in the original Hohenkerk and Sinclair algorithm, fixed values + of the water vapour polytrope exponent, the height of the + tropopause, and the height at which refraction is negligible are + used. + \item The radio refraction has been tested against work done by + Iain~Coulson, JACH, (private communication 1995) for the + James Clerk Maxwell Telescope, Mauna Kea. For typical conditions, + agreement at the \arcsec{0}{1} level is achieved for moderate ZD, + worsening to perhaps \arcsec{0}{5}\,--\,\arcsec{1}{0} at ZD $80^\circ$. + At hot and humid sea-level sites the accuracy will not be as good. + \item It should be noted that the relative humidity RH is formally + defined in terms of ``mixing ratio'' rather than pressures or + densities as is often stated. It is the mass of water per unit + mass of dry air divided by that for saturated air at the same + temperature and pressure (see Gill 1982). The familiar + $\nu=p_w/p_s$ or $\nu=\rho_w/\rho_s$ expressions can differ from + the formal definition by several percent, significant in the + radio case. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFV}{Apply Refraction to Vector} +{ + \action{Adjust an unrefracted Cartesian vector to include the effect of + atmospheric refraction, using the simple + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ model.} + \call{CALL sla\_REFV (VU, REFA, REFB, VR)} +} +\args{GIVEN} +{ + \spec{VU}{D}{unrefracted position of the source (\azel\ 3-vector)} \\ + \spec{REFA}{D}{$\tan \zeta$ coefficient (radians)} \\ + \spec{REFB}{D}{$\tan^{3} \zeta$ coefficient (radians)} +} +\args{RETURNED} +{ + \spec{VR}{D}{refracted position of the source (\azel\ 3-vector)} +} +\notes +{ + \begin{enumerate} + \item This routine applies the adjustment for refraction in the + opposite sense to the usual one -- it takes an unrefracted + ({\it in vacuo}\/) position and produces an observed (refracted) + position, whereas the + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + model strictly + applies to the case where an observed position is to have the + refraction removed. The unrefracted to refracted case is + harder, and requires an inverted form of the text-book + refraction models; the algorithm used here is equivalent to + one iteration of the Newton-Raphson method applied to the + above formula. + \item Though optimized for speed rather than precision, the present + routine achieves consistency with the refracted-to-unrefracted + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + model at better than 1~microarcsecond within + $30^\circ$ of the zenith and remains within 1~milliarcsecond to + $\zeta=70^\circ$. The inherent accuracy of the model is, of + course, far worse than this -- see the documentation for sla\_REFCO + for more information. + \item At low elevations (below about $3^\circ$) the refraction + correction is held back to prevent arithmetic problems and + wildly wrong results. Over a wide range of observer heights + and corresponding temperatures and pressures, the following + levels of accuracy are achieved, relative to numerical + integration through a model atmosphere: + + \begin{center} + \begin{tabular}{ccl} + $\zeta_{obs}$ & {\it error} \\ \\ + $80^\circ$ & \arcsec{0}{4} \\ + $81^\circ$ & \arcsec{0}{8} \\ + $82^\circ$ & \arcsec{1}{6} \\ + $83^\circ$ & \arcseci{3} \\ + $84^\circ$ & \arcseci{7} \\ + $85^\circ$ & \arcseci{17} \\ + $86^\circ$ & \arcseci{45} \\ + $87^\circ$ & \arcseci{150} \\ + $88^\circ$ & \arcseci{340} \\ + $89^\circ$ & \arcseci{620} \\ + $90^\circ$ & \arcseci{1100} \\ + $91^\circ$ & \arcseci{1900} & $<$ high-altitude \\ + $92^\circ$ & \arcseci{3200} & $<$ sites only \\ + \end{tabular} + \end{center} + \item See also the routine sla\_REFZ, which performs the adjustment to + the zenith distance rather than in \xyz . + The present routine is faster than sla\_REFZ and, + except very low down, + is equally accurate for all practical purposes. However, beyond + about $\zeta=84^\circ$ sla\_REFZ should be used, and for the utmost + accuracy iterative use of sla\_REFRO should be considered. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFZ}{Apply Refraction to ZD} +{ + \action{Adjust an unrefracted zenith distance to include the effect of + atmospheric refraction, using the simple + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ model.} + \call{CALL sla\_REFZ (ZU, REFA, REFB, ZR)} +} +\args{GIVEN} +{ + \spec{ZU}{D}{unrefracted zenith distance of the source (radians)} \\ + \spec{REFA}{D}{$\tan \zeta$ coefficient (radians)} \\ + \spec{REFB}{D}{$\tan^{3} \zeta$ coefficient (radians)} +} +\args{RETURNED} +{ + \spec{ZR}{D}{refracted zenith distance (radians)} +} +\notes +{ + \begin{enumerate} + \item This routine applies the adjustment for refraction in the + opposite sense to the usual one -- it takes an unrefracted + ({\it in vacuo}\/) position and produces an observed (refracted) + position, whereas the + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + model strictly + applies to the case where an observed position is to have the + refraction removed. The unrefracted to refracted case is + harder, and requires an inverted form of the text-book + refraction models; the formula used here is based on the + Newton-Raphson method. For the utmost numerical consistency + with the refracted to unrefracted model, two iterations are + carried out, achieving agreement at the $10^{-11}$~arcsecond level + for $\zeta=80^\circ$. The inherent accuracy of the model + is, of course, far worse than this -- see the documentation for + sla\_REFCO for more information. + \item At $\zeta=83^\circ$, the rapidly-worsening + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + model is abandoned and an empirical formula takes over: + + \[\Delta \zeta = F \left( + \frac{0^\circ\hspace{-0.37em}.\hspace{0.02em}55445 + - 0^\circ\hspace{-0.37em}.\hspace{0.02em}01133 E + + 0^\circ\hspace{-0.37em}.\hspace{0.02em}00202 E^2} + {1 + 0.28385 E +0.02390 E^2} \right) \] + where $E=90^\circ-\zeta_{true}$ + and $F$ is a factor chosen to meet the + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + formula at $\zeta=83^\circ$. Over a + wide range of observer heights and corresponding temperatures and + pressures, the following levels of accuracy are achieved, + relative to numerical integration through a model atmosphere: + + \begin{center} + \begin{tabular}{ccl} + $\zeta_{obs}$ & {\it error} \\ \\ + $80^\circ$ & \arcsec{0}{4} \\ + $81^\circ$ & \arcsec{0}{8} \\ + $82^\circ$ & \arcsec{1}{5} \\ + $83^\circ$ & \arcsec{3}{2} \\ + $84^\circ$ & \arcsec{4}{9} \\ + $85^\circ$ & \arcsec{5}{8} \\ + $86^\circ$ & \arcsec{6}{1} \\ + $87^\circ$ & \arcsec{7}{1} \\ + $88^\circ$ & \arcseci{11} \\ + $89^\circ$ & \arcseci{21} \\ + $90^\circ$ & \arcseci{43} \\ + $91^\circ$ & \arcseci{92} & $<$ high-altitude \\ + $92^\circ$ & \arcseci{220} & $<$ sites only \\ + \end{tabular} + \end{center} + \item See also the routine sla\_REFV, which performs the adjustment in + \xyz , and with the emphasis on speed rather than numerical accuracy. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_RVEROT}{RV Corrn to Earth Centre} +{ + \action{Velocity component in a given direction due to Earth rotation.} + \call{R~=~sla\_RVEROT (PHI, RA, DA, ST)} +} +\args{GIVEN} +{ + \spec{PHI}{R}{geodetic latitude of observing station (radians)} \\ + \spec{RA,DA}{R}{apparent \radec\ (radians)} \\ + \spec{ST}{R}{local apparent sidereal time (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVEROT}{R}{Component of Earth rotation in + direction RA,DA (km~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item Sign convention: the result is positive when the observatory + is receding from the given point on the sky. + \item Accuracy: the simple algorithm used assumes a spherical Earth and + an observing station at sea level; for actual observing + sites, the error is unlikely to be greater than 0.0005~km~s$^{-1}$. + For applications requiring greater precision, use the routine + sla\_PVOBS. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_RVGALC}{RV Corrn to Galactic Centre} +{ + \action{Velocity component in a given direction due to the rotation + of the Galaxy.} + \call{R~=~sla\_RVGALC (R2000, D2000)} +} +\args{GIVEN} +{ + \spec{R2000,D2000}{R}{J2000.0 mean \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVGALC}{R}{Component of dynamical LSR motion in direction + R2000,D2000 (km~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item Sign convention: the result is positive when the LSR + is receding from the given point on the sky. + \item The Local Standard of Rest used here is a point in the + vicinity of the Sun which is in a circular orbit around + the Galactic centre. Sometimes called the {\it dynamical}\/ LSR, + it is not to be confused with a {\it kinematical}\/ LSR, which + is the mean standard of rest of star catalogues or stellar + populations. + \item The dynamical LSR velocity due to Galactic rotation is assumed to + be 220~km~s$^{-1}$ towards $l^{I\!I}=90^{\circ}$, + $b^{I\!I}=0$. + \end{enumerate} +} +\aref{Kerr \& Lynden-Bell (1986), MNRAS, 221, p1023.} +%----------------------------------------------------------------------- +\routine{SLA\_RVLG}{RV Corrn to Local Group} +{ + \action{Velocity component in a given direction due to the combination + of the rotation of the Galaxy and the motion of the Galaxy + relative to the mean motion of the local group.} + \call{R~=~sla\_RVLG (R2000, D2000)} +} +\args{GIVEN} +{ + \spec{R2000,D2000}{R}{J2000.0 mean \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVLG}{R}{Component of {\bf solar} ({\it n.b.}) + motion in direction R2000,D2000 (km~s$^{-1}$)} +} +\anote{Sign convention: the result is positive when + the Sun is receding from the given point on the sky.} +\aref{{\it IAU Trans.}\ 1976.\ {\bf 16B}, p201.} +%----------------------------------------------------------------------- +\routine{SLA\_RVLSRD}{RV Corrn to Dynamical LSR} +{ + \action{Velocity component in a given direction due to the Sun's + motion with respect to the ``dynamical'' Local Standard of Rest.} + \call{R~=~sla\_RVLSRD (R2000, D2000)} +} +\args{GIVEN} +{ + \spec{R2000,D2000}{R}{J2000.0 mean \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVLSRD}{R}{Component of {\it peculiar}\/ solar motion + in direction R2000,D2000 (km~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item Sign convention: the result is positive when + the Sun is receding from the given point on the sky. + \item The Local Standard of Rest used here is the {\it dynamical}\/ LSR, + a point in the vicinity of the Sun which is in a circular + orbit around the Galactic centre. The Sun's motion with + respect to the dynamical LSR is called the {\it peculiar}\/ solar + motion. + \item There is another type of LSR, called a {\it kinematical}\/ LSR. A + kinematical LSR is the mean standard of rest of specified star + catalogues or stellar populations, and several slightly + different kinematical LSRs are in use. The Sun's motion with + respect to an agreed kinematical LSR is known as the + {\it standard}\/ solar motion. + The dynamical LSR is seldom used by observational astronomers, + who conventionally use a kinematical LSR such as the one implemented + in the routine sla\_RVLSRK. + \item The peculiar solar motion is from Delhaye (1965), in {\it Stars + and Stellar Systems}, vol~5, p73: in Galactic Cartesian + coordinates (+9,+12,+7)~km~s$^{-1}$. + This corresponds to about 16.6~km~s$^{-1}$ + towards Galactic coordinates $l^{I\!I}=53^{\circ},b^{I\!I}=+25^{\circ}$. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_RVLSRK}{RV Corrn to Kinematical LSR} +{ + \action{Velocity component in a given direction due to the Sun's + motion with respect to a kinematical Local Standard of Rest.} + \call{R~=~sla\_RVLSRK (R2000, D2000)} +} +\args{GIVEN} +{ + \spec{R2000,D2000}{R}{J2000.0 mean \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVLSRK}{R}{Component of {\it standard}\/ solar motion + in direction R2000,D2000 (km~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item Sign convention: the result is positive when + the Sun is receding from the given point on the sky. + \item The Local Standard of Rest used here is one of several + {\it kinematical}\/ LSRs in common use. A kinematical LSR is the + mean standard of rest of specified star catalogues or stellar + populations. The Sun's motion with respect to a kinematical + LSR is known as the {\it standard}\/ solar motion. + \item There is another sort of LSR, seldom used by observational + astronomers, called the {\it dynamical}\/ LSR. This is a + point in the vicinity of the Sun which is in a circular orbit + around the Galactic centre. The Sun's motion with respect to + the dynamical LSR is called the {\it peculiar}\/ solar motion. To + obtain a radial velocity correction with respect to the + dynamical LSR use the routine sla\_RVLSRD. + \item The adopted standard solar motion is 20~km~s$^{-1}$ + towards $\alpha=18^{\rm h},\delta=+30^{\circ}$ (1900). + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Delhaye (1965), in {\it Stars and Stellar Systems}, vol~5, p73. + \item {\it Methods of Experimental Physics}\/ (ed Meeks), vol~12, + part~C, sec~6.1.5.2, p281. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_S2TP}{Spherical to Tangent Plane} +{ + \action{Projection of spherical coordinates onto the tangent plane + (single precision).} + \call{CALL sla\_S2TP (RA, DEC, RAZ, DECZ, XI, ETA, J)} +} +\args{GIVEN} +{ + \spec{RA,DEC}{R}{spherical coordinates of star (radians)} \\ + \spec{RAZ,DECZ}{R}{spherical coordinates of tangent point (radians)} +} +\args{RETURNED} +{ + \spec{XI,ETA}{R}{tangent plane coordinates (radians)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK, star on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 1 = error, star too far from axis} \\ + \spec{}{}{\hspace{1.5em} 2 = error, antistar on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 3 = error, antistar too far from axis} +} +\notes +{ + \begin{enumerate} + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_V2TP is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_SEP}{Angle Between 2 Points on Sphere} +{ + \action{Angle between two points on a sphere (single precision).} + \call{R~=~sla\_SEP (A1, B1, A2, B2)} +} +\args{GIVEN} +{ + \spec{A1,B1}{R}{spherical coordinates of one point (radians)} \\ + \spec{A2,B2}{R}{spherical coordinates of the other point (radians)} +} +\args{RETURNED} +{ + \spec{sla\_SEP}{R}{angle between [A1,B1] and [A2,B2] in radians} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are right ascension and declination, + longitude and latitude, {\it etc.}\ in radians. + \item The result is always positive. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_SMAT}{Solve Simultaneous Equations} +{ + \action{Matrix inversion and solution of simultaneous equations + (single precision).} + \call{CALL sla\_SMAT (N, A, Y, D, JF, IW)} +} +\args{GIVEN} +{ + \spec{N}{I}{number of unknowns} \\ + \spec{A}{R(N,N)}{matrix} \\ + \spec{Y}{R(N)}{vector} +} +\args{RETURNED} +{ + \spec{A}{R(N,N)}{matrix inverse} \\ + \spec{Y}{R(N)}{solution} \\ + \spec{D}{R}{determinant} \\ + \spec{JF}{I}{singularity flag: 0=OK} \\ + \spec{IW}{I(N)}{workspace} +} +\notes +{ + \begin{enumerate} + \item For the set of $n$ simultaneous linear equations in $n$ unknowns: + \begin{verse} + {\bf A}$\cdot${\bf y} = {\bf x} + \end{verse} + where: + \begin{itemize} + \item {\bf A} is a non-singular $n \times n$ matrix, + \item {\bf y} is the vector of $n$ unknowns, and + \item {\bf x} is the known vector, + \end{itemize} + sla\_SMAT computes: + \begin{itemize} + \item the inverse of matrix {\bf A}, + \item the determinant of matrix {\bf A}, and + \item the vector of $n$ unknowns {\bf y}. + \end{itemize} + Argument N is the order $n$, A (given) is the matrix {\bf A}, + Y (given) is the vector {\bf x} and Y (returned) + is the vector {\bf y}. + The argument A (returned) is the inverse matrix {\bf A}$^{-1}$, + and D is {\it det}\/({\bf A}). + \item JF is the singularity flag. If the matrix is non-singular, + JF=0 is returned. If the matrix is singular, JF=$-$1 + and D=0.0 are returned. In the latter case, the contents + of array A on return are undefined. + \item The algorithm is Gaussian elimination with partial pivoting. + This method is very fast; some much slower algorithms can give + better accuracy, but only by a small factor. + \item This routine replaces the obsolete sla\_SMATRX. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_SUBET}{Remove E-terms} +{ + \action{Remove the E-terms (elliptic component of annual aberration) + from a pre IAU~1976 catalogue \radec\ to give a mean place.} + \call{CALL sla\_SUBET (RC, DC, EQ, RM, DM)} +} +\args{GIVEN} +{ + \spec{RC,DC}{D}{\radec\ with E-terms included (radians)} \\ + \spec{EQ}{D}{Besselian epoch of mean equator and equinox} +} +\args{RETURNED} +{ + \spec{RM,DM}{D}{\radec\ without E-terms (radians)} +} +\anote{Most star positions from pre-1984 optical catalogues (or + obtained by astrometry with respect to such stars) have the + E-terms built-in. This routine converts such a position to a + formal mean place (allowing, for example, comparison with a + pulsar timing position).} +\aref{{\it Explanatory Supplement to the Astronomical Ephemeris}, + section 2D, page 48.} +%----------------------------------------------------------------------- +\routine{SLA\_SUPGAL}{Supergalactic to Galactic} +{ + \action{Transformation from de Vaucouleurs supergalactic coordinates + to IAU 1958 galactic coordinates.} + \call{CALL sla\_GALSUP (DL, DB, DSL, DSB)} +} +\args{GIVEN} +{ + \spec{DSL,DSB}{D}{supergalactic longitude and latitude (radians)} +} +\args{RETURNED} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal\ (radians)} +} +\refs +{ + \begin{enumerate} + \item de Vaucouleurs, de Vaucouleurs, \& Corwin, {\it Second Reference + Catalogue of Bright Galaxies}, U.Texas, p8. + \item Systems \& Applied Sciences Corp., documentation for the + machine-readable version of the above catalogue, + Contract NAS 5-26490. + \end{enumerate} + (These two references give different values for the galactic + longitude of the supergalactic origin. Both are wrong; the + correct value is $l^{I\!I}=137.37$.) +} +%------------------------------------------------------------------------------ +\routine{SLA\_SVD}{Singular Value Decomposition} +{ + \action{Singular value decomposition. + This routine expresses a given matrix {\bf A} as the product of + three matrices {\bf U}, {\bf W}, {\bf V}$^{T}$: + \begin{tabbing} + XXXXXX \= \kill + \> {\bf A} = {\bf U} $\cdot$ {\bf W} $\cdot$ {\bf V}$^{T}$ + \end{tabbing} + where: + \begin{tabbing} + XXXXXX \= XXXX \= \kill + \> {\bf A} \> is any $m$ (rows) $\times n$ (columns) matrix, + where $m \geq n$ \\ + \> {\bf U} \> is an $m \times n$ column-orthogonal matrix \\ + \> {\bf W} \> is an $n \times n$ diagonal matrix with + $w_{ii} \geq 0$ \\ + \> {\bf V}$^{T}$ \> is the transpose of an $n \times n$ + orthogonal matrix +\end{tabbing} +} + \call{CALL sla\_SVD (M, N, MP, NP, A, W, V, WORK, JSTAT)} +} +\args{GIVEN} +{ + \spec{M,N}{I}{$m$, $n$, the numbers of rows and columns in matrix {\bf A}} \\ + \spec{MP,NP}{I}{physical dimensions of array containing matrix {\bf A}} \\ + \spec{A}{D(MP,NP)}{array containing $m \times n$ matrix {\bf A}} +} +\args{RETURNED} +{ + \spec{A}{D(MP,NP)}{array containing $m \times n$ column-orthogonal + matrix {\bf U}} \\ + \spec{W}{D(N)}{$n \times n$ diagonal matrix {\bf W} + (diagonal elements only)} \\ + \spec{V}{D(NP,NP)}{array containing $n \times n$ orthogonal + matrix {\bf V} ({\it n.b.}\ not {\bf V}$^{T}$)} \\ + \spec{WORK}{D(N)}{workspace} \\ + \spec{JSTAT}{I}{0~=~OK, $-$1~=~array A wrong shape, $>$0~=~index of W + for which convergence failed (see note~3, below)} +} +\notes +{ + \begin{enumerate} + \item M and N are the {\it logical}\/ dimensions of the + matrices and vectors concerned, which can be located in + arrays of larger {\it physical}\/ dimensions, given by MP and NP. + \item V contains matrix V, not the transpose of matrix V. + \item If the status JSTAT is greater than zero, this need not + necessarily be treated as a failure. It means that, due to + chance properties of the matrix A, the QR transformation + phase of the routine did not fully converge in a predefined + number of iterations, something that very seldom occurs. + When this condition does arise, it is possible that the + elements of the diagonal matrix W have not been correctly + found. However, in practice the results are likely to + be trustworthy. Applications should report the condition + as a warning, but then proceed normally. + \end{enumerate} +} +\refs{The algorithm is an adaptation of the routine SVD in the {\it EISPACK}\, + library (Garbow~{\it et~al.}\ 1977, {\it EISPACK Guide Extension}, + Springer Verlag), which is a FORTRAN~66 implementation of the Algol + routine SVD of Wilkinson \& Reinsch 1971 ({\it Handbook for Automatic + Computation}, vol~2, ed Bauer~{\it et~al.}, Springer Verlag). These + references give full details of the algorithm used here. + A good account of the use of SVD in least squares problems is given + in {\it Numerical Recipes}\/ (Press~{\it et~al.}\ 1987, Cambridge + University Press), which includes another variant of the EISPACK code.} +%----------------------------------------------------------------------- +\routine{SLA\_SVDCOV}{Covariance Matrix from SVD} +{ + \action{From the {\bf W} and {\bf V} matrices from the SVD + factorization of a matrix + (as obtained from the sla\_SVD routine), obtain + the covariance matrix.} + \call{CALL sla\_SVDCOV (N, NP, NC, W, V, WORK, CVM)} +} +\args{GIVEN} +{ + \spec{N}{I}{$n$, the number of rows and columns in + matrices {\bf W} and {\bf V}} \\ + \spec{NP}{I}{first dimension of array containing $n \times n$ + matrix {\bf V}} \\ + \spec{NC}{I}{first dimension of array CVM} \\ + \spec{W}{D(N)}{$n \times n$ diagonal matrix {\bf W} + (diagonal elements only)} \\ + \spec{V}{D(NP,NP)}{array containing $n \times n$ orthogonal matrix {\bf V}} +} +\args{RETURNED} +{ + \spec{WORK}{D(N)}{workspace} \\ + \spec{CVM}{D(NC,NC)}{array to receive covariance matrix} +} +\aref{{\it Numerical Recipes}, section 14.3.} +%----------------------------------------------------------------------- +\routine{SLA\_SVDSOL}{Solution Vector from SVD} +{ + \action{From a given vector and the SVD of a matrix (as obtained from + the sla\_SVD routine), obtain the solution vector. + This routine solves the equation: + \begin{tabbing} + XXXXXX \= \kill + \> {\bf A} $\cdot$ {\bf x} = {\bf b} + \end{tabbing} + where: + \begin{tabbing} + XXXXXX \= XXXX \= \kill + \> {\bf A} \> is a given $m$ (rows) $\times n$ (columns) + matrix, where $m \geq n$ \\ + \> {\bf x} \> is the $n$-vector we wish to find, and \\ + \> {\bf b} \> is a given $m$-vector + \end{tabbing} + by means of the {\it Singular Value Decomposition}\/ method (SVD).} + \call{CALL sla\_SVDSOL (M, N, MP, NP, B, U, W, V, WORK, X)} +} +\args{GIVEN} +{ + \spec{M,N}{I}{$m$, $n$, the numbers of rows and columns in matrix {\bf A}} \\ + \spec{MP,NP}{I}{physical dimensions of array containing matrix {\bf A}} \\ + \spec{B}{D(M)}{known vector {\bf b}} \\ + \spec{U}{D(MP,NP)}{array containing $m \times n$ matrix {\bf U}} \\ + \spec{W}{D(N)}{$n \times n$ diagonal matrix {\bf W} + (diagonal elements only)} \\ + \spec{V}{D(NP,NP)}{array containing $n \times n$ orthogonal matrix {\bf V}} +} +\args{RETURNED} +{ + \spec{WORK}{D(N)}{workspace} \\ + \spec{X}{D(N)}{unknown vector {\bf x}} +} +\notes +{ + \begin{enumerate} + \item In the Singular Value Decomposition method (SVD), + the matrix {\bf A} is first factorized (for example by + the routine sla\_SVD) into the following components: + \begin{tabbing} + XXXXXX \= \kill + \> {\bf A} = {\bf U} $\cdot$ {\bf W} $\cdot$ {\bf V}$^{T}$ + \end{tabbing} + where: + \begin{tabbing} + XXXXXX \= XXXX \= \kill + \> {\bf A} \> is any $m$ (rows) $\times n$ (columns) matrix, + where $m > n$ \\ + \> {\bf U} \> is an $m \times n$ column-orthogonal matrix \\ + \> {\bf W} \> is an $n \times n$ diagonal matrix with + $w_{ii} \geq 0$ \\ + \> {\bf V}$^{T}$ \> is the transpose of an $n \times n$ + orthogonal matrix + \end{tabbing} + Note that $m$ and $n$ are the {\it logical}\/ dimensions of the + matrices and vectors concerned, which can be located in + arrays of larger {\it physical}\/ dimensions MP and NP. + The solution is then found from the expression: + \begin{tabbing} + XXXXXX \= \kill + \> {\bf x} = {\bf V} $\cdot~[diag(1/${\bf W}$_{j})] + \cdot (${\bf U}$^{T} \cdot${\bf b}) + \end{tabbing} + \item If matrix {\bf A} is square, and if the diagonal matrix {\bf W} is not + altered, the method is equivalent to conventional solution + of simultaneous equations. + \item If $m > n$, the result is a least-squares fit. + \item If the solution is poorly determined, this shows up in the + SVD factorization as very small or zero {\bf W}$_{j}$ values. Where + a {\bf W}$_{j}$ value is small but non-zero it can be set to zero to + avoid ill effects. The present routine detects such zero + {\bf W}$_{j}$ values and produces a sensible solution, with highly + correlated terms kept under control rather than being allowed + to elope to infinity, and with meaningful values for the + other terms. + \end{enumerate} +} +\aref{{\it Numerical Recipes}, section 2.9.} +%----------------------------------------------------------------------- +\routine{SLA\_TP2S}{Tangent Plane to Spherical} +{ + \action{Transform tangent plane coordinates into spherical + coordinates (single precision)} + \call{CALL sla\_TP2S (XI, ETA, RAZ, DECZ, RA, DEC)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{R}{tangent plane rectangular coordinates (radians)} \\ + \spec{RAZ,DECZ}{R}{spherical coordinates of tangent point (radians)} +} +\args{RETURNED} +{ + \spec{RA,DEC}{R}{spherical coordinates (radians)} +} +\notes +{ + \begin{enumerate} + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_TP2V is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_TP2V}{Tangent Plane to Direction Cosines} +{ + \action{Given the tangent-plane coordinates of a star and the direction + cosines of the tangent point, determine the direction cosines + of the star + (single precision).} + \call{CALL sla\_TP2V (XI, ETA, V0, V)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{R}{tangent plane coordinates of star (radians)} \\ + \spec{V0}{R(3)}{direction cosines of tangent point} +} +\args{RETURNED} +{ + \spec{V}{R(3)}{direction cosines of star} +} +\notes +{ + \begin{enumerate} + \item If vector V0 is not of unit length, the returned vector V will + be wrong. + \item If vector V0 points at a pole, the returned vector V will be + based on the arbitrary assumption that $\alpha=0$ at + the tangent point. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_TP2S. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_TPS2C}{Plate centre from $\xi,\eta$ and $\alpha,\delta$} +{ + \action{From the tangent plane coordinates of a star of known \radec, + determine the \radec\ of the tangent point (single precision)} + \call{CALL sla\_TPS2C (XI, ETA, RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2, N)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{R}{tangent plane rectangular coordinates (radians)} \\ + \spec{RA,DEC}{R}{spherical coordinates (radians)} +} +\args{RETURNED} +{ + \spec{RAZ1,DECZ1}{R}{spherical coordinates of tangent point, + solution 1} \\ + \spec{RAZ2,DECZ2}{R}{spherical coordinates of tangent point, + solution 2} \\ + \spec{N}{I}{number of solutions:} \\ + \spec{}{}{\hspace{1em} 0 = no solutions returned (note 2)} \\ + \spec{}{}{\hspace{1em} 1 = only the first solution is useful (note 3)} \\ + \spec{}{}{\hspace{1em} 2 = there are two useful solutions (note 3)} +} +\notes +{ + \begin{enumerate} + \item The RAZ1 and RAZ2 values returned are in the range $0\!-\!2\pi$. + \item Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero $\xi$ value, and hence it is + meaningless to ask where the tangent point would have to be + to bring about this combination of $\xi$ and $\delta$. + \item Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. N\,=\,1 + indicates only one useful solution, the usual case; under + these circumstances, the second solution corresponds to the + ``over-the-pole'' case, and this is reflected in the values + of RAZ2 and DECZ2 which are returned. + \item The DECZ1 and DECZ2 values returned are in the range $\pm\pi$, + but in the ordinary, non-pole-crossing, case, the range is + $\pm\pi/2$. + \item RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2 are all in radians. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_TPV2C is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_TPV2C}{Plate centre from $\xi,\eta$ and $x,y,z$} +{ + \action{From the tangent plane coordinates of a star of known + direction cosines, determine the direction cosines + of the tangent point (single precision)} + \call{CALL sla\_TPV2C (XI, ETA, V, V01, V02, N)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{R}{tangent plane coordinates of star (radians)} \\ + \spec{V}{R(3)}{direction cosines of star} +} +\args{RETURNED} +{ + \spec{V01}{R(3)}{direction cosines of tangent point, solution 1} \\ + \spec{V01}{R(3)}{direction cosines of tangent point, solution 2} \\ + \spec{N}{I}{number of solutions:} \\ + \spec{}{}{\hspace{1em} 0 = no solutions returned (note 2)} \\ + \spec{}{}{\hspace{1em} 1 = only the first solution is useful (note 3)} \\ + \spec{}{}{\hspace{1em} 2 = there are two useful solutions (note 3)} +} +\notes +{ + \begin{enumerate} + \item The vector V must be of unit length or the result will be wrong. + \item Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero XI value. + \item Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. + N\,=\,1 + indicates only one useful solution, the usual case; under these + circumstances, the second solution can be regarded as valid if + the vector V02 is interpreted as the ``over-the-pole'' case. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_TPS2C. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_UE2EL}{Universal to Conventional Elements} +{ + \action{Transform universal elements into conventional heliocentric + osculating elements.} + \call{CALL sla\_UE2EL (\vtop{ + \hbox{U, JFORMR,} + \hbox{JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{U}{D(13)}{universal orbital elements (updated; Note~1)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v}_0$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, approx} \\ \\ + \spec{JFORMR}{I}{requested element set (1-3; Note~3)} +} +\args{RETURNED} +{ + \spec{JFORM}{I}{element set actually returned (1-3; Note~4)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude + ($M$ or $L$, radians,} \\ + \spec{}{}{\hspace{1.5em} JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal PMASS} \\ + \spec{}{}{\hspace{1.5em} $-$2 = illegal JFORMR} \\ + \spec{}{}{\hspace{1.5em} $-$3 = position/velocity out of allowed range} +} +\notes +{ + \begin{enumerate} + \setlength{\parskip}{\medskipamount} + \item The ``universal'' elements are those which define the orbit for the + purposes of the method of universal variables (see reference 2). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \item The universal elements are with respect to the mean equator and + equinox of epoch J2000. The orbital elements produced are with + respect to the J2000 ecliptic and mean equinox. + \item Three different element-format options are supported, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> longitude of perihelion $\varpi$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e < 1 )$ \\ + \> AORL \> = \> mean longitude $L$ (radians) \\ + \> DM \> = \> daily motion $n$ (radians) + \end{tabbing} + + JFORM=2, suitable for minor planets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of elements $t_0$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> mean distance $a$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e < 1 )$ \\ + \> AORL \> = \> mean anomaly $M$ (radians) + \end{tabbing} + + JFORM=3, suitable for comets: + + \begin{tabbing} + xxx \= xxxxxxxx \= xx \= \kill + \> EPOCH \> = \> epoch of perihelion $T$ (TT MJD) \\ + \> ORBINC \> = \> inclination $i$ (radians) \\ + \> ANODE \> = \> longitude of the ascending node $\Omega$ (radians) \\ + \> PERIH \> = \> argument of perihelion $\omega$ (radians) \\ + \> AORQ \> = \> perihelion distance $q$ (AU) \\ + \> E \> = \> eccentricity $e$ $( 0 \leq e \leq 10 )$ + \end{tabbing} + \item It may not be possible to generate elements in the form + requested through JFORMR. The caller is notified of the form + of elements actually returned by means of the JFORM argument: + + \begin{tabbing} + xx \= xxxxxxxxxx \= xxxxxxxxxxx \= \kill + \> JFORMR \> JFORM \> meaning \\ \\ + \> ~~~~~1 \> ~~~~~1 \> OK: elements are in the requested format \\ + \> ~~~~~1 \> ~~~~~2 \> never happens \\ + \> ~~~~~1 \> ~~~~~3 \> orbit not elliptical \\ + \> ~~~~~2 \> ~~~~~1 \> never happens \\ + \> ~~~~~2 \> ~~~~~2 \> OK: elements are in the requested format \\ + \> ~~~~~2 \> ~~~~~3 \> orbit not elliptical \\ + \> ~~~~~3 \> ~~~~~1 \> never happens \\ + \> ~~~~~3 \> ~~~~~2 \> never happens \\ + \> ~~~~~3 \> ~~~~~3 \> OK: elements are in the requested format + \end{tabbing} + \item The arguments returned for each value of JFORM ({\it cf}\/ Note~5: + JFORM may not be the same as JFORMR) are as follows: + + \begin{tabbing} + xxx \= xxxxxxxxxxxx \= xxxxxx \= xxxxxx \= \kill + \> JFORM \> 1 \> 2 \> 3 \\ \\ + \> EPOCH \> $t_0$ \> $t_0$ \> $T$ \\ + \> ORBINC \> $i$ \> $i$ \> $i$ \\ + \> ANODE \> $\Omega$ \> $\Omega$ \> $\Omega$ \\ + \> PERIH \> $\varpi$ \> $\omega$ \> $\omega$ \\ + \> AORQ \> $a$ \> $a$ \> $q$ \\ + \> E \> $e$ \> $e$ \> $e$ \\ + \> AORL \> $L$ \> $M$ \> - \\ + \> DM \> $n$ \> - \> - + \end{tabbing} + + where: + \begin{tabbing} + xxx \= xxxxxxxx \= xxx \= \kill + \> $t_0$ \> is the epoch of the elements (MJD, TT) \\ + \> $T$ \> is the epoch of perihelion (MJD, TT) \\ + \> $i$ \> is the inclination (radians) \\ + \> $\Omega$ \> is the longitude of the ascending node (radians) \\ + \> $\varpi$ \> is the longitude of perihelion (radians) \\ + \> $\omega$ \> is the argument of perihelion (radians) \\ + \> $a$ \> is the mean distance (AU) \\ + \> $q$ \> is the perihelion distance (AU) \\ + \> $e$ \> is the eccentricity \\ + \> $L$ \> is the longitude (radians, $0-2\pi$) \\ + \> $M$ \> is the mean anomaly (radians, $0-2\pi$) \\ + \> $n$ \> is the daily motion (radians) \\ + \> - \> means no value is set + \end{tabbing} + \item At very small inclinations, the longitude of the ascending node + ANODE becomes indeterminate and under some circumstances may be + set arbitrarily to zero. Similarly, if the orbit is close to + circular, the true anomaly becomes indeterminate and under some + circumstances may be set arbitrarily to zero. In such cases, + the other elements are automatically adjusted to compensate, + and so the elements remain a valid description of the orbit. + \end{enumerate} +} +\refs{ + \begin{enumerate} + \item Sterne, Theodore E., {\it An Introduction to Celestial Mechanics,}\/ + Interscience Publishers, 1960. Section 6.7, p199. + \item Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_UE2PV}{Pos/Vel from Universal Elements} +{ + \action{Heliocentric position and velocity of a planet, asteroid or comet, + starting from orbital elements in the ``universal variables'' form.} + \call{CALL sla\_UE2PV (DATE, U, PV, JSTAT)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{date (TT Modified Julian Date = JD$-$2400000.5)} +} +\args{GIVEN and RETURNED} +{ + \spec{U}{D(13)}{universal orbital elements (updated; Note~1)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v}_0$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, approx} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s; Note~1)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = radius vector zero} \\ + \spec{}{}{\hspace{1.2em} $-2$ = failed to converge} +} +\notes +{ + \begin{enumerate} + \setlength{\parskip}{\medskipamount} + \item The ``universal'' elements are those which define the orbit for the + purposes of the method of universal variables (see reference). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \item The companion routine is sla\_EL2UE. This takes the conventional + orbital elements and transforms them into the set of numbers + needed by the present routine. A single prediction requires one + one call to sla\_EL2UE followed by one call to the present routine; + for convenience, the two calls are packaged as the routine + sla\_PLANEL. Multiple predictions may be made by again + calling sla\_EL2UE once, but then calling the present routine + multiple times, which is faster than multiple calls to sla\_PLANEL. + + It is not obligatory to use sla\_EL2UE to obtain the parameters. + However, it should be noted that because sla\_EL2UE performs its + own validation, no checks on the contents of the array U are made + by the present routine. + \item DATE is the instant for which the prediction is required. It is + in the TT timescale (formerly Ephemeris Time, ET) and is a + Modified Julian Date (JD$-$2400000.5). + \item The universal elements supplied in the array U are in canonical + units (solar masses, AU and canonical days). The position and + velocity are not sensitive to the choice of reference frame. The + sla\_EL2UE routine in fact produces coordinates with respect to the + J2000 equator and equinox. + \item The algorithm was originally adapted from the EPHSLA program of + D.\,H.\,P.\,Jones (private communication, 1996). The method + is based on Stumpff's Universal Variables. + \end{enumerate} +} +\aref{Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983.} +%----------------------------------------------------------------------- +\routine{SLA\_UNPCD}{Remove Radial Distortion} +{ + \action{Remove pincushion/barrel distortion from a distorted + \xy\ to give tangent-plane \xy.} + \call{CALL sla\_UNPCD (DISCO,X,Y)} +} +\args{GIVEN} +{ + \spec{DISCO}{D}{pincushion/barrel distortion coefficient} \\ + \spec{X,Y}{D}{distorted \xy} +} +\args{RETURNED} +{ + \spec{X,Y}{D}{tangent-plane \xy} +} +\notes +{ + \begin{enumerate} + \item The distortion is of the form $\rho = r (1 + c r^{2})$, where $r$ is + the radial distance from the tangent point, $c$ is the DISCO + argument, and $\rho$ is the radial distance in the presence of + the distortion. + \item For {\it pincushion}\/ distortion, C is +ve; for + {\it barrel}\/ distortion, C is $-$ve. + \item For X,Y in units of one projection radius (in the case of + a photographic plate, the focal length), the following + DISCO values apply: + + \vspace{2ex} + + \hspace{5em} + \begin{tabular}{|l|c|} \hline + Geometry & DISCO \\ \hline \hline + astrograph & 0.0 \\ \hline + Schmidt & $-$0.3333 \\ \hline + AAT PF doublet & +147.069 \\ \hline + AAT PF triplet & +178.585 \\ \hline + AAT f/8 & +21.20 \\ \hline + JKT f/8 & +14.6 \\ \hline + \end{tabular} + + \vspace{2ex} + + \item The present routine is an approximate inverse to the + companion routine sla\_PCD, obtained from two iterations + of Newton's method. The mismatch between the sla\_PCD + and sla\_UNPCD is negligible for astrometric applications; + to reach 1~milliarcsec at the edge of the AAT triplet or + Schmidt field would require field diameters of \degree{2}{4} + and $42^{\circ}$ respectively. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_V2TP}{Direction Cosines to Tangent Plane} +{ + \action{Given the direction cosines of a star and of the tangent point, + determine the star's tangent-plane coordinates + (single precision).} + \call{CALL sla\_V2TP (V, V0, XI, ETA, J)} +} +\args{GIVEN} +{ + \spec{V}{R(3)}{direction cosines of star} \\ + \spec{V0}{R(3)}{direction cosines of tangent point} +} +\args{RETURNED} +{ + \spec{XI,ETA}{R}{tangent plane coordinates (radians)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK, star on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 1 = error, star too far from axis} \\ + \spec{}{}{\hspace{1.5em} 2 = error, antistar on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 3 = error, antistar too far from axis} +} +\notes +{ + \begin{enumerate} + \item If vector V0 is not of unit length, or if vector V is of zero + length, the results will be wrong. + \item If V0 points at a pole, the returned $\xi,\eta$ + will be based on the + arbitrary assumption that $\alpha=0$ at the tangent point. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_S2TP. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_VDV}{Scalar Product} +{ + \action{Scalar product of two 3-vectors (single precision).} + \call{R~=~sla\_VDV (VA, VB)} +} +\args{GIVEN} +{ + \spec{VA}{R(3)}{first vector} \\ + \spec{VB}{R(3)}{second vector} +} +\args{RETURNED} +{ + \spec{sla\_VDV}{R}{scalar product VA.VB} +} +%----------------------------------------------------------------------- +\routine{SLA\_VN}{Normalize Vector} +{ + \action{Normalize a 3-vector, also giving the modulus (single precision).} + \call{CALL sla\_VN (V, UV, VM)} +} +\args{GIVEN} +{ + \spec{V}{R(3)}{vector} +} +\args{RETURNED} +{ + \spec{UV}{R(3)}{unit vector in direction of V} \\ + \spec{VM}{R}{modulus of V} +} +\anote{If the modulus of V is zero, UV is set to zero as well.} +%----------------------------------------------------------------------- +\routine{SLA\_VXV}{Vector Product} +{ + \action{Vector product of two 3-vectors (single precision).} + \call{CALL sla\_VXV (VA, VB, VC)} +} +\args{GIVEN} +{ + \spec{VA}{R(3)}{first vector} \\ + \spec{VB}{R(3)}{second vector} +} +\args{RETURNED} +{ + \spec{VC}{R(3)}{vector product VA$\times$VB} +} +%----------------------------------------------------------------------- +\routine{SLA\_WAIT}{Time Delay} +{ + \action{Wait for a specified interval.} + \call{CALL sla\_WAIT (DELAY)} +} +\args{GIVEN} +{ + \spec{DELAY}{R}{delay in seconds} +} +\notes +{ + \begin{enumerate} + \item The implementation is machine-specific. + \item The delay actually requested is restricted to the range + 100ns-200s in the present implementation. + \item There is no guarantee of accuracy, though on almost all + types of computer the program will certainly not + resume execution {\it before}\/ the stated interval has + elapsed. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_XY2XY}{Apply Linear Model to an \xy} +{ + \action{Transform one \xy\ into another using a linear model of the type + produced by the sla\_FITXY routine.} + \call{CALL sla\_XY2XY (X1,Y1,COEFFS,X2,Y2)} +} +\args{GIVEN} +{ + \spec{X1,Y1}{D}{\xy\ before transformation} \\ + \spec{COEFFS}{D(6)}{transformation coefficients (see note)} +} +\args{RETURNED} +{ + \spec{X2,Y2}{D}{\xy\ after transformation} +} +\notes +{ + \begin{enumerate} + \item The model relates two sets of \xy\ coordinates as follows. + Naming the six elements of COEFFS $a,b,c,d,e$ \& $f$, + the present routine performs the transformation: + \begin{verse} + $x_{2} = a + bx_{1} + cy_{1}$ \\ + $y_{2} = d + ex_{1} + fy_{1}$ + \end{verse} + \item See also sla\_FITXY, sla\_PXY, sla\_INVF, sla\_DCMPF. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_ZD}{$h,\delta$ to Zenith Distance} +{ + \action{Hour angle and declination to zenith distance + (double precision).} + \call{D~=~sla\_ZD (HA, DEC, PHI)} +} +\args{GIVEN} +{ + \spec{HA}{D}{hour angle in radians} \\ + \spec{DEC}{D}{declination in radians} \\ + \spec{PHI}{D}{latitude in radians} +} +\args{RETURNED} +{ + \spec{sla\_ZD}{D}{zenith distance (radians, $0\!-\!\pi$)} +} +\notes +{ + \begin{enumerate} + \item The latitude must be geodetic. In critical applications, + corrections for polar motion should be applied (see sla\_POLMO). + \item In some applications it will be important to specify the + correct type of hour angle and declination in order to + produce the required type + of zenith distance. In particular, it may be + important to distinguish between the zenith distance + as affected by refraction, which would require the + {\it observed}\/ \hadec, and the zenith distance {\it in vacuo}, + which would require the {\it topocentric}\/ \hadec. If + the effects of diurnal aberration can be neglected, the + {\it apparent}\/ \hadec\ may be used instead of the + {\it topocentric}\/ \hadec. + \item No range checking of arguments is done. + \item In applications which involve many zenith distance calculations, + rather than calling the present routine it will be more + efficient to use inline code, having previously computed fixed + terms such as sine and cosine of latitude, and perhaps sine and + cosine of declination. + \end{enumerate} +} + +\pagebreak + +\section{EXPLANATION AND EXAMPLES} +To guide the writer of positional-astronomy applications software, +this final chapter puts the SLALIB routines into the context of +astronomical phenomena and techniques, and presents a few +``cookbook'' examples +of the SLALIB calls in action. The astronomical content of the chapter +is not, of course, intended to be a substitute for specialist text-books on +positional astronomy, but may help bridge the gap between +such books and the SLALIB routines. For further reading, the following +cover a wide range of material and styles: +\begin{itemize} +\item {\it Explanatory Supplement to the Astronomical Almanac}, + ed.\ P.\,Kenneth~Seidelmann (1992), University Science Books. +\item {\it Vectorial Astrometry}, C.\,A.\,Murray (1983), Adam Hilger. +\item {\it Spherical Astronomy}, Robin~M.\,Green (1985), Cambridge + University Press. +\item {\it Spacecraft Attitude Determination and Control}, + ed.\ James~R.\,Wertz (1986), Reidel. +\item {\it Practical Astronomy with your Calculator}, + Peter~Duffett-Smith (1981), Cambridge University Press. +\end{itemize} +Also of considerable value, though out of date in places, are: +\begin{itemize} +\item {\it Explanatory Supplement to the Astronomical Ephemeris + and the American Ephemeris and Nautical Almanac}, RGO/USNO (1974), + HMSO. +\item {\it Textbook on Spherical Astronomy}, W.\,M.\,Smart (1977), + Cambridge University Press. +\end{itemize} +Only brief details of individual SLALIB routines are given here, and +readers will find it useful to refer to the subprogram specifications +elsewhere in this document. The source code for the SLALIB routines +(available in both Fortran and C) is also intended to be used as +documentation. + +\subsection {Spherical Trigonometry} +Celestial phenomena occur at such vast distances from the +observer that for most practical purposes there is no need to +work in 3D; only the direction +of a source matters, not how far away it is. Things can +therefore be viewed as if they were happening +on the inside of sphere with the observer at the centre -- +the {\it celestial sphere}. Problems involving +positions and orientations in the sky can then be solved by +using the formulae of {\it spherical trigonometry}, which +apply to {\it spherical triangles}, the sides of which are +{\it great circles}. + +Positions on the celestial sphere may be specified by using +a spherical polar coordinate system, defined in terms of +some fundamental plane and a line in that plane chosen to +represent zero longitude. Mathematicians usually work with the +co-latitude, with zero at the principal pole, whereas most +astronomical coordinate systems use latitude, reckoned plus and +minus from the equator. +Astronomical coordinate systems may be either right-handed +({\it e.g.}\ right ascension and declination \radec, +Galactic longitude and latitude \gal) +or left-handed ({\it e.g.}\ hour angle and +declination \hadec). In some cases +different conventions have been used in the past, a fruitful source of +mistakes. Azimuth and geographical longitude are examples; azimuth +is now generally reckoned north through east +(making a left-handed system); geographical longitude is now usually +taken to increase eastwards (a right-handed system) but astronomers +used to employ a west-positive convention. In reports +and program comments it is wise to spell out what convention +is being used, if there is any possibility of confusion. + +When applying spherical trigonometry formulae, attention must be +paid to +rounding errors (for example it is a bad idea to find a +small angle through its cosine) and to the possibility of +problems close to poles. +Also, if a formulation relies on inspection to establish +the quadrant of the result, it is an indication that a vector-related +method might be preferable. + +As well as providing many routines which work in terms of specific +spherical coordinates such as \radec, SLALIB provides +two routines which operate directly on generic spherical +coordinates: +sla\_SEP +computes the separation between +two points (the distance along a great circle) and +sla\_BEAR +computes the bearing (or {\it position angle}) +of one point seen from the other. The routines +sla\_DSEP +and +sla\_DBEAR +are double precision equivalents. As a simple demonstration +of SLALIB, we will use these facilities to estimate the distance from +London to Sydney and the initial compass heading: +\goodbreak +\begin{verbatim} + IMPLICIT NONE + + * Degrees to radians + REAL D2R + PARAMETER (D2R=0.01745329252) + + * Longitudes and latitudes (radians) for London and Sydney + REAL AL,BL,AS,BS + PARAMETER (AL=-0.2*D2R,BL=51.5*D2R,AS=151.2*D2R,BS=-33.9*D2R) + + * Earth radius in km (spherical approximation) + REAL RKM + PARAMETER (RKM=6375.0) + + REAL sla_SEP,sla_BEAR + + + * Distance and initial heading (N=0, E=90) + WRITE (*,'(1X,I5,'' km,'',I4,'' deg'')') + : NINT(sla_SEP(AL,BL,AS,BS)*RKM),NINT(sla_BEAR(AL,BL,AS,BS)/D2R) + + END +\end{verbatim} +\goodbreak +(The result is 17011~km, $61^\circ$.) + +The routines +sla\_PAV and +sla\_DPAV +are equivalents of sla\_BEAR and sla\_DBEAR but starting from +direction-cosines instead of spherical coordinates. + +\subsubsection{Formatting angles} +SLALIB has routines for decoding decimal numbers +from character form and for converting angles to and from +sexagesimal form (hours, minutes, seconds or degrees, +arcminutes, arcseconds). These apparently straightforward +operations contain hidden traps which the SLALIB routines +avoid. + +There are five routines for decoding numbers from a character +string, such as might be entered using a keyboard. +They all work in the same style, and successive calls +can work their way along a single string decoding +a sequence of numbers of assorted types. Number +fields can be separated by spaces or commas, and can be defaulted +to previous values or to preset defaults. + +Three of the routines decode single numbers: +sla\_INTIN +(integer), +sla\_FLOTIN +(single precision floating point) and +sla\_DFLTIN +(double precision). A minus sign can be +detected even when the number is zero; this avoids +the frequently-encountered ``minus zero'' bug, where +declinations {\it etc.}\ in +the range $0^{\circ}$ to $-1^{\circ}$ mysteriously migrate to +the range $0^{\circ}$ to $+1^{\circ}$. +Here is an example (in Fortran) where we wish to +read two numbers, and integer {\tt IX} and a real, {\tt Y}, +with {\tt X} defaulting to zero and {\tt Y} defaulting to +{\tt X}: +\goodbreak +\begin{verbatim} + DOUBLE PRECISION Y + CHARACTER*80 A + INTEGER IX,I,J + + * Input the string to be decoded + READ (*,'(A)') A + + * Preset IX to its default value + IX = 0 + + * Point to the start of the string + I = 1 + + * Decode an integer + CALL sla_INTIN(A,I,IX,J) + IF (J.GT.1) GO TO ... (bad IX) + + * Preset Y to its default value + Y = DBLE(IX) + + * Decode a double precision number + CALL sla_DFLTIN(A,I,Y,J) + IF (J.GT.1) GO TO ... (bad Y) +\end{verbatim} +\goodbreak +Two additional routines decode a 3-field sexagesimal number: +sla\_AFIN +(degrees, arcminutes, arcseconds to single +precision radians) and +sla\_DAFIN +(the same but double precision). They also +work using other units such as hours {\it etc}.\ if +you multiply the result by the appropriate factor. An example +Fortran program which uses +sla\_DAFIN +was given earlier, in section 1.2. + +SLALIB provides four routines for expressing an angle in radians +in a preferred range. The function +sla\_RANGE +expresses an angle +in the range $\pm\pi$; +sla\_RANORM +expresses an angle in the range +$0-2\pi$. The functions +sla\_DRANGE +and +sla\_DRANRM +are double precision versions. + +Several routines +(sla\_CTF2D, +sla\_CR2AF +{\it etc.}) are provided to convert +angles to and from +sexagesimal form (hours, minute, seconds or degrees, +arcminutes and arcseconds). +They avoid the common +``converting from integer to real at the wrong time'' +bug, which produces angles like \hms{24}{59}{59}{999}. +Here is a program which displays an hour angle +stored in radians: +\goodbreak +\begin{verbatim} + DOUBLE PRECISION HA + CHARACTER SIGN + INTEGER IHMSF(4) + : + CALL sla_DR2TF(3,HA,SIGN,IHMSF) + WRITE (*,'(1X,A,3I3.2,''.'',I3.3)') SIGN,IHMSF +\end{verbatim} +\goodbreak + +\subsection {Vectors and Matrices} +As an alternative to employing a spherical polar coordinate system, +the direction of an object can be defined in terms of the sum of any +three vectors as long as they are different and +not coplanar. In practice, three vectors at right angles are +usually chosen, forming a system +of {\it Cartesian coordinates}. The {\it x}- and {\it y}-axes +lie in the fundamental plane ({\it e.g.}\ the equator in the +case of \radec), with the {\it x}-axis pointing to zero longitude. +The {\it z}-axis is normal to the fundamental plane and points +towards positive latitudes. The {\it y}-axis can lie in either +of the two possible directions, depending on whether the +coordinate system is right-handed or left-handed. +The three axes are sometimes called +a {\it triad}. For most applications involving arbitrarily +distant objects such as stars, the vector which defines +the direction concerned is constrained to have unit length. +The {\it x}-, {\it y-} and {\it z-}components +can be regarded as the scalar (dot) product of this vector +onto the three axes of the triad in turn. Because the vector +is a unit vector, +each of the three dot-products is simply the cosine of the angle +between the unit vector and the axis concerned, and the +{\it x}-, {\it y-} and {\it z-}components are sometimes +called {\it direction cosines}. + +For some applications involving objects +with the Solar System, unit vectors are inappropriate, and +it is necessary to use vectors scaled in length-units such as +AU, km {\it etc.} +In these cases the origin of the coordinate system may not be +the observer, but instead might be the Sun, the Solar-System +barycentre, the centre of the Earth {\it etc.} But whatever the application, +the final direction in which the observer sees the object can be +expressed as direction cosines. + +But where has this got us? Instead of two numbers -- a longitude and +a latitude -- we now have three numbers to look after +-- the {\it x}-, {\it y-} and +{\it z-}components -- whose quadratic sum we have somehow to contrive to +be unity. And, in addition to this apparent redundancy, +most people find it harder to visualize +problems in terms of \xyz\ than in $[\,\theta,\phi~]$. +Despite these objections, the vector approach turns out to have +significant advantages over the spherical trigonometry approach: +\begin{itemize} +\item Vector formulae tend to be much more succinct; one vector + operation is the equivalent of strings of sines and cosines. +\item The formulae are as a rule rigorous, even at the poles. +\item Accuracy is maintained all over the celestial sphere. + When one Cartesian component is nearly unity and + therefore insensitive to direction, the others become small + and therefore more precise. +\item Formulations usually deliver the quadrant of the result + without the need for any inspection (except within the + library function ATAN2). +\end{itemize} +A number of important transformations in positional +astronomy turn out to be nothing more than changes of coordinate +system, something which is especially convenient if +the vector approach is used. A direction with respect +to one triad can be expressed relative to another triad simply +by multiplying the \xyz\ column vector by the appropriate +$3\times3$ orthogonal matrix +(a tensor of Rank~2, or {\it dyadic}). The three rows of this +{\it rotation matrix}\/ +are the vectors in the old coordinate system of the three +new axes, and the transformation amounts to obtaining the +dot-product of the direction-vector with each of the three +new axes. Precession, nutation, \hadec\ to \azel, +\radec\ to \gal\ and so on are typical examples of the +technique. A useful property of the rotation matrices +is that they can be inverted simply by taking the transpose. + +The elements of these vectors and matrices are assorted combinations of +the sines and cosines of the various angles involved (hour angle, +declination and so on, depending on which transformation is +being applied). If you write out the matrix multiplications +in full you get expressions which are essentially the same as the +equivalent spherical trigonometry formulae. Indeed, many of the +standard formulae of spherical trigonometry are most easily +derived by expressing the problem initially in +terms of vectors. + +\subsubsection{Using vectors} +SLALIB provides conversions between spherical and vector +form +(sla\_CS2C, +sla\_CC2S +{\it etc.}), plus an assortment +of standard vector and matrix operations +(sla\_VDV, +sla\_MXV +{\it etc.}). +There are also routines +(sla\_EULER +{\it etc.}) for creating a rotation matrix +from three {\it Euler angles}\/ (successive rotations about +specified Cartesian axes). Instead of Euler angles, a rotation +matrix can be expressed as an {\it axial vector}\/ (the pole of the rotation, +and the amount of rotation), and routines are provided for this +(sla\_AV2M, +sla\_M2AV +{\it etc.}). + +Here is an example where spherical coordinates {\tt P1} and {\tt Q1} +undergo a coordinate transformation and become {\tt P2} and {\tt Q2}; +the transformation consists of a rotation of the coordinate system +through angles {\tt A}, {\tt B} and {\tt C} about the +{\it z}, new {\it y}\/ and new {\it z}\/ axes respectively: +\goodbreak +\begin{verbatim} + REAL A,B,C,R(3,3),P1,Q1,V1(3),V2(3),P2,Q2 + : + * Create rotation matrix + CALL sla_EULER('ZYZ',A,B,C,R) + + * Transform position (P,Q) from spherical to Cartesian + CALL sla_CS2C(P1,Q1,V1) + + * Multiply by rotation matrix + CALL sla_MXV(R,V1,V2) + + * Back to spherical + CALL sla_CC2S(V2,P2,Q2) +\end{verbatim} +\goodbreak +Small adjustments to the direction of a position +vector are often most conveniently described in terms of +$[\,\Delta x,\Delta y, \Delta z\,]$. Adding the correction +vector needs careful handling if the position +vector is to remain of length unity, an advisable precaution which +ensures that +the \xyz\ components are always available to mean the cosines of +the angles between the vector and the axis concerned. Two types +of shifts are commonly used, +the first where a small vector of arbitrary direction is +added to the unit vector, and the second where there is a displacement +in the latitude coordinate (declination, elevation {\it etc.}) alone. + +For a shift produced by adding a small \xyz\ vector ${\bf D}$ to a +unit vector ${\bf V1}$, the resulting vector ${\bf V2}$ has direction +$<{\bf V1}+{\bf D}>$ but is no longer of unit length. A better approximation +is available if the result is multiplied by a scaling factor of +$(1-{\bf D}\cdot{\bf V1})$, where the dot +means scalar product. In Fortran: +\goodbreak +\begin{verbatim} + F = (1D0-(DX*V1X+DY*V1Y+DZ*V1Z)) + V2X = F*(V1X+DX) + V2Y = F*(V1Y+DY) + V2Z = F*(V1Z+DZ) +\end{verbatim} +\goodbreak +\noindent +The correction for diurnal aberration (discussed later) is +an example of this form of shift. + +As an example of the second kind of displacement +we will apply a small change in elevation $\delta E$ to an +\azel\ direction vector. The direction of the +result can be obtained by making the allowable approximation +${\tan \delta E\approx\delta E}$ and adding a adjustment +vector of length $\delta E$ normal +to the direction vector in the vertical plane containing the direction +vector. The $z$-component of the adjustment vector is +$\delta E \cos E$, +and the horizontal component is +$\delta E \sin E$ which has then to be +resolved into $x$ and $y$ in proportion to their current sizes. To +approximate a unit vector more closely, a correction factor of +$\cos \delta E$ can then be applied, which is nearly +$(1-\delta E^2 /2)$ for +small $\delta E$. Expressed in Fortran, for initial vector +{\tt V1X,V1Y,V1Z}, change in elevation {\tt DEL} +(+ve $\equiv$ upwards), and result +vector {\tt V2X,V2Y,V2Z}: +\goodbreak +\begin{verbatim} + COSDEL = 1DO-DEL*DEL/2D0 + R1 = SQRT(V1X*V1X+V1Y*V1Y) + F = COSDEL*(R1-DEL*V1Z)/R1 + V2X = F*V1X + V2Y = F*V1Y + V2Z = COSDEL*(V1Z+DEL*R1) +\end{verbatim} +\goodbreak +An example of this type of shift is the correction for atmospheric +refraction (see later). +Depending on the relationship between $\delta E$ and $E$, special +handling at the pole (the zenith for our example) may be required. + +SLALIB includes routines for the case where both a position +and a velocity are involved. The routines +sla\_CS2C6 +and +sla\_CC62S +convert from $[\theta,\phi,\dot{\theta},\dot{\phi}]$ +to \xyzxyzd\ and back; +sla\_DCS26 +and +sla\_DC62S +are double precision equivalents. + +\subsection {Celestial Coordinate Systems} +SLALIB has routines to perform transformations +of celestial positions between different spherical +coordinate systems, including those shown in the following table: + +\begin{center} +\begin{tabular}{|l|c|c|c|c|c|c|} \hline +{\it system} & {\it symbols} & {\it longitude} & {\it latitude} & + {\it x-y plane} & {\it long.\ zero} & {\it RH/LH} +\\ \hline \hline +horizon & -- & azimuth & elevation & horizontal & north & L +\\ \hline +equatorial & $\alpha,\delta$ & R.A.\ & Dec.\ & equator & equinox & R +\\ \hline +local equ.\ & $h,\delta$ & H.A.\ & Dec.\ & equator & meridian & L +\\ \hline +ecliptic & $\lambda,\beta$ & ecl.\ long.\ & ecl.\ lat.\ & + ecliptic & equinox & R +\\ \hline +galactic & $l^{I\!I},b^{I\!I}$ & gal.\ long.\ & gal.\ lat.\ & + gal.\ equator & gal.\ centre & R +\\ \hline +supergalactic & SGL,SGB & SG long.\ & SG lat.\ & + SG equator & node w.\ gal.\ equ.\ & R +\\ \hline +\end{tabular} +\end{center} +Transformations between \hadec\ and \azel\ can be performed by +calling +sla\_E2H +and +sla\_H2E, +or, in double precision, +sla\_DE2H +and +sla\_DH2E. +There is also a routine for obtaining +zenith distance alone for a given \hadec, +sla\_ZD, +and one for determining the parallactic angle, +sla\_PA. +Three routines are included which relate to altazimuth telescope +mountings. For a given \hadec\ and latitude, +sla\_ALTAZ +returns the azimuth, elevation and parallactic angle, plus +velocities and accelerations for sidereal tracking. +The routines +sla\_PDA2H +and +sla\_PDQ2H +predict at what hour angle a given azimuth or +parallactic angle will be reached. + +The routines +sla\_EQECL +and +sla\_ECLEQ +transform between ecliptic +coordinates and \radec\/; there is also a routine for generating the +equatorial to ecliptic rotation matrix for a given date: +sla\_ECMAT. + +For conversion between Galactic coordinates and \radec\ there are +two sets of routines, depending on whether the \radec\ is +old-style, B1950, or new-style, J2000; +sla\_EG50 +and +sla\_GE50 +are \radec\ to \gal\ and {\it vice versa}\/ for the B1950 case, while +sla\_EQGAL +and +sla\_GALEQ +are the J2000 equivalents. + +Finally, the routines +sla\_GALSUP +and +sla\_SUPGAL +transform \gal\ to de~Vaucouleurs supergalactic longitude and latitude +and {\it vice versa.} + +It should be appreciated that the table, above, constitutes +a gross oversimplification. Apparently +simple concepts such as equator, equinox {\it etc.}\ are apt to be very hard to +pin down precisely (polar motion, orbital perturbations \ldots) and +some have several interpretations, all subtly different. The various +frames move in complicated ways with respect to one another or to +the stars (themselves in motion). And in some instances the +coordinate system is slightly distorted, so that the +ordinary rules of spherical trigonometry no longer strictly apply. + +These {\it caveats}\/ +apply particularly to the bewildering variety of different +\radec\ systems that are in use. Figure~1 shows how +some of these systems are related, to one another and +to the direction in which a celestial source actually +appears in the sky. At the top of the diagram are +the various sorts of {\it mean place}\/ +found in star catalogues and papers;\footnote{One frame not included in +Figure~1 is that of the Hipparcos catalogue. This is currently the +best available implementation in the optical of the {\it International +Celestial Reference System}\/ (ICRS), which is based on extragalactic +radio sources observed by VLBI. The distinction between FK5 J2000 +and Hipparcos coordinates only becomes important when accuracies of +50~mas or better are required. More details are given in +Section~4.14.} at the bottom is the +{\it observed}\/ \azel, where a perfect theodolite would +be pointed to see the source; and in the body of +the diagram are +the intermediate processing steps and coordinate +systems. To help +understand this diagram, and the SLALIB routines that can +be used to carry out the various calculations, we will look at the coordinate +systems involved, and the astronomical phenomena that +affect them. + +\begin{figure} +\begin{center} +\begin{tabular}{|cccccc|} \hline +& & & & & \\ +\hspace{5em} & \hspace{5em} & \hspace{5em} & + \hspace{5em} & \hspace{5em} & \hspace{5em} \\ +\multicolumn{2}{|c}{\hspace{0em}\fbox{\parbox{8.5em}{\center \vspace{-2ex} + mean \radec, FK4, \\ + any equinox + \vspace{0.5ex}}}} & + \multicolumn{2}{c}{\hspace{0em}\fbox{\parbox{8.5em}{\center \vspace{-2ex} + mean \radec, FK4, + no $\mu$, any equinox + \vspace{0.5ex}}}} & +\multicolumn{2}{c|}{\hspace{0em}\fbox{\parbox{8.5em}{\center \vspace{-2ex} + mean \radec, FK5, \\ + any equinox + \vspace{0.5ex}}}} \\ +& \multicolumn{2}{|c|}{} & \multicolumn{2}{c|}{} & \\ +\multicolumn{2}{|c}{space motion} & \multicolumn{1}{c|}{} & & + \multicolumn{2}{c|}{space motion} \\ +\multicolumn{2}{|c}{-- E-terms} & + \multicolumn{2}{c}{-- E-terms} & \multicolumn{1}{c|}{} & \\ +\multicolumn{2}{|c}{precess to B1950} & \multicolumn{2}{c}{precess to B1950} & + \multicolumn{2}{c|}{precess to J2000} \\ +\multicolumn{2}{|c}{+ E-terms} & + \multicolumn{2}{c}{+ E-terms} & \multicolumn{1}{c|}{} & \\ +\multicolumn{2}{|c}{FK4 to FK5, no $\mu$} & + \multicolumn{2}{c}{FK4 to FK5, no $\mu$} & \multicolumn{1}{c|}{} & \\ +\multicolumn{2}{|c}{parallax} & \multicolumn{1}{c|}{} & & + \multicolumn{2}{c|}{parallax} \\ +& \multicolumn{2}{|c|}{} & \multicolumn{2}{c|}{} & \\ \cline{2-5} +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{\parbox{18em}{\center \vspace{-2ex} + FK5, J2000, current epoch, geocentric + \vspace{0.5ex}}}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{light deflection} & \\ +& \multicolumn{4}{c}{annual aberration} & \\ +& \multicolumn{4}{c}{precession/nutation} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Apparent \radec}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{Earth rotation} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Apparent \hadec}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{diurnal aberration} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Topocentric \hadec}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\hadec\ to \azel} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Topocentric \azel}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{refraction} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Observed \azel}} & \\ +& & & & & \\ +& & & & & \\ \hline +\end{tabular} +\end{center} +\vspace{-0.5ex} +\caption{Relationship Between Celestial Coordinates} + +Star positions are published or catalogued using +one of the mean \radec\ systems shown at +the top. The ``FK4'' systems +were used before about 1980 and are usually +equinox B1950. The ``FK5'' system, equinox J2000, is now preferred, +or rather its modern equivalent, the International Celestial Reference +Frame (in the optical, the Hipparcos catalogue). +The figure relates a star's mean \radec\ to the actual +line-of-sight to the star. +Note that for the conventional choices of equinox, namely +B1950 or J2000, all of the precession and E-terms corrections +are superfluous. +\end{figure} + +\subsection{Precession and Nutation} +{\it Right ascension and declination}, (\radec), are the names +of the longitude and latitude in a spherical +polar coordinate system based on the Earth's axis of rotation. +The zero point of $\alpha$ is the point of intersection of +the {\it celestial +equator}\/ and the {\it ecliptic}\/ (the apparent path of the Sun +through the year) where the Sun moves into the northern +hemisphere. This point is called the +{\it first point of Aries}, +the {\it vernal equinox}\/ (with apologies to +southern-hemisphere readers) or simply the {\it equinox}.\footnote{With +the introduction of the International Celestial Reference System (ICRS), the +connection between (i)~star coordinates and (ii)~the Earth's orientation +and orbit has been broken. However, the orientation of the +International Celestial Reference Frame (ICRF) axes was, for convenience, +chosen to match J2000 FK5, and for most practical purposes ICRF coordinates +(for example entries in the Hipparcos catalogue) can be regarded as +synonymous with J2000 FK5. See Section 4.14 for further details.} + +This simple picture is unfortunately +complicated by the difficulty of defining +a suitable equator and equinox. One problem is that the +Sun's apparent motion is not completely regular, due to the +ellipticity of the Earth's orbit and its continuous disturbance +by the Moon and planets. This is dealt with by +separating the motion into (i)~a smooth and steady {\it mean Sun}\/ +and (ii)~a set of periodic corrections and perturbations; only the former +is involved in establishing reference frames and timescales. +A second, far larger problem, is that +the celestial equator and the ecliptic +are both moving with respect to the stars. +These motions arise because of the gravitational +interactions between the Earth and the other solar-system bodies. + +By far the largest effect is the +so-called ``precession of the equinoxes'', where the Earth's +rotation axis sweeps out a cone centred on the ecliptic +pole, completing one revolution in about 26,000 years. The +cause of the motion is the torque exerted on the distorted and +spinning Earth by the Sun and the Moon. Consider the effect of the +Sun alone, at or near the northern summer solstice. The Sun +`sees' the top (north pole) of the Earth tilted towards it +(by about \degree{23}{5}, the {\it obliquity of the +ecliptic}\/), +and sees the nearer part of the Earth's equatorial bulge +below centre and the further part above centre. +Although the Earth is in free fall, +the gravitational force on the nearer part of the +equatorial bulge is greater than that on the further part, and +so there is a net torque acting +as if to eliminate the tilt. Six months later the same thing +is happening in reverse, except that the torque is still +trying to eliminate the tilt. In between (at the equinoxes) the +torque shrinks to zero. A torque acting on a spinning body +is gyroscopically translated +into a precessional motion of the spin axis at right-angles to the torque, +and this happens to the Earth. +The motion varies during the +year, going through two maxima, but always acts in the +same direction. The Moon produces the same effect, +adding a contribution to the precession which peaks twice +per month. The Moon's proximity to the Earth more than compensates +for its smaller mass and gravitational attraction, so that it +in fact contributes most of the precessional effect. + +The complex interactions between the three bodies produce a +precessional motion that is wobbly rather than completely smooth. +However, the main 26,000-year component is on such a grand scale that +it dwarfs the remaining terms, the biggest of +which has an amplitude of only \arcseci{17} and a period of +about 18.6~years. This difference of scale makes it convenient to treat +these two components of the motion separately. The main 26,000-year +effect is called {\it luni-solar precession}; the smaller, +faster, periodic terms are called the {\it nutation}. + +Note that precession and nutation are simply +different frequency components of the same physical effect. It is +a common misconception that precession is caused +by the Sun and nutation is caused by the Moon. In fact +the Moon is responsible for two-thirds of the precession, and, +while it is true that much of the complex detail of the nutation is +a reflection of the intricacies of the lunar orbit, there are +nonetheless important solar terms in the nutation. + +In addition to and quite separate +from the precession/nutation effect, the orbit of the Earth-Moon system +is not fixed in orientation, a result of the attractions of the +planets. This slow (about \arcsec{0}{5}~per~year) +secular rotation of the ecliptic about a slowly-moving diameter is called, +confusingly, {\it planetary +precession}\/ and, along with the luni-solar precession is +included in the {\it general precession}. The equator and +ecliptic as affected by general precession +are what define the various ``mean'' \radec\ reference frames. + +The models for precession and nutation come from a combination +of observation and theory, and are subject to continuous +refinement. Nutation models in particular have reached a high +degree of sophistication, taking into account such things as +the non-rigidity of the Earth and the effects of +the planets; SLALIB's nutation +model (IAU~1980) involves 106 terms in each of $\psi$ (longitude) +and $\epsilon$ (obliquity), some as small as \arcsec{0}{0001}. + +\subsubsection{SLALIB support for precession and nutation} +SLALIB offers a choice of three precession models: +\begin{itemize} +\item The old Bessel-Newcomb, pre IAU~1976, ``FK4'' model, used for B1950 + star positions and other pre-1984.0 purposes +(sla\_PREBN). +\item The new Fricke, IAU~1976, ``FK5'' model, used for J2000 star + positions and other post-1984.0 purposes +(sla\_PREC). +\item A model published by Simon {\it et al.}\ which is more accurate than + the IAU~1976 model and which is suitable for long + periods of time +(sla\_PRECL). +\end{itemize} +In each case, the named SLALIB routine generates the $(3\times3)$ +{\it precession +matrix}\/ for a given start and finish time. For example, +here is the Fortran code for generating the rotation +matrix which describes the precession between the epochs +J2000 and J1985.372 (IAU 1976 model): +\goodbreak +\begin{verbatim} + DOUBLE PRECISION PMAT(3,3) + : + CALL sla_PREC(2000D0,1985.372D0,PMAT) +\end{verbatim} +\goodbreak +It is instructive to examine the resulting matrix: +\goodbreak +\begin{verbatim} + +0.9999936402 +0.0032709208 +0.0014214694 + -0.0032709208 +0.9999946505 -0.0000023247 + -0.0014214694 -0.0000023248 +0.9999989897 +\end{verbatim} +\goodbreak +Note that the diagonal elements are close to unity, and the +other elements are small. This shows that over an interval as +short as 15~years the precession isn't going to move a +position vector very far (in this case about \degree{0}{2}). + +For convenience, a direct \radec\ to \radec\ precession routine is +also provided +(sla\_PRECES), +suitable for either the old or the new system (but not a +mixture of the two). + +SLALIB provides only one nutation model, the new, IAU~1980 model, +implemented in the routine +sla\_NUTC. +This returns the components of nutation +in longitude and latitude (and also provides the obliquity) from +which a nutation matrix can be generated by calling +sla\_DEULER +(and from which the {\it equation of the equinoxes}, described +later, can be found). Alternatively, +the nutation matrix can be generated in a single call by using +sla\_NUT. + +A rotation matrix for applying the entire precession/nutation +transformation in one go can be generated by calling +sla\_PRENUT. + +\subsection{Mean Places} +The main effect of the precession/nutation is a steady increase of about +\arcseci{50}/year in the ecliptic longitudes of the stars. It is therefore +essential, when reporting the position of an astronomical target, to +qualify the coordinates with a date, or {\it epoch}. +Specifying the epoch ties down the equator and +equinox which define the \radec\ coordinate system that is +being used. +\footnote{An equinox is, however, not required for coordinates +in the International Celestial Reference System. Such coordinates must +be labelled simply ``ICRS'', or the specific catalogue can be mentioned, +such as ``Hipparcos''; constructions such as ``Hipparcos, J2000'' are +redundant and misleading.} For simplicity, only +the smooth and steady ``general +precession'' part of the complete precession/nutation effect is +included, thereby defining what is called the {\it mean}\/ +equator and equinox for the epoch concerned. We say a star +has a mean place of (for example) +\hms{12}{07}{58}{09}~\dms{-19}{44}{37}{1} ``with respect to the mean equator +and equinox of epoch J2000''. The short way of saying +this is ``\radec\ equinox J2000'' ({\bf not} ``\radec\ epoch J2000'', +which means something different to do with +proper motion). + +\subsection{Epoch} +The word ``epoch'' just means a moment in time, and can be supplied +in a variety of forms, using different calendar systems and timescales. + +For the purpose of specifying the epochs associated with the +mean place of a star, two conventions exist. Both sorts of epoch +superficially resemble years AD but are not tied to the civil +(Gregorian) calendar; to distinguish them from ordinary calendar-years +there is often +a ``.0'' suffix (as in ``1950.0''), although any other fractional +part is perfectly legal ({\it e.g.}\ 1987.5). + +The older system, +{\it Besselian epoch}, is defined in such a way that its units are +tropical years of about 365.2422~days and its timescale is the +obsolete {\it Ephemeris Time}. +The start of the Besselian year is the moment +when the ecliptic longitude of the mean Sun is +$280^{\circ}$; this happens near the start of the +calendar year (which is why $280^{\circ}$ was chosen). + +The new system, {\it Julian epoch}, was adopted as +part of the IAU~1976 revisions (about which more will be said +in due course) and came formally into use at the +beginning of 1984. It uses the Julian year of exactly +365.25~days; Julian epoch 2000 is defined to be 2000~January~1.5 in the +TT timescale. + +For specifying mean places, various standard epochs are in use, the +most common ones being Besselian epoch 1950.0 and Julian epoch 2000.0. +To distinguish the two systems, Besselian epochs +are now prefixed ``B'' and Julian epochs are prefixed ``J''. +Epochs without an initial letter can be assumed to be Besselian +if before 1984.0, otherwise Julian. These details are supported by +the SLALIB routines +sla\_DBJIN +(decodes numbers from a +character string, accepting an optional leading B or J), +sla\_KBJ +(decides whether B or J depending on prefix or range) and +sla\_EPCO +(converts one epoch to match another). + +SLALIB has four routines for converting +Besselian and Julian epochs into other forms. +The functions +sla\_EPB2D +and +sla\_EPJ2D +convert Besselian and Julian epochs into MJD; the functions +sla\_EPB +and +sla\_EPJ +do the reverse. For example, to express B1950 as a Julian epoch: +\goodbreak +\begin{verbatim} + DOUBLE PRECISION sla_EPJ,sla_EPB2D + : + WRITE (*,'(1X,''J'',F10.5)') sla_EPJ(sla_EPB2D(1950D0)) +\end{verbatim} +\goodbreak +(The answer is J1949.99979.) + +\subsection{Proper Motion} +Stars in catalogues usually have, in addition to the +\radec\ coordinates, a {\it proper motion} $[\mu_\alpha,\mu_\delta]$. +This is an intrinsic motion +of the star across the background. Very few stars have a +proper motion which exceeds \arcseci{1}/year, and most are +far below this level. A star observed as part of normal +astronomy research will, as a rule, have a proper motion +which is unknown. + +Mean \radec\ and rate of change are not sufficient to pin +down a star; the epoch at which the \radec\ was or will +be correct is also needed. Note the distinction +between the epoch which specifies the +coordinate system and the epoch at which the star passed +through the given \radec. The full specification for a star +is \radec, proper motions, equinox and epoch (plus something to +identify which set of models for the precession {\it etc.}\ is +being used -- see the next section). +For convenience, coordinates given in star catalogues are almost +always adjusted to make the equinox and epoch the same -- for +example B1950 in the case of the SAO~catalogue. + +SLALIB provides one routine to handle proper motion on its own, +sla\_PM. +Proper motion is also allowed for in various other +routines as appropriate, for example +sla\_MAP +and +sla\_FK425. +Note that in all SLALIB routines which involve proper motion +the units are radians per year and the +$\alpha$ component is in the form $\dot{\alpha}$ ({\it i.e.}\ big +numbers near the poles). +Some star catalogues have proper motion per century, and +in some catalogues the $\alpha$ component is in the form +$\dot{\alpha}\cos\delta$ ({\it i.e.}\ angle on the sky). + +\subsection{Parallax and Radial Velocity} +For the utmost accuracy and the nearest stars, allowance can +be made for {\it annual parallax}\/ and for the effects of perspective +on the proper motion. + +Parallax is appreciable only for nearby stars; even +the nearest, Proxima Centauri, is displaced from its average +position by less than +an arcsecond as the Earth revolves in its orbit. + +For stars with a known parallax, knowledge of the radial velocity +allows the proper motion to be expressed as an actual space +motion in 3~dimensions. The proper motion is, +in fact, a snapshot of the transverse component of the +space motion, and in the case of nearby stars will +change with time due to perspective. + +SLALIB does not provide facilities for handling parallax +and radial-velocity on their own, but their contribution is +allowed for in such routines as +sla\_PM, +sla\_MAP +and +sla\_FK425. +Catalogue mean +places do not include the effects of parallax and are therefore +{\it barycentric}; when pointing telescopes {\it etc.}\ it is +usually most efficient to apply the slowly-changing +parallax correction to the mean place of the target early on +and to work with the {\it geocentric}\/ mean place. This latter +approach is implied in Figure~1. + +\subsection{Aberration} +The finite speed of light combined with the motion of the observer +around the Sun during the year causes apparent displacements of +the positions of the stars. The effect is called +the {\it annual aberration} (or ``stellar'' +aberration). Its maximum size, about \arcsec{20}{5}, +occurs for stars $90^{\circ}$ from the point towards which +the Earth is headed as it orbits the Sun; a star exactly in line with +the Earth's motion is not displaced. To receive the light of +a star, the telescope has to be offset slightly in the direction of +the Earth's motion. A familiar analogy is the need to tilt your +umbrella forward when on the move, to avoid getting wet. This +Newtonian model is, +in fact, highly misleading in the context of light as opposed +to rain, but happens to give the same answer as a relativistic +treatment to first order (better than 1~milliarcsecond). + +Before the IAU 1976 resolutions, different +values for the approximately +\arcsec{20}{5} {\it aberration constant}\/ were employed +at different times, and this can complicate comparisons +between different catalogues. Another complication comes from +the so-called {\it E-terms of aberration}, +that small part of the annual aberration correction that is a +function of the eccentricity of the Earth's orbit. The E-terms, +maximum amplitude about \arcsec{0}{3}, +happen to be approximately constant for a given star, and so they +used to be incorporated in the catalogue \radec\/ +to reduce the labour of converting to and from apparent place. +The E-terms can be removed from a catalogue \radec\/ by +calling +sla\_SUBET +or applied (for example to allow a pulsar +timing-position to be plotted on a B1950 finding chart) +by calling +sla\_ADDET; +the E-terms vector itself can be obtained by calling +sla\_ETRMS. +Star positions post IAU 1976 are free of these distortions, and to +apply corrections for annual aberration involves the actual +barycentric velocity of the Earth rather than the use of +canonical circular-orbit models. + +The annual aberration is the aberration correction for +an imaginary observer at the Earth's centre. +The motion of a real observer around the Earth's rotation axis in +the course of the day makes a small extra contribution to the total +aberration effect called the {\it diurnal aberration}. Its +maximum amplitude is about \arcsec{0}{2}. + +No SLALIB routine is provided for calculating the aberration on +its own, though the required velocity vectors can be +generated using +sla\_EVP +and +sla\_GEOC. +Annual and diurnal aberration are allowed for where required, for example in +sla\_MAP +{\it etc}.\ and +sla\_AOP +{\it etc}. Note that this sort +of aberration is different from the {\it planetary +aberration}, which is the apparent displacement of a solar-system +body, with respect to the ephemeris position, as a consequence +of the motion of {\it both}\/ the Earth and the source. The +planetary aberration can be computed either by correcting the +position of the solar-system body for light-time, followed by +the ordinary stellar aberration correction, or more +directly by expressing the position and velocity of the source +in the observer's frame and correcting for light-time alone. + +\subsection{Different Sorts of Mean Place} +A particularly confusing aspect of published mean places is that they +are sensitive to the precise way they were determined. A mean +place is not directly observable, even with fundamental +instruments such as transit circles, and to produce a mean +place will involve relying on some existing star catalogue, +for example the fundamental catalogues FK4 and FK5, +and applying given mathematical models of precession, nutation, +aberration and so on. +Note in particular that no star catalogue, +even a fundamental catalogue such as FK4 or +FK5, defines a coordinate system, strictly speaking; +it is merely a list of star positions and proper motions. +However, once the stars from a given catalogue +are used as position calibrators, {\it e.g.}\ for +transit-circle observations or for plate reductions, then a +broader sense of there being a coordinate grid naturally +arises, and such phrases as ``in the system of +the FK4'' can legitimately be employed. However, +there is no formal link between the +two concepts -- no ``standard least squares fit'' between +reality and the inevitably flawed catalogues.\footnote{This was +true until the inception of the International Celestial Reference +System, which is based on the idea of axes locked into the +distant background. The coordinates +of the extragalactic sources which realize these +axes have no individual significance; there is a ``no net rotation'' +condition which has to be satisfied each time any revisions take +place.} All such +catalogues suffer at some level from systematic, zonal distortions +of both the star positions and of the proper motions, +and include measurement errors peculiar to individual +stars. + +Many of these complications are of little significance except to +specialists. However, observational astronomers cannot +escape exposure to at least the two main varieties of +mean place, loosely called +FK4 and FK5, and should be aware of +certain pitfalls. For most practical purposes the more recent +system, FK5, is free of surprises and tolerates naive +use well. FK4, in contrast, contains two important traps: +\begin{itemize} +\item The FK4 system rotates at about + \arcsec{0}{5} per century relative to distant galaxies. + This is manifested as a systematic distortion in the + proper motions of all FK4-derived catalogues, which will + in turn pollute any astrometry done using those catalogues. + For example, FK4-based astrometry of a QSO using plates + taken decades apart will reveal a non-zero {\it fictitious proper + motion}, and any FK4 star which happens to have zero proper + motion is, in fact, slowly moving against the distant + background. The FK4 frame rotates because it was + established before the nature of the Milky Way, and hence the + existence of systematic motions of nearby stars, had been + recognized. +\item Star positions in the FK4 system are part-corrected for + annual aberration (see above) and embody the so-called + E-terms of aberration. +\end{itemize} +The change from the old FK4-based system to FK5 +occurred at the beginning +of 1984 as part of a package of resolutions made by the IAU in 1976, +along with the adoption of J2000 as the reference epoch. Star +positions in the newer, FK5, system are free from the E-terms, and +the system is a much better approximation to an +inertial frame (about five times better). + +It may occasionally be convenient to specify the FK4 fictitious proper +motion directly. In FK4, the centennial proper motion of (for example) +a QSO is: + +$\mu_\alpha=-$\tsec{0}{015869}$ + +(($\tsec{0}{029032}$~\sin \alpha + +$\tsec{0}{000340}$~\cos \alpha ) \sin \delta + -$\tsec{0}{000105}$~\cos \alpha + -$\tsec{0}{000083}$~\sin \alpha ) \sec \delta $ \\ +$\mu_\delta\,=+$\arcsec{0}{43549}$~\cos \alpha + -$\arcsec{0}{00510}$~\sin \alpha + + ($\arcsec{0}{00158}$~\sin \alpha + -$\arcsec{0}{00125}$~\cos \alpha ) \sin \delta + -$\arcsec{0}{00066}$~\cos \delta $ + +\subsection{Mean Place Transformations} +Figure~1 is based upon three varieties of mean \radec\ all of which are +of practical significance to observing astronomers in the present era: +\begin{itemize} + \item Old style (FK4) with known proper motion in the FK4 + system, and with parallax and radial velocity either + known or assumed zero. + \item Old style (FK4) with zero proper motion in FK5, + and with parallax and radial velocity assumed zero. + \item New style (FK5) with proper motion, parallax and + radial velocity either known or assumed zero. +\end{itemize} +The figure outlines the steps required to convert positions in +any of these systems to a J2000 \radec\ for the current +epoch, as might be required in a telescope-control +program for example. +Most of the steps can be carried out by calling a single +SLALIB routines; there are other SLALIB routines which +offer set-piece end-to-end transformation routines for common cases. +Note, however, that SLALIB does not set out to provide the capability +for arbitrary transformations of star-catalogue data +between all possible systems of mean \radec. +Only in the (common) cases of FK4, equinox and epoch B1950, +to FK5, equinox and epoch J2000, and {\it vice versa}\/ are +proper motion, parallax and radial velocity transformed +along with the star position itself, the +focus of SLALIB support. + +As an example of using SLALIB to transform mean places, here is +a program which implements the top-left path of Figure~1. +An FK4 \radec\ of arbitrary equinox and epoch and with +known proper motion and +parallax is transformed into an FK5 J2000 \radec\ for the current +epoch. As a test star we will use $\alpha=$\hms{16}{09}{55}{13}, +$\delta=$\dms{-75}{59}{27}{2}, equinox 1900, epoch 1963.087, +$\mu_\alpha=$\tsec{-0}{0312}$/y$, $\mu_\delta=$\arcsec{+0}{103}$/y$, +parallax = \arcsec{0}{062}, radial velocity = $-34.22$~km/s. The +epoch of observation is 1994.35. +\goodbreak +\begin{verbatim} + IMPLICIT NONE + DOUBLE PRECISION AS2R,S2R + PARAMETER (AS2R=4.8481368110953599D-6,S2R=7.2722052166430399D-5) + INTEGER J,I + DOUBLE PRECISION R0,D0,EQ0,EP0,PR,PD,PX,RV,EP1,R1,D1,R2,D2,R3,D3, + : R4,D4,R5,D5,R6,D6,EP1D,EP1B,W(3),EB(3),PXR,V(3) + DOUBLE PRECISION sla_EPB,sla_EPJ2D + + * RA, Dec etc of example star + CALL sla_DTF2R(16,09,55.13D0,R0,J) + CALL sla_DAF2R(75,59,27.2D0,D0,J) + D0=-D0 + EQ0=1900D0 + EP0=1963.087D0 + PR=-0.0312D0*S2R + PD=+0.103D0*AS2R + PX=0.062D0 + RV=-34.22D0 + EP1=1994.35D0 + + * Epoch of observation as MJD and Besselian epoch + EP1D=sla_EPJ2D(EP1) + EP1B=sla_EPB(EP1D) + + * Space motion to the current epoch + CALL sla_PM(R0,D0,PR,PD,PX,RV,EP0,EP1B,R1,D1) + + * Remove E-terms of aberration for the original equinox + CALL sla_SUBET(R1,D1,EQ0,R2,D2) + + * Precess to B1950 + R3=R2 + D3=D2 + CALL sla_PRECES('FK4',EQ0,1950D0,R3,D3) + + * Add E-terms for the standard equinox B1950 + CALL sla_ADDET(R3,D3,1950D0,R4,D4) + + * Transform to J2000, no proper motion + CALL sla_FK45Z(R4,D4,EP1B,R5,D5) + + * Parallax + CALL sla_EVP(sla_EPJ2D(EP1),2000D0,W,EB,W,W) + PXR=PX*AS2R + CALL sla_DCS2C(R5,D5,V) + DO I=1,3 + V(I)=V(I)-PXR*EB(I) + END DO + CALL sla_DCC2S(V,R6,D6) + : +\end{verbatim} +\goodbreak +It is interesting to look at how the \radec\ changes during the +course of the calculation: +\begin{tabbing} +xxxxxxxxxxxxxx \= xxxxxxxxxxxxxxxxxxxxxxxxx \= x \= \kill +\> {\tt 16 09 55.130 -75 59 27.20} \> \> {\it original equinox and epoch} \\ +\> {\tt 16 09 54.155 -75 59 23.98} \> \> {\it with space motion} \\ +\> {\tt 16 09 54.229 -75 59 24.18} \> \> {\it with old E-terms removed} \\ +\> {\tt 16 16 28.213 -76 06 54.57} \> \> {\it precessed to 1950.0} \\ +\> {\tt 16 16 28.138 -76 06 54.37} \> \> {\it with new E-terms} \\ +\> {\tt 16 23 07.901 -76 13 58.87} \> \> {\it J2000, current epoch} \\ +\> {\tt 16 23 07.907 -76 13 58.92} \> \> {\it including parallax} +\end{tabbing} + +Other remarks about the above (unusually complicated) example: +\begin{itemize} +\item If the original equinox and epoch were B1950, as is quite + likely, then it would be unnecessary to treat space motions + and E-terms explicitly. Transformation to FK5 J2000 could + be accomplished simply by calling +sla\_FK425, after which + a call to +sla\_PM and the parallax code would complete the + work. +\item The rigorous treatment of the E-terms + has only a small effect on the result. Such refinements + are, nevertheless, worthwhile in order to facilitate comparisons and + to increase the chances that star positions from different + suppliers are compatible. +\item The FK4 to FK5 transformations, +sla\_FK425 + and +sla\_FK45Z, + are not as is sometimes assumed simply 50 years of precession, + though this indeed accounts for most of the change. The + transformations also include adjustments + to the equinox, a revised precession model, elimination of the + E-terms, a change to the proper-motion time unit and so on. + The reason there are two routines rather than just one + is that the FK4 frame rotates relative to the background, whereas + the FK5 frame is a much better approximation to an + inertial frame, and zero proper + motion in FK4 does not, therefore, mean zero proper motion in FK5. + SLALIB also provides two routines, +sla\_FK524 + and +sla\_FK54Z, + to perform the inverse transformations. +\item Some star catalogues (FK4 itself is one) were constructed using slightly + different procedures for the polar regions compared with + elsewhere. SLALIB ignores this inhomogeneity and always + applies the standard + transformations irrespective of location on the celestial sphere. +\end{itemize} + +\subsection {Mean Place to Apparent Place} +The {\it geocentric apparent place}\/ of a source, or {\it apparent place}\/ +for short, +is the \radec\ if viewed from the centre of the Earth, +with respect to the true equator and equinox of date. +Transformation of an FK5 mean \radec, equinox J2000, +current epoch, to apparent place involves the following effects: +\goodbreak +\begin{itemize} + \item Light deflection -- the gravitational lens effect of + the sun. + \item Annual aberration. + \item Precession/nutation. +\end{itemize} +The {\it light deflection}\/ is seldom significant. Its value +at the limb of the Sun is about +\arcsec{1}{74}; it falls off rapidly with distance from the +Sun and has shrunk to about +\arcsec{0}{02} at an elongation of $20^\circ$. + +As already described, the {\it annual aberration}\/ +is a function of the Earth's velocity +relative to the solar system barycentre (available through the +SLALIB routine +sla\_EVP) +and produces shifts of up to about \arcsec{20}{5}. + +The {\it precession/nutation}, from J2000 to the current epoch, is +expressed by a rotation matrix which is available through the +SLALIB routine +sla\_PRENUT. + +The whole mean-to-apparent transformation can be done using the SLALIB +routine +sla\_MAP. As a demonstration, here is a program which lists the +{\it North Polar Distance}\/ ($90^\circ-\delta$) of Polaris for +the decade of closest approach to the Pole: +\goodbreak +\begin{verbatim} + IMPLICIT NONE + DOUBLE PRECISION PI,PIBY2,D2R,S2R,AS2R + PARAMETER (PI=3.141592653589793238462643D0) + PARAMETER (D2R=PI/180D0, + : PIBY2=PI/2D0, + : S2R=PI/(12D0*3600D0), + : AS2R=PI/(180D0*3600D0)) + DOUBLE PRECISION RM,DM,PR,PD,DATE,RA,DA + INTEGER J,IDS,IDE,ID,IYMDF(4),I + DOUBLE PRECISION sla_EPJ2D + + CALL sla_DTF2R(02,31,49.8131D0,RM,J) + CALL sla_DAF2R(89,15,50.661D0,DM,J) + PR=+21.7272D0*S2R/100D0 + PD=-1.571D0*AS2R/100D0 + WRITE (*,'(1X,'// + : '''Polaris north polar distance (deg) 2096-2105''/)') + WRITE (*,'(4X,''Date'',7X''NPD''/)') + CALL sla_CLDJ(2096,1,1,DATE,J) + IDS=NINT(DATE) + CALL sla_CLDJ(2105,12,31,DATE,J) + IDE=NINT(DATE) + DO ID=IDS,IDE,10 + DATE=DBLE(ID) + CALL sla_DJCAL(0,DATE,IYMDF,J) + CALL sla_MAP(RM,DM,PR,PD,0D0,0D0,2000D0,DATE,RA,DA) + WRITE (*,'(1X,I4,2I3.2,F9.5)') (IYMDF(I),I=1,3),(PIBY2-DA)/D2R + END DO + + END +\end{verbatim} +\goodbreak +For cases where the transformation has to be repeated for different +times or for more than one star, the straightforward +sla\_MAP +approach is apt to be +wasteful as both the Earth velocity and the +precession/nutation matrix can be re-calculated relatively +infrequently without ill effect. A more efficient method is to +perform the target-independent calculations only when necessary, +by calling +sla\_MAPPA, +and then to use either +sla\_MAPQKZ, +when only the \radec\/ is known, or +sla\_MAPQK, +when full catalogue positions, including proper motion, parallax and +radial velocity, are available. How frequently to call +sla\_MAPPA +depends on the accuracy objectives; once per +night will deliver sub-arcsecond accuracy for example. + +The routines +sla\_AMP +and +sla\_AMPQK +allow the reverse transformation, from apparent to mean place. + +\subsection{Apparent Place to Observed Place} +The {\it observed place}\/ of a source is its position as +seen by a perfect theodolite at the location of the +observer. Transformation of an apparent \radec\ to observed +place involves the following effects: +\goodbreak +\begin{itemize} + \item \radec\ to \hadec. + \item Diurnal aberration. + \item \hadec\ to \azel. + \item Refraction. +\end{itemize} +The transformation from apparent \radec\ to +apparent \hadec\ is made by allowing for +{\it Earth rotation}\/ through the {\it sidereal time}, $\theta$: +\[ h = \theta - \alpha \] +For this equation to work, $\alpha$ must be the apparent right +ascension for the time of observation, and $\theta$ must be +the {\it local apparent sidereal time}. The latter is obtained +as follows: +\begin{enumerate} +\item from civil time obtain the coordinated universal time, UTC + (more later on this); +\item add the UT1$-$UTC (typically a few tenths of a second) to + give the UT; +\item from the UT compute the Greenwich mean sidereal time (using +sla\_GMST); +\item add the observer's (east) longitude, giving the local mean + sidereal time; +\item add the equation of the equinoxes (using +sla\_EQEQX). +\end{enumerate} +The {\it equation of the equinoxes}\/~($=\Delta\psi\cos\epsilon$ plus +small terms) +is the effect of nutation on the sidereal time. +Its value is typically a second or less. It is +interesting to note that if the object of the exercise is to +transform a mean place all the way into an observed place (very +often the case), +then the equation of the +equinoxes and the longitude component of nutation can both be +omitted, removing a great deal of computation. However, SLALIB +follows the normal convention and works {\it via}\/ the apparent place. + +Note that for very precise work the observer's longitude should +be corrected for {\it polar motion}. This can be done with +sla\_POLMO. +The corrections are always less than about \arcsec{0}{3}, and +are futile unless the position of the observer's telescope is known +to better than a few metres. + +Tables of observed and +predicted UT1$-$UTC corrections and polar motion data +are published every few weeks by the International Earth Rotation Service. + +The transformation from apparent \hadec\ to {\it topocentric}\/ +\hadec\ consists of allowing for +{\it diurnal aberration}. This effect, maximum amplitude \arcsec{0}{2}, +was described earlier. There is no specific SLALIB routine +for computing the diurnal aberration, +though the routines +sla\_AOP {\it etc.}\ +include it, and the required velocity vector can be +determined by calling +sla\_GEOC. + +The next stage is the major coordinate rotation from local equatorial +coordinates \hadec\ into horizon coordinates. The SLALIB routines +sla\_E2H +{\it etc.}\ can be used for this. For high-precision +applications the mean geodetic latitude should be corrected for polar +motion. + +\subsubsection{Refraction} +The final correction is for atmospheric refraction. +This effect, which depends on local meteorological conditions and +the effective colour of the source/detector combination, +increases the observed elevation of the source by a +significant effect even at moderate zenith distances, and near the +horizon by over \degree{0}{5}. The amount of refraction can by +computed by calling the SLALIB routine +sla\_REFRO; +however, +this requires as input the observed zenith distance, which is what +we are trying to predict. For high precision it is +therefore necessary to iterate, using the topocentric +zenith distance as the initial estimate of the +observed zenith distance. + +The full +sla\_REFRO refraction calculation is onerous, and for +zenith distances of less than, say, $75^{\circ}$ the following +model can be used instead: + +\[ \zeta _{vac} \approx \zeta _{obs} + + A \tan \zeta _{obs} + + B \tan ^{3}\zeta _{obs} \] +where $\zeta _{vac}$ is the topocentric +zenith distance (i.e.\ {\it in vacuo}), +$\zeta _{obs}$ is the observed +zenith distance (i.e.\ affected by refraction), and $A$ and $B$ are +constants, about \arcseci{60} +and \arcsec{-0}{06} respectively for a sea-level site. +The two constants can be calculated for a given set of conditions +by calling either +sla\_REFCO or +sla\_REFCOQ. + +sla\_REFCO works by calling +sla\_REFRO for two zenith distances and fitting $A$ and $B$ +to match. The calculation is onerous, but delivers accurate +results whatever the conditions. +sla\_REFCOQ uses a direct formulation of $A$ and $B$ and +is much faster; it is slightly less accurate than +sla\_REFCO but more than adequate for most practical purposes. + +Like the full refraction model, the two-term formulation works in the wrong +direction for our purposes, predicting +the {\it in vacuo}\/ (topocentric) zenith distance +given the refracted (observed) zenith distance, +rather than {\it vice versa}. The obvious approach of +interchanging $\zeta _{vac}$ and $\zeta _{obs}$ and +reversing the signs, though approximately +correct, gives avoidable errors which are just significant in +some applications; for +example about \arcsec{0}{2} at $70^\circ$ zenith distance. A +much better result can easily be obtained, by using one Newton-Raphson +iteration as follows: + +\[ \zeta _{obs} \approx \zeta _{vac} + - \frac{A \tan \zeta _{vac} + B \tan ^{3}\zeta _{vac}} + {1 + ( A + 3 B \tan ^{2}\zeta _{vac} ) \sec ^{2}\zeta _{vac}}\] + +The effect of refraction can be applied to an unrefracted +zenith distance by calling +sla\_REFZ or to an unrefracted +\xyz\ by calling +sla\_REFV. +Over most of the sky these two routines deliver almost identical +results, but beyond $\zeta=83^\circ$ +sla\_REFV +becomes unacceptably inaccurate while +sla\_REFZ +remains usable. (However +sla\_REFV +is significantly faster, which may be important in some applications.) +SLALIB also provides a routine for computing the airmass, the function +sla\_AIRMAS. + +The refraction ``constants'' returned by +sla\_REFCO and +sla\_REFCOQ +are slightly affected by colour, especially at the blue end +of the spectrum. Where values for more than one +wavelength are needed, rather than calling +sla\_REFCO +several times it is more efficient to call +sla\_REFCO +just once, for a selected ``base'' wavelength, and then to call +sla\_ATMDSP +once for each wavelength of interest. + +All the SLALIB refraction routines work for radio wavelengths as well +as the optical/IR band. The radio refraction is very dependent on +humidity, and an accurate value must be supplied. There is no +wavelength dependence, however. The choice of optical/IR or +radio is made by specifying a wavelength greater than $100\mu m$ +for the radio case. + +\subsubsection{Efficiency considerations} +The complete apparent place to observed place transformation +can be carried out by calling +sla\_AOP. +For improved efficiency +in cases of more than one star or a sequence of times, the +target-independent calculations can be done once by +calling +sla\_AOPPA, +the time can be updated by calling +sla\_AOPPAT, +and +sla\_AOPQK +can then be used to perform the +apparent-to-observed transformation. The reverse transformation +is available through +sla\_OAP +and +sla\_OAPQK. +({\it n.b.}\ These routines use accurate but computationally-expensive +refraction algorithms for zenith distances beyond about $76^\circ$. +For many purposes, in-line code tailored to the accuracy requirements +of the application will be preferable, for example ignoring UT1$-$UTC, +omitting diurnal aberration and using +sla\_REFZ +to apply the refraction.) + +\subsection{The Hipparcos Catalogue and the ICRS} +With effect from the beginning of 1998, the IAU adopted a new +reference system to replace FK5 J2000. The new system, called the +International Celestial Reference System (ICRS), differs profoundly +from all predecessors in that the link with solar-system dynamics +was broken; the ICRS axes are defined in terms of the directions +of a set of extragalactic sources, not in terms of the mean equator and +equinox at a given reference epoch. Although the ICRS and FK5 coordinates +of any given object are almost the same, the orientation of the new frame +was essentially arbitrary, and the close match to FK5 J2000 was contrived +purely for reasons of continuity and convenience. + +A distinction is made between the reference {\it system}\/ (the ICRS) +and {\it frame}\/ (ICRF). The ICRS is the set of prescriptions and +conventions together with the modelling required to define, at any +time, a triad of axes. The ICRF is a practical realization, and +currently consists of a catalogue of equatorial coordinates for 608 +extragalactic radio sources observed by VLBI. + +The best optical realization of the ICRF currently available is the +Hipparcos catalogue. The extragalactic sources were not directly +observable by the Hipparcos satellite and so the link from Hipparcos +to ICRF was established through a variety of indirect techniques: VLBI and +conventional interferometry of radio stars, photographic astrometry +and so on. The Hipparcos frame is aligned to the ICRF to within about +0.5~mas and 0.5~mas/year (at epoch 1991.25). + +The Hipparcos catalogue includes all of the FK5 stars, which has enabled +the orientation and spin of the latter to be studied. At epoch J2000, +the misalignment of the FK5 frame with respect to Hipparcos +(and hence ICRS) are about 32~mas and 1~mas/year respectively. +Consequently, for many practical purposes, including pointing +telescopes, the IAU 1976-1982 conventions on reference frames and +Earth orientation remain adequate and there is no need to change to +Hipparcos coordinates, new precession/nutation models and so on. +However, for the most exacting astrometric applications, SLALIB +provides some support for Hipparcos coordinates in the form of +four new routines: +sla\_FK52H and +sla\_H2FK5, +which transform FK5 positions and proper motions to the Hipparcos frame +and {\it vice versa,}\/ and +sla\_FK5HZ and +sla\_HFK5Z, +where the transformations are for stars whose Hipparcos proper motion is +zero. + +Further information on the ICRS can be found in the paper by M.\,Feissel +and F.\,Mignard, Astron.\,Astrophys. 331, L33-L36 (1988). + +\subsection{Timescales} +SLALIB provides for conversion between several timescales, and involves +use of one or two others. The full list is as follows: +\begin{itemize} +\item TAI: International Atomic Time +\item UTC: Coordinated Universal Time +\item UT: Universal Time +\item GMST: Greenwich Mean Sidereal Time +\item LAST: Local Apparent Sidereal Time +\item TT: Terrestrial Time +\item TDB: Barycentric Dynamical Time. +\end{itemize} +Three obsolete timescales should be mentioned here to avoid confusion. +\begin{itemize} +\item GMT: Greenwich Mean Time -- can mean either UTC or UT. +\item ET: Ephemeris Time -- more or less the same as either TT or TDB. +\item TDT: Terrestrial Dynamical Time -- former name of TT. +\end{itemize} + +\subsubsection{Atomic Time: TAI} +{\it International Atomic Time}\/ TAI is a laboratory timescale. Its +unit is the SI second, which is defined in terms of a +defined number +of wavelengths of the radiation produced by a certain electronic +transition in the caesium 133 atom. It +is realized through a changing +population of high-precision atomic clocks held +at standards institutes in various countries. There is an +elaborate process of continuous intercomparison, leading to +a weighted average of all the clocks involved. + +Though TAI shares the same second as the more familiar UTC, the +two timescales are noticeably separated in epoch because of the +build-up of leap seconds. At the time of writing, UTC +lags about half a minute behind TAI. + +For any given date, the difference TAI$-$UTC +can be obtained by calling the SLALIB routine +sla\_DAT. +Note, however, that an up-to-date copy of the routine must be used if +the most recent leap seconds are required. For applications +where this is critical, mechanisms independent of SLALIB +and under local control must +be set up; in such cases +sla\_DAT +can be useful as an +independent check, for test dates within the range of the +available version. Up-to-date information on TAI$-$UTC is available +from {\tt ftp://maia.usno.navy.mil/ser7/tai-utc.dat}. + +\subsubsection{Universal Time: UTC, UT1} +{\it Coordinated Universal Time}\/ UTC is the basis of civil timekeeping. +Most time zones differ from UTC by an integer number +of hours, though a few ({\it e.g.}\ parts of Canada and Australia) differ +by $n+0.5$~hours. The UTC second is the same as the SI second, +as for TAI. In the long term, UTC keeps in step with the +Sun. It does so even though the Earth's rotation is slightly +variable (due to large scale movements of water and atmosphere +among other things) by occasionally introducing a {\it leap +second}. + +{\it Universal Time}\/ UT, or more specifically UT1, +is in effect the mean solar time. It is continuous +({\it i.e.}\ there are no leap seconds) but has a variable +rate because of the Earth's non-uniform rotation period. It is +needed for computing the sidereal time, an essential part of +pointing a telescope at a celestial source. To obtain UT1, you +have to look up the value of UT1$-$UTC for the date concerned +in tables published by the International Earth Rotation +Service; this quantity, kept in the range +$\pm$\tsec{0}{9} by means of UTC leap +seconds, is then added to the UTC. The quantity UT1$-$UTC, +which typically changes by 1 or 2~ms per day, +can only be obtained by observation, though seasonal trends +are known and the IERS listings are able to predict some way into +the future with adequate accuracy for pointing telescopes. + +UTC leap seconds are introduced as necessary, +usually at the end of December or June. +On the average the solar day is slightly longer +than the nominal 86,400~SI~seconds and so leap seconds are always positive; +however, provision exists for negative leap seconds if needed. +The form of a leap second can be seen from the +following description of the end of June~1994: + +\hspace{3em} +\begin{tabular}{clrccc} \\ + & & & UTC & UT1$-$UTC & UT1 \\ \\ +1994 & June & 30 & 23 59 58 & $-0.218$ & 23 59 57.782 \\ + & & & 23 59 59 & $-0.218$ & 23 59 58.782 \\ + & & & 23 59 60 & $-0.218$ & 23 59 59.782 \\ + & July & 1 & 00 00 00 & $+0.782$ & 00 00 00.782 \\ + & & & 00 00 01 & $+0.782$ & 00 00 01.782 \\ +\end{tabular} + +Note that UTC has to be expressed as hours, minutes and +seconds (or at least in seconds for a given date) if leap seconds +are to be taken into account. It is improper to express a UTC as a +Julian Date, for example, because there will be an ambiguity +during a leap second (in the above example, +1994~June~30 \hms{23}{59}{60}{0} and +1994~July~1 \hms{00}{00}{00}{0} would {\it both}\/ come out as +MJD~49534.00000). Although in the vast majority of +cases this won't matter, there are potential problems in +on-line data acquisition systems and in applications involving +taking the difference between two times. Note that although the routines +sla\_DAT +and +sla\_DTT +expect UTC in the form of an MJD, the meaning here is really a +whole-number {\it date}\/ rather than a time. Though the routines will accept +a fractional part and will almost always function correctly, on a day +which ends with a leap +second incorrect results would be obtained during the leap second +itself because by then the MJD would have moved into the next day. + +\subsubsection{Sidereal Time: GMST, LAST} +Sidereal Time is the ``time of day'' relative to the +stars rather than to the Sun. After +one sidereal day the stars come back to the same place in the +sky, apart from sub-arcsecond precession effects. Because the Earth +rotates faster relative to the stars than to the Sun by one day +per year, the sidereal second is shorter than the solar +second; the ratio is about 0.9973. + +The {\it Greenwich Mean Sidereal Time}\/ GMST is +linked to UT1 by a numerical formula which +is implemented in the SLALIB routines +sla\_GMST +and +sla\_GMSTA. +There are, of course, no leap seconds in GMST, but the second +changes in length along with the UT1 second, and also varies +over long periods of time because of slow changes in the Earth's +orbit. This makes the timescale unsuitable for everything except +predicting the apparent directions of celestial sources. + +The {\it Local Apparent Sidereal Time}\/ LAST is the apparent right +ascension of the local meridian, from which the hour angle of any +star can be determined knowing its $\alpha$. It can be obtained from the +GMST by adding the east longitude (corrected for polar motion +in precise work) and the {\it equation of the equinoxes}. The +latter, already described, is an aspect of the nutation effect +and can be predicted by calling the SLALIB routine +sla\_EQEQX +or, neglecting certain very small terms, by calling +sla\_NUTC +and using the expression $\Delta\psi\cos\epsilon$. + +\subsubsection{Dynamical Time: TT, TDB} +Dynamical time is the independent variable in the theories +which describe the motions of bodies in the solar system. When +you use published formulae which model the position of the +Earth in its orbit, for example, or look up +the Moon's position in a precomputed ephemeris, the date and time +you use must be in terms of one of the dynamical timescales. It +is a common but understandable mistake to use UT directly, in which +case the results will be about 1~minute out (in the present +era). + +It is not hard to see why such timescales are necessary. +UTC would clearly be unsuitable as the argument of an +ephemeris because of leap seconds. +A solar-system ephemeris based on UT1 or sidereal time would somehow +have to include the unpredictable variations of the Earth's rotation. +TAI would work, but eventually +the ephemeris and the ensemble of atomic clocks would drift apart. +In effect, the ephemeris {\it is}\/ a clock, with the bodies of +the solar system the hands. + +Only two of the dynamical timescales are of any great importance to +observational astronomers, TT and TDB. (The obsolete +timescale ET, ephemeris time, was more or less the same as TT.) + +{\it Terrestrial Time}\/ TT is +the theoretical timescale of apparent geocentric ephemerides of solar +system bodies. It applies, in principle, +to an Earthbound clock, at sea-level, and for practical purposes +it is tied to +Atomic Time TAI through the formula TT~$=$~TAI~$+$~\tsec{32}{184}. +In practice, therefore, the units of TT are ordinary SI seconds, and +the offset of \tsec{32}{184} with respect to TAI is fixed. +The SLALIB routine +sla\_DTT +returns TT$-$UTC for a given UTC +({\it n.b.}\ sla\_DTT +calls +sla\_DAT, +and the latter must be an up-to-date version if recent leap seconds are +to be taken into account). + +{\it Barycentric Dynamical Time}\/ TDB differs from TT by an amount which +cycles back and forth by a millisecond or two due to +relativistic effects. The variation is +negligible for most purposes, but unless taken into +account would swamp +long-term analysis of pulse arrival times from the +millisecond pulsars. It is a consequence of +the TT clock being on the Earth rather than in empty +space: the ellipticity of +the Earth's orbit means that the TT clock's speed and +gravitational potential vary slightly +during the course of the year, and as a consequence +its rate as seen from an outside observer +varies due to transverse Doppler effect and gravitational +redshift. By definition, TDB and TT differ only +by periodic terms, and the main effect +is a sinusoidal variation of amplitude \tsec{0}{0016}; the +largest planetary terms are nearly two orders of magnitude +smaller. The SLALIB routine +sla\_RCC +provides a model of +TDB-TT accurate to a few nanoseconds. +There are other dynamical timescales, not supported by +SLALIB routines, which include allowance also for the secular terms. +These timescales gain on TT and TDB by about \tsec{0}{0013}/day. + +For most purposes the more accessible TT is the timescale to use, +for example when calling +sla\_PRENUT +to generate a precession/nutation matrix or when calling +sla\_EVP +to predict the +Earth's position and velocity. For some purposes TDB is the +correct timescale, for example when interrogating the JPL planetary +ephemeris (see {\it Starlink User Note~87}\/), though in most cases +TT will be near enough and will involve less computation. + +Investigations of topocentric solar-system phenomena such as +occultations and eclipses require solar time as well as dynamical +time. TT/TDB/ET is all that is required in order to compute the geocentric +circumstances, but if horizon coordinates or geocentric parallax +are to be tackled UT is also needed. A rough estimate +of $\Delta {\rm T} = {\rm ET} - {\rm UT}$ is +available via the routine +sla\_DT. +For a given epoch ({\it e.g.}\ 1650) this returns an approximation +to $\Delta {\rm T}$ in seconds. + +\subsection{Calendars} +The ordinary {\it Gregorian Calendar Date}, +together with a time of day, can be +used to express an epoch in any desired timescale. For many purposes, +however, a continuous count of days is more convenient, and for +this purpose the system of {\it Julian Day Number}\/ can be used. +JD zero is located about 7000~years ago, well before the +historical era, and is formally defined in terms of Greenwich noon; +Julian Day Number 2449444 began at noon on 1994 April~1. {\it Julian Date}\/ +is the same system but with a fractional part appended; +Julian Date 2449443.5 was the midnight on which 1994 April~1 +commenced. Because of the unwieldy size of Julian Dates +and the awkwardness of the half-day offset, it is +accepted practice to remove the leading `24' and the trailing `.5', +producing what is called the {\it Modified Julian Date}: +MJD~=~JD$-2400000.5$. SLALIB routines use MJD, as opposed to +JD, throughout, largely to avoid loss of precision. +1994 April~1 commenced at MJD~49443.0. + +Despite JD (and hence MJD) being defined in terms of (in effect) +UT, the system can be used in conjunction with other timescales +such as TAI, TT and TDB (and even sidereal time through the +concept of {\it Greenwich Sidereal Date}). However, it is improper +to express a UTC as a JD or MJD because of leap seconds. + +SLALIB has six routines for converting to and from dates in +the Gregorian calendar. The routines +sla\_CLDJ +and +sla\_CALDJ +both convert a calendar date into an MJD, the former interpreting +years between 0 and 99 as 1st century and the latter as late 20th or +early 21st century. The routines sla\_DJCL +and +sla\_DJCAL +both convert an MJD into calendar year, month, day and fraction of a day; +the latter performs rounding to a specified precision, important +to avoid dates like `{\tt 94 04 01.***}' appearing in messages. +Some of SLALIB's low-precision ephemeris routines +(sla\_EARTH, +sla\_MOON +and +sla\_ECOR) +work in terms of year plus day-in-year (where +day~1~=~January~1st, at least for the modern era). +This form of date can be generated by +calling +sla\_CALYD +(which defaults years 0-99 into 1950-2049) +or +sla\_CLYD +(which covers the full range from prehistoric times). + +\subsection{Geocentric Coordinates} +The location of the observer on the Earth is significant in a +number of ways. The most obvious, of course, is the effect of latitude +on the observed \azel\ of a star. Less obvious is the need to +allow for geocentric parallax when finding the Moon with a +telescope (and when doing high-precision work involving the +Sun or planets), and the need to correct observed radial +velocities and apparent pulsar periods for the effects +of the Earth's rotation. + +The SLALIB routine +sla\_OBS +supplies details of groundbased observatories from an internal +list. This is useful when writing applications that apply to +more than one observatory; the user can enter a brief name, +or browse through a list, and be spared the trouble of typing +in the full latitude, longitude {\it etc}. The following +Fortran code returns the full name, longitude and latitude +of a specified observatory: +\goodbreak +\begin{verbatim} + CHARACTER IDENT*10,NAME*40 + DOUBLE PRECISION W,P,H + : + CALL sla_OBS(0,IDENT,NAME,W,P,H) + IF (NAME.EQ.'?') ... (not recognized) +\end{verbatim} +\goodbreak +(Beware of the longitude sign convention, which is west +ve +for historical reasons.) The following lists all +the supported observatories: +\goodbreak +\begin{verbatim} + : + INTEGER N + : + N=1 + NAME=' ' + DO WHILE (NAME.NE.'?') + CALL sla_OBS(N,IDENT,NAME,W,P,H) + IF (NAME.NE.'?') THEN + WRITE (*,'(1X,I3,4X,A,4X,A)') N,IDENT,NAME + N=N+1 + END IF + END DO +\end{verbatim} +\goodbreak +The routine +sla\_GEOC +converts a {\it geodetic latitude}\/ +(one referred to the local horizon) to a geocentric position, +taking into account the Earth's oblateness and also the height +above sea level of the observer. The results are expressed in +vector form, namely as the distance of the observer from +the spin axis and equator respectively. The {\it geocentric +latitude}\/ can be found be evaluating ATAN2 of the +two numbers. A full 3-D vector description of the position +and velocity of the observer is available through the routine +sla\_PVOBS. +For a specified geodetic latitude, height above +sea level, and local sidereal time, +sla\_PVOBS +generates a 6-element vector containing the position and +velocity with respect to the true equator and equinox of +date ({\it i.e.}\ compatible with apparent \radec). For +some applications it will be necessary to convert to a +mean \radec\ frame (notably FK5, J2000) by multiplying +elements 1-3 and 4-6 respectively with the appropriate +precession matrix. (In theory an additional correction to the +velocity vector is needed to allow for differential precession, +but this correction is always negligible.) + +See also the discussion of the routine +sla\_RVEROT, +later. + +\subsection{Ephemerides} +SLALIB includes routines for generating positions and +velocities of Solar-System bodies. The accuracy objectives are +modest, and the SLALIB facilities do not attempt +to compete with precomputed ephemerides such as +those provided by JPL, or with models containing +thousands of terms. It is also worth noting +that SLALIB's very accurate star coordinate conversion +routines are not strictly applicable to solar-system cases, +though they are adequate for most practical purposes. + +Earth/Sun ephemerides can be generated using the routine +sla\_EVP, +which predicts Earth position and velocity with respect to both the +solar-system barycentre and the +Sun. Maximum velocity error is 0.42~metres per second; maximum +heliocentric position error is 1600~km (about \arcseci{2}), with +barycentric position errors about 4 times worse. +(The Sun's position as +seen from the Earth can, of course, be obtained simply by +reversing the signs of the Cartesian components of the +Earth\,:\,Sun vector.) + +Geocentric Moon ephemerides are available from +sla\_DMOON, +which predicts the Moon's position and velocity with respect to +the Earth's centre. Direction accuracy is usually better than +10~km (\arcseci{5}) and distance accuracy a little worse. + +Lower-precision but faster predictions for the Sun and Moon +can be made by calling +sla\_EARTH +and +sla\_MOON. +Both are single precision and accept dates in the form of +year, day-in-year and fraction of day +(starting from a calendar date you need to call +sla\_CLYD +or +sla\_CALYD +to get the required year and day). +The +sla\_EARTH +routine returns the heliocentric position and velocity +of the Earth's centre for the mean equator and +equinox of date. The accuracy is better than 20,000~km in position +and 10~metres per second in speed. +The +position and velocity of the Moon with respect to the +Earth's centre for the mean equator and ecliptic of date +can be obtained by calling +sla\_MOON. +The positional accuracy is better than \arcseci{30} in direction +and 1000~km in distance. + +Approximate ephemerides for all the major planets +can be generated by calling +sla\_PLANET +or +sla\_RDPLAN. These routines offer arcminute accuracy (much +better for the inner planets and for Pluto) over a span of several +millennia (but only $\pm100$ years for Pluto). +The routine +sla\_PLANET produces heliocentric position and +velocity in the form of equatorial \xyzxyzd\ for the +mean equator and equinox of J2000. The vectors +produced by +sla\_PLANET +can be used in a variety of ways according to the +requirements of the application concerned. The routine +sla\_RDPLAN +uses +sla\_PLANET +and +sla\_DMOON +to deal with the common case of predicting +a planet's apparent \radec\ and angular size as seen by a +terrestrial observer. + +Note that in predicting the position in the sky of a solar-system body +it is necessary to allow for geocentric parallax. This correction +is {\it essential}\/ in the case of the Moon, where the observer's +position on the Earth can affect the Moon's \radec\ by up to +$1^\circ$. The calculation can most conveniently be done by calling +sla\_PVOBS and subtracting the resulting 6-vector from the +one produced by +sla\_DMOON, as is demonstrated by the following example: +\goodbreak +\begin{verbatim} + * Demonstrate the size of the geocentric parallax correction + * in the case of the Moon. The test example is for the AAT, + * before midnight, in summer, near first quarter. + + IMPLICIT NONE + CHARACTER NAME*40,SH,SD + INTEGER J,I,IHMSF(4),IDMSF(4) + DOUBLE PRECISION SLONGW,SLAT,H,DJUTC,FDUTC,DJUT1,DJTT,STL, + : RMATN(3,3),PMM(6),PMT(6),RM,DM,PVO(6),TL + DOUBLE PRECISION sla_DTT,sla_GMST,sla_EQEQX,sla_DRANRM + + * Get AAT longitude and latitude in radians and height in metres + CALL sla_OBS(0,'AAT',NAME,SLONGW,SLAT,H) + + * UTC (1992 January 13, 11 13 59) to MJD + CALL sla_CLDJ(1992,1,13,DJUTC,J) + CALL sla_DTF2D(11,13,59.0D0,FDUTC,J) + DJUTC=DJUTC+FDUTC + + * UT1 (UT1-UTC value of -0.152 sec is from IERS Bulletin B) + DJUT1=DJUTC+(-0.152D0)/86400D0 + + * TT + DJTT=DJUTC+sla_DTT(DJUTC)/86400D0 + + * Local apparent sidereal time + STL=sla_GMST(DJUT1)-SLONGW+sla_EQEQX(DJTT) + + * Geocentric position/velocity of Moon (mean of date) + CALL sla_DMOON(DJTT,PMM) + + * Nutation to true equinox of date + CALL sla_NUT(DJTT,RMATN) + CALL sla_DMXV(RMATN,PMM,PMT) + CALL sla_DMXV(RMATN,PMM(4),PMT(4)) + + * Report geocentric HA,Dec + CALL sla_DCC2S(PMT,RM,DM) + CALL sla_DR2TF(2,sla_DRANRM(STL-RM),SH,IHMSF) + CALL sla_DR2AF(1,DM,SD,IDMSF) + WRITE (*,'(1X,'' geocentric:'',2X,A,I2.2,2I3.2,''.'',I2.2,'// + : '1X,A,I2.2,2I3.2,''.'',I1)') + : SH,IHMSF,SD,IDMSF + + * Geocentric position of observer (true equator and equinox of date) + CALL sla_PVOBS(SLAT,H,STL,PVO) + + * Place origin at observer + DO I=1,6 + PMT(I)=PMT(I)-PVO(I) + END DO + + * Allow for planetary aberration + TL=499.004782D0*SQRT(PMT(1)**2+PMT(2)**2+PMT(3)**2) + DO I=1,3 + PMT(I)=PMT(I)-TL*PMT(I+3) + END DO + + * Report topocentric HA,Dec + CALL sla_DCC2S(PMT,RM,DM) + CALL sla_DR2TF(2,sla_DRANRM(STL-RM),SH,IHMSF) + CALL sla_DR2AF(1,DM,SD,IDMSF) + WRITE (*,'(1X,''topocentric:'',2X,A,I2.2,2I3.2,''.'',I2.2,'// + : '1X,A,I2.2,2I3.2,''.'',I1)') + : SH,IHMSF,SD,IDMSF + END +\end{verbatim} +\goodbreak +The output produced is as follows: +\goodbreak +\begin{verbatim} + geocentric: +03 06 55.59 +15 03 39.0 + topocentric: +03 09 23.79 +15 40 51.5 +\end{verbatim} +\goodbreak +(An easier but +less instructive method of estimating the topocentric apparent place of the +Moon is to call the routine +sla\_RDPLAN.) + +As an example of using +sla\_PLANET, +the following program estimates the geocentric separation +between Venus and Jupiter during a close conjunction +in 2\,BC, which is a star-of-Bethlehem candidate: +\goodbreak +\begin{verbatim} + * Compute time and minimum geocentric apparent separation + * between Venus and Jupiter during the close conjunction of 2 BC. + + IMPLICIT NONE + + DOUBLE PRECISION SEPMIN,DJD0,FD,DJD,DJDM,DF,PV(6),RMATP(3,3), + : PVM(6),PVE(6),TL,RV,DV,RJ,DJ,SEP + INTEGER IHOUR,IMIN,J,I,IHMIN,IMMIN + DOUBLE PRECISION sla_EPJ,sla_DSEP + + + * Search for closest approach on the given day + DJD0=1720859.5D0 + SEPMIN=1D10 + DO IHOUR=20,22 + DO IMIN=0,59 + CALL sla_DTF2D(IHOUR,IMIN,0D0,FD,J) + + * Julian date and MJD + DJD=DJD0+FD + DJDM=DJD-2400000.5D0 + + * Earth to Moon (mean of date) + CALL sla_DMOON(DJDM,PV) + + * Precess Moon position to J2000 + CALL sla_PRECL(sla_EPJ(DJDM),2000D0,RMATP) + CALL sla_DMXV(RMATP,PV,PVM) + + * Sun to Earth-Moon Barycentre (mean J2000) + CALL sla_PLANET(DJDM,3,PVE,J) + + * Correct from EMB to Earth + DO I=1,3 + PV(I)=PVE(I)-0.012150581D0*PVM(I) + END DO + + * Sun to Venus + CALL sla_PLANET(DJDM,2,PV,J) + + * Earth to Venus + DO I=1,6 + PV(I)=PV(I)-PVE(I) + END DO + + * Light time to Venus (sec) + TL=499.004782D0*SQRT((PV(1)-PVE(1))**2+ + : (PV(2)-PVE(2))**2+ + : (PV(3)-PVE(3))**2) + + * Extrapolate backwards in time by that much + DO I=1,3 + PV(I)=PV(I)-TL*PV(I+3) + END DO + + * To RA,Dec + CALL sla_DCC2S(PV,RV,DV) + + * Same for Jupiter + CALL sla_PLANET(DJDM,5,PV,J) + DO I=1,6 + PV(I)=PV(I)-PVE(I) + END DO + TL=499.004782D0*SQRT((PV(1)-PVE(1))**2+ + : (PV(2)-PVE(2))**2+ + : (PV(3)-PVE(3))**2) + DO I=1,3 + PV(I)=PV(I)-TL*PV(I+3) + END DO + CALL sla_DCC2S(PV,RJ,DJ) + + * Separation (arcsec) + SEP=sla_DSEP(RV,DV,RJ,DJ) + + * Keep if smallest so far + IF (SEP.LT.SEPMIN) THEN + IHMIN=IHOUR + IMMIN=IMIN + SEPMIN=SEP + END IF + END DO + END DO + + * Report + WRITE (*,'(1X,I2.2,'':'',I2.2,F6.1)') IHMIN,IMMIN, + : 206264.8062D0*SEPMIN + + END +\end{verbatim} +\goodbreak +The output produced (the Ephemeris Time on the day in question, and +the closest approach in arcseconds) is as follows: +\goodbreak +\begin{verbatim} + 21:19 33.7 +\end{verbatim} +\goodbreak +For comparison, accurate predictions based on the JPL DE\,102 ephemeris +give a separation about \arcseci{8} less than +the above estimate, occurring about half an hour earlier +(see {\it Sky and Telescope,}\/ April~1987, p\,357). + +The following program demonstrates +sla\_RDPLAN. +\begin{verbatim} + * For a given date, time and geographical location, output + * a table of planetary positions and diameters. + + IMPLICIT NONE + CHARACTER PNAMES(0:9)*7,B*80,S + INTEGER I,NP,IY,J,IM,ID,IHMSF(4),IDMSF(4) + DOUBLE PRECISION R2AS,FD,DJM,ELONG,PHI,RA,DEC,DIAM + PARAMETER (R2AS=206264.80625D0) + DATA PNAMES / 'Sun','Mercury','Venus','Moon','Mars','Jupiter', + : 'Saturn','Uranus','Neptune', 'Pluto' / + + + * Loop until 'end' typed + B=' ' + DO WHILE (B.NE.'END'.AND.B.NE.'end') + + * Get date, time and observer's location + PRINT *,'Date? (Y,M,D, Gregorian)' + READ (*,'(A)') B + IF (B.NE.'END'.AND.B.NE.'end') THEN + I=1 + CALL sla_INTIN(B,I,IY,J) + CALL sla_INTIN(B,I,IM,J) + CALL sla_INTIN(B,I,ID,J) + PRINT *,'Time? (H,M,S, dynamical)' + READ (*,'(A)') B + I=1 + CALL sla_DAFIN(B,I,FD,J) + FD=FD*2.3873241463784300365D0 + CALL sla_CLDJ(IY,IM,ID,DJM,J) + DJM=DJM+FD + PRINT *,'Longitude? (D,M,S, east +ve)' + READ (*,'(A)') B + I=1 + CALL sla_DAFIN(B,I,ELONG,J) + PRINT *,'Latitude? (D,M,S, (geodetic)' + READ (*,'(A)') B + I=1 + CALL sla_DAFIN(B,I,PHI,J) + + * Loop planet by planet + DO NP=0,8 + + * Get RA,Dec and diameter + CALL sla_RDPLAN(DJM,NP,ELONG,PHI,RA,DEC,DIAM) + + * One line of report + CALL sla_DR2TF(2,RA,S,IHMSF) + CALL sla_DR2AF(1,DEC,S,IDMSF) + WRITE (*, + : '(1X,A,2X,3I3.2,''.'',I2.2,2X,A,I2.2,2I3.2,''.'',I1,F8.1)') + : PNAMES(NP),IHMSF,S,IDMSF,R2AS*DIAM + + * Next planet + END DO + PRINT *,' ' + END IF + + * Next case + END DO + + END +\end{verbatim} +Entering the following data (for 1927~June~29 at $5^{\rm h}\,25^{\rm m}$~ET +and the position of Preston, UK.): +\begin{verbatim} + 1927 6 29 + 5 25 + -2 42 + 53 46 +\end{verbatim} +produces the following report: +\begin{verbatim} + Sun 06 28 14.03 +23 17 17.5 1887.8 + Mercury 08 08 58.62 +19 20 57.3 9.3 + Venus 09 38 53.64 +15 35 32.9 22.8 + Moon 06 28 18.30 +23 18 37.3 1903.9 + Mars 09 06 49.34 +17 52 26.7 4.0 + Jupiter 00 11 12.06 -00 10 57.5 41.1 + Saturn 16 01 43.34 -18 36 55.9 18.2 + Uranus 00 13 33.53 +00 39 36.0 3.5 + Neptune 09 49 35.75 +13 38 40.8 2.2 + Pluto 07 05 29.50 +21 25 04.2 .1 +\end{verbatim} +Inspection of the Sun and Moon data reveals that +a total solar eclipse is in progress. + +SLALIB also provides for the case where orbital elements (with respect +to the J2000 equinox and ecliptic) +are available. This allows predictions to be made for minor-planets and +(if you ignore non-gravitational effects) +comets. Furthermore, if major-planet elements for an epoch close to the date +in question are available, more accurate predictions can be made than +are offered by +sla\_RDPLAN and +sla\_PLANET. + +The SLALIB planetary-prediction +routines that work with orbital elements are +sla\_PLANTE (the orbital-elements equivalent of +sla\_RDPLAN), which predicts the topocentric \radec, and +sla\_PLANEL (the orbital-elements equivalent of +sla\_PLANET), which predicts the heliocentric \xyzxyzd\ with respect to the +J2000 equinox and equator. In addition, the routine +sla\_PV2EL does the inverse of +sla\_PLANEL, transforming \xyzxyzd\ into {\it osculating elements.} + +Osculating elements describe the unperturbed 2-body orbit. This is +a good approximation to the actual orbit for a few weeks either +side of the specified epoch, outside which perturbations due to +the other bodies of the Solar System lead to +increasing errors. Given a minor planet's osculating elements for +a particular date, predictions for a date even just +100 days earlier or later +are likely to be in error by several arcseconds. +These errors can +be reduced if new elements are generated which take account of +the perturbations of the major planets, and this is what the routine +sla\_PERTEL does. Once +sla\_PERTEL has been called, to provide osculating elements +close to the required date, the elements can be passed to +sla\_PLANEL or +sla\_PLANTE in the normal way. Predictions of arcsecond accuracy +over a span of a decade or more are available using this +technique. + +Three different combinations of orbital elements are +provided for, matching the usual conventions +for major planets, minor planets and +comets respectively. The choice is made through the +argument {\tt JFORM}:\\ + +\hspace{4em} +\begin{tabular}{|c|c|c|} \hline +{\tt JFORM=1} & {\tt JFORM=2} & {\tt JFORM=3} \\ +\hline \hline +$t_0$ & $t_0$ & $T$ \\ +\hline +$i$ & $i$ & $i$ \\ +\hline +$\Omega$ & $\Omega$ & $\Omega$ \\ +\hline +$\varpi$ & $\omega$ & $\omega$ \\ +\hline +$a$ & $a$ & $q$ \\ +\hline +$e$ & $e$ & $e$ \\ +\hline +$L$ & $M$ & \\ +\hline +$n$ & & \\ +\hline +\end{tabular}\\[5ex] +The symbols have the following meanings: +\begin{tabbing} +xxxxxxx \= xxxx \= \kill +\> $t_0$ \> epoch at which the elements were correct \\ +\> $T$ \> epoch of perihelion passage \\ +\> $i$ \> inclination of the orbit \\ +\> $\Omega$ \> longitude of the ascending node \\ +\> $\varpi$ \> longitude of perihelion ($\varpi = \Omega + \omega$) \\ +\> $\omega$ \> argument of perihelion \\ +\> $a$ \> semi-major axis of the orbital ellipse \\ +\> $q$ \> perihelion distance \\ +\> $e$ \> orbital eccentricity \\ +\> $L$ \> mean longitude ($L = \varpi + M$) \\ +\> $M$ \> mean anomaly \\ +\> $n$ \> mean motion \\ +\end{tabbing} + +The mean motion, $n$, tells sla\_PLANEL the mass of the planet. +If it is not available, it should be claculated +from $n^2 a^3 = k^2 (1+m)$, where $k = 0.01720209895$ and +m is the mass of the planet ($M_\odot = 1$); $a$ is in AU. + +Conventional elements are not the only way of specifying an orbit. +The \xyzxyzd\ state vector is an equally valid specification, +and the so-called {\it method of universal variables}\/ allows +orbital calculations to be made directly, bypassing angular +quantities and avoiding Kepler's Equation. The universal-variables +approach has various advantages, including better handling of +near-parabolic cases and greater efficiency. +SLALIB uses universal variables for its internal +calculations and also offers a number of routines which +applications can call. + +The universal elements are the \xyzxyzd\ and its epoch, plus the mass +of the body. The SLALIB routines supplement these elements with +certain redundant values in order to +avoid unnecessary recomputation when the elements are next used. + +The routines +sla\_EL2UE and +sla\_UE2EL transform conventional elements into the +universal form and {\it vice versa.} +The routine +sla\_PV2UE takes an \xyzxyzd\ and forms the set of universal +elements; +sla\_UE2PV takes a set of universal elements and predicts the \xyzxyzd\ +for a specified epoch. +The routine +sla\_PERTUE provides updated universal elements, +taking into account perturbations from the major planets. + +\subsection{Radial Velocity and Light-Time Corrections} +When publishing high-resolution spectral observations +it is necessary to refer them to a specified standard of rest. +This involves knowing the component in the direction of the +source of the velocity of the observer. SLALIB provides a number +of routines for this purpose, allowing observations to be +referred to the Earth's centre, the Sun, a Local Standard of Rest +(either dynamical or kinematical), the centre of the Galaxy, and +the mean motion of the Local Group. + +The routine +sla\_RVEROT +corrects for the diurnal rotation of +the observer around the Earth's axis. This is always less than 0.5~km/s. + +No specific routine is provided to correct a radial velocity +from geocentric to heliocentric, but this can easily be done by calling +sla\_EVP +as follows (array declarations {\it etc}.\ omitted): +\goodbreak +\begin{verbatim} + : + * Star vector, J2000 + CALL sla_DCS2C(RM,DM,V) + + * Earth/Sun velocity and position, J2000 + CALL sla_EVP(TDB,2000D0,DVB,DPB,DVH,DPH) + + * Radial velocity correction due to Earth orbit (km/s) + VCORB = -sla_DVDV(V,DVH)*149.597870D6 + : +\end{verbatim} +\goodbreak +The maximum value of this correction is the Earth's orbital speed +of about 30~km/s. A related routine, +sla\_ECOR, +computes the light-time correction with respect to the Sun. It +would be used when reducing observations of a rapid variable-star +for instance. +Note, however, that the accuracy objectives for pulsar work are +beyond the scope of these SLALIB routines, and even the superior +sla\_EVP +routine is unsuitable for arrival-time calculations of better +than 25~millisecond accuracy. + +To remove the intrinsic $\sim20$~km/s motion of the Sun relative +to other stars in the solar neighbourhood, +a velocity correction to a +{\it local standard of rest}\/ (LSR) is required. There are +opportunities for mistakes here. There are two sorts of LSR, +{\it dynamical}\/ and {\it kinematical}, and +multiple definitions exist for the latter. The +dynamical LSR is a point near the Sun which is in a circular +orbit around the Galactic centre; the Sun has a ``peculiar'' +motion relative to the dynamical LSR. A kinematical LSR is +the mean standard of rest of specified star catalogues or stellar +populations, and its precise definition depends on which +catalogues or populations were used and how the analysis was +carried out. The Sun's motion with respect to a kinematical +LSR is called the ``standard'' solar motion. Radial +velocity corrections to the dynamical LSR are produced by the routine +sla\_RVLSRD +and to the adopted kinematical LSR by +sla\_RVLSRK. +See the individual specifications for these routines for the +precise definition of the LSR in each case. + +For extragalactic sources, the centre of the Galaxy can be used as +a standard of rest. The radial velocity correction from the +dynamical LSR to the Galactic centre can be obtained by calling +sla\_RVGALC. +Its maximum value is 220~km/s. + +For very distant sources it is appropriate to work relative +to the mean motion of the Local Group. The routine for +computing the radial velocity correction in this case is +sla\_RVLG. +Note that in this case the correction is with respect to the +dynamical LSR, not the Galactic centre as might be expected. +This conforms to the IAU definition, and confers immunity from +revisions of the Galactic rotation speed. + +\subsection{Focal-Plane Astrometry} +The relationship between the position of a star image in +the focal plane of a telescope and the star's celestial +coordinates is usually described in terms of the {\it tangent plane}\/ +or {\it gnomonic}\/ projection. This is the projection produced +by a pin-hole camera and is a good approximation to the projection +geometry of a traditional large {\it f}\/-ratio astrographic refractor. +SLALIB includes a group of routines which transform +star positions between their observed places on the celestial +sphere and their \xy\ coordinates in the tangent plane. The +spherical coordinate system does not have to be \radec\ but +usually is. The so-called {\it standard coordinates}\/ of a star +are the tangent plane \xy, in radians, with respect to an origin +at the tangent point, with the $y$-axis pointing north and +the $x$-axis pointing east (in the direction of increasing $\alpha$). +The factor relating the standard coordinates to +the actual \xy\ coordinates in, say, millimetres is simply +the focal length of the telescope. + +Given the \radec\ of the {\it plate centre}\/ (the tangent point) +and the \radec\ of a star within the field, the standard +coordinates can be determined by calling +sla\_S2TP +(single precision) or +sla\_DS2TP +(double precision). The reverse transformation, where the +\xy\ is known and we wish to find the \radec, is carried out by calling +sla\_TP2S +or +sla\_DTP2S. +Occasionally we know the both the \xy\ and the \radec\ of a +star and need to deduce the \radec\ of the tangent point; +this can be done by calling +sla\_TPS2C +or +sla\_DTPS2C. +(All of these transformations apply not just to \radec\ but to +other spherical coordinate systems, of course.) +Equivalent (and faster) +routines are provided which work directly in \xyz\ instead of +spherical coordinates: +sla\_V2TP and +sla\_DV2TP, +sla\_TP2V and +sla\_DTP2V, +sla\_TPV2C and +sla\_DTPV2C. + +Even at the best of times, the tangent plane projection is merely an +approximation. Some telescopes and cameras exhibit considerable pincushion +or barrel distortion and some have a curved focal surface. +For example, neither Schmidt cameras nor (especially) +large reflecting telescopes with wide-field corrector lenses +are adequately modelled by tangent-plane geometry. In such +cases, however, it is still possible to do most of the work +using the (mathematically convenient) tangent-plane +projection by inserting an extra step which applies or +removes the distortion peculiar to the system concerned. +A simple $r_1=r_0(1+Kr_0^2)$ law works well in the +majority of cases; $r_0$ is the radial distance in the +tangent plane, $r_1$ is the radial distance after adding +the distortion, and $K$ is a constant which depends on the +telescope ($\theta$ is unaffected). The routine +sla\_PCD +applies the distortion to an \xy\ and +sla\_UNPCD +removes it. For \xy\ in radians, $K$ values range from $-1/3$ for the +tiny amount of barrel distortion in Schmidt geometry to several +hundred for the serious pincushion distortion +produced by wide-field correctors in big reflecting telescopes +(the AAT prime focus triplet corrector is about $K=+178.6$). + +SLALIB includes a group of routines which can be put together +to build a simple plate-reduction program. The heart of the group is +sla\_FITXY, +which fits a linear model to relate two sets of \xy\ coordinates, +in the case of a plate reduction the measured positions of the +images of a set of +reference stars and the standard +coordinates derived from their catalogue positions. The +model is of the form: +\[x_{p} = a + bx_{m} + cy_{m}\] +\[y_{p} = d + ex_{m} + fy_{m}\] + +where the {\it p}\/ subscript indicates ``predicted'' coordinates +(the model's approximation to the ideal ``expected'' coordinates) and the +{\it m}\/ subscript indicates ``measured coordinates''. The +six coefficients {\it a--f}\/ can optionally be +constrained to represent a ``solid body rotation'' free of +any squash or shear distortions. Without this constraint +the model can, to some extent, accommodate effects like refraction, +allowing mean places to be used directly and +avoiding the extra complications of a +full mean-apparent-observed transformation for each star. +Having obtained the linear model, +sla\_PXY +can be used to process the set of measured and expected +coordinates, giving the predicted coordinates and determining +the RMS residuals in {\it x}\/ and {\it y}. +The routine +sla\_XY2XY +transforms one \xy\ into another using the linear model. A model +can be inverted by calling +sla\_INVF, +and decomposed into zero points, scales, $x/y$ nonperpendicularity +and orientation by calling +sla\_DCMPF. + +\subsection{Numerical Methods} +SLALIB contains a small number of simple, general-purpose +numerical-methods routines. They have no specific +connection with positional astronomy but have proved useful in +applications to do with simulation and fitting. + +At the heart of many simulation programs is the generation of +pseudo-random numbers, evenly distributed in a given range: +sla\_RANDOM +does this. Pseudo-random normal deviates, or ``Gaussian +residuals'', are often required to simulate noise and +can be generated by means of the function +sla\_GRESID. +Neither routine will pass super-sophisticated +statistical tests, but they work adequately for most +practical purposes and avoid the need to call non-standard +library routines peculiar to one sort of computer. + +Applications which perform a least-squares fit using a traditional +normal-equations methods can accomplish the required matrix-inversion +by calling either +sla\_SMAT +(single precision) or +sla\_DMAT +(double). A generally better way to perform such fits is +to use singular value decomposition. SLALIB provides a routine +to do the decomposition itself, +sla\_SVD, +and two routines to use the results: +sla\_SVDSOL +generates the solution, and +sla\_SVDCOV +produces the covariance matrix. +A simple demonstration of the use of the SLALIB SVD +routines is given below. It generates 500 simulated data +points and fits them to a model which has 4 unknown coefficients. +(The arrays in the example are sized to accept up to 1000 +points and 20 unknowns.) The model is: +\[ y = C_{1} +C_{2}x +C_{3}sin{x} +C_{4}cos{x} \] +The test values for the four coefficients are +$C_1\!=\!+50.0$, +$C_2\!=\!-2.0$, +$C_3\!=\!-10.0$ and +$C_4\!=\!+25.0$. +Gaussian noise, $\sigma=5.0$, is added to each ``observation''. +\goodbreak +\begin{verbatim} + IMPLICIT NONE + + * Sizes of arrays, physical and logical + INTEGER MP,NP,NC,M,N + PARAMETER (MP=1000,NP=10,NC=20,M=500,N=4) + + * The unknowns we are going to solve for + DOUBLE PRECISION C1,C2,C3,C4 + PARAMETER (C1=50D0,C2=-2D0,C3=-10D0,C4=25D0) + + * Arrays + DOUBLE PRECISION A(MP,NP),W(NP),V(NP,NP), + : WORK(NP),B(MP),X(NP),CVM(NC,NC) + + DOUBLE PRECISION VAL,BF1,BF2,BF3,BF4,SD2,D,VAR + REAL sla_GRESID + INTEGER I,J + + * Fill the design matrix + DO I=1,M + + * Dummy independent variable + VAL=DBLE(I)/10D0 + + * The basis functions + BF1=1D0 + BF2=VAL + BF3=SIN(VAL) + BF4=COS(VAL) + + * The observed value, including deliberate Gaussian noise + B(I)=C1*BF1+C2*BF2+C3*BF3+C4*BF4+DBLE(sla_GRESID(5.0)) + + * Fill one row of the design matrix + A(I,1)=BF1 + A(I,2)=BF2 + A(I,3)=BF3 + A(I,4)=BF4 + END DO + + * Factorize the design matrix, solve and generate covariance matrix + CALL sla_SVD(M,N,MP,NP,A,W,V,WORK,J) + CALL sla_SVDSOL(M,N,MP,NP,B,A,W,V,WORK,X) + CALL sla_SVDCOV(N,NP,NC,W,V,WORK,CVM) + + * Compute the variance + SD2=0D0 + DO I=1,M + VAL=DBLE(I)/10D0 + BF1=1D0 + BF2=VAL + BF3=SIN(VAL) + BF4=COS(VAL) + D=B(I)-(X(1)*BF1+X(2)*BF2+X(3)*BF3+X(4)*BF4) + SD2=SD2+D*D + END DO + VAR=SD2/DBLE(M) + + * Report the RMS and the solution + WRITE (*,'(1X,''RMS ='',F5.2/)') SQRT(VAR) + DO I=1,N + WRITE (*,'(1X,''C'',I1,'' ='',F7.3,'' +/-'',F6.3)') + : I,X(I),SQRT(VAR*CVM(I,I)) + END DO + END +\end{verbatim} +\goodbreak +The program produces the following output: +\goodbreak +\begin{verbatim} + RMS = 4.88 + + C1 = 50.192 +/- 0.439 + C2 = -2.002 +/- 0.015 + C3 = -9.771 +/- 0.310 + C4 = 25.275 +/- 0.310 +\end{verbatim} +\goodbreak +In this above example, essentially +identical results would be obtained if the more +commonplace normal-equations method had been used, and the large +$1000\times20$ array would have been avoided. However, the SVD method +comes into its own when the opportunity is taken to edit the W-matrix +(the so-called ``singular values'') in order to control +possible ill-conditioning. The procedure involves replacing with +zeroes any W-elements smaller than a nominated value, for example +0.001 times the largest W-element. Small W-elements indicate +ill-conditioning, which in the case of the normal-equations +method would produce spurious large coefficient values and +possible arithmetic overflows. Using SVD, the effect on the solution +of setting suspiciously small W-elements to zero is to restrain +the offending coefficients from moving very far. The +fact that action was taken can be reported to show the program user that +something is amiss. Furthermore, if element W(J) was set to zero, +the row numbers of the two biggest elements in the Jth column of the +V-matrix identify the pair of solution coefficients that are +dependent. + +A more detailed description of SVD and its use in least-squares +problems would be out of place here, and the reader is urged +to refer to the relevant sections of the book {\it Numerical Recipes} +(Press {\it et al.}, Cambridge University Press, 1987). + +\pagebreak + +\section{SUMMARY OF CALLS} +The basic trigonometrical and numerical facilities are supplied in both single +and double precision versions. +Most of the more esoteric position and time routines use double precision +arguments only, even in cases where single precision would normally be adequate +in practice. +Certain routines with modest accuracy objectives are supplied in +single precision versions only. +In the calling sequences which follow, no attempt has been made +to distinguish between single and double precision argument names, +and frequently the same name is used on different occasions to +mean different things. +However, none of the routines uses a mixture of single and +double precision arguments; each routine is either wholly +single precision or wholly double precision. + +In the classified list, below, +{\it subroutine}\/ subprograms are those whose names and argument lists +are preceded by `CALL', whereas {\it function}\/ subprograms are +those beginning `R=' (when the result is REAL) or `D=' (when +the result is DOUBLE~PRECISION). + +The list is, of course, merely for quick reference; inexperienced +users {\bf must} refer to the detailed specifications given later. +In particular, {\bf don't guess} whether arguments are single or +double precision; the result could be a program that happens to +works on one sort of machine but not on another. + +\callhead{String Decoding} +\begin{callset} +\subp{CALL sla\_INTIN (STRING, NSTRT, IRESLT, JFLAG)} + Convert free-format string into integer +\subq{CALL sla\_FLOTIN (STRING, NSTRT, RESLT, JFLAG)} + {CALL sla\_DFLTIN (STRING, NSTRT, DRESLT, JFLAG)} + Convert free-format string into floating-point number +\subq{CALL sla\_AFIN (STRING, NSTRT, RESLT, JFLAG)} + {CALL sla\_DAFIN (STRING, NSTRT, DRESLT, JFLAG)} + Convert free-format string from deg,arcmin,arcsec to radians +\end{callset} + +\callhead{Sexagesimal Conversions} +\begin{callset} +\subq{CALL sla\_CTF2D (IHOUR, IMIN, SEC, DAYS, J)} + {CALL sla\_DTF2D (IHOUR, IMIN, SEC, DAYS, J)} + Hours, minutes, seconds to days +\subq{CALL sla\_CD2TF (NDP, DAYS, SIGN, IHMSF)} + {CALL sla\_DD2TF (NDP, DAYS, SIGN, IHMSF)} + Days to hours, minutes, seconds +\subq{CALL sla\_CTF2R (IHOUR, IMIN, SEC, RAD, J)} + {CALL sla\_DTF2R (IHOUR, IMIN, SEC, RAD, J)} + Hours, minutes, seconds to radians +\subq{CALL sla\_CR2TF (NDP, ANGLE, SIGN, IHMSF)} + {CALL sla\_DR2TF (NDP, ANGLE, SIGN, IHMSF)} + Radians to hours, minutes, seconds +\subq{CALL sla\_CAF2R (IDEG, IAMIN, ASEC, RAD, J)} + {CALL sla\_DAF2R (IDEG, IAMIN, ASEC, RAD, J)} + Degrees, arcminutes, arcseconds to radians +\subq{CALL sla\_CR2AF (NDP, ANGLE, SIGN, IDMSF)} + {CALL sla\_DR2AF (NDP, ANGLE, SIGN, IDMSF)} + Radians to degrees, arcminutes, arcseconds +\end{callset} + +\callhead{Angles, Vectors and Rotation Matrices} +\begin{callset} +\subq{R~=~sla\_RANGE (ANGLE)} + {D~=~sla\_DRANGE (ANGLE)} + Normalize angle into range $\pm\pi$ +\subq{R~=~sla\_RANORM (ANGLE)} + {D~=~sla\_DRANRM (ANGLE)} + Normalize angle into range $0\!-\!2\pi$ +\subq{CALL sla\_CS2C (A, B, V)} + {CALL sla\_DCS2C (A, B, V)} + Spherical coordinates to \xyz +\subq{CALL sla\_CC2S (V, A, B)} + {CALL sla\_DCC2S (V, A, B)} + \xyz\ to spherical coordinates +\subq{R~=~sla\_VDV (VA, VB)} + {D~=~sla\_DVDV (VA, VB)} + Scalar product of two 3-vectors +\subq{CALL sla\_VXV (VA, VB, VC)} + {CALL sla\_DVXV (VA, VB, VC)} + Vector product of two 3-vectors +\subq{CALL sla\_VN (V, UV, VM)} + {CALL sla\_DVN (V, UV, VM)} + Normalize a 3-vector also giving the modulus +\subq{R~=~sla\_SEP (A1, B1, A2, B2)} + {D~=~sla\_DSEP (A1, B1, A2, B2)} + Angle between two points on a sphere +\subq{R~=~sla\_BEAR (A1, B1, A2, B2)} + {D~=~sla\_DBEAR (A1, B1, A2, B2)} + Direction of one point on a sphere seen from another +\subq{R~=~sla\_PAV (V1, V2)} + {D~=~sla\_DPAV (V1, V2)} + Position-angle of one \xyz\ with respect to another +\subq{CALL sla\_EULER (ORDER, PHI, THETA, PSI, RMAT)} + {CALL sla\_DEULER (ORDER, PHI, THETA, PSI, RMAT)} + Form rotation matrix from three Euler angles +\subq{CALL sla\_AV2M (AXVEC, RMAT)} + {CALL sla\_DAV2M (AXVEC, RMAT)} + Form rotation matrix from axial vector +\subq{CALL sla\_M2AV (RMAT, AXVEC)} + {CALL sla\_DM2AV (RMAT, AXVEC)} + Determine axial vector from rotation matrix +\subq{CALL sla\_MXV (RM, VA, VB)} + {CALL sla\_DMXV (DM, VA, VB)} + Rotate vector forwards +\subq{CALL sla\_IMXV (RM, VA, VB)} + {CALL sla\_DIMXV (DM, VA, VB)} + Rotate vector backwards +\subq{CALL sla\_MXM (A, B, C)} + {CALL sla\_DMXM (A, B, C)} + Product of two 3x3 matrices +\subq{CALL sla\_CS2C6 (A, B, R, AD, BD, RD, V)} + {CALL sla\_DS2C6 (A, B, R, AD, BD, RD, V)} + Conversion of position and velocity in spherical + coordinates to Cartesian coordinates +\subq{CALL sla\_CC62S (V, A, B, R, AD, BD, RD)} + {CALL sla\_DC62S (V, A, B, R, AD, BD, RD)} + Conversion of position and velocity in Cartesian + coordinates to spherical coordinates +\end{callset} + +\callhead{Calendars} +\begin{callset} +\subp{CALL sla\_CLDJ (IY, IM, ID, DJM, J)} + Gregorian Calendar to Modified Julian Date +\subp{CALL sla\_CALDJ (IY, IM, ID, DJM, J)} + Gregorian Calendar to Modified Julian Date, + permitting century default +\subp{CALL sla\_DJCAL (NDP, DJM, IYMDF, J)} + Modified Julian Date to Gregorian Calendar, + in a form convenient for formatted output +\subp{CALL sla\_DJCL (DJM, IY, IM, ID, FD, J)} + Modified Julian Date to Gregorian Year, Month, Day, Fraction +\subp{CALL sla\_CALYD (IY, IM, ID, NY, ND, J)} + Calendar to year and day in year, permitting century default +\subp{CALL sla\_CLYD (IY, IM, ID, NY, ND, J)} + Calendar to year and day in year +\subp{D~=~sla\_EPB (DATE)} + Modified Julian Date to Besselian Epoch +\subp{D~=~sla\_EPB2D (EPB)} + Besselian Epoch to Modified Julian Date +\subp{D~=~sla\_EPJ (DATE)} + Modified Julian Date to Julian Epoch +\subp{D~=~sla\_EPJ2D (EPJ)} + Julian Epoch to Modified Julian Date +\end{callset} + +\callhead{Timescales} +\begin{callset} +\subp{D~=~sla\_GMST (UT1)} + Conversion from Universal Time to sidereal time +\subp{D~=~sla\_GMSTA (DATE, UT1)} + Conversion from Universal Time to sidereal time, rounding errors minimized +\subp{D~=~sla\_EQEQX (DATE)} + Equation of the equinoxes +\subp{D~=~sla\_DAT (DJU)} + Offset of Atomic Time from Coordinated Universal Time: TAI$-$UTC +\subp{D~=~sla\_DT (EPOCH)} + Approximate offset between dynamical time and universal time +\subp{D~=~sla\_DTT (DJU)} + Offset of Terrestrial Time from Coordinated Universal Time: TT$-$UTC +\subp{D~=~sla\_RCC (TDB, UT1, WL, U, V)} + Relativistic clock correction: TDB$-$TT +\end{callset} + +\callhead{Precession and Nutation} +\begin{callset} +\subp{CALL sla\_NUT (DATE, RMATN)} + Nutation matrix +\subp{CALL sla\_NUTC (DATE, DPSI, DEPS, EPS0)} + Longitude and obliquity components of nutation, and + mean obliquity +\subp{CALL sla\_PREC (EP0, EP1, RMATP)} + Precession matrix (IAU) +\subp{CALL sla\_PRECL (EP0, EP1, RMATP)} + Precession matrix (suitable for long periods) +\subp{CALL sla\_PRENUT (EPOCH, DATE, RMATPN)} + Combined precession/nutation matrix +\subp{CALL sla\_PREBN (BEP0, BEP1, RMATP)} + Precession matrix, old system +\subp{CALL sla\_PRECES (SYSTEM, EP0, EP1, RA, DC)} + Precession, in either the old or the new system +\end{callset} + +\callhead{Proper Motion} +\begin{callset} +\subp{CALL sla\_PM (R0, D0, PR, PD, PX, RV, EP0, EP1, R1, D1)} + Adjust for proper motion +\end{callset} + +\callhead{FK4/FK5/Hipparcos Conversions} +\begin{callset} +\subp{CALL sla\_FK425 (\vtop + {\hbox{R1950, D1950, DR1950, DD1950, P1950, V1950,} + \hbox{R2000, D2000, DR2000, DD2000, P2000, V2000)}}} + Convert B1950.0 FK4 star data to J2000.0 FK5 +\subp{CALL sla\_FK45Z (R1950, D1950, EPOCH, R2000, D2000)} + Convert B1950.0 FK4 position to J2000.0 FK5 assuming zero + FK5 proper motion and no parallax +\subp{CALL sla\_FK524 (\vtop + {\hbox{R2000, D2000, DR2000, DD2000, P2000, V2000,} + \hbox{R1950, D1950, DR1950, DD1950, P1950, V1950)}}} + Convert J2000.0 FK5 star data to B1950.0 FK4 +\subp{CALL sla\_FK54Z (R2000, D2000, BEPOCH, + R1950, D1950, DR1950, DD1950)} + Convert J2000.0 FK5 position to B1950.0 FK4 assuming zero + FK5 proper motion and no parallax +\subp{CALL sla\_FK52H (R5, D5, DR5, DD5, RH, DH, DRH, DDH)} + Convert J2000.0 FK5 star data to Hipparcos +\subp{CALL sla\_FK5HZ (R5, D5, EPOCH, RH, DH )} + Convert J2000.0 FK5 position to Hipparcos assuming zero Hipparcos + proper motion +\subp{CALL sla\_H2FK5 (RH, DH, DRH, DDH, R5, D5, DR5, DD5)} + Convert Hipparcos star data to J2000.0 FK5 +\subp{CALL sla\_HFK5Z (RH, DH, EPOCH, R5, D5, DR5, DD5)} + Convert Hipparcos position to J2000.0 FK5 assuming zero Hipparcos + proper motion +\subp{CALL sla\_DBJIN (STRING, NSTRT, DRESLT, J1, J2)} + Like sla\_DFLTIN but with extensions to accept leading `B' and `J' +\subp{CALL sla\_KBJ (JB, E, K, J)} + Select epoch prefix `B' or `J' +\subp{D~=~sla\_EPCO (K0, K, E)} + Convert an epoch into the appropriate form -- `B' or `J' +\end{callset} + +\callhead{Elliptic Aberration} +\begin{callset} +\subp{CALL sla\_ETRMS (EP, EV)} + E-terms +\subp{CALL sla\_SUBET (RC, DC, EQ, RM, DM)} + Remove the E-terms +\subp{CALL sla\_ADDET (RM, DM, EQ, RC, DC)} + Add the E-terms +\end{callset} + +\callhead{Geographical and Geocentric Coordinates} +\begin{callset} +\subp{CALL sla\_OBS (NUMBER, ID, NAME, WLONG, PHI, HEIGHT)} + Interrogate list of observatory parameters +\subp{CALL sla\_GEOC (P, H, R, Z)} + Convert geodetic position to geocentric +\subp{CALL sla\_POLMO (ELONGM, PHIM, XP, YP, ELONG, PHI, DAZ)} + Polar motion +\subp{CALL sla\_PVOBS (P, H, STL, PV)} + Position and velocity of observatory +\end{callset} + +\callhead{Apparent and Observed Place} +\begin{callset} +\subp{CALL sla\_MAP (RM, DM, PR, PD, PX, RV, EQ, DATE, RA, DA)} + Mean place to geocentric apparent place +\subp{CALL sla\_MAPPA (EQ, DATE, AMPRMS)} + Precompute mean to apparent parameters +\subp{CALL sla\_MAPQK (RM, DM, PR, PD, PX, RV, AMPRMS, RA, DA)} + Mean to apparent using precomputed parameters +\subp{CALL sla\_MAPQKZ (RM, DM, AMPRMS, RA, DA)} + Mean to apparent using precomputed parameters, for zero proper + motion, parallax and radial velocity +\subp{CALL sla\_AMP (RA, DA, DATE, EQ, RM, DM)} + Geocentric apparent place to mean place +\subp{CALL sla\_AMPQK (RA, DA, AOPRMS, RM, DM)} + Apparent to mean using precomputed parameters +\subp{CALL sla\_AOP (\vtop + {\hbox{RAP, DAP, UTC, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, AOB, ZOB, HOB, DOB, ROB)}}} + Apparent place to observed place +\subp{CALL sla\_AOPPA (\vtop + {\hbox{UTC, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, AOPRMS)}}} + Precompute apparent to observed parameters +\subp{CALL sla\_AOPPAT (UTC, AOPRMS)} + Update sidereal time in apparent to observed parameters +\subp{CALL sla\_AOPQK (RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB)} + Apparent to observed using precomputed parameters +\subp{CALL sla\_OAP (\vtop + {\hbox{TYPE, OB1, OB2, UTC, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, RAP, DAP)}}} + Observed to apparent +\subp{CALL sla\_OAPQK (TYPE, OB1, OB2, AOPRMS, RA, DA)} + Observed to apparent using precomputed parameters +\end{callset} + +\callhead{Azimuth and Elevation} +\begin{callset} +\subp{CALL sla\_ALTAZ (\vtop + {\hbox{HA, DEC, PHI,} + \hbox{AZ, AZD, AZDD, EL, ELD, ELDD, PA, PAD, PADD)}}} + Positions, velocities {\it etc.}\ for an altazimuth mount +\subq{CALL sla\_E2H (HA, DEC, PHI, AZ, EL)} + {CALL sla\_DE2H (HA, DEC, PHI, AZ, EL)} + \hadec\ to \azel +\subq{CALL sla\_H2E (AZ, EL, PHI, HA, DEC)} + {CALL sla\_DH2E (AZ, EL, PHI, HA, DEC)} + \azel\ to \hadec +\subp{CALL sla\_PDA2H (P, D, A, H1, J1, H2, J2)} + Hour Angle corresponding to a given azimuth +\subp{CALL sla\_PDQ2H (P, D, Q, H1, J1, H2, J2)} + Hour Angle corresponding to a given parallactic angle +\subp{D~=~sla\_PA (HA, DEC, PHI)} + \hadec\ to parallactic angle +\subp{D~=~sla\_ZD (HA, DEC, PHI)} + \hadec\ to zenith distance +\end{callset} + +\callhead{Refraction and Air Mass} +\begin{callset} +\subp{CALL sla\_REFRO (ZOBS, HM, TDK, PMB, RH, WL, PHI, TLR, EPS, REF)} + Change in zenith distance due to refraction +\subp{CALL sla\_REFCO (HM, TDK, PMB, RH, WL, PHI, TLR, EPS, REFA, REFB)} + Constants for simple refraction model (accurate) +\subp{CALL sla\_REFCOQ (TDK, PMB, RH, WL, REFA, REFB)} + Constants for simple refraction model (fast) +\subp{CALL sla\_ATMDSP ( TDK, PMB, RH, WL1, REFA1, REFB1, WL2, REFA2, REFB2 )} + Adjust refraction constants for colour +\subp{CALL sla\_REFZ (ZU, REFA, REFB, ZR)} + Unrefracted to refracted ZD, simple model +\subp{CALL sla\_REFV (VU, REFA, REFB, VR)} + Unrefracted to refracted \azel\ vector, simple model +\subp{D~=~sla\_AIRMAS (ZD)} + Air mass +\end{callset} + +\callhead{Ecliptic Coordinates} +\begin{callset} +\subp{CALL sla\_ECMAT (DATE, RMAT)} + Equatorial to ecliptic rotation matrix +\subp{CALL sla\_EQECL (DR, DD, DATE, DL, DB)} + J2000.0 `FK5' to ecliptic coordinates +\subp{CALL sla\_ECLEQ (DL, DB, DATE, DR, DD)} + Ecliptic coordinates to J2000.0 `FK5' +\end{callset} + +\callhead{Galactic Coordinates} +\begin{callset} +\subp{CALL sla\_EG50 (DR, DD, DL, DB)} + B1950.0 `FK4' to galactic +\subp{CALL sla\_GE50 (DL, DB, DR, DD)} + Galactic to B1950.0 `FK4' +\subp{CALL sla\_EQGAL (DR, DD, DL, DB)} + J2000.0 `FK5' to galactic +\subp{CALL sla\_GALEQ (DL, DB, DR, DD)} + Galactic to J2000.0 `FK5' +\end{callset} + +\callhead{Supergalactic Coordinates} +\begin{callset} +\subp{CALL sla\_GALSUP (DL, DB, DSL, DSB)} + Galactic to supergalactic +\subp{CALL sla\_SUPGAL (DSL, DSB, DL, DB)} + Supergalactic to galactic +\end{callset} + +\callhead{Ephemerides} +\begin{callset} +\subp{CALL sla\_DMOON (DATE, PV)} + Approximate geocentric position and velocity of the Moon +\subp{CALL sla\_EARTH (IY, ID, FD, PV)} + Approximate heliocentric position and velocity of the Earth +\subp{CALL sla\_EVP (DATE, DEQX, DVB, DPB, DVH, DPH)} + Barycentric and heliocentric velocity and position of the Earth +\subp{CALL sla\_MOON (IY, ID, FD, PV)} + Approximate geocentric position and velocity of the Moon +\subp{CALL sla\_PLANET (DATE, NP, PV, JSTAT)} + Approximate heliocentric position and velocity of a planet +\subp{CALL sla\_RDPLAN (DATE, NP, ELONG, PHI, RA, DEC, DIAM)} + Approximate topocentric apparent place of a planet +\subp{CALL sla\_PLANEL (\vtop + {\hbox{DATE, JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, PV, JSTAT)}}} + Heliocentric position and velocity of a planet, asteroid or + comet, starting from orbital elements +\subp{CALL sla\_PLANTE (\vtop + {\hbox{DATE, ELONG, PHI, JFORM, EPOCH, ORBINC, ANODE,} + \hbox{PERIH, AORQ, E, AORL, DM, RA, DEC, R, JSTAT)}}} + Topocentric apparent place of a Solar-System object whose + heliocentric orbital elements are known +\subp{CALL sla\_PV2EL (\vtop + {\hbox{PV, DATE, PMASS, JFORMR, JFORM, EPOCH, ORBINC,} + \hbox{ANODE, PERIH, AORQ, E, AORL, DM, JSTAT)}}} + Orbital elements of a planet from instantaneous position and velocity +\subp{CALL sla\_PERTEL (\vtop + {\hbox{JFORM, DATE0, DATE1,} + \hbox{EPOCH0, ORBI0, ANODE0, PERIH0, AORQ0, E0, AM0,} + \hbox{EPOCH1, ORBI1, ANODE1, PERIH1, AORQ1, E1, AM1,} + \hbox{JSTAT)}}} + Update elements by applying perturbations +\subp{CALL sla\_EL2UE (\vtop + {\hbox{DATE, JFORM, EPOCH, ORBINC, ANODE,} + \hbox{PERIH, AORQ, E, AORL, DM,} + \hbox{U, JSTAT)}}} + Transform conventional elements to universal elements +\subp{CALL sla\_UE2EL (\vtop + {\hbox{U, JFORMR,} + \hbox{JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, JSTAT)}}} + Transform universal elements to conventional elements +\subp{CALL sla\_PV2UE (PV, DATE, PMASS, U, JSTAT)} + Package a position and velocity for use as universal elements +\subp{CALL sla\_UE2PV (DATE, U, PV, JSTAT)} + Extract the position and velocity from universal elements +\subp{CALL sla\_PERTUE (DATE, U, JSTAT)} + Update universal elements by applying perturbations +\subp{R~=~sla\_RVEROT (PHI, RA, DA, ST)} + Velocity component due to rotation of the Earth +\subp{CALL sla\_ECOR (RM, DM, IY, ID, FD, RV, TL)} + Components of velocity and light time due to Earth orbital motion +\subp{R~=~sla\_RVLSRD (R2000, D2000)} + Velocity component due to solar motion wrt dynamical LSR +\subp{R~=~sla\_RVLSRK (R2000, D2000)} + Velocity component due to solar motion wrt kinematical LSR +\subp{R~=~sla\_RVGALC (R2000, D2000)} + Velocity component due to rotation of the Galaxy +\subp{R~=~sla\_RVLG (R2000, D2000)} + Velocity component due to rotation and translation of the + Galaxy, relative to the mean motion of the local group +\end{callset} + +\callhead{Astrometry} +\begin{callset} +\subq{CALL sla\_S2TP (RA, DEC, RAZ, DECZ, XI, ETA, J)} + {CALL sla\_DS2TP (RA, DEC, RAZ, DECZ, XI, ETA, J)} + Transform spherical coordinates into tangent plane +\subq{CALL sla\_V2TP (V, V0, XI, ETA, J)} + {CALL sla\_DV2TP (V, V0, XI, ETA, J)} + Transform \xyz\ into tangent plane coordinates +\subq{CALL sla\_DTP2S (XI, ETA, RAZ, DECZ, RA, DEC)} + {CALL sla\_TP2S (XI, ETA, RAZ, DECZ, RA, DEC)} + Transform tangent plane coordinates into spherical coordinates +\subq{CALL sla\_DTP2V (XI, ETA, V0, V)} + {CALL sla\_TP2V (XI, ETA, V0, V)} + Transform tangent plane coordinates into \xyz +\subq{CALL sla\_DTPS2C (XI, ETA, RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2, N)} + {CALL sla\_TPS2C (XI, ETA, RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2, N)} + Get plate centre from star \radec\ and tangent plane coordinates +\subq{CALL sla\_DTPV2C (XI, ETA, V, V01, V02, N)} + {CALL sla\_TPV2C (XI, ETA, V, V01, V02, N)} + Get plate centre from star \xyz\ and tangent plane coordinates +\subp{CALL sla\_PCD (DISCO, X, Y)} + Apply pincushion/barrel distortion +\subp{CALL sla\_UNPCD (DISCO, X, Y)} + Remove pincushion/barrel distortion +\subp{CALL sla\_FITXY (ITYPE, NP, XYE, XYM, COEFFS, J)} + Fit a linear model to relate two sets of \xy\ coordinates +\subp{CALL sla\_PXY (NP, XYE, XYM, COEFFS, XYP, XRMS, YRMS, RRMS)} + Compute predicted coordinates and residuals +\subp{CALL sla\_INVF (FWDS, BKWDS, J)} + Invert a linear model +\subp{CALL sla\_XY2XY (X1, Y1, COEFFS, X2, Y2)} + Transform one \xy +\subp{CALL sla\_DCMPF (COEFFS, XZ, YZ, XS, YS, PERP, ORIENT)} + Decompose a linear fit into scales {\it etc.} +\end{callset} + +\callhead{Numerical Methods} +\begin{callset} +\subq{CALL sla\_SMAT (N, A, Y, D, JF, IW)} + {CALL sla\_DMAT (N, A, Y, D, JF, IW)} + Matrix inversion and solution of simultaneous equations +\subp{CALL sla\_SVD (M, N, MP, NP, A, W, V, WORK, JSTAT)} + Singular value decomposition of a matrix +\subp{CALL sla\_SVDSOL (M, N, MP, NP, B, U, W, V, WORK, X)} + Solution from given vector plus SVD +\subp{CALL sla\_SVDCOV (N, NP, NC, W, V, WORK, CVM)} + Covariance matrix from SVD +\subp{R~=~sla\_RANDOM (SEED)} + Generate pseudo-random real number in the range {$0 \leq x < 1$} +\subp{R~=~sla\_GRESID (S)} + Generate pseudo-random normal deviate ($\equiv$ `Gaussian residual') +\end{callset} + +\callhead{Real-time} +\begin{callset} +\subp{CALL sla\_WAIT (DELAY)} + Interval wait +\end{callset} + +\end{document} diff --git a/math/slalib/doc/supgal.hlp b/math/slalib/doc/supgal.hlp new file mode 100644 index 00000000..aa260719 --- /dev/null +++ b/math/slalib/doc/supgal.hlp @@ -0,0 +1,43 @@ +.help supgal Jun99 "Slalib Package" +.nf + + SUBROUTINE slSUGA (DSL, DSB, DL, DB) + + - - - - - - - + S U G A + - - - - - - - + + Transformation from de Vaucouleurs supergalactic coordinates + to IAU 1958 galactic coordinates (double precision) + + Given: + DSL,DSB dp supergalactic longitude and latitude + + Returned: + DL,DB dp galactic longitude and latitude L2,B2 + + (all arguments are radians) + + Called: + slDS2C, slDIMV, slDC2S, slDA2P, slDA1P + + References: + + de Vaucouleurs, de Vaucouleurs, & Corwin, Second Reference + Catalogue of Bright Galaxies, U. Texas, page 8. + + Systems & Applied Sciences Corp., Documentation for the + machine-readable version of the above catalogue, + Contract NAS 5-26490. + + (These two references give different values for the galactic + longitude of the supergalactic origin. Both are wrong; the + correct value is L2=137.37.) + + P.T.Wallace Starlink March 1986 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/svd.hlp b/math/slalib/doc/svd.hlp new file mode 100644 index 00000000..14b87c43 --- /dev/null +++ b/math/slalib/doc/svd.hlp @@ -0,0 +1,73 @@ +.help svd Jun99 "Slalib Package" +.nf + + SUBROUTINE slSVD (M, N, MP, NP, A, W, V, WORK, JSTAT) + + - - - - + S V D + - - - - + + Singular value decomposition (double precision) + + This routine expresses a given matrix A as the product of + three matrices U, W, V: + + A = U x W x VT + + Where: + + A is any M (rows) x N (columns) matrix, where M.GE.N + U is an M x N column-orthogonal matrix + W is an N x N diagonal matrix with W(I,I).GE.0 + VT is the transpose of an N x N orthogonal matrix + + Note that M and N, above, are the LOGICAL dimensions of the + matrices and vectors concerned, which can be located in + arrays of larger PHYSICAL dimensions, given by MP and NP. + + Given: + M,N i numbers of rows and columns in matrix A + MP,NP i physical dimensions of array containing matrix A + A d(MP,NP) array containing MxN matrix A + + Returned: + A d(MP,NP) array containing MxN column-orthogonal matrix U + W d(N) NxN diagonal matrix W (diagonal elements only) + V d(NP,NP) array containing NxN orthogonal matrix V + WORK d(N) workspace + JSTAT i 0 = OK, -1 = A wrong shape, >0 = index of W + for which convergence failed. See note 2, below. + + Notes: + + 1) V contains matrix V, not the transpose of matrix V. + + 2) If the status JSTAT is greater than zero, this need not + necessarily be treated as a failure. It means that, due to + chance properties of the matrix A, the QR transformation + phase of the routine did not fully converge in a predefined + number of iterations, something that very seldom occurs. + When this condition does arise, it is possible that the + elements of the diagonal matrix W have not been correctly + found. However, in practice the results are likely to + be trustworthy. Applications should report the condition + as a warning, but then proceed normally. + + References: + The algorithm is an adaptation of the routine SVD in the EISPACK + library (Garbow et al 1977, EISPACK Guide Extension, Springer + Verlag), which is a FORTRAN 66 implementation of the Algol + routine SVD of Wilkinson & Reinsch 1971 (Handbook for Automatic + Computation, vol 2, ed Bauer et al, Springer Verlag). These + references give full details of the algorithm used here. A good + account of the use of SVD in least squares problems is given in + Numerical Recipes (Press et al 1986, Cambridge University Press), + which includes another variant of the EISPACK code. + + P.T.Wallace Starlink 22 December 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/svdcov.hlp b/math/slalib/doc/svdcov.hlp new file mode 100644 index 00000000..48ce38df --- /dev/null +++ b/math/slalib/doc/svdcov.hlp @@ -0,0 +1,35 @@ +.help svdcov Jun99 "Slalib Package" +.nf + + SUBROUTINE slSVDC (N, NP, NC, W, V, WORK, CVM) + + - - - - - - - + S V D C + - - - - - - - + + From the W and V matrices from the SVD factorisation of a matrix + (as obtained from the slSVD routine), obtain the covariance matrix. + + (double precision) + + Given: + N i number of rows and columns in matrices W and V + NP i first dimension of array containing matrix V + NC i first dimension of array to receive CVM + W d(N) NxN diagonal matrix W (diagonal elements only) + V d(NP,NP) array containing NxN orthogonal matrix V + + Returned: + WORK d(N) workspace + CVM d(NC,NC) array to receive covariance matrix + + Reference: + Numerical Recipes, section 14.3. + + P.T.Wallace Starlink December 1988 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/svdsol.hlp b/math/slalib/doc/svdsol.hlp new file mode 100644 index 00000000..42513cfa --- /dev/null +++ b/math/slalib/doc/svdsol.hlp @@ -0,0 +1,82 @@ +.help svdsol Jun99 "Slalib Package" +.nf + + SUBROUTINE slSVDS (M, N, MP, NP, B, U, W, V, WORK, X) + + - - - - - - - + S V D S + - - - - - - - + + From a given vector and the SVD of a matrix (as obtained from + the SVD routine), obtain the solution vector (double precision) + + This routine solves the equation: + + A . x = b + + where: + + A is a given M (rows) x N (columns) matrix, where M.GE.N + x is the N-vector we wish to find + b is a given M-vector + + by means of the Singular Value Decomposition method (SVD). In + this method, the matrix A is first factorised (for example by + the routine slSVD) into the following components: + + A = U x W x VT + + where: + + A is the M (rows) x N (columns) matrix + U is an M x N column-orthogonal matrix + W is an N x N diagonal matrix with W(I,I).GE.0 + VT is the transpose of an NxN orthogonal matrix + + Note that M and N, above, are the LOGICAL dimensions of the + matrices and vectors concerned, which can be located in + arrays of larger PHYSICAL dimensions MP and NP. + + The solution is found from the expression: + + x = V . [diag(1/Wj)] . (transpose(U) . b) + + Notes: + + 1) If matrix A is square, and if the diagonal matrix W is not + adjusted, the method is equivalent to conventional solution + of simultaneous equations. + + 2) If M>N, the result is a least-squares fit. + + 3) If the solution is poorly determined, this shows up in the + SVD factorisation as very small or zero Wj values. Where + a Wj value is small but non-zero it can be set to zero to + avoid ill effects. The present routine detects such zero + Wj values and produces a sensible solution, with highly + correlated terms kept under control rather than being allowed + to elope to infinity, and with meaningful values for the + other terms. + + Given: + M,N i numbers of rows and columns in matrix A + MP,NP i physical dimensions of array containing matrix A + B d(M) known vector b + U d(MP,NP) array containing MxN matrix U + W d(N) NxN diagonal matrix W (diagonal elements only) + V d(NP,NP) array containing NxN orthogonal matrix V + + Returned: + WORK d(N) workspace + X d(N) unknown vector x + + Reference: + Numerical Recipes, section 2.9. + + P.T.Wallace Starlink 29 October 1993 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/tp2s.hlp b/math/slalib/doc/tp2s.hlp new file mode 100644 index 00000000..3cbf1c8e --- /dev/null +++ b/math/slalib/doc/tp2s.hlp @@ -0,0 +1,28 @@ +.help tp2s Jun99 "Slalib Package" +.nf + + SUBROUTINE slTP2S (XI, ETA, RAZ, DECZ, RA, DEC) + + - - - - - + T P 2 S + - - - - - + + Transform tangent plane coordinates into spherical + (single precision) + + Given: + XI,ETA real tangent plane rectangular coordinates + RAZ,DECZ real spherical coordinates of tangent point + + Returned: + RA,DEC real spherical coordinates (0-2pi,+/-pi/2) + + Called: slRA2P + + P.T.Wallace Starlink 24 July 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/tp2v.hlp b/math/slalib/doc/tp2v.hlp new file mode 100644 index 00000000..e81c60d1 --- /dev/null +++ b/math/slalib/doc/tp2v.hlp @@ -0,0 +1,40 @@ +.help tp2v Jun99 "Slalib Package" +.nf + + SUBROUTINE slTP2V (XI, ETA, V0, V) + + - - - - - + T P 2 V + - - - - - + + Given the tangent-plane coordinates of a star and the direction + cosines of the tangent point, determine the direction cosines + of the star. + + (single precision) + + Given: + XI,ETA r tangent plane coordinates of star + V0 r(3) direction cosines of tangent point + + Returned: + V r(3) direction cosines of star + + Notes: + + 1 If vector V0 is not of unit length, the returned vector V will + be wrong. + + 2 If vector V0 points at a pole, the returned vector V will be + based on the arbitrary assumption that the RA of the tangent + point is zero. + + 3 This routine is the Cartesian equivalent of the routine slTP2S. + + P.T.Wallace Starlink 11 February 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/tps2c.hlp b/math/slalib/doc/tps2c.hlp new file mode 100644 index 00000000..d1914ef2 --- /dev/null +++ b/math/slalib/doc/tps2c.hlp @@ -0,0 +1,58 @@ +.help tps2c Jun99 "Slalib Package" +.nf + + SUBROUTINE slTPSC (XI, ETA, RA, DEC, RAZ1, DECZ1, + : RAZ2, DECZ2, N) + + - - - - - - + T P S C + - - - - - - + + From the tangent plane coordinates of a star of known RA,Dec, + determine the RA,Dec of the tangent point. + + (single precision) + + Given: + XI,ETA r tangent plane rectangular coordinates + RA,DEC r spherical coordinates + + Returned: + RAZ1,DECZ1 r spherical coordinates of tangent point, solution 1 + RAZ2,DECZ2 r spherical coordinates of tangent point, solution 2 + N i number of solutions: + 0 = no solutions returned (note 2) + 1 = only the first solution is useful (note 3) + 2 = both solutions are useful (note 3) + + Notes: + + 1 The RAZ1 and RAZ2 values are returned in the range 0-2pi. + + 2 Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero XI value, and hence it is + meaningless to ask where the tangent point would have to be + to bring about this combination of XI and DEC. + + 3 Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. N=1 indicates only one useful + solution, the usual case; under these circumstances, the second + solution corresponds to the "over-the-pole" case, and this is + reflected in the values of RAZ2 and DECZ2 which are returned. + + 4 The DECZ1 and DECZ2 values are returned in the range +/-pi, but + in the usual, non-pole-crossing, case, the range is +/-pi/2. + + 5 This routine is the spherical equivalent of the routine slDPVC. + + Called: slRA2P + + P.T.Wallace Starlink 5 June 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/tpv2c.hlp b/math/slalib/doc/tpv2c.hlp new file mode 100644 index 00000000..7a1b688d --- /dev/null +++ b/math/slalib/doc/tpv2c.hlp @@ -0,0 +1,51 @@ +.help tpv2c Jun99 "Slalib Package" +.nf + + SUBROUTINE slTPVC (XI, ETA, V, V01, V02, N) + + - - - - - - + T P V C + - - - - - - + + Given the tangent-plane coordinates of a star and its direction + cosines, determine the direction cosines of the tangent-point. + + (single precision) + + Given: + XI,ETA r tangent plane coordinates of star + V r(3) direction cosines of star + + Returned: + V01 r(3) direction cosines of tangent point, solution 1 + V02 r(3) direction cosines of tangent point, solution 2 + N i number of solutions: + 0 = no solutions returned (note 2) + 1 = only the first solution is useful (note 3) + 2 = both solutions are useful (note 3) + + Notes: + + 1 The vector V must be of unit length or the result will be wrong. + + 2 Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero XI value, and hence it is meaningless + to ask where the tangent point would have to be. + + 3 Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. N=1 indicates only one useful + solution, the usual case; under these circumstances, the second + solution can be regarded as valid if the vector V02 is interpreted + as the "over-the-pole" case. + + 4 This routine is the Cartesian equivalent of the routine slTPSC. + + P.T.Wallace Starlink 5 June 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ue2el.hlp b/math/slalib/doc/ue2el.hlp new file mode 100644 index 00000000..6eb0996a --- /dev/null +++ b/math/slalib/doc/ue2el.hlp @@ -0,0 +1,167 @@ +.help ue2el Jun99 "Slalib Package" +.nf + + SUBROUTINE slUEEL (U, JFORMR, + : JFORM, EPOCH, ORBINC, ANODE, PERIH, + : AORQ, E, AORL, DM, JSTAT) + + - - - - - - + U E E L + - - - - - - + + Transform universal elements into conventional heliocentric + osculating elements. + + Given: + U d(13) universal orbital elements (Note 1) + + (1) combined mass (M+m) + (2) total energy of the orbit (alpha) + (3) reference (osculating) epoch (t0) + (4-6) position at reference epoch (r0) + (7-9) velocity at reference epoch (v0) + (10) heliocentric distance at reference epoch + (11) r0.v0 + (12) date (t) + (13) universal eccentric anomaly (psi) of date, approx + + JFORMR i requested element set (1-3; Note 3) + + Returned: + JFORM d element set actually returned (1-3; Note 4) + EPOCH d epoch of elements (TT MJD) + ORBINC d inclination (radians) + ANODE d longitude of the ascending node (radians) + PERIH d longitude or argument of perihelion (radians) + AORQ d mean distance or perihelion distance (AU) + E d eccentricity + AORL d mean anomaly or longitude (radians, JFORM=1,2 only) + DM d daily motion (radians, JFORM=1 only) + JSTAT i status: 0 = OK + -1 = illegal combined mass + -2 = illegal JFORMR + -3 = position/velocity out of range + + Notes + + 1 The "universal" elements are those which define the orbit for the + purposes of the method of universal variables (see reference 2). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i) alpha, which is proportional to the total energy of the + orbit, (ii) the heliocentric distance at epoch, (iii) the + outwards component of the velocity at the given epoch, (iv) an + estimate of psi, the "universal eccentric anomaly" at a given + date and (v) that date. + + 2 The universal elements are with respect to the mean equator and + equinox of epoch J2000. The orbital elements produced are with + respect to the J2000 ecliptic and mean equinox. + + 3 Three different element-format options are supported: + + Option JFORM=1, suitable for the major planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = longitude of perihelion, curly pi (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e + AORL = mean longitude L (radians) + DM = daily motion (radians) + + Option JFORM=2, suitable for minor planets: + + EPOCH = epoch of elements (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = mean distance, a (AU) + E = eccentricity, e + AORL = mean anomaly M (radians) + + Option JFORM=3, suitable for comets: + + EPOCH = epoch of perihelion (TT MJD) + ORBINC = inclination i (radians) + ANODE = longitude of the ascending node, big omega (radians) + PERIH = argument of perihelion, little omega (radians) + AORQ = perihelion distance, q (AU) + E = eccentricity, e + + 4 It may not be possible to generate elements in the form + requested through JFORMR. The caller is notified of the form + of elements actually returned by means of the JFORM argument: + + JFORMR JFORM meaning + + 1 1 OK - elements are in the requested format + 1 2 never happens + 1 3 orbit not elliptical + + 2 1 never happens + 2 2 OK - elements are in the requested format + 2 3 orbit not elliptical + + 3 1 never happens + 3 2 never happens + 3 3 OK - elements are in the requested format + + 5 The arguments returned for each value of JFORM (cf Note 6: JFORM + may not be the same as JFORMR) are as follows: + + JFORM 1 2 3 + EPOCH t0 t0 T + ORBINC i i i + ANODE Omega Omega Omega + PERIH curly pi omega omega + AORQ a a q + E e e e + AORL L M - + DM n - - + + where: + + t0 is the epoch of the elements (MJD, TT) + T " epoch of perihelion (MJD, TT) + i " inclination (radians) + Omega " longitude of the ascending node (radians) + curly pi " longitude of perihelion (radians) + omega " argument of perihelion (radians) + a " mean distance (AU) + q " perihelion distance (AU) + e " eccentricity + L " longitude (radians, 0-2pi) + M " mean anomaly (radians, 0-2pi) + n " daily motion (radians) + - means no value is set + + 6 At very small inclinations, the longitude of the ascending node + ANODE becomes indeterminate and under some circumstances may be + set arbitrarily to zero. Similarly, if the orbit is close to + circular, the true anomaly becomes indeterminate and under some + circumstances may be set arbitrarily to zero. In such cases, + the other elements are automatically adjusted to compensate, + and so the elements remain a valid description of the orbit. + + References: + + 1 Sterne, Theodore E., "An Introduction to Celestial Mechanics", + Interscience Publishers Inc., 1960. Section 6.7, p199. + + 2 Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. + + Called: slPVEL + + P.T.Wallace Starlink 18 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/ue2pv.hlp b/math/slalib/doc/ue2pv.hlp new file mode 100644 index 00000000..ed5c9609 --- /dev/null +++ b/math/slalib/doc/ue2pv.hlp @@ -0,0 +1,87 @@ +.help ue2pv Jun99 "Slalib Package" +.nf + + SUBROUTINE slUEPV (DATE, U, PV, JSTAT) + + - - - - - - + U E P V + - - - - - - + + Heliocentric position and velocity of a planet, asteroid or comet, + starting from orbital elements in the "universal variables" form. + + Given: + DATE d date, Modified Julian Date (JD-2400000.5) + + Given and returned: + U d(13) universal orbital elements (updated; Note 1) + + given (1) combined mass (M+m) + " (2) total energy of the orbit (alpha) + " (3) reference (osculating) epoch (t0) + " (4-6) position at reference epoch (r0) + " (7-9) velocity at reference epoch (v0) + " (10) heliocentric distance at reference epoch + " (11) r0.v0 + returned (12) date (t) + " (13) universal eccentric anomaly (psi) of date + + Returned: + PV d(6) position (AU) and velocity (AU/s) + JSTAT i status: 0 = OK + -1 = radius vector zero + -2 = failed to converge + + Notes + + 1 The "universal" elements are those which define the orbit for the + purposes of the method of universal variables (see reference). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i) alpha, which is proportional to the total energy of the + orbit, (ii) the heliocentric distance at epoch, (iii) the + outwards component of the velocity at the given epoch, (iv) an + estimate of psi, the "universal eccentric anomaly" at a given + date and (v) that date. + + 2 The companion routine is slELUE. This takes the conventional + orbital elements and transforms them into the set of numbers + needed by the present routine. A single prediction requires one + one call to slELUE followed by one call to the present routine; + for convenience, the two calls are packaged as the routine + slPLNE. Multiple predictions may be made by again + calling slELUE once, but then calling the present routine + multiple times, which is faster than multiple calls to slPLNE. + + It is not obligatory to use slELUE to obtain the parameters. + However, it should be noted that because slELUE performs its + own validation, no checks on the contents of the array U are made + by the present routine. + + 3 DATE is the instant for which the prediction is required. It is + in the TT timescale (formerly Ephemeris Time, ET) and is a + Modified Julian Date (JD-2400000.5). + + 4 The universal elements supplied in the array U are in canonical + units (solar masses, AU and canonical days). The position and + velocity are not sensitive to the choice of reference frame. The + slELUE routine in fact produces coordinates with respect to the + J2000 equator and equinox. + + 5 The algorithm was originally adapted from the EPHSLA program of + D.H.P.Jones (private communication, 1996). The method is based + on Stumpff's Universal Variables. + + Reference: Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. + + P.T.Wallace Starlink 19 March 1999 + + Copyright (C) 1999 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/unpcd.hlp b/math/slalib/doc/unpcd.hlp new file mode 100644 index 00000000..26654492 --- /dev/null +++ b/math/slalib/doc/unpcd.hlp @@ -0,0 +1,57 @@ +.help unpcd Jun99 "Slalib Package" +.nf + + SUBROUTINE slUPCD (DISCO,X,Y) + + - - - - - - + U P C D + - - - - - - + + Remove pincushion/barrel distortion from a distorted [x,y] + to give tangent-plane [x,y]. + + Given: + DISCO d pincushion/barrel distortion coefficient + X,Y d distorted coordinates + + Returned: + X,Y d tangent-plane coordinates + + Notes: + + 1) The distortion is of the form RP = R*(1 + C*R**2), where R is + the radial distance from the tangent point, C is the DISCO + argument, and RP is the radial distance in the presence of + the distortion. + + 2) For pincushion distortion, C is +ve; for barrel distortion, + C is -ve. + + 3) For X,Y in "radians" - units of one projection radius, + which in the case of a photograph is the focal length of + the camera - the following DISCO values apply: + + Geometry DISCO + + astrograph 0.0 + Schmidt -0.3333 + AAT PF doublet +147.069 + AAT PF triplet +178.585 + AAT f/8 +21.20 + JKT f/8 +13.32 + + 4) The present routine is an approximate inverse to the + companion routine slPCD, obtained from two iterations + of Newton's method. The mismatch between the slPCD and + slUPCD routines is negligible for astrometric applications; + to reach 1 milliarcsec at the edge of the AAT triplet or + Schmidt field would require field diameters of 2.4 degrees + and 42 degrees respectively. + + P.T.Wallace Starlink 1 August 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/v2tp.hlp b/math/slalib/doc/v2tp.hlp new file mode 100644 index 00000000..6522e398 --- /dev/null +++ b/math/slalib/doc/v2tp.hlp @@ -0,0 +1,42 @@ +.help v2tp Jun99 "Slalib Package" +.nf + + SUBROUTINE slV2TP (V, V0, XI, ETA, J) + + - - - - - + V 2 T P + - - - - - + + Given the direction cosines of a star and of the tangent point, + determine the star's tangent-plane coordinates. + + (single precision) + + Given: + V r(3) direction cosines of star + V0 r(3) direction cosines of tangent point + + Returned: + XI,ETA r tangent plane coordinates of star + J i status: 0 = OK + 1 = error, star too far from axis + 2 = error, antistar on tangent plane + 3 = error, antistar too far from axis + + Notes: + + 1 If vector V0 is not of unit length, or if vector V is of zero + length, the results will be wrong. + + 2 If V0 points at a pole, the returned XI,ETA will be based on the + arbitrary assumption that the RA of the tangent point is zero. + + 3 This routine is the Cartesian equivalent of the routine slS2TP. + + P.T.Wallace Starlink 27 November 1996 + + Copyright (C) 1996 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/vdv.hlp b/math/slalib/doc/vdv.hlp new file mode 100644 index 00000000..526ce406 --- /dev/null +++ b/math/slalib/doc/vdv.hlp @@ -0,0 +1,24 @@ +.help vdv Jun99 "Slalib Package" +.nf + + REAL FUNCTION slVDV (VA, VB) + + - - - - + V D V + - - - - + + Scalar product of two 3-vectors (single precision) + + Given: + VA real(3) first vector + VB real(3) second vector + + The result is the scalar product VA.VB (single precision) + + P.T.Wallace Starlink November 1984 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/vn.hlp b/math/slalib/doc/vn.hlp new file mode 100644 index 00000000..17b7b3ba --- /dev/null +++ b/math/slalib/doc/vn.hlp @@ -0,0 +1,27 @@ +.help vn Jun99 "Slalib Package" +.nf + + SUBROUTINE slVN (V, UV, VM) + + - - - + V N + - - - + + Normalizes a 3-vector also giving the modulus (single precision) + + Given: + V real(3) vector + + Returned: + UV real(3) unit vector in direction of V + VM real modulus of V + + If the modulus of V is zero, UV is set to zero as well + + P.T.Wallace Starlink 23 November 1995 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/vxv.hlp b/math/slalib/doc/vxv.hlp new file mode 100644 index 00000000..64272c33 --- /dev/null +++ b/math/slalib/doc/vxv.hlp @@ -0,0 +1,25 @@ +.help vxv Jun99 "Slalib Package" +.nf + + SUBROUTINE slVXV (VA, VB, VC) + + - - - - + V X V + - - - - + + Vector product of two 3-vectors (single precision) + + Given: + VA real(3) first vector + VB real(3) second vector + + Returned: + VC real(3) vector result + + P.T.Wallace Starlink March 1986 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/xy2xy.hlp b/math/slalib/doc/xy2xy.hlp new file mode 100644 index 00000000..64ab43e2 --- /dev/null +++ b/math/slalib/doc/xy2xy.hlp @@ -0,0 +1,45 @@ +.help xy2xy Jun99 "Slalib Package" +.nf + + SUBROUTINE slXYXY (X1,Y1,COEFFS,X2,Y2) + + - - - - - - + X Y X Y + - - - - - - + + Transform one [X,Y] into another using a linear model of the type + produced by the slFTXY routine. + + Given: + X1 d x-coordinate + Y1 d y-coordinate + COEFFS d(6) transformation coefficients (see note) + + Returned: + X2 d x-coordinate + Y2 d y-coordinate + + The model relates two sets of [X,Y] coordinates as follows. + Naming the elements of COEFFS: + + COEFFS(1) = A + COEFFS(2) = B + COEFFS(3) = C + COEFFS(4) = D + COEFFS(5) = E + COEFFS(6) = F + + the present routine performs the transformation: + + X2 = A + B*X1 + C*Y1 + Y2 = D + E*X1 + F*Y1 + + See also slFTXY, slPXY, slINVF, slDCMF + + P.T.Wallace Starlink 5 December 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/doc/zd.hlp b/math/slalib/doc/zd.hlp new file mode 100644 index 00000000..109b4d10 --- /dev/null +++ b/math/slalib/doc/zd.hlp @@ -0,0 +1,48 @@ +.help zd Jun99 "Slalib Package" +.nf + + DOUBLE PRECISION FUNCTION slZD (HA, DEC, PHI) + + - - - + Z D + - - - + + HA, Dec to Zenith Distance (double precision) + + Given: + HA d Hour Angle in radians + DEC d declination in radians + PHI d observatory latitude in radians + + The result is in the range 0 to pi. + + Notes: + + 1) The latitude must be geodetic. In critical applications, + corrections for polar motion should be applied. + + 2) In some applications it will be important to specify the + correct type of hour angle and declination in order to + produce the required type of zenith distance. In particular, + it may be important to distinguish between the zenith distance + as affected by refraction, which would require the "observed" + HA,Dec, and the zenith distance in vacuo, which would require + the "topocentric" HA,Dec. If the effects of diurnal aberration + can be neglected, the "apparent" HA,Dec may be used instead of + the topocentric HA,Dec. + + 3) No range checking of arguments is done. + + 4) In applications which involve many zenith distance calculations, + rather than calling the present routine it will be more efficient + to use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and perhaps sine and cosine of + declination. + + P.T.Wallace Starlink 3 April 1994 + + Copyright (C) 1995 Rutherford Appleton Laboratory + Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. + +.fi +.endhelp diff --git a/math/slalib/dpav.f b/math/slalib/dpav.f new file mode 100644 index 00000000..20de2742 --- /dev/null +++ b/math/slalib/dpav.f @@ -0,0 +1,82 @@ + DOUBLE PRECISION FUNCTION slDPAV ( V1, V2 ) +*+ +* - - - - - +* D P A V +* - - - - - +* +* Position angle of one celestial direction with respect to another. +* +* (double precision) +* +* Given: +* V1 d(3) direction cosines of one point +* V2 d(3) direction cosines of the other point +* +* (The coordinate frames correspond to RA,Dec, Long,Lat etc.) +* +* The result is the bearing (position angle), in radians, of point +* V2 with respect to point V1. It is in the range +/- pi. The +* sense is such that if V2 is a small distance east of V1, the +* bearing is about +pi/2. Zero is returned if the two points +* are coincident. +* +* V1 and V2 need not be unit vectors. +* +* The routine slDBER performs an equivalent function except +* that the points are specified in the form of spherical +* coordinates. +* +* Last revision: 16 March 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION V1(3),V2(3) + + DOUBLE PRECISION X1,Y1,Z1,W,X2,Y2,Z2,SQ,CQ + + + +* The unit vector to point 1. + X1 = V1(1) + Y1 = V1(2) + Z1 = V1(3) + W = SQRT(X1*X1+Y1*Y1+Z1*Z1) + IF (W.NE.0D0) THEN + X1 = X1/W + Y1 = Y1/W + Z1 = Z1/W + END IF + +* The vector to point 2. + X2 = V2(1) + Y2 = V2(2) + Z2 = V2(3) + +* Position angle. + SQ = Y2*X1-X2*Y1 + CQ = Z2*(X1*X1+Y1*Y1)-Z1*(X2*X1+Y2*Y1) + IF (SQ.EQ.0D0.AND.CQ.EQ.0D0) CQ=1D0 + slDPAV = ATAN2(SQ,CQ) + + END diff --git a/math/slalib/dr2af.f b/math/slalib/dr2af.f new file mode 100644 index 00000000..155f1f6b --- /dev/null +++ b/math/slalib/dr2af.f @@ -0,0 +1,76 @@ + SUBROUTINE slDRAF (NDP, ANGLE, SIGN, IDMSF) +*+ +* - - - - - - +* D R A F +* - - - - - - +* +* Convert an angle in radians to degrees, arcminutes, arcseconds +* (double precision) +* +* Given: +* NDP i number of decimal places of arcseconds +* ANGLE d angle in radians +* +* Returned: +* SIGN c '+' or '-' +* IDMSF i(4) degrees, arcminutes, arcseconds, fraction +* +* Notes: +* +* 1) NDP less than zero is interpreted as zero. +* +* 2) The largest useful value for NDP is determined by the size +* of ANGLE, the format of DOUBLE PRECISION floating-point +* numbers on the target machine, and the risk of overflowing +* IDMSF(4). On some architectures, for ANGLE up to 2pi, the +* available floating-point precision corresponds roughly to +* NDP=12. However, the practical limit is NDP=9, set by the +* capacity of a typical 32-bit IDMSF(4). +* +* 3) The absolute value of ANGLE may exceed 2pi. In cases where it +* does not, it is up to the caller to test for and handle the +* case where ANGLE is very nearly 2pi and rounds up to 360 deg, +* by testing for IDMSF(1)=360 and setting IDMSF(1-4) to zero. +* +* Called: slDDTF +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER NDP + DOUBLE PRECISION ANGLE + CHARACTER SIGN*(*) + INTEGER IDMSF(4) + +* Hours to degrees * radians to turns + DOUBLE PRECISION F + PARAMETER (F=15D0/6.283185307179586476925287D0) + + + +* Scale then use days to h,m,s routine + CALL slDDTF(NDP,ANGLE*F,SIGN,IDMSF) + + END diff --git a/math/slalib/dr2tf.f b/math/slalib/dr2tf.f new file mode 100644 index 00000000..3f5edfbb --- /dev/null +++ b/math/slalib/dr2tf.f @@ -0,0 +1,76 @@ + SUBROUTINE slDRTF (NDP, ANGLE, SIGN, IHMSF) +*+ +* - - - - - - +* D R T F +* - - - - - - +* +* Convert an angle in radians to hours, minutes, seconds +* (double precision) +* +* Given: +* NDP i number of decimal places of seconds +* ANGLE d angle in radians +* +* Returned: +* SIGN c '+' or '-' +* IHMSF i(4) hours, minutes, seconds, fraction +* +* Notes: +* +* 1) NDP less than zero is interpreted as zero. +* +* 2) The largest useful value for NDP is determined by the size +* of ANGLE, the format of DOUBLE PRECISION floating-point +* numbers on the target machine, and the risk of overflowing +* IHMSF(4). On some architectures, for ANGLE up to 2pi, the +* available floating-point precision corresponds roughly to +* NDP=12. However, the practical limit is NDP=9, set by the +* capacity of a typical 32-bit IHMSF(4). +* +* 3) The absolute value of ANGLE may exceed 2pi. In cases where it +* does not, it is up to the caller to test for and handle the +* case where ANGLE is very nearly 2pi and rounds up to 24 hours, +* by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +* +* Called: slDDTF +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER NDP + DOUBLE PRECISION ANGLE + CHARACTER SIGN*(*) + INTEGER IHMSF(4) + +* Turns to radians + DOUBLE PRECISION T2R + PARAMETER (T2R=6.283185307179586476925287D0) + + + +* Scale then use days to h,m,s routine + CALL slDDTF(NDP,ANGLE/T2R,SIGN,IHMSF) + + END diff --git a/math/slalib/drange.f b/math/slalib/drange.f new file mode 100644 index 00000000..9f82c57e --- /dev/null +++ b/math/slalib/drange.f @@ -0,0 +1,50 @@ + DOUBLE PRECISION FUNCTION slDA1P (ANGLE) +*+ +* - - - - - - - +* D A 1 P +* - - - - - - - +* +* Normalize angle into range +/- pi (double precision) +* +* Given: +* ANGLE dp the angle in radians +* +* The result (double precision) is ANGLE expressed in the range +/- pi. +* +* P.T.Wallace Starlink 23 November 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION ANGLE + + DOUBLE PRECISION DPI,D2PI + PARAMETER (DPI=3.141592653589793238462643D0) + PARAMETER (D2PI=6.283185307179586476925287D0) + + + slDA1P=MOD(ANGLE,D2PI) + IF (ABS(slDA1P).GE.DPI) + : slDA1P=slDA1P-SIGN(D2PI,ANGLE) + + END diff --git a/math/slalib/dranrm.f b/math/slalib/dranrm.f new file mode 100644 index 00000000..9325840c --- /dev/null +++ b/math/slalib/dranrm.f @@ -0,0 +1,48 @@ + DOUBLE PRECISION FUNCTION slDA2P (ANGLE) +*+ +* - - - - - - - +* D A 2 P +* - - - - - - - +* +* Normalize angle into range 0-2 pi (double precision) +* +* Given: +* ANGLE dp the angle in radians +* +* The result is ANGLE expressed in the range 0-2 pi. +* +* Last revision: 22 July 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION ANGLE + + DOUBLE PRECISION D2PI + PARAMETER (D2PI=6.283185307179586476925286766559D0) + + + slDA2P = MOD(ANGLE,D2PI) + IF (slDA2P.LT.0D0) slDA2P = slDA2P+D2PI + + END diff --git a/math/slalib/ds2c6.f b/math/slalib/ds2c6.f new file mode 100644 index 00000000..7c7de506 --- /dev/null +++ b/math/slalib/ds2c6.f @@ -0,0 +1,75 @@ + SUBROUTINE slDSC6 (A, B, R, AD, BD, RD, V) +*+ +* - - - - - - +* D S C 6 +* - - - - - - +* +* Conversion of position & velocity in spherical coordinates +* to Cartesian coordinates +* +* (double precision) +* +* Given: +* A dp longitude (radians) +* B dp latitude (radians) +* R dp radial coordinate +* AD dp longitude derivative (radians per unit time) +* BD dp latitude derivative (radians per unit time) +* RD dp radial derivative +* +* Returned: +* V dp(6) Cartesian position & velocity vector +* +* P.T.Wallace Starlink 10 July 1993 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION A,B,R,AD,BD,RD,V(6) + + DOUBLE PRECISION SA,CA,SB,CB,RCB,X,Y,RBD,W + + + +* Useful functions + SA=SIN(A) + CA=COS(A) + SB=SIN(B) + CB=COS(B) + RCB=R*CB + X=RCB*CA + Y=RCB*SA + RBD=R*BD + W=RBD*SB-CB*RD + +* Position + V(1)=X + V(2)=Y + V(3)=R*SB + +* Velocity + V(4)=-Y*AD-W*CA + V(5)=X*AD-W*SA + V(6)=RBD*CB+SB*RD + + END diff --git a/math/slalib/ds2tp.f b/math/slalib/ds2tp.f new file mode 100644 index 00000000..ee8104d7 --- /dev/null +++ b/math/slalib/ds2tp.f @@ -0,0 +1,85 @@ + SUBROUTINE slDSTP (RA, DEC, RAZ, DECZ, XI, ETA, J) +*+ +* - - - - - - +* D S T P +* - - - - - - +* +* Projection of spherical coordinates onto tangent plane: +* "gnomonic" projection - "standard coordinates" (double precision) +* +* Given: +* RA,DEC dp spherical coordinates of point to be projected +* RAZ,DECZ dp spherical coordinates of tangent point +* +* Returned: +* XI,ETA dp rectangular coordinates on tangent plane +* J int status: 0 = OK, star on tangent plane +* 1 = error, star too far from axis +* 2 = error, antistar on tangent plane +* 3 = error, antistar too far from axis +* +* P.T.Wallace Starlink 18 July 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RA,DEC,RAZ,DECZ,XI,ETA + INTEGER J + + DOUBLE PRECISION SDECZ,SDEC,CDECZ,CDEC, + : RADIF,SRADIF,CRADIF,DENOM + + DOUBLE PRECISION TINY + PARAMETER (TINY=1D-6) + + +* Trig functions + SDECZ=SIN(DECZ) + SDEC=SIN(DEC) + CDECZ=COS(DECZ) + CDEC=COS(DEC) + RADIF=RA-RAZ + SRADIF=SIN(RADIF) + CRADIF=COS(RADIF) + +* Reciprocal of star vector length to tangent plane + DENOM=SDEC*SDECZ+CDEC*CDECZ*CRADIF + +* Handle vectors too far from axis + IF (DENOM.GT.TINY) THEN + J=0 + ELSE IF (DENOM.GE.0D0) THEN + J=1 + DENOM=TINY + ELSE IF (DENOM.GT.-TINY) THEN + J=2 + DENOM=-TINY + ELSE + J=3 + END IF + +* Compute tangent plane coordinates (even in dubious cases) + XI=CDEC*SRADIF/DENOM + ETA=(SDEC*CDECZ-CDEC*SDECZ*CRADIF)/DENOM + + END diff --git a/math/slalib/dsep.f b/math/slalib/dsep.f new file mode 100644 index 00000000..6e7e9fff --- /dev/null +++ b/math/slalib/dsep.f @@ -0,0 +1,61 @@ + DOUBLE PRECISION FUNCTION slDSEP (A1, B1, A2, B2) +*+ +* - - - - - +* D S E P +* - - - - - +* +* Angle between two points on a sphere. +* +* (double precision) +* +* Given: +* A1,B1 d spherical coordinates of one point +* A2,B2 d spherical coordinates of the other point +* +* (The spherical coordinates are [RA,Dec], [Long,Lat] etc, in radians.) +* +* The result is the angle, in radians, between the two points. It +* is always positive. +* +* Called: slDS2C, slDSEPV +* +* Last revision: 7 May 2000 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION A1,B1,A2,B2 + + DOUBLE PRECISION V1(3),V2(3) + DOUBLE PRECISION slDSEPV + + + +* Convert coordinates from spherical to Cartesian. + CALL slDS2C(A1,B1,V1) + CALL slDS2C(A2,B2,V2) + +* Angle between the vectors. + slDSEP = slDSEPV(V1,V2) + + END diff --git a/math/slalib/dsepv.f b/math/slalib/dsepv.f new file mode 100644 index 00000000..6ff5d9d8 --- /dev/null +++ b/math/slalib/dsepv.f @@ -0,0 +1,77 @@ + DOUBLE PRECISION FUNCTION slDSEPV (V1, V2) +*+ +* - - - - - - +* D S E P V +* - - - - - - +* +* Angle between two vectors. +* +* (double precision) +* +* Given: +* V1 d(3) first vector +* V2 d(3) second vector +* +* The result is the angle, in radians, between the two vectors. It +* is always positive. +* +* Notes: +* +* 1 There is no requirement for the vectors to be unit length. +* +* 2 If either vector is null, zero is returned. +* +* 3 The simplest formulation would use dot product alone. However, +* this would reduce the accuracy for angles near zero and pi. The +* algorithm uses both cross product and dot product, which maintains +* accuracy for all sizes of angle. +* +* Called: slDVXV, slDVN, slDVDV +* +* Last revision: 14 June 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION V1(3),V2(3) + + DOUBLE PRECISION V1XV2(3),WV(3),S,C + DOUBLE PRECISION slDVDV + + + +* Modulus of cross product = sine multiplied by the two moduli. + CALL slDVXV(V1,V2,V1XV2) + CALL slDVN(V1XV2,WV,S) + +* Dot product = cosine multiplied by the two moduli. + C = slDVDV(V1,V2) + +* Angle between the vectors. + IF ( S.NE.0D0 .OR. C.NE.0D0 ) THEN + slDSEPV = ATAN2(S,C) + ELSE + slDSEPV = 0D0 + END IF + + END diff --git a/math/slalib/dt.f b/math/slalib/dt.f new file mode 100644 index 00000000..a012c677 --- /dev/null +++ b/math/slalib/dt.f @@ -0,0 +1,97 @@ + DOUBLE PRECISION FUNCTION slDT (EPOCH) +*+ +* - - - +* D T +* - - - +* +* Estimate the offset between dynamical time and Universal Time +* for a given historical epoch. +* +* Given: +* EPOCH d (Julian) epoch (e.g. 1850D0) +* +* The result is a rough estimate of ET-UT (after 1984, TT-UT) at +* the given epoch, in seconds. +* +* Notes: +* +* 1 Depending on the epoch, one of three parabolic approximations +* is used: +* +* before 979 Stephenson & Morrison's 390 BC to AD 948 model +* 979 to 1708 Stephenson & Morrison's 948 to 1600 model +* after 1708 McCarthy & Babcock's post-1650 model +* +* The breakpoints are chosen to ensure continuity: they occur +* at places where the adjacent models give the same answer as +* each other. +* +* 2 The accuracy is modest, with errors of up to 20 sec during +* the interval since 1650, rising to perhaps 30 min by 1000 BC. +* Comparatively accurate values from AD 1600 are tabulated in +* the Astronomical Almanac (see section K8 of the 1995 AA). +* +* 3 The use of double-precision for both argument and result is +* purely for compatibility with other SLALIB time routines. +* +* 4 The models used are based on a lunar tidal acceleration value +* of -26.00 arcsec per century. +* +* Reference: Explanatory Supplement to the Astronomical Almanac, +* ed P.K.Seidelmann, University Science Books (1992), +* section 2.553, p83. This contains references to +* the Stephenson & Morrison and McCarthy & Babcock +* papers. +* +* P.T.Wallace Starlink 1 March 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION EPOCH + DOUBLE PRECISION T,W,S + + +* Centuries since 1800 + T=(EPOCH-1800D0)/100D0 + +* Select model + IF (EPOCH.GE.1708.185161980887D0) THEN + +* Post-1708: use McCarthy & Babcock + W=T-0.19D0 + S=5.156D0+13.3066D0*W*W + ELSE IF (EPOCH.GE.979.0258204760233D0) THEN + +* 979-1708: use Stephenson & Morrison's 948-1600 model + S=25.5D0*T*T + ELSE + +* Pre-979: use Stephenson & Morrison's 390 BC to AD 948 model + S=1360.0D0+(320D0+44.3D0*T)*T + END IF + +* Result + slDT=S + + END diff --git a/math/slalib/dtf2d.f b/math/slalib/dtf2d.f new file mode 100644 index 00000000..757ed11e --- /dev/null +++ b/math/slalib/dtf2d.f @@ -0,0 +1,73 @@ + SUBROUTINE slDTFD (IHOUR, IMIN, SEC, DAYS, J) +*+ +* - - - - - - +* D T F D +* - - - - - - +* +* Convert hours, minutes, seconds to days (double precision) +* +* Given: +* IHOUR int hours +* IMIN int minutes +* SEC dp seconds +* +* Returned: +* DAYS dp interval in days +* J int status: 0 = OK +* 1 = IHOUR outside range 0-23 +* 2 = IMIN outside range 0-59 +* 3 = SEC outside range 0-59.999... +* +* Notes: +* +* 1) The result is computed even if any of the range checks fail. +* +* 2) The sign must be dealt with outside this routine. +* +* P.T.Wallace Starlink July 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IHOUR,IMIN + DOUBLE PRECISION SEC,DAYS + INTEGER J + +* Seconds per day + DOUBLE PRECISION D2S + PARAMETER (D2S=86400D0) + + + +* Preset status + J=0 + +* Validate sec, min, hour + IF (SEC.LT.0D0.OR.SEC.GE.60D0) J=3 + IF (IMIN.LT.0.OR.IMIN.GT.59) J=2 + IF (IHOUR.LT.0.OR.IHOUR.GT.23) J=1 + +* Compute interval + DAYS=(60D0*(60D0*DBLE(IHOUR)+DBLE(IMIN))+SEC)/D2S + + END diff --git a/math/slalib/dtf2r.f b/math/slalib/dtf2r.f new file mode 100644 index 00000000..f260e3e1 --- /dev/null +++ b/math/slalib/dtf2r.f @@ -0,0 +1,71 @@ + SUBROUTINE slDTFR (IHOUR, IMIN, SEC, RAD, J) +*+ +* - - - - - - +* D T F R +* - - - - - - +* +* Convert hours, minutes, seconds to radians (double precision) +* +* Given: +* IHOUR int hours +* IMIN int minutes +* SEC dp seconds +* +* Returned: +* RAD dp angle in radians +* J int status: 0 = OK +* 1 = IHOUR outside range 0-23 +* 2 = IMIN outside range 0-59 +* 3 = SEC outside range 0-59.999... +* +* Called: +* slDTFD +* +* Notes: +* +* 1) The result is computed even if any of the range checks fail. +* +* 2) The sign must be dealt with outside this routine. +* +* P.T.Wallace Starlink July 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IHOUR,IMIN + DOUBLE PRECISION SEC,RAD + INTEGER J + + DOUBLE PRECISION TURNS + +* Turns to radians + DOUBLE PRECISION T2R + PARAMETER (T2R=6.283185307179586476925287D0) + + + +* Convert to turns then radians + CALL slDTFD(IHOUR,IMIN,SEC,TURNS,J) + RAD=T2R*TURNS + + END diff --git a/math/slalib/dtp2s.f b/math/slalib/dtp2s.f new file mode 100644 index 00000000..436057ea --- /dev/null +++ b/math/slalib/dtp2s.f @@ -0,0 +1,60 @@ + SUBROUTINE slDTPS (XI, ETA, RAZ, DECZ, RA, DEC) +*+ +* - - - - - - +* D T P S +* - - - - - - +* +* Transform tangent plane coordinates into spherical +* (double precision) +* +* Given: +* XI,ETA dp tangent plane rectangular coordinates +* RAZ,DECZ dp spherical coordinates of tangent point +* +* Returned: +* RA,DEC dp spherical coordinates (0-2pi,+/-pi/2) +* +* Called: slDA2P +* +* P.T.Wallace Starlink 24 July 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION XI,ETA,RAZ,DECZ,RA,DEC + + DOUBLE PRECISION slDA2P + + DOUBLE PRECISION SDECZ,CDECZ,DENOM + + + + SDECZ=SIN(DECZ) + CDECZ=COS(DECZ) + + DENOM=CDECZ-ETA*SDECZ + + RA=slDA2P(ATAN2(XI,DENOM)+RAZ) + DEC=ATAN2(SDECZ+ETA*CDECZ,SQRT(XI*XI+DENOM*DENOM)) + + END diff --git a/math/slalib/dtp2v.f b/math/slalib/dtp2v.f new file mode 100644 index 00000000..077df7a8 --- /dev/null +++ b/math/slalib/dtp2v.f @@ -0,0 +1,74 @@ + SUBROUTINE slDTPV (XI, ETA, V0, V) +*+ +* - - - - - - +* D T P V +* - - - - - - +* +* Given the tangent-plane coordinates of a star and the direction +* cosines of the tangent point, determine the direction cosines +* of the star. +* +* (double precision) +* +* Given: +* XI,ETA d tangent plane coordinates of star +* V0 d(3) direction cosines of tangent point +* +* Returned: +* V d(3) direction cosines of star +* +* Notes: +* +* 1 If vector V0 is not of unit length, the returned vector V will +* be wrong. +* +* 2 If vector V0 points at a pole, the returned vector V will be +* based on the arbitrary assumption that the RA of the tangent +* point is zero. +* +* 3 This routine is the Cartesian equivalent of the routine slDTPS. +* +* P.T.Wallace Starlink 11 February 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION XI,ETA,V0(3),V(3) + + DOUBLE PRECISION X,Y,Z,F,R + + + X=V0(1) + Y=V0(2) + Z=V0(3) + F=SQRT(1D0+XI*XI+ETA*ETA) + R=SQRT(X*X+Y*Y) + IF (R.EQ.0D0) THEN + R=1D-20 + X=R + END IF + V(1)=(X-(XI*Y+ETA*X*Z)/R)/F + V(2)=(Y+(XI*X-ETA*Y*Z)/R)/F + V(3)=(Z+ETA*R)/F + + END diff --git a/math/slalib/dtps2c.f b/math/slalib/dtps2c.f new file mode 100644 index 00000000..ce103804 --- /dev/null +++ b/math/slalib/dtps2c.f @@ -0,0 +1,109 @@ + SUBROUTINE slDPSC (XI, ETA, RA, DEC, RAZ1, DECZ1, + : RAZ2, DECZ2, N) +*+ +* - - - - - - - +* D P S C +* - - - - - - - +* +* From the tangent plane coordinates of a star of known RA,Dec, +* determine the RA,Dec of the tangent point. +* +* (double precision) +* +* Given: +* XI,ETA d tangent plane rectangular coordinates +* RA,DEC d spherical coordinates +* +* Returned: +* RAZ1,DECZ1 d spherical coordinates of tangent point, solution 1 +* RAZ2,DECZ2 d spherical coordinates of tangent point, solution 2 +* N i number of solutions: +* 0 = no solutions returned (note 2) +* 1 = only the first solution is useful (note 3) +* 2 = both solutions are useful (note 3) +* +* Notes: +* +* 1 The RAZ1 and RAZ2 values are returned in the range 0-2pi. +* +* 2 Cases where there is no solution can only arise near the poles. +* For example, it is clearly impossible for a star at the pole +* itself to have a non-zero XI value, and hence it is +* meaningless to ask where the tangent point would have to be +* to bring about this combination of XI and DEC. +* +* 3 Also near the poles, cases can arise where there are two useful +* solutions. The argument N indicates whether the second of the +* two solutions returned is useful. N=1 indicates only one useful +* solution, the usual case; under these circumstances, the second +* solution corresponds to the "over-the-pole" case, and this is +* reflected in the values of RAZ2 and DECZ2 which are returned. +* +* 4 The DECZ1 and DECZ2 values are returned in the range +/-pi, but +* in the usual, non-pole-crossing, case, the range is +/-pi/2. +* +* 5 This routine is the spherical equivalent of the routine slDPVC. +* +* Called: slDA2P +* +* P.T.Wallace Starlink 5 June 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION XI,ETA,RA,DEC,RAZ1,DECZ1,RAZ2,DECZ2 + INTEGER N + + DOUBLE PRECISION X2,Y2,SD,CD,SDF,R2,R,S,C + + DOUBLE PRECISION slDA2P + + + X2=XI*XI + Y2=ETA*ETA + SD=SIN(DEC) + CD=COS(DEC) + SDF=SD*SQRT(1D0+X2+Y2) + R2=CD*CD*(1D0+Y2)-SD*SD*X2 + IF (R2.GE.0D0) THEN + R=SQRT(R2) + S=SDF-ETA*R + C=SDF*ETA+R + IF (XI.EQ.0D0.AND.R.EQ.0D0) R=1D0 + RAZ1=slDA2P(RA-ATAN2(XI,R)) + DECZ1=ATAN2(S,C) + R=-R + S=SDF-ETA*R + C=SDF*ETA+R + RAZ2=slDA2P(RA-ATAN2(XI,R)) + DECZ2=ATAN2(S,C) + IF (ABS(SDF).LT.1D0) THEN + N=1 + ELSE + N=2 + END IF + ELSE + N=0 + END IF + + END diff --git a/math/slalib/dtpv2c.f b/math/slalib/dtpv2c.f new file mode 100644 index 00000000..930ca9ff --- /dev/null +++ b/math/slalib/dtpv2c.f @@ -0,0 +1,101 @@ + SUBROUTINE slDPVC (XI, ETA, V, V01, V02, N) +*+ +* - - - - - - - +* D P V C +* - - - - - - - +* +* Given the tangent-plane coordinates of a star and its direction +* cosines, determine the direction cosines of the tangent-point. +* +* (double precision) +* +* Given: +* XI,ETA d tangent plane coordinates of star +* V d(3) direction cosines of star +* +* Returned: +* V01 d(3) direction cosines of tangent point, solution 1 +* V02 d(3) direction cosines of tangent point, solution 2 +* N i number of solutions: +* 0 = no solutions returned (note 2) +* 1 = only the first solution is useful (note 3) +* 2 = both solutions are useful (note 3) +* +* Notes: +* +* 1 The vector V must be of unit length or the result will be wrong. +* +* 2 Cases where there is no solution can only arise near the poles. +* For example, it is clearly impossible for a star at the pole +* itself to have a non-zero XI value, and hence it is meaningless +* to ask where the tangent point would have to be. +* +* 3 Also near the poles, cases can arise where there are two useful +* solutions. The argument N indicates whether the second of the +* two solutions returned is useful. N=1 indicates only one useful +* solution, the usual case; under these circumstances, the second +* solution can be regarded as valid if the vector V02 is interpreted +* as the "over-the-pole" case. +* +* 4 This routine is the Cartesian equivalent of the routine slDPSC. +* +* P.T.Wallace Starlink 5 June 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION XI,ETA,V(3),V01(3),V02(3) + INTEGER N + + DOUBLE PRECISION X,Y,Z,RXY2,XI2,ETA2P1,SDF,R2,R,C + + + X=V(1) + Y=V(2) + Z=V(3) + RXY2=X*X+Y*Y + XI2=XI*XI + ETA2P1=ETA*ETA+1D0 + SDF=Z*SQRT(XI2+ETA2P1) + R2=RXY2*ETA2P1-Z*Z*XI2 + IF (R2.GT.0D0) THEN + R=SQRT(R2) + C=(SDF*ETA+R)/(ETA2P1*SQRT(RXY2*(R2+XI2))) + V01(1)=C*(X*R+Y*XI) + V01(2)=C*(Y*R-X*XI) + V01(3)=(SDF-ETA*R)/ETA2P1 + R=-R + C=(SDF*ETA+R)/(ETA2P1*SQRT(RXY2*(R2+XI2))) + V02(1)=C*(X*R+Y*XI) + V02(2)=C*(Y*R-X*XI) + V02(3)=(SDF-ETA*R)/ETA2P1 + IF (ABS(SDF).LT.1D0) THEN + N=1 + ELSE + N=2 + END IF + ELSE + N=0 + END IF + + END diff --git a/math/slalib/dtt.f b/math/slalib/dtt.f new file mode 100644 index 00000000..38e10ec8 --- /dev/null +++ b/math/slalib/dtt.f @@ -0,0 +1,64 @@ + DOUBLE PRECISION FUNCTION slDTT (UTC) +*+ +* - - - - +* D T T +* - - - - +* +* Increment to be applied to Coordinated Universal Time UTC to give +* Terrestrial Time TT (formerly Ephemeris Time ET) +* +* (double precision) +* +* Given: +* UTC d UTC date as a modified JD (JD-2400000.5) +* +* Result: TT-UTC in seconds +* +* Notes: +* +* 1 The UTC is specified to be a date rather than a time to indicate +* that care needs to be taken not to specify an instant which lies +* within a leap second. Though in most cases UTC can include the +* fractional part, correct behaviour on the day of a leap second +* can only be guaranteed up to the end of the second 23:59:59. +* +* 2 Pre 1972 January 1 a fixed value of 10 + ET-TAI is returned. +* +* 3 See also the routine slDT, which roughly estimates ET-UT for +* historical epochs. +* +* Called: slDAT +* +* P.T.Wallace Starlink 6 December 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION UTC + + DOUBLE PRECISION slDAT + + + slDTT=32.184D0+slDAT(UTC) + + END diff --git a/math/slalib/dv2tp.f b/math/slalib/dv2tp.f new file mode 100644 index 00000000..5d55f7f6 --- /dev/null +++ b/math/slalib/dv2tp.f @@ -0,0 +1,96 @@ + SUBROUTINE slDVTP (V, V0, XI, ETA, J) +*+ +* - - - - - - +* D V T P +* - - - - - - +* +* Given the direction cosines of a star and of the tangent point, +* determine the star's tangent-plane coordinates. +* +* (double precision) +* +* Given: +* V d(3) direction cosines of star +* V0 d(3) direction cosines of tangent point +* +* Returned: +* XI,ETA d tangent plane coordinates of star +* J i status: 0 = OK +* 1 = error, star too far from axis +* 2 = error, antistar on tangent plane +* 3 = error, antistar too far from axis +* +* Notes: +* +* 1 If vector V0 is not of unit length, or if vector V is of zero +* length, the results will be wrong. +* +* 2 If V0 points at a pole, the returned XI,ETA will be based on the +* arbitrary assumption that the RA of the tangent point is zero. +* +* 3 This routine is the Cartesian equivalent of the routine slDSTP. +* +* P.T.Wallace Starlink 27 November 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION V(3),V0(3),XI,ETA + INTEGER J + + DOUBLE PRECISION X,Y,Z,X0,Y0,Z0,R2,R,W,D + + DOUBLE PRECISION TINY + PARAMETER (TINY=1D-6) + + + X=V(1) + Y=V(2) + Z=V(3) + X0=V0(1) + Y0=V0(2) + Z0=V0(3) + R2=X0*X0+Y0*Y0 + R=SQRT(R2) + IF (R.EQ.0D0) THEN + R=1D-20 + X0=R + END IF + W=X*X0+Y*Y0 + D=W+Z*Z0 + IF (D.GT.TINY) THEN + J=0 + ELSE IF (D.GE.0D0) THEN + J=1 + D=TINY + ELSE IF (D.GT.-TINY) THEN + J=2 + D=-TINY + ELSE + J=3 + END IF + D=D*R + XI=(Y*X0-X*Y0)/D + ETA=(Z*R2-Z0*W)/D + + END diff --git a/math/slalib/dvdv.f b/math/slalib/dvdv.f new file mode 100644 index 00000000..b80d5877 --- /dev/null +++ b/math/slalib/dvdv.f @@ -0,0 +1,45 @@ + DOUBLE PRECISION FUNCTION slDVDV (VA, VB) +*+ +* - - - - - +* D V D V +* - - - - - +* +* Scalar product of two 3-vectors (double precision) +* +* Given: +* VA dp(3) first vector +* VB dp(3) second vector +* +* The result is the scalar product VA.VB (double precision) +* +* P.T.Wallace Starlink November 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION VA(3),VB(3) + + + slDVDV=VA(1)*VB(1)+VA(2)*VB(2)+VA(3)*VB(3) + + END diff --git a/math/slalib/dvn.f b/math/slalib/dvn.f new file mode 100644 index 00000000..68774c77 --- /dev/null +++ b/math/slalib/dvn.f @@ -0,0 +1,70 @@ + SUBROUTINE slDVN (V, UV, VM) +*+ +* - - - - +* D V N +* - - - - +* +* Normalizes a 3-vector also giving the modulus (double precision) +* +* Given: +* V d(3) vector +* +* Returned: +* UV d(3) unit vector in direction of V +* VM d modulus of V +* +* Notes: +* +* 1 If the modulus of V is zero, UV is set to zero as well. +* +* 2 To comply with the ANSI Fortran 77 standard, V and UV must be +* different arrays. However, the routine is coded so as to work +* properly on most platforms even if this rule is violated. +* +* Last revision: 22 July 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION V(3),UV(3),VM + + INTEGER I + DOUBLE PRECISION W1,W2 + + +* Modulus. + W1 = 0D0 + DO I=1,3 + W2 = V(I) + W1 = W1+W2*W2 + END DO + W1 = SQRT(W1) + VM = W1 + +* Normalize the vector. + IF (W1.LE.0D0) W1 = 1D0 + DO I=1,3 + UV(I) = V(I)/W1 + END DO + + END diff --git a/math/slalib/dvxv.f b/math/slalib/dvxv.f new file mode 100644 index 00000000..1c422fb7 --- /dev/null +++ b/math/slalib/dvxv.f @@ -0,0 +1,57 @@ + SUBROUTINE slDVXV (VA, VB, VC) +*+ +* - - - - - +* D V X V +* - - - - - +* +* Vector product of two 3-vectors (double precision) +* +* Given: +* VA dp(3) first vector +* VB dp(3) second vector +* +* Returned: +* VC dp(3) vector result +* +* P.T.Wallace Starlink March 1986 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION VA(3),VB(3),VC(3) + + DOUBLE PRECISION VW(3) + INTEGER I + + +* Form the vector product VA cross VB + VW(1)=VA(2)*VB(3)-VA(3)*VB(2) + VW(2)=VA(3)*VB(1)-VA(1)*VB(3) + VW(3)=VA(1)*VB(2)-VA(2)*VB(1) + +* Return the result + DO I=1,3 + VC(I)=VW(I) + END DO + + END diff --git a/math/slalib/e2h.f b/math/slalib/e2h.f new file mode 100644 index 00000000..3905bbb7 --- /dev/null +++ b/math/slalib/e2h.f @@ -0,0 +1,107 @@ + SUBROUTINE slE2H (HA, DEC, PHI, AZ, EL) +*+ +* - - - - +* E 2 H +* - - - - +* +* Equatorial to horizon coordinates: HA,Dec to Az,El +* +* (single precision) +* +* Given: +* HA r hour angle +* DEC r declination +* PHI r observatory latitude +* +* Returned: +* AZ r azimuth +* EL r elevation +* +* Notes: +* +* 1) All the arguments are angles in radians. +* +* 2) Azimuth is returned in the range 0-2pi; north is zero, +* and east is +pi/2. Elevation is returned in the range +* +/-pi/2. +* +* 3) The latitude must be geodetic. In critical applications, +* corrections for polar motion should be applied. +* +* 4) In some applications it will be important to specify the +* correct type of hour angle and declination in order to +* produce the required type of azimuth and elevation. In +* particular, it may be important to distinguish between +* elevation as affected by refraction, which would +* require the "observed" HA,Dec, and the elevation +* in vacuo, which would require the "topocentric" HA,Dec. +* If the effects of diurnal aberration can be neglected, the +* "apparent" HA,Dec may be used instead of the topocentric +* HA,Dec. +* +* 5) No range checking of arguments is carried out. +* +* 6) In applications which involve many such calculations, rather +* than calling the present routine it will be more efficient to +* use inline code, having previously computed fixed terms such +* as sine and cosine of latitude, and (for tracking a star) +* sine and cosine of declination. +* +* P.T.Wallace Starlink 9 July 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL HA,DEC,PHI,AZ,EL + + REAL R2PI + PARAMETER (R2PI=6.283185307179586476925286766559) + + REAL SH,CH,SD,CD,SP,CP,X,Y,Z,R,A + + +* Useful trig functions + SH=SIN(HA) + CH=COS(HA) + SD=SIN(DEC) + CD=COS(DEC) + SP=SIN(PHI) + CP=COS(PHI) + +* Az,El as x,y,z + X=-CH*CD*SP+SD*CP + Y=-SH*CD + Z=CH*CD*CP+SD*SP + +* To spherical + R=SQRT(X*X+Y*Y) + IF (R.EQ.0.0) THEN + A=0.0 + ELSE + A=ATAN2(Y,X) + END IF + IF (A.LT.0.0) A=A+R2PI + AZ=A + EL=ATAN2(Z,R) + + END diff --git a/math/slalib/earth.f b/math/slalib/earth.f new file mode 100644 index 00000000..5d2204af --- /dev/null +++ b/math/slalib/earth.f @@ -0,0 +1,130 @@ + SUBROUTINE slERTH (IY, ID, FD, PV) +*+ +* - - - - - - +* E R T H +* - - - - - - +* +* Approximate heliocentric position and velocity of the Earth +* +* Given: +* IY I year +* ID I day in year (1 = Jan 1st) +* FD R fraction of day +* +* Returned: +* PV R(6) Earth position & velocity vector +* +* Notes: +* +* 1 The date and time is TDB (loosely ET) in a Julian calendar +* which has been aligned to the ordinary Gregorian +* calendar for the interval 1900 March 1 to 2100 February 28. +* The year and day can be obtained by calling slCAYD or +* slCLYD. +* +* 2 The Earth heliocentric 6-vector is mean equator and equinox +* of date. Position part, PV(1-3), is in AU; velocity part, +* PV(4-6), is in AU/sec. +* +* 3 Max/RMS errors 1950-2050: +* 13/5 E-5 AU = 19200/7600 km in position +* 47/26 E-10 AU/s = 0.0070/0.0039 km/s in speed +* +* 4 More accurate results are obtainable with the routines slEVP +* and slEPV. +* +* Last revision: 5 April 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IY,ID + REAL FD,PV(6) + + INTEGER IY4 + REAL TWOPI,SPEED,REMB,SEMB,YI,YF,T,ELM,GAMMA,EM,ELT,EPS0, + : E,ESQ,V,R,ELMM,COSELT,SINEPS,COSEPS,W1,W2,SELMM,CELMM + + PARAMETER (TWOPI=6.28318530718) + +* Mean orbital speed of Earth, AU/s + PARAMETER (SPEED=1.9913E-7) + +* Mean Earth:EMB distance and speed, AU and AU/s + PARAMETER (REMB=3.12E-5,SEMB=8.31E-11) + + + +* Whole years & fraction of year, and years since J1900.0 + YI=FLOAT(IY-1900) + IY4=MOD(MOD(IY,4)+4,4) + YF=(FLOAT(4*(ID-1/(IY4+1))-IY4-2)+4.0*FD)/1461.0 + T=YI+YF + +* Geometric mean longitude of Sun +* (cf 4.881627938+6.283319509911*T MOD 2PI) + ELM=MOD(4.881628+TWOPI*YF+0.00013420*T,TWOPI) + +* Mean longitude of perihelion + GAMMA=4.908230+3.0005E-4*T + +* Mean anomaly + EM=ELM-GAMMA + +* Mean obliquity + EPS0=0.40931975-2.27E-6*T + +* Eccentricity + E=0.016751-4.2E-7*T + ESQ=E*E + +* True anomaly + V=EM+2.0*E*SIN(EM)+1.25*ESQ*SIN(2.0*EM) + +* True ecliptic longitude + ELT=V+GAMMA + +* True distance + R=(1.0-ESQ)/(1.0+E*COS(V)) + +* Moon's mean longitude + ELMM=MOD(4.72+83.9971*T,TWOPI) + +* Useful functions + COSELT=COS(ELT) + SINEPS=SIN(EPS0) + COSEPS=COS(EPS0) + W1=-R*SIN(ELT) + W2=-SPEED*(COSELT+E*COS(GAMMA)) + SELMM=SIN(ELMM) + CELMM=COS(ELMM) + +* Earth position and velocity + PV(1)=-R*COSELT-REMB*CELMM + PV(2)=(W1-REMB*SELMM)*COSEPS + PV(3)=W1*SINEPS + PV(4)=SPEED*(SIN(ELT)+E*SIN(GAMMA))+SEMB*SELMM + PV(5)=(W2-SEMB*CELMM)*COSEPS + PV(6)=W2*SINEPS + + END diff --git a/math/slalib/ecleq.f b/math/slalib/ecleq.f new file mode 100644 index 00000000..9c7d8ed3 --- /dev/null +++ b/math/slalib/ecleq.f @@ -0,0 +1,73 @@ + SUBROUTINE slECEQ (DL, DB, DATE, DR, DD) +*+ +* - - - - - - +* E C E Q +* - - - - - - +* +* Transformation from ecliptic coordinates to +* J2000.0 equatorial coordinates (double precision) +* +* Given: +* DL,DB dp ecliptic longitude and latitude +* (mean of date, IAU 1980 theory, radians) +* DATE dp TDB (loosely ET) as Modified Julian Date +* (JD-2400000.5) +* Returned: +* DR,DD dp J2000.0 mean RA,Dec (radians) +* +* Called: +* slDS2C, slECMA, slDIMV, slPREC, slEPJ, slDC2S, +* slDA2P, slDA1P +* +* P.T.Wallace Starlink March 1986 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DL,DB,DATE,DR,DD + + DOUBLE PRECISION slEPJ,slDA2P,slDA1P + + DOUBLE PRECISION RMAT(3,3),V1(3),V2(3) + + + +* Spherical to Cartesian + CALL slDS2C(DL,DB,V1) + +* Ecliptic to equatorial + CALL slECMA(DATE,RMAT) + CALL slDIMV(RMAT,V1,V2) + +* Mean of date to J2000 + CALL slPREC(2000D0,slEPJ(DATE),RMAT) + CALL slDIMV(RMAT,V2,V1) + +* Cartesian to spherical + CALL slDC2S(V1,DR,DD) + +* Express in conventional ranges + DR=slDA2P(DR) + DD=slDA1P(DD) + + END diff --git a/math/slalib/ecmat.f b/math/slalib/ecmat.f new file mode 100644 index 00000000..8213dd8f --- /dev/null +++ b/math/slalib/ecmat.f @@ -0,0 +1,70 @@ + SUBROUTINE slECMA (DATE, RMAT) +*+ +* - - - - - - +* E C M A +* - - - - - - +* +* Form the equatorial to ecliptic rotation matrix - IAU 1980 theory +* (double precision) +* +* Given: +* DATE dp TDB (loosely ET) as Modified Julian Date +* (JD-2400000.5) +* Returned: +* RMAT dp(3,3) matrix +* +* Reference: +* Murray,C.A., Vectorial Astrometry, section 4.3. +* +* Note: +* The matrix is in the sense V(ecl) = RMAT * V(equ); the +* equator, equinox and ecliptic are mean of date. +* +* Called: slDEUL +* +* P.T.Wallace Starlink 23 August 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,RMAT(3,3) + +* Arc seconds to radians + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + + DOUBLE PRECISION T,EPS0 + + + +* Interval between basic epoch J2000.0 and current epoch (JC) + T = (DATE-51544.5D0)/36525D0 + +* Mean obliquity + EPS0 = AS2R* + : (84381.448D0+(-46.8150D0+(-0.00059D0+0.001813D0*T)*T)*T) + +* Matrix + CALL slDEUL('X',EPS0,0D0,0D0,RMAT) + + END diff --git a/math/slalib/ecor.f b/math/slalib/ecor.f new file mode 100644 index 00000000..5405bc7d --- /dev/null +++ b/math/slalib/ecor.f @@ -0,0 +1,96 @@ + SUBROUTINE slECOR (RM, DM, IY, ID, FD, RV, TL) +*+ +* - - - - - +* E C O R +* - - - - - +* +* Component of Earth orbit velocity and heliocentric +* light time in a given direction (single precision) +* +* Given: +* RM,DM real mean RA, Dec of date (radians) +* IY int year +* ID int day in year (1 = Jan 1st) +* FD real fraction of day +* +* Returned: +* RV real component of Earth orbital velocity (km/sec) +* TL real component of heliocentric light time (sec) +* +* Notes: +* +* 1 The date and time is TDB (loosely ET) in a Julian calendar +* which has been aligned to the ordinary Gregorian +* calendar for the interval 1900 March 1 to 2100 February 28. +* The year and day can be obtained by calling slCAYD or +* slCLYD. +* +* 2 Sign convention: +* +* The velocity component is +ve when the Earth is receding from +* the given point on the sky. The light time component is +ve +* when the Earth lies between the Sun and the given point on +* the sky. +* +* 3 Accuracy: +* +* The velocity component is usually within 0.004 km/s of the +* correct value and is never in error by more than 0.007 km/s. +* The error in light time correction is about 0.03s at worst, +* but is usually better than 0.01s. For applications requiring +* higher accuracy, see the slEVP and slEPV routines. +* +* Called: slERTH, slCS2C, slVDV +* +* Last revision: 5 April 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL RM,DM + INTEGER IY,ID + REAL FD,RV,TL + + REAL slVDV + + REAL PV(6),V(3),AUKM,AUSEC + +* AU to km and light sec (1985 Almanac) + PARAMETER (AUKM=1.4959787066E8, + : AUSEC=499.0047837) + + + +* Sun:Earth position & velocity vector + CALL slERTH(IY,ID,FD,PV) + +* Star position vector + CALL slCS2C(RM,DM,V) + +* Velocity component + RV=-AUKM*slVDV(PV(4),V) + +* Light time component + TL=AUSEC*slVDV(PV(1),V) + + END diff --git a/math/slalib/eg50.f b/math/slalib/eg50.f new file mode 100644 index 00000000..85b65811 --- /dev/null +++ b/math/slalib/eg50.f @@ -0,0 +1,108 @@ + SUBROUTINE slEG50 (DR, DD, DL, DB) +*+ +* - - - - - +* E G 5 0 +* - - - - - +* +* Transformation from B1950.0 'FK4' equatorial coordinates to +* IAU 1958 galactic coordinates (double precision) +* +* Given: +* DR,DD dp B1950.0 'FK4' RA,Dec +* +* Returned: +* DL,DB dp galactic longitude and latitude L2,B2 +* +* (all arguments are radians) +* +* Called: +* slDS2C, slDMXV, slDC2S, slSUET, slDA2P, slDA1P +* +* Note: +* The equatorial coordinates are B1950.0 'FK4'. Use the +* routine slEQGA if conversion from J2000.0 coordinates +* is required. +* +* Reference: +* Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960) +* +* P.T.Wallace Starlink 5 September 1993 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DR,DD,DL,DB + + DOUBLE PRECISION slDA2P,slDA1P + + DOUBLE PRECISION V1(3),V2(3),R,D + +* +* L2,B2 system of galactic coordinates +* +* P = 192.25 RA of galactic north pole (mean B1950.0) +* Q = 62.6 inclination of galactic to mean B1950.0 equator +* R = 33 longitude of ascending node +* +* P,Q,R are degrees +* +* +* Equatorial to galactic rotation matrix +* +* The Euler angles are P, Q, 90-R, about the z then y then +* z axes. +* +* +CP.CQ.SR-SP.CR +SP.CQ.SR+CP.CR -SQ.SR +* +* -CP.CQ.CR-SP.SR -SP.CQ.CR+CP.SR +SQ.CR +* +* +CP.SQ +SP.SQ +CQ +* + + DOUBLE PRECISION RMAT(3,3) + DATA RMAT(1,1),RMAT(1,2),RMAT(1,3), + : RMAT(2,1),RMAT(2,2),RMAT(2,3), + : RMAT(3,1),RMAT(3,2),RMAT(3,3) / + : -0.066988739415D0,-0.872755765852D0,-0.483538914632D0, + : +0.492728466075D0,-0.450346958020D0,+0.744584633283D0, + : -0.867600811151D0,-0.188374601723D0,+0.460199784784D0 / + + + +* Remove E-terms + CALL slSUET(DR,DD,1950D0,R,D) + +* Spherical to Cartesian + CALL slDS2C(R,D,V1) + +* Rotate to galactic + CALL slDMXV(RMAT,V1,V2) + +* Cartesian to spherical + CALL slDC2S(V2,DL,DB) + +* Express angles in conventional ranges + DL=slDA2P(DL) + DB=slDA1P(DB) + + END diff --git a/math/slalib/el2ue.f b/math/slalib/el2ue.f new file mode 100644 index 00000000..4edb620a --- /dev/null +++ b/math/slalib/el2ue.f @@ -0,0 +1,329 @@ + SUBROUTINE slELUE (DATE, JFORM, EPOCH, ORBINC, ANODE, + : PERIH, AORQ, E, AORL, DM, + : U, JSTAT) +*+ +* - - - - - - +* E L U E +* - - - - - - +* +* Transform conventional osculating orbital elements into "universal" +* form. +* +* Given: +* DATE d epoch (TT MJD) of osculation (Note 3) +* JFORM i choice of element set (1-3, Note 6) +* EPOCH d epoch (TT MJD) of the elements +* ORBINC d inclination (radians) +* ANODE d longitude of the ascending node (radians) +* PERIH d longitude or argument of perihelion (radians) +* AORQ d mean distance or perihelion distance (AU) +* E d eccentricity +* AORL d mean anomaly or longitude (radians, JFORM=1,2 only) +* DM d daily motion (radians, JFORM=1 only) +* +* Returned: +* U d(13) universal orbital elements (Note 1) +* +* (1) combined mass (M+m) +* (2) total energy of the orbit (alpha) +* (3) reference (osculating) epoch (t0) +* (4-6) position at reference epoch (r0) +* (7-9) velocity at reference epoch (v0) +* (10) heliocentric distance at reference epoch +* (11) r0.v0 +* (12) date (t) +* (13) universal eccentric anomaly (psi) of date, approx +* +* JSTAT i status: 0 = OK +* -1 = illegal JFORM +* -2 = illegal E +* -3 = illegal AORQ +* -4 = illegal DM +* -5 = numerical error +* +* Called: slUEPV, slPVUE +* +* Notes +* +* 1 The "universal" elements are those which define the orbit for the +* purposes of the method of universal variables (see reference). +* They consist of the combined mass of the two bodies, an epoch, +* and the position and velocity vectors (arbitrary reference frame) +* at that epoch. The parameter set used here includes also various +* quantities that can, in fact, be derived from the other +* information. This approach is taken to avoiding unnecessary +* computation and loss of accuracy. The supplementary quantities +* are (i) alpha, which is proportional to the total energy of the +* orbit, (ii) the heliocentric distance at epoch, (iii) the +* outwards component of the velocity at the given epoch, (iv) an +* estimate of psi, the "universal eccentric anomaly" at a given +* date and (v) that date. +* +* 2 The companion routine is slUEPV. This takes the set of numbers +* that the present routine outputs and uses them to derive the +* object's position and velocity. A single prediction requires one +* call to the present routine followed by one call to slUEPV; +* for convenience, the two calls are packaged as the routine +* slPLNE. Multiple predictions may be made by again calling the +* present routine once, but then calling slUEPV multiple times, +* which is faster than multiple calls to slPLNE. +* +* 3 DATE is the epoch of osculation. It is in the TT timescale +* (formerly Ephemeris Time, ET) and is a Modified Julian Date +* (JD-2400000.5). +* +* 4 The supplied orbital elements are with respect to the J2000 +* ecliptic and equinox. The position and velocity parameters +* returned in the array U are with respect to the mean equator and +* equinox of epoch J2000, and are for the perihelion prior to the +* specified epoch. +* +* 5 The universal elements returned in the array U are in canonical +* units (solar masses, AU and canonical days). +* +* 6 Three different element-format options are available: +* +* Option JFORM=1, suitable for the major planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = longitude of perihelion, curly pi (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e (range 0 to <1) +* AORL = mean longitude L (radians) +* DM = daily motion (radians) +* +* Option JFORM=2, suitable for minor planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e (range 0 to <1) +* AORL = mean anomaly M (radians) +* +* Option JFORM=3, suitable for comets: +* +* EPOCH = epoch of perihelion (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = perihelion distance, q (AU) +* E = eccentricity, e (range 0 to 10) +* +* 7 Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are +* not accessed. +* +* 8 The algorithm was originally adapted from the EPHSLA program of +* D.H.P.Jones (private communication, 1996). The method is based +* on Stumpff's Universal Variables. +* +* Reference: Everhart & Pitkin, Am.J.Phys. 51, 712 (1983). +* +* Last revision: 8 September 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE + INTEGER JFORM + DOUBLE PRECISION EPOCH,ORBINC,ANODE,PERIH,AORQ,E,AORL,DM,U(13) + INTEGER JSTAT + +* Gaussian gravitational constant (exact) + DOUBLE PRECISION GCON + PARAMETER (GCON=0.01720209895D0) + +* Sin and cos of J2000 mean obliquity (IAU 1976) + DOUBLE PRECISION SE,CE + PARAMETER (SE=0.3977771559319137D0, + : CE=0.9174820620691818D0) + + INTEGER J + + DOUBLE PRECISION PHT,ARGPH,Q,W,CM,ALPHA,PHS,SW,CW,SI,CI,SO,CO, + : X,Y,Z,PX,PY,PZ,VX,VY,VZ,DT,FC,FP,PSI, + : UL(13),PV(6) + + + +* Validate arguments. + IF (JFORM.LT.1.OR.JFORM.GT.3) THEN + JSTAT = -1 + GO TO 9999 + END IF + IF (E.LT.0D0.OR.E.GT.10D0.OR.(E.GE.1D0.AND.JFORM.NE.3)) THEN + JSTAT = -2 + GO TO 9999 + END IF + IF (AORQ.LE.0D0) THEN + JSTAT = -3 + GO TO 9999 + END IF + IF (JFORM.EQ.1.AND.DM.LE.0D0) THEN + JSTAT = -4 + GO TO 9999 + END IF + +* +* Transform elements into standard form: +* +* PHT = epoch of perihelion passage +* ARGPH = argument of perihelion (little omega) +* Q = perihelion distance (q) +* CM = combined mass, M+m (mu) + + IF (JFORM.EQ.1) THEN + +* Major planet. + PHT = EPOCH-(AORL-PERIH)/DM + ARGPH = PERIH-ANODE + Q = AORQ*(1D0-E) + W = DM/GCON + CM = W*W*AORQ*AORQ*AORQ + + ELSE IF (JFORM.EQ.2) THEN + +* Minor planet. + PHT = EPOCH-AORL*SQRT(AORQ*AORQ*AORQ)/GCON + ARGPH = PERIH + Q = AORQ*(1D0-E) + CM = 1D0 + + ELSE + +* Comet. + PHT = EPOCH + ARGPH = PERIH + Q = AORQ + CM = 1D0 + + END IF + +* The universal variable alpha. This is proportional to the total +* energy of the orbit: -ve for an ellipse, zero for a parabola, +* +ve for a hyperbola. + + ALPHA = CM*(E-1D0)/Q + +* Speed at perihelion. + + PHS = SQRT(ALPHA+2D0*CM/Q) + +* In a Cartesian coordinate system which has the x-axis pointing +* to perihelion and the z-axis normal to the orbit (such that the +* object orbits counter-clockwise as seen from +ve z), the +* perihelion position and velocity vectors are: +* +* position [Q,0,0] +* velocity [0,PHS,0] +* +* To express the results in J2000 equatorial coordinates we make a +* series of four rotations of the Cartesian axes: +* +* axis Euler angle +* +* 1 z argument of perihelion (little omega) +* 2 x inclination (i) +* 3 z longitude of the ascending node (big omega) +* 4 x J2000 obliquity (epsilon) +* +* In each case the rotation is clockwise as seen from the +ve end of +* the axis concerned. + +* Functions of the Euler angles. + SW = SIN(ARGPH) + CW = COS(ARGPH) + SI = SIN(ORBINC) + CI = COS(ORBINC) + SO = SIN(ANODE) + CO = COS(ANODE) + +* Position at perihelion (AU). + X = Q*CW + Y = Q*SW + Z = Y*SI + Y = Y*CI + PX = X*CO-Y*SO + Y = X*SO+Y*CO + PY = Y*CE-Z*SE + PZ = Y*SE+Z*CE + +* Velocity at perihelion (AU per canonical day). + X = -PHS*SW + Y = PHS*CW + Z = Y*SI + Y = Y*CI + VX = X*CO-Y*SO + Y = X*SO+Y*CO + VY = Y*CE-Z*SE + VZ = Y*SE+Z*CE + +* Time from perihelion to date (in Canonical Days: a canonical day +* is 58.1324409... days, defined as 1/GCON). + + DT = (DATE-PHT)*GCON + +* First approximation to the Universal Eccentric Anomaly, PSI, +* based on the circle (FC) and parabola (FP) values. + + FC = DT/Q + W = (3D0*DT+SQRT(9D0*DT*DT+8D0*Q*Q*Q))**(1D0/3D0) + FP = W-2D0*Q/W + PSI = (1D0-E)*FC+E*FP + +* Assemble local copy of element set. + UL(1) = CM + UL(2) = ALPHA + UL(3) = PHT + UL(4) = PX + UL(5) = PY + UL(6) = PZ + UL(7) = VX + UL(8) = VY + UL(9) = VZ + UL(10) = Q + UL(11) = 0D0 + UL(12) = DATE + UL(13) = PSI + +* Predict position+velocity at epoch of osculation. + CALL slUEPV(DATE,UL,PV,J) + IF (J.NE.0) GO TO 9010 + +* Convert back to universal elements. + CALL slPVUE(PV,DATE,CM-1D0,U,J) + IF (J.NE.0) GO TO 9010 + +* OK exit. + JSTAT = 0 + GO TO 9999 + +* Quasi-impossible numerical errors. + 9010 CONTINUE + JSTAT = -5 + + 9999 CONTINUE + END diff --git a/math/slalib/epb.f b/math/slalib/epb.f new file mode 100644 index 00000000..8b492e27 --- /dev/null +++ b/math/slalib/epb.f @@ -0,0 +1,48 @@ + DOUBLE PRECISION FUNCTION slEPB (DATE) +*+ +* - - - - +* E P B +* - - - - +* +* Conversion of Modified Julian Date to Besselian Epoch +* (double precision) +* +* Given: +* DATE dp Modified Julian Date (JD - 2400000.5) +* +* The result is the Besselian Epoch. +* +* Reference: +* Lieske,J.H., 1979. Astron.Astrophys.,73,282. +* +* P.T.Wallace Starlink February 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE + + + slEPB = 1900D0 + (DATE-15019.81352D0)/365.242198781D0 + + END diff --git a/math/slalib/epb2d.f b/math/slalib/epb2d.f new file mode 100644 index 00000000..e430c7fc --- /dev/null +++ b/math/slalib/epb2d.f @@ -0,0 +1,48 @@ + DOUBLE PRECISION FUNCTION slEB2D (EPB) +*+ +* - - - - - - +* E B 2 D +* - - - - - - +* +* Conversion of Besselian Epoch to Modified Julian Date +* (double precision) +* +* Given: +* EPB dp Besselian Epoch +* +* The result is the Modified Julian Date (JD - 2400000.5). +* +* Reference: +* Lieske,J.H., 1979. Astron.Astrophys.,73,282. +* +* P.T.Wallace Starlink February 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION EPB + + + slEB2D = 15019.81352D0 + (EPB-1900D0)*365.242198781D0 + + END diff --git a/math/slalib/epco.f b/math/slalib/epco.f new file mode 100644 index 00000000..fd6862bf --- /dev/null +++ b/math/slalib/epco.f @@ -0,0 +1,69 @@ + DOUBLE PRECISION FUNCTION slEPCO (K0, K, E) +*+ +* - - - - - +* E P C O +* - - - - - +* +* Convert an epoch into the appropriate form - 'B' or 'J' +* +* Given: +* K0 char form of result: 'B'=Besselian, 'J'=Julian +* K char form of given epoch: 'B' or 'J' +* E dp epoch +* +* Called: slEPB, slEJ2D, slEPJ, slEB2D +* +* Notes: +* +* 1) The result is always either equal to or very close to +* the given epoch E. The routine is required only in +* applications where punctilious treatment of heterogeneous +* mixtures of star positions is necessary. +* +* 2) K0 and K are not validated. They are interpreted as follows: +* +* o If K0 and K are the same the result is E. +* o If K0 is 'B' or 'b' and K isn't, the conversion is J to B. +* o In all other cases, the conversion is B to J. +* +* Note that K0 and K won't match if their cases differ. +* +* P.T.Wallace Starlink 5 September 1993 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) K0,K + DOUBLE PRECISION E + DOUBLE PRECISION slEPB,slEJ2D,slEPJ,slEB2D + + + IF (K.EQ.K0) THEN + slEPCO=E + ELSE IF (K0.EQ.'B'.OR.K0.EQ.'b') THEN + slEPCO=slEPB(slEJ2D(E)) + ELSE + slEPCO=slEPJ(slEB2D(E)) + END IF + + END diff --git a/math/slalib/epj.f b/math/slalib/epj.f new file mode 100644 index 00000000..cc8943db --- /dev/null +++ b/math/slalib/epj.f @@ -0,0 +1,47 @@ + DOUBLE PRECISION FUNCTION slEPJ (DATE) +*+ +* - - - - +* E P J +* - - - - +* +* Conversion of Modified Julian Date to Julian Epoch (double precision) +* +* Given: +* DATE dp Modified Julian Date (JD - 2400000.5) +* +* The result is the Julian Epoch. +* +* Reference: +* Lieske,J.H., 1979. Astron.Astrophys.,73,282. +* +* P.T.Wallace Starlink February 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE + + + slEPJ = 2000D0 + (DATE-51544.5D0)/365.25D0 + + END diff --git a/math/slalib/epj2d.f b/math/slalib/epj2d.f new file mode 100644 index 00000000..9754194b --- /dev/null +++ b/math/slalib/epj2d.f @@ -0,0 +1,47 @@ + DOUBLE PRECISION FUNCTION slEJ2D (EPJ) +*+ +* - - - - - - +* E J 2 D +* - - - - - - +* +* Conversion of Julian Epoch to Modified Julian Date (double precision) +* +* Given: +* EPJ dp Julian Epoch +* +* The result is the Modified Julian Date (JD - 2400000.5). +* +* Reference: +* Lieske,J.H., 1979. Astron.Astrophys.,73,282. +* +* P.T.Wallace Starlink February 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION EPJ + + + slEJ2D = 51544.5D0 + (EPJ-2000D0)*365.25D0 + + END diff --git a/math/slalib/epv.f b/math/slalib/epv.f new file mode 100644 index 00000000..dbea31b0 --- /dev/null +++ b/math/slalib/epv.f @@ -0,0 +1,2509 @@ + SUBROUTINE slEPV ( DATE, PH, VH, PB, VB ) +*+ +* - - - - +* E P V +* - - - - +* +* Earth position and velocity, heliocentric and barycentric, with +* respect to the Barycentric Celestial Reference System. +* +* Given: +* DATE d date, TDB Modified Julian Date (Note 1) +* +* Returned: +* PH d(3) heliocentric Earth position (AU) +* VH d(3) heliocentric Earth velocity (AU,AU/day) +* PB d(3) barycentric Earth position (AU) +* VB d(3) barycentric Earth velocity (AU/day) +* +* Notes: +* +* 1) The date is TDB as an MJD (=JD-2400000.5). TT can be used instead +* of TDB in most applications. +* +* 2) On return, the arrays PH, VH, PV, PB contain the following: +* +* PH(1) x } +* PH(2) y } heliocentric position, AU +* PH(3) z } +* +* VH(1) xdot } +* VH(2) ydot } heliocentric velocity, AU/d +* VH(3) zdot } +* +* PB(1) x } +* PB(2) y } barycentric position, AU +* PB(3) z } +* +* VB(1) xdot } +* VB(2) ydot } barycentric velocity, AU/d +* VB(3) zdot } +* +* The vectors are with respect to the Barycentric Celestial +* Reference System (BCRS); velocities are in AU per TDB day. +* +* 3) The routine is a SIMPLIFIED SOLUTION from the planetary theory +* VSOP2000 (X. Moisson, P. Bretagnon, 2001, Celes. Mechanics & +* Dyn. Astron., 80, 3/4, 205-213) and is an adaptation of original +* Fortran code supplied by P. Bretagnon (private comm., 2000). +* +* 4) Comparisons over the time span 1900-2100 with this simplified +* solution and the JPL DE405 ephemeris give the following results: +* +* RMS max +* Heliocentric: +* position error 3.7 11.2 km +* velocity error 1.4 5.0 mm/s +* +* Barycentric: +* position error 4.6 13.4 km +* velocity error 1.4 4.9 mm/s +* +* The results deteriorate outside this time span. +* +* 5) The routine slEVP is faster but less accurate. The present +* routine targets the case where high accuracy is more important +* than CPU time, yet the extra complication of reading a pre- +* computed ephemeris is not justified. +* +* Last revision: 7 April 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*----------------------------------------------------------------------- + + IMPLICIT NONE + + DOUBLE PRECISION DATE, PH(3), VH(3), PB(3), VB(3) + + DOUBLE PRECISION T, T2, XYZ, XYZD, A, B, C, CT, P, CP, + : HP(3), HV(3), BP(3), BV(3), X, Y, Z + + INTEGER I, J, K + +* Days per Julian year + DOUBLE PRECISION DJY + PARAMETER ( DJY = 365.25D0 ) + +* Reference epoch (J2000), MJD + DOUBLE PRECISION DJM0 + PARAMETER ( DJM0 = 51544.5D0 ) +* +* Matrix elements for orienting the analytical model to DE405/ICRF. +* +* The corresponding Euler angles are: +* +* d ' " +* 1st rotation - 23 26 21.4091 about the x-axis (obliquity) +* 2nd rotation + 0.0475 about the z-axis (RA offset) +* +* These were obtained empirically, by comparisons with DE405 over +* 1900-2100. +* + DOUBLE PRECISION AM12, AM13, AM21, AM22, AM23, AM32, AM33 + PARAMETER ( AM12 = +0.000000211284D0, + : AM13 = -0.000000091603D0, + : AM21 = -0.000000230286D0, + : AM22 = +0.917482137087D0, + : AM23 = -0.397776982902D0, + : AM32 = +0.397776982902D0, + : AM33 = +0.917482137087D0 ) + +* ---------------------- +* Ephemeris Coefficients +* ---------------------- +* +* The coefficients are stored in arrays of dimension (3,n,3). There +* are separate sets of arrays for (i) the Sun to Earth vector and +* (ii) the Solar-System barycenter to Sun vector. Each of these two +* sets contains separate arrays for the terms (n in number) in each +* power of time (in Julian years since J2000): T^0, T^1 and T^2. +* Within each array, all the Cartesian x-components, elements (i,j,1), +* appear first, followed by all the y-components, elements (i,j,2) and +* finally all the z-components, elements (i,j,3). At the lowest level +* are groups of three coefficients. The first coefficient in each +* group, element (1,j,k), is the amplitude of the term, the second, +* element (2,j,k), is the phase and the third, element (3,j,k), is the +* frequency. +* +* The naming scheme is such that a block +* +* DOUBLE PRECISION bn(3,Mbn,3) +* +* applies to body b and time exponent n: +* +* . b can be either E (Earth with respect to Sun) or S (Sun with +* respect to Solar-System Barycenter) +* +* . n can be 0, 1 or 2, for T^0, T^1 or T^2 +* +* For example, array E2(3,ME2,3) contains the coefficients for +* the T^2 terms for the Sun-to-Earth vector. +* +* There is no requirement for the X, Y and Z models for a particular +* block to use the same number of coefficients. The number actually +* used is parameterized, the number of terms being used called NbnX, +* NbnY, and NbnZ respectively. The parameter Mbn is the biggest of +* the three, and defines the array size. Unused elements are not +* initialized and are never accessed. +* + + INTEGER NE0(3), NE0X, NE0Y, NE0Z, ME0, + : NE1(3), NE1X, NE1Y, NE1Z, ME1, + : NE2(3), NE2X, NE2Y, NE2Z, ME2, + : NS0(3), NS0X, NS0Y, NS0Z, MS0, + : NS1(3), NS1X, NS1Y, NS1Z, MS1, + : NS2(3), NS2X, NS2Y, NS2Z, MS2 + + PARAMETER ( NE0X = 501, NE0Y = 501, NE0Z = 137, ME0 = NE0X, + : NE1X = 79, NE1Y = 80, NE1Z = 12, ME1 = NE1Y, + : NE2X = 5, NE2Y = 5, NE2Z = 3, ME2 = NE2X, + : NS0X = 212, NS0Y = 213, NS0Z = 69, MS0 = NS0Y, + : NS1X = 50, NS1Y = 50, NS1Z = 14, MS1 = NS1X, + : NS2X = 9, NS2Y = 9, NS2Z = 2, MS2 = NS2X ) + + DOUBLE PRECISION E0(3,ME0,3), E1(3,ME1,3), E2(3,ME2,3), + : S0(3,MS0,3), S1(3,MS1,3), S2(3,MS2,3) + + DATA NE0 / NE0X, NE0Y, NE0Z / + DATA NE1 / NE1X, NE1Y, NE1Z / + DATA NE2 / NE2X, NE2Y, NE2Z / + DATA NS0 / NS0X, NS0Y, NS0Z / + DATA NS1 / NS1X, NS1Y, NS1Z / + DATA NS2 / NS2X, NS2Y, NS2Z / + +* Sun-to-Earth, T^0, X + DATA ((E0(I,J,1),I=1,3),J= 1, 10) / + : 0.9998292878132D+00, 0.1753485171504D+01, 0.6283075850446D+01, + : 0.8352579567414D-02, 0.1710344404582D+01, 0.1256615170089D+02, + : 0.5611445335148D-02, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.1046664295572D-03, 0.1667225416770D+01, 0.1884922755134D+02, + : 0.3110842534677D-04, 0.6687513390251D+00, 0.8399684731857D+02, + : 0.2552413503550D-04, 0.5830637358413D+00, 0.5296909721118D+00, + : 0.2137207845781D-04, 0.1092330954011D+01, 0.1577343543434D+01, + : 0.1680240182951D-04, 0.4955366134987D+00, 0.6279552690824D+01, + : 0.1679012370795D-04, 0.6153014091901D+01, 0.6286599010068D+01, + : 0.1445526946777D-04, 0.3472744100492D+01, 0.2352866153506D+01 / + DATA ((E0(I,J,1),I=1,3),J= 11, 20) / + : 0.1091038246184D-04, 0.3689845786119D+01, 0.5223693906222D+01, + : 0.9344399733932D-05, 0.6073934645672D+01, 0.1203646072878D+02, + : 0.8993182910652D-05, 0.3175705249069D+01, 0.1021328554739D+02, + : 0.5665546034116D-05, 0.2152484672246D+01, 0.1059381944224D+01, + : 0.6844146703035D-05, 0.1306964099750D+01, 0.5753384878334D+01, + : 0.7346610905565D-05, 0.4354980070466D+01, 0.3981490189893D+00, + : 0.6815396474414D-05, 0.2218229211267D+01, 0.4705732307012D+01, + : 0.6112787253053D-05, 0.5384788425458D+01, 0.6812766822558D+01, + : 0.4518120711239D-05, 0.6087604012291D+01, 0.5884926831456D+01, + : 0.4521963430706D-05, 0.1279424524906D+01, 0.6256777527156D+01 / + DATA ((E0(I,J,1),I=1,3),J= 21, 30) / + : 0.4497426764085D-05, 0.5369129144266D+01, 0.6309374173736D+01, + : 0.4062190566959D-05, 0.5436473303367D+00, 0.6681224869435D+01, + : 0.5412193480192D-05, 0.7867838528395D+00, 0.7755226100720D+00, + : 0.5469839049386D-05, 0.1461440311134D+01, 0.1414349524433D+02, + : 0.5205264083477D-05, 0.4432944696116D+01, 0.7860419393880D+01, + : 0.2149759935455D-05, 0.4502237496846D+01, 0.1150676975667D+02, + : 0.2279109618501D-05, 0.1239441308815D+01, 0.7058598460518D+01, + : 0.2259282939683D-05, 0.3272430985331D+01, 0.4694002934110D+01, + : 0.2558950271319D-05, 0.2265471086404D+01, 0.1216800268190D+02, + : 0.2561581447555D-05, 0.1454740653245D+01, 0.7099330490126D+00 / + DATA ((E0(I,J,1),I=1,3),J= 31, 40) / + : 0.1781441115440D-05, 0.2962068630206D+01, 0.7962980379786D+00, + : 0.1612005874644D-05, 0.1473255041006D+01, 0.5486777812467D+01, + : 0.1818630667105D-05, 0.3743903293447D+00, 0.6283008715021D+01, + : 0.1818601377529D-05, 0.6274174354554D+01, 0.6283142985870D+01, + : 0.1554475925257D-05, 0.1624110906816D+01, 0.2513230340178D+02, + : 0.2090948029241D-05, 0.5852052276256D+01, 0.1179062909082D+02, + : 0.2000176345460D-05, 0.4072093298513D+01, 0.1778984560711D+02, + : 0.1289535917759D-05, 0.5217019331069D+01, 0.7079373888424D+01, + : 0.1281135307881D-05, 0.4802054538934D+01, 0.3738761453707D+01, + : 0.1518229005692D-05, 0.8691914742502D+00, 0.2132990797783D+00 / + DATA ((E0(I,J,1),I=1,3),J= 41, 50) / + : 0.9450128579027D-06, 0.4601859529950D+01, 0.1097707878456D+02, + : 0.7781119494996D-06, 0.1844352816694D+01, 0.8827390247185D+01, + : 0.7733407759912D-06, 0.3582790154750D+01, 0.5507553240374D+01, + : 0.7350644318120D-06, 0.2695277788230D+01, 0.1589072916335D+01, + : 0.6535928827023D-06, 0.3651327986142D+01, 0.1176985366291D+02, + : 0.6324624183656D-06, 0.2241302375862D+01, 0.6262300422539D+01, + : 0.6298565300557D-06, 0.4407122406081D+01, 0.6303851278352D+01, + : 0.8587037089179D-06, 0.3024307223119D+01, 0.1672837615881D+03, + : 0.8299954491035D-06, 0.6192539428237D+01, 0.3340612434717D+01, + : 0.6311263503401D-06, 0.2014758795416D+01, 0.7113454667900D-02 / + DATA ((E0(I,J,1),I=1,3),J= 51, 60) / + : 0.6005646745452D-06, 0.3399500503397D+01, 0.4136910472696D+01, + : 0.7917715109929D-06, 0.2493386877837D+01, 0.6069776770667D+01, + : 0.7556958099685D-06, 0.4159491740143D+01, 0.6496374930224D+01, + : 0.6773228244949D-06, 0.4034162934230D+01, 0.9437762937313D+01, + : 0.5370708577847D-06, 0.1562219163734D+01, 0.1194447056968D+01, + : 0.5710804266203D-06, 0.2662730803386D+01, 0.6282095334605D+01, + : 0.5709824583726D-06, 0.3985828430833D+01, 0.6284056366286D+01, + : 0.5143950896447D-06, 0.1308144688689D+01, 0.6290189305114D+01, + : 0.5088010604546D-06, 0.5352817214804D+01, 0.6275962395778D+01, + : 0.4960369085172D-06, 0.2644267922349D+01, 0.6127655567643D+01 / + DATA ((E0(I,J,1),I=1,3),J= 61, 70) / + : 0.4803137891183D-06, 0.4008844192080D+01, 0.6438496133249D+01, + : 0.5731747768225D-06, 0.3794550174597D+01, 0.3154687086868D+01, + : 0.4735947960579D-06, 0.6107118308982D+01, 0.3128388763578D+01, + : 0.4808348796625D-06, 0.4771458618163D+01, 0.8018209333619D+00, + : 0.4115073743137D-06, 0.3327111335159D+01, 0.8429241228195D+01, + : 0.5230575889287D-06, 0.5305708551694D+01, 0.1336797263425D+02, + : 0.5133977889215D-06, 0.5784230738814D+01, 0.1235285262111D+02, + : 0.5065815825327D-06, 0.2052064793679D+01, 0.1185621865188D+02, + : 0.4339831593868D-06, 0.3644994195830D+01, 0.1726015463500D+02, + : 0.3952928638953D-06, 0.4930376436758D+01, 0.5481254917084D+01 / + DATA ((E0(I,J,1),I=1,3),J= 71, 80) / + : 0.4898498111942D-06, 0.4542084219731D+00, 0.9225539266174D+01, + : 0.4757490209328D-06, 0.3161126388878D+01, 0.5856477690889D+01, + : 0.4727701669749D-06, 0.6214993845446D+00, 0.2544314396739D+01, + : 0.3800966681863D-06, 0.3040132339297D+01, 0.4265981595566D+00, + : 0.3257301077939D-06, 0.8064977360087D+00, 0.3930209696940D+01, + : 0.3255810528674D-06, 0.1974147981034D+01, 0.2146165377750D+01, + : 0.3252029748187D-06, 0.2845924913135D+01, 0.4164311961999D+01, + : 0.3255505635308D-06, 0.3017900824120D+01, 0.5088628793478D+01, + : 0.2801345211990D-06, 0.6109717793179D+01, 0.1256967486051D+02, + : 0.3688987740970D-06, 0.2911550235289D+01, 0.1807370494127D+02 / + DATA ((E0(I,J,1),I=1,3),J= 81, 90) / + : 0.2475153429458D-06, 0.2179146025856D+01, 0.2629832328990D-01, + : 0.3033457749150D-06, 0.1994161050744D+01, 0.4535059491685D+01, + : 0.2186743763110D-06, 0.5125687237936D+01, 0.1137170464392D+02, + : 0.2764777032774D-06, 0.4822646860252D+00, 0.1256262854127D+02, + : 0.2199028768592D-06, 0.4637633293831D+01, 0.1255903824622D+02, + : 0.2046482824760D-06, 0.1467038733093D+01, 0.7084896783808D+01, + : 0.2611209147507D-06, 0.3044718783485D+00, 0.7143069561767D+02, + : 0.2286079656818D-06, 0.4764220356805D+01, 0.8031092209206D+01, + : 0.1855071202587D-06, 0.3383637774428D+01, 0.1748016358760D+01, + : 0.2324669506784D-06, 0.6189088449251D+01, 0.1831953657923D+02 / + DATA ((E0(I,J,1),I=1,3),J= 91,100) / + : 0.1709528015688D-06, 0.5874966729774D+00, 0.4933208510675D+01, + : 0.2168156875828D-06, 0.4302994009132D+01, 0.1044738781244D+02, + : 0.2106675556535D-06, 0.3800475419891D+01, 0.7477522907414D+01, + : 0.1430213830465D-06, 0.1294660846502D+01, 0.2942463415728D+01, + : 0.1388396901944D-06, 0.4594797202114D+01, 0.8635942003952D+01, + : 0.1922258844190D-06, 0.4943044543591D+00, 0.1729818233119D+02, + : 0.1888460058292D-06, 0.2426943912028D+01, 0.1561374759853D+03, + : 0.1789449386107D-06, 0.1582973303499D+00, 0.1592596075957D+01, + : 0.1360803685374D-06, 0.5197240440504D+01, 0.1309584267300D+02, + : 0.1504038014709D-06, 0.3120360916217D+01, 0.1649636139783D+02 / + DATA ((E0(I,J,1),I=1,3),J=101,110) / + : 0.1382769533389D-06, 0.6164702888205D+01, 0.7632943190217D+01, + : 0.1438059769079D-06, 0.1437423770979D+01, 0.2042657109477D+02, + : 0.1326303260037D-06, 0.3609688799679D+01, 0.1213955354133D+02, + : 0.1159244950540D-06, 0.5463018167225D+01, 0.5331357529664D+01, + : 0.1433118149136D-06, 0.6028909912097D+01, 0.7342457794669D+01, + : 0.1234623148594D-06, 0.3109645574997D+01, 0.6279485555400D+01, + : 0.1233949875344D-06, 0.3539359332866D+01, 0.6286666145492D+01, + : 0.9927196061299D-07, 0.1259321569772D+01, 0.7234794171227D+01, + : 0.1242302191316D-06, 0.1065949392609D+01, 0.1511046609763D+02, + : 0.1098402195201D-06, 0.2192508743837D+01, 0.1098880815746D+02 / + DATA ((E0(I,J,1),I=1,3),J=111,120) / + : 0.1158191395315D-06, 0.4054411278650D+01, 0.5729506548653D+01, + : 0.9048475596241D-07, 0.5429764748518D+01, 0.9623688285163D+01, + : 0.8889853269023D-07, 0.5046586206575D+01, 0.6148010737701D+01, + : 0.1048694242164D-06, 0.2628858030806D+01, 0.6836645152238D+01, + : 0.1112308378646D-06, 0.4177292719907D+01, 0.1572083878776D+02, + : 0.8631729709901D-07, 0.1601345232557D+01, 0.6418140963190D+01, + : 0.8527816951664D-07, 0.2463888997513D+01, 0.1471231707864D+02, + : 0.7892139456991D-07, 0.3154022088718D+01, 0.2118763888447D+01, + : 0.1051782905236D-06, 0.4795035816088D+01, 0.1349867339771D+01, + : 0.1048219943164D-06, 0.2952983395230D+01, 0.5999216516294D+01 / + DATA ((E0(I,J,1),I=1,3),J=121,130) / + : 0.7435760775143D-07, 0.5420547991464D+01, 0.6040347114260D+01, + : 0.9869574106949D-07, 0.3695646753667D+01, 0.6566935184597D+01, + : 0.9156886364226D-07, 0.3922675306609D+01, 0.5643178611111D+01, + : 0.7006834356188D-07, 0.1233968624861D+01, 0.6525804586632D+01, + : 0.9806170182601D-07, 0.1919542280684D+01, 0.2122839202813D+02, + : 0.9052289673607D-07, 0.4615902724369D+01, 0.4690479774488D+01, + : 0.7554200867893D-07, 0.1236863719072D+01, 0.1253985337760D+02, + : 0.8215741286498D-07, 0.3286800101559D+00, 0.1097355562493D+02, + : 0.7185178575397D-07, 0.5880942158367D+01, 0.6245048154254D+01, + : 0.7130726476180D-07, 0.7674871987661D+00, 0.6321103546637D+01 / + DATA ((E0(I,J,1),I=1,3),J=131,140) / + : 0.6650894461162D-07, 0.6987129150116D+00, 0.5327476111629D+01, + : 0.7396888823688D-07, 0.3576824794443D+01, 0.5368044267797D+00, + : 0.7420588884775D-07, 0.5033615245369D+01, 0.2354323048545D+02, + : 0.6141181642908D-07, 0.9449927045673D+00, 0.1296430071988D+02, + : 0.6373557924058D-07, 0.6206342280341D+01, 0.9517183207817D+00, + : 0.6359474329261D-07, 0.5036079095757D+01, 0.1990745094947D+01, + : 0.5740173582646D-07, 0.6105106371350D+01, 0.9555997388169D+00, + : 0.7019864084602D-07, 0.7237747359018D+00, 0.5225775174439D+00, + : 0.6398054487042D-07, 0.3976367969666D+01, 0.2407292145756D+02, + : 0.7797092650498D-07, 0.4305423910623D+01, 0.2200391463820D+02 / + DATA ((E0(I,J,1),I=1,3),J=141,150) / + : 0.6466760000900D-07, 0.3500136825200D+01, 0.5230807360890D+01, + : 0.7529417043890D-07, 0.3514779246100D+01, 0.1842262939178D+02, + : 0.6924571140892D-07, 0.2743457928679D+01, 0.1554202828031D+00, + : 0.6220798650222D-07, 0.2242598118209D+01, 0.1845107853235D+02, + : 0.5870209391853D-07, 0.2332832707527D+01, 0.6398972393349D+00, + : 0.6263953473888D-07, 0.2191105358956D+01, 0.6277552955062D+01, + : 0.6257781390012D-07, 0.4457559396698D+01, 0.6288598745829D+01, + : 0.5697304945123D-07, 0.3499234761404D+01, 0.1551045220144D+01, + : 0.6335438746791D-07, 0.6441691079251D+00, 0.5216580451554D+01, + : 0.6377258441152D-07, 0.2252599151092D+01, 0.5650292065779D+01 / + DATA ((E0(I,J,1),I=1,3),J=151,160) / + : 0.6484841818165D-07, 0.1992812417646D+01, 0.1030928125552D+00, + : 0.4735551485250D-07, 0.3744672082942D+01, 0.1431416805965D+02, + : 0.4628595996170D-07, 0.1334226211745D+01, 0.5535693017924D+00, + : 0.6258152336933D-07, 0.4395836159154D+01, 0.2608790314060D+02, + : 0.6196171366594D-07, 0.2587043007997D+01, 0.8467247584405D+02, + : 0.6159556952126D-07, 0.4782499769128D+01, 0.2394243902548D+03, + : 0.4987741172394D-07, 0.7312257619924D+00, 0.7771377146812D+02, + : 0.5459280703142D-07, 0.3001376372532D+01, 0.6179983037890D+01, + : 0.4863461189999D-07, 0.3767222128541D+01, 0.9027992316901D+02, + : 0.5349912093158D-07, 0.3663594450273D+01, 0.6386168663001D+01 / + DATA ((E0(I,J,1),I=1,3),J=161,170) / + : 0.5673725607806D-07, 0.4331187919049D+01, 0.6915859635113D+01, + : 0.4745485060512D-07, 0.5816195745518D+01, 0.6282970628506D+01, + : 0.4745379005326D-07, 0.8323672435672D+00, 0.6283181072386D+01, + : 0.4049002796321D-07, 0.3785023976293D+01, 0.6254626709878D+01, + : 0.4247084014515D-07, 0.2378220728783D+01, 0.7875671926403D+01, + : 0.4026912363055D-07, 0.2864103423269D+01, 0.6311524991013D+01, + : 0.4062935011774D-07, 0.2415408595975D+01, 0.3634620989887D+01, + : 0.5347771048509D-07, 0.3343479309801D+01, 0.2515860172507D+02, + : 0.4829494136505D-07, 0.2821742398262D+01, 0.5760498333002D+01, + : 0.4342554404599D-07, 0.5624662458712D+01, 0.7238675589263D+01 / + DATA ((E0(I,J,1),I=1,3),J=171,180) / + : 0.4021599184361D-07, 0.5557250275009D+00, 0.1101510648075D+02, + : 0.4104900474558D-07, 0.3296691780005D+01, 0.6709674010002D+01, + : 0.4376532905131D-07, 0.3814443999443D+01, 0.6805653367890D+01, + : 0.3314590480650D-07, 0.3560229189250D+01, 0.1259245002418D+02, + : 0.3232421839643D-07, 0.5185389180568D+01, 0.1066495398892D+01, + : 0.3541176318876D-07, 0.3921381909679D+01, 0.9917696840332D+01, + : 0.3689831242681D-07, 0.4190658955386D+01, 0.1192625446156D+02, + : 0.3890605376774D-07, 0.5546023371097D+01, 0.7478166569050D-01, + : 0.3038559339780D-07, 0.6231032794494D+01, 0.1256621883632D+02, + : 0.3137083969782D-07, 0.6207063419190D+01, 0.4292330755499D+01 / + DATA ((E0(I,J,1),I=1,3),J=181,190) / + : 0.4024004081854D-07, 0.1195257375713D+01, 0.1334167431096D+02, + : 0.3300234879283D-07, 0.1804694240998D+01, 0.1057540660594D+02, + : 0.3635399155575D-07, 0.5597811343500D+01, 0.6208294184755D+01, + : 0.3032668691356D-07, 0.3191059366530D+01, 0.1805292951336D+02, + : 0.2809652069058D-07, 0.4094348032570D+01, 0.3523159621801D-02, + : 0.3696955383823D-07, 0.5219282738794D+01, 0.5966683958112D+01, + : 0.3562894142503D-07, 0.1037247544554D+01, 0.6357857516136D+01, + : 0.3510598524148D-07, 0.1430020816116D+01, 0.6599467742779D+01, + : 0.3617736142953D-07, 0.3002911403677D+01, 0.6019991944201D+01, + : 0.2624524910730D-07, 0.2437046757292D+01, 0.6702560555334D+01 / + DATA ((E0(I,J,1),I=1,3),J=191,200) / + : 0.2535824204490D-07, 0.1581594689647D+01, 0.3141537925223D+02, + : 0.3519787226257D-07, 0.5379863121521D+01, 0.2505706758577D+03, + : 0.2578406709982D-07, 0.4904222639329D+01, 0.1673046366289D+02, + : 0.3423887981473D-07, 0.3646448997315D+01, 0.6546159756691D+01, + : 0.2776083886467D-07, 0.3307829300144D+01, 0.1272157198369D+02, + : 0.3379592818379D-07, 0.1747541251125D+01, 0.1494531617769D+02, + : 0.3050255426284D-07, 0.1784689432607D-01, 0.4732030630302D+01, + : 0.2652378350236D-07, 0.4420055276260D+01, 0.5863591145557D+01, + : 0.2374498173768D-07, 0.3629773929208D+01, 0.2388894113936D+01, + : 0.2716451255140D-07, 0.3079623706780D+01, 0.1202934727411D+02 / + DATA ((E0(I,J,1),I=1,3),J=201,210) / + : 0.3038583699229D-07, 0.3312487903507D+00, 0.1256608456547D+02, + : 0.2220681228760D-07, 0.5265520401774D+01, 0.1336244973887D+02, + : 0.3044156540912D-07, 0.4766664081250D+01, 0.2908881142201D+02, + : 0.2731859923561D-07, 0.5069146530691D+01, 0.1391601904066D+02, + : 0.2285603018171D-07, 0.5954935112271D+01, 0.6076890225335D+01, + : 0.2025006454555D-07, 0.4061789589267D+01, 0.4701116388778D+01, + : 0.2012597519804D-07, 0.2485047705241D+01, 0.6262720680387D+01, + : 0.2003406962258D-07, 0.4163779209320D+01, 0.6303431020504D+01, + : 0.2207863441371D-07, 0.6923839133828D+00, 0.6489261475556D+01, + : 0.2481374305624D-07, 0.5944173595676D+01, 0.1204357418345D+02 / + DATA ((E0(I,J,1),I=1,3),J=211,220) / + : 0.2130923288870D-07, 0.4641013671967D+01, 0.5746271423666D+01, + : 0.2446370543391D-07, 0.6125796518757D+01, 0.1495633313810D+00, + : 0.1932492759052D-07, 0.2234572324504D+00, 0.1352175143971D+02, + : 0.2600122568049D-07, 0.4281012405440D+01, 0.4590910121555D+01, + : 0.2431754047488D-07, 0.1429943874870D+00, 0.1162474756779D+01, + : 0.1875902869209D-07, 0.9781803816948D+00, 0.6279194432410D+01, + : 0.1874381139426D-07, 0.5670368130173D+01, 0.6286957268481D+01, + : 0.2156696047173D-07, 0.2008985006833D+01, 0.1813929450232D+02, + : 0.1965076182484D-07, 0.2566186202453D+00, 0.4686889479442D+01, + : 0.2334816372359D-07, 0.4408121891493D+01, 0.1002183730415D+02 / + DATA ((E0(I,J,1),I=1,3),J=221,230) / + : 0.1869937408802D-07, 0.5272745038656D+01, 0.2427287361862D+00, + : 0.2436236460883D-07, 0.4407720479029D+01, 0.9514313292143D+02, + : 0.1761365216611D-07, 0.1943892315074D+00, 0.1351787002167D+02, + : 0.2156289480503D-07, 0.1418570924545D+01, 0.6037244212485D+01, + : 0.2164748979255D-07, 0.4724603439430D+01, 0.2301353951334D+02, + : 0.2222286670853D-07, 0.2400266874598D+01, 0.1266924451345D+02, + : 0.2070901414929D-07, 0.5230348028732D+01, 0.6528907488406D+01, + : 0.1792745177020D-07, 0.2099190328945D+01, 0.6819880277225D+01, + : 0.1841802068445D-07, 0.3467527844848D+00, 0.6514761976723D+02, + : 0.1578401631718D-07, 0.7098642356340D+00, 0.2077542790660D-01 / + DATA ((E0(I,J,1),I=1,3),J=231,240) / + : 0.1561690152531D-07, 0.5943349620372D+01, 0.6272439236156D+01, + : 0.1558591045463D-07, 0.7040653478980D+00, 0.6293712464735D+01, + : 0.1737356469576D-07, 0.4487064760345D+01, 0.1765478049437D+02, + : 0.1434755619991D-07, 0.2993391570995D+01, 0.1102062672231D+00, + : 0.1482187806654D-07, 0.2278049198251D+01, 0.1052268489556D+01, + : 0.1424812827089D-07, 0.1682114725827D+01, 0.1311972100268D+02, + : 0.1380282448623D-07, 0.3262668602579D+01, 0.1017725758696D+02, + : 0.1811481244566D-07, 0.3187771221777D+01, 0.1887552587463D+02, + : 0.1504446185696D-07, 0.5650162308647D+01, 0.7626583626240D-01, + : 0.1740776154137D-07, 0.5487068607507D+01, 0.1965104848470D+02 / + DATA ((E0(I,J,1),I=1,3),J=241,250) / + : 0.1374339536251D-07, 0.5745688172201D+01, 0.6016468784579D+01, + : 0.1761377477704D-07, 0.5748060203659D+01, 0.2593412433514D+02, + : 0.1535138225795D-07, 0.6226848505790D+01, 0.9411464614024D+01, + : 0.1788140543676D-07, 0.6189318878563D+01, 0.3301902111895D+02, + : 0.1375002807996D-07, 0.5371812884394D+01, 0.6327837846670D+00, + : 0.1242115758632D-07, 0.1471687569712D+01, 0.3894181736510D+01, + : 0.1450977333938D-07, 0.4143836662127D+01, 0.1277945078067D+02, + : 0.1297579575023D-07, 0.9003477661957D+00, 0.6549682916313D+01, + : 0.1462667934821D-07, 0.5760505536428D+01, 0.1863592847156D+02, + : 0.1381774374799D-07, 0.1085471729463D+01, 0.2379164476796D+01 / + DATA ((E0(I,J,1),I=1,3),J=251,260) / + : 0.1682333169307D-07, 0.5409870870133D+01, 0.1620077269078D+02, + : 0.1190812918837D-07, 0.1397205174601D+01, 0.1149965630200D+02, + : 0.1221434762106D-07, 0.9001804809095D+00, 0.1257326515556D+02, + : 0.1549934644860D-07, 0.4262528275544D+01, 0.1820933031200D+02, + : 0.1252138953050D-07, 0.1411642012027D+01, 0.6993008899458D+01, + : 0.1237078905387D-07, 0.2844472403615D+01, 0.2435678079171D+02, + : 0.1446953389615D-07, 0.5295835522223D+01, 0.3813291813120D-01, + : 0.1388446457170D-07, 0.4969428135497D+01, 0.2458316379602D+00, + : 0.1019339179228D-07, 0.2491369561806D+01, 0.6112403035119D+01, + : 0.1258880815343D-07, 0.4679426248976D+01, 0.5429879531333D+01 / + DATA ((E0(I,J,1),I=1,3),J=261,270) / + : 0.1297768238261D-07, 0.1074509953328D+01, 0.1249137003520D+02, + : 0.9913505718094D-08, 0.4735097918224D+01, 0.6247047890016D+01, + : 0.9830453155969D-08, 0.4158649187338D+01, 0.6453748665772D+01, + : 0.1192615865309D-07, 0.3438208613699D+01, 0.6290122169689D+01, + : 0.9835874798277D-08, 0.1913300781229D+01, 0.6319103810876D+01, + : 0.9639087569277D-08, 0.9487683644125D+00, 0.8273820945392D+01, + : 0.1175716107001D-07, 0.3228141664287D+01, 0.6276029531202D+01, + : 0.1018926508678D-07, 0.2216607854300D+01, 0.1254537627298D+02, + : 0.9500087869225D-08, 0.2625116459733D+01, 0.1256517118505D+02, + : 0.9664192916575D-08, 0.5860562449214D+01, 0.6259197520765D+01 / + DATA ((E0(I,J,1),I=1,3),J=271,280) / + : 0.9612858712203D-08, 0.7885682917381D+00, 0.6306954180126D+01, + : 0.1117645675413D-07, 0.3932148831189D+01, 0.1779695906178D+02, + : 0.1158864052160D-07, 0.9995605521691D+00, 0.1778273215245D+02, + : 0.9021043467028D-08, 0.5263769742673D+01, 0.6172869583223D+01, + : 0.8836134773563D-08, 0.1496843220365D+01, 0.1692165728891D+01, + : 0.1045872200691D-07, 0.7009039517214D+00, 0.2204125344462D+00, + : 0.1211463487798D-07, 0.4041544938511D+01, 0.8257698122054D+02, + : 0.8541990804094D-08, 0.1447586692316D+01, 0.6393282117669D+01, + : 0.1038720703636D-07, 0.4594249718112D+00, 0.1550861511662D+02, + : 0.1126722351445D-07, 0.3925550579036D+01, 0.2061856251104D+00 / + DATA ((E0(I,J,1),I=1,3),J=281,290) / + : 0.8697373859631D-08, 0.4411341856037D+01, 0.9491756770005D+00, + : 0.8869380028441D-08, 0.2402659724813D+01, 0.3903911373650D+01, + : 0.9247014693258D-08, 0.1401579743423D+01, 0.6267823317922D+01, + : 0.9205062930950D-08, 0.5245978000814D+01, 0.6298328382969D+01, + : 0.8000745038049D-08, 0.3590803356945D+01, 0.2648454860559D+01, + : 0.9168973650819D-08, 0.2470150501679D+01, 0.1498544001348D+03, + : 0.1075444949238D-07, 0.1328606161230D+01, 0.3694923081589D+02, + : 0.7817298525817D-08, 0.6162256225998D+01, 0.4804209201333D+01, + : 0.9541469226356D-08, 0.3942568967039D+01, 0.1256713221673D+02, + : 0.9821910122027D-08, 0.2360246287233D+00, 0.1140367694411D+02 / + DATA ((E0(I,J,1),I=1,3),J=291,300) / + : 0.9897822023777D-08, 0.4619805634280D+01, 0.2280573557157D+02, + : 0.7737289283765D-08, 0.3784727847451D+01, 0.7834121070590D+01, + : 0.9260204034710D-08, 0.2223352487601D+01, 0.2787043132925D+01, + : 0.7320252888486D-08, 0.1288694636874D+01, 0.6282655592598D+01, + : 0.7319785780946D-08, 0.5359869567774D+01, 0.6283496108294D+01, + : 0.7147219933778D-08, 0.5516616675856D+01, 0.1725663147538D+02, + : 0.7946502829878D-08, 0.2630459984567D+01, 0.1241073141809D+02, + : 0.9001711808932D-08, 0.2849815827227D+01, 0.6281591679874D+01, + : 0.8994041507257D-08, 0.3795244450750D+01, 0.6284560021018D+01, + : 0.8298582787358D-08, 0.5236413127363D+00, 0.1241658836951D+02 / + DATA ((E0(I,J,1),I=1,3),J=301,310) / + : 0.8526596520710D-08, 0.4794605424426D+01, 0.1098419223922D+02, + : 0.8209822103197D-08, 0.1578752370328D+01, 0.1096996532989D+02, + : 0.6357049861094D-08, 0.5708926113761D+01, 0.1596186371003D+01, + : 0.7370473179049D-08, 0.3842402530241D+01, 0.4061219149443D+01, + : 0.7232154664726D-08, 0.3067548981535D+01, 0.1610006857377D+03, + : 0.6328765494903D-08, 0.1313930030069D+01, 0.1193336791622D+02, + : 0.8030064908595D-08, 0.3488500408886D+01, 0.8460828644453D+00, + : 0.6275464259232D-08, 0.1532061626198D+01, 0.8531963191132D+00, + : 0.7051897446325D-08, 0.3285859929993D+01, 0.5849364236221D+01, + : 0.6161593705428D-08, 0.1477341999464D+01, 0.5573142801433D+01 / + DATA ((E0(I,J,1),I=1,3),J=311,320) / + : 0.7754683957278D-08, 0.1586118663096D+01, 0.8662240327241D+01, + : 0.5889928990701D-08, 0.1304887868803D+01, 0.1232342296471D+02, + : 0.5705756047075D-08, 0.4555333589350D+01, 0.1258692712880D+02, + : 0.5964178808332D-08, 0.3001762842062D+01, 0.5333900173445D+01, + : 0.6712446027467D-08, 0.4886780007595D+01, 0.1171295538178D+02, + : 0.5941809275464D-08, 0.4701509603824D+01, 0.9779108567966D+01, + : 0.5466993627395D-08, 0.4588357817278D+01, 0.1884211409667D+02, + : 0.6340512090980D-08, 0.1164543038893D+01, 0.5217580628120D+02, + : 0.6325505710045D-08, 0.3919171259645D+01, 0.1041998632314D+02, + : 0.6164789509685D-08, 0.2143828253542D+01, 0.6151533897323D+01 / + DATA ((E0(I,J,1),I=1,3),J=321,330) / + : 0.5263330812430D-08, 0.6066564434241D+01, 0.1885275071096D+02, + : 0.5597087780221D-08, 0.2926316429472D+01, 0.4337116142245D+00, + : 0.5396556236817D-08, 0.3244303591505D+01, 0.6286362197481D+01, + : 0.5396615148223D-08, 0.3404304703662D+01, 0.6279789503410D+01, + : 0.7091832443341D-08, 0.8532377803192D+00, 0.4907302013889D+01, + : 0.6572352589782D-08, 0.4901966774419D+01, 0.1176433076753D+02, + : 0.5960236060795D-08, 0.1874672315797D+01, 0.1422690933580D-01, + : 0.5125480043511D-08, 0.3735726064334D+01, 0.1245594543367D+02, + : 0.5928241866410D-08, 0.4502033899935D+01, 0.6414617803568D+01, + : 0.5249600357424D-08, 0.4372334799878D+01, 0.1151388321134D+02 / + DATA ((E0(I,J,1),I=1,3),J=331,340) / + : 0.6059171276087D-08, 0.2581617302908D+01, 0.6062663316000D+01, + : 0.5295235081662D-08, 0.2974811513158D+01, 0.3496032717521D+01, + : 0.5820561875933D-08, 0.1796073748244D+00, 0.2838593341516D+00, + : 0.4754696606440D-08, 0.1981998136973D+01, 0.3104930017775D+01, + : 0.6385053548955D-08, 0.2559174171605D+00, 0.6133512519065D+01, + : 0.6589828273941D-08, 0.2750967106776D+01, 0.4087944051283D+02, + : 0.5383376567189D-08, 0.6325947523578D+00, 0.2248384854122D+02, + : 0.5928941683538D-08, 0.1672304519067D+01, 0.1581959461667D+01, + : 0.4816060709794D-08, 0.3512566172575D+01, 0.9388005868221D+01, + : 0.6003381586512D-08, 0.5610932219189D+01, 0.5326786718777D+01 / + DATA ((E0(I,J,1),I=1,3),J=341,350) / + : 0.5504225393105D-08, 0.4037501131256D+01, 0.6503488384892D+01, + : 0.5353772620129D-08, 0.6122774968240D+01, 0.1735668374386D+03, + : 0.5786253768544D-08, 0.5527984999515D+01, 0.1350651127443D+00, + : 0.5065706702002D-08, 0.9980765573624D+00, 0.1248988586463D+02, + : 0.5972838885276D-08, 0.6044489493203D+01, 0.2673594526851D+02, + : 0.5323585877961D-08, 0.3924265998147D+01, 0.4171425416666D+01, + : 0.5210772682858D-08, 0.6220111376901D+01, 0.2460261242967D+02, + : 0.4726549040535D-08, 0.3716043206862D+01, 0.7232251527446D+01, + : 0.6029425105059D-08, 0.8548704071116D+00, 0.3227113045244D+03, + : 0.4481542826513D-08, 0.1426925072829D+01, 0.5547199253223D+01 / + DATA ((E0(I,J,1),I=1,3),J=351,360) / + : 0.5836024505068D-08, 0.7135651752625D-01, 0.7285056171570D+02, + : 0.4137046613272D-08, 0.5330767643283D+01, 0.1087398597200D+02, + : 0.5171977473924D-08, 0.4494262335353D+00, 0.1884570439172D+02, + : 0.5694429833732D-08, 0.2952369582215D+01, 0.9723862754494D+02, + : 0.4009158925298D-08, 0.3500003416535D+01, 0.6244942932314D+01, + : 0.4784939596873D-08, 0.6196709413181D+01, 0.2929661536378D+02, + : 0.3983725022610D-08, 0.5103690031897D+01, 0.4274518229222D+01, + : 0.3870535232462D-08, 0.3187569587401D+01, 0.6321208768577D+01, + : 0.5140501213951D-08, 0.1668924357457D+01, 0.1232032006293D+02, + : 0.3849034819355D-08, 0.4445722510309D+01, 0.1726726808967D+02 / + DATA ((E0(I,J,1),I=1,3),J=361,370) / + : 0.4002383075060D-08, 0.5226224152423D+01, 0.7018952447668D+01, + : 0.3890719543549D-08, 0.4371166550274D+01, 0.1491901785440D+02, + : 0.4887084607881D-08, 0.5973556689693D+01, 0.1478866649112D+01, + : 0.3739939287592D-08, 0.2089084714600D+01, 0.6922973089781D+01, + : 0.5031925918209D-08, 0.4658371936827D+01, 0.1715706182245D+02, + : 0.4387748764954D-08, 0.4825580552819D+01, 0.2331413144044D+03, + : 0.4147398098865D-08, 0.3739003524998D+01, 0.1376059875786D+02, + : 0.3719089993586D-08, 0.1148941386536D+01, 0.6297302759782D+01, + : 0.3934238461056D-08, 0.1559893008343D+01, 0.7872148766781D+01, + : 0.3672471375622D-08, 0.5516145383612D+01, 0.6268848941110D+01 / + DATA ((E0(I,J,1),I=1,3),J=371,380) / + : 0.3768911277583D-08, 0.6116053700563D+01, 0.4157198507331D+01, + : 0.4033388417295D-08, 0.5076821746017D+01, 0.1567108171867D+02, + : 0.3764194617832D-08, 0.8164676232075D+00, 0.3185192151914D+01, + : 0.4840628226284D-08, 0.1360479453671D+01, 0.1252801878276D+02, + : 0.4949443923785D-08, 0.2725622229926D+01, 0.1617106187867D+03, + : 0.4117393089971D-08, 0.6054459628492D+00, 0.5642198095270D+01, + : 0.3925754020428D-08, 0.8570462135210D+00, 0.2139354194808D+02, + : 0.3630551757923D-08, 0.3552067338279D+01, 0.6294805223347D+01, + : 0.3627274802357D-08, 0.3096565085313D+01, 0.6271346477544D+01, + : 0.3806143885093D-08, 0.6367751709777D+00, 0.1725304118033D+02 / + DATA ((E0(I,J,1),I=1,3),J=381,390) / + : 0.4433254641565D-08, 0.4848461503937D+01, 0.7445550607224D+01, + : 0.3712319846576D-08, 0.1331950643655D+01, 0.4194847048887D+00, + : 0.3849847534783D-08, 0.4958368297746D+00, 0.9562891316684D+00, + : 0.3483955430165D-08, 0.2237215515707D+01, 0.1161697602389D+02, + : 0.3961912730982D-08, 0.3332402188575D+01, 0.2277943724828D+02, + : 0.3419978244481D-08, 0.5785600576016D+01, 0.1362553364512D+02, + : 0.3329417758177D-08, 0.9812676559709D-01, 0.1685848245639D+02, + : 0.4207206893193D-08, 0.9494780468236D+00, 0.2986433403208D+02, + : 0.3268548976410D-08, 0.1739332095686D+00, 0.5749861718712D+01, + : 0.3321880082685D-08, 0.1423354800666D+01, 0.6279143387820D+01 / + DATA ((E0(I,J,1),I=1,3),J=391,400) / + : 0.4503173010852D-08, 0.2314972675293D+00, 0.1385561574497D+01, + : 0.4316599090954D-08, 0.1012646782616D+00, 0.4176041334900D+01, + : 0.3283493323850D-08, 0.5233306881265D+01, 0.6287008313071D+01, + : 0.3164033542343D-08, 0.4005597257511D+01, 0.2099539292909D+02, + : 0.4159720956725D-08, 0.5365676242020D+01, 0.5905702259363D+01, + : 0.3565176892217D-08, 0.4284440620612D+01, 0.3932462625300D-02, + : 0.3514440950221D-08, 0.4270562636575D+01, 0.7335344340001D+01, + : 0.3540596871909D-08, 0.5953553201060D+01, 0.1234573916645D+02, + : 0.2960769905118D-08, 0.1115180417718D+01, 0.2670964694522D+02, + : 0.2962213739684D-08, 0.3863811918186D+01, 0.6408777551755D+00 / + DATA ((E0(I,J,1),I=1,3),J=401,410) / + : 0.3883556700251D-08, 0.1268617928302D+01, 0.6660449441528D+01, + : 0.2919225516346D-08, 0.4908605223265D+01, 0.1375773836557D+01, + : 0.3115158863370D-08, 0.3744519976885D+01, 0.3802769619140D-01, + : 0.4099438144212D-08, 0.4173244670532D+01, 0.4480965020977D+02, + : 0.2899531858964D-08, 0.5910601428850D+01, 0.2059724391010D+02, + : 0.3289733429855D-08, 0.2488050078239D+01, 0.1081813534213D+02, + : 0.3933075612875D-08, 0.1122363652883D+01, 0.3773735910827D+00, + : 0.3021403764467D-08, 0.4951973724904D+01, 0.2982630633589D+02, + : 0.2798598949757D-08, 0.5117057845513D+01, 0.1937891852345D+02, + : 0.3397421302707D-08, 0.6104159180476D+01, 0.6923953605621D+01 / + DATA ((E0(I,J,1),I=1,3),J=411,420) / + : 0.3720398002179D-08, 0.1184933429829D+01, 0.3066615496545D+02, + : 0.3598484186267D-08, 0.3505282086105D+01, 0.6147450479709D+01, + : 0.3694594027310D-08, 0.2286651088141D+01, 0.2636725487657D+01, + : 0.2680444152969D-08, 0.1871816775482D+00, 0.6816289982179D+01, + : 0.3497574865641D-08, 0.3143251755431D+01, 0.6418701221183D+01, + : 0.3130274129494D-08, 0.2462167316018D+01, 0.1235996607578D+02, + : 0.3241119069551D-08, 0.4256374004686D+01, 0.1652265972112D+02, + : 0.2601960842061D-08, 0.4970362941425D+01, 0.1045450126711D+02, + : 0.2690601527504D-08, 0.2372657824898D+01, 0.3163918923335D+00, + : 0.2908688152664D-08, 0.4232652627721D+01, 0.2828699048865D+02 / + DATA ((E0(I,J,1),I=1,3),J=421,430) / + : 0.3120456131875D-08, 0.3925747001137D+00, 0.2195415756911D+02, + : 0.3148855423384D-08, 0.3093478330445D+01, 0.1172006883645D+02, + : 0.3051044261017D-08, 0.5560948248212D+01, 0.6055599646783D+01, + : 0.2826006876660D-08, 0.5072790310072D+01, 0.5120601093667D+01, + : 0.3100034191711D-08, 0.4998530231096D+01, 0.1799603123222D+02, + : 0.2398771640101D-08, 0.2561739802176D+01, 0.6255674361143D+01, + : 0.2384002842728D-08, 0.4087420284111D+01, 0.6310477339748D+01, + : 0.2842146517568D-08, 0.2515048217955D+01, 0.5469525544182D+01, + : 0.2847674371340D-08, 0.5235326497443D+01, 0.1034429499989D+02, + : 0.2903722140764D-08, 0.1088200795797D+01, 0.6510552054109D+01 / + DATA ((E0(I,J,1),I=1,3),J=431,440) / + : 0.3187610710605D-08, 0.4710624424816D+01, 0.1693792562116D+03, + : 0.3048869992813D-08, 0.2857975896445D+00, 0.8390110365991D+01, + : 0.2860216950984D-08, 0.2241619020815D+01, 0.2243449970715D+00, + : 0.2701117683113D-08, 0.6651573305272D-01, 0.6129297044991D+01, + : 0.2509891590152D-08, 0.1285135324585D+01, 0.1044027435778D+02, + : 0.2623200252223D-08, 0.2981229834530D+00, 0.6436854655901D+01, + : 0.2622541669202D-08, 0.6122470726189D+01, 0.9380959548977D+01, + : 0.2818435667099D-08, 0.4251087148947D+01, 0.5934151399930D+01, + : 0.2365196797465D-08, 0.3465070460790D+01, 0.2470570524223D+02, + : 0.2358704646143D-08, 0.5791603815350D+01, 0.8671969964381D+01 / + DATA ((E0(I,J,1),I=1,3),J=441,450) / + : 0.2388299481390D-08, 0.4142483772941D+01, 0.7096626156709D+01, + : 0.1996041217224D-08, 0.2101901889496D+01, 0.1727188400790D+02, + : 0.2687593060336D-08, 0.1526689456959D+01, 0.7075506709219D+02, + : 0.2618913670810D-08, 0.2397684236095D+01, 0.6632000300961D+01, + : 0.2571523050364D-08, 0.5751929456787D+00, 0.6206810014183D+01, + : 0.2582135006946D-08, 0.5595464352926D+01, 0.4873985990671D+02, + : 0.2372530190361D-08, 0.5092689490655D+01, 0.1590676413561D+02, + : 0.2357178484712D-08, 0.4444363527851D+01, 0.3097883698531D+01, + : 0.2451590394723D-08, 0.3108251687661D+01, 0.6612329252343D+00, + : 0.2370045949608D-08, 0.2608133861079D+01, 0.3459636466239D+02 / + DATA ((E0(I,J,1),I=1,3),J=451,460) / + : 0.2268997267358D-08, 0.3639717753384D+01, 0.2844914056730D-01, + : 0.1731432137906D-08, 0.1741898445707D+00, 0.2019909489111D+02, + : 0.1629869741622D-08, 0.3902225646724D+01, 0.3035599730800D+02, + : 0.2206215801974D-08, 0.4971131250731D+01, 0.6281667977667D+01, + : 0.2205469554680D-08, 0.1677462357110D+01, 0.6284483723224D+01, + : 0.2148792362509D-08, 0.4236259604006D+01, 0.1980482729015D+02, + : 0.1873733657847D-08, 0.5926814998687D+01, 0.2876692439167D+02, + : 0.2026573758959D-08, 0.4349643351962D+01, 0.2449240616245D+02, + : 0.1807770325110D-08, 0.5700940482701D+01, 0.2045286941806D+02, + : 0.1881174408581D-08, 0.6601286363430D+00, 0.2358125818164D+02 / + DATA ((E0(I,J,1),I=1,3),J=461,470) / + : 0.1368023671690D-08, 0.2211098592752D+01, 0.2473415438279D+02, + : 0.1720017916280D-08, 0.4942488551129D+01, 0.1679593901136D+03, + : 0.1702427665131D-08, 0.1452233856386D+01, 0.3338575901272D+03, + : 0.1414032510054D-08, 0.5525357721439D+01, 0.1624205518357D+03, + : 0.1652626045364D-08, 0.4108794283624D+01, 0.8956999012000D+02, + : 0.1642957769686D-08, 0.7344335209984D+00, 0.5267006960365D+02, + : 0.1614952403624D-08, 0.3541213951363D+01, 0.3332657872986D+02, + : 0.1535988291188D-08, 0.4031094072151D+01, 0.3852657435933D+02, + : 0.1593193738177D-08, 0.4185136203609D+01, 0.2282781046519D+03, + : 0.1074569126382D-08, 0.1720485636868D+01, 0.8397383534231D+02 / + DATA ((E0(I,J,1),I=1,3),J=471,480) / + : 0.1074408214509D-08, 0.2758613420318D+01, 0.8401985929482D+02, + : 0.9700199670465D-09, 0.4216686842097D+01, 0.7826370942180D+02, + : 0.1258433517061D-08, 0.2575068876639D+00, 0.3115650189215D+03, + : 0.1240303229539D-08, 0.4800844956756D+00, 0.1784300471910D+03, + : 0.9018345948127D-09, 0.3896756361552D+00, 0.5886454391678D+02, + : 0.1135301432805D-08, 0.3700805023550D+00, 0.7842370451713D+02, + : 0.9215887951370D-09, 0.4364579276638D+01, 0.1014262087719D+03, + : 0.1055401054147D-08, 0.2156564222111D+01, 0.5660027930059D+02, + : 0.1008725979831D-08, 0.5454015785234D+01, 0.4245678405627D+02, + : 0.7217398104321D-09, 0.1597772562175D+01, 0.2457074661053D+03 / + DATA ((E0(I,J,1),I=1,3),J=481,490) / + : 0.6912033134447D-09, 0.5824090621461D+01, 0.1679936946371D+03, + : 0.6833881523549D-09, 0.3578778482835D+01, 0.6053048899753D+02, + : 0.4887304205142D-09, 0.3724362812423D+01, 0.9656299901946D+02, + : 0.5173709754788D-09, 0.5422427507933D+01, 0.2442876000072D+03, + : 0.4671353097145D-09, 0.2396106924439D+01, 0.1435713242844D+03, + : 0.5652608439480D-09, 0.2804028838685D+01, 0.8365903305582D+02, + : 0.5604061331253D-09, 0.1638816006247D+01, 0.8433466158131D+02, + : 0.4712723365400D-09, 0.8979003224474D+00, 0.3164282286739D+03, + : 0.4909967465112D-09, 0.3210426725516D+01, 0.4059982187939D+03, + : 0.4771358267658D-09, 0.5308027211629D+01, 0.1805255418145D+03 / + DATA ((E0(I,J,1),I=1,3),J=491,500) / + : 0.3943451445989D-09, 0.2195145341074D+01, 0.2568537517081D+03, + : 0.3952109120244D-09, 0.5081189491586D+01, 0.2449975330562D+03, + : 0.3788134594789D-09, 0.4345171264441D+01, 0.1568131045107D+03, + : 0.3738330190479D-09, 0.2613062847997D+01, 0.3948519331910D+03, + : 0.3099866678136D-09, 0.2846760817689D+01, 0.1547176098872D+03, + : 0.2002962716768D-09, 0.4921360989412D+01, 0.2268582385539D+03, + : 0.2198291338754D-09, 0.1130360117454D+00, 0.1658638954901D+03, + : 0.1491958330784D-09, 0.4228195232278D+01, 0.2219950288015D+03, + : 0.1475384076173D-09, 0.3005721811604D+00, 0.3052819430710D+03, + : 0.1661626624624D-09, 0.7830125621203D+00, 0.2526661704812D+03 / + DATA ((E0(I,J,1),I=1,3),J=501,NE0X) / + : 0.9015823460025D-10, 0.3807792942715D+01, 0.4171445043968D+03 / + +* Sun-to-Earth, T^1, X + DATA ((E1(I,J,1),I=1,3),J= 1, 10) / + : 0.1234046326004D-05, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.5150068824701D-06, 0.6002664557501D+01, 0.1256615170089D+02, + : 0.1290743923245D-07, 0.5959437664199D+01, 0.1884922755134D+02, + : 0.1068615564952D-07, 0.2015529654209D+01, 0.6283075850446D+01, + : 0.2079619142538D-08, 0.1732960531432D+01, 0.6279552690824D+01, + : 0.2078009243969D-08, 0.4915604476996D+01, 0.6286599010068D+01, + : 0.6206330058856D-09, 0.3616457953824D+00, 0.4705732307012D+01, + : 0.5989335313746D-09, 0.3802607304474D+01, 0.6256777527156D+01, + : 0.5958495663840D-09, 0.2845866560031D+01, 0.6309374173736D+01, + : 0.4866923261539D-09, 0.5213203771824D+01, 0.7755226100720D+00 / + DATA ((E1(I,J,1),I=1,3),J= 11, 20) / + : 0.4267785823142D-09, 0.4368189727818D+00, 0.1059381944224D+01, + : 0.4610675141648D-09, 0.1837249181372D-01, 0.7860419393880D+01, + : 0.3626989993973D-09, 0.2161590545326D+01, 0.5753384878334D+01, + : 0.3563071194389D-09, 0.1452631954746D+01, 0.5884926831456D+01, + : 0.3557015642807D-09, 0.4470593393054D+01, 0.6812766822558D+01, + : 0.3210412089122D-09, 0.5195926078314D+01, 0.6681224869435D+01, + : 0.2875473577986D-09, 0.5916256610193D+01, 0.2513230340178D+02, + : 0.2842913681629D-09, 0.1149902426047D+01, 0.6127655567643D+01, + : 0.2751248215916D-09, 0.5502088574662D+01, 0.6438496133249D+01, + : 0.2481432881127D-09, 0.2921989846637D+01, 0.5486777812467D+01 / + DATA ((E1(I,J,1),I=1,3),J= 21, 30) / + : 0.2059885976560D-09, 0.3718070376585D+01, 0.7079373888424D+01, + : 0.2015522342591D-09, 0.5979395259740D+01, 0.6290189305114D+01, + : 0.1995364084253D-09, 0.6772087985494D+00, 0.6275962395778D+01, + : 0.1957436436943D-09, 0.2899210654665D+01, 0.5507553240374D+01, + : 0.1651609818948D-09, 0.6228206482192D+01, 0.1150676975667D+02, + : 0.1822980550699D-09, 0.1469348746179D+01, 0.1179062909082D+02, + : 0.1675223159760D-09, 0.3813910555688D+01, 0.7058598460518D+01, + : 0.1706491764745D-09, 0.3004380506684D+00, 0.7113454667900D-02, + : 0.1392952362615D-09, 0.1440393973406D+01, 0.7962980379786D+00, + : 0.1209868266342D-09, 0.4150425791727D+01, 0.4694002934110D+01 / + DATA ((E1(I,J,1),I=1,3),J= 31, 40) / + : 0.1009827202611D-09, 0.3290040429843D+01, 0.3738761453707D+01, + : 0.1047261388602D-09, 0.4229590090227D+01, 0.6282095334605D+01, + : 0.1047006652004D-09, 0.2418967680575D+01, 0.6284056366286D+01, + : 0.9609993143095D-10, 0.4627943659201D+01, 0.6069776770667D+01, + : 0.9590900593873D-10, 0.1894393939924D+01, 0.4136910472696D+01, + : 0.9146249188071D-10, 0.2010647519562D+01, 0.6496374930224D+01, + : 0.8545274480290D-10, 0.5529846956226D-01, 0.1194447056968D+01, + : 0.8224377881194D-10, 0.1254304102174D+01, 0.1589072916335D+01, + : 0.6183529510410D-10, 0.3360862168815D+01, 0.8827390247185D+01, + : 0.6259255147141D-10, 0.4755628243179D+01, 0.8429241228195D+01 / + DATA ((E1(I,J,1),I=1,3),J= 41, 50) / + : 0.5539291694151D-10, 0.5371746955142D+01, 0.4933208510675D+01, + : 0.7328259466314D-10, 0.4927699613906D+00, 0.4535059491685D+01, + : 0.6017835843560D-10, 0.5776682001734D-01, 0.1255903824622D+02, + : 0.7079827775243D-10, 0.4395059432251D+01, 0.5088628793478D+01, + : 0.5170358878213D-10, 0.5154062619954D+01, 0.1176985366291D+02, + : 0.4872301838682D-10, 0.6289611648973D+00, 0.6040347114260D+01, + : 0.5249869411058D-10, 0.5617272046949D+01, 0.3154687086868D+01, + : 0.4716172354411D-10, 0.3965901800877D+01, 0.5331357529664D+01, + : 0.4871214940964D-10, 0.4627507050093D+01, 0.1256967486051D+02, + : 0.4598076850751D-10, 0.6023631226459D+01, 0.6525804586632D+01 / + DATA ((E1(I,J,1),I=1,3),J= 51, 60) / + : 0.4562196089485D-10, 0.4138562084068D+01, 0.3930209696940D+01, + : 0.4325493872224D-10, 0.1330845906564D+01, 0.7632943190217D+01, + : 0.5673781176748D-10, 0.2558752615657D+01, 0.5729506548653D+01, + : 0.3961436642503D-10, 0.2728071734630D+01, 0.7234794171227D+01, + : 0.5101868209058D-10, 0.4113444965144D+01, 0.6836645152238D+01, + : 0.5257043167676D-10, 0.6195089830590D+01, 0.8031092209206D+01, + : 0.5076613989393D-10, 0.2305124132918D+01, 0.7477522907414D+01, + : 0.3342169352778D-10, 0.5415998155071D+01, 0.1097707878456D+02, + : 0.3545881983591D-10, 0.3727160564574D+01, 0.4164311961999D+01, + : 0.3364063738599D-10, 0.2901121049204D+00, 0.1137170464392D+02 / + DATA ((E1(I,J,1),I=1,3),J= 61, 70) / + : 0.3357039670776D-10, 0.1652229354331D+01, 0.5223693906222D+01, + : 0.4307412268687D-10, 0.4938909587445D+01, 0.1592596075957D+01, + : 0.3405769115435D-10, 0.2408890766511D+01, 0.3128388763578D+01, + : 0.3001926198480D-10, 0.4862239006386D+01, 0.1748016358760D+01, + : 0.2778264787325D-10, 0.5241168661353D+01, 0.7342457794669D+01, + : 0.2676159480666D-10, 0.3423593942199D+01, 0.2146165377750D+01, + : 0.2954273399939D-10, 0.1881721265406D+01, 0.5368044267797D+00, + : 0.3309362888795D-10, 0.1931525677349D+01, 0.8018209333619D+00, + : 0.2810283608438D-10, 0.2414659495050D+01, 0.5225775174439D+00, + : 0.3378045637764D-10, 0.4238019163430D+01, 0.1554202828031D+00 / + DATA ((E1(I,J,1),I=1,3),J= 71,NE1X) / + : 0.2558134979840D-10, 0.1828225235805D+01, 0.5230807360890D+01, + : 0.2273755578447D-10, 0.5858184283998D+01, 0.7084896783808D+01, + : 0.2294176037690D-10, 0.4514589779057D+01, 0.1726015463500D+02, + : 0.2533506099435D-10, 0.2355717851551D+01, 0.5216580451554D+01, + : 0.2716685375812D-10, 0.2221003625100D+01, 0.8635942003952D+01, + : 0.2419043435198D-10, 0.5955704951635D+01, 0.4690479774488D+01, + : 0.2521232544812D-10, 0.1395676848521D+01, 0.5481254917084D+01, + : 0.2630195021491D-10, 0.5727468918743D+01, 0.2629832328990D-01, + : 0.2548395840944D-10, 0.2628351859400D-03, 0.1349867339771D+01 / + +* Sun-to-Earth, T^2, X + DATA ((E2(I,J,1),I=1,3),J= 1,NE2X) / + : -0.4143818297913D-10, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.2171497694435D-10, 0.4398225628264D+01, 0.1256615170089D+02, + : 0.9845398442516D-11, 0.2079720838384D+00, 0.6283075850446D+01, + : 0.9256833552682D-12, 0.4191264694361D+01, 0.1884922755134D+02, + : 0.1022049384115D-12, 0.5381133195658D+01, 0.8399684731857D+02 / + +* Sun-to-Earth, T^0, Y + DATA ((E0(I,J,2),I=1,3),J= 1, 10) / + : 0.9998921098898D+00, 0.1826583913846D+00, 0.6283075850446D+01, + : -0.2442700893735D-01, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.8352929742915D-02, 0.1395277998680D+00, 0.1256615170089D+02, + : 0.1046697300177D-03, 0.9641423109763D-01, 0.1884922755134D+02, + : 0.3110841876663D-04, 0.5381140401712D+01, 0.8399684731857D+02, + : 0.2570269094593D-04, 0.5301016407128D+01, 0.5296909721118D+00, + : 0.2147389623610D-04, 0.2662510869850D+01, 0.1577343543434D+01, + : 0.1680344384050D-04, 0.5207904119704D+01, 0.6279552690824D+01, + : 0.1679117312193D-04, 0.4582187486968D+01, 0.6286599010068D+01, + : 0.1440512068440D-04, 0.1900688517726D+01, 0.2352866153506D+01 / + DATA ((E0(I,J,2),I=1,3),J= 11, 20) / + : 0.1135139664999D-04, 0.5273108538556D+01, 0.5223693906222D+01, + : 0.9345482571018D-05, 0.4503047687738D+01, 0.1203646072878D+02, + : 0.9007418719568D-05, 0.1605621059637D+01, 0.1021328554739D+02, + : 0.5671536712314D-05, 0.5812849070861D+00, 0.1059381944224D+01, + : 0.7451401861666D-05, 0.2807346794836D+01, 0.3981490189893D+00, + : 0.6393470057114D-05, 0.6029224133855D+01, 0.5753384878334D+01, + : 0.6814275881697D-05, 0.6472990145974D+00, 0.4705732307012D+01, + : 0.6113705628887D-05, 0.3813843419700D+01, 0.6812766822558D+01, + : 0.4503851367273D-05, 0.4527804370996D+01, 0.5884926831456D+01, + : 0.4522249141926D-05, 0.5991783029224D+01, 0.6256777527156D+01 / + DATA ((E0(I,J,2),I=1,3),J= 21, 30) / + : 0.4501794307018D-05, 0.3798703844397D+01, 0.6309374173736D+01, + : 0.5514927480180D-05, 0.3961257833388D+01, 0.5507553240374D+01, + : 0.4062862799995D-05, 0.5256247296369D+01, 0.6681224869435D+01, + : 0.5414900429712D-05, 0.5499032014097D+01, 0.7755226100720D+00, + : 0.5463153987424D-05, 0.6173092454097D+01, 0.1414349524433D+02, + : 0.5071611859329D-05, 0.2870244247651D+01, 0.7860419393880D+01, + : 0.2195112094455D-05, 0.2952338617201D+01, 0.1150676975667D+02, + : 0.2279139233919D-05, 0.5951775132933D+01, 0.7058598460518D+01, + : 0.2278386100876D-05, 0.4845456398785D+01, 0.4694002934110D+01, + : 0.2559088003308D-05, 0.6945321117311D+00, 0.1216800268190D+02 / + DATA ((E0(I,J,2),I=1,3),J= 31, 40) / + : 0.2561079286856D-05, 0.6167224608301D+01, 0.7099330490126D+00, + : 0.1792755796387D-05, 0.1400122509632D+01, 0.7962980379786D+00, + : 0.1818715656502D-05, 0.4703347611830D+01, 0.6283142985870D+01, + : 0.1818744924791D-05, 0.5086748900237D+01, 0.6283008715021D+01, + : 0.1554518791390D-05, 0.5331008042713D-01, 0.2513230340178D+02, + : 0.2063265737239D-05, 0.4283680484178D+01, 0.1179062909082D+02, + : 0.1497613520041D-05, 0.6074207826073D+01, 0.5486777812467D+01, + : 0.2000617940427D-05, 0.2501426281450D+01, 0.1778984560711D+02, + : 0.1289731195580D-05, 0.3646340599536D+01, 0.7079373888424D+01, + : 0.1282657998934D-05, 0.3232864804902D+01, 0.3738761453707D+01 / + DATA ((E0(I,J,2),I=1,3),J= 41, 50) / + : 0.1528915968658D-05, 0.5581433416669D+01, 0.2132990797783D+00, + : 0.1187304098432D-05, 0.5453576453694D+01, 0.9437762937313D+01, + : 0.7842782928118D-06, 0.2823953922273D+00, 0.8827390247185D+01, + : 0.7352892280868D-06, 0.1124369580175D+01, 0.1589072916335D+01, + : 0.6570189360797D-06, 0.2089154042840D+01, 0.1176985366291D+02, + : 0.6324967590410D-06, 0.6704855581230D+00, 0.6262300422539D+01, + : 0.6298289872283D-06, 0.2836414855840D+01, 0.6303851278352D+01, + : 0.6476686465855D-06, 0.4852433866467D+00, 0.7113454667900D-02, + : 0.8587034651234D-06, 0.1453511005668D+01, 0.1672837615881D+03, + : 0.8068948788113D-06, 0.9224087798609D+00, 0.6069776770667D+01 / + DATA ((E0(I,J,2),I=1,3),J= 51, 60) / + : 0.8353786011661D-06, 0.4631707184895D+01, 0.3340612434717D+01, + : 0.6009324532132D-06, 0.1829498827726D+01, 0.4136910472696D+01, + : 0.7558158559566D-06, 0.2588596800317D+01, 0.6496374930224D+01, + : 0.5809279504503D-06, 0.5516818853476D+00, 0.1097707878456D+02, + : 0.5374131950254D-06, 0.6275674734960D+01, 0.1194447056968D+01, + : 0.5711160507326D-06, 0.1091905956872D+01, 0.6282095334605D+01, + : 0.5710183170746D-06, 0.2415001635090D+01, 0.6284056366286D+01, + : 0.5144373590610D-06, 0.6020336443438D+01, 0.6290189305114D+01, + : 0.5103108927267D-06, 0.3775634564605D+01, 0.6275962395778D+01, + : 0.4960654697891D-06, 0.1073450946756D+01, 0.6127655567643D+01 / + DATA ((E0(I,J,2),I=1,3),J= 61, 70) / + : 0.4786385689280D-06, 0.2431178012310D+01, 0.6438496133249D+01, + : 0.6109911263665D-06, 0.5343356157914D+01, 0.3154687086868D+01, + : 0.4839898944024D-06, 0.5830833594047D-01, 0.8018209333619D+00, + : 0.4734822623919D-06, 0.4536080134821D+01, 0.3128388763578D+01, + : 0.4834741473290D-06, 0.2585090489754D+00, 0.7084896783808D+01, + : 0.5134858581156D-06, 0.4213317172603D+01, 0.1235285262111D+02, + : 0.5064004264978D-06, 0.4814418806478D+00, 0.1185621865188D+02, + : 0.3753476772761D-06, 0.1599953399788D+01, 0.8429241228195D+01, + : 0.4935264014283D-06, 0.2157417556873D+01, 0.2544314396739D+01, + : 0.3950929600897D-06, 0.3359394184254D+01, 0.5481254917084D+01 / + DATA ((E0(I,J,2),I=1,3),J= 71, 80) / + : 0.4895849789777D-06, 0.5165704376558D+01, 0.9225539266174D+01, + : 0.4215241688886D-06, 0.2065368800993D+01, 0.1726015463500D+02, + : 0.3796773731132D-06, 0.1468606346612D+01, 0.4265981595566D+00, + : 0.3114178142515D-06, 0.3615638079474D+01, 0.2146165377750D+01, + : 0.3260664220838D-06, 0.4417134922435D+01, 0.4164311961999D+01, + : 0.3976996123008D-06, 0.4700866883004D+01, 0.5856477690889D+01, + : 0.2801459672924D-06, 0.4538902060922D+01, 0.1256967486051D+02, + : 0.3638931868861D-06, 0.1334197991475D+01, 0.1807370494127D+02, + : 0.2487013269476D-06, 0.3749275558275D+01, 0.2629832328990D-01, + : 0.3034165481994D-06, 0.4236622030873D+00, 0.4535059491685D+01 / + DATA ((E0(I,J,2),I=1,3),J= 81, 90) / + : 0.2676278825586D-06, 0.5970848007811D+01, 0.3930209696940D+01, + : 0.2764903818918D-06, 0.5194636754501D+01, 0.1256262854127D+02, + : 0.2485149930507D-06, 0.1002434207846D+01, 0.5088628793478D+01, + : 0.2199305540941D-06, 0.3066773098403D+01, 0.1255903824622D+02, + : 0.2571106500435D-06, 0.7588312459063D+00, 0.1336797263425D+02, + : 0.2049751817158D-06, 0.3444977434856D+01, 0.1137170464392D+02, + : 0.2599707296297D-06, 0.1873128542205D+01, 0.7143069561767D+02, + : 0.1785018072217D-06, 0.5015891306615D+01, 0.1748016358760D+01, + : 0.2324833891115D-06, 0.4618271239730D+01, 0.1831953657923D+02, + : 0.1709711119545D-06, 0.5300003455669D+01, 0.4933208510675D+01 / + DATA ((E0(I,J,2),I=1,3),J= 91,100) / + : 0.2107159351716D-06, 0.2229819815115D+01, 0.7477522907414D+01, + : 0.1750333080295D-06, 0.6161485880008D+01, 0.1044738781244D+02, + : 0.2000598210339D-06, 0.2967357299999D+01, 0.8031092209206D+01, + : 0.1380920248681D-06, 0.3027007923917D+01, 0.8635942003952D+01, + : 0.1412460470299D-06, 0.6037597163798D+01, 0.2942463415728D+01, + : 0.1888459803001D-06, 0.8561476243374D+00, 0.1561374759853D+03, + : 0.1788370542585D-06, 0.4869736290209D+01, 0.1592596075957D+01, + : 0.1360893296167D-06, 0.3626411886436D+01, 0.1309584267300D+02, + : 0.1506846530160D-06, 0.1550975377427D+01, 0.1649636139783D+02, + : 0.1800913376176D-06, 0.2075826033190D+01, 0.1729818233119D+02 / + DATA ((E0(I,J,2),I=1,3),J=101,110) / + : 0.1436261390649D-06, 0.6148876420255D+01, 0.2042657109477D+02, + : 0.1220227114151D-06, 0.4382583879906D+01, 0.7632943190217D+01, + : 0.1337883603592D-06, 0.2036644327361D+01, 0.1213955354133D+02, + : 0.1159326650738D-06, 0.3892276994687D+01, 0.5331357529664D+01, + : 0.1352853128569D-06, 0.1447950649744D+01, 0.1673046366289D+02, + : 0.1433408296083D-06, 0.4457854692961D+01, 0.7342457794669D+01, + : 0.1234701666518D-06, 0.1538818147151D+01, 0.6279485555400D+01, + : 0.1234027192007D-06, 0.1968523220760D+01, 0.6286666145492D+01, + : 0.1244024091797D-06, 0.5779803499985D+01, 0.1511046609763D+02, + : 0.1097934945516D-06, 0.6210975221388D+00, 0.1098880815746D+02 / + DATA ((E0(I,J,2),I=1,3),J=111,120) / + : 0.1254611329856D-06, 0.2591963807998D+01, 0.1572083878776D+02, + : 0.1158247286784D-06, 0.2483612812670D+01, 0.5729506548653D+01, + : 0.9039078252960D-07, 0.3857554579796D+01, 0.9623688285163D+01, + : 0.9108024978836D-07, 0.5826368512984D+01, 0.7234794171227D+01, + : 0.8887068108436D-07, 0.3475694573987D+01, 0.6148010737701D+01, + : 0.8632374035438D-07, 0.3059070488983D-01, 0.6418140963190D+01, + : 0.7893186992967D-07, 0.1583194837728D+01, 0.2118763888447D+01, + : 0.8297650201172D-07, 0.8519770534637D+00, 0.1471231707864D+02, + : 0.1019759578988D-06, 0.1319598738732D+00, 0.1349867339771D+01, + : 0.1010037696236D-06, 0.9937860115618D+00, 0.6836645152238D+01 / + DATA ((E0(I,J,2),I=1,3),J=121,130) / + : 0.1047727548266D-06, 0.1382138405399D+01, 0.5999216516294D+01, + : 0.7351993881086D-07, 0.3833397851735D+01, 0.6040347114260D+01, + : 0.9868771092341D-07, 0.2124913814390D+01, 0.6566935184597D+01, + : 0.7007321959390D-07, 0.5946305343763D+01, 0.6525804586632D+01, + : 0.6861411679709D-07, 0.4574654977089D+01, 0.7238675589263D+01, + : 0.7554519809614D-07, 0.5949232686844D+01, 0.1253985337760D+02, + : 0.9541880448335D-07, 0.3495242990564D+01, 0.2122839202813D+02, + : 0.7185606722155D-07, 0.4310113471661D+01, 0.6245048154254D+01, + : 0.7131360871710D-07, 0.5480309323650D+01, 0.6321103546637D+01, + : 0.6651142021039D-07, 0.5411097713654D+01, 0.5327476111629D+01 / + DATA ((E0(I,J,2),I=1,3),J=131,140) / + : 0.8538618213667D-07, 0.1827849973951D+01, 0.1101510648075D+02, + : 0.8634954288044D-07, 0.5443584943349D+01, 0.5643178611111D+01, + : 0.7449415051484D-07, 0.2011535459060D+01, 0.5368044267797D+00, + : 0.7421047599169D-07, 0.3464562529249D+01, 0.2354323048545D+02, + : 0.6140694354424D-07, 0.5657556228815D+01, 0.1296430071988D+02, + : 0.6353525143033D-07, 0.3463816593821D+01, 0.1990745094947D+01, + : 0.6221964013447D-07, 0.1532259498697D+01, 0.9517183207817D+00, + : 0.5852480257244D-07, 0.1375396598875D+01, 0.9555997388169D+00, + : 0.6398637498911D-07, 0.2405645801972D+01, 0.2407292145756D+02, + : 0.7039744069878D-07, 0.5397541799027D+01, 0.5225775174439D+00 / + DATA ((E0(I,J,2),I=1,3),J=141,150) / + : 0.6977997694382D-07, 0.4762347105419D+01, 0.1097355562493D+02, + : 0.7460629558396D-07, 0.2711944692164D+01, 0.2200391463820D+02, + : 0.5376577536101D-07, 0.2352980430239D+01, 0.1431416805965D+02, + : 0.7530607893556D-07, 0.1943940180699D+01, 0.1842262939178D+02, + : 0.6822928971605D-07, 0.4337651846959D+01, 0.1554202828031D+00, + : 0.6220772380094D-07, 0.6716871369278D+00, 0.1845107853235D+02, + : 0.6586950799043D-07, 0.2229714460505D+01, 0.5216580451554D+01, + : 0.5873800565771D-07, 0.7627013920580D+00, 0.6398972393349D+00, + : 0.6264346929745D-07, 0.6202785478961D+00, 0.6277552955062D+01, + : 0.6257929115669D-07, 0.2886775596668D+01, 0.6288598745829D+01 / + DATA ((E0(I,J,2),I=1,3),J=151,160) / + : 0.5343536033409D-07, 0.1977241012051D+01, 0.4690479774488D+01, + : 0.5587849781714D-07, 0.1922923484825D+01, 0.1551045220144D+01, + : 0.6905100845603D-07, 0.3570757164631D+01, 0.1030928125552D+00, + : 0.6178957066649D-07, 0.5197558947765D+01, 0.5230807360890D+01, + : 0.6187270224331D-07, 0.8193497368922D+00, 0.5650292065779D+01, + : 0.5385664291426D-07, 0.5406336665586D+01, 0.7771377146812D+02, + : 0.6329363917926D-07, 0.2837760654536D+01, 0.2608790314060D+02, + : 0.4546018761604D-07, 0.2933580297050D+01, 0.5535693017924D+00, + : 0.6196091049375D-07, 0.4157871494377D+01, 0.8467247584405D+02, + : 0.6159555108218D-07, 0.3211703561703D+01, 0.2394243902548D+03 / + DATA ((E0(I,J,2),I=1,3),J=161,170) / + : 0.4995340539317D-07, 0.1459098102922D+01, 0.4732030630302D+01, + : 0.5457031243572D-07, 0.1430457676136D+01, 0.6179983037890D+01, + : 0.4863461418397D-07, 0.2196425916730D+01, 0.9027992316901D+02, + : 0.5342947626870D-07, 0.2086612890268D+01, 0.6386168663001D+01, + : 0.5674296648439D-07, 0.2760204966535D+01, 0.6915859635113D+01, + : 0.4745783120161D-07, 0.4245368971862D+01, 0.6282970628506D+01, + : 0.4745676961198D-07, 0.5544725787016D+01, 0.6283181072386D+01, + : 0.4049796869973D-07, 0.2213984363586D+01, 0.6254626709878D+01, + : 0.4248333596940D-07, 0.8075781952896D+00, 0.7875671926403D+01, + : 0.4027178070205D-07, 0.1293268540378D+01, 0.6311524991013D+01 / + DATA ((E0(I,J,2),I=1,3),J=171,180) / + : 0.4066543943476D-07, 0.3986141175804D+01, 0.3634620989887D+01, + : 0.4858863787880D-07, 0.1276112738231D+01, 0.5760498333002D+01, + : 0.5277398263530D-07, 0.4916111741527D+01, 0.2515860172507D+02, + : 0.4105635656559D-07, 0.1725805864426D+01, 0.6709674010002D+01, + : 0.4376781925772D-07, 0.2243642442106D+01, 0.6805653367890D+01, + : 0.3235827894693D-07, 0.3614135118271D+01, 0.1066495398892D+01, + : 0.3073244740308D-07, 0.2460873393460D+01, 0.5863591145557D+01, + : 0.3088609271373D-07, 0.5678431771790D+01, 0.9917696840332D+01, + : 0.3393022279836D-07, 0.3814017477291D+01, 0.1391601904066D+02, + : 0.3038686508802D-07, 0.4660216229171D+01, 0.1256621883632D+02 / + DATA ((E0(I,J,2),I=1,3),J=181,190) / + : 0.4019677752497D-07, 0.5906906243735D+01, 0.1334167431096D+02, + : 0.3288834998232D-07, 0.9536146445882D+00, 0.1620077269078D+02, + : 0.3889973794631D-07, 0.3942205097644D+01, 0.7478166569050D-01, + : 0.3050438987141D-07, 0.1624810271286D+01, 0.1805292951336D+02, + : 0.3601142564638D-07, 0.4030467142575D+01, 0.6208294184755D+01, + : 0.3689015557141D-07, 0.3648878818694D+01, 0.5966683958112D+01, + : 0.3563471893565D-07, 0.5749584017096D+01, 0.6357857516136D+01, + : 0.2776183170667D-07, 0.2630124187070D+01, 0.3523159621801D-02, + : 0.2922350530341D-07, 0.1790346403629D+01, 0.1272157198369D+02, + : 0.3511076917302D-07, 0.6142198301611D+01, 0.6599467742779D+01 / + DATA ((E0(I,J,2),I=1,3),J=191,200) / + : 0.3619351007632D-07, 0.1432421386492D+01, 0.6019991944201D+01, + : 0.2561254711098D-07, 0.2302822475792D+01, 0.1259245002418D+02, + : 0.2626903942920D-07, 0.8660470994571D+00, 0.6702560555334D+01, + : 0.2550187397083D-07, 0.6069721995383D+01, 0.1057540660594D+02, + : 0.2535873526138D-07, 0.1079020331795D-01, 0.3141537925223D+02, + : 0.3519786153847D-07, 0.3809066902283D+01, 0.2505706758577D+03, + : 0.3424651492873D-07, 0.2075435114417D+01, 0.6546159756691D+01, + : 0.2372676630861D-07, 0.2057803120154D+01, 0.2388894113936D+01, + : 0.2710980779541D-07, 0.1510068488010D+01, 0.1202934727411D+02, + : 0.3038710889704D-07, 0.5043617528901D+01, 0.1256608456547D+02 / + DATA ((E0(I,J,2),I=1,3),J=201,210) / + : 0.2220364130585D-07, 0.3694793218205D+01, 0.1336244973887D+02, + : 0.3025880825460D-07, 0.5450618999049D-01, 0.2908881142201D+02, + : 0.2784493486864D-07, 0.3381164084502D+01, 0.1494531617769D+02, + : 0.2294414142438D-07, 0.4382309025210D+01, 0.6076890225335D+01, + : 0.2012723294724D-07, 0.9142212256518D+00, 0.6262720680387D+01, + : 0.2036357831958D-07, 0.5676172293154D+01, 0.4701116388778D+01, + : 0.2003474823288D-07, 0.2592767977625D+01, 0.6303431020504D+01, + : 0.2207144900109D-07, 0.5404976271180D+01, 0.6489261475556D+01, + : 0.2481664905135D-07, 0.4373284587027D+01, 0.1204357418345D+02, + : 0.2674949182295D-07, 0.5859182188482D+01, 0.4590910121555D+01 / + DATA ((E0(I,J,2),I=1,3),J=211,220) / + : 0.2450554720322D-07, 0.4555381557451D+01, 0.1495633313810D+00, + : 0.2601975986457D-07, 0.3933165584959D+01, 0.1965104848470D+02, + : 0.2199860022848D-07, 0.5227977189087D+01, 0.1351787002167D+02, + : 0.2448121172316D-07, 0.4858060353949D+01, 0.1162474756779D+01, + : 0.1876014864049D-07, 0.5690546553605D+01, 0.6279194432410D+01, + : 0.1874513219396D-07, 0.4099539297446D+01, 0.6286957268481D+01, + : 0.2156380842559D-07, 0.4382594769913D+00, 0.1813929450232D+02, + : 0.1981691240061D-07, 0.1829784152444D+01, 0.4686889479442D+01, + : 0.2329992648539D-07, 0.2836254278973D+01, 0.1002183730415D+02, + : 0.1765184135302D-07, 0.2803494925833D+01, 0.4292330755499D+01 / + DATA ((E0(I,J,2),I=1,3),J=221,230) / + : 0.2436368366085D-07, 0.2836897959677D+01, 0.9514313292143D+02, + : 0.2164089203889D-07, 0.6127522446024D+01, 0.6037244212485D+01, + : 0.1847755034221D-07, 0.3683163635008D+01, 0.2427287361862D+00, + : 0.1674798769966D-07, 0.3316993867246D+00, 0.1311972100268D+02, + : 0.2222542124356D-07, 0.8294097805480D+00, 0.1266924451345D+02, + : 0.2071074505925D-07, 0.3659492220261D+01, 0.6528907488406D+01, + : 0.1608224471835D-07, 0.4774492067182D+01, 0.1352175143971D+02, + : 0.1857583439071D-07, 0.2873120597682D+01, 0.8662240327241D+01, + : 0.1793018836159D-07, 0.5282441177929D+00, 0.6819880277225D+01, + : 0.1575391221692D-07, 0.1320789654258D+01, 0.1102062672231D+00 / + DATA ((E0(I,J,2),I=1,3),J=231,240) / + : 0.1840132009557D-07, 0.1917110916256D+01, 0.6514761976723D+02, + : 0.1760917288281D-07, 0.2972635937132D+01, 0.5746271423666D+01, + : 0.1561779518516D-07, 0.4372569261981D+01, 0.6272439236156D+01, + : 0.1558687885205D-07, 0.5416424926425D+01, 0.6293712464735D+01, + : 0.1951359382579D-07, 0.3094448898752D+01, 0.2301353951334D+02, + : 0.1569144275614D-07, 0.2802103689808D+01, 0.1765478049437D+02, + : 0.1479130389462D-07, 0.2136435020467D+01, 0.2077542790660D-01, + : 0.1467828510764D-07, 0.7072627435674D+00, 0.1052268489556D+01, + : 0.1627627337440D-07, 0.3947607143237D+01, 0.6327837846670D+00, + : 0.1503498479758D-07, 0.4079248909190D+01, 0.7626583626240D-01 / + DATA ((E0(I,J,2),I=1,3),J=241,250) / + : 0.1297967708237D-07, 0.6269637122840D+01, 0.1149965630200D+02, + : 0.1374416896634D-07, 0.4175657970702D+01, 0.6016468784579D+01, + : 0.1783812325219D-07, 0.1476540547560D+01, 0.3301902111895D+02, + : 0.1525884228756D-07, 0.4653477715241D+01, 0.9411464614024D+01, + : 0.1451067396763D-07, 0.2573001128225D+01, 0.1277945078067D+02, + : 0.1297713111950D-07, 0.5612799618771D+01, 0.6549682916313D+01, + : 0.1462784012820D-07, 0.4189661623870D+01, 0.1863592847156D+02, + : 0.1384185980007D-07, 0.2656915472196D+01, 0.2379164476796D+01, + : 0.1221497599801D-07, 0.5612515760138D+01, 0.1257326515556D+02, + : 0.1560574525896D-07, 0.4783414317919D+01, 0.1887552587463D+02 / + DATA ((E0(I,J,2),I=1,3),J=251,260) / + : 0.1544598372036D-07, 0.2694431138063D+01, 0.1820933031200D+02, + : 0.1531678928696D-07, 0.4105103489666D+01, 0.2593412433514D+02, + : 0.1349321503795D-07, 0.3082437194015D+00, 0.5120601093667D+01, + : 0.1252030290917D-07, 0.6124072334087D+01, 0.6993008899458D+01, + : 0.1459243816687D-07, 0.3733103981697D+01, 0.3813291813120D-01, + : 0.1226103625262D-07, 0.1267127706817D+01, 0.2435678079171D+02, + : 0.1019449641504D-07, 0.4367790112269D+01, 0.1725663147538D+02, + : 0.1380789433607D-07, 0.3387201768700D+01, 0.2458316379602D+00, + : 0.1019453421658D-07, 0.9204143073737D+00, 0.6112403035119D+01, + : 0.1297929434405D-07, 0.5786874896426D+01, 0.1249137003520D+02 / + DATA ((E0(I,J,2),I=1,3),J=261,270) / + : 0.9912677786097D-08, 0.3164232870746D+01, 0.6247047890016D+01, + : 0.9829386098599D-08, 0.2586762413351D+01, 0.6453748665772D+01, + : 0.1226807746104D-07, 0.6239068436607D+01, 0.5429879531333D+01, + : 0.1192691755997D-07, 0.1867380051424D+01, 0.6290122169689D+01, + : 0.9836499227081D-08, 0.3424716293727D+00, 0.6319103810876D+01, + : 0.9642862564285D-08, 0.5661372990657D+01, 0.8273820945392D+01, + : 0.1165184404862D-07, 0.5768367239093D+01, 0.1778273215245D+02, + : 0.1175794418818D-07, 0.1657351222943D+01, 0.6276029531202D+01, + : 0.1018948635601D-07, 0.6458292350865D+00, 0.1254537627298D+02, + : 0.9500383606676D-08, 0.1054306140741D+01, 0.1256517118505D+02 / + DATA ((E0(I,J,2),I=1,3),J=271,280) / + : 0.1227512202906D-07, 0.2505278379114D+01, 0.2248384854122D+02, + : 0.9664792009993D-08, 0.4289737277000D+01, 0.6259197520765D+01, + : 0.9613285666331D-08, 0.5500597673141D+01, 0.6306954180126D+01, + : 0.1117906736211D-07, 0.2361405953468D+01, 0.1779695906178D+02, + : 0.9611378640782D-08, 0.2851310576269D+01, 0.2061856251104D+00, + : 0.8845354852370D-08, 0.6208777705343D+01, 0.1692165728891D+01, + : 0.1054046966600D-07, 0.5413091423934D+01, 0.2204125344462D+00, + : 0.1215539124483D-07, 0.5613969479755D+01, 0.8257698122054D+02, + : 0.9932460955209D-08, 0.1106124877015D+01, 0.1017725758696D+02, + : 0.8785804715043D-08, 0.2869224476477D+01, 0.9491756770005D+00 / + DATA ((E0(I,J,2),I=1,3),J=281,290) / + : 0.8538084097562D-08, 0.6159640899344D+01, 0.6393282117669D+01, + : 0.8648994369529D-08, 0.1374901198784D+01, 0.4804209201333D+01, + : 0.1039063219067D-07, 0.5171080641327D+01, 0.1550861511662D+02, + : 0.8867983926439D-08, 0.8317320304902D+00, 0.3903911373650D+01, + : 0.8327495955244D-08, 0.3605591969180D+01, 0.6172869583223D+01, + : 0.9243088356133D-08, 0.6114299196843D+01, 0.6267823317922D+01, + : 0.9205657357835D-08, 0.3675153683737D+01, 0.6298328382969D+01, + : 0.1033269714606D-07, 0.3313328813024D+01, 0.5573142801433D+01, + : 0.8001706275552D-08, 0.2019980960053D+01, 0.2648454860559D+01, + : 0.9171858254191D-08, 0.8992015524177D+00, 0.1498544001348D+03 / + DATA ((E0(I,J,2),I=1,3),J=291,300) / + : 0.1075327150242D-07, 0.2898669963648D+01, 0.3694923081589D+02, + : 0.9884866689828D-08, 0.4946715904478D+01, 0.1140367694411D+02, + : 0.9541835576677D-08, 0.2371787888469D+01, 0.1256713221673D+02, + : 0.7739903376237D-08, 0.2213775190612D+01, 0.7834121070590D+01, + : 0.7311962684106D-08, 0.3429378787739D+01, 0.1192625446156D+02, + : 0.9724904869624D-08, 0.6195878564404D+01, 0.2280573557157D+02, + : 0.9251628983612D-08, 0.6511509527390D+00, 0.2787043132925D+01, + : 0.7320763787842D-08, 0.6001083639421D+01, 0.6282655592598D+01, + : 0.7320296650962D-08, 0.3789073265087D+01, 0.6283496108294D+01, + : 0.7947032271039D-08, 0.1059659582204D+01, 0.1241073141809D+02 / + DATA ((E0(I,J,2),I=1,3),J=301,310) / + : 0.9005277053115D-08, 0.1280315624361D+01, 0.6281591679874D+01, + : 0.8995601652048D-08, 0.2224439106766D+01, 0.6284560021018D+01, + : 0.8288040568796D-08, 0.5234914433867D+01, 0.1241658836951D+02, + : 0.6359381347255D-08, 0.4137989441490D+01, 0.1596186371003D+01, + : 0.8699572228626D-08, 0.1758411009497D+01, 0.6133512519065D+01, + : 0.6456797542736D-08, 0.5919285089994D+01, 0.1685848245639D+02, + : 0.7424573475452D-08, 0.5414616938827D+01, 0.4061219149443D+01, + : 0.7235671196168D-08, 0.1496516557134D+01, 0.1610006857377D+03, + : 0.8104015182733D-08, 0.1919918242764D+01, 0.8460828644453D+00, + : 0.8098576535937D-08, 0.3819615855458D+01, 0.3894181736510D+01 / + DATA ((E0(I,J,2),I=1,3),J=311,320) / + : 0.6275292346625D-08, 0.6244264115141D+01, 0.8531963191132D+00, + : 0.6052432989112D-08, 0.5037731872610D+00, 0.1567108171867D+02, + : 0.5705651535817D-08, 0.2984557271995D+01, 0.1258692712880D+02, + : 0.5789650115138D-08, 0.6087038140697D+01, 0.1193336791622D+02, + : 0.5512132153377D-08, 0.5855668994076D+01, 0.1232342296471D+02, + : 0.7388890819102D-08, 0.2443128574740D+01, 0.4907302013889D+01, + : 0.5467593991798D-08, 0.3017561234194D+01, 0.1884211409667D+02, + : 0.6388519802999D-08, 0.5887386712935D+01, 0.5217580628120D+02, + : 0.6106777149944D-08, 0.3483461059895D+00, 0.1422690933580D-01, + : 0.7383420275489D-08, 0.5417387056707D+01, 0.2358125818164D+02 / + DATA ((E0(I,J,2),I=1,3),J=321,330) / + : 0.5505208141738D-08, 0.2848193644783D+01, 0.1151388321134D+02, + : 0.6310757462877D-08, 0.2349882520828D+01, 0.1041998632314D+02, + : 0.6166904929691D-08, 0.5728575944077D+00, 0.6151533897323D+01, + : 0.5263442042754D-08, 0.4495796125937D+01, 0.1885275071096D+02, + : 0.5591828082629D-08, 0.1355441967677D+01, 0.4337116142245D+00, + : 0.5397051680497D-08, 0.1673422864307D+01, 0.6286362197481D+01, + : 0.5396992745159D-08, 0.1833502206373D+01, 0.6279789503410D+01, + : 0.6572913000726D-08, 0.3331122065824D+01, 0.1176433076753D+02, + : 0.5123421866413D-08, 0.2165327142679D+01, 0.1245594543367D+02, + : 0.5930495725999D-08, 0.2931146089284D+01, 0.6414617803568D+01 / + DATA ((E0(I,J,2),I=1,3),J=331,340) / + : 0.6431797403933D-08, 0.4134407994088D+01, 0.1350651127443D+00, + : 0.5003182207604D-08, 0.3805420303749D+01, 0.1096996532989D+02, + : 0.5587731032504D-08, 0.1082469260599D+01, 0.6062663316000D+01, + : 0.5935263407816D-08, 0.8384333678401D+00, 0.5326786718777D+01, + : 0.4756019827760D-08, 0.3552588749309D+01, 0.3104930017775D+01, + : 0.6599951172637D-08, 0.4320826409528D+01, 0.4087944051283D+02, + : 0.5902606868464D-08, 0.4811879454445D+01, 0.5849364236221D+01, + : 0.5921147809031D-08, 0.9942628922396D-01, 0.1581959461667D+01, + : 0.5505382581266D-08, 0.2466557607764D+01, 0.6503488384892D+01, + : 0.5353771071862D-08, 0.4551978748683D+01, 0.1735668374386D+03 / + DATA ((E0(I,J,2),I=1,3),J=341,350) / + : 0.5063282210946D-08, 0.5710812312425D+01, 0.1248988586463D+02, + : 0.5926120403383D-08, 0.1333998428358D+01, 0.2673594526851D+02, + : 0.5211016176149D-08, 0.4649315360760D+01, 0.2460261242967D+02, + : 0.5347075084894D-08, 0.5512754081205D+01, 0.4171425416666D+01, + : 0.4872609773574D-08, 0.1308025299938D+01, 0.5333900173445D+01, + : 0.4727711321420D-08, 0.2144908368062D+01, 0.7232251527446D+01, + : 0.6029426018652D-08, 0.5567259412084D+01, 0.3227113045244D+03, + : 0.4321485284369D-08, 0.5230667156451D+01, 0.9388005868221D+01, + : 0.4476406760553D-08, 0.6134081115303D+01, 0.5547199253223D+01, + : 0.5835268277420D-08, 0.4783808492071D+01, 0.7285056171570D+02 / + DATA ((E0(I,J,2),I=1,3),J=351,360) / + : 0.5172183602748D-08, 0.5161817911099D+01, 0.1884570439172D+02, + : 0.5693571465184D-08, 0.1381646203111D+01, 0.9723862754494D+02, + : 0.4060634965349D-08, 0.3876705259495D+00, 0.4274518229222D+01, + : 0.3967398770473D-08, 0.5029491776223D+01, 0.3496032717521D+01, + : 0.3943754005255D-08, 0.1923162955490D+01, 0.6244942932314D+01, + : 0.4781323427824D-08, 0.4633332586423D+01, 0.2929661536378D+02, + : 0.3871483781204D-08, 0.1616650009743D+01, 0.6321208768577D+01, + : 0.5141741733997D-08, 0.9817316704659D-01, 0.1232032006293D+02, + : 0.4002385978497D-08, 0.3656161212139D+01, 0.7018952447668D+01, + : 0.4901092604097D-08, 0.4404098713092D+01, 0.1478866649112D+01 / + DATA ((E0(I,J,2),I=1,3),J=361,370) / + : 0.3740932630345D-08, 0.5181188732639D+00, 0.6922973089781D+01, + : 0.4387283718538D-08, 0.3254859566869D+01, 0.2331413144044D+03, + : 0.5019197802033D-08, 0.3086773224677D+01, 0.1715706182245D+02, + : 0.3834931695175D-08, 0.2797882673542D+01, 0.1491901785440D+02, + : 0.3760413942497D-08, 0.2892676280217D+01, 0.1726726808967D+02, + : 0.3719717204628D-08, 0.5861046025739D+01, 0.6297302759782D+01, + : 0.4145623530149D-08, 0.2168239627033D+01, 0.1376059875786D+02, + : 0.3932788425380D-08, 0.6271811124181D+01, 0.7872148766781D+01, + : 0.3686377476857D-08, 0.3936853151404D+01, 0.6268848941110D+01, + : 0.3779077950339D-08, 0.1404148734043D+01, 0.4157198507331D+01 / + DATA ((E0(I,J,2),I=1,3),J=371,380) / + : 0.4091334550598D-08, 0.2452436180854D+01, 0.9779108567966D+01, + : 0.3926694536146D-08, 0.6102292739040D+01, 0.1098419223922D+02, + : 0.4841000253289D-08, 0.6072760457276D+01, 0.1252801878276D+02, + : 0.4949340130240D-08, 0.1154832815171D+01, 0.1617106187867D+03, + : 0.3761557737360D-08, 0.5527545321897D+01, 0.3185192151914D+01, + : 0.3647396268188D-08, 0.1525035688629D+01, 0.6271346477544D+01, + : 0.3932405074189D-08, 0.5570681040569D+01, 0.2139354194808D+02, + : 0.3631322501141D-08, 0.1981240601160D+01, 0.6294805223347D+01, + : 0.4130007425139D-08, 0.2050060880201D+01, 0.2195415756911D+02, + : 0.4433905965176D-08, 0.3277477970321D+01, 0.7445550607224D+01 / + DATA ((E0(I,J,2),I=1,3),J=381,390) / + : 0.3851814176947D-08, 0.5210690074886D+01, 0.9562891316684D+00, + : 0.3485807052785D-08, 0.6653274904611D+00, 0.1161697602389D+02, + : 0.3979772816991D-08, 0.1767941436148D+01, 0.2277943724828D+02, + : 0.3402607460500D-08, 0.3421746306465D+01, 0.1087398597200D+02, + : 0.4049993000926D-08, 0.1127144787547D+01, 0.3163918923335D+00, + : 0.3420511182382D-08, 0.4214794779161D+01, 0.1362553364512D+02, + : 0.3640772365012D-08, 0.5324905497687D+01, 0.1725304118033D+02, + : 0.3323037987501D-08, 0.6135761838271D+01, 0.6279143387820D+01, + : 0.4503141663637D-08, 0.1802305450666D+01, 0.1385561574497D+01, + : 0.4314560055588D-08, 0.4812299731574D+01, 0.4176041334900D+01 / + DATA ((E0(I,J,2),I=1,3),J=391,400) / + : 0.3294226949110D-08, 0.3657547059723D+01, 0.6287008313071D+01, + : 0.3215657197281D-08, 0.4866676894425D+01, 0.5749861718712D+01, + : 0.4129362656266D-08, 0.3809342558906D+01, 0.5905702259363D+01, + : 0.3137762976388D-08, 0.2494635174443D+01, 0.2099539292909D+02, + : 0.3514010952384D-08, 0.2699961831678D+01, 0.7335344340001D+01, + : 0.3327607571530D-08, 0.3318457714816D+01, 0.5436992986000D+01, + : 0.3541066946675D-08, 0.4382703582466D+01, 0.1234573916645D+02, + : 0.3216179847052D-08, 0.5271066317054D+01, 0.3802769619140D-01, + : 0.2959045059570D-08, 0.5819591585302D+01, 0.2670964694522D+02, + : 0.3884040326665D-08, 0.5980934960428D+01, 0.6660449441528D+01 / + DATA ((E0(I,J,2),I=1,3),J=401,410) / + : 0.2922027539886D-08, 0.3337290282483D+01, 0.1375773836557D+01, + : 0.4110846382042D-08, 0.5742978187327D+01, 0.4480965020977D+02, + : 0.2934508411032D-08, 0.2278075804200D+01, 0.6408777551755D+00, + : 0.3966896193000D-08, 0.5835747858477D+01, 0.3773735910827D+00, + : 0.3286695827610D-08, 0.5838898193902D+01, 0.3932462625300D-02, + : 0.3720643094196D-08, 0.1122212337858D+01, 0.1646033343740D+02, + : 0.3285508906174D-08, 0.9182250996416D+00, 0.1081813534213D+02, + : 0.3753880575973D-08, 0.5174761973266D+01, 0.5642198095270D+01, + : 0.3022129385587D-08, 0.3381611020639D+01, 0.2982630633589D+02, + : 0.2798569205621D-08, 0.3546193723922D+01, 0.1937891852345D+02 / + DATA ((E0(I,J,2),I=1,3),J=411,420) / + : 0.3397872070505D-08, 0.4533203197934D+01, 0.6923953605621D+01, + : 0.3708099772977D-08, 0.2756168198616D+01, 0.3066615496545D+02, + : 0.3599283541510D-08, 0.1934395469918D+01, 0.6147450479709D+01, + : 0.3688702753059D-08, 0.7149920971109D+00, 0.2636725487657D+01, + : 0.2681084724003D-08, 0.4899819493154D+01, 0.6816289982179D+01, + : 0.3495993460759D-08, 0.1572418915115D+01, 0.6418701221183D+01, + : 0.3130770324995D-08, 0.8912190180489D+00, 0.1235996607578D+02, + : 0.2744353821941D-08, 0.3800821940055D+01, 0.2059724391010D+02, + : 0.2842732906341D-08, 0.2644717440029D+01, 0.2828699048865D+02, + : 0.3046882682154D-08, 0.3987793020179D+01, 0.6055599646783D+01 / + DATA ((E0(I,J,2),I=1,3),J=421,430) / + : 0.2399072455143D-08, 0.9908826440764D+00, 0.6255674361143D+01, + : 0.2384306274204D-08, 0.2516149752220D+01, 0.6310477339748D+01, + : 0.2977324500559D-08, 0.5849195642118D+01, 0.1652265972112D+02, + : 0.3062835258972D-08, 0.1681660100162D+01, 0.1172006883645D+02, + : 0.3109682589231D-08, 0.5804143987737D+00, 0.2751146787858D+02, + : 0.2903920355299D-08, 0.5800768280123D+01, 0.6510552054109D+01, + : 0.2823221989212D-08, 0.9241118370216D+00, 0.5469525544182D+01, + : 0.3187949696649D-08, 0.3139776445735D+01, 0.1693792562116D+03, + : 0.2922559771655D-08, 0.3549440782984D+01, 0.2630839062450D+00, + : 0.2436302066603D-08, 0.4735540696319D+01, 0.3946258593675D+00 / + DATA ((E0(I,J,2),I=1,3),J=431,440) / + : 0.3049473043606D-08, 0.4998289124561D+01, 0.8390110365991D+01, + : 0.2863682575784D-08, 0.6709515671102D+00, 0.2243449970715D+00, + : 0.2641750517966D-08, 0.5410978257284D+01, 0.2986433403208D+02, + : 0.2704093466243D-08, 0.4778317207821D+01, 0.6129297044991D+01, + : 0.2445522177011D-08, 0.6009020662222D+01, 0.1171295538178D+02, + : 0.2623608810230D-08, 0.5010449777147D+01, 0.6436854655901D+01, + : 0.2079259704053D-08, 0.5980943768809D+01, 0.2019909489111D+02, + : 0.2820225596771D-08, 0.2679965110468D+01, 0.5934151399930D+01, + : 0.2365221950927D-08, 0.1894231148810D+01, 0.2470570524223D+02, + : 0.2359682077149D-08, 0.4220752950780D+01, 0.8671969964381D+01 / + DATA ((E0(I,J,2),I=1,3),J=441,450) / + : 0.2387577137206D-08, 0.2571783940617D+01, 0.7096626156709D+01, + : 0.1982102089816D-08, 0.5169765997119D+00, 0.1727188400790D+02, + : 0.2687502389925D-08, 0.6239078264579D+01, 0.7075506709219D+02, + : 0.2207751669135D-08, 0.2031184412677D+01, 0.4377611041777D+01, + : 0.2618370214274D-08, 0.8266079985979D+00, 0.6632000300961D+01, + : 0.2591951887361D-08, 0.8819350522008D+00, 0.4873985990671D+02, + : 0.2375055656248D-08, 0.3520944177789D+01, 0.1590676413561D+02, + : 0.2472019978911D-08, 0.1551431908671D+01, 0.6612329252343D+00, + : 0.2368157127199D-08, 0.4178610147412D+01, 0.3459636466239D+02, + : 0.1764846605693D-08, 0.1506764000157D+01, 0.1980094587212D+02 / + DATA ((E0(I,J,2),I=1,3),J=451,460) / + : 0.2291769608798D-08, 0.2118250611782D+01, 0.2844914056730D-01, + : 0.2209997316943D-08, 0.3363255261678D+01, 0.2666070658668D+00, + : 0.2292699097923D-08, 0.4200423956460D+00, 0.1484170571900D-02, + : 0.1629683015329D-08, 0.2331362582487D+01, 0.3035599730800D+02, + : 0.2206492862426D-08, 0.3400274026992D+01, 0.6281667977667D+01, + : 0.2205746568257D-08, 0.1066051230724D+00, 0.6284483723224D+01, + : 0.2026310767991D-08, 0.2779066487979D+01, 0.2449240616245D+02, + : 0.1762977622163D-08, 0.9951450691840D+00, 0.2045286941806D+02, + : 0.1368535049606D-08, 0.6402447365817D+00, 0.2473415438279D+02, + : 0.1720598775450D-08, 0.2303524214705D+00, 0.1679593901136D+03 / + DATA ((E0(I,J,2),I=1,3),J=461,470) / + : 0.1702429015449D-08, 0.6164622655048D+01, 0.3338575901272D+03, + : 0.1414033197685D-08, 0.3954561185580D+01, 0.1624205518357D+03, + : 0.1573768958043D-08, 0.2028286308984D+01, 0.3144167757552D+02, + : 0.1650705184447D-08, 0.2304040666128D+01, 0.5267006960365D+02, + : 0.1651087618855D-08, 0.2538461057280D+01, 0.8956999012000D+02, + : 0.1616409518983D-08, 0.5111054348152D+01, 0.3332657872986D+02, + : 0.1537175173581D-08, 0.5601130666603D+01, 0.3852657435933D+02, + : 0.1593191980553D-08, 0.2614340453411D+01, 0.2282781046519D+03, + : 0.1499480170643D-08, 0.3624721577264D+01, 0.2823723341956D+02, + : 0.1493807843235D-08, 0.4214569879008D+01, 0.2876692439167D+02 / + DATA ((E0(I,J,2),I=1,3),J=471,480) / + : 0.1074571199328D-08, 0.1496911744704D+00, 0.8397383534231D+02, + : 0.1074406983417D-08, 0.1187817671922D+01, 0.8401985929482D+02, + : 0.9757576855851D-09, 0.2655703035858D+01, 0.7826370942180D+02, + : 0.1258432887565D-08, 0.4969896184844D+01, 0.3115650189215D+03, + : 0.1240336343282D-08, 0.5192460776926D+01, 0.1784300471910D+03, + : 0.9016107005164D-09, 0.1960356923057D+01, 0.5886454391678D+02, + : 0.1135392360918D-08, 0.5082427809068D+01, 0.7842370451713D+02, + : 0.9216046089565D-09, 0.2793775037273D+01, 0.1014262087719D+03, + : 0.1061276615030D-08, 0.3726144311409D+01, 0.5660027930059D+02, + : 0.1010110596263D-08, 0.7404080708937D+00, 0.4245678405627D+02 / + DATA ((E0(I,J,2),I=1,3),J=481,490) / + : 0.7217424756199D-09, 0.2697449980577D-01, 0.2457074661053D+03, + : 0.6912003846756D-09, 0.4253296276335D+01, 0.1679936946371D+03, + : 0.6871814664847D-09, 0.5148072412354D+01, 0.6053048899753D+02, + : 0.4887158016343D-09, 0.2153581148294D+01, 0.9656299901946D+02, + : 0.5161802866314D-09, 0.3852750634351D+01, 0.2442876000072D+03, + : 0.5652599559057D-09, 0.1233233356270D+01, 0.8365903305582D+02, + : 0.4710812608586D-09, 0.5610486976767D+01, 0.3164282286739D+03, + : 0.4909977500324D-09, 0.1639629524123D+01, 0.4059982187939D+03, + : 0.4772641839378D-09, 0.3737100368583D+01, 0.1805255418145D+03, + : 0.4487562567153D-09, 0.1158417054478D+00, 0.8433466158131D+02 / + DATA ((E0(I,J,2),I=1,3),J=491,500) / + : 0.3943441230497D-09, 0.6243502862796D+00, 0.2568537517081D+03, + : 0.3952236913598D-09, 0.3510377382385D+01, 0.2449975330562D+03, + : 0.3788898363417D-09, 0.5916128302299D+01, 0.1568131045107D+03, + : 0.3738329328831D-09, 0.1042266763456D+01, 0.3948519331910D+03, + : 0.2451199165151D-09, 0.1166788435700D+01, 0.1435713242844D+03, + : 0.2436734402904D-09, 0.3254726114901D+01, 0.2268582385539D+03, + : 0.2213605274325D-09, 0.1687210598530D+01, 0.1658638954901D+03, + : 0.1491521204829D-09, 0.2657541786794D+01, 0.2219950288015D+03, + : 0.1474995329744D-09, 0.5013089805819D+01, 0.3052819430710D+03, + : 0.1661939475656D-09, 0.5495315428418D+01, 0.2526661704812D+03 / + DATA ((E0(I,J,2),I=1,3),J=501,NE0Y) / + : 0.9015946748003D-10, 0.2236989966505D+01, 0.4171445043968D+03 / + +* Sun-to-Earth, T^1, Y + DATA ((E1(I,J,2),I=1,3),J= 1, 10) / + : 0.9304690546528D-06, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.5150715570663D-06, 0.4431807116294D+01, 0.1256615170089D+02, + : 0.1290825411056D-07, 0.4388610039678D+01, 0.1884922755134D+02, + : 0.4645466665386D-08, 0.5827263376034D+01, 0.6283075850446D+01, + : 0.2079625310718D-08, 0.1621698662282D+00, 0.6279552690824D+01, + : 0.2078189850907D-08, 0.3344713435140D+01, 0.6286599010068D+01, + : 0.6207190138027D-09, 0.5074049319576D+01, 0.4705732307012D+01, + : 0.5989826532569D-09, 0.2231842216620D+01, 0.6256777527156D+01, + : 0.5961360812618D-09, 0.1274975769045D+01, 0.6309374173736D+01, + : 0.4874165471016D-09, 0.3642277426779D+01, 0.7755226100720D+00 / + DATA ((E1(I,J,2),I=1,3),J= 11, 20) / + : 0.4283834034360D-09, 0.5148765510106D+01, 0.1059381944224D+01, + : 0.4652389287529D-09, 0.4715794792175D+01, 0.7860419393880D+01, + : 0.3751707476401D-09, 0.6617207370325D+00, 0.5753384878334D+01, + : 0.3559998806198D-09, 0.6155548875404D+01, 0.5884926831456D+01, + : 0.3558447558857D-09, 0.2898827297664D+01, 0.6812766822558D+01, + : 0.3211116927106D-09, 0.3625813502509D+01, 0.6681224869435D+01, + : 0.2875609914672D-09, 0.4345435813134D+01, 0.2513230340178D+02, + : 0.2843109704069D-09, 0.5862263940038D+01, 0.6127655567643D+01, + : 0.2744676468427D-09, 0.3926419475089D+01, 0.6438496133249D+01, + : 0.2481285237789D-09, 0.1351976572828D+01, 0.5486777812467D+01 / + DATA ((E1(I,J,2),I=1,3),J= 21, 30) / + : 0.2060338481033D-09, 0.2147556998591D+01, 0.7079373888424D+01, + : 0.2015822358331D-09, 0.4408358972216D+01, 0.6290189305114D+01, + : 0.2001195944195D-09, 0.5385829822531D+01, 0.6275962395778D+01, + : 0.1953667642377D-09, 0.1304933746120D+01, 0.5507553240374D+01, + : 0.1839744078713D-09, 0.6173567228835D+01, 0.1179062909082D+02, + : 0.1643334294845D-09, 0.4635942997523D+01, 0.1150676975667D+02, + : 0.1768051018652D-09, 0.5086283558874D+01, 0.7113454667900D-02, + : 0.1674874205489D-09, 0.2243332137241D+01, 0.7058598460518D+01, + : 0.1421445397609D-09, 0.6186899771515D+01, 0.7962980379786D+00, + : 0.1255163958267D-09, 0.5730238465658D+01, 0.4694002934110D+01 / + DATA ((E1(I,J,2),I=1,3),J= 31, 40) / + : 0.1013945281961D-09, 0.1726055228402D+01, 0.3738761453707D+01, + : 0.1047294335852D-09, 0.2658801228129D+01, 0.6282095334605D+01, + : 0.1047103879392D-09, 0.8481047835035D+00, 0.6284056366286D+01, + : 0.9530343962826D-10, 0.3079267149859D+01, 0.6069776770667D+01, + : 0.9604637611690D-10, 0.3258679792918D+00, 0.4136910472696D+01, + : 0.9153518537177D-10, 0.4398599886584D+00, 0.6496374930224D+01, + : 0.8562458214922D-10, 0.4772686794145D+01, 0.1194447056968D+01, + : 0.8232525360654D-10, 0.5966220721679D+01, 0.1589072916335D+01, + : 0.6150223411438D-10, 0.1780985591923D+01, 0.8827390247185D+01, + : 0.6272087858000D-10, 0.3184305429012D+01, 0.8429241228195D+01 / + DATA ((E1(I,J,2),I=1,3),J= 41, 50) / + : 0.5540476311040D-10, 0.3801260595433D+01, 0.4933208510675D+01, + : 0.7331901699361D-10, 0.5205948591865D+01, 0.4535059491685D+01, + : 0.6018528702791D-10, 0.4770139083623D+01, 0.1255903824622D+02, + : 0.5150530724804D-10, 0.3574796899585D+01, 0.1176985366291D+02, + : 0.6471933741811D-10, 0.2679787266521D+01, 0.5088628793478D+01, + : 0.5317460644174D-10, 0.9528763345494D+00, 0.3154687086868D+01, + : 0.4832187748783D-10, 0.5329322498232D+01, 0.6040347114260D+01, + : 0.4716763555110D-10, 0.2395235316466D+01, 0.5331357529664D+01, + : 0.4871509139861D-10, 0.3056663648823D+01, 0.1256967486051D+02, + : 0.4598417696768D-10, 0.4452762609019D+01, 0.6525804586632D+01 / + DATA ((E1(I,J,2),I=1,3),J= 51, 60) / + : 0.5674189533175D-10, 0.9879680872193D+00, 0.5729506548653D+01, + : 0.4073560328195D-10, 0.5939127696986D+01, 0.7632943190217D+01, + : 0.5040994945359D-10, 0.4549875824510D+01, 0.8031092209206D+01, + : 0.5078185134679D-10, 0.7346659893982D+00, 0.7477522907414D+01, + : 0.3769343537061D-10, 0.1071317188367D+01, 0.7234794171227D+01, + : 0.4980331365299D-10, 0.2500345341784D+01, 0.6836645152238D+01, + : 0.3458236594757D-10, 0.3825159450711D+01, 0.1097707878456D+02, + : 0.3578859493602D-10, 0.5299664791549D+01, 0.4164311961999D+01, + : 0.3370504646419D-10, 0.5002316301593D+01, 0.1137170464392D+02, + : 0.3299873338428D-10, 0.2526123275282D+01, 0.3930209696940D+01 / + DATA ((E1(I,J,2),I=1,3),J= 61, 70) / + : 0.4304917318409D-10, 0.3368078557132D+01, 0.1592596075957D+01, + : 0.3402418753455D-10, 0.8385495425800D+00, 0.3128388763578D+01, + : 0.2778460572146D-10, 0.3669905203240D+01, 0.7342457794669D+01, + : 0.2782710128902D-10, 0.2691664812170D+00, 0.1748016358760D+01, + : 0.2711725179646D-10, 0.4707487217718D+01, 0.5296909721118D+00, + : 0.2981760946340D-10, 0.3190260867816D+00, 0.5368044267797D+00, + : 0.2811672977772D-10, 0.3196532315372D+01, 0.7084896783808D+01, + : 0.2863454474467D-10, 0.2263240324780D+00, 0.5223693906222D+01, + : 0.3333464634051D-10, 0.3498451685065D+01, 0.8018209333619D+00, + : 0.3312991747609D-10, 0.5839154477412D+01, 0.1554202828031D+00 / + DATA ((E1(I,J,2),I=1,3),J= 71,NE1Y) / + : 0.2813255564006D-10, 0.8268044346621D+00, 0.5225775174439D+00, + : 0.2665098083966D-10, 0.3934021725360D+01, 0.5216580451554D+01, + : 0.2349795705216D-10, 0.5197620913779D+01, 0.2146165377750D+01, + : 0.2330352293961D-10, 0.2984999231807D+01, 0.1726015463500D+02, + : 0.2728001683419D-10, 0.6521679638544D+00, 0.8635942003952D+01, + : 0.2484061007669D-10, 0.3468955561097D+01, 0.5230807360890D+01, + : 0.2646328768427D-10, 0.1013724533516D+01, 0.2629832328990D-01, + : 0.2518630264831D-10, 0.6108081057122D+01, 0.5481254917084D+01, + : 0.2421901455384D-10, 0.1651097776260D+01, 0.1349867339771D+01, + : 0.6348533267831D-11, 0.3220226560321D+01, 0.8433466158131D+02 / + +* Sun-to-Earth, T^2, Y + DATA ((E2(I,J,2),I=1,3),J= 1,NE2Y) / + : 0.5063375872532D-10, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.2173815785980D-10, 0.2827805833053D+01, 0.1256615170089D+02, + : 0.1010231999920D-10, 0.4634612377133D+01, 0.6283075850446D+01, + : 0.9259745317636D-12, 0.2620612076189D+01, 0.1884922755134D+02, + : 0.1022202095812D-12, 0.3809562326066D+01, 0.8399684731857D+02 / + +* Sun-to-Earth, T^0, Z + DATA ((E0(I,J,3),I=1,3),J= 1, 10) / + : 0.2796207639075D-05, 0.3198701560209D+01, 0.8433466158131D+02, + : 0.1016042198142D-05, 0.5422360395913D+01, 0.5507553240374D+01, + : 0.8044305033647D-06, 0.3880222866652D+01, 0.5223693906222D+01, + : 0.4385347909274D-06, 0.3704369937468D+01, 0.2352866153506D+01, + : 0.3186156414906D-06, 0.3999639363235D+01, 0.1577343543434D+01, + : 0.2272412285792D-06, 0.3984738315952D+01, 0.1047747311755D+01, + : 0.1645620103007D-06, 0.3565412516841D+01, 0.5856477690889D+01, + : 0.1815836921166D-06, 0.4984507059020D+01, 0.6283075850446D+01, + : 0.1447461676364D-06, 0.3702753570108D+01, 0.9437762937313D+01, + : 0.1430760876382D-06, 0.3409658712357D+01, 0.1021328554739D+02 / + DATA ((E0(I,J,3),I=1,3),J= 11, 20) / + : 0.1120445753226D-06, 0.4829561570246D+01, 0.1414349524433D+02, + : 0.1090232840797D-06, 0.2080729178066D+01, 0.6812766822558D+01, + : 0.9715727346551D-07, 0.3476295881948D+01, 0.4694002934110D+01, + : 0.1036267136217D-06, 0.4056639536648D+01, 0.7109288135493D+02, + : 0.8752665271340D-07, 0.4448159519911D+01, 0.5753384878334D+01, + : 0.8331864956004D-07, 0.4991704044208D+01, 0.7084896783808D+01, + : 0.6901658670245D-07, 0.4325358994219D+01, 0.6275962395778D+01, + : 0.9144536848998D-07, 0.1141826375363D+01, 0.6620890113188D+01, + : 0.7205085037435D-07, 0.3624344170143D+01, 0.5296909721118D+00, + : 0.7697874654176D-07, 0.5554257458998D+01, 0.1676215758509D+03 / + DATA ((E0(I,J,3),I=1,3),J= 21, 30) / + : 0.5197545738384D-07, 0.6251760961735D+01, 0.1807370494127D+02, + : 0.5031345378608D-07, 0.2497341091913D+01, 0.4705732307012D+01, + : 0.4527110205840D-07, 0.2335079920992D+01, 0.6309374173736D+01, + : 0.4753355798089D-07, 0.7094148987474D+00, 0.5884926831456D+01, + : 0.4296951977516D-07, 0.1101916352091D+01, 0.6681224869435D+01, + : 0.3855341568387D-07, 0.1825495405486D+01, 0.5486777812467D+01, + : 0.5253930970990D-07, 0.4424740687208D+01, 0.7860419393880D+01, + : 0.4024630496471D-07, 0.5120498157053D+01, 0.1336797263425D+02, + : 0.4061069791453D-07, 0.6029771435451D+01, 0.3930209696940D+01, + : 0.3797883804205D-07, 0.4435193600836D+00, 0.3154687086868D+01 / + DATA ((E0(I,J,3),I=1,3),J= 31, 40) / + : 0.2933033225587D-07, 0.5124157356507D+01, 0.1059381944224D+01, + : 0.3503000930426D-07, 0.5421830162065D+01, 0.6069776770667D+01, + : 0.3670096214050D-07, 0.4582101667297D+01, 0.1219403291462D+02, + : 0.2905609437008D-07, 0.1926566420072D+01, 0.1097707878456D+02, + : 0.2466827821713D-07, 0.6090174539834D+00, 0.6496374930224D+01, + : 0.2691647295332D-07, 0.1393432595077D+01, 0.2200391463820D+02, + : 0.2150554667946D-07, 0.4308671715951D+01, 0.5643178611111D+01, + : 0.2237481922680D-07, 0.8133968269414D+00, 0.8635942003952D+01, + : 0.1817741038157D-07, 0.3755205127454D+01, 0.3340612434717D+01, + : 0.2227820762132D-07, 0.2759558596664D+01, 0.1203646072878D+02 / + DATA ((E0(I,J,3),I=1,3),J= 41, 50) / + : 0.1944713772307D-07, 0.5699645869121D+01, 0.1179062909082D+02, + : 0.1527340520662D-07, 0.1986749091746D+01, 0.3981490189893D+00, + : 0.1577282574914D-07, 0.3205017217983D+01, 0.5088628793478D+01, + : 0.1424738825424D-07, 0.6256747903666D+01, 0.2544314396739D+01, + : 0.1616563121701D-07, 0.2601671259394D+00, 0.1729818233119D+02, + : 0.1401210391692D-07, 0.4686939173506D+01, 0.7058598460518D+01, + : 0.1488726974214D-07, 0.2815862451372D+01, 0.2593412433514D+02, + : 0.1692626442388D-07, 0.4956894109797D+01, 0.1564752902480D+03, + : 0.1123571582910D-07, 0.2381192697696D+01, 0.3738761453707D+01, + : 0.9903308606317D-08, 0.4294851657684D+01, 0.9225539266174D+01 / + DATA ((E0(I,J,3),I=1,3),J= 51, 60) / + : 0.9174533187191D-08, 0.3075171510642D+01, 0.4164311961999D+01, + : 0.8645985631457D-08, 0.5477534821633D+00, 0.8429241228195D+01, + : -0.1085876492688D-07, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.9264309077815D-08, 0.5968571670097D+01, 0.7079373888424D+01, + : 0.8243116984954D-08, 0.1489098777643D+01, 0.1044738781244D+02, + : 0.8268102113708D-08, 0.3512977691983D+01, 0.1150676975667D+02, + : 0.9043613988227D-08, 0.1290704408221D+00, 0.1101510648075D+02, + : 0.7432912038789D-08, 0.1991086893337D+01, 0.2608790314060D+02, + : 0.8586233727285D-08, 0.4238357924414D+01, 0.2986433403208D+02, + : 0.7612230060131D-08, 0.2911090150166D+01, 0.4732030630302D+01 / + DATA ((E0(I,J,3),I=1,3),J= 61, 70) / + : 0.7097787751408D-08, 0.1908938392390D+01, 0.8031092209206D+01, + : 0.7640237040175D-08, 0.6129219000168D+00, 0.7962980379786D+00, + : 0.7070445688081D-08, 0.1380417036651D+01, 0.2146165377750D+01, + : 0.7690770957702D-08, 0.1680504249084D+01, 0.2122839202813D+02, + : 0.8051292542594D-08, 0.5127423484511D+01, 0.2942463415728D+01, + : 0.5902709104515D-08, 0.2020274190917D+01, 0.7755226100720D+00, + : 0.5134567496462D-08, 0.2606778676418D+01, 0.1256615170089D+02, + : 0.5525802046102D-08, 0.1613011769663D+01, 0.8018209333619D+00, + : 0.5880724784221D-08, 0.4604483417236D+01, 0.4690479774488D+01, + : 0.5211699081370D-08, 0.5718964114193D+01, 0.8827390247185D+01 / + DATA ((E0(I,J,3),I=1,3),J= 71, 80) / + : 0.4891849573562D-08, 0.3689658932196D+01, 0.2132990797783D+00, + : 0.5150246069997D-08, 0.4099769855122D+01, 0.6480980550449D+02, + : 0.5102434319633D-08, 0.5660834602509D+01, 0.3379454372902D+02, + : 0.5083405254252D-08, 0.9842221218974D+00, 0.4136910472696D+01, + : 0.4206562585682D-08, 0.1341363634163D+00, 0.3128388763578D+01, + : 0.4663249683579D-08, 0.8130132735866D+00, 0.5216580451554D+01, + : 0.4099474416530D-08, 0.5791497770644D+01, 0.4265981595566D+00, + : 0.4628251220767D-08, 0.1249802769331D+01, 0.1572083878776D+02, + : 0.5024068728142D-08, 0.4795684802743D+01, 0.6290189305114D+01, + : 0.5120234327758D-08, 0.3810420387208D+01, 0.5230807360890D+01 / + DATA ((E0(I,J,3),I=1,3),J= 81, 90) / + : 0.5524029815280D-08, 0.1029264714351D+01, 0.2397622045175D+03, + : 0.4757415718860D-08, 0.3528044781779D+01, 0.1649636139783D+02, + : 0.3915786131127D-08, 0.5593889282646D+01, 0.1589072916335D+01, + : 0.4869053149991D-08, 0.3299636454433D+01, 0.7632943190217D+01, + : 0.3649365703729D-08, 0.1286049002584D+01, 0.6206810014183D+01, + : 0.3992493949002D-08, 0.3100307589464D+01, 0.2515860172507D+02, + : 0.3320247477418D-08, 0.6212683940807D+01, 0.1216800268190D+02, + : 0.3287123739696D-08, 0.4699118445928D+01, 0.7234794171227D+01, + : 0.3472776811103D-08, 0.2630507142004D+01, 0.7342457794669D+01, + : 0.3423253294767D-08, 0.2946432844305D+01, 0.9623688285163D+01 / + DATA ((E0(I,J,3),I=1,3),J= 91,100) / + : 0.3896173898244D-08, 0.1224834179264D+01, 0.6438496133249D+01, + : 0.3388455337924D-08, 0.1543807616351D+01, 0.1494531617769D+02, + : 0.3062704716523D-08, 0.1191777572310D+01, 0.8662240327241D+01, + : 0.3270075600400D-08, 0.5483498767737D+01, 0.1194447056968D+01, + : 0.3101209215259D-08, 0.8000833804348D+00, 0.3772475342596D+02, + : 0.2780883347311D-08, 0.4077980721888D+00, 0.5863591145557D+01, + : 0.2903605931824D-08, 0.2617490302147D+01, 0.1965104848470D+02, + : 0.2682014743119D-08, 0.2634703158290D+01, 0.7238675589263D+01, + : 0.2534360108492D-08, 0.6102446114873D+01, 0.6836645152238D+01, + : 0.2392564882509D-08, 0.3681820208691D+01, 0.5849364236221D+01 / + DATA ((E0(I,J,3),I=1,3),J=101,110) / + : 0.2656667254856D-08, 0.6216045388886D+01, 0.6133512519065D+01, + : 0.2331242096773D-08, 0.5864949777744D+01, 0.4535059491685D+01, + : 0.2287898363668D-08, 0.4566628532802D+01, 0.7477522907414D+01, + : 0.2336944521306D-08, 0.2442722126930D+01, 0.1137170464392D+02, + : 0.3156632236269D-08, 0.1626628050682D+01, 0.2509084901204D+03, + : 0.2982612402766D-08, 0.2803604512609D+01, 0.1748016358760D+01, + : 0.2774031674807D-08, 0.4654002897158D+01, 0.8223916695780D+02, + : 0.2295236548638D-08, 0.4326518333253D+01, 0.3378142627421D+00, + : 0.2190714699873D-08, 0.4519614578328D+01, 0.2908881142201D+02, + : 0.2191495845045D-08, 0.3012626912549D+01, 0.1673046366289D+02 / + DATA ((E0(I,J,3),I=1,3),J=111,120) / + : 0.2492901628386D-08, 0.1290101424052D+00, 0.1543797956245D+03, + : 0.1993778064319D-08, 0.3864046799414D+01, 0.1778984560711D+02, + : 0.1898146479022D-08, 0.5053777235891D+01, 0.2042657109477D+02, + : 0.1918280127634D-08, 0.2222470192548D+01, 0.4165496312290D+02, + : 0.1916351061607D-08, 0.8719067257774D+00, 0.7737595720538D+02, + : 0.1834720181466D-08, 0.4031491098040D+01, 0.2358125818164D+02, + : 0.1249201523806D-08, 0.5938379466835D+01, 0.3301902111895D+02, + : 0.1477304050539D-08, 0.6544722606797D+00, 0.9548094718417D+02, + : 0.1264316431249D-08, 0.2059072853236D+01, 0.8399684731857D+02, + : 0.1203526495039D-08, 0.3644813532605D+01, 0.4558517281984D+02 / + DATA ((E0(I,J,3),I=1,3),J=121,130) / + : 0.9221681059831D-09, 0.3241815055602D+01, 0.7805158573086D+02, + : 0.7849278367646D-09, 0.5043812342457D+01, 0.5217580628120D+02, + : 0.7983392077387D-09, 0.5000024502753D+01, 0.1501922143975D+03, + : 0.7925395431654D-09, 0.1398734871821D-01, 0.9061773743175D+02, + : 0.7640473285886D-09, 0.5067111723130D+01, 0.4951538251678D+02, + : 0.5398937754482D-09, 0.5597382200075D+01, 0.1613385000004D+03, + : 0.5626247550193D-09, 0.2601338209422D+01, 0.7318837597844D+02, + : 0.5525197197855D-09, 0.5814832109256D+01, 0.1432335100216D+03, + : 0.5407629837898D-09, 0.3384820609076D+01, 0.3230491187871D+03, + : 0.3856739119801D-09, 0.1072391840473D+01, 0.2334791286671D+03 / + DATA ((E0(I,J,3),I=1,3),J=131,NE0Z) / + : 0.3856425239987D-09, 0.2369540393327D+01, 0.1739046517013D+03, + : 0.4350867755983D-09, 0.5255575751082D+01, 0.1620484330494D+03, + : 0.3844113924996D-09, 0.5482356246182D+01, 0.9757644180768D+02, + : 0.2854869155431D-09, 0.9573634763143D+00, 0.1697170704744D+03, + : 0.1719227671416D-09, 0.1887203025202D+01, 0.2265204242912D+03, + : 0.1527846879755D-09, 0.3982183931157D+01, 0.3341954043900D+03, + : 0.1128229264847D-09, 0.2787457156298D+01, 0.3119028331842D+03 / + +* Sun-to-Earth, T^1, Z + DATA ((E1(I,J,3),I=1,3),J= 1, 10) / + : 0.2278290449966D-05, 0.3413716033863D+01, 0.6283075850446D+01, + : 0.5429458209830D-07, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.1903240492525D-07, 0.3370592358297D+01, 0.1256615170089D+02, + : 0.2385409276743D-09, 0.3327914718416D+01, 0.1884922755134D+02, + : 0.8676928342573D-10, 0.1824006811264D+01, 0.5223693906222D+01, + : 0.7765442593544D-10, 0.3888564279247D+01, 0.5507553240374D+01, + : 0.7066158332715D-10, 0.5194267231944D+01, 0.2352866153506D+01, + : 0.7092175288657D-10, 0.2333246960021D+01, 0.8399684731857D+02, + : 0.5357582213535D-10, 0.2224031176619D+01, 0.5296909721118D+00, + : 0.3828035865021D-10, 0.2156710933584D+01, 0.6279552690824D+01 / + DATA ((E1(I,J,3),I=1,3),J= 11,NE1Z) / + : 0.3824857220427D-10, 0.1529755219915D+01, 0.6286599010068D+01, + : 0.3286995181628D-10, 0.4879512900483D+01, 0.1021328554739D+02 / + +* Sun-to-Earth, T^2, Z + DATA ((E2(I,J,3),I=1,3),J= 1,NE2Z) / + : 0.9722666114891D-10, 0.5152219582658D+01, 0.6283075850446D+01, + : -0.3494819171909D-11, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.6713034376076D-12, 0.6440188750495D+00, 0.1256615170089D+02 / + +* SSB-to-Sun, T^0, X + DATA ((S0(I,J,1),I=1,3),J= 1, 10) / + : 0.4956757536410D-02, 0.3741073751789D+01, 0.5296909721118D+00, + : 0.2718490072522D-02, 0.4016011511425D+01, 0.2132990797783D+00, + : 0.1546493974344D-02, 0.2170528330642D+01, 0.3813291813120D-01, + : 0.8366855276341D-03, 0.2339614075294D+01, 0.7478166569050D-01, + : 0.2936777942117D-03, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.1201317439469D-03, 0.4090736353305D+01, 0.1059381944224D+01, + : 0.7578550887230D-04, 0.3241518088140D+01, 0.4265981595566D+00, + : 0.1941787367773D-04, 0.1012202064330D+01, 0.2061856251104D+00, + : 0.1889227765991D-04, 0.3892520416440D+01, 0.2204125344462D+00, + : 0.1937896968613D-04, 0.4797779441161D+01, 0.1495633313810D+00 / + DATA ((S0(I,J,1),I=1,3),J= 11, 20) / + : 0.1434506110873D-04, 0.3868960697933D+01, 0.5225775174439D+00, + : 0.1406659911580D-04, 0.4759766557397D+00, 0.5368044267797D+00, + : 0.1179022300202D-04, 0.7774961520598D+00, 0.7626583626240D-01, + : 0.8085864460959D-05, 0.3254654471465D+01, 0.3664874755930D-01, + : 0.7622752967615D-05, 0.4227633103489D+01, 0.3961708870310D-01, + : 0.6209171139066D-05, 0.2791828325711D+00, 0.7329749511860D-01, + : 0.4366435633970D-05, 0.4440454875925D+01, 0.1589072916335D+01, + : 0.3792124889348D-05, 0.5156393842356D+01, 0.7113454667900D-02, + : 0.3154548963402D-05, 0.6157005730093D+01, 0.4194847048887D+00, + : 0.3088359882942D-05, 0.2494567553163D+01, 0.6398972393349D+00 / + DATA ((S0(I,J,1),I=1,3),J= 21, 30) / + : 0.2788440902136D-05, 0.4934318747989D+01, 0.1102062672231D+00, + : 0.3039928456376D-05, 0.4895077702640D+01, 0.6283075850446D+01, + : 0.2272258457679D-05, 0.5278394064764D+01, 0.1030928125552D+00, + : 0.2162007057957D-05, 0.5802978019099D+01, 0.3163918923335D+00, + : 0.1767632855737D-05, 0.3415346595193D-01, 0.1021328554739D+02, + : 0.1349413459362D-05, 0.2001643230755D+01, 0.1484170571900D-02, + : 0.1170141900476D-05, 0.2424750491620D+01, 0.6327837846670D+00, + : 0.1054355266820D-05, 0.3123311487576D+01, 0.4337116142245D+00, + : 0.9800822461610D-06, 0.3026258088130D+01, 0.1052268489556D+01, + : 0.1091203749931D-05, 0.3157811670347D+01, 0.1162474756779D+01 / + DATA ((S0(I,J,1),I=1,3),J= 31, 40) / + : 0.6960236715913D-06, 0.8219570542313D+00, 0.1066495398892D+01, + : 0.5689257296909D-06, 0.1323052375236D+01, 0.9491756770005D+00, + : 0.6613172135802D-06, 0.2765348881598D+00, 0.8460828644453D+00, + : 0.6277702517571D-06, 0.5794064466382D+01, 0.1480791608091D+00, + : 0.6304884066699D-06, 0.7323555380787D+00, 0.2243449970715D+00, + : 0.4897850467382D-06, 0.3062464235399D+01, 0.3340612434717D+01, + : 0.3759148598786D-06, 0.4588290469664D+01, 0.3516457698740D-01, + : 0.3110520548195D-06, 0.1374299536572D+01, 0.6373574839730D-01, + : 0.3064708359780D-06, 0.4222267485047D+01, 0.1104591729320D-01, + : 0.2856347168241D-06, 0.3714202944973D+01, 0.1510475019529D+00 / + DATA ((S0(I,J,1),I=1,3),J= 41, 50) / + : 0.2840945514288D-06, 0.2847972875882D+01, 0.4110125927500D-01, + : 0.2378951599405D-06, 0.3762072563388D+01, 0.2275259891141D+00, + : 0.2714229481417D-06, 0.1036049980031D+01, 0.2535050500000D-01, + : 0.2323551717307D-06, 0.4682388599076D+00, 0.8582758298370D-01, + : 0.1881790512219D-06, 0.4790565425418D+01, 0.2118763888447D+01, + : 0.2261353968371D-06, 0.1669144912212D+01, 0.7181332454670D-01, + : 0.2214546389848D-06, 0.3937717281614D+01, 0.2968341143800D-02, + : 0.2184915594933D-06, 0.1129169845099D+00, 0.7775000683430D-01, + : 0.2000164937936D-06, 0.4030009638488D+01, 0.2093666171530D+00, + : 0.1966105136719D-06, 0.8745955786834D+00, 0.2172315424036D+00 / + DATA ((S0(I,J,1),I=1,3),J= 51, 60) / + : 0.1904742332624D-06, 0.5919743598964D+01, 0.2022531624851D+00, + : 0.1657399705031D-06, 0.2549141484884D+01, 0.7358765972222D+00, + : 0.1574070533987D-06, 0.5277533020230D+01, 0.7429900518901D+00, + : 0.1832261651039D-06, 0.3064688127777D+01, 0.3235053470014D+00, + : 0.1733615346569D-06, 0.3011432799094D+01, 0.1385174140878D+00, + : 0.1549124014496D-06, 0.4005569132359D+01, 0.5154640627760D+00, + : 0.1637044713838D-06, 0.1831375966632D+01, 0.8531963191132D+00, + : 0.1123420082383D-06, 0.1180270407578D+01, 0.1990721704425D+00, + : 0.1083754165740D-06, 0.3414101320863D+00, 0.5439178814476D+00, + : 0.1156638012655D-06, 0.6130479452594D+00, 0.5257585094865D+00 / + DATA ((S0(I,J,1),I=1,3),J= 61, 70) / + : 0.1142548785134D-06, 0.3724761948846D+01, 0.5336234347371D+00, + : 0.7921463895965D-07, 0.2435425589361D+01, 0.1478866649112D+01, + : 0.7428600285231D-07, 0.3542144398753D+01, 0.2164800718209D+00, + : 0.8323211246747D-07, 0.3525058072354D+01, 0.1692165728891D+01, + : 0.7257595116312D-07, 0.1364299431982D+01, 0.2101180877357D+00, + : 0.7111185833236D-07, 0.2460478875808D+01, 0.4155522422634D+00, + : 0.6868090383716D-07, 0.4397327670704D+01, 0.1173197218910D+00, + : 0.7226419974175D-07, 0.4042647308905D+01, 0.1265567569334D+01, + : 0.6955642383177D-07, 0.2865047906085D+01, 0.9562891316684D+00, + : 0.7492139296331D-07, 0.5014278994215D+01, 0.1422690933580D-01 / + DATA ((S0(I,J,1),I=1,3),J= 71, 80) / + : 0.6598363128857D-07, 0.2376730020492D+01, 0.6470106940028D+00, + : 0.7381147293385D-07, 0.3272990384244D+01, 0.1581959461667D+01, + : 0.6402909624032D-07, 0.5302290955138D+01, 0.9597935788730D-01, + : 0.6237454263857D-07, 0.5444144425332D+01, 0.7084920306520D-01, + : 0.5241198544016D-07, 0.4215359579205D+01, 0.5265099800692D+00, + : 0.5144463853918D-07, 0.1218916689916D+00, 0.5328719641544D+00, + : 0.5868164772299D-07, 0.2369402002213D+01, 0.7871412831580D-01, + : 0.6233195669151D-07, 0.1254922242403D+01, 0.2608790314060D+02, + : 0.6068463791422D-07, 0.5679713760431D+01, 0.1114304132498D+00, + : 0.4359361135065D-07, 0.6097219641646D+00, 0.1375773836557D+01 / + DATA ((S0(I,J,1),I=1,3),J= 81, 90) / + : 0.4686510366826D-07, 0.4786231041431D+01, 0.1143987543936D+00, + : 0.3758977287225D-07, 0.1167368068139D+01, 0.1596186371003D+01, + : 0.4282051974778D-07, 0.1519471064319D+01, 0.2770348281756D+00, + : 0.5153765386113D-07, 0.1860532322984D+01, 0.2228608264996D+00, + : 0.4575129387188D-07, 0.7632857887158D+00, 0.1465949902372D+00, + : 0.3326844933286D-07, 0.1298219485285D+01, 0.5070101000000D-01, + : 0.3748617450984D-07, 0.1046510321062D+01, 0.4903339079539D+00, + : 0.2816756661499D-07, 0.3434522346190D+01, 0.2991266627620D+00, + : 0.3412750405039D-07, 0.2523766270318D+01, 0.3518164938661D+00, + : 0.2655796761776D-07, 0.2904422260194D+01, 0.6256703299991D+00 / + DATA ((S0(I,J,1),I=1,3),J= 91,100) / + : 0.2963597929458D-07, 0.5923900431149D+00, 0.1099462426779D+00, + : 0.2539523734781D-07, 0.4851947722567D+01, 0.1256615170089D+02, + : 0.2283087914139D-07, 0.3400498595496D+01, 0.6681224869435D+01, + : 0.2321309799331D-07, 0.5789099148673D+01, 0.3368040641550D-01, + : 0.2549657649750D-07, 0.3991856479792D-01, 0.1169588211447D+01, + : 0.2290462303977D-07, 0.2788567577052D+01, 0.1045155034888D+01, + : 0.1945398522914D-07, 0.3290896998176D+01, 0.1155361302111D+01, + : 0.1849171512638D-07, 0.2698060129367D+01, 0.4452511715700D-02, + : 0.1647199834254D-07, 0.3016735644085D+01, 0.4408250688924D+00, + : 0.1529530765273D-07, 0.5573043116178D+01, 0.6521991896920D-01 / + DATA ((S0(I,J,1),I=1,3),J=101,110) / + : 0.1433199339978D-07, 0.1481192356147D+01, 0.9420622223326D+00, + : 0.1729134193602D-07, 0.1422817538933D+01, 0.2108507877249D+00, + : 0.1716463931346D-07, 0.3469468901855D+01, 0.2157473718317D+00, + : 0.1391206061378D-07, 0.6122436220547D+01, 0.4123712502208D+00, + : 0.1404746661924D-07, 0.1647765641936D+01, 0.4258542984690D-01, + : 0.1410452399455D-07, 0.5989729161964D+01, 0.2258291676434D+00, + : 0.1089828772168D-07, 0.2833705509371D+01, 0.4226656969313D+00, + : 0.1047374564948D-07, 0.5090690007331D+00, 0.3092784376656D+00, + : 0.1358279126532D-07, 0.5128990262836D+01, 0.7923417740620D-01, + : 0.1020456476148D-07, 0.9632772880808D+00, 0.1456308687557D+00 / + DATA ((S0(I,J,1),I=1,3),J=111,120) / + : 0.1033428735328D-07, 0.3223779318418D+01, 0.1795258541446D+01, + : 0.1412435841540D-07, 0.2410271572721D+01, 0.1525316725248D+00, + : 0.9722759371574D-08, 0.2333531395690D+01, 0.8434341241180D-01, + : 0.9657334084704D-08, 0.6199270974168D+01, 0.1272681024002D+01, + : 0.1083641148690D-07, 0.2864222292929D+01, 0.7032915397480D-01, + : 0.1067318403838D-07, 0.5833458866568D+00, 0.2123349582968D+00, + : 0.1062366201976D-07, 0.4307753989494D+01, 0.2142632012598D+00, + : 0.1236364149266D-07, 0.2873917870593D+01, 0.1847279083684D+00, + : 0.1092759489593D-07, 0.2959887266733D+01, 0.1370332435159D+00, + : 0.8912069362899D-08, 0.5141213702562D+01, 0.2648454860559D+01 / + DATA ((S0(I,J,1),I=1,3),J=121,130) / + : 0.9656467707970D-08, 0.4532182462323D+01, 0.4376440768498D+00, + : 0.8098386150135D-08, 0.2268906338379D+01, 0.2880807454688D+00, + : 0.7857714675000D-08, 0.4055544260745D+01, 0.2037373330570D+00, + : 0.7288455940646D-08, 0.5357901655142D+01, 0.1129145838217D+00, + : 0.9450595950552D-08, 0.4264926963939D+01, 0.5272426800584D+00, + : 0.9381718247537D-08, 0.7489366976576D-01, 0.5321392641652D+00, + : 0.7079052646038D-08, 0.1923311052874D+01, 0.6288513220417D+00, + : 0.9259004415344D-08, 0.2970256853438D+01, 0.1606092486742D+00, + : 0.8259801499742D-08, 0.3327056314697D+01, 0.8389694097774D+00, + : 0.6476334355779D-08, 0.2954925505727D+01, 0.2008557621224D+01 / + DATA ((S0(I,J,1),I=1,3),J=131,140) / + : 0.5984021492007D-08, 0.9138753105829D+00, 0.2042657109477D+02, + : 0.5989546863181D-08, 0.3244464082031D+01, 0.2111650433779D+01, + : 0.6233108606023D-08, 0.4995232638403D+00, 0.4305306221819D+00, + : 0.6877299149965D-08, 0.2834987233449D+01, 0.9561746721300D-02, + : 0.8311234227190D-08, 0.2202951835758D+01, 0.3801276407308D+00, + : 0.6599472832414D-08, 0.4478581462618D+01, 0.1063314406849D+01, + : 0.6160491096549D-08, 0.5145858696411D+01, 0.1368660381889D+01, + : 0.6164772043891D-08, 0.3762976697911D+00, 0.4234171675140D+00, + : 0.6363248684450D-08, 0.3162246718685D+01, 0.1253008786510D-01, + : 0.6448587520999D-08, 0.3442693302119D+01, 0.5287268506303D+00 / + DATA ((S0(I,J,1),I=1,3),J=141,150) / + : 0.6431662283977D-08, 0.8977549136606D+00, 0.5306550935933D+00, + : 0.6351223158474D-08, 0.4306447410369D+01, 0.5217580628120D+02, + : 0.5476721393451D-08, 0.3888529177855D+01, 0.2221856701002D+01, + : 0.5341772572619D-08, 0.2655560662512D+01, 0.7466759693650D-01, + : 0.5337055758302D-08, 0.5164990735946D+01, 0.7489573444450D-01, + : 0.5373120816787D-08, 0.6041214553456D+01, 0.1274714967946D+00, + : 0.5392351705426D-08, 0.9177763485932D+00, 0.1055449481598D+01, + : 0.6688495850205D-08, 0.3089608126937D+01, 0.2213766559277D+00, + : 0.5072003660362D-08, 0.4311316541553D+01, 0.2132517061319D+00, + : 0.5070726650455D-08, 0.5790675464444D+00, 0.2133464534247D+00 / + DATA ((S0(I,J,1),I=1,3),J=151,160) / + : 0.5658012950032D-08, 0.2703945510675D+01, 0.7287631425543D+00, + : 0.4835509924854D-08, 0.2975422976065D+01, 0.7160067364790D-01, + : 0.6479821978012D-08, 0.1324168733114D+01, 0.2209183458640D-01, + : 0.6230636494980D-08, 0.2860103632836D+01, 0.3306188016693D+00, + : 0.4649239516213D-08, 0.4832259763403D+01, 0.7796265773310D-01, + : 0.6487325792700D-08, 0.2726165825042D+01, 0.3884652414254D+00, + : 0.4682823682770D-08, 0.6966602455408D+00, 0.1073608853559D+01, + : 0.5704230804976D-08, 0.5669634104606D+01, 0.8731175355560D-01, + : 0.6125413585489D-08, 0.1513386538915D+01, 0.7605151500000D-01, + : 0.6035825038187D-08, 0.1983509168227D+01, 0.9846002785331D+00 / + DATA ((S0(I,J,1),I=1,3),J=161,170) / + : 0.4331123462303D-08, 0.2782892992807D+01, 0.4297791515992D+00, + : 0.4681107685143D-08, 0.5337232886836D+01, 0.2127790306879D+00, + : 0.4669105829655D-08, 0.5837133792160D+01, 0.2138191288687D+00, + : 0.5138823602365D-08, 0.3080560200507D+01, 0.7233337363710D-01, + : 0.4615856664534D-08, 0.1661747897471D+01, 0.8603097737811D+00, + : 0.4496916702197D-08, 0.2112508027068D+01, 0.7381754420900D-01, + : 0.4278479042945D-08, 0.5716528462627D+01, 0.7574578717200D-01, + : 0.3840525503932D-08, 0.6424172726492D+00, 0.3407705765729D+00, + : 0.4866636509685D-08, 0.4919244697715D+01, 0.7722995774390D-01, + : 0.3526100639296D-08, 0.2550821052734D+01, 0.6225157782540D-01 / + DATA ((S0(I,J,1),I=1,3),J=171,180) / + : 0.3939558488075D-08, 0.3939331491710D+01, 0.5268983110410D-01, + : 0.4041268772576D-08, 0.2275337571218D+01, 0.3503323232942D+00, + : 0.3948761842853D-08, 0.1999324200790D+01, 0.1451108196653D+00, + : 0.3258394550029D-08, 0.9121001378200D+00, 0.5296435984654D+00, + : 0.3257897048761D-08, 0.3428428660869D+01, 0.5297383457582D+00, + : 0.3842559031298D-08, 0.6132927720035D+01, 0.9098186128426D+00, + : 0.3109920095448D-08, 0.7693650193003D+00, 0.3932462625300D-02, + : 0.3132237775119D-08, 0.3621293854908D+01, 0.2346394437820D+00, + : 0.3942189421510D-08, 0.4841863659733D+01, 0.3180992042600D-02, + : 0.3796972285340D-08, 0.1814174994268D+01, 0.1862120789403D+00 / + DATA ((S0(I,J,1),I=1,3),J=181,190) / + : 0.3995640233688D-08, 0.1386990406091D+01, 0.4549093064213D+00, + : 0.2875013727414D-08, 0.9178318587177D+00, 0.1905464808669D+01, + : 0.3073719932844D-08, 0.2688923811835D+01, 0.3628624111593D+00, + : 0.2731016580075D-08, 0.1188259127584D+01, 0.2131850110243D+00, + : 0.2729549896546D-08, 0.3702160634273D+01, 0.2134131485323D+00, + : 0.3339372892449D-08, 0.7199163960331D+00, 0.2007689919132D+00, + : 0.2898833764204D-08, 0.1916709364999D+01, 0.5291709230214D+00, + : 0.2894536549362D-08, 0.2424043195547D+01, 0.5302110212022D+00, + : 0.3096872473843D-08, 0.4445894977497D+01, 0.2976424921901D+00, + : 0.2635672326810D-08, 0.3814366984117D+01, 0.1485980103780D+01 / + DATA ((S0(I,J,1),I=1,3),J=191,200) / + : 0.3649302697001D-08, 0.2924200596084D+01, 0.6044726378023D+00, + : 0.3127954585895D-08, 0.1842251648327D+01, 0.1084620721060D+00, + : 0.2616040173947D-08, 0.4155841921984D+01, 0.1258454114666D+01, + : 0.2597395859860D-08, 0.1158045978874D+00, 0.2103781122809D+00, + : 0.2593286172210D-08, 0.4771850408691D+01, 0.2162200472757D+00, + : 0.2481823585747D-08, 0.4608842558889D+00, 0.1062562936266D+01, + : 0.2742219550725D-08, 0.1538781127028D+01, 0.5651155736444D+00, + : 0.3199558469610D-08, 0.3226647822878D+00, 0.7036329877322D+00, + : 0.2666088542957D-08, 0.1967991731219D+00, 0.1400015846597D+00, + : 0.2397067430580D-08, 0.3707036669873D+01, 0.2125476091956D+00 / + DATA ((S0(I,J,1),I=1,3),J=201,210) / + : 0.2376570772738D-08, 0.1182086628042D+01, 0.2140505503610D+00, + : 0.2547228007887D-08, 0.4906256820629D+01, 0.1534957940063D+00, + : 0.2265575594114D-08, 0.3414949866857D+01, 0.2235935264888D+00, + : 0.2464381430585D-08, 0.4599122275378D+01, 0.2091065926078D+00, + : 0.2433408527044D-08, 0.2830751145445D+00, 0.2174915669488D+00, + : 0.2443605509076D-08, 0.4212046432538D+01, 0.1739420156204D+00, + : 0.2319779262465D-08, 0.9881978408630D+00, 0.7530171478090D-01, + : 0.2284622835465D-08, 0.5565347331588D+00, 0.7426161660010D-01, + : 0.2467268750783D-08, 0.5655708150766D+00, 0.2526561439362D+00, + : 0.2808513492782D-08, 0.1418405053408D+01, 0.5636314030725D+00 / + DATA ((S0(I,J,1),I=1,3),J=211,NS0X) / + : 0.2329528932532D-08, 0.4069557545675D+01, 0.1056200952181D+01, + : 0.9698639532817D-09, 0.1074134313634D+01, 0.7826370942180D+02 / + +* SSB-to-Sun, T^1, X + DATA ((S1(I,J,1),I=1,3),J= 1, 10) / + : -0.1296310361520D-07, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.8975769009438D-08, 0.1128891609250D+01, 0.4265981595566D+00, + : 0.7771113441307D-08, 0.2706039877077D+01, 0.2061856251104D+00, + : 0.7538303866642D-08, 0.2191281289498D+01, 0.2204125344462D+00, + : 0.6061384579336D-08, 0.3248167319958D+01, 0.1059381944224D+01, + : 0.5726994235594D-08, 0.5569981398610D+01, 0.5225775174439D+00, + : 0.5616492836424D-08, 0.5057386614909D+01, 0.5368044267797D+00, + : 0.1010881584769D-08, 0.3473577116095D+01, 0.7113454667900D-02, + : 0.7259606157626D-09, 0.3651858593665D+00, 0.6398972393349D+00, + : 0.8755095026935D-09, 0.1662835408338D+01, 0.4194847048887D+00 / + DATA ((S1(I,J,1),I=1,3),J= 11, 20) / + : 0.5370491182812D-09, 0.1327673878077D+01, 0.4337116142245D+00, + : 0.5743773887665D-09, 0.4250200846687D+01, 0.2132990797783D+00, + : 0.4408103140300D-09, 0.3598752574277D+01, 0.1589072916335D+01, + : 0.3101892374445D-09, 0.4887822983319D+01, 0.1052268489556D+01, + : 0.3209453713578D-09, 0.9702272295114D+00, 0.5296909721118D+00, + : 0.3017228286064D-09, 0.5484462275949D+01, 0.1066495398892D+01, + : 0.3200700038601D-09, 0.2846613338643D+01, 0.1495633313810D+00, + : 0.2137637279911D-09, 0.5692163292729D+00, 0.3163918923335D+00, + : 0.1899686386727D-09, 0.2061077157189D+01, 0.2275259891141D+00, + : 0.1401994545308D-09, 0.4177771136967D+01, 0.1102062672231D+00 / + DATA ((S1(I,J,1),I=1,3),J= 21, 30) / + : 0.1578057810499D-09, 0.5782460597335D+01, 0.7626583626240D-01, + : 0.1237713253351D-09, 0.5705900866881D+01, 0.5154640627760D+00, + : 0.1313076837395D-09, 0.5163438179576D+01, 0.3664874755930D-01, + : 0.1184963304860D-09, 0.3054804427242D+01, 0.6327837846670D+00, + : 0.1238130878565D-09, 0.2317292575962D+01, 0.3961708870310D-01, + : 0.1015959527736D-09, 0.2194643645526D+01, 0.7329749511860D-01, + : 0.9017954423714D-10, 0.2868603545435D+01, 0.1990721704425D+00, + : 0.8668024955603D-10, 0.4923849675082D+01, 0.5439178814476D+00, + : 0.7756083930103D-10, 0.3014334135200D+01, 0.9491756770005D+00, + : 0.7536503401741D-10, 0.2704886279769D+01, 0.1030928125552D+00 / + DATA ((S1(I,J,1),I=1,3),J= 31, 40) / + : 0.5483308679332D-10, 0.6010983673799D+01, 0.8531963191132D+00, + : 0.5184339620428D-10, 0.1952704573291D+01, 0.2093666171530D+00, + : 0.5108658712030D-10, 0.2958575786649D+01, 0.2172315424036D+00, + : 0.5019424524650D-10, 0.1736317621318D+01, 0.2164800718209D+00, + : 0.4909312625978D-10, 0.3167216416257D+01, 0.2101180877357D+00, + : 0.4456638901107D-10, 0.7697579923471D+00, 0.3235053470014D+00, + : 0.4227030350925D-10, 0.3490910137928D+01, 0.6373574839730D-01, + : 0.4095456040093D-10, 0.5178888984491D+00, 0.6470106940028D+00, + : 0.4990537041422D-10, 0.3323887668974D+01, 0.1422690933580D-01, + : 0.4321170010845D-10, 0.4288484987118D+01, 0.7358765972222D+00 / + DATA ((S1(I,J,1),I=1,3),J= 41,NS1X) / + : 0.3544072091802D-10, 0.6021051579251D+01, 0.5265099800692D+00, + : 0.3480198638687D-10, 0.4600027054714D+01, 0.5328719641544D+00, + : 0.3440287244435D-10, 0.4349525970742D+01, 0.8582758298370D-01, + : 0.3330628322713D-10, 0.2347391505082D+01, 0.1104591729320D-01, + : 0.2973060707184D-10, 0.4789409286400D+01, 0.5257585094865D+00, + : 0.2932606766089D-10, 0.5831693799927D+01, 0.5336234347371D+00, + : 0.2876972310953D-10, 0.2692638514771D+01, 0.1173197218910D+00, + : 0.2827488278556D-10, 0.2056052487960D+01, 0.2022531624851D+00, + : 0.2515028239756D-10, 0.7411863262449D+00, 0.9597935788730D-01, + : 0.2853033744415D-10, 0.3948481024894D+01, 0.2118763888447D+01 / + +* SSB-to-Sun, T^2, X + DATA ((S2(I,J,1),I=1,3),J= 1,NS2X) / + : 0.1603551636587D-11, 0.4404109410481D+01, 0.2061856251104D+00, + : 0.1556935889384D-11, 0.4818040873603D+00, 0.2204125344462D+00, + : 0.1182594414915D-11, 0.9935762734472D+00, 0.5225775174439D+00, + : 0.1158794583180D-11, 0.3353180966450D+01, 0.5368044267797D+00, + : 0.9597358943932D-12, 0.5567045358298D+01, 0.2132990797783D+00, + : 0.6511516579605D-12, 0.5630872420788D+01, 0.4265981595566D+00, + : 0.7419792747688D-12, 0.2156188581957D+01, 0.5296909721118D+00, + : 0.3951972655848D-12, 0.1981022541805D+01, 0.1059381944224D+01, + : 0.4478223877045D-12, 0.0000000000000D+00, 0.0000000000000D+00 / + +* SSB-to-Sun, T^0, Y + DATA ((S0(I,J,2),I=1,3),J= 1, 10) / + : 0.4955392320126D-02, 0.2170467313679D+01, 0.5296909721118D+00, + : 0.2722325167392D-02, 0.2444433682196D+01, 0.2132990797783D+00, + : 0.1546579925346D-02, 0.5992779281546D+00, 0.3813291813120D-01, + : 0.8363140252966D-03, 0.7687356310801D+00, 0.7478166569050D-01, + : 0.3385792683603D-03, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.1201192221613D-03, 0.2520035601514D+01, 0.1059381944224D+01, + : 0.7587125720554D-04, 0.1669954006449D+01, 0.4265981595566D+00, + : 0.1964155361250D-04, 0.5707743963343D+01, 0.2061856251104D+00, + : 0.1891900364909D-04, 0.2320960679937D+01, 0.2204125344462D+00, + : 0.1937373433356D-04, 0.3226940689555D+01, 0.1495633313810D+00 / + DATA ((S0(I,J,2),I=1,3),J= 11, 20) / + : 0.1437139941351D-04, 0.2301626908096D+01, 0.5225775174439D+00, + : 0.1406267683099D-04, 0.5188579265542D+01, 0.5368044267797D+00, + : 0.1178703080346D-04, 0.5489483248476D+01, 0.7626583626240D-01, + : 0.8079835186041D-05, 0.1683751835264D+01, 0.3664874755930D-01, + : 0.7623253594652D-05, 0.2656400462961D+01, 0.3961708870310D-01, + : 0.6248667483971D-05, 0.4992775362055D+01, 0.7329749511860D-01, + : 0.4366353695038D-05, 0.2869706279678D+01, 0.1589072916335D+01, + : 0.3829101568895D-05, 0.3572131359950D+01, 0.7113454667900D-02, + : 0.3175733773908D-05, 0.4535372530045D+01, 0.4194847048887D+00, + : 0.3092437902159D-05, 0.9230153317909D+00, 0.6398972393349D+00 / + DATA ((S0(I,J,2),I=1,3),J= 21, 30) / + : 0.2874168812154D-05, 0.3363143761101D+01, 0.1102062672231D+00, + : 0.3040119321826D-05, 0.3324250895675D+01, 0.6283075850446D+01, + : 0.2699723308006D-05, 0.2917882441928D+00, 0.1030928125552D+00, + : 0.2134832683534D-05, 0.4220997202487D+01, 0.3163918923335D+00, + : 0.1770412139433D-05, 0.4747318496462D+01, 0.1021328554739D+02, + : 0.1377264209373D-05, 0.4305058462401D+00, 0.1484170571900D-02, + : 0.1127814538960D-05, 0.8538177240740D+00, 0.6327837846670D+00, + : 0.1055608090130D-05, 0.1551800742580D+01, 0.4337116142245D+00, + : 0.9802673861420D-06, 0.1459646735377D+01, 0.1052268489556D+01, + : 0.1090329461951D-05, 0.1587351228711D+01, 0.1162474756779D+01 / + DATA ((S0(I,J,2),I=1,3),J= 31, 40) / + : 0.6959590025090D-06, 0.5534442628766D+01, 0.1066495398892D+01, + : 0.5664914529542D-06, 0.6030673003297D+01, 0.9491756770005D+00, + : 0.6607787763599D-06, 0.4989507233927D+01, 0.8460828644453D+00, + : 0.6269725742838D-06, 0.4222951804572D+01, 0.1480791608091D+00, + : 0.6301889697863D-06, 0.5444316669126D+01, 0.2243449970715D+00, + : 0.4891042662861D-06, 0.1490552839784D+01, 0.3340612434717D+01, + : 0.3457083123290D-06, 0.3030475486049D+01, 0.3516457698740D-01, + : 0.3032559967314D-06, 0.2652038793632D+01, 0.1104591729320D-01, + : 0.2841133988903D-06, 0.1276744786829D+01, 0.4110125927500D-01, + : 0.2855564444432D-06, 0.2143368674733D+01, 0.1510475019529D+00 / + DATA ((S0(I,J,2),I=1,3),J= 41, 50) / + : 0.2765157135038D-06, 0.5444186109077D+01, 0.6373574839730D-01, + : 0.2382312465034D-06, 0.2190521137593D+01, 0.2275259891141D+00, + : 0.2808060365077D-06, 0.5735195064841D+01, 0.2535050500000D-01, + : 0.2332175234405D-06, 0.9481985524859D-01, 0.7181332454670D-01, + : 0.2322488199659D-06, 0.5180499361533D+01, 0.8582758298370D-01, + : 0.1881850258423D-06, 0.3219788273885D+01, 0.2118763888447D+01, + : 0.2196111392808D-06, 0.2366941159761D+01, 0.2968341143800D-02, + : 0.2183810335519D-06, 0.4825445110915D+01, 0.7775000683430D-01, + : 0.2002733093326D-06, 0.2457148995307D+01, 0.2093666171530D+00, + : 0.1967111767229D-06, 0.5586291545459D+01, 0.2172315424036D+00 / + DATA ((S0(I,J,2),I=1,3),J= 51, 60) / + : 0.1568473250543D-06, 0.3708003123320D+01, 0.7429900518901D+00, + : 0.1852528314300D-06, 0.4310638151560D+01, 0.2022531624851D+00, + : 0.1832111226447D-06, 0.1494665322656D+01, 0.3235053470014D+00, + : 0.1746805502310D-06, 0.1451378500784D+01, 0.1385174140878D+00, + : 0.1555730966650D-06, 0.1068040418198D+01, 0.7358765972222D+00, + : 0.1554883462559D-06, 0.2442579035461D+01, 0.5154640627760D+00, + : 0.1638380568746D-06, 0.2597913420625D+00, 0.8531963191132D+00, + : 0.1159938593640D-06, 0.5834512021280D+01, 0.1990721704425D+00, + : 0.1083427965695D-06, 0.5054033177950D+01, 0.5439178814476D+00, + : 0.1156480369431D-06, 0.5325677432457D+01, 0.5257585094865D+00 / + DATA ((S0(I,J,2),I=1,3),J= 61, 70) / + : 0.1141308860095D-06, 0.2153403923857D+01, 0.5336234347371D+00, + : 0.7913146470946D-07, 0.8642846847027D+00, 0.1478866649112D+01, + : 0.7439752463733D-07, 0.1970628496213D+01, 0.2164800718209D+00, + : 0.7280277104079D-07, 0.6073307250609D+01, 0.2101180877357D+00, + : 0.8319567719136D-07, 0.1954371928334D+01, 0.1692165728891D+01, + : 0.7137705549290D-07, 0.8904989440909D+00, 0.4155522422634D+00, + : 0.6900825396225D-07, 0.2825717714977D+01, 0.1173197218910D+00, + : 0.7245757216635D-07, 0.2481677513331D+01, 0.1265567569334D+01, + : 0.6961165696255D-07, 0.1292955312978D+01, 0.9562891316684D+00, + : 0.7571804456890D-07, 0.3427517575069D+01, 0.1422690933580D-01 / + DATA ((S0(I,J,2),I=1,3),J= 71, 80) / + : 0.6605425721904D-07, 0.8052192701492D+00, 0.6470106940028D+00, + : 0.7375477357248D-07, 0.1705076390088D+01, 0.1581959461667D+01, + : 0.7041664951470D-07, 0.4848356967891D+00, 0.9597935788730D-01, + : 0.6322199535763D-07, 0.3878069473909D+01, 0.7084920306520D-01, + : 0.5244380279191D-07, 0.2645560544125D+01, 0.5265099800692D+00, + : 0.5143125704988D-07, 0.4834486101370D+01, 0.5328719641544D+00, + : 0.5871866319373D-07, 0.7981472548900D+00, 0.7871412831580D-01, + : 0.6300822573871D-07, 0.5979398788281D+01, 0.2608790314060D+02, + : 0.6062154271548D-07, 0.4108655402756D+01, 0.1114304132498D+00, + : 0.4361912339976D-07, 0.5322624319280D+01, 0.1375773836557D+01 / + DATA ((S0(I,J,2),I=1,3),J= 81, 90) / + : 0.4417005920067D-07, 0.6240817359284D+01, 0.2770348281756D+00, + : 0.4686806749936D-07, 0.3214977301156D+01, 0.1143987543936D+00, + : 0.3758892132305D-07, 0.5879809634765D+01, 0.1596186371003D+01, + : 0.5151351332319D-07, 0.2893377688007D+00, 0.2228608264996D+00, + : 0.4554683578572D-07, 0.5475427144122D+01, 0.1465949902372D+00, + : 0.3442381385338D-07, 0.5992034796640D+01, 0.5070101000000D-01, + : 0.2831093954933D-07, 0.5367350273914D+01, 0.3092784376656D+00, + : 0.3756267090084D-07, 0.5758171285420D+01, 0.4903339079539D+00, + : 0.2816374679892D-07, 0.1863718700923D+01, 0.2991266627620D+00, + : 0.3419307025569D-07, 0.9524347534130D+00, 0.3518164938661D+00 / + DATA ((S0(I,J,2),I=1,3),J= 91,100) / + : 0.2904250494239D-07, 0.5304471615602D+01, 0.1099462426779D+00, + : 0.2471734511206D-07, 0.1297069793530D+01, 0.6256703299991D+00, + : 0.2539620831872D-07, 0.3281126083375D+01, 0.1256615170089D+02, + : 0.2281017868007D-07, 0.1829122133165D+01, 0.6681224869435D+01, + : 0.2275319473335D-07, 0.5797198160181D+01, 0.3932462625300D-02, + : 0.2547755368442D-07, 0.4752697708330D+01, 0.1169588211447D+01, + : 0.2285979669317D-07, 0.1223205292886D+01, 0.1045155034888D+01, + : 0.1913386560994D-07, 0.1757532993389D+01, 0.1155361302111D+01, + : 0.1809020525147D-07, 0.4246116108791D+01, 0.3368040641550D-01, + : 0.1649213300201D-07, 0.1445162890627D+01, 0.4408250688924D+00 / + DATA ((S0(I,J,2),I=1,3),J=101,110) / + : 0.1834972793932D-07, 0.1126917567225D+01, 0.4452511715700D-02, + : 0.1439550648138D-07, 0.6160756834764D+01, 0.9420622223326D+00, + : 0.1487645457041D-07, 0.4358761931792D+01, 0.4123712502208D+00, + : 0.1731729516660D-07, 0.6134456753344D+01, 0.2108507877249D+00, + : 0.1717747163567D-07, 0.1898186084455D+01, 0.2157473718317D+00, + : 0.1418190430374D-07, 0.4180286741266D+01, 0.6521991896920D-01, + : 0.1404844134873D-07, 0.7654053565412D-01, 0.4258542984690D-01, + : 0.1409842846538D-07, 0.4418612420312D+01, 0.2258291676434D+00, + : 0.1090948346291D-07, 0.1260615686131D+01, 0.4226656969313D+00, + : 0.1357577323612D-07, 0.3558248818690D+01, 0.7923417740620D-01 / + DATA ((S0(I,J,2),I=1,3),J=111,120) / + : 0.1018154061960D-07, 0.5676087241256D+01, 0.1456308687557D+00, + : 0.1412073972109D-07, 0.8394392632422D+00, 0.1525316725248D+00, + : 0.1030938326496D-07, 0.1653593274064D+01, 0.1795258541446D+01, + : 0.1180081567104D-07, 0.1285802592036D+01, 0.7032915397480D-01, + : 0.9708510575650D-08, 0.7631889488106D+00, 0.8434341241180D-01, + : 0.9637689663447D-08, 0.4630642649176D+01, 0.1272681024002D+01, + : 0.1068910429389D-07, 0.5294934032165D+01, 0.2123349582968D+00, + : 0.1063716179336D-07, 0.2736266800832D+01, 0.2142632012598D+00, + : 0.1234858713814D-07, 0.1302891146570D+01, 0.1847279083684D+00, + : 0.8912631189738D-08, 0.3570415993621D+01, 0.2648454860559D+01 / + DATA ((S0(I,J,2),I=1,3),J=121,130) / + : 0.1036378285534D-07, 0.4236693440949D+01, 0.1370332435159D+00, + : 0.9667798501561D-08, 0.2960768892398D+01, 0.4376440768498D+00, + : 0.8108314201902D-08, 0.6987781646841D+00, 0.2880807454688D+00, + : 0.7648364324628D-08, 0.2499017863863D+01, 0.2037373330570D+00, + : 0.7286136828406D-08, 0.3787426951665D+01, 0.1129145838217D+00, + : 0.9448237743913D-08, 0.2694354332983D+01, 0.5272426800584D+00, + : 0.9374276106428D-08, 0.4787121277064D+01, 0.5321392641652D+00, + : 0.7100226287462D-08, 0.3530238792101D+00, 0.6288513220417D+00, + : 0.9253056659571D-08, 0.1399478925664D+01, 0.1606092486742D+00, + : 0.6636432145504D-08, 0.3479575438447D+01, 0.1368660381889D+01 / + DATA ((S0(I,J,2),I=1,3),J=131,140) / + : 0.6469975312932D-08, 0.1383669964800D+01, 0.2008557621224D+01, + : 0.7335849729765D-08, 0.1243698166898D+01, 0.9561746721300D-02, + : 0.8743421205855D-08, 0.3776164289301D+01, 0.3801276407308D+00, + : 0.5993635744494D-08, 0.5627122113596D+01, 0.2042657109477D+02, + : 0.5981008479693D-08, 0.1674336636752D+01, 0.2111650433779D+01, + : 0.6188535145838D-08, 0.5214925208672D+01, 0.4305306221819D+00, + : 0.6596074017566D-08, 0.2907653268124D+01, 0.1063314406849D+01, + : 0.6630815126226D-08, 0.2127643669658D+01, 0.8389694097774D+00, + : 0.6156772830040D-08, 0.5082160803295D+01, 0.4234171675140D+00, + : 0.6446960563014D-08, 0.1872100916905D+01, 0.5287268506303D+00 / + DATA ((S0(I,J,2),I=1,3),J=141,150) / + : 0.6429324424668D-08, 0.5610276103577D+01, 0.5306550935933D+00, + : 0.6302232396465D-08, 0.1592152049607D+01, 0.1253008786510D-01, + : 0.6399244436159D-08, 0.2746214421532D+01, 0.5217580628120D+02, + : 0.5474965172558D-08, 0.2317666374383D+01, 0.2221856701002D+01, + : 0.5339293190692D-08, 0.1084724961156D+01, 0.7466759693650D-01, + : 0.5334733683389D-08, 0.3594106067745D+01, 0.7489573444450D-01, + : 0.5392665782110D-08, 0.5630254365606D+01, 0.1055449481598D+01, + : 0.6682075673789D-08, 0.1518480041732D+01, 0.2213766559277D+00, + : 0.5079130495960D-08, 0.2739765115711D+01, 0.2132517061319D+00, + : 0.5077759793261D-08, 0.5290711290094D+01, 0.2133464534247D+00 / + DATA ((S0(I,J,2),I=1,3),J=151,160) / + : 0.4832037368310D-08, 0.1404473217200D+01, 0.7160067364790D-01, + : 0.6463279674802D-08, 0.6038381695210D+01, 0.2209183458640D-01, + : 0.6240592771560D-08, 0.1290170653666D+01, 0.3306188016693D+00, + : 0.4672013521493D-08, 0.3261895939677D+01, 0.7796265773310D-01, + : 0.6500650750348D-08, 0.1154522312095D+01, 0.3884652414254D+00, + : 0.6344161389053D-08, 0.6206111545062D+01, 0.7605151500000D-01, + : 0.4682518370646D-08, 0.5409118796685D+01, 0.1073608853559D+01, + : 0.5329460015591D-08, 0.1202985784864D+01, 0.7287631425543D+00, + : 0.5701588675898D-08, 0.4098715257064D+01, 0.8731175355560D-01, + : 0.6030690867211D-08, 0.4132033218460D+00, 0.9846002785331D+00 / + DATA ((S0(I,J,2),I=1,3),J=161,170) / + : 0.4336256312655D-08, 0.1211415991827D+01, 0.4297791515992D+00, + : 0.4688498808975D-08, 0.3765479072409D+01, 0.2127790306879D+00, + : 0.4675578609335D-08, 0.4265540037226D+01, 0.2138191288687D+00, + : 0.4225578112158D-08, 0.5237566010676D+01, 0.3407705765729D+00, + : 0.5139422230028D-08, 0.1507173079513D+01, 0.7233337363710D-01, + : 0.4619995093571D-08, 0.9023957449848D-01, 0.8603097737811D+00, + : 0.4494776255461D-08, 0.5414930552139D+00, 0.7381754420900D-01, + : 0.4274026276788D-08, 0.4145735303659D+01, 0.7574578717200D-01, + : 0.5018141789353D-08, 0.3344408829055D+01, 0.3180992042600D-02, + : 0.4866163952181D-08, 0.3348534657607D+01, 0.7722995774390D-01 / + DATA ((S0(I,J,2),I=1,3),J=171,180) / + : 0.4111986020501D-08, 0.4198823597220D+00, 0.1451108196653D+00, + : 0.3356142784950D-08, 0.5609144747180D+01, 0.1274714967946D+00, + : 0.4070575554551D-08, 0.7028411059224D+00, 0.3503323232942D+00, + : 0.3257451857278D-08, 0.5624697983086D+01, 0.5296435984654D+00, + : 0.3256973703026D-08, 0.1857842076707D+01, 0.5297383457582D+00, + : 0.3830771508640D-08, 0.4562887279931D+01, 0.9098186128426D+00, + : 0.3725024005962D-08, 0.2358058692652D+00, 0.1084620721060D+00, + : 0.3136763921756D-08, 0.2049731526845D+01, 0.2346394437820D+00, + : 0.3795147256194D-08, 0.2432356296933D+00, 0.1862120789403D+00, + : 0.2877342229911D-08, 0.5631101279387D+01, 0.1905464808669D+01 / + DATA ((S0(I,J,2),I=1,3),J=181,190) / + : 0.3076931798805D-08, 0.1117615737392D+01, 0.3628624111593D+00, + : 0.2734765945273D-08, 0.5899826516955D+01, 0.2131850110243D+00, + : 0.2733405296885D-08, 0.2130562964070D+01, 0.2134131485323D+00, + : 0.2898552353410D-08, 0.3462387048225D+00, 0.5291709230214D+00, + : 0.2893736103681D-08, 0.8534352781543D+00, 0.5302110212022D+00, + : 0.3095717734137D-08, 0.2875061429041D+01, 0.2976424921901D+00, + : 0.2636190425832D-08, 0.2242512846659D+01, 0.1485980103780D+01, + : 0.3645512095537D-08, 0.1354016903958D+01, 0.6044726378023D+00, + : 0.2808173547723D-08, 0.6705114365631D-01, 0.6225157782540D-01, + : 0.2625012866888D-08, 0.4775705748482D+01, 0.5268983110410D-01 / + DATA ((S0(I,J,2),I=1,3),J=191,200) / + : 0.2572233995651D-08, 0.2638924216139D+01, 0.1258454114666D+01, + : 0.2604238824792D-08, 0.4826358927373D+01, 0.2103781122809D+00, + : 0.2596886385239D-08, 0.3200388483118D+01, 0.2162200472757D+00, + : 0.3228057304264D-08, 0.5384848409563D+01, 0.2007689919132D+00, + : 0.2481601798252D-08, 0.5173373487744D+01, 0.1062562936266D+01, + : 0.2745977498864D-08, 0.6250966149853D+01, 0.5651155736444D+00, + : 0.2669878833811D-08, 0.4906001352499D+01, 0.1400015846597D+00, + : 0.3203986611711D-08, 0.5034333010005D+01, 0.7036329877322D+00, + : 0.3354961227212D-08, 0.6108262423137D+01, 0.4549093064213D+00, + : 0.2400407324558D-08, 0.2135399294955D+01, 0.2125476091956D+00 / + DATA ((S0(I,J,2),I=1,3),J=201,210) / + : 0.2379905859802D-08, 0.5893721933961D+01, 0.2140505503610D+00, + : 0.2550844302187D-08, 0.3331940762063D+01, 0.1534957940063D+00, + : 0.2268824211001D-08, 0.1843418461035D+01, 0.2235935264888D+00, + : 0.2464700891204D-08, 0.3029548547230D+01, 0.2091065926078D+00, + : 0.2436814726024D-08, 0.4994717970364D+01, 0.2174915669488D+00, + : 0.2443623894745D-08, 0.2645102591375D+01, 0.1739420156204D+00, + : 0.2318701783838D-08, 0.5700547397897D+01, 0.7530171478090D-01, + : 0.2284448700256D-08, 0.5268898905872D+01, 0.7426161660010D-01, + : 0.2468848123510D-08, 0.5276280575078D+01, 0.2526561439362D+00, + : 0.2814052350303D-08, 0.6130168623475D+01, 0.5636314030725D+00 / + DATA ((S0(I,J,2),I=1,3),J=211,NS0Y) / + : 0.2243662755220D-08, 0.6631692457995D+00, 0.8886590321940D-01, + : 0.2330795855941D-08, 0.2499435487702D+01, 0.1056200952181D+01, + : 0.9757679038404D-09, 0.5796846023126D+01, 0.7826370942180D+02 / + +* SSB-to-Sun, T^1, Y + DATA ((S1(I,J,2),I=1,3),J= 1, 10) / + : 0.8989047573576D-08, 0.5840593672122D+01, 0.4265981595566D+00, + : 0.7815938401048D-08, 0.1129664707133D+01, 0.2061856251104D+00, + : 0.7550926713280D-08, 0.6196589104845D+00, 0.2204125344462D+00, + : 0.6056556925895D-08, 0.1677494667846D+01, 0.1059381944224D+01, + : 0.5734142698204D-08, 0.4000920852962D+01, 0.5225775174439D+00, + : 0.5614341822459D-08, 0.3486722577328D+01, 0.5368044267797D+00, + : 0.1028678147656D-08, 0.1877141024787D+01, 0.7113454667900D-02, + : 0.7270792075266D-09, 0.5077167301739D+01, 0.6398972393349D+00, + : 0.8734141726040D-09, 0.9069550282609D-01, 0.4194847048887D+00, + : 0.5377371402113D-09, 0.6039381844671D+01, 0.4337116142245D+00 / + DATA ((S1(I,J,2),I=1,3),J= 11, 20) / + : 0.4729719431571D-09, 0.2153086311760D+01, 0.2132990797783D+00, + : 0.4458052820973D-09, 0.5059830025565D+01, 0.5296909721118D+00, + : 0.4406855467908D-09, 0.2027971692630D+01, 0.1589072916335D+01, + : 0.3101659310977D-09, 0.3317677981860D+01, 0.1052268489556D+01, + : 0.3016749232545D-09, 0.3913703482532D+01, 0.1066495398892D+01, + : 0.3198541352656D-09, 0.1275513098525D+01, 0.1495633313810D+00, + : 0.2142065389871D-09, 0.5301351614597D+01, 0.3163918923335D+00, + : 0.1902615247592D-09, 0.4894943352736D+00, 0.2275259891141D+00, + : 0.1613410990871D-09, 0.2449891130437D+01, 0.1102062672231D+00, + : 0.1576992165097D-09, 0.4211421447633D+01, 0.7626583626240D-01 / + DATA ((S1(I,J,2),I=1,3),J= 21, 30) / + : 0.1241637259894D-09, 0.4140803368133D+01, 0.5154640627760D+00, + : 0.1313974830355D-09, 0.3591920305503D+01, 0.3664874755930D-01, + : 0.1181697118258D-09, 0.1506314382788D+01, 0.6327837846670D+00, + : 0.1238239742779D-09, 0.7461405378404D+00, 0.3961708870310D-01, + : 0.1010107068241D-09, 0.6271010795475D+00, 0.7329749511860D-01, + : 0.9226316616509D-10, 0.1259158839583D+01, 0.1990721704425D+00, + : 0.8664946419555D-10, 0.3353244696934D+01, 0.5439178814476D+00, + : 0.7757230468978D-10, 0.1447677295196D+01, 0.9491756770005D+00, + : 0.7693168628139D-10, 0.1120509896721D+01, 0.1030928125552D+00, + : 0.5487897454612D-10, 0.4439380426795D+01, 0.8531963191132D+00 / + DATA ((S1(I,J,2),I=1,3),J= 31, 40) / + : 0.5196118677218D-10, 0.3788856619137D+00, 0.2093666171530D+00, + : 0.5110853339935D-10, 0.1386879372016D+01, 0.2172315424036D+00, + : 0.5027804534813D-10, 0.1647881805466D+00, 0.2164800718209D+00, + : 0.4922485922674D-10, 0.1594315079862D+01, 0.2101180877357D+00, + : 0.6155599524400D-10, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.4447147832161D-10, 0.5480720918976D+01, 0.3235053470014D+00, + : 0.4144691276422D-10, 0.1931371033660D+01, 0.6373574839730D-01, + : 0.4099950625452D-10, 0.5229611294335D+01, 0.6470106940028D+00, + : 0.5060541682953D-10, 0.1731112486298D+01, 0.1422690933580D-01, + : 0.4293615946300D-10, 0.2714571038925D+01, 0.7358765972222D+00 / + DATA ((S1(I,J,2),I=1,3),J= 41,NS1Y) / + : 0.3545659845763D-10, 0.4451041444634D+01, 0.5265099800692D+00, + : 0.3479112041196D-10, 0.3029385448081D+01, 0.5328719641544D+00, + : 0.3438516493570D-10, 0.2778507143731D+01, 0.8582758298370D-01, + : 0.3297341285033D-10, 0.7898709807584D+00, 0.1104591729320D-01, + : 0.2972585818015D-10, 0.3218785316973D+01, 0.5257585094865D+00, + : 0.2931707295017D-10, 0.4260731012098D+01, 0.5336234347371D+00, + : 0.2897198149403D-10, 0.1120753978101D+01, 0.1173197218910D+00, + : 0.2832293240878D-10, 0.4597682717827D+00, 0.2022531624851D+00, + : 0.2864348326612D-10, 0.2169939928448D+01, 0.9597935788730D-01, + : 0.2852714675471D-10, 0.2377659870578D+01, 0.2118763888447D+01 / + +* SSB-to-Sun, T^2, Y + DATA ((S2(I,J,2),I=1,3),J= 1,NS2Y) / + : 0.1609114495091D-11, 0.2831096993481D+01, 0.2061856251104D+00, + : 0.1560330784946D-11, 0.5193058213906D+01, 0.2204125344462D+00, + : 0.1183535479202D-11, 0.5707003443890D+01, 0.5225775174439D+00, + : 0.1158183066182D-11, 0.1782400404928D+01, 0.5368044267797D+00, + : 0.1032868027407D-11, 0.4036925452011D+01, 0.2132990797783D+00, + : 0.6540142847741D-12, 0.4058241056717D+01, 0.4265981595566D+00, + : 0.7305236491596D-12, 0.6175401942957D+00, 0.5296909721118D+00, + : -0.5580725052968D-12, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.3946122651015D-12, 0.4108265279171D+00, 0.1059381944224D+01 / + +* SSB-to-Sun, T^0, Z + DATA ((S0(I,J,3),I=1,3),J= 1, 10) / + : 0.1181255122986D-03, 0.4607918989164D+00, 0.2132990797783D+00, + : 0.1127777651095D-03, 0.4169146331296D+00, 0.5296909721118D+00, + : 0.4777754401806D-04, 0.4582657007130D+01, 0.3813291813120D-01, + : 0.1129354285772D-04, 0.5758735142480D+01, 0.7478166569050D-01, + : -0.1149543637123D-04, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.3298730512306D-05, 0.5978801994625D+01, 0.4265981595566D+00, + : 0.2733376706079D-05, 0.7665413691040D+00, 0.1059381944224D+01, + : 0.9426389657270D-06, 0.3710201265838D+01, 0.2061856251104D+00, + : 0.8187517749552D-06, 0.3390675605802D+00, 0.2204125344462D+00, + : 0.4080447871819D-06, 0.4552296640088D+00, 0.5225775174439D+00 / + DATA ((S0(I,J,3),I=1,3),J= 11, 20) / + : 0.3169973017028D-06, 0.3445455899321D+01, 0.5368044267797D+00, + : 0.2438098615549D-06, 0.5664675150648D+01, 0.3664874755930D-01, + : 0.2601897517235D-06, 0.1931894095697D+01, 0.1495633313810D+00, + : 0.2314558080079D-06, 0.3666319115574D+00, 0.3961708870310D-01, + : 0.1962549548002D-06, 0.3167411699020D+01, 0.7626583626240D-01, + : 0.2180518287925D-06, 0.1544420746580D+01, 0.7113454667900D-02, + : 0.1451382442868D-06, 0.1583756740070D+01, 0.1102062672231D+00, + : 0.1358439007389D-06, 0.5239941758280D+01, 0.6398972393349D+00, + : 0.1050585898028D-06, 0.2266958352859D+01, 0.3163918923335D+00, + : 0.1050029870186D-06, 0.2711495250354D+01, 0.4194847048887D+00 / + DATA ((S0(I,J,3),I=1,3),J= 21, 30) / + : 0.9934920679800D-07, 0.1116208151396D+01, 0.1589072916335D+01, + : 0.1048395331560D-06, 0.3408619600206D+01, 0.1021328554739D+02, + : 0.8370147196668D-07, 0.3810459401087D+01, 0.2535050500000D-01, + : 0.7989856510998D-07, 0.3769910473647D+01, 0.7329749511860D-01, + : 0.5441221655233D-07, 0.2416994903374D+01, 0.1030928125552D+00, + : 0.4610812906784D-07, 0.5858503336994D+01, 0.4337116142245D+00, + : 0.3923022803444D-07, 0.3354170010125D+00, 0.1484170571900D-02, + : 0.2610725582128D-07, 0.5410600646324D+01, 0.6327837846670D+00, + : 0.2455279767721D-07, 0.6120216681403D+01, 0.1162474756779D+01, + : 0.2375530706525D-07, 0.6055443426143D+01, 0.1052268489556D+01 / + DATA ((S0(I,J,3),I=1,3),J= 31, 40) / + : 0.1782967577553D-07, 0.3146108708004D+01, 0.8460828644453D+00, + : 0.1581687095238D-07, 0.6255496089819D+00, 0.3340612434717D+01, + : 0.1594657672461D-07, 0.3782604300261D+01, 0.1066495398892D+01, + : 0.1563448615040D-07, 0.1997775733196D+01, 0.2022531624851D+00, + : 0.1463624258525D-07, 0.1736316792088D+00, 0.3516457698740D-01, + : 0.1331585056673D-07, 0.4331941830747D+01, 0.9491756770005D+00, + : 0.1130634557637D-07, 0.6152017751825D+01, 0.2968341143800D-02, + : 0.1028949607145D-07, 0.2101792614637D+00, 0.2275259891141D+00, + : 0.1024074971618D-07, 0.4071833211074D+01, 0.5070101000000D-01, + : 0.8826956060303D-08, 0.4861633688145D+00, 0.2093666171530D+00 / + DATA ((S0(I,J,3),I=1,3),J= 41, 50) / + : 0.8572230171541D-08, 0.5268190724302D+01, 0.4110125927500D-01, + : 0.7649332643544D-08, 0.5134543417106D+01, 0.2608790314060D+02, + : 0.8581673291033D-08, 0.2920218146681D+01, 0.1480791608091D+00, + : 0.8430589300938D-08, 0.3604576619108D+01, 0.2172315424036D+00, + : 0.7776165501012D-08, 0.3772942249792D+01, 0.6373574839730D-01, + : 0.8311070234408D-08, 0.6200412329888D+01, 0.3235053470014D+00, + : 0.6927365212582D-08, 0.4543353113437D+01, 0.8531963191132D+00, + : 0.6791574208598D-08, 0.2882188406238D+01, 0.7181332454670D-01, + : 0.5593100811839D-08, 0.1776646892780D+01, 0.7429900518901D+00, + : 0.4553381853021D-08, 0.3949617611240D+01, 0.7775000683430D-01 / + DATA ((S0(I,J,3),I=1,3),J= 51, 60) / + : 0.5758000450068D-08, 0.3859251775075D+01, 0.1990721704425D+00, + : 0.4281283457133D-08, 0.1466294631206D+01, 0.2118763888447D+01, + : 0.4206935661097D-08, 0.5421776011706D+01, 0.1104591729320D-01, + : 0.4213751641837D-08, 0.3412048993322D+01, 0.2243449970715D+00, + : 0.5310506239878D-08, 0.5421641370995D+00, 0.5154640627760D+00, + : 0.3827450341320D-08, 0.8887314524995D+00, 0.1510475019529D+00, + : 0.4292435241187D-08, 0.1405043757194D+01, 0.1422690933580D-01, + : 0.3189780702289D-08, 0.1060049293445D+01, 0.1173197218910D+00, + : 0.3226611928069D-08, 0.6270858897442D+01, 0.2164800718209D+00, + : 0.2893897608830D-08, 0.5117563223301D+01, 0.6470106940028D+00 / + DATA ((S0(I,J,3),I=1,3),J= 61,NS0Z) / + : 0.3239852024578D-08, 0.4079092237983D+01, 0.2101180877357D+00, + : 0.2956892222200D-08, 0.1594917021704D+01, 0.3092784376656D+00, + : 0.2980177912437D-08, 0.5258787667564D+01, 0.4155522422634D+00, + : 0.3163725690776D-08, 0.3854589225479D+01, 0.8582758298370D-01, + : 0.2662262399118D-08, 0.3561326430187D+01, 0.5257585094865D+00, + : 0.2766689135729D-08, 0.3180732086830D+00, 0.1385174140878D+00, + : 0.2411600278464D-08, 0.3324798335058D+01, 0.5439178814476D+00, + : 0.2483527695131D-08, 0.4169069291947D+00, 0.5336234347371D+00, + : 0.7788777276590D-09, 0.1900569908215D+01, 0.5217580628120D+02 / + +* SSB-to-Sun, T^1, Z + DATA ((S1(I,J,3),I=1,3),J= 1, 10) / + : 0.5444220475678D-08, 0.1803825509310D+01, 0.2132990797783D+00, + : 0.3883412695596D-08, 0.4668616389392D+01, 0.5296909721118D+00, + : 0.1334341434551D-08, 0.0000000000000D+00, 0.0000000000000D+00, + : 0.3730001266883D-09, 0.5401405918943D+01, 0.2061856251104D+00, + : 0.2894929197956D-09, 0.4932415609852D+01, 0.2204125344462D+00, + : 0.2857950357701D-09, 0.3154625362131D+01, 0.7478166569050D-01, + : 0.2499226432292D-09, 0.3657486128988D+01, 0.4265981595566D+00, + : 0.1937705443593D-09, 0.5740434679002D+01, 0.1059381944224D+01, + : 0.1374894396320D-09, 0.1712857366891D+01, 0.5368044267797D+00, + : 0.1217248678408D-09, 0.2312090870932D+01, 0.5225775174439D+00 / + DATA ((S1(I,J,3),I=1,3),J= 11,NS1Z) / + : 0.7961052740870D-10, 0.5283368554163D+01, 0.3813291813120D-01, + : 0.4979225949689D-10, 0.4298290471860D+01, 0.4194847048887D+00, + : 0.4388552286597D-10, 0.6145515047406D+01, 0.7113454667900D-02, + : 0.2586835212560D-10, 0.3019448001809D+01, 0.6398972393349D+00 / + +* SSB-to-Sun, T^2, Z + DATA ((S2(I,J,3),I=1,3),J= 1,NS2Z) / + : 0.3749920358054D-12, 0.3230285558668D+01, 0.2132990797783D+00, + : 0.2735037220939D-12, 0.6154322683046D+01, 0.5296909721118D+00 / + +* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +* Time since reference epoch, years. + T = ( DATE - DJM0 ) / DJY + T2 = T*T + +* X then Y then Z. + DO K=1,3 + +* Initialize position and velocity component. + XYZ = 0D0 + XYZD = 0D0 + +* ------------------------------------------------ +* Obtain component of Sun to Earth ecliptic vector +* ------------------------------------------------ + +* Sun to Earth, T^0 terms. + DO J=1,NE0(K) + A = E0(1,J,K) + B = E0(2,J,K) + C = E0(3,J,K) + P = B + C*T + XYZ = XYZ + A*COS(P) + XYZD = XYZD - A*C*SIN(P) + END DO + +* Sun to Earth, T^1 terms. + DO J=1,NE1(K) + A = E1(1,J,K) + B = E1(2,J,K) + C = E1(3,J,K) + CT = C*T + P = B + CT + CP = COS(P) + XYZ = XYZ + A*T*CP + XYZD = XYZD + A*(CP-CT*SIN(P)) + END DO + +* Sun to Earth, T^2 terms. + DO J=1,NE2(K) + A = E2(1,J,K) + B = E2(2,J,K) + C = E2(3,J,K) + CT = C*T + P = B + CT + CP = COS(P) + XYZ = XYZ + A*T2*CP + XYZD = XYZD + A*T*(2D0*CP-CT*SIN(P)) + END DO + +* Heliocentric Earth position and velocity component. + HP(K) = XYZ + HV(K) = XYZD / DJY + +* ------------------------------------------------ +* Obtain component of SSB to Earth ecliptic vector +* ------------------------------------------------ + +* SSB to Sun, T^0 terms. + DO J=1,NS0(K) + A = S0(1,J,K) + B = S0(2,J,K) + C = S0(3,J,K) + P = B + C*T + XYZ = XYZ + A*COS(P) + XYZD = XYZD - A*C*SIN(P) + END DO + +* SSB to Sun, T^1 terms. + DO J=1,NS1(K) + A = S1(1,J,K) + B = S1(2,J,K) + C = S1(3,J,K) + CT = C*T + P = B + CT + CP = COS(P) + XYZ = XYZ + A*T*CP + XYZD = XYZD + A*(CP-CT*SIN(P)) + END DO + +* SSB to Sun, T^2 terms. + DO J=1,NS2(K) + A = S2(1,J,K) + B = S2(2,J,K) + C = S2(3,J,K) + CT = C*T + P = B + CT + CP = COS(P) + XYZ = XYZ + A*T2*CP + XYZD = XYZD + A*T*(2D0*CP-CT*SIN(P)) + END DO + +* Barycentric Earth position and velocity component. + BP(K) = XYZ + BV(K) = XYZD / DJY + +* Next Cartesian component. + END DO + +* Rotate from ecliptic to ICRS coordinates and return the results. + X = HP(1) + Y = HP(2) + Z = HP(3) + PH(1) = X + AM12*Y + AM13*Z + PH(2) = AM21*X + AM22*Y + AM23*Z + PH(3) = AM32*Y + AM33*Z + X = HV(1) + Y = HV(2) + Z = HV(3) + VH(1) = X + AM12*Y + AM13*Z + VH(2) = AM21*X + AM22*Y + AM23*Z + VH(3) = AM32*Y + AM33*Z + X = BP(1) + Y = BP(2) + Z = BP(3) + PB(1) = X + AM12*Y + AM13*Z + PB(2) = AM21*X + AM22*Y + AM23*Z + PB(3) = AM32*Y + AM33*Z + X = BV(1) + Y = BV(2) + Z = BV(3) + VB(1) = X + AM12*Y + AM13*Z + VB(2) = AM21*X + AM22*Y + AM23*Z + VB(3) = AM32*Y + AM33*Z + + END diff --git a/math/slalib/eqecl.f b/math/slalib/eqecl.f new file mode 100644 index 00000000..d3e405a9 --- /dev/null +++ b/math/slalib/eqecl.f @@ -0,0 +1,73 @@ + SUBROUTINE slEQEC (DR, DD, DATE, DL, DB) +*+ +* - - - - - - +* E Q E C +* - - - - - - +* +* Transformation from J2000.0 equatorial coordinates to +* ecliptic coordinates (double precision) +* +* Given: +* DR,DD dp J2000.0 mean RA,Dec (radians) +* DATE dp TDB (loosely ET) as Modified Julian Date +* (JD-2400000.5) +* Returned: +* DL,DB dp ecliptic longitude and latitude +* (mean of date, IAU 1980 theory, radians) +* +* Called: +* slDS2C, slPREC, slEPJ, slDMXV, slECMA, slDC2S, +* slDA2P, slDA1P +* +* P.T.Wallace Starlink March 1986 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DR,DD,DATE,DL,DB + + DOUBLE PRECISION slEPJ,slDA2P,slDA1P + + DOUBLE PRECISION RMAT(3,3),V1(3),V2(3) + + + +* Spherical to Cartesian + CALL slDS2C(DR,DD,V1) + +* Mean J2000 to mean of date + CALL slPREC(2000D0,slEPJ(DATE),RMAT) + CALL slDMXV(RMAT,V1,V2) + +* Equatorial to ecliptic + CALL slECMA(DATE,RMAT) + CALL slDMXV(RMAT,V2,V1) + +* Cartesian to spherical + CALL slDC2S(V1,DL,DB) + +* Express in conventional ranges + DL=slDA2P(DL) + DB=slDA1P(DB) + + END diff --git a/math/slalib/eqeqx.f b/math/slalib/eqeqx.f new file mode 100644 index 00000000..915f40c3 --- /dev/null +++ b/math/slalib/eqeqx.f @@ -0,0 +1,75 @@ + DOUBLE PRECISION FUNCTION slEQEX (DATE) +*+ +* - - - - - - +* E Q E X +* - - - - - - +* +* Equation of the equinoxes (IAU 1994, double precision) +* +* Given: +* DATE dp TDB (loosely ET) as Modified Julian Date +* (JD-2400000.5) +* +* The result is the equation of the equinoxes (double precision) +* in radians: +* +* Greenwich apparent ST = GMST + slEQEX +* +* References: IAU Resolution C7, Recommendation 3 (1994) +* Capitaine, N. & Gontier, A.-M., Astron. Astrophys., +* 275, 645-650 (1993) +* +* Called: slNUTC +* +* Patrick Wallace Starlink 23 August 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE + +* Turns to arc seconds and arc seconds to radians + DOUBLE PRECISION T2AS,AS2R + PARAMETER (T2AS=1296000D0, + : AS2R=0.484813681109535994D-5) + + DOUBLE PRECISION T,OM,DPSI,DEPS,EPS0 + + + +* Interval between basic epoch J2000.0 and current epoch (JC) + T=(DATE-51544.5D0)/36525D0 + +* Longitude of the mean ascending node of the lunar orbit on the +* ecliptic, measured from the mean equinox of date + OM=AS2R*(450160.280D0+(-5D0*T2AS-482890.539D0 + : +(7.455D0+0.008D0*T)*T)*T) + +* Nutation + CALL slNUTC(DATE,DPSI,DEPS,EPS0) + +* Equation of the equinoxes + slEQEX=DPSI*COS(EPS0)+AS2R*(0.00264D0*SIN(OM)+ + : 0.000063D0*SIN(OM+OM)) + + END diff --git a/math/slalib/eqgal.f b/math/slalib/eqgal.f new file mode 100644 index 00000000..eeb19f5d --- /dev/null +++ b/math/slalib/eqgal.f @@ -0,0 +1,97 @@ + SUBROUTINE slEQGA (DR, DD, DL, DB) +*+ +* - - - - - - +* E Q G A +* - - - - - - +* +* Transformation from J2000.0 equatorial coordinates to +* IAU 1958 galactic coordinates (double precision) +* +* Given: +* DR,DD dp J2000.0 RA,Dec +* +* Returned: +* DL,DB dp galactic longitude and latitude L2,B2 +* +* (all arguments are radians) +* +* Called: +* slDS2C, slDMXV, slDC2S, slDA2P, slDA1P +* +* Note: +* The equatorial coordinates are J2000.0. Use the routine +* slEG50 if conversion from B1950.0 'FK4' coordinates is +* required. +* +* Reference: +* Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960) +* +* P.T.Wallace Starlink 21 September 1998 +* +* Copyright (C) 1998 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DR,DD,DL,DB + + DOUBLE PRECISION slDA2P,slDA1P + + DOUBLE PRECISION V1(3),V2(3) + +* +* L2,B2 system of galactic coordinates +* +* P = 192.25 RA of galactic north pole (mean B1950.0) +* Q = 62.6 inclination of galactic to mean B1950.0 equator +* R = 33 longitude of ascending node +* +* P,Q,R are degrees +* +* Equatorial to galactic rotation matrix (J2000.0), obtained by +* applying the standard FK4 to FK5 transformation, for zero proper +* motion in FK5, to the columns of the B1950 equatorial to +* galactic rotation matrix: +* + DOUBLE PRECISION RMAT(3,3) + DATA RMAT(1,1),RMAT(1,2),RMAT(1,3), + : RMAT(2,1),RMAT(2,2),RMAT(2,3), + : RMAT(3,1),RMAT(3,2),RMAT(3,3)/ + : -0.054875539726D0,-0.873437108010D0,-0.483834985808D0, + : +0.494109453312D0,-0.444829589425D0,+0.746982251810D0, + : -0.867666135858D0,-0.198076386122D0,+0.455983795705D0/ + + + +* Spherical to Cartesian + CALL slDS2C(DR,DD,V1) + +* Equatorial to galactic + CALL slDMXV(RMAT,V1,V2) + +* Cartesian to spherical + CALL slDC2S(V2,DL,DB) + +* Express in conventional ranges + DL=slDA2P(DL) + DB=slDA1P(DB) + + END diff --git a/math/slalib/etrms.f b/math/slalib/etrms.f new file mode 100644 index 00000000..f596bf2c --- /dev/null +++ b/math/slalib/etrms.f @@ -0,0 +1,80 @@ + SUBROUTINE slETRM (EP, EV) +*+ +* - - - - - - +* E T R M +* - - - - - - +* +* Compute the E-terms (elliptic component of annual aberration) +* vector (double precision) +* +* Given: +* EP dp Besselian epoch +* +* Returned: +* EV dp(3) E-terms as (dx,dy,dz) +* +* Note the use of the J2000 aberration constant (20.49552 arcsec). +* This is a reflection of the fact that the E-terms embodied in +* existing star catalogues were computed from a variety of +* aberration constants. Rather than adopting one of the old +* constants the latest value is used here. +* +* References: +* 1 Smith, C.A. et al., 1989. Astr.J. 97, 265. +* 2 Yallop, B.D. et al., 1989. Astr.J. 97, 274. +* +* P.T.Wallace Starlink 23 August 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION EP,EV(3) + +* Arcseconds to radians + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + + DOUBLE PRECISION T,E,E0,P,EK,CP + + + +* Julian centuries since B1950 + T=(EP-1950D0)*1.00002135903D-2 + +* Eccentricity + E=0.01673011D0-(0.00004193D0+0.000000126D0*T)*T + +* Mean obliquity + E0=(84404.836D0-(46.8495D0+(0.00319D0+0.00181D0*T)*T)*T)*AS2R + +* Mean longitude of perihelion + P=(1015489.951D0+(6190.67D0+(1.65D0+0.012D0*T)*T)*T)*AS2R + +* E-terms + EK=E*20.49552D0*AS2R + CP=COS(P) + EV(1)= EK*SIN(P) + EV(2)=-EK*CP*COS(E0) + EV(3)=-EK*CP*SIN(E0) + + END diff --git a/math/slalib/euler.f b/math/slalib/euler.f new file mode 100644 index 00000000..ff764cf6 --- /dev/null +++ b/math/slalib/euler.f @@ -0,0 +1,86 @@ + SUBROUTINE slEULR (ORDER, PHI, THETA, PSI, RMAT) +*+ +* - - - - - - +* E U L R +* - - - - - - +* +* Form a rotation matrix from the Euler angles - three successive +* rotations about specified Cartesian axes (single precision) +* +* Given: +* ORDER c*(*) specifies about which axes the rotations occur +* PHI r 1st rotation (radians) +* THETA r 2nd rotation ( " ) +* PSI r 3rd rotation ( " ) +* +* Returned: +* RMAT r(3,3) rotation matrix +* +* A rotation is positive when the reference frame rotates +* anticlockwise as seen looking towards the origin from the +* positive region of the specified axis. +* +* The characters of ORDER define which axes the three successive +* rotations are about. A typical value is 'ZXZ', indicating that +* RMAT is to become the direction cosine matrix corresponding to +* rotations of the reference frame through PHI radians about the +* old Z-axis, followed by THETA radians about the resulting X-axis, +* then PSI radians about the resulting Z-axis. +* +* The axis names can be any of the following, in any order or +* combination: X, Y, Z, uppercase or lowercase, 1, 2, 3. Normal +* axis labelling/numbering conventions apply; the xyz (=123) +* triad is right-handed. Thus, the 'ZXZ' example given above +* could be written 'zxz' or '313' (or even 'ZxZ' or '3xZ'). ORDER +* is terminated by length or by the first unrecognized character. +* +* Fewer than three rotations are acceptable, in which case the later +* angle arguments are ignored. If all rotations are zero, the +* identity matrix is produced. +* +* Called: slDEUL +* +* P.T.Wallace Starlink 23 May 1997 +* +* Copyright (C) 1997 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) ORDER + REAL PHI,THETA,PSI,RMAT(3,3) + + INTEGER J,I + DOUBLE PRECISION W(3,3) + + + +* Compute matrix in double precision + CALL slDEUL(ORDER,DBLE(PHI),DBLE(THETA),DBLE(PSI),W) + +* Copy the result + DO J=1,3 + DO I=1,3 + RMAT(I,J) = REAL(W(I,J)) + END DO + END DO + + END diff --git a/math/slalib/evp.f b/math/slalib/evp.f new file mode 100644 index 00000000..f1e6f555 --- /dev/null +++ b/math/slalib/evp.f @@ -0,0 +1,457 @@ + SUBROUTINE slEVP (DATE, DEQX, DVB, DPB, DVH, DPH) +*+ +* - - - - +* E V P +* - - - - +* +* Barycentric and heliocentric velocity and position of the Earth +* +* All arguments are double precision +* +* Given: +* +* DATE TDB (loosely ET) as a Modified Julian Date +* (JD-2400000.5) +* +* DEQX Julian Epoch (e.g. 2000.0D0) of mean equator and +* equinox of the vectors returned. If DEQX .LE. 0D0, +* all vectors are referred to the mean equator and +* equinox (FK5) of epoch DATE. +* +* Returned (all 3D Cartesian vectors): +* +* DVB,DPB barycentric velocity, position (AU/s, AU) +* DVH,DPH heliocentric velocity, position (AU/s, AU) +* +* Called: slEPJ, slPREC +* +* Notes: +* +* 1 This routine is accurate enough for many purposes but faster and +* more compact than the slEPV routine. The maximum deviations +* from the JPL DE96 ephemeris are as follows: +* +* barycentric velocity 0.42 m/s +* barycentric position 6900 km +* +* heliocentric velocity 0.42 m/s +* heliocentric position 1600 km +* +* 2 The routine is adapted from the BARVEL and BARCOR subroutines of +* Stumpff (1980). Most of the changes are merely cosmetic and do +* not affect the results at all. However, some adjustments have +* been made so as to give results that refer to the IAU 1976 'FK5' +* equinox and precession, although the differences these changes +* make relative to the results from Stumpff's original 'FK4' version +* are smaller than the inherent accuracy of the algorithm. One +* minor shortcoming in the original routines that has NOT been +* corrected is that better numerical accuracy could be achieved if +* the various polynomial evaluations were nested. +* +* Reference: +* +* Stumpff, P., Astron.Astrophys.Suppl.Ser. 41, 1-8 (1980). +* +* Last revision: 7 April 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,DEQX,DVB(3),DPB(3),DVH(3),DPH(3) + + INTEGER IDEQ,I,J,K + + REAL CC2PI,CCSEC3,CCSGD,CCKM,CCMLD,CCFDI,CCIM,T,TSQ,A,PERTL, + : PERTLD,PERTR,PERTRD,COSA,SINA,ESQ,E,PARAM,TWOE,TWOG,G, + : PHI,F,SINF,COSF,PHID,PSID,PERTP,PERTPD,TL,SINLM,COSLM, + : SIGMA,B,PLON,POMG,PECC,FLATM,FLAT + + DOUBLE PRECISION DC2PI,DS2R,DCSLD,DC1MME,DT,DTSQ,DLOCAL,DML, + : DEPS,DPARAM,DPSI,D1PDRO,DRD,DRLD,DTL,DSINLS, + : DCOSLS,DXHD,DYHD,DZHD,DXBD,DYBD,DZBD,DCOSEP, + : DSINEP,DYAHD,DZAHD,DYABD,DZABD,DR, + : DXH,DYH,DZH,DXB,DYB,DZB,DYAH,DZAH,DYAB, + : DZAB,DEPJ,DEQCOR,B1950 + + REAL SN(4),CCSEL(3,17),CCAMPS(5,15),CCSEC(3,4),CCAMPM(4,3), + : CCPAMV(4),CCPAM(4),FORBEL(7),SORBEL(17),SINLP(4),COSLP(4) + EQUIVALENCE (SORBEL(1),E),(FORBEL(1),G) + + DOUBLE PRECISION DCFEL(3,8),DCEPS(3),DCARGS(2,15),DCARGM(2,3), + : DPREMA(3,3),W,VW(3) + + DOUBLE PRECISION slEPJ + + PARAMETER (DC2PI=6.2831853071796D0,CC2PI=6.283185) + PARAMETER (DS2R=0.7272205216643D-4) + PARAMETER (B1950=1949.9997904423D0) + +* +* Constants DCFEL(I,K) of fast changing elements +* I=1 I=2 I=3 + DATA DCFEL/ 1.7400353D+00, 6.2833195099091D+02, 5.2796D-06, + : 6.2565836D+00, 6.2830194572674D+02,-2.6180D-06, + : 4.7199666D+00, 8.3997091449254D+03,-1.9780D-05, + : 1.9636505D-01, 8.4334662911720D+03,-5.6044D-05, + : 4.1547339D+00, 5.2993466764997D+01, 5.8845D-06, + : 4.6524223D+00, 2.1354275911213D+01, 5.6797D-06, + : 4.2620486D+00, 7.5025342197656D+00, 5.5317D-06, + : 1.4740694D+00, 3.8377331909193D+00, 5.6093D-06/ + +* +* Constants DCEPS and CCSEL(I,K) of slowly changing elements +* I=1 I=2 I=3 + DATA DCEPS/ 4.093198D-01,-2.271110D-04,-2.860401D-08 / + DATA CCSEL/ 1.675104E-02,-4.179579E-05,-1.260516E-07, + : 2.220221E-01, 2.809917E-02, 1.852532E-05, + : 1.589963E+00, 3.418075E-02, 1.430200E-05, + : 2.994089E+00, 2.590824E-02, 4.155840E-06, + : 8.155457E-01, 2.486352E-02, 6.836840E-06, + : 1.735614E+00, 1.763719E-02, 6.370440E-06, + : 1.968564E+00, 1.524020E-02,-2.517152E-06, + : 1.282417E+00, 8.703393E-03, 2.289292E-05, + : 2.280820E+00, 1.918010E-02, 4.484520E-06, + : 4.833473E-02, 1.641773E-04,-4.654200E-07, + : 5.589232E-02,-3.455092E-04,-7.388560E-07, + : 4.634443E-02,-2.658234E-05, 7.757000E-08, + : 8.997041E-03, 6.329728E-06,-1.939256E-09, + : 2.284178E-02,-9.941590E-05, 6.787400E-08, + : 4.350267E-02,-6.839749E-05,-2.714956E-07, + : 1.348204E-02, 1.091504E-05, 6.903760E-07, + : 3.106570E-02,-1.665665E-04,-1.590188E-07/ + +* +* Constants of the arguments of the short-period perturbations +* by the planets: DCARGS(I,K) +* I=1 I=2 + DATA DCARGS/ 5.0974222D+00,-7.8604195454652D+02, + : 3.9584962D+00,-5.7533848094674D+02, + : 1.6338070D+00,-1.1506769618935D+03, + : 2.5487111D+00,-3.9302097727326D+02, + : 4.9255514D+00,-5.8849265665348D+02, + : 1.3363463D+00,-5.5076098609303D+02, + : 1.6072053D+00,-5.2237501616674D+02, + : 1.3629480D+00,-1.1790629318198D+03, + : 5.5657014D+00,-1.0977134971135D+03, + : 5.0708205D+00,-1.5774000881978D+02, + : 3.9318944D+00, 5.2963464780000D+01, + : 4.8989497D+00, 3.9809289073258D+01, + : 1.3097446D+00, 7.7540959633708D+01, + : 3.5147141D+00, 7.9618578146517D+01, + : 3.5413158D+00,-5.4868336758022D+02/ + +* +* Amplitudes CCAMPS(N,K) of the short-period perturbations +* N=1 N=2 N=3 N=4 N=5 + DATA CCAMPS/ + : -2.279594E-5, 1.407414E-5, 8.273188E-6, 1.340565E-5,-2.490817E-7, + : -3.494537E-5, 2.860401E-7, 1.289448E-7, 1.627237E-5,-1.823138E-7, + : 6.593466E-7, 1.322572E-5, 9.258695E-6,-4.674248E-7,-3.646275E-7, + : 1.140767E-5,-2.049792E-5,-4.747930E-6,-2.638763E-6,-1.245408E-7, + : 9.516893E-6,-2.748894E-6,-1.319381E-6,-4.549908E-6,-1.864821E-7, + : 7.310990E-6,-1.924710E-6,-8.772849E-7,-3.334143E-6,-1.745256E-7, + : -2.603449E-6, 7.359472E-6, 3.168357E-6, 1.119056E-6,-1.655307E-7, + : -3.228859E-6, 1.308997E-7, 1.013137E-7, 2.403899E-6,-3.736225E-7, + : 3.442177E-7, 2.671323E-6, 1.832858E-6,-2.394688E-7,-3.478444E-7, + : 8.702406E-6,-8.421214E-6,-1.372341E-6,-1.455234E-6,-4.998479E-8, + : -1.488378E-6,-1.251789E-5, 5.226868E-7,-2.049301E-7, 0.0E0, + : -8.043059E-6,-2.991300E-6, 1.473654E-7,-3.154542E-7, 0.0E0, + : 3.699128E-6,-3.316126E-6, 2.901257E-7, 3.407826E-7, 0.0E0, + : 2.550120E-6,-1.241123E-6, 9.901116E-8, 2.210482E-7, 0.0E0, + : -6.351059E-7, 2.341650E-6, 1.061492E-6, 2.878231E-7, 0.0E0/ + +* +* Constants of the secular perturbations in longitude +* CCSEC3 and CCSEC(N,K) +* N=1 N=2 N=3 + DATA CCSEC3/-7.757020E-08/, + : CCSEC/ 1.289600E-06, 5.550147E-01, 2.076942E+00, + : 3.102810E-05, 4.035027E+00, 3.525565E-01, + : 9.124190E-06, 9.990265E-01, 2.622706E+00, + : 9.793240E-07, 5.508259E+00, 1.559103E+01/ + +* Sidereal rate DCSLD in longitude, rate CCSGD in mean anomaly + DATA DCSLD/1.990987D-07/, + : CCSGD/1.990969E-07/ + +* Some constants used in the calculation of the lunar contribution + DATA CCKM/3.122140E-05/, + : CCMLD/2.661699E-06/, + : CCFDI/2.399485E-07/ + +* +* Constants DCARGM(I,K) of the arguments of the perturbations +* of the motion of the Moon +* I=1 I=2 + DATA DCARGM/ 5.1679830D+00, 8.3286911095275D+03, + : 5.4913150D+00,-7.2140632838100D+03, + : 5.9598530D+00, 1.5542754389685D+04/ + +* +* Amplitudes CCAMPM(N,K) of the perturbations of the Moon +* N=1 N=2 N=3 N=4 + DATA CCAMPM/ + : 1.097594E-01, 2.896773E-07, 5.450474E-02, 1.438491E-07, + : -2.223581E-02, 5.083103E-08, 1.002548E-02,-2.291823E-08, + : 1.148966E-02, 5.658888E-08, 8.249439E-03, 4.063015E-08/ + +* +* CCPAMV(K)=A*M*DL/DT (planets), DC1MME=1-MASS(Earth+Moon) + DATA CCPAMV/8.326827E-11,1.843484E-11,1.988712E-12,1.881276E-12/ + DATA DC1MME/0.99999696D0/ + +* CCPAM(K)=A*M(planets), CCIM=INCLINATION(Moon) + DATA CCPAM/4.960906E-3,2.727436E-3,8.392311E-4,1.556861E-3/ + DATA CCIM/8.978749E-2/ + + + + +* +* EXECUTION +* --------- + +* Control parameter IDEQ, and time arguments + IDEQ = 0 + IF (DEQX.GT.0D0) IDEQ=1 + DT = (DATE-15019.5D0)/36525D0 + T = REAL(DT) + DTSQ = DT*DT + TSQ = REAL(DTSQ) + +* Values of all elements for the instant DATE + DO K=1,8 + DLOCAL = MOD(DCFEL(1,K)+DT*DCFEL(2,K)+DTSQ*DCFEL(3,K), DC2PI) + IF (K.EQ.1) THEN + DML = DLOCAL + ELSE + FORBEL(K-1) = REAL(DLOCAL) + END IF + END DO + DEPS = MOD(DCEPS(1)+DT*DCEPS(2)+DTSQ*DCEPS(3), DC2PI) + DO K=1,17 + SORBEL(K) = MOD(CCSEL(1,K)+T*CCSEL(2,K)+TSQ*CCSEL(3,K), + : CC2PI) + END DO + +* Secular perturbations in longitude + DO K=1,4 + A = MOD(CCSEC(2,K)+T*CCSEC(3,K), CC2PI) + SN(K) = SIN(A) + END DO + +* Periodic perturbations of the EMB (Earth-Moon barycentre) + PERTL = CCSEC(1,1) *SN(1) +CCSEC(1,2)*SN(2)+ + : (CCSEC(1,3)+T*CCSEC3)*SN(3) +CCSEC(1,4)*SN(4) + PERTLD = 0.0 + PERTR = 0.0 + PERTRD = 0.0 + DO K=1,15 + A = SNGL(MOD(DCARGS(1,K)+DT*DCARGS(2,K), DC2PI)) + COSA = COS(A) + SINA = SIN(A) + PERTL = PERTL + CCAMPS(1,K)*COSA+CCAMPS(2,K)*SINA + PERTR = PERTR + CCAMPS(3,K)*COSA+CCAMPS(4,K)*SINA + IF (K.LT.11) THEN + PERTLD = PERTLD+ + : (CCAMPS(2,K)*COSA-CCAMPS(1,K)*SINA)*CCAMPS(5,K) + PERTRD = PERTRD+ + : (CCAMPS(4,K)*COSA-CCAMPS(3,K)*SINA)*CCAMPS(5,K) + END IF + END DO + +* Elliptic part of the motion of the EMB + ESQ = E*E + DPARAM = 1D0-DBLE(ESQ) + PARAM = REAL(DPARAM) + TWOE = E+E + TWOG = G+G + PHI = TWOE*((1.0-ESQ*0.125)*SIN(G)+E*0.625*SIN(TWOG) + : +ESQ*0.54166667*SIN(G+TWOG) ) + F = G+PHI + SINF = SIN(F) + COSF = COS(F) + DPSI = DPARAM/(1D0+DBLE(E*COSF)) + PHID = TWOE*CCSGD*((1.0+ESQ*1.5)*COSF+E*(1.25-SINF*SINF*0.5)) + PSID = CCSGD*E*SINF/SQRT(PARAM) + +* Perturbed heliocentric motion of the EMB + D1PDRO = 1D0+DBLE(PERTR) + DRD = D1PDRO*(DBLE(PSID)+DPSI*DBLE(PERTRD)) + DRLD = D1PDRO*DPSI*(DCSLD+DBLE(PHID)+DBLE(PERTLD)) + DTL = MOD(DML+DBLE(PHI)+DBLE(PERTL), DC2PI) + DSINLS = SIN(DTL) + DCOSLS = COS(DTL) + DXHD = DRD*DCOSLS-DRLD*DSINLS + DYHD = DRD*DSINLS+DRLD*DCOSLS + +* Influence of eccentricity, evection and variation on the +* geocentric motion of the Moon + PERTL = 0.0 + PERTLD = 0.0 + PERTP = 0.0 + PERTPD = 0.0 + DO K=1,3 + A = SNGL(MOD(DCARGM(1,K)+DT*DCARGM(2,K), DC2PI)) + SINA = SIN(A) + COSA = COS(A) + PERTL = PERTL +CCAMPM(1,K)*SINA + PERTLD = PERTLD+CCAMPM(2,K)*COSA + PERTP = PERTP +CCAMPM(3,K)*COSA + PERTPD = PERTPD-CCAMPM(4,K)*SINA + END DO + +* Heliocentric motion of the Earth + TL = FORBEL(2)+PERTL + SINLM = SIN(TL) + COSLM = COS(TL) + SIGMA = CCKM/(1.0+PERTP) + A = SIGMA*(CCMLD+PERTLD) + B = SIGMA*PERTPD + DXHD = DXHD+DBLE(A*SINLM)+DBLE(B*COSLM) + DYHD = DYHD-DBLE(A*COSLM)+DBLE(B*SINLM) + DZHD = -DBLE(SIGMA*CCFDI*COS(FORBEL(3))) + +* Barycentric motion of the Earth + DXBD = DXHD*DC1MME + DYBD = DYHD*DC1MME + DZBD = DZHD*DC1MME + DO K=1,4 + PLON = FORBEL(K+3) + POMG = SORBEL(K+1) + PECC = SORBEL(K+9) + TL = MOD(PLON+2.0*PECC*SIN(PLON-POMG), CC2PI) + SINLP(K) = SIN(TL) + COSLP(K) = COS(TL) + DXBD = DXBD+DBLE(CCPAMV(K)*(SINLP(K)+PECC*SIN(POMG))) + DYBD = DYBD-DBLE(CCPAMV(K)*(COSLP(K)+PECC*COS(POMG))) + DZBD = DZBD-DBLE(CCPAMV(K)*SORBEL(K+13)*COS(PLON-SORBEL(K+5))) + END DO + +* Transition to mean equator of date + DCOSEP = COS(DEPS) + DSINEP = SIN(DEPS) + DYAHD = DCOSEP*DYHD-DSINEP*DZHD + DZAHD = DSINEP*DYHD+DCOSEP*DZHD + DYABD = DCOSEP*DYBD-DSINEP*DZBD + DZABD = DSINEP*DYBD+DCOSEP*DZBD + +* Heliocentric coordinates of the Earth + DR = DPSI*D1PDRO + FLATM = CCIM*SIN(FORBEL(3)) + A = SIGMA*COS(FLATM) + DXH = DR*DCOSLS-DBLE(A*COSLM) + DYH = DR*DSINLS-DBLE(A*SINLM) + DZH = -DBLE(SIGMA*SIN(FLATM)) + +* Barycentric coordinates of the Earth + DXB = DXH*DC1MME + DYB = DYH*DC1MME + DZB = DZH*DC1MME + DO K=1,4 + FLAT = SORBEL(K+13)*SIN(FORBEL(K+3)-SORBEL(K+5)) + A = CCPAM(K)*(1.0-SORBEL(K+9)*COS(FORBEL(K+3)-SORBEL(K+1))) + B = A*COS(FLAT) + DXB = DXB-DBLE(B*COSLP(K)) + DYB = DYB-DBLE(B*SINLP(K)) + DZB = DZB-DBLE(A*SIN(FLAT)) + END DO + +* Transition to mean equator of date + DYAH = DCOSEP*DYH-DSINEP*DZH + DZAH = DSINEP*DYH+DCOSEP*DZH + DYAB = DCOSEP*DYB-DSINEP*DZB + DZAB = DSINEP*DYB+DCOSEP*DZB + +* Copy result components into vectors, correcting for FK4 equinox + DEPJ=slEPJ(DATE) + DEQCOR = DS2R*(0.035D0+0.00085D0*(DEPJ-B1950)) + DVH(1) = DXHD-DEQCOR*DYAHD + DVH(2) = DYAHD+DEQCOR*DXHD + DVH(3) = DZAHD + DVB(1) = DXBD-DEQCOR*DYABD + DVB(2) = DYABD+DEQCOR*DXBD + DVB(3) = DZABD + DPH(1) = DXH-DEQCOR*DYAH + DPH(2) = DYAH+DEQCOR*DXH + DPH(3) = DZAH + DPB(1) = DXB-DEQCOR*DYAB + DPB(2) = DYAB+DEQCOR*DXB + DPB(3) = DZAB + +* Was precession to another equinox requested? + IF (IDEQ.NE.0) THEN + +* Yes: compute precession matrix from MJD DATE to Julian epoch DEQX + CALL slPREC(DEPJ,DEQX,DPREMA) + +* Rotate DVH + DO J=1,3 + W=0D0 + DO I=1,3 + W=W+DPREMA(J,I)*DVH(I) + END DO + VW(J)=W + END DO + DO J=1,3 + DVH(J)=VW(J) + END DO + +* Rotate DVB + DO J=1,3 + W=0D0 + DO I=1,3 + W=W+DPREMA(J,I)*DVB(I) + END DO + VW(J)=W + END DO + DO J=1,3 + DVB(J)=VW(J) + END DO + +* Rotate DPH + DO J=1,3 + W=0D0 + DO I=1,3 + W=W+DPREMA(J,I)*DPH(I) + END DO + VW(J)=W + END DO + DO J=1,3 + DPH(J)=VW(J) + END DO + +* Rotate DPB + DO J=1,3 + W=0D0 + DO I=1,3 + W=W+DPREMA(J,I)*DPB(I) + END DO + VW(J)=W + END DO + DO J=1,3 + DPB(J)=VW(J) + END DO + END IF + + END diff --git a/math/slalib/f77.h.in b/math/slalib/f77.h.in new file mode 100644 index 00000000..43cab152 --- /dev/null +++ b/math/slalib/f77.h.in @@ -0,0 +1,956 @@ +/* +*+ +* Name: +* f77.h and cnf.h + +* Purpose: +* C - FORTRAN interace macros and prototypes + +* Language: +* C (part ANSI, part not) + +* Type of Module: +* C include file + +* Description: +* Including this file in SLALIB allows SLALIB to remain free of any +* dependencies on the rest of the Starlink Software Collection. +* +* For historical reasons two files, F77.h and cnf.h are required +* but the have now been combined and for new code, only one is +* necessary. +* +* This file defines the macros needed to write C functions that are +* designed to be called from FORTRAN programs, and to do so in a +* portable way. Arguments are normally passed by reference from a +* FORTRAN program, and so the F77 macros arrange for a pointer to +* all arguments to be available. This requires no work on most +* machines, but will actually generate the pointers on a machine +* that passes FORTRAN arguments by value. + +* Notes: +* - Macros are provided to handle the conversion of logical data +* values between the way that FORTRAN represents a value and the +* way that C represents it. +* - Macros are provided to convert variables between the FORTRAN and +* C method of representing them. In most cases there is no +* conversion required, the macros just arrange for a pointer to +* the FORTRAN variable to be set appropriately. The possibility that +* FORTRAN and C might use different ways of representing integer +* and floating point values is considered remote, the macros are +* really only there for completeness and to assist in the automatic +* generation of C interfaces. +* - For character variables the macros convert between +* the FORTRAN method of representing them (fixed length, blank +* filled strings) and the C method (variable length, null +* terminated strings) using calls to the CNF functions. + +* Implementation Deficiencies: +* - The macros support the K&R style of function definition, but +* this file may not work with all K&R compilers as it contains +* "#if defined" statements. These could be replaced with #ifdef's +* if necessary. This has not been done as is would make the code +* less clear and the need for support for K&R sytle definitions +* should disappear as ANSI compilers become the default. + +* Copyright: +* Copyright (C) 1991, 1993 Science & Engineering Research Council. +* Copyright (C) 2006 Particle Physics and Astronomy Research Council. +* Copyright (C) 2011 Science and Technology Facilities Council. +* All Rights Reserved. + +* Licence: +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be +* useful,but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street,Fifth Floor, Boston, MA +* 02110-1301, USA + +* Authors: +* PMA: Peter Allan (Starlink, RAL) +* AJC: Alan Chipperfield (Starlink, RAL) +* DSB: David S Berry (JAC) +* PWD: Peter W. Draper (JAC, Durham University) +* {enter_new_authors_here} + +* History: +* 13-JUN-2006 (DSB): +* Original version, copied from AST. +* 22-JUN-2006 (PWD): +* Updated to include changes that handle the return type of +* REAL functions (double, not float, on some platforms). +* 13-JUL-2007 (PWD): +* Parameterise the type used for Fortran string lengths. +* 11-MAY-2011 (DSB): +* Added F77_LOCK +* {enter_further_changes_here} +* + +* Bugs: +* {note_any_bugs_here} + +*- +------------------------------------------------------------------------------ +*/ +#if !defined(CNF_MACROS) +#define CNF_MACROS + +#include +/* This initial sections defines values for all macros. These are the */ +/* values that are generally appropriate to an ANSI C compiler on Unix. */ +/* For macros that have different values on other systems, the macros */ +/* should be undefined and then redefined in the system specific sections. */ +/* At the end of this section, some macros are redefined if the compiler */ +/* is non-ANSI. */ + + +#if defined(__STDC__) || defined(VMS) +#define CNF_CONST const +#else +#define CNF_CONST +#endif + +/* ----- Macros common to calling C from FORTRAN and FORTRAN from C ---- */ + + +/* --- External Names --- */ + +/* Macro to define the name of a Fortran routine or common block. This */ +/* ends in an underscore on many Unix systems. */ + +#define F77_EXTERNAL_NAME(X) X ## _ + + +/* --- Logical Values --- */ + +/* Define the values that are used to represent the logical values TRUE */ +/* and FALSE in Fortran. */ + +#define F77_TRUE 1 +#define F77_FALSE 0 + +/* Define macros that evaluate to C logical values, given a FORTRAN */ +/* logical value. */ + +#define F77_ISTRUE(X) ( X ) +#define F77_ISFALSE(X) ( !( X ) ) + + +/* --- Common Blocks --- */ + +/* Macros used in referring to FORTRAN common blocks. */ + +#define F77_BLANK_COMMON _BLNK__ +#define F77_NAMED_COMMON(B) F77_EXTERNAL_NAME(B) + + + +/* ------------------ Calling C from FORTRAN --------------------------- */ + + +/* --- Data Types --- */ + +/* Define macros for all the Fortran data types (except COMPLEX, which is */ +/* not handled by this package). */ + +#define F77_INTEGER_TYPE int +#define F77_REAL_TYPE float +#define F77_REAL_FUNCTION_TYPE @REAL_FUNCTION_TYPE@ +#define F77_DOUBLE_TYPE double +#define F77_LOGICAL_TYPE int +#define F77_CHARACTER_TYPE char +#define F77_BYTE_TYPE signed char +#define F77_WORD_TYPE short int +#define F77_UBYTE_TYPE unsigned char +#define F77_UWORD_TYPE unsigned short int + +/* Define macros for the type of a CHARACTER and CHARACTER_ARRAY argument */ +#define F77_CHARACTER_ARG_TYPE char +#define F77_CHARACTER_ARRAY_ARG_TYPE char + +/* Define a macro to use when passing arguments that STARLINK FORTRAN */ +/* treats as a pointer. From the point of view of C, this type should be */ +/* (void *), but it is declared as type unsigned int as we actually pass */ +/* an INTEGER from the FORTRAN routine. The distinction is important for */ +/* architectures where the size of an INTEGER is not the same as the size */ +/* of a pointer. */ + +#define F77_POINTER_TYPE unsigned int + + +/* --- Subroutine Names --- */ + +/* This declares that the C function returns a value of void. */ + +#define F77_SUBROUTINE(X) void F77_EXTERNAL_NAME(X) + + +/* --- Function Names --- */ + +/* Macros to define the types and names of functions that return values. */ +/* Due the the different ways that function return values could be */ +/* implemented, it is better not to use functions, but to stick to using */ +/* subroutines. */ + +/* Character functions are implemented, but in a way that cannot be */ +/* guaranteed to be portable although it will work on VMS, SunOS, Ultrix */ +/* and DEC OSF/1. It would be better to return the character value as a */ +/* subroutine argument where possible, rather than use a character */ +/* function. */ + +#define F77_INTEGER_FUNCTION(X) F77_INTEGER_TYPE F77_EXTERNAL_NAME(X) +#define F77_REAL_FUNCTION(X) F77_REAL_FUNCTION_TYPE F77_EXTERNAL_NAME(X) +#define F77_DOUBLE_FUNCTION(X) F77_DOUBLE_TYPE F77_EXTERNAL_NAME(X) +#define F77_LOGICAL_FUNCTION(X) F77_LOGICAL_TYPE F77_EXTERNAL_NAME(X) +#define F77_CHARACTER_FUNCTION(X) void F77_EXTERNAL_NAME(X) +#define F77_BYTE_FUNCTION(X) F77_BYTE_TYPE F77_EXTERNAL_NAME(X) +#define F77_WORD_FUNCTION(X) F77_WORD_TYPE F77_EXTERNAL_NAME(X) +#define F77_UBYTE_FUNCTION(X) F77_UBYTE_TYPE F77_EXTERNAL_NAME(X) +#define F77_UWORD_FUNCTION(X) F77_UWORD_TYPE F77_EXTERNAL_NAME(X) +#define F77_POINTER_FUNCTION(X) F77_POINTER_TYPE F77_EXTERNAL_NAME(X) + + +/* --- Character return value for a function --- */ + +#define CHARACTER_RETURN_VALUE(X) CHARACTER(X) TRAIL(X) +#define CHARACTER_RETURN_ARG(X) CHARACTER_ARG(X) TRAIL_ARG(X) + +/* --- Dummy Arguments --- */ + +/* Macros for defining subroutine arguments. All these macros take a */ +/* single argument; the name of the parameter. On most systems, a numeric */ +/* argument is passed as a pointer. */ + +#define INTEGER(X) F77_INTEGER_TYPE *CNF_CONST X +#define REAL(X) F77_REAL_TYPE *CNF_CONST X +#define DOUBLE(X) F77_DOUBLE_TYPE *CNF_CONST X +#define LOGICAL(X) F77_LOGICAL_TYPE *CNF_CONST X +#define BYTE(X) F77_BYTE_TYPE *CNF_CONST X +#define WORD(X) F77_WORD_TYPE *CNF_CONST X +#define UBYTE(X) F77_UBYTE_TYPE *CNF_CONST X +#define UWORD(X) F77_UWORD_TYPE *CNF_CONST X + +/* Pointer arguments. Define a pointer type for passing pointer values */ +/* between subroutines. */ + +#define POINTER(X) F77_POINTER_TYPE *CNF_CONST X + +/* EXTERNAL arguments. Define a passed subroutine or function name */ +#define SUBROUTINE(X) void (*X)() +#define INTEGER_FUNCTION(X) F77_INTEGER_TYPE (*X)() +#define REAL_FUNCTION(X) F77_REAL_TYPE (*X)() +#define DOUBLE_FUNCTION(X) F77_DOUBLE_TYPE (*X)() +#define LOGICAL_FUNCTION(X) F77_LOGICAL_TYPE (*X)() +#define CHARACTER_FUNCTION(X) F77_CHARACTER_TYPE (*X)() +#define BYTE_FUNCTION(X) F77_BYTE_TYPE (*X)() +#define WORD_FUNCTION(X) F77_WORD_TYPE (*X)() +#define UBYTE_FUNCTION(X) F77_UBYTE_TYPE (*X)() +#define UWORD_FUNCTION(X) F77_UWORD_TYPE (*X)() +#define POINTER_FUNCTION(X) F77_POINTER_TYPE (*X)() + +/* Array arguments. */ + +#define INTEGER_ARRAY(X) F77_INTEGER_TYPE *CNF_CONST X +#define REAL_ARRAY(X) F77_REAL_TYPE *CNF_CONST X +#define DOUBLE_ARRAY(X) F77_DOUBLE_TYPE *CNF_CONST X +#define LOGICAL_ARRAY(X) F77_LOGICAL_TYPE *CNF_CONST X +#define BYTE_ARRAY(X) F77_BYTE_TYPE *CNF_CONST X +#define WORD_ARRAY(X) F77_WORD_TYPE *CNF_CONST X +#define UBYTE_ARRAY(X) F77_UBYTE_TYPE *CNF_CONST X +#define UWORD_ARRAY(X) F77_UWORD_TYPE *CNF_CONST X + +#define POINTER_ARRAY(X) F77_POINTER_TYPE *CNF_CONST X + +/* Macros to handle character arguments. */ + +/* Character arguments can be passed in many ways. The purpose of these */ +/* macros and the GENPTR_CHARACTER macro (defined in the next section) is */ +/* to generate a pointer to a character variable called ARG and an integer */ +/* ARG_length containing the length of ARG. If these two variables are */ +/* available directly from the argument list of the routine, then the */ +/* GENPTR_CHARACTER macro is null, otherwise it works on intermediate */ +/* variables. */ + +#define CHARACTER(X) F77_CHARACTER_TYPE *CNF_CONST X +#define TRAIL(X) ,@TRAIL_TYPE@ X ## _length +#define CHARACTER_ARRAY(X) F77_CHARACTER_TYPE *CNF_CONST X + + +/* --- Getting Pointers to Arguments --- */ + +/* Macros that ensure that a pointer to each argument is available for the */ +/* programmer to use. Usually this means that these macros are null. On */ +/* VMS, a pointer to a character variable has to be generated. If a */ +/* particular machine were to pass arguments by reference, rather than by */ +/* value, then these macros would construct the appropriate pointers. */ + +#define GENPTR_INTEGER(X) +#define GENPTR_REAL(X) +#define GENPTR_DOUBLE(X) +#define GENPTR_CHARACTER(X) +#define GENPTR_LOGICAL(X) +#define GENPTR_BYTE(X) +#define GENPTR_WORD(X) +#define GENPTR_UBYTE(X) +#define GENPTR_UWORD(X) +#define GENPTR_POINTER(X) + +#define GENPTR_INTEGER_ARRAY(X) +#define GENPTR_REAL_ARRAY(X) +#define GENPTR_DOUBLE_ARRAY(X) +#define GENPTR_CHARACTER_ARRAY(X) +#define GENPTR_LOGICAL_ARRAY(X) +#define GENPTR_BYTE_ARRAY(X) +#define GENPTR_WORD_ARRAY(X) +#define GENPTR_UBYTE_ARRAY(X) +#define GENPTR_UWORD_ARRAY(X) +#define GENPTR_POINTER_ARRAY(X) + +#define GENPTR_SUBROUTINE(X) +#define GENPTR_INTEGER_FUNCTION(X) +#define GENPTR_REAL_FUNCTION(X) +#define GENPTR_DOUBLE_FUNCTION(X) +#define GENPTR_CHARACTER_FUNCTION(X) +#define GENPTR_LOGICAL_FUNCTION(X) +#define GENPTR_BYTE_FUNCTION(X) +#define GENPTR_WORD_FUNCTION(X) +#define GENPTR_UBYTE_FUNCTION(X) +#define GENPTR_UWORD_FUNCTION(X) +#define GENPTR_POINTER_FUNCTION(X) + + + +/* ------------------ Calling FORTRAN from C --------------------------- */ + + +/* --- Declare variables --- */ + +#define DECLARE_INTEGER(X) F77_INTEGER_TYPE X +#define DECLARE_REAL(X) F77_REAL_TYPE X +#define DECLARE_DOUBLE(X) F77_DOUBLE_TYPE X +#define DECLARE_LOGICAL(X) F77_LOGICAL_TYPE X +#define DECLARE_BYTE(X) F77_BYTE_TYPE X +#define DECLARE_WORD(X) F77_WORD_TYPE X +#define DECLARE_UBYTE(X) F77_UBYTE_TYPE X +#define DECLARE_UWORD(X) F77_UWORD_TYPE X + +#define DECLARE_POINTER(X) F77_POINTER_TYPE X + +#define DECLARE_CHARACTER(X,L) F77_CHARACTER_TYPE X[L]; \ + const int X##_length = L + + +/* --- Declare arrays --- */ + +#define DECLARE_INTEGER_ARRAY(X,D) F77_INTEGER_TYPE X[D] +#define DECLARE_REAL_ARRAY(X,D) F77_REAL_TYPE X[D] +#define DECLARE_DOUBLE_ARRAY(X,D) F77_DOUBLE_TYPE X[D] +#define DECLARE_LOGICAL_ARRAY(X,D) F77_LOGICAL_TYPE X[D] +#define DECLARE_BYTE_ARRAY(X,D) F77_BYTE_TYPE X[D] +#define DECLARE_WORD_ARRAY(X,D) F77_WORD_TYPE X[D] +#define DECLARE_UBYTE_ARRAY(X,D) F77_UBYTE_TYPE X[D] +#define DECLARE_UWORD_ARRAY(X,D) F77_UWORD_TYPE X[D] +#define DECLARE_POINTER_ARRAY(X,D) F77_POINTER_TYPE X[D] +#define DECLARE_CHARACTER_ARRAY(X,L,D) F77_CHARACTER_TYPE X[D][L]; \ + const int X##_length = L + +/* --- Declare and construct dynamic CHARACTER arguments --- */ +#define DECLARE_CHARACTER_DYN(X) F77_CHARACTER_TYPE *X;\ + int X##_length +#define F77_CREATE_CHARACTER(X,L) X=slaStringCreate(L);\ + X##_length = (L>0?L:1) + +/* Declare Dynamic Fortran arrays */ +#define DECLARE_INTEGER_ARRAY_DYN(X) F77_INTEGER_TYPE *X +#define DECLARE_REAL_ARRAY_DYN(X) F77_REAL_TYPE *X +#define DECLARE_DOUBLE_ARRAY_DYN(X) F77_DOUBLE_TYPE *X +#define DECLARE_LOGICAL_ARRAY_DYN(X) F77_LOGICAL_TYPE *X +#define DECLARE_BYTE_ARRAY_DYN(X) F77_BYTE_TYPE *X +#define DECLARE_WORD_ARRAY_DYN(X) F77_WORD_TYPE *X +#define DECLARE_UBYTE_ARRAY_DYN(X) F77_UBYTE_TYPE *X +#define DECLARE_UWORD_ARRAY_DYN(X) F77_UWORD_TYPE *X +#define DECLARE_POINTER_ARRAY_DYN(X) F77_POINTER_TYPE *X +#define DECLARE_CHARACTER_ARRAY_DYN(X) F77_CHARACTER_TYPE *X;\ + int X##_length + +/* Create arrays dynamic Fortran arrays for those types which require */ +/* Separate space for Fortran and C arrays */ +/* Character and logical are already defined */ +/* For most types there is nothing to do */ +#define F77_CREATE_CHARACTER_ARRAY(X,L,N) \ + {int f77dims[1];f77dims[0]=N;X=cnfCrefa(L,1,f77dims);X##_length=L;} +#define F77_CREATE_CHARACTER_ARRAY_M(X,L,N,D) X=cnfCrefa(L,N,D);\ + X##_length = L +#define F77_CREATE_LOGICAL_ARRAY(X,N) \ + {int f77dims[1];f77dims[0]=N;X=cnfCrela(1,f77dims);} +#define F77_CREATE_LOGICAL_ARRAY_M(X,N,D) X=cnfCrela(N,D) +#define F77_CREATE_INTEGER_ARRAY(X,N) +#define F77_CREATE_REAL_ARRAY(X,N) +#define F77_CREATE_DOUBLE_ARRAY(X,N) +#define F77_CREATE_BYTE_ARRAY(X,N) +#define F77_CREATE_UBYTE_ARRAY(X,N) +#define F77_CREATE_WORD_ARRAY(X,N) +#define F77_CREATE_UWORD_ARRAY(X,N) +#define F77_CREATE_POINTER_ARRAY(X,N)\ + X=(F77_POINTER_TYPE *) malloc(N*sizeof(F77_POINTER_TYPE)) + +/* Associate Fortran arrays with C arrays */ +/* These macros ensure that there is space somewhere for the Fortran */ +/* array. They are complemetary to the CREATE_type_ARRAY macros */ +#define F77_ASSOC_CHARACTER_ARRAY(F,C) +#define F77_ASSOC_LOGICAL_ARRAY(F,C) +#define F77_ASSOC_INTEGER_ARRAY(F,C) F=C +#define F77_ASSOC_REAL_ARRAY(F,C) F=C +#define F77_ASSOC_DOUBLE_ARRAY(F,C) F=C +#define F77_ASSOC_BYTE_ARRAY(F,C) F=C +#define F77_ASSOC_UBYTE_ARRAY(F,C) F=C +#define F77_ASSOC_WORD_ARRAY(F,C) F=C +#define F77_ASSOC_UWORD_ARRAY(F,C) F=C +#define F77_ASSOC_POINTER_ARRAY(F,C) + +/* Free created dynamic arrays */ +/* Character and logical are already defined */ +/* For most types there is nothing to do */ +#define F77_FREE_INTEGER(X) +#define F77_FREE_REAL(X) +#define F77_FREE_DOUBLE(X) +#define F77_FREE_BYTE(X) +#define F77_FREE_UBYTE(X) +#define F77_FREE_WORD(X) +#define F77_FREE_UWORD(X) +#define F77_FREE_POINTER(X) cnfFree((void *)X); +#define F77_FREE_CHARACTER(X) slaStringFree( X ) +#define F77_FREE_LOGICAL(X) cnfFree( (char *)X ) + +/* --- IMPORT and EXPORT of values --- */ +/* Export C variables to Fortran variables */ +#define F77_EXPORT_CHARACTER(C,F,L) slaStringExport(C,F,L) +#define F77_EXPORT_DOUBLE(C,F) F=C +#define F77_EXPORT_INTEGER(C,F) F=C +#define F77_EXPORT_LOGICAL(C,F) F=C?F77_TRUE:F77_FALSE +#define F77_EXPORT_REAL(C,F) F=C +#define F77_EXPORT_BYTE(C,F) F=C +#define F77_EXPORT_WORD(C,F) F=C +#define F77_EXPORT_UBYTE(C,F) F=C +#define F77_EXPORT_UWORD(C,F) F=C +#define F77_EXPORT_POINTER(C,F) F=cnfFptr(C) +#define F77_EXPORT_LOCATOR(C,F) cnfExpch(C,F,DAT__SZLOC) + +/* Allow for character strings to be NULL, protects strlen. Note this + * does not allow lengths to differ. */ +#define F77_CREATE_EXPORT_CHARACTER(C,F) \ + if (C) { \ + F77_CREATE_CHARACTER(F,strlen(C)); \ + F77_EXPORT_CHARACTER(C,F,F##_length); \ + } else { \ + F77_CREATE_CHARACTER(F,1); \ + F77_EXPORT_CHARACTER(" ",F,F##_length); \ + } + + +/* Export C arrays to Fortran */ +/* Arrays are assumed to be 1-d so just the number of elements is given */ +/* This may be OK for n-d arrays also */ +/* CHARACTER arrays may be represented in C as arrays of arrays of char or */ +/* as arrays of pointers to char (the _P variant) */ +#define F77_EXPORT_CHARACTER_ARRAY(C,LC,F,LF,N) \ + {int f77dims[1];f77dims[0]=N;cnfExprta(C,LC,F,LF,1,f77dims);} +#define F77_EXPORT_CHARACTER_ARRAY_P(C,F,LF,N) \ + {int f77dims[1];f77dims[0]=N;cnfExprtap(C,F,LF,1,f77dims);} +#define F77_EXPORT_DOUBLE_ARRAY(C,F,N) F=(F77_DOUBLE_TYPE *)C +#define F77_EXPORT_INTEGER_ARRAY(C,F,N) F=(F77_INTEGER_TYPE *)C +#define F77_EXPORT_LOGICAL_ARRAY(C,F,N) \ + {int f77dims[1];f77dims[0]=N;cnfExpla(C,F,1,f77dims);} +#define F77_EXPORT_REAL_ARRAY(C,F,N) F=(F77_REAL_TYPE *)C +#define F77_EXPORT_BYTE_ARRAY(C,F,N) F=(F77_BYTE_TYPE *)C +#define F77_EXPORT_WORD_ARRAY(C,F,N) F=(F77_WORD_TYPE *)C +#define F77_EXPORT_UBYTE_ARRAY(C,F,N) F=(F77_UBYTE_TYPE *)C +#define F77_EXPORT_UWORD_ARRAY(C,F,N) F=(F77_UWORD_TYPE * )C +#define F77_EXPORT_POINTER_ARRAY(C,F,N) \ + {int f77i;for (f77i=0;f77i + +#if USE_CNF +#define F77_LOCK(code) \ + cnfLock(); \ + code \ + cnfUnlock(); +#else +#define F77_LOCK(code) code +#endif + +/* --- Pass arguments to a FORTRAN routine --- */ + +#define INTEGER_ARG(X) X +#define REAL_ARG(X) X +#define DOUBLE_ARG(X) X +#define LOGICAL_ARG(X) X +#define BYTE_ARG(X) X +#define WORD_ARG(X) X +#define UBYTE_ARG(X) X +#define UWORD_ARG(X) X +#define POINTER_ARG(X) X +#define CHARACTER_ARG(X) X +#define TRAIL_ARG(X) ,X##_length + +#define SUBROUTINE_ARG(X) X +#define INTEGER_FUNCTION_ARG(X) X +#define REAL_FUNCTION_ARG(X) X +#define DOUBLE_FUNCTION_ARG(X) X +#define LOGICAL_FUNCTION_ARG(X) X +#define CHARACTER_FUNCTION_ARG(X) X +#define BYTE_FUNCTION_ARG(X) X +#define WORD_FUNCTION_ARG(X) X +#define UBYTE_FUNCTION_ARG(X) X +#define UWORD_FUNCTION_ARG(X) X +#define POINTER_FUNCTION_ARG(X) X + +#define INTEGER_ARRAY_ARG(X) (F77_INTEGER_TYPE *)X +#define REAL_ARRAY_ARG(X) (F77_REAL_TYPE *)X +#define DOUBLE_ARRAY_ARG(X) (F77_DOUBLE_TYPE *)X +#define LOGICAL_ARRAY_ARG(X) (F77_LOGICAL_TYPE *)X +#define BYTE_ARRAY_ARG(X) (F77_BYTE_TYPE *)X +#define WORD_ARRAY_ARG(X) (F77_WORD_TYPE *)X +#define UBYTE_ARRAY_ARG(X) (F77_UBYTE_TYPE *)X +#define UWORD_ARRAY_ARG(X) (F77_UWORD_TYPE *)X +#define POINTER_ARRAY_ARG(X) (F77_POINTER_TYPE *)X +#define CHARACTER_ARRAY_ARG(X) (F77_CHARACTER_ARRAY_ARG_TYPE *)X + + +/* ------------------------ Non-ansi section ------------------------------ */ + +/* The difference between ANSI and non-ANSI compilers, as far as macro */ +/* definition is concerned, is that non-ANSI compilers do not support the */ +/* token concatenation operator (##). To work around this, we use the fact */ +/* that the null comment is preprocessed to produce no characters at all */ +/* by our non-ANSI compilers. */ +/* This section does not deal with the fact that some non-ANSI compilers */ +/* cannot handle function prototypes. That is handled in the machine */ +/* specific sections. */ + +#if !defined(__STDC__) + +/* --- External Name --- */ + +/* Macro to define the name of a Fortran routine or common block. This */ +/* ends in an underscore on many Unix systems. */ + +#undef F77_EXTERNAL_NAME +#define F77_EXTERNAL_NAME(X) X/**/_ + + +/* --- Dummy Arguments --- */ + +/* Macros to handle character dummy arguments. */ + +#undef TRAIL +#define TRAIL(X) ,@TRAIL_TYPE@ X/**/_length + + +/* --- Declare variables --- */ + +#undef DECLARE_CHARACTER +#define DECLARE_CHARACTER(X,L) F77_CHARACTER_TYPE X[L]; \ + const int X/**/_length = L +#undef DECLARE_CHARACTER_ARRAY +#define DECLARE_CHARACTER_ARRAY(X,L,D) F77_CHARACTER_TYPE X[D][L]; \ + const int X/**/_length = L +#undef DECLARE_CHARACTER_DYN +#define DECLARE_CHARACTER_DYN(X) F77_CHARACTER_TYPE *X;\ + int X/**/_length +#undef DECLARE_CHARACTER_ARRAY_DYN +#define DECLARE_CHARACTER_ARRAY_DYN(X) F77_CHARACTER_TYPE *X;\ + int X/**/_length +#undef F77_CREATE_CHARACTER +#define F77_CREATE_CHARACTER(X,L) X=cnfCref(L);\ + X/**/_length = L +#undef F77_CREATE_CHARACTER_ARRAY +#define F77_CREATE_CHARACTER_ARRAY(X,L,N) \ + {int f77dims[1];f77dims[0]=N;X=cnfCrefa(L,1,f77dims);X/**/_length=L;} + +/* --- Pass arguments to a FORTRAN routine --- */ + +#undef TRAIL_ARG +#define TRAIL_ARG(X) ,X/**/_length + + +#endif /* of non ANSI redefinitions */ + + +/* ----------------------------------------------------------------------- */ + +/* The standard macros defined above are known to work with the following */ +/* systems: */ + +/*-------- +| Sun | +---------*/ + +/* On SunOS, the ANSI definitions work with the acc and gcc compilers. */ +/* The cc compiler uses the non ANSI definitions. It also needs the K&R */ +/* definitions in the file kr.h. */ +/* On Solaris, the standard definitions work with the cc compiler. */ + +#if defined(sun) + +#if !defined(__STDC__) +#if !defined(_F77_KR) +#define _F77_KR +#endif +#endif + +#endif /* Sun */ + +/* -------------------- System dependent sections ------------------------- */ + +/*------------ +| VAX/VMS | +-------------*/ + +/* Many macros need to be changed due to the way that VMS handles external */ +/* names, passes character arguments and handles logical values. */ + + +#if defined(VMS) + +/* --- Data Types --- */ + +/* Redefine the macro for the byte data type as signed is not valid syntax */ +/* as the VMS compiler is not ANSI compliant. */ + +#undef F77_BYTE_TYPE +#define F77_BYTE_TYPE char + + +/* --- External Names --- */ + +/* Macro to define the name of a Fortran routine or common block. */ +/* Fortran and C routines names are the same on VMS. */ + +#undef F77_EXTERNAL_NAME +#define F77_EXTERNAL_NAME(X) X + + +/* --- Dummy Arguments --- */ + +/* Macros to handle character arguments. */ +/* Character string arguments are pointers to character string descriptors */ +/* and there are no trailing arguments. */ + +#if( VMS != 0 ) +#include +#endif + + +#undef F77_CHARACTER_ARG_TYPE +#define F77_CHARACTER_ARG_TYPE struct dsc$descriptor_s +#undef F77_CHARACTER_ARRAY_ARG_TYPE +#define F77_CHARACTER_ARRAY_ARG_TYPE struct dsc$descriptor_a +#undef CHARACTER +#define CHARACTER(X) F77_CHARACTER_ARG_TYPE *CNF_CONST X/**/_arg +#undef TRAIL +#define TRAIL(X) +#undef CHARACTER_ARRAY +#define CHARACTER_ARRAY(X) F77_CHARACTER_ARRAY_ARG_TYPE *CNF_CONST X/**/_arg +#undef GENPTR_CHARACTER +#define GENPTR_CHARACTER(X) \ + F77_CHARACTER_TYPE *X = X/**/_arg->dsc$a_pointer; \ + int X/**/_length = X/**/_arg->dsc$w_length; +#undef GENPTR_CHARACTER_ARRAY +#define GENPTR_CHARACTER_ARRAY(X) GENPTR_CHARACTER(X) + + +/* --- Logical Values --- */ + +#undef F77_TRUE +#define F77_TRUE -1 +#undef F77_ISTRUE +#define F77_ISTRUE(X) ( (X)&1 ) +#undef F77_ISFALSE +#define F77_ISFALSE(X) ( ! ( (X)&1 ) ) + + +/* --- Common Blocks --- */ + +#undef F77_BLANK_COMMON +#define F77_BLANK_COMMON $BLANK + + +/* --- Declare Variables --- */ + +#undef DECLARE_CHARACTER +#define DECLARE_CHARACTER(X,L) \ + F77_CHARACTER_TYPE X[L]; const int X/**/_length = L; \ + F77_CHARACTER_ARG_TYPE X/**/_descr = \ + { L, DSC$K_DTYPE_T, DSC$K_CLASS_S, X }; \ + F77_CHARACTER_ARG_TYPE *X/**/_arg = &X/**/_descr +#undef DECLARE_CHARACTER_ARRAY +#define DECLARE_CHARACTER_ARRAY(X,L,D) \ + F77_CHARACTER_TYPE X[D][L]; const int X/**/_length = L; \ + F77_CHARACTER_ARRAY_ARG_TYPE X/**/_descr = \ + { L, DSC$K_DTYPE_T, DSC$K_CLASS_S, X }; \ + F77_CHARACTER_ARRAY_ARG_TYPE *X/**/_arg = &X/**/_descr + + +/* --- The dynamic allocation of character arguments --- */ +#undef DECLARE_CHARACTER_DYN +#define DECLARE_CHARACTER_DYN(X) int X/**/_length;\ + F77_CHARACTER_ARG_TYPE *X/**/_arg;\ + F77_CHARACTER_TYPE *X +#undef DECLARE_CHARACTER_ARRAY_DYN +#define DECLARE_CHARACTER_ARRAY_DYN(X) int X/**/_length;\ + F77_CHARACTER_ARRAY_ARG_TYPE *X/**/_arg;\ + F77_CHARACTER_TYPE *X +#undef F77_CREATE_CHARACTER +#define F77_CREATE_CHARACTER(X,L) X/**/_arg = cnfCref(L);\ + X = X/**/_arg->dsc$a_pointer; \ + X/**/_length = X/**/_arg->dsc$w_length +#undef F77_CREATE_CHARACTER_ARRAY +#define F77_CREATE_CHARACTER_ARRAY(X,L,N) \ + {int f77dims[1];f77dims[0]=N;X/**/_arg=cnfCrefa(L,1,f77dims);X/**/_length=L;} +#define F77_CREATE_CHARACTER_ARRAY_M(X,L,N,D) X/**/_arg = cnfCrefa(L,N,D);\ + X = X/**/_arg->dsc$a_pointer; \ + X/**/_length = X/**/_arg->dsc$w_length +#undef F77_FREE_CHARACTER +#define F77_FREE_CHARACTER(X) slaStringFree( X/**/_arg ) + +/* --- Pass arguments to a FORTRAN routine --- */ + +#undef CHARACTER_ARG +#define CHARACTER_ARG(X) X/**/_arg +#undef CHARACTER_ARRAY_ARG +#define CHARACTER_ARRAY_ARG(X) X/**/_arg +#undef TRAIL_ARG +#define TRAIL_ARG(X) + +#endif /* VMS */ + +/* ----------------------------------------------------------------------- */ + +/*-------------------------- +| DECstation Ultrix (cc) | +| DECstation Ultrix (c89) | +| DECstation OSF/1 | +| Alpha OSF/1 | + --------------------------*/ + +/* Do this complicated set of definitions as a single #if cannot be */ +/* continued across multiple lines. */ + +#if defined(mips) && defined(ultrix) +#define _dec_unix 1 +#endif +#if defined(__mips) && defined(__ultrix) +#define _dec_unix 1 +#endif +#if defined(__mips__) && defined(__osf__) +#define _dec_unix 1 +#endif +#if defined(__alpha) && defined(__osf__) +#define _dec_unix 1 +#endif + +#if _dec_unix + +/* The macros for Ultrix are the same as the standard ones except for ones */ +/* dealing with logical values. The ANSI definitions work with the c89 */ +/* compiler, and the non ANSI definitions work with the cc compiler. */ +/* The same applies to DEC OSF/1, except that its cc compiler is ANSI */ +/* compliant. */ + + +/* --- Logical Values --- */ + +/* Redefine macros that evaluate to a C logical value, given a FORTRAN */ +/* logical value. These definitions are only valid when used with the DEC */ +/* FORTRAN for RISC compiler. If you are using the earlier FORTRAN for */ +/* RISC compiler from MIPS, then these macros should be deleted. */ + +#undef F77_TRUE +#define F77_TRUE -1 +#undef F77_ISTRUE +#define F77_ISTRUE(X) ( (X)&1 ) +#undef F77_ISFALSE +#define F77_ISFALSE(X) ( ! ( (X)&1 ) ) + + +#endif /* DEC Unix */ + +/* +*+ +* Name: +* cnf.h + +* Purpose: +* Function prototypes for cnf routines + +* Language: +* ANSI C + +* Type of Module: +* C include file + +* Description: +* These are the prototype definitions for the functions in the CNF +* library. They are used used in mixing C and FORTRAN programs. + +* Copyright: +* Copyright (C) 1991 Science & Engineering Research Council + +* Authors: +* PMA: Peter Allan (Starlink, RAL) +* AJC: Alan Chipperfield (Starlink, RAL) +* {enter_new_authors_here} + +* History: +* 23-MAY-1991 (PMA): +* Original version. +* 12-JAN-1996 (AJC): +* Add cnf_cref and cnf_freef +* 14-JUN-1996 (AJC): +* Add cnf_crefa, imprta, exprta +* crela, impla, expla +* 18-JUL-1996 (AJC): +* Add impch and expch +* 17-MAR-1998 (AJC): +* Add imprtap and exprtap +* {enter_changes_here} + +* Bugs: +* {note_any_bugs_here} + +*- +------------------------------------------------------------------------------ +*/ +void *cnfCalloc( size_t, size_t ); +void cnfCopyf( const char *source_f, int source_len, char *dest_f, + int dest_len ); +void *cnfCptr( F77_POINTER_TYPE ); +char *cnfCreat( int length ); +F77_CHARACTER_ARG_TYPE *cnfCref( int length ); +F77_CHARACTER_ARG_TYPE *cnfCrefa( int length, int ndims, const int *dims ); +char *cnfCreib( const char *source_f, int source_len ); +char *cnfCreim( const char *source_f, int source_len ); +F77_LOGICAL_TYPE *cnfCrela( int ndims, const int *dims ); +void cnfExpch( const char *source_c, char *dest_f, int nchars ); +void cnfExpla( const int *source_c, F77_LOGICAL_TYPE *dest_f, int ndims, + const int *dims ); +void cnfExpn( const char *source_c, int max, char *dest_f, int dest_len ); +void cnfExprt( const char *source_c, char *dest_f, int dest_len ); +void cnfExprta( const char *source_c, int source_len, char *dest_f, + int dest_len, int ndims, const int *dims ); +void cnfExprtap( char *const *source_c, char *dest_f, int dest_len, + int ndims, const int *dims ); +F77_POINTER_TYPE cnfFptr( void *cpointer ); +void cnfFree( void * ); +void cnfFreef( F77_CHARACTER_ARG_TYPE *temp ); +void cnfImpb( const char *source_f, int source_len, char *dest_c ); +void cnfImpbn( const char *source_f, int source_len, int max, char *dest_c ); +void cnfImpch( const char *source_f, int nchars, char *dest_c ); +void cnfImpla( const F77_LOGICAL_TYPE *source_f, int *dest_c, + int ndims, const int *dims ); +void cnfImpn( const char *source_f, int source_len, int max, char *dest_c ); +void cnfImprt( const char *source_f, int source_len, char *dest_c ); +void cnfImprta( const char *source_f, int source_len, char *dest_c, + int dest_len, int ndims, const int *dims ); +void cnfImprtap( const char *source_f, int source_len, char *const *dest_c, + int dest_len, int ndims, const int *dims ); +int cnfLenc( const char *source_c ); +int cnfLenf( const char *source_f, int source_len ); +void *cnfMalloc( size_t ); +int cnfRegp( void * ); +void cnfUregp( void * ); +void cnfLock( void ); +void cnfUnlock( void ); +#endif + +#ifndef CNF_OLD_DEFINED +#define CNF_OLD_DEFINED +/* Define old names to be new names */ +#define cnf_calloc cnfCalloc +#define cnf_copyf cnfCopyf +#define cnf_cptr cnfCptr +#define cnf_creat cnfCreat +#define cnf_cref cnfCref +#define cnf_crefa cnfCrefa +#define cnf_creib cnfCreib +#define cnf_creim cnfCreim +#define cnf_crela cnfCrela +#define cnf_expch cnfExpch +#define cnf_expla cnfExpla +#define cnf_expn cnfExpn +#define cnf_exprt cnfExprt +#define cnf_exprta cnfExprta +#define cnf_exprtap cnfExprtap +#define cnf_fptr cnfFptr +#define cnf_free cnfFree +#define cnf_freef cnfFreef +#define cnf_impb cnfImpb +#define cnf_impbn cnfImpbn +#define cnf_impch cnfImpch +#define cnf_impla cnfImpla +#define cnf_impn cnfImpn +#define cnf_imprt cnfImprt +#define cnf_imprta cnfImprta +#define cnf_imprtap cnfImprtap +#define cnf_lenc cnfLenc +#define cnf_lenf cnfLenf +#define cnf_malloc cnfMalloc +#define cnf_regp cnfRegp +#define cnf_uregp cnfUregp + +#endif diff --git a/math/slalib/fitxy.f b/math/slalib/fitxy.f new file mode 100644 index 00000000..5060510e --- /dev/null +++ b/math/slalib/fitxy.f @@ -0,0 +1,329 @@ + SUBROUTINE slFTXY (ITYPE,NP,XYE,XYM,COEFFS,J) +*+ +* - - - - - - +* F T X Y +* - - - - - - +* +* Fit a linear model to relate two sets of [X,Y] coordinates. +* +* Given: +* ITYPE i type of model: 4 or 6 (note 1) +* NP i number of samples (note 2) +* XYE d(2,np) expected [X,Y] for each sample +* XYM d(2,np) measured [X,Y] for each sample +* +* Returned: +* COEFFS d(6) coefficients of model (note 3) +* J i status: 0 = OK +* -1 = illegal ITYPE +* -2 = insufficient data +* -3 = no solution +* +* Notes: +* +* 1) ITYPE, which must be either 4 or 6, selects the type of model +* fitted. Both allowed ITYPE values produce a model COEFFS which +* consists of six coefficients, namely the zero points and, for +* each of XE and YE, the coefficient of XM and YM. For ITYPE=6, +* all six coefficients are independent, modelling squash and shear +* as well as origin, scale, and orientation. However, ITYPE=4 +* selects the "solid body rotation" option; the model COEFFS +* still consists of the same six coefficients, but now two of +* them are used twice (appropriately signed). Origin, scale +* and orientation are still modelled, but not squash or shear - +* the units of X and Y have to be the same. +* +* 2) For NC=4, NP must be at least 2. For NC=6, NP must be at +* least 3. +* +* 3) The model is returned in the array COEFFS. Naming the +* elements of COEFFS as follows: +* +* COEFFS(1) = A +* COEFFS(2) = B +* COEFFS(3) = C +* COEFFS(4) = D +* COEFFS(5) = E +* COEFFS(6) = F +* +* the model is: +* +* XE = A + B*XM + C*YM +* YE = D + E*XM + F*YM +* +* For the "solid body rotation" option (ITYPE=4), the +* magnitudes of B and F, and of C and E, are equal. The +* signs of these coefficients depend on whether there is a +* sign reversal between XE,YE and XM,YM; fits are performed +* with and without a sign reversal and the best one chosen. +* +* 4) Error status values J=-1 and -2 leave COEFFS unchanged; +* if J=-3 COEFFS may have been changed. +* +* See also slPXY, slINVF, slXYXY, slDCMF +* +* Called: slDMAT, slDMXV +* +* Last revision: 8 September 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER ITYPE,NP + DOUBLE PRECISION XYE(2,NP),XYM(2,NP),COEFFS(6) + INTEGER J + + INTEGER I,JSTAT,IW(4),NSOL + DOUBLE PRECISION A,B,C,D,AOLD,BOLD,COLD,DOLD,SOLD, + : P,SXE,SXEXM,SXEYM,SYE,SYEYM,SYEXM,SXM, + : SYM,SXMXM,SXMYM,SYMYM,XE,YE, + : XM,YM,V(4),DM3(3,3),DM4(4,4),DET, + : SGN,SXXYY,SXYYX,SX2Y2,SDR2,XR,YR + + + +* Preset the status + J=0 + +* Variable initializations to avoid compiler warnings + A = 0D0 + B = 0D0 + C = 0D0 + D = 0D0 + AOLD = 0D0 + BOLD = 0D0 + COLD = 0D0 + DOLD = 0D0 + SOLD = 0D0 + +* Float the number of samples + P=DBLE(NP) + +* Check ITYPE + IF (ITYPE.EQ.6) THEN + +* +* Six-coefficient linear model +* ---------------------------- + +* Check enough samples + IF (NP.GE.3) THEN + +* Form summations + SXE=0D0 + SXEXM=0D0 + SXEYM=0D0 + SYE=0D0 + SYEYM=0D0 + SYEXM=0D0 + SXM=0D0 + SYM=0D0 + SXMXM=0D0 + SXMYM=0D0 + SYMYM=0D0 + DO I=1,NP + XE=XYE(1,I) + YE=XYE(2,I) + XM=XYM(1,I) + YM=XYM(2,I) + SXE=SXE+XE + SXEXM=SXEXM+XE*XM + SXEYM=SXEYM+XE*YM + SYE=SYE+YE + SYEYM=SYEYM+YE*YM + SYEXM=SYEXM+YE*XM + SXM=SXM+XM + SYM=SYM+YM + SXMXM=SXMXM+XM*XM + SXMYM=SXMYM+XM*YM + SYMYM=SYMYM+YM*YM + END DO + +* Solve for A,B,C in XE = A + B*XM + C*YM + V(1)=SXE + V(2)=SXEXM + V(3)=SXEYM + DM3(1,1)=P + DM3(1,2)=SXM + DM3(1,3)=SYM + DM3(2,1)=SXM + DM3(2,2)=SXMXM + DM3(2,3)=SXMYM + DM3(3,1)=SYM + DM3(3,2)=SXMYM + DM3(3,3)=SYMYM + CALL slDMAT(3,DM3,V,DET,JSTAT,IW) + IF (JSTAT.EQ.0) THEN + DO I=1,3 + COEFFS(I)=V(I) + END DO + +* Solve for D,E,F in YE = D + E*XM + F*YM + V(1)=SYE + V(2)=SYEXM + V(3)=SYEYM + CALL slDMXV(DM3,V,COEFFS(4)) + + ELSE + +* No 6-coefficient solution possible + J=-3 + + END IF + + ELSE + +* Insufficient data for 6-coefficient fit + J=-2 + + END IF + + ELSE IF (ITYPE.EQ.4) THEN + +* +* Four-coefficient solid body rotation model +* ------------------------------------------ + +* Check enough samples + IF (NP.GE.2) THEN + +* Try two solutions, first without then with flip in X + DO NSOL=1,2 + IF (NSOL.EQ.1) THEN + SGN=1D0 + ELSE + SGN=-1D0 + END IF + +* Form summations + SXE=0D0 + SXXYY=0D0 + SXYYX=0D0 + SYE=0D0 + SXM=0D0 + SYM=0D0 + SX2Y2=0D0 + DO I=1,NP + XE=XYE(1,I)*SGN + YE=XYE(2,I) + XM=XYM(1,I) + YM=XYM(2,I) + SXE=SXE+XE + SXXYY=SXXYY+XE*XM+YE*YM + SXYYX=SXYYX+XE*YM-YE*XM + SYE=SYE+YE + SXM=SXM+XM + SYM=SYM+YM + SX2Y2=SX2Y2+XM*XM+YM*YM + END DO + +* +* Solve for A,B,C,D in: +/- XE = A + B*XM - C*YM +* + YE = D + C*XM + B*YM + V(1)=SXE + V(2)=SXXYY + V(3)=SXYYX + V(4)=SYE + DM4(1,1)=P + DM4(1,2)=SXM + DM4(1,3)=-SYM + DM4(1,4)=0D0 + DM4(2,1)=SXM + DM4(2,2)=SX2Y2 + DM4(2,3)=0D0 + DM4(2,4)=SYM + DM4(3,1)=SYM + DM4(3,2)=0D0 + DM4(3,3)=-SX2Y2 + DM4(3,4)=-SXM + DM4(4,1)=0D0 + DM4(4,2)=SYM + DM4(4,3)=SXM + DM4(4,4)=P + CALL slDMAT(4,DM4,V,DET,JSTAT,IW) + IF (JSTAT.EQ.0) THEN + A=V(1) + B=V(2) + C=V(3) + D=V(4) + +* Determine sum of radial errors squared + SDR2=0D0 + DO I=1,NP + XM=XYM(1,I) + YM=XYM(2,I) + XR=A+B*XM-C*YM-XYE(1,I)*SGN + YR=D+C*XM+B*YM-XYE(2,I) + SDR2=SDR2+XR*XR+YR*YR + END DO + + ELSE + +* Singular: set flag + SDR2=-1D0 + + END IF + +* If first pass and non-singular, save variables + IF (NSOL.EQ.1.AND.JSTAT.EQ.0) THEN + AOLD=A + BOLD=B + COLD=C + DOLD=D + SOLD=SDR2 + END IF + + END DO + +* Pick the best of the two solutions + IF (SOLD.GE.0D0.AND.(SOLD.LE.SDR2.OR.NP.EQ.2)) THEN + COEFFS(1)=AOLD + COEFFS(2)=BOLD + COEFFS(3)=-COLD + COEFFS(4)=DOLD + COEFFS(5)=COLD + COEFFS(6)=BOLD + ELSE IF (JSTAT.EQ.0) THEN + COEFFS(1)=-A + COEFFS(2)=-B + COEFFS(3)=C + COEFFS(4)=D + COEFFS(5)=C + COEFFS(6)=B + ELSE + +* No 4-coefficient fit possible + J=-3 + END IF + ELSE + +* Insufficient data for 4-coefficient fit + J=-2 + END IF + ELSE + +* Illegal ITYPE - not 4 or 6 + J=-1 + END IF + + END diff --git a/math/slalib/fk425.f b/math/slalib/fk425.f new file mode 100644 index 00000000..40d5a615 --- /dev/null +++ b/math/slalib/fk425.f @@ -0,0 +1,267 @@ + SUBROUTINE slFK45 (R1950,D1950,DR1950,DD1950,P1950,V1950, + : R2000,D2000,DR2000,DD2000,P2000,V2000) +*+ +* - - - - - - +* F K 4 5 +* - - - - - - +* +* Convert B1950.0 FK4 star data to J2000.0 FK5 (double precision) +* +* This routine converts stars from the old, Bessel-Newcomb, FK4 +* system to the new, IAU 1976, FK5, Fricke system. The precepts +* of Smith et al (Ref 1) are followed, using the implementation +* by Yallop et al (Ref 2) of a matrix method due to Standish. +* Kinoshita's development of Andoyer's post-Newcomb precession is +* used. The numerical constants from Seidelmann et al (Ref 3) are +* used canonically. +* +* Given: (all B1950.0,FK4) +* R1950,D1950 dp B1950.0 RA,Dec (rad) +* DR1950,DD1950 dp B1950.0 proper motions (rad/trop.yr) +* P1950 dp parallax (arcsec) +* V1950 dp radial velocity (km/s, +ve = moving away) +* +* Returned: (all J2000.0,FK5) +* R2000,D2000 dp J2000.0 RA,Dec (rad) +* DR2000,DD2000 dp J2000.0 proper motions (rad/Jul.yr) +* P2000 dp parallax (arcsec) +* V2000 dp radial velocity (km/s, +ve = moving away) +* +* Notes: +* +* 1) The proper motions in RA are dRA/dt rather than +* cos(Dec)*dRA/dt, and are per year rather than per century. +* +* 2) Conversion from Besselian epoch 1950.0 to Julian epoch +* 2000.0 only is provided for. Conversions involving other +* epochs will require use of the appropriate precession, +* proper motion, and E-terms routines before and/or +* after FK425 is called. +* +* 3) In the FK4 catalogue the proper motions of stars within +* 10 degrees of the poles do not embody the differential +* E-term effect and should, strictly speaking, be handled +* in a different manner from stars outside these regions. +* However, given the general lack of homogeneity of the star +* data available for routine astrometry, the difficulties of +* handling positions that may have been determined from +* astrometric fields spanning the polar and non-polar regions, +* the likelihood that the differential E-terms effect was not +* taken into account when allowing for proper motion in past +* astrometry, and the undesirability of a discontinuity in +* the algorithm, the decision has been made in this routine to +* include the effect of differential E-terms on the proper +* motions for all stars, whether polar or not. At epoch 2000, +* and measuring on the sky rather than in terms of dRA, the +* errors resulting from this simplification are less than +* 1 milliarcsecond in position and 1 milliarcsecond per +* century in proper motion. +* +* References: +* +* 1 Smith, C.A. et al, 1989. "The transformation of astrometric +* catalog systems to the equinox J2000.0". Astron.J. 97, 265. +* +* 2 Yallop, B.D. et al, 1989. "Transformation of mean star places +* from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space". +* Astron.J. 97, 274. +* +* 3 Seidelmann, P.K. (ed), 1992. "Explanatory Supplement to +* the Astronomical Almanac", ISBN 0-935702-68-7. +* +* P.T.Wallace Starlink 19 December 1993 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION R1950,D1950,DR1950,DD1950,P1950,V1950, + : R2000,D2000,DR2000,DD2000,P2000,V2000 + + +* Miscellaneous + DOUBLE PRECISION R,D,UR,UD,PX,RV,SR,CR,SD,CD,W,WD + DOUBLE PRECISION X,Y,Z,XD,YD,ZD + DOUBLE PRECISION RXYSQ,RXYZSQ,RXY,RXYZ,SPXY,SPXYZ + INTEGER I,J + +* Star position and velocity vectors + DOUBLE PRECISION R0(3),RD0(3) + +* Combined position and velocity vectors + DOUBLE PRECISION V1(6),V2(6) + +* 2Pi + DOUBLE PRECISION D2PI + PARAMETER (D2PI=6.283185307179586476925287D0) + +* Radians per year to arcsec per century + DOUBLE PRECISION PMF + PARAMETER (PMF=100D0*60D0*60D0*360D0/D2PI) + +* Small number to avoid arithmetic problems + DOUBLE PRECISION TINY + PARAMETER (TINY=1D-30) + + +* +* CANONICAL CONSTANTS (see references) +* + +* Km per sec to AU per tropical century +* = 86400 * 36524.2198782 / 149597870 + DOUBLE PRECISION VF + PARAMETER (VF=21.095D0) + +* Constant vector and matrix (by columns) + DOUBLE PRECISION A(3),AD(3),EM(6,6) + DATA A,AD/ -1.62557D-6, -0.31919D-6, -0.13843D-6, + : +1.245D-3, -1.580D-3, -0.659D-3/ + + DATA (EM(I,1),I=1,6) / +0.9999256782D0, + : +0.0111820610D0, + : +0.0048579479D0, + : -0.000551D0, + : +0.238514D0, + : -0.435623D0 / + + DATA (EM(I,2),I=1,6) / -0.0111820611D0, + : +0.9999374784D0, + : -0.0000271474D0, + : -0.238565D0, + : -0.002667D0, + : +0.012254D0 / + + DATA (EM(I,3),I=1,6) / -0.0048579477D0, + : -0.0000271765D0, + : +0.9999881997D0, + : +0.435739D0, + : -0.008541D0, + : +0.002117D0 / + + DATA (EM(I,4),I=1,6) / +0.00000242395018D0, + : +0.00000002710663D0, + : +0.00000001177656D0, + : +0.99994704D0, + : +0.01118251D0, + : +0.00485767D0 / + + DATA (EM(I,5),I=1,6) / -0.00000002710663D0, + : +0.00000242397878D0, + : -0.00000000006582D0, + : -0.01118251D0, + : +0.99995883D0, + : -0.00002714D0 / + + DATA (EM(I,6),I=1,6) / -0.00000001177656D0, + : -0.00000000006587D0, + : +0.00000242410173D0, + : -0.00485767D0, + : -0.00002718D0, + : +1.00000956D0 / + + + +* Pick up B1950 data (units radians and arcsec/TC) + R=R1950 + D=D1950 + UR=DR1950*PMF + UD=DD1950*PMF + PX=P1950 + RV=V1950 + +* Spherical to Cartesian + SR=SIN(R) + CR=COS(R) + SD=SIN(D) + CD=COS(D) + + R0(1)=CR*CD + R0(2)=SR*CD + R0(3)= SD + + W=VF*RV*PX + + RD0(1)=-SR*CD*UR-CR*SD*UD+W*R0(1) + RD0(2)= CR*CD*UR-SR*SD*UD+W*R0(2) + RD0(3)= CD*UD+W*R0(3) + +* Allow for e-terms and express as position+velocity 6-vector + W=R0(1)*A(1)+R0(2)*A(2)+R0(3)*A(3) + WD=R0(1)*AD(1)+R0(2)*AD(2)+R0(3)*AD(3) + DO I=1,3 + V1(I)=R0(I)-A(I)+W*R0(I) + V1(I+3)=RD0(I)-AD(I)+WD*R0(I) + END DO + +* Convert position+velocity vector to Fricke system + DO I=1,6 + W=0D0 + DO J=1,6 + W=W+EM(I,J)*V1(J) + END DO + V2(I)=W + END DO + +* Revert to spherical coordinates + X=V2(1) + Y=V2(2) + Z=V2(3) + XD=V2(4) + YD=V2(5) + ZD=V2(6) + + RXYSQ=X*X+Y*Y + RXYZSQ=RXYSQ+Z*Z + RXY=SQRT(RXYSQ) + RXYZ=SQRT(RXYZSQ) + + SPXY=X*XD+Y*YD + SPXYZ=SPXY+Z*ZD + + IF (X.EQ.0D0.AND.Y.EQ.0D0) THEN + R=0D0 + ELSE + R=ATAN2(Y,X) + IF (R.LT.0.0D0) R=R+D2PI + END IF + D=ATAN2(Z,RXY) + + IF (RXY.GT.TINY) THEN + UR=(X*YD-Y*XD)/RXYSQ + UD=(ZD*RXYSQ-Z*SPXY)/(RXYZSQ*RXY) + END IF + + IF (PX.GT.TINY) THEN + RV=SPXYZ/(PX*RXYZ*VF) + PX=PX/RXYZ + END IF + +* Return results + R2000=R + D2000=D + DR2000=UR/PMF + DD2000=UD/PMF + V2000=RV + P2000=PX + + END diff --git a/math/slalib/fk45z.f b/math/slalib/fk45z.f new file mode 100644 index 00000000..409d811b --- /dev/null +++ b/math/slalib/fk45z.f @@ -0,0 +1,183 @@ + SUBROUTINE slF45Z (R1950,D1950,BEPOCH,R2000,D2000) +*+ +* - - - - - - +* F 4 5 Z +* - - - - - - +* +* Convert B1950.0 FK4 star data to J2000.0 FK5 assuming zero +* proper motion in the FK5 frame (double precision) +* +* This routine converts stars from the old, Bessel-Newcomb, FK4 +* system to the new, IAU 1976, FK5, Fricke system, in such a +* way that the FK5 proper motion is zero. Because such a star +* has, in general, a non-zero proper motion in the FK4 system, +* the routine requires the epoch at which the position in the +* FK4 system was determined. +* +* The method is from Appendix 2 of Ref 1, but using the constants +* of Ref 4. +* +* Given: +* R1950,D1950 dp B1950.0 FK4 RA,Dec at epoch (rad) +* BEPOCH dp Besselian epoch (e.g. 1979.3D0) +* +* Returned: +* R2000,D2000 dp J2000.0 FK5 RA,Dec (rad) +* +* Notes: +* +* 1) The epoch BEPOCH is strictly speaking Besselian, but +* if a Julian epoch is supplied the result will be +* affected only to a negligible extent. +* +* 2) Conversion from Besselian epoch 1950.0 to Julian epoch +* 2000.0 only is provided for. Conversions involving other +* epochs will require use of the appropriate precession, +* proper motion, and E-terms routines before and/or +* after FK45Z is called. +* +* 3) In the FK4 catalogue the proper motions of stars within +* 10 degrees of the poles do not embody the differential +* E-term effect and should, strictly speaking, be handled +* in a different manner from stars outside these regions. +* However, given the general lack of homogeneity of the star +* data available for routine astrometry, the difficulties of +* handling positions that may have been determined from +* astrometric fields spanning the polar and non-polar regions, +* the likelihood that the differential E-terms effect was not +* taken into account when allowing for proper motion in past +* astrometry, and the undesirability of a discontinuity in +* the algorithm, the decision has been made in this routine to +* include the effect of differential E-terms on the proper +* motions for all stars, whether polar or not. At epoch 2000, +* and measuring on the sky rather than in terms of dRA, the +* errors resulting from this simplification are less than +* 1 milliarcsecond in position and 1 milliarcsecond per +* century in proper motion. +* +* References: +* +* 1 Aoki,S., et al, 1983. Astron.Astrophys., 128, 263. +* +* 2 Smith, C.A. et al, 1989. "The transformation of astrometric +* catalog systems to the equinox J2000.0". Astron.J. 97, 265. +* +* 3 Yallop, B.D. et al, 1989. "Transformation of mean star places +* from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space". +* Astron.J. 97, 274. +* +* 4 Seidelmann, P.K. (ed), 1992. "Explanatory Supplement to +* the Astronomical Almanac", ISBN 0-935702-68-7. +* +* Called: slDS2C, slEPJ, slEB2D, slDC2S, slDA2P +* +* P.T.Wallace Starlink 21 September 1998 +* +* Copyright (C) 1998 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION R1950,D1950,BEPOCH,R2000,D2000 + + DOUBLE PRECISION D2PI + PARAMETER (D2PI=6.283185307179586476925287D0) + + DOUBLE PRECISION W + INTEGER I,J + +* Position and position+velocity vectors + DOUBLE PRECISION R0(3),A1(3),V1(3),V2(6) + +* Radians per year to arcsec per century + DOUBLE PRECISION PMF + PARAMETER (PMF=100D0*60D0*60D0*360D0/D2PI) + +* Functions + DOUBLE PRECISION slEPJ,slEB2D,slDA2P + +* +* CANONICAL CONSTANTS (see references) +* + +* Vectors A and Adot, and matrix M (only half of which is needed here) + DOUBLE PRECISION A(3),AD(3),EM(6,3) + DATA A,AD/ -1.62557D-6, -0.31919D-6, -0.13843D-6, + : +1.245D-3, -1.580D-3, -0.659D-3/ + + DATA (EM(I,1),I=1,6) / +0.9999256782D0, + : +0.0111820610D0, + : +0.0048579479D0, + : -0.000551D0, + : +0.238514D0, + : -0.435623D0 / + + DATA (EM(I,2),I=1,6) / -0.0111820611D0, + : +0.9999374784D0, + : -0.0000271474D0, + : -0.238565D0, + : -0.002667D0, + : +0.012254D0 / + + DATA (EM(I,3),I=1,6) / -0.0048579477D0, + : -0.0000271765D0, + : +0.9999881997D0, + : +0.435739D0, + : -0.008541D0, + : +0.002117D0 / + + + +* Spherical to Cartesian + CALL slDS2C(R1950,D1950,R0) + +* Adjust vector A to give zero proper motion in FK5 + W=(BEPOCH-1950D0)/PMF + DO I=1,3 + A1(I)=A(I)+W*AD(I) + END DO + +* Remove e-terms + W=R0(1)*A1(1)+R0(2)*A1(2)+R0(3)*A1(3) + DO I=1,3 + V1(I)=R0(I)-A1(I)+W*R0(I) + END DO + +* Convert position vector to Fricke system + DO I=1,6 + W=0D0 + DO J=1,3 + W=W+EM(I,J)*V1(J) + END DO + V2(I)=W + END DO + +* Allow for fictitious proper motion in FK4 + W=(slEPJ(slEB2D(BEPOCH))-2000D0)/PMF + DO I=1,3 + V2(I)=V2(I)+W*V2(I+3) + END DO + +* Revert to spherical coordinates + CALL slDC2S(V2,W,D2000) + R2000=slDA2P(W) + + END diff --git a/math/slalib/fk524.f b/math/slalib/fk524.f new file mode 100644 index 00000000..49118030 --- /dev/null +++ b/math/slalib/fk524.f @@ -0,0 +1,275 @@ + SUBROUTINE slFK54 (R2000,D2000,DR2000,DD2000,P2000,V2000, + : R1950,D1950,DR1950,DD1950,P1950,V1950) +*+ +* - - - - - - +* F K 5 4 +* - - - - - - +* +* Convert J2000.0 FK5 star data to B1950.0 FK4 (double precision) +* +* This routine converts stars from the new, IAU 1976, FK5, Fricke +* system, to the old, Bessel-Newcomb, FK4 system. The precepts +* of Smith et al (Ref 1) are followed, using the implementation +* by Yallop et al (Ref 2) of a matrix method due to Standish. +* Kinoshita's development of Andoyer's post-Newcomb precession is +* used. The numerical constants from Seidelmann et al (Ref 3) are +* used canonically. +* +* Given: (all J2000.0,FK5) +* R2000,D2000 dp J2000.0 RA,Dec (rad) +* DR2000,DD2000 dp J2000.0 proper motions (rad/Jul.yr) +* P2000 dp parallax (arcsec) +* V2000 dp radial velocity (km/s, +ve = moving away) +* +* Returned: (all B1950.0,FK4) +* R1950,D1950 dp B1950.0 RA,Dec (rad) +* DR1950,DD1950 dp B1950.0 proper motions (rad/trop.yr) +* P1950 dp parallax (arcsec) +* V1950 dp radial velocity (km/s, +ve = moving away) +* +* Notes: +* +* 1) The proper motions in RA are dRA/dt rather than +* cos(Dec)*dRA/dt, and are per year rather than per century. +* +* 2) Note that conversion from Julian epoch 2000.0 to Besselian +* epoch 1950.0 only is provided for. Conversions involving +* other epochs will require use of the appropriate precession, +* proper motion, and E-terms routines before and/or after +* FK524 is called. +* +* 3) In the FK4 catalogue the proper motions of stars within +* 10 degrees of the poles do not embody the differential +* E-term effect and should, strictly speaking, be handled +* in a different manner from stars outside these regions. +* However, given the general lack of homogeneity of the star +* data available for routine astrometry, the difficulties of +* handling positions that may have been determined from +* astrometric fields spanning the polar and non-polar regions, +* the likelihood that the differential E-terms effect was not +* taken into account when allowing for proper motion in past +* astrometry, and the undesirability of a discontinuity in +* the algorithm, the decision has been made in this routine to +* include the effect of differential E-terms on the proper +* motions for all stars, whether polar or not. At epoch 2000, +* and measuring on the sky rather than in terms of dRA, the +* errors resulting from this simplification are less than +* 1 milliarcsecond in position and 1 milliarcsecond per +* century in proper motion. +* +* References: +* +* 1 Smith, C.A. et al, 1989. "The transformation of astrometric +* catalog systems to the equinox J2000.0". Astron.J. 97, 265. +* +* 2 Yallop, B.D. et al, 1989. "Transformation of mean star places +* from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space". +* Astron.J. 97, 274. +* +* 3 Seidelmann, P.K. (ed), 1992. "Explanatory Supplement to +* the Astronomical Almanac", ISBN 0-935702-68-7. +* +* P.T.Wallace Starlink 19 December 1993 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION R2000,D2000,DR2000,DD2000,P2000,V2000, + : R1950,D1950,DR1950,DD1950,P1950,V1950 + + +* Miscellaneous + DOUBLE PRECISION R,D,UR,UD,PX,RV + DOUBLE PRECISION SR,CR,SD,CD,X,Y,Z,W + DOUBLE PRECISION V1(6),V2(6) + DOUBLE PRECISION XD,YD,ZD + DOUBLE PRECISION RXYZ,WD,RXYSQ,RXY + INTEGER I,J + +* 2Pi + DOUBLE PRECISION D2PI + PARAMETER (D2PI=6.283185307179586476925287D0) + +* Radians per year to arcsec per century + DOUBLE PRECISION PMF + PARAMETER (PMF=100D0*60D0*60D0*360D0/D2PI) + +* Small number to avoid arithmetic problems + DOUBLE PRECISION TINY + PARAMETER (TINY=1D-30) + +* +* CANONICAL CONSTANTS (see references) +* + +* Km per sec to AU per tropical century +* = 86400 * 36524.2198782 / 149597870 + DOUBLE PRECISION VF + PARAMETER (VF=21.095D0) + +* Constant vector and matrix (by columns) + DOUBLE PRECISION A(6),EMI(6,6) + DATA A/ -1.62557D-6, -0.31919D-6, -0.13843D-6, + : +1.245D-3, -1.580D-3, -0.659D-3/ + + DATA (EMI(I,1),I=1,6) / +0.9999256795D0, + : -0.0111814828D0, + : -0.0048590040D0, + : -0.000551D0, + : -0.238560D0, + : +0.435730D0 / + + DATA (EMI(I,2),I=1,6) / +0.0111814828D0, + : +0.9999374849D0, + : -0.0000271557D0, + : +0.238509D0, + : -0.002667D0, + : -0.008541D0 / + + DATA (EMI(I,3),I=1,6) / +0.0048590039D0, + : -0.0000271771D0, + : +0.9999881946D0, + : -0.435614D0, + : +0.012254D0, + : +0.002117D0 / + + DATA (EMI(I,4),I=1,6) / -0.00000242389840D0, + : +0.00000002710544D0, + : +0.00000001177742D0, + : +0.99990432D0, + : -0.01118145D0, + : -0.00485852D0 / + + DATA (EMI(I,5),I=1,6) / -0.00000002710544D0, + : -0.00000242392702D0, + : +0.00000000006585D0, + : +0.01118145D0, + : +0.99991613D0, + : -0.00002716D0 / + + DATA (EMI(I,6),I=1,6) / -0.00000001177742D0, + : +0.00000000006585D0, + : -0.00000242404995D0, + : +0.00485852D0, + : -0.00002717D0, + : +0.99996684D0 / + + + +* Pick up J2000 data (units radians and arcsec/JC) + R=R2000 + D=D2000 + UR=DR2000*PMF + UD=DD2000*PMF + PX=P2000 + RV=V2000 + +* Spherical to Cartesian + SR=SIN(R) + CR=COS(R) + SD=SIN(D) + CD=COS(D) + + X=CR*CD + Y=SR*CD + Z= SD + + W=VF*RV*PX + + V1(1)=X + V1(2)=Y + V1(3)=Z + + V1(4)=-UR*Y-CR*SD*UD+W*X + V1(5)= UR*X-SR*SD*UD+W*Y + V1(6)= CD*UD+W*Z + +* Convert position+velocity vector to BN system + DO I=1,6 + W=0D0 + DO J=1,6 + W=W+EMI(I,J)*V1(J) + END DO + V2(I)=W + END DO + +* Position vector components and magnitude + X=V2(1) + Y=V2(2) + Z=V2(3) + RXYZ=SQRT(X*X+Y*Y+Z*Z) + +* Apply E-terms to position + W=X*A(1)+Y*A(2)+Z*A(3) + X=X+A(1)*RXYZ-W*X + Y=Y+A(2)*RXYZ-W*Y + Z=Z+A(3)*RXYZ-W*Z + +* Recompute magnitude + RXYZ=SQRT(X*X+Y*Y+Z*Z) + +* Apply E-terms to both position and velocity + X=V2(1) + Y=V2(2) + Z=V2(3) + W=X*A(1)+Y*A(2)+Z*A(3) + WD=X*A(4)+Y*A(5)+Z*A(6) + X=X+A(1)*RXYZ-W*X + Y=Y+A(2)*RXYZ-W*Y + Z=Z+A(3)*RXYZ-W*Z + XD=V2(4)+A(4)*RXYZ-WD*X + YD=V2(5)+A(5)*RXYZ-WD*Y + ZD=V2(6)+A(6)*RXYZ-WD*Z + +* Convert to spherical + RXYSQ=X*X+Y*Y + RXY=SQRT(RXYSQ) + + IF (X.EQ.0D0.AND.Y.EQ.0D0) THEN + R=0D0 + ELSE + R=ATAN2(Y,X) + IF (R.LT.0.0D0) R=R+D2PI + END IF + D=ATAN2(Z,RXY) + + IF (RXY.GT.TINY) THEN + UR=(X*YD-Y*XD)/RXYSQ + UD=(ZD*RXYSQ-Z*(X*XD+Y*YD))/((RXYSQ+Z*Z)*RXY) + END IF + +* Radial velocity and parallax + IF (PX.GT.TINY) THEN + RV=(X*XD+Y*YD+Z*ZD)/(PX*VF*RXYZ) + PX=PX/RXYZ + END IF + +* Return results + R1950=R + D1950=D + DR1950=UR/PMF + DD1950=UD/PMF + P1950=PX + V1950=RV + + END diff --git a/math/slalib/fk52h.f b/math/slalib/fk52h.f new file mode 100644 index 00000000..4d9d42f8 --- /dev/null +++ b/math/slalib/fk52h.f @@ -0,0 +1,123 @@ + SUBROUTINE slFK5H (R5,D5,DR5,DD5,RH,DH,DRH,DDH) +*+ +* - - - - - - +* F K 5 H +* - - - - - - +* +* Transform FK5 (J2000) star data into the Hipparcos frame. +* +* (double precision) +* +* This routine transforms FK5 star positions and proper motions +* into the frame of the Hipparcos catalogue. +* +* Given (all FK5, equinox J2000, epoch J2000): +* R5 d RA (radians) +* D5 d Dec (radians) +* DR5 d proper motion in RA (dRA/dt, rad/Jyear) +* DD5 d proper motion in Dec (dDec/dt, rad/Jyear) +* +* Returned (all Hipparcos, epoch J2000): +* RH d RA (radians) +* DH d Dec (radians) +* DRH d proper motion in RA (dRA/dt, rad/Jyear) +* DDH d proper motion in Dec (dDec/dt, rad/Jyear) +* +* Called: slDSC6, slDAVM, slDMXV, slDVXV, slDC6S, +* slDA2P +* +* Notes: +* +* 1) The proper motions in RA are dRA/dt rather than +* cos(Dec)*dRA/dt, and are per year rather than per century. +* +* 2) The FK5 to Hipparcos transformation consists of a pure +* rotation and spin; zonal errors in the FK5 catalogue are +* not taken into account. +* +* 3) The published orientation and spin components are interpreted +* as "axial vectors". An axial vector points at the pole of the +* rotation and its length is the amount of rotation in radians. +* +* 4) See also slHFK5, slF5HZ, slHF5Z. +* +* Reference: +* +* M.Feissel & F.Mignard, Astron. Astrophys. 331, L33-L36 (1998). +* +* P.T.Wallace Starlink 22 June 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION R5,D5,DR5,DD5,RH,DH,DRH,DDH + + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + +* FK5 to Hipparcos orientation and spin (radians, radians/year) + DOUBLE PRECISION EPX,EPY,EPZ + DOUBLE PRECISION OMX,OMY,OMZ + + PARAMETER ( EPX = -19.9D-3 * AS2R, + : EPY = -9.1D-3 * AS2R, + : EPZ = +22.9D-3 * AS2R ) + + PARAMETER ( OMX = -0.30D-3 * AS2R, + : OMY = +0.60D-3 * AS2R, + : OMZ = +0.70D-3 * AS2R ) + + DOUBLE PRECISION PV5(6),ORTN(3),R5H(3,3),S5(3),VV(3),PVH(6),W,R,V + INTEGER I + + DOUBLE PRECISION slDA2P + + + +* FK5 barycentric position/velocity 6-vector (normalized). + CALL slDSC6(R5,D5,1D0,DR5,DD5,0D0,PV5) + +* FK5 to Hipparcos orientation matrix. + ORTN(1) = EPX + ORTN(2) = EPY + ORTN(3) = EPZ + CALL slDAVM(ORTN,R5H) + +* Hipparcos wrt FK5 spin vector. + S5(1) = OMX + S5(2) = OMY + S5(3) = OMZ + +* Orient & spin the 6-vector into the Hipparcos frame. + CALL slDMXV(R5H,PV5,PVH) + CALL slDVXV(PV5,S5,VV) + DO I=1,3 + VV(I) = PV5(I+3)+VV(I) + END DO + CALL slDMXV(R5H,VV,PVH(4)) + +* Hipparcos 6-vector to spherical. + CALL slDC6S(PVH,W,DH,R,DRH,DDH,V) + RH = slDA2P(W) + + END diff --git a/math/slalib/fk54z.f b/math/slalib/fk54z.f new file mode 100644 index 00000000..69a93461 --- /dev/null +++ b/math/slalib/fk54z.f @@ -0,0 +1,87 @@ + SUBROUTINE slF54Z (R2000,D2000,BEPOCH, + : R1950,D1950,DR1950,DD1950) +*+ +* - - - - - - +* F 5 4 Z +* - - - - - - +* +* Convert a J2000.0 FK5 star position to B1950.0 FK4 assuming +* zero proper motion and parallax (double precision) +* +* This routine converts star positions from the new, IAU 1976, +* FK5, Fricke system to the old, Bessel-Newcomb, FK4 system. +* +* Given: +* R2000,D2000 dp J2000.0 FK5 RA,Dec (rad) +* BEPOCH dp Besselian epoch (e.g. 1950D0) +* +* Returned: +* R1950,D1950 dp B1950.0 FK4 RA,Dec (rad) at epoch BEPOCH +* DR1950,DD1950 dp B1950.0 FK4 proper motions (rad/trop.yr) +* +* Notes: +* +* 1) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt. +* +* 2) Conversion from Julian epoch 2000.0 to Besselian epoch 1950.0 +* only is provided for. Conversions involving other epochs will +* require use of the appropriate precession routines before and +* after this routine is called. +* +* 3) Unlike in the slFK54 routine, the FK5 proper motions, the +* parallax and the radial velocity are presumed zero. +* +* 4) It is the intention that FK5 should be a close approximation +* to an inertial frame, so that distant objects have zero proper +* motion; such objects have (in general) non-zero proper motion +* in FK4, and this routine returns those fictitious proper +* motions. +* +* 5) The position returned by this routine is in the B1950 +* reference frame but at Besselian epoch BEPOCH. For +* comparison with catalogues the BEPOCH argument will +* frequently be 1950D0. +* +* Called: slFK54, slPM +* +* P.T.Wallace Starlink 10 April 1990 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION R2000,D2000,BEPOCH, + : R1950,D1950,DR1950,DD1950 + + DOUBLE PRECISION R,D,PX,RV + + + +* FK5 equinox J2000 (any epoch) to FK4 equinox B1950 epoch B1950 + CALL slFK54(R2000,D2000,0D0,0D0,0D0,0D0, + : R,D,DR1950,DD1950,PX,RV) + +* Fictitious proper motion to epoch BEPOCH + CALL slPM(R,D,DR1950,DD1950,0D0,0D0,1950D0,BEPOCH, + : R1950,D1950) + + END diff --git a/math/slalib/fk5hz.f b/math/slalib/fk5hz.f new file mode 100644 index 00000000..0905376d --- /dev/null +++ b/math/slalib/fk5hz.f @@ -0,0 +1,125 @@ + SUBROUTINE slF5HZ (R5,D5,EPOCH,RH,DH) +*+ +* - - - - - - +* F 5 H Z +* - - - - - - +* +* Transform an FK5 (J2000) star position into the frame of the +* Hipparcos catalogue, assuming zero Hipparcos proper motion. +* +* (double precision) +* +* This routine converts a star position from the FK5 system to +* the Hipparcos system, in such a way that the Hipparcos proper +* motion is zero. Because such a star has, in general, a non-zero +* proper motion in the FK5 system, the routine requires the epoch +* at which the position in the FK5 system was determined. +* +* Given: +* R5 d FK5 RA (radians), equinox J2000, epoch EPOCH +* D5 d FK5 Dec (radians), equinox J2000, epoch EPOCH +* EPOCH d Julian epoch (TDB) +* +* Returned (all Hipparcos): +* RH d RA (radians) +* DH d Dec (radians) +* +* Called: slDS2C, slDAVM, slDIMV, slDMXV, slDC2S, +* slDA2P +* +* Notes: +* +* 1) The FK5 to Hipparcos transformation consists of a pure +* rotation and spin; zonal errors in the FK5 catalogue are +* not taken into account. +* +* 2) The published orientation and spin components are interpreted +* as "axial vectors". An axial vector points at the pole of the +* rotation and its length is the amount of rotation in radians. +* +* 3) See also slFK5H, slHFK5, slHF5Z. +* +* Reference: +* +* M.Feissel & F.Mignard, Astron. Astrophys. 331, L33-L36 (1998). +* +* P.T.Wallace Starlink 22 June 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION R5,D5,EPOCH,RH,DH + + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + +* FK5 to Hipparcos orientation and spin (radians, radians/year) + DOUBLE PRECISION EPX,EPY,EPZ + DOUBLE PRECISION OMX,OMY,OMZ + + PARAMETER ( EPX = -19.9D-3 * AS2R, + : EPY = -9.1D-3 * AS2R, + : EPZ = +22.9D-3 * AS2R ) + + PARAMETER ( OMX = -0.30D-3 * AS2R, + : OMY = +0.60D-3 * AS2R, + : OMZ = +0.70D-3 * AS2R ) + + DOUBLE PRECISION P5E(3),ORTN(3),R5H(3,3),T,VST(3),RST(3,3), + : P5(3),PH(3),W + + DOUBLE PRECISION slDA2P + + + +* FK5 barycentric position vector. + CALL slDS2C(R5,D5,P5E) + +* FK5 to Hipparcos orientation matrix. + ORTN(1) = EPX + ORTN(2) = EPY + ORTN(3) = EPZ + CALL slDAVM(ORTN,R5H) + +* Time interval from epoch to J2000. + T = 2000D0-EPOCH + +* Axial vector: accumulated Hipparcos wrt FK5 spin over that interval. + VST(1) = OMX*T + VST(2) = OMY*T + VST(3) = OMZ*T + +* Express the accumulated spin as a rotation matrix. + CALL slDAVM(VST,RST) + +* Derotate the vector's FK5 axes back to epoch. + CALL slDIMV(RST,P5E,P5) + +* Rotate the vector into the Hipparcos frame. + CALL slDMXV(R5H,P5,PH) + +* Hipparcos vector to spherical. + CALL slDC2S(PH,W,DH) + RH = slDA2P(W) + + END diff --git a/math/slalib/flotin.f b/math/slalib/flotin.f new file mode 100644 index 00000000..932580a3 --- /dev/null +++ b/math/slalib/flotin.f @@ -0,0 +1,146 @@ + SUBROUTINE slRFLI (STRING, NSTRT, RESLT, JFLAG) +*+ +* - - - - - - - +* R F L I +* - - - - - - - +* +* Convert free-format input into single precision floating point +* +* Given: +* STRING c string containing number to be decoded +* NSTRT i pointer to where decoding is to start +* RESLT r current value of result +* +* Returned: +* NSTRT i advanced to next number +* RESLT r result +* JFLAG i status: -1 = -OK, 0 = +OK, 1 = null, 2 = error +* +* Called: slDFLI +* +* Notes: +* +* 1 The reason FLOTIN has separate OK status values for + +* and - is to enable minus zero to be detected. This is +* of crucial importance when decoding mixed-radix numbers. +* For example, an angle expressed as deg, arcmin, arcsec +* may have a leading minus sign but a zero degrees field. +* +* 2 A TAB is interpreted as a space, and lowercase characters +* are interpreted as uppercase. +* +* 3 The basic format is the sequence of fields #^.^@#^, where +* # is a sign character + or -, ^ means a string of decimal +* digits, and @, which indicates an exponent, means D or E. +* Various combinations of these fields can be omitted, and +* embedded blanks are permissible in certain places. +* +* 4 Spaces: +* +* . Leading spaces are ignored. +* +* . Embedded spaces are allowed only after +, -, D or E, +* and after the decomal point if the first sequence of +* digits is absent. +* +* . Trailing spaces are ignored; the first signifies +* end of decoding and subsequent ones are skipped. +* +* 5 Delimiters: +* +* . Any character other than +,-,0-9,.,D,E or space may be +* used to signal the end of the number and terminate +* decoding. +* +* . Comma is recognized by FLOTIN as a special case; it +* is skipped, leaving the pointer on the next character. +* See 13, below. +* +* 6 Both signs are optional. The default is +. +* +* 7 The mantissa ^.^ defaults to 1. +* +* 8 The exponent @#^ defaults to E0. +* +* 9 The strings of decimal digits may be of any length. +* +* 10 The decimal point is optional for whole numbers. +* +* 11 A "null result" occurs when the string of characters being +* decoded does not begin with +,-,0-9,.,D or E, or consists +* entirely of spaces. When this condition is detected, JFLAG +* is set to 1 and RESLT is left untouched. +* +* 12 NSTRT = 1 for the first character in the string. +* +* 13 On return from FLOTIN, NSTRT is set ready for the next +* decode - following trailing blanks and any comma. If a +* delimiter other than comma is being used, NSTRT must be +* incremented before the next call to FLOTIN, otherwise +* all subsequent calls will return a null result. +* +* 14 Errors (JFLAG=2) occur when: +* +* . a +, -, D or E is left unsatisfied; or +* +* . the decimal point is present without at least +* one decimal digit before or after it; or +* +* . an exponent more than 100 has been presented. +* +* 15 When an error has been detected, NSTRT is left +* pointing to the character following the last +* one used before the error came to light. This +* may be after the point at which a more sophisticated +* program could have detected the error. For example, +* FLOTIN does not detect that '1E999' is unacceptable +* (on a computer where this is so) until the entire number +* has been decoded. +* +* 16 Certain highly unlikely combinations of mantissa & +* exponent can cause arithmetic faults during the +* decode, in some cases despite the fact that they +* together could be construed as a valid number. +* +* 17 Decoding is left to right, one pass. +* +* 18 See also DFLTIN and INTIN +* +* P.T.Wallace Starlink 23 November 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) STRING + INTEGER NSTRT + REAL RESLT + INTEGER JFLAG + + DOUBLE PRECISION DRESLT + + +* Call the double precision version + CALL slDFLI(STRING,NSTRT,DRESLT,JFLAG) + IF (JFLAG.LE.0) RESLT=REAL(DRESLT) + + END diff --git a/math/slalib/galeq.f b/math/slalib/galeq.f new file mode 100644 index 00000000..e0010c8b --- /dev/null +++ b/math/slalib/galeq.f @@ -0,0 +1,97 @@ + SUBROUTINE slGAEQ (DL, DB, DR, DD) +*+ +* - - - - - - +* G A E Q +* - - - - - - +* +* Transformation from IAU 1958 galactic coordinates to +* J2000.0 equatorial coordinates (double precision) +* +* Given: +* DL,DB dp galactic longitude and latitude L2,B2 +* +* Returned: +* DR,DD dp J2000.0 RA,Dec +* +* (all arguments are radians) +* +* Called: +* slDS2C, slDIMV, slDC2S, slDA2P, slDA1P +* +* Note: +* The equatorial coordinates are J2000.0. Use the routine +* slGE50 if conversion to B1950.0 'FK4' coordinates is +* required. +* +* Reference: +* Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960) +* +* P.T.Wallace Starlink 21 September 1998 +* +* Copyright (C) 1998 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DL,DB,DR,DD + + DOUBLE PRECISION slDA2P,slDA1P + + DOUBLE PRECISION V1(3),V2(3) + +* +* L2,B2 system of galactic coordinates +* +* P = 192.25 RA of galactic north pole (mean B1950.0) +* Q = 62.6 inclination of galactic to mean B1950.0 equator +* R = 33 longitude of ascending node +* +* P,Q,R are degrees +* +* Equatorial to galactic rotation matrix (J2000.0), obtained by +* applying the standard FK4 to FK5 transformation, for zero proper +* motion in FK5, to the columns of the B1950 equatorial to +* galactic rotation matrix: +* + DOUBLE PRECISION RMAT(3,3) + DATA RMAT(1,1),RMAT(1,2),RMAT(1,3), + : RMAT(2,1),RMAT(2,2),RMAT(2,3), + : RMAT(3,1),RMAT(3,2),RMAT(3,3)/ + : -0.054875539726D0,-0.873437108010D0,-0.483834985808D0, + : +0.494109453312D0,-0.444829589425D0,+0.746982251810D0, + : -0.867666135858D0,-0.198076386122D0,+0.455983795705D0/ + + + +* Spherical to Cartesian + CALL slDS2C(DL,DB,V1) + +* Galactic to equatorial + CALL slDIMV(RMAT,V1,V2) + +* Cartesian to spherical + CALL slDC2S(V2,DR,DD) + +* Express in conventional ranges + DR=slDA2P(DR) + DD=slDA1P(DD) + + END diff --git a/math/slalib/galsup.f b/math/slalib/galsup.f new file mode 100644 index 00000000..afc9240c --- /dev/null +++ b/math/slalib/galsup.f @@ -0,0 +1,97 @@ + SUBROUTINE slGASU (DL, DB, DSL, DSB) +*+ +* - - - - - - - +* G A S U +* - - - - - - - +* +* Transformation from IAU 1958 galactic coordinates to +* de Vaucouleurs supergalactic coordinates (double precision) +* +* Given: +* DL,DB dp galactic longitude and latitude L2,B2 +* +* Returned: +* DSL,DSB dp supergalactic longitude and latitude +* +* (all arguments are radians) +* +* Called: +* slDS2C, slDMXV, slDC2S, slDA2P, slDA1P +* +* References: +* +* de Vaucouleurs, de Vaucouleurs, & Corwin, Second Reference +* Catalogue of Bright Galaxies, U. Texas, page 8. +* +* Systems & Applied Sciences Corp., Documentation for the +* machine-readable version of the above catalogue, +* Contract NAS 5-26490. +* +* (These two references give different values for the galactic +* longitude of the supergalactic origin. Both are wrong; the +* correct value is L2=137.37.) +* +* P.T.Wallace Starlink 25 January 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DL,DB,DSL,DSB + + DOUBLE PRECISION slDA2P,slDA1P + + DOUBLE PRECISION V1(3),V2(3) + +* +* System of supergalactic coordinates: +* +* SGL SGB L2 B2 (deg) +* - +90 47.37 +6.32 +* 0 0 - 0 +* +* Galactic to supergalactic rotation matrix: +* + DOUBLE PRECISION RMAT(3,3) + DATA RMAT(1,1),RMAT(1,2),RMAT(1,3), + : RMAT(2,1),RMAT(2,2),RMAT(2,3), + : RMAT(3,1),RMAT(3,2),RMAT(3,3)/ + : -0.735742574804D0,+0.677261296414D0,+0.000000000000D0, + : -0.074553778365D0,-0.080991471307D0,+0.993922590400D0, + : +0.673145302109D0,+0.731271165817D0,+0.110081262225D0/ + + + +* Spherical to Cartesian + CALL slDS2C(DL,DB,V1) + +* Galactic to supergalactic + CALL slDMXV(RMAT,V1,V2) + +* Cartesian to spherical + CALL slDC2S(V2,DSL,DSB) + +* Express in conventional ranges + DSL=slDA2P(DSL) + DSB=slDA1P(DSB) + + END diff --git a/math/slalib/ge50.f b/math/slalib/ge50.f new file mode 100644 index 00000000..a6a8afeb --- /dev/null +++ b/math/slalib/ge50.f @@ -0,0 +1,108 @@ + SUBROUTINE slGE50 (DL, DB, DR, DD) +*+ +* - - - - - +* G E 5 0 +* - - - - - +* +* Transformation from IAU 1958 galactic coordinates to +* B1950.0 'FK4' equatorial coordinates (double precision) +* +* Given: +* DL,DB dp galactic longitude and latitude L2,B2 +* +* Returned: +* DR,DD dp B1950.0 'FK4' RA,Dec +* +* (all arguments are radians) +* +* Called: +* slDS2C, slDIMV, slDC2S, slADET, slDA2P, slDA1P +* +* Note: +* The equatorial coordinates are B1950.0 'FK4'. Use the +* routine slGAEQ if conversion to J2000.0 coordinates +* is required. +* +* Reference: +* Blaauw et al, Mon.Not.R.Astron.Soc.,121,123 (1960) +* +* P.T.Wallace Starlink 5 September 1993 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DL,DB,DR,DD + + DOUBLE PRECISION slDA2P,slDA1P + + DOUBLE PRECISION V1(3),V2(3),R,D,RE,DE + +* +* L2,B2 system of galactic coordinates +* +* P = 192.25 RA of galactic north pole (mean B1950.0) +* Q = 62.6 inclination of galactic to mean B1950.0 equator +* R = 33 longitude of ascending node +* +* P,Q,R are degrees +* +* +* Equatorial to galactic rotation matrix +* +* The Euler angles are P, Q, 90-R, about the z then y then +* z axes. +* +* +CP.CQ.SR-SP.CR +SP.CQ.SR+CP.CR -SQ.SR +* +* -CP.CQ.CR-SP.SR -SP.CQ.CR+CP.SR +SQ.CR +* +* +CP.SQ +SP.SQ +CQ +* + + DOUBLE PRECISION RMAT(3,3) + DATA RMAT(1,1),RMAT(1,2),RMAT(1,3), + : RMAT(2,1),RMAT(2,2),RMAT(2,3), + : RMAT(3,1),RMAT(3,2),RMAT(3,3) / + : -0.066988739415D0,-0.872755765852D0,-0.483538914632D0, + : +0.492728466075D0,-0.450346958020D0,+0.744584633283D0, + : -0.867600811151D0,-0.188374601723D0,+0.460199784784D0 / + + + +* Spherical to Cartesian + CALL slDS2C(DL,DB,V1) + +* Rotate to mean B1950.0 + CALL slDIMV(RMAT,V1,V2) + +* Cartesian to spherical + CALL slDC2S(V2,R,D) + +* Introduce E-terms + CALL slADET(R,D,1950D0,RE,DE) + +* Express in conventional ranges + DR=slDA2P(RE) + DD=slDA1P(DE) + + END diff --git a/math/slalib/geoc.f b/math/slalib/geoc.f new file mode 100644 index 00000000..470a1958 --- /dev/null +++ b/math/slalib/geoc.f @@ -0,0 +1,78 @@ + SUBROUTINE slGEOC (P, H, R, Z) +*+ +* - - - - - +* G E O C +* - - - - - +* +* Convert geodetic position to geocentric (double precision) +* +* Given: +* P dp latitude (geodetic, radians) +* H dp height above reference spheroid (geodetic, metres) +* +* Returned: +* R dp distance from Earth axis (AU) +* Z dp distance from plane of Earth equator (AU) +* +* Notes: +* +* 1 Geocentric latitude can be obtained by evaluating ATAN2(Z,R). +* +* 2 IAU 1976 constants are used. +* +* Reference: +* +* Green,R.M., Spherical Astronomy, CUP 1985, p98. +* +* Last revision: 22 July 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION P,H,R,Z + +* Earth equatorial radius (metres) + DOUBLE PRECISION A0 + PARAMETER (A0=6378140D0) + +* Reference spheroid flattening factor and useful function + DOUBLE PRECISION F,B + PARAMETER (F=1D0/298.257D0,B=(1D0-F)**2) + +* Astronomical unit in metres + DOUBLE PRECISION AU + PARAMETER (AU=1.49597870D11) + + DOUBLE PRECISION SP,CP,C,S + + + +* Geodetic to geocentric conversion + SP = SIN(P) + CP = COS(P) + C = 1D0/SQRT(CP*CP+B*SP*SP) + S = B*C + R = (A0*C+H)*CP/AU + Z = (A0*S+H)*SP/AU + + END diff --git a/math/slalib/gmst.f b/math/slalib/gmst.f new file mode 100644 index 00000000..808ea382 --- /dev/null +++ b/math/slalib/gmst.f @@ -0,0 +1,78 @@ + DOUBLE PRECISION FUNCTION slGMST (UT1) +*+ +* - - - - - +* G M S T +* - - - - - +* +* Conversion from universal time to sidereal time (double precision) +* +* Given: +* UT1 dp universal time (strictly UT1) expressed as +* modified Julian Date (JD-2400000.5) +* +* The result is the Greenwich mean sidereal time (double +* precision, radians). +* +* The IAU 1982 expression (see page S15 of 1984 Astronomical Almanac) +* is used, but rearranged to reduce rounding errors. This expression +* is always described as giving the GMST at 0 hours UT. In fact, it +* gives the difference between the GMST and the UT, which happens to +* equal the GMST (modulo 24 hours) at 0 hours UT each day. In this +* routine, the entire UT is used directly as the argument for the +* standard formula, and the fractional part of the UT is added +* separately. Note that the factor 1.0027379... does not appear in the +* IAU 1982 expression explicitly but in the form of the coefficient +* 8640184.812866, which is 86400x36525x0.0027379... +* +* See also the routine slGMSA, which delivers better numerical +* precision by accepting the UT date and time as separate arguments. +* +* Called: slDA2P +* +* P.T.Wallace Starlink 14 October 2001 +* +* Copyright (C) 2001 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION UT1 + + DOUBLE PRECISION slDA2P + + DOUBLE PRECISION D2PI,S2R + PARAMETER (D2PI=6.283185307179586476925286766559D0, + : S2R=7.272205216643039903848711535369D-5) + + DOUBLE PRECISION TU + + + +* Julian centuries from fundamental epoch J2000 to this UT + TU=(UT1-51544.5D0)/36525D0 + +* GMST at this UT + slGMST=slDA2P(MOD(UT1,1D0)*D2PI+ + : (24110.54841D0+ + : (8640184.812866D0+ + : (0.093104D0-6.2D-6*TU)*TU)*TU)*S2R) + + END diff --git a/math/slalib/gmsta.f b/math/slalib/gmsta.f new file mode 100644 index 00000000..31a92e99 --- /dev/null +++ b/math/slalib/gmsta.f @@ -0,0 +1,100 @@ + DOUBLE PRECISION FUNCTION slGMSA (DATE, UT) +*+ +* - - - - - - +* G M S A +* - - - - - - +* +* Conversion from Universal Time to Greenwich mean sidereal time, +* with rounding errors minimized. +* +* double precision +* +* Given: +* DATE d UT1 date (MJD: integer part of JD-2400000.5)) +* UT d UT1 time (fraction of a day) +* +* The result is the Greenwich mean sidereal time (double precision, +* radians, in the range 0 to 2pi). +* +* There is no restriction on how the UT is apportioned between the +* DATE and UT arguments. Either of the two arguments could, for +* example, be zero and the entire date+time supplied in the other. +* However, the routine is designed to deliver maximum accuracy when +* the DATE argument is a whole number and the UT lies in the range +* 0 to 1 (or vice versa). +* +* The algorithm is based on the IAU 1982 expression (see page S15 of +* the 1984 Astronomical Almanac). This is always described as giving +* the GMST at 0 hours UT1. In fact, it gives the difference between +* the GMST and the UT, the steady 4-minutes-per-day drawing-ahead of +* ST with respect to UT. When whole days are ignored, the expression +* happens to equal the GMST at 0 hours UT1 each day. Note that the +* factor 1.0027379... does not appear explicitly but in the form of +* the coefficient 8640184.812866, which is 86400x36525x0.0027379... +* +* In this routine, the entire UT1 (the sum of the two arguments DATE +* and UT) is used directly as the argument for the standard formula. +* The UT1 is then added, but omitting whole days to conserve accuracy. +* +* See also the routine slGMST, which accepts the UT as a single +* argument. Compared with slGMST, the extra numerical precision +* delivered by the present routine is unlikely to be important in +* an absolute sense, but may be useful when critically comparing +* algorithms and in applications where two sidereal times close +* together are differenced. +* +* Called: slDA2P +* +* P.T.Wallace Starlink 14 October 2001 +* +* Copyright (C) 2001 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,UT + +* Seconds of time to radians + DOUBLE PRECISION S2R + PARAMETER (S2R=7.272205216643039903848712D-5) + + DOUBLE PRECISION D1,D2,T + DOUBLE PRECISION slDA2P + + +* Julian centuries since J2000. + IF (DATE.LT.UT) THEN + D1=DATE + D2=UT + ELSE + D1=UT + D2=DATE + END IF + T=(D1+(D2-51544.5D0))/36525D0 + +* GMST at this UT1. + slGMSA=slDA2P(S2R*(24110.54841D0+ + : (8640184.812866D0+ + : (0.093104D0 + : -6.2D-6*T)*T)*T + : +86400D0*(MOD(D1,1D0)+MOD(D2,1D0)))) + + END diff --git a/math/slalib/gresid.F__vms b/math/slalib/gresid.F__vms new file mode 100644 index 00000000..7cb318fb --- /dev/null +++ b/math/slalib/gresid.F__vms @@ -0,0 +1,89 @@ + REAL FUNCTION sla_GRESID (S) +*+ +* - - - - - - - +* G R E S I D +* - - - - - - - +* +* Generate pseudo-random normal deviate ( = 'Gaussian residual') +* (single precision) +* +* !!! Version for VAX/VMS and DECstation !!! +* +* Given: +* S real standard deviation +* +* The results of many calls to this routine will be +* normally distributed with mean zero and standard deviation S. +* +* The Box-Muller algorithm is used. This is described in +* Numerical Recipes, section 7.2. +* +* P.T.Wallace Starlink 14 October 1991 +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +*- + + IMPLICIT NONE + + REAL S + + REAL X,Y,R,W,GNEXT,G + INTEGER ISEED + LOGICAL FIRST + + REAL RAN + + SAVE GNEXT,ISEED,FIRST + DATA ISEED / 123456789 / + DATA FIRST / .TRUE. / + + + +* Second normal deviate of the pair available? + IF (FIRST) THEN + +* No - generate two random numbers inside unit circle + R = 2.0 + DO WHILE (R.GE.1.0) + +* Generate two random numbers in range +/- 1 + X = 2.0*RAN(ISEED)-1.0 + Y = 2.0*RAN(ISEED)-1.0 + +* Try again if not in unit circle + R = X*X+Y*Y + END DO + +* Box-Muller transformation, generating two deviates + W = SQRT(-2.0*LOG(R)/MAX(R,1E-20)) + GNEXT = X*W + G = Y*W + +* Set flag to indicate availability of next deviate + FIRST = .FALSE. + ELSE + +* Return second deviate of the pair & reset flag + G = GNEXT + FIRST = .TRUE. + END IF + +* Scale the deviate by the required standard deviation + sla_GRESID = G*S + + END diff --git a/math/slalib/gresid.F__win b/math/slalib/gresid.F__win new file mode 100644 index 00000000..af197dbd --- /dev/null +++ b/math/slalib/gresid.F__win @@ -0,0 +1,90 @@ + REAL FUNCTION sla_GRESID (S) +*+ +* - - - - - - - +* G R E S I D +* - - - - - - - +* +* Generate pseudo-random normal deviate ( = 'Gaussian residual') +* (single precision) +* +* Given: +* S real standard deviation +* +* The results of many calls to this routine will be +* normally distributed with mean zero and standard deviation S. +* +* The Box-Muller algorithm is used. This is described in +* Numerical Recipes, section 7.2. +* +* !!! Microsoft Fortran dependent - calls the RAN routine !!! +* !!! To seed the random-number generator, either call the !!! +* !!! Microsoft SEED routine specifying some INTEGER*2 !!! +* !!! seed or call the function sla_RANDOM specifying some !!! +* !!! REAL seed. !!! +* +* P.T.Wallace Starlink 1 April 1993 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +*- + + IMPLICIT NONE + + REAL S + + REAL X,Y,RV,R,W,GNEXT,G + LOGICAL FIRST + + SAVE GNEXT,RV,FIRST + DATA FIRST / .TRUE. / + + + +* Second normal deviate of the pair available? + IF (FIRST) THEN + +* No - generate two random numbers in range +/- 1 + 1 CONTINUE + CALL RANDOM(RV) !!! PC + X = 2.0*RV-1.0 + CALL RANDOM(RV) !!! PC + Y = 2.0*RV-1.0 + +* Try again if not in unit circle + R = X*X+Y*Y + IF (R.GE.1.0) GO TO 1 + +* Box-Muller transformation, generating two deviates + W = SQRT(-2.0*LOG(R)/MAX(R,1E-20)) + GNEXT = X*W + G = Y*W + +* Set flag to indicate availability of next deviate + FIRST = .FALSE. + ELSE + +* Return second deviate of the pair & reset flag + G = GNEXT + FIRST = .TRUE. + END IF + +* Scale the deviate by the required standard deviation + sla_GRESID = G*S + + END diff --git a/math/slalib/gresid.Fdefault b/math/slalib/gresid.Fdefault new file mode 100644 index 00000000..e3b595ef --- /dev/null +++ b/math/slalib/gresid.Fdefault @@ -0,0 +1,113 @@ +#include "config.h" + REAL FUNCTION sla_GRESID (S) +*+ +* - - - - - - - +* G R E S I D +* - - - - - - - +* +* Generate pseudo-random normal deviate ( = 'Gaussian residual') +* (single precision) +* +* Given: +* S real standard deviation +* +* The results of many calls to this routine will be +* normally distributed with mean zero and standard deviation S. +* +* The Box-Muller algorithm is used. This is described in +* Numerical Recipes, section 7.2. +* +* Called: RAN or RAND (a REAL function returning a random variate -- +* the precise function which is called depends on which functions +* are available when the library is built). If neither of these +* is available, we use the local substitute RANDOM defined +* in rtl_random.c +* +* P.T.Wallace Starlink 14 October 1991 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +*- + + IMPLICIT NONE + + REAL S + + REAL X,Y,R,W,GNEXT,G + LOGICAL FTF,FIRST + +#if HAVE_RAND + REAL RAND +#elif HAVE_RANDOM + REAL RANDOM +#else + error "Can't find random-number function" +#endif + + SAVE GNEXT,FTF,FIRST + DATA FTF,FIRST / .TRUE.,.TRUE. / + + X = 0.0 + Y = 0.0 + +* First time through, initialise the random-number generator +#if HAVE_RAND + IF (FTF) THEN + X = RAND(123456789) + FTF = .FALSE. + END IF +#endif + +* Second normal deviate of the pair available? + IF (FIRST) THEN + +* No - generate two random numbers inside unit circle + R = 2.0 + DO WHILE (R.GE.1.0) + +* Generate two random numbers in range +/- 1 +#if HAVE_RAND + X = 2.0*RAND(0)-1.0 + Y = 2.0*RAND(0)-1.0 +#elif HAVE_RANDOM + X = 2.0*RAN(ISEED)-1.0 + Y = 2.0*RAN(ISEED)-1.0 +#endif + +* Try again if not in unit circle + R = X*X+Y*Y + END DO + +* Box-Muller transformation, generating two deviates + W = SQRT(-2.0*LOG(R)/MAX(R,1E-20)) + GNEXT = X*W + G = Y*W + +* Set flag to indicate availability of next deviate + FIRST = .FALSE. + ELSE + +* Return second deviate of the pair & reset flag + G = GNEXT + FIRST = .TRUE. + END IF + +* Scale the deviate by the required standard deviation + sla_GRESID = G*S + + END diff --git a/math/slalib/h2e.f b/math/slalib/h2e.f new file mode 100644 index 00000000..06016ce3 --- /dev/null +++ b/math/slalib/h2e.f @@ -0,0 +1,101 @@ + SUBROUTINE slH2E ( AZ, EL, PHI, HA, DEC ) +*+ +* - - - - - +* D E 2 H +* - - - - - +* +* Horizon to equatorial coordinates: Az,El to HA,Dec +* +* (single precision) +* +* Given: +* AZ r azimuth +* EL r elevation +* PHI r observatory latitude +* +* Returned: +* HA r hour angle +* DEC r declination +* +* Notes: +* +* 1) All the arguments are angles in radians. +* +* 2) The sign convention for azimuth is north zero, east +pi/2. +* +* 3) HA is returned in the range +/-pi. Declination is returned +* in the range +/-pi/2. +* +* 4) The latitude is (in principle) geodetic. In critical +* applications, corrections for polar motion should be applied. +* +* 5) In some applications it will be important to specify the +* correct type of elevation in order to produce the required +* type of HA,Dec. In particular, it may be important to +* distinguish between the elevation as affected by refraction, +* which will yield the "observed" HA,Dec, and the elevation +* in vacuo, which will yield the "topocentric" HA,Dec. If the +* effects of diurnal aberration can be neglected, the +* topocentric HA,Dec may be used as an approximation to the +* "apparent" HA,Dec. +* +* 6) No range checking of arguments is done. +* +* 7) In applications which involve many such calculations, rather +* than calling the present routine it will be more efficient to +* use inline code, having previously computed fixed terms such +* as sine and cosine of latitude. +* +* Last revision: 11 September 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL AZ, EL, PHI, HA, DEC + + DOUBLE PRECISION SA, CA, SE, CE, SP, CP, X, Y, Z, R + + +* Useful trig functions. + SA = SIN(AZ) + CA = COS(AZ) + SE = SIN(EL) + CE = COS(EL) + SP = SIN(PHI) + CP = COS(PHI) + +* HA,Dec as x,y,z. + X = -CA*CE*SP+SE*CP + Y = -SA*CE + Z = CA*CE*CP+SE*SP + +* To HA,Dec. + R = SQRT(X*X+Y*Y) + IF (R.EQ.0.0) THEN + HA = 0.0 + ELSE + HA = REAL(ATAN2(Y,X)) + END IF + DEC = REAL(ATAN2(Z,R)) + + END diff --git a/math/slalib/h2fk5.f b/math/slalib/h2fk5.f new file mode 100644 index 00000000..74d71f39 --- /dev/null +++ b/math/slalib/h2fk5.f @@ -0,0 +1,127 @@ + SUBROUTINE slHFK5 (RH,DH,DRH,DDH,R5,D5,DR5,DD5) +*+ +* - - - - - - +* H F K 5 +* - - - - - - +* +* Transform Hipparcos star data into the FK5 (J2000) system. +* +* (double precision) +* +* This routine transforms Hipparcos star positions and proper +* motions into FK5 J2000. +* +* Given (all Hipparcos, epoch J2000): +* RH d RA (radians) +* DH d Dec (radians) +* DRH d proper motion in RA (dRA/dt, rad/Jyear) +* DDH d proper motion in Dec (dDec/dt, rad/Jyear) +* +* Returned (all FK5, equinox J2000, epoch J2000): +* R5 d RA (radians) +* D5 d Dec (radians) +* DR5 d proper motion in RA (dRA/dt, rad/Jyear) +* DD5 d proper motion in Dec (dDec/dt, rad/Jyear) +* +* Called: slDSC6, slDAVM, slDMXV, slDIMV, slDVXV, +* slDC6S, slDA2P +* +* Notes: +* +* 1) The proper motions in RA are dRA/dt rather than +* cos(Dec)*dRA/dt, and are per year rather than per century. +* +* 2) The FK5 to Hipparcos transformation consists of a pure +* rotation and spin; zonal errors in the FK5 catalogue are +* not taken into account. +* +* 3) The published orientation and spin components are interpreted +* as "axial vectors". An axial vector points at the pole of the +* rotation and its length is the amount of rotation in radians. +* +* 4) See also slFK5H, slF5HZ, slHF5Z. +* +* Reference: +* +* M.Feissel & F.Mignard, Astron. Astrophys. 331, L33-L36 (1998). +* +* P.T.Wallace Starlink 22 June 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RH,DH,DRH,DDH,R5,D5,DR5,DD5 + + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + +* FK5 to Hipparcos orientation and spin (radians, radians/year) + DOUBLE PRECISION EPX,EPY,EPZ + DOUBLE PRECISION OMX,OMY,OMZ + + PARAMETER ( EPX = -19.9D-3 * AS2R, + : EPY = -9.1D-3 * AS2R, + : EPZ = +22.9D-3 * AS2R ) + + PARAMETER ( OMX = -0.30D-3 * AS2R, + : OMY = +0.60D-3 * AS2R, + : OMZ = +0.70D-3 * AS2R ) + + DOUBLE PRECISION PVH(6),ORTN(3),R5H(3,3),S5(3),SH(3),VV(3), + : PV5(6),W,R,V + INTEGER I + + DOUBLE PRECISION slDA2P + + + +* Hipparcos barycentric position/velocity 6-vector (normalized). + CALL slDSC6(RH,DH,1D0,DRH,DDH,0D0,PVH) + +* FK5 to Hipparcos orientation matrix. + ORTN(1) = EPX + ORTN(2) = EPY + ORTN(3) = EPZ + CALL slDAVM(ORTN,R5H) + +* Hipparcos wrt FK5 spin vector. + S5(1) = OMX + S5(2) = OMY + S5(3) = OMZ + +* Rotate the spin vector into the Hipparcos frame. + CALL slDMXV(R5H,S5,SH) + +* De-orient & de-spin the 6-vector into FK5 J2000. + CALL slDIMV(R5H,PVH,PV5) + CALL slDVXV(PVH,SH,VV) + DO I=1,3 + VV(I) = PVH(I+3)-VV(I) + END DO + CALL slDIMV(R5H,VV,PV5(4)) + +* FK5 6-vector to spherical. + CALL slDC6S(PV5,W,D5,R,DR5,DD5,V) + R5 = slDA2P(W) + + END diff --git a/math/slalib/hfk5z.f b/math/slalib/hfk5z.f new file mode 100644 index 00000000..2f6d53b2 --- /dev/null +++ b/math/slalib/hfk5z.f @@ -0,0 +1,140 @@ + SUBROUTINE slHF5Z (RH,DH,EPOCH,R5,D5,DR5,DD5) +*+ +* - - - - - - +* H F 5 Z +* - - - - - - +* +* Transform a Hipparcos star position into FK5 J2000, assuming +* zero Hipparcos proper motion. +* +* (double precision) +* +* Given: +* RH d Hipparcos RA (radians) +* DH d Hipparcos Dec (radians) +* EPOCH d Julian epoch (TDB) +* +* Returned (all FK5, equinox J2000, epoch EPOCH): +* R5 d RA (radians) +* D5 d Dec (radians) +* +* Called: slDS2C, slDAVM, slDMXV, slDMXM, +* slDIMV, slDVXV, slDC6S, slDA2P +* +* Notes: +* +* 1) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt. +* +* 2) The FK5 to Hipparcos transformation consists of a pure +* rotation and spin; zonal errors in the FK5 catalogue are +* not taken into account. +* +* 3) The published orientation and spin components are interpreted +* as "axial vectors". An axial vector points at the pole of the +* rotation and its length is the amount of rotation in radians. +* +* 4) It was the intention that Hipparcos should be a close +* approximation to an inertial frame, so that distant objects +* have zero proper motion; such objects have (in general) +* non-zero proper motion in FK5, and this routine returns those +* fictitious proper motions. +* +* 5) The position returned by this routine is in the FK5 J2000 +* reference frame but at Julian epoch EPOCH. +* +* 6) See also slFK5H, slHFK5, sla_FK5ZHZ. +* +* Reference: +* +* M.Feissel & F.Mignard, Astron. Astrophys. 331, L33-L36 (1998). +* +* P.T.Wallace Starlink 30 December 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RH,DH,EPOCH,R5,D5,DR5,DD5 + + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + +* FK5 to Hipparcos orientation and spin (radians, radians/year) + DOUBLE PRECISION EPX,EPY,EPZ + DOUBLE PRECISION OMX,OMY,OMZ + + PARAMETER ( EPX = -19.9D-3 * AS2R, + : EPY = -9.1D-3 * AS2R, + : EPZ = +22.9D-3 * AS2R ) + + PARAMETER ( OMX = -0.30D-3 * AS2R, + : OMY = +0.60D-3 * AS2R, + : OMZ = +0.70D-3 * AS2R ) + + DOUBLE PRECISION PH(3),ORTN(3),R5H(3,3),S5(3),SH(3),T,VST(3), + : RST(3,3),R5HT(3,3),PV5E(6),VV(3),W,R,V + + DOUBLE PRECISION slDA2P + + + +* Hipparcos barycentric position vector (normalized). + CALL slDS2C(RH,DH,PH) + +* FK5 to Hipparcos orientation matrix. + ORTN(1) = EPX + ORTN(2) = EPY + ORTN(3) = EPZ + CALL slDAVM(ORTN,R5H) + +* Hipparcos wrt FK5 spin vector. + S5(1) = OMX + S5(2) = OMY + S5(3) = OMZ + +* Rotate the spin vector into the Hipparcos frame. + CALL slDMXV(R5H,S5,SH) + +* Time interval from J2000 to epoch. + T = EPOCH-2000D0 + +* Axial vector: accumulated Hipparcos wrt FK5 spin over that interval. + VST(1) = OMX*T + VST(2) = OMY*T + VST(3) = OMZ*T + +* Express the accumulated spin as a rotation matrix. + CALL slDAVM(VST,RST) + +* Rotation matrix: accumulated spin, then FK5 to Hipparcos. + CALL slDMXM(R5H,RST,R5HT) + +* De-orient & de-spin the vector into FK5 J2000 at epoch. + CALL slDIMV(R5HT,PH,PV5E) + CALL slDVXV(SH,PH,VV) + CALL slDIMV(R5HT,VV,PV5E(4)) + +* FK5 position/velocity 6-vector to spherical. + CALL slDC6S(PV5E,W,D5,R,DR5,DD5,V) + R5 = slDA2P(W) + + END diff --git a/math/slalib/idchf.f b/math/slalib/idchf.f new file mode 100644 index 00000000..fa6e597b --- /dev/null +++ b/math/slalib/idchf.f @@ -0,0 +1,112 @@ + SUBROUTINE slICHF (STRING, NPTR, NVEC, NDIGIT, DIGIT) +*+ +* - - - - - - +* I C H F +* - - - - - - +* +* Internal routine used by DFLTIN +* +* Identify next character in string +* +* Given: +* STRING char string +* NPTR int pointer to character to be identified +* +* Returned: +* NPTR int incremented unless end of field +* NVEC int vector for identified character +* NDIGIT int 0-9 if character was a numeral +* DIGIT double equivalent of NDIGIT +* +* NVEC takes the following values: +* +* 1 0-9 +* 2 space or TAB !!! n.b. ASCII TAB assumed !!! +* 3 D,d,E or e +* 4 . +* 5 + +* 6 - +* 7 , +* 8 else +* 9 outside field +* +* If the character is not 0-9, NDIGIT and DIGIT are either not +* altered or are set to arbitrary values. +* +* P.T.Wallace Starlink 22 December 1992 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) STRING + INTEGER NPTR,NVEC,NDIGIT + DOUBLE PRECISION DIGIT + + CHARACTER K + INTEGER NCHAR + +* Character/vector tables + INTEGER NCREC + PARAMETER (NCREC=19) + CHARACTER KCTAB(NCREC) + INTEGER KVTAB(NCREC) + DATA KCTAB/'0','1','2','3','4','5','6','7','8','9', + : ' ','D','d','E','e','.','+','-',','/ + DATA KVTAB/10*1,2,4*3,4,5,6,7/ + + +* Handle pointer outside field + IF (NPTR.LT.1.OR.NPTR.GT.LEN(STRING)) THEN + NVEC=9 + ELSE + +* Not end of field: identify the character + K=STRING(NPTR:NPTR) + DO NCHAR=1,NCREC + IF (K.EQ.KCTAB(NCHAR)) THEN + +* Recognized + NVEC=KVTAB(NCHAR) + NDIGIT=NCHAR-1 + DIGIT=DBLE(NDIGIT) + GO TO 2300 + END IF + END DO + +* Not recognized: check for TAB !!! n.b. ASCII assumed !!! + IF (K.EQ.CHAR(9)) THEN + +* TAB: treat as space + NVEC=2 + ELSE + +* Unrecognized + NVEC=8 + END IF + +* Increment pointer + 2300 CONTINUE + NPTR=NPTR+1 + END IF + + END diff --git a/math/slalib/idchi.f b/math/slalib/idchi.f new file mode 100644 index 00000000..99f8392d --- /dev/null +++ b/math/slalib/idchi.f @@ -0,0 +1,109 @@ + SUBROUTINE slICHI (STRING, NPTR, NVEC, DIGIT) +*+ +* - - - - - - +* I C H I +* - - - - - - +* +* Internal routine used by INTIN +* +* Identify next character in string +* +* Given: +* STRING char string +* NPTR int pointer to character to be identified +* +* Returned: +* NPTR int incremented unless end of field +* NVEC int vector for identified character +* DIGIT double double precision digit if 0-9 +* +* NVEC takes the following values: +* +* 1 0-9 +* 2 space or TAB !!! n.b. ASCII TAB assumed !!! +* 3 + +* 4 - +* 5 , +* 6 else +* 7 outside string +* +* If the character is not 0-9, DIGIT is either unaltered or +* is set to an arbitrary value. +* +* P.T.Wallace Starlink 22 December 1992 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) STRING + INTEGER NPTR,NVEC + DOUBLE PRECISION DIGIT + + CHARACTER K + INTEGER NCHAR + +* Character/vector tables + INTEGER NCREC + PARAMETER (NCREC=14) + CHARACTER KCTAB(NCREC) + INTEGER KVTAB(NCREC) + DATA KCTAB/'0','1','2','3','4','5','6','7','8','9', + : ' ', '+','-',','/ + DATA KVTAB/10*1,2,3,4,5/ + + + +* Handle pointer outside field + IF (NPTR.LT.1.OR.NPTR.GT.LEN(STRING)) THEN + NVEC=7 + ELSE + +* Not end of field: identify character + K=STRING(NPTR:NPTR) + DO NCHAR=1,NCREC + IF (K.EQ.KCTAB(NCHAR)) THEN + +* Recognized + NVEC=KVTAB(NCHAR) + DIGIT=DBLE(NCHAR-1) + GO TO 2300 + END IF + END DO + +* Not recognized: check for TAB !!! n.b. ASCII assumed !!! + IF (K.EQ.CHAR(9)) THEN + +* TAB: treat as space + NVEC=2 + ELSE + +* Unrecognized + NVEC=6 + END IF + +* Increment pointer + 2300 CONTINUE + NPTR=NPTR+1 + END IF + + END diff --git a/math/slalib/imxv.f b/math/slalib/imxv.f new file mode 100644 index 00000000..804adef7 --- /dev/null +++ b/math/slalib/imxv.f @@ -0,0 +1,69 @@ + SUBROUTINE slIMXV (RM, VA, VB) +*+ +* - - - - - +* I M X V +* - - - - - +* +* Performs the 3-D backward unitary transformation: +* +* vector VB = (inverse of matrix RM) * vector VA +* +* (single precision) +* +* (n.b. the matrix must be unitary, as this routine assumes that +* the inverse and transpose are identical) +* +* Given: +* RM real(3,3) matrix +* VA real(3) vector +* +* Returned: +* VB real(3) result vector +* +* P.T.Wallace Starlink November 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL RM(3,3),VA(3),VB(3) + + INTEGER I,J + REAL W,VW(3) + + + +* Inverse of matrix RM * vector VA -> vector VW + DO J=1,3 + W=0.0 + DO I=1,3 + W=W+RM(I,J)*VA(I) + END DO + VW(J)=W + END DO + +* Vector VW -> vector VB + DO J=1,3 + VB(J)=VW(J) + END DO + + END diff --git a/math/slalib/intin.f b/math/slalib/intin.f new file mode 100644 index 00000000..669cb18d --- /dev/null +++ b/math/slalib/intin.f @@ -0,0 +1,194 @@ + SUBROUTINE slINTI (STRING, NSTRT, IRESLT, JFLAG) +*+ +* - - - - - - +* I N T I +* - - - - - - +* +* Convert free-format input into an integer +* +* Given: +* STRING c string containing number to be decoded +* NSTRT i pointer to where decoding is to start +* IRESLT i current value of result +* +* Returned: +* NSTRT i advanced to next number +* IRESLT i result +* JFLAG i status: -1 = -OK, 0 = +OK, 1 = null, 2 = error +* +* Called: slICHI +* +* Notes: +* +* 1 The reason INTIN has separate OK status values for + +* and - is to enable minus zero to be detected. This is +* of crucial importance when decoding mixed-radix numbers. +* For example, an angle expressed as deg, arcmin, arcsec +* may have a leading minus sign but a zero degrees field. +* +* 2 A TAB is interpreted as a space. +* +* 3 The basic format is the sequence of fields #^, where +* # is a sign character + or -, and ^ means a string of +* decimal digits. +* +* 4 Spaces: +* +* . Leading spaces are ignored. +* +* . Spaces between the sign and the number are allowed. +* +* . Trailing spaces are ignored; the first signifies +* end of decoding and subsequent ones are skipped. +* +* 5 Delimiters: +* +* . Any character other than +,-,0-9 or space may be +* used to signal the end of the number and terminate +* decoding. +* +* . Comma is recognized by INTIN as a special case; it +* is skipped, leaving the pointer on the next character. +* See 9, below. +* +* 6 The sign is optional. The default is +. +* +* 7 A "null result" occurs when the string of characters being +* decoded does not begin with +,- or 0-9, or consists +* entirely of spaces. When this condition is detected, JFLAG +* is set to 1 and IRESLT is left untouched. +* +* 8 NSTRT = 1 for the first character in the string. +* +* 9 On return from INTIN, NSTRT is set ready for the next +* decode - following trailing blanks and any comma. If a +* delimiter other than comma is being used, NSTRT must be +* incremented before the next call to INTIN, otherwise +* all subsequent calls will return a null result. +* +* 10 Errors (JFLAG=2) occur when: +* +* . there is a + or - but no number; or +* +* . the number is greater than BIG (defined below). +* +* 11 When an error has been detected, NSTRT is left +* pointing to the character following the last +* one used before the error came to light. +* +* 12 See also FLOTIN and DFLTIN. +* +* P.T.Wallace Starlink 27 April 1998 +* +* Copyright (C) 1998 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) STRING + INTEGER NSTRT,IRESLT,JFLAG + +* Maximum allowed value + DOUBLE PRECISION BIG + PARAMETER (BIG=2147483647D0) + + INTEGER JPTR,MSIGN,NVEC,J + DOUBLE PRECISION DRES,DIGIT + + + +* Current character + JPTR=NSTRT + +* Set defaults + DRES=0D0 + MSIGN=1 + +* Look for sign + 100 CONTINUE + CALL slICHI(STRING,JPTR,NVEC,DIGIT) + GO TO ( 400, 100, 300, 200, 9110, 9100, 9110),NVEC +* 0-9 SP + - , ELSE END + +* Negative + 200 CONTINUE + MSIGN=-1 + +* Look for first decimal + 300 CONTINUE + CALL slICHI(STRING,JPTR,NVEC,DIGIT) + GO TO ( 400, 300, 9200, 9200, 9200, 9200, 9210),NVEC +* 0-9 SP + - , ELSE END + +* Accept decimals + 400 CONTINUE + DRES=DRES*1D1+DIGIT + +* Test for overflow + IF (DRES.GT.BIG) GO TO 9200 + +* Look for subsequent decimals + CALL slICHI(STRING,JPTR,NVEC,DIGIT) + GO TO ( 400, 1610, 1600, 1600, 1600, 1600, 1610),NVEC +* 0-9 SP + - , ELSE END + +* Get result & status + 1600 CONTINUE + JPTR=JPTR-1 + 1610 CONTINUE + J=0 + IF (MSIGN.EQ.1) GO TO 1620 + J=-1 + DRES=-DRES + 1620 CONTINUE + IRESLT=NINT(DRES) + +* Skip to end of field + 1630 CONTINUE + CALL slICHI(STRING,JPTR,NVEC,DIGIT) + GO TO (1720, 1630, 1720, 1720, 9900, 1720, 9900),NVEC +* 0-9 SP + - , ELSE END + + 1720 CONTINUE + JPTR=JPTR-1 + GO TO 9900 + +* Exits + +* Null field + 9100 CONTINUE + JPTR=JPTR-1 + 9110 CONTINUE + J=1 + GO TO 9900 + +* Errors + 9200 CONTINUE + JPTR=JPTR-1 + 9210 CONTINUE + J=2 + +* Return + 9900 CONTINUE + NSTRT=JPTR + JFLAG=J + + END diff --git a/math/slalib/invf.f b/math/slalib/invf.f new file mode 100644 index 00000000..90eb83b9 --- /dev/null +++ b/math/slalib/invf.f @@ -0,0 +1,106 @@ + SUBROUTINE slINVF (FWDS,BKWDS,J) +*+ +* - - - - - +* I N V F +* - - - - - +* +* Invert a linear model of the type produced by the slFTXY routine. +* +* Given: +* FWDS d(6) model coefficients +* +* Returned: +* BKWDS d(6) inverse model +* J i status: 0 = OK, -1 = no inverse +* +* The models relate two sets of [X,Y] coordinates as follows. +* Naming the elements of FWDS: +* +* FWDS(1) = A +* FWDS(2) = B +* FWDS(3) = C +* FWDS(4) = D +* FWDS(5) = E +* FWDS(6) = F +* +* where two sets of coordinates [X1,Y1] and [X2,Y1] are related +* thus: +* +* X2 = A + B*X1 + C*Y1 +* Y2 = D + E*X1 + F*Y1 +* +* the present routine generates a new set of coefficients: +* +* BKWDS(1) = P +* BKWDS(2) = Q +* BKWDS(3) = R +* BKWDS(4) = S +* BKWDS(5) = T +* BKWDS(6) = U +* +* such that: +* +* X1 = P + Q*X2 + R*Y2 +* Y1 = S + T*X2 + U*Y2 +* +* Two successive calls to slINVF will thus deliver a set +* of coefficients equal to the starting values. +* +* To comply with the ANSI Fortran standard, FWDS and BKWDS must +* not be the same array, even though the routine is coded to +* work on many platforms even if this rule is violated. +* +* See also slFTXY, slPXY, slXYXY, slDCMF +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION FWDS(6),BKWDS(6) + INTEGER J + + DOUBLE PRECISION A,B,C,D,E,F,DET + + + + A=FWDS(1) + B=FWDS(2) + C=FWDS(3) + D=FWDS(4) + E=FWDS(5) + F=FWDS(6) + DET=B*F-C*E + IF (DET.NE.0D0) THEN + BKWDS(1)=(C*D-A*F)/DET + BKWDS(2)=F/DET + BKWDS(3)=-C/DET + BKWDS(4)=(A*E-B*D)/DET + BKWDS(5)=-E/DET + BKWDS(6)=B/DET + J=0 + ELSE + J=-1 + END IF + + END diff --git a/math/slalib/kbj.f b/math/slalib/kbj.f new file mode 100644 index 00000000..6d68a069 --- /dev/null +++ b/math/slalib/kbj.f @@ -0,0 +1,74 @@ + SUBROUTINE slKBJ (JB, E, K, J) +*+ +* - - - - +* K B J +* - - - - +* +* Select epoch prefix 'B' or 'J' +* +* Given: +* JB int slDBJI prefix status: 0=none, 1='B', 2='J' +* E dp epoch - Besselian or Julian +* +* Returned: +* K char 'B' or 'J' +* J int status: 0=OK +* +* If JB=0, B is assumed for E < 1984D0, otherwise J. +* +* P.T.Wallace Starlink 31 July 1989 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER JB + DOUBLE PRECISION E + CHARACTER K*(*) + INTEGER J + +* Preset status + J=0 + +* If prefix given expressly, use it + IF (JB.EQ.1) THEN + K='B' + ELSE IF (JB.EQ.2) THEN + K='J' + +* If no prefix, examine the epoch + ELSE IF (JB.EQ.0) THEN + +* If epoch is pre-1984.0, assume Besselian; otherwise Julian + IF (E.LT.1984D0) THEN + K='B' + ELSE + K='J' + END IF + +* If illegal prefix, return error status + ELSE + K=' ' + J=1 + END IF + + END diff --git a/math/slalib/m2av.f b/math/slalib/m2av.f new file mode 100644 index 00000000..7e2e0cdb --- /dev/null +++ b/math/slalib/m2av.f @@ -0,0 +1,75 @@ + SUBROUTINE slM2AV (RMAT, AXVEC) +*+ +* - - - - - +* M 2 A V +* - - - - - +* +* From a rotation matrix, determine the corresponding axial vector +* (single precision) +* +* A rotation matrix describes a rotation about some arbitrary axis, +* called the Euler axis. The "axial vector" returned by this routine +* has the same direction as the Euler axis, and its magnitude is the +* amount of rotation in radians. (The magnitude and direction can be +* separated by means of the routine slVN.) +* +* Given: +* RMAT r(3,3) rotation matrix +* +* Returned: +* AXVEC r(3) axial vector (radians) +* +* The reference frame rotates clockwise as seen looking along +* the axial vector from the origin. +* +* If RMAT is null, so is the result. +* +* Last revision: 26 November 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL RMAT(3,3),AXVEC(3) + + REAL X,Y,Z,S2,C2,PHI,F + + + + X = RMAT(2,3)-RMAT(3,2) + Y = RMAT(3,1)-RMAT(1,3) + Z = RMAT(1,2)-RMAT(2,1) + S2 = SQRT(X*X+Y*Y+Z*Z) + IF (S2.NE.0.0) THEN + C2 = (RMAT(1,1)+RMAT(2,2)+RMAT(3,3)-1.0) + PHI = ATAN2(S2/2.0,C2/2.0) + F = PHI/S2 + AXVEC(1) = X*F + AXVEC(2) = Y*F + AXVEC(3) = Z*F + ELSE + AXVEC(1) = 0.0 + AXVEC(2) = 0.0 + AXVEC(3) = 0.0 + END IF + + END diff --git a/math/slalib/map.f b/math/slalib/map.f new file mode 100644 index 00000000..5c019fcd --- /dev/null +++ b/math/slalib/map.f @@ -0,0 +1,99 @@ + SUBROUTINE slMAP (RM, DM, PR, PD, PX, RV, EQ, DATE, RA, DA) +*+ +* - - - - +* M A P +* - - - - +* +* Transform star RA,Dec from mean place to geocentric apparent +* +* The reference frames and timescales used are post IAU 1976. +* +* References: +* 1984 Astronomical Almanac, pp B39-B41. +* (also Lederle & Schwan, Astron. Astrophys. 134, +* 1-6, 1984) +* +* Given: +* RM,DM dp mean RA,Dec (rad) +* PR,PD dp proper motions: RA,Dec changes per Julian year +* PX dp parallax (arcsec) +* RV dp radial velocity (km/sec, +ve if receding) +* EQ dp epoch and equinox of star data (Julian) +* DATE dp TDB for apparent place (JD-2400000.5) +* +* Returned: +* RA,DA dp apparent RA,Dec (rad) +* +* Called: +* slMAPA star-independent parameters +* slMAPQ quick mean to apparent +* +* Notes: +* +* 1) EQ is the Julian epoch specifying both the reference frame and +* the epoch of the position - usually 2000. For positions where +* the epoch and equinox are different, use the routine slPM to +* apply proper motion corrections before using this routine. +* +* 2) The distinction between the required TDB and TT is always +* negligible. Moreover, for all but the most critical +* applications UTC is adequate. +* +* 3) The proper motions in RA are dRA/dt rather than cos(Dec)*dRA/dt. +* +* 4) This routine may be wasteful for some applications because it +* recomputes the Earth position/velocity and the precession- +* nutation matrix each time, and because it allows for parallax +* and proper motion. Where multiple transformations are to be +* carried out for one epoch, a faster method is to call the +* slMAPA routine once and then either the slMAPQ routine +* (which includes parallax and proper motion) or slMAPZ (which +* assumes zero parallax and proper motion). +* +* 5) The accuracy is sub-milliarcsecond, limited by the +* precession-nutation model (IAU 1976 precession, Shirai & +* Fukushima 2001 forced nutation and precession corrections). +* +* 6) The accuracy is further limited by the routine slEVP, called +* by slMAPA, which computes the Earth position and velocity +* using the methods of Stumpff. The maximum error is about +* 0.3 mas. +* +* P.T.Wallace Starlink 17 September 2001 +* +* Copyright (C) 2001 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RM,DM,PR,PD,PX,RV,EQ,DATE,RA,DA + + DOUBLE PRECISION AMPRMS(21) + + + +* Star-independent parameters + CALL slMAPA(EQ,DATE,AMPRMS) + +* Mean to apparent + CALL slMAPQ(RM,DM,PR,PD,PX,RV,AMPRMS,RA,DA) + + END diff --git a/math/slalib/mappa.f b/math/slalib/mappa.f new file mode 100644 index 00000000..d3d9c2ae --- /dev/null +++ b/math/slalib/mappa.f @@ -0,0 +1,129 @@ + SUBROUTINE slMAPA (EQ, DATE, AMPRMS) +*+ +* - - - - - - +* M A P A +* - - - - - - +* +* Compute star-independent parameters in preparation for +* conversions between mean place and geocentric apparent place. +* +* The parameters produced by this routine are required in the +* parallax, light deflection, aberration, and precession/nutation +* parts of the mean/apparent transformations. +* +* The reference frames and timescales used are post IAU 1976. +* +* Given: +* EQ d epoch of mean equinox to be used (Julian) +* DATE d TDB (JD-2400000.5) +* +* Returned: +* AMPRMS d(21) star-independent mean-to-apparent parameters: +* +* (1) time interval for proper motion (Julian years) +* (2-4) barycentric position of the Earth (AU) +* (5-7) heliocentric direction of the Earth (unit vector) +* (8) (grav rad Sun)*2/(Sun-Earth distance) +* (9-11) ABV: barycentric Earth velocity in units of c +* (12) sqrt(1-v**2) where v=modulus(ABV) +* (13-21) precession/nutation (3,3) matrix +* +* References: +* 1984 Astronomical Almanac, pp B39-B41. +* (also Lederle & Schwan, Astron. Astrophys. 134, +* 1-6, 1984) +* +* Notes: +* +* 1) For DATE, the distinction between the required TDB and TT +* is always negligible. Moreover, for all but the most +* critical applications UTC is adequate. +* +* 2) The vectors AMPRMS(2-4) and AMPRMS(5-7) are referred to +* the mean equinox and equator of epoch EQ. +* +* 3) The parameters AMPRMS produced by this routine are used by +* slAMPQ, slMAPQ and slMAPZ. +* +* 4) The accuracy is sub-milliarcsecond, limited by the +* precession-nutation model (IAU 1976 precession, Shirai & +* Fukushima 2001 forced nutation and precession corrections). +* +* 5) A further limit to the accuracy of routines using the parameter +* array AMPRMS is imposed by the routine slEVP, used here to +* compute the Earth position and velocity by the methods of +* Stumpff. The maximum error in the resulting aberration +* corrections is about 0.3 milliarcsecond. +* +* Called: +* slEPJ MDJ to Julian epoch +* slEVP earth position & velocity +* slDVN normalize vector +* slPRNU precession/nutation matrix +* +* P.T.Wallace Starlink 24 October 2003 +* +* Copyright (C) 2003 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION EQ,DATE,AMPRMS(21) + +* Light time for 1 AU (sec) + DOUBLE PRECISION CR + PARAMETER (CR=499.004782D0) + +* Gravitational radius of the Sun x 2 (2*mu/c**2, AU) + DOUBLE PRECISION GR2 + PARAMETER (GR2=2D0*9.87063D-9) + + INTEGER I + + DOUBLE PRECISION EBD(3),EHD(3),EH(3),E,VN(3),VM + + DOUBLE PRECISION slEPJ + + + +* Time interval for proper motion correction + AMPRMS(1) = slEPJ(DATE)-EQ + +* Get Earth barycentric and heliocentric position and velocity + CALL slEVP(DATE,EQ,EBD,AMPRMS(2),EHD,EH) + +* Heliocentric direction of earth (normalized) and modulus + CALL slDVN(EH,AMPRMS(5),E) + +* Light deflection parameter + AMPRMS(8) = GR2/E + +* Aberration parameters + DO I=1,3 + AMPRMS(I+8) = EBD(I)*CR + END DO + CALL slDVN(AMPRMS(9),VN,VM) + AMPRMS(12) = SQRT(1D0-VM*VM) + +* Precession/nutation matrix + CALL slPRNU(EQ,DATE,AMPRMS(13)) + + END diff --git a/math/slalib/mapqk.f b/math/slalib/mapqk.f new file mode 100644 index 00000000..0e1997ff --- /dev/null +++ b/math/slalib/mapqk.f @@ -0,0 +1,160 @@ + SUBROUTINE slMAPQ (RM, DM, PR, PD, PX, RV, AMPRMS, RA, DA) +*+ +* - - - - - - +* M A P Q +* - - - - - - +* +* Quick mean to apparent place: transform a star RA,Dec from +* mean place to geocentric apparent place, given the +* star-independent parameters. +* +* Use of this routine is appropriate when efficiency is important +* and where many star positions, all referred to the same equator +* and equinox, are to be transformed for one epoch. The +* star-independent parameters can be obtained by calling the +* slMAPA routine. +* +* If the parallax and proper motions are zero the slMAPZ +* routine can be used instead. +* +* The reference frames and timescales used are post IAU 1976. +* +* Given: +* RM,DM d mean RA,Dec (rad) +* PR,PD d proper motions: RA,Dec changes per Julian year +* PX d parallax (arcsec) +* RV d radial velocity (km/sec, +ve if receding) +* +* AMPRMS d(21) star-independent mean-to-apparent parameters: +* +* (1) time interval for proper motion (Julian years) +* (2-4) barycentric position of the Earth (AU) +* (5-7) heliocentric direction of the Earth (unit vector) +* (8) (grav rad Sun)*2/(Sun-Earth distance) +* (9-11) barycentric Earth velocity in units of c +* (12) sqrt(1-v**2) where v=modulus(ABV) +* (13-21) precession/nutation (3,3) matrix +* +* Returned: +* RA,DA d apparent RA,Dec (rad) +* +* References: +* 1984 Astronomical Almanac, pp B39-B41. +* (also Lederle & Schwan, Astron. Astrophys. 134, +* 1-6, 1984) +* +* Notes: +* +* 1) The vectors AMPRMS(2-4) and AMPRMS(5-7) are referred to +* the mean equinox and equator of epoch EQ. +* +* 2) Strictly speaking, the routine is not valid for solar-system +* sources, though the error will usually be extremely small. +* However, to prevent gross errors in the case where the +* position of the Sun is specified, the gravitational +* deflection term is restrained within about 920 arcsec of the +* centre of the Sun's disc. The term has a maximum value of +* about 1.85 arcsec at this radius, and decreases to zero as +* the centre of the disc is approached. +* +* Called: +* slDS2C spherical to Cartesian +* slDVDV dot product +* slDMXV matrix x vector +* slDC2S Cartesian to spherical +* slDA2P normalize angle 0-2Pi +* +* P.T.Wallace Starlink 15 January 2000 +* +* Copyright (C) 2000 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RM,DM,PR,PD,PX,RV,AMPRMS(21),RA,DA + +* Arc seconds to radians + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + +* Km/s to AU/year + DOUBLE PRECISION VF + PARAMETER (VF=0.21094502D0) + + INTEGER I + + DOUBLE PRECISION PMT,GR2E,AB1,EB(3),EHN(3),ABV(3), + : Q(3),PXR,W,EM(3),P(3),PN(3),PDE,PDEP1, + : P1(3),P1DV,P2(3),P3(3) + + DOUBLE PRECISION slDVDV,slDA2P + + + +* Unpack scalar and vector parameters + PMT = AMPRMS(1) + GR2E = AMPRMS(8) + AB1 = AMPRMS(12) + DO I=1,3 + EB(I) = AMPRMS(I+1) + EHN(I) = AMPRMS(I+4) + ABV(I) = AMPRMS(I+8) + END DO + +* Spherical to x,y,z + CALL slDS2C(RM,DM,Q) + +* Space motion (radians per year) + PXR = PX*AS2R + W = VF*RV*PXR + EM(1) = -PR*Q(2)-PD*COS(RM)*SIN(DM)+W*Q(1) + EM(2) = PR*Q(1)-PD*SIN(RM)*SIN(DM)+W*Q(2) + EM(3) = PD*COS(DM) +W*Q(3) + +* Geocentric direction of star (normalized) + DO I=1,3 + P(I) = Q(I)+PMT*EM(I)-PXR*EB(I) + END DO + CALL slDVN(P,PN,W) + +* Light deflection (restrained within the Sun's disc) + PDE = slDVDV(PN,EHN) + PDEP1 = PDE+1D0 + W = GR2E/MAX(PDEP1,1D-5) + DO I=1,3 + P1(I) = PN(I)+W*(EHN(I)-PDE*PN(I)) + END DO + +* Aberration (normalization omitted) + P1DV = slDVDV(P1,ABV) + W = 1D0+P1DV/(AB1+1D0) + DO I=1,3 + P2(I) = AB1*P1(I)+W*ABV(I) + END DO + +* Precession and nutation + CALL slDMXV(AMPRMS(13),P2,P3) + +* Geocentric apparent RA,Dec + CALL slDC2S(P3,RA,DA) + RA = slDA2P(RA) + + END diff --git a/math/slalib/mapqkz.f b/math/slalib/mapqkz.f new file mode 100644 index 00000000..6409b22e --- /dev/null +++ b/math/slalib/mapqkz.f @@ -0,0 +1,131 @@ + SUBROUTINE slMAPZ (RM, DM, AMPRMS, RA, DA) +*+ +* - - - - - - - +* M A P Z +* - - - - - - - +* +* Quick mean to apparent place: transform a star RA,Dec from +* mean place to geocentric apparent place, given the +* star-independent parameters, and assuming zero parallax +* and proper motion. +* +* Use of this routine is appropriate when efficiency is important +* and where many star positions, all with parallax and proper +* motion either zero or already allowed for, and all referred to +* the same equator and equinox, are to be transformed for one +* epoch. The star-independent parameters can be obtained by +* calling the slMAPA routine. +* +* The corresponding routine for the case of non-zero parallax +* and proper motion is slMAPQ. +* +* The reference frames and timescales used are post IAU 1976. +* +* Given: +* RM,DM d mean RA,Dec (rad) +* AMPRMS d(21) star-independent mean-to-apparent parameters: +* +* (1-4) not used +* (5-7) heliocentric direction of the Earth (unit vector) +* (8) (grav rad Sun)*2/(Sun-Earth distance) +* (9-11) ABV: barycentric Earth velocity in units of c +* (12) sqrt(1-v**2) where v=modulus(ABV) +* (13-21) precession/nutation (3,3) matrix +* +* Returned: +* RA,DA d apparent RA,Dec (rad) +* +* References: +* 1984 Astronomical Almanac, pp B39-B41. +* (also Lederle & Schwan, Astron. Astrophys. 134, +* 1-6, 1984) +* +* Notes: +* +* 1) The vectors AMPRMS(2-4) and AMPRMS(5-7) are referred to the +* mean equinox and equator of epoch EQ. +* +* 2) Strictly speaking, the routine is not valid for solar-system +* sources, though the error will usually be extremely small. +* However, to prevent gross errors in the case where the +* position of the Sun is specified, the gravitational +* deflection term is restrained within about 920 arcsec of the +* centre of the Sun's disc. The term has a maximum value of +* about 1.85 arcsec at this radius, and decreases to zero as +* the centre of the disc is approached. +* +* Called: slDS2C, slDVDV, slDMXV, slDC2S, slDA2P +* +* P.T.Wallace Starlink 18 March 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RM,DM,AMPRMS(21),RA,DA + + INTEGER I + + DOUBLE PRECISION GR2E,AB1,EHN(3),ABV(3), + : P(3),PDE,PDEP1,W,P1(3),P1DV, + : P1DVP1,P2(3),P3(3) + + DOUBLE PRECISION slDVDV,slDA2P + + + + +* Unpack scalar and vector parameters + GR2E = AMPRMS(8) + AB1 = AMPRMS(12) + DO I=1,3 + EHN(I) = AMPRMS(I+4) + ABV(I) = AMPRMS(I+8) + END DO + +* Spherical to x,y,z + CALL slDS2C(RM,DM,P) + +* Light deflection + PDE = slDVDV(P,EHN) + PDEP1 = PDE+1D0 + W = GR2E/MAX(PDEP1,1D-5) + DO I=1,3 + P1(I) = P(I)+W*(EHN(I)-PDE*P(I)) + END DO + +* Aberration + P1DV = slDVDV(P1,ABV) + P1DVP1 = P1DV+1D0 + W = 1D0+P1DV/(AB1+1D0) + DO I=1,3 + P2(I) = (AB1*P1(I)+W*ABV(I))/P1DVP1 + END DO + +* Precession and nutation + CALL slDMXV(AMPRMS(13),P2,P3) + +* Geocentric apparent RA,Dec + CALL slDC2S(P3,RA,DA) + RA = slDA2P(RA) + + END diff --git a/math/slalib/mkpkg b/math/slalib/mkpkg new file mode 100644 index 00000000..d2f9203b --- /dev/null +++ b/math/slalib/mkpkg @@ -0,0 +1,193 @@ +# SLALIB library routines + +$checkout libslalib.a lib$ +$update libslalib.a +$checkin libslalib.a lib$ +$exit + +libslalib.a: + addet.f + afin.f + airmas.f + altaz.f + amp.f + ampqk.f + aop.f + aoppa.f + aoppat.f + aopqk.f + atmdsp.f + atms.f + atmt.f + av2m.f + bear.f + caf2r.f + caldj.f + calyd.f + cc2s.f + cc62s.f + cd2tf.f + cldj.f + clyd.f + cr2af.f + cr2tf.f + cs2c.f + cs2c6.f + ctf2d.f + ctf2r.f + daf2r.f + dafin.f + dat.f + dav2m.f + dbear.f + dbjin.f + dc62s.f + dcc2s.f + dcmpf.f + dcs2c.f + dd2tf.f + de2h.f + deuler.f + dfltin.f + dh2e.f + dimxv.f + djcal.f + djcl.f + dm2av.f + dmat.f + dmoon.f + dmxm.f + dmxv.f + dpav.f + dr2af.f + dr2tf.f + drange.f + dranrm.f + ds2c6.f + ds2tp.f + dsep.f + dsepv.f + dt.f + dtf2d.f + dtf2r.f + dtp2s.f + dtp2v.f + dtps2c.f + dtpv2c.f + dtt.f + dv2tp.f + dvdv.f + dvn.f + dvxv.f + e2h.f + earth.f + ecleq.f + ecmat.f + ecor.f + eg50.f + el2ue.f + epb.f + epb2d.f + epco.f + epj.f + epj2d.f + eqecl.f + eqeqx.f + eqgal.f + etrms.f + euler.f + evp.f + fitxy.f + fk425.f + fk45z.f + fk524.f + fk54z.f + fk52h.f + fk5hz.f + flotin.f + galeq.f + galsup.f + ge50.f + geoc.f + gmst.f + gmsta.f + h2e.f + h2fk5.f + hfk5z.f + idchf.f + idchi.f + imxv.f + intin.f + invf.f + kbj.f + m2av.f + map.f + mappa.f + mapqk.f + mapqkz.f + moon.f + mxm.f + mxv.f + nut.f + nutc.f + oap.f + oapqk.f + obs.f + pa.f + pav.f + pcd.f + pda2h.f + pdq2h.f + pertel.f + pertue.f + planel.f + planet.f + plante.f + pm.f + polmo.f + prebn.f + prec.f + preces.f + precl.f + precss.f # preces.f with an integer system argument + prenut.f + pv2ue.f + pv2el.f + pvobs.f + pxy.f + range.f + ranorm.f + rcc.f + rdplan.f + refco.f + refcoq.f + refro.f + refv.f + refz.f + rverot.f + rvgalc.f + rvlg.f + rvlsrd.f + rvlsrk.f + s2tp.f + sep.f + smat.f + subet.f + supgal.f + svd.f + svdcov.f + svdsol.f + tp2s.f + tp2v.f + tps2c.f + tpv2c.f + ue2el.f + ue2pv.f + unpcd.f + v2tp.f + vdv.f + vn.f + vxv.f + xy2xy.f + zd.f + ; diff --git a/math/slalib/moon.f b/math/slalib/moon.f new file mode 100644 index 00000000..c77395ee --- /dev/null +++ b/math/slalib/moon.f @@ -0,0 +1,380 @@ + SUBROUTINE slMOON (IY, ID, FD, PV) +*+ +* - - - - - +* M O O N +* - - - - - +* +* Approximate geocentric position and velocity of the Moon +* (single precision). +* +* Given: +* IY i year +* ID i day in year (1 = Jan 1st) +* FD r fraction of day +* +* Returned: +* PV r(6) Moon position & velocity vector +* +* Notes: +* +* 1 The date and time is TDB (loosely ET) in a Julian calendar +* which has been aligned to the ordinary Gregorian +* calendar for the interval 1900 March 1 to 2100 February 28. +* The year and day can be obtained by calling slCAYD or +* slCLYD. +* +* 2 The Moon 6-vector is Moon centre relative to Earth centre, +* mean equator and equinox of date. Position part, PV(1-3), +* is in AU; velocity part, PV(4-6), is in AU/sec. +* +* 3 The position is accurate to better than 0.5 arcminute +* in direction and 1000 km in distance. The velocity +* is accurate to better than 0.5"/hour in direction and +* 4 m/s in distance. (RMS figures with respect to JPL DE200 +* for the interval 1960-2025 are 14 arcsec and 0.2 arcsec/hour in +* longitude, 9 arcsec and 0.2 arcsec/hour in latitude, 350 km and +* 2 m/s in distance.) Note that the distance accuracy is +* comparatively poor because this routine is principally intended +* for computing topocentric direction. +* +* 4 This routine is only a partial implementation of the original +* Meeus algorithm (reference below), which offers 4 times the +* accuracy in direction and 30 times the accuracy in distance +* when fully implemented (as it is in slDMON). +* +* Reference: +* Meeus, l'Astronomie, June 1984, p348. +* +* Called: slS2C6 +* +* P.T.Wallace Starlink 8 December 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IY,ID + REAL FD,PV(6) + + INTEGER ITP(4,4),ITL(4,39),ITB(4,29),I,IY4,N + REAL D2R,RATCON,ERADAU + REAL ELP0,ELP1,ELP1I,ELP1F + REAL EM0,EM1,EM1F + REAL EMP0,EMP1,EMP1I,EMP1F + REAL D0,D1,D1I,D1F + REAL F0,F1,F1I,F1F + REAL TL(39) + REAL TB(29) + REAL TP(4) + REAL YI,YF,T,ELP,EM,EMP,D,F,EL,ELD,COEFF,CEM,CEMP + REAL CD,CF,THETA,THETAD,B,BD,P,PD,SP,R,RD + REAL V(6),EPS,SINEPS,COSEPS + +* Degrees to radians + PARAMETER (D2R=1.745329252E-2) + +* Rate conversion factor: D2R**2/(86400*365.25) + PARAMETER (RATCON=9.652743551E-12) + +* Earth radius in AU: 6378.137/149597870 + PARAMETER (ERADAU=4.2635212653763E-5) + +* +* Coefficients for fundamental arguments +* +* Fixed term (deg), term in T (deg & whole revs + fraction per year) +* +* Moon's mean longitude + DATA ELP0,ELP1,ELP1I,ELP1F / + : 270.434164, 4812.678831, 4680., 132.678831 / +* +* Sun's mean anomaly + DATA EM0,EM1,EM1F / + : 358.475833, 359.990498, 359.990498 / +* +* Moon's mean anomaly + DATA EMP0,EMP1,EMP1I,EMP1F / + : 296.104608, 4771.988491, 4680., 91.988491 / +* +* Moon's mean elongation + DATA D0,D1,D1I,D1F / + : 350.737486, 4452.671142, 4320., 132.671142 / +* +* Mean distance of the Moon from its ascending node + DATA F0,F1,F1I,F1F / + : 11.250889, 4832.020251, 4680., 152.020251 / + +* +* Coefficients for Moon position +* +* T(N) = coefficient of term (deg) +* IT(N,1-4) = coefficients of M, M', D, F in argument +* +* Longitude +* M M' D F + DATA TL( 1)/ +6.288750 /, + : (ITL(I, 1),I=1,4)/ 0, +1, 0, 0 / + DATA TL( 2)/ +1.274018 /, + : (ITL(I, 2),I=1,4)/ 0, -1, +2, 0 / + DATA TL( 3)/ +0.658309 /, + : (ITL(I, 3),I=1,4)/ 0, 0, +2, 0 / + DATA TL( 4)/ +0.213616 /, + : (ITL(I, 4),I=1,4)/ 0, +2, 0, 0 / + DATA TL( 5)/ -0.185596 /, + : (ITL(I, 5),I=1,4)/ +1, 0, 0, 0 / + DATA TL( 6)/ -0.114336 /, + : (ITL(I, 6),I=1,4)/ 0, 0, 0, +2 / + DATA TL( 7)/ +0.058793 /, + : (ITL(I, 7),I=1,4)/ 0, -2, +2, 0 / + DATA TL( 8)/ +0.057212 /, + : (ITL(I, 8),I=1,4)/ -1, -1, +2, 0 / + DATA TL( 9)/ +0.053320 /, + : (ITL(I, 9),I=1,4)/ 0, +1, +2, 0 / + DATA TL(10)/ +0.045874 /, + : (ITL(I,10),I=1,4)/ -1, 0, +2, 0 / + DATA TL(11)/ +0.041024 /, + : (ITL(I,11),I=1,4)/ -1, +1, 0, 0 / + DATA TL(12)/ -0.034718 /, + : (ITL(I,12),I=1,4)/ 0, 0, +1, 0 / + DATA TL(13)/ -0.030465 /, + : (ITL(I,13),I=1,4)/ +1, +1, 0, 0 / + DATA TL(14)/ +0.015326 /, + : (ITL(I,14),I=1,4)/ 0, 0, +2, -2 / + DATA TL(15)/ -0.012528 /, + : (ITL(I,15),I=1,4)/ 0, +1, 0, +2 / + DATA TL(16)/ -0.010980 /, + : (ITL(I,16),I=1,4)/ 0, -1, 0, +2 / + DATA TL(17)/ +0.010674 /, + : (ITL(I,17),I=1,4)/ 0, -1, +4, 0 / + DATA TL(18)/ +0.010034 /, + : (ITL(I,18),I=1,4)/ 0, +3, 0, 0 / + DATA TL(19)/ +0.008548 /, + : (ITL(I,19),I=1,4)/ 0, -2, +4, 0 / + DATA TL(20)/ -0.007910 /, + : (ITL(I,20),I=1,4)/ +1, -1, +2, 0 / + DATA TL(21)/ -0.006783 /, + : (ITL(I,21),I=1,4)/ +1, 0, +2, 0 / + DATA TL(22)/ +0.005162 /, + : (ITL(I,22),I=1,4)/ 0, +1, -1, 0 / + DATA TL(23)/ +0.005000 /, + : (ITL(I,23),I=1,4)/ +1, 0, +1, 0 / + DATA TL(24)/ +0.004049 /, + : (ITL(I,24),I=1,4)/ -1, +1, +2, 0 / + DATA TL(25)/ +0.003996 /, + : (ITL(I,25),I=1,4)/ 0, +2, +2, 0 / + DATA TL(26)/ +0.003862 /, + : (ITL(I,26),I=1,4)/ 0, 0, +4, 0 / + DATA TL(27)/ +0.003665 /, + : (ITL(I,27),I=1,4)/ 0, -3, +2, 0 / + DATA TL(28)/ +0.002695 /, + : (ITL(I,28),I=1,4)/ -1, +2, 0, 0 / + DATA TL(29)/ +0.002602 /, + : (ITL(I,29),I=1,4)/ 0, +1, -2, -2 / + DATA TL(30)/ +0.002396 /, + : (ITL(I,30),I=1,4)/ -1, -2, +2, 0 / + DATA TL(31)/ -0.002349 /, + : (ITL(I,31),I=1,4)/ 0, +1, +1, 0 / + DATA TL(32)/ +0.002249 /, + : (ITL(I,32),I=1,4)/ -2, 0, +2, 0 / + DATA TL(33)/ -0.002125 /, + : (ITL(I,33),I=1,4)/ +1, +2, 0, 0 / + DATA TL(34)/ -0.002079 /, + : (ITL(I,34),I=1,4)/ +2, 0, 0, 0 / + DATA TL(35)/ +0.002059 /, + : (ITL(I,35),I=1,4)/ -2, -1, +2, 0 / + DATA TL(36)/ -0.001773 /, + : (ITL(I,36),I=1,4)/ 0, +1, +2, -2 / + DATA TL(37)/ -0.001595 /, + : (ITL(I,37),I=1,4)/ 0, 0, +2, +2 / + DATA TL(38)/ +0.001220 /, + : (ITL(I,38),I=1,4)/ -1, -1, +4, 0 / + DATA TL(39)/ -0.001110 /, + : (ITL(I,39),I=1,4)/ 0, +2, 0, +2 / +* +* Latitude +* M M' D F + DATA TB( 1)/ +5.128189 /, + : (ITB(I, 1),I=1,4)/ 0, 0, 0, +1 / + DATA TB( 2)/ +0.280606 /, + : (ITB(I, 2),I=1,4)/ 0, +1, 0, +1 / + DATA TB( 3)/ +0.277693 /, + : (ITB(I, 3),I=1,4)/ 0, +1, 0, -1 / + DATA TB( 4)/ +0.173238 /, + : (ITB(I, 4),I=1,4)/ 0, 0, +2, -1 / + DATA TB( 5)/ +0.055413 /, + : (ITB(I, 5),I=1,4)/ 0, -1, +2, +1 / + DATA TB( 6)/ +0.046272 /, + : (ITB(I, 6),I=1,4)/ 0, -1, +2, -1 / + DATA TB( 7)/ +0.032573 /, + : (ITB(I, 7),I=1,4)/ 0, 0, +2, +1 / + DATA TB( 8)/ +0.017198 /, + : (ITB(I, 8),I=1,4)/ 0, +2, 0, +1 / + DATA TB( 9)/ +0.009267 /, + : (ITB(I, 9),I=1,4)/ 0, +1, +2, -1 / + DATA TB(10)/ +0.008823 /, + : (ITB(I,10),I=1,4)/ 0, +2, 0, -1 / + DATA TB(11)/ +0.008247 /, + : (ITB(I,11),I=1,4)/ -1, 0, +2, -1 / + DATA TB(12)/ +0.004323 /, + : (ITB(I,12),I=1,4)/ 0, -2, +2, -1 / + DATA TB(13)/ +0.004200 /, + : (ITB(I,13),I=1,4)/ 0, +1, +2, +1 / + DATA TB(14)/ +0.003372 /, + : (ITB(I,14),I=1,4)/ -1, 0, -2, +1 / + DATA TB(15)/ +0.002472 /, + : (ITB(I,15),I=1,4)/ -1, -1, +2, +1 / + DATA TB(16)/ +0.002222 /, + : (ITB(I,16),I=1,4)/ -1, 0, +2, +1 / + DATA TB(17)/ +0.002072 /, + : (ITB(I,17),I=1,4)/ -1, -1, +2, -1 / + DATA TB(18)/ +0.001877 /, + : (ITB(I,18),I=1,4)/ -1, +1, 0, +1 / + DATA TB(19)/ +0.001828 /, + : (ITB(I,19),I=1,4)/ 0, -1, +4, -1 / + DATA TB(20)/ -0.001803 /, + : (ITB(I,20),I=1,4)/ +1, 0, 0, +1 / + DATA TB(21)/ -0.001750 /, + : (ITB(I,21),I=1,4)/ 0, 0, 0, +3 / + DATA TB(22)/ +0.001570 /, + : (ITB(I,22),I=1,4)/ -1, +1, 0, -1 / + DATA TB(23)/ -0.001487 /, + : (ITB(I,23),I=1,4)/ 0, 0, +1, +1 / + DATA TB(24)/ -0.001481 /, + : (ITB(I,24),I=1,4)/ +1, +1, 0, +1 / + DATA TB(25)/ +0.001417 /, + : (ITB(I,25),I=1,4)/ -1, -1, 0, +1 / + DATA TB(26)/ +0.001350 /, + : (ITB(I,26),I=1,4)/ -1, 0, 0, +1 / + DATA TB(27)/ +0.001330 /, + : (ITB(I,27),I=1,4)/ 0, 0, -1, +1 / + DATA TB(28)/ +0.001106 /, + : (ITB(I,28),I=1,4)/ 0, +3, 0, +1 / + DATA TB(29)/ +0.001020 /, + : (ITB(I,29),I=1,4)/ 0, 0, +4, -1 / +* +* Parallax +* M M' D F + DATA TP( 1)/ +0.051818 /, + : (ITP(I, 1),I=1,4)/ 0, +1, 0, 0 / + DATA TP( 2)/ +0.009531 /, + : (ITP(I, 2),I=1,4)/ 0, -1, +2, 0 / + DATA TP( 3)/ +0.007843 /, + : (ITP(I, 3),I=1,4)/ 0, 0, +2, 0 / + DATA TP( 4)/ +0.002824 /, + : (ITP(I, 4),I=1,4)/ 0, +2, 0, 0 / + + + +* Whole years & fraction of year, and years since J1900.0 + YI=FLOAT(IY-1900) + IY4=MOD(MOD(IY,4)+4,4) + YF=(FLOAT(4*(ID-1/(IY4+1))-IY4-2)+4.0*FD)/1461.0 + T=YI+YF + +* Moon's mean longitude + ELP=D2R*MOD(ELP0+ELP1I*YF+ELP1F*T,360.0) + +* Sun's mean anomaly + EM=D2R*MOD(EM0+EM1F*T,360.0) + +* Moon's mean anomaly + EMP=D2R*MOD(EMP0+EMP1I*YF+EMP1F*T,360.0) + +* Moon's mean elongation + D=D2R*MOD(D0+D1I*YF+D1F*T,360.0) + +* Mean distance of the moon from its ascending node + F=D2R*MOD(F0+F1I*YF+F1F*T,360.0) + +* Longitude + EL=0.0 + ELD=0.0 + DO N=39,1,-1 + COEFF=TL(N) + CEM=FLOAT(ITL(1,N)) + CEMP=FLOAT(ITL(2,N)) + CD=FLOAT(ITL(3,N)) + CF=FLOAT(ITL(4,N)) + THETA=CEM*EM+CEMP*EMP+CD*D+CF*F + THETAD=CEM*EM1+CEMP*EMP1+CD*D1+CF*F1 + EL=EL+COEFF*SIN(THETA) + ELD=ELD+COEFF*COS(THETA)*THETAD + END DO + EL=EL*D2R+ELP + ELD=RATCON*(ELD+ELP1/D2R) + +* Latitude + B=0.0 + BD=0.0 + DO N=29,1,-1 + COEFF=TB(N) + CEM=FLOAT(ITB(1,N)) + CEMP=FLOAT(ITB(2,N)) + CD=FLOAT(ITB(3,N)) + CF=FLOAT(ITB(4,N)) + THETA=CEM*EM+CEMP*EMP+CD*D+CF*F + THETAD=CEM*EM1+CEMP*EMP1+CD*D1+CF*F1 + B=B+COEFF*SIN(THETA) + BD=BD+COEFF*COS(THETA)*THETAD + END DO + B=B*D2R + BD=RATCON*BD + +* Parallax + P=0.0 + PD=0.0 + DO N=4,1,-1 + COEFF=TP(N) + CEM=FLOAT(ITP(1,N)) + CEMP=FLOAT(ITP(2,N)) + CD=FLOAT(ITP(3,N)) + CF=FLOAT(ITP(4,N)) + THETA=CEM*EM+CEMP*EMP+CD*D+CF*F + THETAD=CEM*EM1+CEMP*EMP1+CD*D1+CF*F1 + P=P+COEFF*COS(THETA) + PD=PD-COEFF*SIN(THETA)*THETAD + END DO + P=(P+0.950724)*D2R + PD=RATCON*PD + +* Transform parallax to distance (AU, AU/sec) + SP=SIN(P) + R=ERADAU/SP + RD=-R*PD/SP + +* Longitude, latitude to x,y,z (AU) + CALL slS2C6(EL,B,R,ELD,BD,RD,V) + +* Mean obliquity + EPS=D2R*(23.45229-0.00013*T) + SINEPS=SIN(EPS) + COSEPS=COS(EPS) + +* Rotate Moon position and velocity into equatorial system + PV(1)=V(1) + PV(2)=V(2)*COSEPS-V(3)*SINEPS + PV(3)=V(2)*SINEPS+V(3)*COSEPS + PV(4)=V(4) + PV(5)=V(5)*COSEPS-V(6)*SINEPS + PV(6)=V(5)*SINEPS+V(6)*COSEPS + + END diff --git a/math/slalib/mxm.f b/math/slalib/mxm.f new file mode 100644 index 00000000..1c00c632 --- /dev/null +++ b/math/slalib/mxm.f @@ -0,0 +1,72 @@ + SUBROUTINE slMXM (A, B, C) +*+ +* - - - - +* M X M +* - - - - +* +* Product of two 3x3 matrices: +* matrix C = matrix A x matrix B +* +* (single precision) +* +* Given: +* A real(3,3) matrix +* B real(3,3) matrix +* +* Returned: +* C real(3,3) matrix result +* +* To comply with the ANSI Fortran 77 standard, A, B and C must +* be different arrays. However, the routine is coded so as to +* work properly on many platforms even if this rule is violated. +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL A(3,3),B(3,3),C(3,3) + + INTEGER I,J,K + REAL W,WM(3,3) + + +* Multiply into scratch matrix + DO I=1,3 + DO J=1,3 + W=0.0 + DO K=1,3 + W=W+A(I,K)*B(K,J) + END DO + WM(I,J)=W + END DO + END DO + +* Return the result + DO J=1,3 + DO I=1,3 + C(I,J)=WM(I,J) + END DO + END DO + + END diff --git a/math/slalib/mxv.f b/math/slalib/mxv.f new file mode 100644 index 00000000..266c1f85 --- /dev/null +++ b/math/slalib/mxv.f @@ -0,0 +1,69 @@ + SUBROUTINE slMXV (RM, VA, VB) +*+ +* - - - - +* M X V +* - - - - +* +* Performs the 3-D forward unitary transformation: +* +* vector VB = matrix RM * vector VA +* +* (single precision) +* +* Given: +* RM real(3,3) matrix +* VA real(3) vector +* +* Returned: +* VB real(3) result vector +* +* To comply with the ANSI Fortran 77 standard, VA and VB must be +* different arrays. However, the routine is coded so as to work +* properly on many platforms even if this rule is violated. +* +* Last revision: 26 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL RM(3,3),VA(3),VB(3) + + INTEGER I,J + REAL W,VW(3) + + +* Matrix RM * vector VA -> vector VW + DO J=1,3 + W=0.0 + DO I=1,3 + W=W+RM(J,I)*VA(I) + END DO + VW(J)=W + END DO + +* Vector VW -> vector VB + DO J=1,3 + VB(J)=VW(J) + END DO + + END diff --git a/math/slalib/newnames b/math/slalib/newnames new file mode 100644 index 00000000..f91c9c86 --- /dev/null +++ b/math/slalib/newnames @@ -0,0 +1,205 @@ +sla_ADDET slADET +sla_AFIN slAFIN +sla_AIRMAS slARMS +sla_ALTAZ slALAZ +sla_AMP slAMP +sla_AMPQK slAMPQ +sla_AOP slAOP +sla_AOPPA slAOPA +sla_AOPPAT slAOPT +sla_AOPQK slAOPQ +sla__ATMS slATMS +sla__ATMT slATMT +sla_ATMDSP slATMD +sla_AV2M slAV2M + +sla_BEAR slBEAR + +sla_CAF2R slCAFR +sla_CALDJ slCADJ +sla_CALYD slCAYD +sla_CC2S slCC2S +sla_CC62S slC62S +sla_CD2TF slCDTF +sla_CLDJ slCLDJ +sla_CLYD slCLYD +sla_CR2AF slCRAF +sla_CR2TF slCRTF +sla_CS2C slCS2C +sla_CS2C6 slS2C6 +sla_CTF2D slCTFD +sla_CTF2R slCTFR + +sla_DAF2R slDAFR +sla_DAFIN slDAFN +sla_DAT slDAT +sla_DAV2M slDAVM +sla_DBEAR slDBER +sla_DBJIN slDBJI +sla_DC62S slDC6S +sla_DCC2S slDC2S +sla_DCMPF slDCMF +sla_DCS2C slDS2C +sla_DD2TF slDDTF +sla_DE2H slDE2H +sla_DEULER slDEUL +sla_DFLTIN slDFLI +sla_DH2E slDH2E +sla_DIMXV slDIMV +sla_DJCAL slDJCA +sla_DJCL slDJCL +sla_DM2AV slDMAV +sla_DMAT slDMAT +sla_DMOON slDMON +sla_DMXM slDMXM +sla_DMXV slDMXV +sla_DPAV slDPAV +sla_DR2AF slDRAF +sla_DR2TF slDRTF +sla_DRANGE slDA1P +sla_DRANRM slDA2P +sla_DS2C6 slDSC6 +sla_DS2TP slDSTP +sla_DSEP slDSEP +sla_DT slDT +sla_DTF2D slDTFD +sla_DTF2R slDTFR +sla_DTP2S slDTPS +sla_DTP2V slDTPV +sla_DTPS2C slDPSC +sla_DTPV2C slDPVC +sla_DTT slDTT +sla_DV2TP slDVTP +sla_DVDV slDVDV +sla_DVN slDVN +sla_DVXV slDVXV + +sla_E2H slE2H +sla_EARTH slERTH +sla_ECLEQ slECEQ +sla_ECMAT slECMA +sla_ECOR slECOR +sla_EG50 slEG50 +sla_EL2UE slELUE +sla_EPB slEPB +sla_EPB2D slEB2D +sla_EPCO slEPCO +sla_EPJ slEPJ +sla_EPJ2D slEJ2D +sla_EQECL slEQEC +sla_EQEQX slEQEX +sla_EQGAL slEQGA +sla_ETRMS slETRM +sla_EULER slEULR +sla_EVP slEVP + +sla_FITXY slFTXY +sla_FK425 slFK45 +sla_FK45Z slF45Z +sla_FK524 slFK54 +sla_FK52H slFK5H +sla_FK54Z slF54Z +sla_FK5HZ slF5HZ +sla_FLOTIN slRFLI + +sla_GALEQ slGAEQ +sla_GALSUP slGASU +sla_GE50 slGE50 +sla_GEOC slGEOC +sla_GMST slGMST +sla_GMSTA slGMSA +sla_GRESID slGRES + +sla_H2E slH2E +sla_H2FK5 slHFK5 +sla_HFK5Z slHF5Z + +sla__IDCHI slICHI +sla__IDCHF slICHF +sla_IMXV slIMXV +sla_INTIN slINTI +sla_INVF slINVF + +sla_KBJ slKBJ + +sla_M2AV slM2AV +sla_MAP slMAP +sla_MAPPA slMAPA +sla_MAPQK slMAPQ +sla_MAPQKZ slMAPZ +sla_MOON slMOON +sla_MXM slMXM +sla_MXV slMXV + +sla_NUT slNUT +sla_NUTC slNUTC + +sla_OBS slOBS +sla_OAP slOAP +sla_OAPQK slOAPQ + +sla_PA slPA +sla_PAV slPAV +sla_PCD slPCD +sla_PDA2H slPDAH +sla_PDQ2H slPDQH +sla_PERTEL slPRTL +sla_PERTUE slPRTE +sla_PLANEL slPLNE +sla_PLANET slPLNT +sla_PLANTE slPLTE +sla_PM slPM +sla_POLMO slPLMO +sla_PREBN slPRBN +sla_PREC slPREC +sla_PRECES slPRCE +sla_PRECL slPREL +sla_PRENUT slPRNU +sla_PV2EL slPVEL +sla_PV2UE slPVUE +sla_PVOBS slPVOB +sla_PXY slPXY + +sla_RANDOM slRNDM +sla_RANGE slRA1P +sla_RANORM slRA2P +sla_RCC slRCC +sla_RDPLAN slRDPL +sla_REFCO slRFCO +sla_REFCOQ slRFCQ +sla_REFRO slRFRO +sla_REFV slREFV +sla_REFZ slREFZ +sla_RVEROT slRVER +sla_RVGALC slRVGA +sla_RVLG slRVLG +sla_RVLSRD slRVLD +sla_RVLSRK slRVLK + +sla_S2TP slS2TP +sla_SEP slSEP +sla_SMAT slSMAT +sla_SUBET slSUET +sla_SUPGAL slSUGA +sla_SVD slSVD +sla_SVDCOV slSVDC +sla_SVDSOL slSVDS + +sla_TP2S slTP2S +sla_TP2V slTP2V +sla_TPS2C slTPSC +sla_TPV2C slTPVC + +sla_UE2EL slUEEL +sla_UE2PV slUEPV +sla_UNPCD slUPCD + +sla_V2TP slV2TP +sla_VDV slVDV +sla_VN slVN +sla_VXV slVXV + +sla_WAIT slWAIT + +sla_XY2XY slXYXY +sla_ZD slZD diff --git a/math/slalib/nut.f b/math/slalib/nut.f new file mode 100644 index 00000000..b3cbf192 --- /dev/null +++ b/math/slalib/nut.f @@ -0,0 +1,76 @@ + SUBROUTINE slNUT (DATE, RMATN) +*+ +* - - - - +* N U T +* - - - - +* +* Form the matrix of nutation for a given date - Shirai & Fukushima +* 2001 theory (double precision) +* +* Reference: +* Shirai, T. & Fukushima, T., Astron.J. 121, 3270-3283 (2001). +* +* Given: +* DATE d TDB (loosely ET) as Modified Julian Date +* (=JD-2400000.5) +* Returned: +* RMATN d(3,3) nutation matrix +* +* Notes: +* +* 1 The matrix is in the sense v(true) = rmatn * v(mean) . +* where v(true) is the star vector relative to the true equator and +* equinox of date and v(mean) is the star vector relative to the +* mean equator and equinox of date. +* +* 2 The matrix represents forced nutation (but not free core +* nutation) plus corrections to the IAU~1976 precession model. +* +* 3 Earth attitude predictions made by combining the present nutation +* matrix with IAU~1976 precession are accurate to 1~mas (with +* respect to the ICRS) for a few decades around 2000. +* +* 4 The distinction between the required TDB and TT is always +* negligible. Moreover, for all but the most critical applications +* UTC is adequate. +* +* Called: slNUTC, slDEUL +* +* Last revision: 1 December 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,RMATN(3,3) + + DOUBLE PRECISION DPSI,DEPS,EPS0 + + + +* Nutation components and mean obliquity + CALL slNUTC(DATE,DPSI,DEPS,EPS0) + +* Rotation matrix + CALL slDEUL('XZX',EPS0,-DPSI,-(EPS0+DEPS),RMATN) + + END diff --git a/math/slalib/nutc.f b/math/slalib/nutc.f new file mode 100644 index 00000000..95affe1b --- /dev/null +++ b/math/slalib/nutc.f @@ -0,0 +1,831 @@ + SUBROUTINE slNUTC (DATE, DPSI, DEPS, EPS0) +*+ +* - - - - - +* N U T C +* - - - - - +* +* Nutation: longitude & obliquity components and mean obliquity, +* using the Shirai & Fukushima (2001) theory. +* +* Given: +* DATE d TDB (loosely ET) as Modified Julian Date +* (JD-2400000.5) +* Returned: +* DPSI,DEPS d nutation in longitude,obliquity +* EPS0 d mean obliquity +* +* Notes: +* +* 1 The routine predicts forced nutation (but not free core nutation) +* plus corrections to the IAU 1976 precession model. +* +* 2 Earth attitude predictions made by combining the present nutation +* model with IAU 1976 precession are accurate to 1 mas (with respect +* to the ICRF) for a few decades around 2000. +* +* 3 The slNUTC80 routine is the equivalent of the present routine +* but using the IAU 1980 nutation theory. The older theory is less +* accurate, leading to errors as large as 350 mas over the interval +* 1900-2100, mainly because of the error in the IAU 1976 precession. +* +* References: +* +* Shirai, T. & Fukushima, T., Astron.J. 121, 3270-3283 (2001). +* +* Fukushima, T., Astron.Astrophys. 244, L11 (1991). +* +* Simon, J. L., Bretagnon, P., Chapront, J., Chapront-Touze, M., +* Francou, G. & Laskar, J., Astron.Astrophys. 282, 663 (1994). +* +* This revision: 24 November 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,DPSI,DEPS,EPS0 + +* Degrees to radians + DOUBLE PRECISION DD2R + PARAMETER (DD2R=1.745329251994329576923691D-2) + +* Arc seconds to radians + DOUBLE PRECISION DAS2R + PARAMETER (DAS2R=4.848136811095359935899141D-6) + +* Arc seconds in a full circle + DOUBLE PRECISION TURNAS + PARAMETER (TURNAS=1296000D0) + +* Reference epoch (J2000), MJD + DOUBLE PRECISION DJM0 + PARAMETER (DJM0=51544.5D0 ) + +* Days per Julian century + DOUBLE PRECISION DJC + PARAMETER (DJC=36525D0) + + INTEGER I,J + DOUBLE PRECISION T,EL,ELP,F,D,OM,VE,MA,JU,SA,THETA,C,S,DP,DE + +* Number of terms in the nutation model + INTEGER NTERMS + PARAMETER (NTERMS=194) + +* The SF2001 forced nutation model + INTEGER NA(9,NTERMS) + DOUBLE PRECISION PSI(4,NTERMS), EPS(4,NTERMS) + +* Coefficients of fundamental angles + DATA ( ( NA(I,J), I=1,9 ), J=1,10 ) / + : 0, 0, 0, 0, -1, 0, 0, 0, 0, + : 0, 0, 2, -2, 2, 0, 0, 0, 0, + : 0, 0, 2, 0, 2, 0, 0, 0, 0, + : 0, 0, 0, 0, -2, 0, 0, 0, 0, + : 0, 1, 0, 0, 0, 0, 0, 0, 0, + : 0, 1, 2, -2, 2, 0, 0, 0, 0, + : 1, 0, 0, 0, 0, 0, 0, 0, 0, + : 0, 0, 2, 0, 1, 0, 0, 0, 0, + : 1, 0, 2, 0, 2, 0, 0, 0, 0, + : 0, -1, 2, -2, 2, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=11,20 ) / + : 0, 0, 2, -2, 1, 0, 0, 0, 0, + : -1, 0, 2, 0, 2, 0, 0, 0, 0, + : -1, 0, 0, 2, 0, 0, 0, 0, 0, + : 1, 0, 0, 0, 1, 0, 0, 0, 0, + : 1, 0, 0, 0, -1, 0, 0, 0, 0, + : -1, 0, 2, 2, 2, 0, 0, 0, 0, + : 1, 0, 2, 0, 1, 0, 0, 0, 0, + : -2, 0, 2, 0, 1, 0, 0, 0, 0, + : 0, 0, 0, 2, 0, 0, 0, 0, 0, + : 0, 0, 2, 2, 2, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=21,30 ) / + : 2, 0, 0, -2, 0, 0, 0, 0, 0, + : 2, 0, 2, 0, 2, 0, 0, 0, 0, + : 1, 0, 2, -2, 2, 0, 0, 0, 0, + : -1, 0, 2, 0, 1, 0, 0, 0, 0, + : 2, 0, 0, 0, 0, 0, 0, 0, 0, + : 0, 0, 2, 0, 0, 0, 0, 0, 0, + : 0, 1, 0, 0, 1, 0, 0, 0, 0, + : -1, 0, 0, 2, 1, 0, 0, 0, 0, + : 0, 2, 2, -2, 2, 0, 0, 0, 0, + : 0, 0, 2, -2, 0, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=31,40 ) / + : -1, 0, 0, 2, -1, 0, 0, 0, 0, + : 0, 1, 0, 0, -1, 0, 0, 0, 0, + : 0, 2, 0, 0, 0, 0, 0, 0, 0, + : -1, 0, 2, 2, 1, 0, 0, 0, 0, + : 1, 0, 2, 2, 2, 0, 0, 0, 0, + : 0, 1, 2, 0, 2, 0, 0, 0, 0, + : -2, 0, 2, 0, 0, 0, 0, 0, 0, + : 0, 0, 2, 2, 1, 0, 0, 0, 0, + : 0, -1, 2, 0, 2, 0, 0, 0, 0, + : 0, 0, 0, 2, 1, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=41,50 ) / + : 1, 0, 2, -2, 1, 0, 0, 0, 0, + : 2, 0, 0, -2, -1, 0, 0, 0, 0, + : 2, 0, 2, -2, 2, 0, 0, 0, 0, + : 2, 0, 2, 0, 1, 0, 0, 0, 0, + : 0, 0, 0, 2, -1, 0, 0, 0, 0, + : 0, -1, 2, -2, 1, 0, 0, 0, 0, + : -1, -1, 0, 2, 0, 0, 0, 0, 0, + : 2, 0, 0, -2, 1, 0, 0, 0, 0, + : 1, 0, 0, 2, 0, 0, 0, 0, 0, + : 0, 1, 2, -2, 1, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=51,60 ) / + : 1, -1, 0, 0, 0, 0, 0, 0, 0, + : -2, 0, 2, 0, 2, 0, 0, 0, 0, + : 0, -1, 0, 2, 0, 0, 0, 0, 0, + : 3, 0, 2, 0, 2, 0, 0, 0, 0, + : 0, 0, 0, 1, 0, 0, 0, 0, 0, + : 1, -1, 2, 0, 2, 0, 0, 0, 0, + : 1, 0, 0, -1, 0, 0, 0, 0, 0, + : -1, -1, 2, 2, 2, 0, 0, 0, 0, + : -1, 0, 2, 0, 0, 0, 0, 0, 0, + : 2, 0, 0, 0, -1, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=61,70 ) / + : 0, -1, 2, 2, 2, 0, 0, 0, 0, + : 1, 1, 2, 0, 2, 0, 0, 0, 0, + : 2, 0, 0, 0, 1, 0, 0, 0, 0, + : 1, 1, 0, 0, 0, 0, 0, 0, 0, + : 1, 0, -2, 2, -1, 0, 0, 0, 0, + : 1, 0, 2, 0, 0, 0, 0, 0, 0, + : -1, 1, 0, 1, 0, 0, 0, 0, 0, + : 1, 0, 0, 0, 2, 0, 0, 0, 0, + : -1, 0, 1, 0, 1, 0, 0, 0, 0, + : 0, 0, 2, 1, 2, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=71,80 ) / + : -1, 1, 0, 1, 1, 0, 0, 0, 0, + : -1, 0, 2, 4, 2, 0, 0, 0, 0, + : 0, -2, 2, -2, 1, 0, 0, 0, 0, + : 1, 0, 2, 2, 1, 0, 0, 0, 0, + : 1, 0, 0, 0, -2, 0, 0, 0, 0, + : -2, 0, 2, 2, 2, 0, 0, 0, 0, + : 1, 1, 2, -2, 2, 0, 0, 0, 0, + : -2, 0, 2, 4, 2, 0, 0, 0, 0, + : -1, 0, 4, 0, 2, 0, 0, 0, 0, + : 2, 0, 2, -2, 1, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=81,90 ) / + : 1, 0, 0, -1, -1, 0, 0, 0, 0, + : 2, 0, 2, 2, 2, 0, 0, 0, 0, + : 1, 0, 0, 2, 1, 0, 0, 0, 0, + : 3, 0, 0, 0, 0, 0, 0, 0, 0, + : 0, 0, 2, -2, -1, 0, 0, 0, 0, + : 3, 0, 2, -2, 2, 0, 0, 0, 0, + : 0, 0, 4, -2, 2, 0, 0, 0, 0, + : -1, 0, 0, 4, 0, 0, 0, 0, 0, + : 0, 1, 2, 0, 1, 0, 0, 0, 0, + : 0, 0, 2, -2, 3, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=91,100 ) / + : -2, 0, 0, 4, 0, 0, 0, 0, 0, + : -1, -1, 0, 2, 1, 0, 0, 0, 0, + : -2, 0, 2, 0, -1, 0, 0, 0, 0, + : 0, 0, 2, 0, -1, 0, 0, 0, 0, + : 0, -1, 2, 0, 1, 0, 0, 0, 0, + : 0, 1, 0, 0, 2, 0, 0, 0, 0, + : 0, 0, 2, -1, 2, 0, 0, 0, 0, + : 2, 1, 0, -2, 0, 0, 0, 0, 0, + : 0, 0, 2, 4, 2, 0, 0, 0, 0, + : -1, -1, 0, 2, -1, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=101,110 ) / + : -1, 1, 0, 2, 0, 0, 0, 0, 0, + : 1, -1, 0, 0, 1, 0, 0, 0, 0, + : 0, -1, 2, -2, 0, 0, 0, 0, 0, + : 0, 1, 0, 0, -2, 0, 0, 0, 0, + : 1, -1, 2, 2, 2, 0, 0, 0, 0, + : 1, 0, 0, 2, -1, 0, 0, 0, 0, + : -1, 1, 2, 2, 2, 0, 0, 0, 0, + : 3, 0, 2, 0, 1, 0, 0, 0, 0, + : 0, 1, 2, 2, 2, 0, 0, 0, 0, + : 1, 0, 2, -2, 0, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=111,120 ) / + : -1, 0, -2, 4, -1, 0, 0, 0, 0, + : -1, -1, 2, 2, 1, 0, 0, 0, 0, + : 0, -1, 2, 2, 1, 0, 0, 0, 0, + : 2, -1, 2, 0, 2, 0, 0, 0, 0, + : 0, 0, 0, 2, 2, 0, 0, 0, 0, + : 1, -1, 2, 0, 1, 0, 0, 0, 0, + : -1, 1, 2, 0, 2, 0, 0, 0, 0, + : 0, 1, 0, 2, 0, 0, 0, 0, 0, + : 0, 1, 2, -2, 0, 0, 0, 0, 0, + : 0, 3, 2, -2, 2, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=121,130 ) / + : 0, 0, 0, 1, 1, 0, 0, 0, 0, + : -1, 0, 2, 2, 0, 0, 0, 0, 0, + : 2, 1, 2, 0, 2, 0, 0, 0, 0, + : 1, 1, 0, 0, 1, 0, 0, 0, 0, + : 2, 0, 0, 2, 0, 0, 0, 0, 0, + : 1, 1, 2, 0, 1, 0, 0, 0, 0, + : -1, 0, 0, 2, 2, 0, 0, 0, 0, + : 1, 0, -2, 2, 0, 0, 0, 0, 0, + : 0, -1, 0, 2, -1, 0, 0, 0, 0, + : -1, 0, 1, 0, 2, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=131,140 ) / + : 0, 1, 0, 1, 0, 0, 0, 0, 0, + : 1, 0, -2, 2, -2, 0, 0, 0, 0, + : 0, 0, 0, 1, -1, 0, 0, 0, 0, + : 1, -1, 0, 0, -1, 0, 0, 0, 0, + : 0, 0, 0, 4, 0, 0, 0, 0, 0, + : 1, -1, 0, 2, 0, 0, 0, 0, 0, + : 1, 0, 2, 1, 2, 0, 0, 0, 0, + : 1, 0, 2, -1, 2, 0, 0, 0, 0, + : -1, 0, 0, 2, -2, 0, 0, 0, 0, + : 0, 0, 2, 1, 1, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=141,150 ) / + : -1, 0, 2, 0, -1, 0, 0, 0, 0, + : -1, 0, 2, 4, 1, 0, 0, 0, 0, + : 0, 0, 2, 2, 0, 0, 0, 0, 0, + : 1, 1, 2, -2, 1, 0, 0, 0, 0, + : 0, 0, 1, 0, 1, 0, 0, 0, 0, + : -1, 0, 2, -1, 1, 0, 0, 0, 0, + : -2, 0, 2, 2, 1, 0, 0, 0, 0, + : 2, -1, 0, 0, 0, 0, 0, 0, 0, + : 4, 0, 2, 0, 2, 0, 0, 0, 0, + : 2, 1, 2, -2, 2, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=151,160 ) / + : 0, 1, 2, 1, 2, 0, 0, 0, 0, + : 1, 0, 4, -2, 2, 0, 0, 0, 0, + : 1, 1, 0, 0, -1, 0, 0, 0, 0, + : -2, 0, 2, 4, 1, 0, 0, 0, 0, + : 2, 0, 2, 0, 0, 0, 0, 0, 0, + : -1, 0, 1, 0, 0, 0, 0, 0, 0, + : 1, 0, 0, 1, 0, 0, 0, 0, 0, + : 0, 1, 0, 2, 1, 0, 0, 0, 0, + : -1, 0, 4, 0, 1, 0, 0, 0, 0, + : -1, 0, 0, 4, 1, 0, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=161,170 ) / + : 2, 0, 2, 2, 1, 0, 0, 0, 0, + : 2, 1, 0, 0, 0, 0, 0, 0, 0, + : 0, 0, 5, -5, 5, -3, 0, 0, 0, + : 0, 0, 0, 0, 0, 0, 0, 2, 0, + : 0, 0, 1, -1, 1, 0, 0, -1, 0, + : 0, 0, -1, 1, -1, 1, 0, 0, 0, + : 0, 0, -1, 1, 0, 0, 2, 0, 0, + : 0, 0, 3, -3, 3, 0, 0, -1, 0, + : 0, 0, -8, 8, -7, 5, 0, 0, 0, + : 0, 0, -1, 1, -1, 0, 2, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=171,180 ) / + : 0, 0, -2, 2, -2, 2, 0, 0, 0, + : 0, 0, -6, 6, -6, 4, 0, 0, 0, + : 0, 0, -2, 2, -2, 0, 8, -3, 0, + : 0, 0, 6, -6, 6, 0, -8, 3, 0, + : 0, 0, 4, -4, 4, -2, 0, 0, 0, + : 0, 0, -3, 3, -3, 2, 0, 0, 0, + : 0, 0, 4, -4, 3, 0, -8, 3, 0, + : 0, 0, -4, 4, -5, 0, 8, -3, 0, + : 0, 0, 0, 0, 0, 2, 0, 0, 0, + : 0, 0, -4, 4, -4, 3, 0, 0, 0 / + DATA ( ( NA(I,J), I=1,9 ), J=181,190 ) / + : 0, 1, -1, 1, -1, 0, 0, 1, 0, + : 0, 0, 0, 0, 0, 0, 0, 1, 0, + : 0, 0, 1, -1, 1, 1, 0, 0, 0, + : 0, 0, 2, -2, 2, 0, -2, 0, 0, + : 0, -1, -7, 7, -7, 5, 0, 0, 0, + : -2, 0, 2, 0, 2, 0, 0, -2, 0, + : -2, 0, 2, 0, 1, 0, 0, -3, 0, + : 0, 0, 2, -2, 2, 0, 0, -2, 0, + : 0, 0, 1, -1, 1, 0, 0, 1, 0, + : 0, 0, 0, 0, 0, 0, 0, 0, 2 / + DATA ( ( NA(I,J), I=1,9 ), J=191,NTERMS ) / + : 0, 0, 0, 0, 0, 0, 0, 0, 1, + : 2, 0, -2, 0, -2, 0, 0, 3, 0, + : 0, 0, 1, -1, 1, 0, 0, -2, 0, + : 0, 0, -7, 7, -7, 5, 0, 0, 0 / + +* Nutation series: longitude + DATA ( ( PSI(I,J), I=1,4 ), J=1,10 ) / + : 3341.5D0, 17206241.8D0, 3.1D0, 17409.5D0, + : -1716.8D0, -1317185.3D0, 1.4D0, -156.8D0, + : 285.7D0, -227667.0D0, 0.3D0, -23.5D0, + : -68.6D0, -207448.0D0, 0.0D0, -21.4D0, + : 950.3D0, 147607.9D0, -2.3D0, -355.0D0, + : -66.7D0, -51689.1D0, 0.2D0, 122.6D0, + : -108.6D0, 71117.6D0, 0.0D0, 7.0D0, + : 35.6D0, -38740.2D0, 0.1D0, -36.2D0, + : 85.4D0, -30127.6D0, 0.0D0, -3.1D0, + : 9.0D0, 21583.0D0, 0.1D0, -50.3D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=11,20 ) / + : 22.1D0, 12822.8D0, 0.0D0, 13.3D0, + : 3.4D0, 12350.8D0, 0.0D0, 1.3D0, + : -21.1D0, 15699.4D0, 0.0D0, 1.6D0, + : 4.2D0, 6313.8D0, 0.0D0, 6.2D0, + : -22.8D0, 5796.9D0, 0.0D0, 6.1D0, + : 15.7D0, -5961.1D0, 0.0D0, -0.6D0, + : 13.1D0, -5159.1D0, 0.0D0, -4.6D0, + : 1.8D0, 4592.7D0, 0.0D0, 4.5D0, + : -17.5D0, 6336.0D0, 0.0D0, 0.7D0, + : 16.3D0, -3851.1D0, 0.0D0, -0.4D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=21,30 ) / + : -2.8D0, 4771.7D0, 0.0D0, 0.5D0, + : 13.8D0, -3099.3D0, 0.0D0, -0.3D0, + : 0.2D0, 2860.3D0, 0.0D0, 0.3D0, + : 1.4D0, 2045.3D0, 0.0D0, 2.0D0, + : -8.6D0, 2922.6D0, 0.0D0, 0.3D0, + : -7.7D0, 2587.9D0, 0.0D0, 0.2D0, + : 8.8D0, -1408.1D0, 0.0D0, 3.7D0, + : 1.4D0, 1517.5D0, 0.0D0, 1.5D0, + : -1.9D0, -1579.7D0, 0.0D0, 7.7D0, + : 1.3D0, -2178.6D0, 0.0D0, -0.2D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=31,40 ) / + : -4.8D0, 1286.8D0, 0.0D0, 1.3D0, + : 6.3D0, 1267.2D0, 0.0D0, -4.0D0, + : -1.0D0, 1669.3D0, 0.0D0, -8.3D0, + : 2.4D0, -1020.0D0, 0.0D0, -0.9D0, + : 4.5D0, -766.9D0, 0.0D0, 0.0D0, + : -1.1D0, 756.5D0, 0.0D0, -1.7D0, + : -1.4D0, -1097.3D0, 0.0D0, -0.5D0, + : 2.6D0, -663.0D0, 0.0D0, -0.6D0, + : 0.8D0, -714.1D0, 0.0D0, 1.6D0, + : 0.4D0, -629.9D0, 0.0D0, -0.6D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=41,50 ) / + : 0.3D0, 580.4D0, 0.0D0, 0.6D0, + : -1.6D0, 577.3D0, 0.0D0, 0.5D0, + : -0.9D0, 644.4D0, 0.0D0, 0.0D0, + : 2.2D0, -534.0D0, 0.0D0, -0.5D0, + : -2.5D0, 493.3D0, 0.0D0, 0.5D0, + : -0.1D0, -477.3D0, 0.0D0, -2.4D0, + : -0.9D0, 735.0D0, 0.0D0, -1.7D0, + : 0.7D0, 406.2D0, 0.0D0, 0.4D0, + : -2.8D0, 656.9D0, 0.0D0, 0.0D0, + : 0.6D0, 358.0D0, 0.0D0, 2.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=51,60 ) / + : -0.7D0, 472.5D0, 0.0D0, -1.1D0, + : -0.1D0, -300.5D0, 0.0D0, 0.0D0, + : -1.2D0, 435.1D0, 0.0D0, -1.0D0, + : 1.8D0, -289.4D0, 0.0D0, 0.0D0, + : 0.6D0, -422.6D0, 0.0D0, 0.0D0, + : 0.8D0, -287.6D0, 0.0D0, 0.6D0, + : -38.6D0, -392.3D0, 0.0D0, 0.0D0, + : 0.7D0, -281.8D0, 0.0D0, 0.6D0, + : 0.6D0, -405.7D0, 0.0D0, 0.0D0, + : -1.2D0, 229.0D0, 0.0D0, 0.2D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=61,70 ) / + : 1.1D0, -264.3D0, 0.0D0, 0.5D0, + : -0.7D0, 247.9D0, 0.0D0, -0.5D0, + : -0.2D0, 218.0D0, 0.0D0, 0.2D0, + : 0.6D0, -339.0D0, 0.0D0, 0.8D0, + : -0.7D0, 198.7D0, 0.0D0, 0.2D0, + : -1.5D0, 334.0D0, 0.0D0, 0.0D0, + : 0.1D0, 334.0D0, 0.0D0, 0.0D0, + : -0.1D0, -198.1D0, 0.0D0, 0.0D0, + : -106.6D0, 0.0D0, 0.0D0, 0.0D0, + : -0.5D0, 165.8D0, 0.0D0, 0.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=71,80 ) / + : 0.0D0, 134.8D0, 0.0D0, 0.0D0, + : 0.9D0, -151.6D0, 0.0D0, 0.0D0, + : 0.0D0, -129.7D0, 0.0D0, 0.0D0, + : 0.8D0, -132.8D0, 0.0D0, -0.1D0, + : 0.5D0, -140.7D0, 0.0D0, 0.0D0, + : -0.1D0, 138.4D0, 0.0D0, 0.0D0, + : 0.0D0, 129.0D0, 0.0D0, -0.3D0, + : 0.5D0, -121.2D0, 0.0D0, 0.0D0, + : -0.3D0, 114.5D0, 0.0D0, 0.0D0, + : -0.1D0, 101.8D0, 0.0D0, 0.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=81,90 ) / + : -3.6D0, -101.9D0, 0.0D0, 0.0D0, + : 0.8D0, -109.4D0, 0.0D0, 0.0D0, + : 0.2D0, -97.0D0, 0.0D0, 0.0D0, + : -0.7D0, 157.3D0, 0.0D0, 0.0D0, + : 0.2D0, -83.3D0, 0.0D0, 0.0D0, + : -0.3D0, 93.3D0, 0.0D0, 0.0D0, + : -0.1D0, 92.1D0, 0.0D0, 0.0D0, + : -0.5D0, 133.6D0, 0.0D0, 0.0D0, + : -0.1D0, 81.5D0, 0.0D0, 0.0D0, + : 0.0D0, 123.9D0, 0.0D0, 0.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=91,100 ) / + : -0.3D0, 128.1D0, 0.0D0, 0.0D0, + : 0.1D0, 74.1D0, 0.0D0, -0.3D0, + : -0.2D0, -70.3D0, 0.0D0, 0.0D0, + : -0.4D0, 66.6D0, 0.0D0, 0.0D0, + : 0.1D0, -66.7D0, 0.0D0, 0.0D0, + : -0.7D0, 69.3D0, 0.0D0, -0.3D0, + : 0.0D0, -70.4D0, 0.0D0, 0.0D0, + : -0.1D0, 101.5D0, 0.0D0, 0.0D0, + : 0.5D0, -69.1D0, 0.0D0, 0.0D0, + : -0.2D0, 58.5D0, 0.0D0, 0.2D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=101,110 ) / + : 0.1D0, -94.9D0, 0.0D0, 0.2D0, + : 0.0D0, 52.9D0, 0.0D0, -0.2D0, + : 0.1D0, 86.7D0, 0.0D0, -0.2D0, + : -0.1D0, -59.2D0, 0.0D0, 0.2D0, + : 0.3D0, -58.8D0, 0.0D0, 0.1D0, + : -0.3D0, 49.0D0, 0.0D0, 0.0D0, + : -0.2D0, 56.9D0, 0.0D0, -0.1D0, + : 0.3D0, -50.2D0, 0.0D0, 0.0D0, + : -0.2D0, 53.4D0, 0.0D0, -0.1D0, + : 0.1D0, -76.5D0, 0.0D0, 0.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=111,120 ) / + : -0.2D0, 45.3D0, 0.0D0, 0.0D0, + : 0.1D0, -46.8D0, 0.0D0, 0.0D0, + : 0.2D0, -44.6D0, 0.0D0, 0.0D0, + : 0.2D0, -48.7D0, 0.0D0, 0.0D0, + : 0.1D0, -46.8D0, 0.0D0, 0.0D0, + : 0.1D0, -42.0D0, 0.0D0, 0.0D0, + : 0.0D0, 46.4D0, 0.0D0, -0.1D0, + : 0.2D0, -67.3D0, 0.0D0, 0.1D0, + : 0.0D0, -65.8D0, 0.0D0, 0.2D0, + : -0.1D0, -43.9D0, 0.0D0, 0.3D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=121,130 ) / + : 0.0D0, -38.9D0, 0.0D0, 0.0D0, + : -0.3D0, 63.9D0, 0.0D0, 0.0D0, + : -0.2D0, 41.2D0, 0.0D0, 0.0D0, + : 0.0D0, -36.1D0, 0.0D0, 0.2D0, + : -0.3D0, 58.5D0, 0.0D0, 0.0D0, + : -0.1D0, 36.1D0, 0.0D0, 0.0D0, + : 0.0D0, -39.7D0, 0.0D0, 0.0D0, + : 0.1D0, -57.7D0, 0.0D0, 0.0D0, + : -0.2D0, 33.4D0, 0.0D0, 0.0D0, + : 36.4D0, 0.0D0, 0.0D0, 0.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=131,140 ) / + : -0.1D0, 55.7D0, 0.0D0, -0.1D0, + : 0.1D0, -35.4D0, 0.0D0, 0.0D0, + : 0.1D0, -31.0D0, 0.0D0, 0.0D0, + : -0.1D0, 30.1D0, 0.0D0, 0.0D0, + : -0.3D0, 49.2D0, 0.0D0, 0.0D0, + : -0.2D0, 49.1D0, 0.0D0, 0.0D0, + : -0.1D0, 33.6D0, 0.0D0, 0.0D0, + : 0.1D0, -33.5D0, 0.0D0, 0.0D0, + : 0.1D0, -31.0D0, 0.0D0, 0.0D0, + : -0.1D0, 28.0D0, 0.0D0, 0.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=141,150 ) / + : 0.1D0, -25.2D0, 0.0D0, 0.0D0, + : 0.1D0, -26.2D0, 0.0D0, 0.0D0, + : -0.2D0, 41.5D0, 0.0D0, 0.0D0, + : 0.0D0, 24.5D0, 0.0D0, 0.1D0, + : -16.2D0, 0.0D0, 0.0D0, 0.0D0, + : 0.0D0, -22.3D0, 0.0D0, 0.0D0, + : 0.0D0, 23.1D0, 0.0D0, 0.0D0, + : -0.1D0, 37.5D0, 0.0D0, 0.0D0, + : 0.2D0, -25.7D0, 0.0D0, 0.0D0, + : 0.0D0, 25.2D0, 0.0D0, 0.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=151,160 ) / + : 0.1D0, -24.5D0, 0.0D0, 0.0D0, + : -0.1D0, 24.3D0, 0.0D0, 0.0D0, + : 0.1D0, -20.7D0, 0.0D0, 0.0D0, + : 0.1D0, -20.8D0, 0.0D0, 0.0D0, + : -0.2D0, 33.4D0, 0.0D0, 0.0D0, + : 32.9D0, 0.0D0, 0.0D0, 0.0D0, + : 0.1D0, -32.6D0, 0.0D0, 0.0D0, + : 0.0D0, 19.9D0, 0.0D0, 0.0D0, + : -0.1D0, 19.6D0, 0.0D0, 0.0D0, + : 0.0D0, -18.7D0, 0.0D0, 0.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=161,170 ) / + : 0.1D0, -19.0D0, 0.0D0, 0.0D0, + : 0.1D0, -28.6D0, 0.0D0, 0.0D0, + : 4.0D0, 178.8D0,-11.8D0, 0.3D0, + : 39.8D0, -107.3D0, -5.6D0, -1.0D0, + : 9.9D0, 164.0D0, -4.1D0, 0.1D0, + : -4.8D0, -135.3D0, -3.4D0, -0.1D0, + : 50.5D0, 75.0D0, 1.4D0, -1.2D0, + : -1.1D0, -53.5D0, 1.3D0, 0.0D0, + : -45.0D0, -2.4D0, -0.4D0, 6.6D0, + : -11.5D0, -61.0D0, -0.9D0, 0.4D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=171,180 ) / + : 4.4D0, -68.4D0, -3.4D0, 0.0D0, + : 7.7D0, -47.1D0, -4.7D0, -1.0D0, + : -42.9D0, -12.6D0, -1.2D0, 4.2D0, + : -42.8D0, 12.7D0, -1.2D0, -4.2D0, + : -7.6D0, -44.1D0, 2.1D0, -0.5D0, + : -64.1D0, 1.7D0, 0.2D0, 4.5D0, + : 36.4D0, -10.4D0, 1.0D0, 3.5D0, + : 35.6D0, 10.2D0, 1.0D0, -3.5D0, + : -1.7D0, 39.5D0, 2.0D0, 0.0D0, + : 50.9D0, -8.2D0, -0.8D0, -5.0D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=181,190 ) / + : 0.0D0, 52.3D0, 1.2D0, 0.0D0, + : -42.9D0, -17.8D0, 0.4D0, 0.0D0, + : 2.6D0, 34.3D0, 0.8D0, 0.0D0, + : -0.8D0, -48.6D0, 2.4D0, -0.1D0, + : -4.9D0, 30.5D0, 3.7D0, 0.7D0, + : 0.0D0, -43.6D0, 2.1D0, 0.0D0, + : 0.0D0, -25.4D0, 1.2D0, 0.0D0, + : 2.0D0, 40.9D0, -2.0D0, 0.0D0, + : -2.1D0, 26.1D0, 0.6D0, 0.0D0, + : 22.6D0, -3.2D0, -0.5D0, -0.5D0 / + DATA ( ( PSI(I,J), I=1,4 ), J=191,NTERMS ) / + : -7.6D0, 24.9D0, -0.4D0, -0.2D0, + : -6.2D0, 34.9D0, 1.7D0, 0.3D0, + : 2.0D0, 17.4D0, -0.4D0, 0.1D0, + : -3.9D0, 20.5D0, 2.4D0, 0.6D0 / + +* Nutation series: obliquity + DATA ( ( EPS(I,J), I=1,4 ), J=1,10 ) / + : 9205365.8D0, -1506.2D0, 885.7D0, -0.2D0, + : 573095.9D0, -570.2D0, -305.0D0, -0.3D0, + : 97845.5D0, 147.8D0, -48.8D0, -0.2D0, + : -89753.6D0, 28.0D0, 46.9D0, 0.0D0, + : 7406.7D0, -327.1D0, -18.2D0, 0.8D0, + : 22442.3D0, -22.3D0, -67.6D0, 0.0D0, + : -683.6D0, 46.8D0, 0.0D0, 0.0D0, + : 20070.7D0, 36.0D0, 1.6D0, 0.0D0, + : 12893.8D0, 39.5D0, -6.2D0, 0.0D0, + : -9593.2D0, 14.4D0, 30.2D0, -0.1D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=11,20 ) / + : -6899.5D0, 4.8D0, -0.6D0, 0.0D0, + : -5332.5D0, -0.1D0, 2.7D0, 0.0D0, + : -125.2D0, 10.5D0, 0.0D0, 0.0D0, + : -3323.4D0, -0.9D0, -0.3D0, 0.0D0, + : 3142.3D0, 8.9D0, 0.3D0, 0.0D0, + : 2552.5D0, 7.3D0, -1.2D0, 0.0D0, + : 2634.4D0, 8.8D0, 0.2D0, 0.0D0, + : -2424.4D0, 1.6D0, -0.4D0, 0.0D0, + : -123.3D0, 3.9D0, 0.0D0, 0.0D0, + : 1642.4D0, 7.3D0, -0.8D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=21,30 ) / + : 47.9D0, 3.2D0, 0.0D0, 0.0D0, + : 1321.2D0, 6.2D0, -0.6D0, 0.0D0, + : -1234.1D0, -0.3D0, 0.6D0, 0.0D0, + : -1076.5D0, -0.3D0, 0.0D0, 0.0D0, + : -61.6D0, 1.8D0, 0.0D0, 0.0D0, + : -55.4D0, 1.6D0, 0.0D0, 0.0D0, + : 856.9D0, -4.9D0, -2.1D0, 0.0D0, + : -800.7D0, -0.1D0, 0.0D0, 0.0D0, + : 685.1D0, -0.6D0, -3.8D0, 0.0D0, + : -16.9D0, -1.5D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=31,40 ) / + : 695.7D0, 1.8D0, 0.0D0, 0.0D0, + : 642.2D0, -2.6D0, -1.6D0, 0.0D0, + : 13.3D0, 1.1D0, -0.1D0, 0.0D0, + : 521.9D0, 1.6D0, 0.0D0, 0.0D0, + : 325.8D0, 2.0D0, -0.1D0, 0.0D0, + : -325.1D0, -0.5D0, 0.9D0, 0.0D0, + : 10.1D0, 0.3D0, 0.0D0, 0.0D0, + : 334.5D0, 1.6D0, 0.0D0, 0.0D0, + : 307.1D0, 0.4D0, -0.9D0, 0.0D0, + : 327.2D0, 0.5D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=41,50 ) / + : -304.6D0, -0.1D0, 0.0D0, 0.0D0, + : 304.0D0, 0.6D0, 0.0D0, 0.0D0, + : -276.8D0, -0.5D0, 0.1D0, 0.0D0, + : 268.9D0, 1.3D0, 0.0D0, 0.0D0, + : 271.8D0, 1.1D0, 0.0D0, 0.0D0, + : 271.5D0, -0.4D0, -0.8D0, 0.0D0, + : -5.2D0, 0.5D0, 0.0D0, 0.0D0, + : -220.5D0, 0.1D0, 0.0D0, 0.0D0, + : -20.1D0, 0.3D0, 0.0D0, 0.0D0, + : -191.0D0, 0.1D0, 0.5D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=51,60 ) / + : -4.1D0, 0.3D0, 0.0D0, 0.0D0, + : 130.6D0, -0.1D0, 0.0D0, 0.0D0, + : 3.0D0, 0.3D0, 0.0D0, 0.0D0, + : 122.9D0, 0.8D0, 0.0D0, 0.0D0, + : 3.7D0, -0.3D0, 0.0D0, 0.0D0, + : 123.1D0, 0.4D0, -0.3D0, 0.0D0, + : -52.7D0, 15.3D0, 0.0D0, 0.0D0, + : 120.7D0, 0.3D0, -0.3D0, 0.0D0, + : 4.0D0, -0.3D0, 0.0D0, 0.0D0, + : 126.5D0, 0.5D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=61,70 ) / + : 112.7D0, 0.5D0, -0.3D0, 0.0D0, + : -106.1D0, -0.3D0, 0.3D0, 0.0D0, + : -112.9D0, -0.2D0, 0.0D0, 0.0D0, + : 3.6D0, -0.2D0, 0.0D0, 0.0D0, + : 107.4D0, 0.3D0, 0.0D0, 0.0D0, + : -10.9D0, 0.2D0, 0.0D0, 0.0D0, + : -0.9D0, 0.0D0, 0.0D0, 0.0D0, + : 85.4D0, 0.0D0, 0.0D0, 0.0D0, + : 0.0D0, -88.8D0, 0.0D0, 0.0D0, + : -71.0D0, -0.2D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=71,80 ) / + : -70.3D0, 0.0D0, 0.0D0, 0.0D0, + : 64.5D0, 0.4D0, 0.0D0, 0.0D0, + : 69.8D0, 0.0D0, 0.0D0, 0.0D0, + : 66.1D0, 0.4D0, 0.0D0, 0.0D0, + : -61.0D0, -0.2D0, 0.0D0, 0.0D0, + : -59.5D0, -0.1D0, 0.0D0, 0.0D0, + : -55.6D0, 0.0D0, 0.2D0, 0.0D0, + : 51.7D0, 0.2D0, 0.0D0, 0.0D0, + : -49.0D0, -0.1D0, 0.0D0, 0.0D0, + : -52.7D0, -0.1D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=81,90 ) / + : -49.6D0, 1.4D0, 0.0D0, 0.0D0, + : 46.3D0, 0.4D0, 0.0D0, 0.0D0, + : 49.6D0, 0.1D0, 0.0D0, 0.0D0, + : -5.1D0, 0.1D0, 0.0D0, 0.0D0, + : -44.0D0, -0.1D0, 0.0D0, 0.0D0, + : -39.9D0, -0.1D0, 0.0D0, 0.0D0, + : -39.5D0, -0.1D0, 0.0D0, 0.0D0, + : -3.9D0, 0.1D0, 0.0D0, 0.0D0, + : -42.1D0, -0.1D0, 0.0D0, 0.0D0, + : -17.2D0, 0.1D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=91,100 ) / + : -2.3D0, 0.1D0, 0.0D0, 0.0D0, + : -39.2D0, 0.0D0, 0.0D0, 0.0D0, + : -38.4D0, 0.1D0, 0.0D0, 0.0D0, + : 36.8D0, 0.2D0, 0.0D0, 0.0D0, + : 34.6D0, 0.1D0, 0.0D0, 0.0D0, + : -32.7D0, 0.3D0, 0.0D0, 0.0D0, + : 30.4D0, 0.0D0, 0.0D0, 0.0D0, + : 0.4D0, 0.1D0, 0.0D0, 0.0D0, + : 29.3D0, 0.2D0, 0.0D0, 0.0D0, + : 31.6D0, 0.1D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=101,110 ) / + : 0.8D0, -0.1D0, 0.0D0, 0.0D0, + : -27.9D0, 0.0D0, 0.0D0, 0.0D0, + : 2.9D0, 0.0D0, 0.0D0, 0.0D0, + : -25.3D0, 0.0D0, 0.0D0, 0.0D0, + : 25.0D0, 0.1D0, 0.0D0, 0.0D0, + : 27.5D0, 0.1D0, 0.0D0, 0.0D0, + : -24.4D0, -0.1D0, 0.0D0, 0.0D0, + : 24.9D0, 0.2D0, 0.0D0, 0.0D0, + : -22.8D0, -0.1D0, 0.0D0, 0.0D0, + : 0.9D0, -0.1D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=111,120 ) / + : 24.4D0, 0.1D0, 0.0D0, 0.0D0, + : 23.9D0, 0.1D0, 0.0D0, 0.0D0, + : 22.5D0, 0.1D0, 0.0D0, 0.0D0, + : 20.8D0, 0.1D0, 0.0D0, 0.0D0, + : 20.1D0, 0.0D0, 0.0D0, 0.0D0, + : 21.5D0, 0.1D0, 0.0D0, 0.0D0, + : -20.0D0, 0.0D0, 0.0D0, 0.0D0, + : 1.4D0, 0.0D0, 0.0D0, 0.0D0, + : -0.2D0, -0.1D0, 0.0D0, 0.0D0, + : 19.0D0, 0.0D0, -0.1D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=121,130 ) / + : 20.5D0, 0.0D0, 0.0D0, 0.0D0, + : -2.0D0, 0.0D0, 0.0D0, 0.0D0, + : -17.6D0, -0.1D0, 0.0D0, 0.0D0, + : 19.0D0, 0.0D0, 0.0D0, 0.0D0, + : -2.4D0, 0.0D0, 0.0D0, 0.0D0, + : -18.4D0, -0.1D0, 0.0D0, 0.0D0, + : 17.1D0, 0.0D0, 0.0D0, 0.0D0, + : 0.4D0, 0.0D0, 0.0D0, 0.0D0, + : 18.4D0, 0.1D0, 0.0D0, 0.0D0, + : 0.0D0, 17.4D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=131,140 ) / + : -0.6D0, 0.0D0, 0.0D0, 0.0D0, + : -15.4D0, 0.0D0, 0.0D0, 0.0D0, + : -16.8D0, -0.1D0, 0.0D0, 0.0D0, + : 16.3D0, 0.0D0, 0.0D0, 0.0D0, + : -2.0D0, 0.0D0, 0.0D0, 0.0D0, + : -1.5D0, 0.0D0, 0.0D0, 0.0D0, + : -14.3D0, -0.1D0, 0.0D0, 0.0D0, + : 14.4D0, 0.0D0, 0.0D0, 0.0D0, + : -13.4D0, 0.0D0, 0.0D0, 0.0D0, + : -14.3D0, -0.1D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=141,150 ) / + : -13.7D0, 0.0D0, 0.0D0, 0.0D0, + : 13.1D0, 0.1D0, 0.0D0, 0.0D0, + : -1.7D0, 0.0D0, 0.0D0, 0.0D0, + : -12.8D0, 0.0D0, 0.0D0, 0.0D0, + : 0.0D0, -14.4D0, 0.0D0, 0.0D0, + : 12.4D0, 0.0D0, 0.0D0, 0.0D0, + : -12.0D0, 0.0D0, 0.0D0, 0.0D0, + : -0.8D0, 0.0D0, 0.0D0, 0.0D0, + : 10.9D0, 0.1D0, 0.0D0, 0.0D0, + : -10.8D0, 0.0D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=151,160 ) / + : 10.5D0, 0.0D0, 0.0D0, 0.0D0, + : -10.4D0, 0.0D0, 0.0D0, 0.0D0, + : -11.2D0, 0.0D0, 0.0D0, 0.0D0, + : 10.5D0, 0.1D0, 0.0D0, 0.0D0, + : -1.4D0, 0.0D0, 0.0D0, 0.0D0, + : 0.0D0, 0.1D0, 0.0D0, 0.0D0, + : 0.7D0, 0.0D0, 0.0D0, 0.0D0, + : -10.3D0, 0.0D0, 0.0D0, 0.0D0, + : -10.0D0, 0.0D0, 0.0D0, 0.0D0, + : 9.6D0, 0.0D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=161,170 ) / + : 9.4D0, 0.1D0, 0.0D0, 0.0D0, + : 0.6D0, 0.0D0, 0.0D0, 0.0D0, + : -87.7D0, 4.4D0, -0.4D0, -6.3D0, + : 46.3D0, 22.4D0, 0.5D0, -2.4D0, + : 15.6D0, -3.4D0, 0.1D0, 0.4D0, + : 5.2D0, 5.8D0, 0.2D0, -0.1D0, + : -30.1D0, 26.9D0, 0.7D0, 0.0D0, + : 23.2D0, -0.5D0, 0.0D0, 0.6D0, + : 1.0D0, 23.2D0, 3.4D0, 0.0D0, + : -12.2D0, -4.3D0, 0.0D0, 0.0D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=171,180 ) / + : -2.1D0, -3.7D0, -0.2D0, 0.1D0, + : -18.6D0, -3.8D0, -0.4D0, 1.8D0, + : 5.5D0, -18.7D0, -1.8D0, -0.5D0, + : -5.5D0, -18.7D0, 1.8D0, -0.5D0, + : 18.4D0, -3.6D0, 0.3D0, 0.9D0, + : -0.6D0, 1.3D0, 0.0D0, 0.0D0, + : -5.6D0, -19.5D0, 1.9D0, 0.0D0, + : 5.5D0, -19.1D0, -1.9D0, 0.0D0, + : -17.3D0, -0.8D0, 0.0D0, 0.9D0, + : -3.2D0, -8.3D0, -0.8D0, 0.3D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=181,190 ) / + : -0.1D0, 0.0D0, 0.0D0, 0.0D0, + : -5.4D0, 7.8D0, -0.3D0, 0.0D0, + : -14.8D0, 1.4D0, 0.0D0, 0.3D0, + : -3.8D0, 0.4D0, 0.0D0, -0.2D0, + : 12.6D0, 3.2D0, 0.5D0, -1.5D0, + : 0.1D0, 0.0D0, 0.0D0, 0.0D0, + : -13.6D0, 2.4D0, -0.1D0, 0.0D0, + : 0.9D0, 1.2D0, 0.0D0, 0.0D0, + : -11.9D0, -0.5D0, 0.0D0, 0.3D0, + : 0.4D0, 12.0D0, 0.3D0, -0.2D0 / + DATA ( ( EPS(I,J), I=1,4 ), J=191,NTERMS ) / + : 8.3D0, 6.1D0, -0.1D0, 0.1D0, + : 0.0D0, 0.0D0, 0.0D0, 0.0D0, + : 0.4D0, -10.8D0, 0.3D0, 0.0D0, + : 9.6D0, 2.2D0, 0.3D0, -1.2D0 / + + + +* Interval between fundamental epoch J2000.0 and given epoch (JC). + T = (DATE-DJM0)/DJC + +* Mean anomaly of the Moon. + EL = 134.96340251D0*DD2R+ + : MOD(T*(1717915923.2178D0+ + : T*( 31.8792D0+ + : T*( 0.051635D0+ + : T*( - 0.00024470D0)))),TURNAS)*DAS2R + +* Mean anomaly of the Sun. + ELP = 357.52910918D0*DD2R+ + : MOD(T*( 129596581.0481D0+ + : T*( - 0.5532D0+ + : T*( 0.000136D0+ + : T*( - 0.00001149D0)))),TURNAS)*DAS2R + +* Mean argument of the latitude of the Moon. + F = 93.27209062D0*DD2R+ + : MOD(T*(1739527262.8478D0+ + : T*( - 12.7512D0+ + : T*( - 0.001037D0+ + : T*( 0.00000417D0)))),TURNAS)*DAS2R + +* Mean elongation of the Moon from the Sun. + D = 297.85019547D0*DD2R+ + : MOD(T*(1602961601.2090D0+ + : T*( - 6.3706D0+ + : T*( 0.006539D0+ + : T*( - 0.00003169D0)))),TURNAS)*DAS2R + +* Mean longitude of the ascending node of the Moon. + OM = 125.04455501D0*DD2R+ + : MOD(T*( - 6962890.5431D0+ + : T*( 7.4722D0+ + : T*( 0.007702D0+ + : T*( - 0.00005939D0)))),TURNAS)*DAS2R + +* Mean longitude of Venus. + VE = 181.97980085D0*DD2R+MOD(210664136.433548D0*T,TURNAS)*DAS2R + +* Mean longitude of Mars. + MA = 355.43299958D0*DD2R+MOD( 68905077.493988D0*T,TURNAS)*DAS2R + +* Mean longitude of Jupiter. + JU = 34.35151874D0*DD2R+MOD( 10925660.377991D0*T,TURNAS)*DAS2R + +* Mean longitude of Saturn. + SA = 50.07744430D0*DD2R+MOD( 4399609.855732D0*T,TURNAS)*DAS2R + +* Geodesic nutation (Fukushima 1991) in microarcsec. + DP = -153.1D0*SIN(ELP)-1.9D0*SIN(2D0*ELP) + DE = 0D0 + +* Shirai & Fukushima (2001) nutation series. + DO J=NTERMS,1,-1 + THETA = DBLE(NA(1,J))*EL+ + : DBLE(NA(2,J))*ELP+ + : DBLE(NA(3,J))*F+ + : DBLE(NA(4,J))*D+ + : DBLE(NA(5,J))*OM+ + : DBLE(NA(6,J))*VE+ + : DBLE(NA(7,J))*MA+ + : DBLE(NA(8,J))*JU+ + : DBLE(NA(9,J))*SA + C = COS(THETA) + S = SIN(THETA) + DP = DP+(PSI(1,J)+PSI(3,J)*T)*C+(PSI(2,J)+PSI(4,J)*T)*S + DE = DE+(EPS(1,J)+EPS(3,J)*T)*C+(EPS(2,J)+EPS(4,J)*T)*S + END DO + +* Change of units, and addition of the precession correction. + DPSI = (DP*1D-6-0.042888D0-0.29856D0*T)*DAS2R + DEPS = (DE*1D-6-0.005171D0-0.02408D0*T)*DAS2R + +* Mean obliquity of date (Simon et al. 1994). + EPS0 = (84381.412D0+ + : (-46.80927D0+ + : (-0.000152D0+ + : (0.0019989D0+ + : (-0.00000051D0+ + : (-0.000000025D0)*T)*T)*T)*T)*T)*DAS2R + + END diff --git a/math/slalib/nutc80.f b/math/slalib/nutc80.f new file mode 100644 index 00000000..4d27e331 --- /dev/null +++ b/math/slalib/nutc80.f @@ -0,0 +1,476 @@ + SUBROUTINE slNUTC80 (DATE, DPSI, DEPS, EPS0) +*+ +* - - - - - - - +* N U T C 8 0 +* - - - - - - - +* +* Nutation: longitude & obliquity components and mean obliquity, +* using the IAU 1980 theory (double precision) +* +* Given: +* DATE d TDB (loosely ET) as Modified Julian Date +* (JD-2400000.5) +* Returned: +* DPSI,DEPS d nutation in longitude,obliquity +* EPS0 d mean obliquity +* +* Called: slDA1P +* +* Notes: +* +* 1 Earth attitude predictions made by combining the present nutation +* model with IAU 1976 precession are accurate to 0.35 arcsec over +* the interval 1900-2100. (The accuracy is much better near the +* middle of the interval.) +* +* 2 The slNUTC routine is the equivalent of the present routine +* but using the Shirai & Fukushima 2001 forced nutation theory +* (SF2001). The newer theory is more accurate than IAU 1980, +* within 1 mas (with respect to the ICRF) for a few decades around +* 2000. The improvement is mainly because of the corrections to the +* IAU 1976 precession that the SF2001 theory includes. +* +* References: +* Final report of the IAU Working Group on Nutation, +* chairman P.K.Seidelmann, 1980. +* Kaplan,G.H., 1981, USNO circular no. 163, pA3-6. +* +* P.T.Wallace Starlink 7 October 2001 +* +* Copyright (C) 2001 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,DPSI,DEPS,EPS0 + + DOUBLE PRECISION T2AS,AS2R,U2R + DOUBLE PRECISION T,EL,EL2,EL3 + DOUBLE PRECISION ELP,ELP2 + DOUBLE PRECISION F,F2,F4 + DOUBLE PRECISION D,D2,D4 + DOUBLE PRECISION OM,OM2 + DOUBLE PRECISION DP,DE + DOUBLE PRECISION A + + DOUBLE PRECISION slDA1P + + +* Turns to arc seconds + PARAMETER (T2AS=1296000D0) +* Arc seconds to radians + PARAMETER (AS2R=0.484813681109535994D-5) +* Units of 0.0001 arcsec to radians + PARAMETER (U2R=AS2R/1D4) + + + + +* Interval between basic epoch J2000.0 and current epoch (JC) + T=(DATE-51544.5D0)/36525D0 + +* +* FUNDAMENTAL ARGUMENTS in the FK5 reference system +* + +* Mean longitude of the Moon minus mean longitude of the Moon's perigee + EL=slDA1P(AS2R*(485866.733D0+(1325D0*T2AS+715922.633D0 + : +(31.310D0+0.064D0*T)*T)*T)) + +* Mean longitude of the Sun minus mean longitude of the Sun's perigee + ELP=slDA1P(AS2R*(1287099.804D0+(99D0*T2AS+1292581.224D0 + : +(-0.577D0-0.012D0*T)*T)*T)) + +* Mean longitude of the Moon minus mean longitude of the Moon's node + F=slDA1P(AS2R*(335778.877D0+(1342D0*T2AS+295263.137D0 + : +(-13.257D0+0.011D0*T)*T)*T)) + +* Mean elongation of the Moon from the Sun + D=slDA1P(AS2R*(1072261.307D0+(1236D0*T2AS+1105601.328D0 + : +(-6.891D0+0.019D0*T)*T)*T)) + +* Longitude of the mean ascending node of the lunar orbit on the +* ecliptic, measured from the mean equinox of date + OM=slDA1P(AS2R*(450160.280D0+(-5D0*T2AS-482890.539D0 + : +(7.455D0+0.008D0*T)*T)*T)) + +* Multiples of arguments + EL2=EL+EL + EL3=EL2+EL + ELP2=ELP+ELP + F2=F+F + F4=F2+F2 + D2=D+D + D4=D2+D2 + OM2=OM+OM + + +* +* SERIES FOR THE NUTATION +* + DP=0D0 + DE=0D0 + +* 106 + DP=DP+SIN(ELP+D) +* 105 + DP=DP-SIN(F2+D4+OM2) +* 104 + DP=DP+SIN(EL2+D2) +* 103 + DP=DP-SIN(EL-F2+D2) +* 102 + DP=DP-SIN(EL+ELP-D2+OM) +* 101 + DP=DP-SIN(-ELP+F2+OM) +* 100 + DP=DP-SIN(EL-F2-D2) +* 99 + DP=DP-SIN(ELP+D2) +* 98 + DP=DP-SIN(F2-D+OM2) +* 97 + DP=DP-SIN(-F2+OM) +* 96 + DP=DP+SIN(-EL-ELP+D2+OM) +* 95 + DP=DP+SIN(ELP+F2+OM) +* 94 + DP=DP-SIN(EL+F2-D2) +* 93 + DP=DP+SIN(EL3+F2-D2+OM2) +* 92 + DP=DP+SIN(F4-D2+OM2) +* 91 + DP=DP-SIN(EL+D2+OM) +* 90 + DP=DP-SIN(EL2+F2+D2+OM2) +* 89 + A=EL2+F2-D2+OM + DP=DP+SIN(A) + DE=DE-COS(A) +* 88 + DP=DP+SIN(EL-ELP-D2) +* 87 + DP=DP+SIN(-EL+F4+OM2) +* 86 + A=-EL2+F2+D4+OM2 + DP=DP-SIN(A) + DE=DE+COS(A) +* 85 + A=EL+F2+D2+OM + DP=DP-SIN(A) + DE=DE+COS(A) +* 84 + A=EL+ELP+F2-D2+OM2 + DP=DP+SIN(A) + DE=DE-COS(A) +* 83 + DP=DP-SIN(EL2-D4) +* 82 + A=-EL+F2+D4+OM2 + DP=DP-2D0*SIN(A) + DE=DE+COS(A) +* 81 + A=-EL2+F2+D2+OM2 + DP=DP+SIN(A) + DE=DE-COS(A) +* 80 + DP=DP-SIN(EL-D4) +* 79 + A=-EL+OM2 + DP=DP+SIN(A) + DE=DE-COS(A) +* 78 + A=F2+D+OM2 + DP=DP+2D0*SIN(A) + DE=DE-COS(A) +* 77 + DP=DP+2D0*SIN(EL3) +* 76 + A=EL+OM2 + DP=DP-2D0*SIN(A) + DE=DE+COS(A) +* 75 + A=EL2+OM + DP=DP+2D0*SIN(A) + DE=DE-COS(A) +* 74 + A=-EL+F2-D2+OM + DP=DP-2D0*SIN(A) + DE=DE+COS(A) +* 73 + A=EL+ELP+F2+OM2 + DP=DP+2D0*SIN(A) + DE=DE-COS(A) +* 72 + A=-ELP+F2+D2+OM2 + DP=DP-3D0*SIN(A) + DE=DE+COS(A) +* 71 + A=EL3+F2+OM2 + DP=DP-3D0*SIN(A) + DE=DE+COS(A) +* 70 + A=-EL2+OM + DP=DP-2D0*SIN(A) + DE=DE+COS(A) +* 69 + A=-EL-ELP+F2+D2+OM2 + DP=DP-3D0*SIN(A) + DE=DE+COS(A) +* 68 + A=EL-ELP+F2+OM2 + DP=DP-3D0*SIN(A) + DE=DE+COS(A) +* 67 + DP=DP+3D0*SIN(EL+F2) +* 66 + DP=DP-3D0*SIN(EL+ELP) +* 65 + DP=DP-4D0*SIN(D) +* 64 + DP=DP+4D0*SIN(EL-F2) +* 63 + DP=DP-4D0*SIN(ELP-D2) +* 62 + A=EL2+F2+OM + DP=DP-5D0*SIN(A) + DE=DE+3D0*COS(A) +* 61 + DP=DP+5D0*SIN(EL-ELP) +* 60 + A=-D2+OM + DP=DP-5D0*SIN(A) + DE=DE+3D0*COS(A) +* 59 + A=EL+F2-D2+OM + DP=DP+6D0*SIN(A) + DE=DE-3D0*COS(A) +* 58 + A=F2+D2+OM + DP=DP-7D0*SIN(A) + DE=DE+3D0*COS(A) +* 57 + A=D2+OM + DP=DP-6D0*SIN(A) + DE=DE+3D0*COS(A) +* 56 + A=EL2+F2-D2+OM2 + DP=DP+6D0*SIN(A) + DE=DE-3D0*COS(A) +* 55 + DP=DP+6D0*SIN(EL+D2) +* 54 + A=EL+F2+D2+OM2 + DP=DP-8D0*SIN(A) + DE=DE+3D0*COS(A) +* 53 + A=-ELP+F2+OM2 + DP=DP-7D0*SIN(A) + DE=DE+3D0*COS(A) +* 52 + A=ELP+F2+OM2 + DP=DP+7D0*SIN(A) + DE=DE-3D0*COS(A) +* 51 + DP=DP-7D0*SIN(EL+ELP-D2) +* 50 + A=-EL+F2+D2+OM + DP=DP-10D0*SIN(A) + DE=DE+5D0*COS(A) +* 49 + A=EL-D2+OM + DP=DP-13D0*SIN(A) + DE=DE+7D0*COS(A) +* 48 + A=-EL+D2+OM + DP=DP+16D0*SIN(A) + DE=DE-8D0*COS(A) +* 47 + A=-EL+F2+OM + DP=DP+21D0*SIN(A) + DE=DE-10D0*COS(A) +* 46 + DP=DP+26D0*SIN(F2) + DE=DE-COS(F2) +* 45 + A=EL2+F2+OM2 + DP=DP-31D0*SIN(A) + DE=DE+13D0*COS(A) +* 44 + A=EL+F2-D2+OM2 + DP=DP+29D0*SIN(A) + DE=DE-12D0*COS(A) +* 43 + DP=DP+29D0*SIN(EL2) + DE=DE-COS(EL2) +* 42 + A=F2+D2+OM2 + DP=DP-38D0*SIN(A) + DE=DE+16D0*COS(A) +* 41 + A=EL+F2+OM + DP=DP-51D0*SIN(A) + DE=DE+27D0*COS(A) +* 40 + A=-EL+F2+D2+OM2 + DP=DP-59D0*SIN(A) + DE=DE+26D0*COS(A) +* 39 + A=-EL+OM + DP=DP+(-58D0-0.1D0*T)*SIN(A) + DE=DE+32D0*COS(A) +* 38 + A=EL+OM + DP=DP+(63D0+0.1D0*T)*SIN(A) + DE=DE-33D0*COS(A) +* 37 + DP=DP+63D0*SIN(D2) + DE=DE-2D0*COS(D2) +* 36 + A=-EL+F2+OM2 + DP=DP+123D0*SIN(A) + DE=DE-53D0*COS(A) +* 35 + A=EL-D2 + DP=DP-158D0*SIN(A) + DE=DE-COS(A) +* 34 + A=EL+F2+OM2 + DP=DP-301D0*SIN(A) + DE=DE+(129D0-0.1D0*T)*COS(A) +* 33 + A=F2+OM + DP=DP+(-386D0-0.4D0*T)*SIN(A) + DE=DE+200D0*COS(A) +* 32 + DP=DP+(712D0+0.1D0*T)*SIN(EL) + DE=DE-7D0*COS(EL) +* 31 + A=F2+OM2 + DP=DP+(-2274D0-0.2D0*T)*SIN(A) + DE=DE+(977D0-0.5D0*T)*COS(A) +* 30 + DP=DP-SIN(ELP+F2-D2) +* 29 + DP=DP+SIN(-EL+D+OM) +* 28 + DP=DP+SIN(ELP+OM2) +* 27 + DP=DP-SIN(ELP-F2+D2) +* 26 + DP=DP+SIN(-F2+D2+OM) +* 25 + DP=DP+SIN(EL2+ELP-D2) +* 24 + DP=DP-4D0*SIN(EL-D) +* 23 + A=ELP+F2-D2+OM + DP=DP+4D0*SIN(A) + DE=DE-2D0*COS(A) +* 22 + A=EL2-D2+OM + DP=DP+4D0*SIN(A) + DE=DE-2D0*COS(A) +* 21 + A=-ELP+F2-D2+OM + DP=DP-5D0*SIN(A) + DE=DE+3D0*COS(A) +* 20 + A=-EL2+D2+OM + DP=DP-6D0*SIN(A) + DE=DE+3D0*COS(A) +* 19 + A=-ELP+OM + DP=DP-12D0*SIN(A) + DE=DE+6D0*COS(A) +* 18 + A=ELP2+F2-D2+OM2 + DP=DP+(-16D0+0.1D0*T)*SIN(A) + DE=DE+7D0*COS(A) +* 17 + A=ELP+OM + DP=DP-15D0*SIN(A) + DE=DE+9D0*COS(A) +* 16 + DP=DP+(17D0-0.1D0*T)*SIN(ELP2) +* 15 + DP=DP-22D0*SIN(F2-D2) +* 14 + A=EL2-D2 + DP=DP+48D0*SIN(A) + DE=DE+COS(A) +* 13 + A=F2-D2+OM + DP=DP+(129D0+0.1D0*T)*SIN(A) + DE=DE-70D0*COS(A) +* 12 + A=-ELP+F2-D2+OM2 + DP=DP+(217D0-0.5D0*T)*SIN(A) + DE=DE+(-95D0+0.3D0*T)*COS(A) +* 11 + A=ELP+F2-D2+OM2 + DP=DP+(-517D0+1.2D0*T)*SIN(A) + DE=DE+(224D0-0.6D0*T)*COS(A) +* 10 + DP=DP+(1426D0-3.4D0*T)*SIN(ELP) + DE=DE+(54D0-0.1D0*T)*COS(ELP) +* 9 + A=F2-D2+OM2 + DP=DP+(-13187D0-1.6D0*T)*SIN(A) + DE=DE+(5736D0-3.1D0*T)*COS(A) +* 8 + DP=DP+SIN(EL2-F2+OM) +* 7 + A=-ELP2+F2-D2+OM + DP=DP-2D0*SIN(A) + DE=DE+1D0*COS(A) +* 6 + DP=DP-3D0*SIN(EL-ELP-D) +* 5 + A=-EL2+F2+OM2 + DP=DP-3D0*SIN(A) + DE=DE+1D0*COS(A) +* 4 + DP=DP+11D0*SIN(EL2-F2) +* 3 + A=-EL2+F2+OM + DP=DP+46D0*SIN(A) + DE=DE-24D0*COS(A) +* 2 + DP=DP+(2062D0+0.2D0*T)*SIN(OM2) + DE=DE+(-895D0+0.5D0*T)*COS(OM2) +* 1 + DP=DP+(-171996D0-174.2D0*T)*SIN(OM) + DE=DE+(92025D0+8.9D0*T)*COS(OM) + +* Convert results to radians + DPSI=DP*U2R + DEPS=DE*U2R + +* Mean obliquity + EPS0=AS2R*(84381.448D0+ + : (-46.8150D0+ + : (-0.00059D0+ + : 0.001813D0*T)*T)*T) + + END diff --git a/math/slalib/oap.f b/math/slalib/oap.f new file mode 100644 index 00000000..1e851d50 --- /dev/null +++ b/math/slalib/oap.f @@ -0,0 +1,193 @@ + SUBROUTINE slOAP ( TYPE, OB1, OB2, DATE, DUT, ELONGM, PHIM, + : HM, XP, YP, TDK, PMB, RH, WL, TLR, + : RAP, DAP ) +*+ +* - - - - +* O A P +* - - - - +* +* Observed to apparent place. +* +* Given: +* TYPE c*(*) type of coordinates - 'R', 'H' or 'A' (see below) +* OB1 d observed Az, HA or RA (radians; Az is N=0,E=90) +* OB2 d observed ZD or Dec (radians) +* DATE d UTC date/time (modified Julian Date, JD-2400000.5) +* DUT d delta UT: UT1-UTC (UTC seconds) +* ELONGM d mean longitude of the observer (radians, east +ve) +* PHIM d mean geodetic latitude of the observer (radians) +* HM d observer's height above sea level (metres) +* XP d polar motion x-coordinate (radians) +* YP d polar motion y-coordinate (radians) +* TDK d local ambient temperature (K; std=273.15D0) +* PMB d local atmospheric pressure (mb; std=1013.25D0) +* RH d local relative humidity (in the range 0D0-1D0) +* WL d effective wavelength (micron, e.g. 0.55D0) +* TLR d tropospheric lapse rate (K/metre, e.g. 0.0065D0) +* +* Returned: +* RAP d geocentric apparent right ascension +* DAP d geocentric apparent declination +* +* Notes: +* +* 1) Only the first character of the TYPE argument is significant. +* 'R' or 'r' indicates that OBS1 and OBS2 are the observed right +* ascension and declination; 'H' or 'h' indicates that they are +* hour angle (west +ve) and declination; anything else ('A' or +* 'a' is recommended) indicates that OBS1 and OBS2 are azimuth +* (north zero, east 90 deg) and zenith distance. (Zenith +* distance is used rather than elevation in order to reflect the +* fact that no allowance is made for depression of the horizon.) +* +* 2) The accuracy of the result is limited by the corrections for +* refraction. Providing the meteorological parameters are +* known accurately and there are no gross local effects, the +* predicted apparent RA,Dec should be within about 0.1 arcsec +* for a zenith distance of less than 70 degrees. Even at a +* topocentric zenith distance of 90 degrees, the accuracy in +* elevation should be better than 1 arcmin; useful results +* are available for a further 3 degrees, beyond which the +* slRFRO routine returns a fixed value of the refraction. +* The complementary routines slAOP (or slAOPQ) and slOAP +* (or slOAPQ) are self-consistent to better than 1 micro- +* arcsecond all over the celestial sphere. +* +* 3) It is advisable to take great care with units, as even +* unlikely values of the input parameters are accepted and +* processed in accordance with the models used. +* +* 4) "Observed" Az,El means the position that would be seen by a +* perfect theodolite located at the observer. This is +* related to the observed HA,Dec via the standard rotation, using +* the geodetic latitude (corrected for polar motion), while the +* observed HA and RA are related simply through the local +* apparent ST. "Observed" RA,Dec or HA,Dec thus means the +* position that would be seen by a perfect equatorial located +* at the observer and with its polar axis aligned to the +* Earth's axis of rotation (n.b. not to the refracted pole). +* By removing from the observed place the effects of +* atmospheric refraction and diurnal aberration, the +* geocentric apparent RA,Dec is obtained. +* +* 5) Frequently, mean rather than apparent RA,Dec will be required, +* in which case further transformations will be necessary. The +* slAMP etc routines will convert the apparent RA,Dec produced +* by the present routine into an "FK5" (J2000) mean place, by +* allowing for the Sun's gravitational lens effect, annual +* aberration, nutation and precession. Should "FK4" (1950) +* coordinates be needed, the routines slFK54 etc will also +* need to be applied. +* +* 6) To convert to apparent RA,Dec the coordinates read from a +* real telescope, corrections would have to be applied for +* encoder zero points, gear and encoder errors, tube flexure, +* the position of the rotator axis and the pointing axis +* relative to it, non-perpendicularity between the mounting +* axes, and finally for the tilt of the azimuth or polar axis +* of the mounting (with appropriate corrections for mount +* flexures). Some telescopes would, of course, exhibit other +* properties which would need to be accounted for at the +* appropriate point in the sequence. +* +* 7) This routine takes time to execute, due mainly to the rigorous +* integration used to evaluate the refraction. For processing +* multiple stars for one location and time, call slAOPA once +* followed by one call per star to slOAPQ. Where a range of +* times within a limited period of a few hours is involved, and the +* highest precision is not required, call slAOPA once, followed +* by a call to slAOPT each time the time changes, followed by +* one call per star to slOAPQ. +* +* 8) The DATE argument is UTC expressed as an MJD. This is, strictly +* speaking, wrong, because of leap seconds. However, as long as +* the delta UT and the UTC are consistent there are no +* difficulties, except during a leap second. In this case, the +* start of the 61st second of the final minute should begin a new +* MJD day and the old pre-leap delta UT should continue to be used. +* As the 61st second completes, the MJD should revert to the start +* of the day as, simultaneously, the delta UTC changes by one +* second to its post-leap new value. +* +* 9) The delta UT (UT1-UTC) is tabulated in IERS circulars and +* elsewhere. It increases by exactly one second at the end of +* each UTC leap second, introduced in order to keep delta UT +* within +/- 0.9 seconds. +* +* 10) IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. +* The longitude required by the present routine is east-positive, +* in accordance with geographical convention (and right-handed). +* In particular, note that the longitudes returned by the +* slOBS routine are west-positive, following astronomical +* usage, and must be reversed in sign before use in the present +* routine. +* +* 11) The polar coordinates XP,YP can be obtained from IERS +* circulars and equivalent publications. The maximum amplitude +* is about 0.3 arcseconds. If XP,YP values are unavailable, +* use XP=YP=0D0. See page B60 of the 1988 Astronomical Almanac +* for a definition of the two angles. +* +* 12) The height above sea level of the observing station, HM, +* can be obtained from the Astronomical Almanac (Section J +* in the 1988 edition), or via the routine slOBS. If P, +* the pressure in millibars, is available, an adequate +* estimate of HM can be obtained from the expression +* +* HM ~ -29.3D0*TSL*LOG(P/1013.25D0). +* +* where TSL is the approximate sea-level air temperature in K +* (see Astrophysical Quantities, C.W.Allen, 3rd edition, +* section 52). Similarly, if the pressure P is not known, +* it can be estimated from the height of the observing +* station, HM, as follows: +* +* P ~ 1013.25D0*EXP(-HM/(29.3D0*TSL)). +* +* Note, however, that the refraction is nearly proportional to the +* pressure and that an accurate P value is important for precise +* work. +* +* 13) The azimuths etc. used by the present routine are with respect +* to the celestial pole. Corrections from the terrestrial pole +* can be computed using slPLMO. +* +* Called: slAOPA, slOAPQ +* +* Last revision: 2 December 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) TYPE + DOUBLE PRECISION OB1,OB2,DATE,DUT,ELONGM,PHIM,HM, + : XP,YP,TDK,PMB,RH,WL,TLR,RAP,DAP + + DOUBLE PRECISION AOPRMS(14) + + + CALL slAOPA(DATE,DUT,ELONGM,PHIM,HM,XP,YP,TDK,PMB,RH,WL,TLR, + : AOPRMS) + CALL slOAPQ(TYPE,OB1,OB2,AOPRMS,RAP,DAP) + + END diff --git a/math/slalib/oapqk.f b/math/slalib/oapqk.f new file mode 100644 index 00000000..7e8a2bb5 --- /dev/null +++ b/math/slalib/oapqk.f @@ -0,0 +1,251 @@ + SUBROUTINE slOAPQ (TYPE, OB1, OB2, AOPRMS, RAP, DAP) +*+ +* - - - - - - +* O A P Q +* - - - - - - +* +* Quick observed to apparent place +* +* Given: +* TYPE c*(*) type of coordinates - 'R', 'H' or 'A' (see below) +* OB1 d observed Az, HA or RA (radians; Az is N=0,E=90) +* OB2 d observed ZD or Dec (radians) +* AOPRMS d(14) star-independent apparent-to-observed parameters: +* +* (1) geodetic latitude (radians) +* (2,3) sine and cosine of geodetic latitude +* (4) magnitude of diurnal aberration vector +* (5) height (HM) +* (6) ambient temperature (T) +* (7) pressure (P) +* (8) relative humidity (RH) +* (9) wavelength (WL) +* (10) lapse rate (TLR) +* (11,12) refraction constants A and B (radians) +* (13) longitude + eqn of equinoxes + sidereal DUT (radians) +* (14) local apparent sidereal time (radians) +* +* Returned: +* RAP d geocentric apparent right ascension +* DAP d geocentric apparent declination +* +* Notes: +* +* 1) Only the first character of the TYPE argument is significant. +* 'R' or 'r' indicates that OBS1 and OBS2 are the observed right +* ascension and declination; 'H' or 'h' indicates that they are +* hour angle (west +ve) and declination; anything else ('A' or +* 'a' is recommended) indicates that OBS1 and OBS2 are azimuth +* (north zero, east 90 deg) and zenith distance. (Zenith distance +* is used rather than elevation in order to reflect the fact that +* no allowance is made for depression of the horizon.) +* +* 2) The accuracy of the result is limited by the corrections for +* refraction. Providing the meteorological parameters are +* known accurately and there are no gross local effects, the +* predicted apparent RA,Dec should be within about 0.1 arcsec +* for a zenith distance of less than 70 degrees. Even at a +* topocentric zenith distance of 90 degrees, the accuracy in +* elevation should be better than 1 arcmin; useful results +* are available for a further 3 degrees, beyond which the +* slRFRO routine returns a fixed value of the refraction. +* The complementary routines slAOP (or slAOPQ) and slOAP +* (or slOAPQ) are self-consistent to better than 1 micro- +* arcsecond all over the celestial sphere. +* +* 3) It is advisable to take great care with units, as even +* unlikely values of the input parameters are accepted and +* processed in accordance with the models used. +* +* 5) "Observed" Az,El means the position that would be seen by a +* perfect theodolite located at the observer. This is +* related to the observed HA,Dec via the standard rotation, using +* the geodetic latitude (corrected for polar motion), while the +* observed HA and RA are related simply through the local +* apparent ST. "Observed" RA,Dec or HA,Dec thus means the +* position that would be seen by a perfect equatorial located +* at the observer and with its polar axis aligned to the +* Earth's axis of rotation (n.b. not to the refracted pole). +* By removing from the observed place the effects of +* atmospheric refraction and diurnal aberration, the +* geocentric apparent RA,Dec is obtained. +* +* 5) Frequently, mean rather than apparent RA,Dec will be required, +* in which case further transformations will be necessary. The +* slAMP etc routines will convert the apparent RA,Dec produced +* by the present routine into an "FK5" (J2000) mean place, by +* allowing for the Sun's gravitational lens effect, annual +* aberration, nutation and precession. Should "FK4" (1950) +* coordinates be needed, the routines slFK54 etc will also +* need to be applied. +* +* 6) To convert to apparent RA,Dec the coordinates read from a +* real telescope, corrections would have to be applied for +* encoder zero points, gear and encoder errors, tube flexure, +* the position of the rotator axis and the pointing axis +* relative to it, non-perpendicularity between the mounting +* axes, and finally for the tilt of the azimuth or polar axis +* of the mounting (with appropriate corrections for mount +* flexures). Some telescopes would, of course, exhibit other +* properties which would need to be accounted for at the +* appropriate point in the sequence. +* +* 7) The star-independent apparent-to-observed-place parameters +* in AOPRMS may be computed by means of the slAOPA routine. +* If nothing has changed significantly except the time, the +* slAOPT routine may be used to perform the requisite +* partial recomputation of AOPRMS. +* +* 8) The azimuths etc used by the present routine are with respect +* to the celestial pole. Corrections from the terrestrial pole +* can be computed using slPLMO. +* +* Called: slDS2C, slDC2S, slRFRO, slDA2P +* +* Last revision: 29 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) TYPE + DOUBLE PRECISION OB1,OB2,AOPRMS(14),RAP,DAP + +* Breakpoint for fast/slow refraction algorithm: +* ZD greater than arctan(4), (see slRFCO routine) +* or vector Z less than cosine(arctan(Z)) = 1/sqrt(17) + DOUBLE PRECISION ZBREAK + PARAMETER (ZBREAK=0.242535625D0) + + CHARACTER C + DOUBLE PRECISION C1,C2,SPHI,CPHI,ST,CE,XAEO,YAEO,ZAEO,V(3), + : XMHDO,YMHDO,ZMHDO,AZ,SZ,ZDO,TZ,DREF,ZDT, + : XAET,YAET,ZAET,XMHDA,YMHDA,ZMHDA,DIURAB,F,HMA + + DOUBLE PRECISION slDA2P + + + +* Coordinate type + C = TYPE(1:1) + +* Coordinates + C1 = OB1 + C2 = OB2 + +* Sin, cos of latitude + SPHI = AOPRMS(2) + CPHI = AOPRMS(3) + +* Local apparent sidereal time + ST = AOPRMS(14) + +* Standardise coordinate type + IF (C.EQ.'R'.OR.C.EQ.'r') THEN + C = 'R' + ELSE IF (C.EQ.'H'.OR.C.EQ.'h') THEN + C = 'H' + ELSE + C = 'A' + END IF + +* If Az,ZD convert to Cartesian (S=0,E=90) + IF (C.EQ.'A') THEN + CE = SIN(C2) + XAEO = -COS(C1)*CE + YAEO = SIN(C1)*CE + ZAEO = COS(C2) + ELSE + +* If RA,Dec convert to HA,Dec + IF (C.EQ.'R') THEN + C1 = ST-C1 + END IF + +* To Cartesian -HA,Dec + CALL slDS2C(-C1,C2,V) + XMHDO = V(1) + YMHDO = V(2) + ZMHDO = V(3) + +* To Cartesian Az,El (S=0,E=90) + XAEO = SPHI*XMHDO-CPHI*ZMHDO + YAEO = YMHDO + ZAEO = CPHI*XMHDO+SPHI*ZMHDO + END IF + +* Azimuth (S=0,E=90) + IF (XAEO.NE.0D0.OR.YAEO.NE.0D0) THEN + AZ = ATAN2(YAEO,XAEO) + ELSE + AZ = 0D0 + END IF + +* Sine of observed ZD, and observed ZD + SZ = SQRT(XAEO*XAEO+YAEO*YAEO) + ZDO = ATAN2(SZ,ZAEO) + +* +* Refraction +* ---------- + +* Large zenith distance? + IF (ZAEO.GE.ZBREAK) THEN + +* Fast algorithm using two constant model + TZ = SZ/ZAEO + DREF = (AOPRMS(11)+AOPRMS(12)*TZ*TZ)*TZ + + ELSE + +* Rigorous algorithm for large ZD + CALL slRFRO(ZDO,AOPRMS(5),AOPRMS(6),AOPRMS(7),AOPRMS(8), + : AOPRMS(9),AOPRMS(1),AOPRMS(10),1D-8,DREF) + END IF + + ZDT = ZDO+DREF + +* To Cartesian Az,ZD + CE = SIN(ZDT) + XAET = COS(AZ)*CE + YAET = SIN(AZ)*CE + ZAET = COS(ZDT) + +* Cartesian Az,ZD to Cartesian -HA,Dec + XMHDA = SPHI*XAET+CPHI*ZAET + YMHDA = YAET + ZMHDA = -CPHI*XAET+SPHI*ZAET + +* Diurnal aberration + DIURAB = -AOPRMS(4) + F = (1D0-DIURAB*YMHDA) + V(1) = F*XMHDA + V(2) = F*(YMHDA+DIURAB) + V(3) = F*ZMHDA + +* To spherical -HA,Dec + CALL slDC2S(V,HMA,DAP) + +* Right Ascension + RAP = slDA2P(ST+HMA) + + END diff --git a/math/slalib/obs.f b/math/slalib/obs.f new file mode 100644 index 00000000..5aad21d1 --- /dev/null +++ b/math/slalib/obs.f @@ -0,0 +1,943 @@ + SUBROUTINE slOBS (N, C, NAME, W, P, H) +*+ +* - - - - +* O B S +* - - - - +* +* Parameters of selected groundbased observing stations +* +* Given: +* N int number specifying observing station +* +* Either given or returned +* C c*(*) identifier specifying observing station +* +* Returned: +* NAME c*(*) name of specified observing station +* W dp longitude (radians, West +ve) +* P dp geodetic latitude (radians, North +ve) +* H dp height above sea level (metres) +* +* Notes: +* +* Station identifiers C may be up to 10 characters long, +* and station names NAME may be up to 40 characters long. +* +* C and N are alternative ways of specifying the observing +* station. The C option, which is the most generally useful, +* may be selected by specifying an N value of zero or less. +* If N is 1 or more, the parameters of the Nth station +* in the currently supported list are interrogated, and +* the station identifier C is returned as well as NAME, W, +* P and H. +* +* If the station parameters are not available, either because +* the station identifier C is not recognized, or because an +* N value greater than the number of stations supported is +* given, a name of '?' is returned and C, W, P and H are left +* in their current states. +* +* Programs can obtain a list of all currently supported +* stations by calling the routine repeatedly, with N=1,2,3... +* When NAME='?' is seen, the list of stations has been +* exhausted. +* +* Station numbers, identifiers, names and other details are +* subject to change and should not be hardwired into +* application programs. +* +* All station identifiers C are uppercase only; lowercase +* characters must be converted to uppercase by the calling +* program. The station names returned may contain both upper- +* and lowercase. All characters up to the first space are +* checked; thus an abbreviated ID will return the parameters +* for the first station in the list which matches the +* abbreviation supplied, and no station in the list will ever +* contain embedded spaces. C must not have leading spaces. +* +* IMPORTANT -- BEWARE OF THE LONGITUDE SIGN CONVENTION. The +* longitude returned by slOBS is west-positive in accordance +* with astronomical usage. However, this sign convention is +* left-handed and is the opposite of the one used by geographers; +* elsewhere in SLALIB the preferable east-positive convention is +* used. In particular, note that for use in slAOP, slAOPA +* and slOAP the sign of the longitude must be reversed. +* +* Users are urged to inform the author of any improvements +* they would like to see made. For example: +* +* typographical corrections +* more accurate parameters +* better station identifiers or names +* additional stations +* +* P.T.Wallace Starlink 15 March 2002 +* +* Copyright (C) 2002 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER N + CHARACTER C*(*),NAME*(*) + DOUBLE PRECISION W,P,H + + INTEGER NMAX,M,NS,I + CHARACTER*10 CC + + DOUBLE PRECISION AS2R,WEST,NORTH,EAST,SOUTH + INTEGER ID,IAM + REAL AS + PARAMETER (AS2R=0.484813681109535994D-5) + +* Table of station identifiers + PARAMETER (NMAX=83) + CHARACTER*10 CTAB(NMAX) + DATA CTAB (1) /'AAT '/ + DATA CTAB (2) /'LPO4.2 '/ + DATA CTAB (3) /'LPO2.5 '/ + DATA CTAB (4) /'LPO1 '/ + DATA CTAB (5) /'LICK120 '/ + DATA CTAB (6) /'MMT '/ + DATA CTAB (7) /'DAO72 '/ + DATA CTAB (8) /'DUPONT '/ + DATA CTAB (9) /'MTHOP1.5 '/ + DATA CTAB (10) /'STROMLO74 '/ + DATA CTAB (11) /'ANU2.3 '/ + DATA CTAB (12) /'GBVA140 '/ + DATA CTAB (13) /'TOLOLO4M '/ + DATA CTAB (14) /'TOLOLO1.5M'/ + DATA CTAB (15) /'TIDBINBLA '/ + DATA CTAB (16) /'BLOEMF '/ + DATA CTAB (17) /'BOSQALEGRE'/ + DATA CTAB (18) /'FLAGSTF61 '/ + DATA CTAB (19) /'LOWELL72 '/ + DATA CTAB (20) /'HARVARD '/ + DATA CTAB (21) /'OKAYAMA '/ + DATA CTAB (22) /'KPNO158 '/ + DATA CTAB (23) /'KPNO90 '/ + DATA CTAB (24) /'KPNO84 '/ + DATA CTAB (25) /'KPNO36FT '/ + DATA CTAB (26) /'KOTTAMIA '/ + DATA CTAB (27) /'ESO3.6 '/ + DATA CTAB (28) /'MAUNAK88 '/ + DATA CTAB (29) /'UKIRT '/ + DATA CTAB (30) /'QUEBEC1.6 '/ + DATA CTAB (31) /'MTEKAR '/ + DATA CTAB (32) /'MTLEMMON60'/ + DATA CTAB (33) /'MCDONLD2.7'/ + DATA CTAB (34) /'MCDONLD2.1'/ + DATA CTAB (35) /'PALOMAR200'/ + DATA CTAB (36) /'PALOMAR60 '/ + DATA CTAB (37) /'DUNLAP74 '/ + DATA CTAB (38) /'HPROV1.93 '/ + DATA CTAB (39) /'HPROV1.52 '/ + DATA CTAB (40) /'SANPM83 '/ + DATA CTAB (41) /'SAAO74 '/ + DATA CTAB (42) /'TAUTNBG '/ + DATA CTAB (43) /'CATALINA61'/ + DATA CTAB (44) /'STEWARD90 '/ + DATA CTAB (45) /'USSR6 '/ + DATA CTAB (46) /'ARECIBO '/ + DATA CTAB (47) /'CAMB5KM '/ + DATA CTAB (48) /'CAMB1MILE '/ + DATA CTAB (49) /'EFFELSBERG'/ + DATA CTAB (50) /'GBVA300 '/ + DATA CTAB (51) /'JODRELL1 '/ + DATA CTAB (52) /'PARKES '/ + DATA CTAB (53) /'VLA '/ + DATA CTAB (54) /'SUGARGROVE'/ + DATA CTAB (55) /'USSR600 '/ + DATA CTAB (56) /'NOBEYAMA '/ + DATA CTAB (57) /'JCMT '/ + DATA CTAB (58) /'ESONTT '/ + DATA CTAB (59) /'ST.ANDREWS'/ + DATA CTAB (60) /'APO3.5 '/ + DATA CTAB (61) /'KECK1 '/ + DATA CTAB (62) /'TAUTSCHM '/ + DATA CTAB (63) /'PALOMAR48 '/ + DATA CTAB (64) /'UKST '/ + DATA CTAB (65) /'KISO '/ + DATA CTAB (66) /'ESOSCHM '/ + DATA CTAB (67) /'ATCA '/ + DATA CTAB (68) /'MOPRA '/ + DATA CTAB (69) /'SUBARU '/ + DATA CTAB (70) /'CFHT '/ + DATA CTAB (71) /'KECK2 '/ + DATA CTAB (72) /'GEMININ '/ + DATA CTAB (73) /'FCRAO '/ + DATA CTAB (74) /'IRTF '/ + DATA CTAB (75) /'CSO '/ + DATA CTAB (76) /'VLT1 '/ + DATA CTAB (77) /'VLT2 '/ + DATA CTAB (78) /'VLT3 '/ + DATA CTAB (79) /'VLT4 '/ + DATA CTAB (80) /'GEMINIS '/ + DATA CTAB (81) /'KOSMA3M '/ + DATA CTAB (82) /'MAGELLAN1 '/ + DATA CTAB (83) /'MAGELLAN2 '/ + +* Degrees, arcminutes, arcseconds to radians + WEST(ID,IAM,AS)=AS2R*(DBLE(60*(60*ID+IAM))+DBLE(AS)) + NORTH(ID,IAM,AS)=WEST(ID,IAM,AS) + EAST(ID,IAM,AS)=-WEST(ID,IAM,AS) + SOUTH(ID,IAM,AS)=-WEST(ID,IAM,AS) + + + + +* Station specified by number or identifier? + IF (N.GT.0) THEN + +* Station specified by number + M=N + IF (M.LE.NMAX) C=CTAB(M) + + ELSE + +* Station specified by identifier: determine corresponding number + CC=C + DO NS=1,NMAX + DO I=1,10 + IF (CC(I:I).EQ.' ') GO TO 5 + IF (CC(I:I).NE.CTAB(NS)(I:I)) GO TO 1 + END DO + GO TO 5 + 1 CONTINUE + END DO + NS=NMAX+1 + 5 CONTINUE + IF (C(1:1).NE.' ') THEN + M=NS + ELSE + M=NMAX+1 + END IF + + END IF + +* +* Return parameters of Mth station +* -------------------------------- + + GO TO (10,20,30,40,50,60,70,80,90,100, + : 110,120,130,140,150,160,170,180,190,200, + : 210,220,230,240,250,260,270,280,290,300, + : 310,320,330,340,350,360,370,380,390,400, + : 410,420,430,440,450,460,470,480,490,500, + : 510,520,530,540,550,560,570,580,590,600, + : 610,620,630,640,650,660,670,680,690,700, + : 710,720,730,740,750,760,770,780,790,800, + : 810,820,830) M + GO TO 9000 + +* AAT (Observer's Guide) AAT + 10 CONTINUE + NAME='Anglo-Australian 3.9m Telescope' + W=EAST(149,03,57.91) + P=SOUTH(31,16,37.34) + H=1164D0 + GO TO 9999 + +* WHT (Gemini, April 1987) LPO4.2 + 20 CONTINUE + NAME='William Herschel 4.2m Telescope' + W=WEST(17,52,53.9) + P=NORTH(28,45,38.1) + H=2332D0 + GO TO 9999 + +* INT (Gemini, April 1987) LPO2.5 + 30 CONTINUE + NAME='Isaac Newton 2.5m Telescope' + W=WEST(17,52,39.5) + P=NORTH(28,45,43.2) + H=2336D0 + GO TO 9999 + +* JKT (Gemini, April 1987) LPO1 + 40 CONTINUE + NAME='Jacobus Kapteyn 1m Telescope' + W=WEST(17,52,41.2) + P=NORTH(28,45,39.9) + H=2364D0 + GO TO 9999 + +* Lick 120" (S.L.Allen, private communication, 2002) LICK120 + 50 CONTINUE + NAME='Lick 120 inch' + W=WEST(121,38,13.689) + P=NORTH(37,20,34.931) + H=1286D0 + GO TO 9999 + +* MMT 6.5m conversion (MMT Observatory website) MMT + 60 CONTINUE + NAME='MMT 6.5m, Mt Hopkins' + W=WEST(110,53,04.4) + P=NORTH(31,41,19.6) + H=2608D0 + GO TO 9999 + +* Victoria B.C. 1.85m (1984 Almanac) DAO72 + 70 CONTINUE + NAME='DAO Victoria BC 1.85 metre' + W=WEST(123,25,01.18) + P=NORTH(48,31,11.9) + H=238D0 + GO TO 9999 + +* Las Campanas (1983 Almanac) DUPONT + 80 CONTINUE + NAME='Du Pont 2.5m Telescope, Las Campanas' + W=WEST(70,42,9.) + P=SOUTH(29,00,11.) + H=2280D0 + GO TO 9999 + +* Mt Hopkins 1.5m (1983 Almanac) MTHOP1.5 + 90 CONTINUE + NAME='Mt Hopkins 1.5 metre' + W=WEST(110,52,39.00) + P=NORTH(31,40,51.4) + H=2344D0 + GO TO 9999 + +* Mt Stromlo 74" (1983 Almanac) STROMLO74 + 100 CONTINUE + NAME='Mount Stromlo 74 inch' + W=EAST(149,00,27.59) + P=SOUTH(35,19,14.3) + H=767D0 + GO TO 9999 + +* ANU 2.3m, SSO (Gary Hovey) ANU2.3 + 110 CONTINUE + NAME='Siding Spring 2.3 metre' + W=EAST(149,03,40.3) + P=SOUTH(31,16,24.1) + H=1149D0 + GO TO 9999 + +* Greenbank 140' (1983 Almanac) GBVA140 + 120 CONTINUE + NAME='Greenbank 140 foot' + W=WEST(79,50,09.61) + P=NORTH(38,26,15.4) + H=881D0 + GO TO 9999 + +* Cerro Tololo 4m (1982 Almanac) TOLOLO4M + 130 CONTINUE + NAME='Cerro Tololo 4 metre' + W=WEST(70,48,53.6) + P=SOUTH(30,09,57.8) + H=2235D0 + GO TO 9999 + +* Cerro Tololo 1.5m (1982 Almanac) TOLOLO1.5M + 140 CONTINUE + NAME='Cerro Tololo 1.5 metre' + W=WEST(70,48,54.5) + P=SOUTH(30,09,56.3) + H=2225D0 + GO TO 9999 + +* Tidbinbilla 64m (1982 Almanac) TIDBINBLA + 150 CONTINUE + NAME='Tidbinbilla 64 metre' + W=EAST(148,58,48.20) + P=SOUTH(35,24,14.3) + H=670D0 + GO TO 9999 + +* Bloemfontein 1.52m (1981 Almanac) BLOEMF + 160 CONTINUE + NAME='Bloemfontein 1.52 metre' + W=EAST(26,24,18.) + P=SOUTH(29,02,18.) + H=1387D0 + GO TO 9999 + +* Bosque Alegre 1.54m (1981 Almanac) BOSQALEGRE + 170 CONTINUE + NAME='Bosque Alegre 1.54 metre' + W=WEST(64,32,48.0) + P=SOUTH(31,35,53.) + H=1250D0 + GO TO 9999 + +* USNO 61" astrographic reflector, Flagstaff (1981 Almanac) FLAGSTF61 + 180 CONTINUE + NAME='USNO 61 inch astrograph, Flagstaff' + W=WEST(111,44,23.6) + P=NORTH(35,11,02.5) + H=2316D0 + GO TO 9999 + +* Lowell 72" (1981 Almanac) LOWELL72 + 190 CONTINUE + NAME='Perkins 72 inch, Lowell' + W=WEST(111,32,09.3) + P=NORTH(35,05,48.6) + H=2198D0 + GO TO 9999 + +* Harvard 1.55m (1981 Almanac) HARVARD + 200 CONTINUE + NAME='Harvard College Observatory 1.55m' + W=WEST(71,33,29.32) + P=NORTH(42,30,19.0) + H=185D0 + GO TO 9999 + +* Okayama 1.88m (1981 Almanac) OKAYAMA + 210 CONTINUE + NAME='Okayama 1.88 metre' + W=EAST(133,35,47.29) + P=NORTH(34,34,26.1) + H=372D0 + GO TO 9999 + +* Kitt Peak Mayall 4m (1981 Almanac) KPNO158 + 220 CONTINUE + NAME='Kitt Peak 158 inch' + W=WEST(111,35,57.61) + P=NORTH(31,57,50.3) + H=2120D0 + GO TO 9999 + +* Kitt Peak 90 inch (1981 Almanac) KPNO90 + 230 CONTINUE + NAME='Kitt Peak 90 inch' + W=WEST(111,35,58.24) + P=NORTH(31,57,46.9) + H=2071D0 + GO TO 9999 + +* Kitt Peak 84 inch (1981 Almanac) KPNO84 + 240 CONTINUE + NAME='Kitt Peak 84 inch' + W=WEST(111,35,51.56) + P=NORTH(31,57,29.2) + H=2096D0 + GO TO 9999 + +* Kitt Peak 36 foot (1981 Almanac) KPNO36FT + 250 CONTINUE + NAME='Kitt Peak 36 foot' + W=WEST(111,36,51.12) + P=NORTH(31,57,12.1) + H=1939D0 + GO TO 9999 + +* Kottamia 74" (1981 Almanac) KOTTAMIA + 260 CONTINUE + NAME='Kottamia 74 inch' + W=EAST(31,49,30.) + P=NORTH(29,55,54.) + H=476D0 + GO TO 9999 + +* La Silla 3.6m (1981 Almanac) ESO3.6 + 270 CONTINUE + NAME='ESO 3.6 metre' + W=WEST(70,43,36.) + P=SOUTH(29,15,36.) + H=2428D0 + GO TO 9999 + +* Mauna Kea 88 inch MAUNAK88 +* (IfA website, Richard Wainscoat) + 280 CONTINUE + NAME='Mauna Kea 88 inch' + W=WEST(155,28,09.96) + P=NORTH(19,49,22.77) + H=4213.6D0 + GO TO 9999 + +* UKIRT (IfA website, Richard Wainscoat) UKIRT + 290 CONTINUE + NAME='UK Infra Red Telescope' + W=WEST(155,28,13.18) + P=NORTH(19,49,20.75) + H=4198.5D0 + GO TO 9999 + +* Quebec 1.6m (1981 Almanac) QUEBEC1.6 + 300 CONTINUE + NAME='Quebec 1.6 metre' + W=WEST(71,09,09.7) + P=NORTH(45,27,20.6) + H=1114D0 + GO TO 9999 + +* Mt Ekar 1.82m (1981 Almanac) MTEKAR + 310 CONTINUE + NAME='Mt Ekar 1.82 metre' + W=EAST(11,34,15.) + P=NORTH(45,50,48.) + H=1365D0 + GO TO 9999 + +* Mt Lemmon 60" (1981 Almanac) MTLEMMON60 + 320 CONTINUE + NAME='Mt Lemmon 60 inch' + W=WEST(110,42,16.9) + P=NORTH(32,26,33.9) + H=2790D0 + GO TO 9999 + +* Mt Locke 2.7m (1981 Almanac) MCDONLD2.7 + 330 CONTINUE + NAME='McDonald 2.7 metre' + W=WEST(104,01,17.60) + P=NORTH(30,40,17.7) + H=2075D0 + GO TO 9999 + +* Mt Locke 2.1m (1981 Almanac) MCDONLD2.1 + 340 CONTINUE + NAME='McDonald 2.1 metre' + W=WEST(104,01,20.10) + P=NORTH(30,40,17.7) + H=2075D0 + GO TO 9999 + +* Palomar 200" (1981 Almanac) PALOMAR200 + 350 CONTINUE + NAME='Palomar 200 inch' + W=WEST(116,51,50.) + P=NORTH(33,21,22.) + H=1706D0 + GO TO 9999 + +* Palomar 60" (1981 Almanac) PALOMAR60 + 360 CONTINUE + NAME='Palomar 60 inch' + W=WEST(116,51,31.) + P=NORTH(33,20,56.) + H=1706D0 + GO TO 9999 + +* David Dunlap 74" (1981 Almanac) DUNLAP74 + 370 CONTINUE + NAME='David Dunlap 74 inch' + W=WEST(79,25,20.) + P=NORTH(43,51,46.) + H=244D0 + GO TO 9999 + +* Haute Provence 1.93m (1981 Almanac) HPROV1.93 + 380 CONTINUE + NAME='Haute Provence 1.93 metre' + W=EAST(5,42,46.75) + P=NORTH(43,55,53.3) + H=665D0 + GO TO 9999 + +* Haute Provence 1.52m (1981 Almanac) HPROV1.52 + 390 CONTINUE + NAME='Haute Provence 1.52 metre' + W=EAST(5,42,43.82) + P=NORTH(43,56,00.2) + H=667D0 + GO TO 9999 + +* San Pedro Martir 83" (1981 Almanac) SANPM83 + 400 CONTINUE + NAME='San Pedro Martir 83 inch' + W=WEST(115,27,47.) + P=NORTH(31,02,38.) + H=2830D0 + GO TO 9999 + +* Sutherland 74" (1981 Almanac) SAAO74 + 410 CONTINUE + NAME='Sutherland 74 inch' + W=EAST(20,48,44.3) + P=SOUTH(32,22,43.4) + H=1771D0 + GO TO 9999 + +* Tautenburg 2m (1981 Almanac) TAUTNBG + 420 CONTINUE + NAME='Tautenburg 2 metre' + W=EAST(11,42,45.) + P=NORTH(50,58,51.) + H=331D0 + GO TO 9999 + +* Catalina 61" (1981 Almanac) CATALINA61 + 430 CONTINUE + NAME='Catalina 61 inch' + W=WEST(110,43,55.1) + P=NORTH(32,25,00.7) + H=2510D0 + GO TO 9999 + +* Steward 90" (1981 Almanac) STEWARD90 + 440 CONTINUE + NAME='Steward 90 inch' + W=WEST(111,35,58.24) + P=NORTH(31,57,46.9) + H=2071D0 + GO TO 9999 + +* Russian 6m (1981 Almanac) USSR6 + 450 CONTINUE + NAME='USSR 6 metre' + W=EAST(41,26,30.0) + P=NORTH(43,39,12.) + H=2100D0 + GO TO 9999 + +* Arecibo 1000' (1981 Almanac) ARECIBO + 460 CONTINUE + NAME='Arecibo 1000 foot' + W=WEST(66,45,11.1) + P=NORTH(18,20,36.6) + H=496D0 + GO TO 9999 + +* Cambridge 5km (1981 Almanac) CAMB5KM + 470 CONTINUE + NAME='Cambridge 5km' + W=EAST(0,02,37.23) + P=NORTH(52,10,12.2) + H=17D0 + GO TO 9999 + +* Cambridge 1 mile (1981 Almanac) CAMB1MILE + 480 CONTINUE + NAME='Cambridge 1 mile' + W=EAST(0,02,21.64) + P=NORTH(52,09,47.3) + H=17D0 + GO TO 9999 + +* Bonn 100m (1981 Almanac) EFFELSBERG + 490 CONTINUE + NAME='Effelsberg 100 metre' + W=EAST(6,53,01.5) + P=NORTH(50,31,28.6) + H=366D0 + GO TO 9999 + +* Greenbank 300' (1981 Almanac) GBVA300 (R.I.P.) + 500 CONTINUE + NAME='Greenbank 300 foot' + W=WEST(79,50,56.36) + P=NORTH(38,25,46.3) + H=894D0 + GO TO 9999 + +* Jodrell Bank Mk 1 (1981 Almanac) JODRELL1 + 510 CONTINUE + NAME='Jodrell Bank 250 foot' + W=WEST(2,18,25.) + P=NORTH(53,14,10.5) + H=78D0 + GO TO 9999 + +* Australia Telescope Parkes Observatory PARKES +* (Peter te Lintel Hekkert) + 520 CONTINUE + NAME='Parkes 64 metre' + W=EAST(148,15,44.3591) + P=SOUTH(32,59,59.8657) + H=391.79D0 + GO TO 9999 + +* VLA (1981 Almanac) VLA + 530 CONTINUE + NAME='Very Large Array' + W=WEST(107,37,03.82) + P=NORTH(34,04,43.5) + H=2124D0 + GO TO 9999 + +* Sugar Grove 150' (1981 Almanac) SUGARGROVE + 540 CONTINUE + NAME='Sugar Grove 150 foot' + W=WEST(79,16,23.) + P=NORTH(38,31,14.) + H=705D0 + GO TO 9999 + +* Russian 600' (1981 Almanac) USSR600 + 550 CONTINUE + NAME='USSR 600 foot' + W=EAST(41,35,25.5) + P=NORTH(43,49,32.) + H=973D0 + GO TO 9999 + +* Nobeyama 45 metre mm dish (based on 1981 Almanac entry) NOBEYAMA + 560 CONTINUE + NAME='Nobeyama 45 metre' + W=EAST(138,29,12.) + P=NORTH(35,56,19.) + H=1350D0 + GO TO 9999 + +* James Clerk Maxwell 15 metre mm telescope, Mauna Kea JCMT +* From GPS measurements on 11Apr2007 for eSMA setup (R. Tilanus) + 570 CONTINUE + NAME='JCMT 15 metre' + W=WEST(155,28,37.30) + P=NORTH(19,49,22.22) + H=4124.75D0 + GO TO 9999 + +* ESO 3.5 metre NTT, La Silla (K.Wirenstrand) ESONTT + 580 CONTINUE + NAME='ESO 3.5 metre NTT' + W=WEST(70,43,07.) + P=SOUTH(29,15,30.) + H=2377D0 + GO TO 9999 + +* St Andrews University Observatory (1982 Almanac) ST.ANDREWS + 590 CONTINUE + NAME='St Andrews' + W=WEST(2,48,52.5) + P=NORTH(56,20,12.) + H=30D0 + GO TO 9999 + +* Apache Point 3.5 metre (R.Owen) APO3.5 + 600 CONTINUE + NAME='Apache Point 3.5m' + W=WEST(105,49,11.56) + P=NORTH(32,46,48.96) + H=2809D0 + GO TO 9999 + +* W.M.Keck Observatory, Telescope 1 KECK1 +* (William Lupton) + 610 CONTINUE + NAME='Keck 10m Telescope #1' + W=WEST(155,28,28.99) + P=NORTH(19,49,33.41) + H=4160D0 + GO TO 9999 + +* Tautenberg Schmidt (1983 Almanac) TAUTSCHM + 620 CONTINUE + NAME='Tautenberg 1.34 metre Schmidt' + W=EAST(11,42,45.0) + P=NORTH(50,58,51.0) + H=331D0 + GO TO 9999 + +* Palomar Schmidt (1981 Almanac) PALOMAR48 + 630 CONTINUE + NAME='Palomar 48-inch Schmidt' + W=WEST(116,51,32.0) + P=NORTH(33,21,26.0) + H=1706D0 + GO TO 9999 + +* UK Schmidt, Siding Spring (1983 Almanac) UKST + 640 CONTINUE + NAME='UK 1.2 metre Schmidt, Siding Spring' + W=EAST(149,04,12.8) + P=SOUTH(31,16,27.8) + H=1145D0 + GO TO 9999 + +* Kiso Schmidt, Japan (1981 Almanac) KISO + 650 CONTINUE + NAME='Kiso 1.05 metre Schmidt, Japan' + W=EAST(137,37,42.2) + P=NORTH(35,47,38.7) + H=1130D0 + GO TO 9999 + +* ESO Schmidt, La Silla (1981 Almanac) ESOSCHM + 660 CONTINUE + NAME='ESO 1 metre Schmidt, La Silla' + W=WEST(70,43,46.5) + P=SOUTH(29,15,25.8) + H=2347D0 + GO TO 9999 + +* Australia Telescope Compact Array ATCA +* (WGS84 coordinates of Station 35, Mark Calabretta) + 670 CONTINUE + NAME='Australia Telescope Compact Array' + W=EAST(149,33,00.500) + P=SOUTH(30,18,46.385) + H=236.9D0 + GO TO 9999 + +* Australia Telescope Mopra Observatory MOPRA +* (Peter te Lintel Hekkert) + 680 CONTINUE + NAME='ATNF Mopra Observatory' + W=EAST(149,05,58.732) + P=SOUTH(31,16,04.451) + H=850D0 + GO TO 9999 + +* Subaru telescope, Mauna Kea SUBARU +* (IfA website, Richard Wainscoat) + 690 CONTINUE + NAME='Subaru 8m telescope' + W=WEST(155,28,33.67) + P=NORTH(19,49,31.81) + H=4163D0 + GO TO 9999 + +* Canada-France-Hawaii Telescope, Mauna Kea CFHT +* (IfA website, Richard Wainscoat) + 700 CONTINUE + NAME='Canada-France-Hawaii 3.6m Telescope' + W=WEST(155,28,07.95) + P=NORTH(19,49,30.91) + H=4204.1D0 + GO TO 9999 + +* W.M.Keck Observatory, Telescope 2 KECK2 +* (William Lupton) + 710 CONTINUE + NAME='Keck 10m Telescope #2' + W=WEST(155,28,27.24) + P=NORTH(19,49,35.62) + H=4159.6D0 + GO TO 9999 + +* Gemini North, Mauna Kea GEMININ +* (IfA website, Richard Wainscoat) + 720 CONTINUE + NAME='Gemini North 8-m telescope' + W=WEST(155,28,08.57) + P=NORTH(19,49,25.69) + H=4213.4D0 + GO TO 9999 + +* Five College Radio Astronomy Observatory FCRAO +* (Tim Jenness) + 730 CONTINUE + NAME='Five College Radio Astronomy Obs' + W=WEST(72,20,42.0) + P=NORTH(42,23,30.0) + H=314D0 + GO TO 9999 + +* NASA Infra Red Telescope Facility IRTF +* (IfA website, Richard Wainscoat) + 740 CONTINUE + NAME='NASA IR Telescope Facility, Mauna Kea' + W=WEST(155,28,19.20) + P=NORTH(19,49,34.39) + H=4168.1D0 + GO TO 9999 + +* Caltech Submillimeter Observatory CSO +* (IfA website, Richard Wainscoat; height estimated) + 750 CONTINUE + NAME='Caltech Sub-mm Observatory, Mauna Kea' + W=WEST(155,28,31.79) + P=NORTH(19,49,20.78) + H=4080D0 + GO TO 9999 + +* ESO VLT, UT1 VLT1 +* (ESO website, VLT Whitebook Chapter 2) + 760 CONTINUE + NAME='ESO VLT, Paranal, Chile: UT1' + W=WEST(70,24,11.642) + P=SOUTH(24,37,33.117) + H=2635.43 + GO TO 9999 + +* ESO VLT, UT2 VLT2 +* (ESO website, VLT Whitebook Chapter 2) + 770 CONTINUE + NAME='ESO VLT, Paranal, Chile: UT2' + W=WEST(70,24,10.855) + P=SOUTH(24,37,31.465) + H=2635.43 + GO TO 9999 + +* ESO VLT, UT3 VLT3 +* (ESO website, VLT Whitebook Chapter 2) + 780 CONTINUE + NAME='ESO VLT, Paranal, Chile: UT3' + W=WEST(70,24,09.896) + P=SOUTH(24,37,30.300) + H=2635.43 + GO TO 9999 + +* ESO VLT, UT4 VLT4 +* (ESO website, VLT Whitebook Chapter 2) + 790 CONTINUE + NAME='ESO VLT, Paranal, Chile: UT4' + W=WEST(70,24,08.000) + P=SOUTH(24,37,31.000) + H=2635.43 + GO TO 9999 + +* Gemini South, Cerro Pachon GEMINIS +* (GPS readings by Patrick Wallace) + 800 CONTINUE + NAME='Gemini South 8-m telescope' + W=WEST(70,44,11.5) + P=SOUTH(30,14,26.7) + H=2738D0 + GO TO 9999 + +* Cologne Observatory for Submillimeter Astronomy (KOSMA) KOSMA3M +* (Holger Jakob) + 810 CONTINUE + NAME='KOSMA 3m telescope, Gornergrat' + W=EAST(7,47,3.48) + P=NORTH(45,58,59.772) + H=3141D0 + GO TO 9999 + +* Magellan 1, 6.5m telescope at Las Campanas, Chile MAGELLAN1 +* (Skip Schaller) + 820 CONTINUE + NAME='Magellan 1, 6.5m, Las Campanas' + W=WEST(70,41,31.9) + P=SOUTH(29,00,51.7) + H=2408D0 + GO TO 9999 + +* Magellan 2, 6.5m telescope at Las Campanas, Chile MAGELLAN2 +* (Skip Schaller) + 830 CONTINUE + NAME='Magellan 2, 6.5m, Las Campanas' + W=WEST(70,41,33.5) + P=SOUTH(29,00,50.3) + H=2408D0 + GO TO 9999 + +* Unrecognized station + 9000 CONTINUE + NAME='?' + +* Exit + 9999 CONTINUE + + END diff --git a/math/slalib/pa.f b/math/slalib/pa.f new file mode 100644 index 00000000..88d21105 --- /dev/null +++ b/math/slalib/pa.f @@ -0,0 +1,64 @@ + DOUBLE PRECISION FUNCTION slPA (HA, DEC, PHI) +*+ +* - - - +* P A +* - - - +* +* HA, Dec to Parallactic Angle (double precision) +* +* Given: +* HA d hour angle in radians (geocentric apparent) +* DEC d declination in radians (geocentric apparent) +* PHI d observatory latitude in radians (geodetic) +* +* The result is in the range -pi to +pi +* +* Notes: +* +* 1) The parallactic angle at a point in the sky is the position +* angle of the vertical, i.e. the angle between the direction to +* the pole and to the zenith. In precise applications care must +* be taken only to use geocentric apparent HA,Dec and to consider +* separately the effects of atmospheric refraction and telescope +* mount errors. +* +* 2) At the pole a zero result is returned. +* +* P.T.Wallace Starlink 16 August 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION HA,DEC,PHI + + DOUBLE PRECISION CP,SQSZ,CQSZ + + + + CP=COS(PHI) + SQSZ=CP*SIN(HA) + CQSZ=SIN(PHI)*COS(DEC)-CP*SIN(DEC)*COS(HA) + IF (SQSZ.EQ.0D0.AND.CQSZ.EQ.0D0) CQSZ=1D0 + slPA=ATAN2(SQSZ,CQSZ) + + END diff --git a/math/slalib/pav.f b/math/slalib/pav.f new file mode 100644 index 00000000..6e6af8a3 --- /dev/null +++ b/math/slalib/pav.f @@ -0,0 +1,71 @@ + REAL FUNCTION slPAV ( V1, V2 ) +*+ +* - - - - +* P A V +* - - - - +* +* Position angle of one celestial direction with respect to another. +* +* (single precision) +* +* Given: +* V1 r(3) direction cosines of one point +* V2 r(3) direction cosines of the other point +* +* (The coordinate frames correspond to RA,Dec, Long,Lat etc.) +* +* The result is the bearing (position angle), in radians, of point +* V2 with respect to point V1. It is in the range +/- pi. The +* sense is such that if V2 is a small distance east of V1, the +* bearing is about +pi/2. Zero is returned if the two points +* are coincident. +* +* V1 and V2 do not have to be unit vectors. +* +* The routine slBEAR performs an equivalent function except +* that the points are specified in the form of spherical +* coordinates. +* +* Called: slDPAV +* +* Last revision: 11 September 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL V1(3), V2(3) + + INTEGER I + DOUBLE PRECISION D1(3), D2(3) + + DOUBLE PRECISION slDPAV + + +* Call the double precision version. + DO I=1,3 + D1(I) = V1(I) + D2(I) = V2(I) + END DO + slPAV = REAL(slDPAV(D1,D2)) + + END diff --git a/math/slalib/pcd.f b/math/slalib/pcd.f new file mode 100644 index 00000000..cef1dbf7 --- /dev/null +++ b/math/slalib/pcd.f @@ -0,0 +1,77 @@ + SUBROUTINE slPCD (DISCO,X,Y) +*+ +* - - - - +* P C D +* - - - - +* +* Apply pincushion/barrel distortion to a tangent-plane [x,y]. +* +* Given: +* DISCO d pincushion/barrel distortion coefficient +* X,Y d tangent-plane coordinates +* +* Returned: +* X,Y d distorted coordinates +* +* Notes: +* +* 1) The distortion is of the form RP = R*(1 + C*R**2), where R is +* the radial distance from the tangent point, C is the DISCO +* argument, and RP is the radial distance in the presence of +* the distortion. +* +* 2) For pincushion distortion, C is +ve; for barrel distortion, +* C is -ve. +* +* 3) For X,Y in units of one projection radius (in the case of +* a photographic plate, the focal length), the following +* DISCO values apply: +* +* Geometry DISCO +* +* astrograph 0.0 +* Schmidt -0.3333 +* AAT PF doublet +147.069 +* AAT PF triplet +178.585 +* AAT f/8 +21.20 +* JKT f/8 +13.32 +* +* 4) There is a companion routine, slUPCD, which performs the +* inverse operation. +* +* P.T.Wallace Starlink 3 September 2000 +* +* Copyright (C) 2000 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DISCO,X,Y + + DOUBLE PRECISION F + + + + F=1D0+DISCO*(X*X+Y*Y) + X=X*F + Y=Y*F + + END diff --git a/math/slalib/pda2h.f b/math/slalib/pda2h.f new file mode 100644 index 00000000..ea8a3425 --- /dev/null +++ b/math/slalib/pda2h.f @@ -0,0 +1,118 @@ + SUBROUTINE slPDAH (P, D, A, H1, J1, H2, J2) +*+ +* - - - - - - +* P D A H +* - - - - - - +* +* Hour Angle corresponding to a given azimuth +* +* (double precision) +* +* Given: +* P d latitude +* D d declination +* A d azimuth +* +* Returned: +* H1 d hour angle: first solution if any +* J1 i flag: 0 = solution 1 is valid +* H2 d hour angle: second solution if any +* J2 i flag: 0 = solution 2 is valid +* +* Called: slDA1P +* +* P.T.Wallace Starlink 6 October 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION P,D,A,H1 + INTEGER J1 + DOUBLE PRECISION H2 + INTEGER J2 + + DOUBLE PRECISION DPI + PARAMETER (DPI=3.141592653589793238462643D0) + DOUBLE PRECISION D90 + PARAMETER (D90=DPI/2D0) + DOUBLE PRECISION TINY + PARAMETER (TINY=1D-12) + DOUBLE PRECISION PN,AN,DN,SA,CA,SASP,QT,QB,HPT,T + DOUBLE PRECISION slDA1P + + +* Preset status flags to OK + J1=0 + J2=0 + +* Adjust latitude, azimuth, declination to avoid critical values + PN=slDA1P(P) + IF (ABS(ABS(PN)-D90).LT.TINY) THEN + PN=PN-SIGN(TINY,PN) + ELSE IF (ABS(PN).LT.TINY) THEN + PN=TINY + END IF + AN=slDA1P(A) + IF (ABS(ABS(AN)-DPI).LT.TINY) THEN + AN=AN-SIGN(TINY,AN) + ELSE IF (ABS(AN).LT.TINY) THEN + AN=TINY + END IF + DN=slDA1P(D) + IF (ABS(ABS(DN)-ABS(P)).LT.TINY) THEN + DN=DN-SIGN(TINY,DN) + ELSE IF (ABS(ABS(DN)-D90).LT.TINY) THEN + DN=DN-SIGN(TINY,DN) + ELSE IF (ABS(DN).LT.TINY) THEN + DN=TINY + END IF + +* Useful functions + SA=SIN(AN) + CA=COS(AN) + SASP=SA*SIN(PN) + +* Quotient giving sin(h+t) + QT=SIN(DN)*SA*COS(PN) + QB=COS(DN)*SQRT(CA*CA+SASP*SASP) + +* Any solutions? + IF (ABS(QT).LE.QB) THEN + +* Yes: find h+t and t + HPT=ASIN(QT/QB) + T=ATAN2(SASP,-CA) + +* The two solutions + H1=slDA1P(HPT-T) + H2=slDA1P(-HPT-(T+DPI)) + +* Reject unless h and A different signs + IF (H1*AN.GT.0D0) J1=-1 + IF (H2*AN.GT.0D0) J2=-1 + ELSE + J1=-1 + J2=-1 + END IF + + END diff --git a/math/slalib/pdq2h.f b/math/slalib/pdq2h.f new file mode 100644 index 00000000..678bb3d7 --- /dev/null +++ b/math/slalib/pdq2h.f @@ -0,0 +1,116 @@ + SUBROUTINE slPDQH (P, D, Q, H1, J1, H2, J2) +*+ +* - - - - - - +* P D Q H +* - - - - - - +* +* Hour Angle corresponding to a given parallactic angle +* +* (double precision) +* +* Given: +* P d latitude +* D d declination +* Q d parallactic angle +* +* Returned: +* H1 d hour angle: first solution if any +* J1 i flag: 0 = solution 1 is valid +* H2 d hour angle: second solution if any +* J2 i flag: 0 = solution 2 is valid +* +* Called: slDA1P +* +* P.T.Wallace Starlink 6 October 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION P,D,Q,H1 + INTEGER J1 + DOUBLE PRECISION H2 + INTEGER J2 + + DOUBLE PRECISION DPI + PARAMETER (DPI=3.141592653589793238462643D0) + DOUBLE PRECISION D90 + PARAMETER (D90=DPI/2D0) + DOUBLE PRECISION TINY + PARAMETER (TINY=1D-12) + DOUBLE PRECISION PN,QN,DN,SQ,CQ,SQSD,QT,QB,HPT,T + DOUBLE PRECISION slDA1P + + +* Preset status flags to OK + J1=0 + J2=0 + +* Adjust latitude, declination, parallactic angle to avoid critical values + PN=slDA1P(P) + IF (ABS(ABS(PN)-D90).LT.TINY) THEN + PN=PN-SIGN(TINY,PN) + ELSE IF (ABS(PN).LT.TINY) THEN + PN=TINY + END IF + QN=slDA1P(Q) + IF (ABS(ABS(QN)-DPI).LT.TINY) THEN + QN=QN-SIGN(TINY,QN) + ELSE IF (ABS(QN).LT.TINY) THEN + QN=TINY + END IF + DN=slDA1P(D) + IF (ABS(ABS(D)-ABS(P)).LT.TINY) THEN + DN=DN-SIGN(TINY,DN) + ELSE IF (ABS(ABS(D)-D90).LT.TINY) THEN + DN=DN-SIGN(TINY,DN) + END IF + +* Useful functions + SQ=SIN(QN) + CQ=COS(QN) + SQSD=SQ*SIN(DN) + +* Quotient giving sin(h+t) + QT=SIN(PN)*SQ*COS(DN) + QB=COS(PN)*SQRT(CQ*CQ+SQSD*SQSD) + +* Any solutions? + IF (ABS(QT).LE.QB) THEN + +* Yes: find h+t and t + HPT=ASIN(QT/QB) + T=ATAN2(SQSD,CQ) + +* The two solutions + H1=slDA1P(HPT-T) + H2=slDA1P(-HPT-(T+DPI)) + +* Reject if h and Q different signs + IF (H1*QN.LT.0D0) J1=-1 + IF (H2*QN.LT.0D0) J2=-1 + ELSE + J1=-1 + J2=-1 + END IF + + END diff --git a/math/slalib/permut.f b/math/slalib/permut.f new file mode 100644 index 00000000..b5aee8b7 --- /dev/null +++ b/math/slalib/permut.f @@ -0,0 +1,160 @@ + SUBROUTINE slPERM ( N, ISTATE, IORDER, J ) +*+ +* - - - - - - - +* P E R M U T +* - - - - - - - +* +* Generate the next permutation of a specified number of items. +* +* Given: +* N i number of items: there will be N! permutations +* +* Given and returned: +* ISTATE i(N) state, ISTATE(1)=-1 to initialize +* +* Returned: +* IORDER i(N) next permutation of numbers 1,2,...,N +* J i status: -1 = illegal N (zero or less is illegal) +* 0 = OK +* +1 = no more permutations available +* +* Notes: +* +* 1) This routine returns, in the IORDER array, the integers 1 to N +* inclusive, in an order that depends on the current contents of +* the ISTATE array. Before calling the routine for the first +* time, the caller must set the first element of the ISTATE array +* to -1 (any negative number will do) to cause the ISTATE array +* to be fully initialized. +* +* 2) The first permutation to be generated is: +* +* IORDER(1)=N, IORDER(2)=N-1, ..., IORDER(N)=1 +* +* This is also the permutation returned for the "finished" +* (J=1) case. +* +* The final permutation to be generated is: +* +* IORDER(1)=1, IORDER(2)=2, ..., IORDER(N)=N +* +* 3) If the "finished" (J=1) status is ignored, the routine continues +* to deliver permutations, the pattern repeating every N! calls. +* +* Last revision: 19 February 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER N,IORDER(N),ISTATE(N),J + + INTEGER I,IP1,ISLOT,ISKIP + + +* ------------- +* Preliminaries +* ------------- + +* Validate, and set status. + IF (N.LT.1) THEN + J = -1 + GO TO 9999 + ELSE + J = 0 + END IF + +* If just starting, initialize state array + IF (ISTATE(1).LT.0) THEN + ISTATE(1) = -1 + DO I=2,N + ISTATE(I) = 0 + END DO + END IF + +* -------------------------- +* Increment the state number +* -------------------------- + +* The state number, maintained in the ISTATE array, is a mixed-radix +* number with N! states. The least significant digit, with a radix of +* 1, is in ISTATE(1). The next digit, in ISTATE(2), has a radix of 2, +* and so on. + +* Increment the least-significant digit of the state number. + ISTATE(1) = ISTATE(1)+1 + +* Digit by digit starting with the least significant. + DO I=1,N + +* Carry? + IF (ISTATE(I).GE.I) THEN + +* Yes: reset the current digit. + ISTATE(I) = 0 + +* Overflow? + IF (I.GE.N) THEN + +* Yes: there are no more permutations. + J = 1 + ELSE + +* No: carry. + IP1 = I+1 + ISTATE(IP1) = ISTATE(IP1)+1 + END IF + END IF + END DO + +* ------------------------------------------------------------------- +* Translate the state number into the corresponding permutation order +* ------------------------------------------------------------------- + +* Initialize the order array. All but one element will be overwritten. + DO I=1,N + IORDER(I) = 1 + END DO + +* Look at each state number digit, starting with the most significant. + DO I=N,2,-1 + +* Initialize the position where the new number will go. + ISLOT = 0 + +* The state number digit says which unfilled slot is to be used. + DO ISKIP=0,ISTATE(I) + +* Increment the slot number until an unused slot is found. + ISLOT = ISLOT+1 + DO WHILE (IORDER(ISLOT).GT.1) + ISLOT = ISLOT+1 + END DO + END DO + +* Store the number in the permutation order array. + IORDER(ISLOT) = I + END DO + + 9999 CONTINUE + + END diff --git a/math/slalib/pertel.f b/math/slalib/pertel.f new file mode 100644 index 00000000..06bf3c42 --- /dev/null +++ b/math/slalib/pertel.f @@ -0,0 +1,182 @@ + SUBROUTINE slPRTL (JFORM, DATE0, DATE1, + : EPOCH0, ORBI0, ANODE0, PERIH0, AORQ0, E0, AM0, + : EPOCH1, ORBI1, ANODE1, PERIH1, AORQ1, E1, AM1, + : JSTAT) +*+ +* - - - - - - - +* P R T L +* - - - - - - - +* +* Update the osculating orbital elements of an asteroid or comet by +* applying planetary perturbations. +* +* Given (format and dates): +* JFORM i choice of element set (2 or 3; Note 1) +* DATE0 d date of osculation (TT MJD) for the given elements +* DATE1 d date of osculation (TT MJD) for the updated elements +* +* Given (the unperturbed elements): +* EPOCH0 d epoch (TT MJD) of the given element set (Note 2) +* ORBI0 d inclination (radians) +* ANODE0 d longitude of the ascending node (radians) +* PERIH0 d argument of perihelion (radians) +* AORQ0 d mean distance or perihelion distance (AU) +* E0 d eccentricity +* AM0 d mean anomaly (radians, JFORM=2 only) +* +* Returned (the updated elements): +* EPOCH1 d epoch (TT MJD) of the updated element set (Note 2) +* ORBI1 d inclination (radians) +* ANODE1 d longitude of the ascending node (radians) +* PERIH1 d argument of perihelion (radians) +* AORQ1 d mean distance or perihelion distance (AU) +* E1 d eccentricity +* AM1 d mean anomaly (radians, JFORM=2 only) +* +* Returned (status flag): +* JSTAT i status: +102 = warning, distant epoch +* +101 = warning, large timespan ( > 100 years) +* +1 to +10 = coincident with planet (Note 6) +* 0 = OK +* -1 = illegal JFORM +* -2 = illegal E0 +* -3 = illegal AORQ0 +* -4 = internal error +* -5 = numerical error +* +* Notes: +* +* 1 Two different element-format options are available: +* +* Option JFORM=2, suitable for minor planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBI = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e +* AM = mean anomaly M (radians) +* +* Option JFORM=3, suitable for comets: +* +* EPOCH = epoch of perihelion (TT MJD) +* ORBI = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = perihelion distance, q (AU) +* E = eccentricity, e +* +* 2 DATE0, DATE1, EPOCH0 and EPOCH1 are all instants of time in +* the TT timescale (formerly Ephemeris Time, ET), expressed +* as Modified Julian Dates (JD-2400000.5). +* +* DATE0 is the instant at which the given (i.e. unperturbed) +* osculating elements are correct. +* +* DATE1 is the specified instant at which the updated osculating +* elements are correct. +* +* EPOCH0 and EPOCH1 will be the same as DATE0 and DATE1 +* (respectively) for the JFORM=2 case, normally used for minor +* planets. For the JFORM=3 case, the two epochs will refer to +* perihelion passage and so will not, in general, be the same as +* DATE0 and/or DATE1 though they may be similar to one another. +* +* 3 The elements are with respect to the J2000 ecliptic and equinox. +* +* 4 Unused elements (AM0 and AM1 for JFORM=3) are not accessed. +* +* 5 See the slPRTE routine for details of the algorithm used. +* +* 6 This routine is not intended to be used for major planets, which +* is why JFORM=1 is not available and why there is no opportunity +* to specify either the longitude of perihelion or the daily +* motion. However, if JFORM=2 elements are somehow obtained for a +* major planet and supplied to the routine, sensible results will, +* in fact, be produced. This happens because the slPRTE routine +* that is called to perform the calculations checks the separation +* between the body and each of the planets and interprets a +* suspiciously small value (0.001 AU) as an attempt to apply it to +* the planet concerned. If this condition is detected, the +* contribution from that planet is ignored, and the status is set to +* the planet number (1-10 = Mercury, Venus, EMB, Mars, Jupiter, +* Saturn, Uranus, Neptune, Earth, Moon) as a warning. +* +* Reference: +* +* Sterne, Theodore E., "An Introduction to Celestial Mechanics", +* Interscience Publishers Inc., 1960. Section 6.7, p199. +* +* Called: slELUE, slPRTE, slUEEL +* +* This revision: 19 June 2004 +* +* Copyright (C) 2004 P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + INTEGER JFORM + DOUBLE PRECISION DATE0,DATE1, + : EPOCH0,ORBI0,ANODE0,PERIH0,AORQ0,E0,AM0, + : EPOCH1,ORBI1,ANODE1,PERIH1,AORQ1,E1,AM1 + INTEGER JSTAT + + DOUBLE PRECISION U(13),DM + INTEGER J,JF + + + +* Check that the elements are either minor-planet or comet format. + IF (JFORM.LT.2.OR.JFORM.GT.3) THEN + JSTAT = -1 + GO TO 9999 + ELSE + +* Provisionally set the status to OK. + JSTAT = 0 + END IF + +* Transform the elements from conventional to universal form. + CALL slELUE(DATE0,JFORM,EPOCH0,ORBI0,ANODE0,PERIH0, + : AORQ0,E0,AM0,0D0,U,J) + IF (J.NE.0) THEN + JSTAT = J + GO TO 9999 + END IF + +* Update the universal elements. + CALL slPRTE(DATE1,U,J) + IF (J.GT.0) THEN + JSTAT = J + ELSE IF (J.LT.0) THEN + JSTAT = -5 + GO TO 9999 + END IF + +* Transform from universal to conventional elements. + CALL slUEEL(U,JFORM, + : JF, EPOCH1, ORBI1, ANODE1, PERIH1, + : AORQ1, E1, AM1, DM, J) + IF (JF.NE.JFORM.OR.J.NE.0) JSTAT=-5 + + 9999 CONTINUE + END diff --git a/math/slalib/pertue.f b/math/slalib/pertue.f new file mode 100644 index 00000000..fc9683c5 --- /dev/null +++ b/math/slalib/pertue.f @@ -0,0 +1,644 @@ + SUBROUTINE slPRTE (DATE, U, JSTAT) +*+ +* - - - - - - - +* P R T E +* - - - - - - - +* +* Update the universal elements of an asteroid or comet by applying +* planetary perturbations. +* +* Given: +* DATE d final epoch (TT MJD) for the updated elements +* +* Given and returned: +* U d(13) universal elements (updated in place) +* +* (1) combined mass (M+m) +* (2) total energy of the orbit (alpha) +* (3) reference (osculating) epoch (t0) +* (4-6) position at reference epoch (r0) +* (7-9) velocity at reference epoch (v0) +* (10) heliocentric distance at reference epoch +* (11) r0.v0 +* (12) date (t) +* (13) universal eccentric anomaly (psi) of date, approx +* +* Returned: +* JSTAT i status: +* +102 = warning, distant epoch +* +101 = warning, large timespan ( > 100 years) +* +1 to +10 = coincident with major planet (Note 5) +* 0 = OK +* -1 = numerical error +* +* Called: slEPJ, slPLNT, slPVUE, slUEPV, slEPV, +* slPREC, slDMON, slDMXV +* +* Notes: +* +* 1 The "universal" elements are those which define the orbit for the +* purposes of the method of universal variables (see reference 2). +* They consist of the combined mass of the two bodies, an epoch, +* and the position and velocity vectors (arbitrary reference frame) +* at that epoch. The parameter set used here includes also various +* quantities that can, in fact, be derived from the other +* information. This approach is taken to avoiding unnecessary +* computation and loss of accuracy. The supplementary quantities +* are (i) alpha, which is proportional to the total energy of the +* orbit, (ii) the heliocentric distance at epoch, (iii) the +* outwards component of the velocity at the given epoch, (iv) an +* estimate of psi, the "universal eccentric anomaly" at a given +* date and (v) that date. +* +* 2 The universal elements are with respect to the J2000 equator and +* equinox. +* +* 3 The epochs DATE, U(3) and U(12) are all Modified Julian Dates +* (JD-2400000.5). +* +* 4 The algorithm is a simplified form of Encke's method. It takes as +* a basis the unperturbed motion of the body, and numerically +* integrates the perturbing accelerations from the major planets. +* The expression used is essentially Sterne's 6.7-2 (reference 1). +* Everhart and Pitkin (reference 2) suggest rectifying the orbit at +* each integration step by propagating the new perturbed position +* and velocity as the new universal variables. In the present +* routine the orbit is rectified less frequently than this, in order +* to gain a slight speed advantage. However, the rectification is +* done directly in terms of position and velocity, as suggested by +* Everhart and Pitkin, bypassing the use of conventional orbital +* elements. +* +* The f(q) part of the full Encke method is not used. The purpose +* of this part is to avoid subtracting two nearly equal quantities +* when calculating the "indirect member", which takes account of the +* small change in the Sun's attraction due to the slightly displaced +* position of the perturbed body. A simpler, direct calculation in +* double precision proves to be faster and not significantly less +* accurate. +* +* Apart from employing a variable timestep, and occasionally +* "rectifying the orbit" to keep the indirect member small, the +* integration is done in a fairly straightforward way. The +* acceleration estimated for the middle of the timestep is assumed +* to apply throughout that timestep; it is also used in the +* extrapolation of the perturbations to the middle of the next +* timestep, to predict the new disturbed position. There is no +* iteration within a timestep. +* +* Measures are taken to reach a compromise between execution time +* and accuracy. The starting-point is the goal of achieving +* arcsecond accuracy for ordinary minor planets over a ten-year +* timespan. This goal dictates how large the timesteps can be, +* which in turn dictates how frequently the unperturbed motion has +* to be recalculated from the osculating elements. +* +* Within predetermined limits, the timestep for the numerical +* integration is varied in length in inverse proportion to the +* magnitude of the net acceleration on the body from the major +* planets. +* +* The numerical integration requires estimates of the major-planet +* motions. Approximate positions for the major planets (Pluto +* alone is omitted) are obtained from the routine slPLNT. Two +* levels of interpolation are used, to enhance speed without +* significantly degrading accuracy. At a low frequency, the routine +* slPLNT is called to generate updated position+velocity "state +* vectors". The only task remaining to be carried out at the full +* frequency (i.e. at each integration step) is to use the state +* vectors to extrapolate the planetary positions. In place of a +* strictly linear extrapolation, some allowance is made for the +* curvature of the orbit by scaling back the radius vector as the +* linear extrapolation goes off at a tangent. +* +* Various other approximations are made. For example, perturbations +* by Pluto and the minor planets are neglected and relativistic +* effects are not taken into account. +* +* In the interests of simplicity, the background calculations for +* the major planets are carried out en masse. The mean elements and +* state vectors for all the planets are refreshed at the same time, +* without regard for orbit curvature, mass or proximity. +* +* The Earth-Moon system is treated as a single body when the body is +* distant but as separate bodies when closer to the EMB than the +* parameter RNE, which incurs a time penalty but improves accuracy +* for near-Earth objects. +* +* 5 This routine is not intended to be used for major planets. +* However, if major-planet elements are supplied, sensible results +* will, in fact, be produced. This happens because the routine +* checks the separation between the body and each of the planets and +* interprets a suspiciously small value (0.001 AU) as an attempt to +* apply the routine to the planet concerned. If this condition is +* detected, the contribution from that planet is ignored, and the +* status is set to the planet number (1-10 = Mercury, Venus, EMB, +* Mars, Jupiter, Saturn, Uranus, Neptune, Earth, Moon) as a warning. +* +* References: +* +* 1 Sterne, Theodore E., "An Introduction to Celestial Mechanics", +* Interscience Publishers Inc., 1960. Section 6.7, p199. +* +* 2 Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. +* +* Last revision: 27 December 2004 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + DOUBLE PRECISION DATE,U(13) + INTEGER JSTAT + +* Distance from EMB at which Earth and Moon are treated separately + DOUBLE PRECISION RNE + PARAMETER (RNE=1D0) + +* Coincidence with major planet distance + DOUBLE PRECISION COINC + PARAMETER (COINC=0.0001D0) + +* Coefficient relating timestep to perturbing force + DOUBLE PRECISION TSC + PARAMETER (TSC=1D-4) + +* Minimum and maximum timestep (days) + DOUBLE PRECISION TSMIN,TSMAX + PARAMETER (TSMIN=0.01D0,TSMAX=10D0) + +* Age limit for major-planet state vector (days) + DOUBLE PRECISION AGEPMO + PARAMETER (AGEPMO=5D0) + +* Age limit for major-planet mean elements (days) + DOUBLE PRECISION AGEPEL + PARAMETER (AGEPEL=50D0) + +* Margin for error when deciding whether to renew the planetary data + DOUBLE PRECISION TINY + PARAMETER (TINY=1D-6) + +* Age limit for the body's osculating elements (before rectification) + DOUBLE PRECISION AGEBEL + PARAMETER (AGEBEL=100D0) + +* Gaussian gravitational constant (exact) and square + DOUBLE PRECISION GCON,GCON2 + PARAMETER (GCON=0.01720209895D0,GCON2=GCON*GCON) + +* The final epoch + DOUBLE PRECISION TFINAL + +* The body's current universal elements + DOUBLE PRECISION UL(13) + +* Current reference epoch + DOUBLE PRECISION T0 + +* Timespan from latest orbit rectification to final epoch (days) + DOUBLE PRECISION TSPAN + +* Time left to go before integration is complete + DOUBLE PRECISION TLEFT + +* Time direction flag: +1=forwards, -1=backwards + DOUBLE PRECISION FB + +* First-time flag + LOGICAL FIRST + +* +* The current perturbations +* +* Epoch (days relative to current reference epoch) + DOUBLE PRECISION RTN +* Position (AU) + DOUBLE PRECISION PERP(3) +* Velocity (AU/d) + DOUBLE PRECISION PERV(3) +* Acceleration (AU/d/d) + DOUBLE PRECISION PERA(3) +* + +* Length of current timestep (days), and half that + DOUBLE PRECISION TS,HTS + +* Epoch of middle of timestep + DOUBLE PRECISION T + +* Epoch of planetary mean elements + DOUBLE PRECISION TPEL + +* Planet number (1=Mercury, 2=Venus, 3=EMB...8=Neptune) + INTEGER NP + +* Planetary universal orbital elements + DOUBLE PRECISION UP(13,8) + +* Epoch of planetary state vectors + DOUBLE PRECISION TPMO + +* State vectors for the major planets (AU,AU/s) + DOUBLE PRECISION PVIN(6,8) + +* Earth velocity and position vectors (AU,AU/s) + DOUBLE PRECISION VB(3),PB(3),VH(3),PE(3) + +* Moon geocentric state vector (AU,AU/s) and position part + DOUBLE PRECISION PVM(6),PM(3) + +* Date to J2000 de-precession matrix + DOUBLE PRECISION PMAT(3,3) + +* +* Correction terms for extrapolated major planet vectors +* +* Sun-to-planet distances squared multiplied by 3 + DOUBLE PRECISION R2X3(8) +* Sunward acceleration terms, G/2R^3 + DOUBLE PRECISION GC(8) +* Tangential-to-circular correction factor + DOUBLE PRECISION FC +* Radial correction factor due to Sunwards acceleration + DOUBLE PRECISION FG +* + +* The body's unperturbed and perturbed state vectors (AU,AU/s) + DOUBLE PRECISION PV0(6),PV(6) + +* The body's perturbed and unperturbed heliocentric distances (AU) cubed + DOUBLE PRECISION R03,R3 + +* The perturbating accelerations, indirect and direct + DOUBLE PRECISION FI(3),FD(3) + +* Sun-to-planet vector, and distance cubed + DOUBLE PRECISION RHO(3),RHO3 + +* Body-to-planet vector, and distance cubed + DOUBLE PRECISION DELTA(3),DELTA3 + +* Miscellaneous + INTEGER I,J + DOUBLE PRECISION R2,W,DT,DT2,R,FT + LOGICAL NE + + DOUBLE PRECISION slEPJ + +* Planetary inverse masses, Mercury through Neptune then Earth and Moon + DOUBLE PRECISION AMAS(10) + DATA AMAS / 6023600D0, 408523.5D0, 328900.5D0, 3098710D0, + : 1047.355D0, 3498.5D0, 22869D0, 19314D0, + : 332946.038D0, 27068709D0 / + +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*----------------------------------------------------------------------* + + +* Preset the status to OK. + JSTAT = 0 + +* Copy the final epoch. + TFINAL = DATE + +* Copy the elements (which will be periodically updated). + DO I=1,13 + UL(I) = U(I) + END DO + +* Initialize the working reference epoch. + T0=UL(3) + +* Total timespan (days) and hence time left. + TSPAN = TFINAL-T0 + TLEFT = TSPAN + +* Warn if excessive. + IF (ABS(TSPAN).GT.36525D0) JSTAT=101 + +* Time direction: +1 for forwards, -1 for backwards. + FB = SIGN(1D0,TSPAN) + +* Initialize relative epoch for start of current timestep. + RTN = 0D0 + +* Reset the perturbations (position, velocity, acceleration). + DO I=1,3 + PERP(I) = 0D0 + PERV(I) = 0D0 + PERA(I) = 0D0 + END DO + +* Set "first iteration" flag. + FIRST = .TRUE. + +* Step through the time left. + DO WHILE (FB*TLEFT.GT.0D0) + +* Magnitude of current acceleration due to planetary attractions. + IF (FIRST) THEN + TS = TSMIN + ELSE + R2 = 0D0 + DO I=1,3 + W = FD(I) + R2 = R2+W*W + END DO + W = SQRT(R2) + +* Use the acceleration to decide how big a timestep can be tolerated. + IF (W.NE.0D0) THEN + TS = MIN(TSMAX,MAX(TSMIN,TSC/W)) + ELSE + TS = TSMAX + END IF + END IF + TS = TS*FB + +* Override if final epoch is imminent. + TLEFT = TSPAN-RTN + IF (ABS(TS).GT.ABS(TLEFT)) TS=TLEFT + +* Epoch of middle of timestep. + HTS = TS/2D0 + T = T0+RTN+HTS + +* Is it time to recompute the major-planet elements? + IF (FIRST.OR.ABS(T-TPEL)-AGEPEL.GE.TINY) THEN + +* Yes: go forward in time by just under the maximum allowed. + TPEL = T+FB*AGEPEL + +* Compute the state vector for the new epoch. + DO NP=1,8 + CALL slPLNT(TPEL,NP,PV,J) + +* Warning if remote epoch, abort if error. + IF (J.EQ.1) THEN + JSTAT = 102 + ELSE IF (J.NE.0) THEN + GO TO 9010 + END IF + +* Transform the vector into universal elements. + CALL slPVUE(PV,TPEL,0D0,UP(1,NP),J) + IF (J.NE.0) GO TO 9010 + END DO + END IF + +* Is it time to recompute the major-planet motions? + IF (FIRST.OR.ABS(T-TPMO)-AGEPMO.GE.TINY) THEN + +* Yes: look ahead. + TPMO = T+FB*AGEPMO + +* Compute the motions of each planet (AU,AU/d). + DO NP=1,8 + +* The planet's position and velocity (AU,AU/s). + CALL slUEPV(TPMO,UP(1,NP),PVIN(1,NP),J) + IF (J.NE.0) GO TO 9010 + +* Scale velocity to AU/d. + DO J=4,6 + PVIN(J,NP) = PVIN(J,NP)*86400D0 + END DO + +* Precompute also the extrapolation correction terms. + R2 = 0D0 + DO I=1,3 + W = PVIN(I,NP) + R2 = R2+W*W + END DO + R2X3(NP) = R2*3D0 + GC(NP) = GCON2/(2D0*R2*SQRT(R2)) + END DO + END IF + +* Reset the first-time flag. + FIRST = .FALSE. + +* Unperturbed motion of the body at middle of timestep (AU,AU/s). + CALL slUEPV(T,UL,PV0,J) + IF (J.NE.0) GO TO 9010 + +* Perturbed position of the body (AU) and heliocentric distance cubed. + R2 = 0D0 + DO I=1,3 + W = PV0(I)+PERP(I)+(PERV(I)+PERA(I)*HTS/2D0)*HTS + PV(I) = W + R2 = R2+W*W + END DO + R3 = R2*SQRT(R2) + +* The body's unperturbed heliocentric distance cubed. + R2 = 0D0 + DO I=1,3 + W = PV0(I) + R2 = R2+W*W + END DO + R03 = R2*SQRT(R2) + +* Compute indirect and initialize direct parts of the perturbation. + DO I=1,3 + FI(I) = PV0(I)/R03-PV(I)/R3 + FD(I) = 0D0 + END DO + +* Ready to compute the direct planetary effects. + +* Reset the "near-Earth" flag. + NE = .FALSE. + +* Interval from state-vector epoch to middle of current timestep. + DT = T-TPMO + DT2 = DT*DT + +* Planet by planet, including separate Earth and Moon. + DO NP=1,10 + +* Which perturbing body? + IF (NP.LE.8) THEN + +* Planet: compute the extrapolation in longitude (squared). + R2 = 0D0 + DO J=4,6 + W = PVIN(J,NP)*DT + R2 = R2+W*W + END DO + +* Hence the tangential-to-circular correction factor. + FC = 1D0+R2/R2X3(NP) + +* The radial correction factor due to the inwards acceleration. + FG = 1D0-GC(NP)*DT2 + +* Planet's position. + DO I=1,3 + RHO(I) = FG*(PVIN(I,NP)+FC*PVIN(I+3,NP)*DT) + END DO + + ELSE IF (NE) THEN + +* Near-Earth and either Earth or Moon. + + IF (NP.EQ.9) THEN + +* Earth: position. + CALL slEPV(T,PE,VH,PB,VB) + DO I=1,3 + RHO(I) = PE(I) + END DO + + ELSE + +* Moon: position. + CALL slPREC(slEPJ(T),2000D0,PMAT) + CALL slDMON(T,PVM) + CALL slDMXV(PMAT,PVM,PM) + DO I=1,3 + RHO(I) = PM(I)+PE(I) + END DO + END IF + END IF + +* Proceed unless Earth or Moon and not the near-Earth case. + IF (NP.LE.8.OR.NE) THEN + +* Heliocentric distance cubed. + R2 = 0D0 + DO I=1,3 + W = RHO(I) + R2 = R2+W*W + END DO + R = SQRT(R2) + RHO3 = R2*R + +* Body-to-planet vector, and distance. + R2 = 0D0 + DO I=1,3 + W = RHO(I)-PV(I) + DELTA(I) = W + R2 = R2+W*W + END DO + R = SQRT(R2) + +* If this is the EMB, set the near-Earth flag appropriately. + IF (NP.EQ.3.AND.R.LT.RNE) NE = .TRUE. + +* Proceed unless EMB and this is the near-Earth case. + IF (.NOT.(NE.AND.NP.EQ.3)) THEN + +* If too close, ignore this planet and set a warning. + IF (R.LT.COINC) THEN + JSTAT = NP + + ELSE + +* Accumulate "direct" part of perturbation acceleration. + DELTA3 = R2*R + W = AMAS(NP) + DO I=1,3 + FD(I) = FD(I)+(DELTA(I)/DELTA3-RHO(I)/RHO3)/W + END DO + END IF + END IF + END IF + END DO + +* Update the perturbations to the end of the timestep. + RTN = RTN+TS + DO I=1,3 + W = (FI(I)+FD(I))*GCON2 + FT = W*TS + PERP(I) = PERP(I)+(PERV(I)+FT/2D0)*TS + PERV(I) = PERV(I)+FT + PERA(I) = W + END DO + +* Time still to go. + TLEFT = TSPAN-RTN + +* Is it either time to rectify the orbit or the last time through? + IF (ABS(RTN).GE.AGEBEL.OR.FB*TLEFT.LE.0D0) THEN + +* Yes: update to the end of the current timestep. + T0 = T0+RTN + RTN = 0D0 + +* The body's unperturbed motion (AU,AU/s). + CALL slUEPV(T0,UL,PV0,J) + IF (J.NE.0) GO TO 9010 + +* Add and re-initialize the perturbations. + DO I=1,3 + J = I+3 + PV(I) = PV0(I)+PERP(I) + PV(J) = PV0(J)+PERV(I)/86400D0 + PERP(I) = 0D0 + PERV(I) = 0D0 + PERA(I) = FD(I)*GCON2 + END DO + +* Use the position and velocity to set up new universal elements. + CALL slPVUE(PV,T0,0D0,UL,J) + IF (J.NE.0) GO TO 9010 + +* Adjust the timespan and time left. + TSPAN = TFINAL-T0 + TLEFT = TSPAN + END IF + +* Next timestep. + END DO + +* Return the updated universal-element set. + DO I=1,13 + U(I) = UL(I) + END DO + +* Finished. + GO TO 9999 + +* Miscellaneous numerical error. + 9010 CONTINUE + JSTAT = -1 + + 9999 CONTINUE + END diff --git a/math/slalib/planel.f b/math/slalib/planel.f new file mode 100644 index 00000000..666a4036 --- /dev/null +++ b/math/slalib/planel.f @@ -0,0 +1,184 @@ + SUBROUTINE slPLNE (DATE, JFORM, EPOCH, ORBINC, ANODE, PERIH, + : AORQ, E, AORL, DM, PV, JSTAT) +*+ +* - - - - - - - +* P L N L +* - - - - - - - +* +* Heliocentric position and velocity of a planet, asteroid or comet, +* starting from orbital elements. +* +* Given: +* DATE d date, Modified Julian Date (JD - 2400000.5, Note 1) +* JFORM i choice of element set (1-3; Note 3) +* EPOCH d epoch of elements (TT MJD, Note 4) +* ORBINC d inclination (radians) +* ANODE d longitude of the ascending node (radians) +* PERIH d longitude or argument of perihelion (radians) +* AORQ d mean distance or perihelion distance (AU) +* E d eccentricity +* AORL d mean anomaly or longitude (radians, JFORM=1,2 only) +* DM d daily motion (radians, JFORM=1 only) +* +* Returned: +* PV d(6) heliocentric x,y,z,xdot,ydot,zdot of date, +* J2000 equatorial triad (AU,AU/s) +* JSTAT i status: 0 = OK +* -1 = illegal JFORM +* -2 = illegal E +* -3 = illegal AORQ +* -4 = illegal DM +* -5 = numerical error +* +* Called: slELUE, slUEPV +* +* Notes +* +* 1 DATE is the instant for which the prediction is required. It is +* in the TT timescale (formerly Ephemeris Time, ET) and is a +* Modified Julian Date (JD-2400000.5). +* +* 2 The elements are with respect to the J2000 ecliptic and equinox. +* +* 3 A choice of three different element-set options is available: +* +* Option JFORM = 1, suitable for the major planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = longitude of perihelion, curly pi (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e (range 0 to <1) +* AORL = mean longitude L (radians) +* DM = daily motion (radians) +* +* Option JFORM = 2, suitable for minor planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e (range 0 to <1) +* AORL = mean anomaly M (radians) +* +* Option JFORM = 3, suitable for comets: +* +* EPOCH = epoch of elements and perihelion (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = perihelion distance, q (AU) +* E = eccentricity, e (range 0 to 10) +* +* Unused arguments (DM for JFORM=2, AORL and DM for JFORM=3) are not +* accessed. +* +* 4 Each of the three element sets defines an unperturbed heliocentric +* orbit. For a given epoch of observation, the position of the body +* in its orbit can be predicted from these elements, which are +* called "osculating elements", using standard two-body analytical +* solutions. However, due to planetary perturbations, a given set +* of osculating elements remains usable for only as long as the +* unperturbed orbit that it describes is an adequate approximation +* to reality. Attached to such a set of elements is a date called +* the "osculating epoch", at which the elements are, momentarily, +* a perfect representation of the instantaneous position and +* velocity of the body. +* +* Therefore, for any given problem there are up to three different +* epochs in play, and it is vital to distinguish clearly between +* them: +* +* . The epoch of observation: the moment in time for which the +* position of the body is to be predicted. +* +* . The epoch defining the position of the body: the moment in time +* at which, in the absence of purturbations, the specified +* position (mean longitude, mean anomaly, or perihelion) is +* reached. +* +* . The osculating epoch: the moment in time at which the given +* elements are correct. +* +* For the major-planet and minor-planet cases it is usual to make +* the epoch that defines the position of the body the same as the +* epoch of osculation. Thus, only two different epochs are +* involved: the epoch of the elements and the epoch of observation. +* +* For comets, the epoch of perihelion fixes the position in the +* orbit and in general a different epoch of osculation will be +* chosen. Thus, all three types of epoch are involved. +* +* For the present routine: +* +* . The epoch of observation is the argument DATE. +* +* . The epoch defining the position of the body is the argument +* EPOCH. +* +* . The osculating epoch is not used and is assumed to be close +* enough to the epoch of observation to deliver adequate accuracy. +* If not, a preliminary call to slPRTL may be used to update +* the element-set (and its associated osculating epoch) by +* applying planetary perturbations. +* +* 5 The reference frame for the result is with respect to the mean +* equator and equinox of epoch J2000. +* +* 6 The algorithm was originally adapted from the EPHSLA program of +* D.H.P.Jones (private communication, 1996). The method is based +* on Stumpff's Universal Variables. +* +* Reference: Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. +* +* P.T.Wallace Starlink 31 December 2002 +* +* Copyright (C) 2002 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE + INTEGER JFORM + DOUBLE PRECISION EPOCH,ORBINC,ANODE,PERIH,AORQ,E,AORL,DM,PV(6) + INTEGER JSTAT + + DOUBLE PRECISION U(13) + INTEGER J + + + +* Validate elements and convert to "universal variables" parameters. + CALL slELUE(DATE,JFORM, + : EPOCH,ORBINC,ANODE,PERIH,AORQ,E,AORL,DM,U,J) + +* Determine the position and velocity. + IF (J.EQ.0) THEN + CALL slUEPV(DATE,U,PV,J) + IF (J.NE.0) J=-5 + END IF + +* Wrap up. + JSTAT = J + + END diff --git a/math/slalib/planet.f b/math/slalib/planet.f new file mode 100644 index 00000000..02590c65 --- /dev/null +++ b/math/slalib/planet.f @@ -0,0 +1,725 @@ + SUBROUTINE slPLNT (DATE, NP, PV, JSTAT) +*+ +* - - - - - - - +* P L N T +* - - - - - - - +* +* Approximate heliocentric position and velocity of a specified +* major planet. +* +* Given: +* DATE d Modified Julian Date (JD - 2400000.5) +* NP i planet (1=Mercury, 2=Venus, 3=EMB ... 9=Pluto) +* +* Returned: +* PV d(6) heliocentric x,y,z,xdot,ydot,zdot, J2000 +* equatorial triad (AU,AU/s) +* JSTAT i status: +1 = warning: date out of range +* 0 = OK +* -1 = illegal NP (outside 1-9) +* -2 = solution didn't converge +* +* Called: slPLNE +* +* Notes +* +* 1 The epoch, DATE, is in the TDB timescale and is a Modified +* Julian Date (JD-2400000.5). +* +* 2 The reference frame is equatorial and is with respect to the +* mean equinox and ecliptic of epoch J2000. +* +* 3 If an NP value outside the range 1-9 is supplied, an error +* status (JSTAT = -1) is returned and the PV vector set to zeroes. +* +* 4 The algorithm for obtaining the mean elements of the planets +* from Mercury to Neptune is due to J.L. Simon, P. Bretagnon, +* J. Chapront, M. Chapront-Touze, G. Francou and J. Laskar +* (Bureau des Longitudes, Paris). The (completely different) +* algorithm for calculating the ecliptic coordinates of Pluto +* is by Meeus. +* +* 5 Comparisons of the present routine with the JPL DE200 ephemeris +* give the following RMS errors over the interval 1960-2025: +* +* position (km) speed (metre/sec) +* +* Mercury 334 0.437 +* Venus 1060 0.855 +* EMB 2010 0.815 +* Mars 7690 1.98 +* Jupiter 71700 7.70 +* Saturn 199000 19.4 +* Uranus 564000 16.4 +* Neptune 158000 14.4 +* Pluto 36400 0.137 +* +* From comparisons with DE102, Simon et al quote the following +* longitude accuracies over the interval 1800-2200: +* +* Mercury 4" +* Venus 5" +* EMB 6" +* Mars 17" +* Jupiter 71" +* Saturn 81" +* Uranus 86" +* Neptune 11" +* +* In the case of Pluto, Meeus quotes an accuracy of 0.6 arcsec +* in longitude and 0.2 arcsec in latitude for the period +* 1885-2099. +* +* For all except Pluto, over the period 1000-3000 the accuracy +* is better than 1.5 times that over 1800-2200. Outside the +* period 1000-3000 the accuracy declines. For Pluto the +* accuracy declines rapidly outside the period 1885-2099. +* Outside these ranges (1885-2099 for Pluto, 1000-3000 for +* the rest) a "date out of range" warning status (JSTAT=+1) +* is returned. +* +* 6 The algorithms for (i) Mercury through Neptune and (ii) Pluto +* are completely independent. In the Mercury through Neptune +* case, the present SLALIB implementation differs from the +* original Simon et al Fortran code in the following respects. +* +* * The date is supplied as a Modified Julian Date rather +* than a Julian Date (MJD = JD - 2400000.5). +* +* * The result is returned only in equatorial Cartesian form; +* the ecliptic longitude, latitude and radius vector are not +* returned. +* +* * The velocity is in AU per second, not AU per day. +* +* * Different error/warning status values are used. +* +* * Kepler's equation is not solved inline. +* +* * Polynomials in T are nested to minimize rounding errors. +* +* * Explicit double-precision constants are used to avoid +* mixed-mode expressions. +* +* * There are other, cosmetic, changes to comply with +* Starlink/SLALIB style guidelines. +* +* None of the above changes affects the result significantly. +* +* 7 For NP=3 the result is for the Earth-Moon Barycentre. To +* obtain the heliocentric position and velocity of the Earth, +* either use the SLALIB routine slEVP (or slEPV) or call +* slDMON and subtract 0.012150581 times the geocentric Moon +* vector from the EMB vector produced by the present routine. +* (The Moon vector should be precessed to J2000 first, but this +* can be omitted for modern epochs without introducing significant +* inaccuracy.) +* +* References: Simon et al., Astron. Astrophys. 282, 663 (1994). +* Meeus, Astronomical Algorithms, Willmann-Bell (1991). +* +* This revision: 19 June 2004 +* +* Copyright (C) 2004 P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE + INTEGER NP + DOUBLE PRECISION PV(6) + INTEGER JSTAT + +* 2Pi, deg to radians, arcsec to radians + DOUBLE PRECISION D2PI,D2R,AS2R + PARAMETER (D2PI=6.283185307179586476925286766559D0, + : D2R=0.017453292519943295769236907684886D0, + : AS2R=4.848136811095359935899141023579D-6) + +* Gaussian gravitational constant (exact) + DOUBLE PRECISION GCON + PARAMETER (GCON=0.01720209895D0) + +* Seconds per Julian century + DOUBLE PRECISION SPC + PARAMETER (SPC=36525D0*86400D0) + +* Sin and cos of J2000 mean obliquity (IAU 1976) + DOUBLE PRECISION SE,CE + PARAMETER (SE=0.3977771559319137D0, + : CE=0.9174820620691818D0) + + INTEGER I,J,IJSP(3,43) + DOUBLE PRECISION AMAS(8),A(3,8),DLM(3,8),E(3,8), + : PI(3,8),DINC(3,8),OMEGA(3,8), + : DKP(9,8),CA(9,8),SA(9,8), + : DKQ(10,8),CLO(10,8),SLO(10,8), + : T,DA,DE,DPE,DI,DO,DMU,ARGA,ARGL,DM, + : AB(2,3,43),DJ0,DS0,DP0,DL0,DLD0,DB0,DR0, + : DJ,DS,DP,DJD,DSD,DPD,WLBR(3),WLBRD(3), + : WJ,WS,WP,AL,ALD,SAL,CAL, + : AC,BC,DL,DLD,DB,DBD,DR,DRD, + : SL,CL,SB,CB,SLCB,CLCB,X,Y,Z,XD,YD,ZD + +* ----------------------- +* Mercury through Neptune +* ----------------------- + +* Planetary inverse masses + DATA AMAS / 6023600D0,408523.5D0,328900.5D0,3098710D0, + : 1047.355D0,3498.5D0,22869D0,19314D0 / + +* +* Tables giving the mean Keplerian elements, limited to T**2 terms: +* +* A semi-major axis (AU) +* DLM mean longitude (degree and arcsecond) +* E eccentricity +* PI longitude of the perihelion (degree and arcsecond) +* DINC inclination (degree and arcsecond) +* OMEGA longitude of the ascending node (degree and arcsecond) +* + DATA A / + : 0.3870983098D0, 0D0, 0D0, + : 0.7233298200D0, 0D0, 0D0, + : 1.0000010178D0, 0D0, 0D0, + : 1.5236793419D0, 3D-10, 0D0, + : 5.2026032092D0, 19132D-10, -39D-10, + : 9.5549091915D0, -0.0000213896D0, 444D-10, + : 19.2184460618D0, -3716D-10, 979D-10, + : 30.1103868694D0, -16635D-10, 686D-10 / +* + DATA DLM / + : 252.25090552D0, 5381016286.88982D0, -1.92789D0, + : 181.97980085D0, 2106641364.33548D0, 0.59381D0, + : 100.46645683D0, 1295977422.83429D0, -2.04411D0, + : 355.43299958D0, 689050774.93988D0, 0.94264D0, + : 34.35151874D0, 109256603.77991D0, -30.60378D0, + : 50.07744430D0, 43996098.55732D0, 75.61614D0, + : 314.05500511D0, 15424811.93933D0, -1.75083D0, + : 304.34866548D0, 7865503.20744D0, 0.21103D0/ +* + DATA E / + : 0.2056317526D0, 0.0002040653D0, -28349D-10, + : 0.0067719164D0, -0.0004776521D0, 98127D-10, + : 0.0167086342D0, -0.0004203654D0, -0.0000126734D0, + : 0.0934006477D0, 0.0009048438D0, -80641D-10, + : 0.0484979255D0, 0.0016322542D0, -0.0000471366D0, + : 0.0555481426D0, -0.0034664062D0, -0.0000643639D0, + : 0.0463812221D0, -0.0002729293D0, 0.0000078913D0, + : 0.0094557470D0, 0.0000603263D0, 0D0 / +* + DATA PI / + : 77.45611904D0, 5719.11590D0, -4.83016D0, + : 131.56370300D0, 175.48640D0, -498.48184D0, + : 102.93734808D0, 11612.35290D0, 53.27577D0, + : 336.06023395D0, 15980.45908D0, -62.32800D0, + : 14.33120687D0, 7758.75163D0, 259.95938D0, + : 93.05723748D0, 20395.49439D0, 190.25952D0, + : 173.00529106D0, 3215.56238D0, -34.09288D0, + : 48.12027554D0, 1050.71912D0, 27.39717D0 / +* + DATA DINC / + : 7.00498625D0, -214.25629D0, 0.28977D0, + : 3.39466189D0, -30.84437D0, -11.67836D0, + : 0D0, 469.97289D0, -3.35053D0, + : 1.84972648D0, -293.31722D0, -8.11830D0, + : 1.30326698D0, -71.55890D0, 11.95297D0, + : 2.48887878D0, 91.85195D0, -17.66225D0, + : 0.77319689D0, -60.72723D0, 1.25759D0, + : 1.76995259D0, 8.12333D0, 0.08135D0 / +* + DATA OMEGA / + : 48.33089304D0, -4515.21727D0, -31.79892D0, + : 76.67992019D0, -10008.48154D0, -51.32614D0, + : 174.87317577D0, -8679.27034D0, 15.34191D0, + : 49.55809321D0, -10620.90088D0, -230.57416D0, + : 100.46440702D0, 6362.03561D0, 326.52178D0, + : 113.66550252D0, -9240.19942D0, -66.23743D0, + : 74.00595701D0, 2669.15033D0, 145.93964D0, + : 131.78405702D0, -221.94322D0, -0.78728D0 / +* +* Tables for trigonometric terms to be added to the mean elements +* of the semi-major axes. +* + DATA DKP / + : 69613, 75645, 88306, 59899, 15746, 71087, 142173, 3086, 0, + : 21863, 32794, 26934, 10931, 26250, 43725, 53867, 28939, 0, + : 16002, 21863, 32004, 10931, 14529, 16368, 15318, 32794, 0, + : 6345, 7818, 15636, 7077, 8184, 14163, 1107, 4872, 0, + : 1760, 1454, 1167, 880, 287, 2640, 19, 2047, 1454, + : 574, 0, 880, 287, 19, 1760, 1167, 306, 574, + : 204, 0, 177, 1265, 4, 385, 200, 208, 204, + : 0, 102, 106, 4, 98, 1367, 487, 204, 0 / +* + DATA CA / + : 4, -13, 11, -9, -9, -3, -1, 4, 0, + : -156, 59, -42, 6, 19, -20, -10, -12, 0, + : 64, -152, 62, -8, 32, -41, 19, -11, 0, + : 124, 621, -145, 208, 54, -57, 30, 15, 0, + : -23437, -2634, 6601, 6259, -1507, -1821, 2620, -2115,-1489, + : 62911,-119919, 79336, 17814,-24241, 12068, 8306, -4893, 8902, + : 389061,-262125,-44088, 8387,-22976, -2093, -615, -9720, 6633, + :-412235,-157046,-31430, 37817, -9740, -13, -7449, 9644, 0 / +* + DATA SA / + : -29, -1, 9, 6, -6, 5, 4, 0, 0, + : -48, -125, -26, -37, 18, -13, -20, -2, 0, + : -150, -46, 68, 54, 14, 24, -28, 22, 0, + : -621, 532, -694, -20, 192, -94, 71, -73, 0, + : -14614,-19828, -5869, 1881, -4372, -2255, 782, 930, 913, + : 139737, 0, 24667, 51123, -5102, 7429, -4095, -1976,-9566, + : -138081, 0, 37205,-49039,-41901,-33872,-27037,-12474,18797, + : 0, 28492,133236, 69654, 52322,-49577,-26430, -3593, 0 / +* +* Tables giving the trigonometric terms to be added to the mean +* elements of the mean longitudes. +* + DATA DKQ / + : 3086, 15746, 69613, 59899, 75645, 88306, 12661, 2658, 0, 0, + : 21863, 32794, 10931, 73, 4387, 26934, 1473, 2157, 0, 0, + : 10, 16002, 21863, 10931, 1473, 32004, 4387, 73, 0, 0, + : 10, 6345, 7818, 1107, 15636, 7077, 8184, 532, 10, 0, + : 19, 1760, 1454, 287, 1167, 880, 574, 2640, 19,1454, + : 19, 574, 287, 306, 1760, 12, 31, 38, 19, 574, + : 4, 204, 177, 8, 31, 200, 1265, 102, 4, 204, + : 4, 102, 106, 8, 98, 1367, 487, 204, 4, 102 / +* + DATA CLO / + : 21, -95, -157, 41, -5, 42, 23, 30, 0, 0, + : -160, -313, -235, 60, -74, -76, -27, 34, 0, 0, + : -325, -322, -79, 232, -52, 97, 55, -41, 0, 0, + : 2268, -979, 802, 602, -668, -33, 345, 201, -55, 0, + : 7610, -4997,-7689,-5841,-2617, 1115, -748, -607, 6074, 354, + : -18549, 30125,20012, -730, 824, 23, 1289, -352,-14767,-2062, + :-135245,-14594, 4197,-4030,-5630,-2898, 2540, -306, 2939, 1986, + : 89948, 2103, 8963, 2695, 3682, 1648, 866, -154, -1963, -283 / +* + DATA SLO / + : -342, 136, -23, 62, 66, -52, -33, 17, 0, 0, + : 524, -149, -35, 117, 151, 122, -71, -62, 0, 0, + : -105, -137, 258, 35, -116, -88, -112, -80, 0, 0, + : 854, -205, -936, -240, 140, -341, -97, -232, 536, 0, + : -56980, 8016, 1012, 1448,-3024,-3710, 318, 503, 3767, 577, + : 138606,-13478,-4964, 1441,-1319,-1482, 427, 1236, -9167,-1918, + : 71234,-41116, 5334,-4935,-1848, 66, 434,-1748, 3780, -701, + : -47645, 11647, 2166, 3194, 679, 0, -244, -419, -2531, 48 / + +* ----- +* Pluto +* ----- + +* +* Coefficients for fundamental arguments: mean longitudes +* (degrees) and mean rate of change of longitude (degrees per +* Julian century) for Jupiter, Saturn and Pluto +* + DATA DJ0, DJD / 34.35D0, 3034.9057D0 / + DATA DS0, DSD / 50.08D0, 1222.1138D0 / + DATA DP0, DPD / 238.96D0, 144.9600D0 / + +* Coefficients for latitude, longitude, radius vector + DATA DL0,DLD0 / 238.956785D0, 144.96D0 / + DATA DB0 / -3.908202D0 / + DATA DR0 / 40.7247248D0 / + +* +* Coefficients for periodic terms (Meeus's Table 36.A) +* +* The coefficients for term n in the series are: +* +* IJSP(1,n) J +* IJSP(2,n) S +* IJSP(3,n) P +* AB(1,1,n) longitude sine (degrees) +* AB(2,1,n) longitude cosine (degrees) +* AB(1,2,n) latitude sine (degrees) +* AB(2,2,n) latitude cosine (degrees) +* AB(1,3,n) radius vector sine (AU) +* AB(2,3,n) radius vector cosine (AU) +* + DATA (IJSP(I, 1),I=1,3),((AB(J,I, 1),J=1,2),I=1,3) / + : 0, 0, 1, + : -19798886D-6, 19848454D-6, + : -5453098D-6, -14974876D-6, + : 66867334D-7, 68955876D-7 / + DATA (IJSP(I, 2),I=1,3),((AB(J,I, 2),J=1,2),I=1,3) / + : 0, 0, 2, + : 897499D-6, -4955707D-6, + : 3527363D-6, 1672673D-6, + : -11826086D-7, -333765D-7 / + DATA (IJSP(I, 3),I=1,3),((AB(J,I, 3),J=1,2),I=1,3) / + : 0, 0, 3, + : 610820D-6, 1210521D-6, + : -1050939D-6, 327763D-6, + : 1593657D-7, -1439953D-7 / + DATA (IJSP(I, 4),I=1,3),((AB(J,I, 4),J=1,2),I=1,3) / + : 0, 0, 4, + : -341639D-6, -189719D-6, + : 178691D-6, -291925D-6, + : -18948D-7, 482443D-7 / + DATA (IJSP(I, 5),I=1,3),((AB(J,I, 5),J=1,2),I=1,3) / + : 0, 0, 5, + : 129027D-6, -34863D-6, + : 18763D-6, 100448D-6, + : -66634D-7, -85576D-7 / + DATA (IJSP(I, 6),I=1,3),((AB(J,I, 6),J=1,2),I=1,3) / + : 0, 0, 6, + : -38215D-6, 31061D-6, + : -30594D-6, -25838D-6, + : 30841D-7, -5765D-7 / + DATA (IJSP(I, 7),I=1,3),((AB(J,I, 7),J=1,2),I=1,3) / + : 0, 1, -1, + : 20349D-6, -9886D-6, + : 4965D-6, 11263D-6, + : -6140D-7, 22254D-7 / + DATA (IJSP(I, 8),I=1,3),((AB(J,I, 8),J=1,2),I=1,3) / + : 0, 1, 0, + : -4045D-6, -4904D-6, + : 310D-6, -132D-6, + : 4434D-7, 4443D-7 / + DATA (IJSP(I, 9),I=1,3),((AB(J,I, 9),J=1,2),I=1,3) / + : 0, 1, 1, + : -5885D-6, -3238D-6, + : 2036D-6, -947D-6, + : -1518D-7, 641D-7 / + DATA (IJSP(I,10),I=1,3),((AB(J,I,10),J=1,2),I=1,3) / + : 0, 1, 2, + : -3812D-6, 3011D-6, + : -2D-6, -674D-6, + : -5D-7, 792D-7 / + DATA (IJSP(I,11),I=1,3),((AB(J,I,11),J=1,2),I=1,3) / + : 0, 1, 3, + : -601D-6, 3468D-6, + : -329D-6, -563D-6, + : 518D-7, 518D-7 / + DATA (IJSP(I,12),I=1,3),((AB(J,I,12),J=1,2),I=1,3) / + : 0, 2, -2, + : 1237D-6, 463D-6, + : -64D-6, 39D-6, + : -13D-7, -221D-7 / + DATA (IJSP(I,13),I=1,3),((AB(J,I,13),J=1,2),I=1,3) / + : 0, 2, -1, + : 1086D-6, -911D-6, + : -94D-6, 210D-6, + : 837D-7, -494D-7 / + DATA (IJSP(I,14),I=1,3),((AB(J,I,14),J=1,2),I=1,3) / + : 0, 2, 0, + : 595D-6, -1229D-6, + : -8D-6, -160D-6, + : -281D-7, 616D-7 / + DATA (IJSP(I,15),I=1,3),((AB(J,I,15),J=1,2),I=1,3) / + : 1, -1, 0, + : 2484D-6, -485D-6, + : -177D-6, 259D-6, + : 260D-7, -395D-7 / + DATA (IJSP(I,16),I=1,3),((AB(J,I,16),J=1,2),I=1,3) / + : 1, -1, 1, + : 839D-6, -1414D-6, + : 17D-6, 234D-6, + : -191D-7, -396D-7 / + DATA (IJSP(I,17),I=1,3),((AB(J,I,17),J=1,2),I=1,3) / + : 1, 0, -3, + : -964D-6, 1059D-6, + : 582D-6, -285D-6, + : -3218D-7, 370D-7 / + DATA (IJSP(I,18),I=1,3),((AB(J,I,18),J=1,2),I=1,3) / + : 1, 0, -2, + : -2303D-6, -1038D-6, + : -298D-6, 692D-6, + : 8019D-7, -7869D-7 / + DATA (IJSP(I,19),I=1,3),((AB(J,I,19),J=1,2),I=1,3) / + : 1, 0, -1, + : 7049D-6, 747D-6, + : 157D-6, 201D-6, + : 105D-7, 45637D-7 / + DATA (IJSP(I,20),I=1,3),((AB(J,I,20),J=1,2),I=1,3) / + : 1, 0, 0, + : 1179D-6, -358D-6, + : 304D-6, 825D-6, + : 8623D-7, 8444D-7 / + DATA (IJSP(I,21),I=1,3),((AB(J,I,21),J=1,2),I=1,3) / + : 1, 0, 1, + : 393D-6, -63D-6, + : -124D-6, -29D-6, + : -896D-7, -801D-7 / + DATA (IJSP(I,22),I=1,3),((AB(J,I,22),J=1,2),I=1,3) / + : 1, 0, 2, + : 111D-6, -268D-6, + : 15D-6, 8D-6, + : 208D-7, -122D-7 / + DATA (IJSP(I,23),I=1,3),((AB(J,I,23),J=1,2),I=1,3) / + : 1, 0, 3, + : -52D-6, -154D-6, + : 7D-6, 15D-6, + : -133D-7, 65D-7 / + DATA (IJSP(I,24),I=1,3),((AB(J,I,24),J=1,2),I=1,3) / + : 1, 0, 4, + : -78D-6, -30D-6, + : 2D-6, 2D-6, + : -16D-7, 1D-7 / + DATA (IJSP(I,25),I=1,3),((AB(J,I,25),J=1,2),I=1,3) / + : 1, 1, -3, + : -34D-6, -26D-6, + : 4D-6, 2D-6, + : -22D-7, 7D-7 / + DATA (IJSP(I,26),I=1,3),((AB(J,I,26),J=1,2),I=1,3) / + : 1, 1, -2, + : -43D-6, 1D-6, + : 3D-6, 0D-6, + : -8D-7, 16D-7 / + DATA (IJSP(I,27),I=1,3),((AB(J,I,27),J=1,2),I=1,3) / + : 1, 1, -1, + : -15D-6, 21D-6, + : 1D-6, -1D-6, + : 2D-7, 9D-7 / + DATA (IJSP(I,28),I=1,3),((AB(J,I,28),J=1,2),I=1,3) / + : 1, 1, 0, + : -1D-6, 15D-6, + : 0D-6, -2D-6, + : 12D-7, 5D-7 / + DATA (IJSP(I,29),I=1,3),((AB(J,I,29),J=1,2),I=1,3) / + : 1, 1, 1, + : 4D-6, 7D-6, + : 1D-6, 0D-6, + : 1D-7, -3D-7 / + DATA (IJSP(I,30),I=1,3),((AB(J,I,30),J=1,2),I=1,3) / + : 1, 1, 3, + : 1D-6, 5D-6, + : 1D-6, -1D-6, + : 1D-7, 0D-7 / + DATA (IJSP(I,31),I=1,3),((AB(J,I,31),J=1,2),I=1,3) / + : 2, 0, -6, + : 8D-6, 3D-6, + : -2D-6, -3D-6, + : 9D-7, 5D-7 / + DATA (IJSP(I,32),I=1,3),((AB(J,I,32),J=1,2),I=1,3) / + : 2, 0, -5, + : -3D-6, 6D-6, + : 1D-6, 2D-6, + : 2D-7, -1D-7 / + DATA (IJSP(I,33),I=1,3),((AB(J,I,33),J=1,2),I=1,3) / + : 2, 0, -4, + : 6D-6, -13D-6, + : -8D-6, 2D-6, + : 14D-7, 10D-7 / + DATA (IJSP(I,34),I=1,3),((AB(J,I,34),J=1,2),I=1,3) / + : 2, 0, -3, + : 10D-6, 22D-6, + : 10D-6, -7D-6, + : -65D-7, 12D-7 / + DATA (IJSP(I,35),I=1,3),((AB(J,I,35),J=1,2),I=1,3) / + : 2, 0, -2, + : -57D-6, -32D-6, + : 0D-6, 21D-6, + : 126D-7, -233D-7 / + DATA (IJSP(I,36),I=1,3),((AB(J,I,36),J=1,2),I=1,3) / + : 2, 0, -1, + : 157D-6, -46D-6, + : 8D-6, 5D-6, + : 270D-7, 1068D-7 / + DATA (IJSP(I,37),I=1,3),((AB(J,I,37),J=1,2),I=1,3) / + : 2, 0, 0, + : 12D-6, -18D-6, + : 13D-6, 16D-6, + : 254D-7, 155D-7 / + DATA (IJSP(I,38),I=1,3),((AB(J,I,38),J=1,2),I=1,3) / + : 2, 0, 1, + : -4D-6, 8D-6, + : -2D-6, -3D-6, + : -26D-7, -2D-7 / + DATA (IJSP(I,39),I=1,3),((AB(J,I,39),J=1,2),I=1,3) / + : 2, 0, 2, + : -5D-6, 0D-6, + : 0D-6, 0D-6, + : 7D-7, 0D-7 / + DATA (IJSP(I,40),I=1,3),((AB(J,I,40),J=1,2),I=1,3) / + : 2, 0, 3, + : 3D-6, 4D-6, + : 0D-6, 1D-6, + : -11D-7, 4D-7 / + DATA (IJSP(I,41),I=1,3),((AB(J,I,41),J=1,2),I=1,3) / + : 3, 0, -2, + : -1D-6, -1D-6, + : 0D-6, 1D-6, + : 4D-7, -14D-7 / + DATA (IJSP(I,42),I=1,3),((AB(J,I,42),J=1,2),I=1,3) / + : 3, 0, -1, + : 6D-6, -3D-6, + : 0D-6, 0D-6, + : 18D-7, 35D-7 / + DATA (IJSP(I,43),I=1,3),((AB(J,I,43),J=1,2),I=1,3) / + : 3, 0, 0, + : -1D-6, -2D-6, + : 0D-6, 1D-6, + : 13D-7, 3D-7 / + + +* Validate the planet number. + IF (NP.LT.1.OR.NP.GT.9) THEN + JSTAT=-1 + DO I=1,6 + PV(I)=0D0 + END DO + ELSE + +* Separate algorithms for Pluto and the rest. + IF (NP.NE.9) THEN + +* ----------------------- +* Mercury through Neptune +* ----------------------- + +* Time: Julian millennia since J2000. + T=(DATE-51544.5D0)/365250D0 + +* OK status unless remote epoch. + IF (ABS(T).LE.1D0) THEN + JSTAT=0 + ELSE + JSTAT=1 + END IF + +* Compute the mean elements. + DA=A(1,NP)+(A(2,NP)+A(3,NP)*T)*T + DL=(3600D0*DLM(1,NP)+(DLM(2,NP)+DLM(3,NP)*T)*T)*AS2R + DE=E(1,NP)+(E(2,NP)+E(3,NP)*T)*T + DPE=MOD((3600D0*PI(1,NP)+(PI(2,NP)+PI(3,NP)*T)*T)*AS2R,D2PI) + DI=(3600D0*DINC(1,NP)+(DINC(2,NP)+DINC(3,NP)*T)*T)*AS2R + DO=MOD((3600D0*OMEGA(1,NP) + : +(OMEGA(2,NP)+OMEGA(3,NP)*T)*T)*AS2R,D2PI) + +* Apply the trigonometric terms. + DMU=0.35953620D0*T + DO J=1,8 + ARGA=DKP(J,NP)*DMU + ARGL=DKQ(J,NP)*DMU + DA=DA+(CA(J,NP)*COS(ARGA)+SA(J,NP)*SIN(ARGA))*1D-7 + DL=DL+(CLO(J,NP)*COS(ARGL)+SLO(J,NP)*SIN(ARGL))*1D-7 + END DO + ARGA=DKP(9,NP)*DMU + DA=DA+T*(CA(9,NP)*COS(ARGA)+SA(9,NP)*SIN(ARGA))*1D-7 + DO J=9,10 + ARGL=DKQ(J,NP)*DMU + DL=DL+T*(CLO(J,NP)*COS(ARGL)+SLO(J,NP)*SIN(ARGL))*1D-7 + END DO + DL=MOD(DL,D2PI) + +* Daily motion. + DM=GCON*SQRT((1D0+1D0/AMAS(NP))/(DA*DA*DA)) + +* Make the prediction. + CALL slPLNE(DATE,1,DATE,DI,DO,DPE,DA,DE,DL,DM,PV,J) + IF (J.LT.0) JSTAT=-2 + + ELSE + +* ----- +* Pluto +* ----- + +* Time: Julian centuries since J2000. + T=(DATE-51544.5D0)/36525D0 + +* OK status unless remote epoch. + IF (T.GE.-1.15D0.AND.T.LE.1D0) THEN + JSTAT=0 + ELSE + JSTAT=1 + END IF + +* Fundamental arguments (radians). + DJ=(DJ0+DJD*T)*D2R + DS=(DS0+DSD*T)*D2R + DP=(DP0+DPD*T)*D2R + +* Initialize coefficients and derivatives. + DO I=1,3 + WLBR(I)=0D0 + WLBRD(I)=0D0 + END DO + +* Term by term through Meeus Table 36.A. + DO J=1,43 + +* Argument and derivative (radians, radians per century). + WJ=DBLE(IJSP(1,J)) + WS=DBLE(IJSP(2,J)) + WP=DBLE(IJSP(3,J)) + AL=WJ*DJ+WS*DS+WP*DP + ALD=(WJ*DJD+WS*DSD+WP*DPD)*D2R + +* Functions of argument. + SAL=SIN(AL) + CAL=COS(AL) + +* Periodic terms in longitude, latitude, radius vector. + DO I=1,3 + +* A and B coefficients (deg, AU). + AC=AB(1,I,J) + BC=AB(2,I,J) + +* Periodic terms (deg, AU, deg/Jc, AU/Jc). + WLBR(I)=WLBR(I)+AC*SAL+BC*CAL + WLBRD(I)=WLBRD(I)+(AC*CAL-BC*SAL)*ALD + END DO + END DO + +* Heliocentric longitude and derivative (radians, radians/sec). + DL=(DL0+DLD0*T+WLBR(1))*D2R + DLD=(DLD0+WLBRD(1))*D2R/SPC + +* Heliocentric latitude and derivative (radians, radians/sec). + DB=(DB0+WLBR(2))*D2R + DBD=WLBRD(2)*D2R/SPC + +* Heliocentric radius vector and derivative (AU, AU/sec). + DR=DR0+WLBR(3) + DRD=WLBRD(3)/SPC + +* Functions of latitude, longitude, radius vector. + SL=SIN(DL) + CL=COS(DL) + SB=SIN(DB) + CB=COS(DB) + SLCB=SL*CB + CLCB=CL*CB + +* Heliocentric vector and derivative, J2000 ecliptic and equinox. + X=DR*CLCB + Y=DR*SLCB + Z=DR*SB + XD=DRD*CLCB-DR*(CL*SB*DBD+SLCB*DLD) + YD=DRD*SLCB+DR*(-SL*SB*DBD+CLCB*DLD) + ZD=DRD*SB+DR*CB*DBD + +* Transform to J2000 equator and equinox. + PV(1)=X + PV(2)=Y*CE-Z*SE + PV(3)=Y*SE+Z*CE + PV(4)=XD + PV(5)=YD*CE-ZD*SE + PV(6)=YD*SE+ZD*CE + END IF + END IF + + END diff --git a/math/slalib/plante.f b/math/slalib/plante.f new file mode 100644 index 00000000..585e764d --- /dev/null +++ b/math/slalib/plante.f @@ -0,0 +1,251 @@ + SUBROUTINE slPLTE (DATE, ELONG, PHI, JFORM, EPOCH, + : ORBINC, ANODE, PERIH, AORQ, E, + : AORL, DM, RA, DEC, R, JSTAT) +*+ +* - - - - - - - +* P L T E +* - - - - - - - +* +* Topocentric apparent RA,Dec of a Solar-System object whose +* heliocentric orbital elements are known. +* +* Given: +* DATE d MJD of observation (JD - 2400000.5, Notes 1,5) +* ELONG d observer's east longitude (radians, Note 2) +* PHI d observer's geodetic latitude (radians, Note 2) +* JFORM i choice of element set (1-3; Notes 3-6) +* EPOCH d epoch of elements (TT MJD, Note 5) +* ORBINC d inclination (radians) +* ANODE d longitude of the ascending node (radians) +* PERIH d longitude or argument of perihelion (radians) +* AORQ d mean distance or perihelion distance (AU) +* E d eccentricity +* AORL d mean anomaly or longitude (radians, JFORM=1,2 only) +* DM d daily motion (radians, JFORM=1 only ) +* +* Returned: +* RA,DEC d RA, Dec (topocentric apparent, radians) +* R d distance from observer (AU) +* JSTAT i status: 0 = OK +* -1 = illegal JFORM +* -2 = illegal E +* -3 = illegal AORQ +* -4 = illegal DM +* -5 = numerical error +* +* Called: slELUE, slPLTU +* +* Notes: +* +* 1 DATE is the instant for which the prediction is required. It is +* in the TT timescale (formerly Ephemeris Time, ET) and is a +* Modified Julian Date (JD-2400000.5). +* +* 2 The longitude and latitude allow correction for geocentric +* parallax. This is usually a small effect, but can become +* important for near-Earth asteroids. Geocentric positions can be +* generated by appropriate use of routines slEVP (or slEPV) and +* slPLNE. +* +* 3 The elements are with respect to the J2000 ecliptic and equinox. +* +* 4 A choice of three different element-set options is available: +* +* Option JFORM = 1, suitable for the major planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = longitude of perihelion, curly pi (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e (range 0 to <1) +* AORL = mean longitude L (radians) +* DM = daily motion (radians) +* +* Option JFORM = 2, suitable for minor planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e (range 0 to <1) +* AORL = mean anomaly M (radians) +* +* Option JFORM = 3, suitable for comets: +* +* EPOCH = epoch of elements and perihelion (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = perihelion distance, q (AU) +* E = eccentricity, e (range 0 to 10) +* +* Unused arguments (DM for JFORM=2, AORL and DM for JFORM=3) are not +* accessed. +* +* 5 Each of the three element sets defines an unperturbed heliocentric +* orbit. For a given epoch of observation, the position of the body +* in its orbit can be predicted from these elements, which are +* called "osculating elements", using standard two-body analytical +* solutions. However, due to planetary perturbations, a given set +* of osculating elements remains usable for only as long as the +* unperturbed orbit that it describes is an adequate approximation +* to reality. Attached to such a set of elements is a date called +* the "osculating epoch", at which the elements are, momentarily, +* a perfect representation of the instantaneous position and +* velocity of the body. +* +* Therefore, for any given problem there are up to three different +* epochs in play, and it is vital to distinguish clearly between +* them: +* +* . The epoch of observation: the moment in time for which the +* position of the body is to be predicted. +* +* . The epoch defining the position of the body: the moment in time +* at which, in the absence of purturbations, the specified +* position (mean longitude, mean anomaly, or perihelion) is +* reached. +* +* . The osculating epoch: the moment in time at which the given +* elements are correct. +* +* For the major-planet and minor-planet cases it is usual to make +* the epoch that defines the position of the body the same as the +* epoch of osculation. Thus, only two different epochs are +* involved: the epoch of the elements and the epoch of observation. +* +* For comets, the epoch of perihelion fixes the position in the +* orbit and in general a different epoch of osculation will be +* chosen. Thus, all three types of epoch are involved. +* +* For the present routine: +* +* . The epoch of observation is the argument DATE. +* +* . The epoch defining the position of the body is the argument +* EPOCH. +* +* . The osculating epoch is not used and is assumed to be close +* enough to the epoch of observation to deliver adequate accuracy. +* If not, a preliminary call to slPRTL may be used to update +* the element-set (and its associated osculating epoch) by +* applying planetary perturbations. +* +* 6 Two important sources for orbital elements are Horizons, operated +* by the Jet Propulsion Laboratory, Pasadena, and the Minor Planet +* Center, operated by the Center for Astrophysics, Harvard. +* +* The JPL Horizons elements (heliocentric, J2000 ecliptic and +* equinox) correspond to SLALIB arguments as follows. +* +* Major planets: +* +* JFORM = 1 +* EPOCH = JDCT-2400000.5D0 +* ORBINC = IN (in radians) +* ANODE = OM (in radians) +* PERIH = OM+W (in radians) +* AORQ = A +* E = EC +* AORL = MA+OM+W (in radians) +* DM = N (in radians) +* +* Epoch of osculation = JDCT-2400000.5D0 +* +* Minor planets: +* +* JFORM = 2 +* EPOCH = JDCT-2400000.5D0 +* ORBINC = IN (in radians) +* ANODE = OM (in radians) +* PERIH = W (in radians) +* AORQ = A +* E = EC +* AORL = MA (in radians) +* +* Epoch of osculation = JDCT-2400000.5D0 +* +* Comets: +* +* JFORM = 3 +* EPOCH = Tp-2400000.5D0 +* ORBINC = IN (in radians) +* ANODE = OM (in radians) +* PERIH = W (in radians) +* AORQ = QR +* E = EC +* +* Epoch of osculation = JDCT-2400000.5D0 +* +* The MPC elements correspond to SLALIB arguments as follows. +* +* Minor planets: +* +* JFORM = 2 +* EPOCH = Epoch-2400000.5D0 +* ORBINC = Incl. (in radians) +* ANODE = Node (in radians) +* PERIH = Perih. (in radians) +* AORQ = a +* E = e +* AORL = M (in radians) +* +* Epoch of osculation = Epoch-2400000.5D0 +* +* Comets: +* +* JFORM = 3 +* EPOCH = T-2400000.5D0 +* ORBINC = Incl. (in radians) +* ANODE = Node. (in radians) +* PERIH = Perih. (in radians) +* AORQ = q +* E = e +* +* Epoch of osculation = Epoch-2400000.5D0 +* +* This revision: 19 June 2004 +* +* Copyright (C) 2004 P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,ELONG,PHI + INTEGER JFORM + DOUBLE PRECISION EPOCH,ORBINC,ANODE,PERIH,AORQ,E, + : AORL,DM,RA,DEC,R + INTEGER JSTAT + + DOUBLE PRECISION U(13) + + +* Transform conventional elements to universal elements. + CALL slELUE(DATE, + : JFORM,EPOCH,ORBINC,ANODE,PERIH,AORQ,E,AORL,DM, + : U,JSTAT) + +* If successful, make the prediction. + IF (JSTAT.EQ.0) CALL slPLTU(DATE,ELONG,PHI,U,RA,DEC,R,JSTAT) + + END diff --git a/math/slalib/plantu.f b/math/slalib/plantu.f new file mode 100644 index 00000000..81e65148 --- /dev/null +++ b/math/slalib/plantu.f @@ -0,0 +1,156 @@ + SUBROUTINE slPLTU (DATE, ELONG, PHI, U, RA, DEC, R, JSTAT) +*+ +* - - - - - - - +* P L A N T U +* - - - - - - - +* +* Topocentric apparent RA,Dec of a Solar-System object whose +* heliocentric universal elements are known. +* +* Given: +* DATE d TT MJD of observation (JD - 2400000.5) +* ELONG d observer's east longitude (radians) +* PHI d observer's geodetic latitude (radians) +* U d(13) universal elements +* +* (1) combined mass (M+m) +* (2) total energy of the orbit (alpha) +* (3) reference (osculating) epoch (t0) +* (4-6) position at reference epoch (r0) +* (7-9) velocity at reference epoch (v0) +* (10) heliocentric distance at reference epoch +* (11) r0.v0 +* (12) date (t) +* (13) universal eccentric anomaly (psi) of date, approx +* +* Returned: +* RA,DEC d RA, Dec (topocentric apparent, radians) +* R d distance from observer (AU) +* JSTAT i status: 0 = OK +* -1 = radius vector zero +* -2 = failed to converge +* +* Called: slGMST, slDT, slEPJ, slEPV, slUEPV, slPRNU, +* slDMXV, slPVOB, slDC2S, slDA2P +* +* Notes: +* +* 1 DATE is the instant for which the prediction is required. It is +* in the TT timescale (formerly Ephemeris Time, ET) and is a +* Modified Julian Date (JD-2400000.5). +* +* 2 The longitude and latitude allow correction for geocentric +* parallax. This is usually a small effect, but can become +* important for near-Earth asteroids. Geocentric positions can be +* generated by appropriate use of routines slEPV (or slEVP) and +* slUEPV. +* +* 3 The "universal" elements are those which define the orbit for the +* purposes of the method of universal variables (see reference 2). +* They consist of the combined mass of the two bodies, an epoch, +* and the position and velocity vectors (arbitrary reference frame) +* at that epoch. The parameter set used here includes also various +* quantities that can, in fact, be derived from the other +* information. This approach is taken to avoiding unnecessary +* computation and loss of accuracy. The supplementary quantities +* are (i) alpha, which is proportional to the total energy of the +* orbit, (ii) the heliocentric distance at epoch, (iii) the +* outwards component of the velocity at the given epoch, (iv) an +* estimate of psi, the "universal eccentric anomaly" at a given +* date and (v) that date. +* +* 4 The universal elements are with respect to the J2000 equator and +* equinox. +* +* 1 Sterne, Theodore E., "An Introduction to Celestial Mechanics", +* Interscience Publishers Inc., 1960. Section 6.7, p199. +* +* 2 Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. +* +* Last revision: 19 February 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,ELONG,PHI,U(13),RA,DEC,R + INTEGER JSTAT + +* Light time for unit distance (sec) + DOUBLE PRECISION TAU + PARAMETER (TAU=499.004782D0) + + INTEGER I + DOUBLE PRECISION DVB(3),DPB(3),VSG(6),VSP(6),V(6),RMAT(3,3), + : VGP(6),STL,VGO(6),DX,DY,DZ,D,TL + DOUBLE PRECISION slGMST,slDT,slEPJ,slDA2P + + + +* Sun to geocentre (J2000, velocity in AU/s). + CALL slEPV(DATE,VSG,VSG(4),DPB,DVB) + DO I=4,6 + VSG(I)=VSG(I)/86400D0 + END DO + +* Sun to planet (J2000). + CALL slUEPV(DATE,U,VSP,JSTAT) + +* Geocentre to planet (J2000). + DO I=1,6 + V(I)=VSP(I)-VSG(I) + END DO + +* Precession and nutation to date. + CALL slPRNU(2000D0,DATE,RMAT) + CALL slDMXV(RMAT,V,VGP) + CALL slDMXV(RMAT,V(4),VGP(4)) + +* Geocentre to observer (date). + STL=slGMST(DATE-slDT(slEPJ(DATE))/86400D0)+ELONG + CALL slPVOB(PHI,0D0,STL,VGO) + +* Observer to planet (date). + DO I=1,6 + V(I)=VGP(I)-VGO(I) + END DO + +* Geometric distance (AU). + DX=V(1) + DY=V(2) + DZ=V(3) + D=SQRT(DX*DX+DY*DY+DZ*DZ) + +* Light time (sec). + TL=TAU*D + +* Correct position for planetary aberration + DO I=1,3 + V(I)=V(I)-TL*V(I+3) + END DO + +* To RA,Dec. + CALL slDC2S(V,RA,DEC) + RA=slDA2P(RA) + R=D + + END diff --git a/math/slalib/pm.f b/math/slalib/pm.f new file mode 100644 index 00000000..903f92a8 --- /dev/null +++ b/math/slalib/pm.f @@ -0,0 +1,98 @@ + SUBROUTINE slPM (R0, D0, PR, PD, PX, RV, EP0, EP1, R1, D1) +*+ +* - - - +* P M +* - - - +* +* Apply corrections for proper motion to a star RA,Dec +* (double precision) +* +* References: +* 1984 Astronomical Almanac, pp B39-B41. +* (also Lederle & Schwan, Astron. Astrophys. 134, +* 1-6, 1984) +* +* Given: +* R0,D0 dp RA,Dec at epoch EP0 (rad) +* PR,PD dp proper motions: RA,Dec changes per year of epoch +* PX dp parallax (arcsec) +* RV dp radial velocity (km/sec, +ve if receding) +* EP0 dp start epoch in years (e.g. Julian epoch) +* EP1 dp end epoch in years (same system as EP0) +* +* Returned: +* R1,D1 dp RA,Dec at epoch EP1 (rad) +* +* Called: +* slDS2C spherical to Cartesian +* slDC2S Cartesian to spherical +* slDA2P normalize angle 0-2Pi +* +* Notes: +* +* 1 The proper motions in RA are dRA/dt rather than cos(Dec)*dRA/dt, +* and are in the same coordinate system as R0,D0. +* +* 2 If the available proper motions are pre-FK5 they will be per +* tropical year rather than per Julian year, and so the epochs +* must both be Besselian rather than Julian. In such cases, a +* scaling factor of 365.2422D0/365.25D0 should be applied to the +* radial velocity before use. +* +* P.T.Wallace Starlink 19 January 2000 +* +* Copyright (C) 2000 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION R0,D0,PR,PD,PX,RV,EP0,EP1,R1,D1 + +* Km/s to AU/year multiplied by arcseconds to radians + DOUBLE PRECISION VFR + PARAMETER (VFR=(365.25D0*86400D0/149597870D0)*4.8481368111D-6) + + INTEGER I + DOUBLE PRECISION slDA2P + DOUBLE PRECISION W,EM(3),T,P(3) + + + +* Spherical to Cartesian + CALL slDS2C(R0,D0,P) + +* Space motion (radians per year) + W=VFR*RV*PX + EM(1)=-PR*P(2)-PD*COS(R0)*SIN(D0)+W*P(1) + EM(2)= PR*P(1)-PD*SIN(R0)*SIN(D0)+W*P(2) + EM(3)= PD*COS(D0) +W*P(3) + +* Apply the motion + T=EP1-EP0 + DO I=1,3 + P(I)=P(I)+T*EM(I) + END DO + +* Cartesian to spherical + CALL slDC2S(P,R1,D1) + R1=slDA2P(R1) + + END diff --git a/math/slalib/polmo.f b/math/slalib/polmo.f new file mode 100644 index 00000000..c82f2132 --- /dev/null +++ b/math/slalib/polmo.f @@ -0,0 +1,159 @@ + SUBROUTINE slPLMO ( ELONGM, PHIM, XP, YP, ELONG, PHI, DAZ ) +*+ +* - - - - - - +* P L M O +* - - - - - - +* +* Polar motion: correct site longitude and latitude for polar +* motion and calculate azimuth difference between celestial and +* terrestrial poles. +* +* Given: +* ELONGM d mean longitude of the observer (radians, east +ve) +* PHIM d mean geodetic latitude of the observer (radians) +* XP d polar motion x-coordinate (radians) +* YP d polar motion y-coordinate (radians) +* +* Returned: +* ELONG d true longitude of the observer (radians, east +ve) +* PHI d true geodetic latitude of the observer (radians) +* DAZ d azimuth correction (terrestrial-celestial, radians) +* +* Notes: +* +* 1) "Mean" longitude and latitude are the (fixed) values for the +* site's location with respect to the IERS terrestrial reference +* frame; the latitude is geodetic. TAKE CARE WITH THE LONGITUDE +* SIGN CONVENTION. The longitudes used by the present routine +* are east-positive, in accordance with geographical convention +* (and right-handed). In particular, note that the longitudes +* returned by the slOBS routine are west-positive, following +* astronomical usage, and must be reversed in sign before use in +* the present routine. +* +* 2) XP and YP are the (changing) coordinates of the Celestial +* Ephemeris Pole with respect to the IERS Reference Pole. +* XP is positive along the meridian at longitude 0 degrees, +* and YP is positive along the meridian at longitude +* 270 degrees (i.e. 90 degrees west). Values for XP,YP can +* be obtained from IERS circulars and equivalent publications; +* the maximum amplitude observed so far is about 0.3 arcseconds. +* +* 3) "True" longitude and latitude are the (moving) values for +* the site's location with respect to the celestial ephemeris +* pole and the meridian which corresponds to the Greenwich +* apparent sidereal time. The true longitude and latitude +* link the terrestrial coordinates with the standard celestial +* models (for precession, nutation, sidereal time etc). +* +* 4) The azimuths produced by slAOP and slAOPQ are with +* respect to due north as defined by the Celestial Ephemeris +* Pole, and can therefore be called "celestial azimuths". +* However, a telescope fixed to the Earth measures azimuth +* essentially with respect to due north as defined by the +* IERS Reference Pole, and can therefore be called "terrestrial +* azimuth". Uncorrected, this would manifest itself as a +* changing "azimuth zero-point error". The value DAZ is the +* correction to be added to a celestial azimuth to produce +* a terrestrial azimuth. +* +* 5) The present routine is rigorous. For most practical +* purposes, the following simplified formulae provide an +* adequate approximation: +* +* ELONG = ELONGM+XP*COS(ELONGM)-YP*SIN(ELONGM) +* PHI = PHIM+(XP*SIN(ELONGM)+YP*COS(ELONGM))*TAN(PHIM) +* DAZ = -SQRT(XP*XP+YP*YP)*COS(ELONGM-ATAN2(XP,YP))/COS(PHIM) +* +* An alternative formulation for DAZ is: +* +* X = COS(ELONGM)*COS(PHIM) +* Y = SIN(ELONGM)*COS(PHIM) +* DAZ = ATAN2(-X*YP-Y*XP,X*X+Y*Y) +* +* Reference: Seidelmann, P.K. (ed), 1992. "Explanatory Supplement +* to the Astronomical Almanac", ISBN 0-935702-68-7, +* sections 3.27, 4.25, 4.52. +* +* P.T.Wallace Starlink 30 November 2000 +* +* Copyright (C) 2000 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION ELONGM,PHIM,XP,YP,ELONG,PHI,DAZ + + DOUBLE PRECISION SEL,CEL,SPH,CPH,XM,YM,ZM,XNM,YNM,ZNM, + : SXP,CXP,SYP,CYP,ZW,XT,YT,ZT,XNT,YNT + + + +* Site mean longitude and mean geodetic latitude as a Cartesian vector + SEL=SIN(ELONGM) + CEL=COS(ELONGM) + SPH=SIN(PHIM) + CPH=COS(PHIM) + + XM=CEL*CPH + YM=SEL*CPH + ZM=SPH + +* Rotate site vector by polar motion, Y-component then X-component + SXP=SIN(XP) + CXP=COS(XP) + SYP=SIN(YP) + CYP=COS(YP) + + ZW=(-YM*SYP+ZM*CYP) + + XT=XM*CXP-ZW*SXP + YT=YM*CYP+ZM*SYP + ZT=XM*SXP+ZW*CXP + +* Rotate also the geocentric direction of the terrestrial pole (0,0,1) + XNM=-SXP*CYP + YNM=SYP + ZNM=CXP*CYP + + CPH=SQRT(XT*XT+YT*YT) + IF (CPH.EQ.0D0) XT=1D0 + SEL=YT/CPH + CEL=XT/CPH + +* Return true longitude and true geodetic latitude of site + IF (XT.NE.0D0.OR.YT.NE.0D0) THEN + ELONG=ATAN2(YT,XT) + ELSE + ELONG=0D0 + END IF + PHI=ATAN2(ZT,CPH) + +* Return current azimuth of terrestrial pole seen from site position + XNT=(XNM*CEL+YNM*SEL)*ZT-ZNM*CPH + YNT=-XNM*SEL+YNM*CEL + IF (XNT.NE.0D0.OR.YNT.NE.0D0) THEN + DAZ=ATAN2(-YNT,-XNT) + ELSE + DAZ=0D0 + END IF + + END diff --git a/math/slalib/prebn.f b/math/slalib/prebn.f new file mode 100644 index 00000000..0c46f592 --- /dev/null +++ b/math/slalib/prebn.f @@ -0,0 +1,80 @@ + SUBROUTINE slPRBN (BEP0, BEP1, RMATP) +*+ +* - - - - - - +* P R B N +* - - - - - - +* +* Generate the matrix of precession between two epochs, +* using the old, pre-IAU1976, Bessel-Newcomb model, using +* Kinoshita's formulation (double precision) +* +* Given: +* BEP0 dp beginning Besselian epoch +* BEP1 dp ending Besselian epoch +* +* Returned: +* RMATP dp(3,3) precession matrix +* +* The matrix is in the sense V(BEP1) = RMATP * V(BEP0) +* +* Reference: +* Kinoshita, H. (1975) 'Formulas for precession', SAO Special +* Report No. 364, Smithsonian Institution Astrophysical +* Observatory, Cambridge, Massachusetts. +* +* Called: slDEUL +* +* P.T.Wallace Starlink 23 August 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION BEP0,BEP1,RMATP(3,3) + +* Arc seconds to radians + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + + DOUBLE PRECISION BIGT,T,TAS2R,W,ZETA,Z,THETA + + + +* Interval between basic epoch B1850.0 and beginning epoch in TC + BIGT = (BEP0-1850D0)/100D0 + +* Interval over which precession required, in tropical centuries + T = (BEP1-BEP0)/100D0 + +* Euler angles + TAS2R = T*AS2R + W = 2303.5548D0+(1.39720D0+0.000059D0*BIGT)*BIGT + + ZETA = (W+(0.30242D0-0.000269D0*BIGT+0.017996D0*T)*T)*TAS2R + Z = (W+(1.09478D0+0.000387D0*BIGT+0.018324D0*T)*T)*TAS2R + THETA = (2005.1125D0+(-0.85294D0-0.000365D0*BIGT)*BIGT+ + : (-0.42647D0-0.000365D0*BIGT-0.041802D0*T)*T)*TAS2R + +* Rotation matrix + CALL slDEUL('ZYZ',-ZETA,THETA,-Z,RMATP) + + END diff --git a/math/slalib/prec.f b/math/slalib/prec.f new file mode 100644 index 00000000..e8eadce7 --- /dev/null +++ b/math/slalib/prec.f @@ -0,0 +1,97 @@ + SUBROUTINE slPREC (EP0, EP1, RMATP) +*+ +* - - - - - +* P R E C +* - - - - - +* +* Form the matrix of precession between two epochs (IAU 1976, FK5) +* (double precision) +* +* Given: +* EP0 dp beginning epoch +* EP1 dp ending epoch +* +* Returned: +* RMATP dp(3,3) precession matrix +* +* Notes: +* +* 1) The epochs are TDB (loosely ET) Julian epochs. +* +* 2) The matrix is in the sense V(EP1) = RMATP * V(EP0) +* +* 3) Though the matrix method itself is rigorous, the precession +* angles are expressed through canonical polynomials which are +* valid only for a limited time span. There are also known +* errors in the IAU precession rate. The absolute accuracy +* of the present formulation is better than 0.1 arcsec from +* 1960AD to 2040AD, better than 1 arcsec from 1640AD to 2360AD, +* and remains below 3 arcsec for the whole of the period +* 500BC to 3000AD. The errors exceed 10 arcsec outside the +* range 1200BC to 3900AD, exceed 100 arcsec outside 4200BC to +* 5600AD and exceed 1000 arcsec outside 6800BC to 8200AD. +* The SLALIB routine slPREL implements a more elaborate +* model which is suitable for problems spanning several +* thousand years. +* +* References: +* Lieske,J.H., 1979. Astron.Astrophys.,73,282. +* equations (6) & (7), p283. +* Kaplan,G.H., 1981. USNO circular no. 163, pA2. +* +* Called: slDEUL +* +* P.T.Wallace Starlink 23 August 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION EP0,EP1,RMATP(3,3) + +* Arc seconds to radians + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + + DOUBLE PRECISION T0,T,TAS2R,W,ZETA,Z,THETA + + + +* Interval between basic epoch J2000.0 and beginning epoch (JC) + T0 = (EP0-2000D0)/100D0 + +* Interval over which precession required (JC) + T = (EP1-EP0)/100D0 + +* Euler angles + TAS2R = T*AS2R + W = 2306.2181D0+(1.39656D0-0.000139D0*T0)*T0 + + ZETA = (W+((0.30188D0-0.000344D0*T0)+0.017998D0*T)*T)*TAS2R + Z = (W+((1.09468D0+0.000066D0*T0)+0.018203D0*T)*T)*TAS2R + THETA = ((2004.3109D0+(-0.85330D0-0.000217D0*T0)*T0) + : +((-0.42665D0-0.000217D0*T0)-0.041833D0*T)*T)*TAS2R + +* Rotation matrix + CALL slDEUL('ZYZ',-ZETA,THETA,-Z,RMATP) + + END diff --git a/math/slalib/preces.f b/math/slalib/preces.f new file mode 100644 index 00000000..9c2aec25 --- /dev/null +++ b/math/slalib/preces.f @@ -0,0 +1,102 @@ + SUBROUTINE slPRCE (SYSTEM, EP0, EP1, RA, DC) +*+ +* - - - - - - - +* P R C E +* - - - - - - - +* +* Precession - either FK4 (Bessel-Newcomb, pre IAU 1976) or +* FK5 (Fricke, post IAU 1976) as required. +* +* Given: +* SYSTEM char precession to be applied: 'FK4' or 'FK5' +* EP0,EP1 dp starting and ending epoch +* RA,DC dp RA,Dec, mean equator & equinox of epoch EP0 +* +* Returned: +* RA,DC dp RA,Dec, mean equator & equinox of epoch EP1 +* +* Called: slDA2P, slPRBN, slPREC, slDS2C, +* slDMXV, slDC2S +* +* Notes: +* +* 1) Lowercase characters in SYSTEM are acceptable. +* +* 2) The epochs are Besselian if SYSTEM='FK4' and Julian if 'FK5'. +* For example, to precess coordinates in the old system from +* equinox 1900.0 to 1950.0 the call would be: +* CALL slPRCE ('FK4', 1900D0, 1950D0, RA, DC) +* +* 3) This routine will NOT correctly convert between the old and +* the new systems - for example conversion from B1950 to J2000. +* For these purposes see slFK45, slFK54, slF45Z and +* slF54Z. +* +* 4) If an invalid SYSTEM is supplied, values of -99D0,-99D0 will +* be returned for both RA and DC. +* +* P.T.Wallace Starlink 20 April 1990 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER SYSTEM*(*) + DOUBLE PRECISION EP0,EP1,RA,DC + + DOUBLE PRECISION PM(3,3),V1(3),V2(3) + CHARACTER SYSUC*3 + + DOUBLE PRECISION slDA2P + + + + +* Convert to uppercase and validate SYSTEM + SYSUC=SYSTEM + IF (SYSUC(1:1).EQ.'f') SYSUC(1:1)='F' + IF (SYSUC(2:2).EQ.'k') SYSUC(2:2)='K' + IF (SYSUC.NE.'FK4'.AND.SYSUC.NE.'FK5') THEN + RA=-99D0 + DC=-99D0 + ELSE + +* Generate appropriate precession matrix + IF (SYSUC.EQ.'FK4') THEN + CALL slPRBN(EP0,EP1,PM) + ELSE + CALL slPREC(EP0,EP1,PM) + END IF + +* Convert RA,Dec to x,y,z + CALL slDS2C(RA,DC,V1) + +* Precess + CALL slDMXV(PM,V1,V2) + +* Back to RA,Dec + CALL slDC2S(V2,RA,DC) + RA=slDA2P(RA) + + END IF + + END diff --git a/math/slalib/precl.f b/math/slalib/precl.f new file mode 100644 index 00000000..55bb839e --- /dev/null +++ b/math/slalib/precl.f @@ -0,0 +1,143 @@ + SUBROUTINE slPREL (EP0, EP1, RMATP) +*+ +* - - - - - - +* P R E L +* - - - - - - +* +* Form the matrix of precession between two epochs, using the +* model of Simon et al (1994), which is suitable for long +* periods of time. +* +* (double precision) +* +* Given: +* EP0 dp beginning epoch +* EP1 dp ending epoch +* +* Returned: +* RMATP dp(3,3) precession matrix +* +* Notes: +* +* 1) The epochs are TDB Julian epochs. +* +* 2) The matrix is in the sense V(EP1) = RMATP * V(EP0) +* +* 3) The absolute accuracy of the model is limited by the +* uncertainty in the general precession, about 0.3 arcsec per +* 1000 years. The remainder of the formulation provides a +* precision of 1 mas over the interval from 1000AD to 3000AD, +* 0.1 arcsec from 1000BC to 5000AD and 1 arcsec from +* 4000BC to 8000AD. +* +* Reference: +* Simon, J.L. et al., 1994. Astron.Astrophys., 282, 663-683. +* +* Called: slDEUL +* +* P.T.Wallace Starlink 23 August 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION EP0,EP1,RMATP(3,3) + +* Arc seconds to radians + DOUBLE PRECISION AS2R + PARAMETER (AS2R=0.484813681109535994D-5) + + DOUBLE PRECISION T0,T,TAS2R,W,ZETA,Z,THETA + + + +* Interval between basic epoch J2000.0 and beginning epoch (1000JY) + T0 = (EP0-2000D0)/1000D0 + +* Interval over which precession required (1000JY) + T = (EP1-EP0)/1000D0 + +* Euler angles + TAS2R = T*AS2R + W = 23060.9097D0+ + : (139.7459D0+ + : (-0.0038D0+ + : (-0.5918D0+ + : (-0.0037D0+ + : 0.0007D0*T0)*T0)*T0)*T0)*T0 + + ZETA = (W+(30.2226D0+ + : (-0.2523D0+ + : (-0.3840D0+ + : (-0.0014D0+ + : 0.0007D0*T0)*T0)*T0)*T0+ + : (18.0183D0+ + : (-0.1326D0+ + : (0.0006D0+ + : 0.0005D0*T0)*T0)*T0+ + : (-0.0583D0+ + : (-0.0001D0+ + : 0.0007D0*T0)*T0+ + : (-0.0285D0+ + : (-0.0002D0)*T)*T)*T)*T)*T)*TAS2R + + Z = (W+(109.5270D0+ + : (0.2446D0+ + : (-1.3913D0+ + : (-0.0134D0+ + : 0.0026D0*T0)*T0)*T0)*T0+ + : (18.2667D0+ + : (-1.1400D0+ + : (-0.0173D0+ + : 0.0044D0*T0)*T0)*T0+ + : (-0.2821D0+ + : (-0.0093D0+ + : 0.0032D0*T0)*T0+ + : (-0.0301D0+ + : 0.0006D0*T0 + : -0.0001D0*T)*T)*T)*T)*T)*TAS2R + + THETA = (20042.0207D0+ + : (-85.3131D0+ + : (-0.2111D0+ + : (0.3642D0+ + : (0.0008D0+ + : (-0.0005D0)*T0)*T0)*T0)*T0)*T0+ + : (-42.6566D0+ + : (-0.2111D0+ + : (0.5463D0+ + : (0.0017D0+ + : (-0.0012D0)*T0)*T0)*T0)*T0+ + : (-41.8238D0+ + : (0.0359D0+ + : (0.0027D0+ + : (-0.0001D0)*T0)*T0)*T0+ + : (-0.0731D0+ + : (0.0019D0+ + : 0.0009D0*T0)*T0+ + : (-0.0127D0+ + : 0.0011D0*T0+0.0004D0*T)*T)*T)*T)*T)*TAS2R + +* Rotation matrix + CALL slDEUL('ZYZ',-ZETA,THETA,-Z,RMATP) + + END diff --git a/math/slalib/precss.f b/math/slalib/precss.f new file mode 100644 index 00000000..c18707dc --- /dev/null +++ b/math/slalib/precss.f @@ -0,0 +1,76 @@ + SUBROUTINE slPRCS (SYSTEM, EP0, EP1, RA, DC) +*+ +* - - - - - - - +* P R C E +* - - - - - - - +* +* Precession - either FK4 (Bessel-Newcomb, pre IAU 1976) or +* FK5 (Fricke, post IAU 1976) as required. +* +* Given: +* SYSTEM int precession to be applied: 1 = FK4 or 2 = FK5 +* EP0,EP1 dp starting and ending epoch +* RA,DC dp RA,Dec, mean equator & equinox of epoch EP0 +* +* Returned: +* RA,DC dp RA,Dec, mean equator & equinox of epoch EP1 +* +* Called: slDA2P, slPRBN, slPREC, slDS2C, +* slDMXV, slDC2S +* +* Notes: +* +* 1) Lowercase characters in SYSTEM are acceptable. +* +* 2) The epochs are Besselian if SYSTEM=FK4 and Julian if FK5. +* For example, to precess coordinates in the old system from +* equinox 1900.0 to 1950.0 the call would be: +* CALL slPRCS (1, 1900D0, 1950D0, RA, DC) +* +* 3) This routine will NOT correctly convert between the old and +* the new systems - for example conversion from B1950 to J2000. +* For these purposes see slFK45, slFK54, slF45Z and +* slF54Z. +* +* 4) If an invalid SYSTEM is supplied, values of -99D0,-99D0 will +* be returned for both RA and DC. +* +* P.T.Wallace Starlink 20 April 1990 +*- + + IMPLICIT NONE + + INTEGER SYSTEM + DOUBLE PRECISION EP0,EP1,RA,DC + + DOUBLE PRECISION PM(3,3),V1(3),V2(3) + + DOUBLE PRECISION slDA2P + + +* Convert to uppercase and validate SYSTEM + IF (SYSTEM.NE.1.AND.SYSTEM.NE.2) THEN + RA=-99D0 + DC=-99D0 + ELSE + +* Generate appropriate precession matrix + IF (SYSTEM.EQ.1) THEN + CALL slPRBN(EP0,EP1,PM) + ELSE + CALL slPREC(EP0,EP1,PM) + END IF + +* Convert RA,Dec to x,y,z + CALL slDS2C(RA,DC,V1) + +* Precess + CALL slDMXV(PM,V1,V2) + +* Back to RA,Dec + CALL slDC2S(V2,RA,DC) + RA=slDA2P(RA) + + END IF + + END diff --git a/math/slalib/precss.f.sav b/math/slalib/precss.f.sav new file mode 100644 index 00000000..c18707dc --- /dev/null +++ b/math/slalib/precss.f.sav @@ -0,0 +1,76 @@ + SUBROUTINE slPRCS (SYSTEM, EP0, EP1, RA, DC) +*+ +* - - - - - - - +* P R C E +* - - - - - - - +* +* Precession - either FK4 (Bessel-Newcomb, pre IAU 1976) or +* FK5 (Fricke, post IAU 1976) as required. +* +* Given: +* SYSTEM int precession to be applied: 1 = FK4 or 2 = FK5 +* EP0,EP1 dp starting and ending epoch +* RA,DC dp RA,Dec, mean equator & equinox of epoch EP0 +* +* Returned: +* RA,DC dp RA,Dec, mean equator & equinox of epoch EP1 +* +* Called: slDA2P, slPRBN, slPREC, slDS2C, +* slDMXV, slDC2S +* +* Notes: +* +* 1) Lowercase characters in SYSTEM are acceptable. +* +* 2) The epochs are Besselian if SYSTEM=FK4 and Julian if FK5. +* For example, to precess coordinates in the old system from +* equinox 1900.0 to 1950.0 the call would be: +* CALL slPRCS (1, 1900D0, 1950D0, RA, DC) +* +* 3) This routine will NOT correctly convert between the old and +* the new systems - for example conversion from B1950 to J2000. +* For these purposes see slFK45, slFK54, slF45Z and +* slF54Z. +* +* 4) If an invalid SYSTEM is supplied, values of -99D0,-99D0 will +* be returned for both RA and DC. +* +* P.T.Wallace Starlink 20 April 1990 +*- + + IMPLICIT NONE + + INTEGER SYSTEM + DOUBLE PRECISION EP0,EP1,RA,DC + + DOUBLE PRECISION PM(3,3),V1(3),V2(3) + + DOUBLE PRECISION slDA2P + + +* Convert to uppercase and validate SYSTEM + IF (SYSTEM.NE.1.AND.SYSTEM.NE.2) THEN + RA=-99D0 + DC=-99D0 + ELSE + +* Generate appropriate precession matrix + IF (SYSTEM.EQ.1) THEN + CALL slPRBN(EP0,EP1,PM) + ELSE + CALL slPREC(EP0,EP1,PM) + END IF + +* Convert RA,Dec to x,y,z + CALL slDS2C(RA,DC,V1) + +* Precess + CALL slDMXV(PM,V1,V2) + +* Back to RA,Dec + CALL slDC2S(V2,RA,DC) + RA=slDA2P(RA) + + END IF + + END diff --git a/math/slalib/prenut.f b/math/slalib/prenut.f new file mode 100644 index 00000000..4e2bb8cb --- /dev/null +++ b/math/slalib/prenut.f @@ -0,0 +1,67 @@ + SUBROUTINE slPRNU (EPOCH, DATE, RMATPN) +*+ +* - - - - - - - +* P R N U +* - - - - - - - +* +* Form the matrix of precession and nutation (SF2001) +* (double precision) +* +* Given: +* EPOCH dp Julian Epoch for mean coordinates +* DATE dp Modified Julian Date (JD-2400000.5) +* for true coordinates +* +* Returned: +* RMATPN dp(3,3) combined precession/nutation matrix +* +* Called: slPREC, slEPJ, slNUT, slDMXM +* +* Notes: +* +* 1) The epoch and date are TDB (loosely ET). TT will do, or even +* UTC. +* +* 2) The matrix is in the sense V(true) = RMATPN * V(mean) +* +* Last revision: 3 December 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION EPOCH,DATE,RMATPN(3,3) + + DOUBLE PRECISION RMATP(3,3),RMATN(3,3),slEPJ + + + +* Precession + CALL slPREC(EPOCH,slEPJ(DATE),RMATP) + +* Nutation + CALL slNUT(DATE,RMATN) + +* Combine the matrices: PN = N x P + CALL slDMXM(RMATN,RMATP,RMATPN) + + END diff --git a/math/slalib/pv2el.f b/math/slalib/pv2el.f new file mode 100644 index 00000000..b8db2d25 --- /dev/null +++ b/math/slalib/pv2el.f @@ -0,0 +1,380 @@ + SUBROUTINE slPVEL (PV, DATE, PMASS, JFORMR, + : JFORM, EPOCH, ORBINC, ANODE, PERIH, + : AORQ, E, AORL, DM, JSTAT) +*+ +* - - - - - - +* P V E L +* - - - - - - +* +* Heliocentric osculating elements obtained from instantaneous position +* and velocity. +* +* Given: +* PV d(6) heliocentric x,y,z,xdot,ydot,zdot of date, +* J2000 equatorial triad (AU,AU/s; Note 1) +* DATE d date (TT Modified Julian Date = JD-2400000.5) +* PMASS d mass of the planet (Sun=1; Note 2) +* JFORMR i requested element set (1-3; Note 3) +* +* Returned: +* JFORM d element set actually returned (1-3; Note 4) +* EPOCH d epoch of elements (TT MJD) +* ORBINC d inclination (radians) +* ANODE d longitude of the ascending node (radians) +* PERIH d longitude or argument of perihelion (radians) +* AORQ d mean distance or perihelion distance (AU) +* E d eccentricity +* AORL d mean anomaly or longitude (radians, JFORM=1,2 only) +* DM d daily motion (radians, JFORM=1 only) +* JSTAT i status: 0 = OK +* -1 = illegal PMASS +* -2 = illegal JFORMR +* -3 = position/velocity out of range +* +* Notes +* +* 1 The PV 6-vector is with respect to the mean equator and equinox of +* epoch J2000. The orbital elements produced are with respect to +* the J2000 ecliptic and mean equinox. +* +* 2 The mass, PMASS, is important only for the larger planets. For +* most purposes (e.g. asteroids) use 0D0. Values less than zero +* are illegal. +* +* 3 Three different element-format options are supported: +* +* Option JFORM=1, suitable for the major planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = longitude of perihelion, curly pi (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e +* AORL = mean longitude L (radians) +* DM = daily motion (radians) +* +* Option JFORM=2, suitable for minor planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e +* AORL = mean anomaly M (radians) +* +* Option JFORM=3, suitable for comets: +* +* EPOCH = epoch of perihelion (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = perihelion distance, q (AU) +* E = eccentricity, e +* +* 4 It may not be possible to generate elements in the form +* requested through JFORMR. The caller is notified of the form +* of elements actually returned by means of the JFORM argument: +* +* JFORMR JFORM meaning +* +* 1 1 OK - elements are in the requested format +* 1 2 never happens +* 1 3 orbit not elliptical +* +* 2 1 never happens +* 2 2 OK - elements are in the requested format +* 2 3 orbit not elliptical +* +* 3 1 never happens +* 3 2 never happens +* 3 3 OK - elements are in the requested format +* +* 5 The arguments returned for each value of JFORM (cf Note 5: JFORM +* may not be the same as JFORMR) are as follows: +* +* JFORM 1 2 3 +* EPOCH t0 t0 T +* ORBINC i i i +* ANODE Omega Omega Omega +* PERIH curly pi omega omega +* AORQ a a q +* E e e e +* AORL L M - +* DM n - - +* +* where: +* +* t0 is the epoch of the elements (MJD, TT) +* T " epoch of perihelion (MJD, TT) +* i " inclination (radians) +* Omega " longitude of the ascending node (radians) +* curly pi " longitude of perihelion (radians) +* omega " argument of perihelion (radians) +* a " mean distance (AU) +* q " perihelion distance (AU) +* e " eccentricity +* L " longitude (radians, 0-2pi) +* M " mean anomaly (radians, 0-2pi) +* n " daily motion (radians) +* - means no value is set +* +* 6 At very small inclinations, the longitude of the ascending node +* ANODE becomes indeterminate and under some circumstances may be +* set arbitrarily to zero. Similarly, if the orbit is close to +* circular, the true anomaly becomes indeterminate and under some +* circumstances may be set arbitrarily to zero. In such cases, +* the other elements are automatically adjusted to compensate, +* and so the elements remain a valid description of the orbit. +* +* 7 The osculating epoch for the returned elements is the argument +* DATE. +* +* Reference: Sterne, Theodore E., "An Introduction to Celestial +* Mechanics", Interscience Publishers, 1960 +* +* Called: slDA2P +* +* Last revision: 8 September 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION PV(6),DATE,PMASS + INTEGER JFORMR,JFORM + DOUBLE PRECISION EPOCH,ORBINC,ANODE,PERIH,AORQ,E,AORL,DM + INTEGER JSTAT + +* Seconds to days + DOUBLE PRECISION DAY + PARAMETER (DAY=86400D0) + +* Gaussian gravitational constant (exact) + DOUBLE PRECISION GCON + PARAMETER (GCON=0.01720209895D0) + +* Sin and cos of J2000 mean obliquity (IAU 1976) + DOUBLE PRECISION SE,CE + PARAMETER (SE=0.3977771559319137D0, + : CE=0.9174820620691818D0) + +* Minimum allowed distance (AU) and speed (AU/day) + DOUBLE PRECISION RMIN,VMIN + PARAMETER (RMIN=1D-3,VMIN=1D-8) + +* How close to unity the eccentricity has to be to call it a parabola + DOUBLE PRECISION PARAB + PARAMETER (PARAB=1D-8) + + DOUBLE PRECISION X,Y,Z,XD,YD,ZD,R,V2,V,RDV,GMU,HX,HY,HZ, + : HX2PY2,H2,H,OI,BIGOM,AR,ECC,S,C,AT,U,OM, + : GAR3,EM1,EP1,HAT,SHAT,CHAT,AE,AM,DN,PL, + : EL,Q,TP,THAT,THHF,F + + INTEGER JF + + DOUBLE PRECISION slDA2P + + +* Validate arguments PMASS and JFORMR. + IF (PMASS.LT.0D0) THEN + JSTAT = -1 + GO TO 999 + END IF + IF (JFORMR.LT.1.OR.JFORMR.GT.3) THEN + JSTAT = -2 + GO TO 999 + END IF + +* Provisionally assume the elements will be in the chosen form. + JF = JFORMR + +* Rotate the position from equatorial to ecliptic coordinates. + X = PV(1) + Y = PV(2)*CE+PV(3)*SE + Z = -PV(2)*SE+PV(3)*CE + +* Rotate the velocity similarly, scaling to AU/day. + XD = DAY*PV(4) + YD = DAY*(PV(5)*CE+PV(6)*SE) + ZD = DAY*(-PV(5)*SE+PV(6)*CE) + +* Distance and speed. + R = SQRT(X*X+Y*Y+Z*Z) + V2 = XD*XD+YD*YD+ZD*ZD + V = SQRT(V2) + +* Reject unreasonably small values. + IF (R.LT.RMIN.OR.V.LT.VMIN) THEN + JSTAT = -3 + GO TO 999 + END IF + +* R dot V. + RDV = X*XD+Y*YD+Z*ZD + +* Mu. + GMU = (1D0+PMASS)*GCON*GCON + +* Vector angular momentum per unit reduced mass. + HX = Y*ZD-Z*YD + HY = Z*XD-X*ZD + HZ = X*YD-Y*XD + +* Areal constant. + HX2PY2 = HX*HX+HY*HY + H2 = HX2PY2+HZ*HZ + H = SQRT(H2) + +* Inclination. + OI = ATAN2(SQRT(HX2PY2),HZ) + +* Longitude of ascending node. + IF (HX.NE.0D0.OR.HY.NE.0D0) THEN + BIGOM = ATAN2(HX,-HY) + ELSE + BIGOM=0D0 + END IF + +* Reciprocal of mean distance etc. + AR = 2D0/R-V2/GMU + +* Eccentricity. + ECC = SQRT(MAX(1D0-AR*H2/GMU,0D0)) + +* True anomaly. + S = H*RDV + C = H2-R*GMU + IF (S.NE.0D0.OR.C.NE.0D0) THEN + AT = ATAN2(S,C) + ELSE + AT = 0D0 + END IF + +* Argument of the latitude. + S = SIN(BIGOM) + C = COS(BIGOM) + U = ATAN2((-X*S+Y*C)*COS(OI)+Z*SIN(OI),X*C+Y*S) + +* Argument of perihelion. + OM = U-AT + +* Capture near-parabolic cases. + IF (ABS(ECC-1D0).LT.PARAB) ECC=1D0 + +* Comply with JFORMR = 1 or 2 only if orbit is elliptical. + IF (ECC.GE.1D0) JF=3 + +* Functions. + GAR3 = GMU*AR*AR*AR + EM1 = ECC-1D0 + EP1 = ECC+1D0 + HAT = AT/2D0 + SHAT = SIN(HAT) + CHAT = COS(HAT) + +* Variable initializations to avoid compiler warnings. + AM = 0D0 + DN = 0D0 + PL = 0D0 + EL = 0D0 + Q = 0D0 + TP = 0D0 + +* Ellipse? + IF (ECC.LT.1D0 ) THEN + +* Eccentric anomaly. + AE = 2D0*ATAN2(SQRT(-EM1)*SHAT,SQRT(EP1)*CHAT) + +* Mean anomaly. + AM = AE-ECC*SIN(AE) + +* Daily motion. + DN = SQRT(GAR3) + END IF + +* "Major planet" element set? + IF (JF.EQ.1) THEN + +* Longitude of perihelion. + PL = BIGOM+OM + +* Longitude at epoch. + EL = PL+AM + END IF + +* "Comet" element set? + IF (JF.EQ.3) THEN + +* Perihelion distance. + Q = H2/(GMU*EP1) + +* Ellipse, parabola, hyperbola? + IF (ECC.LT.1D0) THEN + +* Ellipse: epoch of perihelion. + TP = DATE-AM/DN + ELSE + +* Parabola or hyperbola: evaluate tan ( ( true anomaly ) / 2 ) + THAT = SHAT/CHAT + IF (ECC.EQ.1D0) THEN + +* Parabola: epoch of perihelion. + TP = DATE-THAT*(1D0+THAT*THAT/3D0)*H*H2/(2D0*GMU*GMU) + ELSE + +* Hyperbola: epoch of perihelion. + THHF = SQRT(EM1/EP1)*THAT + F = LOG(1D0+THHF)-LOG(1D0-THHF) + TP = DATE-(ECC*SINH(F)-F)/SQRT(-GAR3) + END IF + END IF + END IF + +* Return the appropriate set of elements. + JFORM = JF + ORBINC = OI + ANODE = slDA2P(BIGOM) + E = ECC + IF (JF.EQ.1) THEN + PERIH = slDA2P(PL) + AORL = slDA2P(EL) + DM = DN + ELSE + PERIH = slDA2P(OM) + IF (JF.EQ.2) AORL = slDA2P(AM) + END IF + IF (JF.NE.3) THEN + EPOCH = DATE + AORQ = 1D0/AR + ELSE + EPOCH = TP + AORQ = Q + END IF + JSTAT = 0 + + 999 CONTINUE + END diff --git a/math/slalib/pv2ue.f b/math/slalib/pv2ue.f new file mode 100644 index 00000000..a2a686ab --- /dev/null +++ b/math/slalib/pv2ue.f @@ -0,0 +1,168 @@ + SUBROUTINE slPVUE (PV, DATE, PMASS, U, JSTAT) +*+ +* - - - - - - +* P V U E +* - - - - - - +* +* Construct a universal element set based on an instantaneous position +* and velocity. +* +* Given: +* PV d(6) heliocentric x,y,z,xdot,ydot,zdot of date, +* (AU,AU/s; Note 1) +* DATE d date (TT Modified Julian Date = JD-2400000.5) +* PMASS d mass of the planet (Sun=1; Note 2) +* +* Returned: +* U d(13) universal orbital elements (Note 3) +* +* (1) combined mass (M+m) +* (2) total energy of the orbit (alpha) +* (3) reference (osculating) epoch (t0) +* (4-6) position at reference epoch (r0) +* (7-9) velocity at reference epoch (v0) +* (10) heliocentric distance at reference epoch +* (11) r0.v0 +* (12) date (t) +* (13) universal eccentric anomaly (psi) of date, approx +* +* JSTAT i status: 0 = OK +* -1 = illegal PMASS +* -2 = too close to Sun +* -3 = too slow +* +* Notes +* +* 1 The PV 6-vector can be with respect to any chosen inertial frame, +* and the resulting universal-element set will be with respect to +* the same frame. A common choice will be mean equator and ecliptic +* of epoch J2000. +* +* 2 The mass, PMASS, is important only for the larger planets. For +* most purposes (e.g. asteroids) use 0D0. Values less than zero +* are illegal. +* +* 3 The "universal" elements are those which define the orbit for the +* purposes of the method of universal variables (see reference). +* They consist of the combined mass of the two bodies, an epoch, +* and the position and velocity vectors (arbitrary reference frame) +* at that epoch. The parameter set used here includes also various +* quantities that can, in fact, be derived from the other +* information. This approach is taken to avoiding unnecessary +* computation and loss of accuracy. The supplementary quantities +* are (i) alpha, which is proportional to the total energy of the +* orbit, (ii) the heliocentric distance at epoch, (iii) the +* outwards component of the velocity at the given epoch, (iv) an +* estimate of psi, the "universal eccentric anomaly" at a given +* date and (v) that date. +* +* Reference: Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. +* +* P.T.Wallace Starlink 18 March 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION PV(6),DATE,PMASS,U(13) + INTEGER JSTAT + +* Gaussian gravitational constant (exact) + DOUBLE PRECISION GCON + PARAMETER (GCON=0.01720209895D0) + +* Canonical days to seconds + DOUBLE PRECISION CD2S + PARAMETER (CD2S=GCON/86400D0) + +* Minimum allowed distance (AU) and speed (AU per canonical day) + DOUBLE PRECISION RMIN,VMIN + PARAMETER (RMIN=1D-3,VMIN=1D-3) + + DOUBLE PRECISION T0,CM,X,Y,Z,XD,YD,ZD,R,V2,V,ALPHA,RDV + + +* Reference epoch. + T0 = DATE + +* Combined mass (mu=M+m). + IF (PMASS.LT.0D0) GO TO 9010 + CM = 1D0+PMASS + +* Unpack the state vector, expressing velocity in AU per canonical day. + X = PV(1) + Y = PV(2) + Z = PV(3) + XD = PV(4)/CD2S + YD = PV(5)/CD2S + ZD = PV(6)/CD2S + +* Heliocentric distance, and speed. + R = SQRT(X*X+Y*Y+Z*Z) + V2 = XD*XD+YD*YD+ZD*ZD + V = SQRT(V2) + +* Reject unreasonably small values. + IF (R.LT.RMIN) GO TO 9020 + IF (V.LT.VMIN) GO TO 9030 + +* Total energy of the orbit. + ALPHA = V2-2D0*CM/R + +* Outward component of velocity. + RDV = X*XD+Y*YD+Z*ZD + +* Construct the universal-element set. + U(1) = CM + U(2) = ALPHA + U(3) = T0 + U(4) = X + U(5) = Y + U(6) = Z + U(7) = XD + U(8) = YD + U(9) = ZD + U(10) = R + U(11) = RDV + U(12) = T0 + U(13) = 0D0 + +* Exit. + JSTAT = 0 + GO TO 9999 + +* Negative PMASS. + 9010 CONTINUE + JSTAT = -1 + GO TO 9999 + +* Too close. + 9020 CONTINUE + JSTAT = -2 + GO TO 9999 + +* Too slow. + 9030 CONTINUE + JSTAT = -3 + + 9999 CONTINUE + END diff --git a/math/slalib/pvobs.f b/math/slalib/pvobs.f new file mode 100644 index 00000000..143704c3 --- /dev/null +++ b/math/slalib/pvobs.f @@ -0,0 +1,77 @@ + SUBROUTINE slPVOB (P, H, STL, PV) +*+ +* - - - - - - +* P V O B +* - - - - - - +* +* Position and velocity of an observing station (double precision) +* +* Given: +* P dp latitude (geodetic, radians) +* H dp height above reference spheroid (geodetic, metres) +* STL dp local apparent sidereal time (radians) +* +* Returned: +* PV dp(6) position/velocity 6-vector (AU, AU/s, true equator +* and equinox of date) +* +* Called: slGEOC +* +* IAU 1976 constants are used. +* +* P.T.Wallace Starlink 14 November 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION P,H,STL,PV(6) + + DOUBLE PRECISION R,Z,S,C,V + +* Mean sidereal rate (at J2000) in radians per (UT1) second + DOUBLE PRECISION SR + PARAMETER (SR=7.292115855306589D-5) + + + +* Geodetic to geocentric conversion + CALL slGEOC(P,H,R,Z) + +* Functions of ST + S=SIN(STL) + C=COS(STL) + +* Speed + V=SR*R + +* Position + PV(1)=R*C + PV(2)=R*S + PV(3)=Z + +* Velocity + PV(4)=-V*S + PV(5)=V*C + PV(6)=0D0 + + END diff --git a/math/slalib/pxy.f b/math/slalib/pxy.f new file mode 100644 index 00000000..6b67089b --- /dev/null +++ b/math/slalib/pxy.f @@ -0,0 +1,110 @@ + SUBROUTINE slPXY (NP,XYE,XYM,COEFFS,XYP,XRMS,YRMS,RRMS) +*+ +* - - - - +* P X Y +* - - - - +* +* Given arrays of "expected" and "measured" [X,Y] coordinates, and a +* linear model relating them (as produced by slFTXY), compute +* the array of "predicted" coordinates and the RMS residuals. +* +* Given: +* NP i number of samples +* XYE d(2,np) expected [X,Y] for each sample +* XYM d(2,np) measured [X,Y] for each sample +* COEFFS d(6) coefficients of model (see below) +* +* Returned: +* XYP d(2,np) predicted [X,Y] for each sample +* XRMS d RMS in X +* YRMS d RMS in Y +* RRMS d total RMS (vector sum of XRMS and YRMS) +* +* The model is supplied in the array COEFFS. Naming the +* elements of COEFF as follows: +* +* COEFFS(1) = A +* COEFFS(2) = B +* COEFFS(3) = C +* COEFFS(4) = D +* COEFFS(5) = E +* COEFFS(6) = F +* +* the model is applied thus: +* +* XP = A + B*XM + C*YM +* YP = D + E*XM + F*YM +* +* The residuals are (XP-XE) and (YP-YE). +* +* If NP is less than or equal to zero, no coordinates are +* transformed, and the RMS residuals are all zero. +* +* See also slFTXY, slINVF, slXYXY, slDCMF +* +* Called: slXYXY +* +* P.T.Wallace Starlink 22 May 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER NP + DOUBLE PRECISION XYE(2,NP),XYM(2,NP),COEFFS(6), + : XYP(2,NP),XRMS,YRMS,RRMS + + INTEGER I + DOUBLE PRECISION SDX2,SDY2,XP,YP,DX,DY,DX2,DY2,P + + + +* Initialize summations + SDX2=0D0 + SDY2=0D0 + +* Loop by sample + DO I=1,NP + +* Transform "measured" [X,Y] to "predicted" [X,Y] + CALL slXYXY(XYM(1,I),XYM(2,I),COEFFS,XP,YP) + XYP(1,I)=XP + XYP(2,I)=YP + +* Compute residuals in X and Y, and update summations + DX=XYE(1,I)-XP + DY=XYE(2,I)-YP + DX2=DX*DX + DY2=DY*DY + SDX2=SDX2+DX2 + SDY2=SDY2+DY2 + +* Next sample + END DO + +* Compute RMS values + P=MAX(1D0,DBLE(NP)) + XRMS=SQRT(SDX2/P) + YRMS=SQRT(SDY2/P) + RRMS=SQRT(XRMS*XRMS+YRMS*YRMS) + + END diff --git a/math/slalib/random.F__vms b/math/slalib/random.F__vms new file mode 100644 index 00000000..b57b5fc9 --- /dev/null +++ b/math/slalib/random.F__vms @@ -0,0 +1,69 @@ + REAL FUNCTION sla_RANDOM (SEED) +*+ +* - - - - - - - +* R A N D O M +* - - - - - - - +* +* Generate pseudo-random real number in the range 0 <= X < 1. +* (single precision) +* +* !!! Version for VAX/VMS and DECstation !!! +* +* Given: +* SEED real an arbitrary real number +* +* Notes: +* +* 1) The result is a pseudo-random REAL number in the range +* 0 <= sla_RANDOM < 1. +* +* 2) SEED is used first time through only. +* +* Called: RAN (a REAL function from the DEC Fortran Library) +* +* P.T.Wallace Starlink 14 October 1991 +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +*- + + IMPLICIT NONE + + REAL SEED + + REAL RAN + + REAL AS + INTEGER ISEED + LOGICAL FIRST + SAVE FIRST + DATA FIRST /.TRUE./ + + + +* If first time, turn SEED into a large, odd integer + IF (FIRST) THEN + AS=ABS(SEED)+1.0 + ISEED=NINT(AS/10.0**(NINT(ALOG10(AS))-6)) + IF (MOD(ISEED,2).EQ.0) ISEED=ISEED+1 + FIRST=.FALSE. + END IF + +* Next pseudo-random number + sla_RANDOM=RAN(ISEED) + + END diff --git a/math/slalib/random.F__win b/math/slalib/random.F__win new file mode 100644 index 00000000..9cd77fac --- /dev/null +++ b/math/slalib/random.F__win @@ -0,0 +1,59 @@ + REAL FUNCTION sla_RANDOM (XSEED) +*+ +* - - - - - - - +* R A N D O M +* - - - - - - - +* +* Generate pseudo-random real number in the range 0 <= X < 1. +* +* (single precision) +* +* !!! Microsoft Fortran dependent !!! +* +* Given (but used first time only): +* XSEED real an arbitrary real number +* +* The value returned is a pseudo-random number such that +* 0 <= sla_RANDOM < 1. +* +* Called: RANDOM (Microsoft run-time library) +* +* P.T.Wallace Starlink 7 November 2003 +* +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +*- + + IMPLICIT NONE + + REAL XSEED + + REAL X + LOGICAL FIRST + SAVE FIRST + DATA FIRST /.TRUE./ + + + IF (FIRST) THEN + CALL SEED(NINT(MOD(XSEED*1.234E7,32E3))) ! Microsoft Fortran + FIRST=.FALSE. + END IF + CALL RANDOM(X) ! Microsoft Fortran + sla_RANDOM=X + + END diff --git a/math/slalib/random.Fdefault b/math/slalib/random.Fdefault new file mode 100644 index 00000000..9a79cb6c --- /dev/null +++ b/math/slalib/random.Fdefault @@ -0,0 +1,87 @@ +#include "config.h" + REAL FUNCTION sla_RANDOM (SEED) +*+ +* - - - - - - - +* R A N D O M +* - - - - - - - +* +* Generate pseudo-random real number in the range 0 <= X < 1. +* (single precision) +* +* +* Given: +* SEED real an arbitrary real number +* +* Notes: +* +* 1) The result is a pseudo-random REAL number in the range +* 0 <= sla_RANDOM < 1. +* +* 2) SEED is used first time through only. +* +* Called: RAN or RAND (a REAL function returning a random variate -- +* the precise function which is called depends on which functions +* are available when the library is built). If neither of these +* is available, we use the local substitute RANDOM defined +* in rtl_random.c +* +* P.T.Wallace Starlink 14 October 1991 +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +*- + + IMPLICIT NONE + + REAL SEED + +#if HAVE_RAND + REAL RAND +#elif HAVE_RANDOM + REAL RANDOM +#else + error "Can't find random-number function" +#endif + + REAL AS + INTEGER ISEED + LOGICAL FIRST + SAVE FIRST + DATA FIRST /.TRUE./ + + + +* If first time, turn SEED into a large, odd integer + IF (FIRST) THEN + AS=ABS(SEED)+1.0 + ISEED=NINT(AS/10.0**(NINT(ALOG10(AS))-6)) + IF (MOD(ISEED,2).EQ.0) ISEED=ISEED+1 + FIRST=.FALSE. +#if HAVE_RAND + AS = RAND(ISEED) +#endif + ELSE + ISEED=0 + END IF + +* Next pseudo-random number +#if HAVE_RAND + sla_RANDOM=RAND(0) +#elif HAVE_RANDOM + sla_RANDOM=RANDOM(ISEED) +#endif + + END diff --git a/math/slalib/range.f b/math/slalib/range.f new file mode 100644 index 00000000..fa927043 --- /dev/null +++ b/math/slalib/range.f @@ -0,0 +1,51 @@ + REAL FUNCTION slRA1P (ANGLE) +*+ +* - - - - - - +* R A 1 P +* - - - - - - +* +* Normalize angle into range +/- pi (single precision) +* +* Given: +* ANGLE dp the angle in radians +* +* The result is ANGLE expressed in the +/- pi (single +* precision). +* +* P.T.Wallace Starlink 23 November 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL ANGLE + + REAL API,A2PI + PARAMETER (API=3.141592653589793238462643) + PARAMETER (A2PI=6.283185307179586476925287) + + + slRA1P=MOD(ANGLE,A2PI) + IF (ABS(slRA1P).GE.API) + : slRA1P=slRA1P-SIGN(A2PI,ANGLE) + + END diff --git a/math/slalib/ranorm.f b/math/slalib/ranorm.f new file mode 100644 index 00000000..77f4b781 --- /dev/null +++ b/math/slalib/ranorm.f @@ -0,0 +1,49 @@ + REAL FUNCTION slRA2P (ANGLE) +*+ +* - - - - - - - +* R A 2 P +* - - - - - - - +* +* Normalize angle into range 0-2 pi (single precision) +* +* Given: +* ANGLE dp the angle in radians +* +* The result is ANGLE expressed in the range 0-2 pi (single +* precision). +* +* P.T.Wallace Starlink 23 November 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL ANGLE + + REAL A2PI + PARAMETER (A2PI=6.283185307179586476925287) + + + slRA2P=MOD(ANGLE,A2PI) + IF (slRA2P.LT.0.0) slRA2P=slRA2P+A2PI + + END diff --git a/math/slalib/rcc.f b/math/slalib/rcc.f new file mode 100644 index 00000000..a07a6d82 --- /dev/null +++ b/math/slalib/rcc.f @@ -0,0 +1,1110 @@ + DOUBLE PRECISION FUNCTION slRCC (TDB, UT1, WL, U, V) +*+ +* - - - - +* R C C +* - - - - +* +* Relativistic clock correction: the difference between proper time at +* a point on the surface of the Earth and coordinate time in the Solar +* System barycentric space-time frame of reference. +* +* The proper time is terrestrial time, TT; the coordinate time is an +* implementation of barycentric dynamical time, TDB. +* +* Given: +* TDB d TDB (MJD: JD-2400000.5) +* UT1 d universal time (fraction of one day) +* WL d clock longitude (radians west) +* U d clock distance from Earth spin axis (km) +* V d clock distance north of Earth equatorial plane (km) +* +* Returned: +* The clock correction, TDB-TT, in seconds: +* +* . TDB is coordinate time in the solar system barycentre frame +* of reference, in units chosen to eliminate the scale difference +* with respect to terrestrial time. +* +* . TT is the proper time for clocks at mean sea level on the +* Earth. +* +* Notes: +* +* 1 The argument TDB is, strictly, the barycentric coordinate time; +* however, the terrestrial time TT can in practice be used without +* any significant loss of accuracy. +* +* 2 The result returned by slRCC comprises a main (annual) +* sinusoidal term of amplitude approximately 0.00166 seconds, plus +* planetary and lunar terms up to about 20 microseconds, and diurnal +* terms up to 2 microseconds. The variation arises from the +* transverse Doppler effect and the gravitational red-shift as the +* observer varies in speed and moves through different gravitational +* potentials. +* +* 3 The geocentric model is that of Fairhead & Bretagnon (1990), in +* its full form. It was supplied by Fairhead (private +* communication) as a FORTRAN subroutine. The original Fairhead +* routine used explicit formulae, in such large numbers that +* problems were experienced with certain compilers (Microsoft +* Fortran on PC aborted with stack overflow, Convex compiled +* successfully but extremely slowly). The present implementation is +* a complete recoding, with the original Fairhead coefficients held +* in a table. To optimise arithmetic precision, the terms are +* accumulated in reverse order, smallest first. A number of other +* coding changes were made, in order to match the calling sequence +* of previous versions of the present routine, and to comply with +* Starlink programming standards. The numerical results compared +* with those from the Fairhead form are essentially unaffected by +* the changes, the differences being at the 10^-20 sec level. +* +* 4 The topocentric part of the model is from Moyer (1981) and +* Murray (1983). It is an approximation to the expression +* ( v / c ) . ( r / c ), where v is the barycentric velocity of +* the Earth, r is the geocentric position of the observer and +* c is the speed of light. +* +* 5 During the interval 1950-2050, the absolute accuracy of is better +* than +/- 3 nanoseconds relative to direct numerical integrations +* using the JPL DE200/LE200 solar system ephemeris. +* +* 6 The IAU definition of TDB was that it must differ from TT only by +* periodic terms. Though practical, this is an imprecise definition +* which ignores the existence of very long-period and secular +* effects in the dynamics of the solar system. As a consequence, +* different implementations of TDB will, in general, differ in zero- +* point and will drift linearly relative to one other. +* +* 7 TDB was, in principle, superseded by new coordinate timescales +* which the IAU introduced in 1991: geocentric coordinate time, +* TCG, and barycentric coordinate time, TCB. However, slRCC +* can be used to implement the periodic part of TCB-TCG. +* +* References: +* +* 1 Fairhead, L., & Bretagnon, P., Astron.Astrophys., 229, 240-247 +* (1990). +* +* 2 Moyer, T.D., Cel.Mech., 23, 33 (1981). +* +* 3 Murray, C.A., Vectorial Astrometry, Adam Hilger (1983). +* +* 4 Seidelmann, P.K. et al, Explanatory Supplement to the +* Astronomical Almanac, Chapter 2, University Science Books +* (1992). +* +* 5 Simon J.L., Bretagnon P., Chapront J., Chapront-Touze M., +* Francou G. & Laskar J., Astron.Astrophys., 282, 663-683 (1994). +* +* P.T.Wallace Starlink 7 May 2000 +* +* Copyright (C) 2000 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION TDB,UT1,WL,U,V + + DOUBLE PRECISION D2PI,D2R + PARAMETER (D2PI=6.283185307179586476925287D0, + : D2R=0.0174532925199432957692369D0) + + DOUBLE PRECISION T,TSOL,W,ELSUN,EMSUN,D,ELJ,ELS, + : WT,W0,W1,W2,W3,W4,WF,WJ + +* ----------------------------------------------------------------------- +* +* Fairhead and Bretagnon canonical coefficients +* +* 787 sets of three coefficients. +* +* Each set is amplitude (microseconds) +* frequency (radians per Julian millennium since J2000), +* phase (radians). +* +* Sets 1-474 are the T**0 terms, +* " 475-679 " " T**1 " +* " 680-764 " " T**2 " +* " 765-784 " " T**3 " +* " 785-787 " " T**4 " . +* + DOUBLE PRECISION FAIRHD(3,787) + INTEGER I,J + DATA ((FAIRHD(I,J),I=1,3),J= 1, 10) / + : 1656.674564D-6, 6283.075849991D0, 6.240054195D0, + : 22.417471D-6, 5753.384884897D0, 4.296977442D0, + : 13.839792D-6, 12566.151699983D0, 6.196904410D0, + : 4.770086D-6, 529.690965095D0, 0.444401603D0, + : 4.676740D-6, 6069.776754553D0, 4.021195093D0, + : 2.256707D-6, 213.299095438D0, 5.543113262D0, + : 1.694205D-6, -3.523118349D0, 5.025132748D0, + : 1.554905D-6, 77713.771467920D0, 5.198467090D0, + : 1.276839D-6, 7860.419392439D0, 5.988822341D0, + : 1.193379D-6, 5223.693919802D0, 3.649823730D0 / + DATA ((FAIRHD(I,J),I=1,3),J= 11, 20) / + : 1.115322D-6, 3930.209696220D0, 1.422745069D0, + : 0.794185D-6, 11506.769769794D0, 2.322313077D0, + : 0.447061D-6, 26.298319800D0, 3.615796498D0, + : 0.435206D-6, -398.149003408D0, 4.349338347D0, + : 0.600309D-6, 1577.343542448D0, 2.678271909D0, + : 0.496817D-6, 6208.294251424D0, 5.696701824D0, + : 0.486306D-6, 5884.926846583D0, 0.520007179D0, + : 0.432392D-6, 74.781598567D0, 2.435898309D0, + : 0.468597D-6, 6244.942814354D0, 5.866398759D0, + : 0.375510D-6, 5507.553238667D0, 4.103476804D0 / + DATA ((FAIRHD(I,J),I=1,3),J= 21, 30) / + : 0.243085D-6, -775.522611324D0, 3.651837925D0, + : 0.173435D-6, 18849.227549974D0, 6.153743485D0, + : 0.230685D-6, 5856.477659115D0, 4.773852582D0, + : 0.203747D-6, 12036.460734888D0, 4.333987818D0, + : 0.143935D-6, -796.298006816D0, 5.957517795D0, + : 0.159080D-6, 10977.078804699D0, 1.890075226D0, + : 0.119979D-6, 38.133035638D0, 4.551585768D0, + : 0.118971D-6, 5486.777843175D0, 1.914547226D0, + : 0.116120D-6, 1059.381930189D0, 0.873504123D0, + : 0.137927D-6, 11790.629088659D0, 1.135934669D0 / + DATA ((FAIRHD(I,J),I=1,3),J= 31, 40) / + : 0.098358D-6, 2544.314419883D0, 0.092793886D0, + : 0.101868D-6, -5573.142801634D0, 5.984503847D0, + : 0.080164D-6, 206.185548437D0, 2.095377709D0, + : 0.079645D-6, 4694.002954708D0, 2.949233637D0, + : 0.062617D-6, 20.775395492D0, 2.654394814D0, + : 0.075019D-6, 2942.463423292D0, 4.980931759D0, + : 0.064397D-6, 5746.271337896D0, 1.280308748D0, + : 0.063814D-6, 5760.498431898D0, 4.167901731D0, + : 0.048042D-6, 2146.165416475D0, 1.495846011D0, + : 0.048373D-6, 155.420399434D0, 2.251573730D0 / + DATA ((FAIRHD(I,J),I=1,3),J= 41, 50) / + : 0.058844D-6, 426.598190876D0, 4.839650148D0, + : 0.046551D-6, -0.980321068D0, 0.921573539D0, + : 0.054139D-6, 17260.154654690D0, 3.411091093D0, + : 0.042411D-6, 6275.962302991D0, 2.869567043D0, + : 0.040184D-6, -7.113547001D0, 3.565975565D0, + : 0.036564D-6, 5088.628839767D0, 3.324679049D0, + : 0.040759D-6, 12352.852604545D0, 3.981496998D0, + : 0.036507D-6, 801.820931124D0, 6.248866009D0, + : 0.036955D-6, 3154.687084896D0, 5.071801441D0, + : 0.042732D-6, 632.783739313D0, 5.720622217D0 / + DATA ((FAIRHD(I,J),I=1,3),J= 51, 60) / + : 0.042560D-6, 161000.685737473D0, 1.270837679D0, + : 0.040480D-6, 15720.838784878D0, 2.546610123D0, + : 0.028244D-6, -6286.598968340D0, 5.069663519D0, + : 0.033477D-6, 6062.663207553D0, 4.144987272D0, + : 0.034867D-6, 522.577418094D0, 5.210064075D0, + : 0.032438D-6, 6076.890301554D0, 0.749317412D0, + : 0.030215D-6, 7084.896781115D0, 3.389610345D0, + : 0.029247D-6, -71430.695617928D0, 4.183178762D0, + : 0.033529D-6, 9437.762934887D0, 2.404714239D0, + : 0.032423D-6, 8827.390269875D0, 5.541473556D0 / + DATA ((FAIRHD(I,J),I=1,3),J= 61, 70) / + : 0.027567D-6, 6279.552731642D0, 5.040846034D0, + : 0.029862D-6, 12139.553509107D0, 1.770181024D0, + : 0.022509D-6, 10447.387839604D0, 1.460726241D0, + : 0.020937D-6, 8429.241266467D0, 0.652303414D0, + : 0.020322D-6, 419.484643875D0, 3.735430632D0, + : 0.024816D-6, -1194.447010225D0, 1.087136918D0, + : 0.025196D-6, 1748.016413067D0, 2.901883301D0, + : 0.021691D-6, 14143.495242431D0, 5.952658009D0, + : 0.017673D-6, 6812.766815086D0, 3.186129845D0, + : 0.022567D-6, 6133.512652857D0, 3.307984806D0 / + DATA ((FAIRHD(I,J),I=1,3),J= 71, 80) / + : 0.016155D-6, 10213.285546211D0, 1.331103168D0, + : 0.014751D-6, 1349.867409659D0, 4.308933301D0, + : 0.015949D-6, -220.412642439D0, 4.005298270D0, + : 0.015974D-6, -2352.866153772D0, 6.145309371D0, + : 0.014223D-6, 17789.845619785D0, 2.104551349D0, + : 0.017806D-6, 73.297125859D0, 3.475975097D0, + : 0.013671D-6, -536.804512095D0, 5.971672571D0, + : 0.011942D-6, 8031.092263058D0, 2.053414715D0, + : 0.014318D-6, 16730.463689596D0, 3.016058075D0, + : 0.012462D-6, 103.092774219D0, 1.737438797D0 / + DATA ((FAIRHD(I,J),I=1,3),J= 81, 90) / + : 0.010962D-6, 3.590428652D0, 2.196567739D0, + : 0.015078D-6, 19651.048481098D0, 3.969480770D0, + : 0.010396D-6, 951.718406251D0, 5.717799605D0, + : 0.011707D-6, -4705.732307544D0, 2.654125618D0, + : 0.010453D-6, 5863.591206116D0, 1.913704550D0, + : 0.012420D-6, 4690.479836359D0, 4.734090399D0, + : 0.011847D-6, 5643.178563677D0, 5.489005403D0, + : 0.008610D-6, 3340.612426700D0, 3.661698944D0, + : 0.011622D-6, 5120.601145584D0, 4.863931876D0, + : 0.010825D-6, 553.569402842D0, 0.842715011D0 / + DATA ((FAIRHD(I,J),I=1,3),J= 91,100) / + : 0.008666D-6, -135.065080035D0, 3.293406547D0, + : 0.009963D-6, 149.563197135D0, 4.870690598D0, + : 0.009858D-6, 6309.374169791D0, 1.061816410D0, + : 0.007959D-6, 316.391869657D0, 2.465042647D0, + : 0.010099D-6, 283.859318865D0, 1.942176992D0, + : 0.007147D-6, -242.728603974D0, 3.661486981D0, + : 0.007505D-6, 5230.807466803D0, 4.920937029D0, + : 0.008323D-6, 11769.853693166D0, 1.229392026D0, + : 0.007490D-6, -6256.777530192D0, 3.658444681D0, + : 0.009370D-6, 149854.400134205D0, 0.673880395D0 / + DATA ((FAIRHD(I,J),I=1,3),J=101,110) / + : 0.007117D-6, 38.027672636D0, 5.294249518D0, + : 0.007857D-6, 12168.002696575D0, 0.525733528D0, + : 0.007019D-6, 6206.809778716D0, 0.837688810D0, + : 0.006056D-6, 955.599741609D0, 4.194535082D0, + : 0.008107D-6, 13367.972631107D0, 3.793235253D0, + : 0.006731D-6, 5650.292110678D0, 5.639906583D0, + : 0.007332D-6, 36.648562930D0, 0.114858677D0, + : 0.006366D-6, 4164.311989613D0, 2.262081818D0, + : 0.006858D-6, 5216.580372801D0, 0.642063318D0, + : 0.006919D-6, 6681.224853400D0, 6.018501522D0 / + DATA ((FAIRHD(I,J),I=1,3),J=111,120) / + : 0.006826D-6, 7632.943259650D0, 3.458654112D0, + : 0.005308D-6, -1592.596013633D0, 2.500382359D0, + : 0.005096D-6, 11371.704689758D0, 2.547107806D0, + : 0.004841D-6, 5333.900241022D0, 0.437078094D0, + : 0.005582D-6, 5966.683980335D0, 2.246174308D0, + : 0.006304D-6, 11926.254413669D0, 2.512929171D0, + : 0.006603D-6, 23581.258177318D0, 5.393136889D0, + : 0.005123D-6, -1.484472708D0, 2.999641028D0, + : 0.004648D-6, 1589.072895284D0, 1.275847090D0, + : 0.005119D-6, 6438.496249426D0, 1.486539246D0 / + DATA ((FAIRHD(I,J),I=1,3),J=121,130) / + : 0.004521D-6, 4292.330832950D0, 6.140635794D0, + : 0.005680D-6, 23013.539539587D0, 4.557814849D0, + : 0.005488D-6, -3.455808046D0, 0.090675389D0, + : 0.004193D-6, 7234.794256242D0, 4.869091389D0, + : 0.003742D-6, 7238.675591600D0, 4.691976180D0, + : 0.004148D-6, -110.206321219D0, 3.016173439D0, + : 0.004553D-6, 11499.656222793D0, 5.554998314D0, + : 0.004892D-6, 5436.993015240D0, 1.475415597D0, + : 0.004044D-6, 4732.030627343D0, 1.398784824D0, + : 0.004164D-6, 12491.370101415D0, 5.650931916D0 / + DATA ((FAIRHD(I,J),I=1,3),J=131,140) / + : 0.004349D-6, 11513.883316794D0, 2.181745369D0, + : 0.003919D-6, 12528.018664345D0, 5.823319737D0, + : 0.003129D-6, 6836.645252834D0, 0.003844094D0, + : 0.004080D-6, -7058.598461315D0, 3.690360123D0, + : 0.003270D-6, 76.266071276D0, 1.517189902D0, + : 0.002954D-6, 6283.143160294D0, 4.447203799D0, + : 0.002872D-6, 28.449187468D0, 1.158692983D0, + : 0.002881D-6, 735.876513532D0, 0.349250250D0, + : 0.003279D-6, 5849.364112115D0, 4.893384368D0, + : 0.003625D-6, 6209.778724132D0, 1.473760578D0 / + DATA ((FAIRHD(I,J),I=1,3),J=141,150) / + : 0.003074D-6, 949.175608970D0, 5.185878737D0, + : 0.002775D-6, 9917.696874510D0, 1.030026325D0, + : 0.002646D-6, 10973.555686350D0, 3.918259169D0, + : 0.002575D-6, 25132.303399966D0, 6.109659023D0, + : 0.003500D-6, 263.083923373D0, 1.892100742D0, + : 0.002740D-6, 18319.536584880D0, 4.320519510D0, + : 0.002464D-6, 202.253395174D0, 4.698203059D0, + : 0.002409D-6, 2.542797281D0, 5.325009315D0, + : 0.003354D-6, -90955.551694697D0, 1.942656623D0, + : 0.002296D-6, 6496.374945429D0, 5.061810696D0 / + DATA ((FAIRHD(I,J),I=1,3),J=151,160) / + : 0.003002D-6, 6172.869528772D0, 2.797822767D0, + : 0.003202D-6, 27511.467873537D0, 0.531673101D0, + : 0.002954D-6, -6283.008539689D0, 4.533471191D0, + : 0.002353D-6, 639.897286314D0, 3.734548088D0, + : 0.002401D-6, 16200.772724501D0, 2.605547070D0, + : 0.003053D-6, 233141.314403759D0, 3.029030662D0, + : 0.003024D-6, 83286.914269554D0, 2.355556099D0, + : 0.002863D-6, 17298.182327326D0, 5.240963796D0, + : 0.002103D-6, -7079.373856808D0, 5.756641637D0, + : 0.002303D-6, 83996.847317911D0, 2.013686814D0 / + DATA ((FAIRHD(I,J),I=1,3),J=161,170) / + : 0.002303D-6, 18073.704938650D0, 1.089100410D0, + : 0.002381D-6, 63.735898303D0, 0.759188178D0, + : 0.002493D-6, 6386.168624210D0, 0.645026535D0, + : 0.002366D-6, 3.932153263D0, 6.215885448D0, + : 0.002169D-6, 11015.106477335D0, 4.845297676D0, + : 0.002397D-6, 6243.458341645D0, 3.809290043D0, + : 0.002183D-6, 1162.474704408D0, 6.179611691D0, + : 0.002353D-6, 6246.427287062D0, 4.781719760D0, + : 0.002199D-6, -245.831646229D0, 5.956152284D0, + : 0.001729D-6, 3894.181829542D0, 1.264976635D0 / + DATA ((FAIRHD(I,J),I=1,3),J=171,180) / + : 0.001896D-6, -3128.388765096D0, 4.914231596D0, + : 0.002085D-6, 35.164090221D0, 1.405158503D0, + : 0.002024D-6, 14712.317116458D0, 2.752035928D0, + : 0.001737D-6, 6290.189396992D0, 5.280820144D0, + : 0.002229D-6, 491.557929457D0, 1.571007057D0, + : 0.001602D-6, 14314.168113050D0, 4.203664806D0, + : 0.002186D-6, 454.909366527D0, 1.402101526D0, + : 0.001897D-6, 22483.848574493D0, 4.167932508D0, + : 0.001825D-6, -3738.761430108D0, 0.545828785D0, + : 0.001894D-6, 1052.268383188D0, 5.817167450D0 / + DATA ((FAIRHD(I,J),I=1,3),J=181,190) / + : 0.001421D-6, 20.355319399D0, 2.419886601D0, + : 0.001408D-6, 10984.192351700D0, 2.732084787D0, + : 0.001847D-6, 10873.986030480D0, 2.903477885D0, + : 0.001391D-6, -8635.942003763D0, 0.593891500D0, + : 0.001388D-6, -7.046236698D0, 1.166145902D0, + : 0.001810D-6, -88860.057071188D0, 0.487355242D0, + : 0.001288D-6, -1990.745017041D0, 3.913022880D0, + : 0.001297D-6, 23543.230504682D0, 3.063805171D0, + : 0.001335D-6, -266.607041722D0, 3.995764039D0, + : 0.001376D-6, 10969.965257698D0, 5.152914309D0 / + DATA ((FAIRHD(I,J),I=1,3),J=191,200) / + : 0.001745D-6, 244287.600007027D0, 3.626395673D0, + : 0.001649D-6, 31441.677569757D0, 1.952049260D0, + : 0.001416D-6, 9225.539273283D0, 4.996408389D0, + : 0.001238D-6, 4804.209275927D0, 5.503379738D0, + : 0.001472D-6, 4590.910180489D0, 4.164913291D0, + : 0.001169D-6, 6040.347246017D0, 5.841719038D0, + : 0.001039D-6, 5540.085789459D0, 2.769753519D0, + : 0.001004D-6, -170.672870619D0, 0.755008103D0, + : 0.001284D-6, 10575.406682942D0, 5.306538209D0, + : 0.001278D-6, 71.812653151D0, 4.713486491D0 / + DATA ((FAIRHD(I,J),I=1,3),J=201,210) / + : 0.001321D-6, 18209.330263660D0, 2.624866359D0, + : 0.001297D-6, 21228.392023546D0, 0.382603541D0, + : 0.000954D-6, 6282.095528923D0, 0.882213514D0, + : 0.001145D-6, 6058.731054289D0, 1.169483931D0, + : 0.000979D-6, 5547.199336460D0, 5.448375984D0, + : 0.000987D-6, -6262.300454499D0, 2.656486959D0, + : 0.001070D-6, -154717.609887482D0, 1.827624012D0, + : 0.000991D-6, 4701.116501708D0, 4.387001801D0, + : 0.001155D-6, -14.227094002D0, 3.042700750D0, + : 0.001176D-6, 277.034993741D0, 3.335519004D0 / + DATA ((FAIRHD(I,J),I=1,3),J=211,220) / + : 0.000890D-6, 13916.019109642D0, 5.601498297D0, + : 0.000884D-6, -1551.045222648D0, 1.088831705D0, + : 0.000876D-6, 5017.508371365D0, 3.969902609D0, + : 0.000806D-6, 15110.466119866D0, 5.142876744D0, + : 0.000773D-6, -4136.910433516D0, 0.022067765D0, + : 0.001077D-6, 175.166059800D0, 1.844913056D0, + : 0.000954D-6, -6284.056171060D0, 0.968480906D0, + : 0.000737D-6, 5326.786694021D0, 4.923831588D0, + : 0.000845D-6, -433.711737877D0, 4.749245231D0, + : 0.000819D-6, 8662.240323563D0, 5.991247817D0 / + DATA ((FAIRHD(I,J),I=1,3),J=221,230) / + : 0.000852D-6, 199.072001436D0, 2.189604979D0, + : 0.000723D-6, 17256.631536341D0, 6.068719637D0, + : 0.000940D-6, 6037.244203762D0, 6.197428148D0, + : 0.000885D-6, 11712.955318231D0, 3.280414875D0, + : 0.000706D-6, 12559.038152982D0, 2.824848947D0, + : 0.000732D-6, 2379.164473572D0, 2.501813417D0, + : 0.000764D-6, -6127.655450557D0, 2.236346329D0, + : 0.000908D-6, 131.541961686D0, 2.521257490D0, + : 0.000907D-6, 35371.887265976D0, 3.370195967D0, + : 0.000673D-6, 1066.495477190D0, 3.876512374D0 / + DATA ((FAIRHD(I,J),I=1,3),J=231,240) / + : 0.000814D-6, 17654.780539750D0, 4.627122566D0, + : 0.000630D-6, 36.027866677D0, 0.156368499D0, + : 0.000798D-6, 515.463871093D0, 5.151962502D0, + : 0.000798D-6, 148.078724426D0, 5.909225055D0, + : 0.000806D-6, 309.278322656D0, 6.054064447D0, + : 0.000607D-6, -39.617508346D0, 2.839021623D0, + : 0.000601D-6, 412.371096874D0, 3.984225404D0, + : 0.000646D-6, 11403.676995575D0, 3.852959484D0, + : 0.000704D-6, 13521.751441591D0, 2.300991267D0, + : 0.000603D-6, -65147.619767937D0, 4.140083146D0 / + DATA ((FAIRHD(I,J),I=1,3),J=241,250) / + : 0.000609D-6, 10177.257679534D0, 0.437122327D0, + : 0.000631D-6, 5767.611978898D0, 4.026532329D0, + : 0.000576D-6, 11087.285125918D0, 4.760293101D0, + : 0.000674D-6, 14945.316173554D0, 6.270510511D0, + : 0.000726D-6, 5429.879468239D0, 6.039606892D0, + : 0.000710D-6, 28766.924424484D0, 5.672617711D0, + : 0.000647D-6, 11856.218651625D0, 3.397132627D0, + : 0.000678D-6, -5481.254918868D0, 6.249666675D0, + : 0.000618D-6, 22003.914634870D0, 2.466427018D0, + : 0.000738D-6, 6134.997125565D0, 2.242668890D0 / + DATA ((FAIRHD(I,J),I=1,3),J=251,260) / + : 0.000660D-6, 625.670192312D0, 5.864091907D0, + : 0.000694D-6, 3496.032826134D0, 2.668309141D0, + : 0.000531D-6, 6489.261398429D0, 1.681888780D0, + : 0.000611D-6, -143571.324284214D0, 2.424978312D0, + : 0.000575D-6, 12043.574281889D0, 4.216492400D0, + : 0.000553D-6, 12416.588502848D0, 4.772158039D0, + : 0.000689D-6, 4686.889407707D0, 6.224271088D0, + : 0.000495D-6, 7342.457780181D0, 3.817285811D0, + : 0.000567D-6, 3634.621024518D0, 1.649264690D0, + : 0.000515D-6, 18635.928454536D0, 3.945345892D0 / + DATA ((FAIRHD(I,J),I=1,3),J=261,270) / + : 0.000486D-6, -323.505416657D0, 4.061673868D0, + : 0.000662D-6, 25158.601719765D0, 1.794058369D0, + : 0.000509D-6, 846.082834751D0, 3.053874588D0, + : 0.000472D-6, -12569.674818332D0, 5.112133338D0, + : 0.000461D-6, 6179.983075773D0, 0.513669325D0, + : 0.000641D-6, 83467.156352816D0, 3.210727723D0, + : 0.000520D-6, 10344.295065386D0, 2.445597761D0, + : 0.000493D-6, 18422.629359098D0, 1.676939306D0, + : 0.000478D-6, 1265.567478626D0, 5.487314569D0, + : 0.000472D-6, -18.159247265D0, 1.999707589D0 / + DATA ((FAIRHD(I,J),I=1,3),J=271,280) / + : 0.000559D-6, 11190.377900137D0, 5.783236356D0, + : 0.000494D-6, 9623.688276691D0, 3.022645053D0, + : 0.000463D-6, 5739.157790895D0, 1.411223013D0, + : 0.000432D-6, 16858.482532933D0, 1.179256434D0, + : 0.000574D-6, 72140.628666286D0, 1.758191830D0, + : 0.000484D-6, 17267.268201691D0, 3.290589143D0, + : 0.000550D-6, 4907.302050146D0, 0.864024298D0, + : 0.000399D-6, 14.977853527D0, 2.094441910D0, + : 0.000491D-6, 224.344795702D0, 0.878372791D0, + : 0.000432D-6, 20426.571092422D0, 6.003829241D0 / + DATA ((FAIRHD(I,J),I=1,3),J=281,290) / + : 0.000481D-6, 5749.452731634D0, 4.309591964D0, + : 0.000480D-6, 5757.317038160D0, 1.142348571D0, + : 0.000485D-6, 6702.560493867D0, 0.210580917D0, + : 0.000426D-6, 6055.549660552D0, 4.274476529D0, + : 0.000480D-6, 5959.570433334D0, 5.031351030D0, + : 0.000466D-6, 12562.628581634D0, 4.959581597D0, + : 0.000520D-6, 39302.096962196D0, 4.788002889D0, + : 0.000458D-6, 12132.439962106D0, 1.880103788D0, + : 0.000470D-6, 12029.347187887D0, 1.405611197D0, + : 0.000416D-6, -7477.522860216D0, 1.082356330D0 / + DATA ((FAIRHD(I,J),I=1,3),J=291,300) / + : 0.000449D-6, 11609.862544012D0, 4.179989585D0, + : 0.000465D-6, 17253.041107690D0, 0.353496295D0, + : 0.000362D-6, -4535.059436924D0, 1.583849576D0, + : 0.000383D-6, 21954.157609398D0, 3.747376371D0, + : 0.000389D-6, 17.252277143D0, 1.395753179D0, + : 0.000331D-6, 18052.929543158D0, 0.566790582D0, + : 0.000430D-6, 13517.870106233D0, 0.685827538D0, + : 0.000368D-6, -5756.908003246D0, 0.731374317D0, + : 0.000330D-6, 10557.594160824D0, 3.710043680D0, + : 0.000332D-6, 20199.094959633D0, 1.652901407D0 / + DATA ((FAIRHD(I,J),I=1,3),J=301,310) / + : 0.000384D-6, 11933.367960670D0, 5.827781531D0, + : 0.000387D-6, 10454.501386605D0, 2.541182564D0, + : 0.000325D-6, 15671.081759407D0, 2.178850542D0, + : 0.000318D-6, 138.517496871D0, 2.253253037D0, + : 0.000305D-6, 9388.005909415D0, 0.578340206D0, + : 0.000352D-6, 5749.861766548D0, 3.000297967D0, + : 0.000311D-6, 6915.859589305D0, 1.693574249D0, + : 0.000297D-6, 24072.921469776D0, 1.997249392D0, + : 0.000363D-6, -640.877607382D0, 5.071820966D0, + : 0.000323D-6, 12592.450019783D0, 1.072262823D0 / + DATA ((FAIRHD(I,J),I=1,3),J=311,320) / + : 0.000341D-6, 12146.667056108D0, 4.700657997D0, + : 0.000290D-6, 9779.108676125D0, 1.812320441D0, + : 0.000342D-6, 6132.028180148D0, 4.322238614D0, + : 0.000329D-6, 6268.848755990D0, 3.033827743D0, + : 0.000374D-6, 17996.031168222D0, 3.388716544D0, + : 0.000285D-6, -533.214083444D0, 4.687313233D0, + : 0.000338D-6, 6065.844601290D0, 0.877776108D0, + : 0.000276D-6, 24.298513841D0, 0.770299429D0, + : 0.000336D-6, -2388.894020449D0, 5.353796034D0, + : 0.000290D-6, 3097.883822726D0, 4.075291557D0 / + DATA ((FAIRHD(I,J),I=1,3),J=321,330) / + : 0.000318D-6, 709.933048357D0, 5.941207518D0, + : 0.000271D-6, 13095.842665077D0, 3.208912203D0, + : 0.000331D-6, 6073.708907816D0, 4.007881169D0, + : 0.000292D-6, 742.990060533D0, 2.714333592D0, + : 0.000362D-6, 29088.811415985D0, 3.215977013D0, + : 0.000280D-6, 12359.966151546D0, 0.710872502D0, + : 0.000267D-6, 10440.274292604D0, 4.730108488D0, + : 0.000262D-6, 838.969287750D0, 1.327720272D0, + : 0.000250D-6, 16496.361396202D0, 0.898769761D0, + : 0.000325D-6, 20597.243963041D0, 0.180044365D0 / + DATA ((FAIRHD(I,J),I=1,3),J=331,340) / + : 0.000268D-6, 6148.010769956D0, 5.152666276D0, + : 0.000284D-6, 5636.065016677D0, 5.655385808D0, + : 0.000301D-6, 6080.822454817D0, 2.135396205D0, + : 0.000294D-6, -377.373607916D0, 3.708784168D0, + : 0.000236D-6, 2118.763860378D0, 1.733578756D0, + : 0.000234D-6, 5867.523359379D0, 5.575209112D0, + : 0.000268D-6, -226858.238553767D0, 0.069432392D0, + : 0.000265D-6, 167283.761587465D0, 4.369302826D0, + : 0.000280D-6, 28237.233459389D0, 5.304829118D0, + : 0.000292D-6, 12345.739057544D0, 4.096094132D0 / + DATA ((FAIRHD(I,J),I=1,3),J=341,350) / + : 0.000223D-6, 19800.945956225D0, 3.069327406D0, + : 0.000301D-6, 43232.306658416D0, 6.205311188D0, + : 0.000264D-6, 18875.525869774D0, 1.417263408D0, + : 0.000304D-6, -1823.175188677D0, 3.409035232D0, + : 0.000301D-6, 109.945688789D0, 0.510922054D0, + : 0.000260D-6, 813.550283960D0, 2.389438934D0, + : 0.000299D-6, 316428.228673312D0, 5.384595078D0, + : 0.000211D-6, 5756.566278634D0, 3.789392838D0, + : 0.000209D-6, 5750.203491159D0, 1.661943545D0, + : 0.000240D-6, 12489.885628707D0, 5.684549045D0 / + DATA ((FAIRHD(I,J),I=1,3),J=351,360) / + : 0.000216D-6, 6303.851245484D0, 3.862942261D0, + : 0.000203D-6, 1581.959348283D0, 5.549853589D0, + : 0.000200D-6, 5642.198242609D0, 1.016115785D0, + : 0.000197D-6, -70.849445304D0, 4.690702525D0, + : 0.000227D-6, 6287.008003254D0, 2.911891613D0, + : 0.000197D-6, 533.623118358D0, 1.048982898D0, + : 0.000205D-6, -6279.485421340D0, 1.829362730D0, + : 0.000209D-6, -10988.808157535D0, 2.636140084D0, + : 0.000208D-6, -227.526189440D0, 4.127883842D0, + : 0.000191D-6, 415.552490612D0, 4.401165650D0 / + DATA ((FAIRHD(I,J),I=1,3),J=361,370) / + : 0.000190D-6, 29296.615389579D0, 4.175658539D0, + : 0.000264D-6, 66567.485864652D0, 4.601102551D0, + : 0.000256D-6, -3646.350377354D0, 0.506364778D0, + : 0.000188D-6, 13119.721102825D0, 2.032195842D0, + : 0.000185D-6, -209.366942175D0, 4.694756586D0, + : 0.000198D-6, 25934.124331089D0, 3.832703118D0, + : 0.000195D-6, 4061.219215394D0, 3.308463427D0, + : 0.000234D-6, 5113.487598583D0, 1.716090661D0, + : 0.000188D-6, 1478.866574064D0, 5.686865780D0, + : 0.000222D-6, 11823.161639450D0, 1.942386641D0 / + DATA ((FAIRHD(I,J),I=1,3),J=371,380) / + : 0.000181D-6, 10770.893256262D0, 1.999482059D0, + : 0.000171D-6, 6546.159773364D0, 1.182807992D0, + : 0.000206D-6, 70.328180442D0, 5.934076062D0, + : 0.000169D-6, 20995.392966449D0, 2.169080622D0, + : 0.000191D-6, 10660.686935042D0, 5.405515999D0, + : 0.000228D-6, 33019.021112205D0, 4.656985514D0, + : 0.000184D-6, -4933.208440333D0, 3.327476868D0, + : 0.000220D-6, -135.625325010D0, 1.765430262D0, + : 0.000166D-6, 23141.558382925D0, 3.454132746D0, + : 0.000191D-6, 6144.558353121D0, 5.020393445D0 / + DATA ((FAIRHD(I,J),I=1,3),J=381,390) / + : 0.000180D-6, 6084.003848555D0, 0.602182191D0, + : 0.000163D-6, 17782.732072784D0, 4.960593133D0, + : 0.000225D-6, 16460.333529525D0, 2.596451817D0, + : 0.000222D-6, 5905.702242076D0, 3.731990323D0, + : 0.000204D-6, 227.476132789D0, 5.636192701D0, + : 0.000159D-6, 16737.577236597D0, 3.600691544D0, + : 0.000200D-6, 6805.653268085D0, 0.868220961D0, + : 0.000187D-6, 11919.140866668D0, 2.629456641D0, + : 0.000161D-6, 127.471796607D0, 2.862574720D0, + : 0.000205D-6, 6286.666278643D0, 1.742882331D0 / + DATA ((FAIRHD(I,J),I=1,3),J=391,400) / + : 0.000189D-6, 153.778810485D0, 4.812372643D0, + : 0.000168D-6, 16723.350142595D0, 0.027860588D0, + : 0.000149D-6, 11720.068865232D0, 0.659721876D0, + : 0.000189D-6, 5237.921013804D0, 5.245313000D0, + : 0.000143D-6, 6709.674040867D0, 4.317625647D0, + : 0.000146D-6, 4487.817406270D0, 4.815297007D0, + : 0.000144D-6, -664.756045130D0, 5.381366880D0, + : 0.000175D-6, 5127.714692584D0, 4.728443327D0, + : 0.000162D-6, 6254.626662524D0, 1.435132069D0, + : 0.000187D-6, 47162.516354635D0, 1.354371923D0 / + DATA ((FAIRHD(I,J),I=1,3),J=401,410) / + : 0.000146D-6, 11080.171578918D0, 3.369695406D0, + : 0.000180D-6, -348.924420448D0, 2.490902145D0, + : 0.000148D-6, 151.047669843D0, 3.799109588D0, + : 0.000157D-6, 6197.248551160D0, 1.284375887D0, + : 0.000167D-6, 146.594251718D0, 0.759969109D0, + : 0.000133D-6, -5331.357443741D0, 5.409701889D0, + : 0.000154D-6, 95.979227218D0, 3.366890614D0, + : 0.000148D-6, -6418.140930027D0, 3.384104996D0, + : 0.000128D-6, -6525.804453965D0, 3.803419985D0, + : 0.000130D-6, 11293.470674356D0, 0.939039445D0 / + DATA ((FAIRHD(I,J),I=1,3),J=411,420) / + : 0.000152D-6, -5729.506447149D0, 0.734117523D0, + : 0.000138D-6, 210.117701700D0, 2.564216078D0, + : 0.000123D-6, 6066.595360816D0, 4.517099537D0, + : 0.000140D-6, 18451.078546566D0, 0.642049130D0, + : 0.000126D-6, 11300.584221356D0, 3.485280663D0, + : 0.000119D-6, 10027.903195729D0, 3.217431161D0, + : 0.000151D-6, 4274.518310832D0, 4.404359108D0, + : 0.000117D-6, 6072.958148291D0, 0.366324650D0, + : 0.000165D-6, -7668.637425143D0, 4.298212528D0, + : 0.000117D-6, -6245.048177356D0, 5.379518958D0 / + DATA ((FAIRHD(I,J),I=1,3),J=421,430) / + : 0.000130D-6, -5888.449964932D0, 4.527681115D0, + : 0.000121D-6, -543.918059096D0, 6.109429504D0, + : 0.000162D-6, 9683.594581116D0, 5.720092446D0, + : 0.000141D-6, 6219.339951688D0, 0.679068671D0, + : 0.000118D-6, 22743.409379516D0, 4.881123092D0, + : 0.000129D-6, 1692.165669502D0, 0.351407289D0, + : 0.000126D-6, 5657.405657679D0, 5.146592349D0, + : 0.000114D-6, 728.762966531D0, 0.520791814D0, + : 0.000120D-6, 52.596639600D0, 0.948516300D0, + : 0.000115D-6, 65.220371012D0, 3.504914846D0 / + DATA ((FAIRHD(I,J),I=1,3),J=431,440) / + : 0.000126D-6, 5881.403728234D0, 5.577502482D0, + : 0.000158D-6, 163096.180360983D0, 2.957128968D0, + : 0.000134D-6, 12341.806904281D0, 2.598576764D0, + : 0.000151D-6, 16627.370915377D0, 3.985702050D0, + : 0.000109D-6, 1368.660252845D0, 0.014730471D0, + : 0.000131D-6, 6211.263196841D0, 0.085077024D0, + : 0.000146D-6, 5792.741760812D0, 0.708426604D0, + : 0.000146D-6, -77.750543984D0, 3.121576600D0, + : 0.000107D-6, 5341.013788022D0, 0.288231904D0, + : 0.000138D-6, 6281.591377283D0, 2.797450317D0 / + DATA ((FAIRHD(I,J),I=1,3),J=441,450) / + : 0.000113D-6, -6277.552925684D0, 2.788904128D0, + : 0.000115D-6, -525.758811831D0, 5.895222200D0, + : 0.000138D-6, 6016.468808270D0, 6.096188999D0, + : 0.000139D-6, 23539.707386333D0, 2.028195445D0, + : 0.000146D-6, -4176.041342449D0, 4.660008502D0, + : 0.000107D-6, 16062.184526117D0, 4.066520001D0, + : 0.000142D-6, 83783.548222473D0, 2.936315115D0, + : 0.000128D-6, 9380.959672717D0, 3.223844306D0, + : 0.000135D-6, 6205.325306007D0, 1.638054048D0, + : 0.000101D-6, 2699.734819318D0, 5.481603249D0 / + DATA ((FAIRHD(I,J),I=1,3),J=451,460) / + : 0.000104D-6, -568.821874027D0, 2.205734493D0, + : 0.000103D-6, 6321.103522627D0, 2.440421099D0, + : 0.000119D-6, 6321.208885629D0, 2.547496264D0, + : 0.000138D-6, 1975.492545856D0, 2.314608466D0, + : 0.000121D-6, 137.033024162D0, 4.539108237D0, + : 0.000123D-6, 19402.796952817D0, 4.538074405D0, + : 0.000119D-6, 22805.735565994D0, 2.869040566D0, + : 0.000133D-6, 64471.991241142D0, 6.056405489D0, + : 0.000129D-6, -85.827298831D0, 2.540635083D0, + : 0.000131D-6, 13613.804277336D0, 4.005732868D0 / + DATA ((FAIRHD(I,J),I=1,3),J=461,470) / + : 0.000104D-6, 9814.604100291D0, 1.959967212D0, + : 0.000112D-6, 16097.679950283D0, 3.589026260D0, + : 0.000123D-6, 2107.034507542D0, 1.728627253D0, + : 0.000121D-6, 36949.230808424D0, 6.072332087D0, + : 0.000108D-6, -12539.853380183D0, 3.716133846D0, + : 0.000113D-6, -7875.671863624D0, 2.725771122D0, + : 0.000109D-6, 4171.425536614D0, 4.033338079D0, + : 0.000101D-6, 6247.911759770D0, 3.441347021D0, + : 0.000113D-6, 7330.728427345D0, 0.656372122D0, + : 0.000113D-6, 51092.726050855D0, 2.791483066D0 / + DATA ((FAIRHD(I,J),I=1,3),J=471,480) / + : 0.000106D-6, 5621.842923210D0, 1.815323326D0, + : 0.000101D-6, 111.430161497D0, 5.711033677D0, + : 0.000103D-6, 909.818733055D0, 2.812745443D0, + : 0.000101D-6, 1790.642637886D0, 1.965746028D0, + +* T + : 102.156724D-6, 6283.075849991D0, 4.249032005D0, + : 1.706807D-6, 12566.151699983D0, 4.205904248D0, + : 0.269668D-6, 213.299095438D0, 3.400290479D0, + : 0.265919D-6, 529.690965095D0, 5.836047367D0, + : 0.210568D-6, -3.523118349D0, 6.262738348D0, + : 0.077996D-6, 5223.693919802D0, 4.670344204D0 / + DATA ((FAIRHD(I,J),I=1,3),J=481,490) / + : 0.054764D-6, 1577.343542448D0, 4.534800170D0, + : 0.059146D-6, 26.298319800D0, 1.083044735D0, + : 0.034420D-6, -398.149003408D0, 5.980077351D0, + : 0.032088D-6, 18849.227549974D0, 4.162913471D0, + : 0.033595D-6, 5507.553238667D0, 5.980162321D0, + : 0.029198D-6, 5856.477659115D0, 0.623811863D0, + : 0.027764D-6, 155.420399434D0, 3.745318113D0, + : 0.025190D-6, 5746.271337896D0, 2.980330535D0, + : 0.022997D-6, -796.298006816D0, 1.174411803D0, + : 0.024976D-6, 5760.498431898D0, 2.467913690D0 / + DATA ((FAIRHD(I,J),I=1,3),J=491,500) / + : 0.021774D-6, 206.185548437D0, 3.854787540D0, + : 0.017925D-6, -775.522611324D0, 1.092065955D0, + : 0.013794D-6, 426.598190876D0, 2.699831988D0, + : 0.013276D-6, 6062.663207553D0, 5.845801920D0, + : 0.011774D-6, 12036.460734888D0, 2.292832062D0, + : 0.012869D-6, 6076.890301554D0, 5.333425680D0, + : 0.012152D-6, 1059.381930189D0, 6.222874454D0, + : 0.011081D-6, -7.113547001D0, 5.154724984D0, + : 0.010143D-6, 4694.002954708D0, 4.044013795D0, + : 0.009357D-6, 5486.777843175D0, 3.416081409D0 / + DATA ((FAIRHD(I,J),I=1,3),J=501,510) / + : 0.010084D-6, 522.577418094D0, 0.749320262D0, + : 0.008587D-6, 10977.078804699D0, 2.777152598D0, + : 0.008628D-6, 6275.962302991D0, 4.562060226D0, + : 0.008158D-6, -220.412642439D0, 5.806891533D0, + : 0.007746D-6, 2544.314419883D0, 1.603197066D0, + : 0.007670D-6, 2146.165416475D0, 3.000200440D0, + : 0.007098D-6, 74.781598567D0, 0.443725817D0, + : 0.006180D-6, -536.804512095D0, 1.302642751D0, + : 0.005818D-6, 5088.628839767D0, 4.827723531D0, + : 0.004945D-6, -6286.598968340D0, 0.268305170D0 / + DATA ((FAIRHD(I,J),I=1,3),J=511,520) / + : 0.004774D-6, 1349.867409659D0, 5.808636673D0, + : 0.004687D-6, -242.728603974D0, 5.154890570D0, + : 0.006089D-6, 1748.016413067D0, 4.403765209D0, + : 0.005975D-6, -1194.447010225D0, 2.583472591D0, + : 0.004229D-6, 951.718406251D0, 0.931172179D0, + : 0.005264D-6, 553.569402842D0, 2.336107252D0, + : 0.003049D-6, 5643.178563677D0, 1.362634430D0, + : 0.002974D-6, 6812.766815086D0, 1.583012668D0, + : 0.003403D-6, -2352.866153772D0, 2.552189886D0, + : 0.003030D-6, 419.484643875D0, 5.286473844D0 / + DATA ((FAIRHD(I,J),I=1,3),J=521,530) / + : 0.003210D-6, -7.046236698D0, 1.863796539D0, + : 0.003058D-6, 9437.762934887D0, 4.226420633D0, + : 0.002589D-6, 12352.852604545D0, 1.991935820D0, + : 0.002927D-6, 5216.580372801D0, 2.319951253D0, + : 0.002425D-6, 5230.807466803D0, 3.084752833D0, + : 0.002656D-6, 3154.687084896D0, 2.487447866D0, + : 0.002445D-6, 10447.387839604D0, 2.347139160D0, + : 0.002990D-6, 4690.479836359D0, 6.235872050D0, + : 0.002890D-6, 5863.591206116D0, 0.095197563D0, + : 0.002498D-6, 6438.496249426D0, 2.994779800D0 / + DATA ((FAIRHD(I,J),I=1,3),J=531,540) / + : 0.001889D-6, 8031.092263058D0, 3.569003717D0, + : 0.002567D-6, 801.820931124D0, 3.425611498D0, + : 0.001803D-6, -71430.695617928D0, 2.192295512D0, + : 0.001782D-6, 3.932153263D0, 5.180433689D0, + : 0.001694D-6, -4705.732307544D0, 4.641779174D0, + : 0.001704D-6, -1592.596013633D0, 3.997097652D0, + : 0.001735D-6, 5849.364112115D0, 0.417558428D0, + : 0.001643D-6, 8429.241266467D0, 2.180619584D0, + : 0.001680D-6, 38.133035638D0, 4.164529426D0, + : 0.002045D-6, 7084.896781115D0, 0.526323854D0 / + DATA ((FAIRHD(I,J),I=1,3),J=541,550) / + : 0.001458D-6, 4292.330832950D0, 1.356098141D0, + : 0.001437D-6, 20.355319399D0, 3.895439360D0, + : 0.001738D-6, 6279.552731642D0, 0.087484036D0, + : 0.001367D-6, 14143.495242431D0, 3.987576591D0, + : 0.001344D-6, 7234.794256242D0, 0.090454338D0, + : 0.001438D-6, 11499.656222793D0, 0.974387904D0, + : 0.001257D-6, 6836.645252834D0, 1.509069366D0, + : 0.001358D-6, 11513.883316794D0, 0.495572260D0, + : 0.001628D-6, 7632.943259650D0, 4.968445721D0, + : 0.001169D-6, 103.092774219D0, 2.838496795D0 / + DATA ((FAIRHD(I,J),I=1,3),J=551,560) / + : 0.001162D-6, 4164.311989613D0, 3.408387778D0, + : 0.001092D-6, 6069.776754553D0, 3.617942651D0, + : 0.001008D-6, 17789.845619785D0, 0.286350174D0, + : 0.001008D-6, 639.897286314D0, 1.610762073D0, + : 0.000918D-6, 10213.285546211D0, 5.532798067D0, + : 0.001011D-6, -6256.777530192D0, 0.661826484D0, + : 0.000753D-6, 16730.463689596D0, 3.905030235D0, + : 0.000737D-6, 11926.254413669D0, 4.641956361D0, + : 0.000694D-6, 3340.612426700D0, 2.111120332D0, + : 0.000701D-6, 3894.181829542D0, 2.760823491D0 / + DATA ((FAIRHD(I,J),I=1,3),J=561,570) / + : 0.000689D-6, -135.065080035D0, 4.768800780D0, + : 0.000700D-6, 13367.972631107D0, 5.760439898D0, + : 0.000664D-6, 6040.347246017D0, 1.051215840D0, + : 0.000654D-6, 5650.292110678D0, 4.911332503D0, + : 0.000788D-6, 6681.224853400D0, 4.699648011D0, + : 0.000628D-6, 5333.900241022D0, 5.024608847D0, + : 0.000755D-6, -110.206321219D0, 4.370971253D0, + : 0.000628D-6, 6290.189396992D0, 3.660478857D0, + : 0.000635D-6, 25132.303399966D0, 4.121051532D0, + : 0.000534D-6, 5966.683980335D0, 1.173284524D0 / + DATA ((FAIRHD(I,J),I=1,3),J=571,580) / + : 0.000543D-6, -433.711737877D0, 0.345585464D0, + : 0.000517D-6, -1990.745017041D0, 5.414571768D0, + : 0.000504D-6, 5767.611978898D0, 2.328281115D0, + : 0.000485D-6, 5753.384884897D0, 1.685874771D0, + : 0.000463D-6, 7860.419392439D0, 5.297703006D0, + : 0.000604D-6, 515.463871093D0, 0.591998446D0, + : 0.000443D-6, 12168.002696575D0, 4.830881244D0, + : 0.000570D-6, 199.072001436D0, 3.899190272D0, + : 0.000465D-6, 10969.965257698D0, 0.476681802D0, + : 0.000424D-6, -7079.373856808D0, 1.112242763D0 / + DATA ((FAIRHD(I,J),I=1,3),J=581,590) / + : 0.000427D-6, 735.876513532D0, 1.994214480D0, + : 0.000478D-6, -6127.655450557D0, 3.778025483D0, + : 0.000414D-6, 10973.555686350D0, 5.441088327D0, + : 0.000512D-6, 1589.072895284D0, 0.107123853D0, + : 0.000378D-6, 10984.192351700D0, 0.915087231D0, + : 0.000402D-6, 11371.704689758D0, 4.107281715D0, + : 0.000453D-6, 9917.696874510D0, 1.917490952D0, + : 0.000395D-6, 149.563197135D0, 2.763124165D0, + : 0.000371D-6, 5739.157790895D0, 3.112111866D0, + : 0.000350D-6, 11790.629088659D0, 0.440639857D0 / + DATA ((FAIRHD(I,J),I=1,3),J=591,600) / + : 0.000356D-6, 6133.512652857D0, 5.444568842D0, + : 0.000344D-6, 412.371096874D0, 5.676832684D0, + : 0.000383D-6, 955.599741609D0, 5.559734846D0, + : 0.000333D-6, 6496.374945429D0, 0.261537984D0, + : 0.000340D-6, 6055.549660552D0, 5.975534987D0, + : 0.000334D-6, 1066.495477190D0, 2.335063907D0, + : 0.000399D-6, 11506.769769794D0, 5.321230910D0, + : 0.000314D-6, 18319.536584880D0, 2.313312404D0, + : 0.000424D-6, 1052.268383188D0, 1.211961766D0, + : 0.000307D-6, 63.735898303D0, 3.169551388D0 / + DATA ((FAIRHD(I,J),I=1,3),J=601,610) / + : 0.000329D-6, 29.821438149D0, 6.106912080D0, + : 0.000357D-6, 6309.374169791D0, 4.223760346D0, + : 0.000312D-6, -3738.761430108D0, 2.180556645D0, + : 0.000301D-6, 309.278322656D0, 1.499984572D0, + : 0.000268D-6, 12043.574281889D0, 2.447520648D0, + : 0.000257D-6, 12491.370101415D0, 3.662331761D0, + : 0.000290D-6, 625.670192312D0, 1.272834584D0, + : 0.000256D-6, 5429.879468239D0, 1.913426912D0, + : 0.000339D-6, 3496.032826134D0, 4.165930011D0, + : 0.000283D-6, 3930.209696220D0, 4.325565754D0 / + DATA ((FAIRHD(I,J),I=1,3),J=611,620) / + : 0.000241D-6, 12528.018664345D0, 3.832324536D0, + : 0.000304D-6, 4686.889407707D0, 1.612348468D0, + : 0.000259D-6, 16200.772724501D0, 3.470173146D0, + : 0.000238D-6, 12139.553509107D0, 1.147977842D0, + : 0.000236D-6, 6172.869528772D0, 3.776271728D0, + : 0.000296D-6, -7058.598461315D0, 0.460368852D0, + : 0.000306D-6, 10575.406682942D0, 0.554749016D0, + : 0.000251D-6, 17298.182327326D0, 0.834332510D0, + : 0.000290D-6, 4732.030627343D0, 4.759564091D0, + : 0.000261D-6, 5884.926846583D0, 0.298259862D0 / + DATA ((FAIRHD(I,J),I=1,3),J=621,630) / + : 0.000249D-6, 5547.199336460D0, 3.749366406D0, + : 0.000213D-6, 11712.955318231D0, 5.415666119D0, + : 0.000223D-6, 4701.116501708D0, 2.703203558D0, + : 0.000268D-6, -640.877607382D0, 0.283670793D0, + : 0.000209D-6, 5636.065016677D0, 1.238477199D0, + : 0.000193D-6, 10177.257679534D0, 1.943251340D0, + : 0.000182D-6, 6283.143160294D0, 2.456157599D0, + : 0.000184D-6, -227.526189440D0, 5.888038582D0, + : 0.000182D-6, -6283.008539689D0, 0.241332086D0, + : 0.000228D-6, -6284.056171060D0, 2.657323816D0 / + DATA ((FAIRHD(I,J),I=1,3),J=631,640) / + : 0.000166D-6, 7238.675591600D0, 5.930629110D0, + : 0.000167D-6, 3097.883822726D0, 5.570955333D0, + : 0.000159D-6, -323.505416657D0, 5.786670700D0, + : 0.000154D-6, -4136.910433516D0, 1.517805532D0, + : 0.000176D-6, 12029.347187887D0, 3.139266834D0, + : 0.000167D-6, 12132.439962106D0, 3.556352289D0, + : 0.000153D-6, 202.253395174D0, 1.463313961D0, + : 0.000157D-6, 17267.268201691D0, 1.586837396D0, + : 0.000142D-6, 83996.847317911D0, 0.022670115D0, + : 0.000152D-6, 17260.154654690D0, 0.708528947D0 / + DATA ((FAIRHD(I,J),I=1,3),J=641,650) / + : 0.000144D-6, 6084.003848555D0, 5.187075177D0, + : 0.000135D-6, 5756.566278634D0, 1.993229262D0, + : 0.000134D-6, 5750.203491159D0, 3.457197134D0, + : 0.000144D-6, 5326.786694021D0, 6.066193291D0, + : 0.000160D-6, 11015.106477335D0, 1.710431974D0, + : 0.000133D-6, 3634.621024518D0, 2.836451652D0, + : 0.000134D-6, 18073.704938650D0, 5.453106665D0, + : 0.000134D-6, 1162.474704408D0, 5.326898811D0, + : 0.000128D-6, 5642.198242609D0, 2.511652591D0, + : 0.000160D-6, 632.783739313D0, 5.628785365D0 / + DATA ((FAIRHD(I,J),I=1,3),J=651,660) / + : 0.000132D-6, 13916.019109642D0, 0.819294053D0, + : 0.000122D-6, 14314.168113050D0, 5.677408071D0, + : 0.000125D-6, 12359.966151546D0, 5.251984735D0, + : 0.000121D-6, 5749.452731634D0, 2.210924603D0, + : 0.000136D-6, -245.831646229D0, 1.646502367D0, + : 0.000120D-6, 5757.317038160D0, 3.240883049D0, + : 0.000134D-6, 12146.667056108D0, 3.059480037D0, + : 0.000137D-6, 6206.809778716D0, 1.867105418D0, + : 0.000141D-6, 17253.041107690D0, 2.069217456D0, + : 0.000129D-6, -7477.522860216D0, 2.781469314D0 / + DATA ((FAIRHD(I,J),I=1,3),J=661,670) / + : 0.000116D-6, 5540.085789459D0, 4.281176991D0, + : 0.000116D-6, 9779.108676125D0, 3.320925381D0, + : 0.000129D-6, 5237.921013804D0, 3.497704076D0, + : 0.000113D-6, 5959.570433334D0, 0.983210840D0, + : 0.000122D-6, 6282.095528923D0, 2.674938860D0, + : 0.000140D-6, -11.045700264D0, 4.957936982D0, + : 0.000108D-6, 23543.230504682D0, 1.390113589D0, + : 0.000106D-6, -12569.674818332D0, 0.429631317D0, + : 0.000110D-6, -266.607041722D0, 5.501340197D0, + : 0.000115D-6, 12559.038152982D0, 4.691456618D0 / + DATA ((FAIRHD(I,J),I=1,3),J=671,680) / + : 0.000134D-6, -2388.894020449D0, 0.577313584D0, + : 0.000109D-6, 10440.274292604D0, 6.218148717D0, + : 0.000102D-6, -543.918059096D0, 1.477842615D0, + : 0.000108D-6, 21228.392023546D0, 2.237753948D0, + : 0.000101D-6, -4535.059436924D0, 3.100492232D0, + : 0.000103D-6, 76.266071276D0, 5.594294322D0, + : 0.000104D-6, 949.175608970D0, 5.674287810D0, + : 0.000101D-6, 13517.870106233D0, 2.196632348D0, + : 0.000100D-6, 11933.367960670D0, 4.056084160D0, + : 4.322990D-6, 6283.075849991D0, 2.642893748D0 / + DATA ((FAIRHD(I,J),I=1,3),J=681,690) / + : 0.406495D-6, 0.000000000D0, 4.712388980D0, + : 0.122605D-6, 12566.151699983D0, 2.438140634D0, + : 0.019476D-6, 213.299095438D0, 1.642186981D0, + : 0.016916D-6, 529.690965095D0, 4.510959344D0, + : 0.013374D-6, -3.523118349D0, 1.502210314D0, + : 0.008042D-6, 26.298319800D0, 0.478549024D0, + : 0.007824D-6, 155.420399434D0, 5.254710405D0, + : 0.004894D-6, 5746.271337896D0, 4.683210850D0, + : 0.004875D-6, 5760.498431898D0, 0.759507698D0, + : 0.004416D-6, 5223.693919802D0, 6.028853166D0 / + DATA ((FAIRHD(I,J),I=1,3),J=691,700) / + : 0.004088D-6, -7.113547001D0, 0.060926389D0, + : 0.004433D-6, 77713.771467920D0, 3.627734103D0, + : 0.003277D-6, 18849.227549974D0, 2.327912542D0, + : 0.002703D-6, 6062.663207553D0, 1.271941729D0, + : 0.003435D-6, -775.522611324D0, 0.747446224D0, + : 0.002618D-6, 6076.890301554D0, 3.633715689D0, + : 0.003146D-6, 206.185548437D0, 5.647874613D0, + : 0.002544D-6, 1577.343542448D0, 6.232904270D0, + : 0.002218D-6, -220.412642439D0, 1.309509946D0, + : 0.002197D-6, 5856.477659115D0, 2.407212349D0 / + DATA ((FAIRHD(I,J),I=1,3),J=701,710) / + : 0.002897D-6, 5753.384884897D0, 5.863842246D0, + : 0.001766D-6, 426.598190876D0, 0.754113147D0, + : 0.001738D-6, -796.298006816D0, 2.714942671D0, + : 0.001695D-6, 522.577418094D0, 2.629369842D0, + : 0.001584D-6, 5507.553238667D0, 1.341138229D0, + : 0.001503D-6, -242.728603974D0, 0.377699736D0, + : 0.001552D-6, -536.804512095D0, 2.904684667D0, + : 0.001370D-6, -398.149003408D0, 1.265599125D0, + : 0.001889D-6, -5573.142801634D0, 4.413514859D0, + : 0.001722D-6, 6069.776754553D0, 2.445966339D0 / + DATA ((FAIRHD(I,J),I=1,3),J=711,720) / + : 0.001124D-6, 1059.381930189D0, 5.041799657D0, + : 0.001258D-6, 553.569402842D0, 3.849557278D0, + : 0.000831D-6, 951.718406251D0, 2.471094709D0, + : 0.000767D-6, 4694.002954708D0, 5.363125422D0, + : 0.000756D-6, 1349.867409659D0, 1.046195744D0, + : 0.000775D-6, -11.045700264D0, 0.245548001D0, + : 0.000597D-6, 2146.165416475D0, 4.543268798D0, + : 0.000568D-6, 5216.580372801D0, 4.178853144D0, + : 0.000711D-6, 1748.016413067D0, 5.934271972D0, + : 0.000499D-6, 12036.460734888D0, 0.624434410D0 / + DATA ((FAIRHD(I,J),I=1,3),J=721,730) / + : 0.000671D-6, -1194.447010225D0, 4.136047594D0, + : 0.000488D-6, 5849.364112115D0, 2.209679987D0, + : 0.000621D-6, 6438.496249426D0, 4.518860804D0, + : 0.000495D-6, -6286.598968340D0, 1.868201275D0, + : 0.000456D-6, 5230.807466803D0, 1.271231591D0, + : 0.000451D-6, 5088.628839767D0, 0.084060889D0, + : 0.000435D-6, 5643.178563677D0, 3.324456609D0, + : 0.000387D-6, 10977.078804699D0, 4.052488477D0, + : 0.000547D-6, 161000.685737473D0, 2.841633844D0, + : 0.000522D-6, 3154.687084896D0, 2.171979966D0 / + DATA ((FAIRHD(I,J),I=1,3),J=731,740) / + : 0.000375D-6, 5486.777843175D0, 4.983027306D0, + : 0.000421D-6, 5863.591206116D0, 4.546432249D0, + : 0.000439D-6, 7084.896781115D0, 0.522967921D0, + : 0.000309D-6, 2544.314419883D0, 3.172606705D0, + : 0.000347D-6, 4690.479836359D0, 1.479586566D0, + : 0.000317D-6, 801.820931124D0, 3.553088096D0, + : 0.000262D-6, 419.484643875D0, 0.606635550D0, + : 0.000248D-6, 6836.645252834D0, 3.014082064D0, + : 0.000245D-6, -1592.596013633D0, 5.519526220D0, + : 0.000225D-6, 4292.330832950D0, 2.877956536D0 / + DATA ((FAIRHD(I,J),I=1,3),J=741,750) / + : 0.000214D-6, 7234.794256242D0, 1.605227587D0, + : 0.000205D-6, 5767.611978898D0, 0.625804796D0, + : 0.000180D-6, 10447.387839604D0, 3.499954526D0, + : 0.000229D-6, 199.072001436D0, 5.632304604D0, + : 0.000214D-6, 639.897286314D0, 5.960227667D0, + : 0.000175D-6, -433.711737877D0, 2.162417992D0, + : 0.000209D-6, 515.463871093D0, 2.322150893D0, + : 0.000173D-6, 6040.347246017D0, 2.556183691D0, + : 0.000184D-6, 6309.374169791D0, 4.732296790D0, + : 0.000227D-6, 149854.400134205D0, 5.385812217D0 / + DATA ((FAIRHD(I,J),I=1,3),J=751,760) / + : 0.000154D-6, 8031.092263058D0, 5.120720920D0, + : 0.000151D-6, 5739.157790895D0, 4.815000443D0, + : 0.000197D-6, 7632.943259650D0, 0.222827271D0, + : 0.000197D-6, 74.781598567D0, 3.910456770D0, + : 0.000138D-6, 6055.549660552D0, 1.397484253D0, + : 0.000149D-6, -6127.655450557D0, 5.333727496D0, + : 0.000137D-6, 3894.181829542D0, 4.281749907D0, + : 0.000135D-6, 9437.762934887D0, 5.979971885D0, + : 0.000139D-6, -2352.866153772D0, 4.715630782D0, + : 0.000142D-6, 6812.766815086D0, 0.513330157D0 / + DATA ((FAIRHD(I,J),I=1,3),J=761,770) / + : 0.000120D-6, -4705.732307544D0, 0.194160689D0, + : 0.000131D-6, -71430.695617928D0, 0.000379226D0, + : 0.000124D-6, 6279.552731642D0, 2.122264908D0, + : 0.000108D-6, -6256.777530192D0, 0.883445696D0, + : 0.143388D-6, 6283.075849991D0, 1.131453581D0, + : 0.006671D-6, 12566.151699983D0, 0.775148887D0, + : 0.001480D-6, 155.420399434D0, 0.480016880D0, + : 0.000934D-6, 213.299095438D0, 6.144453084D0, + : 0.000795D-6, 529.690965095D0, 2.941595619D0, + : 0.000673D-6, 5746.271337896D0, 0.120415406D0 / + DATA ((FAIRHD(I,J),I=1,3),J=771,780) / + : 0.000672D-6, 5760.498431898D0, 5.317009738D0, + : 0.000389D-6, -220.412642439D0, 3.090323467D0, + : 0.000373D-6, 6062.663207553D0, 3.003551964D0, + : 0.000360D-6, 6076.890301554D0, 1.918913041D0, + : 0.000316D-6, -21.340641002D0, 5.545798121D0, + : 0.000315D-6, -242.728603974D0, 1.884932563D0, + : 0.000278D-6, 206.185548437D0, 1.266254859D0, + : 0.000238D-6, -536.804512095D0, 4.532664830D0, + : 0.000185D-6, 522.577418094D0, 4.578313856D0, + : 0.000245D-6, 18849.227549974D0, 0.587467082D0 / + DATA ((FAIRHD(I,J),I=1,3),J=781,787) / + : 0.000180D-6, 426.598190876D0, 5.151178553D0, + : 0.000200D-6, 553.569402842D0, 5.355983739D0, + : 0.000141D-6, 5223.693919802D0, 1.336556009D0, + : 0.000104D-6, 5856.477659115D0, 4.239842759D0, + : 0.003826D-6, 6283.075849991D0, 5.705257275D0, + : 0.000303D-6, 12566.151699983D0, 5.407132842D0, + : 0.000209D-6, 155.420399434D0, 1.989815753D0 / +* ----------------------------------------------------------------------- + + + +* Time since J2000.0 in Julian millennia. + T=(TDB-51544.5D0)/365250D0 + +* -------------------- Topocentric terms ------------------------------- + +* Convert UT1 to local solar time in radians. + TSOL = MOD(UT1,1D0)*D2PI - WL + +* FUNDAMENTAL ARGUMENTS: Simon et al 1994 + +* Combine time argument (millennia) with deg/arcsec factor. + W = T / 3600D0 + +* Sun Mean Longitude. + ELSUN = MOD(280.46645683D0+1296027711.03429D0*W,360D0)*D2R + +* Sun Mean Anomaly. + EMSUN = MOD(357.52910918D0+1295965810.481D0*W,360D0)*D2R + +* Mean Elongation of Moon from Sun. + D = MOD(297.85019547D0+16029616012.090D0*W,360D0)*D2R + +* Mean Longitude of Jupiter. + ELJ = MOD(34.35151874D0+109306899.89453D0*W,360D0)*D2R + +* Mean Longitude of Saturn. + ELS = MOD(50.07744430D0+44046398.47038D0*W,360D0)*D2R + +* TOPOCENTRIC TERMS: Moyer 1981 and Murray 1983. + WT = +0.00029D-10*U*SIN(TSOL+ELSUN-ELS) + : +0.00100D-10*U*SIN(TSOL-2D0*EMSUN) + : +0.00133D-10*U*SIN(TSOL-D) + : +0.00133D-10*U*SIN(TSOL+ELSUN-ELJ) + : -0.00229D-10*U*SIN(TSOL+2D0*ELSUN+EMSUN) + : -0.0220 D-10*V*COS(ELSUN+EMSUN) + : +0.05312D-10*U*SIN(TSOL-EMSUN) + : -0.13677D-10*U*SIN(TSOL+2D0*ELSUN) + : -1.3184 D-10*V*COS(ELSUN) + : +3.17679D-10*U*SIN(TSOL) + +* --------------- Fairhead model --------------------------------------- + +* T**0 + W0=0D0 + DO I=474,1,-1 + W0=W0+FAIRHD(1,I)*SIN(FAIRHD(2,I)*T+FAIRHD(3,I)) + END DO + +* T**1 + W1=0D0 + DO I=679,475,-1 + W1=W1+FAIRHD(1,I)*SIN(FAIRHD(2,I)*T+FAIRHD(3,I)) + END DO + +* T**2 + W2=0D0 + DO I=764,680,-1 + W2=W2+FAIRHD(1,I)*SIN(FAIRHD(2,I)*T+FAIRHD(3,I)) + END DO + +* T**3 + W3=0D0 + DO I=784,765,-1 + W3=W3+FAIRHD(1,I)*SIN(FAIRHD(2,I)*T+FAIRHD(3,I)) + END DO + +* T**4 + W4=0D0 + DO I=787,785,-1 + W4=W4+FAIRHD(1,I)*SIN(FAIRHD(2,I)*T+FAIRHD(3,I)) + END DO + +* Multiply by powers of T and combine. + WF=T*(T*(T*(T*W4+W3)+W2)+W1)+W0 + +* Adjustments to use JPL planetary masses instead of IAU. + WJ= 0.00065D-6 * SIN( 6069.776754D0 *T + 4.021194D0 ) + + : 0.00033D-6 * SIN( 213.299095D0 *T + 5.543132D0 ) + + : (-0.00196D-6 * SIN( 6208.294251D0 *T + 5.696701D0 ))+ + : (-0.00173D-6 * SIN( 74.781599D0 *T + 2.435900D0 ))+ + : 0.03638D-6*T*T + +* ----------------------------------------------------------------------- + +* Final result: TDB-TT in seconds. + slRCC=WT+WF+WJ + + END diff --git a/math/slalib/rdplan.f b/math/slalib/rdplan.f new file mode 100644 index 00000000..95ba3ef8 --- /dev/null +++ b/math/slalib/rdplan.f @@ -0,0 +1,201 @@ + SUBROUTINE slRDPL (DATE, NP, ELONG, PHI, RA, DEC, DIAM) +*+ +* - - - - - - - +* R D P L +* - - - - - - - +* +* Approximate topocentric apparent RA,Dec of a planet, and its +* angular diameter. +* +* Given: +* DATE d MJD of observation (JD - 2400000.5) +* NP i planet: 1 = Mercury +* 2 = Venus +* 3 = Moon +* 4 = Mars +* 5 = Jupiter +* 6 = Saturn +* 7 = Uranus +* 8 = Neptune +* 9 = Pluto +* else = Sun +* ELONG,PHI d observer's east longitude and geodetic +* latitude (radians) +* +* Returned: +* RA,DEC d RA, Dec (topocentric apparent, radians) +* DIAM d angular diameter (equatorial, radians) +* +* Notes: +* +* 1 The date is in a dynamical timescale (TDB, formerly ET) and is +* in the form of a Modified Julian Date (JD-2400000.5). For all +* practical purposes, TT can be used instead of TDB, and for many +* applications UT will do (except for the Moon). +* +* 2 The longitude and latitude allow correction for geocentric +* parallax. This is a major effect for the Moon, but in the +* context of the limited accuracy of the present routine its +* effect on planetary positions is small (negligible for the +* outer planets). Geocentric positions can be generated by +* appropriate use of the routines slDMON and slPLNT. +* +* 3 The direction accuracy (arcsec, 1000-3000AD) is of order: +* +* Sun 5 +* Mercury 2 +* Venus 10 +* Moon 30 +* Mars 50 +* Jupiter 90 +* Saturn 90 +* Uranus 90 +* Neptune 10 +* Pluto 1 (1885-2099AD only) +* +* The angular diameter accuracy is about 0.4% for the Moon, +* and 0.01% or better for the Sun and planets. +* +* See the slPLNT routine for references. +* +* Called: slGMST, slDT, slEPJ, slDMON, slPVOB, slPRNU, +* slPLNT, slDMXV, slDC2S, slDA2P +* +* P.T.Wallace Starlink 26 May 1997 +* +* Copyright (C) 1997 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE + INTEGER NP + DOUBLE PRECISION ELONG,PHI,RA,DEC,DIAM + +* AU in km + DOUBLE PRECISION AUKM + PARAMETER (AUKM=1.49597870D8) + +* Light time for unit distance (sec) + DOUBLE PRECISION TAU + PARAMETER (TAU=499.004782D0) + + INTEGER IP,J,I + DOUBLE PRECISION EQRAU(0:9),STL,VGM(6),V(6),RMAT(3,3), + : VSE(6),VSG(6),VSP(6),VGO(6),DX,DY,DZ,R,TL + DOUBLE PRECISION slGMST,slDT,slEPJ,slDA2P + +* Equatorial radii (km) + DATA EQRAU / 696000D0,2439.7D0,6051.9D0,1738D0,3397D0,71492D0, + : 60268D0,25559D0,24764D0,1151D0 / + + + +* Classify NP + IP=NP + IF (IP.LT.0.OR.IP.GT.9) IP=0 + +* Approximate local ST + STL=slGMST(DATE-slDT(slEPJ(DATE))/86400D0)+ELONG + +* Geocentre to Moon (mean of date) + CALL slDMON(DATE,V) + +* Nutation to true of date + CALL slNUT(DATE,RMAT) + CALL slDMXV(RMAT,V,VGM) + CALL slDMXV(RMAT,V(4),VGM(4)) + +* Moon? + IF (IP.EQ.3) THEN + +* Yes: geocentre to Moon (true of date) + DO I=1,6 + V(I)=VGM(I) + END DO + ELSE + +* No: precession/nutation matrix, J2000 to date + CALL slPRNU(2000D0,DATE,RMAT) + +* Sun to Earth-Moon Barycentre (J2000) + CALL slPLNT(DATE,3,V,J) + +* Precession and nutation to date + CALL slDMXV(RMAT,V,VSE) + CALL slDMXV(RMAT,V(4),VSE(4)) + +* Sun to geocentre (true of date) + DO I=1,6 + VSG(I)=VSE(I)-0.012150581D0*VGM(I) + END DO + +* Sun? + IF (IP.EQ.0) THEN + +* Yes: geocentre to Sun + DO I=1,6 + V(I)=-VSG(I) + END DO + ELSE + +* No: Sun to Planet (J2000) + CALL slPLNT(DATE,IP,V,J) + +* Precession and nutation to date + CALL slDMXV(RMAT,V,VSP) + CALL slDMXV(RMAT,V(4),VSP(4)) + +* Geocentre to planet + DO I=1,6 + V(I)=VSP(I)-VSG(I) + END DO + END IF + END IF + +* Refer to origin at the observer + CALL slPVOB(PHI,0D0,STL,VGO) + DO I=1,6 + V(I)=V(I)-VGO(I) + END DO + +* Geometric distance (AU) + DX=V(1) + DY=V(2) + DZ=V(3) + R=SQRT(DX*DX+DY*DY+DZ*DZ) + +* Light time (sec) + TL=TAU*R + +* Correct position for planetary aberration + DO I=1,3 + V(I)=V(I)-TL*V(I+3) + END DO + +* To RA,Dec + CALL slDC2S(V,RA,DEC) + RA=slDA2P(RA) + +* Angular diameter (radians) + DIAM=2D0*ASIN(EQRAU(IP)/(R*AUKM)) + + END diff --git a/math/slalib/read.me b/math/slalib/read.me new file mode 100644 index 00000000..0b216cb6 --- /dev/null +++ b/math/slalib/read.me @@ -0,0 +1,443 @@ +READ.ME + +Revision date 14 June 2005 SLALIB Version 2.5-2 + +----------------------------------------------------------------------- + +FILES IN THE ORIGINAL SOURCE DIRECTORY (UNIX) + + read.me this file + *.f Fortran source (separate modules) + *.vax Fortran source for VAX/VMS + *.cnvx Fortran source for Convex + *.mips Fortran source for DECstation + *.sun4 Fortran source for Sun SPARCstation + *.lnx Fortran source for Linux + *.pcm Microsoft Fortran source for PC + *.c C functions needed for Linux version + sla.news NEWS item for latest release + make_file Unix make file + mk C-shell script to run make + sun67.tex document + +----------------------------------------------------------------------- + + Copyright (C) 1995-2005 Rutherford Appleton Laboratory + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +----------------------------------------------------------------------- + +PORTING FORTRAN SLALIB TO OTHER SYSTEMS + +FORTRAN SLALIB runs on VAX (VMS), PC (Linux+f2c), PC (Microsoft FORTRAN), +Convex (ConvexOS), DECstation (Ultrix), DEC Alpha (OSF-1) and Sun +SPARCstation (SunOS and Solaris). + +For most platforms, the required changes are confined to these routines: + + sla_GRESID + sla_RANDOM + sla_WAIT + +VAX, CONVEX, DECSTATION/ALPHA, SUN & PC + +Versions suitable for the above platforms are supplied in the +development directory as *.vax, *,cnvx, *.mips, *.sun4, *.pcm and +*.lnx respectively. + + +----------------------------------------------------------------------- + +LATEST RELEASE INFORMATION + +The latest release of SLALIB includes the following changes (most recent +at the end): + +* In sla_RCC, the topocentric term of coefficient 1.3184D-10 sec + had the wrong sign. Minus is correct. + +* The IAU decided in 1991 to rename the Terrestrial Dynamical + Time, TDT, which is now called "Terrestrial Time" or TT. + Appropriate changes have been made in the SLALIB documentation. + The same IAU resolutions introduced the timescales TCG and TCB; + there are at present no SLALIB routines to handle these new + timescales. + +* The Keck 1 Telescope has been added to sla_OBS. + +* The handling of the random-number seed in the PC versions of + sla_RANDOM and sla_GRESID was flawed and has been improved. + +* The UTC leap second at the end of June 1993 has been added to the + routine sla_DAT. Existing applications which call sla_DAT or + sla_DTT require relinking. + +* Some unnecessary code in sla_AMPQK has been removed. + +* Minor reorganization of the sla_REFRO code has led to an improvement + in speed of about 20%, and precautions have been taken against + potential arithmetic errors. + +* There have been small revisions to sla_FK425 and sla_FK524. The + results are not significantly affected, except in the pathological + case of large proper motion combined with immense distance, where + sla_FK524 could produce erroneous radial velocity values. The + latest versions are close to the algorithms published in the 1992 + Explanatory Supplement to the Astronomical Almanac. + +* The leap second at the end of June 1994 has been added to sla_DAT. + +* THE SLA_RVLSR ROUTINE HAS BEEN RETIRED. Its place has been taken + by two new routines: sla_RVLSRK and sla_RVLSRD. The original + sla_RVLSR had used a "kinematical" LSR. When this was later changed + to a "dynamical" LSR for (what seemed liked good reasons at the time), + the small differences were noticed by spectral-line radio observers, + who had to fall back on old copies of the routine to remain consistent + with existing practice. The new routines provide both sorts of LSR: + sla_RVLSRK uses a kinematical LSR and sla_RVLSRD uses the dynamical LSR. + +* The sla_PA routine (computation of parallactic angle) used an + unnecessarily complicated formulation, which has been simplified. + The results are unaffected. + +* The sla_ZD routine (computation of zenith distance) used a + straightforward cosine-formula-based method, which suffered from + decreased accuracy near the zenith. A better, vector-derived, + formulation has been substituted, without materially affecting + the results. Because sla_ZD is double precision, the old + formulation was always adequate; however, had anyone transcribed + the code in single precision errors approaching 1 arcmin could + have resulted. The new formulation delivers good results all + over the sky even in a single precision version. + +* Routines have been added to transform equatorial coordinates + (HA,Dec) to horizon coordinates (Az,El) and back. Single and + double precision are both supported. The routines are called + sla_E2H, sla_DE2H, sla_H2E, sla_DH2E. + +* A new routine has been added to the tangent-plane projection set. + The single and double precision versions are called sla_TPRD and + sla_DTPRD respectively. Given the RA,Dec of a star and its + xi,eta coordinates, the routine determines the "plate centre". + +* The existing routine sla_PREC for obtaining the precession matrix + uses the official IAU model and should continue to be used for + canonical purposes. A new version, called sla_PRECL, uses a + more up-to-date model which delivers better accuracy, especially + over intervals of millennia. + +* The routine sla_PVOBS was returning velocities in AU per sidereal + second rather than per UT second. This has been corrected. The + maximum error was equivalent to about 0.001 km/s. + +* In sla_MAPQK and sla_MAPQKZ, the area within which the gravitional + light-deflection term is restrained has been extended from its + original 300 arcsec radius to about 920 arcsec, just inside the + Sun's disc. + +* A chapter of explanation, with examples, has been added to SUN/67, + which has also undergone various cosmetic revisions. + +* There were two discrepancies between the documentation of sla_DCMPF + (program comments and SUN/67) and the code. The first was that the + formulae for the nonperpendicularity used PERP instead of PERP/2; + the documentation has been corrected. The other was that the + documentation showed the zero point corrections being applied first, + whereas the code returned zero point corrections corresponding to + being applied last. The code has been corrected to match the + documentation. + +* The C module slaCldj gave incorrect answers for dates during + January and February. The error, which did not affect the Fortran + version, has been corrected. + +* THE CALLS FOR sla_TPRD AND sla_DTPRD HAS BEEN CHANGED. An integer + status argument has been added; non-zero means the supplied RA,Dec + and Xi,Eta describe an impossible case. (This can only happen + near the pole and with non-zero Xi.) Also, a slightly neater + formulation has been introduced. + +* Three new routines have been added. sla_ALTAZ takes a star's HA,Dec + and produces position, velocity and acceleration for azimuth, + elevation and parallactic angle. sla_PDA2H predicts the HA at which + a given azimuth will be reached. sla_PDQ2H does the same for + position angle. + +* In the sla_OBS routine, the wrong sign was returned for the Perkins + 72 inch telescope at Lowell - fixed. + +* A revised model for the equation of the equinoxes has been + installed in sla_EQEQX, in line with recent IAU resolutions. The + change amounts to less than 3 mas. + +* A bug in sla_DFLTIN has been corrected. A negative number following + an E- or D-format number without intervening spaces lost its sign. + +* Four stations have been added to sla_OBS: + + TAUTENBERG Tautenberg 1.34 metre Schmidt + PALOMAR48 Palomar 48-inch Schmidt + UKST UK 1.2 metre Schmidt, Siding Spring + KISO Kiso 1.05 metre Schmidt, Japan + ESOSCHMIDT ESO 1 metre Schmidt, La Silla + +* The sla_EARTH and sla_MOON routines could give an integer divide by zero + for years before 1 BC. This has been corrected. + +* sla_CALYD (provided to support the sla_EARTH and sla_MOON routines) + has been upgraded to work outside the interval 1900 March 1 to + 2100 February 28. The status value indicating dates outside that + range has been dropped; a new error value for year before -4711 + has been introduced. + +* A new routine, sla_CLYD, has been added. It is a version of sla_CALYD + without the century-default feature and is to enable 1st-century + dates to be supplied to sla_EARTH and sla_MOON. + +* Two new routines, sla_PLANET and sla_RDPLAN, have been added, which + compute approximate planetary ephemerides. + +* A new routine, sla_DMOON, implements the same (Meeus) model as the + sla_MOON routine, but in full and in double precision. The time + argument is a straightforward MJD rather than sla_MOON's year and + day-in-year. + +* The sla_REFRO code has been speeded up by a factor of two (and is + also clearer). + +* sla_REFV and sla_REFZ have, in different ways, been made more accurate + for cases close to the horizon. The improvement to sla_REFV is + relatively modest, but sla_REFZ is now capable of delivering useful + results for rise/set phenomena. + +* sla_AOPQK has been speeded up for low-elevation cases. + +* Versions of the tangent-plane routines working directly in x,y,z + instead of spherical coordinates have been added. They may be + faster in some applications. The routines are sla_DV2TP, sla_V2TP, + sla_DTP2V, sla_TP2V, sla_DTPXYZ, sla_TPXYZ. + +* The coordinates of the Australia Telescope Compact Array have been + added to sla_OBS. The name is 'ATCA'. + +* Despite their recent introduction THE ROUTINES sla_DTPRD, sla_DTPXYZ, + sla_TPRD AND sla_TPXYZ HAVE BEEN WITHDRAWN. They have been replaced + by the new routines sla_DTPS2C, sla_DTPV2C, sla_TPS2C and sla_TPV2C. + These are functionally equivalent to the earlier routines but return + two solutions instead of one: the second solution can arise near a + pole. + +* The UTC leap second at the end of 1995 has been added to sla_DAT. + +* The refraction routine sla_REFRO has been extensively revised. The + principal motivation was to improve the radio predictions by + introducing better humidity models. The models previously in + use had been entirely adequate for the optical case, for which + they had been devised, but improved models were required for + the radio case. None of the changes significantly affects the + optical results with respect to the earlier version of the sla_REFRO + routine. For example, at 70 deg zenith distance the new version + agrees with the old version to better than 0.05 arcsec for any + reasonable combination of parameters. However, the improved + water-vapour expressions do make a significant difference in the + radio band, at 70 deg zenith distance reaching almost 4 arcsec + for a hot, humid, low-altitude site during a period of low pressure. + +* There was a bug in slaRdplan, the (private) C version of sla_RDPLAN. + The answers were unaffected but there could be floating-point + problems on some platforms. + +* A new routine has been added, sla_GMSTA. This gives greater numerical + precision than the existing GMST function by allowing the date and + time to be specified separately rather than as a single MJD. + +* Measures taken in sla_MAPQK to avoid trouble when processing Solar + positions had not been carried through into sla_MAPQKZ. The two + routines now use the same strategy. + +* In sla_REFRO, at zenith distances well beyond 90 deg and under some + conditions, it was possible to encounter arithmetic errors due to + failure of the tropospheric model-atmosphere to deliver sensible + temperatures. This is inherent in the published algorithm. To + avoid the problem, the temperature delivered by the model has been + constrained to the range 200 to 320 deg K. + +* A new routine has been added, sla_ATMDSP, for rapidly recalculating + the A,B refraction coefficients for different wavelengths. + +* The first UTC leap-second date in the sla_DAT routine was one day early. + This will have had no effect on the results for more recent epochs. + +* slaObs, the C version of sla_OBS, had some problems related to character + string handling. A call using the "number" option retured an invalid + station ID, and station ID and name strings of the stipulated 10 + and 40 character lengths were improperly terminated. + +* A new routine, sla_POLMO has been added. This is a specialist tool + to do with Earth polar motion. + +* sla_DC62S and sla_CC62S could give floating point errors if vectors in + unlikely units were supplied. The handling of difficult cases has + been improved. + +* Support for Linux has been added. + +* slaRefreo, the C version of sla_REFRO, was not re-entrant. It is now; + there has been a small (4%) speed penalty. + +* The C routines slaRandom, slaGresid and slaWait have been dropped. + They could not easily be made re-entrant and posed perennial platform- + dependency problems. + +* The value for the arcsec to radians factor in several routines + had an incorrect (and superfluous) 19th digit, which has been + removed. + +* There was a minor bug in sla_DV2TP and sla_V2TP, to do with protection + against the special case where the tangent point is the pole. + +* In sla_OBS, the position of the Parkes radiotelescope has been revised, + and the ATNF Mopra observatory has been added. + +* Two new routines have been added. sla_PAV (single precision) and + sla_DPAV (double precision) are like sla_BEAR and sla_DBEAR but start + with direction cosines rather than spherical coordinates - they return + the position angle of one point with respect to the other. + +* slaRefro, the C version of sla_REFRO, still wasn't re-entrant, but is + now. + +* slaDtf2d, the C version of sla_DTF2D, used to accept 60.0 in the seconds + field; this has been corrected. + +* The sla_PLANET and sla_RDPLAN routines now include Pluto. The ephemeris + is accurate (sub-arcsecond) but covers the 20th and 21st centuries + only. + + !!! IMPORTANT NOTE !!! + + sla_RDPLAN used to interpret any planet number outside the range 1-8 + as meaning the Sun. The new version uses planet number 9. Existing + programs using 9 for the Sun should be changed to use 0. The rule + has not been changed, except that the range is now 1-9 instead of + 1-8, as it is unlikely that the equivalent problem will arise in the + future. + +* Two new routines have been added, sla_PLANEL and sla_PLANTE. They are + analogues of sla_PLANET and sla_RDPLAN but for the case where orbital + elements are available. They can be used for predicting the + positions of asteroids and comets, and, if up-to-date osculating + elements are supplied, more accurate positions for the major + planets than can be provided through the sla_PLANET and sla_RDPLAN + routines. + +* The sla_REFRO routine could give inaccurate results for low temperatures + (subzero C). This was caused by over-cautious defensive programming, + which prevented the tropospheric temperature falling below 200 K. + +* A new routine has been added, sla_REFCOQ. This calculates the coefficients + of a two-term refraction model. It complements the existing sla_REFCO + routine, being much faster at the expense of some accuracy. + +* The 1997 July 1 UTC leap second has been added to the sla_DAT routine. + +* A bug in slaSvd, the C version of sla_SVD, caused occasional false + indications of ill-conditioning. The results of least-squares + fits do not seem to have been affected. The Fortran version did not + have the bug. + +* The Subaru telescope (Japanese National 8-metre telescope, Mauna Kea) + has been added to the sla_OBS routine. + +* The sla_DAT routine has been extended back to the inception of UTC in + 1960. + +* The "earliest date possible" in DJCL sla_was two days out (disagreeing + with sla_DJCAL, which had the correct value). + +* The sla_GMSTA code has been improved. + +* A new routine, sla_PV2EL, takes a heliocentric J2000 equatorial position + and velocity and produces the equivalent set of osculating elements. + +* The 1999 January 1 UTC leap second has been added to the sla_DAT routine. + +* Four new routines have been introduced which transform between the + FK5 system and the ICRS (Hipparcos) system. sla_FK52H and sla_H2FK5 + transform star positions and proper motions from FK5 coordinates to + Hipparcos coordinates and vice versa. sla_FK5HZ and sla_HFK5Z do the + same but for the case where the Hipparcos proper motions are zero. + +* Six new routines have been introduced for dealing with orbital elements. + Four of them (sla_EL2UE, sla_PV2UE, sla_UE2EL and sla_UE2PV) provide + applications with direct access to the "universal variables" method + that was already being used internally. Compared with using conventional + (angular) elements and solving Kepler's equation, the universal variables + approach has a number of advantages, including better handling of near- + parabolic orbits and greater efficiency. The remaining two routines + (sla_PERTEL and sla_PERTUE) generate updated elements by applying + major-planet perturbations. The new elements can then be used to + predict positions that are much more accurate. For minor planets, + sub-arcsecond accuracy over a decade is achievable. + +* Several observatory sites have been added to the OBS routine: CFHT, + Keck 2, Gemini North, FCRAO, IRTF and CSO. The coordinates for all + the Mauna Kea sites have been updated in accordance with recent aerial + photography results made available by the Institute for Astronomy, + University of Hawaii. + +* A bug in sla_DAT has been corrected. It used to give incorrect + results for dates in the first 54 days of 1972. + +* There are new routines for generating permutations (sla_PERMUT) and + combinations (sla_COMBN). + +* There was a bug in sla_PM for star data using Julian epochs (i.e. all + modern data). The treatment of radial velocity was correct for + Besselian epochs but wrong for Julian epochs. This had only a tiny + effect on a handful of nearby stars. The new version assumes Julian + epochs when interpreting the radial velocity. If the data are old- + style, using Besselian epochs, you have to scale the radial velocity + by 365.2422/365.25 first. + +* There was a bug in sla_RCC which meant the diurnal terms were being + calculated incorrectly, leading to errors of up to about 4 microsec. + +* Two new routines have been added, sla_DSEPV and sla_SEPV. These are + analogues of the existing routines sla_DSEP and sla_SEP, but accept + [x,y,z] vectors instead of spherical coordinates. + +* The sla_UNPCD routine used to be approximate but now is rigorous. + +* The four VLTs and Gemini South have been added to sla_OBS. + +* An additional Earth position/velocity routine, sla_EPV, has been + added. It is bigger and slower than sla_EVP but much more accurate. + Position accuracy is a few km; velocity accuracy is a few mm/s. + The sla_PERTUE and sla_PLANTU routines now call this routine in + order to deliver better predictions for near-Earth objects. + +* There was a bug in sla_DSEPV. For the unique case of two precisely + antipodal vectors zero was returned instead of pi. + +----------------------------------------------------------------------- + + + P.T.Wallace + + ptw@star.rl.ac.uk + +44-1235-44-5372 diff --git a/math/slalib/refco.f b/math/slalib/refco.f new file mode 100644 index 00000000..f03a30fa --- /dev/null +++ b/math/slalib/refco.f @@ -0,0 +1,88 @@ + SUBROUTINE slRFCO ( HM, TDK, PMB, RH, WL, PHI, TLR, EPS, + : REFA, REFB ) +*+ +* - - - - - - +* R F C O +* - - - - - - +* +* Determine the constants A and B in the atmospheric refraction +* model dZ = A tan Z + B tan**3 Z. +* +* Z is the "observed" zenith distance (i.e. affected by refraction) +* and dZ is what to add to Z to give the "topocentric" (i.e. in vacuo) +* zenith distance. +* +* Given: +* HM d height of the observer above sea level (metre) +* TDK d ambient temperature at the observer (K) +* PMB d pressure at the observer (millibar) +* RH d relative humidity at the observer (range 0-1) +* WL d effective wavelength of the source (micrometre) +* PHI d latitude of the observer (radian, astronomical) +* TLR d temperature lapse rate in the troposphere (K/metre) +* EPS d precision required to terminate iteration (radian) +* +* Returned: +* REFA d tan Z coefficient (radian) +* REFB d tan**3 Z coefficient (radian) +* +* Called: slRFRO +* +* Notes: +* +* 1 Typical values for the TLR and EPS arguments might be 0.0065D0 and +* 1D-10 respectively. +* +* 2 The radio refraction is chosen by specifying WL > 100 micrometres. +* +* 3 The routine is a slower but more accurate alternative to the +* slRFCQ routine. The constants it produces give perfect +* agreement with slRFRO at zenith distances arctan(1) (45 deg) +* and arctan(4) (about 76 deg). It achieves 0.5 arcsec accuracy +* for ZD < 80 deg, 0.01 arcsec accuracy for ZD < 60 deg, and +* 0.001 arcsec accuracy for ZD < 45 deg. +* +* P.T.Wallace Starlink 22 May 2004 +* +* Copyright (C) 2004 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION HM,TDK,PMB,RH,WL,PHI,TLR,EPS,REFA,REFB + + DOUBLE PRECISION ATN1,ATN4,R1,R2 + +* Sample zenith distances: arctan(1) and arctan(4) + PARAMETER (ATN1=0.7853981633974483D0, + : ATN4=1.325817663668033D0) + + + +* Determine refraction for the two sample zenith distances + CALL slRFRO(ATN1,HM,TDK,PMB,RH,WL,PHI,TLR,EPS,R1) + CALL slRFRO(ATN4,HM,TDK,PMB,RH,WL,PHI,TLR,EPS,R2) + +* Solve for refraction constants + REFA = (64D0*R1-R2)/60D0 + REFB = (R2-4D0*R1)/60D0 + + END diff --git a/math/slalib/refcoq.f b/math/slalib/refcoq.f new file mode 100644 index 00000000..76e40341 --- /dev/null +++ b/math/slalib/refcoq.f @@ -0,0 +1,227 @@ + SUBROUTINE slRFCQ ( TDK, PMB, RH, WL, REFA, REFB ) +*+ +* - - - - - - - +* R F C Q +* - - - - - - - +* +* Determine the constants A and B in the atmospheric refraction +* model dZ = A tan Z + B tan**3 Z. This is a fast alternative +* to the slRFCO routine - see notes. +* +* Z is the "observed" zenith distance (i.e. affected by refraction) +* and dZ is what to add to Z to give the "topocentric" (i.e. in vacuo) +* zenith distance. +* +* Given: +* TDK d ambient temperature at the observer (K) +* PMB d pressure at the observer (millibar) +* RH d relative humidity at the observer (range 0-1) +* WL d effective wavelength of the source (micrometre) +* +* Returned: +* REFA d tan Z coefficient (radian) +* REFB d tan**3 Z coefficient (radian) +* +* The radio refraction is chosen by specifying WL > 100 micrometres. +* +* Notes: +* +* 1 The model is an approximation, for moderate zenith distances, +* to the predictions of the slRFRO routine. The approximation +* is maintained across a range of conditions, and applies to +* both optical/IR and radio. +* +* 2 The algorithm is a fast alternative to the slRFCO routine. +* The latter calls the slRFRO routine itself: this involves +* integrations through a model atmosphere, and is costly in +* processor time. However, the model which is produced is precisely +* correct for two zenith distance (45 degrees and about 76 degrees) +* and at other zenith distances is limited in accuracy only by the +* A tan Z + B tan**3 Z formulation itself. The present routine +* is not as accurate, though it satisfies most practical +* requirements. +* +* 3 The model omits the effects of (i) height above sea level (apart +* from the reduced pressure itself), (ii) latitude (i.e. the +* flattening of the Earth) and (iii) variations in tropospheric +* lapse rate. +* +* The model was tested using the following range of conditions: +* +* lapse rates 0.0055, 0.0065, 0.0075 K/metre +* latitudes 0, 25, 50, 75 degrees +* heights 0, 2500, 5000 metres ASL +* pressures mean for height -10% to +5% in steps of 5% +* temperatures -10 deg to +20 deg with respect to 280 deg at SL +* relative humidity 0, 0.5, 1 +* wavelengths 0.4, 0.6, ... 2 micron, + radio +* zenith distances 15, 45, 75 degrees +* +* The accuracy with respect to direct use of the slRFRO routine +* was as follows: +* +* worst RMS +* +* optical/IR 62 mas 8 mas +* radio 319 mas 49 mas +* +* For this particular set of conditions: +* +* lapse rate 0.0065 K/metre +* latitude 50 degrees +* sea level +* pressure 1005 mb +* temperature 280.15 K +* humidity 80% +* wavelength 5740 Angstroms +* +* the results were as follows: +* +* ZD slRFRO slRFCQ Saastamoinen +* +* 10 10.27 10.27 10.27 +* 20 21.19 21.20 21.19 +* 30 33.61 33.61 33.60 +* 40 48.82 48.83 48.81 +* 45 58.16 58.18 58.16 +* 50 69.28 69.30 69.27 +* 55 82.97 82.99 82.95 +* 60 100.51 100.54 100.50 +* 65 124.23 124.26 124.20 +* 70 158.63 158.68 158.61 +* 72 177.32 177.37 177.31 +* 74 200.35 200.38 200.32 +* 76 229.45 229.43 229.42 +* 78 267.44 267.29 267.41 +* 80 319.13 318.55 319.10 +* +* deg arcsec arcsec arcsec +* +* The values for Saastamoinen's formula (which includes terms +* up to tan^5) are taken from Hohenkerk and Sinclair (1985). +* +* The results from the much slower but more accurate slRFCO +* routine have not been included in the tabulation as they are +* identical to those in the slRFRO column to the 0.01 arcsec +* resolution used. +* +* 4 Outlandish input parameters are silently limited to mathematically +* safe values. Zero pressure is permissible, and causes zeroes to +* be returned. +* +* 5 The algorithm draws on several sources, as follows: +* +* a) The formula for the saturation vapour pressure of water as +* a function of temperature and temperature is taken from +* expressions A4.5-A4.7 of Gill (1982). +* +* b) The formula for the water vapour pressure, given the +* saturation pressure and the relative humidity, is from +* Crane (1976), expression 2.5.5. +* +* c) The refractivity of air is a function of temperature, +* total pressure, water-vapour pressure and, in the case +* of optical/IR but not radio, wavelength. The formulae +* for the two cases are developed from Hohenkerk & Sinclair +* (1985) and Rueger (2002). +* +* The above three items are as used in the slRFRO routine. +* +* d) The formula for beta, the ratio of the scale height of the +* atmosphere to the geocentric distance of the observer, is +* an adaption of expression 9 from Stone (1996). The +* adaptations, arrived at empirically, consist of (i) a +* small adjustment to the coefficient and (ii) a humidity +* term for the radio case only. +* +* e) The formulae for the refraction constants as a function of +* n-1 and beta are from Green (1987), expression 4.31. +* +* References: +* +* Crane, R.K., Meeks, M.L. (ed), "Refraction Effects in the Neutral +* Atmosphere", Methods of Experimental Physics: Astrophysics 12B, +* Academic Press, 1976. +* +* Gill, Adrian E., "Atmosphere-Ocean Dynamics", Academic Press, 1982. +* +* Green, R.M., "Spherical Astronomy", Cambridge University Press, 1987. +* +* Hohenkerk, C.Y., & Sinclair, A.T., NAO Technical Note No. 63, 1985. +* +* Rueger, J.M., "Refractive Index Formulae for Electronic Distance +* Measurement with Radio and Millimetre Waves", in Unisurv Report +* S-68, School of Surveying and Spatial Information Systems, +* University of New South Wales, Sydney, Australia, 2002. +* +* Stone, Ronald C., P.A.S.P. 108 1051-1058, 1996. +* +* Last revision: 2 December 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION TDK,PMB,RH,WL,REFA,REFB + + LOGICAL OPTIC + DOUBLE PRECISION T,P,R,W,TDC,PS,PW,WLSQ,GAMMA,BETA + + + +* Decide whether optical/IR or radio case: switch at 100 microns. + OPTIC = WL.LE.100D0 + +* Restrict parameters to safe values. + T = MIN(MAX(TDK,100D0),500D0) + P = MIN(MAX(PMB,0D0),10000D0) + R = MIN(MAX(RH,0D0),1D0) + W = MIN(MAX(WL,0.1D0),1D6) + +* Water vapour pressure at the observer. + IF (P.GT.0D0) THEN + TDC = T-273.15D0 + PS = 10D0**((0.7859D0+0.03477D0*TDC)/(1D0+0.00412D0*TDC))* + : (1D0+P*(4.5D-6+6D-10*TDC*TDC)) + PW = R*PS/(1D0-(1D0-R)*PS/P) + ELSE + PW = 0D0 + END IF + +* Refractive index minus 1 at the observer. + IF (OPTIC) THEN + WLSQ = W*W + GAMMA = ((77.53484D-6+(4.39108D-7+3.666D-9/WLSQ)/WLSQ)*P + : -11.2684D-6*PW)/T + ELSE + GAMMA = (77.6890D-6*P-(6.3938D-6-0.375463D0/T)*PW)/T + END IF + +* Formula for beta adapted from Stone, with empirical adjustments. + BETA=4.4474D-6*T + IF (.NOT.OPTIC) BETA=BETA-0.0074D0*PW*BETA + +* Refraction constants from Green. + REFA = GAMMA*(1D0-BETA) + REFB = -GAMMA*(BETA-GAMMA/2D0) + + END diff --git a/math/slalib/refro.f b/math/slalib/refro.f new file mode 100644 index 00000000..3a93264e --- /dev/null +++ b/math/slalib/refro.f @@ -0,0 +1,402 @@ + SUBROUTINE slRFRO ( ZOBS, HM, TDK, PMB, RH, WL, PHI, TLR, + : EPS, REF ) +*+ +* - - - - - - +* R F R O +* - - - - - - +* +* Atmospheric refraction for radio and optical/IR wavelengths. +* +* Given: +* ZOBS d observed zenith distance of the source (radian) +* HM d height of the observer above sea level (metre) +* TDK d ambient temperature at the observer (K) +* PMB d pressure at the observer (millibar) +* RH d relative humidity at the observer (range 0-1) +* WL d effective wavelength of the source (micrometre) +* PHI d latitude of the observer (radian, astronomical) +* TLR d temperature lapse rate in the troposphere (K/metre) +* EPS d precision required to terminate iteration (radian) +* +* Returned: +* REF d refraction: in vacuo ZD minus observed ZD (radian) +* +* Notes: +* +* 1 A suggested value for the TLR argument is 0.0065D0. The +* refraction is significantly affected by TLR, and if studies +* of the local atmosphere have been carried out a better TLR +* value may be available. The sign of the supplied TLR value +* is ignored. +* +* 2 A suggested value for the EPS argument is 1D-8. The result is +* usually at least two orders of magnitude more computationally +* precise than the supplied EPS value. +* +* 3 The routine computes the refraction for zenith distances up +* to and a little beyond 90 deg using the method of Hohenkerk +* and Sinclair (NAO Technical Notes 59 and 63, subsequently adopted +* in the Explanatory Supplement, 1992 edition - see section 3.281). +* +* 4 The code is a development of the optical/IR refraction subroutine +* AREF of C.Hohenkerk (HMNAO, September 1984), with extensions to +* support the radio case. Apart from merely cosmetic changes, the +* following modifications to the original HMNAO optical/IR refraction +* code have been made: +* +* . The angle arguments have been changed to radians. +* +* . Any value of ZOBS is allowed (see note 6, below). +* +* . Other argument values have been limited to safe values. +* +* . Murray's values for the gas constants have been used +* (Vectorial Astrometry, Adam Hilger, 1983). +* +* . The numerical integration phase has been rearranged for +* extra clarity. +* +* . A better model for Ps(T) has been adopted (taken from +* Gill, Atmosphere-Ocean Dynamics, Academic Press, 1982). +* +* . More accurate expressions for Pwo have been adopted +* (again from Gill 1982). +* +* . The formula for the water vapour pressure, given the +* saturation pressure and the relative humidity, is from +* Crane (1976), expression 2.5.5. +* +* . Provision for radio wavelengths has been added using +* expressions devised by A.T.Sinclair, RGO (private +* communication 1989). The refractivity model currently +* used is from J.M.Rueger, "Refractive Index Formulae for +* Electronic Distance Measurement with Radio and Millimetre +* Waves", in Unisurv Report S-68 (2002), School of Surveying +* and Spatial Information Systems, University of New South +* Wales, Sydney, Australia. +* +* . The optical refractivity for dry air is from Resolution 3 of +* the International Association of Geodesy adopted at the XXIIth +* General Assembly in Birmingham, UK, 1999. +* +* . Various small changes have been made to gain speed. +* +* 5 The radio refraction is chosen by specifying WL > 100 micrometres. +* Because the algorithm takes no account of the ionosphere, the +* accuracy deteriorates at low frequencies, below about 30 MHz. +* +* 6 Before use, the value of ZOBS is expressed in the range +/- pi. +* If this ranged ZOBS is -ve, the result REF is computed from its +* absolute value before being made -ve to match. In addition, if +* it has an absolute value greater than 93 deg, a fixed REF value +* equal to the result for ZOBS = 93 deg is returned, appropriately +* signed. +* +* 7 As in the original Hohenkerk and Sinclair algorithm, fixed values +* of the water vapour polytrope exponent, the height of the +* tropopause, and the height at which refraction is negligible are +* used. +* +* 8 The radio refraction has been tested against work done by +* Iain Coulson, JACH, (private communication 1995) for the +* James Clerk Maxwell Telescope, Mauna Kea. For typical conditions, +* agreement at the 0.1 arcsec level is achieved for moderate ZD, +* worsening to perhaps 0.5-1.0 arcsec at ZD 80 deg. At hot and +* humid sea-level sites the accuracy will not be as good. +* +* 9 It should be noted that the relative humidity RH is formally +* defined in terms of "mixing ratio" rather than pressures or +* densities as is often stated. It is the mass of water per unit +* mass of dry air divided by that for saturated air at the same +* temperature and pressure (see Gill 1982). +* +* 10 The algorithm is designed for observers in the troposphere. The +* supplied temperature, pressure and lapse rate are assumed to be +* for a point in the troposphere and are used to define a model +* atmosphere with the tropopause at 11km altitude and a constant +* temperature above that. However, in practice, the refraction +* values returned for stratospheric observers, at altitudes up to +* 25km, are quite usable. +* +* Called: slDA1P, slATMT, slATMS +* +* Last revision: 5 December 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION ZOBS,HM,TDK,PMB,RH,WL,PHI,TLR,EPS,REF + +* +* Fixed parameters +* + DOUBLE PRECISION D93,GCR,DMD,DMW,S,DELTA,HT,HS + INTEGER ISMAX +* 93 degrees in radians + PARAMETER (D93=1.623156204D0) +* Universal gas constant + PARAMETER (GCR=8314.32D0) +* Molecular weight of dry air + PARAMETER (DMD=28.9644D0) +* Molecular weight of water vapour + PARAMETER (DMW=18.0152D0) +* Mean Earth radius (metre) + PARAMETER (S=6378120D0) +* Exponent of temperature dependence of water vapour pressure + PARAMETER (DELTA=18.36D0) +* Height of tropopause (metre) + PARAMETER (HT=11000D0) +* Upper limit for refractive effects (metre) + PARAMETER (HS=80000D0) +* Numerical integration: maximum number of strips. + PARAMETER (ISMAX=16384) + + INTEGER IS,K,N,I,J + LOGICAL OPTIC,LOOP + DOUBLE PRECISION ZOBS1,ZOBS2,HMOK,TDKOK,PMBOK,RHOK,WLOK,ALPHA, + : TOL,WLSQ,GB,A,GAMAL,GAMMA,GAMM2,DELM2, + : TDC,PSAT,PWO,W, + : C1,C2,C3,C4,C5,C6,R0,TEMPO,DN0,RDNDR0,SK0,F0, + : RT,TT,DNT,RDNDRT,SINE,ZT,FT,DNTS,RDNDRP,ZTS,FTS, + : RS,DNS,RDNDRS,ZS,FS,REFOLD,Z0,ZRANGE,FB,FF,FO,FE, + : H,R,SZ,RG,DR,TG,DN,RDNDR,T,F,REFP,REFT + + DOUBLE PRECISION slDA1P + +* The refraction integrand + DOUBLE PRECISION REFI + REFI(DN,RDNDR) = RDNDR/(DN+RDNDR) + + + +* Transform ZOBS into the normal range. + ZOBS1 = slDA1P(ZOBS) + ZOBS2 = MIN(ABS(ZOBS1),D93) + +* Keep other arguments within safe bounds. + HMOK = MIN(MAX(HM,-1D3),HS) + TDKOK = MIN(MAX(TDK,100D0),500D0) + PMBOK = MIN(MAX(PMB,0D0),10000D0) + RHOK = MIN(MAX(RH,0D0),1D0) + WLOK = MAX(WL,0.1D0) + ALPHA = MIN(MAX(ABS(TLR),0.001D0),0.01D0) + +* Tolerance for iteration. + TOL = MIN(MAX(ABS(EPS),1D-12),0.1D0)/2D0 + +* Decide whether optical/IR or radio case - switch at 100 microns. + OPTIC = WLOK.LE.100D0 + +* Set up model atmosphere parameters defined at the observer. + WLSQ = WLOK*WLOK + GB = 9.784D0*(1D0-0.0026D0*COS(PHI+PHI)-0.00000028D0*HMOK) + IF (OPTIC) THEN + A = (287.6155D0+(1.62887D0+0.01360D0/WLSQ)/WLSQ) + : *273.15D-6/1013.25D0 + ELSE + A = 77.6890D-6 + END IF + GAMAL = (GB*DMD)/GCR + GAMMA = GAMAL/ALPHA + GAMM2 = GAMMA-2D0 + DELM2 = DELTA-2D0 + TDC = TDKOK-273.15D0 + PSAT = 10D0**((0.7859D0+0.03477D0*TDC)/(1D0+0.00412D0*TDC))* + : (1D0+PMBOK*(4.5D-6+6D-10*TDC*TDC)) + IF (PMBOK.GT.0D0) THEN + PWO = RHOK*PSAT/(1D0-(1D0-RHOK)*PSAT/PMBOK) + ELSE + PWO = 0D0 + END IF + W = PWO*(1D0-DMW/DMD)*GAMMA/(DELTA-GAMMA) + C1 = A*(PMBOK+W)/TDKOK + IF (OPTIC) THEN + C2 = (A*W+11.2684D-6*PWO)/TDKOK + ELSE + C2 = (A*W+6.3938D-6*PWO)/TDKOK + END IF + C3 = (GAMMA-1D0)*ALPHA*C1/TDKOK + C4 = (DELTA-1D0)*ALPHA*C2/TDKOK + IF (OPTIC) THEN + C5 = 0D0 + C6 = 0D0 + ELSE + C5 = 375463D-6*PWO/TDKOK + C6 = C5*DELM2*ALPHA/(TDKOK*TDKOK) + END IF + +* Conditions at the observer. + R0 = S+HMOK + CALL slATMT(R0,TDKOK,ALPHA,GAMM2,DELM2,C1,C2,C3,C4,C5,C6, + : R0,TEMPO,DN0,RDNDR0) + SK0 = DN0*R0*SIN(ZOBS2) + F0 = REFI(DN0,RDNDR0) + +* Conditions in the troposphere at the tropopause. + RT = S+MAX(HT,HMOK) + CALL slATMT(R0,TDKOK,ALPHA,GAMM2,DELM2,C1,C2,C3,C4,C5,C6, + : RT,TT,DNT,RDNDRT) + SINE = SK0/(RT*DNT) + ZT = ATAN2(SINE,SQRT(MAX(1D0-SINE*SINE,0D0))) + FT = REFI(DNT,RDNDRT) + +* Conditions in the stratosphere at the tropopause. + CALL slATMS(RT,TT,DNT,GAMAL,RT,DNTS,RDNDRP) + SINE = SK0/(RT*DNTS) + ZTS = ATAN2(SINE,SQRT(MAX(1D0-SINE*SINE,0D0))) + FTS = REFI(DNTS,RDNDRP) + +* Conditions at the stratosphere limit. + RS = S+HS + CALL slATMS(RT,TT,DNT,GAMAL,RS,DNS,RDNDRS) + SINE = SK0/(RS*DNS) + ZS = ATAN2(SINE,SQRT(MAX(1D0-SINE*SINE,0D0))) + FS = REFI(DNS,RDNDRS) + +* Variable initialization to avoid compiler warning. + REFT = 0D0 + +* Integrate the refraction integral in two parts; first in the +* troposphere (K=1), then in the stratosphere (K=2). + + DO K = 1,2 + +* Initialize previous refraction to ensure at least two iterations. + REFOLD = 1D0 + +* Start off with 8 strips. + IS = 8 + +* Start Z, Z range, and start and end values. + IF (K.EQ.1) THEN + Z0 = ZOBS2 + ZRANGE = ZT-Z0 + FB = F0 + FF = FT + ELSE + Z0 = ZTS + ZRANGE = ZS-Z0 + FB = FTS + FF = FS + END IF + +* Sums of odd and even values. + FO = 0D0 + FE = 0D0 + +* First time through the loop we have to do every point. + N = 1 + +* Start of iteration loop (terminates at specified precision). + LOOP = .TRUE. + DO WHILE (LOOP) + +* Strip width. + H = ZRANGE/DBLE(IS) + +* Initialize distance from Earth centre for quadrature pass. + IF (K.EQ.1) THEN + R = R0 + ELSE + R = RT + END IF + +* One pass (no need to compute evens after first time). + DO I=1,IS-1,N + +* Sine of observed zenith distance. + SZ = SIN(Z0+H*DBLE(I)) + +* Find R (to the nearest metre, maximum four iterations). + IF (SZ.GT.1D-20) THEN + W = SK0/SZ + RG = R + DR = 1D6 + J = 0 + DO WHILE (ABS(DR).GT.1D0.AND.J.LT.4) + J=J+1 + IF (K.EQ.1) THEN + CALL slATMT(R0,TDKOK,ALPHA,GAMM2,DELM2, + : C1,C2,C3,C4,C5,C6,RG,TG,DN,RDNDR) + ELSE + CALL slATMS(RT,TT,DNT,GAMAL,RG,DN,RDNDR) + END IF + DR = (RG*DN-W)/(DN+RDNDR) + RG = RG-DR + END DO + R = RG + END IF + +* Find the refractive index and integrand at R. + IF (K.EQ.1) THEN + CALL slATMT(R0,TDKOK,ALPHA,GAMM2,DELM2, + : C1,C2,C3,C4,C5,C6,R,T,DN,RDNDR) + ELSE + CALL slATMS(RT,TT,DNT,GAMAL,R,DN,RDNDR) + END IF + F = REFI(DN,RDNDR) + +* Accumulate odd and (first time only) even values. + IF (N.EQ.1.AND.MOD(I,2).EQ.0) THEN + FE = FE+F + ELSE + FO = FO+F + END IF + END DO + +* Evaluate the integrand using Simpson's Rule. + REFP = H*(FB+4D0*FO+2D0*FE+FF)/3D0 + +* Has the required precision been achieved (or can't be)? + IF (ABS(REFP-REFOLD).GT.TOL.AND.IS.LT.ISMAX) THEN + +* No: prepare for next iteration. + +* Save current value for convergence test. + REFOLD = REFP + +* Double the number of strips. + IS = IS+IS + +* Sum of all current values = sum of next pass's even values. + FE = FE+FO + +* Prepare for new odd values. + FO = 0D0 + +* Skip even values next time. + N = 2 + ELSE + +* Yes: save troposphere component and terminate the loop. + IF (K.EQ.1) REFT = REFP + LOOP = .FALSE. + END IF + END DO + END DO + +* Result. + REF = REFT+REFP + IF (ZOBS1.LT.0D0) REF = -REF + + END diff --git a/math/slalib/refv.f b/math/slalib/refv.f new file mode 100644 index 00000000..42a5f1f6 --- /dev/null +++ b/math/slalib/refv.f @@ -0,0 +1,129 @@ + SUBROUTINE slREFV (VU, REFA, REFB, VR) +*+ +* - - - - - +* R E F V +* - - - - - +* +* Adjust an unrefracted Cartesian vector to include the effect of +* atmospheric refraction, using the simple A tan Z + B tan**3 Z +* model. +* +* Given: +* VU dp unrefracted position of the source (Az/El 3-vector) +* REFA dp tan Z coefficient (radian) +* REFB dp tan**3 Z coefficient (radian) +* +* Returned: +* VR dp refracted position of the source (Az/El 3-vector) +* +* Notes: +* +* 1 This routine applies the adjustment for refraction in the +* opposite sense to the usual one - it takes an unrefracted +* (in vacuo) position and produces an observed (refracted) +* position, whereas the A tan Z + B tan**3 Z model strictly +* applies to the case where an observed position is to have the +* refraction removed. The unrefracted to refracted case is +* harder, and requires an inverted form of the text-book +* refraction models; the algorithm used here is equivalent to +* one iteration of the Newton-Raphson method applied to the above +* formula. +* +* 2 Though optimized for speed rather than precision, the present +* routine achieves consistency with the refracted-to-unrefracted +* A tan Z + B tan**3 Z model at better than 1 microarcsecond within +* 30 degrees of the zenith and remains within 1 milliarcsecond to +* beyond ZD 70 degrees. The inherent accuracy of the model is, of +* course, far worse than this - see the documentation for slRFCO +* for more information. +* +* 3 At low elevations (below about 3 degrees) the refraction +* correction is held back to prevent arithmetic problems and +* wildly wrong results. For optical/IR wavelengths, over a wide +* range of observer heights and corresponding temperatures and +* pressures, the following levels of accuracy (arcsec, worst case) +* are achieved, relative to numerical integration through a model +* atmosphere: +* +* ZD error +* +* 80 0.7 +* 81 1.3 +* 82 2.5 +* 83 5 +* 84 10 +* 85 20 +* 86 55 +* 87 160 +* 88 360 +* 89 640 +* 90 1100 +* 91 1700 } relevant only to +* 92 2600 } high-elevation sites +* +* The results for radio are slightly worse over most of the range, +* becoming significantly worse below ZD=88 and unusable beyond +* ZD=90. +* +* 4 See also the routine slREFZ, which performs the adjustment to +* the zenith distance rather than in Cartesian Az/El coordinates. +* The present routine is faster than slREFZ and, except very low down, +* is equally accurate for all practical purposes. However, beyond +* about ZD 84 degrees slREFZ should be used, and for the utmost +* accuracy iterative use of slRFRO should be considered. +* +* P.T.Wallace Starlink 10 April 2004 +* +* Copyright (C) 2004 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION VU(3),REFA,REFB,VR(3) + + DOUBLE PRECISION X,Y,Z1,Z,ZSQ,RSQ,R,WB,WT,D,CD,F + + + +* Initial estimate = unrefracted vector + X = VU(1) + Y = VU(2) + Z1 = VU(3) + +* Keep correction approximately constant below about 3 deg elevation + Z = MAX(Z1,0.05D0) + +* One Newton-Raphson iteration + ZSQ = Z*Z + RSQ = X*X+Y*Y + R = SQRT(RSQ) + WB = REFB*RSQ/ZSQ + WT = (REFA+WB)/(1D0+(REFA+3D0*WB)*(ZSQ+RSQ)/ZSQ) + D = WT*R/Z + CD = 1D0-D*D/2D0 + F = CD*(1D0-WT) + +* Post-refraction x,y,z + VR(1) = X*F + VR(2) = Y*F + VR(3) = CD*(Z+D*R)+(Z1-Z) + + END diff --git a/math/slalib/refz.f b/math/slalib/refz.f new file mode 100644 index 00000000..6bdae80f --- /dev/null +++ b/math/slalib/refz.f @@ -0,0 +1,170 @@ + SUBROUTINE slREFZ (ZU, REFA, REFB, ZR) +*+ +* - - - - - +* R E F Z +* - - - - - +* +* Adjust an unrefracted zenith distance to include the effect of +* atmospheric refraction, using the simple A tan Z + B tan**3 Z +* model (plus special handling for large ZDs). +* +* Given: +* ZU dp unrefracted zenith distance of the source (radian) +* REFA dp tan Z coefficient (radian) +* REFB dp tan**3 Z coefficient (radian) +* +* Returned: +* ZR dp refracted zenith distance (radian) +* +* Notes: +* +* 1 This routine applies the adjustment for refraction in the +* opposite sense to the usual one - it takes an unrefracted +* (in vacuo) position and produces an observed (refracted) +* position, whereas the A tan Z + B tan**3 Z model strictly +* applies to the case where an observed position is to have the +* refraction removed. The unrefracted to refracted case is +* harder, and requires an inverted form of the text-book +* refraction models; the formula used here is based on the +* Newton-Raphson method. For the utmost numerical consistency +* with the refracted to unrefracted model, two iterations are +* carried out, achieving agreement at the 1D-11 arcseconds level +* for a ZD of 80 degrees. The inherent accuracy of the model +* is, of course, far worse than this - see the documentation for +* slRFCO for more information. +* +* 2 At ZD 83 degrees, the rapidly-worsening A tan Z + B tan^3 Z +* model is abandoned and an empirical formula takes over. For +* optical/IR wavelengths, over a wide range of observer heights and +* corresponding temperatures and pressures, the following levels of +* accuracy (arcsec, worst case) are achieved, relative to numerical +* integration through a model atmosphere: +* +* ZR error +* +* 80 0.7 +* 81 1.3 +* 82 2.4 +* 83 4.7 +* 84 6.2 +* 85 6.4 +* 86 8 +* 87 10 +* 88 15 +* 89 30 +* 90 60 +* 91 150 } relevant only to +* 92 400 } high-elevation sites +* +* For radio wavelengths the errors are typically 50% larger than +* the optical figures and by ZD 85 deg are twice as bad, worsening +* rapidly below that. To maintain 1 arcsec accuracy down to ZD=85 +* at the Green Bank site, Condon (2004) has suggested amplifying +* the amount of refraction predicted by slREFZ below 10.8 deg +* elevation by the factor (1+0.00195*(10.8-E_t)), where E_t is the +* unrefracted elevation in degrees. +* +* The high-ZD model is scaled to match the normal model at the +* transition point; there is no glitch. +* +* 3 Beyond 93 deg zenith distance, the refraction is held at its +* 93 deg value. +* +* 4 See also the routine slREFV, which performs the adjustment in +* Cartesian Az/El coordinates, and with the emphasis on speed +* rather than numerical accuracy. +* +* Reference: +* +* Condon,J.J., Refraction Corrections for the GBT, PTCS/PN/35.2, +* NRAO Green Bank, 2004. +* +* P.T.Wallace Starlink 9 April 2004 +* +* Copyright (C) 2004 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION ZU,REFA,REFB,ZR + +* Radians to degrees + DOUBLE PRECISION R2D + PARAMETER (R2D=57.29577951308232D0) + +* Largest usable ZD (deg) + DOUBLE PRECISION D93 + PARAMETER (D93=93D0) + +* Coefficients for high ZD model (used beyond ZD 83 deg) + DOUBLE PRECISION C1,C2,C3,C4,C5 + PARAMETER (C1=+0.55445D0, + : C2=-0.01133D0, + : C3=+0.00202D0, + : C4=+0.28385D0, + : C5=+0.02390D0) + +* ZD at which one model hands over to the other (radians) + DOUBLE PRECISION Z83 + PARAMETER (Z83=83D0/R2D) + +* High-ZD-model prediction (deg) for that point + DOUBLE PRECISION REF83 + PARAMETER (REF83=(C1+C2*7D0+C3*49D0)/(1D0+C4*7D0+C5*49D0)) + + DOUBLE PRECISION ZU1,ZL,S,C,T,TSQ,TCU,REF,E,E2 + + + +* Perform calculations for ZU or 83 deg, whichever is smaller + ZU1 = MIN(ZU,Z83) + +* Functions of ZD + ZL = ZU1 + S = SIN(ZL) + C = COS(ZL) + T = S/C + TSQ = T*T + TCU = T*TSQ + +* Refracted ZD (mathematically to better than 1 mas at 70 deg) + ZL = ZL-(REFA*T+REFB*TCU)/(1D0+(REFA+3D0*REFB*TSQ)/(C*C)) + +* Further iteration + S = SIN(ZL) + C = COS(ZL) + T = S/C + TSQ = T*T + TCU = T*TSQ + REF = ZU1-ZL+ + : (ZL-ZU1+REFA*T+REFB*TCU)/(1D0+(REFA+3D0*REFB*TSQ)/(C*C)) + +* Special handling for large ZU + IF (ZU.GT.ZU1) THEN + E = 90D0-MIN(D93,ZU*R2D) + E2 = E*E + REF = (REF/REF83)*(C1+C2*E+C3*E2)/(1D0+C4*E+C5*E2) + END IF + +* Return refracted ZD + ZR = ZU-REF + + END diff --git a/math/slalib/rtl_random.c b/math/slalib/rtl_random.c new file mode 100644 index 00000000..a8730c0c --- /dev/null +++ b/math/slalib/rtl_random.c @@ -0,0 +1,33 @@ +#include + +float +random_ ( int *iseed ) +/* +** - - - - - - - +** r a n d o m +** - - - - - - - +** +** Generate pseudo-random real number in the range 0 <= x < 1. +** +** (single precision) +** +** This function is designed to replace the Fortran->C interface routine +** random(3f) on systems which do not have this library (for example Linux) +** +** Fortran call: X = RANDOM(ISEED) +** +** Given: +** iseed int seed value +** +** If iseed !=0 random-number generator is initialised and first number +** is returned. +** iseed == 0 next number in the sequence is returned +** +** B.K.McIlwrath Starlink 12 January 1996 +*/ +{ + if( *iseed != 0 ) + srand(*iseed); + + return (float) rand() / (float) RAND_MAX; +} diff --git a/math/slalib/rverot.f b/math/slalib/rverot.f new file mode 100644 index 00000000..3fc5ab50 --- /dev/null +++ b/math/slalib/rverot.f @@ -0,0 +1,66 @@ + REAL FUNCTION slRVER (PHI, RA, DA, ST) +*+ +* - - - - - - - +* R V E R +* - - - - - - - +* +* Velocity component in a given direction due to Earth rotation +* (single precision) +* +* Given: +* PHI real latitude of observing station (geodetic) +* RA,DA real apparent RA,DEC +* ST real local apparent sidereal time +* +* PHI, RA, DEC and ST are all in radians. +* +* Result: +* Component of Earth rotation in direction RA,DA (km/s) +* +* Sign convention: +* The result is +ve when the observatory is receding from the +* given point on the sky. +* +* Accuracy: +* The simple algorithm used assumes a spherical Earth, of +* a radius chosen to give results accurate to about 0.0005 km/s +* for observing stations at typical latitudes and heights. For +* applications requiring greater precision, use the routine +* slPVOB. +* +* P.T.Wallace Starlink 20 July 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL PHI,RA,DA,ST + +* Nominal mean sidereal speed of Earth equator in km/s (the actual +* value is about 0.4651) + REAL ESPEED + PARAMETER (ESPEED=0.4655) + + + slRVER=ESPEED*COS(PHI)*SIN(ST-RA)*COS(DA) + + END diff --git a/math/slalib/rvgalc.f b/math/slalib/rvgalc.f new file mode 100644 index 00000000..173c7d92 --- /dev/null +++ b/math/slalib/rvgalc.f @@ -0,0 +1,87 @@ + REAL FUNCTION slRVGA (R2000, D2000) +*+ +* - - - - - - - +* R V G A +* - - - - - - - +* +* Velocity component in a given direction due to the rotation +* of the Galaxy (single precision) +* +* Given: +* R2000,D2000 real J2000.0 mean RA,Dec (radians) +* +* Result: +* Component of dynamical LSR motion in direction R2000,D2000 (km/s) +* +* Sign convention: +* The result is +ve when the dynamical LSR is receding from the +* given point on the sky. +* +* Note: The Local Standard of Rest used here is a point in the +* vicinity of the Sun which is in a circular orbit around +* the Galactic centre. Sometimes called the "dynamical" LSR, +* it is not to be confused with a "kinematical" LSR, which +* is the mean standard of rest of star catalogues or stellar +* populations. +* +* Reference: The orbital speed of 220 km/s used here comes from +* Kerr & Lynden-Bell (1986), MNRAS, 221, p1023. +* +* Called: +* slCS2C, slVDV +* +* P.T.Wallace Starlink 23 March 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL R2000,D2000 + + REAL VA(3), VB(3) + + REAL slVDV + +* +* LSR velocity due to Galactic rotation +* +* Speed = 220 km/s +* Apex = L2,B2 90deg, 0deg +* = RA,Dec 21 12 01.1 +48 19 47 J2000.0 +* +* This is expressed in the form of a J2000.0 x,y,z vector: +* +* VA(1) = X = -SPEED*COS(RA)*COS(DEC) +* VA(2) = Y = -SPEED*SIN(RA)*COS(DEC) +* VA(3) = Z = -SPEED*SIN(DEC) + + DATA VA / -108.70408, +97.86251, -164.33610 / + + + +* Convert given J2000 RA,Dec to x,y,z + CALL slCS2C(R2000,D2000,VB) + +* Compute dot product with LSR motion vector + slRVGA=slVDV(VA,VB) + + END diff --git a/math/slalib/rvlg.f b/math/slalib/rvlg.f new file mode 100644 index 00000000..cc3076e6 --- /dev/null +++ b/math/slalib/rvlg.f @@ -0,0 +1,82 @@ + REAL FUNCTION slRVLG (R2000, D2000) +*+ +* - - - - - +* R V L G +* - - - - - +* +* Velocity component in a given direction due to the combination +* of the rotation of the Galaxy and the motion of the Galaxy +* relative to the mean motion of the local group (single precision) +* +* Given: +* R2000,D2000 real J2000.0 mean RA,Dec (radians) +* +* Result: +* Component of SOLAR motion in direction R2000,D2000 (km/s) +* +* Sign convention: +* The result is +ve when the Sun is receding from the +* given point on the sky. +* +* Reference: +* IAU Trans 1976, 168, p201. +* +* Called: +* slCS2C, slVDV +* +* P.T.Wallace Starlink June 1985 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL R2000,D2000 + + REAL VA(3), VB(3) + + REAL slVDV + +* +* Solar velocity due to Galactic rotation and translation +* +* Speed = 300 km/s +* +* Apex = L2,B2 90deg, 0deg +* = RA,Dec 21 12 01.1 +48 19 47 J2000.0 +* +* This is expressed in the form of a J2000.0 x,y,z vector: +* +* VA(1) = X = -SPEED*COS(RA)*COS(DEC) +* VA(2) = Y = -SPEED*SIN(RA)*COS(DEC) +* VA(3) = Z = -SPEED*SIN(DEC) + + DATA VA / -148.23284, +133.44888, -224.09467 / + + + +* Convert given J2000 RA,Dec to x,y,z + CALL slCS2C(R2000,D2000,VB) + +* Compute dot product with Solar motion vector + slRVLG=slVDV(VA,VB) + + END diff --git a/math/slalib/rvlsrd.f b/math/slalib/rvlsrd.f new file mode 100644 index 00000000..720d6c9c --- /dev/null +++ b/math/slalib/rvlsrd.f @@ -0,0 +1,96 @@ + REAL FUNCTION slRVLD (R2000, D2000) +*+ +* - - - - - - - +* R V L D +* - - - - - - - +* +* Velocity component in a given direction due to the Sun's motion +* with respect to the dynamical Local Standard of Rest. +* +* (single precision) +* +* Given: +* R2000,D2000 r J2000.0 mean RA,Dec (radians) +* +* Result: +* Component of "peculiar" solar motion in direction R2000,D2000 (km/s) +* +* Sign convention: +* The result is +ve when the Sun is receding from the given point on +* the sky. +* +* Note: The Local Standard of Rest used here is the "dynamical" LSR, +* a point in the vicinity of the Sun which is in a circular +* orbit around the Galactic centre. The Sun's motion with +* respect to the dynamical LSR is called the "peculiar" solar +* motion. +* +* There is another type of LSR, called a "kinematical" LSR. A +* kinematical LSR is the mean standard of rest of specified star +* catalogues or stellar populations, and several slightly +* different kinematical LSRs are in use. The Sun's motion with +* respect to an agreed kinematical LSR is known as the "standard" +* solar motion. To obtain a radial velocity correction with +* respect to an adopted kinematical LSR use the routine slRVLK. +* +* Reference: Delhaye (1965), in "Stars and Stellar Systems", vol 5, +* p73. +* +* Called: +* slCS2C, slVDV +* +* P.T.Wallace Starlink 9 March 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL R2000,D2000 + + REAL VA(3), VB(3) + + REAL slVDV + +* +* Peculiar solar motion from Delhaye 1965: in Galactic Cartesian +* coordinates (+9,+12,+7) km/s. This corresponds to about 16.6 km/s +* towards Galactic coordinates L2 = 53 deg, B2 = +25 deg, or RA,Dec +* 17 49 58.7 +28 07 04 J2000. +* +* The solar motion is expressed here in the form of a J2000.0 +* equatorial Cartesian vector: +* +* VA(1) = X = -SPEED*COS(RA)*COS(DEC) +* VA(2) = Y = -SPEED*SIN(RA)*COS(DEC) +* VA(3) = Z = -SPEED*SIN(DEC) + + DATA VA / +0.63823, +14.58542, -7.80116 / + + + +* Convert given J2000 RA,Dec to x,y,z + CALL slCS2C(R2000,D2000,VB) + +* Compute dot product with solar motion vector + slRVLD=slVDV(VA,VB) + + END diff --git a/math/slalib/rvlsrk.f b/math/slalib/rvlsrk.f new file mode 100644 index 00000000..52b3db95 --- /dev/null +++ b/math/slalib/rvlsrk.f @@ -0,0 +1,95 @@ + REAL FUNCTION slRVLK (R2000, D2000) +*+ +* - - - - - - - +* R V L K +* - - - - - - - +* +* Velocity component in a given direction due to the Sun's motion +* with respect to an adopted kinematic Local Standard of Rest. +* +* (single precision) +* +* Given: +* R2000,D2000 r J2000.0 mean RA,Dec (radians) +* +* Result: +* Component of "standard" solar motion in direction R2000,D2000 (km/s) +* +* Sign convention: +* The result is +ve when the Sun is receding from the given point on +* the sky. +* +* Note: The Local Standard of Rest used here is one of several +* "kinematical" LSRs in common use. A kinematical LSR is the +* mean standard of rest of specified star catalogues or stellar +* populations. The Sun's motion with respect to a kinematical +* LSR is known as the "standard" solar motion. +* +* There is another sort of LSR, the "dynamical" LSR, which is a +* point in the vicinity of the Sun which is in a circular orbit +* around the Galactic centre. The Sun's motion with respect to +* the dynamical LSR is called the "peculiar" solar motion. To +* obtain a radial velocity correction with respect to the +* dynamical LSR use the routine slRVLD. +* +* Reference: Delhaye (1965), in "Stars and Stellar Systems", vol 5, +* p73. +* +* Called: +* slCS2C, slVDV +* +* P.T.Wallace Starlink 11 March 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL R2000,D2000 + + REAL VA(3), VB(3) + + REAL slVDV + +* +* Standard solar motion (from Methods of Experimental Physics, ed Meeks, +* vol 12, part C, sec 6.1.5.2, p281): +* +* 20 km/s towards RA 18h Dec +30d (1900). +* +* The solar motion is expressed here in the form of a J2000.0 +* equatorial Cartesian vector: +* +* VA(1) = X = -SPEED*COS(RA)*COS(DEC) +* VA(2) = Y = -SPEED*SIN(RA)*COS(DEC) +* VA(3) = Z = -SPEED*SIN(DEC) + + DATA VA / -0.29000, +17.31726, -10.00141 / + + + +* Convert given J2000 RA,Dec to x,y,z + CALL slCS2C(R2000,D2000,VB) + +* Compute dot product with solar motion vector + slRVLK=slVDV(VA,VB) + + END diff --git a/math/slalib/s2tp.f b/math/slalib/s2tp.f new file mode 100644 index 00000000..ca187db2 --- /dev/null +++ b/math/slalib/s2tp.f @@ -0,0 +1,85 @@ + SUBROUTINE slS2TP (RA, DEC, RAZ, DECZ, XI, ETA, J) +*+ +* - - - - - +* S 2 T P +* - - - - - +* +* Projection of spherical coordinates onto tangent plane: +* "gnomonic" projection - "standard coordinates" +* (single precision) +* +* Given: +* RA,DEC real spherical coordinates of point to be projected +* RAZ,DECZ real spherical coordinates of tangent point +* +* Returned: +* XI,ETA real rectangular coordinates on tangent plane +* J int status: 0 = OK, star on tangent plane +* 1 = error, star too far from axis +* 2 = error, antistar on tangent plane +* 3 = error, antistar too far from axis +* +* P.T.Wallace Starlink 18 July 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL RA,DEC,RAZ,DECZ,XI,ETA + INTEGER J + + REAL SDECZ,SDEC,CDECZ,CDEC,RADIF,SRADIF,CRADIF,DENOM + + REAL TINY + PARAMETER (TINY=1E-6) + + +* Trig functions + SDECZ=SIN(DECZ) + SDEC=SIN(DEC) + CDECZ=COS(DECZ) + CDEC=COS(DEC) + RADIF=RA-RAZ + SRADIF=SIN(RADIF) + CRADIF=COS(RADIF) + +* Reciprocal of star vector length to tangent plane + DENOM=SDEC*SDECZ+CDEC*CDECZ*CRADIF + +* Handle vectors too far from axis + IF (DENOM.GT.TINY) THEN + J=0 + ELSE IF (DENOM.GE.0.0) THEN + J=1 + DENOM=TINY + ELSE IF (DENOM.GT.-TINY) THEN + J=2 + DENOM=-TINY + ELSE + J=3 + END IF + +* Compute tangent plane coordinates (even in dubious cases) + XI=CDEC*SRADIF/DENOM + ETA=(SDEC*CDECZ-CDEC*SDECZ*CRADIF)/DENOM + + END diff --git a/math/slalib/sedscript b/math/slalib/sedscript new file mode 100755 index 00000000..046d7e1d --- /dev/null +++ b/math/slalib/sedscript @@ -0,0 +1,17 @@ +#!/bin/csh + +# SEDSCRIPT -- Script for editing/renaming the SLALIB FORTRAN routines + +# Make the appropriate name changes and add IRAF copyright +foreach file (*.f) + echo $file + sed -f SED1 $file > tempfile.f + rm $file + mv tempfile.f $file + sed -f SED2 $file > tempfile.f + rm $file + mv tempfile.f $file +end + +# Restore IRAF version of the preces.f file from a save version. +cp precss.f.sav precss.f diff --git a/math/slalib/sep.f b/math/slalib/sep.f new file mode 100644 index 00000000..100de493 --- /dev/null +++ b/math/slalib/sep.f @@ -0,0 +1,56 @@ + REAL FUNCTION slSEP (A1, B1, A2, B2) +*+ +* - - - - +* S E P +* - - - - +* +* Angle between two points on a sphere. +* +* (single precision) +* +* Given: +* A1,B1 r spherical coordinates of one point +* A2,B2 r spherical coordinates of the other point +* +* (The spherical coordinates are [RA,Dec], [Long,Lat] etc, in radians.) +* +* The result is the angle, in radians, between the two points. It +* is always positive. +* +* Called: slDSEP +* +* Last revision: 7 May 2000 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL A1,B1,A2,B2 + + DOUBLE PRECISION slDSEP + + + +* Use double precision version. + slSEP = REAL(slDSEP(DBLE(A1),DBLE(B1),DBLE(A2),DBLE(B2))) + + END diff --git a/math/slalib/sepv.f b/math/slalib/sepv.f new file mode 100644 index 00000000..c1c867ce --- /dev/null +++ b/math/slalib/sepv.f @@ -0,0 +1,71 @@ + REAL FUNCTION slSEPV (V1, V2) +*+ +* - - - - - +* S E P V +* - - - - - +* +* Angle between two vectors. +* +* (single precision) +* +* Given: +* V1 r(3) first vector +* V2 r(3) second vector +* +* The result is the angle, in radians, between the two vectors. It +* is always positive. +* +* Notes: +* +* 1 There is no requirement for the vectors to be unit length. +* +* 2 If either vector is null, zero is returned. +* +* 3 The simplest formulation would use dot product alone. However, +* this would reduce the accuracy for angles near zero and pi. The +* algorithm uses both cross product and dot product, which maintains +* accuracy for all sizes of angle. +* +* Called: slDSEPV +* +* Last revision: 7 May 2000 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL V1(3),V2(3) + + INTEGER I + DOUBLE PRECISION DV1(3),DV2(3) + DOUBLE PRECISION slDSEPV + + + +* Use double precision version. + DO I=1,3 + DV1(I) = DBLE(V1(I)) + DV2(I) = DBLE(V2(I)) + END DO + slSEPV = REAL(slDSEPV(DV1,DV2)) + + END diff --git a/math/slalib/sla.c b/math/slalib/sla.c new file mode 100644 index 00000000..10bfde3c --- /dev/null +++ b/math/slalib/sla.c @@ -0,0 +1,2338 @@ +/* +* Name: +* sla.c + +* Purpose: +* Implement a C interface to the Fortran SLALIB library. + +* Description: +* This file implements a C interface to the Fortran version of the +* SLALIB library. + +* Notes: +* This interface only supports a subset of the functions provided by +* SLALIB. It should be extended as and when necessary. + +* Copyright: +* Copyright (C) 1996-2006 Council for the Central Laboratory of the +* Research Councils. Copyright (C) 2007-2008 Science and Technology +* Facilities Council. All Rights Reserved. + +* Licence: +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public Licence as +* published by the Free Software Foundation; either version 2 of +* the Licence, or (at your option) any later version. +* +* This program is distributed in the hope that it will be +* useful,but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public Licence for more details. +* +* You should have received a copy of the GNU General Public Licence +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street,Fifth Floor, Boston, MA +* 02110-1301, USA + +* Authors: +* RFWS: R.F. Warren-Smith (STARLINK) +* DSB: David S. Berry (STARLINK) +* TIMJ: Tim Jenness (JAC, Hawaii) +* PWD: Peter W. Draper (Durham University) + +* History: +* 12-NOV-1996 (RFWS): +* Original version. +* 28-APR-1997 (RFWS): +* Added SLA_DJCAL. +* 26-SEP-1997 (DSB): +* Added SLA_DD2TF, SLA_DJCL. +* 21-JUN-2001 (DSB): +* Added SLA_DBEAR, SLA_DVDV. +* 23-AUG-2001 (DSB): +* Added SLA_SVD and SLA_SVDSOL +* 11-NOV-2002 (DSB): +* Added SLA_RVEROT, SLA_GMST, SLA_EQEQX, SLA_RVLSRK, SLA_RVLSRD, +* SLA_RVLG, SLA_RVGALC. +* 11-JUN-2003 (DSB): +* Added SLA_GEOC, SLA_HFK5Z and SLA_FK5HZ. +* 2-DEC-2004 (DSB): +* Added SLA_DEULER. +* 29-SEP-2005 (DSB): +* Added SLA_DE2H and SLA_DH2E +* 12-JUN-2006 (DSB): +* Moved from AST to SLALIB. +* 25-JUN-2006 (TIMJ): +* Add SLA_AIRMAS. +* 07-AUG-2006 (TIMJ): +* Import cnfImprt from CNF. +* Add SLA_OBS +* 08-AUG-2006 (TIMJ): +* Add SLA_PA +* 12-DEC-2006 (TIMJ): +* Add SLA_DTT and SLA_DAT +* 21-DEC-2006 (TIMJ): +* Add SLA_RDPLAN +* 03-APR-2007 (TIMJ): +* Add SLA_DR2TF +* 14-DEC-2007 (TIMJ): +* Add slaDafin, Add slaMap +* 12-MAR-2008 (TIMJ): +* Add slaOap, slaDr2af, slaAmp, slaPertel, slaPlanet, slaCldj +* to enable elements test. +* 14-JUL-2008 (TIMJ): +* Allowed to use const. +* 30-JUL-2008 (TIMJ): +* Add slaDs2tp +* 10-FEB-2012 (DSB): +* Added slaPvobs +*- +*/ + +/* Header files. */ +/* ============= */ +#include "f77.h" /* FORTRAN <-> C interface macros (SUN/209) */ +#include "slalib.h" /* Prototypes for C SLALIB functions */ +#include /* Malloc etc */ +#include /* string manipulation */ + + +/* Functions needed to avoid a dependence on CNF. */ +/* ============================================== */ + +static void slaStringExport( const char *source_c, char *dest_f, int dest_len ) { +/* +*+ +* Name: +* slaStringExport + +* Purpose: +* Export a C string to a FORTRAN string. + +* Type: +* Protected function. + +* Synopsis: +* void slaStringExport( const char *source_c, char *dest_f, int dest_len ) + +* Description: +* This function creates a FORTRAN string from a C string, storing +* it in the supplied memory. If the C string is shorter than the +* space allocated for the FORTRAN string, then it is padded with +* blanks. If the C string is longer than the space allocated for +* the FORTRAN string, then the string is truncated. + +* Parameters: +* source_c +* A pointer to the input C string. +* dest_f +* A pointer to the output FORTRAN string. +* dest_len +* The length of the output FORTRAN string. + +* Notes: +* - This function is potentially platform-specific. For example, +* if FORTRAN strings were passed by descriptor, then the +* descriptor address would be passed as "dest_f" and this must +* then be used to locate the actual FORTRAN character data. +* - This function is equivalent to cnfExprt but is included here to +* avoid SLALIB becoming dependent on CNF. +*- +*/ + +/* Local Variables:*/ + int i; /* Loop counter for characters */ + +/* Check the supplied pointers. */ + if ( !source_c || !dest_f ) return; + +/* Copy the characters of the input C string to the output FORTRAN + string, taking care not to go beyond the end of the FORTRAN + string.*/ + for ( i = 0; source_c[ i ] && ( i < dest_len ); i++ ) { + dest_f[ i ] = source_c[ i ]; + } + +/* Fill the rest of the output FORTRAN string with blanks. */ + for ( ; i < dest_len; i++ ) dest_f[ i ] = ' '; +} + +static void slaStringImport( const char *source_f, int source_len, char *dest_c ) + +/* +*+ +* Name: +* slaStringImportt + +* Purpose: +* Import a FORTRAN string into a C string + +* Type: +* Protected function. + +* Language: +* ANSI C + +* Invocation: +* slaStringImport( source_f, source_len, dest_c ) + +* Description: +* Import a FORTRAN string into a C string, discarding trailing +* blanks. The NUL character is appended to the C string after +* the last non-blank character. The input string and output string +* pointers can point to the same location if the string is to be +* modified in place (but care must be taken to allow for the additional +* C terminator when allocating memory). + +* Arguments: +* const char *source_f (Given) +* A pointer to the input FORTRAN string +* int source_len (Given) +* The length of the input FORTRAN string +* char *dest_c (Returned via pointer) +* A pointer to the output C string. Can be same as source. + +* Notes: +* - No check is made that there is sufficient space allocated to +* the C string to hold the FORTRAN string and a terminating null. +* It is responsibility of the programmer to check this. +* - This function is equivalent to cnfImprt but is included here to +* avoid SLALIB becoming dependent on CNF. + +* Authors: +* PMA: Peter Allan (Starlink, RAL) +* AJC: Alan Chipperfield (Starlink, RAL) +* TIMJ: Tim Jenness (JAC, Hawaii) +* {enter_new_authors_here} + +* History: +* 27-MAR-1991 (PMA): +* Original version. +* 22-MAY-1996 (AJC): +* Correct description re trailing blanks +* 24-SEP-1998 (AJC): +* Specify const char * for input strings +* 25-NOV-2005 (TIMJ): +* Allow the strings to be identical +* {enter_changes_here} + +*- + +*...........................................................................*/ + +{ +/* Local Variables: */ + + int i; /* Loop counter */ + + +/* Find the last non blank character in the input FORTRAN string. */ + + for( i = source_len - 1 ; ( i >= 0 ) && ( source_f[i] == ' ' ) ; i-- ) + ; + +/* Put a null character at the end of the output C string. */ + + dest_c[i+1] = '\0'; + +/* Copy the characters from the input FORTRAN string to the output C */ +/* string if the strings are different. */ + + if (dest_c != source_f ) { + memmove( dest_c, source_f, (size_t)i+1 ); + } +} + +/* Allocate string buffer dynamically. Taken from cnfCref. + See cnfCref for more details. +*/ + +static F77_CHARACTER_ARG_TYPE *slaStringCreate( int length ) { + /* Local Variables: */ + F77_CHARACTER_ARG_TYPE *ptr; /* A pointer to the string allocated */ + +/* Allocate the space. */ + ptr = (F77_CHARACTER_ARG_TYPE *) + malloc( (size_t)( ( length > 0 ) ? length : 1 ) ); + +/* Check for malloc returning a null value. If it does not, set the string */ +/* to the null character. */ + if ( ptr != 0 ) { + ptr[0] = '\0'; + } + + return( ptr ); +} + +/* Free space allocate by slaStringCreate. Take from cnfFreef */ + +static void slaStringFree ( F77_CHARACTER_ARG_TYPE * temp ) { + free( temp ); +} + + +/* SLALIB wrapper implementations. */ +/* =============================== */ +/* Fortran routine prototype. */ +F77_SUBROUTINE(sla_addet)( DOUBLE(RM), + DOUBLE(DM), + DOUBLE(EQ), + DOUBLE(RC), + DOUBLE(DC) ); + +/* C interface implementation. */ +void slaAddet ( double rm, double dm, double eq, double *rc, double *dc ) { + DECLARE_DOUBLE(RM); + DECLARE_DOUBLE(DM); + DECLARE_DOUBLE(EQ); + DECLARE_DOUBLE(RC); + DECLARE_DOUBLE(DC); + RM = rm; + DM = dm; + EQ = eq; + F77_LOCK( F77_CALL(sla_addet)( DOUBLE_ARG(&RM), + DOUBLE_ARG(&DM), + DOUBLE_ARG(&EQ), + DOUBLE_ARG(&RC), + DOUBLE_ARG(&DC) ); ) + *rc = RC; + *dc = DC; +} + +/* etc... */ +F77_SUBROUTINE(sla_ampqk)( DOUBLE(RA), + DOUBLE(DA), + DOUBLE_ARRAY(AMPRMS), + DOUBLE(RM), + DOUBLE(DM) ); + +void slaAmpqk ( double ra, double da, double amprms[21], + double *rm, double *dm ) { + DECLARE_DOUBLE(RA); + DECLARE_DOUBLE(DA); + DECLARE_DOUBLE_ARRAY(AMPRMS,21); + DECLARE_DOUBLE(RM); + DECLARE_DOUBLE(DM); + int i; + RA = ra; + DA = da; + for ( i = 0; i < 21; i++ ) AMPRMS[ i ] = amprms[ i ]; + F77_LOCK( F77_CALL(sla_ampqk)( DOUBLE_ARG(&RA), + DOUBLE_ARG(&DA), + DOUBLE_ARRAY_ARG(AMPRMS), + DOUBLE_ARG(&RM), + DOUBLE_ARG(&DM) ); ) + *rm = RM; + *dm = DM; +} + +F77_DOUBLE_FUNCTION(sla_airmas)( DOUBLE(ZD) ); + +double slaAirmas( double zd ) { + DECLARE_DOUBLE(ZD); + double result; + ZD = zd; + F77_LOCK( result = F77_CALL(sla_airmas)( DOUBLE_ARG(&ZD) ); ) + return result; +} + +F77_SUBROUTINE(sla_caldj)( INTEGER(IY), + INTEGER(IM), + INTEGER(ID), + DOUBLE(DJM), + INTEGER(J) ); + +void slaCaldj ( int iy, int im, int id, double *djm, int *j ) { + DECLARE_INTEGER(IY); + DECLARE_INTEGER(IM); + DECLARE_INTEGER(ID); + DECLARE_DOUBLE(DJM); + DECLARE_INTEGER(J); + IY = iy; + IM = im; + ID = id; + F77_LOCK( F77_CALL(sla_caldj)( INTEGER_ARG(&IY), + INTEGER_ARG(&IM), + INTEGER_ARG(&ID), + DOUBLE_ARG(&DJM), + INTEGER_ARG(&J) ); ) + *djm = DJM; + *j = J; +} + +F77_SUBROUTINE(sla_daf2r)( INTEGER(IDEG), + INTEGER(IAMIN), + DOUBLE(ASEC), + DOUBLE(RAD), + INTEGER(J) ); + +void slaDaf2r ( int ideg, int iamin, double asec, double *rad, int *j ) { + DECLARE_INTEGER(IDEG); + DECLARE_INTEGER(IAMIN); + DECLARE_DOUBLE(ASEC); + DECLARE_DOUBLE(RAD); + DECLARE_INTEGER(J); + IDEG = ideg; + IAMIN = iamin; + ASEC = asec; + F77_LOCK( F77_CALL(sla_daf2r)( INTEGER_ARG(&IDEG), + INTEGER_ARG(&IAMIN), + DOUBLE_ARG(&ASEC), + DOUBLE_ARG(&RAD), + INTEGER_ARG(&J) ); ) + *rad = RAD; + *j = J; +} + +F77_SUBROUTINE(sla_dav2m)( DOUBLE_ARRAY(AXVEC), + DOUBLE_ARRAY(RMAT) ); + +void slaDav2m ( double axvec[3], double rmat[3][3] ) { + DECLARE_DOUBLE_ARRAY(AXVEC,3); + DECLARE_DOUBLE_ARRAY(RMAT,9); + int i; + int j; + for ( i = 0; i < 3; i++ ) AXVEC[ i ] = axvec[ i ]; + F77_LOCK( F77_CALL(sla_dav2m)( DOUBLE_ARRAY_ARG(AXVEC), + DOUBLE_ARRAY_ARG(RMAT) ); ) + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) rmat[ i ][ j ] = RMAT[ i + 3 * j ]; + } +} + +F77_SUBROUTINE(sla_dcc2s)( DOUBLE_ARRAY(V), + DOUBLE(A), + DOUBLE(B) ); + +void slaDcc2s ( double v[3], double *a, double *b ) { + DECLARE_DOUBLE_ARRAY(V,3); + DECLARE_DOUBLE(A); + DECLARE_DOUBLE(B); + int i; + for ( i = 0; i < 3; i++ ) V[ i ] = v[ i ]; + F77_LOCK( F77_CALL(sla_dcc2s)( DOUBLE_ARRAY_ARG(V), + DOUBLE_ARG(&A), + DOUBLE_ARG(&B) ); ) + *a = A; + *b = B; +} + +F77_SUBROUTINE(sla_dcs2c)( DOUBLE(A), + DOUBLE(B), + DOUBLE_ARRAY(V) ); + +void slaDcs2c ( double a, double b, double v[3] ) { + DECLARE_DOUBLE(A); + DECLARE_DOUBLE(B); + DECLARE_DOUBLE_ARRAY(V,3); + int i; + A = a; + B = b; + F77_LOCK( F77_CALL(sla_dcs2c)( DOUBLE_ARG(&A), + DOUBLE_ARG(&B), + DOUBLE_ARRAY_ARG(V) ); ) + for ( i = 0; i < 3; i++ ) v[ i ] = V[ i ]; +} + +F77_SUBROUTINE(sla_dd2tf)( INTEGER(NDP), + DOUBLE(DAYS), + CHARACTER(SIGN), + INTEGER_ARRAY(IHMSF) + TRAIL(SIGN) ); + +void slaDd2tf ( int ndp, double days, char *sign, int ihmsf[4] ) { + DECLARE_INTEGER(NDP); + DECLARE_DOUBLE(DAYS); + DECLARE_CHARACTER(SIGN,2); + DECLARE_INTEGER_ARRAY(IHMSF,4); + int i; + + NDP = ndp; + DAYS = days; + F77_LOCK( F77_CALL(sla_dd2tf)( INTEGER_ARG(&NDP), + DOUBLE_ARG(&DAYS), + CHARACTER_ARG(SIGN), + INTEGER_ARRAY_ARG(IHMSF) + TRAIL_ARG(SIGN) ); ) + sign[0] = SIGN[0]; + sign[1] = 0; + for ( i = 0; i < 4; i++ ) ihmsf[ i ] = IHMSF[ i ]; +} + +F77_SUBROUTINE(sla_dr2tf)( INTEGER(NDP), + DOUBLE(ANGLE), + CHARACTER(SIGN), + INTEGER_ARRAY(IHMSF) + TRAIL(SIGN) ); + +void +slaDr2tf( int ndp, double angle, char * sign, int ihmsf[4] ) { + DECLARE_INTEGER(NDP); + DECLARE_DOUBLE(ANGLE); + DECLARE_CHARACTER(SIGN,2); + DECLARE_INTEGER_ARRAY(IHMSF,4); + int i; + + NDP = ndp; + ANGLE = angle; + F77_LOCK( F77_CALL(sla_dr2tf)( INTEGER_ARG(&NDP), + DOUBLE_ARG(&ANGLE), + CHARACTER_ARG(SIGN), + INTEGER_ARRAY_ARG(IHMSF) + TRAIL_ARG(SIGN) ); ) + sign[0] = SIGN[0]; + sign[1] = 0; + for ( i = 0; i < 4; i++ ) ihmsf[ i ] = IHMSF[ i ]; +} + +F77_SUBROUTINE(sla_dr2af)( INTEGER(NDP), + DOUBLE(ANGLE), + CHARACTER(SIGN), + INTEGER_ARRAY(IDMSF) + TRAIL(SIGN) ); + +void +slaDr2af( int ndp, double angle, char * sign, int idmsf[4] ) { + DECLARE_INTEGER(NDP); + DECLARE_DOUBLE(ANGLE); + DECLARE_CHARACTER(SIGN,2); + DECLARE_INTEGER_ARRAY(IDMSF,4); + int i; + + NDP = ndp; + ANGLE = angle; + F77_LOCK( F77_CALL(sla_dr2af)( INTEGER_ARG(&NDP), + DOUBLE_ARG(&ANGLE), + CHARACTER_ARG(SIGN), + INTEGER_ARRAY_ARG(IDMSF) + TRAIL_ARG(SIGN) ); ) + sign[0] = SIGN[0]; + sign[1] = 0; + for ( i = 0; i < 4; i++ ) idmsf[ i ] = IDMSF[ i ]; +} + +F77_SUBROUTINE(sla_dimxv)( DOUBLE_ARRAY(DM), + DOUBLE_ARRAY(VA), + DOUBLE_ARRAY(VB) ); + +void slaDimxv ( double dm[3][3], double va[3], double vb[3] ) { + DECLARE_DOUBLE_ARRAY(DM,9); + DECLARE_DOUBLE_ARRAY(VA,3); + DECLARE_DOUBLE_ARRAY(VB,3); + int i; + int j; + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) DM[ i + j * 3 ] = dm[ i ][ j ]; + VA[ i ] = va[ i ]; + } + F77_LOCK( F77_CALL(sla_dimxv)( DOUBLE_ARRAY_ARG(DM), + DOUBLE_ARRAY_ARG(VA), + DOUBLE_ARRAY_ARG(VB) ); ) + for ( i = 0; i < 3; i++ ) vb[ i ] = VB[ i ]; +} + +F77_SUBROUTINE(sla_djcal)( INTEGER(NDP), + DOUBLE(DJM), + INTEGER_ARRAY(IYMDF), + INTEGER(J) ); + +void slaDjcal ( int ndp, double djm, int iymdf[ 4 ], int *j ) { + DECLARE_INTEGER(NDP); + DECLARE_DOUBLE(DJM); + DECLARE_INTEGER_ARRAY(IYMDF,4); + DECLARE_INTEGER(J); + int i; + + NDP = ndp; + DJM = djm; + F77_LOCK( F77_CALL(sla_djcal)( INTEGER_ARG(&NDP), + DOUBLE_ARG(&DJM), + INTEGER_ARRAY_ARG(IYMDF), + INTEGER_ARG(&J) ); ) + for ( i = 0; i < 4; i++ ) iymdf[ i ] = IYMDF[ i ]; + *j = J; +} + +F77_SUBROUTINE(sla_djcl)( DOUBLE(DJM), + INTEGER(IY), + INTEGER(IM), + INTEGER(ID), + DOUBLE(FD), + INTEGER(J) ); + +void slaDjcl ( double djm, int *iy, int *im, int *id, double *fd, int *j ) { + DECLARE_DOUBLE(DJM); + DECLARE_INTEGER(IY); + DECLARE_INTEGER(IM); + DECLARE_INTEGER(ID); + DECLARE_DOUBLE(FD); + DECLARE_INTEGER(J); + + DJM = djm; + F77_LOCK( F77_CALL(sla_djcl)( DOUBLE_ARG(&DJM), + INTEGER_ARG(&IY), + INTEGER_ARG(&IM), + INTEGER_ARG(&ID), + DOUBLE_ARG(&FD), + INTEGER_ARG(&J) ); ) + *iy = IY; + *im = IM; + *id = ID; + *fd = FD; + *j = J; +} + +F77_SUBROUTINE(sla_dmat)( INTEGER(N), + DOUBLE_ARRAY(A), + DOUBLE_ARRAY(Y), + DOUBLE(D), + INTEGER(JF), + INTEGER_ARRAY(IW) ); + +void slaDmat ( int n, double *a, double *y, double *d, int *jf, int *iw ) { + DECLARE_INTEGER(N); + F77_DOUBLE_TYPE *A; + F77_DOUBLE_TYPE *Y; + DECLARE_DOUBLE(D); + DECLARE_INTEGER(JF); + F77_INTEGER_TYPE *IW; + int i; + int j; + A = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) ( n * n ) ); + Y = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) n ); + if ( sizeof( F77_INTEGER_TYPE ) > sizeof( int ) ) { + IW = malloc( sizeof( F77_INTEGER_TYPE ) * (size_t) n ); + } else { + IW = (F77_INTEGER_TYPE *) iw; + } + if ( IW ) { + N = n; + for ( i = 0; i < n; i++ ) { + for ( j = 0; j < n; j++ ) A[ i + n * j ] = a[ n * i + j ]; + Y[ i ] = y[ i ]; + } + F77_LOCK( F77_CALL(sla_dmat)( INTEGER_ARG(&N), DOUBLE_ARRAY_ARG(A), + DOUBLE_ARRAY_ARG(Y), DOUBLE_ARG(&D), + INTEGER_ARG(&JF), INTEGER_ARG(IW) ); ) + for ( i = 0; i < n; i++ ) { + for ( j = 0; j < n; j++ ) a[ n * i + j ] = A[ i + n * j ]; + y[ i ] = Y[ i ]; + } + *d = D; + *jf = JF; + } + free( A ); + free( Y ); + if ( sizeof( F77_INTEGER_TYPE ) > sizeof( int ) ) free( IW ); +} + +F77_SUBROUTINE(sla_dmxm)( DOUBLE_ARRAY(A), + DOUBLE_ARRAY(B), + DOUBLE_ARRAY(C) ); + +void slaDmxm ( double a[3][3], double b[3][3], double c[3][3] ) { + DECLARE_DOUBLE_ARRAY(A,9); + DECLARE_DOUBLE_ARRAY(B,9); + DECLARE_DOUBLE_ARRAY(C,9); + int i; + int j; + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) { + A[ i + 3 * j ] = a[ i ][ j ]; + B[ i + 3 * j ] = b[ i ][ j ]; + } + } + F77_LOCK( F77_CALL(sla_dmxm)( DOUBLE_ARRAY_ARG(A), + DOUBLE_ARRAY_ARG(B), + DOUBLE_ARRAY_ARG(C) ); ) + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) c[ i ][ j ] = C[ i + 3 * j ]; + } +} + +F77_SUBROUTINE(sla_dmxv)( DOUBLE_ARRAY(DM), + DOUBLE_ARRAY(VA), + DOUBLE_ARRAY(VB) ); + +void slaDmxv ( double dm[3][3], double va[3], double vb[3] ) { + DECLARE_DOUBLE_ARRAY(DM,9); + DECLARE_DOUBLE_ARRAY(VA,3); + DECLARE_DOUBLE_ARRAY(VB,3); + int i; + int j; + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) DM[ i + 3 * j ] = dm[ i ][ j ]; + VA[ i ] = va[ i ]; + } + F77_LOCK( F77_CALL(sla_dmxv)( DOUBLE_ARRAY_ARG(DM), + DOUBLE_ARRAY_ARG(VA), + DOUBLE_ARRAY_ARG(VB) ); ) + for ( i = 0; i < 3; i++ ) vb[ i ] = VB[ i ]; +} + +F77_DOUBLE_FUNCTION(sla_dbear)( DOUBLE(A1), DOUBLE(B1), + DOUBLE(A2), DOUBLE(B2) ); + +double slaDbear ( double a1, double b1, double a2, double b2 ) { + DECLARE_DOUBLE(A1); + DECLARE_DOUBLE(B1); + DECLARE_DOUBLE(A2); + DECLARE_DOUBLE(B2); + double result; + A1 = a1; + B1 = b1; + A2 = a2; + B2 = b2; + F77_LOCK( result = F77_CALL(sla_dbear)( DOUBLE_ARG(&A1), DOUBLE_ARG(&B1), + DOUBLE_ARG(&A2), DOUBLE_ARG(&B2) ); ) + return result; +} + +F77_DOUBLE_FUNCTION(sla_drange)( DOUBLE(ANGLE) ); + +double slaDrange ( double angle ) { + DECLARE_DOUBLE(ANGLE); + double result; + ANGLE = angle; + F77_LOCK( result = F77_CALL(sla_drange)( DOUBLE_ARG(&ANGLE) ); ) + return result; +} + +F77_DOUBLE_FUNCTION(sla_dranrm)( DOUBLE(ANGLE) ); + +double slaDranrm ( double angle ) { + DECLARE_DOUBLE(ANGLE); + double result; + ANGLE = angle; + F77_LOCK( result = F77_CALL(sla_dranrm)( DOUBLE_ARG(&ANGLE) ); ) + return result; +} + +F77_DOUBLE_FUNCTION(sla_dsep)( DOUBLE(A1), + DOUBLE(B1), + DOUBLE(A2), + DOUBLE(B2) ); + +double slaDsep ( double a1, double b1, double a2, double b2 ) { + DECLARE_DOUBLE(A1); + DECLARE_DOUBLE(B1); + DECLARE_DOUBLE(A2); + DECLARE_DOUBLE(B2); + double result; + A1 = a1; + B1 = b1; + A2 = a2; + B2 = b2; + F77_LOCK( result = F77_CALL(sla_dsep)( DOUBLE_ARG(&A1), + DOUBLE_ARG(&B1), + DOUBLE_ARG(&A2), + DOUBLE_ARG(&B2) ); ) + return result; +} + +F77_SUBROUTINE(sla_ds2tp)( DOUBLE(RA), DOUBLE(DEC), + DOUBLE(RAZ), DOUBLE(DECZ), + DOUBLE(XI), DOUBLE(ETA), + INTEGER(J) ); + +void slaDs2tp ( double ra, double dec, double raz, double decz, double * xi, double * eta, int* j ) { + + DECLARE_DOUBLE(RA); + DECLARE_DOUBLE(DEC); + DECLARE_DOUBLE(RAZ); + DECLARE_DOUBLE(DECZ); + DECLARE_DOUBLE(XI); + DECLARE_DOUBLE(ETA); + DECLARE_INTEGER(J); + + F77_EXPORT_DOUBLE(ra, RA); + F77_EXPORT_DOUBLE(dec, DEC); + F77_EXPORT_DOUBLE(raz, RAZ); + F77_EXPORT_DOUBLE(decz, DECZ); + + F77_LOCK( F77_CALL(sla_ds2tp)( DOUBLE_ARG(&RA), + DOUBLE_ARG(&DEC), + DOUBLE_ARG(&RAZ), + DOUBLE_ARG(&DECZ), + DOUBLE_ARG(&XI), + DOUBLE_ARG(&ETA), + INTEGER_ARG(&J) ); ) + + F77_IMPORT_DOUBLE(XI, *xi); + F77_IMPORT_DOUBLE(ETA, *eta); + F77_IMPORT_DOUBLE(J, *j); + +} + +F77_DOUBLE_FUNCTION(sla_dvdv)( DOUBLE_ARRAY(VA), + DOUBLE_ARRAY(VB) ); + +double slaDvdv( double va[3], double vb[3] ) { + DECLARE_DOUBLE_ARRAY(VA,3); + DECLARE_DOUBLE_ARRAY(VB,3); + double result; + int i; + for ( i = 0; i < 3; i++ ) { + VA[ i ] = va[ i ]; + VB[ i ] = vb[ i ]; + } + F77_LOCK( result = F77_CALL(sla_dvdv)( DOUBLE_ARRAY_ARG(VA), + DOUBLE_ARRAY_ARG(VB) ); ) + return result; +} + +F77_SUBROUTINE(sla_dtf2d)( INTEGER(IHOUR), + INTEGER(IMIN), + DOUBLE(SEC), + DOUBLE(DAYS), + INTEGER(J) ); + +void slaDtf2d ( int ihour, int imin, double sec, double *days, int *j ) { + DECLARE_INTEGER(IHOUR); + DECLARE_INTEGER(IMIN); + DECLARE_DOUBLE(SEC); + DECLARE_DOUBLE(DAYS); + DECLARE_INTEGER(J); + IHOUR = ihour; + IMIN = imin; + SEC = sec; + F77_LOCK( F77_CALL(sla_dtf2d)( INTEGER_ARG(&IHOUR), + INTEGER_ARG(&IMIN), + DOUBLE_ARG(&SEC), + DOUBLE_ARG(&DAYS), + INTEGER_ARG(&J) ); ) + *days = DAYS; + *j = J; +} + +F77_SUBROUTINE(sla_dtf2r)( INTEGER(IHOUR), + INTEGER(IMIN), + DOUBLE(SEC), + DOUBLE(RAD), + INTEGER(J) ); + +void slaDtf2r ( int ihour, int imin, double sec, double *rad, int *j ) { + DECLARE_INTEGER(IHOUR); + DECLARE_INTEGER(IMIN); + DECLARE_DOUBLE(SEC); + DECLARE_DOUBLE(RAD); + DECLARE_INTEGER(J); + IHOUR = ihour; + IMIN = imin; + SEC = sec; + F77_LOCK( F77_CALL(sla_dtf2r)( INTEGER_ARG(&IHOUR), + INTEGER_ARG(&IMIN), + DOUBLE_ARG(&SEC), + DOUBLE_ARG(&RAD), + INTEGER_ARG(&J) ); ) + *rad = RAD; + *j = J; +} + +F77_DOUBLE_FUNCTION(sla_dt)( DOUBLE(EPOCH) ); + +double slaDt ( double epoch ) +{ + DECLARE_DOUBLE(EPOCH); + double result; + EPOCH = epoch; + F77_LOCK( result = F77_CALL(sla_dt)( DOUBLE_ARG(&EPOCH) ); ) + return result; +} + +F77_SUBROUTINE(sla_dvn)( DOUBLE_ARRAY(V), + DOUBLE_ARRAY(UV), + DOUBLE(VM) ); + +void slaDvn ( double v[3], double uv[3], double *vm ) { + DECLARE_DOUBLE_ARRAY(V,3); + DECLARE_DOUBLE_ARRAY(UV,3); + DECLARE_DOUBLE(VM); + int i; + for ( i = 0; i < 3; i++ ) V[ i ] = v[ i ]; + F77_LOCK( F77_CALL(sla_dvn)( DOUBLE_ARRAY_ARG(V), + DOUBLE_ARRAY_ARG(UV), + DOUBLE_ARG(&VM) ); ) + for ( i = 0; i < 3; i++ ) uv[ i ] = UV[ i ]; + *vm = VM; +} + +F77_SUBROUTINE(sla_dvxv)( DOUBLE_ARRAY(VA), + DOUBLE_ARRAY(VB), + DOUBLE_ARRAY(VC) ); + +void slaDvxv ( double va[3], double vb[3], double vc[3] ) { + DECLARE_DOUBLE_ARRAY(VA,3); + DECLARE_DOUBLE_ARRAY(VB,3); + DECLARE_DOUBLE_ARRAY(VC,3); + int i; + for ( i = 0; i < 3; i++ ) { + VA[ i ] = va[ i ]; + VB[ i ] = vb[ i ]; + } + F77_LOCK( F77_CALL(sla_dvxv)( DOUBLE_ARRAY_ARG(VA), + DOUBLE_ARRAY_ARG(VB), + DOUBLE_ARRAY_ARG(VC) ); ) + for ( i = 0; i < 3; i++ ) vc[ i ] = VC[ i ]; +} + +F77_SUBROUTINE(sla_ecmat)( DOUBLE(DATE), + DOUBLE_ARRAY(RMAT) ); + +void slaEcmat ( double date, double rmat[3][3] ) { + DECLARE_DOUBLE(DATE); + DECLARE_DOUBLE_ARRAY(RMAT,9); + int i; + int j; + DATE = date; + F77_LOCK( F77_CALL(sla_ecmat)( DOUBLE_ARG(&DATE), + DOUBLE_ARRAY_ARG(RMAT) ); ) + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) rmat[ i ][ j ] = RMAT[ i + 3 * j ]; + } +} + +F77_DOUBLE_FUNCTION(sla_epb)( DOUBLE(DATE) ); + +double slaEpb ( double date ) { + DECLARE_DOUBLE(DATE); + double result; + DATE = date; + F77_LOCK( result = F77_CALL(sla_epb)( DOUBLE_ARG(&DATE) ); ) + return result; +} + +F77_DOUBLE_FUNCTION(sla_epb2d)( DOUBLE(EPB) ); + +double slaEpb2d ( double epb ) { + DECLARE_DOUBLE(EPB); + double result; + EPB = epb; + F77_LOCK( result = F77_CALL(sla_epb2d)( DOUBLE_ARG(&EPB) ); ) + return result; +} + +F77_DOUBLE_FUNCTION(sla_epj)( DOUBLE(DATE) ); + +double slaEpj ( double date ) { + DECLARE_DOUBLE(DATE); + double result; + DATE = date; + F77_LOCK( result = F77_CALL(sla_epj)( DOUBLE_ARG(&DATE) ); ) + return result; +} + +F77_DOUBLE_FUNCTION(sla_epj2d)( DOUBLE(EPJ) ); + +double slaEpj2d ( double epj ) { + DECLARE_DOUBLE(EPJ); + double result; + EPJ = epj; + F77_LOCK( result = F77_CALL(sla_epj2d)( DOUBLE_ARG(&EPJ) ); ) + return result; +} + +F77_DOUBLE_FUNCTION(sla_eqeqx)( DOUBLE(DATE) ); + +double slaEqeqx ( double date ) { + DECLARE_DOUBLE(DATE); + double result; + DATE = date; + F77_LOCK( result = F77_CALL(sla_eqeqx)( DOUBLE_ARG(&DATE) ); ) + return result; +} + +F77_SUBROUTINE(sla_eqgal)( DOUBLE(DR), + DOUBLE(DD), + DOUBLE(DL), + DOUBLE(DB) ); + +void slaEqgal ( double dr, double dd, double *dl, double *db ) { + DECLARE_DOUBLE(DR); + DECLARE_DOUBLE(DD); + DECLARE_DOUBLE(DL); + DECLARE_DOUBLE(DB); + DR = dr; + DD = dd; + F77_LOCK( F77_CALL(sla_eqgal)( DOUBLE_ARG(&DR), + DOUBLE_ARG(&DD), + DOUBLE_ARG(&DL), + DOUBLE_ARG(&DB) ); ) + *dl = DL; + *db = DB; +} + +F77_SUBROUTINE(sla_fk45z)( DOUBLE(R1950), + DOUBLE(D1950), + DOUBLE(BEPOCH), + DOUBLE(R2000), + DOUBLE(D2000) ); + +void slaFk45z ( double r1950, double d1950, double bepoch, + double *r2000, double *d2000 ) { + DECLARE_DOUBLE(R1950); + DECLARE_DOUBLE(D1950); + DECLARE_DOUBLE(BEPOCH); + DECLARE_DOUBLE(R2000); + DECLARE_DOUBLE(D2000); + R1950 = r1950; + D1950 = d1950; + BEPOCH = bepoch; + F77_LOCK( F77_CALL(sla_fk45z)( DOUBLE_ARG(&R1950), + DOUBLE_ARG(&D1950), + DOUBLE_ARG(&BEPOCH), + DOUBLE_ARG(&R2000), + DOUBLE_ARG(&D2000) ); ) + *r2000 = R2000; + *d2000 = D2000; +} + +F77_SUBROUTINE(sla_fk54z)( DOUBLE(R2000), + DOUBLE(D2000), + DOUBLE(BEPOCH), + DOUBLE(R1950), + DOUBLE(D1950), + DOUBLE(DR1950), + DOUBLE(DD1950) ); + +void slaFk54z ( double r2000, double d2000, double bepoch, + double *r1950, double *d1950, + double *dr1950, double *dd1950 ) { + DECLARE_DOUBLE(R2000); + DECLARE_DOUBLE(D2000); + DECLARE_DOUBLE(BEPOCH); + DECLARE_DOUBLE(R1950); + DECLARE_DOUBLE(D1950); + DECLARE_DOUBLE(DR1950); + DECLARE_DOUBLE(DD1950); + R2000 = r2000; + D2000 = d2000; + BEPOCH = bepoch; + F77_LOCK( F77_CALL(sla_fk54z)( DOUBLE_ARG(&R2000), + DOUBLE_ARG(&D2000), + DOUBLE_ARG(&BEPOCH), + DOUBLE_ARG(&R1950), + DOUBLE_ARG(&D1950), + DOUBLE_ARG(&DR1950), + DOUBLE_ARG(&DD1950) ); ) + *r1950 = R1950; + *d1950 = D1950; + *dr1950 = DR1950; + *dd1950 = DD1950; +} + +F77_SUBROUTINE(sla_galeq)( DOUBLE(DL), + DOUBLE(DB), + DOUBLE(DR), + DOUBLE(DD) ); + +void slaGaleq ( double dl, double db, double *dr, double *dd ) { + DECLARE_DOUBLE(DL); + DECLARE_DOUBLE(DB); + DECLARE_DOUBLE(DR); + DECLARE_DOUBLE(DD); + DL = dl; + DB = db; + F77_LOCK( F77_CALL(sla_galeq)( DOUBLE_ARG(&DL), + DOUBLE_ARG(&DB), + DOUBLE_ARG(&DR), + DOUBLE_ARG(&DD) ); ) + *dr = DR; + *dd = DD; +} + +F77_SUBROUTINE(sla_galsup)( DOUBLE(DL), + DOUBLE(DB), + DOUBLE(DSL), + DOUBLE(DSB) ); + +void slaGalsup ( double dl, double db, double *dsl, double *dsb ) { + DECLARE_DOUBLE(DL); + DECLARE_DOUBLE(DB); + DECLARE_DOUBLE(DSL); + DECLARE_DOUBLE(DSB); + DL = dl; + DB = db; + F77_LOCK( F77_CALL(sla_galsup)( DOUBLE_ARG(&DL), + DOUBLE_ARG(&DB), + DOUBLE_ARG(&DSL), + DOUBLE_ARG(&DSB) ); ) + *dsl = DSL; + *dsb = DSB; +} + +F77_DOUBLE_FUNCTION(sla_gmst)( DOUBLE(UT1) ); + +double slaGmst ( double ut1 ) { + DECLARE_DOUBLE(UT1); + double result; + UT1 = ut1; + F77_LOCK( result = F77_CALL(sla_gmst)( DOUBLE_ARG(&UT1) ); ) + return result; +} + +F77_SUBROUTINE(sla_mappa)( DOUBLE(EQ), + DOUBLE(DATE), + DOUBLE_ARRAY(AMPRMS) ); + +void slaMappa ( double eq, double date, double amprms[21] ) { + DECLARE_DOUBLE(EQ); + DECLARE_DOUBLE(DATE); + DECLARE_DOUBLE_ARRAY(AMPRMS,21); + int i; + EQ = eq; + DATE = date; + F77_LOCK( F77_CALL(sla_mappa)( DOUBLE_ARG(&EQ), + DOUBLE_ARG(&DATE), + DOUBLE_ARRAY_ARG(AMPRMS) ); ) + for ( i = 0; i < 21; i++ ) amprms[ i ] = AMPRMS[ i ]; +} + +F77_SUBROUTINE(sla_map)(DOUBLE(RM), DOUBLE(DM), + DOUBLE(PR), DOUBLE(PD), + DOUBLE(PX), + DOUBLE(RV), + DOUBLE(EQ), + DOUBLE(DATE), + DOUBLE(RA), DOUBLE(DA) ); + +void +slaMap( double rm, double dm, double pr, double pd, double px, + double rv, double eq, double date, double * ra, double * da ) { + DECLARE_DOUBLE(RM); + DECLARE_DOUBLE(DM); + DECLARE_DOUBLE(PR); + DECLARE_DOUBLE(PD); + DECLARE_DOUBLE(PX); + DECLARE_DOUBLE(RV); + DECLARE_DOUBLE(EQ); + DECLARE_DOUBLE(DATE); + DECLARE_DOUBLE(RA); + DECLARE_DOUBLE(DA); + + F77_EXPORT_DOUBLE(rm,RM); + F77_EXPORT_DOUBLE(dm,DM); + F77_EXPORT_DOUBLE(pr,PR); + F77_EXPORT_DOUBLE(pd,PD); + F77_EXPORT_DOUBLE(px,PX); + F77_EXPORT_DOUBLE(rv,RV); + F77_EXPORT_DOUBLE(eq,EQ); + F77_EXPORT_DOUBLE(date,DATE); + + F77_LOCK( F77_CALL(sla_map)( DOUBLE_ARG(&RM), + DOUBLE_ARG(&DM), + DOUBLE_ARG(&PR), + DOUBLE_ARG(&PD), + DOUBLE_ARG(&PX), + DOUBLE_ARG(&RV), + DOUBLE_ARG(&EQ), + DOUBLE_ARG(&DATE), + DOUBLE_ARG(&RA), + DOUBLE_ARG(&DA) + ); ) + + + F77_IMPORT_DOUBLE(RA, *ra); + F77_IMPORT_DOUBLE(DA, *da); +} + + +F77_SUBROUTINE(sla_mapqkz)( DOUBLE(RM), + DOUBLE(DM), + DOUBLE_ARRAY(AMPRMS), + DOUBLE(RA), + DOUBLE(DA) ); + +void slaMapqkz ( double rm, double dm, double amprms[21], + double *ra, double *da ) { + DECLARE_DOUBLE(RM); + DECLARE_DOUBLE(DM); + DECLARE_DOUBLE_ARRAY(AMPRMS,21); + DECLARE_DOUBLE(RA); + DECLARE_DOUBLE(DA); + int i; + RM = rm; + DM = dm; + for ( i = 0; i < 21; i++ ) AMPRMS[ i ] = amprms[ i ]; + F77_LOCK( F77_CALL(sla_mapqkz)( DOUBLE_ARG(&RM), + DOUBLE_ARG(&DM), + DOUBLE_ARRAY_ARG(AMPRMS), + DOUBLE_ARG(&RA), + DOUBLE_ARG(&DA) ); ) + *ra = RA; + *da = DA; +} + +F77_SUBROUTINE(sla_mapqk)( DOUBLE(RM), + DOUBLE(DM), + DOUBLE(PR), + DOUBLE(PD), + DOUBLE(PX), + DOUBLE(RV), + DOUBLE_ARRAY(AMPRMS), + DOUBLE(RA), + DOUBLE(DA) ); + +void slaMapqk ( double rm, double dm, double pr, double pd, + double px, double rv, double amprms[21], + double *ra, double *da ) { + DECLARE_DOUBLE(RM); + DECLARE_DOUBLE(DM); + DECLARE_DOUBLE(PR); + DECLARE_DOUBLE(PD); + DECLARE_DOUBLE(PX); + DECLARE_DOUBLE(RV); + DECLARE_DOUBLE_ARRAY(AMPRMS,21); + DECLARE_DOUBLE(RA); + DECLARE_DOUBLE(DA); + int i; + RM = rm; + DM = dm; + PR = pr; + PD = pd; + PX = px; + RV = rv; + for ( i = 0; i < 21; i++ ) AMPRMS[ i ] = amprms[ i ]; + F77_LOCK( F77_CALL(sla_mapqk)( DOUBLE_ARG(&RM), + DOUBLE_ARG(&DM), + DOUBLE_ARG(&PR), + DOUBLE_ARG(&PD), + DOUBLE_ARG(&PX), + DOUBLE_ARG(&RV), + DOUBLE_ARRAY_ARG(AMPRMS), + DOUBLE_ARG(&RA), + DOUBLE_ARG(&DA) ); ) + *ra = RA; + *da = DA; +} + +F77_SUBROUTINE(sla_prebn)( DOUBLE(BEP0), + DOUBLE(BEP1), + DOUBLE_ARRAY(RMATP) ); + +void slaPrebn ( double bep0, double bep1, double rmatp[3][3] ) { + DECLARE_DOUBLE(BEP0); + DECLARE_DOUBLE(BEP1); + DECLARE_DOUBLE_ARRAY(RMATP,9); + int i; + int j; + BEP0 = bep0; + BEP1 = bep1; + F77_LOCK( F77_CALL(sla_prebn)( DOUBLE_ARG(&BEP0), + DOUBLE_ARG(&BEP1), + DOUBLE_ARRAY_ARG(RMATP) ); ) + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) rmatp[ i ][ j ] = RMATP[ i + 3 * j ]; + } +} + +F77_SUBROUTINE(sla_prec)( DOUBLE(EP0), + DOUBLE(EP1), + DOUBLE_ARRAY(RMATP) ); + +void slaPrec ( double ep0, double ep1, double rmatp[3][3] ) { + DECLARE_DOUBLE(EP0); + DECLARE_DOUBLE(EP1); + DECLARE_DOUBLE_ARRAY(RMATP,9); + int i; + int j; + EP0 = ep0; + EP1 = ep1; + F77_LOCK( F77_CALL(sla_prec)( DOUBLE_ARG(&EP0), + DOUBLE_ARG(&EP1), + DOUBLE_ARRAY_ARG(RMATP) ); ) + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) rmatp[ i ][ j ] = RMATP[ i + 3 * j ]; + } +} + +F77_REAL_FUNCTION(sla_rverot)( REAL(PHI), + REAL(RA), + REAL(DEC), + REAL(ST) ); + +float slaRverot ( float phi, float ra, float dec, float st ) { + DECLARE_REAL(PHI); + DECLARE_REAL(RA); + DECLARE_REAL(DEC); + DECLARE_REAL(ST); + float result; + PHI = phi; + RA = ra; + DEC = dec; + ST = st; + F77_LOCK( result = F77_CALL(sla_rverot)( REAL_ARG(&PHI), + REAL_ARG(&RA), + REAL_ARG(&DEC), + REAL_ARG(&ST) ); ) + return result; +} + +F77_REAL_FUNCTION(sla_rvgalc)( REAL(RA), + REAL(DEC) ); + +float slaRvgalc ( float ra, float dec ) { + DECLARE_REAL(RA); + DECLARE_REAL(DEC); + float result; + RA = ra; + DEC = dec; + F77_LOCK( result = F77_CALL(sla_rvgalc)( REAL_ARG(&RA), + REAL_ARG(&DEC) ); ) + return result; +} + +F77_REAL_FUNCTION(sla_rvlg)( REAL(RA), + REAL(DEC) ); + +float slaRvlg ( float ra, float dec ) { + DECLARE_REAL(RA); + DECLARE_REAL(DEC); + float result; + RA = ra; + DEC = dec; + F77_LOCK( result = F77_CALL(sla_rvlg)( REAL_ARG(&RA), + REAL_ARG(&DEC) ); ) + return result; +} + +F77_REAL_FUNCTION(sla_rvlsrd)( REAL(RA), + REAL(DEC) ); + +float slaRvlsrd ( float ra, float dec ) { + DECLARE_REAL(RA); + DECLARE_REAL(DEC); + float result; + RA = ra; + DEC = dec; + F77_LOCK( result = F77_CALL(sla_rvlsrd)( REAL_ARG(&RA), + REAL_ARG(&DEC) ); ) + return result; +} + +F77_REAL_FUNCTION(sla_rvlsrk)( REAL(RA), + REAL(DEC) ); + +float slaRvlsrk ( float ra, float dec ) { + DECLARE_REAL(RA); + DECLARE_REAL(DEC); + float result; + RA = ra; + DEC = dec; + F77_LOCK( result = F77_CALL(sla_rvlsrk)( REAL_ARG(&RA), + REAL_ARG(&DEC) ); ) + return result; +} + + +F77_SUBROUTINE(sla_subet)( DOUBLE(RC), + DOUBLE(DC), + DOUBLE(EQ), + DOUBLE(RM), + DOUBLE(DM) ); + +void slaSubet ( double rc, double dc, double eq, double *rm, double *dm ) { + DECLARE_DOUBLE(RC); + DECLARE_DOUBLE(DC); + DECLARE_DOUBLE(EQ); + DECLARE_DOUBLE(RM); + DECLARE_DOUBLE(DM); + RC = rc; + DC = dc; + EQ = eq; + F77_LOCK( F77_CALL(sla_subet)( DOUBLE_ARG(&RC), + DOUBLE_ARG(&DC), + DOUBLE_ARG(&EQ), + DOUBLE_ARG(&RM), + DOUBLE_ARG(&DM) ); ) + *rm = RM; + *dm = DM; +} + +F77_SUBROUTINE(sla_supgal)( DOUBLE(DSL), + DOUBLE(DSB), + DOUBLE(DL), + DOUBLE(DB) ); + +void slaSupgal ( double dsl, double dsb, double *dl, double *db ) { + DECLARE_DOUBLE(DSL); + DECLARE_DOUBLE(DSB); + DECLARE_DOUBLE(DL); + DECLARE_DOUBLE(DB); + DSL = dsl; + DSB = dsb; + F77_LOCK( F77_CALL(sla_supgal)( DOUBLE_ARG(&DSL), + DOUBLE_ARG(&DSB), + DOUBLE_ARG(&DL), + DOUBLE_ARG(&DB) ); ) + *dl = DL; + *db = DB; +} + + + +F77_SUBROUTINE(sla_svd)( INTEGER(M), + INTEGER(N), + INTEGER(MP), + INTEGER(NP), + DOUBLE_ARRAY(A), + DOUBLE_ARRAY(W), + DOUBLE_ARRAY(V), + DOUBLE_ARRAY(WORK), + INTEGER(JSTAT) ); + +void slaSvd ( int m, int n, int mp, int np, + double *a, double *w, double *v, double *work, + int *jstat ){ + DECLARE_INTEGER(M); + DECLARE_INTEGER(N); + DECLARE_INTEGER(MP); + DECLARE_INTEGER(NP); + F77_DOUBLE_TYPE *A; + F77_DOUBLE_TYPE *W; + F77_DOUBLE_TYPE *V; + F77_DOUBLE_TYPE *WORK; + DECLARE_INTEGER(JSTAT); + + + int i; + int j; + + A = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) ( mp * np ) ); + W = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) n ); + V = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) ( np * np ) ); + WORK = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) n ); + + if ( WORK ) { + M = m; + N = n; + MP = mp; + NP = np; + + for ( i = 0; i < m; i++ ) { + for ( j = 0; j < n; j++ ) A[ i + mp * j ] = a[ np * i + j ]; + } + + F77_LOCK( F77_CALL(sla_svd)( INTEGER_ARG(&M), + INTEGER_ARG(&N), + INTEGER_ARG(&MP), + INTEGER_ARG(&NP), + DOUBLE_ARRAY_ARG(A), + DOUBLE_ARRAY_ARG(W), + DOUBLE_ARRAY_ARG(V), + DOUBLE_ARRAY_ARG(WORK), + INTEGER_ARG(&JSTAT) ); ) + + + for ( i = 0; i < m; i++ ) { + for ( j = 0; j < n; j++ ) a[ np * i + j ] = A[ i + mp * j ]; + } + + for ( i = 0; i < n; i++ ) { + w[ i ] = W[ i ]; + work[ i ] = WORK[ i ]; + for ( j = 0; j < n; j++ ) v[ np * i + j ] = V[ i + np * j ]; + } + + *jstat = JSTAT; + } + + free( A ); + free( W ); + free( V ); + free( WORK ); +} + +F77_SUBROUTINE(sla_svdsol)( INTEGER(M), + INTEGER(N), + INTEGER(MP), + INTEGER(NP), + DOUBLE_ARRAY(B), + DOUBLE_ARRAY(U), + DOUBLE_ARRAY(W), + DOUBLE_ARRAY(V), + DOUBLE_ARRAY(WORK), + DOUBLE_ARRAY(X) ); + +void slaSvdsol ( int m, int n, int mp, int np, + double *b, double *u, double *w, double *v, + double *work, double *x ){ + + DECLARE_INTEGER(M); + DECLARE_INTEGER(N); + DECLARE_INTEGER(MP); + DECLARE_INTEGER(NP); + F77_DOUBLE_TYPE *B; + F77_DOUBLE_TYPE *U; + F77_DOUBLE_TYPE *W; + F77_DOUBLE_TYPE *V; + F77_DOUBLE_TYPE *WORK; + F77_DOUBLE_TYPE *X; + + int i; + int j; + + B = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) ( m ) ); + U = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) ( mp * np ) ); + W = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) n ); + V = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) ( np * np ) ); + WORK = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) n ); + X = malloc( sizeof( F77_DOUBLE_TYPE ) * (size_t) n ); + + if ( X ) { + M = m; + N = n; + MP = mp; + NP = np; + + for ( i = 0; i < m; i++ ) { + B[ i ] = b[ i ]; + for ( j = 0; j < n; j++ ) U[ i + mp * j ] = u[ np * i + j ]; + } + for ( i = 0; i < n; i++ ) { + W[ i ] = w[ i ]; + for ( j = 0; j < n; j++ ) V[ i + np * j ] = v[ np * i + j ]; + } + + F77_LOCK( F77_CALL(sla_svdsol)( INTEGER_ARG(&M), + INTEGER_ARG(&N), + INTEGER_ARG(&MP), + INTEGER_ARG(&NP), + DOUBLE_ARRAY_ARG(B), + DOUBLE_ARRAY_ARG(U), + DOUBLE_ARRAY_ARG(W), + DOUBLE_ARRAY_ARG(V), + DOUBLE_ARRAY_ARG(WORK), + DOUBLE_ARRAY_ARG(X) ); ) + + for ( i = 0; i < n; i++ ) { + x[ i ] = X[ i ]; + work[ i ] = WORK[ i ]; + } + } + + free( B ); + free( U ); + free( W ); + free( V ); + free( WORK ); + free( X ); +} + + + +F77_SUBROUTINE(sla_evp)( DOUBLE(DATE), + DOUBLE(DEQX), + DOUBLE_ARRAY(DVB), + DOUBLE_ARRAY(DPB), + DOUBLE_ARRAY(DVH), + DOUBLE_ARRAY(DPH) ); + +void slaEvp ( double date, double deqx, double dvb[3], double dpb[3], + double dvh[3], double dph[3] ) { + DECLARE_DOUBLE(DATE); + DECLARE_DOUBLE(DEQX); + DECLARE_DOUBLE_ARRAY(DVB,3); + DECLARE_DOUBLE_ARRAY(DPB,3); + DECLARE_DOUBLE_ARRAY(DVH,3); + DECLARE_DOUBLE_ARRAY(DPH,3); + + int i; + DATE = date; + DEQX = deqx; + F77_LOCK( F77_CALL(sla_evp)( DOUBLE_ARG(&DATE), + DOUBLE_ARG(&DEQX), + DOUBLE_ARRAY_ARG(DVB), + DOUBLE_ARRAY_ARG(DPB), + DOUBLE_ARRAY_ARG(DVH), + DOUBLE_ARRAY_ARG(DPH) ); ) + for ( i = 0; i < 3; i++ ) { + dvb[ i ] = DVB[ i ]; + dpb[ i ] = DPB[ i ]; + dvh[ i ] = DVH[ i ]; + dph[ i ] = DPH[ i ]; + } + +} + +F77_SUBROUTINE(sla_fk5hz)( DOUBLE(R5), + DOUBLE(D5), + DOUBLE(JEPOCH), + DOUBLE(RH), + DOUBLE(DH) ); + +void slaFk5hz ( double r5, double d5, double jepoch, + double *rh, double *dh ) { + DECLARE_DOUBLE(R5); + DECLARE_DOUBLE(D5); + DECLARE_DOUBLE(JEPOCH); + DECLARE_DOUBLE(RH); + DECLARE_DOUBLE(DH); + R5 = r5; + D5 = d5; + JEPOCH = jepoch; + F77_LOCK( F77_CALL(sla_fk5hz)( DOUBLE_ARG(&R5), + DOUBLE_ARG(&D5), + DOUBLE_ARG(&JEPOCH), + DOUBLE_ARG(&RH), + DOUBLE_ARG(&DH) ); ) + *rh = RH; + *dh = DH; +} + +F77_SUBROUTINE(sla_hfk5z)( DOUBLE(RH), + DOUBLE(DH), + DOUBLE(JEPOCH), + DOUBLE(R5), + DOUBLE(D5), + DOUBLE(DR5), + DOUBLE(DD5) ); + +void slaHfk5z ( double rh, double dh, double jepoch, + double *r5, double *d5, + double *dr5, double *dd5 ) { + DECLARE_DOUBLE(RH); + DECLARE_DOUBLE(DH); + DECLARE_DOUBLE(JEPOCH); + DECLARE_DOUBLE(R5); + DECLARE_DOUBLE(D5); + DECLARE_DOUBLE(DR5); + DECLARE_DOUBLE(DD5); + RH = rh; + DH = dh; + JEPOCH = jepoch; + F77_LOCK( F77_CALL(sla_hfk5z)( DOUBLE_ARG(&RH), + DOUBLE_ARG(&DH), + DOUBLE_ARG(&JEPOCH), + DOUBLE_ARG(&R5), + DOUBLE_ARG(&D5), + DOUBLE_ARG(&DR5), + DOUBLE_ARG(&DD5) ); ) + *r5 = R5; + *d5 = D5; + *dr5 = DR5; + *dd5 = DD5; +} + +F77_SUBROUTINE(sla_geoc)( DOUBLE(P), + DOUBLE(H), + DOUBLE(R), + DOUBLE(Z) ); + +void slaGeoc ( double p, double h, double *r, double *z ) { + DECLARE_DOUBLE(P); + DECLARE_DOUBLE(H); + DECLARE_DOUBLE(R); + DECLARE_DOUBLE(Z); + P = p; + H = h; + F77_LOCK( F77_CALL(sla_geoc)( DOUBLE_ARG(&P), + DOUBLE_ARG(&H), + DOUBLE_ARG(&R), + DOUBLE_ARG(&Z) ); ) + *r = R; + *z = Z; +} + +F77_SUBROUTINE(sla_deuler)( CHARACTER(ORDER), + DOUBLE(PHI), + DOUBLE(THETA), + DOUBLE(PSI), + DOUBLE_ARRAY(RMAT) + TRAIL(ORDER) ); + +void slaDeuler ( const char *order, double phi, double theta, double psi, + double rmat[3][3] ) { + + DECLARE_CHARACTER(ORDER,4); + DECLARE_DOUBLE(PHI); + DECLARE_DOUBLE(THETA); + DECLARE_DOUBLE(PSI); + DECLARE_DOUBLE_ARRAY(RMAT,9); + int i,j; + + PHI = phi; + THETA = theta; + PSI = psi; + + slaStringExport( order, ORDER, 4 ); + + F77_LOCK( F77_CALL (sla_deuler) ( CHARACTER_ARG(ORDER), + DOUBLE_ARG(&PHI), + DOUBLE_ARG(&THETA), + DOUBLE_ARG(&PSI), + DOUBLE_ARRAY_ARG(RMAT) + TRAIL_ARG(ORDER) ); ) + + for ( i = 0; i < 3; i++ ) { + for ( j = 0; j < 3; j++ ) rmat[ i ][ j ] = RMAT[ i + 3 * j ]; + } + +} + +F77_SUBROUTINE(sla_de2h)( DOUBLE(HA), + DOUBLE(DEC), + DOUBLE(PHI), + DOUBLE(AZ), + DOUBLE(EL) ); + +void slaDe2h ( double ha, double dec, double phi, double *az, double *el ) { + DECLARE_DOUBLE(HA); + DECLARE_DOUBLE(DEC); + DECLARE_DOUBLE(PHI); + DECLARE_DOUBLE(AZ); + DECLARE_DOUBLE(EL); + HA = ha; + DEC = dec; + PHI = phi; + F77_LOCK( F77_CALL(sla_de2h)( DOUBLE_ARG(&HA), + DOUBLE_ARG(&DEC), + DOUBLE_ARG(&PHI), + DOUBLE_ARG(&AZ), + DOUBLE_ARG(&EL) ); ) + *az = AZ; + *el = EL; +} + +F77_SUBROUTINE(sla_dh2e)( DOUBLE(AZ), + DOUBLE(EL), + DOUBLE(PHI), + DOUBLE(HA), + DOUBLE(DEC) ); + +void slaDh2e ( double az, double el, double phi, double *ha, double *dec ) { + DECLARE_DOUBLE(AZ); + DECLARE_DOUBLE(EL); + DECLARE_DOUBLE(PHI); + DECLARE_DOUBLE(HA); + DECLARE_DOUBLE(DEC); + AZ = az; + EL = el; + PHI = phi; + F77_LOCK( F77_CALL(sla_dh2e)( DOUBLE_ARG(&AZ), + DOUBLE_ARG(&EL), + DOUBLE_ARG(&PHI), + DOUBLE_ARG(&HA), + DOUBLE_ARG(&DEC) ); ) + *ha = HA; + *dec = DEC; +} + + +F77_SUBROUTINE(sla_obs)( INTEGER(I), + CHARACTER(C), + CHARACTER(NAME), + DOUBLE(W), + DOUBLE(P), + DOUBLE(H) + TRAIL(C) + TRAIL(NAME) ); + +/* Note that SLA insists that "c" has space for 10 characters + nul + and "name" has space for 40 characters + nul */ + +void +slaObs( int n, char *c, char *name, double *w, double *p, double *h ) { + + DECLARE_INTEGER( N ); + DECLARE_CHARACTER( C, 10 ); + DECLARE_CHARACTER( NAME, 40 ); + DECLARE_DOUBLE( W ); + DECLARE_DOUBLE( P ); + DECLARE_DOUBLE( H ); + + if (n < 1) { + /* C needs to be imported */ + slaStringExport( c, C, 10 ); + } else { + /* initialise C */ + slaStringExport( "", C, 10 ); + } + F77_EXPORT_INTEGER( n, N ); + + /* w, p and h are not touched on error but for consistency this means + we copy the current values to Fortran so that we can correctly copy + back the result. */ + F77_EXPORT_DOUBLE( *w, W ); + F77_EXPORT_DOUBLE( *p, P ); + F77_EXPORT_DOUBLE( *h, H ); + + /* call the routine */ + F77_LOCK( F77_CALL(sla_obs)( INTEGER_ARG(&N), + CHARACTER_ARG(C), + CHARACTER_ARG(NAME), + DOUBLE_ARG(&W), + DOUBLE_ARG(&P), + DOUBLE_ARG(&H) + TRAIL_ARG(C) + TRAIL_ARG(NAME) ); ) + + /* extract results */ + slaStringImport( NAME, 40, name ); + if (n > 0 && name[0] != '?') { + /* only do this if we know we used a numeric input and if the result + for the NAME is not '?' (since we are not allowed to alter the string + in that case). This allows people + to call slaObs with a string constant */ + slaStringImport( C, 10, c ); + } + F77_IMPORT_DOUBLE( W, *w ); + F77_IMPORT_DOUBLE( P, *p ); + F77_IMPORT_DOUBLE( H, *h ); + +} + +F77_DOUBLE_FUNCTION(sla_pa)( DOUBLE(HA), DOUBLE(DEC), DOUBLE(PHI) ); + +double +slaPa ( double ha, double dec, double phi ) { + DECLARE_DOUBLE(HA); + DECLARE_DOUBLE(DEC); + DECLARE_DOUBLE(PHI); + DECLARE_DOUBLE(RETVAL); + double retval; + + F77_EXPORT_DOUBLE( ha, HA ); + F77_EXPORT_DOUBLE( dec, DEC ); + F77_EXPORT_DOUBLE( phi, PHI ); + + F77_LOCK( RETVAL = F77_CALL(sla_pa)( DOUBLE_ARG(&HA), DOUBLE_ARG(&DEC), DOUBLE_ARG(&PHI)); ) + + F77_IMPORT_DOUBLE( RETVAL, retval ); + return retval; +} + +F77_DOUBLE_FUNCTION(sla_dtt)( DOUBLE(UTC) ); + +double +slaDtt( double utc ) { + DECLARE_DOUBLE(UTC); + DECLARE_DOUBLE(RETVAL); + double retval; + + F77_EXPORT_DOUBLE( utc, UTC ); + F77_LOCK( RETVAL = F77_CALL(sla_dtt)( DOUBLE_ARG(&UTC) ); ) + + F77_IMPORT_DOUBLE( RETVAL, retval ); + return retval; +} + +F77_DOUBLE_FUNCTION(sla_dat)( DOUBLE(UTC) ); + +double +slaDat( double utc ) { + DECLARE_DOUBLE(UTC); + DECLARE_DOUBLE(RETVAL); + double retval; + + F77_EXPORT_DOUBLE( utc, UTC ); + F77_LOCK( RETVAL = F77_CALL(sla_dat)( DOUBLE_ARG(&UTC) ); ) + + F77_IMPORT_DOUBLE( RETVAL, retval ); + return retval; +} + +F77_SUBROUTINE(sla_rdplan)(DOUBLE(DATE), INTEGER(I), DOUBLE(ELONG), DOUBLE(PHI), + DOUBLE(RA), DOUBLE(DEC), DOUBLE(DIAM) ); + +void +slaRdplan( double date, int i, double elong, double phi, + double * ra, double * dec, double * diam ) { + DECLARE_DOUBLE(DATE); + DECLARE_INTEGER(I); + DECLARE_DOUBLE(ELONG); + DECLARE_DOUBLE(PHI); + DECLARE_DOUBLE(RA); + DECLARE_DOUBLE(DEC); + DECLARE_DOUBLE(DIAM); + + F77_EXPORT_DOUBLE( date, DATE ); + F77_EXPORT_INTEGER( i, I ); + F77_EXPORT_DOUBLE( elong, ELONG ); + F77_EXPORT_DOUBLE( phi, PHI ); + + F77_LOCK( F77_CALL(sla_rdplan)( DOUBLE_ARG(&DATE), + INTEGER_ARG(&I), + DOUBLE_ARG(&ELONG), + DOUBLE_ARG(&PHI), + DOUBLE_ARG(&RA), + DOUBLE_ARG(&DEC), + DOUBLE_ARG(&DIAM)); ) + + F77_IMPORT_DOUBLE( RA, *ra ); + F77_IMPORT_DOUBLE( DEC, *dec ); + F77_IMPORT_DOUBLE( DIAM, *diam ); +} + +F77_SUBROUTINE(sla_dafin)( CHARACTER(STRING), INTEGER(IPTR), DOUBLE(A), + INTEGER(J) TRAIL(STRING) ); + +void +slaDafin( const char * string, int * iptr, double *a, int *j ) { + + DECLARE_CHARACTER_DYN(STRING); + DECLARE_DOUBLE(A); + DECLARE_INTEGER(IPTR); + DECLARE_INTEGER(J); + + F77_EXPORT_INTEGER( *iptr, IPTR ); + F77_CREATE_EXPORT_CHARACTER( string, STRING ); + + F77_LOCK( F77_CALL(sla_dafin)( CHARACTER_ARG(STRING), INTEGER_ARG(&IPTR), + DOUBLE_ARG(&A), INTEGER_ARG(&J) TRAIL_ARG(STRING) ); ) + + F77_IMPORT_INTEGER(IPTR, *iptr ); + F77_IMPORT_INTEGER(J, *j ); + F77_IMPORT_DOUBLE(A, *a ); + F77_FREE_CHARACTER(STRING); + +} + +F77_SUBROUTINE(sla_oap)( CHARACTER(TYPE), + DOUBLE(OB1), + DOUBLE(OB2), + DOUBLE(DATE), + DOUBLE(DUT), + DOUBLE(ELONGM), + DOUBLE(PHIM), + DOUBLE(HM), + DOUBLE(XP), + DOUBLE(YP), + DOUBLE(TDK), + DOUBLE(PMB), + DOUBLE(RH), + DOUBLE(WL), + DOUBLE(TLR), + DOUBLE(RAP), + DOUBLE(DAP) + TRAIL(TYPE) ); + +void slaOap ( const char *type, double ob1, double ob2, double date, + double dut, double elongm, double phim, double hm, + double xp, double yp, double tdk, double pmb, + double rh, double wl, double tlr, + double *rap, double *dap ) { + DECLARE_CHARACTER(TYPE,1); + DECLARE_DOUBLE(OB1); + DECLARE_DOUBLE(OB2); + DECLARE_DOUBLE(DATE); + DECLARE_DOUBLE(DUT); + DECLARE_DOUBLE(ELONGM); + DECLARE_DOUBLE(PHIM); + DECLARE_DOUBLE(HM); + DECLARE_DOUBLE(XP); + DECLARE_DOUBLE(YP); + DECLARE_DOUBLE(TDK); + DECLARE_DOUBLE(PMB); + DECLARE_DOUBLE(RH); + DECLARE_DOUBLE(WL); + DECLARE_DOUBLE(TLR); + DECLARE_DOUBLE(RAP); + DECLARE_DOUBLE(DAP); + + slaStringExport( type, TYPE, 1 ); + OB1 = ob1; + OB2 = ob2; + DATE = date; + DUT = dut; + ELONGM = elongm; + PHIM = phim; + HM = hm; + XP = xp; + YP = yp; + TDK = tdk; + PMB = pmb; + RH = rh; + WL = wl; + TLR = tlr; + + F77_LOCK( F77_CALL(sla_oap)( CHARACTER_ARG(TYPE), + DOUBLE_ARG(&OB1), DOUBLE_ARG(&OB2), + DOUBLE_ARG(&DATE), DOUBLE_ARG(&DUT), + DOUBLE_ARG(&ELONGM), DOUBLE_ARG(&PHIM), + DOUBLE_ARG(&HM), DOUBLE_ARG(&XP), + DOUBLE_ARG(&YP), DOUBLE_ARG(&TDK), + DOUBLE_ARG(&PMB), DOUBLE_ARG(&RH), + DOUBLE_ARG(&WL), DOUBLE_ARG(&TLR), + DOUBLE_ARG(&RAP), DOUBLE_ARG(&DAP) + TRAIL_ARG(TYPE) ); ) + + *rap = RAP; + *dap = DAP; + +} + +F77_SUBROUTINE(sla_amp)( DOUBLE(RA), + DOUBLE(DA), + DOUBLE(DATE), + DOUBLE(EQ), + DOUBLE(RM), + DOUBLE(DM) + ); + +void slaAmp( double ra, double da, double date, double eq, + double *rm, double *dm) { + + DECLARE_DOUBLE(RA); + DECLARE_DOUBLE(DA); + DECLARE_DOUBLE(DATE); + DECLARE_DOUBLE(EQ); + DECLARE_DOUBLE(RM); + DECLARE_DOUBLE(DM); + + RA = ra; + DA = da; + DATE = date; + EQ = eq; + + F77_LOCK( F77_CALL(sla_amp)( DOUBLE_ARG(&RA), + DOUBLE_ARG(&DA), + DOUBLE_ARG(&DATE), + DOUBLE_ARG(&EQ), + DOUBLE_ARG(&RM), + DOUBLE_ARG(&DM)); ) + + *rm = RM; + *dm = DM; + +} + +F77_SUBROUTINE(sla_aop)( + DOUBLE(RAP), + DOUBLE(DAP), + DOUBLE(DATE), + DOUBLE(DUT), + DOUBLE(ELONGM), + DOUBLE(PHIM), + DOUBLE(HM), + DOUBLE(XP), + DOUBLE(YP), + DOUBLE(TDK), + DOUBLE(PMB), + DOUBLE(RH), + DOUBLE(WL), + DOUBLE(TLR), + DOUBLE(AOB), + DOUBLE(ZOB), + DOUBLE(HOB), + DOUBLE(DOB), + DOUBLE(ROB) ); + +void slaAop ( double rap, double dap, double date, double dut, + double elongm, double phim, double hm, double xp, + double yp, double tdk, double pmb, double rh, + double wl, double tlr, + double *aob, double *zob, double *hob, + double *dob, double *rob ) { + + DECLARE_DOUBLE(RAP); + DECLARE_DOUBLE(DAP); + DECLARE_DOUBLE(DATE); + DECLARE_DOUBLE(DUT); + DECLARE_DOUBLE(ELONGM); + DECLARE_DOUBLE(PHIM); + DECLARE_DOUBLE(HM); + DECLARE_DOUBLE(XP); + DECLARE_DOUBLE(YP); + DECLARE_DOUBLE(TDK); + DECLARE_DOUBLE(PMB); + DECLARE_DOUBLE(RH); + DECLARE_DOUBLE(WL); + DECLARE_DOUBLE(TLR); + DECLARE_DOUBLE(AOB); + DECLARE_DOUBLE(ZOB); + DECLARE_DOUBLE(HOB); + DECLARE_DOUBLE(DOB); + DECLARE_DOUBLE(ROB); + + RAP = rap; + DAP = dap; + DATE = date; + DUT = dut; + ELONGM = elongm; + PHIM = phim; + HM = hm; + XP = xp; + YP = yp; + TDK = tdk; + PMB = pmb; + RH = rh; + WL = wl; + TLR = tlr; + + F77_LOCK( F77_CALL(sla_aop)( + DOUBLE_ARG(&RAP), + DOUBLE_ARG(&DAP), + DOUBLE_ARG(&DATE), + DOUBLE_ARG(&DUT), + DOUBLE_ARG(&ELONGM), + DOUBLE_ARG(&PHIM), + DOUBLE_ARG(&HM), + DOUBLE_ARG(&XP), + DOUBLE_ARG(&YP), + DOUBLE_ARG(&TDK), + DOUBLE_ARG(&PMB), + DOUBLE_ARG(&RH), + DOUBLE_ARG(&WL), + DOUBLE_ARG(&TLR), + DOUBLE_ARG(&AOB), + DOUBLE_ARG(&ZOB), + DOUBLE_ARG(&HOB), + DOUBLE_ARG(&DOB), + DOUBLE_ARG(&ROB) ); ) + + *aob = AOB; + *zob = ZOB; + *hob = HOB; + *dob = DOB; + *rob = ROB; +} + +F77_SUBROUTINE(sla_cldj)( INTEGER(IY), + INTEGER(IM), + INTEGER(ID), + DOUBLE(DJM), + INTEGER(I) ); + +void +slaCldj( int iy, int im, int id, double * djm, int *i ) { + DECLARE_INTEGER(IY); + DECLARE_INTEGER(IM); + DECLARE_INTEGER(ID); + DECLARE_DOUBLE(DJM); + DECLARE_INTEGER(I); + + IY = iy; + IM = im; + ID = id; + + F77_LOCK( F77_CALL(sla_cldj)( INTEGER_ARG(&IY), + INTEGER_ARG(&IM), + INTEGER_ARG(&ID), + DOUBLE_ARG(&DJM), + INTEGER_ARG(&I) ); ) + + *djm = DJM; + *i = I; + +} + +F77_SUBROUTINE(sla_pertel)( INTEGER(JFORM), + DOUBLE(DATE0), + DOUBLE(DATE1), + DOUBLE(EPOCH0), + DOUBLE(ORBI0), + DOUBLE(ANODE0), + DOUBLE(PERIH0), + DOUBLE(AORQ0), + DOUBLE(E0), + DOUBLE(AM0), + DOUBLE(EPOCH1), + DOUBLE(ORBI1), + DOUBLE(ANODE1), + DOUBLE(PERIH1), + DOUBLE(AORQ1), + DOUBLE(E1), + DOUBLE(AM1), + INTEGER(JSTAT) ); + +void slaPertel (int jform, double date0, double date1, + double epoch0, double orbi0, double anode0, + double perih0, double aorq0, double e0, double am0, + double *epoch1, double *orbi1, double *anode1, + double *perih1, double *aorq1, double *e1, double *am1, + int *jstat ) { + + DECLARE_INTEGER(JFORM); + DECLARE_DOUBLE(DATE0); + DECLARE_DOUBLE(DATE1); + DECLARE_DOUBLE(EPOCH0); + DECLARE_DOUBLE(ORBI0); + DECLARE_DOUBLE(ANODE0); + DECLARE_DOUBLE(PERIH0); + DECLARE_DOUBLE(AORQ0); + DECLARE_DOUBLE(E0); + DECLARE_DOUBLE(AM0); + DECLARE_DOUBLE(EPOCH1); + DECLARE_DOUBLE(ORBI1); + DECLARE_DOUBLE(ANODE1); + DECLARE_DOUBLE(PERIH1); + DECLARE_DOUBLE(AORQ1); + DECLARE_DOUBLE(E1); + DECLARE_DOUBLE(AM1); + DECLARE_INTEGER(JSTAT); + + JFORM = jform; + DATE0 = date0; + DATE1 = date1; + EPOCH0 = epoch0; + ORBI0 = orbi0; + ANODE0 = anode0; + PERIH0 = perih0; + AORQ0 = aorq0; + E0 = e0; + AM0 = am0; + + F77_LOCK( F77_CALL(sla_pertel)( INTEGER_ARG(&JFORM), + DOUBLE_ARG(&DATE0), + DOUBLE_ARG(&DATE1), + DOUBLE_ARG(&EPOCH0), + DOUBLE_ARG(&ORBI0), + DOUBLE_ARG(&ANODE0), + DOUBLE_ARG(&PERIH0), + DOUBLE_ARG(&AORQ0), + DOUBLE_ARG(&E0), + DOUBLE_ARG(&AM0), + DOUBLE_ARG(&EPOCH1), + DOUBLE_ARG(&ORBI1), + DOUBLE_ARG(&ANODE1), + DOUBLE_ARG(&PERIH1), + DOUBLE_ARG(&AORQ1), + DOUBLE_ARG(&E1), + DOUBLE_ARG(&AM1), + INTEGER_ARG(&JSTAT) ); ) + + *epoch1 = EPOCH1; + *orbi1 = ORBI1; + *anode1 = ANODE1; + *perih1 = PERIH1; + *aorq1 = AORQ1; + *e1 = E1; + *am1 = AM1; + *jstat = JSTAT; + +} + +F77_SUBROUTINE(sla_plante)(DOUBLE(DATE), + DOUBLE(ELONG), + DOUBLE(PHI), + INTEGER(JFORM), + DOUBLE(EPOCH), + DOUBLE(ORBINC), + DOUBLE(ANODE), + DOUBLE(PERIH), + DOUBLE(AORQ), + DOUBLE(E), + DOUBLE(AORL), + DOUBLE(DM), + DOUBLE(RA), + DOUBLE(DEC), + DOUBLE(R), + INTEGER(JSTAT) ); + +void slaPlante ( double date, double elong, double phi, int jform, + double epoch, double orbinc, double anode, double perih, + double aorq, double e, double aorl, double dm, + double *ra, double *dec, double *r, int *jstat ) { + + DECLARE_DOUBLE(DATE); + DECLARE_DOUBLE(ELONG); + DECLARE_DOUBLE(PHI); + DECLARE_INTEGER(JFORM); + DECLARE_DOUBLE(EPOCH); + DECLARE_DOUBLE(ORBINC); + DECLARE_DOUBLE(ANODE); + DECLARE_DOUBLE(PERIH); + DECLARE_DOUBLE(AORQ); + DECLARE_DOUBLE(E); + DECLARE_DOUBLE(AORL); + DECLARE_DOUBLE(DM); + DECLARE_DOUBLE(RA); + DECLARE_DOUBLE(DEC); + DECLARE_DOUBLE(R); + DECLARE_INTEGER(JSTAT); + + DATE = date; + ELONG = elong; + PHI = phi; + JFORM = jform; + EPOCH = epoch; + ORBINC = orbinc; + ANODE = anode; + PERIH = perih; + AORQ = aorq; + E = e; + AORL = aorl; + DM = dm; + + F77_LOCK( F77_CALL(sla_plante)( DOUBLE_ARG(&EPOCH), + DOUBLE_ARG(&ELONG), + DOUBLE_ARG(&PHI), + INTEGER_ARG(&JFORM), + DOUBLE_ARG(&EPOCH), + DOUBLE_ARG(&ORBINC), + DOUBLE_ARG(&ANODE), + DOUBLE_ARG(&PERIH), + DOUBLE_ARG(&AORQ), + DOUBLE_ARG(&E), + DOUBLE_ARG(&AORL), + DOUBLE_ARG(&DM), + DOUBLE_ARG(&RA), + DOUBLE_ARG(&DEC), + DOUBLE_ARG(&R), + INTEGER_ARG(&JSTAT) ); ) + + *ra = RA; + *dec = DEC; + *r = R; + *jstat = JSTAT; + +} + +F77_SUBROUTINE(sla_preces)(CHARACTER(SYS), + DOUBLE(EP0), + DOUBLE(EP1), + DOUBLE(RA), + DOUBLE(DC) + TRAIL(SYS) ); + +void slaPreces ( const char sys[3], double ep0, double ep1, + double *ra, double *dc ) { + + DECLARE_CHARACTER(SYS,3); + DECLARE_DOUBLE(EP0); + DECLARE_DOUBLE(EP1); + DECLARE_DOUBLE(RA); + DECLARE_DOUBLE(DC); + + slaStringExport( sys, SYS, 3 ); + EP0 = ep0; + EP1 = ep1; + RA = *ra; + DC = *dc; + + F77_LOCK( F77_CALL(sla_preces)( CHARACTER_ARG(SYS), + DOUBLE_ARG(&EP0), + DOUBLE_ARG(&EP1), + DOUBLE_ARG(&RA), + DOUBLE_ARG(&DC) + TRAIL_ARG(SYS) ); ) + + *ra = RA; + *dc = DC; + +} + + +F77_SUBROUTINE(sla_pvobs)( DOUBLE(P), + DOUBLE(H), + DOUBLE(STL), + DOUBLE_ARRAY(PV) ); + +void slaPvobs( double p, double h, double stl, double pv[6] ){ + DECLARE_DOUBLE(P); + DECLARE_DOUBLE(H); + DECLARE_DOUBLE(STL); + DECLARE_DOUBLE_ARRAY(PV,6); + + int i; + P = p; + H = h; + STL = stl; + F77_LOCK( F77_CALL(sla_pvobs)( DOUBLE_ARG(&P), + DOUBLE_ARG(&H), + DOUBLE_ARG(&STL), + DOUBLE_ARRAY_ARG(PV) ); ) + for( i = 0; i < 6; i++ ) pv[ i ] = PV[ i ]; +} + diff --git a/math/slalib/sla.news b/math/slalib/sla.news new file mode 100644 index 00000000..e395c6e5 --- /dev/null +++ b/math/slalib/sla.news @@ -0,0 +1,88 @@ +# 23-SEP-2005 (PTW): +# Suppression of compiler warnings. +# Improved sla_UE2PV. +# Package version number changed to 2.5-4. + +SLALIB_Version_2.5.5 + +* The SLALIB C wrapper now optionally uses the CNF library to serialise +calls from C to Fortran, there-by ensuring that the C functions are +thread-safe. This dependency on CNF can be switched off by configuring +SLALIB with the "--without-cnf" option, in which case CNF will not be +used and the C wrappers will not be thread-safe. + +SLALIB_Version_2.5.4 + +* Changes to sla_EL2UE, sla_FITXY, sla_PV2EL, sla_REFRO, sla_UE2PV and + sla_SVD to avoid warnings if compiled with -Wall and -g -O. + +* Changes to sla_UE2PV to improve convergence in high-eccentricity + cases. + +SLALIB_Version_2.5.3 Expiry 30 June 2006 + +* 2006 January 1 leap second added to sla_DAT. + +SLALIB_Version_2.5.2 Expiry 31 March 2006 + +* Bug-fix to sla_DSEPV. Precisely antipodal vectors returned zero + instead of pi. + +SLALIB_Version_2.5.1 Expiry 31 March 2006 + +* An additional Earth position/velocity routine, sla_EPV, has been + added. It is bigger and slower than sla_EVP but much more accurate. + Position accuracy is a few km; velocity accuracy is a few mm/s. + The sla_PERTUE and sla_PLANTU routines now call this routine in + order to deliver better predictions for near-Earth objects. + +SLALIB_Version_2.4-14 Expiry 31 December 2005 + +* Cosmetic changes to about 20% of the routines. + +* Updated optical refraction model in REFCOQ and REFRO. + +SLALIB_Version_2.4-12 + +* SLALIB has been autoconfed and integrated into the new Starlink build + system. + +* It has been released under the Gnu General Public License + +SLALIB_Version_2.4-11 Expiry 31 March 2004 + +The latest releases of SLALIB include the following changes: + +* A new routine PLANTU has been added. It predicts the topocentric + apparent RA,Dec of a solar-system body given the Universal Elements. + It is a Universal-Elements counterpart to PLANTE, which uses + conventional spherical elements (and which now calls PLANTU). + +* The documentation for the suite of heliocentric orbital elements + routines has been improved to make it easier and more obvious how + to use of elements from JPL Horizons and from the Minor Planet + Center. + + Confusion over epochs has often arisen, because the epoch of osculation + (when the elements are momentarily correct) is completely separate from + the epochs that locate a body in its orbit, the former having a role + only when appying perturbations. Part of the reason for this confusion + is that for major and minor planets it is conventional to adopt the + same epoch for (i) osculation and (ii) computing the anomaly or longitude + that fixes the body, even though they could in principle be different. + For the comet case this convention is impossible because the choice of + perihelion dictates the epoch fixing the body, and hence the existence + of (and need for) two independent concepts of epoch is exposed. + + The SLALIB routines in question, especially slaPlante, now have extra + explanation dealing with the three distinct epochs (date of observation, + fixing the body, and osculation) and also some notes dealing with JPL + and MPC elements. Additionally, a table has been added to SUN/67 + showing how to use the JPL and MPC elements. + + P.T.Wallace + 8 April 2005 + + ptw@tpsoft.demon.co.uk + +44-1235-531198 +-------------------------------------------------------------------------- diff --git a/math/slalib/slaTest.c b/math/slalib/slaTest.c new file mode 100644 index 00000000..ab684558 --- /dev/null +++ b/math/slalib/slaTest.c @@ -0,0 +1,112 @@ +/* + *+ + * Name: + * slaTest + + * Purpose: + * Test C interface to SLA + + * Language: + * Starlink ANSI C + + * Description: + * Provides a simple test of the C interface. Test coverage is not + * complete because not all Fortran routines have wrappers. + + * Copyright: + * Copyright (C) 2006 Particle Physics and Engineering Research Council + + * Licence: + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be + * useful,but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street,Fifth Floor, Boston, MA + * 02110-1301, USA + + * Authors: + * TIMJ: Tim Jenness (JAC, Hawaii) + * {enter_new_authors_here} + + * History: + * 07-AUG-2006 (TIMJ): + * Original version. + + *- + */ + +#if HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include "slalib.h" + +#if HAVE_FC_MAIN +void FC_MAIN ( void ); +void FC_MAIN ( ) {} +#endif + + +int main ( void ) { + double w, p, h; + char telname[41]; + char telshort[11]; + int exstatus = EXIT_SUCCESS; + + + /* call slaObs - initialise to recognisable state */ + w = 0.0; p = 0.0; h = -1.0; + + /* first call by short name */ + slaObs( 0, "JCMT", telname, &w, &p, &h ); + if ( h == -1.0 ) { + printf( "Error obtaining information on JCMT\n"); + exstatus = EXIT_FAILURE; + } else { + printf( "Telescope JCMT is '%s' w = %f, p = %f, h = %f\n", + telname, w, p, h); + } + + /* call by index */ + h = -1.0; w = 0.0; p = 0.0; + slaObs( 1, telshort, telname, &w, &p, &h ); + if (h == -1.0 ) { + printf( "Error obtaining information on telescope 1\n"); + exstatus = EXIT_FAILURE; + } else { + printf( "Telescope 1 is '%s' aka '%s' w = %f, p = %f, h = %f\n", + telshort, telname, w, p, h); + } + + /* deliberately fail - with bad index */ + h = -1.0; w = 0.0; p = 0.0; strcpy( telshort, "unknown" ); + slaObs( 100000, telshort, telname, &w, &p, &h ); + if (h != -1.0 || telname[0] != '?') { + printf("Attempt to decode unfeasibly large telescope index should have failed\n"); + printf("Got this result: Tel: '%s' aka '%s', w=%f p=%f h=%f\n", telshort, + telname, w, p, h); + exstatus = EXIT_FAILURE; + } + + /* deliberately fail - with bad name */ + h = -1.0; w = 0.0; p = 0.0; + slaObs( 0, "AFakeTel", telname, &w, &p, &h ); + if (h != -1.0 || telname[0] != '?') { + printf("Attempt to decode unknown telescope should have failed\n"); + printf("Got this result: Tel: '%s', w=%f p=%f h=%f\n", telname, w, p, h); + exstatus = EXIT_FAILURE; + } + + return exstatus; +} diff --git a/math/slalib/sla_link b/math/slalib/sla_link new file mode 100755 index 00000000..941abfac --- /dev/null +++ b/math/slalib/sla_link @@ -0,0 +1 @@ +echo -lsla `cnf_link` diff --git a/math/slalib/sla_link_adam b/math/slalib/sla_link_adam new file mode 100755 index 00000000..a5e757b3 --- /dev/null +++ b/math/slalib/sla_link_adam @@ -0,0 +1 @@ +echo -lsla `cnf_link_adam` diff --git a/math/slalib/sla_test.f b/math/slalib/sla_test.f new file mode 100644 index 00000000..4edaf093 --- /dev/null +++ b/math/slalib/sla_test.f @@ -0,0 +1,6655 @@ + PROGRAM SLA_TEST +*+ +* - - - - - - - - - +* S L A _ T E S T +* - - - - - - - - - +* +* Validate the slalib library. +* +* Each slalib function is tested to some useful but in most cases +* not exhaustive level. Successful completion is signalled by an +* absence of output messages. Failure of a given function or +* group of functions results in error messages. +* +* Any messages go to standard output. +* +* Adapted from original C code by P.T.Wallace. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink and P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + INTEGER EXITSTATUS + + +* Preset the status to success. + STATUS = .TRUE. + +* Test all the slalib functions. + CALL T_ADDET ( STATUS ) + CALL T_AFIN ( STATUS ) + CALL T_AIRMAS ( STATUS ) + CALL T_ALTAZ ( STATUS ) + CALL T_AMP ( STATUS ) + CALL T_AOP ( STATUS ) + CALL T_BEAR ( STATUS ) + CALL T_CAF2R ( STATUS ) + CALL T_CALDJ ( STATUS ) + CALL T_CALYD ( STATUS ) + CALL T_CC2S ( STATUS ) + CALL T_CC62S ( STATUS ) + CALL T_CD2TF ( STATUS ) + CALL T_CLDJ ( STATUS ) + CALL T_CR2AF ( STATUS ) + CALL T_CR2TF ( STATUS ) + CALL T_CS2C6 ( STATUS ) + CALL T_CTF2D ( STATUS ) + CALL T_CTF2R ( STATUS ) + CALL T_DAT ( STATUS ) + CALL T_DBJIN ( STATUS ) + CALL T_DJCAL ( STATUS ) + CALL T_DMAT ( STATUS ) + CALL T_E2H ( STATUS ) + CALL T_EARTH ( STATUS ) + CALL T_ECLEQ ( STATUS ) + CALL T_ECMAT ( STATUS ) + CALL T_ECOR ( STATUS ) + CALL T_EG50 ( STATUS ) + CALL T_EPB ( STATUS ) + CALL T_EPB2D ( STATUS ) + CALL T_EPCO ( STATUS ) + CALL T_EPJ ( STATUS ) + CALL T_EPJ2D ( STATUS ) + CALL T_EQECL ( STATUS ) + CALL T_EQEQX ( STATUS ) + CALL T_EQGAL ( STATUS ) + CALL T_ETRMS ( STATUS ) + CALL T_EVP ( STATUS ) + CALL T_FITXY ( STATUS ) + CALL T_FK425 ( STATUS ) + CALL T_FK45Z ( STATUS ) + CALL T_FK524 ( STATUS ) + CALL T_FK52H ( STATUS ) + CALL T_FK54Z ( STATUS ) + CALL T_FLOTIN ( STATUS ) + CALL T_GALEQ ( STATUS ) + CALL T_GALSUP ( STATUS ) + CALL T_GE50 ( STATUS ) + CALL T_GMST ( STATUS ) + CALL T_INTIN ( STATUS ) + CALL T_KBJ ( STATUS ) + CALL T_MAP ( STATUS ) + CALL T_MOON ( STATUS ) + CALL T_NUT ( STATUS ) + CALL T_OBS ( STATUS ) + CALL T_PA ( STATUS ) + CALL T_PCD ( STATUS ) + CALL T_PDA2H ( STATUS ) + CALL T_PDQ2H ( STATUS ) + CALL T_PERCOM ( STATUS ) + CALL T_PLANET ( STATUS ) + CALL T_PM ( STATUS ) + CALL T_POLMO ( STATUS ) + CALL T_PREBN ( STATUS ) + CALL T_PREC ( STATUS ) + CALL T_PRECES ( STATUS ) + CALL T_PRENUT ( STATUS ) + CALL T_PVOBS ( STATUS ) + CALL T_RANGE ( STATUS ) + CALL T_RANORM ( STATUS ) + CALL T_RCC ( STATUS ) + CALL T_REF ( STATUS ) + CALL T_RV ( STATUS ) + CALL T_SEP ( STATUS ) + CALL T_SMAT ( STATUS ) + CALL T_SUPGAL ( STATUS ) + CALL T_SVD ( STATUS ) + CALL T_TP ( STATUS ) + CALL T_TPV ( STATUS ) + CALL T_VECMAT ( STATUS ) + CALL T_ZD ( STATUS ) + +* Report any errors and set up an appropriate exit status. Set the +* EXITSTATUS to 0 on success, 1 on any error -- Unix-style. The +* EXIT intrinsic is non-standard but common (which is portable enough +* for a regression test). + + IF ( STATUS ) THEN + WRITE (*,'(1X,''SLALIB validation OK!'')') + EXITSTATUS = 0 + ELSE + WRITE (*,'(1X,''SLALIB validation failed!'')') + EXITSTATUS = 1 + ENDIF + + CALL EXIT(EXITSTATUS) + + END + + SUBROUTINE VCS ( S, SOK, FUNC, TEST, STATUS ) +*+ +* - - - - +* V C S +* - - - - +* +* Validate a character string result. +* +* Internal routine used by sla_TEST program. +* +* Given: +* S CHARACTER string produced by routine under test +* SOK CHARACTER correct value +* FUNC CHARACTER name of routine under test +* TEST CHARACTER name of individual test (or ' ') +* +* Given and returned: +* STATUS LOGICAL set to .FALSE. if test fails +* +* Called: ERR +* +* Last revision: 25 May 2002 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) S, SOK, FUNC, TEST + LOGICAL STATUS + + + IF ( S .NE. SOK ) THEN + CALL ERR ( FUNC, TEST, STATUS ) + WRITE (*,'(1X,'' expected ='',6X,''"'',A,''"'')') SOK + WRITE (*,'(1X,'' actual = '',6X,''"'',A,''"'')') S + END IF + + END + + SUBROUTINE VIV ( IVAL, IVALOK, FUNC, TEST, STATUS ) +*+ +* - - - - +* V I V +* - - - - +* +* Validate an integer result. +* +* Internal routine used by sla_TEST program. +* +* Given: +* IVAL INTEGER value computed by routine under test +* IVALOK INTEGER correct value +* FUNC CHARACTER name of routine under test +* TEST CHARACTER name of individual test (or ' ') +* +* Given and returned: +* STATUS LOGICAL set to .FALSE. if test fails +* +* Called: ERR +* +* Last revision: 25 May 2002 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER IVAL, IVALOK + CHARACTER*(*) FUNC, TEST + LOGICAL STATUS + + + IF ( IVAL .NE. IVALOK ) THEN + CALL ERR ( FUNC, TEST, STATUS ) + WRITE (*,'(1X,'' expected ='',I10)') IVALOK + WRITE (*,'(1X,'' actual = '',I10)') IVAL + END IF + + END + + SUBROUTINE VLV ( IVAL, IVALOK, FUNC, TEST, STATUS ) +*+ +* - - - - +* V L V +* - - - - +* +* Validate a long result. +* +* Internal routine used by sla_TEST program. +* +* Given: +* IVAL INTEGER*4 value computed by routine under test +* IVALOK INTEGER*4 correct value +* FUNC CHARACTER name of routine under test +* TEST CHARACTER name of individual test (or ' ') +* +* Given and returned: +* STATUS LOGICAL set to .FALSE. if test fails +* +* Called: ERR +* +* Last revision: 25 May 2002 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER*4 IVAL, IVALOK + CHARACTER*(*) FUNC, TEST + LOGICAL STATUS + + + IF ( IVAL .NE. IVALOK ) THEN + CALL ERR ( FUNC, TEST, STATUS ) + WRITE (*,'(1X,'' expected ='',I10)') IVALOK + WRITE (*,'(1X,'' actual = '',I10)') IVAL + END IF + + END + + SUBROUTINE VVD ( VAL, VALOK, DVAL, FUNC, TEST, STATUS ) +*+ +* - - - - +* V V D +* - - - - +* +* Validate a double result. +* +* Internal routine used by sla_TEST program. +* +* Given: +* VAL DOUBLE value computed by routine under test +* VALOK DOUBLE correct value +* DVAL DOUBLE maximum allowable error +* FUNC CHARACTER name of routine under test +* TEST CHARACTER name of individual test (or ' ') +* +* Given and returned: +* STATUS LOGICAL set to .FALSE. if test fails +* +* Called: ERR +* +* Last revision: 25 May 2002 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION VAL, VALOK, DVAL + CHARACTER*(*) FUNC, TEST + LOGICAL STATUS + + + IF ( DABS ( VAL - VALOK ) .GT. DVAL ) THEN + CALL ERR ( FUNC, TEST, STATUS ) + WRITE (*,'(1X,'' expected ='',G30.19)') VALOK + WRITE (*,'(1X,'' actual = '',G30.19)') VAL + END IF + + END + + SUBROUTINE ERR ( FUNC, TEST, STATUS ) +*+ +* - - - - +* E R R +* - - - - +* +* Report a failed test. +* +* Internal routine used by sla_TEST program. +* +* Given: +* FUNC CHARACTER name of routine under test +* TEST CHARACTER name of individual test (or ' ') +* +* Given and returned: +* STATUS LOGICAL set to .FALSE. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + CHARACTER*(*) FUNC, TEST + LOGICAL STATUS + + + WRITE (*,'(1X,A,'' test '',A,'' fails:'')') FUNC, TEST + STATUS = .FALSE. + + END + + SUBROUTINE T_ADDET ( STATUS ) +*+ +* - - - - - - - - +* T _ A D E T +* - - - - - - - - +* +* Test slADET, slSUET routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slADET, VVD, slSUET. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION RM, DM, EQ, R1, D1, R2, D2 + + RM = 2D0 + DM = -1D0 + EQ = 1975D0 + + CALL slADET ( RM, DM, EQ, R1, D1 ) + CALL VVD ( R1 - RM, 2.983864874295250D-6, 1D-12, 'slADET', + : 'R', STATUS ) + CALL VVD ( D1 - DM, 2.379650804185118D-7, 1D-12, 'slADET', + : 'D', STATUS ) + + CALL slSUET ( R1, D1, EQ, R2, D2 ) + CALL VVD ( R2 - RM, 0D0, 1D-12, 'slSUET', 'R', STATUS ) + CALL VVD ( D2 - DM, 0D0, 1D-12, 'slSUET', 'D', STATUS ) + + END + + SUBROUTINE T_AFIN ( STATUS ) +*+ +* - - - - - - - +* T _ A F I N +* - - - - - - - +* +* Test slAFIN and slDAFN routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slAFIN, VIV, VVD, slDAFN. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER I, J + REAL F + DOUBLE PRECISION D + CHARACTER*12 S + DATA S /'12 34 56.7 |'/ + + + I = 1 + CALL slAFIN (S, I, F, J) + CALL VIV ( I, 12, 'slAFIN', 'I', STATUS ) + CALL VVD ( DBLE( F ), 0.2196045986911432D0, 1D-6, 'slAFIN', + : 'A', STATUS ) + CALL VIV ( J, 0, 'slAFIN', 'J', STATUS ) + + I = 1 + CALL slDAFN (S, I, D, J) + CALL VIV ( I, 12, 'slDAFN', 'I', STATUS ) + CALL VVD ( D, 0.2196045986911432D0, 1D-12, 'slDAFN', 'A', + : STATUS ) + CALL VIV ( J, 0, 'slDAFN', 'J', STATUS ) + + END + + SUBROUTINE T_AIRMAS ( STATUS ) +*+ +* - - - - - - - - - +* T _ A R M S +* - - - - - - - - - +* +* Test slARMS routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: VVD, slARMS. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slARMS + + + CALL VVD ( slARMS ( 1.2354D0 ), 3.015698990074724D0, + : 1D-12, 'slARMS', ' ', STATUS ) + + END + + SUBROUTINE T_ALTAZ ( STATUS ) +*+ +* - - - - - - - - +* T _ A L A Z +* - - - - - - - - +* +* Test slALAZ routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slALAZ, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION AZ, AZD, AZDD, EL, ELD, ELDD, PA, PAD, PADD + + CALL slALAZ ( 0.7D0, -0.7D0, -0.65D0, + : AZ, AZD, AZDD, EL, ELD, ELDD, PA, PAD, PADD ) + + CALL VVD ( AZ, 4.400560746660174D0, 1D-12, 'slALAZ', + : 'AZ', STATUS ) + CALL VVD ( AZD, -0.2015438937145421D0, 1D-13, 'slALAZ', + : 'AZD', STATUS ) + CALL VVD ( AZDD, -0.4381266949668748D0, 1D-13, 'slALAZ', + : 'AZDD', STATUS ) + CALL VVD ( EL, 1.026646506651396D0, 1D-12, 'slALAZ', + : 'EL', STATUS ) + CALL VVD ( ELD, -0.7576920683826450D0, 1D-13, 'slALAZ', + : 'ELD', STATUS ) + CALL VVD ( ELDD, 0.04922465406857453D0, 1D-14, 'slALAZ', + : 'ELDD', STATUS ) + CALL VVD ( PA, 1.707639969653937D0, 1D-12, 'slALAZ', + : 'PA', STATUS ) + CALL VVD ( PAD, 0.4717832355365627D0, 1D-13, 'slALAZ', + : 'PAD', STATUS ) + CALL VVD ( PADD, -0.2957914128185515D0, 1D-13, 'slALAZ', + : 'PADD', STATUS ) + + END + + SUBROUTINE T_AMP ( STATUS ) +*+ +* - - - - - - +* T _ A M P +* - - - - - - +* +* Test slAMP, slMAPA, slAMPQ routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slAMP, VVD. +* +* Last revision: 16 November 2001 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION RM, DM + + CALL slAMP ( 2.345D0, -1.234D0, 50100D0, 1990D0, RM, DM ) + CALL VVD ( RM, 2.344472180027961D0, 1D-11, 'slAMP', 'R', + : STATUS ) + CALL VVD ( DM, -1.233573099847705D0, 1D-11, 'slAMP', 'D', + : STATUS ) + + END + + SUBROUTINE T_AOP ( STATUS ) +*+ +* - - - - - - +* T _ A O P +* - - - - - - +* +* Test slAOP, slAOPA, slAOPQ, slOAP, slOAPQ, +* slAOPT routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slAOP, VVD, slAOPA, slAOPQ, slOAP, slOAPQ, +* slAOPT. +* +* Defined in slamac.h: DS2R +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER I + DOUBLE PRECISION DS2R + DOUBLE PRECISION RAP, DAP, DATE, DUT, ELONGM, PHIM, HM, XP, YP, + : TDK, PMB, RH, WL, TLR, AOB, ZOB, HOB, DOB, ROB, AOPRMS(14) + + PARAMETER (DS2R = + : 7.2722052166430399038487115353692196393452995355905D-5) + + DAP = -0.1234D0 + DATE = 51000.1D0 + DUT = 25D0 + ELONGM = 2.1D0 + PHIM = 0.5D0 + HM = 3000D0 + XP = -0.5D-6 + YP = 1D-6 + TDK = 280D0 + PMB = 550D0 + RH = 0.6D0 + TLR = 0.006D0 + + DO I = 1, 3 + + IF ( I .EQ. 1 ) THEN + RAP = 2.7D0 + WL = 0.45D0 + ELSE IF ( I .EQ. 2 ) THEN + RAP = 2.345D0 + ELSE + WL = 1D6 + END IF + + CALL slAOP ( RAP, DAP, DATE, DUT, ELONGM, PHIM, HM, XP, YP, + : TDK, PMB, RH, WL, TLR, AOB, ZOB, HOB, DOB, ROB ) + + IF ( I .EQ. 1 ) THEN + CALL VVD ( AOB, 1.812817787123283034D0, 1D-10, 'slAOP', + : 'lo aob', STATUS ) + CALL VVD ( ZOB, 1.393860816635714034D0, 1D-10, 'slAOP', + : 'lo zob', STATUS ) + CALL VVD ( HOB, -1.297808009092456683D0, 1D-10, 'slAOP', + : 'lo hob', STATUS ) + CALL VVD ( DOB, -0.122967060534561D0, 1D-10, 'slAOP', + : 'lo dob', STATUS ) + CALL VVD ( ROB, 2.699270287872084D0, 1D-10, 'slAOP', + : 'lo rob', STATUS ) + ELSE IF ( I .EQ. 2 ) THEN + CALL VVD ( AOB, 2.019928026670621442D0, 1D-10, 'slAOP', + : 'aob/o', STATUS ) + CALL VVD ( ZOB, 1.101316172427482466D0, 1D-10, 'slAOP', + : 'zob/o', STATUS ) + CALL VVD ( HOB, -0.9432923558497740862D0, 1D-10, 'slAOP', + : 'hob/o', STATUS ) + CALL VVD ( DOB, -0.1232144708194224D0, 1D-10, 'slAOP', + : 'dob/o', STATUS ) + CALL VVD ( ROB, 2.344754634629428D0, 1D-10, 'slAOP', + : 'rob/o', STATUS ) + ELSE + CALL VVD ( AOB, 2.019928026670621442D0, 1D-10, 'slAOP', + : 'aob/r', STATUS ) + CALL VVD ( ZOB, 1.101267532198003760D0, 1D-10, 'slAOP', + : 'zob/r', STATUS ) + CALL VVD ( HOB, -0.9432533138143315937D0, 1D-10, 'slAOP', + : 'hob/r', STATUS ) + CALL VVD ( DOB, -0.1231850665614878D0, 1D-10, 'slAOP', + : 'dob/r', STATUS ) + CALL VVD ( ROB, 2.344715592593984D0, 1D-10, 'slAOP', + : 'rob/r', STATUS ) + END IF + END DO + + DATE = 48000.3D0 + WL = 0.45D0 + + CALL slAOPA ( DATE, DUT, ELONGM, PHIM, HM, XP, YP, TDK, + : PMB, RH, WL, TLR, AOPRMS ) + CALL VVD ( AOPRMS(1), 0.4999993892136306D0, 1D-13, 'slAOPA', + : '1', STATUS ) + CALL VVD ( AOPRMS(2), 0.4794250025886467D0, 1D-13, 'slAOPA', + : '2', STATUS ) + CALL VVD ( AOPRMS(3), 0.8775828547167932D0, 1D-13, 'slAOPA', + : '3', STATUS ) + CALL VVD ( AOPRMS(4), 1.363180872136126D-6, 1D-13, 'slAOPA', + : '4', STATUS ) + CALL VVD ( AOPRMS(5), 3000D0, 1D-10, 'slAOPA', '5', + : STATUS ) + CALL VVD ( AOPRMS(6), 280D0, 1D-11, 'slAOPA', '6', + : STATUS ) + CALL VVD ( AOPRMS(7), 550D0, 1D-11, 'slAOPA', '7', + : STATUS ) + CALL VVD ( AOPRMS(8), 0.6D0, 1D-13, 'slAOPA', '8', + : STATUS ) + CALL VVD ( AOPRMS(9), 0.45D0, 1D-13, 'slAOPA', '9', + : STATUS ) + CALL VVD ( AOPRMS(10), 0.006D0, 1D-15, 'slAOPA', '10', + : STATUS ) + CALL VVD ( AOPRMS(11), 0.0001562803328459898D0, 1D-13, + : 'slAOPA', '11', STATUS ) + CALL VVD ( AOPRMS(12), -1.792293660141D-7, 1D-13, + : 'slAOPA', '12', STATUS ) + CALL VVD ( AOPRMS(13), 2.101874231495843D0, 1D-13, + : 'slAOPA', '13', STATUS ) + CALL VVD ( AOPRMS(14), 7.601916802079765D0, 1D-8, + : 'slAOPA', '14', STATUS ) + + CALL slOAP ( 'R', 1.6D0, -1.01D0, DATE, DUT, ELONGM, PHIM, + : HM, XP, YP, TDK, PMB, RH, WL, TLR, RAP, DAP ) + CALL VVD ( RAP, 1.601197569844787D0, 1D-10, 'slOAP', + : 'Rr', STATUS ) + CALL VVD ( DAP, -1.012528566544262D0, 1D-10, 'slOAP', + : 'Rd', STATUS ) + CALL slOAP ( 'H', -1.234D0, 2.34D0, DATE, DUT, ELONGM, PHIM, + : HM, XP, YP, TDK, PMB, RH, WL, TLR, RAP, DAP ) + CALL VVD ( RAP, 5.693087688154886463D0, 1D-10, 'slOAP', + : 'Hr', STATUS ) + CALL VVD ( DAP, 0.8010281167405444D0, 1D-10, 'slOAP', + : 'Hd', STATUS ) + CALL slOAP ( 'A', 6.1D0, 1.1D0, DATE, DUT, ELONGM, PHIM, + : HM, XP, YP, TDK, PMB, RH, WL, TLR, RAP, DAP ) + CALL VVD ( RAP, 5.894305175192448940D0, 1D-10, 'slOAP', + : 'Ar', STATUS ) + CALL VVD ( DAP, 1.406150707974922D0, 1D-10, 'slOAP', + : 'Ad', STATUS ) + + CALL slOAPQ ( 'R', 2.1D0, -0.345D0, AOPRMS, RAP, DAP ) + CALL VVD ( RAP, 2.10023962776202D0, 1D-10, 'slOAPQ', + : 'Rr', STATUS ) + CALL VVD ( DAP, -0.3452428692888919D0, 1D-10, 'slOAPQ', + : 'Rd', STATUS ) + CALL slOAPQ ( 'H', -0.01D0, 1.03D0, AOPRMS, RAP, DAP ) + CALL VVD ( RAP, 1.328731933634564995D0, 1D-10, 'slOAPQ', + : 'Hr', STATUS ) + CALL VVD ( DAP, 1.030091538647746D0, 1D-10, 'slOAPQ', + : 'Hd', STATUS ) + CALL slOAPQ ( 'A', 4.321D0, 0.987D0, AOPRMS, RAP, DAP ) + CALL VVD ( RAP, 0.4375507112075065923D0, 1D-10, 'slOAPQ', + : 'Ar', STATUS ) + CALL VVD ( DAP, -0.01520898480744436D0, 1D-10, 'slOAPQ', + : 'Ad', STATUS ) + + CALL slAOPT ( DATE + DS2R, AOPRMS ) + CALL VVD ( AOPRMS(14), 7.602374979243502D0, 1D-8, 'slAOPT', + : ' ', STATUS ) + + END + + SUBROUTINE T_BEAR ( STATUS ) +*+ +* - - - - - - - +* T _ B E A R +* - - - - - - - +* +* Test slBEAR, slDBER, slDPAV, slPAV routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: VVD, slBEAR, slDBER, +* slDS2C, slPAV, slDPAV. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER I + REAL F1(3), F2(3) + REAL slBEAR, slPAV + DOUBLE PRECISION D1(3), D2(3) + DOUBLE PRECISION A1, B1, A2, B2 + DOUBLE PRECISION slDBER, slDPAV + + + A1 = 1.234D0 + B1 = -0.123D0 + A2 = 2.345D0 + B2 = 0.789D0 + + CALL VVD ( DBLE( slBEAR ( SNGL( A1 ), SNGL( B1 ), SNGL( A2 ), + : SNGL( B2 ) ) ), 0.7045970341781791D0, 1D-6, + : 'slBEAR', ' ', STATUS ) + CALL VVD ( slDBER ( A1, B1, A2, B2 ), 0.7045970341781791D0, + : 1D-12, 'slDBER', ' ', STATUS ) + CALL slDS2C ( A1, B1, D1 ) + CALL slDS2C ( A2, B2, D2 ) + + DO I = 1, 3 + F1(I) = SNGL( D1(I) ) + F2(I) = SNGL( D2(I) ) + END DO + + CALL VVD ( DBLE( slPAV ( F1, F2 ) ), 0.7045970341781791D0, + : 1D-6, 'slPAV', ' ', STATUS ) + CALL VVD ( slDPAV ( D1, D2 ), 0.7045970341781791D0, + : 1D-12, 'slDPAV', ' ', STATUS ) + + END + + SUBROUTINE T_CAF2R ( STATUS ) +*+ +* - - - - - - - - +* T _ C A F R +* - - - - - - - - +* +* Test slCAFR, slDAFR routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCAFR, VVD, VIV, slDAFR. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J + REAL R + DOUBLE PRECISION DR + + CALL slCAFR ( 76, 54, 32.1E0, R, J ) + CALL VVD ( DBLE( R ), 1.342313819975276D0, 1D-6, 'slCAFR', + : 'R', STATUS ) + CALL VIV ( J, 0, 'slCAFR', 'J', STATUS ) + CALL slDAFR ( 76, 54, 32.1D0, DR, J ) + CALL VVD ( DR, 1.342313819975276D0, 1D-12, 'slDAFR', + : 'R', STATUS ) + CALL VIV ( J, 0, 'slCAFR', 'J', STATUS ) + + END + + SUBROUTINE T_CALDJ ( STATUS ) +*+ +* - - - - - - - - +* T _ C A D J +* - - - - - - - - +* +* Test slCADJ routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCADJ, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J + DOUBLE PRECISION DJM + + CALL slCADJ ( 1999, 12, 31, DJM, J ) + CALL VVD ( DJM, 51543D0, 0D0, 'slCADJ', ' ', STATUS ) + + END + + SUBROUTINE T_CALYD ( STATUS ) +*+ +* - - - - - - - - +* T _ C A Y D +* - - - - - - - - +* +* Test slCAYD and slCLYD routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCAYD, slCLYD, VIV. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER NY, ND, J + + CALL slCAYD ( 46, 4, 30, NY, ND, J ) + CALL VIV ( NY, 2046, 'slCAYD', 'Y', STATUS ) + CALL VIV ( ND, 120, 'slCAYD', 'D', STATUS ) + CALL VIV ( J, 0, 'slCAYD', 'J', STATUS ) + CALL slCLYD ( -5000, 1, 1, NY, ND, J ) + CALL VIV ( J, 1, 'slCLYD', 'illegal year', STATUS ) + CALL slCLYD ( 1900, 0, 1, NY, ND, J ) + CALL VIV ( J, 2, 'slCLYD', 'illegal month', STATUS ) + CALL slCLYD ( 1900, 2, 29, NY, ND, J) + CALL VIV ( NY, 1900, 'slCLYD', 'illegal day (Y)', STATUS ) + CALL VIV ( ND, 61, 'slCLYD', 'illegal day (D)', STATUS ) + CALL VIV ( J, 3, 'slCLYD', 'illegal day (J)', STATUS ) + CALL slCLYD ( 2000, 2, 29, NY, ND, J ) + CALL VIV ( NY, 2000, 'slCLYD', 'Y', STATUS ) + CALL VIV ( ND, 60, 'slCLYD', 'D', STATUS ) + CALL VIV ( J, 0, 'slCLYD', 'J', STATUS ) + + END + + SUBROUTINE T_CC2S ( STATUS ) +*+ +* - - - - - - - +* T _ C C 2 S +* - - - - - - - +* +* Test slCC2S, slDC2S routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCC2S, VVD, slDC2S. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL V(3), A, B + DOUBLE PRECISION DV(3), DA, DB + + DATA V/100.0, -50.0, 25.0/ + DATA DV/100D0, -50D0, 25D0/ + + CALL slCC2S ( V, A, B ) + CALL VVD ( DBLE( A), -0.4636476090008061D0, 1D-6, 'slCC2S', + : 'A', STATUS ) + CALL VVD ( DBLE( B ), 0.2199879773954594D0, 1D-6, 'slCC2S', + : 'B', STATUS ) + + CALL slDC2S ( DV, DA, DB ) + CALL VVD ( DA, -0.4636476090008061D0, 1D-12, 'slDC2S', + : 'A', STATUS ) + CALL VVD ( DB, 0.2199879773954594D0, 1D-12, 'slDC2S', + : 'B', STATUS ) + + END + + SUBROUTINE T_CC62S ( STATUS ) +*+ +* - - - - - - - - +* T _ C 6 2 S +* - - - - - - - - +* +* Test slC62S, slDC6S routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slC62S, VVD, slDC6S. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL V(6), A, B, R, AD, BD, RD + DOUBLE PRECISION DV(6), DA, DB, DR, DAD, DBD, DRD + + DATA V/100.0, -50.0, 25.0, -0.1, 0.2, 0.7/ + DATA DV/100D0, -50D0, 25D0, -0.1D0, 0.2D0, 0.7D0/ + + CALL slC62S ( V, A, B, R, AD, BD, RD ) + CALL VVD ( DBLE( A ), -0.4636476090008061D0, 1D-6, 'slC62S', + : 'A', STATUS ) + CALL VVD ( DBLE( B ), 0.2199879773954594D0, 1D-6, 'slC62S', + : 'B', STATUS ) + CALL VVD ( DBLE( R ), 114.564392373896D0, 1D-3, 'slC62S', + : 'R', STATUS ) + CALL VVD ( DBLE( AD ), 0.001200000000000000D0, 1D-9, 'slC62S', + : 'AD', STATUS ) + CALL VVD ( DBLE( BD ), 0.006303582107999407D0, 1D-8, 'slC62S', + : 'BD', STATUS ) + CALL VVD ( DBLE( RD ), -0.02182178902359925D0, 1D-7, 'slC62S', + : 'RD', STATUS ) + + CALL slDC6S ( DV, DA, DB, DR, DAD, DBD, DRD ) + CALL VVD ( DA, -0.4636476090008061D0, 1D-6, 'slDC6S', + : 'A', STATUS ) + CALL VVD ( DB, 0.2199879773954594D0, 1D-6, 'slDC6S', + : 'B', STATUS ) + CALL VVD ( DR, 114.564392373896D0, 1D-9, 'slDC6S', + : 'R', STATUS ) + CALL VVD ( DAD, 0.001200000000000000D0, 1D-15, 'slDC6S', + : 'AD', STATUS ) + CALL VVD ( DBD, 0.006303582107999407D0, 1D-14, 'slDC6S', + : 'BD', STATUS ) + CALL VVD ( DRD, -0.02182178902359925D0, 1D-13, 'slDC6S', + : 'RD', STATUS ) + + END + + SUBROUTINE T_CD2TF ( STATUS ) +*+ +* - - - - - - - - +* T _ C D T F +* - - - - - - - - +* +* Test slCDTF, slDDTF routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCDTF, VIV, VVD, slDDTF. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER IHMSF(4) + CHARACTER S + + CALL slCDTF ( 4, -0.987654321E0, S, IHMSF ) + CALL VIV ( ICHAR( S ), ICHAR( '-' ), 'slCDTF', 'S', STATUS ) + CALL VIV ( IHMSF(1), 23, 'slCDTF', '(1)', STATUS ) + CALL VIV ( IHMSF(2), 42, 'slCDTF', '(2)', STATUS ) + CALL VIV ( IHMSF(3), 13, 'slCDTF', '(3)', STATUS ) + CALL VVD ( DFLOAT( IHMSF(4) ), 3333D0, 1000D0, 'slCDTF', + : '(4)', STATUS ) + + CALL slDDTF ( 4, -0.987654321D0, S, IHMSF ) + CALL VIV ( ICHAR( S ), ICHAR( '-' ), 'slDDTF', 'S', STATUS ) + CALL VIV ( IHMSF(1), 23, 'slDDTF', '(1)', STATUS ) + CALL VIV ( IHMSF(2), 42, 'slDDTF', '(2)', STATUS ) + CALL VIV ( IHMSF(3), 13, 'slDDTF', '(3)', STATUS ) + CALL VIV ( IHMSF(4), 3333, 'slDDTF', '(4)', STATUS ) + + END + + SUBROUTINE T_CLDJ ( STATUS ) +*+ +* - - - - - - - +* T _ C L D J +* - - - - - - - +* +* Test slCLDJ routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCLDJ, VVD, VIV. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J + DOUBLE PRECISION D + + CALL slCLDJ ( 1899, 12, 31, D, J ) + CALL VVD ( D, 15019D0, 0D0, 'slCLDJ', 'D', STATUS ) + CALL VIV ( J, 0, 'slCLDJ', 'J', STATUS ) + + END + + SUBROUTINE T_CR2AF ( STATUS ) +*+ +* - - - - - - - - +* T _ C R A F +* - - - - - - - - +* +* Test slCRAF, slDRAF routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCRAF, VIV, VVD, slDRAF. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER IDMSF(4) + CHARACTER S + + CALL slCRAF ( 4, 2.345E0, S, IDMSF ) + CALL VIV ( ICHAR( S ), ICHAR( '+' ), 'slCRAF', 'S', STATUS ) + CALL VIV ( IDMSF(1), 134, 'slCRAF', '(1)', STATUS ) + CALL VIV ( IDMSF(2), 21, 'slCRAF', '(2)', STATUS ) + CALL VIV ( IDMSF(3), 30, 'slCRAF', '(3)', STATUS ) + CALL VVD ( DBLE( IDMSF(4) ), 9706D0, 1000D0, 'slCRAF', + : '(4)', STATUS ) + + CALL slDRAF ( 4, 2.345D0, S, IDMSF ) + CALL VIV ( ICHAR( S ), ICHAR( '+' ), 'slDRAF', 'S', STATUS ) + CALL VIV ( IDMSF(1), 134, 'slDRAF', '(1)', STATUS ) + CALL VIV ( IDMSF(2), 21, 'slDRAF', '(2)', STATUS ) + CALL VIV ( IDMSF(3), 30, 'slDRAF', '(3)', STATUS ) + CALL VIV ( IDMSF(4), 9706, 'slDRAF', '(4)', STATUS ) + + END + + SUBROUTINE T_CR2TF ( STATUS ) +*+ +* - - - - - - - - +* T _ C R T F +* - - - - - - - - +* +* Test slCRTF, slDRTF routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCRTF, VIV, VVD, slDRTF. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER IHMSF(4) + CHARACTER S + + CALL slCRTF ( 4, -3.01234E0, S, IHMSF ) + CALL VIV ( ICHAR( S ), ICHAR( '-' ), 'slCRTF', 'S', STATUS ) + CALL VIV ( IHMSF(1), 11, 'slCRTF', '(1)', STATUS ) + CALL VIV ( IHMSF(2), 30, 'slCRTF', '(2)', STATUS ) + CALL VIV ( IHMSF(3), 22, 'slCRTF', '(3)', STATUS ) + CALL VVD ( DBLE( IHMSF(4) ), 6484D0, 1000D0, 'slCRTF', + : '(4)', STATUS ) + + CALL slDRTF ( 4, -3.01234D0, S, IHMSF ) + CALL VIV ( ICHAR( S ), ICHAR( '-' ), 'slDRTF', 'S', STATUS ) + CALL VIV ( IHMSF(1), 11, 'slDRTF', '(1)', STATUS ) + CALL VIV ( IHMSF(2), 30, 'slDRTF', '(2)', STATUS ) + CALL VIV ( IHMSF(3), 22, 'slDRTF', '(3)', STATUS ) + CALL VIV ( IHMSF(4), 6484, 'slDRTF', '(4)', STATUS ) + + END + + SUBROUTINE T_CS2C6 ( STATUS ) +*+ +* - - - - - - - - +* T _ S 2 C 6 +* - - - - - - - - +* +* Test slS2C6, slDSC6 routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slS2C6, VVD, slDSC6. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL V(6) + DOUBLE PRECISION DV(6) + + CALL slS2C6( -3.21E0, 0.123E0, 0.456E0, -7.8E-6, 9.01E-6, + : -1.23E-5, V ) + CALL VVD ( DBLE( V(1) ), -0.4514964673880165D0, + : 1D-6, 'slS2C6', 'X', STATUS ) + CALL VVD ( DBLE( V(2) ), 0.03093394277342585D0, + : 1D-6, 'slS2C6', 'Y', STATUS ) + CALL VVD ( DBLE( V(3) ), 0.05594668105108779D0, + : 1D-6, 'slS2C6', 'Z', STATUS ) + CALL VVD ( DBLE( V(4) ), 1.292270850663260D-5, + : 1D-6, 'slS2C6', 'XD', STATUS ) + CALL VVD ( DBLE( V(5) ), 2.652814182060692D-6, + : 1D-6, 'slS2C6', 'YD', STATUS ) + CALL VVD ( DBLE( V(6) ), 2.568431853930293D-6, + : 1D-6, 'slS2C6', 'ZD', STATUS ) + + CALL slDSC6( -3.21D0, 0.123D0, 0.456D0, -7.8D-6, 9.01D-6, + : -1.23D-5, DV ) + CALL VVD ( DV(1), -0.4514964673880165D0, 1D-12, 'slDSC6', + : 'X', STATUS ) + CALL VVD ( DV(2), 0.03093394277342585D0, 1D-12, 'slDSC6', + : 'Y', STATUS ) + CALL VVD ( DV(3), 0.05594668105108779D0, 1D-12, 'slDSC6', + : 'Z', STATUS ) + CALL VVD ( DV(4), 1.292270850663260D-5, 1D-12, 'slDSC6', + : 'XD', STATUS ) + CALL VVD ( DV(5), 2.652814182060692D-6, 1D-12, 'slDSC6', + : 'YD', STATUS ) + CALL VVD ( DV(6), 2.568431853930293D-6, 1D-12, 'slDSC6', + : 'ZD', STATUS ) + + END + + SUBROUTINE T_CTF2D ( STATUS ) +*+ +* - - - - - - - - +* T _ C T F D +* - - - - - - - - +* +* Test slCTFD, slDTFD routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCTFD, VVD, VIV, slDTFD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J + REAL D + DOUBLE PRECISION DD + + CALL slCTFD (23, 56, 59.1E0, D, J) + CALL VVD ( DBLE( D ), 0.99790625D0, 1D-6, 'slCTFD', + : 'D', STATUS ) + CALL VIV ( J, 0, 'slCTFD', 'J', STATUS ) + + CALL slDTFD (23, 56, 59.1D0, DD, J) + CALL VVD ( DD, 0.99790625D0, 1D-12, 'slDTFD', 'D', STATUS ) + CALL VIV ( J, 0, 'slDTFD', 'J', STATUS ) + + END + + SUBROUTINE T_CTF2R ( STATUS ) +*+ +* - - - - - - - - +* T _ C T F R +* - - - - - - - - +* +* Test slCTFR, slDTFR routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCTFR, VVD, VIV, slDTFR. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J + REAL R + DOUBLE PRECISION DR + + CALL slCTFR (23, 56, 59.1E0, R, J) + CALL VVD ( DBLE( R ), 6.270029887942679D0, 1D-6, 'slCTFR', + : 'R', STATUS ) + CALL VIV ( J, 0, 'slCTFR', 'J', STATUS ) + + CALL slDTFR (23, 56, 59.1D0, DR, J) + CALL VVD ( DR, 6.270029887942679D0, 1D-12, 'slDTFR', + : 'R', STATUS ) + CALL VIV ( J, 0, 'slDTFR', 'J', STATUS ) + + END + + SUBROUTINE T_DAT ( STATUS ) +*+ +* - - - - - - +* T _ D A T +* - - - - - - +* +* Test slDAT, slDTT, slDT routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slDAT, slDTT, slDT, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slDAT, slDTT, slDT + + + CALL VVD ( slDAT ( 43900D0 ), 18D0, 0D0, 'slDAT', + : ' ', STATUS ) + CALL VVD ( slDTT ( 40404D0 ), 39.709746D0, 1D-12, 'slDTT', + : ' ', STATUS ) + CALL VVD ( slDT ( 500D0 ), 4686.7D0, 1D-10, 'slDT', + : '500', STATUS ) + CALL VVD ( slDT ( 1400D0 ), 408D0, 1D-11, 'slDT', + : '1400', STATUS ) + CALL VVD ( slDT ( 1950D0 ), 27.99145626D0, 1D-12, 'slDT', + : '1950', STATUS ) + + END + + SUBROUTINE T_DBJIN ( STATUS ) +*+ +* - - - - - - - - +* T _ D B J I +* - - - - - - - - +* +* Test slDBJI routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slDBJI, VVD, VIV. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER I, JA, JB + DOUBLE PRECISION D + CHARACTER*32 S + DATA S /' B1950, , J 2000, B1975 JE '/ + + I = 1 + D = 0D0 + + CALL slDBJI ( S, I, D, JA, JB ) + CALL VIV ( I, 9, 'slDBJI', 'I1', STATUS ) + CALL VVD ( D, 1950D0, 0D0, 'slDBJI', 'D1', STATUS ) + CALL VIV ( JA, 0, 'slDBJI', 'JA1', STATUS ) + CALL VIV ( JB, 1, 'slDBJI', 'JB1', STATUS ) + + CALL slDBJI ( S, I, D, JA, JB ) + CALL VIV ( I, 11, 'slDBJI', 'I2', STATUS ) + CALL VVD ( D, 1950D0, 0D0, 'slDBJI', 'D2', STATUS ) + CALL VIV ( JA, 1, 'slDBJI', 'JA2', STATUS ) + CALL VIV ( JB, 0, 'slDBJI', 'JB2', STATUS ) + + CALL slDBJI ( S, I, D, JA, JB ) + CALL VIV ( I, 19, 'slDBJI', 'I3', STATUS ) + CALL VVD ( D, 2000D0, 0D0, 'slDBJI', 'D3', STATUS ) + CALL VIV ( JA, 0, 'slDBJI', 'JA3', STATUS ) + CALL VIV ( JB, 2, 'slDBJI', 'JB3', STATUS ) + + CALL slDBJI ( S, I, D, JA, JB ) + CALL VIV ( I, 26, 'slDBJI', 'I4', STATUS ) + CALL VVD ( D, 1975D0, 0D0, 'slDBJI', 'D4', STATUS ) + CALL VIV ( JA, 0, 'slDBJI', 'JA4', STATUS ) + CALL VIV ( JB, 1, 'slDBJI', 'JB4', STATUS ) + + CALL slDBJI ( S, I, D, JA, JB ) + CALL VIV ( I, 26, 'slDBJI', 'I5', STATUS ) + CALL VVD ( D, 1975D0, 0D0, 'slDBJI', 'D5', STATUS ) + CALL VIV ( JA, 1, 'slDBJI', 'JA5', STATUS ) + CALL VIV ( JB, 0, 'slDBJI', 'JB5', STATUS ) + + END + + SUBROUTINE T_DJCAL ( STATUS ) +*+ +* - - - - - - - - +* T _ D J C A +* - - - - - - - - +* +* Test slDJCA, slDJCL routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slDJCA, VIV. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER IYDMF(4), J, IY, IM, ID + DOUBLE PRECISION DJM + DOUBLE PRECISION F + + DJM = 50123.9999D0 + + CALL slDJCA ( 4, DJM, IYDMF, J ) + CALL VIV ( IYDMF(1), 1996, 'slDJCA', 'Y', STATUS ) + CALL VIV ( IYDMF(2), 2, 'slDJCA', 'M', STATUS ) + CALL VIV ( IYDMF(3), 10, 'slDJCA', 'D', STATUS ) + CALL VIV ( IYDMF(4), 9999, 'slDJCA', 'F', STATUS ) + CALL VIV ( J, 0, 'slDJCA', 'J', STATUS ) + + CALL slDJCL ( DJM, IY, IM, ID, F, J ) + CALL VIV ( IY, 1996, 'slDJCL', 'Y', STATUS ) + CALL VIV ( IM, 2, 'slDJCL', 'M', STATUS ) + CALL VIV ( ID, 10, 'slDJCL', 'D', STATUS ) + CALL VVD ( F, 0.9999D0, 1D-7, 'slDJCL', 'F', STATUS ) + CALL VIV ( J, 0, 'slDJCL', 'J', STATUS ) + + END + + SUBROUTINE T_DMAT ( STATUS ) +*+ +* - - - - - - - +* T _ D M A T +* - - - - - - - +* +* Test slDMAT routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slDMAT, VVD, VIV. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J, IW(3) + DOUBLE PRECISION DA(3,3) + DOUBLE PRECISION DV(3) + DOUBLE PRECISION DD + + DATA DA/2.22D0, 1.6578D0, 1.380522D0, + : 1.6578D0, 1.380522D0, 1.22548578D0, + : 1.380522D0, 1.22548578D0, 1.1356276122D0/ + DATA DV/2.28625D0, 1.7128825D0, 1.429432225D0/ + + CALL slDMAT ( 3, DA, DV, DD, J, IW ) + + CALL VVD ( DA(1,1), 18.02550629769198D0, + : 1D-10, 'slDMAT', 'A(1,1)', STATUS ) + CALL VVD ( DA(1,2), -52.16386644917280607D0, + : 1D-10, 'slDMAT', 'A(1,2)', STATUS ) + CALL VVD ( DA(1,3), 34.37875949717850495D0, + : 1D-10, 'slDMAT', 'A(1,3)', STATUS ) + CALL VVD ( DA(2,1), -52.16386644917280607D0, + : 1D-10, 'slDMAT', 'A(2,1)', STATUS ) + CALL VVD ( DA(2,2), 168.1778099099805627D0, + : 1D-10, 'slDMAT', 'A(2,2)', STATUS ) + CALL VVD ( DA(2,3), -118.0722869694232670D0, + : 1D-10, 'slDMAT', 'A(2,3)', STATUS ) + CALL VVD ( DA(3,1), 34.37875949717850495D0, + : 1D-10, 'slDMAT', 'A(3,1)', STATUS ) + CALL VVD ( DA(3,2), -118.0722869694232670D0, + : 1D-10, 'slDMAT', 'A(3,2)', STATUS ) + CALL VVD ( DA(3,3), 86.50307003740151262D0, + : 1D-10, 'slDMAT', 'A(3,3)', STATUS ) + CALL VVD ( DV(1), 1.002346480763383D0, + : 1D-12, 'slDMAT', 'V(1)', STATUS ) + CALL VVD ( DV(2), 0.03285594016974583489D0, + : 1D-12, 'slDMAT', 'V(2)', STATUS ) + CALL VVD ( DV(3), 0.004760688414885247309D0, + : 1D-12, 'slDMAT', 'V(3)', STATUS ) + CALL VVD ( DD, 0.003658344147359863D0, + : 1D-12, 'slDMAT', 'D', STATUS ) + CALL VIV ( J, 0, 'slDMAT', 'J', STATUS ) + + END + + SUBROUTINE T_E2H ( STATUS ) +*+ +* - - - - - - - +* T _ E 2 H +* - - - - - - - +* +* Test slE2H, slDE2H, slH2E, slDH2E routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: All the above plus VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL H, D, P, A, E + DOUBLE PRECISION DH, DD, DP, DA, DE + + DH = -0.3D0 + DD = -1.1D0 + DP = -0.7D0 + + H = SNGL( DH ) + D = SNGL( DD ) + P = SNGL( DP ) + + CALL slDE2H ( DH, DD, DP, DA, DE ) + CALL VVD ( DA, 2.820087515852369D0, 1D-12, 'slDE2H', + : 'AZ', STATUS ) + CALL VVD ( DE, 1.132711866443304D0, 1D-12, 'slDE2H', + : 'El', STATUS ) + + CALL slE2H ( H, D, P, A, E ) + CALL VVD ( DBLE( A ), 2.820087515852369D0, 1D-6, 'slE2H', + : 'AZ', STATUS ) + CALL VVD ( DBLE( E ), 1.132711866443304D0, 1D-6, 'slE2H', + : 'El', STATUS ) + + CALL slDH2E ( DA, DE, DP, DH, DD ) + CALL VVD ( DH, -0.3D0, 1D-12, 'slDH2E', 'HA', STATUS ) + CALL VVD ( DD, -1.1D0, 1D-12, 'slDH2E', 'DEC', STATUS ) + + CALL slH2E ( A, E, P, H, D ) + CALL VVD ( DBLE( H ), -0.3D0, 1D-6, 'slH2E', + : 'HA', STATUS ) + CALL VVD ( DBLE( D ), -1.1D0, 1D-6, 'slH2E', + : 'DEC', STATUS ) + + END + + SUBROUTINE T_EARTH ( STATUS ) +*+ +* - - - - - - - - +* T _ E R T H +* - - - - - - - - +* +* Test slERTH routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slERTH, VVD. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL PV(6) + + CALL slERTH ( 1978, 174, 0.87E0, PV ) + + CALL VVD ( DBLE( PV(1) ), 3.590867086D-2, 1D-6, 'slERTH', + : 'PV(1)', STATUS ) + CALL VVD ( DBLE( PV(2) ), -9.319285116D-1, 1D-6, 'slERTH', + : 'PV(2)', STATUS ) + CALL VVD ( DBLE( PV(3) ), -4.041039435D-1, 1D-6, 'slERTH', + : 'PV(3)', STATUS ) + CALL VVD ( DBLE( PV(4) ), 1.956930055D-7, 1D-13, 'slERTH', + : 'PV(4)', STATUS ) + CALL VVD ( DBLE( PV(5) ), 5.743797400D-9, 1D-13, 'slERTH', + : 'PV(5)', STATUS ) + CALL VVD ( DBLE( PV(6) ), 2.512001677D-9, 1D-13, 'slERTH', + : 'PV(6)', STATUS ) + + END + + SUBROUTINE T_ECLEQ ( STATUS ) +*+ +* - - - - - - - - +* T _ E C E Q +* - - - - - - - - +* +* Test slECEQ routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slECEQ, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION R, D + + CALL slECEQ ( 1.234D0, -0.123D0, 43210D0, R, D ) + + CALL VVD ( R, 1.229910118208851D0, 1D-12, 'slECEQ', + : 'RA', STATUS ) + CALL VVD ( D, 0.2638461400411088D0, 1D-12, 'slECEQ', + : 'DEC', STATUS ) + + END + + SUBROUTINE T_ECMAT ( STATUS ) +*+ +* - - - - - - - - +* T _ E C M A +* - - - - - - - - +* +* Test slECMA routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slECMA, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION RM(3,3) + + CALL slECMA ( 41234D0, RM ) + + CALL VVD ( RM(1,1), 1D0, 1D-12, 'slECMA', + : '(1,1)', STATUS ) + CALL VVD ( RM(1,2), 0D0, 1D-12, 'slECMA', + : '(1,2)', STATUS ) + CALL VVD ( RM(1,3), 0D0, 1D-12, 'slECMA', + : '(1,3)', STATUS ) + CALL VVD ( RM(2,1), 0D0, 1D-12, 'slECMA', + : '(2,1)', STATUS ) + CALL VVD ( RM(2,2), 0.917456575085716D0, 1D-12, 'slECMA', + : '(2,2)', STATUS ) + CALL VVD ( RM(2,3), 0.397835937079581D0, 1D-12, 'slECMA', + : '(2,3)', STATUS ) + CALL VVD ( RM(3,1), 0D0, 1D-12, 'slECMA', + : '(3,1)', STATUS ) + CALL VVD ( RM(3,2), -0.397835937079581D0, 1D-12, 'slECMA', + : '(3,2)', STATUS ) + CALL VVD ( RM(3,3), 0.917456575085716D0, 1D-12, 'slECMA', + : '(3,3)', STATUS ) + + END + + SUBROUTINE T_ECOR ( STATUS ) +*+ +* - - - - - - - +* T _ E C O R +* - - - - - - - +* +* Test slECOR routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slECOR, VVD. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL RV, Tl + + CALL slECOR ( 2.345E0, -0.567E0, 1995, 306, 0.037E0, RV, Tl ) + + CALL VVD ( DBLE( RV ), -19.182460D0, 1D-3, 'slECOR', + : 'RV', STATUS ) + CALL VVD ( DBLE( Tl ), -120.36632D0, 1D-2, 'slECOR', + : 'Tl', STATUS ) + + END + + SUBROUTINE T_EG50 ( STATUS ) +*+ +* - - - - - - - +* T _ E G 5 0 +* - - - - - - - +* +* Test slEG50 routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEG50, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION DL, DB + + CALL slEG50 ( 3.012D0, 1.234D0, DL, DB ) + + CALL VVD ( DL, 2.305557953813397D0, 1D-12, 'slEG50', + : 'L', STATUS ) + CALL VVD ( DB, 0.7903600886585871D0, 1D-12, 'slEG50', + : 'B', STATUS ) + + END + + SUBROUTINE T_EPB ( STATUS ) + +*+ +* - - - - - - +* T _ E P B +* - - - - - - +* +* Test slEPB routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEPB, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slEPB + + + CALL VVD ( slEPB ( 45123D0 ), 1982.419793168669D0, 1D-8, + : 'slEPB', ' ', STATUS ) + + END + + SUBROUTINE T_EPB2D ( STATUS ) +*+ +* - - - - - - - +* T _ E B 2 D +* - - - - - - - +* +* Test slEB2D routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEB2D, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slEB2D + + + CALL VVD ( slEB2D ( 1975.5D0 ), 42595.5995279655D0, 1D-7, + : 'slEB2D', ' ', STATUS ) + + END + + SUBROUTINE T_EPCO ( STATUS ) +*+ +* - - - - - - - +* T _ E P C O +* - - - - - - - +* +* Test slEPCO routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEPCO, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slEPCO + + + CALL VVD ( slEPCO ( 'B', 'J', 2000D0 ), 2000.001277513665D0, + : 1D-7, 'slEPCO', 'BJ', STATUS ) + CALL VVD ( slEPCO ( 'J', 'B', 1950D0 ), 1949.999790442300D0, + : 1D-7, 'slEPCO', 'JB', STATUS ) + CALL VVD ( slEPCO ( 'J', 'J', 2000D0 ), 2000D0, + : 1D-7, 'slEPCO', 'JJ', STATUS ) + + END + + SUBROUTINE T_EPJ ( STATUS ) +*+ +* - - - - - - +* T _ E P J +* - - - - - - +* +* Test slEPJ routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEPJ, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slEPJ + + + CALL VVD ( slEPJ ( 42999D0 ), 1976.603696098563D0, + : 1D-7, 'slEPJ', ' ', STATUS ) + + END + + SUBROUTINE T_EPJ2D ( STATUS ) +*+ +* - - - - - - - - +* T _ E J 2 D +* - - - - - - - - +* +* Test slEJ2D routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEJ2D, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slEJ2D + + + CALL VVD ( slEJ2D ( 2010.077D0 ), 55225.124250D0, + : 1D-6, 'slEJ2D', ' ', STATUS ) + + END + + SUBROUTINE T_EQECL ( STATUS ) +*+ +* - - - - - - - - +* T _ E Q E C +* - - - - - - - - +* +* Test slEQEC routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEQEC, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION DL, DB + + CALL slEQEC ( 0.789D0, -0.123D0, 46555D0, DL, DB ) + + CALL VVD ( DL, 0.7036566430349022D0, 1D-12, 'slEQEC', + : 'L', STATUS ) + CALL VVD ( DB, -0.4036047164116848D0, 1D-12, 'slEQEC', + : 'B', STATUS ) + + END + + SUBROUTINE T_EQEQX ( STATUS ) +*+ +* - - - - - - - - +* T _ E Q E X +* - - - - - - - - +* +* Test slEQEX routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEQEX, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slEQEX + + + CALL VVD ( slEQEX ( 41234D0 ), 5.376047445838358596D-5, + : 1D-17, 'slEQEX', ' ', STATUS ) + + END + + SUBROUTINE T_EQGAL ( STATUS ) +*+ +* - - - - - - - - +* T _ E Q G A +* - - - - - - - - +* +* Test slEQGA routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEQGA, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION DL, DB + + CALL slEQGA ( 5.67D0, -1.23D0, DL, DB ) + + CALL VVD ( DL, 5.612270780904526D0, 1D-12, 'slEQGA', + : 'DL', STATUS ) + CALL VVD ( DB, -0.6800521449061520D0, 1D-12, 'slEQGA', + : 'DB', STATUS ) + + END + + SUBROUTINE T_ETRMS ( STATUS ) +*+ +* - - - - - - - - +* T _ E T R M +* - - - - - - - - +* +* Test slETRM routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slETRM, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION EV(3) + + CALL slETRM ( 1976.9D0, EV ) + + CALL VVD ( EV(1), -1.621617102537041D-6, 1D-18, 'slETRM', + : 'X', STATUS ) + CALL VVD ( EV(2), -3.310070088507914D-7, 1D-18, 'slETRM', + : 'Y', STATUS ) + CALL VVD ( EV(3), -1.435296627515719D-7, 1D-18, 'slETRM', + : 'Z', STATUS ) + + END + + SUBROUTINE T_EVP ( STATUS ) +*+ +* - - - - - - +* T _ E V P +* - - - - - - +* +* Test slEVP and slEPV routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slEVP, slEPV, VVD. +* +* Last revision: 21 October 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION DVB(3), DPB(3), DVH(3), DPH(3) + + CALL slEVP ( 50100D0, 1990D0, DVB, DPB, DVH, DPH ) + + CALL VVD ( DVB(1), -1.807210068604058436D-7, 1D-14, 'slEVP', + : 'DVB(X)', STATUS ) + CALL VVD ( DVB(2), -8.385891022440320D-8, 1D-14, 'slEVP', + : 'DVB(Y)', STATUS ) + CALL VVD ( DVB(3), -3.635846882638055D-8, 1D-14, 'slEVP', + : 'DVB(Z)', STATUS ) + CALL VVD ( DPB(1), -0.4515615297360333D0, 1D-7, 'slEVP', + : 'DPB(X)', STATUS ) + CALL VVD ( DPB(2), 0.8103788166239596D0, 1D-7, 'slEVP', + : 'DPB(Y)', STATUS ) + CALL VVD ( DPB(3), 0.3514505204144827D0, 1D-7, 'slEVP', + : 'DPB(Z)', STATUS ) + CALL VVD ( DVH(1), -1.806354061156890855D-7, 1D-14, 'slEVP', + : 'DVH(X)', STATUS ) + CALL VVD ( DVH(2), -8.383798678086174D-8, 1D-14, 'slEVP', + : 'DVH(Y)', STATUS ) + CALL VVD ( DVH(3), -3.635185843644782D-8, 1D-14, 'slEVP', + : 'DVH(Z)', STATUS ) + CALL VVD ( DPH(1), -0.4478571659918565D0, 1D-7, 'slEVP', + : 'DPH(X)', STATUS ) + CALL VVD ( DPH(2), 0.8036439916076232D0, 1D-7, 'slEVP', + : 'DPH(Y)', STATUS ) + CALL VVD ( DPH(3), 0.3484298459102053D0, 1D-7, 'slEVP', + : 'DPH(Z)', STATUS ) + + CALL slEPV ( 53411.52501161D0, DPH, DVH, DPB, DVB ) + + CALL VVD ( DPH(1), -0.7757238809297653D0, 1D-12, 'slEPV', + : 'DPH(X)', STATUS ) + CALL VVD ( DPH(2), +0.5598052241363390D0, 1D-12, 'slEPV', + : 'DPH(Y)', STATUS ) + CALL VVD ( DPH(3), +0.2426998466481708D0, 1D-12, 'slEPV', + : 'DPH(Z)', STATUS ) + CALL VVD ( DVH(1), -0.0109189182414732D0, 1D-12, 'slEPV', + : 'DVH(X)', STATUS ) + CALL VVD ( DVH(2), -0.0124718726844084D0, 1D-12, 'slEPV', + : 'DVH(Y)', STATUS ) + CALL VVD ( DVH(3), -0.0054075694180650D0, 1D-12, 'slEPV', + : 'DVH(Z)', STATUS ) + CALL VVD ( DPB(1), -0.7714104440491060D0, 1D-12, 'slEPV', + : 'DPB(X)', STATUS ) + CALL VVD ( DPB(2), +0.5598412061824225D0, 1D-12, 'slEPV', + : 'DPB(Y)', STATUS ) + CALL VVD ( DPB(3), +0.2425996277722475D0, 1D-12, 'slEPV', + : 'DPB(Z)', STATUS ) + CALL VVD ( DVB(1), -0.0109187426811683D0, 1D-12, 'slEPV', + : 'DVB(X)', STATUS ) + CALL VVD ( DVB(2), -0.0124652546173285D0, 1D-12, 'slEPV', + : 'DVB(Y)', STATUS ) + CALL VVD ( DVB(3), -0.0054047731809662D0, 1D-12, 'slEPV', + : 'DVB(Z)', STATUS ) + + END + + SUBROUTINE T_FITXY ( STATUS ) +*+ +* - - - - - - - - +* T _ F T X Y +* - - - - - - - - +* +* Test slFTXY, slPXY, slINVF, slXYXY, slDCMF routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slFTXY, VVD, VIV, slPXY, slINVF, slXYXY, slDCMF. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J, NPTS + + PARAMETER (NPTS = 8) + + DOUBLE PRECISION XYE(2,NPTS) + DOUBLE PRECISION XYM(2,NPTS) + DOUBLE PRECISION COEFFS(6), XYP(2,NPTS), XRMS, YRMS, RRMS, + : BKWDS(6), X2, Y2, XZ, YZ, XS, YS, PERP, ORIENT + + DATA XYE/-23.4D0, -12.1D0, 32D0, -15.3D0, + : 10.9D0, 23.7D0, -3D0, 16.1D0, + : 45D0, 32.5D0, 8.6D0, -17D0, + : 15.3D0, 10D0, 121.7D0, -3.8D0/ + DATA XYM/-23.41D0, 12.12D0, 32.03D0, 15.34D0, + : 10.93D0,-23.72D0, -3.01D0, -16.10D0, + : 44.90D0,-32.46D0, 8.55D0, 17.02D0, + : 15.31D0,-10.07D0, 120.92D0, 3.81D0/ + +* Fit a 4-coeff linear model to relate two sets of (x,y) coordinates. + + CALL slFTXY ( 4, NPTS, XYE, XYM, COEFFS, J ) + CALL VVD ( COEFFS(1), -7.938263381515947D-3, + : 1D-12, 'slFTXY', '4/1', STATUS ) + CALL VVD ( COEFFS(2), 1.004640925187200D0, + : 1D-12, 'slFTXY', '4/2', STATUS ) + CALL VVD ( COEFFS(3), 3.976948048238268D-4, + : 1D-12, 'slFTXY', '4/3', STATUS ) + CALL VVD ( COEFFS(4), -2.501031681585021D-2, + : 1D-12, 'slFTXY', '4/4', STATUS ) + CALL VVD ( COEFFS(5), 3.976948048238268D-4, + : 1D-12, 'slFTXY', '4/5', STATUS ) + CALL VVD ( COEFFS(6), -1.004640925187200D0, + : 1D-12, 'slFTXY', '4/6', STATUS ) + CALL VIV ( J, 0, 'slFTXY', '4/J', STATUS ) + +* Same but 6-coeff. + + CALL slFTXY ( 6, NPTS, XYE, XYM, COEFFS, J ) + CALL VVD ( COEFFS(1), -2.617232551841476D-2, + : 1D-12, 'slFTXY', '6/1', STATUS ) + CALL VVD ( COEFFS(2), 1.005634905041421D0, + : 1D-12, 'slFTXY', '6/2', STATUS ) + CALL VVD ( COEFFS(3), 2.133045023329208D-3, + : 1D-12, 'slFTXY', '6/3', STATUS ) + CALL VVD ( COEFFS(4), 3.846993364417779909D-3, + : 1D-12, 'slFTXY', '6/4', STATUS ) + CALL VVD ( COEFFS(5), 1.301671386431460D-4, + : 1D-12, 'slFTXY', '6/5', STATUS ) + CALL VVD ( COEFFS(6), -0.9994827065693964D0, + : 1D-12, 'slFTXY', '6/6', STATUS ) + CALL VIV ( J, 0, 'slFTXY', '6/J', STATUS ) + +* Compute predicted coordinates and residuals. + + CALL slPXY ( NPTS, XYE, XYM, COEFFS, XYP, XRMS, YRMS, RRMS ) + CALL VVD ( XYP(1,1), -23.542232946855340D0, + : 1D-12, 'slPXY', 'X1', STATUS ) + CALL VVD ( XYP(2,1), -12.11293062297230597D0, + : 1D-12, 'slPXY', 'Y1', STATUS ) + CALL VVD ( XYP(1,2), 32.217034593616180D0, + : 1D-12, 'slPXY', 'X2', STATUS ) + CALL VVD ( XYP(2,2), -15.324048471959370D0, + : 1D-12, 'slPXY', 'Y2', STATUS ) + CALL VVD ( XYP(1,3), 10.914821358630950D0, + : 1D-12, 'slPXY', 'X3', STATUS ) + CALL VVD ( XYP(2,3), 23.712999520015880D0, + : 1D-12, 'slPXY', 'Y3', STATUS ) + CALL VVD ( XYP(1,4), -3.087475414568693D0, + : 1D-12, 'slPXY', 'X4', STATUS ) + CALL VVD ( XYP(2,4), 16.09512676604438414D0, + : 1D-12, 'slPXY', 'Y4', STATUS ) + CALL VVD ( XYP(1,5), 45.05759626938414666D0, + : 1D-12, 'slPXY', 'X5', STATUS ) + CALL VVD ( XYP(2,5), 32.45290015313210889D0, + : 1D-12, 'slPXY', 'Y5', STATUS ) + CALL VVD ( XYP(1,6), 8.608310538882801D0, + : 1D-12, 'slPXY', 'X6', STATUS ) + CALL VVD ( XYP(2,6), -17.006235743411300D0, + : 1D-12, 'slPXY', 'Y6', STATUS ) + CALL VVD ( XYP(1,7), 15.348618307280820D0, + : 1D-12, 'slPXY', 'X7', STATUS ) + CALL VVD ( XYP(2,7), 10.07063070741086835D0, + : 1D-12, 'slPXY', 'Y7', STATUS ) + CALL VVD ( XYP(1,8), 121.5833272936291482D0, + : 1D-12, 'slPXY', 'X8', STATUS ) + CALL VVD ( XYP(2,8), -3.788442308260240D0, + : 1D-12, 'slPXY', 'Y8', STATUS ) + CALL VVD ( XRMS ,0.1087247110488075D0, + : 1D-13, 'slPXY', 'XRMS', STATUS ) + CALL VVD ( YRMS, 0.03224481175794666D0, + : 1D-13, 'slPXY', 'YRMS', STATUS ) + CALL VVD ( RRMS, 0.1134054261398109D0, + : 1D-13, 'slPXY', 'RRMS', STATUS ) + +* Invert the model. + + CALL slINVF ( COEFFS, BKWDS, J ) + CALL VVD ( BKWDS(1), 0.02601750208015891D0, + : 1D-12, 'slINVF', '1', status) + CALL VVD ( BKWDS(2), 0.9943963945040283D0, + : 1D-12, 'slINVF', '2', status) + CALL VVD ( BKWDS(3), 0.002122190075497872D0, + : 1D-12, 'slINVF', '3', status) + CALL VVD ( BKWDS(4), 0.003852372795357474353D0, + : 1D-12, 'slINVF', '4', status) + CALL VVD ( BKWDS(5), 0.0001295047252932767D0, + : 1D-12, 'slINVF', '5', status) + CALL VVD ( BKWDS(6), -1.000517284779212D0, + : 1D-12, 'slINVF', '6', status) + CALL VIV ( J, 0, 'slINVF', 'J', STATUS ) + +* Transform one x,y. + + CALL slXYXY ( 44.5D0, 32.5D0, COEFFS, X2, Y2 ) + CALL VVD ( X2, 44.793904912083030D0, + : 1D-11, 'slXYXY', 'X', status) + CALL VVD ( Y2, -32.473548532471330D0, + : 1D-11, 'slXYXY', 'Y', status) + +* Decompose the fit into scales etc. + + CALL slDCMF ( COEFFS, XZ, YZ, XS, YS, PERP, ORIENT ) + CALL VVD ( XZ, -0.0260175020801628646D0, + : 1D-12, 'slDCMF', 'XZ', status) + CALL VVD ( YZ, -0.003852372795357474353D0, + : 1D-12, 'slDCMF', 'YZ', status) + CALL VVD ( XS, -1.00563491346569D0, + : 1D-12, 'slDCMF', 'XS', status) + CALL VVD ( YS, 0.999484982684761D0, + : 1D-12, 'slDCMF', 'YS', status) + CALL VVD ( PERP,-0.002004707996156263D0, + : 1D-12, 'slDCMF', 'P', status) + CALL VVD ( ORIENT, 3.14046086182333D0, + : 1D-12, 'slDCMF', 'O', status) + + END + + SUBROUTINE T_FK425 ( STATUS ) +*+ +* - - - - - - - - +* T _ F K 4 5 +* - - - - - - - - +* +* Test slFK45 routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slFK45. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION R2000, D2000, DR2000, DD2000, P2000, V2000 + + CALL slFK45 ( 1.234D0, -0.123D0, -1D-5, 2D-6, 0.5D0, + : 20D0, R2000, D2000, DR2000, DD2000, P2000, + : V2000 ) + + CALL VVD ( R2000, 1.244117554618727D0, 1D-12, 'slFK45', + : 'R', STATUS ) + CALL VVD ( D2000, -0.1213164254458709D0, 1D-12, 'slFK45', + : 'D', STATUS ) + CALL VVD ( DR2000, -9.964265838268711D-6, 1D-17, 'slFK45', + : 'DR', STATUS ) + CALL VVD ( DD2000, 2.038065265773541D-6, 1D-17, 'slFK45', + : 'DD', STATUS ) + CALL VVD ( P2000, 0.4997443812415410D0, 1D-12, 'slFK45', + : 'P', STATUS ) + CALL VVD ( V2000, 20.010460915421010D0, 1D-11, 'slFK45', + : 'V', STATUS ) + + END + + SUBROUTINE T_FK45Z ( STATUS ) +*+ +* - - - - - - - - +* T _ F 4 5 Z +* - - - - - - - - +* +* Test slF45Z routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slF45Z. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION R2000, D2000 + + CALL slF45Z ( 1.234D0, -0.123D0, 1984D0, R2000, D2000 ) + + CALL VVD ( R2000, 1.244616510731691D0, 1D-12, 'slF45Z', + : 'R', STATUS ) + CALL VVD ( D2000, -0.1214185839586555D0, 1D-12, 'slF45Z', + : 'D', STATUS ) + + END + + SUBROUTINE T_FK524 ( STATUS ) +*+ +* - - - - - - - - +* T _ F K 5 4 +* - - - - - - - - +* +* Test slFK54 routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slFK54. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION R1950, D1950, DR1950, DD1950, P1950, V1950 + + CALL slFK54 ( 4.567D0, -1.23D0, -3D-5, 8D-6, 0.29D0, + : -35D0, R1950, D1950, DR1950, DD1950, P1950, + : V1950 ) + + CALL VVD ( R1950, 4.543778603272084D0, 1D-12, 'slFK54', + : 'R', STATUS ) + CALL VVD ( D1950, -1.229642790187574D0, 1D-12, 'slFK54', + : 'D', STATUS ) + CALL VVD ( DR1950, -2.957873121769244D-5, 1D-17, 'slFK54', + : 'DR', STATUS ) + CALL VVD ( DD1950, 8.117725309659079D-6, 1D-17, 'slFK54', + : 'DD', STATUS ) + CALL VVD ( P1950, 0.2898494999992917D0, 1D-12, 'slFK54', + : 'P', STATUS ) + CALL VVD ( V1950, -35.026862824252680D0, 1D-11, 'slFK54', + : 'V', STATUS ) + + END + + SUBROUTINE T_FK52H ( STATUS ) +*+ +* - - - - - - - - +* T _ F K 5 H +* - - - - - - - - +* +* Test slFK5H, slHFK5, slF5HZ, slHF5Z routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slFK54, slHFK5. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION R5, D5, DR5, DD5, RH, DH, DRH, DDH + + CALL slFK5H ( 1.234D0, -0.987D0, 1D-6, -2D-6, RH, DH, DRH, + : DDH ) + CALL VVD ( RH, 1.234000000272122558D0, 1D-13, 'slFK5H', + : 'R', STATUS ) + CALL VVD ( DH, -0.9869999235218543959D0, 1D-13, 'slFK5H', + : 'D', STATUS ) + CALL VVD ( DRH, 0.000000993178295D0, 1D-13, 'slFK5H', + : 'DR', STATUS ) + CALL VVD ( DDH, -0.000001997665915D0, 1D-13, 'slFK5H', + : 'DD', STATUS ) + CALL slHFK5 ( RH, DH, DRH, DDH, r5, D5, DR5, DD5 ) + CALL VVD ( R5, 1.234D0, 1D-13, 'slHFK5', 'R', STATUS ) + CALL VVD ( D5, -0.987D0, 1D-13, 'slHFK5', 'D', STATUS ) + CALL VVD ( DR5, 1D-6, 1D-13, 'slHFK5', 'DR', STATUS ) + CALL VVD ( DD5, -2D-6, 1D-13, 'slHFK5', 'DD', STATUS ) + CALL slF5HZ ( 1.234D0, -0.987D0, 1980D0, RH, DH ) + CALL VVD ( RH, 1.234000136713611301D0, 1D-13, 'slF5HZ', + : 'R', STATUS ) + CALL VVD ( DH, -0.9869999702020807601D0, 1D-13, 'slF5HZ', + : 'D', STATUS ) + CALL slHF5Z ( RH, DH, 1980D0, R5, D5, DR5, DD5 ) + CALL VVD ( R5, 1.234D0, 1D-13, 'slHF5Z', 'R', STATUS ) + CALL VVD ( D5, -0.987D0, 1D-13, 'slHF5Z', 'D', STATUS ) + CALL VVD ( DR5, 0.000000006822074D0, 1D-13, 'slHF5Z', + : 'DR', STATUS ) + CALL VVD ( DD5, -0.000000002334012D0, 1D-13, 'slHF5Z', + : 'DD', STATUS ) + + END + + SUBROUTINE T_FK54Z ( STATUS ) +*+ +* - - - - - - - - +* T _ F 5 4 Z +* - - - - - - - - +* +* Test slF54Z routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slF54Z. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION R1950, D1950, DR1950, DD1950 + + CALL slF54Z ( 0.001D0, -1.55D0, 1900D0, R1950, D1950, + : DR1950, DD1950 ) + + CALL VVD ( R1950, 6.271585543439484D0, 1D-12, 'slF54Z', + : 'R', STATUS ) + CALL VVD ( D1950, -1.554861715330319D0, 1D-12, 'slF54Z', + : 'D', STATUS ) + CALL VVD ( DR1950, -4.175410876044916011D-8, 1D-20, 'slF54Z', + : 'DR', STATUS ) + CALL VVD ( DD1950, 2.118595098308522D-8, 1D-20, 'slF54Z', + : 'DD', STATUS ) + + END + + SUBROUTINE T_FLOTIN ( STATUS ) +*+ +* - - - - - - - - - +* T _ R F L I +* - - - - - - - - - +* +* Test slRFLI, slDFLI routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slRFLI, VVD, VIV, slDFLI. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER I, J + REAL FV + DOUBLE PRECISION DV + CHARACTER*33 S + DATA S /' 12.345, , -0 1E3-4 2000 E '/ + + I = 1 + FV = 0.0 + + CALL slRFLI ( S, I, FV, J ) + CALL VIV ( I, 10, 'slRFLI', 'V5', STATUS ) + CALL VVD ( DBLE( FV ), 12.345D0, 1D-5, 'slRFLI', + : 'V1', STATUS ) + CALL VIV ( J, 0, 'slRFLI', 'J1', STATUS ) + + CALL slRFLI ( S, I, FV, J ) + CALL VIV ( I, 12, 'slRFLI', 'I2', STATUS ) + CALL VVD ( DBLE( FV ), 12.345D0, 1D-5, 'slRFLI', + : 'V2', STATUS ) + CALL VIV ( J, 1, 'slRFLI', 'J2', STATUS ) + + CALL slRFLI ( S, I, FV, J ) + CALL VIV ( I, 16, 'slRFLI', 'I3', STATUS ) + CALL VVD ( DBLE( FV ), 0D0, 0D0, 'slRFLI', 'V3', STATUS ) + CALL VIV ( J, -1, 'slRFLI', 'J3', STATUS ) + + CALL slRFLI ( S, I, FV, J ) + CALL VIV ( I, 19, 'slRFLI', 'I4', STATUS ) + CALL VVD ( DBLE( FV), 1000D0, 0D0, 'slRFLI', 'V4', STATUS ) + CALL VIV ( J, 0, 'slRFLI', 'J4', STATUS ) + + CALL slRFLI ( S, I, FV, J ) + CALL VIV ( I, 22, 'slRFLI', 'I5', STATUS ) + CALL VVD ( DBLE( FV ), -4D0, 0D0, 'slRFLI', 'V5', STATUS ) + CALL VIV ( J, -1, 'slRFLI', 'J5', STATUS ) + + CALL slRFLI ( S, I, FV, J ) + CALL VIV ( I, 28, 'slRFLI', 'I6', STATUS ) + CALL VVD ( DBLE( FV ), 2000D0, 0D0, 'slRFLI', + : 'V6', STATUS ) + CALL VIV ( J, 0, 'slRFLI', 'J6', STATUS ) + + CALL slRFLI ( S, I, FV, J ) + CALL VIV ( I, 34, 'slRFLI', 'I7', STATUS ) + CALL VVD ( DBLE( FV ), 2000D0, 0D0, 'slRFLI', + : 'V7', STATUS ) + CALL VIV ( J, 2, 'slRFLI', 'J7', STATUS ) + + I = 1 + DV = 0D0 + + CALL slDFLI ( S, I, DV, J ) + CALL VIV ( I, 10, 'slDFLI', 'I1', STATUS ) + CALL VVD ( DV, 12.345D0, 1D-12, 'slDFLI', 'V1', STATUS ) + CALL VIV ( J, 0, 'slDFLI', 'J1', STATUS ) + + CALL slDFLI ( S, I, DV, J ) + CALL VIV ( I, 12, 'slDFLI', 'I2', STATUS ) + CALL VVD ( DV, 12.345D0, 1D-12, 'slDFLI', 'V2', STATUS ) + CALL VIV ( J, 1, 'slDFLI', 'J2', STATUS ) + + CALL slDFLI ( S, I, DV, J ) + CALL VIV ( I, 16, 'slDFLI', 'I3', STATUS ) + CALL VVD ( DV, 0D0, 0D0, 'slDFLI', 'V3', STATUS ) + CALL VIV ( J, -1, 'slDFLI', 'J3', STATUS ) + + CALL slDFLI ( S, I, DV, J ) + CALL VIV ( I, 19, 'slDFLI', 'I4', STATUS ) + CALL VVD ( DV, 1000D0, 0D0, 'slDFLI', 'V4', STATUS ) + CALL VIV ( J, 0, 'slDFLI', 'J4', STATUS ) + + CALL slDFLI ( S, I, DV, J ) + CALL VIV ( I, 22, 'slDFLI', 'I5', STATUS ) + CALL VVD ( DV, -4D0, 0D0, 'slDFLI', 'V5', STATUS ) + CALL VIV ( J, -1, 'slDFLI', 'J5', STATUS ) + + CALL slDFLI ( S, I, DV, J ) + CALL VIV ( I, 28, 'slDFLI', 'I6', STATUS ) + CALL VVD ( DV, 2000D0, 0D0, 'slDFLI', 'V6', STATUS ) + CALL VIV ( J, 0, 'slDFLI', 'J6', STATUS ) + + CALL slDFLI ( S, I, DV, J ) + CALL VIV ( I, 34, 'slDFLI', 'I7', STATUS ) + CALL VVD ( DV, 2000D0, 0D0, 'slDFLI', 'V7', STATUS ) + CALL VIV ( J, 2, 'slDFLI', 'J7', STATUS ) + + END + + SUBROUTINE T_GALEQ ( STATUS ) +*+ +* - - - - - - - - +* T _ G A E Q +* - - - - - - - - +* +* Test slGAEQ routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slGAEQ, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION DR, DD + + CALL slGAEQ ( 5.67D0, -1.23D0, DR, DD ) + + CALL VVD ( DR, 0.04729270418071426D0, 1D-12, 'slGAEQ', + : 'DR', STATUS ) + CALL VVD ( DD, -0.7834003666745548D0, 1D-12, 'slGAEQ', + : 'DD', STATUS ) + + END + + SUBROUTINE T_GALSUP ( STATUS ) +*+ +* - - - - - - - - - +* T _ G A S U +* - - - - - - - - - +* +* Test slGASU routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slGASU, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION DSL, DSB + + CALL slGASU ( 6.1D0, -1.4D0, DSL, DSB ) + + CALL VVD ( DSL, 4.567933268859171D0, 1D-12, 'slGASU', + : 'DSL', STATUS ) + CALL VVD ( DSB, -0.01862369899731829D0, 1D-12, 'slGASU', + : 'DSB', STATUS ) + + END + + SUBROUTINE T_GE50 ( STATUS ) +*+ +* - - - - - - - +* T _ G E 5 0 +* - - - - - - - +* +* Test slGE50 routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slGE50, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION DR, DD + + CALL slGE50 ( 6.1D0, -1.55D0, DR, DD ) + + CALL VVD ( DR, 0.1966825219934508D0, 1D-12, 'slGE50', + : 'DR', STATUS ) + CALL VVD ( DD, -0.4924752701678960D0, 1D-12, 'slGE50', + : 'DD', STATUS ) + + END + + SUBROUTINE T_GMST ( STATUS ) +*+ +* - - - - - - - +* T _ G M S T +* - - - - - - - +* +* Test slGMST and slGMSA routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slGMST, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slGMST, slGMSA + + + CALL VVD ( slGMST ( 43999.999D0 ), 3.9074971356487318D0, + : 1D-9, 'slGMST', ' ', STATUS ) + CALL VVD ( slGMSA ( 43999D0, 0.999D0 ), + : 3.9074971356487318D0, 1D-12, 'slGMSA', ' ', STATUS ) + + END + + SUBROUTINE T_INTIN ( STATUS ) +*+ +* - - - - - - - - +* T _ I N T I +* - - - - - - - - +* +* Test slINTI routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slINTI, VIV. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER*4 N + INTEGER I, J + CHARACTER*28 S + DATA S /' -12345, , -0 2000 + '/ + + I = 1 + N = 0 + + CALL slINTI ( S, I, N, J ) + CALL VIV ( I, 10, 'slINTI', 'I1', STATUS ) + CALL VLV ( N, -12345, 'slINTI', 'V1', STATUS ) + CALL VIV ( J, -1, 'slINTI', 'J1', STATUS ) + + CALL slINTI ( S, I, N, J ) + CALL VIV ( I, 12, 'slINTI', 'I2', STATUS ) + CALL VLV ( N, -12345, 'slINTI', 'V2', STATUS ) + CALL VIV ( J, 1, 'slINTI', 'J2', STATUS ) + + CALL slINTI ( S, I, N, J ) + CALL VIV ( I, 17, 'slINTI', 'I3', STATUS ) + CALL VLV ( N, 0, 'slINTI', 'V3', STATUS ) + CALL VIV ( J, -1, 'slINTI', 'J3', STATUS ) + + CALL slINTI ( S, I, N, J ) + CALL VIV ( I, 23, 'slINTI', 'I4', STATUS ) + CALL VLV ( N, 2000, 'slINTI', 'V4', STATUS ) + CALL VIV ( J, 0, 'slINTI', 'J4', STATUS ) + + CALL slINTI ( S, I, N, J ) + CALL VIV ( I, 29, 'slINTI', 'I5', STATUS ) + CALL VLV ( N, 2000, 'slINTI', 'V5', STATUS ) + CALL VIV ( J, 2, 'slINTI', 'J5', STATUS ) + + END + + SUBROUTINE T_KBJ ( STATUS ) +*+ +* - - - - - - +* T _ K B J +* - - - - - - +* +* Test slKBJ routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slKBJ, VCS, VIV. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J + DOUBLE PRECISION E + CHARACTER K + DATA K /'?'/ + + E = 1950D0 + CALL slKBJ ( -1, E, K, J ) + CALL VCS ( K, ' ', 'slKBJ', 'JB1', STATUS ) + CALL VIV ( J, 1, 'slKBJ', 'J1', STATUS ) + CALL slKBJ ( 0, E, K, J ) + CALL VCS ( K, 'B', 'slKBJ', 'JB2', STATUS ) + CALL VIV ( J, 0, 'slKBJ', 'J2', STATUS ) + CALL slKBJ ( 1, E, K, J ) + CALL VCS ( K, 'B', 'slKBJ', 'JB3', STATUS ) + CALL VIV ( J, 0, 'slKBJ', 'J3', STATUS ) + CALL slKBJ ( 2, E, K, J ) + CALL VCS ( K, 'J', 'slKBJ', 'JB4', STATUS ) + CALL VIV ( J, 0, 'slKBJ', 'J4', STATUS ) + CALL slKBJ ( 3, E, K, J ) + CALL VCS ( K, ' ', 'slKBJ', 'JB5', STATUS ) + CALL VIV ( J, 1, 'slKBJ', 'J5', STATUS ) + + E = 2000D0 + CALL slKBJ ( 0, E, K, J ) + CALL VCS ( K, 'J', 'slKBJ', 'JB6', STATUS ) + CALL VIV ( J, 0, 'slKBJ', 'J6', STATUS ) + CALL slKBJ ( 1, E, K, J ) + CALL VCS ( K, 'B', 'slKBJ', 'jB7', STATUS ) + CALL VIV ( J, 0, 'slKBJ', 'J7', STATUS ) + CALL slKBJ ( 2, E, K, J ) + CALL VCS ( K, 'J', 'slKBJ', 'JB8', STATUS ) + CALL VIV ( J, 0, 'slKBJ', 'J8', STATUS ) + + END + + SUBROUTINE T_MAP ( STATUS ) +*+ +* - - - - - - +* T _ M A P +* - - - - - - +* +* Test slMAP, slMAPA, slMAPQ, slMAPZ routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slMAP, slMAPA, slMAPQ, slMAPZ, VVD. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION RA, DA, AMPRMS(21) + + CALL slMAP ( 6.123D0, -0.999D0, 1.23D-5, -0.987D-5, + : 0.123D0, 32.1D0, 1999D0, 43210.9D0, RA, DA ) + + CALL VVD ( RA, 6.117130429775647D0, 1D-12, 'slMAP', + : 'RA', STATUS ) + CALL VVD ( DA, -1.000880769038632D0, 1D-12, 'slMAP', + : 'DA', STATUS ) + + CALL slMAPA ( 2020D0, 45012.3D0, AMPRMS ) + + CALL VVD ( AMPRMS(1), -37.884188911704310D0, + : 1D-11, 'slMAPA', 'AMPRMS(1)', STATUS ) + CALL VVD ( AMPRMS(2), -0.7888341859486424D0, + : 1D-7, 'slMAPA', 'AMPRMS(2)', STATUS ) + CALL VVD ( AMPRMS(3), 0.5405321789059870D0, + : 1D-7, 'slMAPA', 'AMPRMS(3)', STATUS ) + CALL VVD ( AMPRMS(4), 0.2340784267119091D0, + : 1D-7, 'slMAPA', 'AMPRMS(4)', STATUS ) + CALL VVD ( AMPRMS(5), -0.8067807553217332071D0, + : 1D-7, 'slMAPA', 'AMPRMS(5)', STATUS ) + CALL VVD ( AMPRMS(6), 0.5420884771236513880D0, + : 1D-7, 'slMAPA', 'AMPRMS(6)', STATUS ) + CALL VVD ( AMPRMS(7), 0.2350423277034460899D0, + : 1D-7, 'slMAPA', 'AMPRMS(7)', STATUS ) + CALL VVD ( AMPRMS(8), 1.999729469227807D-8, + : 1D-12, 'slMAPA', 'AMPRMS(8)', STATUS ) + CALL VVD ( AMPRMS(9), -6.035531043691568494D-5, + : 1D-12, 'slMAPA', 'AMPRMS(9)', STATUS ) + CALL VVD ( AMPRMS(10), -7.381891582591552377D-5, + : 1D-11, 'slMAPA', 'AMPRMS(10)', STATUS ) + CALL VVD ( AMPRMS(11), -3.200897749853207412D-5, + : 1D-11, 'slMAPA', 'AMPRMS(11)', STATUS ) + CALL VVD ( AMPRMS(12), 0.9999999949417148D0, + : 1D-11, 'slMAPA', 'AMPRMS(12)', STATUS ) + CALL VVD ( AMPRMS(13), 0.9999566751478850D0, + : 1D-11, 'slMAPA', 'AMPRMS(13)', STATUS ) + CALL VVD ( AMPRMS(14), -8.537361890149777D-3, + : 1D-11, 'slMAPA', 'AMPRMS(14)', STATUS ) + CALL VVD ( AMPRMS(15), -3.709619811228171D-3, + : 1D-11, 'slMAPA', 'AMPRMS(15)', STATUS ) + CALL VVD ( AMPRMS(16), 8.537308717676752D-3, + : 1D-11, 'slMAPA', 'AMPRMS(16)', STATUS ) + CALL VVD ( AMPRMS(17), 0.9999635560607690D0, + : 1D-11, 'slMAPA', 'AMPRMS(17)', STATUS ) + CALL VVD ( AMPRMS(18), -3.016886324169151D-5, + : 1D-11, 'slMAPA', 'AMPRMS(18)', STATUS ) + CALL VVD ( AMPRMS(19), 3.709742180572510D-3, + : 1D-11, 'slMAPA', 'AMPRMS(19)', STATUS ) + CALL VVD ( AMPRMS(20), -1.502613373498668D-6, + : 1D-11, 'slMAPA', 'AMPRMS(20)', STATUS ) + CALL VVD ( AMPRMS(21), 0.9999931188816729D0, + : 1D-11, 'slMAPA', 'AMPRMS(21)', STATUS ) + + CALL slMAPQ ( 1.234D0, -0.987D0, -1.2D-5, -0.99D0, + : 0.75D0, -23.4D0, AMPRMS, RA, DA ) + + CALL VVD ( RA, 1.223337584930993D0, 1D-11, 'slMAPQ', + : 'RA', STATUS ) + CALL VVD ( DA, 0.5558838650379129D0, 1D-11, 'slMAPQ', + : 'DA', STATUS ) + + CALL slMAPZ ( 6.012D0, 1.234D0, AMPRMS, RA, DA ) + + CALL VVD ( RA, 6.006091119756597D0, 1D-11, 'slMAPZ', + : 'RA', STATUS ) + CALL VVD ( DA, 1.23045846622498D0, 1D-11, 'slMAPZ', + : 'DA', STATUS ) + + END + + SUBROUTINE T_MOON ( STATUS ) +*+ +* - - - - - - - +* T _ M O O N +* - - - - - - - +* +* Test slMOON and slDMON routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slMOON, slDMON, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL PV(6) + + CALL slMOON ( 1999, 365, 0.9E0, PV ) + + CALL VVD ( DBLE( PV(1) ), -2.155729505970773D-3, 1D-6, + : 'slMOON', '(1)', STATUS ) + CALL VVD ( DBLE( PV(2) ), -1.538107758633427D-3, 1D-6, + : 'slMOON', '(2)', STATUS ) + CALL VVD ( DBLE( PV(3) ), -4.003940552689305D-4, 1D-6 , + : 'slMOON', '(3)', STATUS ) + CALL VVD ( DBLE( PV(4) ), 3.629209419071314D-9, 1D-12, + : 'slMOON', '(4)', STATUS ) + CALL VVD ( DBLE( PV(5) ), -4.989667166259157D-9, 1D-12, + : 'slMOON', '(5)', STATUS ) + CALL VVD ( DBLE( PV(6) ), -2.160752457288307D-9, 1D-12, + : 'slMOON', '(6)', STATUS ) + + END + + SUBROUTINE T_NUT ( STATUS ) +*+ +* - - - - - - +* T _ N U T +* - - - - - - +* +* Test slNUT, slNUTC, slNUTC80 routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slNUT, slNUTC, VVD. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION RMATN(3,3), DPSI, DEPS, EPS0 + + CALL slNUT ( 46012.34D0, RMATN ) + + CALL VVD ( RMATN(1,1), 9.999999969492166D-1, 1D-12, + : 'slNUT', '(1,1)', STATUS ) + CALL VVD ( RMATN(1,2), 7.166577986249302D-5, 1D-12, + : 'slNUT', '(1,2)', STATUS ) + CALL VVD ( RMATN(1,3), 3.107382973077677D-5, 1D-12, + : 'slNUT', '(1,3)', STATUS ) + CALL VVD ( RMATN(2,1), -7.166503970900504D-5, 1D-12, + : 'slNUT', '(2,1)', STATUS ) + CALL VVD ( RMATN(2,2), 9.999999971483732D-1, 1D-12, + : 'slNUT', '(2,2)', STATUS ) + CALL VVD ( RMATN(2,3), -2.381965032461830D-5, 1D-12, + : 'slNUT', '(2,3)', STATUS ) + CALL VVD ( RMATN(3,1), -3.107553669598237D-5, 1D-12, + : 'slNUT', '(3,1)', STATUS ) + CALL VVD ( RMATN(3,2), 2.381742334472628D-5, 1D-12, + : 'slNUT', '(3,2)', STATUS ) + CALL VVD ( RMATN(3,3), 9.999999992335206818D-1, 1D-12, + : 'slNUT', '(3,3)', STATUS ) + + CALL slNUTC ( 50123.4D0, DPSI, DEPS, EPS0 ) + + CALL VVD ( DPSI, 3.523550954747999709D-5, 1D-17, 'slNUTC', + : 'DPSI', STATUS ) + CALL VVD ( DEPS, -4.143371566683342D-5, 1D-17, 'slNUTC', + : 'DEPS', STATUS ) + CALL VVD ( EPS0, 0.4091014592901651D0, 1D-12, 'slNUTC', + : 'EPS0', STATUS ) + + CALL slNUTC80 ( 50123.4D0, DPSI, DEPS, EPS0 ) + + CALL VVD ( DPSI, 3.537714281665945321D-5, 1D-17, 'slNUTC80', + : 'DPSI', STATUS ) + CALL VVD ( DEPS, -4.140590085987148317D-5, 1D-17, 'slNUTC80', + : 'DEPS', STATUS ) + CALL VVD ( EPS0, 0.4091016349007751D0, 1D-12, 'slNUTC80', + : 'EPS0', STATUS ) + + END + + SUBROUTINE T_OBS ( STATUS ) +*+ +* - - - - - - +* T _ O B S +* - - - - - - +* +* Test slOBS routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slOBS, err, VVD. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER N + DOUBLE PRECISION W, P, H + CHARACTER*10 C + CHARACTER*40 NAME + + N = 0 + C = 'MMT' + CALL slOBS ( N, C, NAME, W, P, H ) + CALL VCS ( C, 'MMT', 'slOBS', '1/C', STATUS ) + CALL VCS ( NAME, 'MMT 6.5m, Mt Hopkins', 'slOBS', '1/NAME', + : STATUS ) + CALL VVD ( W, 1.935300584055477D0, 1D-8, 'slOBS', + : '1/W', STATUS ) + CALL VVD ( P, 0.5530735081550342238D0, 1D-10, 'slOBS', + : '1/P', STATUS ) + CALL VVD ( H, 2608D0, 1D-10, 'slOBS', + : '1/H', STATUS ) + + N = 61 + CALL slOBS ( N, C, NAME, W, P, H ) + CALL VCS ( C, 'KECK1', 'slOBS', '2/C', STATUS ) + CALL VCS ( NAME, 'Keck 10m Telescope #1', 'slOBS', + : '2/NAME', STATUS ) + CALL VVD ( W, 2.713545757918895D0, 1D-8, 'slOBS', + : '2/W', STATUS ) + CALL VVD ( P, 0.3460280563536619D0, 1D-8, 'slOBS', + : '2/P', STATUS ) + CALL VVD ( H, 4160D0, 1D-10, 'slOBS', + : '2/H', STATUS ) + + N = 83 + CALL slOBS ( N, C, NAME, W, P, H ) + CALL VCS ( C, 'MAGELLAN2', 'slOBS', '3/C', STATUS ) + CALL VCS ( NAME, 'Magellan 2, 6.5m, Las Campanas', + : 'slOBS', '3/NAME', STATUS ) + CALL VVD ( W, 1.233819305534497D0, 1D-8, 'slOBS', + : '3/W', STATUS ) + CALL VVD ( P, -0.506389344359954D0, 1D-8, 'slOBS', + : '3/P', STATUS ) + CALL VVD ( H, 2408D0, 1D-10, 'slOBS', + : '3/H', STATUS ) + + N = 84 + CALL slOBS ( N, C, NAME, W, P, H ) + CALL VCS ( NAME, '?', 'slOBS', '4/NAME', STATUS ) + + END + + SUBROUTINE T_PA ( STATUS ) +*+ +* - - - - - +* T _ P A +* - - - - - +* +* Test slPA routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPA, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slPA + + + CALL VVD ( slPA ( -1.567D0, 1.5123D0, 0.987D0 ), + : -1.486288540423851D0, 1D-12, 'slPA', ' ', STATUS ) + CALL VVD ( slPA ( 0D0, 0.789D0, 0.789D0 ), + : 0D0, 0D0, 'slPA', 'zenith', STATUS ) + + END + + SUBROUTINE T_PCD ( STATUS ) +*+ +* - - - - - - +* T _ P C D +* - - - - - - +* +* Test slPCD, slUPCD routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPCD, VVD, slUPCD. +* +* Last revision: 4 September 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION DISCO, X, Y + + DISCO = 178.585D0 + X = 0.0123D0 + Y = -0.00987D0 + + CALL slPCD ( DISCO, X, Y ) + CALL VVD ( X, 0.01284630845735895D0, 1D-14, 'slPCD', + : 'X', STATUS ) + CALL VVD ( Y, -0.01030837922553926D0, 1D-14, 'slPCD', + : 'Y', STATUS ) + + CALL slUPCD ( DISCO, X, Y ) + CALL VVD ( X, 0.0123D0, 1D-14, 'slUPCD', + : 'X', STATUS ) + CALL VVD ( Y, -0.00987D0, 1D-14, 'slUPCD', + : 'Y', STATUS ) + + END + + SUBROUTINE T_PDA2H ( STATUS ) +*+ +* - - - - - - - - +* T _ P D A H +* - - - - - - - - +* +* Test slPDAH routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPDAH, VVD. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J1, J2 + DOUBLE PRECISION H1, H2 + + CALL slPDAH ( -0.51D0, -1.31D0, 3.1D0, H1, J1, H2, J2 ) + CALL VVD ( H1, -0.1161784556585304927D0, 1D-14, 'slPDAH', + : 'H1', STATUS ) + CALL VIV ( J1, 0, 'slPDAH', 'J1', STATUS ) + CALL VVD ( H2, -2.984787179226459D0, 1D-13, 'slPDAH', + : 'H2', STATUS ) + CALL VIV ( J2, 0, 'slPDAH', 'J2', STATUS ) + + END + + SUBROUTINE T_PDQ2H ( STATUS ) +*+ +* - - - - - - - - +* T _ P D Q H +* - - - - - - - - +* +* Test slPDQH routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPDQH, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J1, J2 + DOUBLE PRECISION H1, H2 + + CALL slPDQH ( 0.9D0, 0.2D0, 0.1D0, H1, J1, H2, J2 ) + CALL VVD ( H1, 0.1042809894435257D0, 1D-14, 'slPDQH', + : 'H1', STATUS ) + CALL VIV ( J1, 0, 'slPDQH', 'J1', STATUS ) + CALL VVD ( H2, 2.997450098818439D0, 1D-13, 'slPDQH', + : 'H2', STATUS ) + CALL VIV ( J2, 0, 'slPDQH', 'J2', STATUS ) + + END + + SUBROUTINE T_PERCOM ( STATUS ) +*+ +* - - - - - - - - - +* T _ P E R C O M +* - - - - - - - - - +* +* Test slCMBN, slPERM routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slCMBN, VIV, slPERM. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER LIST(3), I, J, ISTATE(4), IORDER(4) + + LIST(1) = 0 + + DO I = 1, 11 + CALL slCMBN ( 3, 5, LIST, J ) + END DO + + CALL VIV ( J, 1, 'slCMBN', 'J', STATUS ) + CALL VIV ( LIST(1), 1, 'slCMBN', 'LIST(1)', STATUS ) + CALL VIV ( LIST(2), 2, 'slCMBN', 'LIST(2)', STATUS ) + CALL VIV ( LIST(3), 3, 'slCMBN', 'LIST(3)', STATUS ) + + ISTATE(1) = -1 + + DO I = 1, 25 + CALL slPERM ( 4, ISTATE, IORDER, J ) + END DO + + CALL VIV ( J, 1, 'slPERM', 'J', STATUS ) + CALL VIV ( IORDER(1), 4, 'slPERM', 'IORDER(1)', STATUS ) + CALL VIV ( IORDER(2), 3, 'slPERM', 'IORDER(2)', STATUS ) + CALL VIV ( IORDER(3), 2, 'slPERM', 'IORDER(3)', STATUS ) + CALL VIV ( IORDER(4), 1, 'slPERM', 'IORDER(4)', STATUS ) + + END + + SUBROUTINE T_PLANET ( STATUS ) +*+ +* - - - - - - - - - +* T _ P L N T +* - - - - - - - - - +* +* Test slELUE, slPRTL, slPRTE, slPLNE, slPLNT, +* slPLTE, slPLTU, slPVEL, slPVUE, slRDPL, slUEEL +* and slUEPV routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slELUE, slPRTL, slPRTE, slPLNE, slPLNT, +* slPLTE, slPLTU, slPVEL, slPVUE, slRDPL, +* slUEEL, slUEPV, VIV, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J, JFORM + DOUBLE PRECISION U(13), PV(6), RA, DEC, R, DIAM, EPOCH, ORBINC, + : ANODE, PERIH, AORQ, E, AORL, DM + + + CALL slELUE ( 50000D0, 1, 49000D0, 0.1D0, 2D0, 0.2D0, + : 3D0, 0.05D0, 3D0, 0.003312D0, U, J ) + CALL VVD ( U(1), 1.000878908362435284D0, 1D-12, 'slELUE', + : 'U(1)', STATUS ) + CALL VVD ( U(2), -0.3336263027874777288D0, 1D-12, 'slELUE', + : 'U(2)', STATUS ) + CALL VVD ( U(3), 50000D0, 1D-12, 'slELUE', + : 'U(3)', STATUS ) + CALL VVD ( U(4), 2.840425801310305210D0, 1D-12, 'slELUE', + : 'U(4)', STATUS ) + CALL VVD ( U(5), 0.1264380368035014224D0, 1D-12, 'slELUE', + : 'U(5)', STATUS ) + CALL VVD ( U(6), -0.2287711835229143197D0, 1D-12, 'slELUE', + : 'U(6)', STATUS ) + CALL VVD ( U(7), -0.01301062595106185195D0, 1D-12, 'slELUE', + : 'U(7)', STATUS ) + CALL VVD ( U(8), 0.5657102158104651697D0, 1D-12, 'slELUE', + : 'U(8)', STATUS ) + CALL VVD ( U(9), 0.2189745287281794885D0, 1D-12, 'slELUE', + : 'U(9)', STATUS ) + CALL VVD ( U(10), 2.852427310959998500D0, 1D-12, 'slELUE', + : 'U(10)', STATUS ) + CALL VVD ( U(11), -0.01552349065435120900D0, 1D-12, 'slELUE', + : 'U(11)', STATUS ) + CALL VVD ( U(12), 50000D0, 1D-12, 'slELUE', + : 'U(12)', STATUS ) + CALL VVD ( U(13), 0D0, 1D-12, 'slELUE', + : 'U(13)', STATUS ) + CALL VIV ( J, 0, 'slELUE', 'J', STATUS ) + + CALL slPRTL ( 2, 43000D0, 43200D0, 43000D0, + : 0.2D0, 3D0, 4D0, 5D0, 0.02D0, 6D0, + : EPOCH, ORBINC, ANODE, PERIH, AORQ, E, AORL, J ) + CALL VVD ( EPOCH, 43200D0, 1D-10, 'slPRTL', + : 'EPOCH', STATUS ) + CALL VVD ( ORBINC, 0.1995661466545422381D0, 1D-7, 'slPRTL', + : 'ORBINC', STATUS ) + CALL VVD ( ANODE, 2.998052737821591215D0, 1D-7, 'slPRTL', + : 'ANODE', STATUS ) + CALL VVD ( PERIH, 4.009516448441143636D0, 1D-6, 'slPRTL', + : 'PERIH', STATUS ) + CALL VVD ( AORQ, 5.014216294790922323D0, 1D-7, 'slPRTL', + : 'AORQ', STATUS ) + CALL VVD ( E, 0.02281386258309823607D0, 1D-7, 'slPRTL', + : 'E', STATUS ) + CALL VVD ( AORL, 0.01735248648779583748D0, 1D-6, 'slPRTL', + : 'AORL', STATUS ) + CALL VIV ( J, 0, 'slPRTL', 'J', STATUS ) + + CALL slPRTE ( 50100D0, U, J ) + CALL VVD ( U(1), 1.000000000000000D0, 1D-12, 'slPRTE', + : 'U(1)', STATUS ) + CALL VVD ( U(2), -0.3329769417028020949D0, 1D-11, 'slPRTE', + : 'U(2)', STATUS ) + CALL VVD ( U(3), 50100D0, 1D-12, 'slPRTE', + : 'U(3)', STATUS ) + CALL VVD ( U(4), 2.638884303608524597D0, 1D-11, 'slPRTE', + : 'U(4)', STATUS ) + CALL VVD ( U(5), 1.070994304747824305D0, 1D-11, 'slPRTE', + : 'U(5)', STATUS ) + CALL VVD ( U(6), 0.1544112080167568589D0, 1D-11, 'slPRTE', + : 'U(6)', STATUS ) + CALL VVD ( U(7), -0.2188240619161439344D0, 1D-11, 'slPRTE', + : 'U(7)', STATUS ) + CALL VVD ( U(8), 0.5207557453451906385D0, 1D-11, 'slPRTE', + : 'U(8)', STATUS ) + CALL VVD ( U(9), 0.2217782439275216936D0, 1D-11, 'slPRTE', + : 'U(9)', STATUS ) + CALL VVD ( U(10), 2.852118859689216658D0, 1D-11, 'slPRTE', + : 'U(10)', STATUS ) + CALL VVD ( U(11), 0.01452010174371893229D0, 1D-11, 'slPRTE', + : 'U(11)', STATUS ) + CALL VVD ( U(12), 50100D0, 1D-12, 'slPRTE', + : 'U(12)', STATUS ) + CALL VVD ( U(13), 0D0, 1D-12, 'slPRTE', + : 'U(13)', STATUS ) + CALL VIV ( J, 0, 'slPRTE', 'J', STATUS ) + + CALL slPLNE ( 50600D0, 2, 50500D0, 0.1D0, 3D0, 5D0, + : 2D0, 0.3D0, 4D0, 0D0, PV, J ) + CALL VVD ( PV(1), 1.947628959288897677D0, 1D-12, 'slPLNE', + : 'PV(1)', STATUS ) + CALL VVD ( PV(2), -1.013736058752235271D0, 1D-12, 'slPLNE', + : 'PV(2)', STATUS ) + CALL VVD ( PV(3), -0.3536409947732733647D0, 1D-12, 'slPLNE', + : 'PV(3)', STATUS ) + CALL VVD ( PV(4), 2.742247411571786194D-8, 1D-19, 'slPLNE', + : 'PV(4)', STATUS ) + CALL VVD ( PV(5), 1.170467244079075911D-7, 1D-19, 'slPLNE', + : 'PV(5)', STATUS ) + CALL VVD ( PV(6), 3.709878268217564005D-8, 1D-19, 'slPLNE', + : 'PV(6)', STATUS ) + CALL VIV ( J, 0, 'slPLNE', 'J', STATUS ) + + CALL slPLNT ( 1D6, 0, PV, J ) + CALL VVD ( PV(1), 0D0, 0D0, 'slPLNT', + : 'PV(1) 1', STATUS ) + CALL VVD ( PV(2), 0D0, 0D0, 'slPLNT', + : 'PV(2) 1', STATUS ) + CALL VVD ( PV(3), 0D0, 0D0, 'slPLNT', + : 'PV(3) 1', STATUS ) + CALL VVD ( PV(4), 0D0, 0D0, 'slPLNT', + : 'PV(4) 1', STATUS ) + CALL VVD ( PV(5), 0D0, 0D0, 'slPLNT', + : 'PV(5) 1', STATUS ) + CALL VVD ( PV(6), 0D0, 0D0, 'slPLNT', + : 'PV(6) 1', STATUS ) + CALL VIV ( J, -1, 'slPLNT', 'J 1', STATUS ) + + CALL slPLNT ( 1D6, 10, PV, J ) + CALL VIV ( J, -1, 'slPLNT', 'J 2', STATUS ) + + CALL slPLNT ( -320000D0, 3, PV, J ) + CALL VVD ( PV(1), 0.9308038666827242603D0, 1D-11, 'slPLNT', + : 'PV(1) 3', STATUS ) + CALL VVD ( PV(2), 0.3258319040252137618D0, 1D-11, 'slPLNT', + : 'PV(2) 3', STATUS ) + CALL VVD ( PV(3), 0.1422794544477122021D0, 1D-11, 'slPLNT', + : 'PV(3) 3', STATUS ) + CALL VVD ( PV(4), -7.441503423889371696D-8, 1D-17, 'slPLNT', + : 'PV(4) 3', STATUS ) + CALL VVD ( PV(5), 1.699734557528650689D-7, 1D-17, 'slPLNT', + : 'PV(5) 3', STATUS ) + CALL VVD ( PV(6), 7.415505123001430864D-8, 1D-17, 'slPLNT', + : 'PV(6) 3', STATUS ) + CALL VIV ( J, 1, 'slPLNT', 'J 3', STATUS ) + + CALL slPLNT ( 43999.9D0, 1, PV, J ) + CALL VVD ( PV(1), 0.2945293959257422246D0, 1D-11, 'slPLNT', + : 'PV(1) 4', STATUS ) + CALL VVD ( PV(2), -0.2452204176601052181D0, 1D-11, 'slPLNT', + : 'PV(2) 4', STATUS ) + CALL VVD ( PV(3), -0.1615427700571978643D0, 1D-11, 'slPLNT', + : 'PV(3) 4', STATUS ) + CALL VVD ( PV(4), 1.636421147459047057D-7, 1D-18, 'slPLNT', + : 'PV(4) 4', STATUS ) + CALL VVD ( PV(5), 2.252949422574889753D-7, 1D-18, 'slPLNT', + : 'PV(5) 4', STATUS ) + CALL VVD ( PV(6), 1.033542799062371839D-7, 1D-18, 'slPLNT', + : 'PV(6) 4', STATUS ) + CALL VIV ( J, 0, 'slPLNT', 'J 4', STATUS ) + + CALL slPLTE ( 50600D0, -1.23D0, 0.456D0, 2, 50500D0, + : 0.1D0, 3D0, 5D0, 2D0, 0.3D0, 4D0, + : 0D0, RA, DEC, R, J ) + CALL VVD ( RA, 6.222958101333794007D0, 1D-10, 'slPLTE', + : 'RA', STATUS ) + CALL VVD ( DEC, 0.01142220305739771601D0, 1D-10, 'slPLTE', + : 'DEC', STATUS ) + CALL VVD ( R, 2.288902494080167624D0, 1D-8, 'slPLTE', + : 'R', STATUS ) + CALL VIV ( J, 0, 'slPLTE', 'J', STATUS ) + + U(1) = 1.0005D0 + U(2) = -0.3D0 + U(3) = 55000D0 + U(4) = 2.8D0 + U(5) = 0.1D0 + U(6) = -0.2D0 + U(7) = -0.01D0 + U(8) = 0.5D0 + U(9) = 0.22D0 + U(10) = 2.8D0 + U(11) = -0.015D0 + U(12) = 55001D0 + U(13) = 0D0 + + CALL slPLTU ( 55001D0, -1.23D0, 0.456D0, U, RA, DEC, R, J ) + CALL VVD ( RA, 0.3531814831241686647D0, 1D-9, 'slPLTU', + : 'RA', STATUS ) + CALL VVD ( DEC, 0.06940344580567131328D0, 1D-9, 'slPLTU', + : 'DEC', STATUS ) + CALL VVD ( R, 3.031687170873274464D0, 1D-8, 'slPLTU', + : 'R', STATUS ) + CALL VIV ( J, 0, 'slPLTU', 'J', STATUS ) + + PV(1) = 0.3D0 + PV(2) = -0.2D0 + PV(3) = 0.1D0 + PV(4) = -0.9D-7 + PV(5) = 0.8D-7 + PV(6) = -0.7D-7 + CALL slPVEL ( PV, 50000D0, 0.00006D0, 1, + : JFORM, EPOCH, ORBINC, ANODE, PERIH, + : AORQ, E, AORL, DM, J ) + CALL VIV ( JFORM, 1, 'slPVEL', 'JFORM', STATUS ) + CALL VVD ( EPOCH, 50000D0, 1D-10, 'slPVEL', + : 'EPOCH', STATUS ) + CALL VVD ( ORBINC, 1.52099895268912D0, 1D-12, 'slPVEL', + : 'ORBINC', STATUS ) + CALL VVD ( ANODE, 2.720503180538650D0, 1D-12, 'slPVEL', + : 'ANODE', STATUS ) + CALL VVD ( PERIH, 2.194081512031836D0, 1D-12, 'slPVEL', + : 'PERIH', STATUS ) + CALL VVD ( AORQ, 0.2059371035373771D0, 1D-12, 'slPVEL', + : 'AORQ', STATUS ) + CALL VVD ( E, 0.9866822985810528D0, 1D-12, 'slPVEL', + : 'E', STATUS ) + CALL VVD ( AORL, 0.2012758344836794D0, 1D-12, 'slPVEL', + : 'AORL', STATUS ) + CALL VVD ( DM, 0.1840740507951820D0, 1D-12, 'slPVEL', + : 'DM', STATUS ) + CALL VIV ( J, 0, 'slPVEL', 'J', STATUS ) + + CALL slPVUE ( PV, 50000D0, 0.00006D0, U, J ) + CALL VVD ( U(1), 1.00006D0, 1D-12, 'slPVUE', + : 'U(1)', STATUS ) + CALL VVD ( U(2), -4.856142884511782D0, 1D-12, 'slPVUE', + : 'U(2)', STATUS ) + CALL VVD ( U(3), 50000D0, 1D-12, 'slPVUE', + : 'U(3)', STATUS ) + CALL VVD ( U(4), 0.3D0, 1D-12, 'slPVUE', + : 'U(4)', STATUS ) + CALL VVD ( U(5), -0.2D0, 1D-12, 'slPVUE', + : 'U(5)', STATUS ) + CALL VVD ( U(6), 0.1D0, 1D-12, 'slPVUE', + : 'U(6)', STATUS ) + CALL VVD ( U(7), -0.4520378601821727D0, 1D-12, 'slPVUE', + : 'U(7)', STATUS ) + CALL VVD ( U(8), 0.4018114312730424D0, 1D-12, 'slPVUE', + : 'U(8)', STATUS ) + CALL VVD ( U(9), -.3515850023639121D0, 1D-12, 'slPVUE', + : 'U(9)', STATUS ) + CALL VVD ( U(10), 0.3741657386773941D0, 1D-12, 'slPVUE', + : 'U(10)', STATUS ) + CALL VVD ( U(11), -0.2511321445456515D0, 1D-12, 'slPVUE', + : 'U(11)', STATUS ) + CALL VVD ( U(12), 50000D0, 1D-12, 'slPVUE', + : 'U(12)', STATUS ) + CALL VVD ( U(13), 0D0, 1D-12, 'slPVUE', + : 'U(13)', STATUS ) + CALL VIV ( J, 0, 'slPVUE', 'J', STATUS ) + + CALL slRDPL ( 40999.9D0, 0, 0.1D0, -0.9D0, RA, DEC, DIAM ) + CALL VVD ( RA, 5.772270359389275837D0, 1D-7, 'slRDPL', + : 'RA 0', STATUS ) + CALL VVD ( DEC, -0.2089207338795416192D0, 1D-7, 'slRDPL', + : 'DEC 0', STATUS ) + CALL VVD ( DIAM, 9.415338935229717875D-3, 1D-14, 'slRDPL', + : 'DIAM 0', STATUS ) + CALL slRDPL ( 41999.9D0, 1, 1.1D0, -0.9D0, RA, DEC, DIAM ) + CALL VVD ( RA, 3.866363420052936653D0, 1D-7, 'slRDPL', + : 'RA 1', STATUS ) + CALL VVD ( DEC, -0.2594430577550113130D0, 1D-7, 'slRDPL', + : 'DEC 1', STATUS ) + CALL VVD ( DIAM, 4.638468996795023071D-5, 1D-14, 'slRDPL', + : 'DIAM 1', STATUS ) + CALL slRDPL ( 42999.9D0, 2, 2.1D0, 0.9D0, RA, DEC, DIAM ) + CALL VVD ( RA, 2.695383203184077378D0, 1D-7, 'slRDPL', + : 'RA 2', STATUS ) + CALL VVD ( DEC, 0.2124044506294805126D0, 1D-7, 'slRDPL', + : 'DEC 2', STATUS ) + CALL VVD ( DIAM, 4.892222838681000389D-5, 1D-14, 'slRDPL', + : 'DIAM 2', STATUS ) + CALL slRDPL ( 43999.9D0, 3, 3.1D0, 0.9D0, RA, DEC, DIAM ) + CALL VVD ( RA, 2.908326678461540165D0, 1D-7, 'slRDPL', + : 'RA 3', STATUS ) + CALL VVD ( DEC, 0.08729783126905579385D0, 1D-7, 'slRDPL', + : 'DEC 3', STATUS ) + CALL VVD ( DIAM, 8.581305866034962476D-3, 1D-14, 'slRDPL', + : 'DIAM 3', STATUS ) + CALL slRDPL ( 44999.9D0, 4, -0.1D0, 1.1D0, RA, DEC, DIAM ) + CALL VVD ( RA, 3.429840787472851721D0, 1D-7, 'slRDPL', + : 'RA 4', STATUS ) + CALL VVD ( DEC, -0.06979851055261161013D0, 1D-7, 'slRDPL', + : 'DEC 4', STATUS ) + CALL VVD ( DIAM, 4.540536678439300199D-5, 1D-14, 'slRDPL', + : 'DIAM 4', STATUS ) + CALL slRDPL ( 45999.9D0, 5, -1.1D0, 0.1D0, RA, DEC, DIAM ) + CALL VVD ( RA, 4.864669466449422548D0, 1D-7, 'slRDPL', + : 'RA 5', STATUS ) + CALL VVD ( DEC, -0.4077714497908953354D0, 1D-7, 'slRDPL', + : 'DEC 5', STATUS ) + CALL VVD ( DIAM, 1.727945579027815576D-4, 1D-14, 'slRDPL', + : 'DIAM 5', STATUS ) + CALL slRDPL ( 46999.9D0, 6, -2.1D0, -0.1D0, RA, DEC, DIAM ) + CALL VVD ( RA, 4.432929829176388766D0, 1D-7, 'slRDPL', + : 'RA 6', STATUS ) + CALL VVD ( DEC, -0.3682820877854730530D0, 1D-7, 'slRDPL', + : 'DEC 6', STATUS ) + CALL VVD ( DIAM, 8.670829016099083311D-5, 1D-14, 'slRDPL', + : 'DIAM 6', STATUS ) + CALL slRDPL ( 47999.9D0, 7, -3.1D0, -1.1D0, RA, DEC, DIAM ) + CALL VVD ( RA, 4.894972492286818487D0, 1D-7, 'slRDPL', + : 'RA 7', STATUS ) + CALL VVD ( DEC, -0.4084068901053653125D0, 1D-7, 'slRDPL', + : 'DEC 7', STATUS ) + CALL VVD ( DIAM, 1.793916783975974163D-5, 1D-14, 'slRDPL', + : 'DIAM 7', STATUS ) + CALL slRDPL ( 48999.9D0, 8, 0D0, 0D0, RA, DEC, DIAM ) + CALL VVD ( RA, 5.066050284760144000D0, 1D-7, 'slRDPL', + : 'RA 8', STATUS ) + CALL VVD ( DEC, -0.3744690779683850609D0, 1D-7, 'slRDPL', + : 'DEC 8', STATUS ) + CALL VVD ( DIAM, 1.062210086082700563D-5, 1D-14, 'slRDPL', + : 'DIAM 8', STATUS ) + CALL slRDPL ( 49999.9D0, 9, 0D0, 0D0, RA, DEC, DIAM ) + CALL VVD ( RA, 4.179543143097200945D0, 1D-7, 'slRDPL', + : 'RA 9', STATUS ) + CALL VVD ( DEC, -0.1258021632894033300D0, 1D-7, 'slRDPL', + : 'DEC 9', STATUS ) + CALL VVD ( DIAM, 5.034057475664904352D-7, 1D-14, 'slRDPL', + : 'DIAM 9', STATUS ) + + CALL slUEEL ( U, 1, JFORM, EPOCH, ORBINC, ANODE, PERIH, + : AORQ, E, AORL, DM, J ) + CALL VIV ( JFORM, 1, 'slUEEL', 'JFORM', STATUS ) + CALL VVD ( EPOCH, 50000.00000000000D0, 1D-10, 'slPVEL', + : 'EPOCH', STATUS ) + CALL VVD ( ORBINC, 1.520998952689120D0, 1D-12, 'slUEEL', + : 'ORBINC', STATUS ) + CALL VVD ( ANODE, 2.720503180538650D0, 1D-12, 'slUEEL', + : 'ANODE', STATUS ) + CALL VVD ( PERIH, 2.194081512031836D0, 1D-12, 'slUEEL', + : 'PERIH', STATUS ) + CALL VVD ( AORQ, 0.2059371035373771D0, 1D-12, 'slUEEL', + : 'AORQ', STATUS ) + CALL VVD ( E, 0.9866822985810528D0, 1D-12, 'slUEEL', + : 'E', STATUS ) + CALL VVD ( AORL, 0.2012758344836794D0, 1D-12, 'slUEEL', + : 'AORL', STATUS ) + CALL VIV ( J, 0, 'slUEEL', 'J', STATUS ) + + CALL slUEPV ( 50010D0, U, PV, J ) + CALL VVD ( U(1), 1.00006D0, 1D-12, 'slUEPV', + : 'U(1)', STATUS ) + CALL VVD ( U(2), -4.856142884511782111D0, 1D-12, 'slUEPV', + : 'U(2)', STATUS ) + CALL VVD ( U(3), 50000D0, 1D-12, 'slUEPV', + : 'U(3)', STATUS ) + CALL VVD ( U(4), 0.3D0, 1D-12, 'slUEPV', + : 'U(4)', STATUS ) + CALL VVD ( U(5), -0.2D0, 1D-12, 'slUEPV', + : 'U(5)', STATUS ) + CALL VVD ( U(6), 0.1D0, 1D-12, 'slUEPV', + : 'U(6)', STATUS ) + CALL VVD ( U(7), -0.4520378601821727110D0, 1D-12, 'slUEPV', + : 'U(7)', STATUS ) + CALL VVD ( U(8), 0.4018114312730424097D0, 1D-12, 'slUEPV', + : 'U(8)', STATUS ) + CALL VVD ( U(9), -0.3515850023639121085D0, 1D-12, 'slUEPV', + : 'U(9)', STATUS ) + CALL VVD ( U(10), 0.3741657386773941386D0, 1D-12, 'slUEPV', + : 'U(10)', STATUS ) + CALL VVD ( U(11), -0.2511321445456515061D0, 1D-12, 'slUEPV', + : 'U(11)', STATUS ) + CALL VVD ( U(12), 50010.00000000000D0, 1D-12, 'slUEPV', + : 'U(12)', STATUS ) + CALL VVD ( U(13), 0.7194308220038886856D0, 1D-12, 'slUEPV', + : 'U(13)', STATUS ) + CALL VVD ( PV(1), 0.07944764084631667011D0, 1D-12, 'slUEPV', + : 'PV(1)', STATUS ) + CALL VVD ( PV(2), -0.04118141077419014775D0, 1D-12, 'slUEPV', + : 'PV(2)', STATUS ) + CALL VVD ( PV(3), 0.002915180702063625400D0, 1D-12, 'slUEPV', + : 'PV(3)', STATUS ) + CALL VVD ( PV(4), -0.6890132370721108608D-6, 1D-18,'slUEPV', + : 'PV(4)', STATUS ) + CALL VVD ( PV(5), 0.4326690733487621457D-6, 1D-18, 'slUEPV', + : 'PV(5)', STATUS ) + CALL VVD ( PV(6), -0.1763249096254134306D-6, 1D-18, 'slUEPV', + : 'PV(6)', STATUS ) + CALL VIV ( J, 0, 'slUEPV', 'J', STATUS ) + + END + + SUBROUTINE T_PM ( STATUS ) +*+ +* - - - - - +* T _ P M +* - - - - - +* +* Test slPM routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPM, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION R1, D1 + + CALL slPM ( 5.43D0, -0.87D0, -0.33D-5, 0.77D-5, 0.7D0, + : 50.3D0*365.2422D0/365.25D0, 1899D0, 1943D0, + : R1, D1 ) + CALL VVD ( R1, 5.429855087793875D0, 1D-12, 'slPM', + : 'R', STATUS ) + CALL VVD ( D1, -0.8696617307805072D0, 1D-12, 'slPM', + : 'D', STATUS ) + + END + + SUBROUTINE T_POLMO ( STATUS ) +*+ +* - - - - - - - - +* T _ P L M O +* - - - - - - - - +* +* Test slPLMO routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPLMO, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION ELONG, PHI, DAZ + + CALL slPLMO ( 0.7D0, -0.5D0, 1D-6, -2D-6, ELONG, PHI, DAZ ) + + CALL VVD ( ELONG, 0.7000004837322044D0, 1D-12, 'slPLMO', + : 'ELONG', STATUS ) + CALL VVD ( PHI, -0.4999979467222241D0, 1D-12, 'slPLMO', + : 'PHI', STATUS ) + CALL VVD ( DAZ, 1.008982781275728D-6, 1D-12, 'slPLMO', + : 'DAZ', STATUS ) + + END + + SUBROUTINE T_PREBN ( STATUS ) +*+ +* - - - - - - - - +* T _ P R B N +* - - - - - - - - +* +* Test slPRBN routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPRBN, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION RMATP(3,3) + + CALL slPRBN ( 1925D0, 1975D0, RMATP ) + + CALL VVD ( RMATP(1,1), 9.999257613786738D-1, 1D-12, + : 'slPRBN', '(1,1)', STATUS ) + CALL VVD ( RMATP(1,2), -1.117444640880939D-2, 1D-12, + : 'slPRBN', '(1,2)', STATUS ) + CALL VVD ( RMATP(1,3), -4.858341150654265D-3, 1D-12, + : 'slPRBN', '(1,3)', STATUS ) + CALL VVD ( RMATP(2,1), 1.117444639746558D-2, 1D-12, + : 'slPRBN', '(2,1)', STATUS ) + CALL VVD ( RMATP(2,2), 9.999375635561940D-1, 1D-12, + : 'slPRBN', '(2,2)', STATUS ) + CALL VVD ( RMATP(2,3), -2.714797892626396D-5, 1D-12, + : 'slPRBN', '(2,3)', STATUS ) + CALL VVD ( RMATP(3,1), 4.858341176745641D-3, 1D-12, + : 'slPRBN', '(3,1)', STATUS ) + CALL VVD ( RMATP(3,2), -2.714330927085065D-5, 1D-12, + : 'slPRBN', '(3,2)', STATUS ) + CALL VVD ( RMATP(3,3), 9.999881978224798D-1, 1D-12, + : 'slPRBN', '(3,3)', STATUS ) + + END + + SUBROUTINE T_PREC ( STATUS ) +*+ +* - - - - - - - +* T _ P R E C +* - - - - - - - +* +* Test slPREC and slPREL routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPREC, slPREL, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION RMATP(3,3) + + CALL slPREC ( 1925D0, 1975D0, RMATP ) + + CALL VVD ( RMATP(1,1), 9.999257249850045D-1, 1D-12, + : 'slPREC', '(1,1)', STATUS ) + CALL VVD ( RMATP(1,2), -1.117719859160180D-2, 1D-12, + : 'slPREC', '(1,2)', STATUS ) + CALL VVD ( RMATP(1,3), -4.859500474027002D-3, 1D-12, + : 'slPREC', '(1,3)', STATUS ) + CALL VVD ( RMATP(2,1), 1.117719858025860D-2, 1D-12, + : 'slPREC', '(2,1)', STATUS ) + CALL VVD ( RMATP(2,2), 9.999375327960091D-1, 1D-12, + : 'slPREC', '(2,2)', STATUS ) + CALL VVD ( RMATP(2,3), -2.716114374174549D-5, 1D-12, + : 'slPREC', '(2,3)', STATUS ) + CALL VVD ( RMATP(3,1), 4.859500500117173D-3, 1D-12, + : 'slPREC', '(3,1)', STATUS ) + CALL VVD ( RMATP(3,2), -2.715647545167383D-5, 1D-12, + : 'slPREC', '(3,2)', STATUS ) + CALL VVD ( RMATP(3,3), 9.999881921889954D-1, 1D-12, + : 'slPREC', '(3,3)', STATUS ) + + CALL slPREL ( 1925D0, 1975D0, RMATP ) + + CALL VVD ( RMATP(1,1), 9.999257331781050D-1, 1D-12, + : 'slPREC', '(1,1)', STATUS ) + CALL VVD ( RMATP(1,2), -1.117658038434041D-2, 1D-12, + : 'slPREC', '(1,2)', STATUS ) + CALL VVD ( RMATP(1,3), -4.859236477249598D-3, 1D-12, + : 'slPREC', '(1,3)', STATUS ) + CALL VVD ( RMATP(2,1), 1.117658037299592D-2, 1D-12, + : 'slPREC', '(2,1)', STATUS ) + CALL VVD ( RMATP(2,2), 9.999375397061558D-1, 1D-12, + : 'slPREC', '(2,2)', STATUS ) + CALL VVD ( RMATP(2,3), -2.715816653174189D-5, 1D-12, + : 'slPREC', '(2,3)', STATUS ) + CALL VVD ( RMATP(3,1), 4.859236503342703D-3, 1D-12, + : 'slPREC', '(3,1)', STATUS ) + CALL VVD ( RMATP(3,2), -2.715349745834860D-5, 1D-12, + : 'slPREC', '(3,2)', STATUS ) + CALL VVD ( RMATP(3,3), 9.999881934719490D-1, 1D-12, + : 'slPREC', '(3,3)', STATUS ) + + END + + SUBROUTINE T_PRECES ( STATUS ) +*+ +* - - - - - - - - - +* T _ P R C E +* - - - - - - - - - +* +* Test slPRCE routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPRCE, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION RA, DC + + RA = 6.28D0 + DC = -1.123D0 + CALL slPRCE ( 'FK4', 1925D0, 1950D0, RA, DC ) + CALL VVD ( RA, 0.002403604864728447D0, 1D-12, 'slPRCE', + : 'R', STATUS ) + CALL VVD ( DC, -1.120570643322045D0, 1D-12, 'slPRCE', + : 'D', STATUS ) + + RA = 0.0123D0 + DC = 1.0987D0 + CALL slPRCE ( 'FK5', 2050D0, 1990D0, RA, DC ) + CALL VVD ( RA, 6.282003602708382D0, 1D-12, 'slPRCE', + : 'R', STATUS ) + CALL VVD ( DC, 1.092870326188383D0, 1D-12, 'slPRCE', + : 'D', STATUS ) + + END + + SUBROUTINE T_PRENUT ( STATUS ) +*+ +* - - - - - - - - - +* P R N U +* - - - - - - - - - +* +* Test slPRNU routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPRNU, VVD. +* +* Last revision: 16 November 2001 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION RMATPN(3,3) + + CALL slPRNU ( 1985D0, 50123.4567D0, RMATPN ) + + CALL VVD ( RMATPN(1,1), 9.999962358680738D-1, 1D-12, + : 'slPRNU', '(1,1)', STATUS ) + CALL VVD ( RMATPN(1,2), -2.516417057665452D-3, 1D-12, + : 'slPRNU', '(1,2)', STATUS ) + CALL VVD ( RMATPN(1,3), -1.093569785342370D-3, 1D-12, + : 'slPRNU', '(1,3)', STATUS ) + CALL VVD ( RMATPN(2,1), 2.516462370370876D-3, 1D-12, + : 'slPRNU', '(2,1)', STATUS ) + CALL VVD ( RMATPN(2,2), 9.999968329010883D-1, 1D-12, + : 'slPRNU', '(2,2)', STATUS ) + CALL VVD ( RMATPN(2,3), 4.006159587358310D-5, 1D-12, + : 'slPRNU', '(2,3)', STATUS ) + CALL VVD ( RMATPN(3,1), 1.093465510215479D-3, 1D-12, + : 'slPRNU', '(3,1)', STATUS ) + CALL VVD ( RMATPN(3,2), -4.281337229063151D-5, 1D-12, + : 'slPRNU', '(3,2)', STATUS ) + CALL VVD ( RMATPN(3,3), 9.999994012499173D-1, 1D-12, + : 'slPRNU', '(3,3)', STATUS ) + + END + + SUBROUTINE T_PVOBS ( STATUS ) +*+ +* - - - - - - - - +* T _ P V O B +* - - - - - - - - +* +* Test slPVOB routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slPVOB, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION PV(6) + + CALL slPVOB ( 0.5123D0, 3001D0, -0.567D0, PV ) + + CALL VVD ( PV(1), 0.3138647803054939D-4, 1D-16, 'slPVOB', + : '(1)', STATUS ) + CALL VVD ( PV(2),-0.1998515596527082D-4, 1D-16, 'slPVOB', + : '(2)', STATUS ) + CALL VVD ( PV(3), 0.2078572043443275D-4, 1D-16, 'slPVOB', + : '(3)', STATUS ) + CALL VVD ( PV(4), 0.1457340726851264D-8, 1D-20, 'slPVOB', + : '(4)', STATUS ) + CALL VVD ( PV(5), 0.2288738340888011D-8, 1D-20, 'slPVOB', + : '(5)', STATUS ) + CALL VVD ( PV(6), 0D0, 0D0, 'slPVOB', + : '(6)', STATUS ) + + END + + SUBROUTINE T_RANGE ( STATUS ) +*+ +* - - - - - - - - +* T _ R A 1 P +* - - - - - - - - +* +* Test slRA1P, slDA1P routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slRA1P, VVD, slDA1P. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL slRA1P + DOUBLE PRECISION slDA1P + + + CALL VVD ( DBLE( slRA1P ( -4.0 ) ), 2.283185307179586D0, + : 1D-6, 'slRA1P', ' ', STATUS ) + CALL VVD ( slDA1P ( -4D0 ), 2.283185307179586D0, + : 1D-12, 'slDA1P', ' ', STATUS ) + + END + + SUBROUTINE T_RANORM ( STATUS ) +*+ +* - - - - - - - - - +* T _ R A 2 P +* - - - - - - - - - +* +* Test slRA2P, slDA2P routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slRA2P, VVD, slDA2P. +* +* Last revision: 22 October 2006 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL slRA2P + DOUBLE PRECISION slDA2P + + + CALL VVD ( DBLE( slRA2P ( -0.1E0 ) ), 6.183185307179587D0, + : 1D-5, 'slRA2P', '1', STATUS ) + CALL VVD ( slDA2P ( -0.1D0 ), 6.183185307179587D0, + : 1D-12, 'slDA2P', '2', STATUS ) + + END + + SUBROUTINE T_RCC ( STATUS ) +*+ +* - - - - - - +* T _ R C C +* - - - - - - +* +* Test slRCC routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slRCC, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slRCC + + + CALL VVD ( slRCC ( 48939.123D0, 0.76543D0, 5.0123D0, + : 5525.242D0, 3190D0 ), + : -1.280131613589158D-3, 1D-15, 'slRCC', ' ', STATUS ) + + END + + SUBROUTINE T_REF ( STATUS ) +*+ +* - - - - - - +* T _ R E F +* - - - - - - +* +* Test slRFRO, slRFCO, slATMD, slREFV, slREFZ routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slRFRO, VVD, slRFCO, slRFCQ, slATMD, +* slDS2C, slREFV, slREFZ. +* +* Last revision: 17 January 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION REF, REFA, REFB, REFA2, REFB2, VU(3), VR(3), ZR + + CALL slRFRO ( 1.4D0, 3456.7D0, 280D0, 678.9D0, 0.9D0, 0.55D0, + : -0.3D0, 0.006D0, 1D-9, REF ) + CALL VVD ( REF, 0.00106715763018568D0, 1D-12, 'slRFRO', + : 'O', STATUS ) + + CALL slRFRO ( 1.4D0, 3456.7D0, 280D0, 678.9D0, 0.9D0, 1000D0, + : -0.3D0, 0.006D0, 1D-9, REF ) + CALL VVD ( REF, 0.001296416185295403D0, 1D-12, 'slRFRO', + : 'R', STATUS ) + + CALL slRFCQ ( 275.9D0, 709.3D0, 0.9D0, 101D0, REFA, REFB ) + CALL VVD ( REFA, 2.324736903790639D-4, 1D-12, 'slRFCQ', + : 'A/R', STATUS ) + CALL VVD ( REFB, -2.442884551059D-7, 1D-15, 'slRFCQ', + : 'B/R', STATUS ) + + CALL slRFCO ( 2111.1D0, 275.9D0, 709.3D0, 0.9D0, 101D0, + : -1.03D0, 0.0067D0, 1D-12, REFA, REFB ) + CALL VVD ( REFA, 2.324673985217244D-4, 1D-12, 'slRFCO', + : 'A/R', STATUS ) + CALL VVD ( REFB, -2.265040682496D-7, 1D-15, 'slRFCO', + : 'B/R', STATUS ) + + CALL slRFCQ ( 275.9D0, 709.3D0, 0.9D0, 0.77D0, REFA, REFB ) + CALL VVD ( REFA, 2.007406521596588D-4, 1D-12, 'slRFCQ', + : 'A', STATUS ) + CALL VVD ( REFB, -2.264210092590D-7, 1D-15, 'slRFCQ', + : 'B', STATUS ) + + CALL slRFCO ( 2111.1D0, 275.9D0, 709.3D0, 0.9D0, 0.77D0, + : -1.03D0, 0.0067D0, 1D-12, REFA, REFB ) + CALL VVD ( REFA, 2.007202720084551D-4, 1D-12, 'slRFCO', + : 'A', STATUS ) + CALL VVD ( REFB, -2.223037748876D-7, 1D-15, 'slRFCO', + : 'B', STATUS ) + + CALL slATMD ( 275.9D0, 709.3D0, 0.9D0, 0.77D0, + : REFA, REFB, 0.5D0, REFA2, REFB2 ) + CALL VVD ( REFA2, 2.034523658888048D-4, 1D-12, 'slATMD', + : 'A', STATUS ) + CALL VVD ( REFB2, -2.250855362179D-7, 1D-15, 'slATMD', + : 'B', STATUS ) + + CALL slDS2C ( 0.345D0, 0.456D0, VU ) + CALL slREFV ( VU, REFA, REFB, VR ) + CALL VVD ( VR(1), 0.8447487047790478D0, 1D-12, 'slREFV', + : 'X1', STATUS ) + CALL VVD ( VR(2), 0.3035794890562339D0, 1D-12, 'slREFV', + : 'Y1', STATUS ) + CALL VVD ( VR(3), 0.4407256738589851D0, 1D-12, 'slREFV', + : 'Z1', STATUS ) + + CALL slDS2C ( 3.7D0, 0.03D0, VU ) + CALL slREFV ( VU, REFA, REFB, VR ) + CALL VVD ( VR(1), -0.8476187691681673D0, 1D-12, 'slREFV', + : 'X2', STATUS ) + CALL VVD ( VR(2), -0.5295354802804889D0, 1D-12, 'slREFV', + : 'Y2', STATUS ) + CALL VVD ( VR(3), 0.0322914582168426D0, 1D-12, 'slREFV', + : 'Z2', STATUS ) + + CALL slREFZ ( 0.567D0, REFA, REFB, ZR ) + CALL VVD ( ZR, 0.566872285910534D0, 1D-12, 'slREFZ', + : 'hi el', STATUS ) + + CALL slREFZ ( 1.55D0, REFA, REFB, ZR ) + CALL VVD ( ZR, 1.545697350690958D0, 1D-12, 'slREFZ', + : 'lo el', STATUS ) + + END + + SUBROUTINE T_RV ( STATUS ) +*+ +* - - - - - +* T _ R V +* - - - - - +* +* Test slRVER, slRVGA, slRVLG, slRVLD, slRVLK routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: VVD, slRVER, slRVGA, slRVLG, slRVLD, slRVLK. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + REAL slRVER, slRVGA, slRVLG, slRVLD, slRVLK + + + CALL VVD ( DBLE( slRVER ( -0.777E0, 5.67E0, -0.3E0, + : 3.19E0 ) ), -0.1948098355075913D0, 1D-6, + : 'slRVER', ' ', STATUS ) + CALL VVD ( DBLE( slRVGA ( 1.11E0, -0.99E0 ) ), + : 158.9630759840254D0, 1D-3, 'slRVGA', ' ', STATUS ) + CALL VVD ( DBLE( slRVLG ( 3.97E0, 1.09E0 ) ), + : -197.818762175363D0, 1D-3, 'slRVLG', ' ', STATUS ) + CALL VVD ( DBLE( slRVLD ( 6.01E0, 0.1E0 ) ), + : -4.082811335150567D0, 1D-4, 'slRVLD', ' ', STATUS ) + CALL VVD ( DBLE( slRVLK ( 6.01E0, 0.1E0 ) ), + : -5.925180579830265D0, 1D-4, 'slRVLK', ' ', STATUS ) + + END + + SUBROUTINE T_SEP ( STATUS ) +*+ +* - - - - - - - +* T _ S E P +* - - - - - - - +* +* Test slDSEP, slDSEPV, slSEP, slSEPV routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slDSEP, slSEP, VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER I + REAL slSEP, slSEPV + REAL R1(3), R2(3), AR1, BR1, AR2, BR2 + DOUBLE PRECISION slDSEP, slDSEPV + DOUBLE PRECISION D1(3), D2(3), AD1, BD1, AD2, BD2 + + + R1(1) = 1.0 + R1(2) = 0.1 + R1(3) = 0.2 + R2(1) = -3.0 + R2(2) = 1E-3 + R2(3) = 0.2 + + DO I = 1, 3 + D1(I) = DBLE( R1(I) ) + D2(I) = DBLE( R2(I) ) + END DO + + CALL slDC2S ( D1, AD1, BD1 ) + CALL slDC2S ( D2, AD2, BD2 ) + + AR1 = SNGL( AD1 ) + BR1 = SNGL( BD1 ) + AR2 = SNGL( AD2 ) + BR2 = SNGL( BD2 ) + + CALL VVD ( slDSEP ( AD1, BD1, AD2, BD2 ), + : 2.8603919190246608D0, 1D-7, 'slDSEP', ' ', STATUS ) + CALL VVD ( DBLE( slSEP ( AR1, BR1, AR2, BR2 ) ), + : 2.8603919190246608D0, 1D-4, 'slSEP', ' ', STATUS ) + CALL VVD ( slDSEPV ( D1, D2 ), + : 2.8603919190246608D0, 1D-7, 'slDSEPV', ' ', STATUS ) + CALL VVD ( DBLE( slSEPV ( R1, R2 ) ), + : 2.8603919190246608D0, 1D-4, 'slSEPV', ' ', STATUS ) + + END + + SUBROUTINE T_SMAT ( STATUS ) +*+ +* - - - - - - - +* T _ S M A T +* - - - - - - - +* +* Test slSMAT routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slSMAT, VVD, VIV. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J, IW(3) + REAL A(3,3) + REAL V(3) + REAL D + + DATA A/2.22E0, 1.6578E0, 1.380522E0, + : 1.6578E0, 1.380522E0, 1.22548578E0, + : 1.380522E0, 1.22548578E0, 1.1356276122E0/ + DATA V/2.28625E0, 1.7128825E0, 1.429432225E0/ + + + CALL slSMAT ( 3, A, V, D, J, IW ) + + CALL VVD ( DBLE( A(1,1) ), 18.02550629769198D0, + : 1D-2, 'slSMAT', 'A(0,0)', STATUS ) + CALL VVD ( DBLE( A(1,2) ), -52.16386644917481D0, + : 1D-2, 'slSMAT', 'A(0,1)', STATUS ) + CALL VVD ( DBLE( A(1,3) ), 34.37875949717994D0, + : 1D-2, 'slSMAT', 'A(0,2)', STATUS ) + CALL VVD ( DBLE( A(2,1) ), -52.16386644917477D0, + : 1D-2, 'slSMAT', 'A(1,0)', STATUS ) + CALL VVD ( DBLE( A(2,2) ), 168.1778099099869D0, + : 1D-1, 'slSMAT', 'A(1,1)', STATUS ) + CALL VVD ( DBLE( A(2,3) ), -118.0722869694278D0, + : 1D-2, 'slSMAT', 'A(1,2)', STATUS ) + CALL VVD ( DBLE( A(3,1) ), 34.37875949717988D0, + : 1D-2, 'slSMAT', 'A(2,0)', STATUS ) + CALL VVD ( DBLE( A(3,2) ), -118.07228696942770D0, + : 1D-2, 'slSMAT', 'A(2,1)', STATUS ) + CALL VVD ( DBLE( A(3,3) ), 86.50307003740468D0, + : 1D-2, 'slSMAT', 'A(2,2)', STATUS ) + CALL VVD ( DBLE( V(1) ), 1.002346480763383D0, + : 1D-4, 'slSMAT', 'V(1)', STATUS ) + CALL VVD ( DBLE( V(2) ), 0.0328559401697292D0, + : 1D-4, 'slSMAT', 'V(2)', STATUS ) + CALL VVD ( DBLE( V(3) ), 0.004760688414898454D0, + : 1D-4, 'slSMAT', 'V(3)', STATUS ) + CALL VVD ( DBLE( D ), 0.003658344147359863D0, + : 1D-4, 'slSMAT', 'D', STATUS ) + CALL VIV ( J, 0, 'slSMAT', 'J', STATUS ) + + END + + SUBROUTINE T_SUPGAL ( STATUS ) +*+ +* - - - - - - - - - +* T _ S U G A +* - - - - - - - - - +* +* Test slSUGA routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slSUGA, VVD. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION DL, DB + + CALL slSUGA ( 6.1D0, -1.4D0, Dl, DB ) + + CALL VVD ( DL, 3.798775860769474D0, 1D-12, 'slSUGA', + : 'DL', STATUS ) + CALL VVD ( DB, -0.1397070490669407D0, 1D-12, 'slSUGA', + : 'DB', STATUS ) + + END + + SUBROUTINE T_SVD ( STATUS ) +*+ +* - - - - - - +* T _ S V D +* - - - - - - +* +* Test slSVD, slSVDS, slSVDC routines. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: slSVD, VVD, slSVDS, slSVDC. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER M, N + INTEGER I, J + INTEGER MP, NP, NC + + PARAMETER (MP = 10) + PARAMETER (NP = 6) + PARAMETER (NC = 7) + + DOUBLE PRECISION A(MP,NP), W(NP), V(NP,NP), WORK(NP), + : B(MP), X(NP), C(NC,NC) + DOUBLE PRECISION VAL + + M = 5 + N = 4 + + DO I = 1, M + VAL = DFLOAT( ( I ) ) / 2D0 + B(I) = 23D0 - 3D0 * VAL - 11D0 * DSIN ( VAL ) + + : 13D0 * DCOS ( VAL ) + A(I,1) = 1D0 + A(I,2) = VAL + A(I,3) = DSIN ( VAL ) + A(I,4) = DCOS ( VAL ) + END DO + + CALL slSVD ( M, N, MP, NP, A, W, V, WORK, J ) + +* Allow U and V to have reversed signs. + IF (A(1,1) .GT. 0D0) THEN + DO I = 1, M + DO J = 1, N + A(I,J) = - A(I,J) + V(I,J) = - V(I,J) + END DO + END DO + END IF + + CALL VVD ( A(1,1), -0.21532492989299D0, 1D-12, 'slSVD', + : 'A(1,1)', STATUS ) + CALL VVD ( A(1,2), 0.67675050651267D0, 1D-12, 'slSVD', + : 'A(1,2)', STATUS ) + CALL VVD ( A(1,3), -0.37267876361644D0, 1D-12, 'slSVD', + : 'A(1,3)', STATUS ) + CALL VVD ( A(1,4), 0.58330405917160D0, 1D-12, 'slSVD', + : 'A(1,4)', STATUS ) + CALL VVD ( A(2,1), -0.33693420368121D0, 1D-12, 'slSVD', + : 'A(2,1)', STATUS ) + CALL VVD ( A(2,2), 0.48011695963936D0, 1D-12, 'slSVD', + : 'A(2,2)', STATUS ) + CALL VVD ( A(2,3), 0.62656568539705D0, 1D-12, 'slSVD', + : 'A(2,3)', STATUS ) + CALL VVD ( A(2,4), -0.17479918328198D0, 1D-12, 'slSVD', + : 'A(2,4)', STATUS ) + CALL VVD ( A(3,1), -0.44396825906047D0, 1D-12, 'slSVD', + : 'A(3,1)', STATUS ) + CALL VVD ( A(3,2), 0.18255923809825D0, 1D-12, 'slSVD', + : 'A(3,2)', STATUS ) + CALL VVD ( A(3,3), 0.02228154115994D0, 1D-12, 'slSVD', + : 'A(3,3)', STATUS ) + CALL VVD ( A(3,4), -0.51743308030238D0, 1D-12, 'slSVD', + : 'A(3,4)', STATUS ) + CALL VVD ( A(4,1), -0.53172583816951D0, 1D-12, 'slSVD', + : 'A(4,1)', STATUS ) + CALL VVD ( A(4,2), -0.16537863535943D0, 1D-12, 'slSVD', + : 'A(4,2)', STATUS ) + CALL VVD ( A(4,3), -0.61134201569990D0, 1D-12, 'slSVD', + : 'A(4,3)', STATUS ) + CALL VVD ( A(4,4), -0.28871221824912D0, 1D-12, 'slSVD', + : 'A(4,4)', STATUS ) + CALL VVD ( A(5,1), -0.60022523682867D0, 1D-12, 'slSVD', + : 'A(5,1)', STATUS ) + CALL VVD ( A(5,2), -0.50081781972404D0, 1D-12, 'slSVD', + : 'A(5,2)', STATUS ) + CALL VVD ( A(5,3), 0.30706750690326D0, 1D-12, 'slSVD', + : 'A(5,3)', STATUS ) + CALL VVD ( A(5,4), 0.52736124480318D0, 1D-12, 'slSVD', + : 'A(5,4)', STATUS ) + + CALL VVD ( W(1), 4.57362714220621D0, 1D-12, 'slSVD', + : 'W(1)', STATUS ) + CALL VVD ( W(2), 1.64056393111226D0, 1D-12, 'slSVD', + : 'W(2)', STATUS ) + CALL VVD ( W(3), 0.03999179717447D0, 1D-12, 'slSVD', + : 'W(3)', STATUS ) + CALL VVD ( W(4), 0.37267332634218D0, 1D-12, 'slSVD', + : 'W(4)', STATUS ) + + CALL VVD ( V(1,1), -0.46531525230679D0, 1D-12, 'slSVD', + : 'V(1,1)', STATUS ) + CALL VVD ( V(1,2), 0.41036514115630D0, 1D-12, 'slSVD', + : 'V(1,2)', STATUS ) + CALL VVD ( V(1,3), -0.70279526907678D0, 1D-12, 'slSVD', + : 'V(1,3)', STATUS ) + CALL VVD ( V(1,4), 0.34808185338758D0, 1D-12, 'slSVD', + : 'V(1,4)', STATUS ) + CALL VVD ( V(2,1), -0.80342444002914D0, 1D-12, 'slSVD', + : 'V(2,1)', STATUS ) + CALL VVD ( V(2,2), -0.29896472833787D0, 1D-12, 'slSVD', + : 'V(2,2)', STATUS ) + CALL VVD ( V(2,3), 0.46592932810178D0, 1D-12, 'slSVD', + : 'V(2,3)', STATUS ) + CALL VVD ( V(2,4), 0.21917828721921D0, 1D-12, 'slSVD', + : 'V(2,4)', STATUS ) + CALL VVD ( V(3,1), -0.36564497020801D0, 1D-12, 'slSVD', + : 'V(3,1)', STATUS ) + CALL VVD ( V(3,2), 0.28066812941896D0, 1D-12, 'slSVD', + : 'V(3,2)', STATUS ) + CALL VVD ( V(3,3), -0.03324480702665D0, 1D-12, 'slSVD', + : 'V(3,3)', STATUS ) + CALL VVD ( V(3,4), -0.88680546891402D0, 1D-12, 'slSVD', + : 'V(3,4)', STATUS ) + CALL VVD ( V(4,1), 0.06553350971918D0, 1D-12, 'slSVD', + : 'V(4,1)', STATUS ) + CALL VVD ( V(4,2), 0.81452191085452D0, 1D-12, 'slSVD', + : 'V(4,2)', STATUS ) + CALL VVD ( V(4,3), 0.53654771808636D0, 1D-12, 'slSVD', + : 'V(4,3)', STATUS ) + CALL VVD ( V(4,4), 0.21065602782287D0, 1D-12, 'slSVD', + : 'V(4,4)', STATUS ) + + CALL slSVDS ( M, N, MP, NP, B, A, W, V, WORK, X ) + + CALL VVD ( X(1), 23D0, 1D-12, 'slSVDS', 'X(1)', STATUS ) + CALL VVD ( X(2), -3D0, 1D-12, 'slSVDS', 'X(2)', STATUS ) + CALL VVD ( X(3), -11D0, 1D-12, 'slSVDS', 'X(3)', STATUS ) + CALL VVD ( X(4), 13D0, 1D-12, 'slSVDS', 'X(4)', STATUS ) + + CALL slSVDC ( N, NP, NC, W, V, WORK, C ) + + CALL VVD ( C(1,1), 309.77269378273270D0, 1D-10, + : 'slSVDC', 'C(1,1)', STATUS ) + CALL VVD ( C(1,2), -204.22043941662150D0, 1D-10, + : 'slSVDC', 'C(1,2)', STATUS ) + CALL VVD ( C(1,3), 12.43704316907477D0, 1D-10, + : 'slSVDC', 'C(1,3)', STATUS ) + CALL VVD ( C(1,4), -235.12299986206710D0, 1D-10, + : 'slSVDC', 'C(1,4)', STATUS ) + CALL VVD ( C(2,1), -204.22043941662150D0, 1D-10, + : 'slSVDC', 'C(2,1)', STATUS ) + CALL VVD ( C(2,2), 136.14695961108110D0, 1D-10, + : 'slSVDC', 'C(2,2)', STATUS ) + CALL VVD ( C(2,3), -11.10167446246327D0, 1D-10, + : 'slSVDC', 'C(2,3)', STATUS ) + CALL VVD ( C(2,4), 156.54937371198730D0, 1D-10, + : 'slSVDC', 'C(2,4)', STATUS ) + CALL VVD ( C(3,1), 12.43704316907477D0, 1D-10, + : 'slSVDC', 'C(3,1)', STATUS ) + CALL VVD ( C(3,2), -11.10167446246327D0, 1D-10, + : 'slSVDC', 'C(3,2)', STATUS ) + CALL VVD ( C(3,3), 6.38909830090602D0, 1D-10, + : 'slSVDC', 'C(3,3)', STATUS ) + CALL VVD ( C(3,4), -12.41424302586736D0, 1D-10, + : 'slSVDC', 'C(3,4)', STATUS ) + CALL VVD ( C(4,1), -235.12299986206710D0, 1D-10, + : 'slSVDC', 'C(4,1)', STATUS ) + CALL VVD ( C(4,2), 156.54937371198730D0, 1D-10, + : 'slSVDC', 'C(4,2)', STATUS ) + CALL VVD ( C(4,3), -12.41424302586736D0, 1D-10, + : 'slSVDC', 'C(4,3)', STATUS ) + CALL VVD ( C(4,4), 180.56719842359560D0, 1D-10, + : 'slSVDC', 'C(4,4)', STATUS ) + + END + + SUBROUTINE T_TP ( STATUS ) +*+ +* - - - - - - +* T _ T P +* - - - - - - +* +* Test spherical tangent-planD-projection routines: +* +* slS2TP slDSTP slDPSC +* slTP2S slDTPS slTPSC +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: all the above, plus VVD and VIV. +* +* Last revision: 10 July 2000 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J + REAL R0, D0, R1, D1, X, Y, R2, D2, R01, D01, R02, D02 + DOUBLE PRECISION DR0, DD0, DR1, DD1, DX, DY, DR2, DD2, DR01, + : DD01, DR02, DD02 + + R0 = 3.1E0 + D0 = -0.9E0 + R1 = R0 + 0.2E0 + D1 = D0 - 0.1E0 + CALL slS2TP ( R1, D1, R0, D0, X, Y, J ) + CALL VVD ( DBLE( X ), 0.1086112301590404D0, 1D-6, 'slS2TP', + : 'X', STATUS ) + CALL VVD ( DBLE( Y ), -0.1095506200711452D0, 1D-6, 'slS2TP', + : 'Y', STATUS ) + CALL VIV ( J, 0, 'slS2TP', 'J', STATUS ) + CALL slTP2S ( X, Y, R0, D0, R2, D2 ) + CALL VVD ( DBLE( ( R2 - R1 ) ), 0D0, 1D-6, 'slTP2S', + : 'R', STATUS ) + CALL VVD ( DBLE( ( D2 - D1 ) ), 0D0, 1D-6, 'slTP2S', + : 'D', STATUS ) + CALL slTPSC ( X, Y, R2, D2, R01, D01, R02, D02, J ) + CALL VVD ( DBLE( R01 ), 3.1D0, 1D-6, 'slTPSC', + : 'R1', STATUS ) + CALL VVD ( DBLE( D01 ), -0.9D0, 1D-6, 'slTPSC', + : 'D1', STATUS ) + CALL VVD ( DBLE( R02 ), 0.3584073464102072D0, 1D-6, 'slTPSC', + : 'R2', STATUS ) + CALL VVD ( DBLE( D02 ), -2.023361658234722D0, 1D-6, 'slTPSC', + : 'D2', STATUS ) + CALL VIV ( J, 1, 'slTPSC', 'N', STATUS ) + + DR0 = 3.1D0 + DD0 = -0.9D0 + DR1 = DR0 + 0.2D0 + DD1 = DD0 - 0.1D0 + CALL slDSTP ( DR1, DD1, DR0, DD0, DX, DY, J ) + CALL VVD ( DX, 0.1086112301590404D0, 1D-12, 'slDSTP', + : 'X', STATUS ) + CALL VVD ( DY, -0.1095506200711452D0, 1D-12, 'slDSTP', + : 'Y', STATUS ) + CALL VIV ( J, 0, 'slDSTP', 'J', STATUS ) + CALL slDTPS ( DX, DY, DR0, DD0, DR2, DD2 ) + CALL VVD ( DR2 - DR1, 0D0, 1D-12, 'slDTPS', 'R', STATUS ) + CALL VVD ( DD2 - DD1, 0D0, 1D-12, 'slDTPS', 'D', STATUS ) + CALL slDPSC ( DX, DY, DR2, DD2, DR01, DD01, DR02, DD02, J ) + CALL VVD ( DR01, 3.1D0, 1D-12, 'slDPSC', 'R1', STATUS ) + CALL VVD ( DD01, -0.9D0, 1D-12, 'slDPSC', 'D1', STATUS ) + CALL VVD ( DR02, 0.3584073464102072D0, 1D-12, 'slDPSC', + : 'R2', STATUS ) + CALL VVD ( DD02, -2.023361658234722D0, 1D-12, 'slDPSC', + : 'D2', STATUS ) + CALL VIV ( J, 1, 'slDPSC', 'N', STATUS ) + + END + + SUBROUTINE T_TPV ( STATUS ) +*+ +* - - - - - - +* T _ T P V +* - - - - - - +* +* Test Cartesian tangent-planD-projection routines: +* +* slTP2V slV2TP slTPVC +* slDTPV slDVTP slDPVC +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: all the above, plus VVD and VIV. +* +* Last revision: 21 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER J + REAL RXI, RETA, RV(3), RV0(3), RTXI, RTETA, RTV(3), + : RTV01(3), RTV02(3) + DOUBLE PRECISION XI, ETA, X, Y, Z, V(3), V0(3), TXI, TETA, + : TV(3), TV01(3), TV02(3) + + XI = -0.1D0 + ETA = 0.055D0 + RXI = SNGL( XI ) + RETA = SNGL( ETA ) + + X = -0.7D0 + Y = -0.13D0 + Z = DSQRT ( 1D0 - X * X - Y * Y ) + RV(1) = SNGL( X ) + RV(2) = SNGL( Y ) + RV(3) = SNGL( Z ) + V(1) = X + V(2) = Y + V(3) = Z + + X = -0.72D0 + Y = -0.16D0 + Z = DSQRT ( 1D0 - X * X - Y * Y ) + RV0(1) = SNGL( X ) + RV0(2) = SNGL( Y ) + RV0(3) = SNGL( Z ) + V0(1) = X + V0(2) = Y + V0(3) = Z + + CALL slTP2V ( RXI, RETA, RV0, RTV ) + CALL VVD ( DBLE( RTV(1) ), -0.700887428128D0, 1D-6, 'slTP2V', + : 'V(1)', STATUS ) + CALL VVD ( DBLE( RTV(2) ), -0.05397407D0, 1D-6, 'slTP2V', + : 'V(2)', STATUS ) + CALL VVD ( DBLE( RTV(3) ), 0.711226836562D0, 1D-6, 'slTP2V', + : 'V(3)', STATUS ) + + CALL slDTPV ( XI, ETA, V0, TV ) + CALL VVD ( TV(1), -0.7008874281280771D0, 1D-13, 'slDTPV', + : 'V(1)', STATUS ) + CALL VVD ( TV(2), -0.05397406827952735D0, 1D-13, 'slDTPV', + : 'V(2)', STATUS ) + CALL VVD ( TV(3), 0.7112268365615617D0, 1D-13, 'slDTPV', + : 'V(3)', STATUS ) + + CALL slV2TP ( RV, RV0, RTXI, RTETA, J) + CALL VVD ( DBLE( RTXI ), -0.02497229197D0, 1D-6, 'slV2TP', + : 'XI', STATUS ) + CALL VVD ( DBLE( RTETA ), 0.03748140764D0, 1D-6, 'slV2TP', + : 'ETA', STATUS ) + CALL VIV ( J, 0, 'slV2TP', 'J', STATUS ) + + CALL slDVTP ( V, V0, TXI, TETA, J ) + CALL VVD ( TXI, -0.02497229197023852D0, 1D-13, 'slDVTP', + : 'XI', STATUS ) + CALL VVD ( TETA, 0.03748140764224765D0, 1D-13, 'slDVTP', + : 'ETA', STATUS ) + CALL VIV ( J, 0, 'slDVTP', 'J', STATUS ) + + CALL slTPVC ( RXI, RETA, RV, RTV01, RTV02, J ) + CALL VVD ( DBLE( RTV01(1) ), -0.7074573732537283D0, 1D-6, + : 'slTPVC', 'V01(1)', STATUS ) + CALL VVD ( DBLE( RTV01(2) ), -0.2372965765309941D0, 1D-6, + : 'slTPVC', 'V01(2)', STATUS ) + CALL VVD ( DBLE( RTV01(3) ), 0.6657284730245545D0, 1D-6, + : 'slTPVC', 'V01(3)', STATUS ) + CALL VVD ( DBLE( RTV02(1) ), -0.6680480104758149D0, 1D-6, + : 'slTPVC', 'V02(1)', STATUS ) + CALL VVD ( DBLE( RTV02(2) ), -0.02915588494045333D0, 1D-6, + : 'slTPVC', 'V02(2)', STATUS ) + CALL VVD ( DBLE( RTV02(3) ), 0.7435467638774610D0, 1D-6, + : 'slTPVC', 'V02(3)', STATUS ) + CALL VIV ( J, 1, 'slTPVC', 'N', STATUS ) + + CALL slDPVC ( XI, ETA, V, TV01, TV02, J ) + CALL VVD ( TV01(1), -0.7074573732537283D0, 1D-13, 'slDPVC', + : 'V01(1)', STATUS ) + CALL VVD ( TV01(2), -0.2372965765309941D0, 1D-13, 'slDPVC', + : 'V01(2)', STATUS ) + CALL VVD ( TV01(3), 0.6657284730245545D0, 1D-13, 'slDPVC', + : 'V01(3)', STATUS ) + CALL VVD ( TV02(1), -0.6680480104758149D0, 1D-13, 'slDPVC', + : 'V02(1)', STATUS ) + CALL VVD ( TV02(2), -0.02915588494045333D0, 1D-13, 'slDPVC', + : 'V02(2)', STATUS ) + CALL VVD ( TV02(3), 0.7435467638774610D0, 1D-13, 'slDPVC', + : 'V02(3)', STATUS ) + CALL VIV ( J, 1, 'slDPVC', 'N', STATUS ) + + END + + SUBROUTINE T_VECMAT ( STATUS ) +*+ +* - - - - - - - - - +* T _ V E C M A +* - - - - - - - - - +* +* Test all the 3-vector and 3x3 matrix routines: +* +* slAV2M slDAVM +* slCC2S slDC2S +* slCS2C slDS2C +* slEULR slDEUL +* slIMXV slDIMV +* slM2AV slDMAV +* slMXM slDMXM +* slMXV slDMXV +* slVDV slDVDV +* slVN slDVN +* slVXV slDVXV +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: all the above, plus VVD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + INTEGER I + REAL slVDV + REAL AV(3), RM1(3,3), RM2(3,3), RM(3,3), V1(3), V2(3), + : V3(3), V4(3), V5(3), VM, V6(3), V7(3) + DOUBLE PRECISION slDVDV + DOUBLE PRECISION DAV(3), DRM1(3,3), DRM2(3,3), DRM(3,3), + : DV1(3), DV2(3), DV3(3), DV4(3), DV5(3), + : DVM, DV6(3), DV7(3) + + +* Make a rotation matrix. + AV(1) = -0.123E0 + AV(2) = 0.0987E0 + AV(3) = 0.0654E0 + CALL slAV2M ( AV, RM1 ) + CALL VVD ( DBLE( RM1(1,1) ), 0.9930075842721269D0, + : 1D-6, 'slAV2M', '11', STATUS ) + CALL VVD ( DBLE( RM1(1,2) ), 0.05902743090199868D0, + : 1D-6, 'slAV2M', '12', STATUS ) + CALL VVD ( DBLE( RM1(1,3) ), -0.1022335560329612D0, + : 1D-6, 'slAV2M', '13', STATUS ) + CALL VVD ( DBLE( RM1(2,1) ), -0.07113807138648245D0, + : 1D-6, 'slAV2M', '21', STATUS ) + CALL VVD ( DBLE( RM1(2,2) ), 0.9903204657727545D0, + : 1D-6, 'slAV2M', '22', STATUS ) + CALL VVD ( DBLE( RM1(2,3) ), -0.1191836812279541D0, + : 1D-6, 'slAV2M', '23', STATUS ) + CALL VVD ( DBLE( RM1(3,1) ), 0.09420887631983825D0, + : 1D-6, 'slAV2M', '31', STATUS ) + CALL VVD ( DBLE( RM1(3,2) ), 0.1256229973879967D0, + : 1D-6, 'slAV2M', '32', STATUS ) + CALL VVD ( DBLE( RM1(3,3) ), 0.9875948309655174D0, + : 1D-6, 'slAV2M', '33', STATUS ) + +* Make another. + CALL slEULR ( 'YZY', 2.345E0, -0.333E0, 2.222E0, RM2 ) + CALL VVD ( DBLE( RM2(1,1) ), -0.1681574770810878D0, + : 1D-6, 'slEULR', '11', STATUS ) + CALL VVD ( DBLE( RM2(1,2) ), 0.1981362273264315D0, + : 1D-6, 'slEULR', '12', STATUS ) + CALL VVD ( DBLE( RM2(1,3) ), 0.9656423242187410D0, + : 1D-6, 'slEULR', '13', STATUS ) + CALL VVD ( DBLE( RM2(2,1) ), -0.2285369373983370D0, + : 1D-6, 'slEULR', '21', STATUS ) + CALL VVD ( DBLE( RM2(2,2) ), 0.9450659587140423D0, + : 1D-6, 'slEULR', '22', STATUS ) + CALL VVD ( DBLE( RM2(2,3) ), -0.2337117924378156D0, + : 1D-6, 'slEULR', '23', STATUS ) + CALL VVD ( DBLE( RM2(3,1) ), -0.9589024617479674D0, + : 1D-6, 'slEULR', '31', STATUS ) + CALL VVD ( DBLE( RM2(3,2) ), -0.2599853247796050D0, + : 1D-6, 'slEULR', '32', STATUS ) + CALL VVD ( DBLE( RM2(3,3) ), -0.1136384607117296D0, + : 1D-6, 'slEULR', '33', STATUS ) + +* Combine them. + CALL slMXM ( RM2, RM1, RM ) + CALL VVD ( DBLE( RM(1,1) ), -0.09010460088585805D0, + : 1D-6, 'slMXM', '11', STATUS ) + CALL VVD ( DBLE( RM(1,2) ), 0.3075993402463796D0, + : 1D-6, 'slMXM', '12', STATUS ) + CALL VVD ( DBLE( RM(1,3) ), 0.9472400998581048D0, + : 1D-6, 'slMXM', '13', STATUS ) + CALL VVD ( DBLE( RM(2,1) ), -0.3161868071070688D0, + : 1D-6, 'slMXM', '21', STATUS ) + CALL VVD ( DBLE( RM(2,2) ), 0.8930686362478707D0, + : 1D-6, 'slMXM', '22', STATUS ) + CALL VVD ( DBLE( RM(2,3) ),-0.3200848543149236D0, + : 1D-6, 'slMXM', '23', STATUS ) + CALL VVD ( DBLE( RM(3,1) ),-0.9444083141897035D0, + : 1D-6, 'slMXM', '31', STATUS ) + CALL VVD ( DBLE( RM(3,2) ),-0.3283459407855694D0, + : 1D-6, 'slMXM', '32', STATUS ) + CALL VVD ( DBLE( RM(3,3) ), 0.01678926022795169D0, + : 1D-6, 'slMXM', '33', STATUS ) + +* Create a vector. + CALL slCS2C ( 3.0123E0, -0.999E0, V1 ) + CALL VVD ( DBLE( V1(1) ), -0.5366267667260525D0, + : 1D-6, 'slCS2C', 'X', STATUS ) + CALL VVD ( DBLE( V1(2) ), 0.06977111097651444D0, + : 1D-6, 'slCS2C', 'Y', STATUS ) + CALL VVD ( DBLE( V1(3) ), -0.8409302618566215D0, + : 1D-6, 'slCS2C', 'Z', STATUS ) + +* Rotate it using the two matrices sequentially. + CALL slMXV ( RM1, V1, V2 ) + CALL slMXV ( RM2, V2, V3 ) + CALL VVD ( DBLE( V3(1) ), -0.7267487768696160D0, + : 1D-6, 'slMXV', 'X', STATUS ) + CALL VVD ( DBLE( V3(2) ), 0.5011537352639822D0, + : 1D-6, 'slMXV', 'Y', STATUS ) + CALL VVD ( DBLE( V3(3) ), 0.4697671220397141D0, + : 1D-6, 'slMXV', 'Z', STATUS ) + +* Derotate it using the combined matrix. + CALL slIMXV ( RM, V3, V4 ) + CALL VVD ( DBLE( V4(1) ), -0.5366267667260526D0, + : 1D-6, 'slIMXV', 'X', STATUS ) + CALL VVD ( DBLE( V4(2) ), 0.06977111097651445D0, + : 1D-6, 'slIMXV', 'Y', STATUS ) + CALL VVD ( DBLE( V4(3) ), -0.8409302618566215D0, + : 1D-6, 'slIMXV', 'Z', STATUS ) + +* Convert the combined matrix into an axial vector. + CALL slM2AV ( RM, V5 ) + CALL VVD ( DBLE( V5(1) ), 0.006889040510209034D0, + : 1D-6, 'slM2AV', 'X', STATUS ) + CALL VVD ( DBLE( V5(2) ), -1.577473205461961D0, + : 1D-6, 'slM2AV', 'Y', STATUS ) + CALL VVD ( DBLE( V5(3) ), 0.5201843672856759D0, + : 1D-6, 'slM2AV', 'Z', STATUS ) + +* Multiply it by a scalar and then normalize. + DO I = 1, 3 + V5(I) = V5(I) * 1000.0 + END DO + + CALL slVN ( V5, V6, VM ) + CALL VVD ( DBLE( V6(1) ), 0.004147420704640065D0, + : 1D-6, 'slVN', 'X', STATUS ) + CALL VVD ( DBLE( V6(2) ), -0.9496888606842218D0, + : 1D-6, 'slVN', 'Y', STATUS ) + CALL VVD ( DBLE( V6(3) ), 0.3131674740355448D0, + : 1D-6, 'slVN', 'Z', STATUS ) + CALL VVD ( DBLE( VM ), 1661.042127339937D0, + : 1D-3, 'slVN', 'M', STATUS ) + +* Dot product with the original vector. + CALL VVD ( DBLE( slVDV ( V6, V1 ) ), + : -0.3318384698006295D0, 1D-6, 'slVN', ' ', STATUS ) + +* Cross product with the original vector. + CALL slVXV (V6, V1, V7 ) + CALL VVD ( DBLE( V7(1) ), 0.7767720597123304D0, + : 1D-6, 'slVXV', 'X', STATUS ) + CALL VVD ( DBLE( V7(2) ), -0.1645663574562769D0, + : 1D-6, 'slVXV', 'Y', STATUS ) + CALL VVD ( DBLE( V7(3) ), -0.5093390925544726D0, + : 1D-6, 'slVXV', 'Z', STATUS ) + +* Same in double precision. + + DAV(1) = -0.123D0 + DAV(2) = 0.0987D0 + DAV(3) = 0.0654D0 + CALL slDAVM ( DAV, DRM1 ) + CALL VVD ( DRM1(1,1), 0.9930075842721269D0, 1D-12, + : 'slDAVM', '11', STATUS ) + CALL VVD ( DRM1(1,2), 0.05902743090199868D0, 1D-12, + : 'slDAVM', '12', STATUS ) + CALL VVD ( DRM1(1,3), -0.1022335560329612D0, 1D-12, + : 'slDAVM', '13', STATUS ) + CALL VVD ( DRM1(2,1), -0.07113807138648245D0, 1D-12, + : 'slDAVM', '21', STATUS ) + CALL VVD ( DRM1(2,2), 0.9903204657727545D0, 1D-12, + : 'slDAVM', '22', STATUS ) + CALL VVD ( DRM1(2,3), -0.1191836812279541D0, 1D-12, + : 'slDAVM', '23', STATUS ) + CALL VVD ( DRM1(3,1), 0.09420887631983825D0, 1D-12, + : 'slDAVM', '31', STATUS ) + CALL VVD ( DRM1(3,2), 0.1256229973879967D0, 1D-12, + : 'slDAVM', '32', STATUS ) + CALL VVD ( DRM1(3,3), 0.9875948309655174D0, 1D-12, + : 'slDAVM', '33', STATUS ) + + CALL slDEUL ( 'YZY', 2.345D0, -0.333D0, 2.222D0, DRM2 ) + CALL VVD ( DRM2(1,1), -0.1681574770810878D0, 1D-12, + : 'slDEUL', '11', STATUS ) + CALL VVD ( DRM2(1,2), 0.1981362273264315D0, 1D-12, + : 'slDEUL', '12', STATUS ) + CALL VVD ( DRM2(1,3), 0.9656423242187410D0, 1D-12, + : 'slDEUL', '13', STATUS ) + CALL VVD ( DRM2(2,1), -0.2285369373983370D0, 1D-12, + : 'slDEUL', '21', STATUS ) + CALL VVD ( DRM2(2,2), 0.9450659587140423D0, 1D-12, + : 'slDEUL', '22', STATUS ) + CALL VVD ( DRM2(2,3), -0.2337117924378156D0, 1D-12, + : 'slDEUL', '23', STATUS ) + CALL VVD ( DRM2(3,1), -0.9589024617479674D0, 1D-12, + : 'slDEUL', '31', STATUS ) + CALL VVD ( DRM2(3,2), -0.2599853247796050D0, 1D-12, + : 'slDEUL', '32', STATUS ) + CALL VVD ( DRM2(3,3), -0.1136384607117296D0, 1D-12, + : 'slDEUL', '33', STATUS ) + + CALL slDMXM ( DRM2, DRM1, DRM ) + CALL VVD ( DRM(1,1), -0.09010460088585805D0, 1D-12, + : 'slDMXM', '11', STATUS ) + CALL VVD ( DRM(1,2), 0.3075993402463796D0, 1D-12, + : 'slDMXM', '12', STATUS ) + CALL VVD ( DRM(1,3), 0.9472400998581048D0, 1D-12, + : 'slDMXM', '13', STATUS ) + CALL VVD ( DRM(2,1), -0.3161868071070688D0, 1D-12, + : 'slDMXM', '21', STATUS ) + CALL VVD ( DRM(2,2), 0.8930686362478707D0, 1D-12, + : 'slDMXM', '22', STATUS ) + CALL VVD ( DRM(2,3), -0.3200848543149236D0, 1D-12, + : 'slDMXM', '23', STATUS ) + CALL VVD ( DRM(3,1), -0.9444083141897035D0, 1D-12, + : 'slDMXM', '31', STATUS ) + CALL VVD ( DRM(3,2), -0.3283459407855694D0, 1D-12, + : 'slDMXM', '32', STATUS ) + CALL VVD ( DRM(3,3), 0.01678926022795169D0, 1D-12, + : 'slDMXM', '33', STATUS ) + + CALL slDS2C ( 3.0123D0, -0.999D0, DV1 ) + CALL VVD ( DV1(1), -0.5366267667260525D0, 1D-12, + : 'slDS2C', 'X', STATUS ) + CALL VVD ( DV1(2), 0.06977111097651444D0, 1D-12, + : 'slDS2C', 'Y', STATUS ) + CALL VVD ( DV1(3), -0.8409302618566215D0, 1D-12, + : 'slDS2C', 'Z', STATUS ) + + CALL slDMXV ( DRM1, DV1, DV2 ) + CALL slDMXV ( DRM2, DV2, DV3 ) + CALL VVD ( DV3(1), -0.7267487768696160D0, 1D-12, + : 'slDMXV', 'X', STATUS ) + CALL VVD ( DV3(2), 0.5011537352639822D0, 1D-12, + : 'slDMXV', 'Y', STATUS ) + CALL VVD ( DV3(3), 0.4697671220397141D0, 1D-12, + : 'slDMXV', 'Z', STATUS ) + + CALL slDIMV ( DRM, DV3, DV4 ) + CALL VVD ( DV4(1), -0.5366267667260526D0, 1D-12, + : 'slDIMV', 'X', STATUS ) + CALL VVD ( DV4(2), 0.06977111097651445D0, 1D-12, + : 'slDIMV', 'Y', STATUS ) + CALL VVD ( DV4(3), -0.8409302618566215D0, 1D-12, + : 'slDIMV', 'Z', STATUS ) + + CALL slDMAV ( DRM, DV5 ) + CALL VVD ( DV5(1), 0.006889040510209034D0, 1D-12, + : 'slDMAV', 'X', STATUS ) + CALL VVD ( DV5(2), -1.577473205461961D0, 1D-12, + : 'slDMAV', 'Y', STATUS ) + CALL VVD ( DV5(3), 0.5201843672856759D0, 1D-12, + : 'slDMAV', 'Z', STATUS ) + + DO I = 1, 3 + DV5(I) = DV5(I) * 1000D0 + END DO + + CALL slDVN ( DV5, DV6, DVM ) + CALL VVD ( DV6(1), 0.004147420704640065D0, 1D-12, + : 'slDVN', 'X', STATUS ) + CALL VVD ( DV6(2), -0.9496888606842218D0, 1D-12, + : 'slDVN', 'Y', STATUS ) + CALL VVD ( DV6(3), 0.3131674740355448D0, 1D-12, + : 'slDVN', 'Z', STATUS ) + CALL VVD ( DVM, 1661.042127339937D0, 1D-9, 'slDVN', + : 'M', STATUS ) + + CALL VVD ( slDVDV ( DV6, DV1 ), -0.3318384698006295D0, + : 1D-12, 'slDVN', ' ', STATUS ) + + CALL slDVXV (DV6, DV1, DV7 ) + CALL VVD ( DV7(1), 0.7767720597123304D0, 1D-12, + : 'slDVXV', 'X', STATUS ) + CALL VVD ( DV7(2), -0.1645663574562769D0, 1D-12, + : 'slDVXV', 'Y', STATUS ) + CALL VVD ( DV7(3), -0.5093390925544726D0, 1D-12, + : 'slDVXV', 'Z', STATUS ) + + END + + SUBROUTINE T_ZD ( STATUS ) +*+ +* - - - - - +* T _ Z D +* - - - - - +* +* Test slZD routine. +* +* Returned: +* STATUS LOGICAL .TRUE. = success, .FALSE. = fail +* +* Called: VVD, slZD. +* +* Last revision: 22 October 2005 +* +* Copyright CLRC/Starlink. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 59 Temple Place, Suite 330, +* Boston, MA 02111-1307 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + LOGICAL STATUS + + DOUBLE PRECISION slZD + + + CALL VVD ( slZD ( -1.023D0, -0.876D0, -0.432D0 ), + : 0.8963914139430839D0, 1D-12, 'slZD', ' ', STATUS ) + + END diff --git a/math/slalib/slalib.h b/math/slalib/slalib.h new file mode 100644 index 00000000..bf804c4f --- /dev/null +++ b/math/slalib/slalib.h @@ -0,0 +1,509 @@ +#ifndef SLALIBHDEF +#define SLALIBHDEF +/* +** Author: +** Patrick Wallace (ptw@tpsoft.demon.co.uk) +** +** License: +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 +** USA. +** +** Last revision: 10 December 2002 +** +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +void slaAddet ( double rm, double dm, double eq, double *rc, double *dc ); + +void slaAfin ( const char *string, int *iptr, float *a, int *j ); + +double slaAirmas ( double zd ); + +void slaAltaz ( double ha, double dec, double phi, + double *az, double *azd, double *azdd, + double *el, double *eld, double *eldd, + double *pa, double *pad, double *padd ); + +void slaAmp ( double ra, double da, double date, double eq, + double *rm, double *dm ); + +void slaAmpqk ( double ra, double da, double amprms[21], + double *rm, double *dm ); + +void slaAop ( double rap, double dap, double date, double dut, + double elongm, double phim, double hm, double xp, + double yp, double tdk, double pmb, double rh, + double wl, double tlr, + double *aob, double *zob, double *hob, + double *dob, double *rob ); + +void slaAoppa ( double date, double dut, double elongm, double phim, + double hm, double xp, double yp, double tdk, double pmb, + double rh, double wl, double tlr, double aoprms[14] ); + +void slaAoppat ( double date, double aoprms[14] ); + +void slaAopqk ( double rap, double dap, double aoprms[14], + double *aob, double *zob, double *hob, + double *dob, double *rob ); + +void slaAtmdsp ( double tdk, double pmb, double rh, double wl1, + double a1, double b1, double wl2, double *a2, double *b2 ); + +void slaAv2m ( float axvec[3], float rmat[3][3] ); + +float slaBear ( float a1, float b1, float a2, float b2 ); + +void slaCaf2r ( int ideg, int iamin, float asec, float *rad, int *j ); + +void slaCaldj ( int iy, int im, int id, double *djm, int *j ); + +void slaCalyd ( int iy, int im, int id, int *ny, int *nd, int *j ); + +void slaCc2s ( float v[3], float *a, float *b ); + +void slaCc62s ( float v[6], float *a, float *b, float *r, + float *ad, float *bd, float *rd ); + +void slaCd2tf ( int ndp, float days, char *sign, int ihmsf[4] ); + +void slaCldj ( int iy, int im, int id, double *djm, int *j ); + +void slaClyd ( int iy, int im, int id, int *ny, int *nd, int *jstat ); + +void slaCombn ( int nsel, int ncand, int list[], int *j ); + +void slaCr2af ( int ndp, float angle, char *sign, int idmsf[4] ); + +void slaCr2tf ( int ndp, float angle, char *sign, int ihmsf[4] ); + +void slaCs2c ( float a, float b, float v[3] ); + +void slaCs2c6 ( float a, float b, float r, float ad, + float bd, float rd, float v[6] ); + +void slaCtf2d ( int ihour, int imin, float sec, float *days, int *j ); + +void slaCtf2r ( int ihour, int imin, float sec, float *rad, int *j ); + +void slaDaf2r ( int ideg, int iamin, double asec, double *rad, int *j ); + +void slaDafin ( const char *string, int *iptr, double *a, int *j ); + +double slaDat ( double dju ); + +void slaDav2m ( double axvec[3], double rmat[3][3] ); + +double slaDbear ( double a1, double b1, double a2, double b2 ); + +void slaDbjin ( const char *string, int *nstrt, + double *dreslt, int *jf1, int *jf2 ); + +void slaDc62s ( double v[6], double *a, double *b, double *r, + double *ad, double *bd, double *rd ); + +void slaDcc2s ( double v[3], double *a, double *b ); + +void slaDcmpf ( double coeffs[6], double *xz, double *yz, double *xs, + double *ys, double *perp, double *orient ); + +void slaDcs2c ( double a, double b, double v[3] ); + +void slaDd2tf ( int ndp, double days, char *sign, int ihmsf[4] ); + +void slaDe2h ( double ha, double dec, double phi, + double *az, double *el ); + +void slaDeuler ( const char *order, double phi, double theta, double psi, + double rmat[3][3] ); + +void slaDfltin ( const char *string, int *nstrt, double *dreslt, int *jflag ); + +void slaDh2e ( double az, double el, double phi, double *ha, double *dec); + +void slaDimxv ( double dm[3][3], double va[3], double vb[3] ); + +void slaDjcal ( int ndp, double djm, int iymdf[4], int *j ); + +void slaDjcl ( double djm, int *iy, int *im, int *id, double *fd, int *j ); + +void slaDm2av ( double rmat[3][3], double axvec[3] ); + +void slaDmat ( int n, double *a, double *y, double *d, int *jf, int *iw ); + +void slaDmoon ( double date, double pv[6] ); + +void slaDmxm ( double a[3][3], double b[3][3], double c[3][3] ); + +void slaDmxv ( double dm[3][3], double va[3], double vb[3] ); + +double slaDpav ( double v1[3], double v2[3] ); + +void slaDr2af ( int ndp, double angle, char *sign, int idmsf[4] ); + +void slaDr2tf ( int ndp, double angle, char *sign, int ihmsf[4] ); + +double slaDrange ( double angle ); + +double slaDranrm ( double angle ); + +void slaDs2c6 ( double a, double b, double r, double ad, double bd, + double rd, double v[6] ); + +void slaDs2tp ( double ra, double dec, double raz, double decz, + double *xi, double *eta, int *j ); + +double slaDsep ( double a1, double b1, double a2, double b2 ); + +double slaDsepv ( double v1[3], double v2[3] ); + +double slaDt ( double epoch ); + +void slaDtf2d ( int ihour, int imin, double sec, double *days, int *j ); + +void slaDtf2r ( int ihour, int imin, double sec, double *rad, int *j ); + +void slaDtp2s ( double xi, double eta, double raz, double decz, + double *ra, double *dec ); + +void slaDtp2v ( double xi, double eta, double v0[3], double v[3] ); + +void slaDtps2c ( double xi, double eta, double ra, double dec, + double *raz1, double *decz1, + double *raz2, double *decz2, int *n ); + +void slaDtpv2c ( double xi, double eta, double v[3], + double v01[3], double v02[3], int *n ); + +double slaDtt ( double dju ); + +void slaDv2tp ( double v[3], double v0[3], double *xi, double *eta, int *j ); + +double slaDvdv ( double va[3], double vb[3] ); + +void slaDvn ( double v[3], double uv[3], double *vm ); + +void slaDvxv ( double va[3], double vb[3], double vc[3] ); + +void slaE2h ( float ha, float dec, float phi, float *az, float *el ); + +void slaEarth ( int iy, int id, float fd, float posvel[6] ); + +void slaEcleq ( double dl, double db, double date, double *dr, double *dd ); + +void slaEcmat ( double date, double rmat[3][3] ); + +void slaEcor ( float rm, float dm, int iy, int id, float fd, + float *rv, float *tl ); + +void slaEg50 ( double dr, double dd, double *dl, double *db ); + +void slaEl2ue ( double date, int jform, double epoch, double orbinc, + double anode, double perih, double aorq, double e, + double aorl, double dm, double u[], int *jstat ); + +double slaEpb ( double date ); + +double slaEpb2d ( double epb ); + +double slaEpco ( char k0, char k, double e ); + +double slaEpj ( double date ); + +double slaEpj2d ( double epj ); + +void slaEqecl ( double dr, double dd, double date, double *dl, double *db ); + +double slaEqeqx ( double date ); + +void slaEqgal ( double dr, double dd, double *dl, double *db ); + +void slaEtrms ( double ep, double ev[3] ); + +void slaEuler ( const char *order, float phi, float theta, float psi, + float rmat[3][3] ); + +void slaEvp ( double date, double deqx, + double dvb[3], double dpb[3], + double dvh[3], double dph[3] ); + +void slaFitxy ( int itype, int np, double xye[][2], double xym[][2], + double coeffs[6], int *j ); + +void slaFk425 ( double r1950, double d1950, double dr1950, + double dd1950, double p1950, double v1950, + double *r2000, double *d2000, double *dr2000, + double *dd2000, double *p2000, double *v2000 ); + +void slaFk45z ( double r1950, double d1950, double bepoch, + double *r2000, double *d2000 ); + +void slaFk524 ( double r2000, double d2000, double dr2000, + double dd2000, double p2000, double v2000, + double *r1950, double *d1950, double *dr1950, + double *dd1950, double *p1950, double *v1950 ); + +void slaFk52h ( double r5, double d5, double dr5, double dd5, + double *dr, double *dh, double *drh, double *ddh ); + +void slaFk54z ( double r2000, double d2000, double bepoch, + double *r1950, double *d1950, + double *dr1950, double *dd1950 ); + +void slaFk5hz ( double r5, double d5, double epoch, + double *rh, double *dh ); + +void slaFlotin ( const char *string, int *nstrt, float *reslt, int *jflag ); + +void slaGaleq ( double dl, double db, double *dr, double *dd ); + +void slaGalsup ( double dl, double db, double *dsl, double *dsb ); + +void slaGe50 ( double dl, double db, double *dr, double *dd ); + +void slaGeoc ( double p, double h, double *r, double *z ); + +double slaGmst ( double ut1 ); + +double slaGmsta ( double date, double ut1 ); + +void slaH2e ( float az, float el, float phi, float *ha, float *dec ); + +void slaH2fk5 ( double dr, double dh, double drh, double ddh, + double *r5, double *d5, double *dr5, double *dd5 ); + +void slaHfk5z ( double rh, double dh, double epoch, + double *r5, double *d5, double *dr5, double *dd5 ); + +void slaImxv ( float rm[3][3], float va[3], float vb[3] ); + +void slaInt2in ( const char *string, int *nstrt, int *ireslt, int *jflag ); + +void slaIntin ( const char *string, int *nstrt, long *ireslt, int *jflag ); + +void slaInvf ( double fwds[6], double bkwds[6], int *j ); + +void slaKbj ( int jb, double e, char *k, int *j ); + +void slaM2av ( float rmat[3][3], float axvec[3] ); + +void slaMap ( double rm, double dm, double pr, double pd, + double px, double rv, double eq, double date, + double *ra, double *da ); + +void slaMappa ( double eq, double date, double amprms[21] ); + +void slaMapqk ( double rm, double dm, double pr, double pd, + double px, double rv, double amprms[21], + double *ra, double *da ); + +void slaMapqkz ( double rm, double dm, double amprms[21], + double *ra, double *da ); + +void slaMoon ( int iy, int id, float fd, float posvel[6] ); + +void slaMxm ( float a[3][3], float b[3][3], float c[3][3] ); + +void slaMxv ( float rm[3][3], float va[3], float vb[3] ); + +void slaNut ( double date, double rmatn[3][3] ); + +void slaNutc ( double date, double *dpsi, double *deps, double *eps0 ); + +void slaNutc80 ( double date, double *dpsi, double *deps, double *eps0 ); + +void slaOap ( const char *type, double ob1, double ob2, double date, + double dut, double elongm, double phim, double hm, + double xp, double yp, double tdk, double pmb, + double rh, double wl, double tlr, + double *rap, double *dap ); + +void slaOapqk ( const char *type, double ob1, double ob2, double aoprms[14], + double *rap, double *dap ); + +void slaObs ( int n, char *c, char *name, double *w, double *p, double *h ); + +double slaPa ( double ha, double dec, double phi ); + +double slaPav ( float v1[3], float v2[3] ); + +void slaPcd ( double disco, double *x, double *y ); + +void slaPda2h ( double p, double d, double a, + double *h1, int *j1, double *h2, int *j2 ); + +void slaPdq2h ( double p, double d, double q, + double *h1, int *j1, double *h2, int *j2 ); + +void slaPermut ( int n, int istate[], int iorder[], int *j ); + +void slaPertel (int jform, double date0, double date1, + double epoch0, double orbi0, double anode0, + double perih0, double aorq0, double e0, double am0, + double *epoch1, double *orbi1, double *anode1, + double *perih1, double *aorq1, double *e1, double *am1, + int *jstat ); + +void slaPertue ( double date, double u[], int *jstat ); + +void slaPlanel ( double date, int jform, double epoch, double orbinc, + double anode, double perih, double aorq, double e, + double aorl, double dm, double pv[6], int *jstat ); + +void slaPlanet ( double date, int np, double pv[6], int *j ); + +void slaPlante ( double date, double elong, double phi, int jform, + double epoch, double orbinc, double anode, double perih, + double aorq, double e, double aorl, double dm, + double *ra, double *dec, double *r, int *jstat ); + +void slaPlantu ( double date, double elong, double phi, double u[], + double *ra, double *dec, double *r, int *jstat ); + +void slaPm ( double r0, double d0, double pr, double pd, + double px, double rv, double ep0, double ep1, + double *r1, double *d1 ); + +void slaPolmo ( double elongm, double phim, double xp, double yp, + double *elong, double *phi, double *daz ); + +void slaPrebn ( double bep0, double bep1, double rmatp[3][3] ); + +void slaPrec ( double ep0, double ep1, double rmatp[3][3] ); + +void slaPrecl ( double ep0, double ep1, double rmatp[3][3] ); + +void slaPreces ( const char sys[3], double ep0, double ep1, + double *ra, double *dc ); + +void slaPrenut ( double epoch, double date, double rmatpn[3][3] ); + +void slaPv2el ( double pv[], double date, double pmass, int jformr, + int *jform, double *epoch, double *orbinc, + double *anode, double *perih, double *aorq, double *e, + double *aorl, double *dm, int *jstat ); + +void slaPv2ue ( double pv[], double date, double pmass, + double u[], int *jstat ); + +void slaPvobs ( double p, double h, double stl, double pv[6] ); + +void slaPxy ( int np, double xye[][2], double xym[][2], + double coeffs[6], + double xyp[][2], double *xrms, double *yrms, double *rrms ); + +float slaRange ( float angle ); + +float slaRanorm ( float angle ); + +double slaRcc ( double tdb, double ut1, double wl, double u, double v ); + +void slaRdplan ( double date, int np, double elong, double phi, + double *ra, double *dec, double *diam ); + +void slaRefco ( double hm, double tdk, double pmb, double rh, + double wl, double phi, double tlr, double eps, + double *refa, double *refb ); + +void slaRefcoq ( double tdk, double pmb, double rh, double wl, + double *refa, double *refb ); + +void slaRefro ( double zobs, double hm, double tdk, double pmb, + double rh, double wl, double phi, double tlr, double eps, + double *ref ); + +void slaRefv ( double vu[3], double refa, double refb, double vr[3] ); + +void slaRefz ( double zu, double refa, double refb, double *zr ); + +float slaRverot ( float phi, float ra, float da, float st ); + +float slaRvgalc ( float r2000, float d2000 ); + +float slaRvlg ( float r2000, float d2000 ); + +float slaRvlsrd ( float r2000, float d2000 ); + +float slaRvlsrk ( float r2000, float d2000 ); + +void slaS2tp ( float ra, float dec, float raz, float decz, + float *xi, float *eta, int *j ); + +float slaSep ( float a1, float b1, float a2, float b2 ); + +float slaSepv ( float v1[3], float v2[3] ); + +void slaSmat ( int n, float *a, float *y, float *d, int *jf, int *iw ); + +void slaSubet ( double rc, double dc, double eq, + double *rm, double *dm ); + +void slaSupgal ( double dsl, double dsb, double *dl, double *db ); + +void slaSvd ( int m, int n, int mp, int np, + double *a, double *w, double *v, double *work, + int *jstat ); + +void slaSvdcov ( int n, int np, int nc, + double *w, double *v, double *work, double *cvm ); + +void slaSvdsol ( int m, int n, int mp, int np, + double *b, double *u, double *w, double *v, + double *work, double *x ); + +void slaTp2s ( float xi, float eta, float raz, float decz, + float *ra, float *dec ); + +void slaTp2v ( float xi, float eta, float v0[3], float v[3] ); + +void slaTps2c ( float xi, float eta, float ra, float dec, + float *raz1, float *decz1, + float *raz2, float *decz2, int *n ); + +void slaTpv2c ( float xi, float eta, float v[3], + float v01[3], float v02[3], int *n ); + +void slaUe2el ( double u[], int jformr, + int *jform, double *epoch, double *orbinc, + double *anode, double *perih, double *aorq, double *e, + double *aorl, double *dm, int *jstat ); + +void slaUe2pv ( double date, double u[], double pv[], int *jstat ); + +void slaUnpcd ( double disco, double *x, double *y ); + +void slaV2tp ( float v[3], float v0[3], float *xi, float *eta, int *j ); + +float slaVdv ( float va[3], float vb[3] ); + +void slaVn ( float v[3], float uv[3], float *vm ); + +void slaVxv ( float va[3], float vb[3], float vc[3] ); + +void slaXy2xy ( double x1, double y1, double coeffs[6], + double *x2, double *y2 ); + +double slaZd ( double ha, double dec, double phi ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/math/slalib/smat.f b/math/slalib/smat.f new file mode 100644 index 00000000..bd922c55 --- /dev/null +++ b/math/slalib/smat.f @@ -0,0 +1,159 @@ + SUBROUTINE slSMAT (N, A, Y, D, JF, IW) +*+ +* - - - - - +* S M A T +* - - - - - +* +* Matrix inversion & solution of simultaneous equations +* (single precision) +* +* For the set of n simultaneous equations in n unknowns: +* A.Y = X +* +* where: +* A is a non-singular N x N matrix +* Y is the vector of N unknowns +* X is the known vector +* +* SMATRX computes: +* the inverse of matrix A +* the determinant of matrix A +* the vector of N unknowns +* +* Arguments: +* +* symbol type dimension before after +* +* N int no. of unknowns unchanged +* A real (N,N) matrix inverse +* Y real (N) vector solution +* D real - determinant +* * JF int - singularity flag +* IW int (N) - workspace +* +* * JF is the singularity flag. If the matrix is non-singular, +* JF=0 is returned. If the matrix is singular, JF=-1 & D=0.0 are +* returned. In the latter case, the contents of array A on return +* are undefined. +* +* Algorithm: +* Gaussian elimination with partial pivoting. +* +* Speed: +* Very fast. +* +* Accuracy: +* Fairly accurate - errors 1 to 4 times those of routines optimised +* for accuracy. +* +* Note: replaces the obsolete slSMATRX routine. +* +* P.T.Wallace Starlink 10 September 1990 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER N + REAL A(N,N),Y(N),D + INTEGER JF + INTEGER IW(N) + + REAL SFA + PARAMETER (SFA=1E-20) + + INTEGER K,IMX,I,J,NP1MK,KI + REAL AMX,T,AKK,YK,AIK + + + JF=0 + D=1.0 + DO K=1,N + AMX=ABS(A(K,K)) + IMX=K + IF (K.NE.N) THEN + DO I=K+1,N + T=ABS(A(I,K)) + IF (T.GT.AMX) THEN + AMX=T + IMX=I + END IF + END DO + END IF + IF (AMX.LT.SFA) THEN + JF=-1 + ELSE + IF (IMX.NE.K) THEN + DO J=1,N + T=A(K,J) + A(K,J)=A(IMX,J) + A(IMX,J)=T + END DO + T=Y(K) + Y(K)=Y(IMX) + Y(IMX)=T + D=-D + END IF + IW(K)=IMX + AKK=A(K,K) + D=D*AKK + IF (ABS(D).LT.SFA) THEN + JF=-1 + ELSE + AKK=1.0/AKK + A(K,K)=AKK + DO J=1,N + IF (J.NE.K) A(K,J)=A(K,J)*AKK + END DO + YK=Y(K)*AKK + Y(K)=YK + DO I=1,N + AIK=A(I,K) + IF (I.NE.K) THEN + DO J=1,N + IF (J.NE.K) A(I,J)=A(I,J)-AIK*A(K,J) + END DO + Y(I)=Y(I)-AIK*YK + END IF + END DO + DO I=1,N + IF (I.NE.K) A(I,K)=-A(I,K)*AKK + END DO + END IF + END IF + END DO + IF (JF.NE.0) THEN + D=0.0 + ELSE + DO K=1,N + NP1MK=N+1-K + KI=IW(NP1MK) + IF (NP1MK.NE.KI) THEN + DO I=1,N + T=A(I,NP1MK) + A(I,NP1MK)=A(I,KI) + A(I,KI)=T + END DO + END IF + END DO + END IF + END diff --git a/math/slalib/subet.f b/math/slalib/subet.f new file mode 100644 index 00000000..04ed6f9d --- /dev/null +++ b/math/slalib/subet.f @@ -0,0 +1,84 @@ + SUBROUTINE slSUET (RC, DC, EQ, RM, DM) +*+ +* - - - - - - +* S U E T +* - - - - - - +* +* Remove the E-terms (elliptic component of annual aberration) +* from a pre IAU 1976 catalogue RA,Dec to give a mean place +* (double precision) +* +* Given: +* RC,DC dp RA,Dec (radians) with E-terms included +* EQ dp Besselian epoch of mean equator and equinox +* +* Returned: +* RM,DM dp RA,Dec (radians) without E-terms +* +* Called: +* slETRM, slDS2C, sla_,DVDV, slDC2S, slDA2P +* +* Explanation: +* Most star positions from pre-1984 optical catalogues (or +* derived from astrometry using such stars) embody the +* E-terms. This routine converts such a position to a +* formal mean place (allowing, for example, comparison with a +* pulsar timing position). +* +* Reference: +* Explanatory Supplement to the Astronomical Ephemeris, +* section 2D, page 48. +* +* P.T.Wallace Starlink 10 May 1990 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION RC,DC,EQ,RM,DM + + DOUBLE PRECISION slDA2P,slDVDV + DOUBLE PRECISION A(3),V(3),F + + INTEGER I + + + +* E-terms + CALL slETRM(EQ,A) + +* Spherical to Cartesian + CALL slDS2C(RC,DC,V) + +* Include the E-terms + F=1D0+slDVDV(V,A) + DO I=1,3 + V(I)=F*V(I)-A(I) + END DO + +* Cartesian to spherical + CALL slDC2S(V,RM,DM) + +* Bring RA into conventional range + RM=slDA2P(RM) + + END diff --git a/math/slalib/sun67.tex b/math/slalib/sun67.tex new file mode 100644 index 00000000..ab9c7ba9 --- /dev/null +++ b/math/slalib/sun67.tex @@ -0,0 +1,13140 @@ +\documentclass[11pt,twoside]{article} +\setcounter{tocdepth}{2} +\pagestyle{myheadings} + +% ----------------------------------------------------------------------------- +% ? Document identification +\newcommand{\stardoccategory} {Starlink User Note} +\newcommand{\stardocinitials} {SUN} +\newcommand{\stardocsource} {sun67.70} +\newcommand{\stardocnumber} {67.70} +\newcommand{\stardocauthors} {P.\,T.\,Wallace} +\newcommand{\stardocdate} {19 December 2005} +\newcommand{\stardoctitle} {SLALIB --- Positional Astronomy Library} +\newcommand{\stardocversion} {2.5-3} +\newcommand{\stardocmanual} {Programmer's Manual} +% ? End of document identification + +%%% Also see \nroutines definition later %%% + +% ----------------------------------------------------------------------------- + +\newcommand{\stardocname}{\stardocinitials /\stardocnumber} +\markright{\stardocname} + +%---------------------------------------------------- +% Comment out unwanted definitions to suit stationery + +\setlength{\textwidth}{160mm} % +\setlength{\textheight}{230mm} % European A4 +\setlength{\topmargin}{-5mm} % + +%\setlength{\textwidth}{167mm} % +%\setlength{\textheight}{220mm} % US Letter +%\setlength{\topmargin}{-10mm} % + +% +%---------------------------------------------------- + +\setlength{\textwidth}{160mm} +\setlength{\textheight}{230mm} +\setlength{\topmargin}{-2mm} +\setlength{\oddsidemargin}{0mm} +\setlength{\evensidemargin}{0mm} +\setlength{\parindent}{0mm} +\setlength{\parskip}{\medskipamount} +\setlength{\unitlength}{1mm} + +% ----------------------------------------------------------------------------- +% Hypertext definitions. +% ====================== +% These are used by the LaTeX2HTML translator in conjunction with star2html. + +% Comment.sty: version 2.0, 19 June 1992 +% Selectively in/exclude pieces of text. +% +% Author +% Victor Eijkhout +% Department of Computer Science +% University Tennessee at Knoxville +% 104 Ayres Hall +% Knoxville, TN 37996 +% USA + +% Do not remove the %begin{latexonly} and %end{latexonly} lines (used by +% star2html to signify raw TeX that latex2html cannot process). +%begin{latexonly} +\makeatletter +\def\makeinnocent#1{\catcode`#1=12 } +\def\csarg#1#2{\expandafter#1\csname#2\endcsname} + +\def\ThrowAwayComment#1{\begingroup + \def\CurrentComment{#1}% + \let\do\makeinnocent \dospecials + \makeinnocent\^^L% and whatever other special cases + \endlinechar`\^^M \catcode`\^^M=12 \xComment} +{\catcode`\^^M=12 \endlinechar=-1 % + \gdef\xComment#1^^M{\def\test{#1} + \csarg\ifx{PlainEnd\CurrentComment Test}\test + \let\html@next\endgroup + \else \csarg\ifx{LaLaEnd\CurrentComment Test}\test + \edef\html@next{\endgroup\noexpand\end{\CurrentComment}} + \else \let\html@next\xComment + \fi \fi \html@next} +} +\makeatother + +\def\includecomment + #1{\expandafter\def\csname#1\endcsname{}% + \expandafter\def\csname end#1\endcsname{}} +\def\excludecomment + #1{\expandafter\def\csname#1\endcsname{\ThrowAwayComment{#1}}% + {\escapechar=-1\relax + \csarg\xdef{PlainEnd#1Test}{\string\\end#1}% + \csarg\xdef{LaLaEnd#1Test}{\string\\end\string\{#1\string\}}% + }} + +% Define environments that ignore their contents. +\excludecomment{comment} +\excludecomment{rawhtml} +\excludecomment{htmlonly} + +% Hypertext commands etc. This is a condensed version of the html.sty +% file supplied with LaTeX2HTML by: Nikos Drakos & +% Jelle van Zeijl . The LaTeX2HTML documentation +% should be consulted about all commands (and the environments defined above) +% except \xref and \xlabel which are Starlink specific. + +\newcommand{\htmladdnormallinkfoot}[2]{#1\footnote{#2}} +\newcommand{\htmladdnormallink}[2]{#1} +\newcommand{\htmladdimg}[1]{} +\newenvironment{latexonly}{}{} +\newcommand{\hyperref}[4]{#2\ref{#4}#3} +\newcommand{\htmlref}[2]{#1} +\newcommand{\htmlimage}[1]{} +\newcommand{\htmladdtonavigation}[1]{} +\newcommand{\latexhtml}[2]{#1} +\newcommand{\html}[1]{} + +% Starlink cross-references and labels. +\newcommand{\xref}[3]{#1} +\newcommand{\xlabel}[1]{} + +% LaTeX2HTML symbol. +\newcommand{\latextohtml}{{\bf LaTeX}{2}{\tt{HTML}}} + +% Define command to re-centre underscore for Latex and leave as normal +% for HTML (severe problems with \_ in tabbing environments and \_\_ +% generally otherwise). +\newcommand{\latex}[1]{#1} +\newcommand{\setunderscore}{\renewcommand{\_}{{\tt\symbol{95}}}} +\latex{\setunderscore} + +% ----------------------------------------------------------------------------- +% Debugging. +% ========= +% Remove % on the following to debug links in the HTML version using Latex. + +% \newcommand{\hotlink}[2]{\fbox{\begin{tabular}[t]{@{}c@{}}#1\\\hline{\footnotesize #2}\end{tabular}}} +% \renewcommand{\htmladdnormallinkfoot}[2]{\hotlink{#1}{#2}} +% \renewcommand{\htmladdnormallink}[2]{\hotlink{#1}{#2}} +% \renewcommand{\hyperref}[4]{\hotlink{#1}{\S\ref{#4}}} +% \renewcommand{\htmlref}[2]{\hotlink{#1}{\S\ref{#2}}} +% \renewcommand{\xref}[3]{\hotlink{#1}{#2 -- #3}} +%end{latexonly} +% ----------------------------------------------------------------------------- +% ? Document specific \newcommand or \newenvironment commands. +%------------------------------------------------------------------------------ + +\newcommand{\nroutines} {188} +\newcommand{\radec} {$[\,\alpha,\delta\,]$} +\newcommand{\hadec} {$[\,h,\delta\,]$} +\newcommand{\xieta} {$[\,\xi,\eta\,]$} +\newcommand{\azel} {$[\,Az,El~]$} +\newcommand{\ecl} {$[\,\lambda,\beta~]$} +\newcommand{\gal} {$[\,l^{I\!I},b^{I\!I}\,]$} +\newcommand{\xy} {$[\,x,y\,]$} +\newcommand{\xyz} {$[\,x,y,z\,]$} +\newcommand{\xyzd} {$[\,\dot{x},\dot{y},\dot{z}\,]$} +\newcommand{\xyzxyzd} {$[\,x,y,z,\dot{x},\dot{y},\dot{z}\,]$} +\newcommand{\degree}[2] {$#1^{\circ} + \hspace{-0.37em}.\hspace{0.02em}#2$} + +\newcommand{\arcsec}[2] {\arcseci{#1}$\hspace{-0.4em}.#2$} +\begin{htmlonly} + \newcommand{\arcsec}[2] { + {$#1\hspace{-0.05em}^{'\hspace{-0.1em}'}\hspace{-0.4em}.#2$} + } +\end{htmlonly} + +\newcommand{\arcseci}[1] {$#1\hspace{-0.05em}$\raisebox{-0.5ex} + {$^{'\hspace{-0.1em}'}$}} +\begin{htmlonly} + \newcommand{\arcseci}[1] {$#1\hspace{-0.05em}^{'\hspace{-0.1em}'}$} +\end{htmlonly} + +\newcommand{\dms}[4] {$#1^{\circ}\,#2\raisebox{-0.5ex} + {$^{'}$}\,$\arcsec{#3}{#4}} +\begin{htmlonly} + \newcommand{\dms}[4]{$#1^{\circ}\,#2^{'}\,#3^{''}.#4$} +\end{htmlonly} + +\newcommand{\tseci}[1] {$#1$\mbox{$^{\rm s}$}} +\newcommand{\tsec}[2] {\tseci{#1}$\hspace{-0.3em}.#2$} +\begin{htmlonly} + \newcommand{\tsec}[2] {$#1^{\rm s}\hspace{-0.3em}.#2$} +\end{htmlonly} + +\newcommand{\hms}[4] {$#1^{\rm h}\,#2^{\rm m}\,$\tsec{#3}{#4}} +\begin{htmlonly} + \newcommand{\hms}[4] {$#1^{h}\,#2^{m}\,#3^{s}.#4$} +\end{htmlonly} + +\newcommand{\callhead}[1]{\goodbreak\vspace{\bigskipamount}{\large\bf{#1}}} +\newenvironment{callset}{\begin{list}{}{\setlength{\leftmargin}{2cm} + \setlength{\parsep}{\smallskipamount}}}{\end{list}} +\newcommand{\subp}[1]{\item\hspace{-1cm}#1\\} +\newcommand{\subq}[2]{\item\hspace{-1cm}#1\\\hspace*{-1cm}#2\\} +\newcommand{\name}[1]{\mbox{#1}} +\newcommand{\fortvar}[1]{\mbox{\em #1}} + +\newcommand{\routine}[3] +{\hbadness=10000 + \vbox + { + \rule{\textwidth}{0.3mm}\\ + {\Large {\bf #1} \hfill #2 \hfill {\bf #1}}\\ + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + #3 + \end{description} + \setlength{\topsep}{\oldspacing} + } +} + +% Replacement for HTML version (each routine in own subsection). +\begin{htmlonly} + \newcommand{\routine}[3] + { + \subsection{#1\xlabel{#1} - #2\label{#1}} + \begin{description} + #3 + \end{description} + } +\end{htmlonly} + +\newcommand{\action}[1] +{\item[ACTION]: #1} + +\begin{htmlonly} + \newcommand{\action}[1] + {\item[ACTION:] #1} +\end{htmlonly} + +\newcommand{\call}[1] +{\item[CALL]: \hspace{0.4em}{\tt #1}} +\newlength{\oldspacing} + +\begin{htmlonly} + \newcommand{\call}[1] + { + \item[CALL:] {\tt #1} + } +\end{htmlonly} + +\newcommand{\args}[2] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[#1]:\\[1.5ex] + \begin{tabular}{p{7em}p{6em}p{22em}} + #2 + \end{tabular} + \end{description} + \setlength{\topsep}{\oldspacing} +} +\begin{htmlonly} + \newcommand{\args}[2] + { + \begin{description} + \item[#1:]\\ + \begin{tabular}{p{7em}p{6em}l} + #2 + \end{tabular} + \end{description} + } +\end{htmlonly} + +\newcommand{\spec}[3] +{ + {\em {#1}} & {\bf \mbox{#2}} & {#3} +} + +\newcommand{\specel}[2] +{ + \multicolumn{1}{c}{#1} & {} & {#2} +} + +\newcommand{\anote}[1] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[NOTE]: + #1 + \end{description} + \setlength{\topsep}{\oldspacing} +} + +\begin{htmlonly} + \newcommand{\anote}[1] + { + \begin{description} + \item[NOTE:] + #1 + \end{description} + } +\end{htmlonly} + +\newcommand{\notes}[1] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[NOTES]: + #1 + \end{description} + \setlength{\topsep}{\oldspacing} +} + +\begin{htmlonly} + \newcommand{\notes}[1] + { + \begin{description} + \item[NOTES:] + #1 + \end{description} + } +\end{htmlonly} + +\newcommand{\aref}[1] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[REFERENCE]: + #1 + \end{description} + \setlength{\topsep}{\oldspacing} +} + +\begin{htmlonly} + \newcommand{\aref}[1] + { + \begin{description} + \item[REFERENCE:] + #1 + \end{description} + } +\end{htmlonly} + +\newcommand{\refs}[1] +{ + \goodbreak + \setlength{\oldspacing}{\topsep} + \setlength{\topsep}{0.3ex} + \begin{description} + \item[REFERENCES]: + #1 + \end{description} + \setlength{\topsep}{\oldspacing} +} +\begin{htmlonly} + \newcommand{\refs}[1] + { + \begin{description} + \item[REFERENCES:] + #1 + \end{description} + } +\end{htmlonly} + +\newcommand{\exampleitem}{\item [EXAMPLE]:} +\begin{htmlonly} + \newcommand{\exampleitem}{\item [EXAMPLE:]} +\end{htmlonly} + +%------------------------------------------------------------------------------ +% ? End of document specific commands +% ----------------------------------------------------------------------------- +% Title Page. +% =========== +\renewcommand{\thepage}{\roman{page}} +\begin{document} +\thispagestyle{empty} + +% Latex document header. +% ====================== +\begin{latexonly} + CCLRC / {\sc Rutherford Appleton Laboratory} \hfill {\bf \stardocname}\\ + {\large Particle Physics \& Astronomy Research Council}\\ + {\large Starlink Project\\} + {\large \stardoccategory\ \stardocnumber} + \begin{flushright} + \stardocauthors\\ + \stardocdate + \end{flushright} + \vspace{-4mm} + \rule{\textwidth}{0.5mm} + \vspace{5mm} + \begin{center} + {\Huge\bf \stardoctitle \\ [2.5ex]} + {\LARGE\bf \stardocversion \\ [4ex]} + {\Huge\bf \stardocmanual} + \end{center} + \vspace{5mm} + +% ? Heading for abstract if used. + \vspace{10mm} + \begin{center} + {\Large\bf Abstract} + \end{center} +% ? End of heading for abstract. +\end{latexonly} + +% HTML documentation header. +% ========================== +\begin{htmlonly} + \xlabel{} + \begin{rawhtml}

\end{rawhtml} + \stardoctitle\\ + \stardocversion\\ + \stardocmanual + \begin{rawhtml}

\end{rawhtml} + +% ? Add picture here if required. +% ? End of picture + + \begin{rawhtml}

\end{rawhtml} + \stardoccategory\ \stardocnumber \\ + \stardocauthors \\ + \stardocdate + \begin{rawhtml}

\end{rawhtml} + \htmladdnormallink{CCLRC}{http://www.cclrc.ac.uk} / + \htmladdnormallink{Rutherford Appleton Laboratory} + {http://www.cclrc.ac.uk} \\ + \htmladdnormallink{Particle Physics \& Astronomy Research Council} + {http://www.pparc.ac.uk} \\ + \begin{rawhtml}

\end{rawhtml} + \htmladdnormallink{Starlink Project}{http://www.starlink.ac.uk/} + \begin{rawhtml}

\end{rawhtml} + \htmladdnormallink{\htmladdimg{source.gif} Retrieve hardcopy} + {http://www.starlink.ac.uk/cgi-bin/hcserver?\stardocsource}\\ + +% HTML document table of contents. +% ================================ +% Add table of contents header and a navigation button to return to this +% point in the document (this should always go before the abstract \section). + \label{stardoccontents} + \begin{rawhtml} +
+

Contents

+ \end{rawhtml} + \htmladdtonavigation{\htmlref{\htmladdimg{contents_motif.gif}} + {stardoccontents}} + +% ? New section for abstract if used. + \section{\xlabel{abstract}Abstract} +% ? End of new section for abstract +\end{htmlonly} + +% ----------------------------------------------------------------------------- +% ? Document Abstract. (if used) +% ================== +SLALIB is a library used by writers of positional-astronomy applications. +Most of the \nroutines\ routines are concerned with astronomical position +and time, +but a number have wider trigonometrical, numerical or general applications. +% ? End of document abstract +% ----------------------------------------------------------------------------- +% ? Latex document Table of Contents (if used). +% =========================================== + \newpage + \begin{latexonly} + \setlength{\parskip}{0mm} + \tableofcontents + \setlength{\parskip}{\medskipamount} + \markright{\stardocname} + \end{latexonly} +% ? End of Latex document table of contents +% ----------------------------------------------------------------------------- +\newpage +\renewcommand{\thepage}{\arabic{page}} +\setcounter{page}{1} + +\section{INTRODUCTION} +\subsection{Purpose} +SLALIB\footnote{The name isn't an acronym; +it just stands for ``Subprogram Library~A''.} +is a library of routines +intended to make accurate and reliable positional-astronomy +applications easier to write. +Most SLALIB routines are concerned with astronomical position and time, but a +number have wider trigonometrical, numerical or general applications. +The applications ASTROM, COCO, RV and TPOINT +all make extensive use of the SLALIB +routines, as do a number of telescope control systems around the world. +The SLALIB versions currently in service are written in +Fortran~77 and run on VAX/VMS, several Unix platforms and PC. +A proprietary ANSI~C version is also available from the author; it is +functionally similar to the Fortran version upon which the present +document concentrates. + +\subsection{Example Application} +Here is a simple example of an application program written +using SLALIB calls: + +\begin{verbatim} + PROGRAM FK4FK5 + * + * Read a B1950 position from I/O unit 5 and reply on I/O unit 6 + * with the J2000 equivalent. Enter a period to quit. + * + IMPLICIT NONE + CHARACTER C*80,S + INTEGER I,J,IHMSF(4),IDMSF(4) + DOUBLE PRECISION R4,D4,R5,D5 + LOGICAL BAD + + * Loop until a period is entered + C = ' ' + DO WHILE (C(:1).NE.'.') + + * Read h m s d ' " + READ (5,'(A)') C + IF (C(:1).NE.'.') THEN + BAD = .TRUE. + + * Decode the RA + I = 1 + CALL sla_DAFIN(C,I,R4,J) + IF (J.EQ.0) THEN + R4 = 15D0*R4 + + * Decode the Dec + CALL sla_DAFIN(C,I,D4,J) + IF (J.EQ.0) THEN + + * FK4 to FK5 + CALL sla_FK45Z(R4,D4,1950D0,R5,D5) + + * Format and output the result + CALL sla_DR2TF(2,R5,S,IHMSF) + CALL sla_DR2AF(1,D5,S,IDMSF) + WRITE (6, + : '(1X,I2.2,2I3.2,''.'',I2.2,2X,A,I2.2,2I3.2,''.'',I1)') + : IHMSF,S,IDMSF + BAD = .FALSE. + END IF + END IF + IF (BAD) WRITE (6,'(1X,''?'')') + END IF + END DO + + END +\end{verbatim} +In this example, SLALIB not only provides the complicated FK4 to +FK5 transformation but also +simplifies the tedious and error-prone tasks +of decoding and formatting angles +expressed as hours, minutes {\it etc}. The +example incorporates range checking, and avoids the +notorious ``minus zero'' problem (an often-perpetrated bug where +declinations between $0^{\circ}$ and $-1^{\circ}$ lose their minus +sign). +With a little extra elaboration and a few more calls to SLALIB, +defaulting can be provided (enabling unused fields to +be replaced with commas to avoid retyping), proper motions +can be handled, different epochs can be specified, and +so on. See the program COCO (SUN/56) for further ideas. + +\subsection{Scope} +SLALIB contains \nroutines\ routines covering the following topics: +\begin{itemize} +\item String Decoding, + Sexagesimal Conversions +\item Angles, Vectors \& Rotation Matrices +\item Calendars, + Time Scales +\item Precession \& Nutation +\item Proper Motion +\item FK4/FK5/Hipparcos, + Elliptic Aberration +\item Geocentric Coordinates +\item Apparent \& Observed Place +\item Azimuth \& Elevation +\item Refraction \& Air Mass +\item Ecliptic, + Galactic, + Supergalactic Coordinates +\item Ephemerides +\item Astrometry +\item Numerical Methods +\end{itemize} + +\subsection{Objectives} +SLALIB was designed to give application programmers +a basic set of positional-astronomy tools which were +accurate and easy to use. To this end, the library is: +\begin{itemize} +\item Readily available, including source code and documentation. +\item Supported and maintained. +\item Portable -- coded in standard languages and available for +multiple computers and operating systems. +\item Thoroughly commented, both for maintainability and to +assist those wishing to cannibalize the code. +\item Stable. +\item Trustworthy -- some care has gone into +testing SLALIB, both by comparison with published data and +by checks for internal consistency. +\item Rigorous -- corners are not cut, +even where the practical consequences would, as a rule, be +negligible. +\item Comprehensive, without including too many esoteric features +required only by specialists. +\item Practical -- almost all the routines have been written to +satisfy real needs encountered during the development of +real-life applications. +\item Environment-independent -- the package is +completely free of pauses, stops, I/O {\it etc}. +\item Self-contained -- SLALIB calls no other libraries. +\end{itemize} +A few {\it caveats}: +\begin{itemize} +\item SLALIB does not pretend to be canonical. It is in essence +an anthology, and the adopted algorithms are liable +to change as more up-to-date ones become available. +\item The functions aren't orthogonal -- there are several +cases of different +routines doing similar things, and many examples where +sequences of SLALIB calls have simply been packaged, all to +make applications less trouble to write. +\item There are omissions -- for example there are no +routines for calculating physical ephemerides of +Solar-System bodies. +\item SLALIB is not homogeneous, though important subsets +(for example the FK4/FK5 routines) are. +\item The library is not foolproof. You have to know what +you are trying to do ({\it e.g.}\ by reading textbooks on positional +astronomy), and it is the caller's responsibility to supply +sensible arguments (although enough internal validation is done to +avoid arithmetic errors). +\item Without being written in a wasteful +manner, SLALIB is nonetheless optimized for maintainability +rather than speed. In addition, there are many places +where considerable simplification would be possible if some +specified amount of accuracy could be sacrificed; such +compromises are left to the individual programmer and +are not allowed to limit SLALIB's value as a source +of comparison results. +\end{itemize} + +\subsection{Fortran Version} +The Fortran versions of SLALIB use ANSI Fortran~77 with a few +commonplace extensions. Just three out of the \nroutines\ routines require +platform-specific techniques and accordingly are supplied +in different forms. +SLALIB has been implemented on the following platforms: +VAX/VMS, +PC (Microsoft Fortran, Linux), +DECstation (Ultrix), +DEC Alpha (DEC Unix), +Sun (SunOS, Solaris), +Hewlett Packard (HP-UX), +CONVEX, +Perkin-Elmer and +Fujitsu. + +\subsection{C Version} +An ANSI C version of SLALIB is available from the author +but is not part of the Starlink release. +The functionality of this (proprietary) C version closely matches +that of the Starlink Fortran SLALIB, partly for the convenience of +existing users of the Fortran version, some of whom have in the past +implemented C ``wrappers''. The function names +cannot be the same as the Fortran versions because of potential +linking problems when +both forms of the library are present; the C routine which +is the equivalent of (for example) {\tt SLA\_REFRO} is {\tt slaRefro}. +The types of arguments follow the Fortran version, except +that integers are {\tt int} rather than {\tt long} (the one +exception being +{\tt slaIntin}, which returns a {\tt long} +and is supplemented by an additional routine, +not present in the Fortran SLALIB, called {\tt slaInt2in}, which returns +an {\tt int}). +Argument passing is by value +(except for arrays and strings of course) +for given arguments and by pointer for returned arguments. +All the C functions are re-entrant. + +The Fortran routines {\tt sla\_GRESID}, {\tt sla\_RANDOM} and +{\tt sla\_WAIT} have no C counterparts. + +Further details of the C version of SLALIB are available +from the author. The definitive guide to +the calling sequences is the file {\tt slalib.h}. + +\subsection{Future Versions} +The homogeneity and ease of use of SLALIB could perhaps be improved +in the future by turning to object-oriented techniques, in particular +through the C++ and Java languages. For example ``celestial +position'' could be a class and many of the transformations +could happen automatically. This requires further study and +would result in a complete redesign. Various attempts have been +made to do this, but none as yet has the author's seal of +approval. Furthermore, +the impact of Fortran~90 has yet to be assessed. Should compilers +become widely available, some internal recoding may be worthwhile +in order to simplify parts of the code. However, as with C++, +a redesign of the +application interfaces will be needed if the capabilities of the +new language are to be exploited to the full. + +\subsection{New Functions} +In a package like SLALIB it is difficult to know how far to go. Is it +enough to provide the primitive operations, or should more +complicated functions be packaged? Is it worth encroaching on +specialist areas, where individual experts have all written their +own software already? To what extent should CPU efficiency be +an issue? How much support of different numerical precisions is +required? And so on. + +In practice, almost all the routines in SLALIB are there because they were +needed for some specific application, and this is likely to remain the +pattern for any enhancements in the future. +Suggestions for additional SLALIB routines should be addressed to the +author. + +\subsection{Acknowledgements} +SLALIB is descended from a package of routines written +for the AAO 16-bit minicomputers +in the mid-1970s. The coming of the VAX +allowed a much more comprehensive and thorough package +to be designed for Starlink, especially important +at a time when the adoption +of the IAU 1976 resolutions meant that astronomers +would have to cope with a mixture of reference frames, +time scales and nomenclature. + +Much of the preparatory work on SLALIB was done by +Althea~Wilkinson of Manchester University. +During its development, +Andrew~Murray, +Catherine~Hohenkerk, +Andrew~Sinclair, +Bernard~Yallop +and +Brian~Emerson of Her Majesty's Nautical Almanac Office were consulted +on many occasions; their advice was indispensable. +I am especially grateful to +Catherine~Hohenkerk +for supplying preprints of papers, and test data. A number of +enhancements to SLALIB were at the suggestion of +Russell~Owen, University of Washington, +the late Phil~Hill, St~Andrews University, +Bill~Vacca, JILA, Boulder and +Ron~Maddalena, NRAO. +Mark~Calabretta, CSIRO Radiophysics, Sydney supplied changes to suit Convex. +I am indebted to Derek~Jones (RGO) for introducing me to the +``universal variables'' method of calculating orbits. + +The first C version of SLALIB was a hand-coded transcription +of the Starlink Fortran version carried out by +Steve~Eaton (University of Leeds) in the course of +MSc work. This was later +enhanced by John~Straede (AAO) and Martin~Shepherd (Caltech). +The current C SLALIB is a complete rewrite by the present author and +includes a comprehensive validation suite. +Additional comments on the C version came from Bob~Payne (NRAO) and +Jeremy~Bailey (AAO). + +\section{LINKING} + +On Unix systems (Linux, Sun, DEC Alpha {\it etc.}): +\begin{verse} +{\tt \%~~f77 progname.o -L/star/lib `sla\_link` -o progname} +\end{verse} +(The above assumes that all Starlink directories have been added to +the {\tt LD\_LIBRARY\_PATH} and {\tt PATH} environment variables +as described in SUN/202.) + +\pagebreak + +\section{SUBPROGRAM SPECIFICATIONS} +%----------------------------------------------------------------------- +\routine{SLA\_ADDET}{Add E-terms of Aberration} +{ + \action{Add the E-terms (elliptic component of annual aberration) to a + pre IAU 1976 mean place to conform to the old catalogue convention.} + \call{CALL sla\_ADDET (RM, DM, EQ, RC, DC)} +} +\args{GIVEN} +{ + \spec{RM,DM}{D}{\radec\ without E-terms (radians)} \\ + \spec{EQ}{D}{Besselian epoch of mean equator and equinox} +} +\args{RETURNED} +{ + \spec{RC,DC}{D}{\radec\ with E-terms included (radians)} +} +\anote{Most star positions from pre-1984 optical catalogues (or + obtained by astrometry with respect to such stars) have the + E-terms built-in. If it is necessary to convert a formal mean + place (for example a pulsar timing position) to one + consistent with such a star catalogue, then the + \radec\ should be adjusted using this routine.} +\aref{{\it Explanatory Supplement to the Astronomical Ephemeris}, + section 2D, page 48.} +%----------------------------------------------------------------------- +\routine{SLA\_AFIN}{Sexagesimal character string to angle} +{ + \action{Decode a free-format sexagesimal string (degrees, arcminutes, + arcseconds) into a single precision floating point + number (radians).} + \call{CALL sla\_AFIN (STRING, NSTRT, RESLT, JF)} +} +\args{GIVEN} +{ + \spec{STRING}{C*(*)}{string containing deg, arcmin, arcsec fields} \\ + \spec{NSTRT}{I}{pointer to start of decode (beginning of STRING = 1)} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced past the decoded angle} \\ + \spec{RESLT}{R}{angle in radians} \\ + \spec{JF}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{0.7em} $+1$ = default, RESLT unchanged (note 2)} \\ + \spec{}{}{\hspace{0.7em} $-1$ = bad degrees (note 3)} \\ + \spec{}{}{\hspace{0.7em} $-2$ = bad arcminutes (note 3)} \\ + \spec{}{}{\hspace{0.7em} $-3$ = bad arcseconds (note 3)} \\ +} +\goodbreak +\setlength{\oldspacing}{\topsep} +\setlength{\topsep}{0.3ex} +\begin{description} + \exampleitem \\ [1.5ex] + \begin{tabular}{lll} + {\it argument} & {\it before} & {\it after} \\ \\ + STRING & $'$\verb*#-57 17 44.806 12 34 56.7#$'$ & unchanged \\ + NSTRT & 1 & 16 ({\it i.e.}\ pointing to 12...) \\ + RESLT & - & $-1.00000$ \\ + JF & - & 0 + \end{tabular} +\end{description} +A further call to sla\_AFIN, without adjustment of NSTRT, will +decode the second angle, \dms{12}{34}{56}{7}. +\setlength{\topsep}{\oldspacing} +\notes +{ + \begin{enumerate} + \item The first three ``fields'' in STRING are degrees, arcminutes, + arcseconds, separated by spaces or commas. The degrees field + may be signed, but not the others. The decoding is carried + out by the sla\_DFLTIN routine and is free-format. + \item Successive fields may be absent, defaulting to zero. For + zero status, the only combinations allowed are degrees alone, + degrees and arcminutes, and all three fields present. If all + three fields are omitted, a status of +1 is returned and RESLT is + unchanged. In all other cases RESLT is changed. + \item Range checking: + \begin{itemize} + \item The degrees field is not range checked. However, it is + expected to be integral unless the other two fields are absent. + \item The arcminutes field is expected to be 0-59, and integral if + the arcseconds field is present. If the arcseconds field + is absent, the arcminutes is expected to be 0-59.9999... + \item The arcseconds field is expected to be 0-59.9999... + \item Decoding continues even when a check has failed. Under these + circumstances the field takes the supplied value, defaulting to + zero, and the result RESLT is computed and returned. + \end{itemize} + \item Further fields after the three expected ones are not treated as + an error. The pointer NSTRT is left in the correct state for + further decoding with the present routine or with sla\_DFLTIN + {\it etc}. See the example, above. + \item If STRING contains hours, minutes, seconds instead of + degrees {\it etc}, + or if the required units are turns (or days) instead of radians, + the result RESLT should be multiplied as follows: \\ [1.5ex] + \begin{tabular}{lll} + {\it for STRING} & {\it to obtain} & {\it multiply RESLT by} \\ \\ + ${\circ}$~~\raisebox{-0.7ex}{$'$}~~\raisebox{-0.7ex}{$''$} + & radians & $1.0$ \\ + ${\circ}$~~\raisebox{-0.7ex}{$'$}~~\raisebox{-0.7ex}{$''$} + & turns & $1/{2 \pi} = 0.1591549430918953358$ \\ + h m s & radians & $15.0$ \\ + h m s & days & $15/{2\pi} = 2.3873241463784300365$ \\ + \end{tabular} + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AIRMAS}{Air Mass} +{ + \action{Air mass at given zenith distance (double precision).} + \call{D~=~sla\_AIRMAS (ZD)} +} +\args{GIVEN} +{ + \spec{ZD}{D}{observed zenith distance (radians)} +} +\args{RETURNED} +{ + \spec{sla\_AIRMAS}{D}{air mass (1 at zenith)} +} +\notes +{ + \begin{enumerate} + \item The {\it observed}\/ zenith distance referred to above means + ``as affected by refraction''. + \item The routine uses Hardie's (1962) polynomial fit to Bemporad's + data for the relative air mass, $X$, in units of thickness at the + zenith as tabulated by Schoenberg (1929). This is adequate for all + normal needs as it is accurate to better than + 0.1\% up to $X = 6.8$ and better than 1\% up to $X = 10$. + Bemporad's tabulated values are unlikely to be trustworthy + to such accuracy + because of variations in density, pressure and other + conditions in the atmosphere from those assumed in his work. + \item The sign of the ZD is ignored. + \item At zenith distances greater than about $\zeta = 87^{\circ}$ the + air mass is held constant to avoid arithmetic overflows. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Hardie, R.H., 1962, in {\it Astronomical Techniques}\, + ed. W.A.\ Hiltner, University of Chicago Press, p180. + \item Schoenberg, E., 1929, Hdb.\ d.\ Ap., + Berlin, Julius Springer, 2, 268. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_ALTAZ}{Velocities {\it etc.}\ for Altazimuth Mount} +{ + \action{Positions, velocities and accelerations for an altazimuth + telescope mount that is tracking a star (double precision).} + \call{CALL sla\_ALTAZ (\vtop{ + \hbox{HA, DEC, PHI,} + \hbox{AZ, AZD, AZDD, EL, ELD, ELDD, PA, PAD, PADD)}}} +} +\args{GIVEN} +{ + \spec{HA}{D}{hour angle} \\ + \spec{DEC}{D}{declination} \\ + \spec{PHI}{D}{observatory latitude} +} +\args{RETURNED} +{ + \spec{AZ}{D}{azimuth} \\ + \spec{AZD}{D}{azimuth velocity} \\ + \spec{AZDD}{D}{azimuth acceleration} \\ + \spec{EL}{D}{elevation} \\ + \spec{ELD}{D}{elevation velocity} \\ + \spec{ELDD}{D}{elevation acceleration} \\ + \spec{PA}{D}{parallactic angle} \\ + \spec{PAD}{D}{parallactic angle velocity} \\ + \spec{PADD}{D}{parallactic angle acceleration} +} +\notes +{ + \begin{enumerate} + \setlength{\parskip}{\medskipamount} + \item Natural units are used throughout. HA, DEC, PHI, AZ, EL + and ZD are in radians. The velocities and accelerations + assume constant declination and constant rate of change of + hour angle (as for tracking a star); the units of AZD, ELD + and PAD are radians per radian of HA, while the units of AZDD, + ELDD and PADD are radians per radian of HA squared. To + convert into practical degree- and second-based units: + + \begin{center} + \begin{tabular}{rlcl} + angles & $\times 360/2\pi$ & $\rightarrow$ & degrees \\ + velocities & $\times (2\pi/86400) \times (360/2\pi)$ + & $\rightarrow$ & degree/sec \\ + accelerations & $\times (2\pi/86400)^2 \times (360/2\pi)$ + & $\rightarrow$ & degree/sec/sec \\ + \end{tabular} + \end{center} + + Note that the seconds here are sidereal rather than SI. One + sidereal second is about 0.99727 SI seconds. + + The velocity and acceleration factors assume the sidereal + tracking case. Their respective numerical values are (exactly) + 1/240 and (approximately) 1/3300236.9. + \item Azimuth is returned in the range $[\,0,2\pi\,]$; north is zero, + and east is $+\pi/2$. Elevation and parallactic angle are + returned in the range $\pm\pi$. Position angle is +ve + for a star west of the meridian and is the angle NP--star--zenith. + \item The latitude is geodetic as opposed to geocentric. The + hour angle and declination are topocentric. Refraction and + deficiencies in the telescope mounting are ignored. The + purpose of the routine is to give the general form of the + quantities. The details of a real telescope could profoundly + change the results, especially close to the zenith. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and (for tracking a star) + sine and cosine of declination. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AMP}{Apparent to Mean} +{ + \action{Convert star \radec\ from geocentric apparent to + mean place (post IAU 1976).} + \call{CALL sla\_AMP (RA, DA, DATE, EQ, RM, DM)} +} +\args{GIVEN} +{ + \spec{RA,DA}{D}{apparent \radec\ (radians)} \\ + \spec{DATE}{D}{TDB for apparent place (JD$-$2400000.5)} \\ + \spec{EQ}{D}{equinox: Julian epoch of mean place} +} +\args{RETURNED} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item The distinction between the required TDB and TT is + always negligible. Moreover, for all but the most + critical applications UTC is adequate. + \item Iterative techniques are used for the aberration and + light deflection corrections so that the routines + sla\_AMP (or sla\_AMPQK) and sla\_MAP (or sla\_MAPQK) are + accurate inverses; even at the edge of the Sun's disc + the discrepancy is only about 1~nanoarcsecond. + \item Where multiple apparent places are to be converted to + mean places, for a fixed date and equinox, it is more + efficient to use the sla\_MAPPA routine to compute the + required parameters once, followed by one call to + sla\_AMPQK per star. + \item For EQ=2000D0, + the agreement with ICRS sub-mas, limited by the + precession-nutation model (IAU 1976 precession, Shirai \& + Fukushima 2001 forced nutation and precession corrections). + \item The accuracy is further limited by the routine sla\_EVP, called + by sla\_MAPPA, which computes the Earth position and + velocity using the methods of Stumpff. The maximum + error is about 0.3~milliarcsecond. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AMPQK}{Quick Apparent to Mean} +{ + \action{Convert star \radec\ from geocentric apparent to mean place + (post IAU 1976). Use of this routine is appropriate when + efficiency is important and where many star positions are + all to be transformed for one epoch and equinox. The + star-independent parameters can be obtained by calling + the sla\_MAPPA routine.} + \call{CALL sla\_AMPQK (RA, DA, AMPRMS, RM, DM)} +} +\args{GIVEN} +{ + \spec{RA,DA}{D}{apparent \radec\ (radians)} \\ + \spec{AMPRMS}{D(21)}{star-independent mean-to-apparent parameters:} \\ + \specel {(1)} {time interval for proper motion (Julian years)} \\ + \specel {(2-4)} {barycentric position of the Earth (AU)} \\ + \specel {(5-7)} {heliocentric direction of the Earth (unit vector)} \\ + \specel {(8)} {(gravitational radius of + Sun)$\times 2 / $(Sun-Earth distance)} \\ + \specel {(9-11)} {{\bf v}: barycentric Earth velocity in units of c} \\ + \specel {(12)} {$\sqrt{1-\left|\mbox{\bf v}\right|^2}$} \\ + \specel {(13-21)} {precession-nutation $3\times3$ matrix} +} +\args{RETURNED} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item Iterative techniques are used for the aberration and + light deflection corrections so that the routines + sla\_AMP (or sla\_AMPQK) and sla\_MAP (or sla\_MAPQK) are + accurate inverses; even at the edge of the Sun's disc + the discrepancy is only about 1~nanoarcsecond. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AOP}{Apparent to Observed} +{ + \action{Apparent to observed place, for sources distant from + the solar system.} + \call{CALL sla\_AOP (\vtop{ + \hbox{RAP, DAP, DATE, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, AOB, ZOB, HOB, DOB, ROB)}}} +} +\args{GIVEN} +{ + \spec{RAP,DAP}{D}{geocentric apparent \radec\ (radians)} \\ + \spec{DATE}{D}{UTC date/time (Modified Julian Date, JD$-$2400000.5)} \\ + \spec{DUT}{D}{$\Delta$UT: UT1$-$UTC (UTC seconds)} \\ + \spec{ELONGM}{D}{observer's mean longitude (radians, east +ve)} \\ + \spec{PHIM}{D}{observer's mean geodetic latitude (radians)} \\ + \spec{HM}{D}{observer's height above sea level (metres)} \\ + \spec{XP,YP}{D}{polar motion \xy\ coordinates (radians)} \\ + \spec{TDK}{D}{local ambient temperature (K; std=273.15D0)} \\ + \spec{PMB}{D}{local atmospheric pressure (mb; std=1013.25D0)} \\ + \spec{RH}{D}{local relative humidity (in the range 0D0\,--\,1D0)} \\ + \spec{WL}{D}{effective wavelength ($\mu{\rm m}$, {\it e.g.}\ 0.55D0)} \\ + \spec{TLR}{D}{tropospheric lapse rate (K per metre, + {\it e.g.}\ 0.0065D0)} +} +\args{RETURNED} +{ + \spec{AOB}{D}{observed azimuth (radians: N=0, E=$90^{\circ}$)} \\ + \spec{ZOB}{D}{observed zenith distance (radians)} \\ + \spec{HOB}{D}{observed Hour Angle (radians)} \\ + \spec{DOB}{D}{observed $\delta$ (radians)} \\ + \spec{ROB}{D}{observed $\alpha$ (radians)} +} +\notes +{ + \begin{enumerate} + \item This routine returns zenith distance rather than elevation + in order to reflect the fact that no allowance is made for + depression of the horizon. + \item The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted azimuth and elevation should be within about + \arcsec{0}{1} for $\zeta<70^{\circ}$. Even + at a topocentric zenith distance of + $90^{\circ}$, the accuracy in elevation should be better than + 1~arcminute; useful results are available for a further + $3^{\circ}$, beyond which the sla\_REFRO routine returns a + fixed value of the refraction. The complementary + routines sla\_AOP (or sla\_AOPQK) and sla\_OAP (or sla\_OAPQK) + are self-consistent to better than 1~microarcsecond all over + the celestial sphere. + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item {\it Apparent}\/ \radec\ means the geocentric apparent + right ascension + and declination, which is obtained from a catalogue mean place + by allowing for space motion, parallax, the Sun's gravitational + lens effect, annual aberration, and precession-nutation. For + star positions in the FK5 system ({\it i.e.}\ J2000), these + effects can + be applied by means of the sla\_MAP {\it etc.}\ routines. + Starting from + other mean place systems, additional transformations will be + needed; for example, FK4 ({\it i.e.}\ B1950) mean places would + first have to be converted to FK5, which can be done with the + sla\_FK425 {\it etc.}\ routines. + \item {\it Observed}\/ \azel\ means the position that would be seen by a + perfect theodolite located at the observer. This is obtained + from the geocentric apparent \radec\ by allowing for Earth + orientation and diurnal aberration, rotating from equator + to horizon coordinates, and then adjusting for refraction. + The \hadec\ is obtained by rotating back into equatorial + coordinates, using the geodetic latitude corrected for polar + motion, and is the position that would be seen by a perfect + equatorial located at the observer and with its polar axis + aligned to the Earth's axis of rotation ({\it n.b.}\ not to the + refracted pole). Finally, the $\alpha$ is obtained by subtracting + the {\it h}\/ from the local apparent ST. + \item To predict the required setting of a real telescope, the + observed place produced by this routine would have to be + adjusted for the tilt of the azimuth or polar axis of the + mounting (with appropriate corrections for mount flexures), + for non-perpendicularity between the mounting axes, for the + position of the rotator axis and the pointing axis relative + to it, for tube flexure, for gear and encoder errors, and + finally for encoder zero points. Some telescopes would, of + course, exhibit other properties which would need to be + accounted for at the appropriate point in the sequence. + \item This routine takes time to execute, due mainly to the + rigorous integration used to evaluate the refraction. + For processing multiple stars for one location and time, + call sla\_AOPPA once followed by one call per star to sla\_AOPQK. + Where a range of times within a limited period of a few hours + is involved, and the highest precision is not required, call + sla\_AOPPA once, followed by a call to sla\_AOPPAT each time the + time changes, followed by one call per star to sla\_AOPQK. + \item The DATE argument is UTC expressed as an MJD. This is, + strictly speaking, wrong, because of leap seconds. However, + as long as the $\Delta$UT and the UTC are consistent there + are no difficulties, except during a leap second. In this + case, the start of the 61st second of the final minute should + begin a new MJD day and the old pre-leap $\Delta$UT should + continue to be used. As the 61st second completes, the MJD + should revert to the start of the day as, simultaneously, + the $\Delta$UT changes by one second to its post-leap new value. + \item The $\Delta$UT (UT1$-$UTC) is tabulated in IERS circulars and + elsewhere. It increases by exactly one second at the end of + each UTC leap second, introduced in order to keep $\Delta$UT + within $\pm$\tsec{0}{9}. + \item IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. The + longitude required by the present routine is {\bf east-positive}, + in accordance with geographical convention (and right-handed). + In particular, note that the longitudes returned by the + sla\_OBS routine are west-positive (as in the {\it Astronomical + Almanac}\/ before 1984) and must be reversed in sign before use + in the present routine. + \item The polar coordinates XP,YP can be obtained from IERS + circulars and equivalent publications. The + maximum amplitude is about \arcsec{0}{3}. If XP,YP values + are unavailable, use XP=YP=0D0. See page B60 of the 1988 + {\it Astronomical Almanac}\/ for a definition of the two angles. + \item The height above sea level of the observing station, HM, + can be obtained from the {\it Astronomical Almanac}\/ (Section J + in the 1988 edition), or via the routine sla\_OBS. If P, + the pressure in millibars, is available, an adequate + estimate of HM can be obtained from the following expression: + \begin{quote} + {\tt HM=-29.3D0*TSL*LOG(P/1013.25D0)} + \end{quote} + where TSL is the approximate sea-level air temperature in K + (see {\it Astrophysical Quantities}, C.W.Allen, 3rd~edition, + \S 52). Similarly, if the pressure P is not known, + it can be estimated from the height of the observing + station, HM as follows: + \begin{quote} + {\tt P=1013.25D0*EXP(-HM/(29.3D0*TSL))} + \end{quote} + Note, however, that the refraction is nearly proportional to the + pressure and that an accurate P value is important for + precise work. + \item The azimuths {\it etc.}\ used by the present routine are with + respect to the celestial pole. Corrections to the terrestrial pole + can be computed using sla\_POLMO. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AOPPA}{Appt-to-Obs Parameters} +{ + \action{Pre-compute the set of apparent to observed place parameters + required by the ``quick'' routines sla\_AOPQK and sla\_OAPQK.} + \call{CALL sla\_AOPPA (\vtop{ + \hbox{DATE, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, AOPRMS)}}} +} +\args{GIVEN} +{ + \spec{DATE}{D}{UTC date/time (Modified Julian Date, JD$-$2400000.5)} \\ + \spec{DUT}{D}{$\Delta$UT: UT1$-$UTC (UTC seconds)} \\ + \spec{ELONGM}{D}{observer's mean longitude (radians, east +ve)} \\ + \spec{PHIM}{D}{observer's mean geodetic latitude (radians)} \\ + \spec{HM}{D}{observer's height above sea level (metres)} \\ + \spec{XP,YP}{D}{polar motion \xy\ coordinates (radians)} \\ + \spec{TDK}{D}{local ambient temperature (K; std=273.15D0)} \\ + \spec{PMB}{D}{local atmospheric pressure (mb; std=1013.25D0)} \\ + \spec{RH}{D}{local relative humidity (in the range 0D0\,--\,1D0)} \\ + \spec{WL}{D}{effective wavelength ($\mu{\rm m}$, {\it e.g.}\ 0.55D0)} \\ + \spec{TLR}{D}{tropospheric lapse rate (K per metre, + {\it e.g.}\ 0.0065D0)} +} +\args{RETURNED} +{ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel {(1)} {geodetic latitude (radians)} \\ + \specel {(2,3)} {sine and cosine of geodetic latitude} \\ + \specel {(4)} {magnitude of diurnal aberration vector} \\ + \specel {(5)} {height (HM)} \\ + \specel {(6)} {ambient temperature (TDK)} \\ + \specel {(7)} {pressure (PMB)} \\ + \specel {(8)} {relative humidity (RH)} \\ + \specel {(9)} {wavelength (WL)} \\ + \specel {(10)} {lapse rate (TLR)} \\ + \specel {(11,12)} {refraction constants A and B (radians)} \\ + \specel {(13)} {longitude + eqn of equinoxes + + ``sidereal $\Delta$UT'' (radians)} \\ + \specel {(14)} {local apparent sidereal time (radians)} +} +\notes +{ + \begin{enumerate} + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item The DATE argument is UTC expressed as an MJD. This is, + strictly speaking, wrong, because of leap seconds. However, + as long as the $\Delta$UT and the UTC are consistent there + are no difficulties, except during a leap second. In this + case, the start of the 61st second of the final minute should + begin a new MJD day and the old pre-leap $\Delta$UT should + continue to be used. As the 61st second completes, the MJD + should revert to the start of the day as, simultaneously, + the $\Delta$UT changes by one second to its post-leap new value. + \item The $\Delta$UT (UT1$-$UTC) is tabulated in IERS circulars and + elsewhere. It increases by exactly one second at the end of + each UTC leap second, introduced in order to keep $\Delta$UT + within $\pm$\tsec{0}{9}. The ``sidereal $\Delta$UT'' which forms + part of AOPRMS(13) is the same quantity, but converted from solar + to sidereal seconds and expressed in radians. + \item IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. The + longitude required by the present routine is {\bf east-positive}, + in accordance with geographical convention (and right-handed). + In particular, note that the longitudes returned by the + sla\_OBS routine are west-positive (as in the {\it Astronomical + Almanac}\/ before 1984) and must be reversed in sign before use in + the present routine. + \item The polar coordinates XP,YP can be obtained from IERS + circulars and equivalent publications. The + maximum amplitude is about \arcsec{0}{3}. If XP,YP values + are unavailable, use XP=YP=0D0. See page B60 of the 1988 + {\it Astronomical Almanac}\/ for a definition of the two angles. + \item The height above sea level of the observing station, HM, + can be obtained from the {\it Astronomical Almanac}\/ (Section J + in the 1988 edition), or via the routine sla\_OBS. If P, + the pressure in millibars, is available, an adequate + estimate of HM can be obtained from the following expression: + \begin{quote} + {\tt HM=-29.3D0*TSL*LOG(P/1013.25D0)} + \end{quote} + where TSL is the approximate sea-level air temperature in K + (see {\it Astrophysical Quantities}, C.W.Allen, 3rd~edition, + \S 52). Similarly, if the pressure P is not known, + it can be estimated from the height of the observing + station, HM as follows: + \begin{quote} + {\tt P=1013.25D0*EXP(-HM/(29.3D0*TSL))} + \end{quote} + Note, however, that the refraction is nearly proportional to the + pressure and that an accurate P value is important for + precise work. + \item Repeated, computationally-expensive, calls to sla\_AOPPA for + times that are very close together can be avoided by calling + sla\_AOPPA just once and then using sla\_AOPPAT for the subsequent + times. Fresh calls to sla\_AOPPA will be needed only when changes + in the precession have grown to unacceptable levels or when + anything affecting the refraction has changed. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AOPPAT}{Update Appt-to-Obs Parameters} +{ + \action{Recompute the sidereal time in the apparent to observed place + star-independent parameter block.} + \call{CALL sla\_AOPPAT (DATE, AOPRMS)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{UTC date/time (Modified Julian Date, JD$-$2400000.5)} \\ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel{(1-12)}{not required} \\ + \specel{(13)}{longitude + eqn of equinoxes + + ``sidereal $\Delta$UT'' (radians)} \\ + \specel{(14)}{not required} +} +\args{RETURNED} +{ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel{(1-13)}{not changed} \\ + \specel{(14)}{local apparent sidereal time (radians)} +} +\anote{For more information, see sla\_AOPPA.} +%----------------------------------------------------------------------- +\routine{SLA\_AOPQK}{Quick Appt-to-Observed} +{ + \action{Quick apparent to observed place (but see Note~8, below).} + \call{CALL sla\_AOPQK (RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB)} +} +\args{GIVEN} +{ + \spec{RAP,DAP}{D}{geocentric apparent \radec\ (radians)} \\ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel{(1)}{geodetic latitude (radians)} \\ + \specel{(2,3)}{sine and cosine of geodetic latitude} \\ + \specel{(4)}{magnitude of diurnal aberration vector} \\ + \specel{(5)}{height (metres)} \\ + \specel{(6)}{ambient temperature (K)} \\ + \specel{(7)}{pressure (mb)} \\ + \specel{(8)}{relative humidity (0\,--\,1)} \\ + \specel{(9)}{wavelength ($\mu{\rm m}$)} \\ + \specel{(10)}{lapse rate (K per metre)} \\ + \specel{(11,12)}{refraction constants A and B (radians)} \\ + \specel{(13)}{longitude + eqn of equinoxes + + ``sidereal $\Delta$UT'' (radians)} \\ + \specel{(14)}{local apparent sidereal time (radians)} +} +\args{RETURNED} +{ + \spec{AOB}{D}{observed azimuth (radians: N=0, E=$90^{\circ}$)} \\ + \spec{ZOB}{D}{observed zenith distance (radians)} \\ + \spec{HOB}{D}{observed Hour Angle (radians)} \\ + \spec{DOB}{D}{observed Declination (radians)} \\ + \spec{ROB}{D}{observed Right Ascension (radians)} +} +\notes +{ + \begin{enumerate} + \item This routine returns zenith distance rather than elevation + in order to reflect the fact that no allowance is made for + depression of the horizon. + \item The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted azimuth and elevation should be within about + \arcsec{0}{1} for $\zeta<70^{\circ}$. Even + at a topocentric zenith distance of + $90^{\circ}$, the accuracy in elevation should be better than + 1~arcminute; useful results are available for a further + $3^{\circ}$, beyond which the sla\_REFRO routine returns a + fixed value of the refraction. The complementary + routines sla\_AOP (or sla\_AOPQK) and sla\_OAP (or sla\_OAPQK) + are self-consistent to better than 1~microarcsecond all over + the celestial sphere. + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item {\it Apparent}\/ \radec\ means the geocentric apparent right ascension + and declination, which is obtained from a catalogue mean place + by allowing for space motion, parallax, the Sun's gravitational + lens effect, annual aberration and precession-nutation. For + star positions in the FK5 system ({\it i.e.}\ J2000), these effects can + be applied by means of the sla\_MAP {\it etc.}\ routines. Starting from + other mean place systems, additional transformations will be + needed; for example, FK4 ({\it i.e.}\ B1950) mean places would first + have to be converted to FK5, which can be done with the + sla\_FK425 {\it etc.}\ routines. + \item {\it Observed}\/ \azel\ means the position that would be seen by a + perfect theodolite located at the observer. This is obtained + from the geocentric apparent \radec\ by allowing for Earth + orientation and diurnal aberration, rotating from equator + to horizon coordinates, and then adjusting for refraction. + The \hadec\ is obtained by rotating back into equatorial + coordinates, using the geodetic latitude corrected for polar + motion, and is the position that would be seen by a perfect + equatorial located at the observer and with its polar axis + aligned to the Earth's axis of rotation ({\it n.b.}\ not to the + refracted pole). Finally, the $\alpha$ is obtained by subtracting + the {\it h}\/ from the local apparent ST. + \item To predict the required setting of a real telescope, the + observed place produced by this routine would have to be + adjusted for the tilt of the azimuth or polar axis of the + mounting (with appropriate corrections for mount flexures), + for non-perpendicularity between the mounting axes, for the + position of the rotator axis and the pointing axis relative + to it, for tube flexure, for gear and encoder errors, and + finally for encoder zero points. Some telescopes would, of + course, exhibit other properties which would need to be + accounted for at the appropriate point in the sequence. + \item The star-independent apparent-to-observed-place parameters + in AOPRMS may be computed by means of the sla\_AOPPA routine. + If nothing has changed significantly except the time, the + sla\_AOPPAT routine may be used to perform the requisite + partial recomputation of AOPRMS. + \item At zenith distances beyond about $76^\circ$, the need for + special care with the corrections for refraction causes a + marked increase in execution time. Moreover, the effect + gets worse with increasing zenith distance. Adroit + programming in the calling application may allow the + problem to be reduced. Prepare an alternative AOPRMS array, + computed for zero air-pressure; this will disable the + refraction corrections and cause rapid execution. Using + this AOPRMS array, a preliminary call to the present routine + will, depending on the application, produce a rough position + which may be enough to establish whether the full, slow + calculation (using the real AOPRMS array) is worthwhile. + For example, there would be no need for the full calculation + if the preliminary call had already established that the + source was well below the elevation limits for a particular + telescope. + \item The azimuths {\it etc.}\ used by the present routine are with + respect to the celestial pole. Corrections to the terrestrial pole + can be computed using sla\_POLMO. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_ATMDSP}{Atmospheric Dispersion} +{ + \action{Apply atmospheric-dispersion adjustments to refraction coefficients.} + \call{CALL sla\_ATMDSP (TDK, PMB, RH, WL1, A1, B1, WL2, A2, B2)} +} +\args{GIVEN} +{ + \spec{TDK}{D}{ambient temperature at the observer (K)} \\ + \spec{PMB}{D}{pressure at the observer (mb)} \\ + \spec{RH}{D}{relative humidity at the observer (range 0\,--\,1)} \\ + \spec{WL1}{D}{base wavelength ($\mu{\rm m}$)} \\ + \spec{A1}{D}{refraction coefficient A for wavelength WL1 (radians)} \\ + \spec{B1}{D}{refraction coefficient B for wavelength WL1 (radians)} \\ + \spec{WL2}{D}{wavelength for which adjusted A,B required ($\mu{\rm m}$)} +} +\args{RETURNED} +{ + \spec{A2}{D}{refraction coefficient A for wavelength WL2 (radians)} \\ + \spec{B2}{D}{refraction coefficient B for wavelength WL2 (radians)} +} +\notes +{ + \begin{enumerate} + \item To use this routine, first call sla\_REFCO specifying WL1 as the + wavelength. This yields refraction coefficients A1, B1, correct + for that wavelength. Subsequently, calls to sla\_ATMDSP specifying + different wavelengths will produce new, slightly adjusted + refraction coefficients A2, B2, which apply to the specified wavelength. + \item Most of the atmospheric dispersion happens between $0.7\,\mu{\rm m}$ + and the UV atmospheric cutoff, and the effect increases strongly + towards the UV end. For this reason a blue reference wavelength + is recommended, for example $0.4\,\mu{\rm m}$. + \item The accuracy, for this set of conditions: \\[1pc] + \hspace*{5ex} \begin{tabular}{rcl} + height above sea level & ~ & 2000\,m \\ + latitude & ~ & $29^\circ$ \\ + pressure & ~ & 793\,mb \\ + temperature & ~ & $290^\circ$\,K \\ + humidity & ~ & 0.5 (50\%) \\ + lapse rate & ~ & $0.0065^\circ m^{-1}$ \\ + reference wavelength & ~ & $0.4\,\mu{\rm m}$ \\ + star elevation & ~ & $15^\circ$ \\ + \end{tabular}\\[1pc] + is about 2.5\,mas RMS between 0.3 and $1.0\,\mu{\rm m}$, and stays + within 4\,mas for the whole range longward of $0.3\,\mu{\rm m}$ + (compared with a total dispersion from 0.3 to $20\,\mu{\rm m}$ + of about \arcseci{11}). These errors are typical for ordinary + conditions; in extreme conditions values a few times this size + may occur. + \item If either wavelength exceeds $100\,\mu{\rm m}$, the radio case + is assumed and the returned refraction coefficients are the + same as the given ones. Note that radio refraction coefficients + cannot be turned into optical values using this routine, nor + vice versa. + \item The algorithm consists of calculation of the refractivity of the + air at the observer for the two wavelengths, using the methods + of the sla\_REFRO routine, and then scaling of the two refraction + coefficients according to classical refraction theory. This + amounts to scaling the A coefficient in proportion to $(\mu-1)$ and + the B coefficient almost in the same ratio (see R.M.Green, + {\it Spherical Astronomy,}\/ Cambridge University Press, 1985). + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_AV2M}{Rotation Matrix from Axial Vector} +{ + \action{Form the rotation matrix corresponding to a given axial vector + (single precision).} + \call{CALL sla\_AV2M (AXVEC, RMAT)} +} +\args{GIVEN} +{ + \spec{AXVEC}{R(3)}{axial vector (radians)} +} +\args{RETURNED} +{ + \spec{RMAT}{R(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item A rotation matrix describes a rotation about some + arbitrary axis, called the Euler axis. The + {\it axial vector} supplied to this routine + has the same direction as the Euler axis, and its + magnitude is the amount of rotation in radians. + \item If AXVEC is null, the unit matrix is returned. + \item The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_BEAR}{Direction Between Points on a Sphere} +{ + \action{Returns the bearing (position angle) of one point on a + sphere seen from another (single precision).} + \call{R~=~sla\_BEAR (A1, B1, A2, B2)} +} +\args{GIVEN} +{ + \spec{A1,B1}{R}{spherical coordinates of one point} \\ + \spec{A2,B2}{R}{spherical coordinates of the other point} +} +\args{RETURNED} +{ + \spec{sla\_BEAR}{R}{bearing from first point to second} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are \radec, + $[\lambda,\phi]$ {\it etc.}, in radians. + \item The result is the bearing (position angle), in radians, + of point [A2,B2] as seen + from point [A1,B1]. It is in the range $\pm \pi$. The sense + is such that if [A2,B2] + is a small distance due east of [A1,B1] the result + is about $+\pi/2$. Zero is returned + if the two points are coincident. + \item If either B-coordinate is outside the range $\pm\pi/2$, the + result may correspond to ``the long way round''. + \item The routine sla\_PAV performs an equivalent function except + that the points are specified in the form of Cartesian unit + vectors. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CAF2R}{Deg,Arcmin,Arcsec to Radians} +{ + \action{Convert degrees, arcminutes, arcseconds to radians + (single precision).} + \call{CALL sla\_CAF2R (IDEG, IAMIN, ASEC, RAD, J)} +} +\args{GIVEN} +{ + \spec{IDEG}{I}{degrees} \\ + \spec{IAMIN}{I}{arcminutes} \\ + \spec{ASEC}{R}{arcseconds} +} +\args{RETURNED} +{ + \spec{RAD}{R}{angle in radians} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 1 = IDEG outside range 0$-$359} \\ + \spec{}{}{\hspace{1.5em} 2 = IAMIN outside range 0$-$59} \\ + \spec{}{}{\hspace{1.5em} 3 = ASEC outside range 0$-$59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CALDJ}{Calendar Date to MJD} +{ + \action{Gregorian Calendar to Modified Julian Date, with century default.} + \call{CALL sla\_CALDJ (IY, IM, ID, DJM, J)} +} +\args{GIVEN} +{ + \spec{IY,IM,ID}{I}{year, month, day in Gregorian calendar} +} +\args{RETURNED} +{ + \spec{DJM}{D}{modified Julian Date (JD$-$2400000.5) for $0^{\rm h}$} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = bad year (MJD not computed)} \\ + \spec{}{}{\hspace{1.5em} 2 = bad month (MJD not computed)} \\ + \spec{}{}{\hspace{1.5em} 3 = bad day (MJD computed)} \\ +} +\notes +{ + \begin{enumerate} + \item This routine supports the {\it century default}\/ feature. + Acceptable years are: + \begin{itemize} + \item 00-49, interpreted as 2000\,--\,2049, + \item 50-99, interpreted as 1950\,--\,1999, and + \item 100 upwards, interpreted literally. + \end{itemize} + For 1-100AD use the routine sla\_CLDJ instead. + \item For year $n$BC use IY = $-(n-1)$. + \item When an invalid year or month is supplied (status J~=~1~or~2) + the MJD is {\bf not} computed. When an invalid day is supplied + (status J~=~3) the MJD {\bf is} computed. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CALYD}{Calendar to Year, Day} +{ + \action{Gregorian calendar date to year and day in year, in a Julian + calendar aligned to the 20th/21st century Gregorian calendar, + with century default.} + \call{CALL sla\_CALYD (IY, IM, ID, NY, ND, J)} +} +\args{GIVEN} +{ + \spec{IY,IM,ID}{I}{year, month, day in Gregorian calendar: + year may optionally omit the century} +} +\args{RETURNED} +{ + \spec{NY}{I}{year (re-aligned Julian calendar)} \\ + \spec{ND}{I}{day in year (1 = January 1st)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = bad year (before $-4711$)} \\ + \spec{}{}{\hspace{1.5em} 2 = bad month} \\ + \spec{}{}{\hspace{1.5em} 3 = bad day} +} +\notes +{ + \begin{enumerate} + \item This routine supports the {\it century default}\/ feature. + Acceptable years are: + \begin{itemize} + \item 00-49, interpreted as 2000\,--\,2049, + \item 50-99, interpreted as 1950\,--\,1999, and + \item other years after $-4712$, interpreted literally. + \end{itemize} + Use sla\_CLYD for years before 100AD. + \item The purpose of sla\_CALDJ is to support + sla\_EARTH, sla\_MOON and sla\_ECOR. + \item Between 1900~March~1 and 2100~February~28 it returns answers + which are consistent with the ordinary Gregorian calendar. + Outside this range there will be a discrepancy which increases + by one day for every non-leap century year. + \item When an invalid year or month is supplied (status J~=~1 or J~=~2) + the results are {\bf not} computed. When a day is + supplied which is outside the conventional range (status J~=~3) + the results {\bf are} computed. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CC2S}{Cartesian to Spherical} +{ + \action{Cartesian coordinates to spherical coordinates (single precision).} + \call{CALL sla\_CC2S (V, A, B)} +} +\args{GIVEN} +{ + \spec{V}{R(3)}{\xyz\ vector} +} +\args{RETURNED} +{ + \spec{A,B}{R}{spherical coordinates in radians} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the {\it x}-axis + at zero longitude and latitude, and the {\it z}-axis at the + +ve latitude pole. + \item If V is null, zero A and B are returned. + \item At either pole, zero A is returned. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CC62S}{Cartesian 6-Vector to Spherical} +{ + \action{Conversion of position \& velocity in Cartesian coordinates + to spherical coordinates (single precision).} + \call{CALL sla\_CC62S (V, A, B, R, AD, BD, RD)} +} +\args{GIVEN} +{ + \spec{V}{R(6)}{\xyzxyzd} +} +\args{RETURNED} +{ + \spec{A}{R}{longitude (radians) -- for example $\alpha$} \\ + \spec{B}{R}{latitude (radians) -- for example $\delta$} \\ + \spec{R}{R}{radial coordinate} \\ + \spec{AD}{R}{longitude derivative (radians per unit time)} \\ + \spec{BD}{R}{latitude derivative (radians per unit time)} \\ + \spec{RD}{R}{radial derivative} +} +%----------------------------------------------------------------------- +\routine{SLA\_CD2TF}{Days to Hour,Min,Sec} +{ + \action{Convert an interval in days to hours, minutes, seconds + (single precision).} + \call{CALL sla\_CD2TF (NDP, DAYS, SIGN, IHMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of seconds} \\ + \spec{DAYS}{R}{interval in days} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IHMSF}{I(4)}{hours, minutes, seconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size of + DAYS, the format of REAL floating-point numbers on the target + machine, and the risk of overflowing IHMSF(4). On some + architectures, for DAYS up to 1.0, + the available floating-point + precision corresponds roughly to NDP=3. This is well + below the ultimate limit of NDP=9 set by the capacity of a + typical 32-bit IHMSF(4). + \item The absolute value of DAYS may exceed 1.0. In cases where it + does not, it is up to the caller to test for and handle the + case where DAYS is very nearly 1.0 and rounds up to 24~hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +\end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CLDJ}{Calendar to MJD} +{ + \action{Gregorian Calendar to Modified Julian Date.} + \call{CALL sla\_CLDJ (IY, IM, ID, DJM, J)} +} +\args{GIVEN} +{ + \spec{IY,IM,ID}{I}{year, month, day in Gregorian calendar} +} +\args{RETURNED} +{ + \spec{DJM}{D}{modified Julian Date (JD$-$2400000.5) for $0^{\rm h}$} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = bad year} \\ + \spec{}{}{\hspace{1.5em} 2 = bad month} \\ + \spec{}{}{\hspace{1.5em} 3 = bad day} +} +\notes +{ + \begin{enumerate} + \item When an invalid year or month is supplied (status J~=~1~or~2) + the MJD is {\bf not} computed. When an invalid day is supplied + (status J~=~3) the MJD {\bf is} computed. + \item The year must be $-$4699 ({\it i.e.}\ 4700BC) or later. + For year $n$BC use IY = $-(n-1)$. + \item An alternative to the present routine is sla\_CALDJ, which + accepts a year with the century missing. + \end{enumerate} +} +\aref{The algorithm is adapted from Hatcher, + {\it Q.\,Jl.\,R.\,astr.\,Soc.}\ (1984) {\bf 25}, 53-55.} +%----------------------------------------------------------------------- +\routine{SLA\_CLYD}{Calendar to Year, Day} +{ + \action{Gregorian calendar date to year and day in year, in a Julian + calendar aligned to the 20th/21st century Gregorian calendar.} + \call{CALL sla\_CLYD (IY, IM, ID, NY, ND, J)} +} +\args{GIVEN} +{ + \spec{IY,IM,ID}{I}{year, month, day in Gregorian calendar} +} +\args{RETURNED} +{ + \spec{NY}{I}{year (re-aligned Julian calendar)} \\ + \spec{ND}{I}{day in year (1 = January 1st)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = bad year (before $-4711$)} \\ + \spec{}{}{\hspace{1.5em} 2 = bad month} \\ + \spec{}{}{\hspace{1.5em} 3 = bad day} +} +\notes +{ + \begin{enumerate} + \item The purpose of sla\_CLYD is to support sla\_EARTH, + sla\_MOON and sla\_ECOR. + \item Between 1900~March~1 and 2100~February~28 it returns answers + which are consistent with the ordinary Gregorian calendar. + Outside this range there will be a discrepancy which increases + by one day for every non-leap century year. + \item When an invalid year or month is supplied (status J~=~1 or J~=~2) + the results are {\bf not} computed. When a day is + supplied which is outside the conventional range (status J~=~3) + the results {\bf are} computed. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_COMBN}{Next Combination} +{ + \action{Generate the next combination, a subset of a specified size chosen + from a specified number of items.} + \call{CALL sla\_COMBN (NSEL, NCAND, LIST, J)} +} +\args{GIVEN} +{ + \spec{NSEL}{I}{number of items (subset size)} \\ + \spec{NCAND}{I}{number of candidates (set size)} +} +\args{GIVEN and RETURNED} +{ + \spec{LIST}{I(NSEL)}{latest combination, LIST(1)=0 to initialize} +} +\args{RETURNED} +{ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal NSEL or NCAND} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $+$1 = no more combinations available} +} +\notes +{ + \begin{enumerate} + \item NSEL and NCAND must both be at least 1, and NSEL must be less + than or equal to NCAND. + \item This routine returns, in the LIST array, a subset of NSEL integers + chosen from the range 1 to NCAND inclusive, in ascending order. + Before calling the routine for the first time, the caller must set + the first element of the LIST array to zero (any value less than 1 + will do) to cause initialization. + \item The first combination to be generated is: + \begin{verse} + LIST(1)=1, LIST(2)=2, \ldots, LIST(NSEL)=NSEL + \end{verse} + This is also the combination returned for the ``finished'' (J=1) case. + The final permutation to be generated is: + \begin{verse} + LIST(1)=NCAND, LIST(2)=NCAND$-$1, \ldots, \\ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~LIST(NSEL)=NCAND$-$NSEL+1 + \end{verse} + \item If the ``finished'' (J=1) status is ignored, the routine + continues to deliver combinations, the pattern repeating + every NCAND!/(NSEL!(NCAND$-$NSEL)!) calls. + \item The algorithm is by R.\,F.\,Warren-Smith (private communication). + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CR2AF}{Radians to Deg,Arcmin,Arcsec} +{ + \action{Convert an angle in radians to degrees, arcminutes, + arcseconds (single precision).} + \call{CALL sla\_CR2AF (NDP, ANGLE, SIGN, IDMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of arcseconds} \\ + \spec{ANGLE}{R}{angle in radians} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IDMSF}{I(4)}{degrees, arcminutes, arcseconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size of + ANGLE, the format of REAL floating-point numbers on the target + machine, and the risk of overflowing IDMSF(4). On some + architectures, for ANGLE up to 2pi, + the available floating-point + precision corresponds roughly to NDP=3. This is well + below the ultimate limit of NDP=9 set by the capacity of a + typical 32-bit IDMSF(4). + \item The absolute value of ANGLE may exceed $2\pi$. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly $2\pi$ and rounds up to $360^{\circ}$, + by testing for IDMSF(1)=360 and setting IDMSF(1-4) to zero. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CR2TF}{Radians to Hour,Min,Sec} +{ + \action{Convert an angle in radians to hours, minutes, seconds + (single precision).} + \call{CALL sla\_CR2TF (NDP, ANGLE, SIGN, IHMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of seconds} \\ + \spec{ANGLE}{R}{angle in radians} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IHMSF}{I(4)}{hours, minutes, seconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size of + ANGLE, the format of REAL floating-point numbers on the target + machine, and the risk of overflowing IHMSF(4). On some + architectures, for ANGLE up to 2pi, + the available floating-point + precision corresponds roughly to NDP=3. This is well below + the ultimate limit of NDP=9 set by the capacity of a typical + 32-bit IHMSF(4). + \item The absolute value of ANGLE may exceed $2\pi$. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly $2\pi$ and rounds up to 24~hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +\end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CS2C}{Spherical to Cartesian} +{ + \action{Spherical coordinates to Cartesian coordinates (single precision).} + \call{CALL sla\_CS2C (A, B, V)} +} +\args{GIVEN} +{ + \spec{A,B}{R}{spherical coordinates in radians: \radec\ {\it etc.}} +} +\args{RETURNED} +{ + \spec{V}{R(3)}{\xyz\ unit vector} +} +\anote{The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the {\it x}-axis + at zero longitude and latitude, and the {\it z}-axis at the + +ve latitude pole.} +%----------------------------------------------------------------------- +\routine{SLA\_CS2C6}{Spherical Pos/Vel to Cartesian} +{ + \action{Conversion of position \& velocity in spherical coordinates + to Cartesian coordinates (single precision).} + \call{CALL sla\_CS2C6 (A, B, R, AD, BD, RD, V)} +} +\args{GIVEN} +{ + \spec{A}{R}{longitude (radians) -- for example $\alpha$} \\ + \spec{B}{R}{latitude (radians) -- for example $\delta$} \\ + \spec{R}{R}{radial coordinate} \\ + \spec{AD}{R}{longitude derivative (radians per unit time)} \\ + \spec{BD}{R}{latitude derivative (radians per unit time)} \\ + \spec{RD}{R}{radial derivative} +} +\args{RETURNED} +{ + \spec{V}{R(6)}{\xyzxyzd} +} +\anote{The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the {\it x}-axis + at zero longitude and latitude, and the {\it z}-axis at the + +ve latitude pole.} +%----------------------------------------------------------------------- +\routine{SLA\_CTF2D}{Hour,Min,Sec to Days} +{ + \action{Convert hours, minutes, seconds to days (single precision).} + \call{CALL sla\_CTF2D (IHOUR, IMIN, SEC, DAYS, J)} +} +\args{GIVEN} +{ + \spec{IHOUR}{I}{hours} \\ + \spec{IMIN}{I}{minutes} \\ + \spec{SEC}{R}{seconds} +} +\args{RETURNED} +{ + \spec{DAYS}{R}{interval in days} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = IHOUR outside range 0-23} \\ + \spec{}{}{\hspace{1.5em} 2 = IMIN outside range 0-59} \\ + \spec{}{}{\hspace{1.5em} 3 = SEC outside range 0-59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_CTF2R}{Hour,Min,Sec to Radians} +{ + \action{Convert hours, minutes, seconds to radians (single precision).} + \call{CALL sla\_CTF2R (IHOUR, IMIN, SEC, RAD, J)} +} +\args{GIVEN} +{ + \spec{IHOUR}{I}{hours} \\ + \spec{IMIN}{I}{minutes} \\ + \spec{SEC}{R}{seconds} +} +\args{RETURNED} +{ + \spec{RAD}{R}{angle in radians} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = IHOUR outside range 0-23} \\ + \spec{}{}{\hspace{1.5em} 2 = IMIN outside range 0-59} \\ + \spec{}{}{\hspace{1.5em} 3 = SEC outside range 0-59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DAF2R}{Deg,Arcmin,Arcsec to Radians} +{ + \action{Convert degrees, arcminutes, arcseconds to radians + (double precision).} + \call{CALL sla\_DAF2R (IDEG, IAMIN, ASEC, RAD, J)} +} +\args{GIVEN} +{ + \spec{IDEG}{I}{degrees} \\ + \spec{IAMIN}{I}{arcminutes} \\ + \spec{ASEC}{D}{arcseconds} +} +\args{RETURNED} +{ + \spec{RAD}{D}{angle in radians} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 1 = IDEG outside range 0$-$359} \\ + \spec{}{}{\hspace{1.5em} 2 = IAMIN outside range 0$-$59} \\ + \spec{}{}{\hspace{1.5em} 3 = ASEC outside range 0$-$59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DAFIN}{Sexagesimal character string to angle} +{ + \action{Decode a free-format sexagesimal string (degrees, arcminutes, + arcseconds) into a double precision floating point + number (radians).} + \call{CALL sla\_DAFIN (STRING, NSTRT, DRESLT, JF)} +} +\args{GIVEN} +{ + \spec{STRING}{C*(*)}{string containing deg, arcmin, arcsec fields} \\ + \spec{NSTRT}{I}{pointer to start of decode (beginning of STRING = 1)} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced past the decoded angle} \\ + \spec{DRESLT}{D}{angle in radians} \\ + \spec{JF}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{0.7em} $+1$ = default, DRESLT unchanged (note 2)} \\ + \spec{}{}{\hspace{0.7em} $-1$ = bad degrees (note 3)} \\ + \spec{}{}{\hspace{0.7em} $-2$ = bad arcminutes (note 3)} \\ + \spec{}{}{\hspace{0.7em} $-3$ = bad arcseconds (note 3)} \\ +} +\goodbreak +\setlength{\oldspacing}{\topsep} +\setlength{\topsep}{0.3ex} +\begin{description} + \item [EXAMPLE]: \\ [1.5ex] + \begin{tabular}{lll} + {\it argument} & {\it before} & {\it after} \\ \\ + STRING & $'$\verb*}-57 17 44.806 12 34 56.7}$'$ & unchanged \\ + NSTRT & 1 & 16 ({\it i.e.}\ pointing to 12...) \\ + RESLT & - & $-1.00000${\tt D0} \\ + JF & - & 0 + \end{tabular} + \item A further call to sla\_DAFIN, without adjustment of NSTRT, will + decode the second angle, \dms{12}{34}{56}{7}. +\end{description} +\setlength{\topsep}{\oldspacing} +\notes +{ + \begin{enumerate} + \item The first three ``fields'' in STRING are degrees, arcminutes, + arcseconds, separated by spaces or commas. The degrees field + may be signed, but not the others. The decoding is carried + out by the sla\_DFLTIN routine and is free-format. + \item Successive fields may be absent, defaulting to zero. For + zero status, the only combinations allowed are degrees alone, + degrees and arcminutes, and all three fields present. If all + three fields are omitted, a status of +1 is returned and DRESLT is + unchanged. In all other cases DRESLT is changed. + \item Range checking: + \begin{itemize} + \item The degrees field is not range checked. However, it is + expected to be integral unless the other two fields are absent. + \item The arcminutes field is expected to be 0-59, and integral if + the arcseconds field is present. If the arcseconds field + is absent, the arcminutes is expected to be 0-59.9999... + \item The arcseconds field is expected to be 0-59.9999... + \item Decoding continues even when a check has failed. Under these + circumstances the field takes the supplied value, defaulting to + zero, and the result DRESLT is computed and returned. + \end{itemize} + \item Further fields after the three expected ones are not treated as + an error. The pointer NSTRT is left in the correct state for + further decoding with the present routine or with sla\_DFLTIN + {\it etc}. See the example, above. + \item If STRING contains hours, minutes, seconds instead of + degrees {\it etc}, + or if the required units are turns (or days) instead of radians, + the result DRESLT should be multiplied as follows: \\ [1.5ex] + \begin{tabular}{lll} + {\it for STRING} & {\it to obtain} & {\it multiply DRESLT by} \\ \\ + ${\circ}$~~\raisebox{-0.7ex}{$'$}~~\raisebox{-0.7ex}{$''$} + & radians & $1.0D0$ \\ + ${\circ}$~~\raisebox{-0.7ex}{$'$}~~\raisebox{-0.7ex}{$''$} + & turns & $1/{2 \pi} = 0.1591549430918953358D0$ \\ + h m s & radians & $15.0D0$ \\ + h m s & days & $15/{2\pi} = 2.3873241463784300365D0$ + \end{tabular} + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_DAT}{TAI$-$UTC} +{ + \action{Increment to be applied to Coordinated Universal Time UTC to give + International Atomic Time TAI.} + \call{D~=~sla\_DAT (UTC)} +} +\args{GIVEN} +{ + \spec{UTC}{D}{UTC date as a modified JD (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_DAT}{D}{TAI$-$UTC in seconds} +} +\notes +{ + \begin{enumerate} + \item The UTC is specified to be a date rather than a time to indicate + that care needs to be taken not to specify an instant which lies + within a leap second. Though in most cases UTC can include the + fractional part, correct behaviour on the day of a leap second + can be guaranteed only up to the end of the second + $23^{\rm h}\,59^{\rm m}\,59^{\rm s}$. + \item For epochs from 1961 January 1 onwards, the expressions from the + file {\tt ftp://maia.usno.navy.mil/ser7/tai-utc.dat} are used. + A 5ms time step at 1961~January~1 is taken from 2.58.1 (p87) of + the 1992 Explanatory Supplement. + \item UTC began at 1960 January 1.0 (JD 2436934.5) and it is improper + to call the routine with an earlier epoch. However, if this + is attempted, the TAI$-$UTC expression for the year 1960 is used. + \item This routine has to be updated on each occasion that a + leap second is announced, and programs using it relinked. + Refer to the program source code for information on when the + most recent leap second was added. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DAV2M}{Rotation Matrix from Axial Vector} +{ + \action{Form the rotation matrix corresponding to a given axial vector + (double precision).} + \call{CALL sla\_DAV2M (AXVEC, RMAT)} +} +\args{GIVEN} +{ + \spec{AXVEC}{D(3)}{axial vector (radians)} +} +\args{RETURNED} +{ + \spec{RMAT}{D(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item A rotation matrix describes a rotation about some + arbitrary axis, called the Euler axis. The + {\it axial vector} supplied to this routine + has the same direction as the Euler axis, and its + magnitude is the amount of rotation in radians. + \item If AXVEC is null, the unit matrix is returned. + \item The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DBEAR}{Direction Between Points on a Sphere} +{ + \action{Returns the bearing (position angle) of one point on a + sphere relative to another (double precision).} + \call{D~=~sla\_DBEAR (A1, B1, A2, B2)} +} +\args{GIVEN} +{ + \spec{A1,B1}{D}{spherical coordinates of one point} \\ + \spec{A2,B2}{D}{spherical coordinates of the other point} +} +\args{RETURNED} +{ + \spec{sla\_DBEAR}{D}{bearing from first point to second} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are \radec, + $[\lambda,\phi]$ {\it etc.}, in radians. + \item The result is the bearing (position angle), in radians, + of point [A2,B2] as seen + from point [A1,B1]. It is in the range $\pm \pi$. The sense + is such that if [A2,B2] + is a small distance due east of [A1,B1] the result + is about $+\pi/2$. Zero is returned + if the two points are coincident. + \item If either B-coordinate is outside the range $\pm\pi/2$, the + result may correspond to ``the long way round''. + \item The routine sla\_DPAV performs an equivalent function except + that the points are specified in the form of Cartesian + vectors. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DBJIN}{Decode String to B/J Epoch (DP)} +{ + \action{Decode a character string into a DOUBLE PRECISION number, + with special provision for Besselian and Julian epochs. + The string syntax is as for sla\_DFLTIN, prefixed by + an optional `B' or `J'.} + \call{CALL sla\_DBJIN (STRING, NSTRT, DRESLT, J1, J2)} +} +\args{GIVEN} +{ + \spec{STRING}{C}{string containing field to be decoded} \\ + \spec{NSTRT}{I}{pointer to first character of field in string} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{incremented past the decoded field} \\ + \spec{DRESLT}{D}{result} \\ + \spec{J1}{I}{DFLTIN status:} \\ + \spec{}{}{\hspace{0.7em} $-$1 = $-$OK} \\ + \spec{}{}{\hspace{1.5em} 0 = +OK} \\ + \spec{}{}{\hspace{1.5em} 1 = null field} \\ + \spec{}{}{\hspace{1.5em} 2 = error} \\ + \spec{J2}{I}{syntax flag:} \\ + \spec{}{}{\hspace{1.5em} 0 = normal DFLTIN syntax} \\ + \spec{}{}{\hspace{1.5em} 1 = `B' or `b'} \\ + \spec{}{}{\hspace{1.5em} 2 = `J' or `j'} +} +\notes +{ + \begin{enumerate} + \item The purpose of the syntax extensions is to help cope with mixed + FK4 and FK5 data, allowing fields such as `B1950' or `J2000' + to be decoded. + \item In addition to the syntax accepted by sla\_DFLTIN, + the following two extensions are recognized by sla\_DBJIN: + \begin{enumerate} + \item A valid non-null field preceded by the character `B' + (or `b') is accepted. + \item A valid non-null field preceded by the character `J' + (or `j') is accepted. + \end{enumerate} + \item The calling program is told of the `B' or `J' through an + supplementary status argument. The rest of + the arguments are as for sla\_DFLTIN. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DC62S}{Cartesian 6-Vector to Spherical} +{ + \action{Conversion of position \& velocity in Cartesian coordinates + to spherical coordinates (double precision).} + \call{CALL sla\_DC62S (V, A, B, R, AD, BD, RD)} +} +\args{GIVEN} +{ + \spec{V}{D(6)}{\xyzxyzd} +} +\args{RETURNED} +{ + \spec{A}{D}{longitude (radians)} \\ + \spec{B}{D}{latitude (radians)} \\ + \spec{R}{D}{radial coordinate} \\ + \spec{AD}{D}{longitude derivative (radians per unit time)} \\ + \spec{BD}{D}{latitude derivative (radians per unit time)} \\ + \spec{RD}{D}{radial derivative} +} +%----------------------------------------------------------------------- +\routine{SLA\_DCC2S}{Cartesian to Spherical} +{ + \action{Cartesian coordinates to spherical coordinates (double precision).} + \call{CALL sla\_DCC2S (V, A, B)} +} +\args{GIVEN} +{ + \spec{V}{D(3)}{\xyz\ vector} +} +\args{RETURNED} +{ + \spec{A,B}{D}{spherical coordinates in radians} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the {\it x}-axis + at zero longitude and latitude, and the {\it z}-axis at the + +ve latitude pole. + \item If V is null, zero A and B are returned. + \item At either pole, zero A is returned. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DCMPF}{Interpret Linear Fit} +{ + \action{Decompose an \xy\ linear fit into its constituent parameters: + zero points, scales, nonperpendicularity and orientation.} + \call{CALL sla\_DCMPF (COEFFS,XZ,YZ,XS,YS,PERP,ORIENT)} +} +\args{GIVEN} +{ + \spec{COEFFS}{D(6)}{transformation coefficients (see note)} +} +\args{RETURNED} +{ + \spec{XZ}{D}{{\it x} zero point} \\ + \spec{YZ}{D}{{\it y} zero point} \\ + \spec{XS}{D}{{\it x} scale} \\ + \spec{YS}{D}{{\it y} scale} \\ + \spec{PERP}{D}{nonperpendicularity (radians)} \\ + \spec{ORIENT}{D}{orientation (radians)} +} +\notes +{ + \begin{enumerate} + \item The model relates two sets of \xy\ coordinates as follows. + Naming the six elements of COEFFS $a,b,c,d,e$ \& $f$, + the model transforms coordinates $[x_{1},y_{1}\,]$ into coordinates + $[x_{2},y_{2}\,]$ as follows: + \begin{verse} + $x_{2} = a + bx_{1} + cy_{1}$ \\ + $y_{2} = d + ex_{1} + fy_{1}$ + \end{verse} + The sla\_DCMPF routine decomposes this transformation + into four steps: + \begin{enumerate} + \item Zero points: + \begin{verse} + $x' = x_{1} + {\rm XZ}$ \\ + $y' = y_{1} + {\rm YZ}$ + \end{verse} + \item Scales: + \begin{verse} + $x'' = x' {\rm XS}$ \\ + $y'' = y' {\rm YS}$ + \end{verse} + \item Nonperpendicularity: + \begin{verse} + $x''' = + x'' \cos {\rm PERP}/2 + y'' \sin {\rm PERP}/2$ \\ + $y''' = + x'' \sin {\rm PERP}/2 + y'' \cos {\rm PERP}/2$ + \end{verse} + \item Orientation: + \begin{verse} + $x_{2} = + x''' \cos {\rm ORIENT} + + y''' \sin {\rm ORIENT}$ \\ + $y_{2} = - x''' \sin {\rm ORIENT} + + y''' \cos {\rm ORIENT}$ + \end{verse} + \end{enumerate} + \item See also sla\_FITXY, sla\_PXY, sla\_INVF, sla\_XY2XY. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DCS2C}{Spherical to Cartesian} +{ + \action{Spherical coordinates to Cartesian coordinates (double precision).} + \call{CALL sla\_DCS2C (A, B, V)} +} +\args{GIVEN} +{ + \spec{A,B}{D}{spherical coordinates in radians: \radec\ {\it etc.}} +} +\args{RETURNED} +{ + \spec{V}{D(3)}{\xyz\ unit vector} +} +\anote{The spherical coordinates are longitude (+ve anticlockwise + looking from the +ve latitude pole) and latitude. The + Cartesian coordinates are right handed, with the {\it x}-axis + at zero longitude and latitude, and the {\it z}-axis at the + +ve latitude pole.} +%----------------------------------------------------------------------- +\routine{SLA\_DD2TF}{Days to Hour,Min,Sec} +{ + \action{Convert an interval in days into hours, minutes, seconds + (double precision).} + \call{CALL sla\_DD2TF (NDP, DAYS, SIGN, IHMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of seconds} \\ + \spec{DAYS}{D}{interval in days} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IHMSF}{I(4)}{hours, minutes, seconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size + of DAYS, the format of DOUBLE PRECISION floating-point numbers + on the target machine, and the risk of overflowing IHMSF(4). + On some architectures, for DAYS up to 1D0, the available + floating-point precision corresponds roughly to NDP=12. + However, the practical limit is NDP=9, set by the capacity of + a typical 32-bit IHMSF(4). + \item The absolute value of DAYS may exceed 1D0. In cases where it + does not, it is up to the caller to test for and handle the + case where DAYS is very nearly 1D0 and rounds up to 24~hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. +\end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DE2H}{$h,\delta$ to Az,El} +{ + \action{Equatorial to horizon coordinates + (double precision).} + \call{CALL sla\_DE2H (HA, DEC, PHI, AZ, EL)} +} +\args{GIVEN} +{ + \spec{HA}{D}{hour angle (radians)} \\ + \spec{DEC}{D}{declination (radians)} \\ + \spec{PHI}{D}{latitude (radians)} +} +\args{RETURNED} +{ + \spec{AZ}{D}{azimuth (radians)} \\ + \spec{EL}{D}{elevation (radians)} +} +\notes +{ + \begin{enumerate} + \item Azimuth is returned in the range $0\!-\!2\pi$; north is zero, + and east is $+\pi/2$. Elevation is returned in the range + $\pm\pi$. + \item The latitude must be geodetic. In critical applications, + corrections for polar motion should be applied. + \item In some applications it will be important to specify the + correct type of hour angle and declination in order to + produce the required type of azimuth and elevation. In + particular, it may be important to distinguish between + elevation as affected by refraction, which would + require the {\it observed} \hadec, and the elevation + {\it in vacuo}, which would require the {\it topocentric} + \hadec. + If the effects of diurnal aberration can be neglected, the + {\it apparent} \hadec\ may be used instead of the topocentric + \hadec. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and (for tracking a star) + sine and cosine of declination. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DEULER}{Euler Angles to Rotation Matrix} +{ + \action{Form a rotation matrix from the Euler angles -- three + successive rotations about specified Cartesian axes + (double precision).} + \call{CALL sla\_DEULER (ORDER, PHI, THETA, PSI, RMAT)} +} +\args{GIVEN} +{ + \spec{ORDER}{C}{specifies about which axes the rotations occur} \\ + \spec{PHI}{D}{1st rotation (radians)} \\ + \spec{THETA}{D}{2nd rotation (radians)} \\ + \spec{PSI}{D}{3rd rotation (radians)} +} +\args{RETURNED} +{ + \spec{RMAT}{D(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item A rotation is positive when the reference frame rotates + anticlockwise as seen looking towards the origin from the + positive region of the specified axis. + \item The characters of ORDER define which axes the three successive + rotations are about. A typical value is `ZXZ', indicating that + RMAT is to become the direction cosine matrix corresponding to + rotations of the reference frame through PHI radians about the + old {\it z}-axis, followed by THETA radians about the resulting + {\it x}-axis, + then PSI radians about the resulting {\it z}-axis. + \item The axis names can be any of the following, in any order or + combination: X, Y, Z, uppercase or lowercase, 1, 2, 3. Normal + axis labelling/numbering conventions apply; the {\it xyz} ($\equiv123$) + triad is right-handed. Thus, the `ZXZ' example given above + could be written `zxz' or `313' (or even `ZxZ' or `3xZ'). ORDER + is terminated by length or by the first unrecognized character. + Fewer than three rotations are acceptable, in which case the later + angle arguments are ignored. Zero rotations produces + the identity RMAT. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DFLTIN}{Decode a Double Precision Number} +{ + \action{Convert free-format input into double precision floating point.} + \call{CALL sla\_DFLTIN (STRING, NSTRT, DRESLT, JFLAG)} +} +\args{GIVEN} +{ + \spec{STRING}{C}{string containing number to be decoded} \\ + \spec{NSTRT}{I}{pointer to where decoding is to commence} \\ + \spec{DRESLT}{D}{current value of result} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced to next number} \\ + \spec{DRESLT}{D}{result} \\ + \spec{JFLAG}{I}{status: $-$1~=~$-$OK, 0~=~+OK, 1~=~null result, 2~=~error} +} +\notes +{ + \begin{enumerate} + \item The reason sla\_DFLTIN has separate `OK' status values + for + and $-$ is to enable minus zero to be detected. + This is of crucial importance + when decoding mixed-radix numbers. For example, an angle + expressed as degrees, arcminutes and arcseconds may have a + leading minus sign but a zero degrees field. + \item A TAB is interpreted as a space, and lowercase characters are + interpreted as uppercase. {\it n.b.}\ The test for TAB is + ASCII-specific. + \item The basic format is the sequence of fields $\pm n.n x \pm n$, + where $\pm$ is a sign + character `+' or `$-$', $n$ means a string of decimal digits, + `.' is a decimal point, and $x$, which indicates an exponent, + means `D' or `E'. Various combinations of these fields can be + omitted, and embedded blanks are permissible in certain places. + \item Spaces: + \begin{itemize} + \item Leading spaces are ignored. + \item Embedded spaces are allowed only after +, $-$, D or E, + and after the decimal point if the first sequence of + digits is absent. + \item Trailing spaces are ignored; the first signifies + end of decoding and subsequent ones are skipped. + \end{itemize} + \item Delimiters: + \begin{itemize} + \item Any character other than +,$-$,0-9,.,D,E or space may be + used to signal the end of the number and terminate decoding. + \item Comma is recognized by sla\_DFLTIN as a special case; it + is skipped, leaving the pointer on the next character. See + 13, below. + \item Decoding will in all cases terminate if end of string + is reached. + \end{itemize} + \item Both signs are optional. The default is +. + \item The mantissa $n.n$ defaults to unity. + \item The exponent $x\!\pm\!n$ defaults to `D0'. + \item The strings of decimal digits may be of any length. + \item The decimal point is optional for whole numbers. + \item A {\it null result}\/ occurs when the string of characters + being decoded does not begin with +,$-$,0-9,.,D or E, or + consists entirely of spaces. When this condition is + detected, JFLAG is set to 1 and DRESLT is left untouched. + \item NSTRT = 1 for the first character in the string. + \item On return from sla\_DFLTIN, NSTRT is set ready for the next + decode -- following trailing blanks and any comma. If a + delimiter other than comma is being used, NSTRT must be + incremented before the next call to sla\_DFLTIN, otherwise + all subsequent calls will return a null result. + \item Errors (JFLAG=2) occur when: + \begin{itemize} + \item a +, $-$, D or E is left unsatisfied; or + \item the decimal point is present without at least + one decimal digit before or after it; or + \item an exponent more than 100 has been presented. + \end{itemize} + \item When an error has been detected, NSTRT is left + pointing to the character following the last + one used before the error came to light. This + may be after the point at which a more sophisticated + program could have detected the error. For example, + sla\_DFLTIN does not detect that `1D999' is unacceptable + (on a computer where this is so) until the entire number + has been decoded. + \item Certain highly unlikely combinations of mantissa and + exponent can cause arithmetic faults during the + decode, in some cases despite the fact that they + together could be construed as a valid number. + \item Decoding is left to right, one pass. + \item See also sla\_FLOTIN and sla\_INTIN. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DH2E}{Az,El to $h,\delta$} +{ + \action{Horizon to equatorial coordinates + (double precision).} + \call{CALL sla\_DH2E (AZ, EL, PHI, HA, DEC)} +} +\args{GIVEN} +{ + \spec{AZ}{D}{azimuth (radians)} \\ + \spec{EL}{D}{elevation (radians)} \\ + \spec{PHI}{D}{latitude (radians)} +} +\args{RETURNED} +{ + \spec{HA}{D}{hour angle (radians)} \\ + \spec{DEC}{D}{declination (radians)} +} +\notes +{ + \begin{enumerate} + \item The sign convention for azimuth is north zero, east $+\pi/2$. + \item HA is returned in the range $\pm\pi$. Declination is returned + in the range $\pm\pi/2$. + \item The latitude is (in principle) geodetic. In critical + applications, corrections for polar motion should be applied + (see sla\_POLMO). + \item In some applications it will be important to specify the + correct type of elevation in order to produce the required + type of \hadec. In particular, it may be important to + distinguish between the elevation as affected by refraction, + which will yield the {\it observed} \hadec, and the elevation + {\it in vacuo}, which will yield the {\it topocentric} + \hadec. If the + effects of diurnal aberration can be neglected, the + topocentric \hadec\ may be used as an approximation to the + {\it apparent} \hadec. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DIMXV}{Apply 3D Reverse Rotation} +{ + \action{Multiply a 3-vector by the inverse of a rotation + matrix (double precision).} + \call{CALL sla\_DIMXV (DM, VA, VB)} +} +\args{GIVEN} +{ + \spec{DM}{D(3,3)}{rotation matrix} \\ + \spec{VA}{D(3)}{vector to be rotated} +} +\args{RETURNED} +{ + \spec{VB}{D(3)}{result vector} +} +\notes +{ + \begin{enumerate} + \item This routine performs the operation: + \begin{verse} + {\bf b} = {\bf M}$^{T}\cdot${\bf a} + \end{verse} + where {\bf a} and {\bf b} are the 3-vectors VA and VB + respectively, and {\bf M} is the $3\times3$ matrix DM. + \item The main function of this routine is apply an inverse + rotation; under these circumstances, ${\bf M}$ is + {\it orthogonal}, with its inverse the same as its transpose. + \item To comply with the ANSI Fortran 77 standard, VA and VB must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly on the VAX and many other systems even + if this rule is violated, something that is {\bf not}, however, + recommended. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DJCAL}{MJD to Gregorian for Output} +{ + \action{Modified Julian Date to Gregorian Calendar Date, expressed + in a form convenient for formatting messages (namely + rounded to a specified precision, and with the fields + stored in a single array).} + \call{CALL sla\_DJCAL (NDP, DJM, IYMDF, J)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of days in fraction} \\ + \spec{DJM}{D}{modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{IYMDF}{I(4)}{year, month, day, fraction in Gregorian calendar} \\ + \spec{J}{I}{status: nonzero = out of range} +} +\notes +{ + \begin{enumerate} + \item Any date after 4701BC March 1 is accepted. + \item Large NDP values risk internal overflows. It is typically safe + to use up to NDP=4. + \end{enumerate} +} +\aref{The algorithm is adapted from Hatcher, + {\it Q.\,Jl.\,R.\,astr.\,Soc.}\ (1984) {\bf 25}, 53-55.} +%----------------------------------------------------------------------- +\routine{SLA\_DJCL}{MJD to Year,Month,Day,Frac} +{ + \action{Modified Julian Date to Gregorian year, month, day, + and fraction of a day.} + \call{CALL sla\_DJCL (DJM, IY, IM, ID, FD, J)} +} +\args{GIVEN} +{ + \spec{DJM}{D}{modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{IY}{I}{year} \\ + \spec{IM}{I}{month} \\ + \spec{ID}{I}{day} \\ + \spec{FD}{D}{fraction of day} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em}0~=~OK} \\ + \spec{}{}{\hspace{0.7em}$-$1~= unacceptable date} \\ + \spec{}{}{\hspace{0.7em}~~~~~~~~~~~~(before 4701\,BC~March~1)} +} +\aref{The algorithm is adapted from Hatcher, + {\it Q.\,Jl.\,R.\,astr.\,Soc.}\ (1984) {\bf 25}, 53-55.} +%----------------------------------------------------------------------- +\routine{SLA\_DM2AV}{Rotation Matrix to Axial Vector} +{ + \action{From a rotation matrix, determine the corresponding axial vector + (double precision).} + \call{CALL sla\_DM2AV (RMAT, AXVEC)} +} +\args{GIVEN} +{ + \spec{RMAT}{D(3,3)}{rotation matrix} +} +\args{RETURNED} +{ + \spec{AXVEC}{D(3)}{axial vector (radians)} +} +\notes +{ + \begin{enumerate} + \item A rotation matrix describes a rotation about some arbitrary axis, + called the Euler axis. The {\it axial vector} returned by + this routine has the same direction as the Euler axis, and its + magnitude is the amount of rotation in radians. + \item The magnitude and direction of the axial vector can be separated + by means of the routine sla\_DVN. + \item The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + \item If RMAT is null, so is the result. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DMAT}{Solve Simultaneous Equations} +{ + \action{Matrix inversion and solution of simultaneous equations + (double precision).} + \call{CALL sla\_DMAT (N, A, Y, D, JF, IW)} +} +\args{GIVEN} +{ + \spec{N}{I}{number of unknowns} \\ + \spec{A}{D(N,N)}{matrix} \\ + \spec{Y}{D(N)}{vector} +} +\args{RETURNED} +{ + \spec{A}{D(N,N)}{matrix inverse} \\ + \spec{Y}{D(N)}{solution} \\ + \spec{D}{D}{determinant} \\ + \spec{JF}{I}{singularity flag: 0=OK} \\ + \spec{IW}{I(N)}{workspace} +} +\notes +{ + \begin{enumerate} + \item For the set of $n$ simultaneous linear equations in $n$ unknowns: + \begin{verse} + {\bf A}$\cdot${\bf y} = {\bf x} + \end{verse} + where: + \begin{itemize} + \item {\bf A} is a non-singular $n \times n$ matrix, + \item {\bf y} is the vector of $n$ unknowns, and + \item {\bf x} is the known vector, + \end{itemize} + sla\_DMAT computes: + \begin{itemize} + \item the inverse of matrix {\bf A}, + \item the determinant of matrix {\bf A}, and + \item the vector of $n$ unknowns {\bf y}. + \end{itemize} + Argument N is the order $n$, A (given) is the matrix {\bf A}, + Y (given) is the vector {\bf x} and Y (returned) + is the vector {\bf y}. + The argument A (returned) is the inverse matrix {\bf A}$^{-1}$, + and D is {\it det}\/({\bf A}). + \item JF is the singularity flag. If the matrix is non-singular, + JF=0 is returned. If the matrix is singular, JF=$-$1 + and D=0D0 are returned. In the latter case, the contents + of array A on return are undefined. + \item The algorithm is Gaussian elimination with partial pivoting. + This method is very fast; some much slower algorithms can give + better accuracy, but only by a small factor. + \item This routine replaces the obsolete sla\_DMATRX. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DMOON}{Approx Moon Pos/Vel} +{ + \action{Approximate geocentric position and velocity of the Moon + (double precision).} + \call{CALL sla\_DMOON (DATE, PV)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (loosely ET) as a Modified Julian Date (JD$-$2400000.5) +} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{Moon \xyzxyzd, mean equator and equinox + of date (AU, AU~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item This routine is a full implementation of the algorithm + published by Meeus (see reference). + \item Meeus quotes accuracies of \arcseci{10} in longitude, + \arcseci{3} in latitude and \arcsec{0}{2} arcsec in HP + (equivalent to about 20~km in distance). Comparison with + JPL~DE200 over the interval 1960-2025 gives RMS errors of + \arcsec{3}{7} and 83~mas/hour in longitude, + \arcsec{2}{3} arcsec and 48~mas/hour in latitude, + 11~km and 81~mm/s in distance. + The maximum errors over the same interval are + \arcseci{18} and \arcsec{0}{50}/hour in longitude, + \arcseci{11} and \arcsec{0}{24}/hour in latitude, + 40~km and 0.29~m/s in distance. + \item The original algorithm is expressed in terms of the obsolete + time scale {\it Ephemeris Time}. Either TDB or TT can be used, + but not UT without incurring significant errors (\arcseci{30} at + the present time) due to the Moon's \arcsec{0}{5}/s movement. + \item The algorithm is based on pre IAU 1976 standards. However, + the result has been moved onto the new (FK5) equinox, an + adjustment which is in any case much smaller than the + intrinsic accuracy of the procedure. + \item Velocity is obtained by a complete analytical differentiation + of the Meeus model. + \end{enumerate} +} +\aref{Meeus, {\it l'Astronomie}, June 1984, p348.} +%----------------------------------------------------------------------- +\routine{SLA\_DMXM}{Multiply $3\times3$ Matrices} +{ + \action{Product of two $3\times3$ matrices (double precision).} + \call{CALL sla\_DMXM (A, B, C)} +} +\args{GIVEN} +{ + \spec{A}{D(3,3)}{matrix {\bf A}} \\ + \spec{B}{D(3,3)}{matrix {\bf B}} +} +\args{RETURNED} +{ + \spec{C}{D(3,3)}{matrix result: {\bf A}$\times${\bf B}} +} +\anote{To comply with the ANSI Fortran 77 standard, A, B and C must + be different arrays. However, the routine is coded so as to + work properly on many platforms even if this rule is violated, + something that is {\bf not}, however, recommended.} +%----------------------------------------------------------------------- +\routine{SLA\_DMXV}{Apply 3D Rotation} +{ + \action{Multiply a 3-vector by a rotation matrix (double precision).} + \call{CALL sla\_DMXV (DM, VA, VB)} +} +\args{GIVEN} +{ + \spec{DM}{D(3,3)}{rotation matrix} \\ + \spec{VA}{D(3)}{vector to be rotated} +} +\args{RETURNED} +{ + \spec{VB}{D(3)}{result vector} +} +\notes +{ + \begin{enumerate} + \item This routine performs the operation: + \begin{verse} + {\bf b} = {\bf M}$\cdot${\bf a} + \end{verse} + where {\bf a} and {\bf b} are the 3-vectors VA and VB + respectively, and {\bf M} is the $3\times3$ matrix DM. + \item The main function of this routine is apply a + rotation; under these circumstances, {\bf M} is a + {\it proper real orthogonal}\/ matrix. + \item To comply with the ANSI Fortran 77 standard, VA and VB must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly with many Fortran compilers even + if this rule is violated, something that is {\bf not}, however, + recommended. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DPAV}{Position-Angle Between Two Directions} +{ + \action{Returns the bearing (position angle) of one celestial + direction with respect to another (double precision).} + \call{D~=~sla\_DPAV (V1, V2)} +} +\args{GIVEN} +{ + \spec{V1}{D(3)}{vector to one point} \\ + \spec{V2}{D(3)}{vector to the other point} +} +\args{RETURNED} +{ + \spec{sla\_DPAV}{D}{position-angle of 2nd point with respect to 1st} +} +\notes +{ + \begin{enumerate} + \item The coordinate frames correspond to \radec, + $[\lambda,\phi]$ {\it etc.}. + \item The result is the bearing (position angle), in radians, + of point V2 as seen + from point V1. It is in the range $\pm \pi$. The sense + is such that if V2 + is a small distance due east of V1 the result + is about $+\pi/2$. Zero is returned + if the two points are coincident. + \item There is no requirement for either vector to be of unit length. + \item The routine sla\_DBEAR performs an equivalent function except + that the points are specified in the form of spherical coordinates. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_DR2AF}{Radians to Deg,Min,Sec,Frac} +{ + \action{Convert an angle in radians to degrees, arcminutes, arcseconds, + fraction (double precision).} + \call{CALL sla\_DR2AF (NDP, ANGLE, SIGN, IDMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of arcseconds} \\ + \spec{ANGLE}{D}{angle in radians} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IDMSF}{I(4)}{degrees, arcminutes, arcseconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size + of ANGLE, the format of DOUBLE PRECISION floating-point + numbers on the target machine, and the risk of overflowing + IDMSF(4). On some architectures, for ANGLE up to 2pi, the + available floating-point precision corresponds roughly to + NDP=12. However, the practical limit is NDP=9, set by the + capacity of a typical 32-bit IDMSF(4). + \item The absolute value of ANGLE may exceed $2\pi$. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly $2\pi$ and rounds up to $360^{\circ}$, + by testing for IDMSF(1)=360 and setting IDMSF(1-4) to zero. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DR2TF}{Radians to Hour,Min,Sec,Frac} +{ + \action{Convert an angle in radians to hours, minutes, seconds, + fraction (double precision).} + \call{CALL sla\_DR2TF (NDP, ANGLE, SIGN, IHMSF)} +} +\args{GIVEN} +{ + \spec{NDP}{I}{number of decimal places of seconds} \\ + \spec{ANGLE}{D}{angle in radians} +} +\args{RETURNED} +{ + \spec{SIGN}{C}{`+' or `$-$'} \\ + \spec{IHMSF}{I(4)}{hours, minutes, seconds, fraction} +} +\notes +{ + \begin{enumerate} + \item NDP less than zero is interpreted as zero. + \item The largest useful value for NDP is determined by the size + of ANGLE, the format of DOUBLE PRECISION floating-point + numbers on the target machine, and the risk of overflowing + IHMSF(4). On some architectures, for ANGLE up to 2pi, the + available floating-point precision corresponds roughly to + NDP=12. However, the practical limit is NDP=9, set by the + capacity of a typical 32-bit IHMSF(4). + \item The absolute value of ANGLE may exceed $2\pi$. In cases where it + does not, it is up to the caller to test for and handle the + case where ANGLE is very nearly $2\pi$ and rounds up to 24~hours, + by testing for IHMSF(1)=24 and setting IHMSF(1-4) to zero. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DRANGE}{Put Angle into Range $\pm\pi$} +{ + \action{Normalize an angle into the range $\pm\pi$ (double precision).} + \call{D~=~sla\_DRANGE (ANGLE)} +} +\args{GIVEN} +{ + \spec{ANGLE}{D}{angle in radians} +} +\args{RETURNED} +{ + \spec{sla\_DRANGE}{D}{ANGLE expressed in the range $\pm\pi$.} +} +%----------------------------------------------------------------------- +\routine{SLA\_DRANRM}{Put Angle into Range $0\!-\!2\pi$} +{ + \action{Normalize an angle into the range $0\!-\!2\pi$ + (double precision).} + \call{D~=~sla\_DRANRM (ANGLE)} +} +\args{GIVEN} +{ + \spec{ANGLE}{D}{angle in radians} +} +\args{RETURNED} +{ + \spec{sla\_DRANRM}{D}{ANGLE expressed in the range $0\!-\!2\pi$} +} +%----------------------------------------------------------------------- +\routine{SLA\_DS2C6}{Spherical Pos/Vel to Cartesian} +{ + \action{Conversion of position \& velocity in spherical coordinates + to Cartesian coordinates (double precision).} + \call{CALL sla\_DS2C6 (A, B, R, AD, BD, RD, V)} +} +\args{GIVEN} +{ + \spec{A}{D}{longitude (radians) -- for example $\alpha$} \\ + \spec{B}{D}{latitude (radians) -- for example $\delta$} \\ + \spec{R}{D}{radial coordinate} \\ + \spec{AD}{D}{longitude derivative (radians per unit time)} \\ + \spec{BD}{D}{latitude derivative (radians per unit time)} \\ + \spec{RD}{D}{radial derivative} +} +\args{RETURNED} +{ + \spec{V}{D(6)}{\xyzxyzd} +} +%----------------------------------------------------------------------- +\routine{SLA\_DS2TP}{Spherical to Tangent Plane} +{ + \action{Projection of spherical coordinates onto the tangent plane + (double precision).} + \call{CALL sla\_DS2TP (RA, DEC, RAZ, DECZ, XI, ETA, J)} +} +\args{GIVEN} +{ + \spec{RA,DEC}{D}{spherical coordinates of star (radians)} \\ + \spec{RAZ,DECZ}{D}{spherical coordinates of tangent point (radians)} +} +\args{RETURNED} +{ + \spec{XI,ETA}{D}{tangent plane coordinates (radians)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK, star on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 1 = error, star too far from axis} \\ + \spec{}{}{\hspace{1.5em} 2 = error, antistar on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 3 = error, antistar too far from axis} +} +\notes +{ + \begin{enumerate} + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_DV2TP is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DSEP}{Angle Between 2 Points on Sphere} +{ + \action{Angle between two points on a sphere (double precision).} + \call{D~=~sla\_DSEP (A1, B1, A2, B2)} +} +\args{GIVEN} +{ + \spec{A1,B1}{D}{spherical coordinates of one point (radians)} \\ + \spec{A2,B2}{D}{spherical coordinates of the other point (radians)} +} +\args{RETURNED} +{ + \spec{sla\_DSEP}{D}{angle between [A1,B1] and [A2,B2] in radians} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are right ascension and declination, + longitude and latitude, {\it etc.}, in radians. + \item The result is always positive. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DSEPV}{Angle Between 2 Vectors} +{ + \action{Angle between two vectors (double precision).} + \call{D~=~sla\_DSEPV (V1, V2)} +} +\args{GIVEN} +{ + \spec{V1}{D(3)}{first vector} \\ + \spec{V2}{D(3)}{second vector} +} +\args{RETURNED} +{ + \spec{sla\_DSEPV}{D}{angle between V1 and V2 in radians} +} +\notes +{ + \begin{enumerate} + \item There is no requirement for either vector to be of unit length. + \item If either vector is null, zero is returned. + \item The result is always positive. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DT}{Approximate ET minus UT} +{ + \action{Estimate $\Delta$T, the offset between dynamical time + and Universal Time, for a given historical epoch.} + \call{D~=~sla\_DT (EPOCH)} +} +\args{GIVEN} +{ + \spec{EPOCH}{D}{(Julian) epoch ({\it e.g.}\ 1850D0)} +} +\args{RETURNED} +{ + \spec{sla\_DT}{D}{approximate ET$-$UT (after 1984, TT$-$UT1) in seconds} +} +\notes +{ + \begin{enumerate} + \item Depending on the epoch, one of three parabolic approximations + is used: + +\begin{tabular}{lll} +& before AD 979 & Stephenson \& Morrison's 390 BC to AD 948 model \\ +& AD 979 to AD 1708 & Stephenson \& Morrison's AD 948 to AD 1600 model \\ +& after AD 1708 & McCarthy \& Babcock's post-1650 model +\end{tabular} + + The breakpoints are chosen to ensure continuity: they occur + at places where the adjacent models give the same answer as + each other. + \item The accuracy is modest, with errors of up to $20^{\rm s}$ during + the interval since 1650, rising to perhaps $30^{\rm m}$ + by 1000~BC. Comparatively accurate values from AD~1600 + are tabulated in + the {\it Astronomical Almanac}\/ (see section K8 of the 1995 + edition). + \item The use of {\tt DOUBLE PRECISION} for both argument and result is + simply for compatibility with other SLALIB time routines. + \item The models used are based on a lunar tidal acceleration value + of \arcsec{-26}{00} per century. + \end{enumerate} +} +\aref{Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7. + This contains references to the papers by Stephenson \& Morrison + and by McCarthy \& Babcock which describe the models used here.} +%----------------------------------------------------------------------- +\routine{SLA\_DTF2D}{Hour,Min,Sec to Days} +{ + \action{Convert hours, minutes, seconds to days (double precision).} + \call{CALL sla\_DTF2D (IHOUR, IMIN, SEC, DAYS, J)} +} +\args{GIVEN} +{ + \spec{IHOUR}{I}{hours} \\ + \spec{IMIN}{I}{minutes} \\ + \spec{SEC}{D}{seconds} +} +\args{RETURNED} +{ + \spec{DAYS}{D}{interval in days} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = IHOUR outside range 0-23} \\ + \spec{}{}{\hspace{1.5em} 2 = IMIN outside range 0-59} \\ + \spec{}{}{\hspace{1.5em} 3 = SEC outside range 0-59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTF2R}{Hour,Min,Sec to Radians} +{ + \action{Convert hours, minutes, seconds to radians (double precision).} + \call{CALL sla\_DTF2R (IHOUR, IMIN, SEC, RAD, J)} +} +\args{GIVEN} +{ + \spec{IHOUR}{I}{hours} \\ + \spec{IMIN}{I}{minutes} \\ + \spec{SEC}{D}{seconds} +} +\args{RETURNED} +{ + \spec{RAD}{D}{angle in radians} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} 1 = IHOUR outside range 0-23} \\ + \spec{}{}{\hspace{1.5em} 2 = IMIN outside range 0-59} \\ + \spec{}{}{\hspace{1.5em} 3 = SEC outside range 0-59.999$\cdots$} +} +\notes +{ + \begin{enumerate} + \item The result is computed even if any of the range checks fail. + \item The sign must be dealt with outside this routine. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTP2S}{Tangent Plane to Spherical} +{ + \action{Transform tangent plane coordinates into spherical + coordinates (double precision)} + \call{CALL sla\_DTP2S (XI, ETA, RAZ, DECZ, RA, DEC)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{D}{tangent plane rectangular coordinates (radians)} \\ + \spec{RAZ,DECZ}{D}{spherical coordinates of tangent point (radians)} +} +\args{RETURNED} +{ + \spec{RA,DEC}{D}{spherical coordinates (radians)} +} +\notes +{ + \begin{enumerate} + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_DTP2V is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTP2V}{Tangent Plane to Direction Cosines} +{ + \action{Given the tangent-plane coordinates of a star and the direction + cosines of the tangent point, determine the direction cosines + of the star + (double precision).} + \call{CALL sla\_DTP2V (XI, ETA, V0, V)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{D}{tangent plane coordinates of star (radians)} \\ + \spec{V0}{D(3)}{direction cosines of tangent point} +} +\args{RETURNED} +{ + \spec{V}{D(3)}{direction cosines of star} +} +\notes +{ + \begin{enumerate} + \item If vector V0 is not of unit length, the returned vector V will + be wrong. + \item If vector V0 points at a pole, the returned vector V will be + based on the arbitrary assumption that $\alpha=0$ at + the tangent point. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_DTP2S. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTPS2C}{Plate centre from $\xi,\eta$ and $\alpha,\delta$} +{ + \action{From the tangent plane coordinates of a star of known \radec, + determine the \radec\ of the tangent point (double precision)} + \call{CALL sla\_DTPS2C (XI, ETA, RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2, N)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{D}{tangent plane rectangular coordinates (radians)} \\ + \spec{RA,DEC}{D}{spherical coordinates (radians)} +} +\args{RETURNED} +{ + \spec{RAZ1,DECZ1}{D}{spherical coordinates of tangent point, + solution 1} \\ + \spec{RAZ2,DECZ2}{D}{spherical coordinates of tangent point, + solution 2} \\ + \spec{N}{I}{number of solutions:} \\ + \spec{}{}{\hspace{1em} 0 = no solutions returned (note 2)} \\ + \spec{}{}{\hspace{1em} 1 = only the first solution is useful (note 3)} \\ + \spec{}{}{\hspace{1em} 2 = there are two useful solutions (note 3)} +} +\notes +{ + \begin{enumerate} + \item The RAZ1 and RAZ2 values returned are in the range $0\!-\!2\pi$. + \item Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero $\xi$ value, and hence it is + meaningless to ask where the tangent point would have to be + to bring about this combination of $\xi$ and $\delta$. + \item Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. N\,=\,1 + indicates only one useful solution, the usual case; under + these circumstances, the second solution corresponds to the + ``over-the-pole'' case, and this is reflected in the values + of RAZ2 and DECZ2 which are returned. + \item The DECZ1 and DECZ2 values returned are in the range $\pm\pi$, + but in the ordinary, non-pole-crossing, case, the range is + $\pm\pi/2$. + \item RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2 are all in radians. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_DTPV2C is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTPV2C}{Plate centre from $\xi,\eta$ and $x,y,z$} +{ + \action{From the tangent plane coordinates of a star of known + direction cosines, determine the direction cosines + of the tangent point (double precision)} + \call{CALL sla\_DTPV2C (XI, ETA, V, V01, V02, N)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{D}{tangent plane coordinates of star (radians)} \\ + \spec{V}{D(3)}{direction cosines of star} +} +\args{RETURNED} +{ + \spec{V01}{D(3)}{direction cosines of tangent point, solution 1} \\ + \spec{V02}{D(3)}{direction cosines of tangent point, solution 2} \\ + \spec{N}{I}{number of solutions:} \\ + \spec{}{}{\hspace{1em} 0 = no solutions returned (note 2)} \\ + \spec{}{}{\hspace{1em} 1 = only the first solution is useful (note 3)} \\ + \spec{}{}{\hspace{1em} 2 = there are two useful solutions (note 3)} +} +\notes +{ + \begin{enumerate} + \item The vector V must be of unit length or the result will be wrong. + \item Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero XI value. + \item Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. + N\,=\,1 + indicates only one useful solution, the usual case; under these + circumstances, the second solution can be regarded as valid if + the vector V02 is interpreted as the ``over-the-pole'' case. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_DTPS2C. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DTT}{TT minus UTC} +{ + \action{Compute $\Delta$TT, the increment to be applied to + Coordinated Universal Time UTC to give + Terrestrial Time TT.} + \call{D~=~sla\_DTT (DJU)} +} +\args{GIVEN} +{ + \spec{DJU}{D}{UTC date as a modified JD (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_DTT}{D}{TT$-$UTC in seconds} +} +\notes +{ + \begin{enumerate} + \item The UTC is specified to be a date rather than a time to indicate + that care needs to be taken not to specify an instant which lies + within a leap second. Though in most cases UTC can include the + fractional part, correct behaviour on the day of a leap second + can be guaranteed only up to the end of the second + $23^{\rm h}\,59^{\rm m}\,59^{\rm s}$. + \item Pre 1972 January 1 a fixed value of 10 + ET$-$TAI is returned. + \item TT is one interpretation of the defunct time scale + {\it Ephemeris Time}, ET. + \item See also the routine sla\_DT, which roughly estimates ET$-$UT for + historical epochs. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DV2TP}{Direction Cosines to Tangent Plane} +{ + \action{Given the direction cosines of a star and of the tangent point, + determine the star's tangent-plane coordinates + (double precision).} + \call{CALL sla\_DV2TP (V, V0, XI, ETA, J)} +} +\args{GIVEN} +{ + \spec{V}{D(3)}{direction cosines of star} \\ + \spec{V0}{D(3)}{direction cosines of tangent point} +} +\args{RETURNED} +{ + \spec{XI,ETA}{D}{tangent plane coordinates (radians)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK, star on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 1 = error, star too far from axis} \\ + \spec{}{}{\hspace{1.5em} 2 = error, antistar on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 3 = error, antistar too far from axis} +} +\notes +{ + \begin{enumerate} + \item If vector V0 is not of unit length, or if vector V is of zero + length, the results will be wrong. + \item If V0 points at a pole, the returned $\xi,\eta$ + will be based on the + arbitrary assumption that $\alpha=0$ at the tangent point. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_DS2TP. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_DVDV}{Scalar Product} +{ + \action{Scalar product of two 3-vectors (double precision).} + \call{D~=~sla\_DVDV (VA, VB)} +} +\args{GIVEN} +{ + \spec{VA}{D(3)}{first vector} \\ + \spec{VB}{D(3)}{second vector} +} +\args{RETURNED} +{ + \spec{sla\_DVDV}{D}{scalar product VA.VB} +} +%----------------------------------------------------------------------- +\routine{SLA\_DVN}{Normalize Vector} +{ + \action{Normalize a 3-vector, also giving the modulus (double precision).} + \call{CALL sla\_DVN (V, UV, VM)} +} +\args{GIVEN} +{ + \spec{V}{D(3)}{vector} +} +\args{RETURNED} +{ + \spec{UV}{D(3)}{unit vector in direction of V} \\ + \spec{VM}{D}{modulus of V} +} +\anote{If the modulus of V is zero, UV is set to zero as well.} +%----------------------------------------------------------------------- +\routine{SLA\_DVXV}{Vector Product} +{ + \action{Vector product of two 3-vectors (double precision).} + \call{CALL sla\_DVXV (VA, VB, VC)} +} +\args{GIVEN} +{ + \spec{VA}{D(3)}{first vector} \\ + \spec{VB}{D(3)}{second vector} +} +\args{RETURNED} +{ + \spec{VC}{D(3)}{vector product VA$\times$VB} +} +%----------------------------------------------------------------------- +\routine{SLA\_E2H}{$h,\delta$ to Az,El} +{ + \action{Equatorial to horizon coordinates + (single precision).} + \call{CALL sla\_DE2H (HA, DEC, PHI, AZ, EL)} +} +\args{GIVEN} +{ + \spec{HA}{R}{hour angle (radians)} \\ + \spec{DEC}{R}{declination (radians)} \\ + \spec{PHI}{R}{latitude (radians)} +} +\args{RETURNED} +{ + \spec{AZ}{R}{azimuth (radians)} \\ + \spec{EL}{R}{elevation (radians)} +} +\notes +{ + \begin{enumerate} + \item Azimuth is returned in the range $0\!-\!2\pi$; north is zero, + and east is $+\pi/2$. Elevation is returned in the range + $\pm\pi$. + \item The latitude must be geodetic. In critical applications, + corrections for polar motion should be applied. + \item In some applications it will be important to specify the + correct type of hour angle and declination in order to + produce the required type of azimuth and elevation. In + particular, it may be important to distinguish between + elevation as affected by refraction, which would + require the {\it observed} \hadec, and the elevation + {\it in vacuo}, which would require the {\it topocentric} + \hadec. + If the effects of diurnal aberration can be neglected, the + {\it apparent} \hadec\ may be used instead of the topocentric + \hadec. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude, and (for tracking a star) + sine and cosine of declination. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EARTH}{Approx Earth Pos/Vel} +{ + \action{Approximate heliocentric position and velocity of the Earth + (single precision).} + \call{CALL sla\_EARTH (IY, ID, FD, PV)} +} +\args{GIVEN} +{ + \spec{IY}{I}{year} \\ + \spec{ID}{I}{day in year (1 = Jan 1st)} \\ + \spec{FD}{R}{fraction of day} +} +\args{RETURNED} +{ + \spec{PV}{R(6)}{Earth \xyzxyzd\ (AU, AU~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item The date and time is TDB (loosely ET) in a Julian calendar + which has been aligned to the ordinary Gregorian + calendar for the interval 1900~March~1 to 2100~February~28. + The year and day can be obtained by calling sla\_CALYD or + sla\_CLYD. + \item The Earth heliocentric 6-vector is referred to the + FK4 mean equator and equinox of date. + \item Maximum/RMS errors 1950-2050: + \begin{itemize} + \item 13/5~$\times10^{-5}$~AU = 19200/7600~km in position + \item 47/26~$\times10^{-10}$~AU~s$^{-1}$ = + 0.0070/0.0039~km~s$^{-1}$ in speed + \end{itemize} + \item More accurate results are obtainable with the routines sla\_EVP + and sla\_EPV. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_ECLEQ}{Ecliptic to Equatorial} +{ + \action{Transformation from ecliptic longitude and latitude to + J2000.0 \radec.} + \call{CALL sla\_ECLEQ (DL, DB, DATE, DR, DD)} +} +\args{GIVEN} +{ + \spec{DL,DB}{D}{ecliptic longitude and latitude + (mean of date, IAU 1980 theory, radians)} \\ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date + (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{DR,DD}{D}{J2000.0 mean \radec\ (radians)} +} +%----------------------------------------------------------------------- +\routine{SLA\_ECMAT}{Form $\alpha,\delta\rightarrow\lambda,\beta$ Matrix} +{ + \action{Form the equatorial to ecliptic rotation matrix (IAU 1980 theory).} + \call{CALL sla\_ECMAT (DATE, RMAT)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date + (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{RMAT}{D(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item RMAT is matrix {\bf M} in the expression + {\bf v}$_{ecl}$~=~{\bf M}$\cdot${\bf v}$_{equ}$. + \item The equator, equinox and ecliptic are mean of date. + \end{enumerate} +} +\aref{Murray, C.A., {\it Vectorial Astrometry}, section 4.3.} +%----------------------------------------------------------------------- +\routine{SLA\_ECOR}{RV \& Time Corrns to Sun} +{ + \action{Component of Earth orbit velocity and heliocentric + light time in a given direction.} + \call{CALL sla\_ECOR (RM, DM, IY, ID, FD, RV, TL)} +} +\args{GIVEN} +{ + \spec{RM,DM}{R}{mean \radec\ of date (radians)} \\ + \spec{IY}{I}{year} \\ + \spec{ID}{I}{day in year (1 = Jan 1st)} \\ + \spec{FD}{R}{fraction of day} +} +\args{RETURNED} +{ + \spec{RV}{R}{component of Earth orbital velocity (km~s$^{-1}$)} \\ + \spec{TL}{R}{component of heliocentric light time (s)} +} +\notes +{ + \begin{enumerate} + \item The date and time is TDB (loosely ET) in a Julian calendar + which has been aligned to the ordinary Gregorian + calendar for the interval 1900 March 1 to 2100 February 28. + The year and day can be obtained by calling sla\_CALYD or + sla\_CLYD. + \item Sign convention: + \begin{itemize} + \item The velocity component is +ve when the + Earth is receding from + the given point on the sky. + \item The light time component is +ve + when the Earth lies between the Sun and + the given point on the sky. + \end{itemize} + \item Accuracy: + \begin{itemize} + \item The velocity component is usually within 0.004~km~s$^{-1}$ + of the correct value and is never in error by more than + 0.007~km~s$^{-1}$. + \item The error in light time correction is about + \tsec{0}{03} at worst, + but is usually better than \tsec{0}{01}. + \end{itemize} + For applications requiring higher accuracy, see the sla\_EVP + and sla\_EPV routines. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EG50}{B1950 $\alpha,\delta$ to Galactic} +{ + \action{Transformation from B1950.0 FK4 equatorial coordinates to + IAU 1958 galactic coordinates.} + \call{CALL sla\_EG50 (DR, DD, DL, DB)} +} +\args{GIVEN} +{ + \spec{DR,DD}{D}{B1950.0 \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal\ (radians)} +} +\anote{The equatorial coordinates are B1950.0 FK4. Use the + routine sla\_EQGAL if conversion from J2000.0 FK5 coordinates + is required.} +\aref{Blaauw {\it et al.}, 1960, {\it Mon.Not.R.astr.Soc.}, + {\bf 121}, 123.} +%----------------------------------------------------------------------- +\routine{SLA\_EL2UE}{Conventional to Universal Elements} +{ + \action{Transform conventional osculating orbital elements + into ``universal'' form.} + \call{CALL sla\_EL2UE (\vtop{ + \hbox{DATE, JFORM, EPOCH, ORBINC, ANODE,} + \hbox{PERIH, AORQ, E, AORL, DM,} + \hbox{U, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{DATE}{D}{epoch (TT MJD) of osculation (Note~3)} \\ + \spec{JFORM}{I}{choice of element set (1-3; Note~6)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude + ($M$ or $L$, radians,} \\ + \spec{}{}{\hspace{1.5em} JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} +} +\args{RETURNED} +{ + \spec{U}{D(13)}{universal orbital elements (Note~1)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v}_0$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, + approx} \\ \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = illegal JFORM} \\ + \spec{}{}{\hspace{1.2em} $-$2 = illegal E} \\ + \spec{}{}{\hspace{1.2em} $-$3 = illegal AORQ} \\ + \spec{}{}{\hspace{1.2em} $-$4 = illegal DM} \\ + \spec{}{}{\hspace{1.2em} $-$5 = numerical error} +} +\notes +{ + \begin{enumerate} + \item The ``universal'' elements are those which define the orbit for + the purposes of the method of universal variables (see reference). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \item The companion routine is sla\_UE2PV. This takes the set of numbers + that the present routine outputs and uses them to derive the + object's position and velocity. A single prediction requires one + call to the present routine followed by one call to sla\_UE2PV; + for convenience, the two calls are packaged as the routine + sla\_PLANEL. Multiple predictions may be made by again calling the + present routine once, but then calling sla\_UE2PV multiple times, + which is faster than multiple calls to sla\_PLANEL. + \item DATE is the epoch of osculation. It is in the TT time scale + (formerly Ephemeris Time, ET) and is a Modified Julian Date + (JD$-$2400000.5). + \item The supplied orbital elements are with respect to the J2000 + ecliptic and equinox. The position and velocity parameters + returned in the array U are with respect to the mean equator and + equinox of epoch J2000, and are for the perihelion prior to the + specified epoch. + \item The universal elements returned in the array U are in canonical + units (solar masses, AU and canonical days). + \item Three different element-format options are supported, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & longitude of perihelion $\varpi$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e < 1 )$ \\ + & AORL & = & mean longitude $L$ (radians) \\ + & DM & = & daily motion $n$ (radians) + \end{tabular} + + JFORM=2, suitable for minor planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e < 1 )$ \\ + & AORL & = & mean anomaly $M$ (radians) + \end{tabular} + + JFORM=3, suitable for comets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of perihelion $T$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & perihelion distance $q$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e \leq 10 )$ + \end{tabular} + + \item Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are + not accessed. + \item The algorithm was originally adapted from the EPHSLA program of + D.\,H.\,P.\,Jones (private communication, 1996). The method + is based on Stumpff's Universal Variables. + \end{enumerate} +} +\aref{Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983.} +%------------------------------------------------------------------------------ +\routine{SLA\_EPB}{MJD to Besselian Epoch} +{ + \action{Conversion of Modified Julian Date to Besselian Epoch.} + \call{D~=~sla\_EPB (DATE)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{Modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_EPB}{D}{Besselian Epoch} +} +\aref{Lieske, J.H., 1979, {\it Astr.Astrophys.}\ {\bf 73}, 282.} +%----------------------------------------------------------------------- +\routine{SLA\_EPB2D}{Besselian Epoch to MJD} +{ + \action{Conversion of Besselian Epoch to Modified Julian Date.} + \call{D~=~sla\_EPB2D (EPB)} +} +\args{GIVEN} +{ + \spec{EPB}{D}{Besselian Epoch} +} +\args{RETURNED} +{ + \spec{sla\_EPB2D}{D}{Modified Julian Date (JD$-$2400000.5)} +} +\aref{Lieske, J.H., 1979. {\it Astr.Astrophys.}\ {\bf 73}, 282.} +%----------------------------------------------------------------------- +\routine{SLA\_EPCO}{Convert Epoch to B or J} +{ + \action{Convert an epoch to Besselian or Julian to match another one.} + \call{D~=~sla\_EPCO (K0, K, E)} + +} +\args{GIVEN} +{ + \spec{K0}{C}{form of result: `B'=Besselian, `J'=Julian} \\ + \spec{K}{C}{form of given epoch: `B' or `J'} \\ + \spec{E}{D}{epoch} +} +\args{RETURNED} +{ + \spec{sla\_EPCO}{D}{the given epoch converted as necessary} +} +\notes +{ + \begin{enumerate} + \item The result is always either equal to or very close to + the given epoch E. The routine is required only in + applications where punctilious treatment of heterogeneous + mixtures of star positions is necessary. + \item K0 and K are not validated. They are interpreted as follows: + \begin{itemize} + \item If K0 and K are the same, the result is E. + \item If K0 is `B' and K isn't, the conversion is J to B. + \item In all other cases, the conversion is B to J. + \end{itemize} + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EPJ}{MJD to Julian Epoch} +{ + \action{Convert Modified Julian Date to Julian Epoch.} + \call{D~=~sla\_EPJ (DATE)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{Modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_EPJ}{D}{Julian Epoch} +} +\aref{Lieske, J.H., 1979.\ {\it Astr.Astrophys.}, {\bf 73}, 282.} +%----------------------------------------------------------------------- +\routine{SLA\_EPJ2D}{Julian Epoch to MJD} +{ + \action{Convert Julian Epoch to Modified Julian Date.} + \call{D~=~sla\_EPJ2D (EPJ)} +} +\args{GIVEN} +{ + \spec{EPJ}{D}{Julian Epoch} +} +\args{RETURNED} +{ + \spec{sla\_EPJ2D}{D}{Modified Julian Date (JD$-$2400000.5)} +} +\aref{Lieske, J.H., 1979.\ {\it Astr.Astrophys.}, {\bf 73}, 282.} +%----------------------------------------------------------------------- +\routine{SLA\_EPV}{Earth Position \& Velocity (high accuracy)} +{ + \action{Earth position and velocity, heliocentric and barycentric, + with respect to the Barycentric Celestial Reference System.} + \call{CALL sla\_EPV (DATE, PH, VH, PB, VB)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB Modified Julian Date (Note~1)} +} +\args{RETURNED} +{ + \spec{PH}{D(3)}{heliocentric \xyz, AU} \\ + \spec{VH}{D(3)}{heliocentric \xyzd, AU~d$^{-1}$} \\ + \spec{PB}{D(3)}{barycentric \xyz, AU} \\ + \spec{VB}{D(3)}{barycentric \xyzd, AU~d$^{-1}$} +} +\notes +{ + \begin{enumerate} + \item The date is TDB as MJD (=JD$-$2400000.5). TT can be used + instead of TDB in most applications. + \item The vectors are with respect to the Barycentric Celestial + Reference System (BCRS). Positions are in AU; velocities are in + AU per TDB day. + \item The routine is a {\it simplified solution}\/ from the planetary + theory VSOP2000 (X.\,Moisson, P.\,Bretagnon, 2001, Celes. Mechanics + \& Dyn. Astron., {\bf 80}, 3/4, 205-213) and is an adaptation of + original Fortran code supplied by P.\,Bretagnon (private + communication, 2000). + \item Comparisons over the time span 1900-2100 with this simplified + solution and the JPL DE405 ephemeris give the following results: + + \begin{tabular}{lllll} + & & RMS & max \\ + & Heliocentric: \\ + & ~~~~~position error & 3.7 & 11.2 & km \\ + & ~~~~~velocity error & 1.4 & ~5.0 & mm/s \\ + & Barycentric: \\ + & ~~~~~position error & 4.6 & 13.4 & km \\ + & ~~~~~velocity error & 1.4 & ~4.9 & mm/s + \end{tabular} + + The results deteriorate outside this time span. + \item The routine sla\_EVP is faster but less accurate. + The present routine targets the case where high + accuracy is more important + than CPU time, yet the extra complication of reading a + pre-computed ephemeris is not justified. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EQECL}{J2000 $\alpha,\delta$ to Ecliptic} +{ + \action{Transformation from J2000.0 equatorial coordinates to + ecliptic longitude and latitude.} + \call{CALL sla\_EQECL (DR, DD, DATE, DL, DB)} +} +\args{GIVEN} +{ + \spec{DR,DD}{D}{J2000.0 mean \radec\ (radians)} \\ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{DL,DB}{D}{ecliptic longitude and latitude + (mean of date, IAU 1980 theory, radians)} +} +%----------------------------------------------------------------------- +\routine{SLA\_EQEQX}{Equation of the Equinoxes} +{ + \action{Equation of the equinoxes (IAU 1994).} + \call{D~=~sla\_EQEQX (DATE)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_EQEQX}{D}{The equation of the equinoxes (radians)} +} +\notes{ + \begin{enumerate} + \item The equation of the equinoxes is defined here as GAST~$-$~GMST: + it is added to a {\it mean}\/ sidereal time to give the + {\it apparent}\/ sidereal time. + \item The change from the classic ``textbook'' expression + $\Delta\psi\,cos\,\epsilon$ occurred with IAU Resolution C7, + Recommendation~3 (1994). The new formulation takes into + account cross-terms between the various precession and + nutation quantities, amounting to about 3~milliarcsec. + The transition from the old to the new model officially + took place on 1997 February~27. + \end{enumerate} +} +\aref{Capitaine, N.\ \& Gontier, A.-M.\ (1993), + {\it Astron. Astrophys.}, + {\bf 275}, 645-650.} +%----------------------------------------------------------------------- +\routine{SLA\_EQGAL}{J2000 $\alpha,\delta$ to Galactic} +{ + \action{Transformation from J2000.0 FK5 equatorial coordinates to + IAU 1958 galactic coordinates.} + \call{CALL sla\_EQGAL (DR, DD, DL, DB)} +} +\args{GIVEN} +{ + \spec{DR,DD}{D}{J2000.0 \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal\ (radians)} +} +\anote{The equatorial coordinates are J2000.0 FK5. Use the routine + sla\_EG50 if conversion from B1950.0 FK4 coordinates is required.} +\aref{Blaauw {\it et al.}, 1960, {\it Mon.Not.R.astr.Soc.}, + {\bf 121}, 123.} +%----------------------------------------------------------------------- +\routine{SLA\_ETRMS}{E-terms of Aberration} +{ + \action{Compute the E-terms vector -- the part of the annual + aberration which arises from the eccentricity of the + Earth's orbit.} + \call{CALL sla\_ETRMS (EP, EV)} +} +\args{GIVEN} +{ + \spec{EP}{D}{Besselian epoch} +} +\args{RETURNED} +{ + \spec{EV}{D(3)}{E-terms as $[\Delta x, \Delta y, \Delta z\,]$} +} +\anote{Note the use of the J2000 aberration constant (\arcsec{20}{49552}). + This is a reflection of the fact that the E-terms embodied in + existing star catalogues were computed from a variety of + aberration constants. Rather than adopting one of the old + constants the latest value is used here.} +\refs +{ + \begin{enumerate} + \item Smith, C.A.\ {\it et al.}, 1989. {\it Astr.J.}\ {\bf 97}, 265. + \item Yallop, B.D.\ {\it et al.}, 1989. {\it Astr.J.}\ {\bf 97}, 274. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EULER}{Rotation Matrix from Euler Angles} +{ + \action{Form a rotation matrix from the Euler angles -- three + successive rotations about specified Cartesian axes + (single precision).} + \call{CALL sla\_EULER (ORDER, PHI, THETA, PSI, RMAT)} +} +\args{GIVEN} +{ + \spec{ORDER}{C*(*)}{specifies about which axes the rotations occur} \\ + \spec{PHI}{R}{1st rotation (radians)} \\ + \spec{THETA}{R}{2nd rotation (radians)} \\ + \spec{PSI}{R}{3rd rotation (radians)} +} +\args{RETURNED} +{ + \spec{RMAT}{R(3,3)}{rotation matrix} +} +\notes +{ + \begin{enumerate} + \item A rotation is positive when the reference frame rotates + anticlockwise as seen looking towards the origin from the + positive region of the specified axis. + \item The characters of ORDER define which axes the three successive + rotations are about. A typical value is `ZXZ', indicating that + RMAT is to become the direction cosine matrix corresponding to + rotations of the reference frame through PHI radians about the + old {\it z}-axis, followed by THETA radians about the resulting + {\it x}-axis, + then PSI radians about the resulting {\it z}-axis. In detail: + \begin{itemize} + \item The axis names can be any of the following, in any order or + combination: X, Y, Z, uppercase or lowercase, 1, 2, 3. Normal + axis labelling/numbering conventions apply; + the {\it xyz} ($\equiv123$) + triad is right-handed. Thus, the `ZXZ' example given above + could be written `zxz' or `313' (or even `ZxZ' or `3xZ'). + \item ORDER is terminated by length or by the first unrecognized + character. + \item Fewer than three rotations are acceptable, in which case + the later angle arguments are ignored. + \end{itemize} + \item Zero rotations produces the identity RMAT. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_EVP}{Earth Position \& Velocity} +{ + \action{Barycentric and heliocentric velocity and position of the Earth.} + \call{CALL sla\_EVP (DATE, DEQX, DVB, DPB, DVH, DPH)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as a Modified Julian Date + (JD$-$2400000.5)} \\ + \spec{DEQX}{D}{Julian Epoch ({\it e.g.}\ 2000D0) of mean equator and + equinox of the vectors returned. If DEQX~$<0$, + all vectors are referred to the mean equator and + equinox (FK5) of date DATE.} +} +\args{RETURNED} +{ + \spec{DVB}{D(3)}{barycentric \xyzd, AU~s$^{-1}$} \\ + \spec{DPB}{D(3)}{barycentric \xyz, AU} \\ + \spec{DVH}{D(3)}{heliocentric \xyzd, AU~s$^{-1}$} \\ + \spec{DPH}{D(3)}{heliocentric \xyz, AU} +} +\notes +{ + \begin{enumerate} + \item This routine is accurate enough for many purposes but faster + and more compact than the sla\_EPV routine. The maximum + deviations from the JPL~DE96 ephemeris are as follows: + \begin{itemize} + \item velocity (barycentric or heliocentric): 420~mm~s$^{-1}$ + \item position (barycentric): 6900~km + \item position (heliocentric): 1600~km + \end{itemize} + \item The routine is adapted from the BARVEL and BARCOR + subroutines of Stumpff (1980). + Most of the changes are merely cosmetic and do not affect + the results at all. However, some adjustments have been + made so as to give results that refer to the IAU 1976 + `FK5' equinox and precession, although the differences these + changes make relative to the results from Stumpff's original + `FK4' version are smaller than the inherent accuracy of the + algorithm. One minor shortcoming in the original routines + that has {\bf not} been corrected is that slightly better + numerical accuracy could be achieved if the various polynomial + evaluations were to be so arranged that the smallest terms were + computed first. + \end{enumerate} +} +\aref {Stumpff, P., 1980., {\it Astron.Astrophys.Suppl.Ser.}\ + {\bf 41}, 1-8.} +%----------------------------------------------------------------------- +\routine{SLA\_FITXY}{Fit Linear Model to Two \xy\ Sets} +{ + \action{Fit a linear model to relate two sets of \xy\ coordinates.} + \call{CALL sla\_FITXY (ITYPE, NP, XYE, XYM, COEFFS, J)} +} +\args{GIVEN} +{ + \spec{ITYPE}{I}{type of model: 4 or 6 (note 1)} \\ + \spec{NP}{I}{number of samples (note 2)} \\ + \spec{XYE}{D(2,NP)}{expected \xy\ for each sample} \\ + \spec{XYM}{D(2,NP)}{measured \xy\ for each sample} +} +\args{RETURNED} +{ + \spec{COEFFS}{D(6)}{coefficients of model (note 3)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK} \\ + \spec{}{}{\hspace{0.7em} $-$1 = illegal ITYPE} \\ + \spec{}{}{\hspace{0.7em} $-$2 = insufficient data} \\ + \spec{}{}{\hspace{0.7em} $-$3 = singular solution} +} +\notes +{ + \begin{enumerate} + \item ITYPE, which must be either 4 or 6, selects the type of model + fitted. Both allowed ITYPE values produce a model COEFFS which + consists of six coefficients, namely the zero points and, for + each of XE and YE, the coefficient of XM and YM. For ITYPE=6, + all six coefficients are independent, modelling squash and shear + as well as origin, scale, and orientation. However, ITYPE=4 + selects the {\it solid body rotation}\/ option; the model COEFFS + still consists of the same six coefficients, but now two of + them are used twice (appropriately signed). Origin, scale + and orientation are still modelled, but not squash or shear -- + the units of X and Y have to be the same. + \item For NC=4, NP must be at least 2. For NC=6, NP must be at + least 3. + \item The model is returned in the array COEFFS. Naming the + six elements of COEFFS $a,b,c,d,e$ \& $f$, + the model transforms {\it measured}\/ coordinates + $[x_{m},y_{m}\,]$ into {\it expected}\/ coordinates + $[x_{e},y_{e}\,]$ as follows: + \begin{verse} + $x_{e} = a + bx_{m} + cy_{m}$ \\ + $y_{e} = d + ex_{m} + fy_{m}$ + \end{verse} + For the {\it solid body rotation}\/ option (ITYPE=4), the + magnitudes of $b$ and $f$, and of $c$ and $e$, are equal. The + signs of these coefficients depend on whether there is a + sign reversal between $[x_{e},y_{e}]$ and $[x_{m},y_{m}]$; + fits are performed + with and without a sign reversal and the best one chosen. + \item Error status values J=$-$1 and $-$2 leave COEFFS unchanged; + if J=$-$3 COEFFS may have been changed. + \item See also sla\_PXY, sla\_INVF, sla\_XY2XY, sla\_DCMPF. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK425}{FK4 to FK5} +{ + \action{Convert B1950.0 FK4 star data to J2000.0 FK5. + This routine converts stars from the old, Bessel-Newcomb, FK4 + system to the new, IAU~1976, FK5, Fricke system. The precepts + of Smith~{\it et~al.}\ (see reference~1) are followed, + using the implementation + by Yallop~{\it et~al.}\ (reference~2) of a matrix method + due to Standish. + Kinoshita's development of Andoyer's post-Newcomb precession is + used. The numerical constants from + Seidelmann~{\it et~al.}\ (reference~3) are used canonically.} + \call{CALL sla\_FK425 (\vtop{ + \hbox{R1950,D1950,DR1950,DD1950,P1950,V1950,} + \hbox{R2000,D2000,DR2000,DD2000,P2000,V2000)}}} +} +\args{GIVEN} +{ + \spec{R1950}{D}{B1950.0 $\alpha$ (radians)} \\ + \spec{D1950}{D}{B1950.0 $\delta$ (radians)} \\ + \spec{DR1950}{D}{B1950.0 proper motion in $\alpha$ + (radians per tropical year)} \\ + \spec{DD1950}{D}{B1950.0 proper motion in $\delta$ + (radians per tropical year)} \\ + \spec{P1950}{D}{B1950.0 parallax (arcsec)} \\ + \spec{V1950}{D}{B1950.0 radial velocity (km~s$^{-1}$, +ve = moving away)} +} +\args{RETURNED} +{ + \spec{R2000}{D}{J2000.0 $\alpha$ (radians)} \\ + \spec{D2000}{D}{J2000.0 $\delta$ (radians)} \\ + \spec{DR2000}{D}{J2000.0 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD2000}{D}{J2000.0 proper motion in $\delta$ + (radians per Julian year)} \\ + \spec{P2000}{D}{J2000.0 parallax (arcsec)} \\ + \spec{V2000}{D}{J2000.0 radial velocity (km~s$^{-1}$, +ve = moving away)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item Conversion from Besselian epoch 1950.0 to Julian epoch + 2000.0 only is provided for. Conversions involving other + epochs will require use of the appropriate precession, + proper motion, and E-terms routines before and/or after FK425 + is called. + \item In the FK4 catalogue the proper motions of stars within + $10^{\circ}$ of the poles do not include the {\it differential + E-terms}\/ effect and should, strictly speaking, be handled + in a different manner from stars outside these regions. + However, given the general lack of homogeneity of the star + data available for routine astrometry, the difficulties of + handling positions that may have been determined from + astrometric fields spanning the polar and non-polar regions, + the likelihood that the differential E-terms effect was not + taken into account when allowing for proper motion in past + astrometry, and the undesirability of a discontinuity in + the algorithm, the decision has been made in this routine to + include the effect of differential E-terms on the proper + motions for all stars, whether polar or not. At epoch J2000, + and measuring on the sky rather than in terms of $\Delta\alpha$, + the errors resulting from this simplification are less than + 1~milliarcsecond in position and 1~milliarcsecond per + century in proper motion. + \item See also sla\_FK45Z, sla\_FK524, sla\_FK54Z. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Smith, C.A.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 265. + \item Yallop, B.D.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 274. + \item Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK45Z}{FK4 to FK5, no P.M. or Parallax} +{ + \action{Convert B1950.0 FK4 star data to J2000.0 FK5 assuming zero + proper motion in the FK5 frame. + This routine converts stars from the old, Bessel-Newcomb, FK4 + system to the new, IAU~1976, FK5, Fricke system, in such a + way that the FK5 proper motion is zero. Because such a star + has, in general, a non-zero proper motion in the FK4 system, + the routine requires the epoch at which the position in the + FK4 system was determined. The method is from appendix~2 of + reference~1, but using the constants of reference~4.} + \call{CALL sla\_FK45Z (R1950, D1950, BEPOCH, R2000, D2000)} +} +\args{GIVEN} +{ + \spec{R1950}{D}{B1950.0 FK4 $\alpha$ at epoch BEPOCH (radians)} \\ + \spec{D1950}{D}{B1950.0 FK4 $\delta$ at epoch BEPOCH (radians)} \\ + \spec{BEPOCH}{D}{Besselian epoch ({\it e.g.}\ 1979.3D0)} +} +\args{RETURNED} +{ + \spec{R2000}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D2000}{D}{J2000.0 FK5 $\delta$ (radians)} +} +\notes +{ + \begin{enumerate} + \item The epoch BEPOCH is strictly speaking Besselian, but + if a Julian epoch is supplied the result will be + affected only to a negligible extent. + \item Conversion from Besselian epoch 1950.0 to Julian epoch + 2000.0 only is provided for. Conversions involving other + epochs will require use of the appropriate precession, + proper motion, and E-terms routines before and/or + after FK45Z is called. + \item In the FK4 catalogue the proper motions of stars within + $10^{\circ}$ of the poles do not include the {\it differential + E-terms}\/ effect and should, strictly speaking, be handled + in a different manner from stars outside these regions. + However, given the general lack of homogeneity of the star + data available for routine astrometry, the difficulties of + handling positions that may have been determined from + astrometric fields spanning the polar and non-polar regions, + the likelihood that the differential E-terms effect was not + taken into account when allowing for proper motion in past + astrometry, and the undesirability of a discontinuity in + the algorithm, the decision has been made in this routine to + include the effect of differential E-terms on the proper + motions for all stars, whether polar or not. At epoch 2000, + and measuring on the sky rather than in terms of $\Delta\alpha$, + the errors resulting from this simplification are less than + 1~milliarcsecond in position and 1~milliarcsecond per + century in proper motion. + \item See also sla\_FK425, sla\_FK524, sla\_FK54Z. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Aoki, S., {\it et al.}, 1983.\ {\it Astr.Astrophys.}, {\bf 128}, 263. + \item Smith, C.A.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 265. + \item Yallop, B.D.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 274. + \item Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK524}{FK5 to FK4} +{ + \action{Convert J2000.0 FK5 star data to B1950.0 FK4. + This routine converts stars from the new, IAU~1976, FK5, Fricke + system, to the old, Bessel-Newcomb, FK4 system. + The precepts of Smith~{\it et~al.}\ (reference~1) are followed, + using the implementation by Yallop~{\it et~al.}\ (reference~2) + of a matrix method due to Standish. Kinoshita's development of + Andoyer's post-Newcomb precession is used. The numerical + constants from Seidelmann~{\it et~al.}\ (reference~3) are + used canonically.} + \call{CALL sla\_FK524 (\vtop{ + \hbox{R2000, D2000, DR2000, DD2000, P2000, V2000,} + \hbox{R1950, D1950, DR1950, DD1950, P1950, V1950)}}} +} +\args{GIVEN} +{ + \spec{R2000}{D}{J2000.0 $\alpha$ (radians)} \\ + \spec{D2000}{D}{J2000.0 $\delta$ (radians)} \\ + \spec{DR2000}{D}{J2000.0 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD2000}{D}{J2000.0 proper motion in $\delta$ + (radians per Julian year)} \\ + \spec{P2000}{D}{J2000.0 parallax (arcsec)} \\ + \spec{V2000}{D}{J2000 radial velocity (km~s$^{-1}$, +ve = moving away)} +} +\args{RETURNED} +{ + \spec{R1950}{D}{B1950.0 $\alpha$ (radians)} \\ + \spec{D1950}{D}{B1950.0 $\delta$ (radians)} \\ + \spec{DR1950}{D}{B1950.0 proper motion in $\alpha$ + (radians per tropical year)} \\ + \spec{DD1950}{D}{B1950.0 proper motion in $\delta$ + (radians per tropical year)} \\ + \spec{P1950}{D}{B1950.0 parallax (arcsec)} \\ + \spec{V1950}{D}{radial velocity (km~s$^{-1}$, +ve = moving away)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item Note that conversion from Julian epoch 2000.0 to Besselian + epoch 1950.0 only is provided for. Conversions involving + other epochs will require use of the appropriate precession, + proper motion, and E-terms routines before and/or after + FK524 is called. + \item In the FK4 catalogue the proper motions of stars within + $10^{\circ}$ of the poles do not include the {\it differential + E-terms}\/ effect and should, strictly speaking, be handled + in a different manner from stars outside these regions. + However, given the general lack of homogeneity of the star + data available for routine astrometry, the difficulties of + handling positions that may have been determined from + astrometric fields spanning the polar and non-polar regions, + the likelihood that the differential E-terms effect was not + taken into account when allowing for proper motion in past + astrometry, and the undesirability of a discontinuity in + the algorithm, the decision has been made in this routine to + include the effect of differential E-terms on the proper + motions for all stars, whether polar or not. At epoch 2000, + and measuring on the sky rather than in terms of $\Delta\alpha$, + the errors resulting from this simplification are less than + 1~milliarcsecond in position and 1~milliarcsecond per + century in proper motion. + \item See also sla\_FK425, sla\_FK45Z, sla\_FK54Z. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Smith, C.A.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 265. + \item Yallop, B.D.\ {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 274. + \item Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK52H}{FK5 to Hipparcos} +{ + \action{Transform an FK5 (J2000) position and proper motion + into the frame of the Hipparcos catalogue.} + \call{CALL sla\_FK52H (R5, D5, DR5, DD5, RH, DH, DRH, DDH)} +} +\args{GIVEN} +{ + \spec{R5}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D5}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{DR5}{D}{J2000.0 FK5 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD5}{D}{J2000.0 FK5 proper motion in $\delta$ + (radians per Julian year)} +} +\args{RETURNED} +{ + \spec{RH}{D}{Hipparcos $\alpha$ (radians)} \\ + \spec{DH}{D}{Hipparcos $\delta$ (radians)} \\ + \spec{DRH}{D}{Hipparcos proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DDH}{D}{Hipparcos proper motion in $\delta$ + (radians per Julian year)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item The FK5 to Hipparcos + transformation consists of a pure rotation and spin; + zonal errors in the FK5 catalogue are not taken into account. + \item The adopted epoch J2000.0 FK5 to Hipparcos orientation and spin + values are as follows (see reference): + + \vspace{2ex} + + ~~~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & + \multicolumn{1}{|c}{\it orientation} & + \multicolumn{1}{|c|}{\it ~~~spin~~~} \\ \hline + $x$ & $-19.9$~~~~ & ~$-0.30$~~ \\ + $y$ & $-9.1$~~~~ & ~$+0.60$~~ \\ + $z$ & $+22.9$~~~~ & ~$+0.70$~~ \\ \hline + & {\it mas}~~~~~ & ~{\it mas/y}~ \\ \hline + \end{tabular} + + \vspace{3ex} + + These orientation and spin components are interpreted as + {\it axial vectors.} An axial vector points at the pole of + the rotation and its length is the amount of rotation in radians. + \item See also sla\_FK5HZ, sla\_H2FK5, sla\_HFK5Z. + \end{enumerate} +} +\aref {Feissel, M.\ \& Mignard, F., 1998., {\it Astron.Astrophys.}\ + {\bf 331}, L33-L36.} +%----------------------------------------------------------------------- +\routine{SLA\_FK54Z}{FK5 to FK4, no P.M. or Parallax} +{ + \action{Convert a J2000.0 FK5 star position to B1950.0 FK4 assuming + FK5 zero proper motion and parallax. + This routine converts star positions from the new, IAU~1976, + FK5, Fricke system to the old, Bessel-Newcomb, FK4 system.} + \call{CALL sla\_FK54Z (R2000, D2000, BEPOCH, R1950, D1950, DR1950, DD1950)} +} +\args{GIVEN} +{ + \spec{R2000}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D2000}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{BEPOCH}{D}{Besselian epoch ({\it e.g.}\ 1950D0)} +} +\args{RETURNED} +{ + \spec{R1950}{D}{B1950.0 FK4 $\alpha$ at epoch BEPOCH (radians)} \\ + \spec{D1950}{D}{B1950.0 FK4 $\delta$ at epoch BEPOCH (radians)} \\ + \spec{DR1950}{D}{B1950.0 FK4 proper motion in $\alpha$ + (radians per tropical year)} \\ + \spec{DD1950}{D}{B1950.0 FK4 proper motion in $\delta$ + (radians per tropical year)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item Conversion from Julian epoch 2000.0 to Besselian epoch 1950.0 + only is provided for. Conversions involving other epochs will + require use of the appropriate precession routines before and + after this routine is called. + \item Unlike in the sla\_FK524 routine, the FK5 proper motions, the + parallax and the radial velocity are presumed zero. + \item It was the intention that FK5 should be a close approximation + to an inertial frame, so that distant objects have zero proper + motion; such objects have (in general) non-zero proper motion + in FK4, and this routine returns those {\it fictitious proper + motions}. + \item The position returned by this routine is in the B1950 + reference frame but at Besselian epoch BEPOCH. For + comparison with catalogues the BEPOCH argument will + frequently be 1950D0. + \item See also sla\_FK425, sla\_FK45Z, sla\_FK524. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_FK5HZ}{FK5 to Hipparcos, no P.M.} +{ + \action{Transform an FK5 (J2000) star position into the frame of the + Hipparcos catalogue, assuming zero Hipparcos proper motion.} + \call{CALL sla\_FK5HZ (R5, D5, EPOCH, RH, DH)} +} +\args{GIVEN} +{ + \spec{R5}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D5}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{EPOCH}{D}{Julian epoch (TDB)} +} +\args{RETURNED} +{ + \spec{RH}{D}{Hipparcos $\alpha$ (radians)} \\ + \spec{DH}{D}{Hipparcos $\delta$ (radians)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item The FK5 to Hipparcos + transformation consists of a pure rotation and spin; + zonal errors in the FK5 catalogue are not taken into account. + \item The adopted epoch J2000.0 FK5 to Hipparcos orientation and spin + values are as follows (see reference): + + \vspace{2ex} + + ~~~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & + \multicolumn{1}{|c}{\it orientation} & + \multicolumn{1}{|c|}{\it ~~~spin~~~} \\ \hline + $x$ & $-19.9$~~~~ & ~$-0.30$~~ \\ + $y$ & $-9.1$~~~~ & ~$+0.60$~~ \\ + $z$ & $+22.9$~~~~ & ~$+0.70$~~ \\ \hline + & {\it mas}~~~~~ & ~{\it mas/y}~ \\ \hline + \end{tabular} + + \vspace{3ex} + + These orientation and spin components are interpreted as + {\it axial vectors.} An axial vector points at the pole of + the rotation and its length is the amount of rotation in radians. + \item See also sla\_FK52H, sla\_H2FK5, sla\_HFK5Z. + \end{enumerate} +} +\aref {Feissel, M.\ \& Mignard, F., 1998., {\it Astron.Astrophys.}\ + {\bf 331}, L33-L36.} +%----------------------------------------------------------------------- +\routine{SLA\_FLOTIN}{Decode a Real Number} +{ + \action{Convert free-format input into single precision floating point.} + \call{CALL sla\_FLOTIN (STRING, NSTRT, RESLT, JFLAG)} +} +\args{GIVEN} +{ + \spec{STRING}{C}{string containing number to be decoded} \\ + \spec{NSTRT}{I}{pointer to where decoding is to commence} \\ + \spec{RESLT}{R}{current value of result} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced to next number} \\ + \spec{RESLT}{R}{result} \\ + \spec{JFLAG}{I}{status: $-$1~=~$-$OK, 0~=~+OK, 1~=~null result, 2~=~error} +} +\notes +{ + \begin{enumerate} + \item The reason sla\_FLOTIN has separate `OK' status values + for + and $-$ is to enable minus zero to be detected. + This is of crucial importance + when decoding mixed-radix numbers. For example, an angle + expressed as degrees, arcminutes and arcseconds may have a + leading minus sign but a zero degrees field. + \item A TAB is interpreted as a space, and lowercase characters are + interpreted as uppercase. {\it n.b.}\ The test for TAB is + ASCII-specific. + \item The basic format is the sequence of fields $\pm n.n x \pm n$, + where $\pm$ is a sign + character `+' or `$-$', $n$ means a string of decimal digits, + `.' is a decimal point, and $x$, which indicates an exponent, + means `D' or `E'. Various combinations of these fields can be + omitted, and embedded blanks are permissible in certain places. + \item Spaces: + \begin{itemize} + \item Leading spaces are ignored. + \item Embedded spaces are allowed only after +, $-$, D or E, + and after the decimal point if the first sequence of + digits is absent. + \item Trailing spaces are ignored; the first signifies + end of decoding and subsequent ones are skipped. + \end{itemize} + \item Delimiters: + \begin{itemize} + \item Any character other than +,$-$,0-9,.,D,E or space may be + used to signal the end of the number and terminate decoding. + \item Comma is recognized by sla\_FLOTIN as a special case; it + is skipped, leaving the pointer on the next character. See + 13, below. + \item Decoding will in all cases terminate if end of string + is reached. + \end{itemize} + \item Both signs are optional. The default is +. + \item The mantissa $n.n$ defaults to unity. + \item The exponent $x\!\pm\!n$ defaults to `E0'. + \item The strings of decimal digits may be of any length. + \item The decimal point is optional for whole numbers. + \item A {\it null result}\/ occurs when the string of characters + being decoded does not begin with +,$-$,0-9,.,D or E, or + consists entirely of spaces. When this condition is + detected, JFLAG is set to 1 and RESLT is left untouched. + \item NSTRT = 1 for the first character in the string. + \item On return from sla\_FLOTIN, NSTRT is set ready for the next + decode -- following trailing blanks and any comma. If a + delimiter other than comma is being used, NSTRT must be + incremented before the next call to sla\_FLOTIN, otherwise + all subsequent calls will return a null result. + \item Errors (JFLAG=2) occur when: + \begin{itemize} + \item a +, $-$, D or E is left unsatisfied; or + \item the decimal point is present without at least + one decimal digit before or after it; or + \item an exponent more than 100 has been presented. + \end{itemize} + \item When an error has been detected, NSTRT is left + pointing to the character following the last + one used before the error came to light. This + may be after the point at which a more sophisticated + program could have detected the error. For example, + sla\_FLOTIN does not detect that `1E999' is unacceptable + (on a computer where this is so) + until the entire number has been decoded. + \item Certain highly unlikely combinations of mantissa and + exponent can cause arithmetic faults during the + decode, in some cases despite the fact that they + together could be construed as a valid number. + \item Decoding is left to right, one pass. + \item See also sla\_DFLTIN and sla\_INTIN. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_GALEQ}{Galactic to J2000 $\alpha,\delta$} +{ + \action{Transformation from IAU 1958 galactic coordinates + to J2000.0 FK5 equatorial coordinates.} + \call{CALL sla\_GALEQ (DL, DB, DR, DD)} +} +\args{GIVEN} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal} +} +\args{RETURNED} +{ + \spec{DR,DD}{D}{J2000.0 \radec} +} +\notes +{ + \begin{enumerate} + \item All arguments are in radians. + \item The equatorial coordinates are J2000.0 FK5. Use the routine + sla\_GE50 if conversion to B1950.0 FK4 coordinates is + required. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_GALSUP}{Galactic to Supergalactic} +{ + \action{Transformation from IAU 1958 galactic coordinates to + de Vaucouleurs supergalactic coordinates.} + \call{CALL sla\_GALSUP (DL, DB, DSL, DSB)} +} +\args{GIVEN} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal\ (radians)} +} +\args{RETURNED} +{ + \spec{DSL,DSB}{D}{supergalactic longitude and latitude (radians)} +} +\refs +{ + \begin{enumerate} + \item de Vaucouleurs, de Vaucouleurs, \& Corwin, {\it Second Reference + Catalogue of Bright Galaxies}, U.Texas, p8. + \item Systems \& Applied Sciences Corp., documentation for the + machine-readable version of the above catalogue, + Contract NAS 5-26490. + \end{enumerate} + (These two references give different values for the galactic + longitude of the supergalactic origin. Both are wrong; the + correct value is $l^{I\!I}=137.37$.) +} +%----------------------------------------------------------------------- +\routine{SLA\_GE50}{Galactic to B1950 $\alpha,\delta$} +{ + \action{Transformation from IAU 1958 galactic coordinates to + B1950.0 FK4 equatorial coordinates.} + \call{CALL sla\_GE50 (DL, DB, DR, DD)} +} +\args{GIVEN} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal} +} +\args{RETURNED} +{ + \spec{DR,DD}{D}{B1950.0 \radec} +} +\notes +{ + \begin{enumerate} + \item All arguments are in radians. + \item The equatorial coordinates are B1950.0 FK4. Use the + routine sla\_GALEQ if conversion to J2000.0 FK5 coordinates + is required. + \end{enumerate} +} +\aref{Blaauw {\it et al.}, 1960, {\it Mon.Not.R.astr.Soc.}, + {\bf 121}, 123.} +%----------------------------------------------------------------------- +\routine{SLA\_GEOC}{Geodetic to Geocentric} +{ + \action{Convert geodetic position to geocentric.} + \call{CALL sla\_GEOC (P, H, R, Z)} +} +\args{GIVEN} +{ + \spec{P}{D}{latitude (geodetic, radians)} \\ + \spec{H}{D}{height above reference spheroid (geodetic, metres)} +} +\args{RETURNED} +{ + \spec{R}{D}{distance from Earth axis (AU)} \\ + \spec{Z}{D}{distance from plane of Earth equator (AU)} +} +\notes +{ + \begin{enumerate} + \item Geocentric latitude can be obtained by evaluating {\tt ATAN2(Z,R)}. + \item IAU 1976 constants are used. + \end{enumerate} +} +\aref{Green, R.M., 1985.\ {\it Spherical Astronomy}, Cambridge U.P., p98.} +%----------------------------------------------------------------------- +\routine{SLA\_GMST}{UT to GMST} +{ + \action{Conversion from universal time UT1 to Greenwich mean + sidereal time.} + \call{D~=~sla\_GMST (UT1)} +} +\args{GIVEN} +{ + \spec{UT1}{D}{universal time (strictly UT1) expressed as + modified Julian Date (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{sla\_GMST}{D}{Greenwich mean sidereal time (radians)} +} +\notes +{ + \begin{enumerate} + \item The IAU~1982 expression + (see page~S15 of the 1984 {\it Astronomical + Almanac})\/ is used, but rearranged to reduce rounding errors. This + expression is always described as giving the GMST at $0^{\rm h}$UT; + in fact, it gives the difference between the + GMST and the UT, which happens to equal the GMST (modulo + 24~hours) at $0^{\rm h}$UT each day. In sla\_GMST, the + entire UT is used directly as the argument for the + canonical formula, and the fractional part of the UT is + added separately; note that the factor $1.0027379\cdots$ does + not appear. + \item See also the routine sla\_GMSTA, which + delivers better numerical + precision by accepting the UT date and time as separate arguments. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_GMSTA}{UT to GMST (extra precision)} +{ + \action{Conversion from universal time UT1 to Greenwich mean + sidereal time, with rounding errors minimized.} + \call{D~=~sla\_GMSTA (DATE, UT1)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{UT1 date as Modified Julian Date (integer part + of JD$-$2400000.5)} \\ + \spec{UT1}{D}{UT1 time (fraction of a day)} +} +\args{RETURNED} +{ + \spec{sla\_GMST}{D}{Greenwich mean sidereal time (radians)} +} +\notes +{ + \begin{enumerate} + \item The algorithm is derived from the IAU 1982 expression + (see page~S15 of the 1984 Astronomical Almanac). + \item There is no restriction on how the UT is apportioned between the + DATE and UT1 arguments. Either of the two arguments could, for + example, be zero and the entire date\,+\,time supplied in the other. + However, the routine is designed to deliver maximum accuracy when + the DATE argument is a whole number and the UT1 argument + lies in the range $[\,0,\,1\,]$, or {\it vice versa}. + \item See also the routine sla\_GMST, which accepts the UT1 as a single + argument. Compared with sla\_GMST, the extra numerical precision + delivered by the present routine is unlikely to be important in + an absolute sense, but may be useful when critically comparing + algorithms and in applications where two sidereal times close + together are differenced. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_GRESID}{Gaussian Residual} +{ + \action{Generate pseudo-random normal deviate or {\it Gaussian residual}.} + \call{R~=~sla\_GRESID (S)} +} +\args{GIVEN} +{ + \spec{S}{R}{standard deviation} +} +\notes +{ + \begin{enumerate} + \item The results of many calls to this routine will be + normally distributed with mean zero and standard deviation S. + \item The Box-Muller algorithm is used. + \item The implementation is machine-dependent. + \end{enumerate} +} +\aref{Ahrens \& Dieter, 1972.\ {\it Comm.A.C.M.}\ {\bf 15}, 873.} +%----------------------------------------------------------------------- +\routine{SLA\_H2E}{Az,El to $h,\delta$} +{ + \action{Horizon to equatorial coordinates + (single precision).} + \call{CALL sla\_H2E (AZ, EL, PHI, HA, DEC)} +} +\args{GIVEN} +{ + \spec{AZ}{R}{azimuth (radians)} \\ + \spec{EL}{R}{elevation (radians)} \\ + \spec{PHI}{R}{latitude (radians)} +} +\args{RETURNED} +{ + \spec{HA}{R}{hour angle (radians)} \\ + \spec{DEC}{R}{declination (radians)} +} +\notes +{ + \begin{enumerate} + \item The sign convention for azimuth is north zero, east $+\pi/2$. + \item HA is returned in the range $\pm\pi$. Declination is returned + in the range $\pm\pi$. + \item The latitude is (in principle) geodetic. In critical + applications, corrections for polar motion should be applied + (see sla\_POLMO). + \item In some applications it will be important to specify the + correct type of elevation in order to produce the required + type of \hadec. In particular, it may be important to + distinguish between the elevation as affected by refraction, + which will yield the {\it observed} \hadec, and the elevation + {\it in vacuo}, which will yield the {\it topocentric} + \hadec. If the + effects of diurnal aberration can be neglected, the + topocentric \hadec\ may be used as an approximation to the + {\it apparent} \hadec. + \item No range checking of arguments is carried out. + \item In applications which involve many such calculations, rather + than calling the present routine it will be more efficient to + use inline code, having previously computed fixed terms such + as sine and cosine of latitude. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_H2FK5}{Hipparcos to FK5} +{ + \action{Transform a Hipparcos star position and proper motion + into the FK5 (J2000) frame.} + \call{CALL sla\_H2FK5 (RH, DH, DRH, DDH, R5, D5, DR5, DD5)} +} +\args{GIVEN} +{ + \spec{RH}{D}{Hipparcos $\alpha$ (radians)} \\ + \spec{DH}{D}{Hipparcos $\delta$ (radians)} \\ + \spec{DRH}{D}{Hipparcos proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DDH}{D}{Hipparcos proper motion in $\delta$ + (radians per Julian year)} +} +\args{RETURNED} +{ + \spec{R5}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D5}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{DR5}{D}{J2000.0 FK5 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD5}{D}{FK5 J2000.0 proper motion in $\delta$ + (radians per Julian year)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item The FK5 to Hipparcos + transformation consists of a pure rotation and spin; + zonal errors in the FK5 catalogue are not taken into account. + \item The adopted epoch J2000.0 FK5 to Hipparcos orientation and spin + values are as follows (see reference): + + \vspace{2ex} + + ~~~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & + \multicolumn{1}{|c}{\it orientation} & + \multicolumn{1}{|c|}{\it ~~~spin~~~} \\ \hline + $x$ & $-19.9$~~~~ & ~$-0.30$~~ \\ + $y$ & $-9.1$~~~~ & ~$+0.60$~~ \\ + $z$ & $+22.9$~~~~ & ~$+0.70$~~ \\ \hline + & {\it mas}~~~~~ & ~{\it mas/y}~ \\ \hline + \end{tabular} + + \vspace{3ex} + + These orientation and spin components are interpreted as + {\it axial vectors.} An axial vector points at the pole of + the rotation and its length is the amount of rotation in radians. + \item See also sla\_FK52H, sla\_FK5HZ, sla\_HFK5Z. + \end{enumerate} +} +\aref {Feissel, M.\ \& Mignard, F., 1998., {\it Astron.Astrophys.}\ + {\bf 331}, L33-L36.} +%----------------------------------------------------------------------- +\routine{SLA\_HFK5Z}{Hipparcos to FK5, no P.M.} +{ + \action{Transform a Hipparcos star position + into the FK5 (J2000) frame assuming zero Hipparcos proper motion.} + \call{CALL sla\_HFK5Z (RH, DH, EPOCH, R5, D5, DR5, DD5)} +} +\args{GIVEN} +{ + \spec{RH}{D}{Hipparcos $\alpha$ (radians)} \\ + \spec{DH}{D}{Hipparcos $\delta$ (radians)} \\ + \spec{EPOCH}{D}{Julian epoch (TDB)} +} +\args{RETURNED} +{ + \spec{R5}{D}{J2000.0 FK5 $\alpha$ (radians)} \\ + \spec{D5}{D}{J2000.0 FK5 $\delta$ (radians)} \\ + \spec{DR5}{D}{J2000.0 FK5 proper motion in $\alpha$ + (radians per Julian year)} \\ + \spec{DD5}{D}{FK5 J2000.0 proper motion in $\delta$ + (radians per Julian year)} +} +\notes +{ + \begin{enumerate} + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item The FK5 to Hipparcos + transformation consists of a pure rotation and spin; + zonal errors in the FK5 catalogue are not taken into account. + \item The adopted epoch J2000.0 FK5 to Hipparcos orientation and spin + values are as follows (see reference): + + \vspace{2ex} + + ~~~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & + \multicolumn{1}{|c}{\it orientation} & + \multicolumn{1}{|c|}{\it ~~~spin~~~} \\ \hline + $x$ & $-19.9$~~~~ & ~$-0.30$~~ \\ + $y$ & $-9.1$~~~~ & ~$+0.60$~~ \\ + $z$ & $+22.9$~~~~ & ~$+0.70$~~ \\ \hline + & {\it mas}~~~~~ & ~{\it mas/y}~ \\ \hline + \end{tabular} + + \vspace{3ex} + + These orientation and spin components are interpreted as + {\it axial vectors.} An axial vector points at the pole of + the rotation and its length is the amount of rotation in radians. + \item It was the intention that Hipparcos should be a close + approximation to an inertial frame, so that distant objects + have zero proper motion; such objects have (in general) + non-zero proper motion in FK5, and this routine returns those + {\it fictitious proper motions.} + \item The position returned by this routine is in the FK5 J2000 + reference frame but at Julian epoch EPOCH. + \item See also sla\_FK52H, sla\_FK5HZ, sla\_H2FK5. + \end{enumerate} +} +\aref {Feissel, M.\ \& Mignard, F., 1998., {\it Astron.Astrophys.}\ + {\bf 331}, L33-L36.} +%----------------------------------------------------------------------- +\routine{SLA\_IMXV}{Apply 3D Reverse Rotation} +{ + \action{Multiply a 3-vector by the inverse of a rotation + matrix (single precision).} + \call{CALL sla\_IMXV (RM, VA, VB)} +} +\args{GIVEN} +{ + \spec{RM}{R(3,3)}{rotation matrix} \\ + \spec{VA}{R(3)}{vector to be rotated} +} +\args{RETURNED} +{ + \spec{VB}{R(3)}{result vector} +} +\notes +{ + \begin{enumerate} + \item This routine performs the operation: + \begin{verse} + {\bf b} = {\bf M}$^{T}\cdot${\bf a} + \end{verse} + where {\bf a} and {\bf b} are the 3-vectors VA and VB + respectively, and {\bf M} is the $3\times3$ matrix RM. + \item The main function of this routine is apply an inverse + rotation; under these circumstances, ${\bf M}$ is + {\it orthogonal}, with its inverse the same as its transpose. + \item To comply with the ANSI Fortran 77 standard, VA and VB must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly on the VAX and many other systems even + if this rule is violated, something that is {\bf not}, however, + recommended. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_INTIN}{Decode an Integer Number} +{ + \action{Convert free-format input into an integer.} + \call{CALL sla\_INTIN (STRING, NSTRT, IRESLT, JFLAG)} +} +\args{GIVEN} +{ + \spec{STRING}{C}{string containing number to be decoded} \\ + \spec{NSTRT}{I}{pointer to where decoding is to commence} \\ + \spec{IRESLT}{I}{current value of result} +} +\args{RETURNED} +{ + \spec{NSTRT}{I}{advanced to next number} \\ + \spec{IRESLT}{I}{result} \\ + \spec{JFLAG}{I}{status: $-$1 = $-$OK, 0~=~+OK, 1~=~null result, 2~=~error} +} +\notes +{ + \begin{enumerate} + \item The reason sla\_INTIN has separate `OK' status values + for + and $-$ is to enable minus zero to be detected. + This is of crucial importance + when decoding mixed-radix numbers. For example, an angle + expressed as degrees, arcminutes and arcseconds may have a + leading minus sign but a zero degrees field. + \item A TAB is interpreted as a space. {\it n.b.}\ The test for TAB is + ASCII-specific. + \item The basic format is the sequence of fields $\pm n$, + where $\pm$ is a sign + character `+' or `$-$', and $n$ means a string of decimal digits. + \item Spaces: + \begin{itemize} + \item Leading spaces are ignored. + \item Spaces between the sign and the number are allowed. + \item Trailing spaces are ignored; the first signifies + end of decoding and subsequent ones are skipped. + \end{itemize} + \item Delimiters: + \begin{itemize} + \item Any character other than +,$-$,0-9 or space may be + used to signal the end of the number and terminate decoding. + \item Comma is recognized by sla\_INTIN as a special case; it + is skipped, leaving the pointer on the next character. See + 9, below. + \item Decoding will in all cases terminate if end of string + is reached. + \end{itemize} + \item The sign is optional. The default is +. + \item A {\it null result}\/ occurs when the string of characters + being decoded does not begin with +,$-$ or 0-9, or + consists entirely of spaces. When this condition is + detected, JFLAG is set to 1 and IRESLT is left untouched. + \item NSTRT = 1 for the first character in the string. + \item On return from sla\_INTIN, NSTRT is set ready for the next + decode -- following trailing blanks and any comma. If a + delimiter other than comma is being used, NSTRT must be + incremented before the next call to sla\_INTIN, otherwise + all subsequent calls will return a null result. + \item Errors (JFLAG=2) occur when: + \begin{itemize} + \item there is a + or $-$ but no number; or + \item the number is greater than $2^{31}-1$. + \end{itemize} + \item When an error has been detected, NSTRT is left + pointing to the character following the last + one used before the error came to light. + \item See also sla\_FLOTIN and sla\_DFLTIN. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_INVF}{Invert Linear Model} +{ + \action{Invert a linear model of the type produced by the + sla\_FITXY routine.} + \call{CALL sla\_INVF (FWDS,BKWDS,J)} +} +\args{GIVEN} +{ + \spec{FWDS}{D(6)}{model coefficients} +} +\args{RETURNED} +{ + \spec{BKWDS}{D(6)}{inverse model} \\ + \spec{J}{I}{status: 0 = OK, $-$1 = no inverse} +} +\notes +{ + \begin{enumerate} + \item The models relate two sets of \xy\ coordinates as follows. + Naming the six elements of FWDS $a,b,c,d,e$ \& $f$, + where two sets of coordinates $[x_{1},y_{1}]$ and + $[x_{2},y_{2}\,]$ are related thus: + \begin{verse} + $x_{2} = a + bx_{1} + cy_{1}$ \\ + $y_{2} = d + ex_{1} + fy_{1}$ + \end{verse} + The present routine generates a new set of coefficients + $p,q,r,s,t$ \& $u$ (the array BKWDS) such that: + \begin{verse} + $x_{1} = p + qx_{2} + ry_{2}$ \\ + $y_{1} = s + tx_{2} + uy_{2}$ + \end{verse} + \item Two successive calls to this routine will deliver a set + of coefficients equal to the starting values. + \item To comply with the ANSI Fortran 77 standard, FWDS and BKWDS must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly with many Fortran compilers even + if this rule is violated, something that is {\bf not}, however, + recommended. + \item See also sla\_FITXY, sla\_PXY, sla\_XY2XY, sla\_DCMPF. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_KBJ}{Select Epoch Prefix} +{ + \action{Select epoch prefix `B' or `J'.} + \call{CALL sla\_KBJ (JB, E, K, J)} +} +\args{GIVEN} +{ + \spec{JB}{I}{sla\_DBJIN prefix status: 0=none, 1=`B', 2=`J'} \\ + \spec{E}{D}{epoch -- Besselian or Julian} +} +\args{RETURNED} +{ + \spec{K}{C}{`B' or `J'} \\ + \spec{J}{I}{status: 0=OK} +} +\anote{The routine is mainly intended for use in conjunction with the + sla\_DBJIN routine. If the value of JB indicates that an explicit + B or J prefix was detected by sla\_DBJIN, a `B' or `J' + is returned to match. If JB indicates that no explicit B or J + was supplied, the choice is made on the basis of the epoch + itself; B is assumed for E $<1984$, otherwise J.} +%----------------------------------------------------------------------- +\routine{SLA\_M2AV}{Rotation Matrix to Axial Vector} +{ + \action{From a rotation matrix, determine the corresponding axial vector + (single precision).} + \call{CALL sla\_M2AV (RMAT, AXVEC)} +} +\args{GIVEN} +{ + \spec{RMAT}{R(3,3)}{rotation matrix} +} +\args{RETURNED} +{ + \spec{AXVEC}{R(3)}{axial vector (radians)} +} +\notes +{ + \begin{enumerate} + \item A rotation matrix describes a rotation about some arbitrary axis, + called the Euler axis. The {\it axial vector} returned by + this routine has the same direction as the Euler axis, and its + magnitude is the amount of rotation in radians. + \item The magnitude and direction of the axial vector can be separated + by means of the routine sla\_VN. + \item The reference frame rotates clockwise as seen looking along + the axial vector from the origin. + \item If RMAT is null, so is the result. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MAP}{Mean to Apparent} +{ + \action{Transform star \radec\ from mean place to geocentric apparent. + The reference frames and time scales used are post IAU~1976.} + \call{CALL sla\_MAP (RM, DM, PR, PD, PX, RV, EQ, DATE, RA, DA)} +} +\args{GIVEN} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} \\ + \spec{PR,PD}{D}{proper motions: \radec\ changes per Julian year} \\ + \spec{PX}{D}{parallax (arcsec)} \\ + \spec{RV}{D}{radial velocity (km~s$^{-1}$, +ve if receding)} \\ + \spec{EQ}{D}{epoch and equinox of star data (Julian)} \\ + \spec{DATE}{D}{TDB for apparent place (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{RA,DA}{D}{apparent \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item EQ is the Julian epoch specifying both the reference + frame and the epoch of the position -- usually 2000. + For positions where the epoch and equinox are + different, use the routine sla\_PM to apply proper + motion corrections before using this routine. + \item The distinction between the required TDB and TT is + always negligible. Moreover, for all but the most + critical applications UTC is adequate. + \item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are per year rather than per century. + \item This routine may be wasteful for some applications + because it recomputes the Earth position/velocity and + the precession-nutation matrix each time, and because + it allows for parallax and proper motion. Where + multiple transformations are to be carried out for one + epoch, a faster method is to call the sla\_MAPPA routine + once and then either the sla\_MAPQK routine (which includes + parallax and proper motion) or sla\_MAPQKZ (which assumes + zero parallax and FK5 proper motion). + \item The accuracy, starting from ICRS star data, + is limited to about 1~mas by the + precession-nutation model used, SF2001. + A different precession-nutation model + can be introduced by using sla\_MAPPA and sla\_MAPQK (see + the previous note) and replacing the precession-nutation + matrix into the parameter array directly. + \item The accuracy is further limited by the routine sla\_EVP, called + by sla\_MAPPA, which computes the Earth position and + velocity using the methods of Stumpff. The maximum + error is about 0.3~milliarcsecond. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MAPPA}{Mean to Apparent Parameters} +{ + \action{Compute star-independent parameters in preparation for + conversions between mean place and geocentric apparent place. + The parameters produced by this routine are required in the + parallax, light deflection, aberration, and precession-nutation + parts of the mean/apparent transformations. + The reference frames and time scales used are post IAU~1976.} + \call{CALL sla\_MAPPA (EQ, DATE, AMPRMS)} +} +\args{GIVEN} +{ + \spec{EQ}{D}{epoch of mean equinox to be used (Julian)} \\ + \spec{DATE}{D}{TDB (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{AMPRMS}{D(21)}{star-independent mean-to-apparent parameters:} \\ + \specel {(1)} {time interval for proper motion (Julian years)} \\ + \specel {(2-4)} {barycentric position of the Earth (AU)} \\ + \specel {(5-7)} {heliocentric direction of the Earth (unit vector)} \\ + \specel {(8)} {(gravitational radius of + Sun)$\times 2 / $(Sun-Earth distance)} \\ + \specel {(9-11)} {{\bf v}: barycentric Earth velocity in units of c} \\ + \specel {(12)} {$\sqrt{1-\left|\mbox{\bf v}\right|^2}$} \\ + \specel {(13-21)} {precession-nutation $3\times3$ matrix} +} +\notes +{ + \begin{enumerate} + \item For DATE, the distinction between the required TDB and TT + is always negligible. Moreover, for all but the most + critical applications UTC is adequate. + \item The vectors AMPRMS(2-4) and AMPRMS(5-7) are + (in essence) referred to + the mean equinox and equator of epoch EQ. For + EQ=2000D0, they are referred to the ICRS. + \item The parameters produced by this routine are used by + sla\_MAPQK, sla\_MAPQKZ and sla\_AMPQK. + \item The accuracy, starting from ICRS star data, + is limited to about 1~mas by the precession-nutation + model used, SF2001. A different precession-nutation model + can be introduced by first calling the present routine + and then replacing the precession-nutation + matrix in AMPRMS(13-21) directly. + \item A further limit to the accuracy of routines using the + parameter array AMPRMS is + imposed by the routine sla\_EVP, used here to compute the + Earth position and velocity by the methods of Stumpff. + The maximum error in the resulting aberration corrections is + about 0.3 milliarcsecond. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MAPQK}{Quick Mean to Apparent} +{ + \action{Quick mean to apparent place: transform a star \radec\ from + mean place to geocentric apparent place, given the + star-independent parameters. The reference frames and + time scales used are post IAU~1976.} + \call{CALL sla\_MAPQK (RM, DM, PR, PD, PX, RV, AMPRMS, RA, DA)} +} +\args{GIVEN} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} \\ + \spec{PR,PD}{D}{proper motions: \radec\ changes per Julian year} \\ + \spec{PX}{D}{parallax (arcsec)} \\ + \spec{RV}{D}{radial velocity (km~s$^{-1}$, +ve if receding)} \\ + \spec{AMPRMS}{D(21)}{star-independent mean-to-apparent parameters:} \\ + \specel {(1)} {time interval for proper motion (Julian years)} \\ + \specel {(2-4)} {barycentric position of the Earth (AU)} \\ + \specel {(5-7)} {heliocentric direction of the Earth (unit vector)} \\ + \specel {(8)} {(gravitational radius of + Sun)$\times 2 / $(Sun-Earth distance)} \\ + \specel {(9-11)} {{\bf v}: barycentric Earth velocity in units of c} \\ + \specel {(12)} {$\sqrt{1-\left|\mbox{\bf v}\right|^2}$} \\ + \specel {(13-21)} {precession-nutation $3\times3$ matrix} +} +\args{RETURNED} +{ + \spec{RA,DA}{D }{apparent \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item Use of this routine is appropriate when efficiency is important + and where many star positions, all referred to the same equator + and equinox, are to be transformed for one epoch. The + star-independent parameters can be obtained by calling the + sla\_MAPPA routine. + \item If the parallax and proper motions are zero the sla\_MAPQKZ + routine can be used instead. + \item The vectors AMPRMS(2-4) and AMPRMS(5-7) are + (in essence) referred to + the mean equinox and equator of epoch EQ. For + EQ=2000D0, they are referred to the ICRS. + \item Strictly speaking, the routine is not valid for solar-system + sources, though the error will usually be extremely small. + However, to prevent gross errors in the case where the + position of the Sun is specified, the gravitational + deflection term is restrained within about \arcseci{920} of the + centre of the Sun's disc. The term has a maximum value of + about \arcsec{1}{85} at this radius, and decreases to zero as + the centre of the disc is approached. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MAPQKZ}{Quick Mean-Appt, no PM {\it etc.}} +{ + \action{Quick mean to apparent place: transform a star \radec\ from + mean place to geocentric apparent place, given the + star-independent parameters, and assuming zero parallax + and FK5 proper motion. + The reference frames and time scales used are post IAU~1976.} + \call{CALL sla\_MAPQKZ (RM, DM, AMPRMS, RA, DA)} +} +\args{GIVEN} +{ + \spec{RM,DM}{D}{mean \radec\ (radians)} \\ + \spec{AMPRMS}{D(21)}{star-independent mean-to-apparent parameters:} \\ + \specel {(1)} {time interval for proper motion (Julian years)} \\ + \specel {(2-4)} {barycentric position of the Earth (AU)} \\ + \specel {(5-7)} {heliocentric direction of the Earth (unit vector)} \\ + \specel {(8)} {(gravitational radius of + Sun)$\times 2 / $(Sun-Earth distance)} \\ + \specel {(9-11)} {{\bf v}: barycentric Earth velocity in units of c} \\ + \specel {(12)} {$\sqrt{1-\left|\mbox{\bf v}\right|^2}$} \\ + \specel {(13-21)} {precession-nutation $3\times3$ matrix} +} +\args{RETURNED} +{ + \spec{RA,DA}{D}{apparent \radec\ (radians)} +} +\notes +{ + \begin{enumerate} + \item Use of this routine is appropriate when efficiency is important + and where many star positions, all with parallax and proper + motion either zero or already allowed for, and all referred to + the same equator and equinox, are to be transformed for one + epoch. The star-independent parameters can be obtained by + calling the sla\_MAPPA routine. + \item The corresponding routine for the case of non-zero parallax + and FK5 proper motion is sla\_MAPQK. + \item The vectors AMPRMS(2-4) and AMPRMS(5-7) are + (in essence) referred to + the mean equinox and equator of epoch EQ. For + EQ=2000D0, they are referred to the ICRS. + \item Strictly speaking, the routine is not valid for solar-system + sources, though the error will usually be extremely small. + However, to prevent gross errors in the case where the + position of the Sun is specified, the gravitational + deflection term is restrained within about \arcseci{920} of the + centre of the Sun's disc. The term has a maximum value of + about \arcsec{1}{85} at this radius, and decreases to zero as + the centre of the disc is approached. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr.Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_MOON}{Approx Moon Pos/Vel} +{ + \action{Approximate geocentric position and velocity of the Moon + (single precision).} + \call{CALL sla\_MOON (IY, ID, FD, PV)} +} +\args{GIVEN} +{ + \spec{IY}{I}{year} \\ + \spec{ID}{I}{day in year (1 = Jan 1st)} \\ + \spec{FD}{R }{fraction of day} +} +\args{RETURNED} +{ + \spec{PV}{R(6)}{Moon \xyzxyzd, mean equator and equinox of + date (AU, AU~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item The date and time is TDB (loosely ET) in a Julian calendar + which has been aligned to the ordinary Gregorian + calendar for the interval 1900 March 1 to 2100 February 28. + The year and day can be obtained by calling sla\_CALYD or + sla\_CLYD. + \item The position is accurate to better than 0.5~arcminute + in direction and 1000~km in distance. The velocity + is accurate to better than \arcsec{0}{5} per hour in direction + and 4~metres per second in distance. (RMS figures with respect + to JPL DE200 for the interval 1960-2025 are \arcseci{14} and + \arcsec{0}{2} per hour in longitude, \arcseci{9} and \arcsec{0}{2} + per hour in latitude, 350~km and 2~metres per second in distance.) + Note that the distance accuracy is comparatively poor because this + routine is principally intended for computing topocentric direction. + \item This routine is only a partial implementation of the original + Meeus algorithm (reference below), which offers 4 times the + accuracy in direction and 20 times the accuracy in distance + when fully implemented (as it is in sla\_DMOON). + \end{enumerate} +} +\aref{Meeus, {\it l'Astronomie}, June 1984, p348.} +%----------------------------------------------------------------------- +\routine{SLA\_MXM}{Multiply $3\times3$ Matrices} +{ + \action{Product of two $3\times3$ matrices (single precision).} + \call{CALL sla\_MXM (A, B, C)} +} +\args{GIVEN} +{ + \spec{A}{R(3,3)}{matrix {\bf A}} \\ + \spec{B}{R(3,3)}{matrix {\bf B}} +} +\args{RETURNED} +{ + \spec{C}{R(3,3)}{matrix result: {\bf A}$\times${\bf B}} +} +\anote{To comply with the ANSI Fortran 77 standard, A, B and C must + be different arrays. The routine is, in fact, coded + so as to work properly with many Fortran compilers even + if this rule is violated, something that is {\bf not}, however, + recommended.} +%----------------------------------------------------------------------- +\routine{SLA\_MXV}{Apply 3D Rotation} +{ + \action{Multiply a 3-vector by a rotation matrix (single precision).} + \call{CALL sla\_MXV (RM, VA, VB)} +} +\args{GIVEN} +{ + \spec{RM}{R(3,3)}{rotation matrix} \\ + \spec{VA}{R(3)}{vector to be rotated} +} +\args{RETURNED} +{ + \spec{VB}{R(3)}{result vector} +} +\notes +{ + \begin{enumerate} + \item This routine performs the operation: + \begin{verse} + {\bf b} = {\bf M}$\cdot${\bf a} + \end{verse} + where {\bf a} and {\bf b} are the 3-vectors VA and VB + respectively, and {\bf M} is the $3\times3$ matrix RM. + \item The main function of this routine is apply a + rotation; under these circumstances, ${\bf M}$ is a + {\it proper real orthogonal}\/ matrix. + \item To comply with the ANSI Fortran 77 standard, VA and VB must + {\bf not} be the same array. The routine is, in fact, coded + so as to work properly with many Fortran compilers even + if this rule is violated, something that is {\bf not}, however, + recommended. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_NUT}{Nutation Matrix} +{ + \action{Form the matrix of nutation (SF2001 theory) for a given date.} + \call{CALL sla\_NUT (DATE, RMATN)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date + (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{RMATN}{D(3,3)}{nutation matrix} +} +\notes{ + \begin{enumerate} + \item The matrix is in the sense: + \begin{verse} + ${\bf v}_{true} = {\bf M}\times{\bf v}_{mean}$ + \end{verse} + where ${\bf v}_{true}$ is the star vector relative to the + true equator and equinox of date, {\bf M} is the + $3\times3$ matrix {\tt rmatn} and + ${\bf v}_{mean}$ is the star vector relative to the + mean equator and equinox of date. + \item The matrix represents forced nutation (but not free core nutation) + plus corrections to the IAU~1976 precession model. + \item Earth attitude predictions made by combining the present nutation + matrix with IAU~1976 precession are accurate to 1~mas (with respect + to the ICRS) for a few decades around 2000. + \item The distinction between the required TDB and TT is + always negligible. Moreover, for all but the most + critical applications UTC is adequate. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Kaplan, G.H., 1981.\ {\it USNO circular No.\ 163}, pA3-6. + \item Shirai, T. \& Fukushima, T., 2001, Astron.J., {\bf 121}, + 3270-3283. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_NUTC}{Nutation Components} +{ + \action{Nutation (SF2001 theory): longitude \& obliquity + components, and mean obliquity.} + \call{CALL sla\_NUTC (DATE, DPSI, DEPS, EPS0)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date + (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{DPSI,DEPS}{D}{nutation in longitude and obliquity (radians)} \\ + \spec{EPS0}{D}{mean obliquity (radians)} +} +\notes +{ + \begin{enumerate} + \item The routine predicts forced nutation (but not free core nutation) + plus corrections to the IAU~1976 precession model. + \item Earth attitude predictions made by combining the present nutation + model with IAU~1976 precession are accurate to 1~mas (with respect + to the ICRS) for a few decades around 2000. + \item The slaNutc80 routine is the equivalent of the present routine + but using the IAU 1980 nutation theory. The older theory is less + accurate, leading to errors as large as 350~mas over the interval + 1900-2100, mainly because of the error in the IAU~1976 precession. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Shirai, T. \& Fukushima, T., Astron.J.\ 121, 3270-3283 (2001). + \item Fukushima, T., Astron.Astrophys.\ 244, L11 (1991). + \item Simon, J. L., Bretagnon, P., Chapront, J., Chapront-Touze, M., + Francou, G. \& Laskar, J., Astron.Astrophys.\ 282, 663 (1994). + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_NUTC80}{Nutation Components, IAU 1980} +{ + \action{Nutation (IAU 1980 theory): longitude \& obliquity + components, and mean obliquity.} + \call{CALL sla\_NUTC80 (DATE, DPSI, DEPS, EPS0)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TDB (formerly ET) as Modified Julian Date + (JD$-$2400000.5)} +} +\args{RETURNED} +{ + \spec{DPSI,DEPS}{D}{nutation in longitude and obliquity (radians)} \\ + \spec{EPS0}{D}{mean obliquity (radians)} +} +\notes +{ + \begin{enumerate} + \item The IAU 1980 theory used in the present function has + errors as large as 350~mas over the interval + 1900-2100, mainly because of the error in the IAU~1976 + precession. For more accurate results, either the corrections + published in IERS {\it Bulletin~B}\/ + must be applied, or the + sla\_NUTC function can be used. The latter is based upon the + more recent SF2001 nutation theory and is of better + than 1\,mas accuracy. + \item The distinction between the required TDB and TT is + always negligible. Moreover, for all but the most + critical applications UTC is adequate. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Final report of the IAU Working Group on Nutation, + chairman P.K.Seidelmann, 1980. + \item Kaplan, G.H., 1981.\ {\it USNO circular no.\ 163}, pA3-6. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_OAP}{Observed to Apparent} +{ + \action{Observed to apparent place.} + \call{CALL sla\_OAP (\vtop{ + \hbox{TYPE, OB1, OB2, DATE, DUT, ELONGM, PHIM,} + \hbox{HM, XP, YP, TDK, PMB, RH, WL, TLR, RAP, DAP)}}} +} +\args{GIVEN} +{ + \spec{TYPE}{C*(*)}{type of coordinates -- `R', `H' or `A' (see below)} \\ + \spec{OB1}{D}{observed Az, HA or RA (radians; Az is N=0, E=$90^{\circ}$)} \\ + \spec{OB2}{D}{observed zenith distance or $\delta$ (radians)} \\ + \spec{DATE}{D }{UTC date/time (Modified Julian Date, JD$-$2400000.5)} \\ + \spec{DUT}{D}{$\Delta$UT: UT1$-$UTC (UTC seconds)} \\ + \spec{ELONGM}{D}{observer's mean longitude (radians, east +ve)} \\ + \spec{PHIM}{D}{observer's mean geodetic latitude (radians)} \\ + \spec{HM}{D}{observer's height above sea level (metres)} \\ + \spec{XP,YP}{D}{polar motion \xy\ coordinates (radians)} \\ + \spec{TDK}{D}{local ambient temperature (K; std=273.15D0)} \\ + \spec{PMB}{D}{local atmospheric pressure (mb; std=1013.25D0)} \\ + \spec{RH}{D}{local relative humidity (in the range 0D0\,--\,1D0)} \\ + \spec{WL}{D}{effective wavelength ($\mu{\rm m}$, {\it e.g.}\ 0.55D0)} \\ + \spec{TLR}{D}{tropospheric lapse rate (K per metre, + {\it e.g.}\ 0.0065D0)} +} +\args{RETURNED} +{ + \spec{RAP,DAP}{D}{geocentric apparent \radec} +} +\notes +{ + \begin{enumerate} + \item Only the first character of the TYPE argument is significant. + `R' or `r' indicates that OBS1 and OBS2 are the observed right + ascension and declination; `H' or `h' indicates that they are + hour angle (west +ve) and declination; anything else (`A' or + `a' is recommended) indicates that OBS1 and OBS2 are azimuth + (north zero, east $90^{\circ}$) and zenith distance. (Zenith + distance is used rather than elevation in order to reflect the + fact that no allowance is made for depression of the horizon.) + \item The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted azimuth and elevation should be within about + \arcsec{0}{1} for $\zeta<70^{\circ}$. Even + at a topocentric zenith distance of + $90^{\circ}$, the accuracy in elevation should be better than + 1~arcminute; useful results are available for a further + $3^{\circ}$, beyond which the sla\_REFRO routine returns a + fixed value of the refraction. The complementary + routines sla\_AOP (or sla\_AOPQK) and sla\_OAP (or sla\_OAPQK) + are self-consistent to better than 1~microarcsecond all over + the celestial sphere. + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item {\it Observed}\/ \azel\ means the position that would be seen by a + perfect theodolite located at the observer. This is + related to the observed \hadec\ via the standard rotation, using + the geodetic latitude (corrected for polar motion), while the + observed HA and RA are related simply through the local + apparent ST. {\it Observed}\/ \radec\ or \hadec\ thus means the + position that would be seen by a perfect equatorial located + at the observer and with its polar axis aligned to the + Earth's axis of rotation ({\it n.b.}\ not to the refracted pole). + By removing from the observed place the effects of + atmospheric refraction and diurnal aberration, the + geocentric apparent \radec\ is obtained. + \item Frequently, {\it mean}\/ rather than {\it apparent}\, + \radec\ will be required, + in which case further transformations will be necessary. The + sla\_AMP {\it etc.}\ routines will convert + the apparent \radec\ produced + by the present routine into an FK5 J2000 mean place, by + allowing for the Sun's gravitational lens effect, annual + aberration, nutation and precession. Should FK4 B1950 + coordinates be required, the routines sla\_FK524 {\it etc.}\ will also + have to be applied. + \item To convert to apparent \radec\ the coordinates read from a + real telescope, corrections would have to be applied for + encoder zero points, gear and encoder errors, tube flexure, + the position of the rotator axis and the pointing axis + relative to it, non-perpendicularity between the mounting + axes, and finally for the tilt of the azimuth or polar axis + of the mounting (with appropriate corrections for mount + flexures). Some telescopes would, of course, exhibit other + properties which would need to be accounted for at the + appropriate point in the sequence. + \item This routine takes time to execute, due mainly to the + rigorous integration used to evaluate the refraction. + For processing multiple stars for one location and time, + call sla\_AOPPA once followed by one call per star to sla\_OAPQK. + Where a range of times within a limited period of a few hours + is involved, and the highest precision is not required, call + sla\_AOPPA once, followed by a call to sla\_AOPPAT each time the + time changes, followed by one call per star to sla\_OAPQK. + \item The DATE argument is UTC expressed as an MJD. This is, + strictly speaking, wrong, because of leap seconds. However, + as long as the $\Delta$UT and the UTC are consistent there + are no difficulties, except during a leap second. In this + case, the start of the 61st second of the final minute should + begin a new MJD day and the old pre-leap $\Delta$UT should + continue to be used. As the 61st second completes, the MJD + should revert to the start of the day as, simultaneously, + the $\Delta$UT changes by one second to its post-leap new value. + \item The $\Delta$UT (UT1$-$UTC) is tabulated in IERS circulars and + elsewhere. It increases by exactly one second at the end of + each UTC leap second, introduced in order to keep $\Delta$UT + within $\pm$\tsec{0}{9}. + \item IMPORTANT -- TAKE CARE WITH THE LONGITUDE SIGN CONVENTION. The + longitude required by the present routine is {\bf east-positive}, + in accordance with geographical convention (and right-handed). + In particular, note that the longitudes returned by the + sla\_OBS routine are west-positive (as in the {\it Astronomical + Almanac}\/ before 1984) and must be reversed in sign before use + in the present routine. + \item The polar coordinates XP,YP can be obtained from IERS + circulars and equivalent publications. The + maximum amplitude is about \arcsec{0}{3}. If XP,YP values + are unavailable, use XP=YP=0D0. See page B60 of the 1988 + {\it Astronomical Almanac}\/ for a definition of the two angles. + \item The height above sea level of the observing station, HM, + can be obtained from the {\it Astronomical Almanac}\/ (Section J + in the 1988 edition), or via the routine sla\_OBS. If P, + the pressure in mb, is available, an adequate + estimate of HM can be obtained from the following expression: + \begin{quote} + {\tt HM=-29.3D0*TSL*LOG(P/1013.25D0)} + \end{quote} + where TSL is the approximate sea-level air temperature in K + (see {\it Astrophysical Quantities}, C.W.Allen, 3rd~edition, + \S 52). Similarly, if the pressure P is not known, + it can be estimated from the height of the observing + station, HM as follows: + \begin{quote} + {\tt P=1013.25D0*EXP(-HM/(29.3D0*TSL))} + \end{quote} + Note, however, that the refraction is nearly proportional to the + pressure and that an accurate P value is important for + precise work. + \item The azimuths {\it etc.}\ used by the present routine are with + respect to the celestial pole. Corrections from the terrestrial pole + can be computed using sla\_POLMO. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_OAPQK}{Quick Observed to Apparent} +{ + \action{Quick observed to apparent place.} + \call{CALL sla\_OAPQK (TYPE, OB1, OB2, AOPRMS, RAP, DAP)} +} +\args{GIVEN} +{ + \spec{TYPE}{C*(*)}{type of coordinates -- `R', `H' or `A' (see below)} \\ + \spec{OB1}{D}{observed Az, HA or RA (radians; Az is N=0, E=$90^{\circ}$)} \\ + \spec{OB2}{D}{observed zenith distance or $\delta$ (radians)} \\ + \spec{AOPRMS}{D(14)}{star-independent apparent-to-observed parameters:} \\ + \specel {(1)} {geodetic latitude (radians)} \\ + \specel {(2,3)} {sine and cosine of geodetic latitude} \\ + \specel {(4)} {magnitude of diurnal aberration vector} \\ + \specel {(5)} {height (HM)} \\ + \specel {(6)} {ambient temperature (TDK)} \\ + \specel {(7)} {pressure (PMB)} \\ + \specel {(8)} {relative humidity (RH)} \\ + \specel {(9)} {wavelength (WL)} \\ + \specel {(10)} {lapse rate (TLR)} \\ + \specel {(11,12)} {refraction constants A and B (radians)} \\ + \specel {(13)} {longitude + eqn of equinoxes + + ``sidereal $\Delta$UT'' (radians)} \\ + \specel {(14)} {local apparent sidereal time (radians)} +} +\args{RETURNED} +{ + \spec{RAP,DAP}{D}{geocentric apparent \radec} +} +\notes +{ + \begin{enumerate} + \item Only the first character of the TYPE argument is significant. + `R' or `r' indicates that OBS1 and OBS2 are the observed right + ascension and declination; `H' or `h' indicates that they are + hour angle (west +ve) and declination; anything else (`A' or + `a' is recommended) indicates that OBS1 and OBS2 are Azimuth + (north zero, east $90^{\circ}$) and zenith distance. (Zenith + distance is used rather than elevation in order to reflect the + fact that no allowance is made for depression of the horizon.) + \item The accuracy of the result is limited by the corrections for + refraction. Providing the meteorological parameters are + known accurately and there are no gross local effects, the + predicted azimuth and elevation should be within about + \arcsec{0}{1} for $\zeta<70^{\circ}$. Even + at a topocentric zenith distance of + $90^{\circ}$, the accuracy in elevation should be better than + 1~arcminute; useful results are available for a further + $3^{\circ}$, beyond which the sla\_REFRO routine returns a + fixed value of the refraction. The complementary + routines sla\_AOP (or sla\_AOPQK) and sla\_OAP (or sla\_OAPQK) + are self-consistent to better than 1~microarcsecond all over + the celestial sphere. + \item It is advisable to take great care with units, as even + unlikely values of the input parameters are accepted and + processed in accordance with the models used. + \item {\it Observed}\/ \azel\ means the position that would be seen by a + perfect theodolite located at the observer. This is + related to the observed \hadec\ via the standard rotation, using + the geodetic latitude (corrected for polar motion), while the + observed HA and RA are related simply through the local + apparent ST. {\it Observed}\/ \radec\ or \hadec\ thus means the + position that would be seen by a perfect equatorial located + at the observer and with its polar axis aligned to the + Earth's axis of rotation ({\it n.b.}\ not to the refracted pole). + By removing from the observed place the effects of + atmospheric refraction and diurnal aberration, the + geocentric apparent \radec\ is obtained. + \item Frequently, {\it mean}\/ rather than {\it apparent}\, + \radec\ will be required, + in which case further transformations will be necessary. The + sla\_AMP {\it etc.}\ routines will convert + the apparent \radec\ produced + by the present routine into an FK5 J2000 mean place, by + allowing for the Sun's gravitational lens effect, annual + aberration, nutation and precession. Should FK4 B1950 + coordinates be required, the routines sla\_FK524 {\it etc.}\ will also + have to be applied. + \item To convert to apparent \radec\ the coordinates read from a + real telescope, corrections would have to be applied for + encoder zero points, gear and encoder errors, tube flexure, + the position of the rotator axis and the pointing axis + relative to it, non-perpendicularity between the mounting + axes, and finally for the tilt of the azimuth or polar axis + of the mounting (with appropriate corrections for mount + flexures). Some telescopes would, of course, exhibit other + properties which would need to be accounted for at the + appropriate point in the sequence. + \item The star-independent apparent-to-observed-place parameters + in AOPRMS may be computed by means of the sla\_AOPPA routine. + If nothing has changed significantly except the time, the + sla\_AOPPAT routine may be used to perform the requisite + partial recomputation of AOPRMS. + \item The azimuths {\it etc.}\ used by the present routine are with + respect to the celestial pole. Corrections from the terrestrial pole + can be computed using sla\_POLMO. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_OBS}{Observatory Parameters} +{ + \action{Look up an entry in a standard list of + groundbased observing stations parameters.} + \call{CALL sla\_OBS (N, C, NAME, W, P, H)} +} +\args{GIVEN} +{ + \spec{N}{I}{number specifying observing station} +} +\args{GIVEN or RETURNED} +{ + \spec{C}{C*(*)}{identifier specifying observing station} +} +\args{RETURNED} +{ + \spec{NAME}{C*(*)}{name of specified observing station} \\ + \spec{W}{D}{longitude (radians, west +ve)} \\ + \spec{P}{D}{geodetic latitude (radians, north +ve)} \\ + \spec{H}{D}{height above sea level (metres)} +} +\notes +{ + \begin{enumerate} + \item Station identifiers C may be up to 10 characters long, + and station names NAME may be up to 40 characters long. + \item C and N are {\it alternative}\/ ways of specifying the observing + station. The C option, which is the most generally useful, + may be selected by specifying an N value of zero or less. + If N is 1 or more, the parameters of the Nth station + in the currently supported list are interrogated, and + the station identifier C is returned as well as NAME, W, + P and H. + \item If the station parameters are not available, either because + the station identifier C is not recognized, or because an + N value greater than the number of stations supported is + given, a name of `?' is returned and W, P and H are left in + their current states. + \item Programs can obtain a list of all currently supported + stations by calling the routine repeatedly, with N=1,2,3... + When NAME=`?' is seen, the list of stations has been + exhausted. The stations at the time of writing are listed + below. + \item Station numbers, identifiers, names and other details are + subject to change and should not be hardwired into + application programs. + \item All station identifiers C are uppercase only; lower case + characters must be converted to uppercase by the calling + program. The station names returned may contain both upper- + and lowercase. All characters up to the first space are + checked; thus an abbreviated ID will return the parameters + for the first station in the list which matches the + abbreviation supplied, and no station in the list will ever + contain embedded spaces. C must not have leading spaces. + \item IMPORTANT -- BEWARE OF THE LONGITUDE SIGN CONVENTION. The + longitude returned by sla\_OBS is + {\bf west-positive}, following the pre-1984 {\it Astronomical + Almanac}. However, this sign convention is left-handed and is + the opposite of the one now used; elsewhere in + SLALIB the preferable east-positive convention is used. In + particular, note that for use in sla\_AOP, sla\_AOPPA and + sla\_OAP the sign of the longitude must be reversed. + \item Users are urged to inform the author of any improvements + they would like to see made. For example: + \begin{itemize} + \item typographical corrections + \item more accurate parameters + \item better station identifiers or names + \item additional stations + \end{itemize} + \end{enumerate} +Stations supported by sla\_OBS at the time of writing: + +\begin{tabbing} +xxxxxxxxxxxxxxxxx \= \kill +{\it ID} \> {\it NAME} \\ \\ +AAT \> Anglo-Australian 3.9m Telescope \\ +ANU2.3 \> Siding Spring 2.3m \\ +APO3.5 \> Apache Point 3.5m \\ +ARECIBO \> Arecibo 1000 foot \\ +ATCA \> Australia Telescope Compact Array \\ +BLOEMF \> Bloemfontein 1.52m \\ +BOSQALEGRE \> Bosque Alegre 1.54m \\ +CAMB1MILE \> Cambridge 1 mile \\ +CAMB5KM \> Cambridge 5 km \\ +CATALINA61 \> Catalina 61 inch \\ +CFHT \> Canada-France-Hawaii 3.6m Telescope \\ +CSO \> Caltech Sub-mm Observatory, Mauna Kea \\ +DAO72 \> DAO Victoria BC 1.85m \\ +DUNLAP74 \> David Dunlap 74 inch \\ +DUPONT \> Du Pont 2.5m Telescope, Las Campanas \\ +EFFELSBERG \> Effelsberg 100m \\ +ESO3.6 \> ESO 3.6m \\ +ESONTT \> ESO 3.5m NTT \\ +ESOSCHM \> ESO 1m Schmidt, La Silla \\ +FCRAO \> Five College Radio Astronomy Obs \\ +FLAGSTF61 \> USNO 61 inch astrograph, Flagstaff \\ +GBVA140 \> Greenbank 140 foot \\ +GBVA300 \> Greenbank 300 foot \\ +GEMININ \> Gemini North 8m \\ +GEMINIS \> Gemini South 8m \\ +HARVARD \> Harvard College Observatory 1.55m \\ +HPROV1.52 \> Haute Provence 1.52m \\ +HPROV1.93 \> Haute Provence 1.93m \\ +IRTF \> NASA IR Telescope Facility, Mauna Kea \\ +JCMT \> JCMT 15m \\ +JODRELL1 \> Jodrell Bank 250 foot \\ +KECK1 \> Keck 10m Telescope 1 \\ +KECK2 \> Keck 10m Telescope 2 \\ +KISO \> Kiso 1.05m Schmidt, Japan \\ +KOSMA3M \> Cologne Submillimeter Observatory 3m \\ +KOTTAMIA \> Kottamia 74 inch \\ +KPNO158 \> Kitt Peak 158 inch \\ +KPNO36FT \> Kitt Peak 36 foot \\ +KPNO84 \> Kitt Peak 84 inch \\ +KPNO90 \> Kitt Peak 90 inch \\ +LICK120 \> Lick 120 inch \\ +LOWELL72 \> Perkins 72 inch, Lowell \\ +LPO1 \> Jacobus Kapteyn 1m Telescope \\ +LPO2.5 \> Isaac Newton 2.5m Telescope \\ +LPO4.2 \> William Herschel 4.2m Telescope \\ +MAGELLAN1 \> Magellan 1, 6.5m, Las Campanas \\ +MAGELLAN2 \> Magellan 2, 6.5m, Las Campanas \\ +MAUNAK88 \> Mauna Kea 88 inch \\ +MCDONLD2.1 \> McDonald 2.1m \\ +MCDONLD2.7 \> McDonald 2.7m \\ +MMT \> MMT, Mt Hopkins \\ +MOPRA \> ATNF Mopra Observatory \\ +MTEKAR \> Mt Ekar 1.82m \\ +MTHOP1.5 \> Mt Hopkins 1.5m \\ +MTLEMMON60 \> Mt Lemmon 60 inch \\ +NOBEYAMA \> Nobeyama 45m \\ +OKAYAMA \> Okayama 1.88m \\ +PALOMAR200 \> Palomar 200 inch \\ +PALOMAR48 \> Palomar 48-inch Schmidt \\ +PALOMAR60 \> Palomar 60 inch \\ +PARKES \> Parkes 64m \\ +QUEBEC1.6 \> Quebec 1.6m \\ +SAAO74 \> Sutherland 74 inch \\ +SANPM83 \> San Pedro Martir 83 inch \\ +ST.ANDREWS \> St Andrews University Observatory \\ +STEWARD90 \> Steward 90 inch \\ +STROMLO74 \> Mount Stromlo 74 inch \\ +SUBARU \> Subaru 8m \\ +SUGARGROVE \> Sugar Grove 150 foot \\ +TAUTNBG \> Tautenburg 2m \\ +TAUTSCHM \> Tautenberg 1.34m Schmidt \\ +TIDBINBLA \> Tidbinbilla 64m \\ +TOLOLO1.5M \> Cerro Tololo 1.5m \\ +TOLOLO4M \> Cerro Tololo 4m \\ +UKIRT \> UK Infra Red Telescope \\ +UKST \> UK 1.2m Schmidt, Siding Spring \\ +USSR6 \> USSR 6m \\ +USSR600 \> USSR 600 foot \\ +VLA \> Very Large Array \\ +VLT1 \> ESO VLT 8m, UT1 \\ +VLT2 \> ESO VLT 8m, UT2 \\ +VLT3 \> ESO VLT 8m, UT3 \\ +VLT4 \> ESO VLT 8m, UT4 +\end{tabbing} +} +%----------------------------------------------------------------------- +\routine{SLA\_PA}{$h,\delta$ to Parallactic Angle} +{ + \action{Hour angle and declination to parallactic angle + (double precision).} + \call{D~=~sla\_PA (HA, DEC, PHI)} +} +\args{GIVEN} +{ + \spec{HA}{D}{hour angle in radians (geocentric apparent)} \\ + \spec{DEC}{D}{declination in radians (geocentric apparent)} \\ + \spec{PHI}{D}{latitude in radians (geodetic)} +} +\args{RETURNED} +{ + \spec{sla\_PA}{D}{parallactic angle (radians, in the range $\pm \pi$)} +} +\notes +{ + \begin{enumerate} + \item The parallactic angle at a point in the sky is the position + angle of the vertical, {\it i.e.}\ the angle between the direction to + the pole and to the zenith. In precise applications care must + be taken only to use geocentric apparent \hadec\ and to consider + separately the effects of atmospheric refraction and telescope + mount errors. + \item At the pole a zero result is returned. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PAV}{Position-Angle Between Two Directions} +{ + \action{Returns the bearing (position angle) of one celestial + direction with respect to another (single precision).} + \call{R~=~sla\_PAV (V1, V2)} +} +\args{GIVEN} +{ + \spec{V1}{R(3)}{vector to one point} \\ + \spec{V2}{R(3)}{vector to the other point} +} +\args{RETURNED} +{ + \spec{sla\_PAV}{R}{position-angle of 2nd point with respect to 1st} +} +\notes +{ + \begin{enumerate} + \item The coordinate frames correspond to \radec, + $[\lambda,\phi]$ {\it etc.}. + \item The result is the bearing (position angle), in radians, + of point V2 as seen + from point V1. It is in the range $\pm \pi$. The sense + is such that if V2 + is a small distance due east of V1 the result + is about $+\pi/2$. Zero is returned + if the two points are coincident. + \item There is no requirement for either vector to be of unit length. + \item The routine sla\_BEAR performs an equivalent function except + that the points are specified in the form of spherical coordinates. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_PCD}{Apply Radial Distortion} +{ + \action{Apply pincushion/barrel distortion to a tangent-plane \xy.} + \call{CALL sla\_PCD (DISCO,X,Y)} +} +\args{GIVEN} +{ + \spec{DISCO}{D}{pincushion/barrel distortion coefficient} \\ + \spec{X,Y}{D}{tangent-plane \xy} +} +\args{RETURNED} +{ + \spec{X,Y}{D}{distorted \xy} +} +\notes +{ + \begin{enumerate} + \item The distortion is of the form $\rho = r (1 + c r^{2})$, where $r$ is + the radial distance from the tangent point, $c$ is the DISCO + argument, and $\rho$ is the radial distance in the presence of + the distortion. + \item For {\it pincushion}\/ distortion, C is +ve; for + {\it barrel}\/ distortion, C is $-$ve. + \item For X,Y in units of one projection radius (in the case of + a photographic plate, the focal length), the following + DISCO values apply: + + \vspace{2ex} + + \hspace{5em} + \begin{tabular}{|l|c|} \hline + Geometry & DISCO \\ \hline \hline + astrograph & 0.0 \\ \hline + Schmidt & $-$0.3333 \\ \hline + AAT PF doublet & +147.069 \\ \hline + AAT PF triplet & +178.585 \\ \hline + AAT f/8 & +21.20 \\ \hline + JKT f/8 & +14.6 \\ \hline + \end{tabular} + + \vspace{2ex} + + \item There is a companion routine, sla\_UNPCD, which performs the + inverse operation. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PDA2H}{H.A.\ for a Given Azimuth} +{ + \action{Hour Angle corresponding to a given azimuth (double precision).} + \call{CALL sla\_PDA2H (P, D, A, H1, J1, H2, J2)} +} +\args{GIVEN} +{ + \spec{P}{D}{latitude} \\ + \spec{D}{D}{declination} \\ + \spec{A}{D}{azimuth} +} +\args{RETURNED} +{ + \spec{H1}{D}{hour angle: first solution if any} \\ + \spec{J1}{I}{flag: 0 = solution 1 is valid} \\ + \spec{H2}{D}{hour angle: second solution if any} \\ + \spec{J2}{I}{flag: 0 = solution 2 is valid} +} +%----------------------------------------------------------------------- +\routine{SLA\_PDQ2H}{H.A.\ for a Given P.A.} +{ + \action{Hour Angle corresponding to a given parallactic angle + (double precision).} + \call{CALL sla\_PDQ2H (P, D, Q, H1, J1, H2, J2)} +} +\args{GIVEN} +{ + \spec{P}{D}{latitude} \\ + \spec{D}{D}{declination} \\ + \spec{Q}{D}{azimuth} +} +\args{RETURNED} +{ + \spec{H1}{D}{hour angle: first solution if any} \\ + \spec{J1}{I}{flag: 0 = solution 1 is valid} \\ + \spec{H2}{D}{hour angle: second solution if any} \\ + \spec{J2}{I}{flag: 0 = solution 2 is valid} +} +%----------------------------------------------------------------------- +\routine{SLA\_PERMUT}{Next Permutation} +{ + \action{Generate the next permutation of a specified number of items.} + \call{CALL sla\_PERMUT (N, ISTATE, IORDER, J)} +} +\args{GIVEN} +{ + \spec{N}{I}{number of items: there will be N! permutations} \\ + \spec{ISTATE}{I(N)}{state, ISTATE(1)$=-1$ to initialize} +} +\args{RETURNED} +{ + \spec{ISTATE}{I(N)}{state, updated ready for next time} \\ + \spec{IORDER}{I(N)}{next permutation of numbers 1,2,\ldots,N} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal N (zero or less is illegal)} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $+$1 = no more permutations available} +} +\notes +{ + \begin{enumerate} + \item This routine returns, in the IORDER array, the integers 1 to N + inclusive, in an order that depends on the current contents of + the ISTATE array. Before calling the routine for the first + time, the caller must set the first element of the ISTATE array + to $-1$ (any negative number will do) to cause the ISTATE array + to be fully initialized. + \item The first permutation to be generated is: + \begin{verse} + IORDER(1)=N, IORDER(2)=N-1, ..., IORDER(N)=1 + \end{verse} + This is also the permutation returned for the ``finished'' (J=1) case. + The final permutation to be generated is: + \begin{verse} + IORDER(1)=1, IORDER(2)=2, ..., IORDER(N)=N + \end{verse} + \item If the ``finished'' (J=1) status is ignored, the routine continues + to deliver permutations, the pattern repeating every~N!\,~calls. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_PERTEL}{Perturbed Orbital Elements} +{ + \action{Update the osculating elements of an asteroid or comet by + applying planetary perturbations.} + \call{CALL sla\_PERTEL (\vtop{ + \hbox{JFORM, DATE0, DATE1,} + \hbox{EPOCH0, ORBI0, ANODE0, PERIH0, AORQ0, E0, AM0,} + \hbox{EPOCH1, ORBI1, ANODE1, PERIH1, AORQ1, E1, AM1,} + \hbox{JSTAT)}}} +} +\args{GIVEN (format and dates)} +{ + \spec{JFORM}{I}{choice of element set (2 or 3; Note~1)} \\ + \spec{DATE0}{D}{date of osculation (TT MJD) for the given} \\ + \spec{}{}{\hspace{1.5em} elements} \\ + \spec{DATE1}{D}{date of osculation (TT MJD) for the updated} \\ + \spec{}{}{\hspace{1.5em} elements} +} +\args{GIVEN (the unperturbed elements)} +{ + \spec{EPOCH0}{D}{epoch of the given element set + ($t_0$ or $T$, TT MJD;} \\ + \spec{}{}{\hspace{1.5em} Note~2)} \\ + \spec{ORBI0}{D}{inclination ($i$, radians)} \\ + \spec{ANODE0}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH0}{D}{argument of perihelion + ($\omega$, radians)} \\ + \spec{AORQ0}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E0}{D}{eccentricity ($e$)} \\ + \spec{AM0}{D}{mean anomaly ($M$, radians, JFORM=2 only)} +} +\args{RETURNED (the updated elements)} +{ + \spec{EPOCH1}{D}{epoch of the updated element set + ($t_0$ or $T$,} \\ + \spec{}{}{\hspace{1.5em} TT MJD; Note~2)} \\ + \spec{ORBI1}{D}{inclination ($i$, radians)} \\ + \spec{ANODE1}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH1}{D}{argument of perihelion + ($\omega$, radians)} \\ + \spec{AORQ1}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E1}{D}{eccentricity ($e$)} \\ + \spec{AM1}{D}{mean anomaly ($M$, radians, JFORM=2 only)} +} +\args{RETURNED (status flag)} +{ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{0.5em}+102 = warning, distant epoch} \\ + \spec{}{}{\hspace{0.5em}+101 = warning, large timespan + ($>100$ years)} \\ + \spec{}{}{\hspace{-1.8em}+1 to +10 = coincident with major planet + (Note~6)} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = illegal JFORM} \\ + \spec{}{}{\hspace{1.2em} $-$2 = illegal E0} \\ + \spec{}{}{\hspace{1.2em} $-$3 = illegal AORQ0} \\ + \spec{}{}{\hspace{1.2em} $-$4 = internal error} \\ + \spec{}{}{\hspace{1.2em} $-$5 = numerical error} +} +\notes +{ + \begin{enumerate} + \item Two different element-format options are supported, as follows. \\ + + JFORM=2, suitable for minor planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e < 1 )$ \\ + & AORL & = & mean anomaly $M$ (radians) + \end{tabular} + + JFORM=3, suitable for comets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of perihelion $T$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & perihelion distance $q$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e \leq 10 )$ + \end{tabular} + + \item DATE0, DATE1, EPOCH0 and EPOCH1 are all instants of time in + the TT time scale (formerly Ephemeris Time, ET), expressed + as Modified Julian Dates (JD$-$2400000.5). + \begin{itemize} + \item DATE0 is the instant at which the given + ({\it i.e.}\ unperturbed) osculating elements are correct. + \item DATE1 is the specified instant at which the updated osculating + elements are correct. + \item EPOCH0 and EPOCH1 will be the same as DATE0 and DATE1 + (respectively) for the JFORM=2 case, normally used for minor + planets. For the JFORM=3 case, the two epochs will refer to + perihelion passage and so will not, in general, be the same as + DATE0 and/or DATE1 though they may be similar to one another. + \end{itemize} + \item The elements are with respect to the J2000 ecliptic and mean equinox. + \item Unused elements (AM0 and AM1 for JFORM=3) are not accessed. + \item See the sla\_PERTUE routine for details of the algorithm used. + \item This routine is not intended to be used for major planets, which + is why JFORM=1 is not available and why there is no opportunity + to specify either the longitude of perihelion or the daily + motion. However, if JFORM=2 elements are somehow obtained for a + major planet and supplied to the routine, sensible results will, + in fact, be produced. This happens because the sla\_PERTUE routine + that is called to perform the calculations checks the separation + between the body and each of the planets and interprets a + suspiciously small value (0.001~AU) as an attempt to apply it to + the planet concerned. If this condition is detected, the + contribution from that planet is ignored, and the status is set to + the planet number (1--10 = Mercury, Venus, EMB, Mars, Jupiter, + Saturn, Uranus, Neptune, Earth, Moon) as a warning. + \end{enumerate} +} +\aref{Sterne, Theodore E., {\it An Introduction to Celestial Mechanics,}\/ + Interscience Publishers, 1960. Section 6.7, p199.} +%------------------------------------------------------------------------------ +\routine{SLA\_PERTUE}{Perturbed Universal Elements} +{ + \action{Update the universal elements of an asteroid or comet by + applying planetary perturbations.} + \call{CALL sla\_PERTUE (DATE, U, JSTAT)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{final epoch (TT MJD) for the updated elements} +} +\args{GIVEN and RETURNED} +{ + \spec{U}{D(13)}{universal elements (updated in place)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v_0}$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, approx} +} +\args{RETURNED} +{ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{0.5em}+102 = warning, distant epoch} \\ + \spec{}{}{\hspace{0.5em}+101 = warning, large timespan + ($>100$ years)} \\ + \spec{}{}{\hspace{-1.8em}+1 to +10 = coincident with major planet + (Note~5)} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = numerical error} +} +\notes +{ + \begin{enumerate} + \setlength{\parskip}{\medskipamount} + \item The ``universal'' elements are those which define the orbit for the + purposes of the method of universal variables (see reference 2). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + + \item The universal elements are with respect to the J2000 equator and + equinox. + + \item The epochs DATE, U(3) and U(12) are all Modified Julian Dates + (JD$-$2400000.5). + + \item The algorithm is a simplified form of Encke's method. It takes as + a basis the unperturbed motion of the body, and numerically + integrates the perturbing accelerations from the major planets. + The expression used is essentially Sterne's 6.7-2 (reference 1). + Everhart \& Pitkin (reference 2) suggest rectifying the orbit at + each integration step by propagating the new perturbed position + and velocity as the new universal variables. In the present + routine the orbit is rectified less frequently than this, in order + to gain a slight speed advantage. However, the rectification is + done directly in terms of position and velocity, as suggested by + Everhart \& Pitkin, bypassing the use of conventional orbital + elements. + + The $f(q)$ part of the full Encke method is not used. The purpose + of this part is to avoid subtracting two nearly equal quantities + when calculating the ``indirect member'', which takes account of the + small change in the Sun's attraction due to the slightly displaced + position of the perturbed body. A simpler, direct calculation in + double precision proves to be faster and not significantly less + accurate. + + Apart from employing a variable timestep, and occasionally + ``rectifying the orbit'' to keep the indirect member small, the + integration is done in a fairly straightforward way. The + acceleration estimated for the middle of the timestep is assumed + to apply throughout that timestep; it is also used in the + extrapolation of the perturbations to the middle of the next + timestep, to predict the new disturbed position. There is no + iteration within a timestep. + + Measures are taken to reach a compromise between execution time + and accuracy. The starting-point is the goal of achieving + arcsecond accuracy for ordinary minor planets over a ten-year + timespan. This goal dictates how large the timesteps can be, + which in turn dictates how frequently the unperturbed motion has + to be recalculated from the osculating elements. + + Within predetermined limits, the timestep for the numerical + integration is varied in length in inverse proportion to the + magnitude of the net acceleration on the body from the major + planets. + + The numerical integration requires estimates of the major-planet + motions. Approximate positions for the major planets (Pluto + alone is omitted) are obtained from the routine sla\_PLANET. Two + levels of interpolation are used, to enhance speed without + significantly degrading accuracy. At a low frequency, the routine + sla\_PLANET is called to generate updated position+velocity ``state + vectors''. The only task remaining to be carried out at the full + frequency ({\it i.e.}\ at each integration step) is to use the state + vectors to extrapolate the planetary positions. In place of a + strictly linear extrapolation, some allowance is made for the + curvature of the orbit by scaling back the radius vector as the + linear extrapolation goes off at a tangent. + + Various other approximations are made. For example, perturbations + by Pluto and the minor planets are neglected and relativistic + effects are not taken into account. + + In the interests of simplicity, the background calculations for + the major planets are carried out {\it en masse.} + The mean elements and + state vectors for all the planets are refreshed at the same time, + without regard for orbit curvature, mass or proximity. + + The Earth-Moon system is treated as a single body when the body is + distant but as separate bodies when closer to the EMB than the + parameter RNE, which incurs a time penalty but improves accuracy + for near-Earth objects. + + \item This routine is not intended to be used for major planets. + However, if major-planet elements are supplied, sensible results + will, in fact, be produced. This happens because the routine + checks the separation between the body and each of the planets and + interprets a suspiciously small value (0.001~AU) as an attempt to + apply the routine to the planet concerned. If this condition + is detected, the + contribution from that planet is ignored, and the status is set to + the planet number (1--10 = Mercury, Venus, EMB, + Mars, Jupiter, Saturn, Uranus, Neptune, Earth, Moon) as a warning. + \end{enumerate} +} +\refs{ + \begin{enumerate} + \item Sterne, Theodore E., {\it An Introduction to Celestial Mechanics,}\/ + Interscience Publishers, 1960. Section 6.7, p199. + \item Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PLANEL}{Planet Position from Elements} +{ + \action{Heliocentric position and velocity of a planet, + asteroid or comet, starting from orbital elements.} + \call{CALL sla\_PLANEL (\vtop{ + \hbox{DATE, JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, PV, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TT MJD of observation (JD$-$2400000.5,} \\ + \spec{}{}{\hspace{1.5em} Note~1)} \\ + \spec{JFORM}{I}{choice of element set (1-3, Note~3)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD, Note~4)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude + ($M$ or $L$, radians,} \\ + \spec{}{}{\hspace{1.5em} JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal JFORM} \\ + \spec{}{}{\hspace{1.5em} $-$2 = illegal E} \\ + \spec{}{}{\hspace{1.5em} $-$3 = illegal AORQ} \\ + \spec{}{}{\hspace{1.5em} $-$4 = illegal DM} \\ + \spec{}{}{\hspace{1.5em} $-$5 = numerical error} +} +\notes +{ + \begin{enumerate} + \item DATE is the instant for which the prediction is required. It is + in the TT time scale (formerly Ephemeris Time, ET) and is a + Modified Julian Date (JD$-$2400000.5). + \item The elements are with respect to the J2000 ecliptic and equinox. + \item A choice of three different element-format options is available, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & longitude of perihelion $\varpi$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ \\ + & AORL & = & mean longitude $L$ (radians) \\ + & DM & = & daily motion $n$ (radians) + \end{tabular} + + JFORM=2, suitable for minor planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ \\ + & AORL & = & mean anomaly $M$ (radians) + \end{tabular} + + JFORM=3, suitable for comets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of perihelion $T$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & perihelion distance $q$ (AU) \\ + & E & = & eccentricity $e$ + \end{tabular} + + Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are + not accessed. + + \item Each of the three element sets defines an unperturbed heliocentric + orbit. For a given epoch of observation, the position of the body + in its orbit can be predicted from these elements, which are + called {\it osculating elements,}\/ + using standard two-body analytical + solutions. However, due to planetary perturbations, a given set + of osculating elements remains usable for only as long as the + unperturbed orbit that it describes is an adequate approximation + to reality. Attached to such a set of elements is a date called + the {\it osculating epoch,}\/ + at which the elements are, momentarily, + a perfect representation of the instantaneous position and + velocity of the body. + + \vspace{1ex} + + Therefore, for any given problem there are up to three different + epochs in play, and it is vital to distinguish clearly between + them: + \begin{itemize} + \item The epoch of observation: the moment in time for which the + position of the body is to be predicted. + \item The epoch defining the position of the body: the moment + in time at which, in the absence of purturbations, the + specified position---mean longitude, mean anomaly, or + perihelion---is reached. + \item The osculating epoch: the moment in time at which the + given elements are correct. + \end{itemize} + For the major-planet and minor-planet cases it is usual to make + the epoch that defines the position of the body the same as the + epoch of osculation. Thus, only two different epochs are + involved: the epoch of the elements and the epoch of observation. + For comets, the epoch of perihelion fixes the position in the + orbit and in general a different epoch of osculation will be + chosen. Thus, all three types of epoch are involved. + + \vspace{1ex} + + \goodbreak + For the present routine: + \begin{itemize} + \item The epoch of observation is the argument DATE. + \item The epoch defining the position of the body is the argument + EPOCH. + \item The osculating epoch is not used and is assumed to be + close enough to the epoch of observation to deliver + adequate accuracy. If not, a preliminary call to + sla\_PERTEL may be used to update the element-set (and + its associated osculating epoch) by + applying planetary perturbations. + \end{itemize} + \item The reference frame for the result is equatorial and is with + respect to the mean equinox and ecliptic of epoch J2000. + \item The algorithm was originally adapted from the EPHSLA program of + D.\,H.\,P.\,Jones (private communication, 1996). The method + is based on Stumpff's Universal Variables. + \end{enumerate} +} +\aref{Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983.} +%------------------------------------------------------------------------------ +\routine{SLA\_PLANET}{Planetary Ephemerides} +{ + \action{Approximate heliocentric position and velocity of a planet.} + \call{CALL sla\_PLANET (DATE, NP, PV, JSTAT)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{Modified Julian Date (JD$-$2400000.5)} \\ + \spec{NP}{I}{planet:} \\ + \spec{}{}{\hspace{1.5em} 1\,=\,Mercury} \\ + \spec{}{}{\hspace{1.5em} 2\,=\,Venus} \\ + \spec{}{}{\hspace{1.5em} 3\,=\,Earth-Moon Barycentre} \\ + \spec{}{}{\hspace{1.5em} 4\,=\,Mars} \\ + \spec{}{}{\hspace{1.5em} 5\,=\,Jupiter} \\ + \spec{}{}{\hspace{1.5em} 6\,=\,Saturn} \\ + \spec{}{}{\hspace{1.5em} 7\,=\,Uranus} \\ + \spec{}{}{\hspace{1.5em} 8\,=\,Neptune} \\ + \spec{}{}{\hspace{1.5em} 9\,=\,Pluto} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} $+$1 = warning: date outside of range} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal NP (outside 1-9)} \\ + \spec{}{}{\hspace{1.5em} $-$2 = solution didn't converge} +} +\notes +{ + \begin{enumerate} + \item The epoch, DATE, is in the TDB time scale and is in the form + of a Modified Julian Date (JD$-$2400000.5). + \item The reference frame is equatorial and is with respect to + the mean equinox and ecliptic of epoch J2000. + \item If a planet number, NP, outside the range 1-9 is supplied, an error + status is returned (JSTAT~=~$-1$) and the PV vector + is set to zeroes. + \item The algorithm for obtaining the mean elements of the + planets from Mercury to Neptune is due to + J.\,L.\,Simon, P.\,Bretagnon, J.\,Chapront, + M.\,Chapront-Touze, G.\,Francou and J.\,Laskar (Bureau des + Longitudes, Paris, France). The (completely different) + algorithm for calculating the ecliptic coordinates of + Pluto is by Meeus. + \item Comparisons of the present routine with the JPL DE200 ephemeris + give the following RMS errors over the interval 1960-2025: + + \begin{tabular}{llll} + & & {\it position (km)} & {\it speed (metre/sec)} \\ \\ + & Mercury & \hspace{2em}334 & \hspace{2.5em}0.437 \\ + & Venus & \hspace{1.5em}1060 & \hspace{2.5em}0.855 \\ + & EMB & \hspace{1.5em}2010 & \hspace{2.5em}0.815 \\ + & Mars & \hspace{1.5em}7690 & \hspace{2.5em}1.98 \\ + & Jupiter & \hspace{1em}71700 & \hspace{2.5em}7.70 \\ + & Saturn & \hspace{0.5em}199000 & \hspace{2em}19.4 \\ + & Uranus & \hspace{0.5em}564000 & \hspace{2em}16.4 \\ + & Neptune & \hspace{0.5em}158000 & \hspace{2em}14.4 \\ + & Pluto & \hspace{1em}36400 & \hspace{2.5em}0.137 + \end{tabular} + + From comparisons with DE102, Simon {\it et al.}\/ quote the following + longitude accuracies over the interval 1800-2200: + + \begin{tabular}{lll} + & Mercury & \hspace{0.5em}\arcseci{4} \\ + & Venus & \hspace{0.5em}\arcseci{5} \\ + & EMB & \hspace{0.5em}\arcseci{6} \\ + & Mars & \arcseci{17} \\ + & Jupiter & \arcseci{71} \\ + & Saturn & \arcseci{81} \\ + & Uranus & \arcseci{86} \\ + & Neptune & \arcseci{11} + \end{tabular} + + In the case of Pluto, Meeus quotes an accuracy of \arcsec{0}{6} + in longitude and \arcsec{0}{2} in latitude for the period + 1885-2099. + + For all except Pluto, over the period 1000-3000, + the accuracy is better than 1.5 + times that over 1800-2200. Outside the interval 1000-3000 the + accuracy declines. For Pluto the accuracy declines rapidly + outside the period 1885-2099. Outside these ranges + (1885-2099 for Pluto, 1000-3000 for the rest) a ``date out + of range'' warning status ({\tt JSTAT=+1}) is returned. + \item The algorithms for (i)~Mercury through Neptune and + (ii)~Pluto are completely independent. In the Mercury + through Neptune case, the present SLALIB + implementation differs from the original + Simon {\it et al.}\/ Fortran code in the following respects: + \begin{itemize} + \item The date is supplied as a Modified Julian Date rather + a Julian Date (${\rm MJD} = ({\rm JD} - 2400000.5$). + \item The result is returned only in equatorial + Cartesian form; the ecliptic + longitude, latitude and radius vector are not returned. + \item The velocity is in AU per second, not AU per day. + \item Different error/warning status values are used. + \item Kepler's Equation is not solved inline. + \item Polynomials in T are nested to minimize rounding errors. + \item Explicit double-precision constants are used to avoid + mixed-mode expressions. + \item There are other, cosmetic, changes to comply with + Starlink/SLALIB style guidelines. + \end{itemize} + None of the above changes affects the result significantly. + \item For NP\,=\,3 the result is for the Earth-Moon Barycentre. To + obtain the heliocentric position and velocity of the Earth, + either use the SLALIB routine sla\_EVP (or sla\_EPV) + or call sla\_DMOON and + subtract 0.012150581 times the geocentric Moon vector from + the EMB vector produced by the present routine. (The Moon + vector should be precessed to J2000 first, but this can + be omitted for modern epochs without introducing significant + inaccuracy.) + \end{enumerate} +\refs +{ + \begin{enumerate} + \item Simon {\it et al.,}\/ + Astron.\ Astrophys.\ {\bf 282}, 663 (1994). + \item Meeus, J., + {\it Astronomical Algorithms,}\/ Willmann-Bell (1991). + \end{enumerate} +} +} +%------------------------------------------------------------------------------ +\routine{SLA\_PLANTE}{\radec\ of Planet from Elements} +{ + \action{Topocentric apparent \radec\ of a Solar-System object whose + heliocentric orbital elements are known.} + \call{CALL sla\_PLANTE (\vtop{ + \hbox{DATE, ELONG, PHI, JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, RA, DEC, R, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TT MJD of observation (JD$-$2400000.5,} \\ + \spec{}{}{\hspace{1.5em} Notes~1,5)} \\ + \spec{ELONG,PHI}{D}{observer's longitude (east +ve) and latitude} \\ + \spec{}{}{\hspace{1.5em} (radians, Note~2)} \\ + \spec{JFORM}{I}{choice of element set (1-3, Notes~3-6)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD, Note~5)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude ($M$ or $L$, radians,} \\ + \spec{}{}{\hspace{1.5em} JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} +} +\args{RETURNED} +{ + \spec{RA,DEC}{D}{topocentric apparent \radec\ (radians)} \\ + \spec{R}{D}{distance from observer (AU)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal JFORM} \\ + \spec{}{}{\hspace{1.5em} $-$2 = illegal E} \\ + \spec{}{}{\hspace{1.5em} $-$3 = illegal AORQ} \\ + \spec{}{}{\hspace{1.5em} $-$4 = illegal DM} \\ + \spec{}{}{\hspace{1.5em} $-$5 = numerical error} +} +\notes +{ + \begin{enumerate} + \item DATE is the instant for which the prediction is + required. It is in the TT time scale (formerly + Ephemeris Time, ET) and is a + Modified Julian Date (JD$-$2400000.5). + \item The longitude and latitude allow correction for geocentric + parallax. This is usually a small effect, but can become + important for near-Earth asteroids. Geocentric positions + can be generated by appropriate use of the routines + sla\_EVP (or sla\_EPV) and sla\_PLANEL. + \item The elements are with respect to the J2000 ecliptic and equinox. + \item A choice of three different element-format options is available, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & longitude of perihelion $\varpi$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ \\ + & AORL & = & mean longitude $L$ (radians) \\ + & DM & = & daily motion $n$ (radians) + \end{tabular} + + JFORM=2, suitable for minor planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ \\ + & AORL & = & mean anomaly $M$ (radians) + \end{tabular} + + JFORM=3, suitable for comets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of perihelion $T$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & perihelion distance $q$ (AU) \\ + & E & = & eccentricity $e$ + \end{tabular} + + Unused elements (DM for JFORM=2, AORL and DM for JFORM=3) are + not accessed. + + \item Each of the three element sets defines an unperturbed heliocentric + orbit. For a given epoch of observation, the position of the body + in its orbit can be predicted from these elements, which are + called {\it osculating elements,}\/ + using standard two-body analytical + solutions. However, due to planetary perturbations, a given set + of osculating elements remains usable for only as long as the + unperturbed orbit that it describes is an adequate approximation + to reality. Attached to such a set of elements is a date called + the {\it osculating epoch,}\/ + at which the elements are, momentarily, + a perfect representation of the instantaneous position and + velocity of the body. + + \vspace{1ex} + + Therefore, for any given problem there are up to three different + epochs in play, and it is vital to distinguish clearly between + them: + \begin{itemize} + \item The epoch of observation: the moment in time for which the + position of the body is to be predicted. + \item The epoch defining the position of the body: the moment + in time at which, in the absence of purturbations, the + specified position---mean longitude, mean anomaly, or + perihelion---is reached. + \item The osculating epoch: the moment in time at which the + given elements are correct. + \end{itemize} + For the major-planet and minor-planet cases it is usual to make + the epoch that defines the position of the body the same as the + epoch of osculation. Thus, only two different epochs are + involved: the epoch of the elements and the epoch of observation. + For comets, the epoch of perihelion fixes the position in the + orbit and in general a different epoch of osculation will be + chosen. Thus, all three types of epoch are involved. + + \vspace{1ex} + + \goodbreak + For the present routine: + \begin{itemize} + \item The epoch of observation is the argument DATE. + \item The epoch defining the position of the body is the argument + EPOCH. + \item The osculating epoch is not used and is assumed to be + close enough to the epoch of observation to deliver + adequate accuracy. If not, a preliminary call to + sla\_PERTEL may be used to update the element-set (and + its associated osculating epoch) by + applying planetary perturbations. + \end{itemize} + \item Two important sources for orbital elements are {\it Horizons,}\/ + operated by the Jet Propulsion Laboratory, Pasadena, + and the {\it Minor Planet Center,}\/ operated by the Center for + Astrophysics, Harvard. For further details, see Section~\ref{ephem}. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_PLANTU}{\radec\ from Universal Elements} +{ + \action{Topocentric apparent \radec\ of a Solar-System object whose + heliocentric universal orbital elements are known.} + \call{CALL sla\_PLANTU (DATE, ELONG, PHI, U, RA, DEC, R, JSTAT)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{TT MJD of observation (JD$-$2400000.5)} \\ + \spec{ELONG,PHI}{D}{observer's longitude (east +ve) and latitude} \\ + \spec{}{}{\hspace{1.5em} radians)} +} +\args{GIVEN and RETURNED} +{ + \spec{U}{D(13)}{universal orbital elements} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v_0}$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, approx} +} +\args{RETURNED} +{ + \spec{RA,DEC}{D}{topocentric apparent \radec\ (radians)} \\ + \spec{R}{D}{distance from observer (AU)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = radius vector zero} \\ + \spec{}{}{\hspace{1.5em} $-$2 = failed to converge} +} +\notes +{ + \begin{enumerate} + \item DATE is the instant for which the prediction is + required. It is in the TT time scale (formerly + Ephemeris Time, ET) and is a + Modified Julian Date (JD$-$2400000.5). + \item The longitude and latitude allow correction for geocentric + parallax. This is usually a small effect, but can become + important for near-Earth asteroids. Geocentric positions + can be generated by appropriate use of the routines + sla\_EVP (or sla\_EPV) and sla\_UE2PV. + \item The ``universal'' elements are those which define the orbit for the + purposes of the method of universal variables (see reference 2). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \item The universal elements are with respect to the J2000 ecliptic + and equinox. + \end{enumerate} +} +\refs{ + \begin{enumerate} + \item Sterne, Theodore E., {\it An Introduction to Celestial Mechanics,}\/ + Interscience Publishers, 1960. Section 6.7, p199. + \item Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983. + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_PM}{Proper Motion} +{ + \action{Apply corrections for proper motion to a star \radec.} + \call{CALL sla\_PM (R0, D0, PR, PD, PX, RV, EP0, EP1, R1, D1)} +} +\args{GIVEN} +{ + \spec{R0,D0}{D}{\radec\ at epoch EP0 (radians)} \\ + \spec{PR,PD}{D}{proper motions: rate of change of + \radec\ (radians per year)} \\ + \spec{PX}{D}{parallax (arcsec)} \\ + \spec{RV}{D}{radial velocity (km~s$^{-1}$, +ve if receding)} \\ + \spec{EP0}{D}{start epoch in years ({\it e.g.}\ Julian epoch)} \\ + \spec{EP1}{D}{end epoch in years (same system as EP0)} +} +\args{RETURNED} +{ + \spec{R1,D1}{D}{\radec\ at epoch EP1 (radians)} +} +\notes +{ +\begin{enumerate} +\item The $\alpha$ proper motions are $\dot{\alpha}$ rather than + $\dot{\alpha}\cos\delta$, and are in the same coordinate + system as R0,D0. +\item If the available proper motions are pre-FK5 they will be per + tropical year rather than per Julian year, and so the epochs + must both be Besselian rather than Julian. In such cases, a + scaling factor of 365.2422D0/365.25D0 should be applied to the + radial velocity before use also. +\end{enumerate} +} +\refs +{ + \begin{enumerate} + \item 1984 {\it Astronomical Almanac}, pp B39-B41. + \item Lederle \& Schwan, 1984.\ {\it Astr. Astrophys.}\ {\bf 134}, 1-6. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_POLMO}{Polar Motion} +{ + \action{Polar motion: correct site longitude and latitude for polar + motion and calculate azimuth difference between celestial and + terrestrial poles.} + \call{CALL sla\_POLMO (ELONGM, PHIM, XP, YP, ELONG, PHI, DAZ)} +} +\args{GIVEN} +{ + \spec{ELONGM}{D}{mean longitude of the site (radians, east +ve)} \\ + \spec{PHIM}{D}{mean geodetic latitude of the site (radians)} \\ + \spec{XP}{D}{polar motion $x$-coordinate (radians)} \\ + \spec{YP}{D}{polar motion $y$-coordinate (radians)} +} +\args{RETURNED} +{ + \spec{ELONG}{D}{true longitude of the site (radians, east +ve)} \\ + \spec{PHI}{D}{true geodetic latitude of the site (radians)} \\ + \spec{DAZ}{D}{azimuth correction (terrestrial$-$celestial, radians)} +} +\notes +{ +\begin{enumerate} +\item ``Mean'' longitude and latitude are the (fixed) values for the + site's location with respect to the IERS terrestrial reference + frame; the latitude is geodetic. TAKE CARE WITH THE LONGITUDE + SIGN CONVENTION. The longitudes used by the present routine + are east-positive, in accordance with geographical convention + (and right-handed). In particular, note that the longitudes + returned by the sla\_OBS routine are west-positive, following + astronomical usage, and must be reversed in sign before use in + the present routine. +\item XP and YP are the (changing) coordinates of the Celestial + Ephemeris Pole with respect to the IERS Reference Pole. + XP is positive along the meridian at longitude $0^\circ$, + and YP is positive along the meridian at longitude + $270^\circ$ ({\it i.e.}\ $90^\circ$ west). Values for XP,YP can + be obtained from IERS circulars and equivalent publications; + the maximum amplitude observed so far is about \arcsec{0}{3}. +\item ``True'' longitude and latitude are the (moving) values for + the site's location with respect to the celestial ephemeris + pole and the meridian which corresponds to the Greenwich + apparent sidereal time. The true longitude and latitude + link the terrestrial coordinates with the standard celestial + models (for precession, nutation, sidereal time {\it etc}). +\item The azimuths produced by sla\_AOP and sla\_AOPQK are with + respect to due north as defined by the Celestial Ephemeris + Pole, and can therefore be called ``celestial azimuths''. + However, a telescope fixed to the Earth measures azimuth + essentially with respect to due north as defined by the + IERS Reference Pole, and can therefore be called ``terrestrial + azimuth''. Uncorrected, this would manifest itself as a + changing ``azimuth zero-point error''. The value DAZ is the + correction to be added to a celestial azimuth to produce + a terrestrial azimuth. +\item The present routine is rigorous. For most practical + purposes, the following simplified formulae provide an + adequate approximation: \\[2ex] + \hspace*{1em}\begin{tabular}{lll} + {\tt ELONG} & {\tt =} & + {\tt ELONGM+XP*COS(ELONGM)-YP*SIN(ELONGM)} \\ + {\tt PHI } & {\tt =} & + {\tt PHIM+(XP*SIN(ELONGM)+YP*COS(ELONGM))*TAN(PHIM)} \\ + {\tt DAZ } & {\tt =} & + {\tt -SQRT(XP*XP+YP*YP)*COS(ELONGM-ATAN2(XP,YP))/COS(PHIM)} \\ + \end{tabular} \\[2ex] + An alternative formulation for DAZ is:\\[2ex] + \hspace*{1em}\begin{tabular}{lll} + {\tt X } & {\tt =} & {\tt COS(ELONGM)*COS(PHIM)} \\ + {\tt Y } & {\tt =} & {\tt SIN(ELONGM)*COS(PHIM)} \\ + {\tt DAZ} & {\tt =} & {\tt ATAN2(-X*YP-Y*XP,X*X+Y*Y)} \\ + \end{tabular} +\end{enumerate} +} +\aref{Seidelmann, P.K.\ (ed), 1992. {\it Explanatory + Supplement to the Astronomical Almanac,}\/ ISBN~0-935702-68-7, + sections 3.27, 4.25, 4.52.} +%----------------------------------------------------------------------- +\routine{SLA\_PREBN}{Precession Matrix (FK4)} +{ + \action{Generate the matrix of precession between two epochs, + using the old, pre IAU~1976, Bessel-Newcomb model, in + Andoyer's formulation.} + \call{CALL sla\_PREBN (BEP0, BEP1, RMATP)} +} +\args{GIVEN} +{ + \spec{BEP0}{D}{beginning Besselian epoch} \\ + \spec{BEP1}{D}{ending Besselian epoch} +} +\args{RETURNED} +{ + \spec{RMATP}{D(3,3)}{precession matrix} +} +\anote{The matrix is in the sense: + \begin{verse} + {\bf v}$_{1}$ = {\bf M}$\cdot${\bf v}$_{0}$ + \end{verse} + where {\bf v}$_{1}$ is the star vector relative to the + mean equator and equinox of epoch BEP1, {\bf M} is the + $3\times3$ matrix RMATP and + {\bf v}$_{0}$ is the star vector relative to the + mean equator and equinox of epoch BEP0.} +\aref{Smith {\it et al.}, 1989.\ {\it Astr.J.}\ {\bf 97}, 269.} +%----------------------------------------------------------------------- +\routine{SLA\_PREC}{Precession Matrix (FK5)} +{ + \action{Form the matrix of precession between two epochs (IAU 1976, FK5).} + \call{CALL sla\_PREC (EP0, EP1, RMATP)} +} +\args{GIVEN} +{ + \spec{EP0}{D}{beginning epoch} \\ + \spec{EP1}{D}{ending epoch} +} +\args{RETURNED} +{ + \spec{RMATP}{D(3,3)}{precession matrix} +} +\notes +{ + \begin{enumerate} + \item The epochs are TDB Julian epochs. + \item The matrix is in the sense: + \begin{verse} + {\bf v}$_{1}$ = {\bf M}$\cdot${\bf v}$_{0}$ + \end{verse} + where {\bf v}$_{1}$ is the star vector relative to the + mean equator and equinox of epoch EP1, {\bf M} is the + $3\times3$ matrix RMATP and + {\bf v}$_{0}$ is the star vector relative to the + mean equator and equinox of epoch EP0. + \item Though the matrix method itself is rigorous, the precession + angles are expressed through canonical polynomials which are + valid only for a limited time span. There are also known + errors in the IAU precession rate. The absolute accuracy + of the present formulation is better than \arcsec{0}{1} from + 1960\,AD to 2040\,AD, better than \arcseci{1} from 1640\,AD to 2360\,AD, + and remains below \arcseci{3} for the whole of the period + 500\,BC to 3000\,AD. The errors exceed \arcseci{10} outside the + range 1200\,BC to 3900\,AD, exceed \arcseci{100} outside 4200\,BC to + 5600\,AD and exceed \arcseci{1000} outside 6800\,BC to 8200\,AD. + The SLALIB routine sla\_PRECL implements a more elaborate + model which is suitable for problems spanning several + thousand years. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Lieske, J.H., 1979.\ {\it Astr.Astrophys.}\ {\bf 73}, 282; + equations 6 \& 7, p283. + \item Kaplan, G.H., 1981.\ {\it USNO circular no.\ 163}, pA2. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PRECES}{Precession} +{ + \action{Precession -- either the old ``FK4'' (Bessel-Newcomb, pre~IAU~1976) + or new ``FK5'' (Fricke, post~IAU~1976) as required.} + \call{CALL sla\_PRECES (SYSTEM, EP0, EP1, RA, DC)} +} +\args{GIVEN} +{ + \spec{SYSTEM}{C}{precession to be applied: `FK4' or `FK5'} \\ + \spec{EP0,EP1}{D}{starting and ending epoch} \\ + \spec{RA,DC}{D}{\radec, mean equator \& equinox of epoch EP0} +} +\args{RETURNED} +{ + \spec{RA,DC}{D}{\radec, mean equator \& equinox of epoch EP1} +} +\notes +{ + \begin{enumerate} + \item Lowercase characters in SYSTEM are acceptable. + \item The epochs are Besselian if SYSTEM=`FK4' and Julian if `FK5'. + For example, to precess coordinates in the old system from + equinox 1900.0 to 1950.0 the call would be: + \begin{quote} + {\tt CALL sla\_PRECES ('FK4', 1900D0, 1950D0, RA, DC)} + \end{quote} + \item This routine will {\bf NOT} correctly convert between the old and + the new systems -- for example conversion from B1950 to J2000. + For these purposes see sla\_FK425, sla\_FK524, sla\_FK45Z and + sla\_FK54Z. + \item If an invalid SYSTEM is supplied, values of $-$99D0,$-$99D0 are + returned for both RA and DC. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PRECL}{Precession Matrix (latest)} +{ + \action{Form the matrix of precession between two epochs, using the + model of Simon {\it et al}.\ (1994), which is suitable for long + periods of time.} + \call{CALL sla\_PRECL (EP0, EP1, RMATP)} +} +\args{GIVEN} +{ + \spec{EP0}{D}{beginning epoch} \\ + \spec{EP1}{D}{ending epoch} +} +\args{RETURNED} +{ + \spec{RMATP}{D(3,3)}{precession matrix} +} +\notes +{ + \begin{enumerate} + \item The epochs are TDB Julian epochs. + \item The matrix is in the sense: + \begin{verse} + {\bf v}$_{1}$ = {\bf M}$\cdot${\bf v}$_{0}$ + \end{verse} + where {\bf v}$_{1}$ is the star vector relative to the + mean equator and equinox of epoch EP1, {\bf M} is the + $3\times3$ matrix RMATP and + {\bf v}$_{0}$ is the star vector relative to the + mean equator and equinox of epoch EP0. + \item The absolute accuracy of the model is limited by the + uncertainty in the general precession, about \arcsec{0}{3} per + 1000~years. The remainder of the formulation provides a + precision of 1~milliarcsecond over the interval from 1000\,AD + to 3000\,AD, \arcsec{0}{1} from 1000\,BC to 5000\,AD and + \arcseci{1} from 4000\,BC to 8000\,AD. + \end{enumerate} +} +\aref{Simon, J.L.\ {\it et al}., 1994.\ {\it Astr.Astrophys.}\ {\bf 282}, + 663.} +%----------------------------------------------------------------------- +\routine{SLA\_PRENUT}{Precession-Nutation Matrix} +{ + \action{Form the matrix of precession and nutation (SF2001).} + \call{CALL sla\_PRENUT (EPOCH, DATE, RMATPN)} +} +\args{GIVEN} +{ + \spec{EPOCH}{D}{Julian Epoch for mean coordinates} \\ + \spec{DATE}{D}{Modified Julian Date (JD$-$2400000.5) + for true coordinates} +} +\args{RETURNED} +{ + \spec{RMATPN}{D(3,3)}{combined precession-nutation matrix} +} +\notes +{ + \begin{enumerate} + \item The epoch and date are TDB. TT (or even UTC) will do. + \item The matrix is in the sense: + \begin{verse} + {\bf v}$_{true}$ = {\bf M}$\cdot${\bf v}$_{mean}$ + \end{verse} + where {\bf v}$_{true}$ is the star vector relative to the + true equator and equinox of epoch DATE, {\bf M} is the + $3\times3$ matrix RMATPN and + {\bf v}$_{mean}$ is the star vector relative to the + mean equator and equinox of epoch EPOCH. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_PV2EL}{Orbital Elements from Position/Velocity} +{ + \action{Heliocentric osculating elements obtained from instantaneous + position and velocity.} + \call{CALL sla\_PV2EL (\vtop{ + \hbox{PV, DATE, PMASS, JFORMR, JFORM, EPOCH, ORBINC,} + \hbox{ANODE, PERIH, AORQ, E, AORL, DM, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s; Note~1)} \\ + \spec{DATE}{D}{date (TT Modified Julian Date = JD$-$2400000.5)} \\ + \spec{PMASS}{D}{mass of the planet (Sun = 1; Note~2)} \\ + \spec{JFORMR}{I}{requested element set (1-3; Note~3)} +} +\args{RETURNED} +{ + \spec{JFORM}{I}{element set actually returned (1-3; Note~4)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude + ($M$ or $L$, radians,} \\ + \spec{}{}{\hspace{1.5em} JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal PMASS} \\ + \spec{}{}{\hspace{1.5em} $-$2 = illegal JFORMR} \\ + \spec{}{}{\hspace{1.5em} $-$3 = position/velocity out of allowed range} +} +\notes +{ + \begin{enumerate} + \item The PV 6-vector is with respect to the mean equator and equinox of + epoch J2000. The orbital elements produced are with respect to + the J2000 ecliptic and mean equinox. + \item The mass, PMASS, is important only for the larger planets. For + most purposes ({\it e.g.}~asteroids) use 0D0. Values less than zero + are illegal. + \item Three different element-format options are supported, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & longitude of perihelion $\varpi$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e < 1 )$ \\ + & AORL & = & mean longitude $L$ (radians) \\ + & DM & = & daily motion $n$ (radians) + \end{tabular} + + JFORM=2, suitable for minor planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e < 1 )$ \\ + & AORL & = & mean anomaly $M$ (radians) + \end{tabular} + + JFORM=3, suitable for comets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of perihelion $T$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & perihelion distance $q$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e \leq 10 )$ + \end{tabular} + + \item It may not be possible to generate elements in the form + requested through JFORMR. The caller is notified of the form + of elements actually returned by means of the JFORM argument: + + \begin{tabular}{llll} + & JFORMR & JFORM & meaning \\ \\ + & ~~~~~1 & ~~~~~1 & OK: elements are in the requested format \\ + & ~~~~~1 & ~~~~~2 & never happens \\ + & ~~~~~1 & ~~~~~3 & orbit not elliptical \\ + & ~~~~~2 & ~~~~~1 & never happens \\ + & ~~~~~2 & ~~~~~2 & OK: elements are in the requested format \\ + & ~~~~~2 & ~~~~~3 & orbit not elliptical \\ + & ~~~~~3 & ~~~~~1 & never happens \\ + & ~~~~~3 & ~~~~~2 & never happens \\ + & ~~~~~3 & ~~~~~3 & OK: elements are in the requested format + \end{tabular} + + \item The arguments returned for each value of JFORM ({\it cf.}\/ Note~5: + JFORM may not be the same as JFORMR) are as follows: + + \begin{tabular}{lllll} + & JFORM & 1 & 2 & 3 \\ \\ + & EPOCH & $t_0$ & $t_0$ & $T$ \\ + & ORBINC & $i$ & $i$ & $i$ \\ + & ANODE & $\Omega$ & $\Omega$ & $\Omega$ \\ + & PERIH & $\varpi$ & $\omega$ & $\omega$ \\ + & AORQ & $a$ & $a$ & $q$ \\ + & E & $e$ & $e$ & $e$ \\ + & AORL & $L$ & $M$ & - \\ + & DM & $n$ & - & - + \end{tabular} + + where: + + \begin{tabular}{lll} + & $t_0$ & is the epoch of the elements (MJD, TT) \\ + & $T$ & is the epoch of perihelion (MJD, TT) \\ + & $i$ & is the inclination (radians) \\ + & $\Omega$ & is the longitude of the ascending node (radians) \\ + & $\varpi$ & is the longitude of perihelion (radians) \\ + & $\omega$ & is the argument of perihelion (radians) \\ + & $a$ & is the mean distance (AU) \\ + & $q$ & is the perihelion distance (AU) \\ + & $e$ & is the eccentricity \\ + & $L$ & is the longitude (radians, $0-2\pi$) \\ + & $M$ & is the mean anomaly (radians, $0-2\pi$) \\ + & $n$ & is the daily motion (radians) \\ + & - & means no value is set + \end{tabular} + + \item At very small inclinations, the longitude of the ascending node + ANODE becomes indeterminate and under some circumstances may be + set arbitrarily to zero. Similarly, if the orbit is close to + circular, the true anomaly becomes indeterminate and under some + circumstances may be set arbitrarily to zero. In such cases, + the other elements are automatically adjusted to compensate, + and so the elements remain a valid description of the orbit. + \item The osculating epoch for the returned elements is the argument + DATE. + \end{enumerate} +} +\aref{Sterne, Theodore E., {\it An Introduction to Celestial Mechanics,}\/ + Interscience Publishers, 1960.} +%----------------------------------------------------------------------- +\routine{SLA\_PV2UE}{Position/Velocity to Universal Elements} +{ + \action{Construct a universal element set based on an instantaneous + position and velocity.} + \call{CALL sla\_PV2UE (PV, DATE, PMASS, U, JSTAT)} +} +\args{GIVEN} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s; Note~1)} \\ + \spec{DATE}{D}{date (TT Modified Julian Date = JD$-$2400000.5)} \\ + \spec{PMASS}{D}{mass of the planet (Sun = 1; Note~2)} +} +\args{RETURNED} +{ + \spec{U}{D(13)}{universal orbital elements (Note~3)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v}_0$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, approx} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = illegal PMASS} \\ + \spec{}{}{\hspace{1.2em} $-$2 = too close to Sun} \\ + \spec{}{}{\hspace{1.2em} $-$3 = too slow} +} +\notes +{ + \begin{enumerate} + \item The PV 6-vector can be with respect to any chosen inertial frame, + and the resulting universal-element set will be with respect to + the same frame. A common choice will be mean equator and ecliptic + of epoch J2000. + \item The mass, PMASS, is important only for the larger planets. For + most purposes ({\it e.g.}~asteroids) use 0D0. Values less than zero + are illegal. + \item The ``universal'' elements are those which define the orbit for the + purposes of the method of universal variables (see reference). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \end{enumerate} +} +\aref{Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983.} +%----------------------------------------------------------------------- +\routine{SLA\_PVOBS}{Observatory Position \& Velocity} +{ + \action{Position and velocity of an observing station.} + \call{CALL sla\_PVOBS (P, H, STL, PV)} +} +\args{GIVEN} +{ + \spec{P}{D}{latitude (geodetic, radians)} \\ + \spec{H}{D}{height above reference spheroid (geodetic, metres)} \\ + \spec{STL}{D}{local apparent sidereal time (radians)} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{\xyzxyzd\ (AU, AU~s$^{-1}$, true equator and equinox + of date)} +} +\anote{IAU 1976 constants are used.} +%----------------------------------------------------------------------- +\routine{SLA\_PXY}{Apply Linear Model} +{ + \action{Given arrays of {\it expected}\/ and {\it measured}\, + \xy\ coordinates, and a + linear model relating them (as produced by sla\_FITXY), compute + the array of {\it predicted}\/ coordinates and the RMS residuals.} + \call{CALL sla\_PXY (NP,XYE,XYM,COEFFS,XYP,XRMS,YRMS,RRMS)} +} +\args{GIVEN} +{ + \spec{NP}{I}{number of samples} \\ + \spec{XYE}{D(2,NP)}{expected \xy\ for each sample} \\ + \spec{XYM}{D(2,NP)}{measured \xy\ for each sample} \\ + \spec{COEFFS}{D(6)}{coefficients of model (see below)} +} +\args{RETURNED} +{ + \spec{XYP}{D(2,NP)}{predicted \xy\ for each sample} \\ + \spec{XRMS}{D}{RMS in X} \\ + \spec{YRMS}{D}{RMS in Y} \\ + \spec{RRMS}{D }{total RMS (vector sum of XRMS and YRMS)} +} +\notes +{ + \begin{enumerate} + \item The model is supplied in the array COEFFS. Naming the + six elements of COEFFS $a,b,c,d,e$ \& $f$, + the model transforms {\it measured}\/ coordinates + $[x_{m},y_{m}\,]$ into {\it predicted}\/ coordinates + $[x_{p},y_{p}\,]$ as follows: + \begin{verse} + $x_{p} = a + bx_{m} + cy_{m}$ \\ + $y_{p} = d + ex_{m} + fy_{m}$ + \end{verse} + \item The residuals are $(x_{p}-x_{e})$ and $(y_{p}-y_{e})$. + \item If NP is less than or equal to zero, no coordinates are + transformed, and the RMS residuals are all zero. + \item See also sla\_FITXY, sla\_INVF, sla\_XY2XY, sla\_DCMPF + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_RANDOM}{Random Number} +{ + \action{Generate pseudo-random real number in the range $0 \leq x < 1$.} + \call{R~=~sla\_RANDOM (SEED)} +} +\args{GIVEN} +{ + \spec{SEED}{R}{an arbitrary real number} +} +\args{RETURNED} +{ + \spec{SEED}{R}{a new arbitrary value} \\ + \spec{sla\_RANDOM}{R}{Pseudo-random real number $0 \leq x < 1$.} +} +\anote{The implementation is machine-dependent.} +%----------------------------------------------------------------------- +\routine{SLA\_RANGE}{Put Angle into Range $\pm\pi$} +{ + \action{Normalize an angle into the range $\pm\pi$ (single precision).} + \call{R~=~sla\_RANGE (ANGLE)} +} +\args{GIVEN} +{ + \spec{ANGLE}{R}{angle in radians} +} +\args{RETURNED} +{ + \spec{sla\_RANGE}{R}{ANGLE expressed in the range $\pm\pi$.} +} +%----------------------------------------------------------------------- +\routine{SLA\_RANORM}{Put Angle into Range $0\!-\!2\pi$} +{ + \action{Normalize an angle into the range $0\!-\!2\pi$ (single precision).} + \call{R~=~sla\_RANORM (ANGLE)} +} +\args{GIVEN} +{ + \spec{ANGLE}{R}{angle in radians} +} +\args{RETURNED} +{ + \spec{sla\_RANORM}{R}{ANGLE expressed in the range $0\!-\!2\pi$} +} +%----------------------------------------------------------------------- +\routine{SLA\_RCC}{Barycentric Coordinate Time} +{ + \call{D~=~sla\_RCC (TDB, UT1, WL, U, V)} + \action{The relativistic clock correction: + the difference between {\it proper time}\/ at + a point on the Earth and + {\it coordinate time}\/ in the solar + system barycentric space-time frame of reference. + The proper time is Terrestrial Time, TT; + the coordinate time is an implementation of Barycentric + Dynamical Time, TDB.} +} +\args{GIVEN} +{ + \spec{TDB}{D}{TDB (MJD: JD$-$2400000.5)} \\ + \spec{UT1}{D}{universal time (fraction of one day)} \\ + \spec{WL}{D}{clock longitude (radians west)} \\ + \spec{U}{D}{clock distance from Earth spin axis (km)} \\ + \spec{V}{D}{clock distance north of Earth equatorial plane (km)} +} +\args{RETURNED} +{ + \spec{sla\_RCC}{D}{TDB$-$TT (sec; Note 1)} +} +\notes +{ + \begin{enumerate} + \item TDB is coordinate time in the solar system barycentre frame + of reference, in units chosen to eliminate the scale difference + with respect to terrestrial time. TT is the proper + time for clocks at mean sea level on the Earth. + \item The number returned by sla\_RCC comprises + a main (annual) sinusoidal term of amplitude + approximately 1.66ms, plus lunar and planetary terms up to about + 20$\mu$s, and diurnal terms up to 2$\mu$s. The + variation arises from the transverse Doppler effect and the + gravitational red-shift as the observer varies in speed and + moves through different gravitational potentials. + \item The argument TDB is, strictly, the barycentric coordinate time; + however, the terrestrial time (TT) can in practice be used without + significant loss of accuracy. + \item The geocentric model is that of Fairhead \& Bretagnon (1990), in + its full form. It was supplied by Fairhead (private communication) + as a Fortran subroutine. A number of coding changes were made to + this subroutine in order + match the calling sequence of previous versions of the present + routine, to comply with Starlink programming standards and to + avoid compilation problems on certain machines. The + numerical results are essentially unaffected by the + changes. + \item The topocentric model is from Moyer (1981) and Murray (1983). + It is an approximation to the expression + \[\frac{{\bf v}_e \cdot ( {\bf x} - {\bf x}_e )}{c^2}\] + where ${\bf v}_e$ is the barycentric velocity of + the Earth, ${\bf x}$ and ${\bf x}_e$ are the barycentric positions + of the observer and the Earth respectively, and + c is the speed of light. + It can be disabled, if necessary, by setting the arguments + U and V to zero. + \item During the interval 1950-2050, the absolute accuracy + is better than $\pm3$~nanoseconds + relative to direct numerical integrations using the JPL DE200/LE200 + solar system ephemeris. + \item The IAU 1976 definition of TDB was that it must differ from TT only by + periodic terms. Though practical, this is an imprecise definition + which ignores the existence of very long-period and secular effects + in the dynamics of the solar system. As a consequence, different + implementations of TDB will, in general, differ in zero-point and + will drift linearly relative to one other. In 1991 the IAU introduced + new time scales designed to overcome these objections: geocentric coordinate + time, TCG, and barycentric coordinate time, TCB. In principle, therefore, + TDB is obsolete. However, sla\_RCC + can be used to implement the periodic part of TCB$-$TCG. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Fairhead,\,L., \& Bretagnon,\,P., {\it Astron.\,Astrophys.,}\/ + {\bf 229}, 240-247 (1990). + \item Moyer,\,T.D., {\it Cel.\,Mech.,}\/ {\bf 23}, 33 (1981). + \item Murray,\,C.A., {\it Vectorial Astrometry,}\/ Adam Hilger (1983). + \item Seidelmann,\,P.K.\ {\it et al,}\/ {\it Explanatory Supplement to the + Astronomical Almanac,}\/ Chapter 2, University Science Books + (1992). + \item Simon,\,J.L., Bretagnon,\,P., Chapront,\,J., Chapront-Touze,\,M., + Francou,\,G.\ \& Laskar,\,J., {\it Astron.Astrophys.,}\/ + {\bf 282}, 663-683 (1994). + \end{enumerate} +} +%------------------------------------------------------------------------------ +\routine{SLA\_RDPLAN}{Apparent \radec\ of Planet} +{ + \action{Approximate topocentric apparent \radec\ and angular + size of a planet.} + \call{CALL sla\_RDPLAN (DATE, NP, ELONG, PHI, RA, DEC, DIAM)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{MJD of observation (JD$-$2400000.5)} \\ + \spec{NP}{I}{planet:} \\ + \spec{}{}{\hspace{1.5em} 1\,=\,Mercury} \\ + \spec{}{}{\hspace{1.5em} 2\,=\,Venus} \\ + \spec{}{}{\hspace{1.5em} 3\,=\,Moon} \\ + \spec{}{}{\hspace{1.5em} 4\,=\,Mars} \\ + \spec{}{}{\hspace{1.5em} 5\,=\,Jupiter} \\ + \spec{}{}{\hspace{1.5em} 6\,=\,Saturn} \\ + \spec{}{}{\hspace{1.5em} 7\,=\,Uranus} \\ + \spec{}{}{\hspace{1.5em} 8\,=\,Neptune} \\ + \spec{}{}{\hspace{1.5em} 9\,=\,Pluto} \\ + \spec{}{}{\hspace{0.44em} else\,=\,Sun} \\ + \spec{ELONG,PHI}{D}{observer's longitude (east +ve) and latitude + (radians)} +} +\args{RETURNED} +{ + \spec{RA,DEC}{D}{topocentric apparent \radec\ (radians)} \\ + \spec{DIAM}{D}{angular diameter (equatorial, radians)} +} +\notes +{ + \begin{enumerate} + \item The date is in a dynamical time scale (TDB, formerly ET) + and is in the form of a Modified + Julian Date (JD$-$2400000.5). For all practical purposes, TT can + be used instead of TDB, and for many applications UT will do + (except for the Moon). + \item The longitude and latitude allow correction for geocentric + parallax. This is a major effect for the Moon, but in the + context of the limited accuracy of the present routine its + effect on planetary positions is small (negligible for the + outer planets). Geocentric positions can be generated by + appropriate use of the routines sla\_DMOON and sla\_PLANET. + \item The direction accuracy (arcsec, 1000-3000\,AD) is of order: + + \begin{tabular}{lll} + & Sun & \hspace{0.5em}5 \\ + & Mercury & \hspace{0.5em}2 \\ + & Venus & 10 \\ + & Moon & 30 \\ + & Mars & 50 \\ + & Jupiter & 90 \\ + & Saturn & 90 \\ + & Uranus & 90 \\ + & Neptune & 10 \\ + & Pluto & \hspace{0.5em}1~~~(1885-2099\,AD only) + \end{tabular} + + The angular diameter accuracy is about 0.4\% for the Moon, + and 0.01\% or better for the Sun and planets. + For more information on accuracy, + refer to the routines sla\_PLANET and sla\_DMOON, + which the present routine uses. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFCO}{Refraction Constants} +{ + \action{Determine the constants $a$ and $b$ in the + atmospheric refraction model + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$, + where $\zeta$ is the {\it observed}\/ zenith distance + ({\it i.e.}\ affected by refraction) and $\Delta \zeta$ is + what to add to $\zeta$ to give the {\it topocentric}\, + ({\it i.e.\ in vacuo}) zenith distance.} + \call{CALL sla\_REFCO (HM, TDK, PMB, RH, WL, PHI, TLR, EPS, REFA, REFB)} +} +\args{GIVEN} +{ + \spec{HM}{D}{height of the observer above sea level (metre)} \\ + \spec{TDK}{D}{ambient temperature at the observer K)} \\ + \spec{PMB}{D}{pressure at the observer (mb)} \\ + \spec{RH}{D}{relative humidity at the observer (range 0\,--\,1)} \\ + \spec{WL}{D}{effective wavelength of the source ($\mu{\rm m}$)} \\ + \spec{PHI}{D}{latitude of the observer (radian, astronomical)} \\ + \spec{TLR}{D}{temperature lapse rate in the troposphere + ( K per metre)} \\ + \spec{EPS}{D}{precision required to terminate iteration (radian)} +} +\args{RETURNED} +{ + \spec{REFA}{D}{$\tan \zeta$ coefficient (radians)} \\ + \spec{REFB}{D}{$\tan^{3} \zeta$ coefficient (radians)} +} +\notes +{ + \begin{enumerate} + \item Suggested values for the TLR and EPS arguments are 0.0065D0 and + 1D$-$8 respectively. The signs of both are immaterial. + \item The radio refraction is chosen by specifying WL $>100$~$\mu{\rm m}$. + \item The routine is a slower but more accurate alternative to the + sla\_REFCOQ routine. The constants it produces give perfect + agreement with sla\_REFRO at zenith distances + $\tan^{-1} 1$ ($45^\circ$) and $\tan^{-1} 4$ ($\sim 76^\circ$). + At other zenith distances, the model achieves: + \arcsec{0}{5} accuracy for $\zeta<80^{\circ}$, + \arcsec{0}{01} accuracy for $\zeta<60^{\circ}$, and + \arcsec{0}{001} accuracy for $\zeta<45^{\circ}$. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFCOQ}{Refraction Constants (fast)} +{ + \action{Determine the constants $a$ and $b$ in the + atmospheric refraction model + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$, + where $\zeta$ is the {\it observed}\/ zenith distance + ({\it i.e.}\ affected by refraction) and $\Delta \zeta$ is + what to add to $\zeta$ to give the {\it topocentric}\, + ({\it i.e.\ in vacuo}) zenith distance. (This is a fast + alternative to the sla\_REFCO routine -- see notes.)} + \call{CALL sla\_REFCOQ (TDK, PMB, RH, WL, REFA, REFB)} +} +\args{GIVEN} +{ + \spec{TDK}{D}{ambient temperature at the observer (K)} \\ + \spec{PMB}{D}{pressure at the observer (mb)} \\ + \spec{RH}{D}{relative humidity at the observer (range 0\,--\,1)} \\ + \spec{WL}{D}{effective wavelength of the source ($\mu{\rm m}$)} +} +\args{RETURNED} +{ + \spec{REFA}{D}{$\tan \zeta$ coefficient (radians)} \\ + \spec{REFB}{D}{$\tan^{3} \zeta$ coefficient (radians)} +} +\notes +{ + \begin{enumerate} + \item The radio refraction is chosen by specifying WL $>100$~$\mu{\rm m}$. + \item The model is an approximation, for moderate zenith distances, + to the predictions of the sla\_REFRO routine. The approximation + is maintained across a range of conditions, and applies to + both optical/IR and radio. + \item The algorithm is a fast alternative to the sla\_REFCO routine. + The latter calls the sla\_REFRO routine itself: this involves + integrations through a model atmosphere, and is costly in + processor time. However, the model which is produced is precisely + correct for two zenith distances ($45^\circ$ and $\sim\!76^\circ$) + and at other zenith distances is limited in accuracy only by the + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ formulation + itself. The present routine is not as accurate, though it + satisfies most practical requirements. + \item The model omits the effects of (i)~height above sea level (apart + from the reduced pressure itself), (ii)~latitude ({\it i.e.}\ the + flattening of the Earth) and (iii)~variations in tropospheric + lapse rate. + \item The model has been tested using the following range of conditions: + \begin{itemize} + \item [$\cdot$] lapse rates 0.0055, 0.0065, 0.0075~K per metre + \item [$\cdot$] latitudes $0^\circ$, $25^\circ$, $50^\circ$, $75^\circ$ + \item [$\cdot$] heights 0, 2500, 5000 metres above sea level + \item [$\cdot$] pressures mean for height $-10$\% to $+5$\% in steps of $5$\% + \item [$\cdot$] temperatures $-10^\circ$ to $+20^\circ$ with respect to + $280$K at sea level + \item [$\cdot$] relative humidity 0, 0.5, 1 + \item [$\cdot$] wavelength 0.4, 0.6, \ldots\ $2\mu{\rm m}$, + radio + \item [$\cdot$] zenith distances $15^\circ$, $45^\circ$, $75^\circ$ + \end{itemize} + For the above conditions, the comparison with sla\_REFRO + was as follows: + + \vspace{2ex} + + ~~~~~~~~~~ + \begin{tabular}{|r|r|r|} \hline + & {\it worst} & {\it RMS} \\ \hline + optical/IR & 62 & 8 \\ + radio & 319 & 49 \\ \hline + & mas & mas \\ \hline + \end{tabular} + + \vspace{3ex} + + For this particular set of conditions: + \begin{itemize} + \item [$\cdot$] lapse rate 6.5 K km$^{-1}$ + \item [$\cdot$] latitude $50^\circ$ + \item [$\cdot$] sea level + \item [$\cdot$] pressure 1005\,mb + \item [$\cdot$] temperature $7^\circ$C + \item [$\cdot$] humidity 80\% + \item [$\cdot$] wavelength 5740\,\.{A} + \end{itemize} + the results were as follows: + + \vspace{2ex} + + ~~~~~~~~~~ + \begin{tabular}{|r|r|r|r|} \hline + \multicolumn{1}{|c}{$\zeta$} & + \multicolumn{1}{|c}{sla\_REFRO} & + \multicolumn{1}{|c}{sla\_REFCOQ} & + \multicolumn{1}{|c|}{Saastamoinen} \\ \hline + 10 & 10.27 & 10.27 & 10.27 \\ + 20 & 21.19 & 21.20 & 21.19 \\ + 30 & 33.61 & 33.61 & 33.60 \\ + 40 & 48.82 & 48.83 & 48.81 \\ + 45 & 58.16 & 58.18 & 58.16 \\ + 50 & 69.28 & 69.30 & 69.27 \\ + 55 & 82.97 & 82.99 & 82.95 \\ + 60 & 100.51 & 100.54 & 100.50 \\ + 65 & 124.23 & 124.26 & 124.20 \\ + 70 & 158.63 & 158.68 & 158.61 \\ + 72 & 177.32 & 177.37 & 177.31 \\ + 74 & 200.35 & 200.38 & 200.32 \\ + 76 & 229.45 & 229.43 & 229.42 \\ + 78 & 267.44 & 267.29 & 267.41 \\ + 80 & 319.13 & 318.55 & 319.10 \\ \hline + deg & arcsec & arcsec & arcsec \\ \hline + \end{tabular} + + \vspace{3ex} + + The values for Saastamoinen's formula (which includes terms + up to $\tan^5$) are taken from Hohenkerk \& Sinclair (1985). + + The results from the much slower but more accurate sla\_REFCO + routine have not been included in the tabulation as they are + identical to those in the sla\_REFRO column to the \arcsec{0}{01} + resolution used. + \item Outlandish input parameters are silently limited + to mathematically safe values. Zero pressure is permissible, + and causes zeroes to be returned. + \item The algorithm draws on several sources, as follows: + \begin{itemize} + \item The formula for the saturation vapour pressure of water as + a function of temperature and temperature is taken from + expressions A4.5-A4.7 of Gill (1982). + \item The formula for the water vapour pressure, given the + saturation pressure and the relative humidity is from + Crane (1976), expression 2.5.5. + \item The refractivity of air is a function of temperature, + total pressure, water-vapour pressure and, in the case + of optical/IR but not radio, wavelength. The formulae + for the two cases are developed from Hohenkerk \& Sinclair + (1985) and Rueger (2002). + \item The formula for $\beta~(=H_0/r_0)$ is + an adaption of expression 9 from Stone (1996). The + adaptations, arrived at empirically, consist of (i)~a + small adjustment to the coefficient and (ii)~a humidity + term for the radio case only. + \item The formulae for the refraction constants as a function of + $n-1$ and $\beta$ are from Green (1987), expression 4.31. + \end{itemize} + The first three items are as used in the sla\_REFRO routine. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Crane, R.K., Meeks, M.L.\ (ed), ``Refraction Effects in + the Neutral Atmosphere'', + {\it Methods of Experimental Physics: Astrophysics 12B,}\/ + Academic Press, 1976. + \item Gill, Adrian E., {\it Atmosphere-Ocean Dynamics,}\/ + Academic Press, 1982. + \item Green, R.M., {\it Spherical Astronomy,}\/ Cambridge + University Press, 1987. + \item Hohenkerk, C.Y., \& Sinclair, A.T., NAO Technical Note + No.~63, 1985. + \item Rueger, J.M., {\it Refractive Index Formulae for + Electronic Distance Measurement with Radio and Millimetre + Waves}, in Unisurv Report S-68, School of Surveying + and Spatial Information Systems, University of New South + Wales, Sydney, Australia, 2002. + \item Stone, Ronald C., P.A.S.P.~{\bf 108} 1051-1058, 1996. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFRO}{Refraction} +{ + \action{Atmospheric refraction, for radio or optical/IR wavelengths.} + \call{CALL sla\_REFRO (ZOBS, HM, TDK, PMB, RH, WL, PHI, TLR, EPS, REF)} +} +\args{GIVEN} +{ + \spec{ZOBS}{D}{observed zenith distance of the source (radians)} \\ + \spec{HM}{D}{height of the observer above sea level (metre)} \\ + \spec{TDK}{D}{ambient temperature at the observer (K)} \\ + \spec{PMB}{D}{pressure at the observer (mb)} \\ + \spec{RH}{D}{relative humidity at the observer (range 0\,--\,1)} \\ + \spec{WL}{D}{effective wavelength of the source ($\mu{\rm m}$)} \\ + \spec{PHI}{D}{latitude of the observer (radian, astronomical)} \\ + \spec{TLR}{D}{temperature lapse rate in the troposphere + (K per metre)} \\ + \spec{EPS}{D}{precision required to terminate iteration (radian)} +} +\args{RETURNED} +{ + \spec{REF}{D}{refraction: {\it in vacuo}\/ ZD minus observed ZD (radians)} +} +\notes +{ + \begin{enumerate} + \item A suggested value for the TLR argument is 0.0065D0 (sign immaterial). + The refraction is significantly affected by TLR, and if studies + of the local atmosphere have been carried out a better TLR + value may be available. + \item A suggested value for the EPS argument is 1D$-$8. The result is + usually at least two orders of magnitude more computationally + precise than the supplied EPS value. + \item The routine computes the refraction for zenith distances up + to and a little beyond $90^\circ$ using the method of Hohenkerk + \& Sinclair (NAO Technical Notes 59 and 63, subsequently adopted + in the {\it Explanatory Supplement to the Astronomical Almanac,}\/ + 1992 -- see section 3.281). + \item The code is based on the {\tt AREF} + optical/IR refraction subroutine + (HMNAO, September 1984, RGO: Hohenkerk 1985), + with extensions to + support the radio case. The modifications to the original HMNAO + optical/IR refraction code which affect the results are: + \begin{itemize} + \item The angle arguments have been changed to radians, + any value of ZOBS is allowed (see Note~6, below) and + other argument values have been limited to safe values. + \item Revised values for the gas constants are used, from + Murray (1983). + \item A better model for $P_s(T)$ has been adopted, + from Gill (1982). + \item More accurate expressions for $Pw_o$ have been adopted + (again from Gill 1982). + \item The formula for the water vapour pressure, given the + saturation pressure and the relative humidity, is from + Crane (1976), expression 2.5.5. + \item Provision for radio wavelengths has been added using + expressions devised by A.\,T.\,Sinclair, RGO (Sinclair 1989). + The refractivity model is from Rueger (2002). + \item The optical refractivity for dry air is from IAG (1999). + \end{itemize} + \item The radio refraction is chosen by specifying WL $>100$~$\mu{\rm m}$. + Because the algorithm takes no account of the ionosphere, the + accuracy deteriorates at low frequencies, below about 30\,MHz. + \item Before use, the value of ZOBS is expressed in the range $\pm\pi$. + If this ranged ZOBS is negative, the result REF is computed from its + absolute value before being made negative to match. In addition, if + it has an absolute value greater than $93^\circ$, a fixed REF value + equal to the result for ZOBS~$=93^\circ$ is returned, appropriately + signed. + \item As in the original Hohenkerk \& Sinclair algorithm, fixed values + of the water vapour polytrope exponent, the height of the + tropopause, and the height at which refraction is negligible are + used. + \item The radio refraction has been tested against work done by + Iain~Coulson, JACH, (private communication 1995) for the + James Clerk Maxwell Telescope, Mauna Kea. For typical conditions, + agreement at the \arcsec{0}{1} level is achieved for moderate ZD, + worsening to perhaps \arcsec{0}{5}\,--\,\arcsec{1}{0} at ZD $80^\circ$. + At hot and humid sea-level sites the accuracy will not be as good. + \item It should be noted that the relative humidity RH is formally + defined in terms of ``mixing ratio'' rather than pressures or + densities as is often stated. It is the mass of water per unit + mass of dry air divided by that for saturated air at the same + temperature and pressure (see Gill 1982). The familiar + $\nu=p_w/p_s$ or $\nu=\rho_w/\rho_s$ expressions can differ from + the formal definition by several percent, significant in the + radio case. + \item The algorithm is designed for observers in the troposphere. The + supplied temperature, pressure and lapse rate are assumed to be + for a point in the troposphere and are used to define a model + atmosphere with the tropopause at 11km altitude and a constant + temperature above that. However, in practice, the refraction + values returned for stratospheric observers, at altitudes up to + 25km, are quite usable. + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Coulsen, I.\ 1995, private communication. + \item Crane, R.K., Meeks, M.L.\ (ed), 1976, + ``Refraction Effects in the Neutral Atmosphere'', + {\it Methods of Experimental Physics: Astrophysics 12B}, + Academic Press. + \item Gill, Adrian E.\ 1982, {\it Atmosphere-Ocean Dynamics}, + Academic Press. + \item Hohenkerk, C.Y.\ 1985, private communication. + \item Hohenkerk, C.Y., \& Sinclair, A.T.\ 1985, + {\it NAO Technical Note}\/ + No.~63, Royal Greenwich Observatory. + \item International Association of Geodesy, + XXIIth General Assembly, Birmingham, UK, 1999, + Resolution 3. + \item Murray, C.A.\ 1983, {\it Vectorial Astrometry,} + Adam Hilger, Bristol. + \item Seidelmann,\,P.K.\ {\it et al.}\ 1992, + {\it Explanatory Supplement to the + Astronomical Almanac}, Chapter 3, University Science Books. + \item Rueger, J.M.\ 2002, {\it Refractive Index Formulae for + Electronic Distance Measurement with Radio and Millimetre + Waves}, in Unisurv Report S-68, School of Surveying + and Spatial Information Systems, University of New South + Wales, Sydney, Australia. + \item Sinclair, A.T.\ 1989, private communication. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFV}{Apply Refraction to Vector} +{ + \action{Adjust an unrefracted Cartesian vector to include the effect of + atmospheric refraction, using the simple + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ model.} + \call{CALL sla\_REFV (VU, REFA, REFB, VR)} +} +\args{GIVEN} +{ + \spec{VU}{D}{unrefracted position of the source (\azel\ 3-vector)} \\ + \spec{REFA}{D}{$\tan \zeta$ coefficient (radians)} \\ + \spec{REFB}{D}{$\tan^{3} \zeta$ coefficient (radians)} +} +\args{RETURNED} +{ + \spec{VR}{D}{refracted position of the source (\azel\ 3-vector)} +} +\notes +{ + \begin{enumerate} + \item This routine applies the adjustment for refraction in the + opposite sense to the usual one -- it takes an unrefracted + ({\it in vacuo}\/) position and produces an observed (refracted) + position, whereas the + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + model strictly + applies to the case where an observed position is to have the + refraction removed. The unrefracted to refracted case is + harder, and requires an inverted form of the text-book + refraction models; the algorithm used here is equivalent to + one iteration of the Newton-Raphson method applied to the + above formula. + \item Though optimized for speed rather than precision, the present + routine achieves consistency with the refracted-to-unrefracted + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + model at better than 1~microarcsecond within + $30^\circ$ of the zenith and remains within 1~milliarcsecond to + $\zeta=70^\circ$. The inherent accuracy of the model is, of + course, far worse than this -- see the documentation for sla\_REFCO + for more information. + \item At low elevations (below about $3^\circ$) the refraction + correction is held back to prevent arithmetic problems and + wildly wrong results. For optical/IR wavelengths, over a wide + range of observer heights and corresponding temperatures and + pressures, the following levels of accuracy (worst case) + are achieved, relative to numerical integration through a model + atmosphere: + \begin{center} + \begin{tabular}{ccl} + $\zeta_{obs}$ & {\it error} \\ \\ + $80^\circ$ & \arcsec{0}{7} \\ + $81^\circ$ & \arcsec{1}{3} \\ + $82^\circ$ & \arcsec{2}{5} \\ + $83^\circ$ & \arcseci{5} \\ + $84^\circ$ & \arcseci{10} \\ + $85^\circ$ & \arcseci{20} \\ + $86^\circ$ & \arcseci{55} \\ + $87^\circ$ & \arcseci{160} \\ + $88^\circ$ & \arcseci{360} \\ + $89^\circ$ & \arcseci{640} \\ + $90^\circ$ & \arcseci{1100} \\ + $91^\circ$ & \arcseci{1700} & $<$ high-altitude \\ + $92^\circ$ & \arcseci{2600} & $<$ sites only \\ + \end{tabular} + \end{center} + The results for radio are slightly worse over most of the range, + becoming significantly worse below $\zeta = 88^\circ$ + and unusable beyond $\zeta = 90^\circ$. + \item See also the routine sla\_REFZ, which performs the adjustment to + the zenith distance rather than in \xyz. + The present routine is faster than sla\_REFZ and, + except very low down, + is equally accurate for all practical purposes. However, beyond + about $\zeta=84^\circ$ sla\_REFZ should be used, and for the utmost + accuracy iterative use of sla\_REFRO should be considered. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_REFZ}{Apply Refraction to ZD} +{ + \action{Adjust an unrefracted zenith distance to include the effect of + atmospheric refraction, using the simple + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ model.} + \call{CALL sla\_REFZ (ZU, REFA, REFB, ZR)} +} +\args{GIVEN} +{ + \spec{ZU}{D}{unrefracted zenith distance of the source (radians)} \\ + \spec{REFA}{D}{$\tan \zeta$ coefficient (radians)} \\ + \spec{REFB}{D}{$\tan^{3} \zeta$ coefficient (radians)} +} +\args{RETURNED} +{ + \spec{ZR}{D}{refracted zenith distance (radians)} +} +\notes +{ + \begin{enumerate} + \item This routine applies the adjustment for refraction in the + opposite sense to the usual one -- it takes an unrefracted + ({\it in vacuo}\/) position and produces an observed (refracted) + position, whereas the + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + model strictly + applies to the case where an observed position is to have the + refraction removed. The unrefracted to refracted case is + harder, and requires an inverted form of the text-book + refraction models; the formula used here is based on the + Newton-Raphson method. For the utmost numerical consistency + with the refracted to unrefracted model, two iterations are + carried out, achieving agreement at the $10^{-11}$~arcsecond level + for $\zeta=80^\circ$. The inherent accuracy of the model + is, of course, far worse than this -- see the documentation for + sla\_REFCO for more information. + \item At $\zeta=83^\circ$, the rapidly-worsening + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + model is abandoned and an empirical formula takes over: + + \[\Delta \zeta = F \left( + \frac{0^\circ\hspace{-0.37em}.\hspace{0.02em}55445 + - 0^\circ\hspace{-0.37em}.\hspace{0.02em}01133 E + + 0^\circ\hspace{-0.37em}.\hspace{0.02em}00202 E^2} + {1 + 0.28385 E +0.02390 E^2} \right) \] + where $E=90^\circ-\zeta_{true}$ + and $F$ is a factor chosen to meet the + $\Delta \zeta = a \tan \zeta + b \tan^{3} \zeta$ + formula at $\zeta=83^\circ$. + + For optical/IR wavelengths, over a wide range of observer heights + and corresponding temperatures and pressures, the following levels + of accuracy (worst case) are achieved, + relative to numerical integration through a model atmosphere: + + \begin{center} + \begin{tabular}{ccl} + $\zeta_{obs}$ & {\it error} \\ \\ + $80^\circ$ & \arcsec{0}{7} \\ + $81^\circ$ & \arcsec{1}{3} \\ + $82^\circ$ & \arcsec{2}{4} \\ + $83^\circ$ & \arcsec{4}{7} \\ + $84^\circ$ & \arcsec{6}{2} \\ + $85^\circ$ & \arcsec{6}{4} \\ + $86^\circ$ & \arcseci{8} \\ + $87^\circ$ & \arcseci{10} \\ + $88^\circ$ & \arcseci{15} \\ + $89^\circ$ & \arcseci{30} \\ + $90^\circ$ & \arcseci{60} \\ + $91^\circ$ & \arcseci{150} & $<$ high-altitude \\ + $92^\circ$ & \arcseci{400} & $<$ sites only \\ + \end{tabular} + \end{center} + For radio wavelengths the errors are typically 50\% larger than + the optical figures and by $\zeta = 85^\circ$ are twice as bad, + worsening rapidly below that. To maintain \arcseci{1} accuracy + down to $\zeta = 85^\circ$ at the Green Bank site, Condon (2004) + has suggested amplifying the amount of refraction predicted by + sla\_REFZ below \degree{10}{8} elevation by the factor + $(1+0.00195*(10.8-E_{topo}))$, where $E_{topo}$ is the + unrefracted elevation in degrees. + + The high-ZD model is scaled to match the normal model at the + transition point; there is no glitch. + \item See also the routine sla\_REFV, which performs the adjustment in + \xyz , and with the emphasis on speed rather than numerical accuracy. + \end{enumerate} +} +\aref{Condon,\,J.J., {\it Refraction Corrections for the GBT,} PTCS/PN/35.2, + NRAO Green Bank, 2004.} +%----------------------------------------------------------------------- +\routine{SLA\_RVEROT}{RV Corrn to Earth Centre} +{ + \action{Velocity component in a given direction due to Earth rotation.} + \call{R~=~sla\_RVEROT (PHI, RA, DA, ST)} +} +\args{GIVEN} +{ + \spec{PHI}{R}{geodetic latitude of observing station (radians)} \\ + \spec{RA,DA}{R}{apparent \radec\ (radians)} \\ + \spec{ST}{R}{local apparent sidereal time (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVEROT}{R}{Component of Earth rotation in + direction [RA,DA]~(km~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item Sign convention: the result is positive when the observatory + is receding from the given point on the sky. + \item Accuracy: the simple algorithm used assumes a spherical Earth and + an observing station at sea level; for actual observing + sites, the error is unlikely to be greater than 0.0005~km~s$^{-1}$. + For applications requiring greater accuracy, use the routine + sla\_PVOBS. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_RVGALC}{RV Corrn to Galactic Centre} +{ + \action{Velocity component in a given direction due to the rotation + of the Galaxy.} + \call{R~=~sla\_RVGALC (R2000, D2000)} +} +\args{GIVEN} +{ + \spec{R2000,D2000}{R}{J2000.0 mean \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVGALC}{R}{Component of dynamical LSR motion in direction + R2000,D2000 (km~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item Sign convention: the result is positive when the LSR + is receding from the given point on the sky. + \item The Local Standard of Rest used here is a point in the + vicinity of the Sun which is in a circular orbit around + the Galactic centre. Sometimes called the {\it dynamical}\/ LSR, + it is not to be confused with a {\it kinematical}\/ LSR, which + is the mean standard of rest of star catalogues or stellar + populations. + \item The dynamical LSR velocity due to Galactic rotation is assumed to + be 220~km~s$^{-1}$ towards $l^{I\!I}=90^{\circ}$, + $b^{I\!I}=0$. + \end{enumerate} +} +\aref{Kerr \& Lynden-Bell (1986), MNRAS, 221, p1023.} +%----------------------------------------------------------------------- +\routine{SLA\_RVLG}{RV Corrn to Local Group} +{ + \action{Velocity component in a given direction due to the combination + of the rotation of the Galaxy and the motion of the Galaxy + relative to the mean motion of the local group.} + \call{R~=~sla\_RVLG (R2000, D2000)} +} +\args{GIVEN} +{ + \spec{R2000,D2000}{R}{J2000.0 mean \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVLG}{R}{Component of {\bf solar} ({\it n.b.}) + motion in direction R2000,D2000 (km~s$^{-1}$)} +} +\anote{Sign convention: the result is positive when + the Sun is receding from the given point on the sky.} +\aref{{\it IAU Trans.}\ 1976.\ {\bf 16B}, p201.} +%----------------------------------------------------------------------- +\routine{SLA\_RVLSRD}{RV Corrn to Dynamical LSR} +{ + \action{Velocity component in a given direction due to the Sun's + motion with respect to the ``dynamical'' Local Standard of Rest.} + \call{R~=~sla\_RVLSRD (R2000, D2000)} +} +\args{GIVEN} +{ + \spec{R2000,D2000}{R}{J2000.0 mean \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVLSRD}{R}{Component of {\it peculiar}\/ solar motion + in direction R2000,D2000 (km~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item Sign convention: the result is positive when + the Sun is receding from the given point on the sky. + \item The Local Standard of Rest used here is the {\it dynamical}\/ LSR, + a point in the vicinity of the Sun which is in a circular + orbit around the Galactic centre. The Sun's motion with + respect to the dynamical LSR is called the {\it peculiar}\/ solar + motion. + \item There is another type of LSR, called a {\it kinematical}\/ LSR. A + kinematical LSR is the mean standard of rest of specified star + catalogues or stellar populations, and several slightly + different kinematical LSRs are in use. The Sun's motion with + respect to an agreed kinematical LSR is known as the + {\it standard}\/ solar motion. + The dynamical LSR is seldom used by observational astronomers, + who conventionally use a kinematical LSR such as the one implemented + in the routine sla\_RVLSRK. + \item The peculiar solar motion is from Delhaye (1965), in {\it Stars + and Stellar Systems}, vol~5, p73: in Galactic Cartesian + coordinates (+9,+12,+7)~km~s$^{-1}$. + This corresponds to about 16.6~km~s$^{-1}$ + towards Galactic coordinates $l^{I\!I}=53^{\circ},b^{I\!I}=+25^{\circ}$. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_RVLSRK}{RV Corrn to Kinematical LSR} +{ + \action{Velocity component in a given direction due to the Sun's + motion with respect to a kinematical Local Standard of Rest.} + \call{R~=~sla\_RVLSRK (R2000, D2000)} +} +\args{GIVEN} +{ + \spec{R2000,D2000}{R}{J2000.0 mean \radec\ (radians)} +} +\args{RETURNED} +{ + \spec{sla\_RVLSRK}{R}{Component of {\it standard}\/ solar motion + in direction R2000,D2000 (km~s$^{-1}$)} +} +\notes +{ + \begin{enumerate} + \item Sign convention: the result is positive when + the Sun is receding from the given point on the sky. + \item The Local Standard of Rest used here is one of several + {\it kinematical}\/ LSRs in common use. A kinematical LSR is the + mean standard of rest of specified star catalogues or stellar + populations. The Sun's motion with respect to a kinematical + LSR is known as the {\it standard}\/ solar motion. + \item There is another sort of LSR, seldom used by observational + astronomers, called the {\it dynamical}\/ LSR. This is a + point in the vicinity of the Sun which is in a circular orbit + around the Galactic centre. The Sun's motion with respect to + the dynamical LSR is called the {\it peculiar}\/ solar motion. To + obtain a radial velocity correction with respect to the + dynamical LSR use the routine sla\_RVLSRD. + \item The adopted standard solar motion is 20~km~s$^{-1}$ + towards $\alpha=18^{\rm h},\delta=+30^{\circ}$ (1900). + \end{enumerate} +} +\refs +{ + \begin{enumerate} + \item Delhaye (1965), in {\it Stars and Stellar Systems}, vol~5, p73. + \item {\it Methods of Experimental Physics}\/ (ed Meeks), vol~12, + part~C, sec~6.1.5.2, p281. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_S2TP}{Spherical to Tangent Plane} +{ + \action{Projection of spherical coordinates onto the tangent plane + (single precision).} + \call{CALL sla\_S2TP (RA, DEC, RAZ, DECZ, XI, ETA, J)} +} +\args{GIVEN} +{ + \spec{RA,DEC}{R}{spherical coordinates of star (radians)} \\ + \spec{RAZ,DECZ}{R}{spherical coordinates of tangent point (radians)} +} +\args{RETURNED} +{ + \spec{XI,ETA}{R}{tangent plane coordinates (radians)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK, star on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 1 = error, star too far from axis} \\ + \spec{}{}{\hspace{1.5em} 2 = error, antistar on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 3 = error, antistar too far from axis} +} +\notes +{ + \begin{enumerate} + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_V2TP is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_SEP}{Angle Between 2 Points on Sphere} +{ + \action{Angle between two points on a sphere (single precision).} + \call{R~=~sla\_SEP (A1, B1, A2, B2)} +} +\args{GIVEN} +{ + \spec{A1,B1}{R}{spherical coordinates of one point (radians)} \\ + \spec{A2,B2}{R}{spherical coordinates of the other point (radians)} +} +\args{RETURNED} +{ + \spec{sla\_SEP}{R}{angle between [A1,B1] and [A2,B2] in radians} +} +\notes +{ + \begin{enumerate} + \item The spherical coordinates are right ascension and declination, + longitude and latitude, {\it etc.}\ in radians. + \item The result is always positive. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_SEPV}{Angle Between 2 Vectors} +{ + \action{Angle between two vectors (single precision).} + \call{R~=~sla\_SEPV (V1, V2)} +} +\args{GIVEN} +{ + \spec{V1}{R(3)}{first vector} \\ + \spec{V2}{R(3)}{second vector} +} +\args{RETURNED} +{ + \spec{sla\_SEPV}{R}{angle between V1 and V2 in radians} +} +\notes +{ + \begin{enumerate} + \item There is no requirement for either vector to be of unit length. + \item If either vector is null, zero is returned. + \item The result is always positive. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_SMAT}{Solve Simultaneous Equations} +{ + \action{Matrix inversion and solution of simultaneous equations + (single precision).} + \call{CALL sla\_SMAT (N, A, Y, D, JF, IW)} +} +\args{GIVEN} +{ + \spec{N}{I}{number of unknowns} \\ + \spec{A}{R(N,N)}{matrix} \\ + \spec{Y}{R(N)}{vector} +} +\args{RETURNED} +{ + \spec{A}{R(N,N)}{matrix inverse} \\ + \spec{Y}{R(N)}{solution} \\ + \spec{D}{R}{determinant} \\ + \spec{JF}{I}{singularity flag: 0=OK} \\ + \spec{IW}{I(N)}{workspace} +} +\notes +{ + \begin{enumerate} + \item For the set of $n$ simultaneous linear equations in $n$ unknowns: + \begin{verse} + {\bf A}$\cdot${\bf y} = {\bf x} + \end{verse} + where: + \begin{itemize} + \item {\bf A} is a non-singular $n \times n$ matrix, + \item {\bf y} is the vector of $n$ unknowns, and + \item {\bf x} is the known vector, + \end{itemize} + sla\_SMAT computes: + \begin{itemize} + \item the inverse of matrix {\bf A}, + \item the determinant of matrix {\bf A}, and + \item the vector of $n$ unknowns {\bf y}. + \end{itemize} + Argument N is the order $n$, A (given) is the matrix {\bf A}, + Y (given) is the vector {\bf x} and Y (returned) + is the vector {\bf y}. + The argument A (returned) is the inverse matrix {\bf A}$^{-1}$, + and D is {\it det}\/({\bf A}). + \item JF is the singularity flag. If the matrix is non-singular, + JF=0 is returned. If the matrix is singular, JF=$-$1 + and D=0.0 are returned. In the latter case, the contents + of array A on return are undefined. + \item The algorithm is Gaussian elimination with partial pivoting. + This method is very fast; some much slower algorithms can give + better accuracy, but only by a small factor. + \item This routine replaces the obsolete sla\_SMATRX. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_SUBET}{Remove E-terms} +{ + \action{Remove the E-terms (elliptic component of annual aberration) + from a pre IAU~1976 catalogue \radec\ to give a mean place.} + \call{CALL sla\_SUBET (RC, DC, EQ, RM, DM)} +} +\args{GIVEN} +{ + \spec{RC,DC}{D}{\radec\ with E-terms included (radians)} \\ + \spec{EQ}{D}{Besselian epoch of mean equator and equinox} +} +\args{RETURNED} +{ + \spec{RM,DM}{D}{\radec\ without E-terms (radians)} +} +\anote{Most star positions from pre-1984 optical catalogues (or + obtained by astrometry with respect to such stars) have the + E-terms built-in. This routine converts such a position to a + formal mean place (allowing, for example, comparison with a + pulsar timing position).} +\aref{{\it Explanatory Supplement to the Astronomical Ephemeris}, + section 2D, page 48.} +%----------------------------------------------------------------------- +\routine{SLA\_SUPGAL}{Supergalactic to Galactic} +{ + \action{Transformation from de Vaucouleurs supergalactic coordinates + to IAU 1958 galactic coordinates.} + \call{CALL sla\_SUPGAL (DSL, DSB, DL, DB)} +} +\args{GIVEN} +{ + \spec{DSL,DSB}{D}{supergalactic longitude and latitude (radians)} +} +\args{RETURNED} +{ + \spec{DL,DB}{D}{galactic longitude and latitude \gal\ (radians)} +} +\refs +{ + \begin{enumerate} + \item de Vaucouleurs, de Vaucouleurs, \& Corwin, {\it Second Reference + Catalogue of Bright Galaxies}, U.Texas, p8. + \item Systems \& Applied Sciences Corp., documentation for the + machine-readable version of the above catalogue, + Contract NAS 5-26490. + \end{enumerate} + (These two references give different values for the galactic + longitude of the supergalactic origin. Both are wrong; the + correct value is $l^{I\!I}=137.37$.) +} +%------------------------------------------------------------------------------ +\routine{SLA\_SVD}{Singular Value Decomposition} +{ + \action{Singular value decomposition. + This routine expresses a given matrix {\bf A} as the product of + three matrices {\bf U}, {\bf W}, {\bf V}$^{T}$: + + \begin{tabular}{ll} + & {\bf A} = {\bf U} $\cdot$ {\bf W} $\cdot$ {\bf V}$^{T}$ + \end{tabular} + + where: + + \begin{tabular}{lll} + & {\bf A} & is any $m$ (rows) $\times n$ (columns) matrix, + where $m \geq n$ \\ + & {\bf U} & is an $m \times n$ column-orthogonal matrix \\ + & {\bf W} & is an $n \times n$ diagonal matrix with + $w_{ii} \geq 0$ \\ + & {\bf V}$^{T}$ & is the transpose of an $n \times n$ + orthogonal matrix + \end{tabular} +} + \call{CALL sla\_SVD (M, N, MP, NP, A, W, V, WORK, JSTAT)} +} +\args{GIVEN} +{ + \spec{M,N}{I}{$m$, $n$, the numbers of rows and columns in matrix {\bf A}} \\ + \spec{MP,NP}{I}{physical dimensions of array containing matrix {\bf A}} \\ + \spec{A}{D(MP,NP)}{array containing $m \times n$ matrix {\bf A}} +} +\args{RETURNED} +{ + \spec{A}{D(MP,NP)}{array containing $m \times n$ column-orthogonal + matrix {\bf U}} \\ + \spec{W}{D(N)}{$n \times n$ diagonal matrix {\bf W} + (diagonal elements only)} \\ + \spec{V}{D(NP,NP)}{array containing $n \times n$ orthogonal + matrix {\bf V} ({\it n.b.}\ not {\bf V}$^{T}$)} \\ + \spec{WORK}{D(N)}{workspace} \\ + \spec{JSTAT}{I}{0~=~OK, $-$1~=~array A wrong shape, $>$0~=~index of W + for which convergence failed (see note~3, below)} +} +\notes +{ + \begin{enumerate} + \item M and N are the {\it logical}\/ dimensions of the + matrices and vectors concerned, which can be located in + arrays of larger {\it physical}\/ dimensions, given by MP and NP. + \item V contains matrix V, not the transpose of matrix V. + \item If the status JSTAT is greater than zero, this need not + necessarily be treated as a failure. It means that, due to + chance properties of the matrix A, the QR transformation + phase of the routine did not fully converge in a predefined + number of iterations, something that very seldom occurs. + When this condition does arise, it is possible that the + elements of the diagonal matrix W have not been correctly + found. However, in practice the results are likely to + be trustworthy. Applications should report the condition + as a warning, but then proceed normally. + \end{enumerate} +} +\refs{The algorithm is an adaptation of the routine SVD in the {\it EISPACK}\, + library (Garbow~{\it et~al.}\ 1977, {\it EISPACK Guide Extension}, + Springer Verlag), which is a FORTRAN~66 implementation of the Algol + routine SVD of Wilkinson \& Reinsch 1971 ({\it Handbook for Automatic + Computation}, vol~2, ed Bauer~{\it et~al.}, Springer Verlag). These + references give full details of the algorithm used here. + A good account of the use of SVD in least squares problems is given + in {\it Numerical Recipes}\/ (Press~{\it et~al.}\ 1987, Cambridge + University Press), which includes another variant of the EISPACK code.} +%----------------------------------------------------------------------- +\routine{SLA\_SVDCOV}{Covariance Matrix from SVD} +{ + \action{From the {\bf W} and {\bf V} matrices from the SVD + factorization of a matrix + (as obtained from the sla\_SVD routine), obtain + the covariance matrix.} + \call{CALL sla\_SVDCOV (N, NP, NC, W, V, WORK, CVM)} +} +\args{GIVEN} +{ + \spec{N}{I}{$n$, the number of rows and columns in + matrices {\bf W} and {\bf V}} \\ + \spec{NP}{I}{first dimension of array containing $n \times n$ + matrix {\bf V}} \\ + \spec{NC}{I}{first dimension of array CVM} \\ + \spec{W}{D(N)}{$n \times n$ diagonal matrix {\bf W} + (diagonal elements only)} \\ + \spec{V}{D(NP,NP)}{array containing $n \times n$ orthogonal matrix {\bf V}} +} +\args{RETURNED} +{ + \spec{WORK}{D(N)}{workspace} \\ + \spec{CVM}{D(NC,NC)}{array to receive covariance matrix} +} +\aref{{\it Numerical Recipes}, section 14.3.} +%----------------------------------------------------------------------- +\routine{SLA\_SVDSOL}{Solution Vector from SVD} +{ + \action{From a given vector and the SVD of a matrix (as obtained from + the sla\_SVD routine), obtain the solution vector. + This routine solves the equation: + + \begin{tabular}{ll} + & {\bf A} $\cdot$ {\bf x} = {\bf b} + \end{tabular} + + where: + + \begin{tabular}{lll} + & {\bf A} & is a given $m$ (rows) $\times n$ (columns) + matrix, where $m \geq n$ \\ + & {\bf x} & is the $n$-vector we wish to find, and \\ + & {\bf b} & is a given $m$-vector + \end{tabular} + + by means of the {\it Singular Value Decomposition}\/ method (SVD).} + \call{CALL sla\_SVDSOL (M, N, MP, NP, B, U, W, V, WORK, X)} +} +\args{GIVEN} +{ + \spec{M,N}{I}{$m$, $n$, the numbers of rows and columns in matrix {\bf A}} \\ + \spec{MP,NP}{I}{physical dimensions of array containing matrix {\bf A}} \\ + \spec{B}{D(M)}{known vector {\bf b}} \\ + \spec{U}{D(MP,NP)}{array containing $m \times n$ matrix {\bf U}} \\ + \spec{W}{D(N)}{$n \times n$ diagonal matrix {\bf W} + (diagonal elements only)} \\ + \spec{V}{D(NP,NP)}{array containing $n \times n$ orthogonal matrix {\bf V}} +} +\args{RETURNED} +{ + \spec{WORK}{D(N)}{workspace} \\ + \spec{X}{D(N)}{unknown vector {\bf x}} +} +\notes +{ + \begin{enumerate} + \item In the Singular Value Decomposition method (SVD), + the matrix {\bf A} is first factorized (for example by + the routine sla\_SVD) into the following components: + + \begin{tabular}{ll} + & {\bf A} = {\bf U} $\cdot$ {\bf W} $\cdot$ {\bf V}$^{T}$ + \end{tabular} + + where: + + \begin{tabular}{lll} + & {\bf A} & is any $m$ (rows) $\times n$ (columns) matrix, + where $m > n$ \\ + & {\bf U} & is an $m \times n$ column-orthogonal matrix \\ + & {\bf W} & is an $n \times n$ diagonal matrix with + $w_{ii} \geq 0$ \\ + & {\bf V}$^{T}$ & is the transpose of an $n \times n$ + orthogonal matrix + \end{tabular} + + Note that $m$ and $n$ are the {\it logical}\/ dimensions of the + matrices and vectors concerned, which can be located in + arrays of larger {\it physical}\/ dimensions MP and NP. + The solution is then found from the expression: + + \begin{tabular}{ll} + & {\bf x} = {\bf V} $\cdot~[diag(1/${\bf W}$_{j})] + \cdot (${\bf U}$^{T} \cdot${\bf b}) + \end{tabular} + + \item If matrix {\bf A} is square, and if the diagonal matrix {\bf W} is not + altered, the method is equivalent to conventional solution + of simultaneous equations. + \item If $m > n$, the result is a least-squares fit. + \item If the solution is poorly determined, this shows up in the + SVD factorization as very small or zero {\bf W}$_{j}$ values. Where + a {\bf W}$_{j}$ value is small but non-zero it can be set to zero to + avoid ill effects. The present routine detects such zero + {\bf W}$_{j}$ values and produces a sensible solution, with highly + correlated terms kept under control rather than being allowed + to elope to infinity, and with meaningful values for the + other terms. + \end{enumerate} +} +\aref{{\it Numerical Recipes}, section 2.9.} +%----------------------------------------------------------------------- +\routine{SLA\_TP2S}{Tangent Plane to Spherical} +{ + \action{Transform tangent plane coordinates into spherical + coordinates (single precision)} + \call{CALL sla\_TP2S (XI, ETA, RAZ, DECZ, RA, DEC)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{R}{tangent plane rectangular coordinates (radians)} \\ + \spec{RAZ,DECZ}{R}{spherical coordinates of tangent point (radians)} +} +\args{RETURNED} +{ + \spec{RA,DEC}{R}{spherical coordinates (radians)} +} +\notes +{ + \begin{enumerate} + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_TP2V is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_TP2V}{Tangent Plane to Direction Cosines} +{ + \action{Given the tangent-plane coordinates of a star and the direction + cosines of the tangent point, determine the direction cosines + of the star + (single precision).} + \call{CALL sla\_TP2V (XI, ETA, V0, V)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{R}{tangent plane coordinates of star (radians)} \\ + \spec{V0}{R(3)}{direction cosines of tangent point} +} +\args{RETURNED} +{ + \spec{V}{R(3)}{direction cosines of star} +} +\notes +{ + \begin{enumerate} + \item If vector V0 is not of unit length, the returned vector V will + be wrong. + \item If vector V0 points at a pole, the returned vector V will be + based on the arbitrary assumption that $\alpha=0$ at + the tangent point. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_TP2S. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_TPS2C}{Plate centre from $\xi,\eta$ and $\alpha,\delta$} +{ + \action{From the tangent plane coordinates of a star of known \radec, + determine the \radec\ of the tangent point (single precision)} + \call{CALL sla\_TPS2C (XI, ETA, RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2, N)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{R}{tangent plane rectangular coordinates (radians)} \\ + \spec{RA,DEC}{R}{spherical coordinates (radians)} +} +\args{RETURNED} +{ + \spec{RAZ1,DECZ1}{R}{spherical coordinates of tangent point, + solution 1} \\ + \spec{RAZ2,DECZ2}{R}{spherical coordinates of tangent point, + solution 2} \\ + \spec{N}{I}{number of solutions:} \\ + \spec{}{}{\hspace{1em} 0 = no solutions returned (note 2)} \\ + \spec{}{}{\hspace{1em} 1 = only the first solution is useful (note 3)} \\ + \spec{}{}{\hspace{1em} 2 = there are two useful solutions (note 3)} +} +\notes +{ + \begin{enumerate} + \item The RAZ1 and RAZ2 values returned are in the range $0\!-\!2\pi$. + \item Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero $\xi$ value, and hence it is + meaningless to ask where the tangent point would have to be + to bring about this combination of $\xi$ and $\delta$. + \item Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. N\,=\,1 + indicates only one useful solution, the usual case; under + these circumstances, the second solution corresponds to the + ``over-the-pole'' case, and this is reflected in the values + of RAZ2 and DECZ2 which are returned. + \item The DECZ1 and DECZ2 values returned are in the range $\pm\pi$, + but in the ordinary, non-pole-crossing, case, the range is + $\pm\pi/2$. + \item RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2 are all in radians. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item When working in \xyz\ rather than spherical coordinates, the + equivalent Cartesian routine sla\_TPV2C is available. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_TPV2C}{Plate centre from $\xi,\eta$ and $x,y,z$} +{ + \action{From the tangent plane coordinates of a star of known + direction cosines, determine the direction cosines + of the tangent point (single precision)} + \call{CALL sla\_TPV2C (XI, ETA, V, V01, V02, N)} +} +\args{GIVEN} +{ + \spec{XI,ETA}{R}{tangent plane coordinates of star (radians)} \\ + \spec{V}{R(3)}{direction cosines of star} +} +\args{RETURNED} +{ + \spec{V01}{R(3)}{direction cosines of tangent point, solution 1} \\ + \spec{V01}{R(3)}{direction cosines of tangent point, solution 2} \\ + \spec{N}{I}{number of solutions:} \\ + \spec{}{}{\hspace{1em} 0 = no solutions returned (note 2)} \\ + \spec{}{}{\hspace{1em} 1 = only the first solution is useful (note 3)} \\ + \spec{}{}{\hspace{1em} 2 = there are two useful solutions (note 3)} +} +\notes +{ + \begin{enumerate} + \item The vector V must be of unit length or the result will be wrong. + \item Cases where there is no solution can only arise near the poles. + For example, it is clearly impossible for a star at the pole + itself to have a non-zero XI value. + \item Also near the poles, cases can arise where there are two useful + solutions. The argument N indicates whether the second of the + two solutions returned is useful. + N\,=\,1 + indicates only one useful solution, the usual case; under these + circumstances, the second solution can be regarded as valid if + the vector V02 is interpreted as the ``over-the-pole'' case. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_TPS2C. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_UE2EL}{Universal to Conventional Elements} +{ + \action{Transform universal elements into conventional heliocentric + osculating elements.} + \call{CALL sla\_UE2EL (\vtop{ + \hbox{U, JFORMR,} + \hbox{JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, JSTAT)}}} +} +\args{GIVEN} +{ + \spec{U}{D(13)}{universal orbital elements (updated; Note~1)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v}_0$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, approx} \\ \\ + \spec{JFORMR}{I}{requested element set (1-3; Note~3)} +} +\args{RETURNED} +{ + \spec{JFORM}{I}{element set actually returned (1-3; Note~4)} \\ + \spec{EPOCH}{D}{epoch of elements ($t_0$ or $T$, TT MJD)} \\ + \spec{ORBINC}{D}{inclination ($i$, radians)} \\ + \spec{ANODE}{D}{longitude of the ascending node ($\Omega$, radians)} \\ + \spec{PERIH}{D}{longitude or argument of perihelion + ($\varpi$ or $\omega$,} \\ + \spec{}{}{\hspace{1.5em} radians)} \\ + \spec{AORQ}{D}{mean distance or perihelion distance ($a$ or $q$, AU)} \\ + \spec{E}{D}{eccentricity ($e$)} \\ + \spec{AORL}{D}{mean anomaly or longitude + ($M$ or $L$, radians,} \\ + \spec{}{}{\hspace{1.5em} JFORM=1,2 only)} \\ + \spec{DM}{D}{daily motion ($n$, radians, JFORM=1 only)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{2.3em} 0 = OK} \\ + \spec{}{}{\hspace{1.5em} $-$1 = illegal PMASS} \\ + \spec{}{}{\hspace{1.5em} $-$2 = illegal JFORMR} \\ + \spec{}{}{\hspace{1.5em} $-$3 = position/velocity out of allowed range} +} +\notes +{ + \begin{enumerate} + \setlength{\parskip}{\medskipamount} + \item The ``universal'' elements are those which define the orbit for the + purposes of the method of universal variables (see reference 2). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \item The universal elements are with respect to the mean equator and + equinox of epoch J2000. The orbital elements produced are with + respect to the J2000 ecliptic and mean equinox. + \item Three different element-format options are supported, as + follows. \\ + + JFORM=1, suitable for the major planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & longitude of perihelion $\varpi$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e < 1 )$ \\ + & AORL & = & mean longitude $L$ (radians) \\ + & DM & = & daily motion $n$ (radians) + \end{tabular} + + JFORM=2, suitable for minor planets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of elements $t_0$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & mean distance $a$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e < 1 )$ \\ + & AORL & = & mean anomaly $M$ (radians) + \end{tabular} + + JFORM=3, suitable for comets: + + \begin{tabular}{llll} + & EPOCH & = & epoch of perihelion $T$ (TT MJD) \\ + & ORBINC & = & inclination $i$ (radians) \\ + & ANODE & = & longitude of the ascending node $\Omega$ (radians) \\ + & PERIH & = & argument of perihelion $\omega$ (radians) \\ + & AORQ & = & perihelion distance $q$ (AU) \\ + & E & = & eccentricity $e$ $( 0 \leq e \leq 10 )$ + \end{tabular} + + \item It may not be possible to generate elements in the form + requested through JFORMR. The caller is notified of the form + of elements actually returned by means of the JFORM argument: + + \begin{tabular}{llll} + & JFORMR & JFORM & meaning \\ \\ + & ~~~~~1 & ~~~~~1 & OK: elements are in the requested format \\ + & ~~~~~1 & ~~~~~2 & never happens \\ + & ~~~~~1 & ~~~~~3 & orbit not elliptical \\ + & ~~~~~2 & ~~~~~1 & never happens \\ + & ~~~~~2 & ~~~~~2 & OK: elements are in the requested format \\ + & ~~~~~2 & ~~~~~3 & orbit not elliptical \\ + & ~~~~~3 & ~~~~~1 & never happens \\ + & ~~~~~3 & ~~~~~2 & never happens \\ + & ~~~~~3 & ~~~~~3 & OK: elements are in the requested format + \end{tabular} + + \item The arguments returned for each value of JFORM ({\it cf.}\/ Note~5: + JFORM may not be the same as JFORMR) are as follows: + + \begin{tabular}{lllll} + & JFORM & 1 & 2 & 3 \\ \\ + & EPOCH & $t_0$ & $t_0$ & $T$ \\ + & ORBINC & $i$ & $i$ & $i$ \\ + & ANODE & $\Omega$ & $\Omega$ & $\Omega$ \\ + & PERIH & $\varpi$ & $\omega$ & $\omega$ \\ + & AORQ & $a$ & $a$ & $q$ \\ + & E & $e$ & $e$ & $e$ \\ + & AORL & $L$ & $M$ & - \\ + & DM & $n$ & - & - + \end{tabular} + + where: + + \begin{tabular}{lll} + & $t_0$ & is the epoch of the elements (MJD, TT) \\ + & $T$ & is the epoch of perihelion (MJD, TT) \\ + & $i$ & is the inclination (radians) \\ + & $\Omega$ & is the longitude of the ascending node (radians) \\ + & $\varpi$ & is the longitude of perihelion (radians) \\ + & $\omega$ & is the argument of perihelion (radians) \\ + & $a$ & is the mean distance (AU) \\ + & $q$ & is the perihelion distance (AU) \\ + & $e$ & is the eccentricity \\ + & $L$ & is the longitude (radians, $0-2\pi$) \\ + & $M$ & is the mean anomaly (radians, $0-2\pi$) \\ + & $n$ & is the daily motion (radians) \\ + & - & means no value is set + \end{tabular} + + \item At very small inclinations, the longitude of the ascending node + ANODE becomes indeterminate and under some circumstances may be + set arbitrarily to zero. Similarly, if the orbit is close to + circular, the true anomaly becomes indeterminate and under some + circumstances may be set arbitrarily to zero. In such cases, + the other elements are automatically adjusted to compensate, + and so the elements remain a valid description of the orbit. + \end{enumerate} +} +\refs{ + \begin{enumerate} + \item Sterne, Theodore E., {\it An Introduction to Celestial Mechanics,}\/ + Interscience Publishers, 1960. Section 6.7, p199. + \item Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_UE2PV}{Pos/Vel from Universal Elements} +{ + \action{Heliocentric position and velocity of a planet, asteroid or comet, + starting from orbital elements in the ``universal variables'' form.} + \call{CALL sla\_UE2PV (DATE, U, PV, JSTAT)} +} +\args{GIVEN} +{ + \spec{DATE}{D}{date (TT Modified Julian Date = JD$-$2400000.5)} +} +\args{GIVEN and RETURNED} +{ + \spec{U}{D(13)}{universal orbital elements (updated; Note~1)} \\ + \specel {(1)} {combined mass ($M+m$)} \\ + \specel {(2)} {total energy of the orbit ($\alpha$)} \\ + \specel {(3)} {reference (osculating) epoch ($t_0$)} \\ + \specel {(4-6)} {position at reference epoch (${\rm \bf r}_0$)} \\ + \specel {(7-9)} {velocity at reference epoch (${\rm \bf v}_0$)} \\ + \specel {(10)} {heliocentric distance at reference epoch} \\ + \specel {(11)} {${\rm \bf r}_0.{\rm \bf v}_0$} \\ + \specel {(12)} {date ($t$)} \\ + \specel {(13)} {universal eccentric anomaly ($\psi$) of date, approx} +} +\args{RETURNED} +{ + \spec{PV}{D(6)}{heliocentric \xyzxyzd, equatorial, J2000} \\ + \spec{}{}{\hspace{1.5em} (AU, AU/s; Note~1)} \\ + \spec{JSTAT}{I}{status:} \\ + \spec{}{}{\hspace{1.95em} 0 = OK} \\ + \spec{}{}{\hspace{1.2em} $-$1 = radius vector zero} \\ + \spec{}{}{\hspace{1.2em} $-2$ = failed to converge} +} +\notes +{ + \begin{enumerate} + \setlength{\parskip}{\medskipamount} + \item The ``universal'' elements are those which define the orbit for the + purposes of the method of universal variables (see reference). + They consist of the combined mass of the two bodies, an epoch, + and the position and velocity vectors (arbitrary reference frame) + at that epoch. The parameter set used here includes also various + quantities that can, in fact, be derived from the other + information. This approach is taken to avoiding unnecessary + computation and loss of accuracy. The supplementary quantities + are (i)~$\alpha$, which is proportional to the total energy of the + orbit, (ii)~the heliocentric distance at epoch, + (iii)~the outwards component of the velocity at the given epoch, + (iv)~an estimate of $\psi$, the ``universal eccentric anomaly'' at a + given date and (v)~that date. + \item The companion routine is sla\_EL2UE. This takes the conventional + orbital elements and transforms them into the set of numbers + needed by the present routine. A single prediction requires one + one call to sla\_EL2UE followed by one call to the present routine; + for convenience, the two calls are packaged as the routine + sla\_PLANEL. Multiple predictions may be made by again + calling sla\_EL2UE once, but then calling the present routine + multiple times, which is faster than multiple calls to sla\_PLANEL. + + It is not obligatory to use sla\_EL2UE to obtain the parameters. + However, it should be noted that because sla\_EL2UE performs its + own validation, no checks on the contents of the array U are made + by the present routine. + \item DATE is the instant for which the prediction is required. It is + in the TT time scale (formerly Ephemeris Time, ET) and is a + Modified Julian Date (JD$-$2400000.5). + \item The universal elements supplied in the array U are in canonical + units (solar masses, AU and canonical days). The position and + velocity are not sensitive to the choice of reference frame. The + sla\_EL2UE routine in fact produces coordinates with respect to the + J2000 equator and equinox. + \item The algorithm was originally adapted from the EPHSLA program of + D.\,H.\,P.\,Jones (private communication, 1996). The method + is based on Stumpff's Universal Variables. + \end{enumerate} +} +\aref{Everhart, E. \& Pitkin, E.T., Am.~J.~Phys.~51, 712, 1983.} +%----------------------------------------------------------------------- +\routine{SLA\_UNPCD}{Remove Radial Distortion} +{ + \action{Remove pincushion/barrel distortion from a distorted + \xy\ to give tangent-plane \xy.} + \call{CALL sla\_UNPCD (DISCO,X,Y)} +} +\args{GIVEN} +{ + \spec{DISCO}{D}{pincushion/barrel distortion coefficient} \\ + \spec{X,Y}{D}{distorted \xy} +} +\args{RETURNED} +{ + \spec{X,Y}{D}{tangent-plane \xy} +} +\notes +{ + \begin{enumerate} + \item The distortion is of the form $\rho = r (1 + c r^{2})$, where $r$ is + the radial distance from the tangent point, $c$ is the DISCO + argument, and $\rho$ is the radial distance in the presence of + the distortion. + \item For {\it pincushion}\/ distortion, C is +ve; for + {\it barrel}\/ distortion, C is $-$ve. + \item For X,Y in units of one projection radius (in the case of + a photographic plate, the focal length), the following + DISCO values apply: + + \vspace{2ex} + + \hspace{5em} + \begin{tabular}{|l|c|} \hline + Geometry & DISCO \\ \hline \hline + astrograph & 0.0 \\ \hline + Schmidt & $-$0.3333 \\ \hline + AAT PF doublet & +147.069 \\ \hline + AAT PF triplet & +178.585 \\ \hline + AAT f/8 & +21.20 \\ \hline + JKT f/8 & +14.6 \\ \hline + \end{tabular} + + \vspace{2ex} + + \item The present routine is a rigorous inverse of the companion + routine sla\_PCD. The expression for $\rho$ in Note~1 + is rewritten in the form $x^3 + ax + b = 0$ and solved by + standard techniques. + + \item Cases where the cubic has multiple real roots can sometimes + occur, corresponding to extreme instances of barrel distortion + where up to three different undistorted \xy s all produce the + same distorted \xy. However, only one solution is returned, + the one that produces the smallest change in \xy. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_V2TP}{Direction Cosines to Tangent Plane} +{ + \action{Given the direction cosines of a star and of the tangent point, + determine the star's tangent-plane coordinates + (single precision).} + \call{CALL sla\_V2TP (V, V0, XI, ETA, J)} +} +\args{GIVEN} +{ + \spec{V}{R(3)}{direction cosines of star} \\ + \spec{V0}{R(3)}{direction cosines of tangent point} +} +\args{RETURNED} +{ + \spec{XI,ETA}{R}{tangent plane coordinates (radians)} \\ + \spec{J}{I}{status:} \\ + \spec{}{}{\hspace{1.5em} 0 = OK, star on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 1 = error, star too far from axis} \\ + \spec{}{}{\hspace{1.5em} 2 = error, antistar on tangent plane} \\ + \spec{}{}{\hspace{1.5em} 3 = error, antistar too far from axis} +} +\notes +{ + \begin{enumerate} + \item If vector V0 is not of unit length, or if vector V is of zero + length, the results will be wrong. + \item If V0 points at a pole, the returned $\xi,\eta$ + will be based on the + arbitrary assumption that $\alpha=0$ at the tangent point. + \item The projection is called the {\it gnomonic}\/ projection; the + Cartesian coordinates \xieta\ are called + {\it standard coordinates.}\/ The latter + are in units of the distance from the tangent plane to the projection + point, {\it i.e.}\ radians near the origin. + \item This routine is the Cartesian equivalent of the routine sla\_S2TP. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_VDV}{Scalar Product} +{ + \action{Scalar product of two 3-vectors (single precision).} + \call{R~=~sla\_VDV (VA, VB)} +} +\args{GIVEN} +{ + \spec{VA}{R(3)}{first vector} \\ + \spec{VB}{R(3)}{second vector} +} +\args{RETURNED} +{ + \spec{sla\_VDV}{R}{scalar product VA.VB} +} +%----------------------------------------------------------------------- +\routine{SLA\_VN}{Normalize Vector} +{ + \action{Normalize a 3-vector, also giving the modulus (single precision).} + \call{CALL sla\_VN (V, UV, VM)} +} +\args{GIVEN} +{ + \spec{V}{R(3)}{vector} +} +\args{RETURNED} +{ + \spec{UV}{R(3)}{unit vector in direction of V} \\ + \spec{VM}{R}{modulus of V} +} +\anote{If the modulus of V is zero, UV is set to zero as well.} +%----------------------------------------------------------------------- +\routine{SLA\_VXV}{Vector Product} +{ + \action{Vector product of two 3-vectors (single precision).} + \call{CALL sla\_VXV (VA, VB, VC)} +} +\args{GIVEN} +{ + \spec{VA}{R(3)}{first vector} \\ + \spec{VB}{R(3)}{second vector} +} +\args{RETURNED} +{ + \spec{VC}{R(3)}{vector product VA$\times$VB} +} +%----------------------------------------------------------------------- +\routine{SLA\_WAIT}{Time Delay} +{ + \action{Wait for a specified interval.} + \call{CALL sla\_WAIT (DELAY)} +} +\args{GIVEN} +{ + \spec{DELAY}{R}{delay in seconds} +} +\notes +{ + \begin{enumerate} + \item The implementation is machine-specific. + \item The delay actually requested is restricted to the range + 100ns-200s in the present implementation. + \item There is no guarantee of accuracy, though on almost all + types of computer the program will certainly not + resume execution {\it before}\/ the stated interval has + elapsed. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_XY2XY}{Apply Linear Model to an \xy} +{ + \action{Transform one \xy\ into another using a linear model of the type + produced by the sla\_FITXY routine.} + \call{CALL sla\_XY2XY (X1, Y1, COEFFS, X2, Y2)} +} +\args{GIVEN} +{ + \spec{X1,Y1}{D}{\xy\ before transformation} \\ + \spec{COEFFS}{D(6)}{transformation coefficients (see note)} +} +\args{RETURNED} +{ + \spec{X2,Y2}{D}{\xy\ after transformation} +} +\notes +{ + \begin{enumerate} + \item The model relates two sets of \xy\ coordinates as follows. + Naming the six elements of COEFFS $a,b,c,d,e$ \& $f$, + the present routine performs the transformation: + \begin{verse} + $x_{2} = a + bx_{1} + cy_{1}$ \\ + $y_{2} = d + ex_{1} + fy_{1}$ + \end{verse} + \item See also sla\_FITXY, sla\_PXY, sla\_INVF, sla\_DCMPF. + \end{enumerate} +} +%----------------------------------------------------------------------- +\routine{SLA\_ZD}{$h,\delta$ to Zenith Distance} +{ + \action{Hour angle and declination to zenith distance + (double precision).} + \call{D~=~sla\_ZD (HA, DEC, PHI)} +} +\args{GIVEN} +{ + \spec{HA}{D}{hour angle in radians} \\ + \spec{DEC}{D}{declination in radians} \\ + \spec{PHI}{D}{latitude in radians} +} +\args{RETURNED} +{ + \spec{sla\_ZD}{D}{zenith distance (radians, $0\!-\!\pi$)} +} +\notes +{ + \begin{enumerate} + \item The latitude must be geodetic. In critical applications, + corrections for polar motion should be applied (see sla\_POLMO). + \item In some applications it will be important to specify the + correct type of hour angle and declination in order to + produce the required type + of zenith distance. In particular, it may be + important to distinguish between the zenith distance + as affected by refraction, which would require the + {\it observed}\/ \hadec, and the zenith distance {\it in vacuo}, + which would require the {\it topocentric}\/ \hadec. If + the effects of diurnal aberration can be neglected, the + {\it apparent}\/ \hadec\ may be used instead of the + {\it topocentric}\/ \hadec. + \item No range checking of arguments is done. + \item In applications which involve many zenith distance calculations, + rather than calling the present routine it will be more + efficient to use inline code, having previously computed fixed + terms such as sine and cosine of latitude, and perhaps sine and + cosine of declination. + \end{enumerate} +} +\vfill +\pagebreak + +\section{EXPLANATION AND EXAMPLES} +To guide the writer of positional-astronomy applications software, +this final chapter puts the SLALIB routines into the context of +astronomical phenomena and techniques, and presents a few +``cookbook'' examples +of the SLALIB calls in action. The astronomical content of the chapter +is not, of course, intended to be a substitute for specialist text-books on +positional astronomy, but may help bridge the gap between +such books and the SLALIB routines. For further reading, the following +cover a wide range of material and styles: +\begin{itemize} +\item {\it Explanatory Supplement to the Astronomical Almanac}, + ed.\ P.\,Kenneth~Seidelmann (1992), University Science Books. +\item {\it Vectorial Astrometry}, C.\,A.\,Murray (1983), Adam Hilger. +\item {\it Spherical Astronomy}, Robin~M.\,Green (1985), Cambridge + University Press. +\item {\it Spacecraft Attitude Determination and Control}, + ed.\ James~R.\,Wertz (1986), Reidel. +\item {\it Practical Astronomy with your Calculator}, + Peter~Duffett-Smith (1981), Cambridge University Press. +\end{itemize} +Also of considerable value, though out of date in places, are: +\begin{itemize} +\item {\it Explanatory Supplement to the Astronomical Ephemeris + and the American Ephemeris and Nautical Almanac}, RGO/USNO (1974), + HMSO. +\item {\it Textbook on Spherical Astronomy}, W.\,M.\,Smart (1977), + Cambridge University Press. +\end{itemize} +Only brief details of individual SLALIB routines are given here, and +readers will find it useful to refer to the subprogram specifications +elsewhere in this document. The source code for the SLALIB routines +(available in both Fortran and C) is also intended to be used as +documentation. + +\subsection {Spherical Trigonometry} +Celestial phenomena occur at such vast distances from the +observer that for most practical purposes there is no need to +work in 3D; only the direction +of a source matters, not how far away it is. Things can +therefore be viewed as if they were happening +on the inside of sphere with the observer at the centre -- +the {\it celestial sphere}. Problems involving +positions and orientations in the sky can then be solved by +using the formulae of {\it spherical trigonometry}, which +apply to {\it spherical triangles}, the sides of which are +{\it great circles}. + +Positions on the celestial sphere may be specified by using +a spherical polar coordinate system, defined in terms of +some fundamental plane and a line in that plane chosen to +represent zero longitude. Mathematicians usually work with the +co-latitude, with zero at the principal pole, whereas most +astronomical coordinate systems use latitude, reckoned plus and +minus from the equator. +Astronomical coordinate systems may be either right-handed +({\it e.g.}\ right ascension and declination \radec, +Galactic longitude and latitude \gal) +or left-handed ({\it e.g.}\ hour angle and +declination \hadec). In some cases +different conventions have been used in the past, a fruitful source of +mistakes. Azimuth and geographical longitude are examples; azimuth +is now generally reckoned north through east +(making a left-handed system); geographical longitude is now usually +taken to increase eastwards (a right-handed system) but astronomers +used to employ a west-positive convention. In reports +and program comments it is wise to spell out what convention +is being used, if there is any possibility of confusion. + +When applying spherical trigonometry formulae, attention must be +paid to +rounding errors (for example it is a bad idea to find a +small angle through its cosine) and to the possibility of +problems close to poles. +Also, if a formulation relies on inspection to establish +the quadrant of the result, it is an indication that a vector-related +method might be preferable. + +As well as providing many routines which work in terms of specific +spherical coordinates such as \radec, SLALIB provides +two routines which operate directly on generic spherical +coordinates: +sla\_SEP +computes the separation between +two points (the distance along a great circle) and +sla\_BEAR +computes the bearing (or {\it position angle}) +of one point seen from the other. The routines +sla\_DSEP +and +sla\_DBEAR +are double precision equivalents. As a simple demonstration +of SLALIB, we will use these facilities to estimate the distance from +London to Sydney and the initial compass heading: +\goodbreak +\begin{verbatim} + IMPLICIT NONE + + * Degrees to radians + REAL D2R + PARAMETER (D2R=0.01745329252) + + * Longitudes and latitudes (radians) for London and Sydney + REAL AL,BL,AS,BS + PARAMETER (AL=-0.2*D2R,BL=51.5*D2R,AS=151.2*D2R,BS=-33.9*D2R) + + * Earth radius in km (spherical approximation) + REAL RKM + PARAMETER (RKM=6375.0) + + REAL sla_SEP,sla_BEAR + + + * Distance and initial heading (N=0, E=90) + WRITE (*,'(1X,I5,'' km,'',I4,'' deg'')') + : NINT(sla_SEP(AL,BL,AS,BS)*RKM),NINT(sla_BEAR(AL,BL,AS,BS)/D2R) + + END +\end{verbatim} +\goodbreak +(The result is 17011~km, $61^\circ$.) + +The routines +sla\_SEPV, +sla\_DSEPV, +sla\_PAV, +sla\_DPAV +are equivalents of sla\_SEP, sla\_DSEP, sla\_BEAR and sla\_DBEAR +but starting from vectors +instead of spherical coordinates. + +\subsubsection{Formatting angles} +SLALIB has routines for decoding decimal numbers +from character form and for converting angles to and from +sexagesimal form (hours, minutes, seconds or degrees, +arcminutes, arcseconds). These apparently straightforward +operations contain hidden traps which the SLALIB routines +avoid. + +There are five routines for decoding numbers from a character +string, such as might be entered using a keyboard. +They all work in the same style, and successive calls +can work their way along a single string decoding +a sequence of numbers of assorted types. Number +fields can be separated by spaces or commas, and can be defaulted +to previous values or to preset defaults. + +Three of the routines decode single numbers: +sla\_INTIN +(integer), +sla\_FLOTIN +(single precision floating point) and +sla\_DFLTIN +(double precision). A minus sign can be +detected even when the number is zero; this avoids +the frequently-encountered ``minus zero'' bug, where +declinations {\it etc.}\ in +the range $0^{\circ}$ to $-1^{\circ}$ mysteriously migrate to +the range $0^{\circ}$ to $+1^{\circ}$. +Here is an example (in Fortran) where we wish to +read two numbers, an integer {\tt IX} and a real, {\tt Y}, +with {\tt IX} defaulting to zero and {\tt Y} defaulting to +{\tt IX}: +\goodbreak +\begin{verbatim} + DOUBLE PRECISION Y + CHARACTER*80 A + INTEGER IX,I,J + + * Input the string to be decoded + READ (*,'(A)') A + + * Preset IX to its default value + IX = 0 + + * Point to the start of the string + I = 1 + + * Decode an integer + CALL sla_INTIN(A,I,IX,J) + IF (J.GT.1) GO TO ... (bad IX) + + * Preset Y to its default value + Y = DBLE(IX) + + * Decode a double precision number + CALL sla_DFLTIN(A,I,Y,J) + IF (J.GT.1) GO TO ... (bad Y) +\end{verbatim} +\goodbreak +Two additional routines decode a 3-field sexagesimal number: +sla\_AFIN +(degrees, arcminutes, arcseconds to single +precision radians) and +sla\_DAFIN +(the same but double precision). They also +work using other units such as hours {\it etc}.\ if +you multiply the result by the appropriate factor. An example +Fortran program which uses +sla\_DAFIN +was given earlier, in section 1.2. + +SLALIB provides four routines for expressing an angle in radians +in a preferred range. The function +sla\_RANGE +expresses an angle +in the range $\pm\pi$; +sla\_RANORM +expresses an angle in the range +$0-2\pi$. The functions +sla\_DRANGE +and +sla\_DRANRM +are double precision versions. + +Several routines +(sla\_CTF2D, +sla\_CR2AF +{\it etc.}) are provided to convert +angles to and from +sexagesimal form (hours, minute, seconds or degrees, +arcminutes and arcseconds). +They avoid the common +``converting from integer to real at the wrong time'' +bug, which produces angles like \hms{24}{59}{59}{999}. +Here is a program which displays an hour angle +stored in radians: +\goodbreak +\begin{verbatim} + DOUBLE PRECISION HA + CHARACTER SIGN + INTEGER IHMSF(4) + : + CALL sla_DR2TF(3,HA,SIGN,IHMSF) + WRITE (*,'(1X,A,3I3.2,''.'',I3.3)') SIGN,IHMSF +\end{verbatim} +\goodbreak + +\subsection {Vectors and Matrices} +As an alternative to employing a spherical polar coordinate system, +the direction of an object can be defined in terms of the sum of any +three vectors as long as they are different and +not coplanar. In practice, three vectors at right angles are +usually chosen, forming a system +of {\it Cartesian coordinates}. The {\it x}- and {\it y}-axes +lie in the fundamental plane ({\it e.g.}\ the equator in the +case of \radec), with the {\it x}-axis pointing to zero longitude. +The {\it z}-axis is normal to the fundamental plane and points +towards positive latitudes. The {\it y}-axis can lie in either +of the two possible directions, depending on whether the +coordinate system is right-handed or left-handed. +The three axes are sometimes called +a {\it triad}. For most applications involving arbitrarily +distant objects such as stars, the vector which defines +the direction concerned is constrained to have unit length. +The {\it x}-, {\it y-} and {\it z-}components +can be regarded as the scalar (dot) product of this vector +onto the three axes of the triad in turn. Because the vector +is a unit vector, +each of the three dot-products is simply the cosine of the angle +between the unit vector and the axis concerned, and the +{\it x}-, {\it y-} and {\it z-}components are sometimes +called {\it direction cosines}. + +For some applications, including those involving objects +within the Solar System, unit vectors are inappropriate, and +it is necessary to use vectors scaled in length-units such as +AU, km {\it etc.} +In these cases the origin of the coordinate system may not be +the observer, but instead might be the Sun, the Solar-System +barycentre, the centre of the Earth {\it etc.} But whatever the application, +the final direction in which the observer sees the object can be +expressed as direction cosines. + +But where has this got us? Instead of two numbers -- a longitude and +a latitude -- we now have three numbers to look after +-- the {\it x}-, {\it y-} and +{\it z-}components -- whose quadratic sum we have somehow to contrive to +be unity. And, in addition to this apparent redundancy, +most people find it harder to visualize +problems in terms of \xyz\ than in $[\,\theta,\phi~]$. +Despite these objections, the vector approach turns out to have +significant advantages over the spherical trigonometry approach: +\begin{itemize} +\item Vector formulae tend to be much more succinct; one vector + operation is the equivalent of strings of sines and cosines. +\item The formulae are as a rule rigorous, even at the poles. +\item Accuracy is maintained all over the celestial sphere. + When one Cartesian component is nearly unity and + therefore insensitive to direction, the others become small + and therefore more precise. +\item Formulations usually deliver the quadrant of the result + without the need for any inspection (except within the + library function ATAN2). +\end{itemize} +A number of important transformations in positional +astronomy turn out to be nothing more than changes of coordinate +system, something which is especially convenient if +the vector approach is used. A direction with respect +to one triad can be expressed relative to another triad simply +by multiplying the \xyz\ column vector by the appropriate +$3\times3$ orthogonal matrix +(a tensor of Rank~2, or {\it dyadic}). The three rows of this +{\it rotation matrix}\/ +are the vectors in the old coordinate system of the three +new axes, and the transformation amounts to obtaining the +dot-product of the direction-vector with each of the three +new axes. Precession, nutation, \hadec\ to \azel, +\radec\ to \gal\ and so on are typical examples of the +technique. A useful property of the rotation matrices +is that they can be inverted simply by taking the transpose. + +The elements of these vectors and matrices are assorted combinations of +the sines and cosines of the various angles involved (hour angle, +declination and so on, depending on which transformation is +being applied). If you write out the matrix multiplications +in full you get expressions which are essentially the same as the +equivalent spherical trigonometry formulae. Indeed, many of the +standard formulae of spherical trigonometry are most easily +derived by expressing the problem initially in +terms of vectors. + +\subsubsection{Using vectors} +SLALIB provides conversions between spherical and vector +form +(sla\_CS2C, +sla\_CC2S +{\it etc.}), plus an assortment +of standard vector and matrix operations +(sla\_VDV, +sla\_MXV +{\it etc.}). +There are also routines +(sla\_EULER +{\it etc.}) for creating a rotation matrix +from three {\it Euler angles}\/ (successive rotations about +specified Cartesian axes). Instead of Euler angles, a rotation +matrix can be expressed as an {\it axial vector}\/ (the pole of the rotation, +and the amount of rotation), and routines are provided for this +(sla\_AV2M, +sla\_M2AV +{\it etc.}). + +Here is an example where spherical coordinates {\tt P1} and {\tt Q1} +undergo a coordinate transformation and become {\tt P2} and {\tt Q2}; +the transformation consists of a rotation of the coordinate system +through angles {\tt A}, {\tt B} and {\tt C} about the +{\it z}, new {\it y}\/ and new {\it z}\/ axes respectively: +\goodbreak +\begin{verbatim} + REAL A,B,C,R(3,3),P1,Q1,V1(3),V2(3),P2,Q2 + : + * Create rotation matrix + CALL sla_EULER('ZYZ',A,B,C,R) + + * Transform position (P1,Q1) from spherical to Cartesian + CALL sla_CS2C(P1,Q1,V1) + + * Apply the rotation + CALL sla_MXV(R,V1,V2) + + * Back to spherical + CALL sla_CC2S(V2,P2,Q2) +\end{verbatim} +\goodbreak +Small adjustments to the direction of a position +vector are often most conveniently described in terms of +$[\,\Delta x,\Delta y, \Delta z\,]$. Adding the correction +vector needs careful handling if the position +vector is to remain of length unity, an advisable precaution which +ensures that +the \xyz\ components are always available to mean the cosines of +the angles between the vector and the axis concerned. Two types +of shifts are commonly used, +the first where a small vector of arbitrary direction is +added to the unit vector, and the second where there is a displacement +in the latitude coordinate (declination, elevation {\it etc.}) alone. + +For a shift produced by adding a small \xyz\ vector ${\bf d}$ to a +unit vector ${\bf v}_1$, the resulting vector ${\bf v}_2$ has direction +$<{\bf v}_1+{\bf d}>$ but is no longer of unit length. A better approximation +is available if the result is multiplied by a scaling factor of +$(1-{\bf d}\cdot{\bf v}_1)$, where the dot +means scalar product. In Fortran: +\goodbreak +\begin{verbatim} + F = (1D0-(DX*V1X+DY*V1Y+DZ*V1Z)) + V2X = F*(V1X+DX) + V2Y = F*(V1Y+DY) + V2Z = F*(V1Z+DZ) +\end{verbatim} +\goodbreak +\noindent +The correction for diurnal aberration (discussed later) is +an example of this form of shift. + +As an example of the second kind of displacement +we will apply a small change in elevation $\delta E$ to an +\azel\ direction vector. The direction of the +result can be obtained by making the allowable approximation +${\tan \delta E\approx\delta E}$ and adding a adjustment +vector of length $\delta E$ normal +to the direction vector in the vertical plane containing the direction +vector. The $z$-component of the adjustment vector is +$\delta E \cos E$, +and the horizontal component is +$\delta E \sin E$ which has then to be +resolved into $x$ and $y$ in proportion to their current sizes. To +approximate a unit vector more closely, a correction factor of +$\cos \delta E$ can then be applied, which is nearly +$(1-\delta E^2 /2)$ for +small $\delta E$. Expressed in Fortran, for initial vector +{\tt V1X,V1Y,V1Z}, change in elevation {\tt DEL} +(+ve $\equiv$ upwards), and result +vector {\tt V2X,V2Y,V2Z}: +\goodbreak +\begin{verbatim} + COSDEL = 1D0-DEL*DEL/2D0 + R1 = SQRT(V1X*V1X+V1Y*V1Y) + F = COSDEL*(R1-DEL*V1Z)/R1 + V2X = F*V1X + V2Y = F*V1Y + V2Z = COSDEL*(V1Z+DEL*R1) +\end{verbatim} +\goodbreak +An example of this type of shift is the correction for atmospheric +refraction (see later). +Depending on the relationship between $\delta E$ and $E$, special +handling at the pole (the zenith for our example) may be required. + +SLALIB includes routines for the case where both a position +and a velocity are involved. The routines +sla\_CS2C6 +and +sla\_CC62S +convert from $[\theta,\phi,\dot{\theta},\dot{\phi}]$ +to \xyzxyzd\ and back; +sla\_DS2C6 +and +sla\_DC62S +are double precision equivalents. + +\subsection {Celestial Coordinate Systems} +SLALIB has routines to perform transformations +of celestial positions between different spherical +coordinate systems, including those shown in the following table: + +\begin{center} +\begin{tabular}{|l|c|c|c|c|c|c|} \hline +{\it system} & {\it symbols} & {\it longitude} & {\it latitude} & + {\it x-y plane} & {\it long.\ zero} & {\it RH/LH} +\\ \hline \hline +horizon & -- & azimuth & elevation & horizontal & north & L +\\ \hline +equatorial & $\alpha,\delta$ & R.A.\ & Dec.\ & equator & equinox & R +\\ \hline +local equ.\ & $h,\delta$ & H.A.\ & Dec.\ & equator & meridian & L +\\ \hline +ecliptic & $\lambda,\beta$ & ecl.\ long.\ & ecl.\ lat.\ & + ecliptic & equinox & R +\\ \hline +galactic & $l^{I\!I},b^{I\!I}$ & gal.\ long.\ & gal.\ lat.\ & + gal.\ equator & gal.\ centre & R +\\ \hline +supergalactic & SGL,SGB & SG long.\ & SG lat.\ & + SG equator & node w.\ gal.\ equ.\ & R +\\ \hline +\end{tabular} +\end{center} +Transformations between \hadec\ and \azel\ can be performed by +calling +sla\_E2H +and +sla\_H2E, +or, in double precision, +sla\_DE2H +and +sla\_DH2E. +There is also a routine for obtaining +zenith distance alone for a given \hadec, +sla\_ZD, +and one for determining the parallactic angle, +sla\_PA. +Three routines are included which relate to altazimuth telescope +mountings. For a given \hadec\ and latitude, +sla\_ALTAZ +returns the azimuth, elevation and parallactic angle, plus +velocities and accelerations for sidereal tracking. +The routines +sla\_PDA2H +and +sla\_PDQ2H +predict at what hour angle a given azimuth or +parallactic angle will be reached. + +The routines +sla\_EQECL +and +sla\_ECLEQ +transform between ecliptic +coordinates and \radec\/; there is also a routine for generating the +equatorial to ecliptic rotation matrix for a given date: +sla\_ECMAT. + +For conversion between Galactic coordinates and \radec\ there are +two sets of routines, depending on whether the \radec\ is +old-style, B1950, or new-style, J2000; +sla\_EG50 +and +sla\_GE50 +are \radec\ to \gal\ and {\it vice versa}\/ for the B1950 case, while +sla\_EQGAL +and +sla\_GALEQ +are the J2000 equivalents. + +Finally, the routines +sla\_GALSUP +and +sla\_SUPGAL +transform \gal\ to de~Vaucouleurs supergalactic longitude and latitude +and {\it vice versa.} + +It should be appreciated that the table, above, constitutes +a gross oversimplification. Apparently +simple concepts such as equator, equinox {\it etc.}\ are apt to be very hard to +pin down precisely (polar motion, orbital perturbations \ldots) and +some have several interpretations, all subtly different. The various +frames move in complicated ways with respect to one another or to +the stars (themselves in motion). And in some instances the +coordinate system is slightly distorted, so that the +ordinary rules of spherical trigonometry no longer strictly apply. + +These {\it caveats}\/ +apply particularly to the bewildering variety of different +\radec\ systems that are in use. Figure~1 shows how +some of these systems are related, to one another and +to the direction in which a celestial source actually +appears in the sky. At the top of the diagram are +the various sorts of {\it mean place}\/ +found in star catalogues and papers;\footnote{One frame not included in +Figure~1 is that of the Hipparcos catalogue. This is currently the +best available implementation in the optical of the {\it International +Celestial Reference System}\/ (ICRS), which is based on extragalactic +radio sources observed by VLBI. The distinction between FK5 J2000 +and Hipparcos coordinates only becomes important when accuracies of +50~mas or better are required. More details are given in +Section~4.14.} at the bottom is the +{\it observed}\/ \azel, where a perfect theodolite would +be pointed to see the source; and in the body of +the diagram are +the intermediate processing steps and coordinate +systems. To help +understand this diagram, and the SLALIB routines that can +be used to carry out the various calculations, we will look at the coordinate +systems involved, and the astronomical phenomena that +affect them. + +\begin{figure} +\begin{center} +\begin{tabular}{|cccccc|} \hline +& & & & & \\ +\hspace{5em} & \hspace{5em} & \hspace{5em} & + \hspace{5em} & \hspace{5em} & \hspace{5em} \\ +\multicolumn{2}{|c}{\hspace{0em}\fbox{\parbox{8.5em}{\center \vspace{-2ex} + mean \radec, FK4, \\ + any equinox + \vspace{0.5ex}}}} & + \multicolumn{2}{c}{\hspace{0em}\fbox{\parbox{8.5em}{\center \vspace{-2ex} + mean \radec, FK4, + no $\mu$, any equinox + \vspace{0.5ex}}}} & +\multicolumn{2}{c|}{\hspace{0em}\fbox{\parbox{8.5em}{\center \vspace{-2ex} + mean \radec, FK5, \\ + any equinox + \vspace{0.5ex}}}} \\ +& \multicolumn{2}{|c|}{} & \multicolumn{2}{c|}{} & \\ +\multicolumn{2}{|c}{space motion} & \multicolumn{1}{c|}{} & & + \multicolumn{2}{c|}{space motion} \\ +\multicolumn{2}{|c}{-- E-terms} & + \multicolumn{2}{c}{-- E-terms} & \multicolumn{1}{c|}{} & \\ +\multicolumn{2}{|c}{precess to B1950} & \multicolumn{2}{c}{precess to B1950} & + \multicolumn{2}{c|}{precess to J2000} \\ +\multicolumn{2}{|c}{+ E-terms} & + \multicolumn{2}{c}{+ E-terms} & \multicolumn{1}{c|}{} & \\ +\multicolumn{2}{|c}{FK4 to FK5, no $\mu$} & + \multicolumn{2}{c}{FK4 to FK5, no $\mu$} & \multicolumn{1}{c|}{} & \\ +\multicolumn{2}{|c}{parallax} & \multicolumn{1}{c|}{} & & + \multicolumn{2}{c|}{parallax} \\ +& \multicolumn{2}{|c|}{} & \multicolumn{2}{c|}{} & \\ \cline{2-5} +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{\parbox{18em}{\center \vspace{-2ex} + FK5, J2000, current epoch, geocentric + \vspace{0.5ex}}}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{light deflection} & \\ +& \multicolumn{4}{c}{annual aberration} & \\ +& \multicolumn{4}{c}{precession-nutation} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Apparent \radec}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{Earth rotation} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Apparent \hadec}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{diurnal aberration} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Topocentric \hadec}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\hadec\ to \azel} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Topocentric \azel}} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{refraction} & \\ +\multicolumn{3}{|c|}{} & & & \\ +& \multicolumn{4}{c}{\fbox{Observed \azel}} & \\ +& & & & & \\ +& & & & & \\ \hline +\end{tabular} +\end{center} +\vspace{-0.5ex} +\caption{\bf Relationship Between Celestial Coordinates} + +Star positions are published or catalogued using +one of the mean \radec\ systems shown at +the top. The ``FK4'' systems +were used before about 1980 and are usually +equinox B1950. The ``FK5'' system, equinox J2000, is now preferred, +or rather its modern equivalent, the International Celestial Reference +Frame (in the optical, the Hipparcos catalogue). +The figure relates a star's mean \radec\ to the actual +line-of-sight to the star. +Note that for the conventional choices of equinox, namely +B1950 or J2000, all of the precession and E-terms corrections +are superfluous. +\end{figure} + +\subsection{Precession and Nutation} +{\it Right ascension and declination}, (\radec), are the names +of the longitude and latitude in a spherical +polar coordinate system based on the Earth's axis of rotation. +The zero point of $\alpha$ is the point of intersection of +the {\it celestial +equator}\/ and the {\it ecliptic}\/ (the apparent path of the Sun +through the year) where the Sun moves into the northern +hemisphere. This point is called the +{\it first point of Aries}, +the {\it vernal equinox}\/ (with apologies to +southern-hemisphere readers) or simply the {\it equinox}.\footnote{With +the introduction of the International Celestial Reference System (ICRS), the +connection between (i)~star coordinates and (ii)~the Earth's orientation +and orbit has been broken. However, the orientation of the +International Celestial Reference Frame (ICRF) axes was, for convenience, +chosen to match J2000 FK5, and for most practical purposes ICRF coordinates +(for example entries in the Hipparcos catalogue) can be regarded as +synonymous with J2000 FK5. See Section 4.14 for further details.} + +This simple picture is unfortunately +complicated by the difficulty of defining +a suitable equator and equinox. One problem is that the +Sun's apparent diurnal and annual +motions are not completely regular, due to the +ellipticity of the Earth's orbit and its continuous disturbance +by the Moon and planets. This is dealt with by +separating the motion into (i)~a smooth and steady {\it mean Sun}\/ +and (ii)~a set of periodic corrections and perturbations; only the former +is involved in establishing reference systems and time scales. +A second, far larger problem, is that +the celestial equator and the ecliptic +are both moving with respect to the stars. +These motions arise because of the gravitational +interactions between the Earth and the other solar-system bodies. + +By far the largest effect is the +so-called ``precession of the equinoxes'', where the Earth's +rotation axis sweeps out a cone centred on the ecliptic +pole, completing one revolution in about 26,000 years. The +cause of the motion is the torque exerted on the distorted and +spinning Earth by the Sun and the Moon. Consider the effect of the +Sun alone, at or near the northern summer solstice. The Sun +`sees' the top (north pole) of the Earth tilted towards it +(by about \degree{23}{5}, the {\it obliquity of the +ecliptic}\/), +and sees the nearer part of the Earth's equatorial bulge +below centre and the further part above centre. +Although the Earth is in free fall, +the gravitational force on the nearer part of the +equatorial bulge is greater than that on the further part, and +so there is a net torque acting +as if to eliminate the tilt. Six months later the same thing +is happening in reverse, except that the torque is still +trying to eliminate the tilt. In between (at the equinoxes) the +torque shrinks to zero. A torque acting on a spinning body +is gyroscopically translated +into a precessional motion of the spin axis at right-angles to the torque, +and this happens to the Earth. +The motion varies during the +year, going through two maxima, but always acts in the +same direction. The Moon produces the same effect, +adding a contribution to the precession which peaks twice +per month. The Moon's proximity to the Earth more than compensates +for its smaller mass and gravitational attraction, so that it +in fact contributes most of the precessional effect. + +The complex interactions between the three bodies produce a +precessional motion that is wobbly rather than completely smooth. +However, the main 26,000-year component is on such a grand scale that +it dwarfs the remaining terms, the biggest of +which has an amplitude of only \arcseci{11} and a period of +about 18.6~years. This difference of scale makes it convenient to treat +these two components of the motion separately. The main 26,000-year +effect is called {\it luni-solar precession}; the smaller, +faster, periodic terms are called the {\it nutation}. + +Note that precession and nutation are simply +different frequency components of the same physical effect. It is +a common misconception that precession is caused +by the Sun and nutation is caused by the Moon. In fact +the Moon is responsible for two-thirds of the precession, and, +while it is true that much of the complex detail of the nutation is +a reflection of the intricacies of the lunar orbit, there are +nonetheless important solar terms in the nutation. + +In addition to and quite separate +from the precession-nutation effect, the orbit of the Earth-Moon system +is not fixed in orientation, a result of the attractions of the +planets. This slow (about \arcsec{0}{5}~per~year) +secular rotation of the ecliptic about a slowly-moving diameter is called, +confusingly, {\it planetary +precession}\/ and, along with the luni-solar precession is +included in the {\it general precession}. The equator and +ecliptic as affected by general precession +are what define the various ``mean'' \radec\ reference frames. + +The models for precession and nutation come from a combination +of observation and theory, and are subject to continuous +refinement. Nutation models in particular have reached a high +degree of sophistication, taking into account such things as +the non-rigidity of the Earth and the effects of +the planets; SLALIB's nutation +model (SF2001) involves 194 terms in each of $\psi$ (longitude) +and $\epsilon$ (obliquity), some as small as a few microarcseconds. + +\subsubsection{SLALIB support for precession and nutation} +SLALIB offers a choice of three precession models: +\begin{itemize} +\item The old Bessel-Newcomb, pre IAU~1976, ``FK4'' model, used for B1950 + star positions and other pre-1984.0 purposes +(sla\_PREBN). +\item The new Fricke, IAU~1976, ``FK5'' model, used for J2000 star + positions and other post-1984.0 purposes +(sla\_PREC). +\item A model published by Simon {\it et al.}\ which is more accurate than + the IAU~1976 model and which is suitable for long + periods of time +(sla\_PRECL). +\end{itemize} +In each case, the named SLALIB routine generates the $(3\times3)$ +{\it precession +matrix}\/ for a given start and finish time. For example, +here is the Fortran code for generating the rotation +matrix which describes the precession between the epochs +J2000 and J1985.372 (IAU 1976 model): +\goodbreak +\begin{verbatim} + DOUBLE PRECISION PMAT(3,3) + : + CALL sla_PREC(2000D0,1985.372D0,PMAT) +\end{verbatim} +\goodbreak +It is instructive to examine the resulting matrix: +\goodbreak +\begin{verbatim} + +0.9999936402 +0.0032709208 +0.0014214694 + -0.0032709208 +0.9999946505 -0.0000023247 + -0.0014214694 -0.0000023248 +0.9999989897 +\end{verbatim} +\goodbreak +Note that the diagonal elements are close to unity, and the +other elements are small. This shows that over an interval as +short as 15~years the precession isn't going to move a +position vector very far (in this case about \degree{0}{2}). + +For convenience, a direct \radec\ to \radec\ precession routine is +also provided +(sla\_PRECES), +suitable for either the old or the new system (but not a +mixture of the two). + +SLALIB provides two nutation models, the old IAU~1980 model, +implemented in the routine +slaNutc80, and a much more accurate newer theory, SF2001, +implemented in the routine +slaNutc. +Both return the components of nutation +in longitude and latitude (and also provide the obliquity) from +which a nutation matrix can be generated by calling +slaDeuler +(and from which the {\it equation of the equinoxes}, described +later, can be found). Alternatively, +the SF2001 nutation matrix can be generated in a single call by using +slaNut. The SF2001 nutation theory includes components that correct +for errors in the IAU~1976 precession and also for the +$\sim 23\,$mas +displacement between the mean J2000 and ICRS coordinate systems, +achieving a final accuracy well under 1\,mas in the present era. + +A rotation matrix for applying the entire precession-nutation +transformation in one go can be generated by calling +sla\_PRENUT. + +\subsection{Mean Places} +From a classical standpoint, +the main effect of the precession-nutation is an increase of about +\arcseci{50}/year in the ecliptic longitudes of the stars. It is therefore +essential, when reporting the position of an astronomical target, to +qualify the coordinates with a date, or {\it epoch}. +Specifying the epoch ties down the equator and +equinox which define the \radec\ coordinate system that is +being used. +\footnote{An equinox is, however, not required for coordinates +in the International Celestial Reference System. Such coordinates must +be labelled simply ``ICRS'', or the specific catalogue can be mentioned, +such as ``Hipparcos''; constructions such as ``Hipparcos, J2000'' are +redundant and misleading.} For simplicity, only +the smooth and steady ``precession'' part of the +complete precession-nutation effect is +included, thereby defining what is called the {\it mean}\/ +equator and equinox for the epoch concerned. We say a star +has a mean place of (for example) +\hms{12}{07}{58}{09}~\dms{-19}{44}{37}{1} ``with respect to the mean equator +and equinox of epoch J2000''. The short way of saying +this is ``\radec\ equinox J2000'' ({\bf not} ``\radec\ epoch J2000'', +which means something different to do with +proper motion). + +\subsection{Epoch} +The word ``epoch'' just means a significant +moment in time, and can be supplied +in a variety of forms, using different calendar systems and time scales. + +For the purpose of specifying the epochs associated with the +mean place of a star, two conventions exist. Both sorts of epoch +superficially resemble years AD but are not tied to the civil +(Gregorian) calendar; to distinguish them from ordinary calendar-years +there is often +a ``.0'' suffix (as in ``1950.0''), although any other fractional +part is perfectly legal ({\it e.g.}\ 1987.5). + +The older system, +{\it Besselian epoch}, is defined in such a way that its units are +tropical years of about 365.2422~days and its time scale is the +obsolete {\it Ephemeris Time}. +The start of the Besselian year is the moment +when the ecliptic longitude of the mean Sun is +$280^{\circ}$; this happens near the start of the +calendar year (which is why $280^{\circ}$ was chosen). + +The new system, {\it Julian epoch}, was adopted as +part of the IAU~1976 revisions (about which more will be said +in due course) and came formally into use at the +beginning of 1984. It uses the Julian year of exactly +365.25~days; Julian epoch 2000 is defined to be 2000~January~1.5 in the +TT time scale. + +For specifying mean places, various standard epochs are in use, the +most common ones being Besselian epoch 1950.0 and Julian epoch 2000.0. +To distinguish the two systems, Besselian epochs +are now prefixed ``B'' and Julian epochs are prefixed ``J''. +Epochs without an initial letter can be assumed to be Besselian +if before 1984.0, otherwise Julian. These details are supported by +the SLALIB routines +sla\_DBJIN +(decodes numbers from a +character string, accepting an optional leading B or J), +sla\_KBJ +(decides whether B or J depending on prefix or range) and +sla\_EPCO +(converts one epoch to match another). + +SLALIB has four routines for converting +Besselian and Julian epochs into other forms. +The functions +sla\_EPB2D +and +sla\_EPJ2D +convert Besselian and Julian epochs into MJD; the functions +sla\_EPB +and +sla\_EPJ +do the reverse. For example, to express B1950 as a Julian epoch: +\goodbreak +\begin{verbatim} + DOUBLE PRECISION sla_EPJ,sla_EPB2D + : + WRITE (*,'(1X,''J'',F10.5)') sla_EPJ(sla_EPB2D(1950D0)) +\end{verbatim} +\goodbreak +(The answer is J1949.99979.) + +\subsection{Proper Motion} +Stars in catalogues usually have, in addition to the +\radec\ coordinates, a {\it proper motion} $[\mu_\alpha,\mu_\delta]$. +This is an intrinsic motion +of the star across the background. Very few stars have a +proper motion which exceeds \arcseci{1}/year, and most are +far below this level. A star observed as part of normal +astronomy research will, as a rule, have a proper motion +which is unknown. + +Mean \radec\ and rate of change are not sufficient to pin +down a star; the epoch at which the \radec\ was or will +be correct is also needed. Note the distinction +between the epoch which specifies the +coordinate system and the epoch at which the star passed +through the given \radec. The full specification for a star +is \radec, proper motions, equinox and epoch (plus something to +identify which set of models for the precession {\it etc.}\ is +being used -- see the next section). +For convenience, coordinates given in star catalogues are almost +always adjusted to make the equinox and epoch the same -- for +example B1950 in the case of the SAO~catalogue. + +SLALIB provides one routine to handle proper motion on its own, +sla\_PM. +Proper motion is also allowed for in various other +routines as appropriate, for example +sla\_MAP +and +sla\_FK425. +Note that in all SLALIB routines which involve proper motion +the units are radians per year and the +$\alpha$ component is in the form $\dot{\alpha}$ ({\it i.e.}\ big +numbers near the poles). +Some star catalogues have proper motion per century, and +in some catalogues the $\alpha$ component is in the form +$\dot{\alpha}\cos\delta$ ({\it i.e.}\ angle on the sky). + +\subsection{Parallax and Radial Velocity} +For the utmost accuracy and the nearest stars, allowance can +be made for {\it annual parallax}\/ and for the effects of perspective +on the proper motion. + +Parallax is appreciable only for nearby stars; even +the nearest, Proxima Centauri, is displaced from its average +position by less than +an arcsecond as the Earth revolves in its orbit. + +For stars with a known parallax, knowledge of the radial velocity +allows the proper motion to be expressed as an actual space +motion in 3~dimensions. The proper motion is, +in fact, a snapshot of the transverse component of the +space motion, and in the case of nearby stars will +change with time due to perspective. + +SLALIB does not provide facilities for handling parallax +and radial-velocity on their own, but their contribution is +allowed for in such routines as +sla\_PM, +sla\_MAP +and +sla\_FK425. +Catalogue mean +places do not include the effects of parallax and are therefore +{\it barycentric}; when pointing telescopes {\it etc.}\ it is +usually most efficient to apply the slowly-changing +parallax correction to the mean place of the target early on +and to work with the {\it geocentric}\/ mean place. This latter +approach is implied in Figure~1. + +\subsection{Aberration} +The finite speed of light combined with the motion of the observer +around the Sun during the year causes apparent displacements of +the positions of the stars. The effect is called +the {\it annual aberration} (or ``stellar'' +aberration). Its maximum size, about \arcsec{20}{5}, +occurs for stars $90^{\circ}$ from the point towards which +the Earth is headed as it orbits the Sun; a star exactly in line with +the Earth's motion is not displaced. To receive the light of +a star, the telescope has to be offset slightly in the direction of +the Earth's motion. A familiar analogy is the need to tilt your +umbrella forward when on the move, to avoid getting wet. This +classical model is, +in fact, misleading in the context of light as opposed +to rain, but happens to give the same answer as a relativistic +treatment to first order (better than 1~milliarcsecond). + +Before the IAU 1976 resolutions, different +values for the approximately +\arcsec{20}{5} {\it aberration constant}\/ were employed +at different times, and this can complicate comparisons +between different catalogues. Another complication comes from +the so-called {\it E-terms of aberration}, +that small part of the annual aberration correction that is a +function of the eccentricity of the Earth's orbit. The E-terms, +maximum amplitude about \arcsec{0}{3}, +happen to be approximately constant for a given star, and so they +used to be incorporated in the catalogue \radec\/ +to reduce the labour of converting to and from apparent place. +The E-terms can be removed from a catalogue \radec\/ by +calling +sla\_SUBET +or applied (for example to allow a pulsar +timing-position to be plotted on a B1950 finding chart) +by calling +sla\_ADDET; +the E-terms vector itself can be obtained by calling +sla\_ETRMS. +Star positions post IAU 1976 are free of these distortions, and to +apply corrections for annual aberration involves the actual +barycentric velocity of the Earth rather than the use of +canonical circular-orbit models. + +The annual aberration is the aberration correction for +an imaginary observer at the Earth's centre. +The motion of a real observer around the Earth's rotation axis in +the course of the day makes a small extra contribution to the total +aberration effect called the {\it diurnal aberration}. Its +maximum amplitude is about \arcsec{0}{3}. + +No SLALIB routine is provided for calculating the aberration on +its own, though the required velocity vectors can be +generated using +sla\_EVP (or +sla\_EPV) +and +sla\_GEOC. +Annual and diurnal aberration are allowed for where required, for example in +sla\_MAP +{\it etc}.\ and +sla\_AOP +{\it etc}. Note that this sort +of aberration is different from the {\it planetary +aberration}, which is the apparent displacement of a solar-system +body, with respect to the ephemeris position, as a consequence +of the motion of {\it both}\/ the Earth and the source. The +planetary aberration can be computed either by correcting the +position of the solar-system body for light-time, followed by +the ordinary stellar aberration correction, or more +directly by expressing the position and velocity of the source +in the observer's frame and correcting for light-time alone. + +\subsection{Different Sorts of Mean Place} +A confusing aspect of the mean places used in the +pre-ICRS era is that they +are sensitive to the precise way they were determined. A mean +place is not directly observable, even with fundamental +instruments such as transit circles, and to produce one +will involve relying on some existing star catalogue, +for example the fundamental catalogues FK4 and FK5, +and applying given mathematical models of precession, nutation, +aberration and so on. +Note in particular that no star catalogue, +even a fundamental catalogue such as FK4 or +FK5, defines a coordinate system, strictly speaking; +it is merely a list of star positions and proper motions. +However, once the stars from a given catalogue +are used as position calibrators, {\it e.g.}\ for +transit-circle observations or for plate reductions, then a +broader sense of there being a coordinate grid naturally +arises, and such phrases as ``in the system of +the FK4'' can legitimately be employed. However, +there is no formal link between the +two concepts -- no ``standard least squares fit'' between +reality and the inevitably flawed catalogues. +All such +catalogues suffer at some level from systematic, zonal distortions +of both the star positions and of the proper motions, +and include measurement errors peculiar to individual +stars. + +Many of these complications are of little significance except to +specialists. However, observational astronomers cannot +escape exposure to at least the two main varieties of +mean place, loosely called +FK4 and FK5, and should be aware of +certain pitfalls. For most practical purposes the more recent +system, FK5, is free of surprises and tolerates naive +use well. FK4, in contrast, contains two important traps: +\begin{itemize} +\item The FK4 system rotates at about + \arcsec{0}{5} per century relative to distant galaxies. + This is manifested as a systematic distortion in the + proper motions of all FK4-derived catalogues, which will + in turn pollute any astrometry done using those catalogues. + For example, FK4-based astrometry of a QSO using plates + taken decades apart will reveal a non-zero {\it fictitious proper + motion}, and any FK4 star which happens to have zero proper + motion is, in fact, slowly moving against the distant + background. The FK4 frame rotates because it was + established before the nature of the Milky Way, and hence the + existence of systematic motions of nearby stars, had been + recognized. +\item Star positions in the FK4 system are part-corrected for + annual aberration (see above) and embody the so-called + E-terms of aberration. +\end{itemize} +The change from the old FK4-based system to FK5 +occurred at the beginning +of 1984 as part of a package of resolutions made by the IAU in 1976, +along with the adoption of J2000 as the reference epoch. Star +positions in the newer, FK5, system are free from the E-terms, and +the system is a much better approximation to an +inertial frame -- about five times better (and ICRS is hundreds +of times better still). + +It may occasionally be convenient to specify the FK4 fictitious proper +motion directly. In FK4, the centennial proper motion of (for example) +a QSO is: + +$\mu_\alpha=-$\tsec{0}{015869}$ + +(($\tsec{0}{029032}$~\sin \alpha + +$\tsec{0}{000340}$~\cos \alpha ) \sin \delta + -$\tsec{0}{000105}$~\cos \alpha + -$\tsec{0}{000083}$~\sin \alpha ) \sec \delta $ \\ +$\mu_\delta\,=+$\arcsec{0}{43549}$~\cos \alpha + -$\arcsec{0}{00510}$~\sin \alpha + + ($\arcsec{0}{00158}$~\sin \alpha + -$\arcsec{0}{00125}$~\cos \alpha ) \sin \delta + -$\arcsec{0}{00066}$~\cos \delta $ + +\subsection{Mean Place Transformations} +Figure~1 is based upon three varieties of mean \radec\ all of which are +of practical significance to observing astronomers in the present era: +\begin{itemize} + \item Old style (FK4) with known proper motion in the FK4 + system, and with parallax and radial velocity either + known or assumed zero. + \item Old style (FK4) with zero proper motion in FK5, + and with parallax and radial velocity assumed zero. + \item New style (FK5 or, loosely, ICRS) + with proper motion, parallax and + radial velocity either known or assumed zero. +\end{itemize} +The figure outlines the steps required to convert positions in +any of these systems to a J2000 \radec\ for the current +epoch, as might be required in a telescope-control +program for example. +Most of the steps can be carried out by calling a single +SLALIB routine; there are other SLALIB routines which +offer set-piece end-to-end transformation routines for common cases. +Note, however, that SLALIB does not set out to provide the capability +for arbitrary transformations of star-catalogue data +between all possible systems of mean \radec. +Only in the (common) cases of FK4, equinox and epoch B1950, +to FK5, equinox and epoch J2000, and {\it vice versa}\/ are +proper motion, parallax and radial velocity transformed +along with the star position itself, the +focus of SLALIB support. + +As an example of using SLALIB to transform mean places, here is +Fortran code that implements the top-left path of Figure~1. +An FK4 \radec\ of arbitrary equinox and epoch and with +known proper motion and +parallax is transformed into an FK5 J2000 \radec\ for the current +epoch. As a test star we will use $\alpha=$\hms{16}{09}{55}{13}, +$\delta=$\dms{-75}{59}{27}{2}, equinox 1900, epoch 1963.087, +$\mu_\alpha=$\tsec{-0}{0312}$/y$, $\mu_\delta=$\arcsec{+0}{103}$/y$, +parallax = \arcsec{0}{062}, radial velocity = $-34.22$~km/s. The +date of observation is 1994.35. +\goodbreak +\begin{verbatim} + IMPLICIT NONE + DOUBLE PRECISION AS2R,S2R + PARAMETER (AS2R=4.8481368110953599D-6,S2R=7.2722052166430399D-5) + INTEGER J,I + DOUBLE PRECISION R0,D0,EQ0,EP0,PR,PD,PX,RV,EP1,R1,D1,R2,D2,R3,D3, + : R4,D4,R5,D5,R6,D6,EP1D,EP1B,W(3),EB(3),PXR,V(3) + DOUBLE PRECISION sla_EPB,sla_EPJ2D + + * RA, Dec etc of example star + CALL sla_DTF2R(16,09,55.13D0,R0,J) + CALL sla_DAF2R(75,59,27.2D0,D0,J) + D0=-D0 + EQ0=1900D0 + EP0=1963.087D0 + PR=-0.0312D0*S2R + PD=+0.103D0*AS2R + PX=0.062D0 + RV=-34.22D0 + EP1=1994.35D0 + + * Epoch of observation as MJD and Besselian epoch + EP1D=sla_EPJ2D(EP1) + EP1B=sla_EPB(EP1D) + + * Space motion to the current epoch + CALL sla_PM(R0,D0,PR,PD,PX,RV,EP0,EP1B,R1,D1) + + * Remove E-terms of aberration for the original equinox + CALL sla_SUBET(R1,D1,EQ0,R2,D2) + + * Precess to B1950 + R3=R2 + D3=D2 + CALL sla_PRECES('FK4',EQ0,1950D0,R3,D3) + + * Add E-terms for the standard equinox B1950 + CALL sla_ADDET(R3,D3,1950D0,R4,D4) + + * Transform to J2000, no proper motion + CALL sla_FK45Z(R4,D4,EP1B,R5,D5) + + * Parallax + CALL sla_EVP(sla_EPJ2D(EP1),2000D0,W,EB,W,W) + PXR=PX*AS2R + CALL sla_DCS2C(R5,D5,V) + DO I=1,3 + V(I)=V(I)-PXR*EB(I) + END DO + CALL sla_DCC2S(V,R6,D6) + : +\end{verbatim} +\goodbreak +It is interesting to look at how the \radec\ changes during the +course of the calculation: +\begin{tabbing} +xxxxxxxxxxxxxx \= xxxxxxxxxxxxxxxxxxxxxxxxx \= x \= \kill +\> {\tt 16 09 55.130 -75 59 27.20} \> \> {\it original equinox and epoch} \\ +\> {\tt 16 09 54.155 -75 59 23.98} \> \> {\it with space motion} \\ +\> {\tt 16 09 54.229 -75 59 24.18} \> \> {\it with old E-terms removed} \\ +\> {\tt 16 16 28.213 -76 06 54.57} \> \> {\it precessed to 1950.0} \\ +\> {\tt 16 16 28.138 -76 06 54.37} \> \> {\it with new E-terms} \\ +\> {\tt 16 23 07.901 -76 13 58.87} \> \> {\it J2000, current epoch} \\ +\> {\tt 16 23 07.907 -76 13 58.92} \> \> {\it including parallax} +\end{tabbing} + +Other remarks about the above (unusually complicated) example: +\begin{itemize} +\item If the original equinox and epoch were B1950, as is quite + likely, then it would be unnecessary to treat space motions + and E-terms explicitly. Transformation to FK5 J2000 could + be accomplished simply by calling +sla\_FK425, after which + a call to +sla\_PM and the parallax code would complete the + work. +\item The rigorous treatment of the E-terms + has only a small effect on the result. Such refinements + are, nevertheless, worthwhile in order to facilitate comparisons and + to increase the chances that star positions from different + suppliers are compatible. +\item The FK4 to FK5 transformations, +sla\_FK425 + and +sla\_FK45Z, + are not as is sometimes assumed simply 50 years of precession, + though this indeed accounts for most of the change. The + transformations also include adjustments + to the equinox, a revised precession model, elimination of the + E-terms, a change to the proper-motion time unit and so on. + The reason there are two routines rather than just one + is that the FK4 frame rotates relative to the background, whereas + the FK5 frame is a much better approximation to an + inertial frame, and zero proper + motion in FK4 does not, therefore, mean zero proper motion in FK5. + SLALIB also provides two routines, +sla\_FK524 + and +sla\_FK54Z, + to perform the inverse transformations. +\item Some star catalogues (FK4 itself is one) were constructed using slightly + different procedures for the polar regions compared with + elsewhere. SLALIB ignores this inhomogeneity and always + applies the standard + transformations, irrespective of location on the celestial sphere. +\end{itemize} + +\subsection {Mean Place to Apparent Place} +The {\it geocentric apparent place}\/ of a source, or {\it apparent place}\/ +for short, +is the \radec\ if viewed from the centre of the Earth, +with respect to the true equator and equinox of date. +Transformation of an FK5 mean \radec, equinox J2000, +current epoch, to apparent place involves the following effects: +\goodbreak +\begin{itemize} + \item Light deflection -- the gravitational lens effect of + the sun. + \item Annual aberration. + \item Precession-nutation. +\end{itemize} +The {\it light deflection}\/ is seldom significant. Its value +at the limb of the Sun is about +\arcsec{1}{74}; it falls off rapidly with distance from the +Sun and has shrunk to about +\arcsec{0}{02} at an elongation of $20^\circ$. + +As already described, the {\it annual aberration}\/ +is a function of the Earth's velocity +relative to the solar system barycentre (available through the +SLALIB routines +sla\_EVP and +sla\_EPV) +and produces shifts of up to about \arcsec{20}{5}. + +The {\it precession-nutation}, from J2000 to the current epoch, is +expressed by a rotation matrix which is available through the +SLALIB routine +sla\_PRENUT. + +The whole mean-to-apparent transformation can be done using the SLALIB +routine +sla\_MAP. As a demonstration, here is a program which lists the +{\it North Polar Distance}\/ ($90^\circ-\delta$) of Polaris for +the decade of closest approach to the Pole: +\goodbreak +\begin{verbatim} + IMPLICIT NONE + DOUBLE PRECISION PI,PIBY2,D2R,S2R,AS2R + PARAMETER (PI=3.141592653589793238462643D0) + PARAMETER (D2R=PI/180D0, + : PIBY2=PI/2D0, + : S2R=PI/(12D0*3600D0), + : AS2R=PI/(180D0*3600D0)) + DOUBLE PRECISION RM,DM,PR,PD,DATE,RA,DA + INTEGER J,IDS,IDE,ID,IYMDF(4),I + + CALL sla_DTF2R(02,31,49.8131D0,RM,J) + CALL sla_DAF2R(89,15,50.661D0,DM,J) + PR=+21.7272D0*S2R/100D0 + PD=-1.571D0*AS2R/100D0 + WRITE (*,'(1X,'// + : '''Polaris north polar distance (deg) 2096-2105''/)') + WRITE (*,'(4X,''Date'',7X''NPD''/)') + CALL sla_CLDJ(2096,1,1,DATE,J) + IDS=NINT(DATE) + CALL sla_CLDJ(2105,12,31,DATE,J) + IDE=NINT(DATE) + DO ID=IDS,IDE,10 + DATE=DBLE(ID) + CALL sla_DJCAL(0,DATE,IYMDF,J) + CALL sla_MAP(RM,DM,PR,PD,0D0,0D0,2000D0,DATE,RA,DA) + WRITE (*,'(1X,I4,2I3.2,F9.5)') (IYMDF(I),I=1,3),(PIBY2-DA)/D2R + END DO + + END +\end{verbatim} +\goodbreak +For cases where the transformation has to be repeated for different +times or for more than one star, the straightforward +sla\_MAP +approach is apt to be +wasteful as both the Earth velocity and the +precession-nutation matrix can be re-calculated relatively +infrequently without ill effect. A more efficient method is to +perform the target-independent calculations only when necessary, +by calling +sla\_MAPPA, +and then to use either +sla\_MAPQKZ, +when only the \radec\/ is known, or +sla\_MAPQK, +when full catalogue positions, including proper motion, parallax and +radial velocity, are available. How frequently to call +sla\_MAPPA +depends on the accuracy objectives; once per +night will deliver sub-arcsecond accuracy for example. + +The routines +sla\_AMP +and +sla\_AMPQK +allow the reverse transformation, from apparent to mean place. + +\subsection{Apparent Place to Observed Place} +The {\it observed place}\/ of a source is its position as +seen by a perfect theodolite at the location of the +observer. Transformation of an apparent \radec\ to observed +place involves the following effects: +\goodbreak +\begin{itemize} + \item \radec\ to \hadec. + \item Diurnal aberration. + \item \hadec\ to \azel. + \item Refraction. +\end{itemize} +The transformation from apparent \radec\ to +apparent \hadec\ is made by allowing for +{\it Earth rotation}\/ through the {\it sidereal time}, $\theta$: +\[ h = \theta - \alpha \] +For this equation to work, $\alpha$ must be the apparent right +ascension for the time of observation, and $\theta$ must be +the {\it local apparent sidereal time}. The latter is obtained +as follows: +\begin{enumerate} +\item from civil time obtain the coordinated universal time, UTC + (more later on this); +\item add the UT1$-$UTC (typically a few tenths of a second) to + give the UT; +\item from the UT compute the Greenwich mean sidereal time (using +sla\_GMST); +\item add the observer's (east) longitude, giving the local mean + sidereal time; +\item add the equation of the equinoxes (using +sla\_EQEQX). +\end{enumerate} +The {\it equation of the equinoxes}\/~($=\Delta\psi\cos\epsilon$ plus +small terms) +is the effect of nutation on the sidereal time. +Its value is typically a second or less. It is +interesting to note that if the object of the exercise is to +transform a mean place all the way into an observed place (very +often the case), +then the equation of the +equinoxes and the longitude component of nutation can both be +omitted, removing a great deal of computation. However, SLALIB +follows the normal convention and works {\it via}\/ the apparent place. + +Note that for very precise work the observer's longitude should +be corrected for {\it polar motion}. This can be done with +sla\_POLMO. +The corrections are always less than about \arcsec{0}{3}, and +are futile unless the position of the observer's telescope is known +to better than a few metres. + +Tables of observed and +predicted UT1$-$UTC corrections and polar motion data +are published every few weeks by the International Earth Rotation Service. + +The transformation from apparent \hadec\ to {\it topocentric}\/ +\hadec\ consists of allowing for +{\it diurnal aberration}. This effect, maximum amplitude \arcsec{0}{2}, +was described earlier. There is no specific SLALIB routine +for computing the diurnal aberration, +though the routines +sla\_AOP {\it etc.}\ +include it, and the required velocity vector can be +determined by calling +sla\_GEOC. + +The next stage is the major coordinate rotation from local equatorial +coordinates \hadec\ into horizon coordinates. The SLALIB routines +sla\_E2H +{\it etc.}\ can be used for this. For high-precision +applications the mean geodetic latitude should be corrected for polar +motion. + +\subsubsection{Refraction} +The final correction is for atmospheric refraction. +This effect, which depends on local meteorological conditions and +the effective colour of the source/detector combination, +increases the observed elevation of the source by a +significant effect even at moderate zenith distances, and near the +horizon by over \degree{0}{5}. The amount of refraction can by +computed by calling the SLALIB routine +sla\_REFRO; +however, +this requires as input the observed zenith distance, which is what +we are trying to predict. For high precision it is +therefore necessary to iterate, using the topocentric +zenith distance as the initial estimate of the +observed zenith distance. + +The full +sla\_REFRO refraction calculation is onerous, and for +zenith distances of less than, say, $75^{\circ}$ the following +model can be used instead: + +\[ \zeta _{vac} \approx \zeta _{obs} + + A \tan \zeta _{obs} + + B \tan ^{3}\zeta _{obs} \] +where $\zeta _{vac}$ is the topocentric +zenith distance (i.e.\ {\it in vacuo}), +$\zeta _{obs}$ is the observed +zenith distance (i.e.\ affected by refraction), and $A$ and $B$ are +constants, about \arcseci{60} +and \arcsec{-0}{06} respectively for a sea-level site. +The two constants can be calculated for a given set of conditions +by calling either +sla\_REFCO or +sla\_REFCOQ. + +sla\_REFCO works by calling +sla\_REFRO for two zenith distances and fitting $A$ and $B$ +to match. The calculation is onerous, but delivers accurate +results whatever the conditions. +sla\_REFCOQ uses a direct formulation of $A$ and $B$ and +is much faster; it is slightly less accurate than +sla\_REFCO but more than adequate for most practical purposes. + +Like the full refraction model, the two-term formulation works in the wrong +direction for our purposes, predicting +the {\it in vacuo}\/ (topocentric) zenith distance +given the refracted (observed) zenith distance, +rather than {\it vice versa}. The obvious approach of +interchanging $\zeta _{vac}$ and $\zeta _{obs}$ and +reversing the signs, though approximately +correct, gives avoidable errors which are just significant in +some applications; for +example about \arcsec{0}{2} at $70^\circ$ zenith distance. A +much better result can easily be obtained, by using one Newton-Raphson +iteration as follows: + +\[ \zeta _{obs} \approx \zeta _{vac} + - \frac{A \tan \zeta _{vac} + B \tan ^{3}\zeta _{vac}} + {1 + ( A + 3 B \tan ^{2}\zeta _{vac} ) \sec ^{2}\zeta _{vac}}\] + +The effect of refraction can be applied to an unrefracted +zenith distance by calling +sla\_REFZ or to an unrefracted +\xyz\ by calling +sla\_REFV. +Over most of the sky these two routines deliver almost identical +results, but beyond $\zeta=83^\circ$ +sla\_REFV +becomes unacceptably inaccurate while +sla\_REFZ +remains usable. (However +sla\_REFV +is significantly faster, which may be important in some applications.) +SLALIB also provides a routine for computing the airmass, the function +sla\_AIRMAS. + +The refraction ``constants'' returned by +sla\_REFCO and +sla\_REFCOQ +are slightly affected by colour, especially at the blue end +of the spectrum. Where values for more than one +wavelength are needed, rather than calling +sla\_REFCO +several times it is more efficient to call +sla\_REFCO +just once, for a selected ``base'' wavelength, and then to call +sla\_ATMDSP +once for each wavelength of interest. + +All the SLALIB refraction routines work for radio wavelengths as well +as the optical/IR band. The radio refraction is very dependent on +humidity, and an accurate value must be supplied. There is no +wavelength dependence, however. The choice of optical/IR or +radio is made by specifying a wavelength greater than $100\mu {\rm m}$ +for the radio case. + +\subsubsection{Efficiency considerations} +The complete apparent place to observed place transformation +can be carried out by calling +sla\_AOP. +For improved efficiency +in cases of more than one star or a sequence of times, the +target-independent calculations can be done once by +calling +sla\_AOPPA, +the time can be updated by calling +sla\_AOPPAT, +and +sla\_AOPQK +can then be used to perform the +apparent-to-observed transformation. The reverse transformation +is available through +sla\_OAP +and +sla\_OAPQK. +({\it n.b.}\ These routines use accurate but computationally-expensive +refraction algorithms for zenith distances beyond about $76^\circ$. +For many purposes, in-line code tailored to the accuracy requirements +of the application will be preferable, for example ignoring +polar motion, +omitting diurnal aberration and using +sla\_REFZ +to apply the refraction.) + +\subsection{The Hipparcos Catalogue and the ICRS} +With effect from the beginning of 1998, the IAU adopted a new +reference system to replace FK5 J2000. The new system, called the +International Celestial Reference System (ICRS), differs profoundly +from all predecessors in that the link with solar-system dynamics +was broken; the ICRS axes are defined in terms of the coordinates +of a set of extragalactic sources, not in terms of the mean equator and +equinox at a given reference epoch. Although the ICRS and FK5 coordinates +of any given object are almost the same, the orientation of the new frame +was essentially arbitrary, and the close match to FK5 J2000 was contrived +purely for reasons of continuity and convenience. + +A distinction is made between the reference {\it system}\/ (the ICRS) +and {\it frame}\/ (ICRF). The ICRS is the set of prescriptions and +conventions together with the modelling required to define, at any +time, a triad of axes. The ICRF is a practical realization, and +currently consists of a catalogue of equatorial coordinates for 608 +extragalactic radio sources observed by VLBI. + +The best optical realization of the ICRF currently available is the +Hipparcos catalogue. The extragalactic sources were not directly +observable by the Hipparcos satellite and so the link from Hipparcos +to ICRF was established through a variety of indirect techniques: VLBI and +conventional interferometry of radio stars, photographic astrometry +and so on. The Hipparcos frame is aligned to the ICRF to within about +0.5~mas and 0.5~mas/year (at epoch 1991.25). + +The Hipparcos catalogue includes all of the FK5 stars, which has enabled +the orientation and spin of the latter to be studied. At epoch J2000, +the misalignment of the FK5 frame with respect to Hipparcos +(and hence ICRS) are about 32~mas and 1~mas/year respectively. +Consequently, for many practical purposes, including pointing +telescopes, the IAU 1976-1982 conventions on reference frames and +Earth orientation remain adequate and there is no need to change to +Hipparcos coordinates, new precession-nutation models and so on. +However, for the most exacting astrometric applications, SLALIB +provides some support for Hipparcos coordinates in the form of +four new routines: +sla\_FK52H and +sla\_H2FK5, +which transform FK5 positions and proper motions to the Hipparcos frame +and {\it vice versa,}\/ and +sla\_FK5HZ and +sla\_HFK5Z, +where the transformations are for stars whose Hipparcos proper motion is +zero. + +Further information on the ICRS can be found in the paper by M.\,Feissel +and F.\,Mignard, Astron.\,Astrophys. 331, L33-L36 (1988). + +\subsection{Time Scales} + +SLALIB provides for transformation between several time scales, and involves +use of one or two others. The full list is as follows: +\begin{itemize} +\item TAI: International Atomic Time +\item UTC: Coordinated Universal Time +\item TT: Terrestrial Time +\item TDB: Barycentric Dynamical Time. +\item UT: Universal Time +\item GMST: Greenwich mean sidereal time +\item GAST (or GST): Greenwich apparent sidereal time. +\item LAST: local apparent sidereal time +\end{itemize} +Strictly speaking, UT and the sidereal times are not {\it times}\/ in +the physics sense, but {\it angles}\/ that describe Earth rotation. + +Three obsolete time scales should be mentioned here to avoid confusion. +\begin{itemize} +\item GMT: Greenwich Mean Time -- can mean either UTC or UT. +\item ET: Ephemeris Time -- more or less the same as either TT or TDB. +\item TDT: Terrestrial Dynamical Time -- former name of TT. +\end{itemize} + +time scales that have no SLALIB support at present: +\begin{itemize} +\item Any form of local civil time (BST, PDT {\it etc.}) +\item TCG: geocentric coordinate time. +\item TCB: barycentric coordinate time. +\end{itemize} + +\subsubsection{Atomic Time: TAI} +{\it International Atomic Time,} TAI, is a ``laboratory'' +time scale with no link to astronomical observations +except in an historical sense. Its +unit is the SI second, which is defined in terms of a +specific number +of wavelengths of the radiation produced by a certain electronic +transition in the caesium 133 atom. It +is realized through a changing +population of high-precision atomic clocks held +at standards institutes in various countries. There is an +elaborate process of continuous intercomparison, leading to +a weighted average of all the clocks involved. + +Though TAI shares the same second as the more familiar UTC, the +two time scales are noticeably separated in epoch because of the +build-up of leap seconds (see the next section). +At the time of writing, UTC +lags over half a minute behind TAI. + +For any given date, the difference TAI$-$UTC +can be obtained by calling the SLALIB function +sla\_DAT. +Note, however, that an up-to-date copy of the function must be used if +the most recent leap seconds are required. For applications +where this is critical, mechanisms independent of SLALIB +and under local control must +be set up; in such cases +sla\_DAT +can be useful as an +independent check, for test dates within the range of the +available version. Up-to-date information on TAI$-$UTC is available +from {\tt ftp://maia.usno.navy.mil/ser7/tai-utc.dat}. + +\subsubsection{Universal Time: UT, UTC} +\label{UTC} +{\it Universal Time,} UT, or more specifically UT1, +is in effect mean solar time and is really an expression +of Earth rotation rather than a measure of time. +Originally +defined in terms of a point in the sky called ``the fictitious +mean Sun'', UT is now defined through its relationship +with Earth rotation angle +(formerly sidereal time). +Because the Earth's rotation rate is slightly irregular and +gradually decreasing,\footnote{The Earth is slowing +down because of tidal effects. The SI +second reflects the length-of-day in the mid-19th century, when +the astronomical observations that established modern timekeeping +were being made. Since then, +the average length-of-day has increased by roughly 2~ms. +Superimposed in this gradual slowdown are +variations (seasonal and decadal) that are geophysical in origin, +notably due to large scale movements of water and atmosphere. +Because of +conservation of angular momentum, as the Earth's rotation-rate +decreases, the Moon moves farther away. In 50 billion years the +distance of the Moon will be at a maximum, 44\% greater than now, at +which stage day and month will both equal 47 present days.} +the UT second is not precisely +matched to the SI second. This makes UT itself unsuitable for +use as a time scale. + +That role is instead taken by +{\it Coordinated Universal Time,} UTC, which is clock-based and +is the foundation of civil timekeeping. +Most time zones differ from UTC by an integer number +of hours, though a few ({\it e.g.}\ parts of Canada and Australia) differ +by $n+0.5$~hours. Since its introduction, UTC has been kept +roughly in step with UT by a variety of adjustments that are +agreed in advance and then carried out in a coordinated manner by +the timekeeping communities of different countries---hence the +name. Though rate +changes were used in the past, nowadays all such adjustments +are made by occasionally inserting +a whole second. This procedure is called +a {\it leap second}. Because the day length is now slightly longer +than 86400 SI seconds, a leap second amounts to stopping the UTC +clock for a second to let the Earth catch up. + +You need UT1 in order to point a telescope or antenna at a +celestial target. To obtain it +starting from UTC, you +have to look up the value of UT1$-$UTC for the date concerned +in tables published by the International Earth Rotation and +reference frames +Service; this quantity, kept in the range +$\pm$\tsec{0}{9} by means of leap +seconds, is then added to the UTC. The quantity UT1$-$UTC, +which typically changes by of order 1~ms per day, +can be obtained only by observation (VLBI using +extragalactic radio sources), though seasonal trends +are well known and the IERS listings are able to predict some way into +the future with adequate accuracy for pointing telescopes. + +UTC leap seconds are introduced as necessary, +usually at the end of December or June. +Because on the average the solar day is slightly longer +than the nominal 86,400~SI~seconds, leap seconds are always positive; +however, provision exists for negative leap seconds if needed. +The form of a leap second can be seen from the +following description of the end of June~1994: + +\hspace{3em} +\begin{tabular}{clrccc} \\ + & & & UTC & UT1$-$UTC & UT1 \\ \\ +1994 & June & 30 & 23 59 58 & $-0.218$ & 23 59 57.782 \\ + & & & 23 59 59 & $-0.218$ & 23 59 58.782 \\ + & & & 23 59 60 & $-0.218$ & 23 59 59.782 \\ + & July & 1 & 00 00 00 & $+0.782$ & 00 00 00.782 \\ + & & & 00 00 01 & $+0.782$ & 00 00 01.782 \\ +\end{tabular} +\goodbreak + +Note that UTC has to be expressed as hours, minutes and +seconds (or at least in seconds for a given date) if leap seconds +are to be taken into account in the +correct manner. +It is improper to express a UTC as a +Julian Date, for example, because there will be an ambiguity +during a leap second (in the above example, +1994~June~30 \hms{23}{59}{60}{0} and +1994~July~1 \hms{00}{00}{00}{0} would {\it both}\/ come out as +MJD~49534.00000). Although in the vast majority of +cases this won't matter, there are potential problems in +on-line data acquisition systems and in applications involving +taking the difference between two times. Note that although the functions +sla\_DAT +and +sla\_DTT +expect UTC in the form of an MJD, the meaning here is really a +whole-number {\it date}\/ rather than a time. +Though the functions will accept +a fractional part and will almost always function correctly, on a day +which ends with a leap +second incorrect results would be obtained during the leap second +itself because by then the MJD would have moved into the next day. + +\subsubsection{Sidereal Time: GMST, LAST {\it etc.}} +Sidereal time is like the time of day but relative to the +stars rather than to the Sun. After +one sidereal day the stars come back to the same place in the +sky, apart from sub-arcsecond precession effects. Because the Earth +rotates faster relative to the stars than to the Sun by one day +per year, the sidereal second is shorter than the solar +second; the ratio is about 0.9973. + +The {\it Greenwich mean sidereal time,} GMST, is +linked to UT1 by a numerical formula which +is implemented in the SLALIB functions +sla\_GMST +and +sla\_GMSTA. +There are, of course, no leap seconds in GMST, but the sidereal +second (measured in SI seconds) +changes in length along with the UT1 second, and also varies +over long periods of time because of slow changes in the Earth's +orbit. This makes sidereal time unsuitable for everything except +predicting the apparent directions of celestial sources, in other +words as an angle rather than a time. + +The {\it local apparent sidereal time,} LAST, is the apparent right +ascension of the local meridian, from which the hour angle of any +star can be determined knowing its right +ascension. LAST can be obtained from the +GMST by adding the east longitude (corrected for polar motion +in precise work) and the {\it equation of the equinoxes}. The +latter, already described, is an aspect of the nutation effect +and can be predicted by calling the SLALIB function +sla\_EQEQX +or, neglecting certain very small terms, by calling +sla\_NUTC +and using the expression $\Delta\psi\cos\epsilon$. + +GAST, or plain GST, is GMST plus the equation of the equinoxes. + +\subsubsection{Dynamical Time: TT, TDB} +Dynamical time (formerly Ephemeris Time, ET) +is the independent variable in the theories +which describe the motions of bodies in the solar system. When +using published formulae or +tables that model the position of the +Earth in its orbit, for example, or look up +the Moon's position in a precomputed ephemeris, the date and time +must be in terms of one of the dynamical time scales. It +is a common but understandable mistake to use UTC directly, in which +case the results will be over a minute out (at the time of writing). + +It is not hard to see why such time scales are necessary. +UTC would clearly be unsuitable as the argument of an +ephemeris because of leap seconds. +A solar-system ephemeris based on UT1 or sidereal time would somehow +have to include the unpredictable variations of the Earth's rotation. +TAI would work, but in principle +the ephemeris and the ensemble of atomic clocks would +eventually drift apart. +In effect, the ephemeris {\it is}\/ a clock, with the bodies of +the solar system the hands from which the ephemeris time is read. + +Only two of the dynamical time scales are of any great importance to +observational astronomers, TT and TDB. + +{\it Terrestrial Time,} TT, is +the theoretical time scale of apparent geocentric ephemerides of solar +system bodies. It applies to clocks at sea-level, and for practical purposes +it is tied to +Atomic Time TAI through the formula TT~$=$~TAI~$+$~\tsec{32}{184}. +In practice, therefore, the units of TT are ordinary SI seconds, and +the offset of \tsec{32}{184} with respect to TAI is fixed. +The SLALIB function +sla\_DTT +returns TT$-$UTC for a given UTC +({\it n.b.}~sla\_DTT +calls +sla\_DTT, +and the latter must be an up-to-date version if recent leap seconds are +to be taken into account). + +{\it Barycentric Dynamical Time,} TDB, is a +{\it coordinate time,} suitable +for labelling events that are most simply described in a context +where the bodies of the solar system +are absent. Applications include +the emission of pulsar radiation and the motions of the +solar-system bodies themselves. When the readings of the +observer's TT clock are labelled using such a +coordinate time, differences +are seen because the clock is affected by its +speed in the barycentric coordinate system +and the gravitational potential in which it is immersed. Equivalently, +observations of pulsars +expressed in TT would display similar variations (quite +apart from the familiar light-time effects). + +TDB is defined in such a way that it keeps close to TT +on the average, with the relativistic effects emerging as +quasi-periodic differences of maximum amplitude rather less +than 2\,ms. This is +negligible for many purposes, so that TT can act as +a perfectly adequate surrogate for TDB in most cases, +but unless taken into +account would swamp +long-term analysis of pulse arrival times from the +millisecond pulsars. + +Most of the variation between TDB and TT comes from the ellipticity of +the Earth's orbit; the TT clock's speed and +gravitational potential vary slightly +during the course of the year, and as a consequence +its rate as seen from an outside observer +varies due to transverse Doppler effect and gravitational +redshift. The main component is a sinusoidal variation of +amplitude \tsec{0}{0017}; higher harmonics, and terms +caused by Moon and planets, lie two orders of magnitude below +this dominant annual term. Diurnal (topocentric) terms, a +function of UT, are $2\,\mu$s or less. + +The IAU 1976 resolution defined TDB by +stipulating that TDB$-$TT consists of periodic terms only. +This provided +a good qualitative description, but turned out to +contain hidden assumptions about the form of the +solar-system ephemeris and hence lacked dynamical +rigour. A later resolution, in 1991, introduced new +coordinate time scales, TCG and TCB, and identified TDB as a +linear transformation of one of them (TCB) with a rate +chosen not to drift from TT on the average. Unfortunately +even this improved definition has proved to +contin ambiguities. The SLALIB +sla\_RCC function implements TDB in the way that is +most consistent with the 1976 definition and +with existing practice. It provides a model of +TDB$-$TT accurate to a few nanoseconds. + +Unlike TDB, the IAU 1991 coordinate time scales TCG and TCB +(not supported by SLALIB functions at present) +do not have their rates adjusted to track TT and consequently +gain on TT and TDB, by about +\tsec{0}{02}/year and \tsec{0}{5}/year respectively. + +As already pointed out, the distinction between TT and TDB is +of no practical importance for most purposes. For +example when calling +sla\_PRENUT +to generate a precession-nutation matrix, or when calling +sla\_EVP or +sla\_EPV +to predict the +Earth's position and velocity, the time argument is strictly +TDB, but TT is entirely adequate and will require much +less computation. + +The time scale used by the JPL solar-system ephemerides is called +$T_{eph}$ and is numerically the same as TDB. + +Predictions of topocentric solar-system phenomena such as +occultations and eclipses require solar time UT as well as dynamical +time. TT/TDB/ET is all that is required in order to compute the geocentric +circumstances, but if horizon coordinates or geocentric parallax +are to be tackled UT is also needed. A rough estimate +of $\Delta {\rm T} = {\rm ET} - {\rm UT}$ is +available via the function +sla\_DT. +For a given epoch ({\it e.g.}\ 1650) this returns an approximation +to $\Delta {\rm T}$ in seconds. + + + + +\subsection{Calendars} +The ordinary {\it Gregorian Calendar Date}, +together with a time of day, can be +used to express an epoch in any desired time scale. For many purposes, +however, a continuous count of days is more convenient, and for +this purpose the system of {\it Julian Day Number}\/ can be used. +JD zero is located about 7000~years ago, well before the +historical era, and is formally defined in terms of Greenwich noon; +for example Julian Day Number 2449444 began at noon +on 1994 April~1. {\it Julian Date}\/ +is the same system but with a fractional part appended; +Julian Date 2449443.5 was the midnight on which 1994 April~1 +commenced. Because of the unwieldy size of Julian Dates +and the awkwardness of the half-day offset, it is +accepted practice to remove the leading `24' and the trailing `.5', +producing what is called the {\it Modified Julian Date}: +MJD~=~JD$-2400000.5$. SLALIB routines use MJD, as opposed to +JD, throughout, largely to avoid loss of precision. +1994 April~1 commenced at MJD~49443.0. + +Despite JD (and hence MJD) being defined in terms of (in effect) +UT, the system can be used in conjunction with other time scales +such as TAI, TT and TDB (and even sidereal time through the +concept of {\it Greenwich Sidereal Date}). However, it is improper +to express a UTC as a JD or MJD because of leap seconds. + +SLALIB has six routines for converting to and from dates in +the Gregorian calendar. The routines +sla\_CLDJ +and +sla\_CALDJ +both convert a calendar date into an MJD, the former interpreting +years between 0 and 99 as 1st century and the latter as late 20th or +early 21st century. The routines sla\_DJCL +and +sla\_DJCAL +both convert an MJD into calendar year, month, day and fraction of a day; +the latter performs rounding to a specified precision, important +to avoid dates like `{\tt 2005 04 01.***}' appearing in messages. +Some of SLALIB's low-precision ephemeris routines +(sla\_EARTH, +sla\_MOON +and +sla\_ECOR) +work in terms of year plus day-in-year (where +day~1~=~January~1st, at least for the modern era). +This form of date can be generated by +calling +sla\_CALYD +(which defaults years 0-99 into 1950-2049) +or +sla\_CLYD +(which covers the full range from prehistoric times). + +\subsection{Geocentric Coordinates} +The location of the observer on the Earth is significant in a +number of ways. The most obvious, of course, is the effect of +longitude and latitude +on the observed \azel\ of a star. Less obvious is the need to +allow for geocentric parallax when finding the Moon with a +telescope (and when doing high-precision work involving the +Sun or planets), and the need to correct observed radial +velocities and apparent pulsar periods for the effects +of the Earth's rotation. + +The SLALIB routine +sla\_OBS +supplies details of groundbased observatories from an internal +list. This is useful when writing applications that apply to +more than one observatory; the user can enter a brief name, +or browse through a list, and be spared the trouble of typing +in the full latitude, longitude {\it etc}. The following +Fortran code returns the full name, longitude and latitude +of a specified observatory: +\goodbreak +\begin{verbatim} + CHARACTER IDENT*10,NAME*40 + DOUBLE PRECISION W,P,H + : + CALL sla_OBS(0,IDENT,NAME,W,P,H) + IF (NAME.EQ.'?') ... (not recognized) +\end{verbatim} +\goodbreak +(Beware of the longitude sign convention, which is west +ve +for historical reasons.) The following lists all +the supported observatories: +\goodbreak +\begin{verbatim} + : + INTEGER N + : + N=1 + NAME=' ' + DO WHILE (NAME.NE.'?') + CALL sla_OBS(N,IDENT,NAME,W,P,H) + IF (NAME.NE.'?') THEN + WRITE (*,'(1X,I3,4X,A,4X,A)') N,IDENT,NAME + N=N+1 + END IF + END DO +\end{verbatim} +\goodbreak +The routine +sla\_GEOC +converts a {\it geodetic latitude}\/ +(one referred to the local horizon) to a geocentric position, +taking into account the Earth's oblateness and also the height +above sea level of the observer. The results are expressed in +vector form, namely as the distance of the observer from +the spin axis and equator respectively. The {\it geocentric +latitude}\/ can be found be evaluating ATAN2 of the +two numbers. A full 3-D vector description of the position +and velocity of the observer is available through the routine +sla\_PVOBS. +For a specified geodetic latitude, height above +sea level, and local sidereal time, +sla\_PVOBS +generates a 6-element vector containing the position and +velocity with respect to the true equator and equinox of +date ({\it i.e.}\ compatible with apparent \radec). For +some applications it will be necessary to convert to a +mean \radec\ frame (notably FK5, J2000) by multiplying +elements 1-3 and 4-6 respectively with the appropriate +precession matrix. (In theory an additional correction to the +velocity vector is needed to allow for differential precession, +but this correction is always negligible.) + +See also the discussion of the routine +sla\_RVEROT, +later. + +\label{ephem} +\subsection{Ephemerides} +SLALIB includes routines for generating positions and +velocities of Solar-System bodies. The accuracy objectives are +modest, and the SLALIB facilities do not attempt +to compete with precomputed ephemerides such as +those provided by JPL, or with models containing +thousands of terms. It is also worth noting +that SLALIB's very accurate star coordinate conversion +routines are not strictly applicable to solar-system cases, +though they are adequate for most practical purposes. + +Earth/Sun ephemerides can be generated using the routines +sla\_EVP and +sla\_EPV, +each of which predict Earth position and velocity with respect to both the +solar-system barycentre and the +Sun. The two routines offer different trade-offs between +accuracy and execution time. For most purposes, +sla\_EVP is adequate: +maximum velocity error is 0.42~metres per second; maximum +heliocentric position error is 1600~km (equivalent to +about \arcseci{2} at 1~AU), with +barycentric position errors about 4 times worse. +The larger and slower +sla\_EPV +delivers $3\sigma$ results of 0.005~metres per second in velocity +and 15~km in position, and is particularly useful when predicting +apparent directions of near-Earth objects. +(The Sun's position as +seen from the Earth can, of course, be obtained simply by +reversing the signs of the Cartesian components of the +Earth\,:\,Sun vector.) + +Geocentric Moon ephemerides are available from +sla\_DMOON, +which predicts the Moon's position and velocity with respect to +the Earth's centre. Direction accuracy is usually better than +10~km (\arcseci{5}) and distance accuracy a little worse. + +Lower-precision but faster predictions for the Sun and Moon +can be made by calling +sla\_EARTH +and +sla\_MOON. +Both are single precision and accept dates in the form of +year, day-in-year and fraction of day +(starting from a calendar date you need to call +sla\_CLYD +or +sla\_CALYD +to get the required year and day). +The +sla\_EARTH +routine returns the heliocentric position and velocity +of the Earth's centre for the mean equator and +equinox of date. The accuracy is better than 20,000~km in position +and 10~metres per second in speed. +The +position and velocity of the Moon with respect to the +Earth's centre for the mean equator and ecliptic of date +can be obtained by calling +sla\_MOON. +The positional accuracy is better than \arcseci{30} in direction +and 1000~km in distance. + +Approximate ephemerides for all the major planets +can be generated by calling +sla\_PLANET +or +sla\_RDPLAN. These routines offer arcminute accuracy (much +better for the inner planets and for Pluto) over a span of several +millennia (but only $\pm100$ years for Pluto). +The routine +sla\_PLANET produces heliocentric position and +velocity in the form of equatorial \xyzxyzd\ for the +mean equator and equinox of J2000. The vectors +produced by +sla\_PLANET +can be used in a variety of ways according to the +requirements of the application concerned. The routine +sla\_RDPLAN +uses +sla\_PLANET +and +sla\_DMOON +to deal with the common case of predicting +a planet's apparent \radec\ and angular size as seen by a +terrestrial observer. + +Note that in predicting the position in the sky of a solar-system body +it is necessary to allow for geocentric parallax. This correction +is {\it essential}\/ in the case of the Moon, where the observer's +position on the Earth can affect the Moon's \radec\ by up to +$1^\circ$. The calculation can most conveniently be done by calling +sla\_PVOBS and subtracting the resulting 6-vector from the +one produced by +sla\_DMOON, as is demonstrated by the following example: +\goodbreak +\begin{verbatim} + * Demonstrate the size of the geocentric parallax correction + * in the case of the Moon. The test example is for the AAT, + * before midnight, in summer, near first quarter. + + IMPLICIT NONE + CHARACTER NAME*40,SH,SD + INTEGER J,I,IHMSF(4),IDMSF(4) + DOUBLE PRECISION SLONGW,SLAT,H,DJUTC,FDUTC,DJUT1,DJTT,STL, + : RMATN(3,3),PMM(6),PMT(6),RM,DM,PVO(6),TL + DOUBLE PRECISION sla_DTT,sla_GMST,sla_EQEQX,sla_DRANRM + + * Get AAT longitude and latitude in radians and height in metres + CALL sla_OBS(0,'AAT',NAME,SLONGW,SLAT,H) + + * UTC (1992 January 13, 11 13 59) to MJD + CALL sla_CLDJ(1992,1,13,DJUTC,J) + CALL sla_DTF2D(11,13,59.0D0,FDUTC,J) + DJUTC=DJUTC+FDUTC + + * UT1 (UT1-UTC value of -0.152 sec is from IERS Bulletin B) + DJUT1=DJUTC+(-0.152D0)/86400D0 + + * TT + DJTT=DJUTC+sla_DTT(DJUTC)/86400D0 + + * Local apparent sidereal time + STL=sla_GMST(DJUT1)-SLONGW+sla_EQEQX(DJTT) + + * Geocentric position/velocity of Moon (mean of date) + CALL sla_DMOON(DJTT,PMM) + + * Nutation to true equinox of date + CALL sla_NUT(DJTT,RMATN) + CALL sla_DMXV(RMATN,PMM,PMT) + CALL sla_DMXV(RMATN,PMM(4),PMT(4)) + + * Report geocentric HA,Dec + CALL sla_DCC2S(PMT,RM,DM) + CALL sla_DR2TF(2,sla_DRANRM(STL-RM),SH,IHMSF) + CALL sla_DR2AF(1,DM,SD,IDMSF) + WRITE (*,'(1X,'' geocentric:'',2X,A,I2.2,2I3.2,''.'',I2.2,'// + : '1X,A,I2.2,2I3.2,''.'',I1)') + : SH,IHMSF,SD,IDMSF + + * Geocentric position of observer (true equator and equinox of date) + CALL sla_PVOBS(SLAT,H,STL,PVO) + + * Place origin at observer + DO I=1,6 + PMT(I)=PMT(I)-PVO(I) + END DO + + * Allow for planetary aberration + TL=499.004782D0*SQRT(PMT(1)**2+PMT(2)**2+PMT(3)**2) + DO I=1,3 + PMT(I)=PMT(I)-TL*PMT(I+3) + END DO + + * Report topocentric HA,Dec + CALL sla_DCC2S(PMT,RM,DM) + CALL sla_DR2TF(2,sla_DRANRM(STL-RM),SH,IHMSF) + CALL sla_DR2AF(1,DM,SD,IDMSF) + WRITE (*,'(1X,''topocentric:'',2X,A,I2.2,2I3.2,''.'',I2.2,'// + : '1X,A,I2.2,2I3.2,''.'',I1)') + : SH,IHMSF,SD,IDMSF + END +\end{verbatim} +\goodbreak +The output produced is as follows: +\goodbreak +\begin{verbatim} + geocentric: +03 06 55.55 +15 03 38.8 + topocentric: +03 09 23.76 +15 40 51.4 +\end{verbatim} +\goodbreak +(An easier but +less instructive method of estimating the topocentric apparent place of the +Moon is to call the routine +sla\_RDPLAN.) + +As an example of using +sla\_PLANET, +the following program estimates the geocentric separation +between Venus and Jupiter during a close conjunction +in 2\,BC, which is a star-of-Bethlehem candidate: +\goodbreak +\begin{verbatim} + * Compute time and minimum geocentric apparent separation + * between Venus and Jupiter during the close conjunction of 2 BC. + + IMPLICIT NONE + + DOUBLE PRECISION SEPMIN,DJD0,FD,DJD,DJDM,PV(6),RMATP(3,3), + : PVM(6),PVE(6),TL,RV,DV,RJ,DJ,SEP + INTEGER IHOUR,IMIN,J,I,IHMIN,IMMIN + DOUBLE PRECISION sla_EPJ,sla_DSEP + + + * Search for closest approach on the given day + DJD0=1720859.5D0 + SEPMIN=1D10 + DO IHOUR=20,22 + DO IMIN=0,59 + CALL sla_DTF2D(IHOUR,IMIN,0D0,FD,J) + + * Julian date and MJD + DJD=DJD0+FD + DJDM=DJD-2400000.5D0 + + * Earth to Moon (mean of date) + CALL sla_DMOON(DJDM,PV) + + * Precess Moon position to J2000 + CALL sla_PRECL(sla_EPJ(DJDM),2000D0,RMATP) + CALL sla_DMXV(RMATP,PV,PVM) + + * Sun to Earth-Moon Barycentre (mean J2000) + CALL sla_PLANET(DJDM,3,PVE,J) + + * Correct from EMB to Earth + DO I=1,3 + PVE(I)=PVE(I)-0.012150581D0*PVM(I) + END DO + + * Sun to Venus + CALL sla_PLANET(DJDM,2,PV,J) + + * Earth to Venus + DO I=1,6 + PV(I)=PV(I)-PVE(I) + END DO + + * Light time to Venus (sec) + TL=499.004782D0*SQRT((PV(1)-PVE(1))**2+ + : (PV(2)-PVE(2))**2+ + : (PV(3)-PVE(3))**2) + + * Extrapolate backwards in time by that much + DO I=1,3 + PV(I)=PV(I)-TL*PV(I+3) + END DO + + * To RA,Dec + CALL sla_DCC2S(PV,RV,DV) + + * Same for Jupiter + CALL sla_PLANET(DJDM,5,PV,J) + DO I=1,6 + PV(I)=PV(I)-PVE(I) + END DO + TL=499.004782D0*SQRT((PV(1)-PVE(1))**2+ + : (PV(2)-PVE(2))**2+ + : (PV(3)-PVE(3))**2) + DO I=1,3 + PV(I)=PV(I)-TL*PV(I+3) + END DO + CALL sla_DCC2S(PV,RJ,DJ) + + * Separation (arcsec) + SEP=sla_DSEP(RV,DV,RJ,DJ) + + * Keep if smallest so far + IF (SEP.LT.SEPMIN) THEN + IHMIN=IHOUR + IMMIN=IMIN + SEPMIN=SEP + END IF + END DO + END DO + + * Report + WRITE (*,'(1X,I2.2,'':'',I2.2,F6.1)') IHMIN,IMMIN, + : 206264.8062D0*SEPMIN + + END +\end{verbatim} +\goodbreak +The output produced (the Ephemeris Time on the day in question, and +the closest approach in arcseconds) is as follows: +\goodbreak +\begin{verbatim} + 21:16 33.3 +\end{verbatim} +\goodbreak +For comparison, accurate JPL predictions +give a separation \arcseci{8} less than +the above estimate, occurring $30^{\rm m}$ earlier +(see {\it Sky and Telescope,}\/ April~1987, p\,357). + +The following program demonstrates +sla\_RDPLAN. +\begin{verbatim} + * For a given date, time and geographical location, output + * a table of planetary positions and diameters. + + IMPLICIT NONE + CHARACTER PNAMES(0:9)*7,B*80,S + INTEGER I,NP,IY,J,IM,ID,IHMSF(4),IDMSF(4) + DOUBLE PRECISION D15B2P,R2AS,FD,DJM,ELONG,PHI,RA,DEC,DIAM + PARAMETER (D15B2P=2.3873241463784300365D0, + : R2AS=206264.80625D0) + DATA PNAMES / 'Sun','Mercury','Venus','Moon','Mars','Jupiter', + : 'Saturn','Uranus','Neptune', 'Pluto' / + + + * Loop until 'end' typed + B=' ' + DO WHILE (B.NE.'END'.AND.B.NE.'end') + + * Get date, time and observer's location + PRINT *,'Date? (Y,M,D, Gregorian)' + READ (*,'(A)') B + IF (B.NE.'END'.AND.B.NE.'end') THEN + I=1 + CALL sla_INTIN(B,I,IY,J) + CALL sla_INTIN(B,I,IM,J) + CALL sla_INTIN(B,I,ID,J) + PRINT *,'Time? (H,M,S, dynamical)' + READ (*,'(A)') B + I=1 + CALL sla_DAFIN(B,I,FD,J) + FD=FD*D15B2P + CALL sla_CLDJ(IY,IM,ID,DJM,J) + DJM=DJM+FD + PRINT *,'Longitude? (D,M,S, east +ve)' + READ (*,'(A)') B + I=1 + CALL sla_DAFIN(B,I,ELONG,J) + PRINT *,'Latitude? (D,M,S, geodetic)' + READ (*,'(A)') B + I=1 + CALL sla_DAFIN(B,I,PHI,J) + + * Loop planet by planet + DO NP=0,9 + + * Get RA,Dec and diameter + CALL sla_RDPLAN(DJM,NP,ELONG,PHI,RA,DEC,DIAM) + + * One line of report + CALL sla_DR2TF(2,RA,S,IHMSF) + CALL sla_DR2AF(1,DEC,S,IDMSF) + WRITE (*, + : '(1X,A,2X,3I3.2,''.'',I2.2,2X,A,I2.2,2I3.2,''.'',I1,F8.1)') + : PNAMES(NP),IHMSF,S,IDMSF,R2AS*DIAM + + * Next planet + END DO + PRINT *,' ' + END IF + + * Next case + END DO + + END +\end{verbatim} +Entering the following data (for 1927~June~29 at $5^{\rm h}\,25^{\rm m}$~ET +and the position of Preston, UK): +\begin{verbatim} + 1927 6 29 + 5 25 + -2 42 + 53 46 +\end{verbatim} +produces the following report: +\begin{verbatim} + Sun 06 28 14.03 +23 17 17.3 1887.8 + Mercury 08 08 58.60 +19 20 57.1 9.3 + Venus 09 38 53.61 +15 35 32.8 22.8 + Moon 06 28 15.95 +23 17 21.3 1902.3 + Mars 09 06 49.33 +17 52 26.6 4.0 + Jupiter 00 11 12.08 -00 10 57.5 41.1 + Saturn 16 01 43.35 -18 36 55.9 18.2 + Uranus 00 13 33.54 +00 39 36.1 3.5 + Neptune 09 49 35.76 +13 38 40.8 2.2 + Pluto 07 05 29.51 +21 25 04.2 0.1 +\end{verbatim} +Inspection of the Sun and Moon data reveals that +a total solar eclipse is in progress. + +SLALIB also provides for the case where orbital elements (with respect +to the J2000 equinox and ecliptic) +are available. This allows predictions to be made for minor-planets and +(if you ignore non-gravitational effects) +comets. Furthermore, if major-planet elements for an epoch close to the date +in question are available, more accurate predictions can be made than +are offered by +sla\_RDPLAN and +sla\_PLANET. + +The SLALIB planetary-prediction +routines that work with orbital elements are +sla\_PLANTE (the orbital-elements equivalent of +sla\_RDPLAN), which predicts the topocentric \radec, and +sla\_PLANEL (the orbital-elements equivalent of +sla\_PLANET), which predicts the heliocentric \xyzxyzd\ with respect to the +J2000 equinox and equator. In addition, the routine +sla\_PV2EL does the inverse of +sla\_PLANEL, transforming \xyzxyzd\ into {\it osculating elements.} + +Osculating elements describe the unperturbed 2-body orbit. Depending +on accuracy requirements, this unperturbed orbit is an +adequate approximation to the actual orbit for a few weeks either +side of the specified epoch, outside which perturbations due to +the other bodies of the Solar System lead to +increasing errors. Given a minor planet's osculating elements for +a particular date, predictions for a date only +100 days earlier or later +are likely to be in error by several arcseconds. +These errors can +be reduced if new elements are generated which take account of +the perturbations of the major planets, and this is what the routine +sla\_PERTEL does. Once +sla\_PERTEL has been called, to provide osculating elements +close to the required date, the elements can be passed to +sla\_PLANEL or +sla\_PLANTE in the normal way. Predictions of arcsecond accuracy +over a span of a decade or more are available using this +technique. + +Three different combinations of orbital elements are +provided for, matching the usual conventions +for major planets, minor planets and +comets respectively. The choice is made through the +argument {\tt JFORM}: + +\vspace{1ex} +\hspace{3em} +\begin{tabular}{|c|c|c|} \hline +{\tt JFORM=1} & {\tt JFORM=2} & {\tt JFORM=3} \\ +\hline \hline +$t_0$ & $t_0$ & $T$ \\ +\hline +$i$ & $i$ & $i$ \\ +\hline +$\Omega$ & $\Omega$ & $\Omega$ \\ +\hline +$\varpi$ & $\omega$ & $\omega$ \\ +\hline +$a$ & $a$ & $q$ \\ +\hline +$e$ & $e$ & $e$ \\ +\hline +$L$ & $M$ & \\ +\hline +$n$ & & \\ +\hline +\end{tabular}\\[2ex] +The symbols have the following meanings: + +\vspace{-1ex} + +\begin{tabular}{lll} +& $t_0$ & epoch of osculation \\ +& $T$ & epoch of perihelion passage \\ +& $i$ & inclination of the orbit \\ +& $\Omega$ & longitude of the ascending node \\ +& $\varpi$ & longitude of perihelion ($\varpi = \Omega + \omega$) \\ +& $\omega$ & argument of perihelion \\ +& $a$ & semi-major axis of the orbital ellipse \\ +& $q$ & perihelion distance \\ +& $e$ & orbital eccentricity \\ +& $L$ & mean longitude ($L = \varpi + M$) \\ +& $M$ & mean anomaly \\ +& $n$ & mean motion \\ +\end{tabular} + +The mean motion, $n$, tells +sla\_PLANEL the mass of the planet. +If it is not available, it should be calculated +from $n^2 a^3 = k^2 (1+m)$, where $k = 0.01720209895$ and +m is the mass of the planet ($M_\odot = 1$); $a$ is in AU. + +Note that for any given problem there are up to three different +epochs in play, and it is vital to distinguish clearly between +them: +\begin{itemize} +\item The epoch of observation: the moment in time for which the + position of the body is to be predicted. +\item The epoch defining the position of the body: the moment in time + at which, in the absence of purturbations, the specified + position---mean longitude, mean anomaly, or perihelion---is + reached. +\item The epoch of osculation: the moment in time at which the given + elements precisely specify the body's position and velocity. +\end{itemize} + +For the major-planet and minor-planet cases it is usual to make +the epoch that defines the position of the body the same as the +epoch of osculation. Thus, for planets (major and +minor) only two different epochs are +involved: the epoch of the elements and the epoch of observation. +For comets, the epoch of perihelion fixes the position in the +orbit and in general a different epoch of osculation will be +chosen. Thus, for comets all three types of epoch are involved. +How many of the three elements are present in a given SLALIB +argument list depends on the routine concerned. + +Two important sources for orbital elements are the {\it Horizons}\/ +service, operated by the Jet Propulsion Laboratory, Pasadena, +and the Minor Planet Center, operated by the Center for +Astrophysics, Harvard. +The JPL elements (heliocentric, J2000 ecliptic and +equinox) and MPC elements +correspond to SLALIB arguments as shown in the following table, +where ``(rad)'' means conversion from degrees to radians, and +``(MJD)'' means ``subtract {\tt 2400000.5D0}'': + +\vspace{2ex} + +\begin{small} +\begin{tabular}{|c||c|c|c||c|c|} \hline +{\it SLALIB } & \multicolumn{3}{c||}{\it JPL} + & \multicolumn{2}{c|}{\it MPC} \\ +argument & major planet & minor planet & comet & minor planet & comet \\ +\hline \hline +{\tt JFORM} & {\tt 1} & {\tt 2} & {\tt 3} & {\tt 2} & {\tt 3} \\ +{\tt EPOCH} & {\tt JDCT} (MJD) & {\tt JDCT} (MJD) & {\tt Tp} (MJD) & + {\tt Epoch} (MJD) & {\tt T} (MJD) \\ +{\tt ORBINC} & {\tt IN} (rad) & {\tt IN} (rad) & {\tt IN} (rad) & + {\tt Incl.} (rad) & {\tt Incl.} (rad) \\ +{\tt ANODE} & {\tt OM} (rad) & {\tt OM} (rad) & {\tt OM} (rad) & + {\tt Node} (rad) & {\tt Node.} (rad) \\ +{\tt PERIH} & {\tt OM+W} (rad) & {\tt W} (rad) & {\tt W} (rad) & + {\tt Perih.} (rad) & {\tt Perih.} (rad) \\ +{\tt AORQ} & {\tt A} & {\tt A} & {\tt QR} & {\tt a} & {\tt q} \\ +{\tt E} & {\tt EC} & {\tt EC} & {\tt EC} & {\tt e} & {\tt e} \\ +{\tt AORL} & {\tt MA+OM+W} (rad) & {\tt MA} (rad) & & {\tt M} (rad) & \\ +{\tt DM} & {\tt N} (rad) & & & & \\ \hline +epoch of osculation & {\tt JDCT} (MJD) + & {\tt JDCT} (MJD) + & {\tt JDCT} (MJD) + & {\tt Epoch} (MJD) + & {\tt Epoch} (MJD) \\ +\hline +\end{tabular} +\end{small}\\[3ex] + +Conventional elements are not the only way of specifying an orbit. +The \xyzxyzd\ state vector is an equally valid specification, +and the so-called {\it method of universal variables}\/ allows +orbital calculations to be made directly, bypassing angular +quantities and avoiding Kepler's Equation. The universal-variables +approach has various advantages, including better handling of +near-parabolic cases and greater efficiency. +SLALIB uses universal variables for its internal +calculations and also offers a number of routines which +applications can call. + +The universal elements are the \xyzxyzd\ and its epoch, plus the mass +of the body. The SLALIB routines supplement these elements with +certain redundant values in order to +avoid unnecessary recomputation when the elements are next used. + +The routines +sla\_EL2UE and +sla\_UE2EL transform conventional elements into the +universal form and {\it vice versa.} +The routine +sla\_PV2UE takes an \xyzxyzd\ and forms the set of universal +elements; +sla\_UE2PV takes a set of universal elements and predicts the \xyzxyzd\ +for a specified epoch. +The routine +sla\_PERTUE provides updated universal elements, +taking into account perturbations from the major planets. +Starting with universal elements, the routine +sla\_PLANTU (the universal elements equivalent of +sla\_PLANTE) predicts topocentric \radec. + +\subsection{Radial Velocity and Light-Time Corrections} +When publishing high-resolution spectral observations +it is necessary to refer them to a specified standard of rest. +This involves knowing the component in the direction of the +source of the velocity of the observer. SLALIB provides a number +of routines for this purpose, allowing observations to be +referred to the Earth's centre, the Sun, a Local Standard of Rest +(either dynamical or kinematical), the centre of the Galaxy, and +the mean motion of the Local Group. + +The routine +sla\_RVEROT +corrects for the diurnal rotation of +the observer around the Earth's axis. This is always less than 0.5~km/s. + +No specific routine is provided to correct a radial velocity +from geocentric to heliocentric, but this can easily be done by calling +sla\_EVP +as follows (array declarations {\it etc}.\ omitted): +\goodbreak +\begin{verbatim} + : + * Star vector, J2000 + CALL sla_DCS2C(RM,DM,V) + + * Earth/Sun velocity and position, J2000 + CALL sla_EVP(TDB,2000D0,DVB,DPB,DVH,DPH) + + * Radial velocity correction due to Earth orbit (km/s) + VCORB = -sla_DVDV(V,DVH)*149.597870D6 + : +\end{verbatim} +\goodbreak +The maximum value of this correction is the Earth's orbital speed +of about 30~km/s. A related routine, +sla\_ECOR, +computes the light-time correction with respect to the Sun. It +would be used when reducing observations of a rapid variable-star +for instance. +For pulsar work the +sla\_EVP routine is not sufficiently accurate for +phase predictions, being limited to about 25~ms. The +alternative sla\_EPV routine will deliver pulse arrival times +accurate to 50~$\mu$s, but is significantly slower. + +To remove the intrinsic $\sim20$~km/s motion of the Sun relative +to other stars in the solar neighbourhood, +a velocity correction to a +{\it local standard of rest}\/ (LSR) is required. There are +opportunities for mistakes here. There are two sorts of LSR, +{\it dynamical}\/ and {\it kinematical}, and +multiple definitions exist for the latter. The +dynamical LSR is a point near the Sun which is in a circular +orbit around the Galactic centre; the Sun has a ``peculiar'' +motion relative to the dynamical LSR. A kinematical LSR is +the mean standard of rest of specified star catalogues or stellar +populations, and its precise definition depends on which +catalogues or populations were used and how the analysis was +carried out. The Sun's motion with respect to a kinematical +LSR is called the ``standard'' solar motion. Radial +velocity corrections to the dynamical LSR are produced by the routine +sla\_RVLSRD +and to the adopted kinematical LSR by +sla\_RVLSRK. +See the individual specifications for these routines for the +precise definition of the LSR in each case. + +For extragalactic sources, the centre of the Galaxy can be used as +a standard of rest. The radial velocity correction from the +dynamical LSR to the Galactic centre can be obtained by calling +sla\_RVGALC. +Its maximum value is 220~km/s. + +For very distant sources it is appropriate to work relative +to the mean motion of the Local Group. The routine for +computing the radial velocity correction in this case is +sla\_RVLG. +Note that in this case the correction is with respect to the +dynamical LSR, not the Galactic centre as might be expected. +This conforms to the IAU definition, and confers immunity from +revisions of the Galactic rotation speed. + +\subsection{Focal-Plane Astrometry} +The relationship between the position of a star image in +the focal plane of a telescope and the star's celestial +coordinates is usually described in terms of the {\it tangent plane}\/ +or {\it gnomonic}\/ projection. This is the projection produced +by a pin-hole camera and is a good approximation to the projection +geometry of a traditional large {\it f}\/-ratio astrographic refractor. +SLALIB includes a group of routines which transform +star positions between their observed places on the celestial +sphere and their \xy\ coordinates in the tangent plane. The +spherical coordinate system does not have to be \radec\ but +usually is. The so-called {\it standard coordinates}\/ of a star +are the tangent plane \xy, in radians, with respect to an origin +at the tangent point, with the $y$-axis pointing north and +the $x$-axis pointing east (in the direction of increasing $\alpha$). +The factor relating the standard coordinates to +the actual \xy\ coordinates in, say, millimetres is simply +the focal length of the telescope. + +Given the \radec\ of the {\it plate centre}\/ (the tangent point) +and the \radec\ of a star within the field, the standard +coordinates can be determined by calling +sla\_S2TP +(single precision) or +sla\_DS2TP +(double precision). The reverse transformation, where the +\xy\ is known and we wish to find the \radec, is carried out by calling +sla\_TP2S +or +sla\_DTP2S. +Occasionally we know the both the \xy\ and the \radec\ of a +star and need to deduce the \radec\ of the tangent point; +this can be done by calling +sla\_TPS2C +or +sla\_DTPS2C. +(All of these transformations apply not just to \radec\ but to +other spherical coordinate systems, of course.) +Equivalent (and faster) +routines are provided which work directly in \xyz\ instead of +spherical coordinates: +sla\_V2TP and +sla\_DV2TP, +sla\_TP2V and +sla\_DTP2V, +sla\_TPV2C and +sla\_DTPV2C. + +Even at the best of times, the tangent plane projection is merely an +approximation. Some telescopes and cameras exhibit considerable pincushion +or barrel distortion and some have a curved focal surface. +For example, neither Schmidt cameras nor (especially) +large reflecting telescopes with wide-field corrector lenses +are adequately modelled by tangent-plane geometry. In such +cases, however, it is still possible to do most of the work +using the (mathematically convenient) tangent-plane +projection by inserting an extra step which applies or +removes the distortion peculiar to the system concerned. +A simple $r_1=r_0(1+Kr_0^2)$ law works well in the +majority of cases; $r_0$ is the radial distance in the +tangent plane, $r_1$ is the radial distance after adding +the distortion, and $K$ is a constant which depends on the +telescope ($\theta$ is unaffected). The routine +sla\_PCD +applies the distortion to an \xy\ and +sla\_UNPCD +removes it. For \xy\ in radians, $K$ values range from $-1/3$ for the +tiny amount of barrel distortion in Schmidt geometry to several +hundred for the serious pincushion distortion +produced by wide-field correctors in big reflecting telescopes +(the AAT prime focus triplet corrector is about $K=+178.6$). + +SLALIB includes a group of routines which can be put together +to build a simple plate-reduction program. The heart of the group is +sla\_FITXY, +which fits a linear model to relate two sets of \xy\ coordinates, +in the case of a plate reduction the measured positions of the +images of a set of +reference stars and the standard +coordinates derived from their catalogue positions. The +model is of the form: +\[x_{p} = a + bx_{m} + cy_{m}\] +\[y_{p} = d + ex_{m} + fy_{m}\] + +where the {\it p}\/ subscript indicates ``predicted'' coordinates +(the model's approximation to the ideal ``expected'' coordinates) and the +{\it m}\/ subscript indicates ``measured coordinates''. The +six coefficients {\it a--f}\/ can optionally be +constrained to represent a ``solid body rotation'' free of +any squash or shear distortions. Without this constraint +the model can, to some extent, accommodate effects like refraction, +allowing mean places to be used directly and +avoiding the extra complications of a +full mean-apparent-observed transformation for each star. +Having obtained the linear model, +sla\_PXY +can be used to process the set of measured and expected +coordinates, giving the predicted coordinates and determining +the RMS residuals in {\it x}\/ and {\it y}. +The routine +sla\_XY2XY +transforms one \xy\ into another using the linear model. A model +can be inverted by calling +sla\_INVF, +and decomposed into zero points, scales, $x/y$ nonperpendicularity +and orientation by calling +sla\_DCMPF. + +\subsection{Numerical Methods} +SLALIB contains a small number of simple, general-purpose +numerical-methods routines. They have no specific +connection with positional astronomy but have proved useful in +applications to do with simulation and fitting. + +At the heart of many simulation programs is the generation of +pseudo-random numbers, evenly distributed in a given range: +sla\_RANDOM +does this. Pseudo-random normal deviates, or ``Gaussian +residuals'', are often required to simulate noise and +can be generated by means of the function +sla\_GRESID. +Neither routine will pass super-sophisticated +statistical tests, but they work adequately for most +practical purposes and avoid the need to call non-standard +library routines peculiar to one sort of computer. + +Applications which perform a least-squares fit using a traditional +normal-equations methods can accomplish the required matrix-inversion +by calling either +sla\_SMAT +(single precision) or +sla\_DMAT +(double). A generally better way to perform such fits is +to use singular value decomposition. SLALIB provides a routine +to do the decomposition itself, +sla\_SVD, +and two routines to use the results: +sla\_SVDSOL +generates the solution, and +sla\_SVDCOV +produces the covariance matrix. +A simple demonstration of the use of the SLALIB SVD +routines is given below. It generates 500 simulated data +points and fits them to a model which has 4 unknown coefficients. +(The arrays in the example are sized to accept up to 1000 +points and 20 unknowns.) The model is: +\[ y = C_{1} +C_{2}x +C_{3}sin{x} +C_{4}cos{x} \] +The test values for the four coefficients are +$C_1\!=\!+50.0$, +$C_2\!=\!-2.0$, +$C_3\!=\!-10.0$ and +$C_4\!=\!+25.0$. +Gaussian noise, $\sigma=5.0$, is added to each ``observation''. +\goodbreak +\begin{verbatim} + IMPLICIT NONE + + * Sizes of arrays, physical and logical + INTEGER MP,NP,NC,M,N + PARAMETER (MP=1000,NP=10,NC=20,M=500,N=4) + + * The unknowns we are going to solve for + DOUBLE PRECISION C1,C2,C3,C4 + PARAMETER (C1=50D0,C2=-2D0,C3=-10D0,C4=25D0) + + * Arrays + DOUBLE PRECISION A(MP,NP),W(NP),V(NP,NP), + : WORK(NP),B(MP),X(NP),CVM(NC,NC) + + DOUBLE PRECISION VAL,BF1,BF2,BF3,BF4,SD2,D,VAR + REAL sla_GRESID + INTEGER I,J + + * Fill the design matrix + DO I=1,M + + * Dummy independent variable + VAL=DBLE(I)/10D0 + + * The basis functions + BF1=1D0 + BF2=VAL + BF3=SIN(VAL) + BF4=COS(VAL) + + * The observed value, including deliberate Gaussian noise + B(I)=C1*BF1+C2*BF2+C3*BF3+C4*BF4+DBLE(sla_GRESID(5.0)) + + * Fill one row of the design matrix + A(I,1)=BF1 + A(I,2)=BF2 + A(I,3)=BF3 + A(I,4)=BF4 + END DO + + * Factorize the design matrix, solve and generate covariance matrix + CALL sla_SVD(M,N,MP,NP,A,W,V,WORK,J) + CALL sla_SVDSOL(M,N,MP,NP,B,A,W,V,WORK,X) + CALL sla_SVDCOV(N,NP,NC,W,V,WORK,CVM) + + * Compute the variance + SD2=0D0 + DO I=1,M + VAL=DBLE(I)/10D0 + BF1=1D0 + BF2=VAL + BF3=SIN(VAL) + BF4=COS(VAL) + D=B(I)-(X(1)*BF1+X(2)*BF2+X(3)*BF3+X(4)*BF4) + SD2=SD2+D*D + END DO + VAR=SD2/DBLE(M) + + * Report the RMS and the solution + WRITE (*,'(1X,''RMS ='',F5.2/)') SQRT(VAR) + DO I=1,N + WRITE (*,'(1X,''C'',I1,'' ='',F7.3,'' +/-'',F6.3)') + : I,X(I),SQRT(VAR*CVM(I,I)) + END DO + END +\end{verbatim} +\goodbreak +The program produces output like the following: +\goodbreak +\begin{verbatim} + RMS = 4.88 + + C1 = 50.192 +/- 0.439 + C2 = -2.002 +/- 0.015 + C3 = -9.771 +/- 0.310 + C4 = 25.275 +/- 0.310 +\end{verbatim} +\goodbreak +In this above example, essentially +identical results would be obtained if the more +commonplace normal-equations method had been used, and the large +$1000\times20$ array would have been avoided. However, the SVD method +comes into its own when the opportunity is taken to edit the W-matrix +(the so-called ``singular values'') in order to control +possible ill-conditioning. The procedure involves replacing with +zeroes any W-elements smaller than a nominated value, for example +0.001 times the largest W-element. Small W-elements indicate +ill-conditioning, which in the case of the normal-equations +method would produce spurious large coefficient values and +possible arithmetic overflows. Using SVD, the effect on the solution +of setting suspiciously small W-elements to zero is to restrain +the offending coefficients from moving very far. The +fact that action was taken can be reported to show the program user that +something is amiss. Furthermore, if element W(J) was set to zero, +the row numbers of the two biggest elements in the Jth column of the +V-matrix identify the pair of solution coefficients that are +dependent. + +A more detailed description of SVD and its use in least-squares +problems would be out of place here, and the reader is urged +to refer to the relevant sections of the book {\it Numerical Recipes} +(Press {\it et al.}, Cambridge University Press, 1987). + +The routines +sla\_COMBN +and +sla\_PERMUT +are useful for problems which involve combinations (different subsets) +and permutations (different orders). +Both return the next in a sequence of results, cycling through all the +possible results as the routine is called repeatedly. + +\vfill + +\pagebreak + +\section{SUMMARY OF CALLS} +The basic trigonometrical and numerical facilities are supplied in both single +and double precision versions. +Most of the more esoteric position and time routines use double precision +arguments only, even in cases where single precision would normally be adequate +in practice. +Certain routines with modest accuracy objectives are supplied in +single precision versions only. +In the calling sequences which follow, no attempt has been made +to distinguish between single and double precision argument names, +and frequently the same name is used on different occasions to +mean different things. +However, none of the routines uses a mixture of single and +double precision arguments; each routine is either wholly +single precision or wholly double precision. + +In the classified list, below, +{\it subroutine}\/ subprograms are those whose names and argument lists +are preceded by `CALL', whereas {\it function}\/ subprograms are +those beginning `R=' (when the result is REAL) or `D=' (when +the result is DOUBLE~PRECISION). + +The list is, of course, merely for quick reference; inexperienced +users {\bf must} refer to the detailed specifications given later. +In particular, {\bf don't guess} whether arguments are single or +double precision; the result could be a program that happens to +works on one sort of machine but not on another. + +\callhead{String Decoding} +\begin{callset} +\subp{CALL sla\_INTIN (STRING, NSTRT, IRESLT, JFLAG)} + Convert free-format string into integer +\subq{CALL sla\_FLOTIN (STRING, NSTRT, RESLT, JFLAG)} + {CALL sla\_DFLTIN (STRING, NSTRT, DRESLT, JFLAG)} + Convert free-format string into floating-point number +\subq{CALL sla\_AFIN (STRING, NSTRT, RESLT, JFLAG)} + {CALL sla\_DAFIN (STRING, NSTRT, DRESLT, JFLAG)} + Convert free-format string from deg,arcmin,arcsec to radians +\end{callset} + +\callhead{Sexagesimal Conversions} +\begin{callset} +\subq{CALL sla\_CTF2D (IHOUR, IMIN, SEC, DAYS, J)} + {CALL sla\_DTF2D (IHOUR, IMIN, SEC, DAYS, J)} + Hours, minutes, seconds to days +\subq{CALL sla\_CD2TF (NDP, DAYS, SIGN, IHMSF)} + {CALL sla\_DD2TF (NDP, DAYS, SIGN, IHMSF)} + Days to hours, minutes, seconds +\subq{CALL sla\_CTF2R (IHOUR, IMIN, SEC, RAD, J)} + {CALL sla\_DTF2R (IHOUR, IMIN, SEC, RAD, J)} + Hours, minutes, seconds to radians +\subq{CALL sla\_CR2TF (NDP, ANGLE, SIGN, IHMSF)} + {CALL sla\_DR2TF (NDP, ANGLE, SIGN, IHMSF)} + Radians to hours, minutes, seconds +\subq{CALL sla\_CAF2R (IDEG, IAMIN, ASEC, RAD, J)} + {CALL sla\_DAF2R (IDEG, IAMIN, ASEC, RAD, J)} + Degrees, arcminutes, arcseconds to radians +\subq{CALL sla\_CR2AF (NDP, ANGLE, SIGN, IDMSF)} + {CALL sla\_DR2AF (NDP, ANGLE, SIGN, IDMSF)} + Radians to degrees, arcminutes, arcseconds +\end{callset} + +\callhead{Angles, Vectors and Rotation Matrices} +\begin{callset} +\subq{R~=~sla\_RANGE (ANGLE)} + {D~=~sla\_DRANGE (ANGLE)} + Normalize angle into range $\pm\pi$ +\subq{R~=~sla\_RANORM (ANGLE)} + {D~=~sla\_DRANRM (ANGLE)} + Normalize angle into range $0\!-\!2\pi$ +\subq{CALL sla\_CS2C (A, B, V)} + {CALL sla\_DCS2C (A, B, V)} + Spherical coordinates to \xyz +\subq{CALL sla\_CC2S (V, A, B)} + {CALL sla\_DCC2S (V, A, B)} + \xyz\ to spherical coordinates +\subq{R~=~sla\_VDV (VA, VB)} + {D~=~sla\_DVDV (VA, VB)} + Scalar product of two 3-vectors +\subq{CALL sla\_VXV (VA, VB, VC)} + {CALL sla\_DVXV (VA, VB, VC)} + Vector product of two 3-vectors +\subq{CALL sla\_VN (V, UV, VM)} + {CALL sla\_DVN (V, UV, VM)} + Normalize a 3-vector also giving the modulus +\subq{R~=~sla\_SEP (A1, B1, A2, B2)} + {D~=~sla\_DSEP (A1, B1, A2, B2)} + Angle between two points on a sphere +\subq{R~=~sla\_SEPV (V1, V2)} + {D~=~sla\_DSEPV (V1, V2)} + Angle between two \xyz\ vectors +\subq{R~=~sla\_BEAR (A1, B1, A2, B2)} + {D~=~sla\_DBEAR (A1, B1, A2, B2)} + Direction of one point on a sphere seen from another +\subq{R~=~sla\_PAV (V1, V2)} + {D~=~sla\_DPAV (V1, V2)} + Position-angle of one \xyz\ with respect to another +\subq{CALL sla\_EULER (ORDER, PHI, THETA, PSI, RMAT)} + {CALL sla\_DEULER (ORDER, PHI, THETA, PSI, RMAT)} + Form rotation matrix from three Euler angles +\subq{CALL sla\_AV2M (AXVEC, RMAT)} + {CALL sla\_DAV2M (AXVEC, RMAT)} + Form rotation matrix from axial vector +\subq{CALL sla\_M2AV (RMAT, AXVEC)} + {CALL sla\_DM2AV (RMAT, AXVEC)} + Determine axial vector from rotation matrix +\subq{CALL sla\_MXV (RM, VA, VB)} + {CALL sla\_DMXV (DM, VA, VB)} + Rotate vector forwards +\subq{CALL sla\_IMXV (RM, VA, VB)} + {CALL sla\_DIMXV (DM, VA, VB)} + Rotate vector backwards +\subq{CALL sla\_MXM (A, B, C)} + {CALL sla\_DMXM (A, B, C)} + Product of two 3x3 matrices +\subq{CALL sla\_CS2C6 (A, B, R, AD, BD, RD, V)} + {CALL sla\_DS2C6 (A, B, R, AD, BD, RD, V)} + Conversion of position and velocity in spherical + coordinates to Cartesian coordinates +\subq{CALL sla\_CC62S (V, A, B, R, AD, BD, RD)} + {CALL sla\_DC62S (V, A, B, R, AD, BD, RD)} + Conversion of position and velocity in Cartesian + coordinates to spherical coordinates +\end{callset} + +\callhead{Calendars} +\begin{callset} +\subp{CALL sla\_CLDJ (IY, IM, ID, DJM, J)} + Gregorian Calendar to Modified Julian Date +\subp{CALL sla\_CALDJ (IY, IM, ID, DJM, J)} + Gregorian Calendar to Modified Julian Date, + permitting century default +\subp{CALL sla\_DJCAL (NDP, DJM, IYMDF, J)} + Modified Julian Date to Gregorian Calendar, + in a form convenient for formatted output +\subp{CALL sla\_DJCL (DJM, IY, IM, ID, FD, J)} + Modified Julian Date to Gregorian Year, Month, Day, Fraction +\subp{CALL sla\_CALYD (IY, IM, ID, NY, ND, J)} + Calendar to year and day in year, permitting century default +\subp{CALL sla\_CLYD (IY, IM, ID, NY, ND, J)} + Calendar to year and day in year +\subp{D~=~sla\_EPB (DATE)} + Modified Julian Date to Besselian Epoch +\subp{D~=~sla\_EPB2D (EPB)} + Besselian Epoch to Modified Julian Date +\subp{D~=~sla\_EPJ (DATE)} + Modified Julian Date to Julian Epoch +\subp{D~=~sla\_EPJ2D (EPJ)} + Julian Epoch to Modified Julian Date +\end{callset} + +\callhead{Time Scales} +\begin{callset} +\subp{D~=~sla\_GMST (UT1)} + Conversion from Universal Time to sidereal time +\subp{D~=~sla\_GMSTA (DATE, UT1)} + Conversion from Universal Time to sidereal time, rounding errors minimized +\subp{D~=~sla\_EQEQX (DATE)} + Equation of the equinoxes +\subp{D~=~sla\_DAT (DJU)} + Offset of Atomic Time from Coordinated Universal Time: TAI$-$UTC +\subp{D~=~sla\_DT (EPOCH)} + Approximate offset between dynamical time and universal time +\subp{D~=~sla\_DTT (DJU)} + Offset of Terrestrial Time from Coordinated Universal Time: TT$-$UTC +\subp{D~=~sla\_RCC (TDB, UT1, WL, U, V)} + Relativistic clock correction: TDB$-$TT +\end{callset} + +\callhead{Precession and Nutation} +\begin{callset} +\subp{CALL sla\_NUT (DATE, RMATN)} + Nutation matrix +\subp{CALL sla\_NUTC (DATE, DPSI, DEPS, EPS0)} + Longitude and obliquity components of nutation, and + mean obliquity +\subp{CALL sla\_NUTC80 (DATE, DPSI, DEPS, EPS0)} + Longitude and obliquity components of nutation, and + mean obliquity, IAU 1980 +\subp{CALL sla\_PREC (EP0, EP1, RMATP)} + Precession matrix (IAU) +\subp{CALL sla\_PRECL (EP0, EP1, RMATP)} + Precession matrix (suitable for long periods) +\subp{CALL sla\_PRENUT (EPOCH, DATE, RMATPN)} + Combined precession-nutation matrix +\subp{CALL sla\_PREBN (BEP0, BEP1, RMATP)} + Precession matrix, old system +\subp{CALL sla\_PRECES (SYSTEM, EP0, EP1, RA, DC)} + Precession, in either the old or the new system +\end{callset} + +\callhead{Proper Motion} +\begin{callset} +\subp{CALL sla\_PM (R0, D0, PR, PD, PX, RV, EP0, EP1, R1, D1)} + Adjust for proper motion +\end{callset} + +\callhead{FK4/FK5/Hipparcos Conversions} +\begin{callset} +\subp{CALL sla\_FK425 (\vtop + {\hbox{R1950, D1950, DR1950, DD1950, P1950, V1950,} + \hbox{R2000, D2000, DR2000, DD2000, P2000, V2000)}}} + Convert B1950.0 FK4 star data to J2000.0 FK5 +\subp{CALL sla\_FK45Z (R1950, D1950, EPOCH, R2000, D2000)} + Convert B1950.0 FK4 position to J2000.0 FK5 assuming zero + FK5 proper motion and no parallax +\subp{CALL sla\_FK524 (\vtop + {\hbox{R2000, D2000, DR2000, DD2000, P2000, V2000,} + \hbox{R1950, D1950, DR1950, DD1950, P1950, V1950)}}} + Convert J2000.0 FK5 star data to B1950.0 FK4 +\subp{CALL sla\_FK54Z (R2000, D2000, BEPOCH, + R1950, D1950, DR1950, DD1950)} + Convert J2000.0 FK5 position to B1950.0 FK4 assuming zero + FK5 proper motion and no parallax +\subp{CALL sla\_FK52H (R5, D5, DR5, DD5, RH, DH, DRH, DDH)} + Convert J2000.0 FK5 star data to Hipparcos +\subp{CALL sla\_FK5HZ (R5, D5, EPOCH, RH, DH )} + Convert J2000.0 FK5 position to Hipparcos assuming zero Hipparcos + proper motion +\subp{CALL sla\_H2FK5 (RH, DH, DRH, DDH, R5, D5, DR5, DD5)} + Convert Hipparcos star data to J2000.0 FK5 +\subp{CALL sla\_HFK5Z (RH, DH, EPOCH, R5, D5, DR5, DD5)} + Convert Hipparcos position to J2000.0 FK5 assuming zero Hipparcos + proper motion +\subp{CALL sla\_DBJIN (STRING, NSTRT, DRESLT, J1, J2)} + Like sla\_DFLTIN but with extensions to accept leading `B' and `J' +\subp{CALL sla\_KBJ (JB, E, K, J)} + Select epoch prefix `B' or `J' +\subp{D~=~sla\_EPCO (K0, K, E)} + Convert an epoch into the appropriate form -- `B' or `J' +\end{callset} + +\callhead{Elliptic Aberration} +\begin{callset} +\subp{CALL sla\_ETRMS (EP, EV)} + E-terms +\subp{CALL sla\_SUBET (RC, DC, EQ, RM, DM)} + Remove the E-terms +\subp{CALL sla\_ADDET (RM, DM, EQ, RC, DC)} + Add the E-terms +\end{callset} + +\callhead{Geographical and Geocentric Coordinates} +\begin{callset} +\subp{CALL sla\_OBS (NUMBER, ID, NAME, WLONG, PHI, HEIGHT)} + Interrogate list of observatory parameters +\subp{CALL sla\_GEOC (P, H, R, Z)} + Convert geodetic position to geocentric +\subp{CALL sla\_POLMO (ELONGM, PHIM, XP, YP, ELONG, PHI, DAZ)} + Polar motion +\subp{CALL sla\_PVOBS (P, H, STL, PV)} + Position and velocity of observatory +\end{callset} + +\callhead{Apparent and Observed Place} +\begin{callset} +\subp{CALL sla\_MAP (RM, DM, PR, PD, PX, RV, EQ, DATE, RA, DA)} + Mean place to geocentric apparent place +\subp{CALL sla\_MAPPA (EQ, DATE, AMPRMS)} + Precompute mean to apparent parameters +\subp{CALL sla\_MAPQK (RM, DM, PR, PD, PX, RV, AMPRMS, RA, DA)} + Mean to apparent using precomputed parameters +\subp{CALL sla\_MAPQKZ (RM, DM, AMPRMS, RA, DA)} + Mean to apparent using precomputed parameters, for zero proper + motion, parallax and radial velocity +\subp{CALL sla\_AMP (RA, DA, DATE, EQ, RM, DM)} + Geocentric apparent place to mean place +\subp{CALL sla\_AMPQK (RA, DA, AMPRMS, RM, DM)} + Apparent to mean using precomputed parameters +\subp{CALL sla\_AOP (\vtop + {\hbox{RAP, DAP, UTC, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, AOB, ZOB, HOB, DOB, ROB)}}} + Apparent place to observed place +\subp{CALL sla\_AOPPA (\vtop + {\hbox{UTC, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, AOPRMS)}}} + Precompute apparent to observed parameters +\subp{CALL sla\_AOPPAT (UTC, AOPRMS)} + Update sidereal time in apparent to observed parameters +\subp{CALL sla\_AOPQK (RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB)} + Apparent to observed using precomputed parameters +\subp{CALL sla\_OAP (\vtop + {\hbox{TYPE, OB1, OB2, UTC, DUT, ELONGM, PHIM, HM, XP, YP,} + \hbox{TDK, PMB, RH, WL, TLR, RAP, DAP)}}} + Observed to apparent +\subp{CALL sla\_OAPQK (TYPE, OB1, OB2, AOPRMS, RA, DA)} + Observed to apparent using precomputed parameters +\end{callset} + +\callhead{Azimuth and Elevation} +\begin{callset} +\subp{CALL sla\_ALTAZ (\vtop + {\hbox{HA, DEC, PHI,} + \hbox{AZ, AZD, AZDD, EL, ELD, ELDD, PA, PAD, PADD)}}} + Positions, velocities {\it etc.}\ for an altazimuth mount +\subq{CALL sla\_E2H (HA, DEC, PHI, AZ, EL)} + {CALL sla\_DE2H (HA, DEC, PHI, AZ, EL)} + \hadec\ to \azel +\subq{CALL sla\_H2E (AZ, EL, PHI, HA, DEC)} + {CALL sla\_DH2E (AZ, EL, PHI, HA, DEC)} + \azel\ to \hadec +\subp{CALL sla\_PDA2H (P, D, A, H1, J1, H2, J2)} + Hour Angle corresponding to a given azimuth +\subp{CALL sla\_PDQ2H (P, D, Q, H1, J1, H2, J2)} + Hour Angle corresponding to a given parallactic angle +\subp{D~=~sla\_PA (HA, DEC, PHI)} + \hadec\ to parallactic angle +\subp{D~=~sla\_ZD (HA, DEC, PHI)} + \hadec\ to zenith distance +\end{callset} + +\callhead{Refraction and Air Mass} +\begin{callset} +\subp{CALL sla\_REFRO (ZOBS, HM, TDK, PMB, RH, WL, PHI, TLR, EPS, REF)} + Change in zenith distance due to refraction +\subp{CALL sla\_REFCO (HM, TDK, PMB, RH, WL, PHI, TLR, EPS, REFA, REFB)} + Constants for simple refraction model (accurate) +\subp{CALL sla\_REFCOQ (TDK, PMB, RH, WL, REFA, REFB)} + Constants for simple refraction model (fast) +\subp{CALL sla\_ATMDSP ( TDK, PMB, RH, WL1, REFA1, REFB1, WL2, REFA2, REFB2 )} + Adjust refraction constants for colour +\subp{CALL sla\_REFZ (ZU, REFA, REFB, ZR)} + Unrefracted to refracted ZD, simple model +\subp{CALL sla\_REFV (VU, REFA, REFB, VR)} + Unrefracted to refracted \azel\ vector, simple model +\subp{D~=~sla\_AIRMAS (ZD)} + Air mass +\end{callset} + +\callhead{Ecliptic Coordinates} +\begin{callset} +\subp{CALL sla\_ECMAT (DATE, RMAT)} + Equatorial to ecliptic rotation matrix +\subp{CALL sla\_EQECL (DR, DD, DATE, DL, DB)} + J2000.0 `FK5' to ecliptic coordinates +\subp{CALL sla\_ECLEQ (DL, DB, DATE, DR, DD)} + Ecliptic coordinates to J2000.0 `FK5' +\end{callset} + +\callhead{Galactic Coordinates} +\begin{callset} +\subp{CALL sla\_EG50 (DR, DD, DL, DB)} + B1950.0 `FK4' to galactic +\subp{CALL sla\_GE50 (DL, DB, DR, DD)} + Galactic to B1950.0 `FK4' +\subp{CALL sla\_EQGAL (DR, DD, DL, DB)} + J2000.0 `FK5' to galactic +\subp{CALL sla\_GALEQ (DL, DB, DR, DD)} + Galactic to J2000.0 `FK5' +\end{callset} + +\callhead{Supergalactic Coordinates} +\begin{callset} +\subp{CALL sla\_GALSUP (DL, DB, DSL, DSB)} + Galactic to supergalactic +\subp{CALL sla\_SUPGAL (DSL, DSB, DL, DB)} + Supergalactic to galactic +\end{callset} + +\callhead{Ephemerides} +\begin{callset} +\subp{CALL sla\_DMOON (DATE, PV)} + Approximate geocentric position and velocity of the Moon +\subp{CALL sla\_EARTH (IY, ID, FD, PV)} + Approximate heliocentric position and velocity of the Earth +\subp{CALL sla\_EPV (DATE, DPH, DVH, DPB, DVB )} + Heliocentric and barycentric position and velocity of the Earth +\subp{CALL sla\_EVP (DATE, DEQX, DVB, DPB, DVH, DPH)} + Barycentric and heliocentric velocity and position of the Earth +\subp{CALL sla\_MOON (IY, ID, FD, PV)} + Approximate geocentric position and velocity of the Moon +\subp{CALL sla\_PLANET (DATE, NP, PV, JSTAT)} + Approximate heliocentric position and velocity of a planet +\subp{CALL sla\_RDPLAN (DATE, NP, ELONG, PHI, RA, DEC, DIAM)} + Approximate topocentric apparent place of a planet +\subp{CALL sla\_PLANEL (\vtop + {\hbox{DATE, JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, PV, JSTAT)}}} + Heliocentric position and velocity of a planet, asteroid or + comet, starting from orbital elements +\subp{CALL sla\_PLANTE (\vtop + {\hbox{DATE, ELONG, PHI, JFORM, EPOCH, ORBINC, ANODE,} + \hbox{PERIH, AORQ, E, AORL, DM, RA, DEC, R, JSTAT)}}} + Topocentric apparent place of a Solar-System object whose + heliocentric orbital elements are known +\subp{CALL sla\_PLANTU (DATE, ELONG, PHI, U, RA, DEC, R, JSTAT)} + Topocentric apparent place of a Solar-System object whose + heliocentric universal orbital elements are known +\subp{CALL sla\_PV2EL (\vtop + {\hbox{PV, DATE, PMASS, JFORMR, JFORM, EPOCH, ORBINC,} + \hbox{ANODE, PERIH, AORQ, E, AORL, DM, JSTAT)}}} + Orbital elements of a planet from instantaneous position and velocity +\subp{CALL sla\_PERTEL (\vtop + {\hbox{JFORM, DATE0, DATE1,} + \hbox{EPOCH0, ORBI0, ANODE0, PERIH0, AORQ0, E0, AM0,} + \hbox{EPOCH1, ORBI1, ANODE1, PERIH1, AORQ1, E1, AM1,} + \hbox{JSTAT)}}} + Update elements by applying perturbations +\subp{CALL sla\_EL2UE (\vtop + {\hbox{DATE, JFORM, EPOCH, ORBINC, ANODE,} + \hbox{PERIH, AORQ, E, AORL, DM,} + \hbox{U, JSTAT)}}} + Transform conventional elements to universal elements +\subp{CALL sla\_UE2EL (\vtop + {\hbox{U, JFORMR,} + \hbox{JFORM, EPOCH, ORBINC, ANODE, PERIH,} + \hbox{AORQ, E, AORL, DM, JSTAT)}}} + Transform universal elements to conventional elements +\subp{CALL sla\_PV2UE (PV, DATE, PMASS, U, JSTAT)} + Package a position and velocity for use as universal elements +\subp{CALL sla\_UE2PV (DATE, U, PV, JSTAT)} + Extract the position and velocity from universal elements +\subp{CALL sla\_PERTUE (DATE, U, JSTAT)} + Update universal elements by applying perturbations +\subp{R~=~sla\_RVEROT (PHI, RA, DA, ST)} + Velocity component due to rotation of the Earth +\subp{CALL sla\_ECOR (RM, DM, IY, ID, FD, RV, TL)} + Components of velocity and light time due to Earth orbital motion +\subp{R~=~sla\_RVLSRD (R2000, D2000)} + Velocity component due to solar motion wrt dynamical LSR +\subp{R~=~sla\_RVLSRK (R2000, D2000)} + Velocity component due to solar motion wrt kinematical LSR +\subp{R~=~sla\_RVGALC (R2000, D2000)} + Velocity component due to rotation of the Galaxy +\subp{R~=~sla\_RVLG (R2000, D2000)} + Velocity component due to rotation and translation of the + Galaxy, relative to the mean motion of the local group +\end{callset} + +\callhead{Astrometry} +\begin{callset} +\subq{CALL sla\_S2TP (RA, DEC, RAZ, DECZ, XI, ETA, J)} + {CALL sla\_DS2TP (RA, DEC, RAZ, DECZ, XI, ETA, J)} + Transform spherical coordinates into tangent plane +\subq{CALL sla\_V2TP (V, V0, XI, ETA, J)} + {CALL sla\_DV2TP (V, V0, XI, ETA, J)} + Transform \xyz\ into tangent plane coordinates +\subq{CALL sla\_DTP2S (XI, ETA, RAZ, DECZ, RA, DEC)} + {CALL sla\_TP2S (XI, ETA, RAZ, DECZ, RA, DEC)} + Transform tangent plane coordinates into spherical coordinates +\subq{CALL sla\_DTP2V (XI, ETA, V0, V)} + {CALL sla\_TP2V (XI, ETA, V0, V)} + Transform tangent plane coordinates into \xyz +\subq{CALL sla\_DTPS2C (XI, ETA, RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2, N)} + {CALL sla\_TPS2C (XI, ETA, RA, DEC, RAZ1, DECZ1, RAZ2, DECZ2, N)} + Get plate centre from star \radec\ and tangent plane coordinates +\subq{CALL sla\_DTPV2C (XI, ETA, V, V01, V02, N)} + {CALL sla\_TPV2C (XI, ETA, V, V01, V02, N)} + Get plate centre from star \xyz\ and tangent plane coordinates +\subp{CALL sla\_PCD (DISCO, X, Y)} + Apply pincushion/barrel distortion +\subp{CALL sla\_UNPCD (DISCO, X, Y)} + Remove pincushion/barrel distortion +\subp{CALL sla\_FITXY (ITYPE, NP, XYE, XYM, COEFFS, J)} + Fit a linear model to relate two sets of \xy\ coordinates +\subp{CALL sla\_PXY (NP, XYE, XYM, COEFFS, XYP, XRMS, YRMS, RRMS)} + Compute predicted coordinates and residuals +\subp{CALL sla\_INVF (FWDS, BKWDS, J)} + Invert a linear model +\subp{CALL sla\_XY2XY (X1, Y1, COEFFS, X2, Y2)} + Transform one \xy +\subp{CALL sla\_DCMPF (COEFFS, XZ, YZ, XS, YS, PERP, ORIENT)} + Decompose a linear fit into scales {\it etc.} +\end{callset} + +\callhead{Numerical Methods} +\begin{callset} +\subp{CALL sla\_COMBN (NSEL, NCAND, LIST, J)} + Next combination (subset from a specified number of items) +\subp{CALL sla\_PERMUT (N, ISTATE, IORDER, J)} + Next permutation of a specified number of items +\subq{CALL sla\_SMAT (N, A, Y, D, JF, IW)} + {CALL sla\_DMAT (N, A, Y, D, JF, IW)} + Matrix inversion and solution of simultaneous equations +\subp{CALL sla\_SVD (M, N, MP, NP, A, W, V, WORK, JSTAT)} + Singular value decomposition of a matrix +\subp{CALL sla\_SVDSOL (M, N, MP, NP, B, U, W, V, WORK, X)} + Solution from given vector plus SVD +\subp{CALL sla\_SVDCOV (N, NP, NC, W, V, WORK, CVM)} + Covariance matrix from SVD +\subp{R~=~sla\_RANDOM (SEED)} + Generate pseudo-random real number in the range {$0 \leq x < 1$} +\subp{R~=~sla\_GRESID (S)} + Generate pseudo-random normal deviate ($\equiv$ `Gaussian residual') +\end{callset} + +\callhead{Real-time} +\begin{callset} +\subp{CALL sla\_WAIT (DELAY)} + Interval wait +\end{callset} + +\end{document} diff --git a/math/slalib/supgal.f b/math/slalib/supgal.f new file mode 100644 index 00000000..4df6b10d --- /dev/null +++ b/math/slalib/supgal.f @@ -0,0 +1,97 @@ + SUBROUTINE slSUGA (DSL, DSB, DL, DB) +*+ +* - - - - - - - +* S U G A +* - - - - - - - +* +* Transformation from de Vaucouleurs supergalactic coordinates +* to IAU 1958 galactic coordinates (double precision) +* +* Given: +* DSL,DSB dp supergalactic longitude and latitude +* +* Returned: +* DL,DB dp galactic longitude and latitude L2,B2 +* +* (all arguments are radians) +* +* Called: +* slDS2C, slDIMV, slDC2S, slDA2P, slDA1P +* +* References: +* +* de Vaucouleurs, de Vaucouleurs, & Corwin, Second Reference +* Catalogue of Bright Galaxies, U. Texas, page 8. +* +* Systems & Applied Sciences Corp., Documentation for the +* machine-readable version of the above catalogue, +* Contract NAS 5-26490. +* +* (These two references give different values for the galactic +* longitude of the supergalactic origin. Both are wrong; the +* correct value is L2=137.37.) +* +* P.T.Wallace Starlink March 1986 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DSL,DSB,DL,DB + + DOUBLE PRECISION slDA2P,slDA1P + + DOUBLE PRECISION V1(3),V2(3) + +* +* System of supergalactic coordinates: +* +* SGL SGB L2 B2 (deg) +* - +90 47.37 +6.32 +* 0 0 - 0 +* +* Galactic to supergalactic rotation matrix: +* + DOUBLE PRECISION RMAT(3,3) + DATA RMAT(1,1),RMAT(1,2),RMAT(1,3), + : RMAT(2,1),RMAT(2,2),RMAT(2,3), + : RMAT(3,1),RMAT(3,2),RMAT(3,3)/ + : -0.735742574804D0,+0.677261296414D0,+0.000000000000D0, + : -0.074553778365D0,-0.080991471307D0,+0.993922590400D0, + : +0.673145302109D0,+0.731271165817D0,+0.110081262225D0/ + + + +* Spherical to Cartesian + CALL slDS2C(DSL,DSB,V1) + +* Supergalactic to galactic + CALL slDIMV(RMAT,V1,V2) + +* Cartesian to spherical + CALL slDC2S(V2,DL,DB) + +* Express in conventional ranges + DL=slDA2P(DL) + DB=slDA1P(DB) + + END diff --git a/math/slalib/svd.f b/math/slalib/svd.f new file mode 100644 index 00000000..59f53cfd --- /dev/null +++ b/math/slalib/svd.f @@ -0,0 +1,401 @@ + SUBROUTINE slSVD (M, N, MP, NP, A, W, V, WORK, JSTAT) +*+ +* - - - - +* S V D +* - - - - +* +* Singular value decomposition (double precision) +* +* This routine expresses a given matrix A as the product of +* three matrices U, W, V: +* +* A = U x W x VT +* +* Where: +* +* A is any M (rows) x N (columns) matrix, where M.GE.N +* U is an M x N column-orthogonal matrix +* W is an N x N diagonal matrix with W(I,I).GE.0 +* VT is the transpose of an N x N orthogonal matrix +* +* Note that M and N, above, are the LOGICAL dimensions of the +* matrices and vectors concerned, which can be located in +* arrays of larger PHYSICAL dimensions, given by MP and NP. +* +* Given: +* M,N i numbers of rows and columns in matrix A +* MP,NP i physical dimensions of array containing matrix A +* A d(MP,NP) array containing MxN matrix A +* +* Returned: +* A d(MP,NP) array containing MxN column-orthogonal matrix U +* W d(N) NxN diagonal matrix W (diagonal elements only) +* V d(NP,NP) array containing NxN orthogonal matrix V +* WORK d(N) workspace +* JSTAT i 0 = OK, -1 = A wrong shape, >0 = index of W +* for which convergence failed. See note 2, below. +* +* Notes: +* +* 1) V contains matrix V, not the transpose of matrix V. +* +* 2) If the status JSTAT is greater than zero, this need not +* necessarily be treated as a failure. It means that, due to +* chance properties of the matrix A, the QR transformation +* phase of the routine did not fully converge in a predefined +* number of iterations, something that very seldom occurs. +* When this condition does arise, it is possible that the +* elements of the diagonal matrix W have not been correctly +* found. However, in practice the results are likely to +* be trustworthy. Applications should report the condition +* as a warning, but then proceed normally. +* +* References: +* The algorithm is an adaptation of the routine SVD in the EISPACK +* library (Garbow et al 1977, EISPACK Guide Extension, Springer +* Verlag), which is a FORTRAN 66 implementation of the Algol +* routine SVD of Wilkinson & Reinsch 1971 (Handbook for Automatic +* Computation, vol 2, ed Bauer et al, Springer Verlag). These +* references give full details of the algorithm used here. A good +* account of the use of SVD in least squares problems is given in +* Numerical Recipes (Press et al 1986, Cambridge University Press), +* which includes another variant of the EISPACK code. +* +* Last revision: 8 September 2005 +* +* Copyright P.T.Wallace. All rights reserved. +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER M,N,MP,NP + DOUBLE PRECISION A(MP,NP),W(N),V(NP,NP),WORK(N) + INTEGER JSTAT + +* Maximum number of iterations in QR phase + INTEGER ITMAX + PARAMETER (ITMAX=30) + + INTEGER L,L1,I,K,J,K1,ITS,I1 + LOGICAL CANCEL + DOUBLE PRECISION G,SCALE,AN,S,X,F,H,C,Y,Z + + + +* Variable initializations to avoid compiler warnings. + L = 0 + L1 = 0 + +* Check that the matrix is the right shape + IF (M.LT.N) THEN + +* No: error status + JSTAT = -1 + + ELSE + +* Yes: preset the status to OK + JSTAT = 0 + +* +* Householder reduction to bidiagonal form +* ---------------------------------------- + + G = 0D0 + SCALE = 0D0 + AN = 0D0 + DO I=1,N + L = I+1 + WORK(I) = SCALE*G + G = 0D0 + S = 0D0 + SCALE = 0D0 + IF (I.LE.M) THEN + DO K=I,M + SCALE = SCALE+ABS(A(K,I)) + END DO + IF (SCALE.NE.0D0) THEN + DO K=I,M + X = A(K,I)/SCALE + A(K,I) = X + S = S+X*X + END DO + F = A(I,I) + G = -SIGN(SQRT(S),F) + H = F*G-S + A(I,I) = F-G + IF (I.NE.N) THEN + DO J=L,N + S = 0D0 + DO K=I,M + S = S+A(K,I)*A(K,J) + END DO + F = S/H + DO K=I,M + A(K,J) = A(K,J)+F*A(K,I) + END DO + END DO + END IF + DO K=I,M + A(K,I) = SCALE*A(K,I) + END DO + END IF + END IF + W(I) = SCALE*G + G = 0D0 + S = 0D0 + SCALE = 0D0 + IF (I.LE.M .AND. I.NE.N) THEN + DO K=L,N + SCALE = SCALE+ABS(A(I,K)) + END DO + IF (SCALE.NE.0D0) THEN + DO K=L,N + X = A(I,K)/SCALE + A(I,K) = X + S = S+X*X + END DO + F = A(I,L) + G = -SIGN(SQRT(S),F) + H = F*G-S + A(I,L) = F-G + DO K=L,N + WORK(K) = A(I,K)/H + END DO + IF (I.NE.M) THEN + DO J=L,M + S = 0D0 + DO K=L,N + S = S+A(J,K)*A(I,K) + END DO + DO K=L,N + A(J,K) = A(J,K)+S*WORK(K) + END DO + END DO + END IF + DO K=L,N + A(I,K) = SCALE*A(I,K) + END DO + END IF + END IF + +* Overestimate of largest column norm for convergence test + AN = MAX(AN,ABS(W(I))+ABS(WORK(I))) + + END DO + +* +* Accumulation of right-hand transformations +* ------------------------------------------ + + DO I=N,1,-1 + IF (I.NE.N) THEN + IF (G.NE.0D0) THEN + DO J=L,N + V(J,I) = (A(I,J)/A(I,L))/G + END DO + DO J=L,N + S = 0D0 + DO K=L,N + S = S+A(I,K)*V(K,J) + END DO + DO K=L,N + V(K,J) = V(K,J)+S*V(K,I) + END DO + END DO + END IF + DO J=L,N + V(I,J) = 0D0 + V(J,I) = 0D0 + END DO + END IF + V(I,I) = 1D0 + G = WORK(I) + L = I + END DO + +* +* Accumulation of left-hand transformations +* ----------------------------------------- + + DO I=N,1,-1 + L = I+1 + G = W(I) + IF (I.NE.N) THEN + DO J=L,N + A(I,J) = 0D0 + END DO + END IF + IF (G.NE.0D0) THEN + IF (I.NE.N) THEN + DO J=L,N + S = 0D0 + DO K=L,M + S = S+A(K,I)*A(K,J) + END DO + F = (S/A(I,I))/G + DO K=I,M + A(K,J) = A(K,J)+F*A(K,I) + END DO + END DO + END IF + DO J=I,M + A(J,I) = A(J,I)/G + END DO + ELSE + DO J=I,M + A(J,I) = 0D0 + END DO + END IF + A(I,I) = A(I,I)+1D0 + END DO + +* +* Diagonalisation of the bidiagonal form +* -------------------------------------- + + DO K=N,1,-1 + K1 = K-1 + +* Iterate until converged + ITS = 0 + DO WHILE (ITS.LT.ITMAX) + ITS = ITS+1 + +* Test for splitting into submatrices + CANCEL = .TRUE. + DO L=K,1,-1 + L1 = L-1 + IF (AN+ABS(WORK(L)).EQ.AN) THEN + CANCEL = .FALSE. + GO TO 10 + END IF +* (Following never attempted for L=1 because WORK(1) is zero) + IF (AN+ABS(W(L1)).EQ.AN) GO TO 10 + END DO + 10 CONTINUE + +* Cancellation of WORK(L) if L>1 + IF (CANCEL) THEN + C = 0D0 + S = 1D0 + DO I=L,K + F = S*WORK(I) + IF (AN+ABS(F).EQ.AN) GO TO 20 + G = W(I) + H = SQRT(F*F+G*G) + W(I) = H + C = G/H + S = -F/H + DO J=1,M + Y = A(J,L1) + Z = A(J,I) + A(J,L1) = Y*C+Z*S + A(J,I) = -Y*S+Z*C + END DO + END DO + 20 CONTINUE + END IF + +* Converged? + Z = W(K) + IF (L.EQ.K) THEN + +* Yes: stop iterating + ITS = ITMAX + +* Ensure singular values non-negative + IF (Z.LT.0D0) THEN + W(K) = -Z + DO J=1,N + V(J,K) = -V(J,K) + END DO + END IF + ELSE + +* Not converged yet: set status if iteration limit reached + IF (ITS.EQ.ITMAX) JSTAT = K + +* Shift from bottom 2x2 minor + X = W(L) + Y = W(K1) + G = WORK(K1) + H = WORK(K) + F = ((Y-Z)*(Y+Z)+(G-H)*(G+H))/(2D0*H*Y) + IF (ABS(F).LE.1D15) THEN + G = SQRT(F*F+1D0) + ELSE + G = ABS(F) + END IF + F = ((X-Z)*(X+Z)+H*(Y/(F+SIGN(G,F))-H))/X + +* Next QR transformation + C = 1D0 + S = 1D0 + DO I1=L,K1 + I = I1+1 + G = WORK(I) + Y = W(I) + H = S*G + G = C*G + Z = SQRT(F*F+H*H) + WORK(I1) = Z + IF (Z.NE.0D0) THEN + C = F/Z + S = H/Z + ELSE + C = 1D0 + S = 0D0 + END IF + F = X*C+G*S + G = -X*S+G*C + H = Y*S + Y = Y*C + DO J=1,N + X = V(J,I1) + Z = V(J,I) + V(J,I1) = X*C+Z*S + V(J,I) = -X*S+Z*C + END DO + Z = SQRT(F*F+H*H) + W(I1) = Z + IF (Z.NE.0D0) THEN + C = F/Z + S = H/Z + END IF + F = C*G+S*Y + X = -S*G+C*Y + DO J=1,M + Y = A(J,I1) + Z = A(J,I) + A(J,I1) = Y*C+Z*S + A(J,I) = -Y*S+Z*C + END DO + END DO + WORK(L) = 0D0 + WORK(K) = F + W(K) = X + END IF + END DO + END DO + END IF + + END diff --git a/math/slalib/svdcov.f b/math/slalib/svdcov.f new file mode 100644 index 00000000..02a6be0e --- /dev/null +++ b/math/slalib/svdcov.f @@ -0,0 +1,78 @@ + SUBROUTINE slSVDC (N, NP, NC, W, V, WORK, CVM) +*+ +* - - - - - - - +* S V D C +* - - - - - - - +* +* From the W and V matrices from the SVD factorisation of a matrix +* (as obtained from the slSVD routine), obtain the covariance matrix. +* +* (double precision) +* +* Given: +* N i number of rows and columns in matrices W and V +* NP i first dimension of array containing matrix V +* NC i first dimension of array to receive CVM +* W d(N) NxN diagonal matrix W (diagonal elements only) +* V d(NP,NP) array containing NxN orthogonal matrix V +* +* Returned: +* WORK d(N) workspace +* CVM d(NC,NC) array to receive covariance matrix +* +* Reference: +* Numerical Recipes, section 14.3. +* +* P.T.Wallace Starlink December 1988 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER N,NP,NC + DOUBLE PRECISION W(N),V(NP,NP),WORK(N),CVM(NC,NC) + + INTEGER I,J,K + DOUBLE PRECISION S + + + + DO I=1,N + S=W(I) + IF (S.NE.0D0) THEN + WORK(I)=1D0/(S*S) + ELSE + WORK(I)=0D0 + END IF + END DO + DO I=1,N + DO J=1,I + S=0D0 + DO K=1,N + S=S+V(I,K)*V(J,K)*WORK(K) + END DO + CVM(I,J)=S + CVM(J,I)=S + END DO + END DO + + END diff --git a/math/slalib/svdsol.f b/math/slalib/svdsol.f new file mode 100644 index 00000000..53209f2d --- /dev/null +++ b/math/slalib/svdsol.f @@ -0,0 +1,127 @@ + SUBROUTINE slSVDS (M, N, MP, NP, B, U, W, V, WORK, X) +*+ +* - - - - - - - +* S V D S +* - - - - - - - +* +* From a given vector and the SVD of a matrix (as obtained from +* the SVD routine), obtain the solution vector (double precision) +* +* This routine solves the equation: +* +* A . x = b +* +* where: +* +* A is a given M (rows) x N (columns) matrix, where M.GE.N +* x is the N-vector we wish to find +* b is a given M-vector +* +* by means of the Singular Value Decomposition method (SVD). In +* this method, the matrix A is first factorised (for example by +* the routine slSVD) into the following components: +* +* A = U x W x VT +* +* where: +* +* A is the M (rows) x N (columns) matrix +* U is an M x N column-orthogonal matrix +* W is an N x N diagonal matrix with W(I,I).GE.0 +* VT is the transpose of an NxN orthogonal matrix +* +* Note that M and N, above, are the LOGICAL dimensions of the +* matrices and vectors concerned, which can be located in +* arrays of larger PHYSICAL dimensions MP and NP. +* +* The solution is found from the expression: +* +* x = V . [diag(1/Wj)] . (transpose(U) . b) +* +* Notes: +* +* 1) If matrix A is square, and if the diagonal matrix W is not +* adjusted, the method is equivalent to conventional solution +* of simultaneous equations. +* +* 2) If M>N, the result is a least-squares fit. +* +* 3) If the solution is poorly determined, this shows up in the +* SVD factorisation as very small or zero Wj values. Where +* a Wj value is small but non-zero it can be set to zero to +* avoid ill effects. The present routine detects such zero +* Wj values and produces a sensible solution, with highly +* correlated terms kept under control rather than being allowed +* to elope to infinity, and with meaningful values for the +* other terms. +* +* Given: +* M,N i numbers of rows and columns in matrix A +* MP,NP i physical dimensions of array containing matrix A +* B d(M) known vector b +* U d(MP,NP) array containing MxN matrix U +* W d(N) NxN diagonal matrix W (diagonal elements only) +* V d(NP,NP) array containing NxN orthogonal matrix V +* +* Returned: +* WORK d(N) workspace +* X d(N) unknown vector x +* +* Reference: +* Numerical Recipes, section 2.9. +* +* P.T.Wallace Starlink 29 October 1993 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + INTEGER M,N,MP,NP + DOUBLE PRECISION B(M),U(MP,NP),W(N),V(NP,NP),WORK(N),X(N) + + INTEGER J,I,JJ + DOUBLE PRECISION S + + + +* Calculate [diag(1/Wj)] . transpose(U) . b (or zero for zero Wj) + DO J=1,N + S=0D0 + IF (W(J).NE.0D0) THEN + DO I=1,M + S=S+U(I,J)*B(I) + END DO + S=S/W(J) + END IF + WORK(J)=S + END DO + +* Multiply by matrix V to get result + DO J=1,N + S=0D0 + DO JJ=1,N + S=S+V(J,JJ)*WORK(JJ) + END DO + X(J)=S + END DO + + END diff --git a/math/slalib/tp2s.f b/math/slalib/tp2s.f new file mode 100644 index 00000000..f8d31895 --- /dev/null +++ b/math/slalib/tp2s.f @@ -0,0 +1,60 @@ + SUBROUTINE slTP2S (XI, ETA, RAZ, DECZ, RA, DEC) +*+ +* - - - - - +* T P 2 S +* - - - - - +* +* Transform tangent plane coordinates into spherical +* (single precision) +* +* Given: +* XI,ETA real tangent plane rectangular coordinates +* RAZ,DECZ real spherical coordinates of tangent point +* +* Returned: +* RA,DEC real spherical coordinates (0-2pi,+/-pi/2) +* +* Called: slRA2P +* +* P.T.Wallace Starlink 24 July 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL XI,ETA,RAZ,DECZ,RA,DEC + + REAL slRA2P + + REAL SDECZ,CDECZ,DENOM + + + + SDECZ=SIN(DECZ) + CDECZ=COS(DECZ) + + DENOM=CDECZ-ETA*SDECZ + + RA=slRA2P(ATAN2(XI,DENOM)+RAZ) + DEC=ATAN2(SDECZ+ETA*CDECZ,SQRT(XI*XI+DENOM*DENOM)) + + END diff --git a/math/slalib/tp2v.f b/math/slalib/tp2v.f new file mode 100644 index 00000000..ba2ff7dd --- /dev/null +++ b/math/slalib/tp2v.f @@ -0,0 +1,74 @@ + SUBROUTINE slTP2V (XI, ETA, V0, V) +*+ +* - - - - - +* T P 2 V +* - - - - - +* +* Given the tangent-plane coordinates of a star and the direction +* cosines of the tangent point, determine the direction cosines +* of the star. +* +* (single precision) +* +* Given: +* XI,ETA r tangent plane coordinates of star +* V0 r(3) direction cosines of tangent point +* +* Returned: +* V r(3) direction cosines of star +* +* Notes: +* +* 1 If vector V0 is not of unit length, the returned vector V will +* be wrong. +* +* 2 If vector V0 points at a pole, the returned vector V will be +* based on the arbitrary assumption that the RA of the tangent +* point is zero. +* +* 3 This routine is the Cartesian equivalent of the routine slTP2S. +* +* P.T.Wallace Starlink 11 February 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL XI,ETA,V0(3),V(3) + + REAL X,Y,Z,F,R + + + X=V0(1) + Y=V0(2) + Z=V0(3) + F=SQRT(1.0+XI*XI+ETA*ETA) + R=SQRT(X*X+Y*Y) + IF (R.EQ.0.0) THEN + R=1E-20 + X=R + END IF + V(1)=(X-(XI*Y+ETA*X*Z)/R)/F + V(2)=(Y+(XI*X-ETA*Y*Z)/R)/F + V(3)=(Z+ETA*R)/F + + END diff --git a/math/slalib/tps2c.f b/math/slalib/tps2c.f new file mode 100644 index 00000000..80873699 --- /dev/null +++ b/math/slalib/tps2c.f @@ -0,0 +1,109 @@ + SUBROUTINE slTPSC (XI, ETA, RA, DEC, RAZ1, DECZ1, + : RAZ2, DECZ2, N) +*+ +* - - - - - - +* T P S C +* - - - - - - +* +* From the tangent plane coordinates of a star of known RA,Dec, +* determine the RA,Dec of the tangent point. +* +* (single precision) +* +* Given: +* XI,ETA r tangent plane rectangular coordinates +* RA,DEC r spherical coordinates +* +* Returned: +* RAZ1,DECZ1 r spherical coordinates of tangent point, solution 1 +* RAZ2,DECZ2 r spherical coordinates of tangent point, solution 2 +* N i number of solutions: +* 0 = no solutions returned (note 2) +* 1 = only the first solution is useful (note 3) +* 2 = both solutions are useful (note 3) +* +* Notes: +* +* 1 The RAZ1 and RAZ2 values are returned in the range 0-2pi. +* +* 2 Cases where there is no solution can only arise near the poles. +* For example, it is clearly impossible for a star at the pole +* itself to have a non-zero XI value, and hence it is +* meaningless to ask where the tangent point would have to be +* to bring about this combination of XI and DEC. +* +* 3 Also near the poles, cases can arise where there are two useful +* solutions. The argument N indicates whether the second of the +* two solutions returned is useful. N=1 indicates only one useful +* solution, the usual case; under these circumstances, the second +* solution corresponds to the "over-the-pole" case, and this is +* reflected in the values of RAZ2 and DECZ2 which are returned. +* +* 4 The DECZ1 and DECZ2 values are returned in the range +/-pi, but +* in the usual, non-pole-crossing, case, the range is +/-pi/2. +* +* 5 This routine is the spherical equivalent of the routine slDPVC. +* +* Called: slRA2P +* +* P.T.Wallace Starlink 5 June 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL XI,ETA,RA,DEC,RAZ1,DECZ1,RAZ2,DECZ2 + INTEGER N + + REAL X2,Y2,SD,CD,SDF,R2,R,S,C + + REAL slRA2P + + + X2=XI*XI + Y2=ETA*ETA + SD=SIN(DEC) + CD=COS(DEC) + SDF=SD*SQRT(1.0+X2+Y2) + R2=CD*CD*(1.0+Y2)-SD*SD*X2 + IF (R2.GE.0.0) THEN + R=SQRT(R2) + S=SDF-ETA*R + C=SDF*ETA+R + IF (XI.EQ.0.0.AND.R.EQ.0.0) R=1.0 + RAZ1=slRA2P(RA-ATAN2(XI,R)) + DECZ1=ATAN2(S,C) + R=-R + S=SDF-ETA*R + C=SDF*ETA+R + RAZ2=slRA2P(RA-ATAN2(XI,R)) + DECZ2=ATAN2(S,C) + IF (ABS(SDF).LT.1.0) THEN + N=1 + ELSE + N=2 + END IF + ELSE + N=0 + END IF + + END diff --git a/math/slalib/tpv2c.f b/math/slalib/tpv2c.f new file mode 100644 index 00000000..2c01fe73 --- /dev/null +++ b/math/slalib/tpv2c.f @@ -0,0 +1,101 @@ + SUBROUTINE slTPVC (XI, ETA, V, V01, V02, N) +*+ +* - - - - - - +* T P V C +* - - - - - - +* +* Given the tangent-plane coordinates of a star and its direction +* cosines, determine the direction cosines of the tangent-point. +* +* (single precision) +* +* Given: +* XI,ETA r tangent plane coordinates of star +* V r(3) direction cosines of star +* +* Returned: +* V01 r(3) direction cosines of tangent point, solution 1 +* V02 r(3) direction cosines of tangent point, solution 2 +* N i number of solutions: +* 0 = no solutions returned (note 2) +* 1 = only the first solution is useful (note 3) +* 2 = both solutions are useful (note 3) +* +* Notes: +* +* 1 The vector V must be of unit length or the result will be wrong. +* +* 2 Cases where there is no solution can only arise near the poles. +* For example, it is clearly impossible for a star at the pole +* itself to have a non-zero XI value, and hence it is meaningless +* to ask where the tangent point would have to be. +* +* 3 Also near the poles, cases can arise where there are two useful +* solutions. The argument N indicates whether the second of the +* two solutions returned is useful. N=1 indicates only one useful +* solution, the usual case; under these circumstances, the second +* solution can be regarded as valid if the vector V02 is interpreted +* as the "over-the-pole" case. +* +* 4 This routine is the Cartesian equivalent of the routine slTPSC. +* +* P.T.Wallace Starlink 5 June 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL XI,ETA,V(3),V01(3),V02(3) + INTEGER N + + REAL X,Y,Z,RXY2,XI2,ETA2P1,SDF,R2,R,C + + + X=V(1) + Y=V(2) + Z=V(3) + RXY2=X*X+Y*Y + XI2=XI*XI + ETA2P1=ETA*ETA+1.0 + SDF=Z*SQRT(XI2+ETA2P1) + R2=RXY2*ETA2P1-Z*Z*XI2 + IF (R2.GT.0.0) THEN + R=SQRT(R2) + C=(SDF*ETA+R)/(ETA2P1*SQRT(RXY2*(R2+XI2))) + V01(1)=C*(X*R+Y*XI) + V01(2)=C*(Y*R-X*XI) + V01(3)=(SDF-ETA*R)/ETA2P1 + R=-R + C=(SDF*ETA+R)/(ETA2P1*SQRT(RXY2*(R2+XI2))) + V02(1)=C*(X*R+Y*XI) + V02(2)=C*(Y*R-X*XI) + V02(3)=(SDF-ETA*R)/ETA2P1 + IF (ABS(SDF).LT.1.0) THEN + N=1 + ELSE + N=2 + END IF + ELSE + N=0 + END IF + + END diff --git a/math/slalib/ue2el.f b/math/slalib/ue2el.f new file mode 100644 index 00000000..303c63f6 --- /dev/null +++ b/math/slalib/ue2el.f @@ -0,0 +1,212 @@ + SUBROUTINE slUEEL (U, JFORMR, + : JFORM, EPOCH, ORBINC, ANODE, PERIH, + : AORQ, E, AORL, DM, JSTAT) +*+ +* - - - - - - +* U E E L +* - - - - - - +* +* Transform universal elements into conventional heliocentric +* osculating elements. +* +* Given: +* U d(13) universal orbital elements (Note 1) +* +* (1) combined mass (M+m) +* (2) total energy of the orbit (alpha) +* (3) reference (osculating) epoch (t0) +* (4-6) position at reference epoch (r0) +* (7-9) velocity at reference epoch (v0) +* (10) heliocentric distance at reference epoch +* (11) r0.v0 +* (12) date (t) +* (13) universal eccentric anomaly (psi) of date, approx +* +* JFORMR i requested element set (1-3; Note 3) +* +* Returned: +* JFORM d element set actually returned (1-3; Note 4) +* EPOCH d epoch of elements (TT MJD) +* ORBINC d inclination (radians) +* ANODE d longitude of the ascending node (radians) +* PERIH d longitude or argument of perihelion (radians) +* AORQ d mean distance or perihelion distance (AU) +* E d eccentricity +* AORL d mean anomaly or longitude (radians, JFORM=1,2 only) +* DM d daily motion (radians, JFORM=1 only) +* JSTAT i status: 0 = OK +* -1 = illegal combined mass +* -2 = illegal JFORMR +* -3 = position/velocity out of range +* +* Notes +* +* 1 The "universal" elements are those which define the orbit for the +* purposes of the method of universal variables (see reference 2). +* They consist of the combined mass of the two bodies, an epoch, +* and the position and velocity vectors (arbitrary reference frame) +* at that epoch. The parameter set used here includes also various +* quantities that can, in fact, be derived from the other +* information. This approach is taken to avoiding unnecessary +* computation and loss of accuracy. The supplementary quantities +* are (i) alpha, which is proportional to the total energy of the +* orbit, (ii) the heliocentric distance at epoch, (iii) the +* outwards component of the velocity at the given epoch, (iv) an +* estimate of psi, the "universal eccentric anomaly" at a given +* date and (v) that date. +* +* 2 The universal elements are with respect to the mean equator and +* equinox of epoch J2000. The orbital elements produced are with +* respect to the J2000 ecliptic and mean equinox. +* +* 3 Three different element-format options are supported: +* +* Option JFORM=1, suitable for the major planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = longitude of perihelion, curly pi (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e +* AORL = mean longitude L (radians) +* DM = daily motion (radians) +* +* Option JFORM=2, suitable for minor planets: +* +* EPOCH = epoch of elements (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = mean distance, a (AU) +* E = eccentricity, e +* AORL = mean anomaly M (radians) +* +* Option JFORM=3, suitable for comets: +* +* EPOCH = epoch of perihelion (TT MJD) +* ORBINC = inclination i (radians) +* ANODE = longitude of the ascending node, big omega (radians) +* PERIH = argument of perihelion, little omega (radians) +* AORQ = perihelion distance, q (AU) +* E = eccentricity, e +* +* 4 It may not be possible to generate elements in the form +* requested through JFORMR. The caller is notified of the form +* of elements actually returned by means of the JFORM argument: +* +* JFORMR JFORM meaning +* +* 1 1 OK - elements are in the requested format +* 1 2 never happens +* 1 3 orbit not elliptical +* +* 2 1 never happens +* 2 2 OK - elements are in the requested format +* 2 3 orbit not elliptical +* +* 3 1 never happens +* 3 2 never happens +* 3 3 OK - elements are in the requested format +* +* 5 The arguments returned for each value of JFORM (cf Note 6: JFORM +* may not be the same as JFORMR) are as follows: +* +* JFORM 1 2 3 +* EPOCH t0 t0 T +* ORBINC i i i +* ANODE Omega Omega Omega +* PERIH curly pi omega omega +* AORQ a a q +* E e e e +* AORL L M - +* DM n - - +* +* where: +* +* t0 is the epoch of the elements (MJD, TT) +* T " epoch of perihelion (MJD, TT) +* i " inclination (radians) +* Omega " longitude of the ascending node (radians) +* curly pi " longitude of perihelion (radians) +* omega " argument of perihelion (radians) +* a " mean distance (AU) +* q " perihelion distance (AU) +* e " eccentricity +* L " longitude (radians, 0-2pi) +* M " mean anomaly (radians, 0-2pi) +* n " daily motion (radians) +* - means no value is set +* +* 6 At very small inclinations, the longitude of the ascending node +* ANODE becomes indeterminate and under some circumstances may be +* set arbitrarily to zero. Similarly, if the orbit is close to +* circular, the true anomaly becomes indeterminate and under some +* circumstances may be set arbitrarily to zero. In such cases, +* the other elements are automatically adjusted to compensate, +* and so the elements remain a valid description of the orbit. +* +* References: +* +* 1 Sterne, Theodore E., "An Introduction to Celestial Mechanics", +* Interscience Publishers Inc., 1960. Section 6.7, p199. +* +* 2 Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. +* +* Called: slPVEL +* +* P.T.Wallace Starlink 18 March 1999 +* +* Copyright (C) 1999 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION U(13) + INTEGER JFORMR,JFORM + DOUBLE PRECISION EPOCH,ORBINC,ANODE,PERIH,AORQ,E,AORL,DM + INTEGER JSTAT + +* Gaussian gravitational constant (exact) + DOUBLE PRECISION GCON + PARAMETER (GCON=0.01720209895D0) + +* Canonical days to seconds + DOUBLE PRECISION CD2S + PARAMETER (CD2S=GCON/86400D0) + + INTEGER I + DOUBLE PRECISION PMASS,DATE,PV(6) + + +* Unpack the universal elements. + PMASS = U(1)-1D0 + DATE = U(3) + DO I=1,3 + PV(I) = U(I+3) + PV(I+3) = U(I+6)*CD2S + END DO + +* Convert the position and velocity etc into conventional elements. + CALL slPVEL(PV,DATE,PMASS,JFORMR,JFORM,EPOCH,ORBINC,ANODE, + : PERIH,AORQ,E,AORL,DM,JSTAT) + + END diff --git a/math/slalib/ue2pv.f b/math/slalib/ue2pv.f new file mode 100644 index 00000000..8024bc65 --- /dev/null +++ b/math/slalib/ue2pv.f @@ -0,0 +1,253 @@ + SUBROUTINE slUEPV ( DATE, U, PV, JSTAT ) +*+ +* - - - - - - +* U E P V +* - - - - - - +* +* Heliocentric position and velocity of a planet, asteroid or comet, +* starting from orbital elements in the "universal variables" form. +* +* Given: +* DATE d date, Modified Julian Date (JD-2400000.5) +* +* Given and returned: +* U d(13) universal orbital elements (updated; Note 1) +* +* given (1) combined mass (M+m) +* " (2) total energy of the orbit (alpha) +* " (3) reference (osculating) epoch (t0) +* " (4-6) position at reference epoch (r0) +* " (7-9) velocity at reference epoch (v0) +* " (10) heliocentric distance at reference epoch +* " (11) r0.v0 +* returned (12) date (t) +* " (13) universal eccentric anomaly (psi) of date +* +* Returned: +* PV d(6) position (AU) and velocity (AU/s) +* JSTAT i status: 0 = OK +* -1 = radius vector zero +* -2 = failed to converge +* +* Notes +* +* 1 The "universal" elements are those which define the orbit for the +* purposes of the method of universal variables (see reference). +* They consist of the combined mass of the two bodies, an epoch, +* and the position and velocity vectors (arbitrary reference frame) +* at that epoch. The parameter set used here includes also various +* quantities that can, in fact, be derived from the other +* information. This approach is taken to avoiding unnecessary +* computation and loss of accuracy. The supplementary quantities +* are (i) alpha, which is proportional to the total energy of the +* orbit, (ii) the heliocentric distance at epoch, (iii) the +* outwards component of the velocity at the given epoch, (iv) an +* estimate of psi, the "universal eccentric anomaly" at a given +* date and (v) that date. +* +* 2 The companion routine is slELUE. This takes the conventional +* orbital elements and transforms them into the set of numbers +* needed by the present routine. A single prediction requires one +* one call to slELUE followed by one call to the present routine; +* for convenience, the two calls are packaged as the routine +* slPLNE. Multiple predictions may be made by again +* calling slELUE once, but then calling the present routine +* multiple times, which is faster than multiple calls to slPLNE. +* +* It is not obligatory to use slELUE to obtain the parameters. +* However, it should be noted that because slELUE performs its +* own validation, no checks on the contents of the array U are made +* by the present routine. +* +* 3 DATE is the instant for which the prediction is required. It is +* in the TT timescale (formerly Ephemeris Time, ET) and is a +* Modified Julian Date (JD-2400000.5). +* +* 4 The universal elements supplied in the array U are in canonical +* units (solar masses, AU and canonical days). The position and +* velocity are not sensitive to the choice of reference frame. The +* slELUE routine in fact produces coordinates with respect to the +* J2000 equator and equinox. +* +* 5 The algorithm was originally adapted from the EPHSLA program of +* D.H.P.Jones (private communication, 1996). The method is based +* on Stumpff's Universal Variables. +* +* Reference: Everhart, E. & Pitkin, E.T., Am.J.Phys. 51, 712, 1983. +* +* P.T.Wallace Starlink 22 October 2005 +* +* Copyright (C) 2005 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DATE,U(13),PV(6) + INTEGER JSTAT + +* Gaussian gravitational constant (exact) + DOUBLE PRECISION GCON + PARAMETER (GCON=0.01720209895D0) + +* Canonical days to seconds + DOUBLE PRECISION CD2S + PARAMETER (CD2S=GCON/86400D0) + +* Test value for solution and maximum number of iterations + DOUBLE PRECISION TEST + INTEGER NITMAX + PARAMETER (TEST=1D-13,NITMAX=25) + + INTEGER I,NIT,N + + DOUBLE PRECISION CM,ALPHA,T0,P0(3),V0(3),R0,SIGMA0,T,PSI,DT,W, + : TOL,PSJ,PSJ2,BETA,S0,S1,S2,S3, + : FF,R,FLAST,PLAST,F,G,FD,GD + + + +* Unpack the parameters. + CM = U(1) + ALPHA = U(2) + T0 = U(3) + DO I=1,3 + P0(I) = U(I+3) + V0(I) = U(I+6) + END DO + R0 = U(10) + SIGMA0 = U(11) + T = U(12) + PSI = U(13) + +* Approximately update the universal eccentric anomaly. + PSI = PSI+(DATE-T)*GCON/R0 + +* Time from reference epoch to date (in Canonical Days: a canonical +* day is 58.1324409... days, defined as 1/GCON). + DT = (DATE-T0)*GCON + +* Refine the universal eccentric anomaly, psi. + NIT = 1 + W = 1D0 + TOL = 0D0 + DO WHILE (ABS(W).GE.TOL) + +* Form half angles until BETA small enough. + N = 0 + PSJ = PSI + PSJ2 = PSJ*PSJ + BETA = ALPHA*PSJ2 + DO WHILE (ABS(BETA).GT.0.7D0) + N = N+1 + BETA = BETA/4D0 + PSJ = PSJ/2D0 + PSJ2 = PSJ2/4D0 + END DO + +* Calculate Universal Variables S0,S1,S2,S3 by nested series. + S3 = PSJ*PSJ2*((((((BETA/210D0+1D0) + : *BETA/156D0+1D0) + : *BETA/110D0+1D0) + : *BETA/72D0+1D0) + : *BETA/42D0+1D0) + : *BETA/20D0+1D0)/6D0 + S2 = PSJ2*((((((BETA/182D0+1D0) + : *BETA/132D0+1D0) + : *BETA/90D0+1D0) + : *BETA/56D0+1D0) + : *BETA/30D0+1D0) + : *BETA/12D0+1D0)/2D0 + S1 = PSJ+ALPHA*S3 + S0 = 1D0+ALPHA*S2 + +* Undo the angle-halving. + TOL = TEST + DO WHILE (N.GT.0) + S3 = 2D0*(S0*S3+PSJ*S2) + S2 = 2D0*S1*S1 + S1 = 2D0*S0*S1 + S0 = 2D0*S0*S0-1D0 + PSJ = PSJ+PSJ + TOL = TOL+TOL + N = N-1 + END DO + +* Values of F and F' corresponding to the current value of psi. + FF = R0*S1+SIGMA0*S2+CM*S3-DT + R = R0*S0+SIGMA0*S1+CM*S2 + +* If first iteration, create dummy "last F". + IF ( NIT.EQ.1) FLAST = FF + +* Check for sign change. + IF ( FF*FLAST.LT.0D0 ) THEN + +* Sign change: get psi adjustment using secant method. + W = FF*(PLAST-PSI)/(FLAST-FF) + ELSE + +* No sign change: use Newton-Raphson method instead. + IF (R.EQ.0D0) GO TO 9010 + W = FF/R + END IF + +* Save the last psi and F values. + PLAST = PSI + FLAST = FF + +* Apply the Newton-Raphson or secant adjustment to psi. + PSI = PSI-W + +* Next iteration, unless too many already. + IF (NIT.GT.NITMAX) GO TO 9020 + NIT = NIT+1 + END DO + +* Project the position and velocity vectors (scaling velocity to AU/s). + W = CM*S2 + F = 1D0-W/R0 + G = DT-CM*S3 + FD = -CM*S1/(R0*R) + GD = 1D0-W/R + DO I=1,3 + PV(I) = P0(I)*F+V0(I)*G + PV(I+3) = CD2S*(P0(I)*FD+V0(I)*GD) + END DO + +* Update the parameters to allow speedy prediction of PSI next time. + U(12) = DATE + U(13) = PSI + +* OK exit. + JSTAT = 0 + GO TO 9999 + +* Null radius vector. + 9010 CONTINUE + JSTAT = -1 + GO TO 9999 + +* Failed to converge. + 9020 CONTINUE + JSTAT = -2 + + 9999 CONTINUE + END diff --git a/math/slalib/unpcd.f b/math/slalib/unpcd.f new file mode 100644 index 00000000..c4de5fbb --- /dev/null +++ b/math/slalib/unpcd.f @@ -0,0 +1,145 @@ + SUBROUTINE slUPCD ( DISCO, X, Y ) +*+ +* - - - - - - +* U P C D +* - - - - - - +* +* Remove pincushion/barrel distortion from a distorted [x,y] to give +* tangent-plane [x,y]. +* +* Given: +* DISCO d pincushion/barrel distortion coefficient +* X,Y d distorted coordinates +* +* Returned: +* X,Y d tangent-plane coordinates +* +* Notes: +* +* 1) The distortion is of the form RP = R*(1+C*R^2), where R is +* the radial distance from the tangent point, C is the DISCO +* argument, and RP is the radial distance in the presence of +* the distortion. +* +* 2) For pincushion distortion, C is +ve; for barrel distortion, +* C is -ve. +* +* 3) For X,Y in "radians" - units of one projection radius, +* which in the case of a photograph is the focal length of +* the camera - the following DISCO values apply: +* +* Geometry DISCO +* +* astrograph 0.0 +* Schmidt -0.3333 +* AAT PF doublet +147.069 +* AAT PF triplet +178.585 +* AAT f/8 +21.20 +* JKT f/8 +13.32 +* +* 4) The present routine is a rigorous inverse of the companion +* routine slPCD. The expression for RP in Note 1 is rewritten +* in the form x^3+a*x+b=0 and solved by standard techniques. +* +* 5) Cases where the cubic has multiple real roots can sometimes +* occur, corresponding to extreme instances of barrel distortion +* where up to three different undistorted [X,Y]s all produce the +* same distorted [X,Y]. However, only one solution is returned, +* the one that produces the smallest change in [X,Y]. +* +* P.T.Wallace Starlink 3 September 2000 +* +* Copyright (C) 2000 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION DISCO,X,Y + + DOUBLE PRECISION THIRD + PARAMETER (THIRD=1D0/3D0) + DOUBLE PRECISION D2PI + PARAMETER (D2PI=6.283185307179586476925286766559D0) + + DOUBLE PRECISION RP,Q,R,D,W,S,T,F,C,T3,F1,F2,F3,W1,W2,W3 + + + +* Distance of the point from the origin. + RP = SQRT(X*X+Y*Y) + +* If zero, or if no distortion, no action is necessary. + IF (RP.NE.0D0.AND.DISCO.NE.0D0) THEN + +* Begin algebraic solution. + Q = 1D0/(3D0*DISCO) + R = RP/(2D0*DISCO) + W = Q*Q*Q+R*R + +* Continue if one real root, or three of which only one is positive. + IF (W.GE.0D0) THEN + D = SQRT(W) + W = R+D + S = SIGN(ABS(W)**THIRD,W) + W = R-D + T = SIGN((ABS(W))**THIRD,W) + F = S+T + ELSE + +* Three different real roots: use geometrical method instead. + W = 2D0/SQRT(-3D0*DISCO) + C = 4D0*RP/(DISCO*W*W*W) + S = SQRT(1D0-MIN(C*C,1D0)) + T3 = ATAN2(S,C) + +* The three solutions. + F1 = W*COS((D2PI-T3)/3D0) + F2 = W*COS((T3)/3D0) + F3 = W*COS((D2PI+T3)/3D0) + +* Pick the one that moves [X,Y] least. + W1 = ABS(F1-RP) + W2 = ABS(F2-RP) + W3 = ABS(F3-RP) + IF (W1.LT.W2) THEN + IF (W1.LT.W3) THEN + F = F1 + ELSE + F = F3 + END IF + ELSE + IF (W2.LT.W3) THEN + F = F2 + ELSE + F = F3 + END IF + END IF + + END IF + +* Remove the distortion. + F = F/RP + X = F*X + Y = F*Y + + END IF + + END diff --git a/math/slalib/v2tp.f b/math/slalib/v2tp.f new file mode 100644 index 00000000..bb56af7a --- /dev/null +++ b/math/slalib/v2tp.f @@ -0,0 +1,96 @@ + SUBROUTINE slV2TP (V, V0, XI, ETA, J) +*+ +* - - - - - +* V 2 T P +* - - - - - +* +* Given the direction cosines of a star and of the tangent point, +* determine the star's tangent-plane coordinates. +* +* (single precision) +* +* Given: +* V r(3) direction cosines of star +* V0 r(3) direction cosines of tangent point +* +* Returned: +* XI,ETA r tangent plane coordinates of star +* J i status: 0 = OK +* 1 = error, star too far from axis +* 2 = error, antistar on tangent plane +* 3 = error, antistar too far from axis +* +* Notes: +* +* 1 If vector V0 is not of unit length, or if vector V is of zero +* length, the results will be wrong. +* +* 2 If V0 points at a pole, the returned XI,ETA will be based on the +* arbitrary assumption that the RA of the tangent point is zero. +* +* 3 This routine is the Cartesian equivalent of the routine slS2TP. +* +* P.T.Wallace Starlink 27 November 1996 +* +* Copyright (C) 1996 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL V(3),V0(3),XI,ETA + INTEGER J + + REAL X,Y,Z,X0,Y0,Z0,R2,R,W,D + + REAL TINY + PARAMETER (TINY=1E-6) + + + X=V(1) + Y=V(2) + Z=V(3) + X0=V0(1) + Y0=V0(2) + Z0=V0(3) + R2=X0*X0+Y0*Y0 + R=SQRT(R2) + IF (R.EQ.0.0) THEN + R=1E-20 + X0=R + END IF + W=X*X0+Y*Y0 + D=W+Z*Z0 + IF (D.GT.TINY) THEN + J=0 + ELSE IF (D.GE.0.0) THEN + J=1 + D=TINY + ELSE IF (D.GT.-TINY) THEN + J=2 + D=-TINY + ELSE + J=3 + END IF + D=D*R + XI=(Y*X0-X*Y0)/D + ETA=(Z*R2-Z0*W)/D + + END diff --git a/math/slalib/vdv.f b/math/slalib/vdv.f new file mode 100644 index 00000000..fc686b9d --- /dev/null +++ b/math/slalib/vdv.f @@ -0,0 +1,45 @@ + REAL FUNCTION slVDV (VA, VB) +*+ +* - - - - +* V D V +* - - - - +* +* Scalar product of two 3-vectors (single precision) +* +* Given: +* VA real(3) first vector +* VB real(3) second vector +* +* The result is the scalar product VA.VB (single precision) +* +* P.T.Wallace Starlink November 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL VA(3),VB(3) + + + slVDV=VA(1)*VB(1)+VA(2)*VB(2)+VA(3)*VB(3) + + END diff --git a/math/slalib/veri.f.in b/math/slalib/veri.f.in new file mode 100644 index 00000000..76eb4380 --- /dev/null +++ b/math/slalib/veri.f.in @@ -0,0 +1,52 @@ + INTEGER FUNCTION sla_VERI () +*+ +* - - - - - +* V E R I +* - - - - - +* +* Report the SLALIB version number as an integer. +* +* Given: +* None +* +* The result is the SLALIB version number as an integer m*1e6+n*1e3+r, +* where m is the major version, n the minor version and r the release +* number. +* +* Notes: +* +* To obtain the version number in a printable form, see +* subroutine sla_vers(version). +* +* The sla_veri subroutine was introduced in SLALIB version 2.5-1, so +* if this function is absent, one can only tell that the release +* predates that one. +* +* Norman Gray Starlink 8 April 2005 +* +* Copyright (C) 2005 Council for the Central Laboratory of the +* Research Councils +* +* Licence: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +*- + + IMPLICIT NONE + + sla_VERI=@PACKAGE_VERSION_INTEGER@ + + END diff --git a/math/slalib/vers.f.in b/math/slalib/vers.f.in new file mode 100644 index 00000000..b9ef9544 --- /dev/null +++ b/math/slalib/vers.f.in @@ -0,0 +1,58 @@ + SUBROUTINE sla_VERS (VERSION) +*+ +* - - - - - +* V E R S +* - - - - - +* +* Report the SLALIB version number. +* +* Given: +* None +* +* Returned: +* VERSION c*(*) Version number, in the form 'm.n-r'. +* The major version is m, the minor version n, and +* release r. The string passed in should be at least +* 8 characters in length, to account for the (remote) +* possibility that these numbers will ever go to +* two digits. +* +* Notes: +* +* To obtain the version number in a more easily processed form, see +* function sla_veri(). +* +* The sla_vers subroutine was introduced in SLALIB version 2.5-1, so +* if this function is absent, one can only tell that the release +* predates that one. +* +* Norman Gray Starlink 8 April 2005 +* +* Copyright (C) 2005 Council for the Central Laboratory of the +* Research Councils +* +* Licence: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +*- + + IMPLICIT NONE + + CHARACTER VERSION*(*) + + VERSION='@PACKAGE_VERSION@' + + END diff --git a/math/slalib/vn.f b/math/slalib/vn.f new file mode 100644 index 00000000..8bbb33d9 --- /dev/null +++ b/math/slalib/vn.f @@ -0,0 +1,64 @@ + SUBROUTINE slVN (V, UV, VM) +*+ +* - - - +* V N +* - - - +* +* Normalizes a 3-vector also giving the modulus (single precision) +* +* Given: +* V real(3) vector +* +* Returned: +* UV real(3) unit vector in direction of V +* VM real modulus of V +* +* If the modulus of V is zero, UV is set to zero as well +* +* P.T.Wallace Starlink 23 November 1995 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL V(3),UV(3),VM + + INTEGER I + REAL W1,W2 + + +* Modulus + W1=0.0 + DO I=1,3 + W2=V(I) + W1=W1+W2*W2 + END DO + W1=SQRT(W1) + VM=W1 + +* Normalize the vector + IF (W1.LE.0.0) W1=1.0 + DO I=1,3 + UV(I)=V(I)/W1 + END DO + + END diff --git a/math/slalib/vxv.f b/math/slalib/vxv.f new file mode 100644 index 00000000..688764bd --- /dev/null +++ b/math/slalib/vxv.f @@ -0,0 +1,57 @@ + SUBROUTINE slVXV (VA, VB, VC) +*+ +* - - - - +* V X V +* - - - - +* +* Vector product of two 3-vectors (single precision) +* +* Given: +* VA real(3) first vector +* VB real(3) second vector +* +* Returned: +* VC real(3) vector result +* +* P.T.Wallace Starlink March 1986 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + REAL VA(3),VB(3),VC(3) + + REAL VW(3) + INTEGER I + + +* Form the vector product VA cross VB + VW(1)=VA(2)*VB(3)-VA(3)*VB(2) + VW(2)=VA(3)*VB(1)-VA(1)*VB(3) + VW(3)=VA(1)*VB(2)-VA(2)*VB(1) + +* Return the result + DO I=1,3 + VC(I)=VW(I) + END DO + + END diff --git a/math/slalib/wait.f__vms b/math/slalib/wait.f__vms new file mode 100644 index 00000000..5897e7e6 --- /dev/null +++ b/math/slalib/wait.f__vms @@ -0,0 +1,60 @@ + SUBROUTINE sla_WAIT (DELAY) +*+ +* - - - - - +* W A I T +* - - - - - +* +* Interval wait +* +* !!! VAX/VMS specific !!! +* +* Given: +* DELAY real delay in seconds +* +* A delay 100ns < DELAY < 200s is requested. +* +* P.T.Wallace Starlink 14 October 1991 +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +*- + + IMPLICIT NONE + + REAL DELAY + + INTEGER JSTAT + INTEGER SYS$SCHDWK,SYS$HIBER + + INTEGER IDT(2) + DATA IDT(2)/-1/ + + + +* Encode delta time + IDT(1)=-NINT(MAX(1.0,1E7*MIN(200.0,DELAY))) + + +* Schedule a wakeup + JSTAT=SYS$SCHDWK(,,IDT,) + IF (.NOT.JSTAT) CALL LIB$STOP(%VAL(JSTAT)) + +* Hibernate + JSTAT=SYS$HIBER() + IF (.NOT.JSTAT) CALL LIB$STOP(%VAL(JSTAT)) + + END diff --git a/math/slalib/wait.f__win b/math/slalib/wait.f__win new file mode 100644 index 00000000..b018650c --- /dev/null +++ b/math/slalib/wait.f__win @@ -0,0 +1,83 @@ + SUBROUTINE sla_WAIT (DELAY) +*+ +* - - - - - +* W A I T +* - - - - - +* +* Interval wait +* +* !!! PC only - Microsoft Fortran specific !!! +* +* Given: +* DELAY real delay in seconds +* +* A delay of up to 10000 seconds occurs. +* +* Called: GETTIM (Microsoft Fortran run-time library) +* +* P.T.Wallace Starlink 14 October 1991 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +*- + + IMPLICIT NONE + + REAL DELAY + + INTEGER IDELAY,IH,IM,IS,I,IT,IT0,IDT + LOGICAL FIRST,LOOP + + + + +* Convert requested delay to 0.01 second ticks + IDELAY=NINT(MAX(MIN(DELAY,1E4),0.0)*1E2) + +* Set "note start time" flag + FIRST=.TRUE. + +* Set "wait in progress" flag + LOOP=.TRUE. + +* Main loop + DO WHILE (LOOP) + +* Get the current time and convert to 0.01 second ticks + CALL GETTIM(IH,IM,IS,I) + IT=((IH*60+IM)*60+IS)*100+I + +* First time through the loop? + IF (FIRST) THEN + +* Yes: note the time and reset the flag + IT0=IT + FIRST=.FALSE. + ELSE + +* No: subtract the start time, handling 0 hours wrap + IDT=IT-IT0 + IF (IDT.LT.0) IDT=IDT+8640000 + +* If the requested delay has elapsed, stop looping + LOOP=IDT.LT.IDELAY + END IF + END DO + + END diff --git a/math/slalib/wait.fdefault b/math/slalib/wait.fdefault new file mode 100644 index 00000000..75e2720f --- /dev/null +++ b/math/slalib/wait.fdefault @@ -0,0 +1,49 @@ + SUBROUTINE sla_WAIT (DELAY) +*+ +* - - - - - +* W A I T +* - - - - - +* +* Interval wait +* +* !!! Version for: SPARC/SunOS4, +* SPARC/Solaris2, +* DEC Mips/Ultrix +* DEC AXP/Digital Unix +* Intel/Linux +* Convex +* +* Given: +* DELAY real delay in seconds +* +* Called: SLEEP (a Fortran Intrinsic on all obove platforms) +* +* P.T.Wallace Starlink 22 January 1998 +* +* Copyright (C) 1998 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +*- + + IMPLICIT NONE + + REAL DELAY + + CALL SLEEP(NINT(DELAY)) + + END diff --git a/math/slalib/xy2xy.f b/math/slalib/xy2xy.f new file mode 100644 index 00000000..b9c770a3 --- /dev/null +++ b/math/slalib/xy2xy.f @@ -0,0 +1,67 @@ + SUBROUTINE slXYXY (X1,Y1,COEFFS,X2,Y2) +*+ +* - - - - - - +* X Y X Y +* - - - - - - +* +* Transform one [X,Y] into another using a linear model of the type +* produced by the slFTXY routine. +* +* Given: +* X1 d x-coordinate +* Y1 d y-coordinate +* COEFFS d(6) transformation coefficients (see note) +* +* Returned: +* X2 d x-coordinate +* Y2 d y-coordinate +* +* The model relates two sets of [X,Y] coordinates as follows. +* Naming the elements of COEFFS: +* +* COEFFS(1) = A +* COEFFS(2) = B +* COEFFS(3) = C +* COEFFS(4) = D +* COEFFS(5) = E +* COEFFS(6) = F +* +* the present routine performs the transformation: +* +* X2 = A + B*X1 + C*Y1 +* Y2 = D + E*X1 + F*Y1 +* +* See also slFTXY, slPXY, slINVF, slDCMF +* +* P.T.Wallace Starlink 5 December 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION X1,Y1,COEFFS(6),X2,Y2 + + + X2=COEFFS(1)+COEFFS(2)*X1+COEFFS(3)*Y1 + Y2=COEFFS(4)+COEFFS(5)*X1+COEFFS(6)*Y1 + + END diff --git a/math/slalib/zd.f b/math/slalib/zd.f new file mode 100644 index 00000000..c7376266 --- /dev/null +++ b/math/slalib/zd.f @@ -0,0 +1,80 @@ + DOUBLE PRECISION FUNCTION slZD (HA, DEC, PHI) +*+ +* - - - +* Z D +* - - - +* +* HA, Dec to Zenith Distance (double precision) +* +* Given: +* HA d Hour Angle in radians +* DEC d declination in radians +* PHI d observatory latitude in radians +* +* The result is in the range 0 to pi. +* +* Notes: +* +* 1) The latitude must be geodetic. In critical applications, +* corrections for polar motion should be applied. +* +* 2) In some applications it will be important to specify the +* correct type of hour angle and declination in order to +* produce the required type of zenith distance. In particular, +* it may be important to distinguish between the zenith distance +* as affected by refraction, which would require the "observed" +* HA,Dec, and the zenith distance in vacuo, which would require +* the "topocentric" HA,Dec. If the effects of diurnal aberration +* can be neglected, the "apparent" HA,Dec may be used instead of +* the topocentric HA,Dec. +* +* 3) No range checking of arguments is done. +* +* 4) In applications which involve many zenith distance calculations, +* rather than calling the present routine it will be more efficient +* to use inline code, having previously computed fixed terms such +* as sine and cosine of latitude, and perhaps sine and cosine of +* declination. +* +* P.T.Wallace Starlink 3 April 1994 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +* +* License: +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program (see SLA_CONDITIONS); if not, write to the +* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +* Boston, MA 02110-1301 USA +* +* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc. +*- + + IMPLICIT NONE + + DOUBLE PRECISION HA,DEC,PHI + + DOUBLE PRECISION SH,CH,SD,CD,SP,CP,X,Y,Z + + + SH=SIN(HA) + CH=COS(HA) + SD=SIN(DEC) + CD=COS(DEC) + SP=SIN(PHI) + CP=COS(PHI) + X=CH*CD*SP-SD*CP + Y=SH*CD + Z=CH*CD*CP+SD*SP + slZD=ATAN2(SQRT(X*X+Y*Y),Z) + + END -- cgit