pro near_conj, near, plot = plot, qstop = qstop
file = '/ys/ucon/idl/hudson/near.dat'
data=rd_tfile(file,5)
n_read = n_elements(data(0,*))
near = {near_str, time:0l, day:0, dd:0., pp:0.0, r_moon:0.0, $
  r_sun:0.0, pp_sun:0.0, xx:0.0, yy:0.0, daylight:0, saa:0}
near = replicate(near,n_read) 
for i = 0, n_read-1 do begin
  near(i).day = 6606 + fix(strmid(data(0,i),0,2)) 
  near(i).time = 3600.*fix(strmid(data(1,i),0,2)) $
    + 60.*fix(strmid(data(1,i),3,2))
  near(i).time = near(i).time*1000.
endfor
;for i = 0, n_read-1 do begin
;  if (conj(i).time gt 8.64e7) then begin
;     conj(i).time = conj(i).time - 8.64e7
;     conj(i).day = conj(i).day + 1
;  endif
;endfor
near.dd = reform(data(4,*))
near.pp = reform(data(3,*))
rad = 180/!pi
fmt_timer,near,t1,t2
pangle = get_rb0p(t1,/pangle)*rad
near.pp_sun = near.pp-pangle              ; corrects for solar tilt
near.xx = -sin(near.pp_sun/rad)*near.dd ; xx is W departure
near.yy =  cos(near.pp_sun/rad)*near.dd ; yy is N departure
t1 = anytim(t1,/ext)
t1(0) = t1(0)-3
t2 = anytim(t2,/ext)
t2(0) = t2(0)+6
rd_fem,t1,t2,fem_dat
near.daylight = day_in(fem_dat, fmt_tim(near))
;if n_elements(plot) ne 0 then eclipse_plotter,near,date=date 
if keyword_set(plot) then begin
  plot,near.xx,near.yy,yr=[-1.5,1.5],tit='NEAR conjunction, 19-Feb-97'
  ttt = findgen(101)
; sunrad = get_rb0p(t1,/r)/2.45
  sunrad = 1.
  xxx = sunrad * cos(ttt*2*!pi/100.)
  yyy = sunrad * sin(ttt*2*!pi/100.)
  oplot,xxx,yyy
  xxx = 1.5*xxx & yyy = 1.5*yyy
  oplot,xxx,yyy,lines=1
  x = 741 & y = 298 & x1 = 804 & y1 = 319
  arrow,x,y,x1,y1
endif
if n_elements(qstop) then stop
end