Viewing contents of file '../idllib/uit/pro/astdisp.pro'
pro AstDisp,x,y,ra,dec,DN
;+
; NAME:
;   ASTDISP
; DESCRIPTION:
;   This procedure prints of the X,Y,RA,DEC,DN in a standard format.  X,Y must
;   be supplied.  RA,DEC may also be supplied, and a DN may also be supplied.
; INPUT:
;   X         The X pixel coordinate
;   Y         The Y pixel coordinate
; OPTIONAL INPUT:
;   RA        Right Ascention
;   DEC       DEClination  (if RA is supplied, DEC must also be supplied)
;   DN        Data Number
; OUTPUT:
;   Printed positions in both degrees and sexigesimal format
;   All passed variables remain unchanged
; HISTORY:
;   10-AUG-90 Version 1 written by Eric W. Deutsch
;   20-AUG-91 Converted to standard header.  Vectorized Code.  E. Deutsch
;-

  arg=n_params(0)
  if (arg lt 2) then begin
    print,'Call: IDL> AstDisp,x_pixel,y_pixel,[RA,DEC],[DN]'
    print,'e.g.: IDL> AstDisp,x,y,ra,dec'
    return
    endif
  if (arg eq 3) then dec=0.0D

  hdr='    X        Y'
  fmt='$(f8.2,1x,f8.2'
  if (arg le 2) then begin & type=0 & goto,PRN & endif

  hdr=hdr+'         RA       DEC           RA           DEC'
  fmt=fmt+',2x,F9.4,1x,F9.4,2x,A'
  if (arg le 4) then begin & type=1 & goto,PRN & endif

  hdr=hdr+'           DN'
  fmt=fmt+',3x,f9.3'
  type=2

PRN:
  print,hdr
  for i=0,n_elements(x)-1 do begin
    if (type eq 0) then print,format=fmt+')',x(i),y(i)
    if (type eq 1) then print,format=fmt+')',x(i),y(i),ra(i),dec(i), $
      adstring(ra(i),dec(i),2)
    if (type eq 2) then print,format=fmt+')',x(i),y(i),ra(i),dec(i), $
      adstring(ra(i),dec(i),2),DN(i)
    endfor

  return
end