PRO thm_crib_neutral_sheet
compile_opt idl2
date = '2008-12-27/00:00:00'
hrs = 3
date = time_double(date)-3600*hrs/2
timespan,date,hrs,/hour
time = make_array(121, /double)
for i=0, 120l do $
time[i] = time[i] + i*60 + time_double(date)
gse_pos = make_array(121,3,/double)
gse_pos[*,0] = (-1.*(dindgen(121)/4.))+8
omni_hro_load, varformat=['Vx', 'Vy', 'Vz']
tdeflag, ['OMNI_HRO_1min_Vx', 'OMNI_HRO_1min_Vy', 'OMNI_HRO_1min_Vz'], 'remove_nan'
get_data, 'OMNI_HRO_1min_Vx_deflag', data=Vx_data
get_data, 'OMNI_HRO_1min_Vy_deflag', data=Vy_data
get_data, 'OMNI_HRO_1min_Vz_deflag', data=Vz_data
gse2agsm, {x: time, y: gse_pos}, agsm_pos_from_vel, sw_velocity = [[Vx_data.Y], [Vy_data.Y], [Vz_data.Y]]
gsm_pos = agsm_pos_from_vel.Y
stop
neutral_sheet, time, gsm_pos, model='sm', distance2NS=dz2NS_sm
neutral_sheet, time, gsm_pos, model='themis', distance2NS=dz2NS_thm
neutral_sheet, time, gsm_pos, model='aen', distance2NS=dz2NS_aen
neutral_sheet, time, gsm_pos, model='den', distance2NS=dz2NS_den
neutral_sheet, time, gsm_pos, model='fairfield', distance2NS=dz2NS_fm
neutral_sheet, time, gsm_pos, model='den_fairfield', distance2NS=dz2NS_den_fm
neutral_sheet, time, gsm_pos, model='lopez', distance2NS=dz2NS_lm
times = replicate(time_double(date),14)
x = [-22,-22,-22,-22,-17,-12,-8,-5,-3,2,4,7,8,8]
y = replicate(0,14)
z = [10,7,4,0,replicate(0,9),4]
trace_pts_north = [[x],[y],[z]]
trace_pts_south = [[x],[y],[-1*z]]
store_data,'trace_pts_north',data={x:times,y:trace_pts_north}
store_data,'trace_pts_south',data={x:times,y:trace_pts_south}
ttrace2iono,'trace_pts_north',trace_var_name = 'trace_n', $
external_model='t89',par=2.0D,in_coord='gsm',out_coord='gsm'
ttrace2iono,'trace_pts_south',trace_var_name = 'trace_s',$
external_model='t89',par=2.0D,in_coord='gsm',out_coord='gsm', /south
thm_init
window,xsize=950,ysize=700
axisthick = 1.0
charthick = 1.0
linethick = 2.0
charsize = 1.5
symsize = 1.0
landscape=1
encapsulated=1
xmargin = [.1,.1]
ymargin = [.3,.1]
xrange = [-21,10]
zrange = [-11,11]
tplotxy,'trace_n',versus='xrz',xrange=xrange,yrange=zrange,charsize=charsize,title="XZ field line/neutral sheet plot (gsm)",subtitle='[Y at 0.0 re]',xthick=axisthick,ythick=axisthick,thick=linethick,background=255,charthick=charthick,ymargin=ymargin,xmargin=xmargin
tplotxy,'trace_s',versus='xrz',xrange=xrange,yrange=zrange,/over,xthick=axisthick,ythick=axisthick,thick=linethick,charthick=charthick
oplot, gsm_pos[*,0], dz2NS_aen, color = 220, thick = 1.8
oplot, gsm_pos[*,0], dz2NS_sm, color = 60, thick = 2.5
oplot, gsm_pos[*,0], dz2NS_den, color = 90, thick = 1.8
oplot, gsm_pos[*,0], dz2NS_fm, color = 30, thick = 2.5
oplot, gsm_pos[*,0], dz2NS_thm, color = 150, thick = 1.8, linestyle=2
oplot, gsm_pos[*,0], dz2NS_lm, color = 200, thick = 1.8
oplot, gsm_pos[*,0], dz2NS_den_fm, color = 250, thick = 1.8, linestyle=2
xyouts, .1, .22, 'AEN = Orange', color = 220, /normal, charsize=1.25
xyouts, .1, .19, 'SM = Blue', color = 60, /normal, charsize=1.25
xyouts, .1, .16, 'DEN = Light Blue', color = 90, /normal, charsize=1.25
xyouts, .1, .13, 'FM = Purple', color = 30, /normal, charsize=1.25
xyouts, .1, .10, 'THM = Dashed Green', color = 150, /normal, charsize=1.25
xyouts, .1, .07, 'LM = Yellow', color = 200, /normal, charsize=1.25
xyouts, .1, .04, 'DEN_FM = Dashed Red', color = 250, /normal, charsize=1.25
print, '.c to continue'
print, 'This is a plot of field lines with the neutral sheet models overplotted.'
stop
time = replicate(time_double(date),24)
x = make_array(24, /double)
y = findgen(24)-12
z = make_array(24, /double)
gsm_pos = make_array(24,3,/double)
gsm_pos[*,0] = x-21
gsm_pos[*,1] = y
gsm_pos[*,2] = z
neutral_sheet, time, gsm_pos, model='themis', distance2NS=dz2NS_thm
neutral_sheet, time, gsm_pos, model='aen', distance2NS=dz2NS_aen
neutral_sheet, time, gsm_pos, model='den', distance2NS=dz2NS_den
neutral_sheet, time, gsm_pos, model='fairfield', distance2NS=dz2NS_fm
neutral_sheet, time, gsm_pos, model='den_fairfield', distance2NS=dz2NS_den_fm
neutral_sheet, time, gsm_pos, model='lopez', distance2NS=dz2NS_lm
window, xsize=750, ysize=750
xmargin = [17,17]
ymargin = [25,5]
plot, gsm_pos[*,1], dz2NS_aen, color = 0, thick = 1.8, xtitle='Y', ytitle='Z', $
xmargin=xmargin, ymargin=ymargin, yrange=[-11,11], $
title='YZ Neutral sheet plot (gsm)', charsize=1.5, $
subtitle = '[X at -21.0 re]'
oplot, gsm_pos[*,1], dz2NS_aen, color = 220, thick = 1.8
oplot, gsm_pos[*,1], dz2NS_sm, color = 60, thick = 2.
oplot, gsm_pos[*,1], dz2NS_den, color = 90, thick = 1.8
oplot, gsm_pos[*,1], dz2NS_fm, color = 30, thick = 2.5
oplot, gsm_pos[*,1], dz2NS_thm, color = 150, thick = 1.8, linestyle=2
oplot, gsm_pos[*,1], dz2NS_lm, color = 200, thick = 1.8
oplot, gsm_pos[*,1], dz2NS_den_fm, color = 250, thick = 1.8, linestyle=2
xyouts, .1, .22, 'AEN = Orange', color = 220, /normal, charsize=1.25
xyouts, .1, .19, 'SM = Blue', color = 60, /normal, charsize=1.25
xyouts, .1, .16, 'DEN = Light Blue', color = 90, /normal, charsize=1.25
xyouts, .1, .13, 'FM = Purple', color = 30, /normal, charsize=1.25
xyouts, .1, .10, 'THM = Dashed Green', color = 150, /normal, charsize=1.25
xyouts, .1, .07, 'LM = Yellow', color = 200, /normal, charsize=1.25
xyouts, .1, .04, 'DEN_FM = Dashed Red', color = 250, /normal, charsize=1.25
bx = make_array(24, /double)
by = make_array(24, /double)
bz = make_array(24, /double)
times=time
gsm_pos[*,0] = x-21
gsm_pos[*,1] = y
FOR i=0,n_elements(time)-1 DO BEGIN
time=time_struct(times[i])
geopack_recalc, time.year, time.doy, time.hour, time.min, time.sec, tilt=tilt
geopack_igrf_gsm, gsm_pos[i,0], gsm_pos[i,1], gsm_pos[i,2], igrf_bx, igrf_by, igrf_bz
geopack_t89, 2, gsm_pos[i,0], gsm_pos[i,1], gsm_pos[i,2], t89_bx,t89_by, t89_bz, tilt = tilt
bx[i] = igrf_bx + t89_bx
by[i] = igrf_by + t89_by
bz[i] = igrf_bz + t89_bz
ENDFOR
print, 'Done'
print, '.c to continue'
stop
END