.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
