University of Colorado at Boulder University of Colorado CU Home Search A to Z Index Map
Laboratory for Atmospheric and Space Physics

timas_kp_plot.pro


pro timas_kp_plot, file_name, ps_or_x

; modified 6/96 to read all values for each record.....
;


;
;  10/10 ADDED A NEW VARIABLE Q_FILE_FLAGS_CORRUPTED.....
; 9/23/95 add switch to make a gif file of spectrogram only
; in x mode
;
;
;for i=0, info.nvars-1 do begin
;	vinfo= cdf_varinq(cdfid,i)
;	print, vinfo.name, ' ', vinfo.datatype
;endfor
; Z Varaibles names and dimensions
; 
; you entered  
; CDFID      1990328
; ** Structure <203910>, 8 tags, length=40, refs=1:
;    NDIMS           LONG                 0
;    ENCODING        STRING    'NETWORK_ENCODING'
;    MAJORITY        STRING    'COL_MAJOR'
;    MAXREC          LONG                -1
;    NVARS           LONG                 0
;    NZVARS          LONG                45
;    NATTS           LONG                39
;    DIM             LONG      Array(1)
; Dimensions:            0
; 
; Z Variable names and Types
; Epoch CDF_EPOCH
; Time_PB5 CDF_INT4
; Density_H CDF_REAL4
; Density_O CDF_REAL4
; Density_He_1 CDF_REAL4
; Density_He_2 CDF_REAL4
; Vel_H_low CDF_REAL4
; Vel_O_low CDF_REAL4
; Velocity_H CDF_REAL4
; Velocity_O CDF_REAL4
; Temp_H_Low CDF_REAL4
; Temp_O_Low CDF_REAL4
; Temperature_H CDF_REAL4
; Temperature_O CDF_REAL4
; Mode_ID CDF_INT4
; Energy_Range_ID CDF_UINT1
; TIMAS_B CDF_REAL4
; Quality_H CDF_REAL4
; Quality_O CDF_REAL4
; Quality_HE_1 CDF_REAL4
; Quality_HE_2 CDF_REAL4
; Geomagnetic_Position CDF_REAL4
; Geographic_Position CDF_REAL4
; label_geomagnetic CDF_CHAR
; units_geomagnetic CDF_CHAR
; format_geomagnetic CDF_CHAR
; label_geographic CDF_CHAR
; units_geographic CDF_CHAR
; format_geographic CDF_CHAR
; label_time CDF_CHAR
; unit_time CDF_CHAR
; format_time CDF_CHAR
; Labels_for_TIMAS_B CDF_CHAR
; Labels_for_Quality CDF_CHAR
; label_Energy_Ranges CDF_CHAR
; label_H_density CDF_CHAR
; label_O_density CDF_CHAR
; label_H_Low_Velocity CDF_CHAR
; label_O_Low_Velocity CDF_CHAR
; label_H_Full_Velocity CDF_CHAR
; label_O_Full_Velocity CDF_CHAR
; label_H_Low_Temp CDF_CHAR
; label_O_Low_Temp CDF_CHAR
; label_H_full_Temp CDF_CHAR
; label_O_full_Temp CDF_CHAR
; % CDF_CONTROL: Function completed but: NO_PADVALUE_SPECIFIED: A pad value has
;                not been specified.
; NOTE:  The NO_PADVALUE_SPECIFIED: error is a feature of idl. no problem/wkp.
; MAXRECORDS=           -1
; po_k0_timas
;
; Z Variable names and Types   start out with keeping only
;				one variable add 1440 of
;				seletected variables for
;				24 hour plots when you have
;				some data to plot!!!!
; Epoch CDF_EPOCH
EPOCH=1.0D1	; trick to get epoch as a double variable
Time=fltarr(1440) ; 1440 minutes per day ...time in decimal hours!!!	
; Time_PB5 CDF_INT4
Pb5time=fltarr(3)		; Pb5 times of last record only
; Density_H CDF_REAL4

hydrogen=fltarr(4,1440)
; Density_O CDF_REAL4

oxygen=fltarr(4,1440)
; Density_He_1 CDF_REAL4
he1den=fltarr(1440)	
; Density_He_2 CDF_REAL4
he2den=fltarr(1440)
; Vel_H_low CDF_REAL4
hvlow=fltarr(3)
; Vel_O_low CDF_REAL4
ovlow=fltarr(3)
; Velocity_H CDF_REAL4
hvel=fltarr(3)
hvelocity=fltarr(2,1440) ; par and perp
ovelocity=fltarr(2,1440)
htemperature=fltarr(2,1440); par and perp
otemperature=fltarr(2,1440)
; Velocity_O CDF_REAL4
ovel=fltarr(3)
; Temp_H_Low CDF_REAL4
htlow=fltarr(2)
; Temp_O_Low CDF_REAL4
otlow=fltarr(2)
htemp=fltarr(2)
; Temperature_H CDF_REAL4
otemp=fltarr(2)
; Temperature_O CDF_REAL4
mode=intarr(1440)
; Mode_ID CDF_INT4
erid=intarr(1440)
; Energy_Range_ID CDF_UINT1
timasb=fltarr(3)
BB=fltarr(3,1440)
; TIMAS_B CDF_REAL4
quality=fltarr(4,1440) ; h, o he+ he++ 
qh=fltarr(3)
; Quality_H CDF_REAL4
qo=fltarr(3)
; Quality_O CDF_REAL4
; Quality_HE_1 CDF_REAL4
; Quality_HE_2 CDF_REAL4
; Geographic_Position CDF_REAL4
geo_pos=fltarr(3)		; geographic position
altitude=fltarr(1440)		;
lat=fltarr(1440)			;
longitude=fltarr(1440)		;

; Geomagnetic_Position CDF_REAL4
mag_pos=fltarr(3)		; geomagnetic position
mlt=fltarr(1440)			;
invl=fltarr(1440)		;
mag_lat=fltarr(1440)		;


year=0L
Month=0L
Day=0L
Hour=0L
Minute=0L
Second=0L
Milli=0L	;for cdf_epoch
iarray_3=intarr(3)
array_3=fltarr(3)
array_2=fltarr(2)
dum=0L
idum=0
ibyte=intarr(1)	;reading in CDF_INT1 format

print,'file_name from input: ',file_name
print,'ps_or_x from input: ', ps_or_x
; note you have to enter the file name and ps_or_x on the 
; command line between single quotes '
;		example: IDL>check_cdf,'81310_de_eics','ps'

cdfname=file_name 
set_plot,'x'
;print, a(-1)		; make code crash for test
;print, 'Using ',cdfname+'.cdf  and outputing to device: ',ps_or_x

if ps_or_x eq 'ps' then begin
   set_plot,'ps'
   DEVICE, FILENAME=cdfname+'.ps', /Landscape   
print, 'Opening ',cdfname,'.ps file for line plots...'
endif 
;
; gif option  added 9/23/95
gif_or_no='n'
if ps_or_x eq 'x' then begin
 gif_name=''
 gif_or_no=''
 print, 'DO you want to make a gif file? y/n'
 read,gif_or_no
 print, 'you entered ',gif_name,' 
 if gif_or_no eq 'y' then begin
   device,retain=2		;let idl do the backing store
				; TVRD needs this to work
				; on my sparc station 2/wkp 
  gif_name=''
  print, 'making a gif file: ',gif_name   ; and make a gif at the end
 endif 
endif
;
;open cdf
;
cdfid=cdf_open(cdfname)
print,'CDFID ',cdfid
info=cdf_inquire(cdfid)

help,/structure, info
print, 'Dimensions: ',info.dim
print, ''
;print,'Z Variable names and Types'
;for i=0, info.nzvars-1 do begin
;	vinfo= cdf_varinq(cdfid,i,/zvariable)
;	print, vinfo.name, '    Type:', vinfo.datatype, '     DIMS:', vinfo.DIM
;endfor
;
cdf_control,cdfid,variable=0,/zvariable,get_var_info=einfo
max_records=einfo.maxrec
print, 'NOTE:  The NO_PADVALUE_SPECIFIED: error is a feature of idl. no problem/wkp.'

;% CDF_CONTROL: Function completed but: NO_PADVALUE_SPECIFIED: A pad value has
;               not been specified.

print,'MAXRECORDS= ',max_records

if max_records eq 0 then begin
   print, 'No valid Summary Data for this UT day'
   print_null,cdfid,einfo  ; call to print_null.pro ???? 
   print,cdfname 
   stop
endif

if max_records lt 0 then begin
   print, 'ERRORR NO FILL RECORD IN THIS CDF'
   print, 'KEY PARAMETER CDF NOT CLOSED when generated'
   print, ' ..... or .......'
   print, 'you forgot to specify bin when you used ftp '
   print, 'to transfer the file here! '
   print, cdfname
   stop
endif

;print,' use command cdf_attget,cdfid,VALIDMIN inquotes, varname in quotes, local variable'
   status=''
;		86400/96 seconds = 1440 max intervals per day!
print, cdfname
print, 'This version reads all values for each variable first...its faster'

i=0	; make the record star===0  (insruance statement 
; epoch
;
;  cdf_varget,cdfid,'Epoch',EPOCH, rec_start=i,/zvariable
;  cdf_varget,cdfid,'Epoch',EPOCH, rec_count=max_records,/zvariable
;   Result=CDF_ERROR(status)
;   if result ne 'CDF_OK: Function completed successfully.' then $
;   print, 'Status after cdf_varget for Epoch call/',Result,'/', status
; you don't really need epoch!!! use pb5 time....

;cdf_epoch, EPOCH, year, Month, Day, Hour, Minute, Second, milli,/break
;print Format= '("Record #: ",i4,2x,i4, 2x,i2,"/",i2,3x,i2,":",i2,":",i2,".",i3 )',$
;	 i, year, Month, Day, Hour,  Minute, Second, milli

;;time
;	Time_PB5(3)	yyyy doy seconds.microseconds

   cdf_varget,cdfid,'Time_PB5',pb5time, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Time_PB5 array call/',Result,'/', status

yrday=(pb5time(0,1)MOD 100)*1000+pb5time(1,1)
for j=0, max_records-1 do begin
 time(j)=pb5time(2,j)/3600000. ; time in decimal hours
endfor
;print,time
;print, 'From Time_PB5:', iarray_3
;print 'From PB5: ',yrday, time(i),' In decimal hours'

;>>>>>; third line of output icp # and enery mode 

;mode=intarr(1440)
; Mode_ID CDF_INT4
;
  cdf_varget,cdfid,'Mode_ID',mode, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Mode_ID call/',Result,'/', status


;erid=intarr(1440)
; Energy_Range_ID CDF_UINT1
  cdf_varget,cdfid,'Energy_Range_ID',erid, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Energy_Range_ID call/',Result,'/', status


;print Format='("ICP# ",i5," Energy code: ",i3, "       H+  (3)    O+(3)  He+ and He++ ")',$
;mode(i),erid(i)
;>>>>>> LINE of DENSITIES

; Density_H CDF_REAL4
   cdf_varget,cdfid,'Density_H',hden, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Density_H array call/',Result,'/', status

for k=0, max_records-1 do begin
   hydrogen(0:2,k)=hden(0:2,k)
   hydrogen(3,k)=hden(0,k)+hden(1,k)+hden(2,k)
endfor


;oden=fltarr(3)
; Density_O CDF_REAL4
   cdf_varget,cdfid,'Density_O',oden, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Density_O array call/',Result,'/', status

for k=0, max_records-1 do begin
   oxygen(0:2,k)=oden(0:2,k)
   oxygen(3,k)=oden(0,k)+oden(1,k)+oden(2,k)
endfor

; Density_He_1 CDF_REAL4
;he1den=fltarr(3)
  cdf_varget,cdfid,'Density_He_1',he1den, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Density_He_1 call/',Result,'/', status


; Density_He_2 CDF_REAL4
;he2den=fltarr(3)
  cdf_varget,cdfid,'Density_He_2',he2den, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Density_He_2 call/',Result,'/', status

;printFormat='("Density:    ",8f12.3  )',$
;	 hden,oden,he1den(i),he2den(i)

;>>>line of low velocities.......
; Vel_H_low CDF_REAL4
;hvlow=fltarr(3)
   cdf_varget,cdfid,'Vel_H_low',hvlow, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Vel_H_low array call/',Result,'/', status

print,'low range h and o velocities not plotted!'

; Vel_O_low CDF_REAL4
;ovlow=fltarr(3)
   cdf_varget,cdfid,'Vel_O_low',ovlow, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Vel_O_low array call/',Result,'/', status
;

;printFormat='("Vel Low:    ",6f12.3)',hvlow,ovlow

;>>>Line of full velocities:::::
; Velocity_H CDF_REAL4
;hvel=fltarr(3)
   cdf_varget,cdfid,'Velocity_H',hvel, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Velocity_H array call/',Result,'/',status

for k=0,max_records-1 do begin
  hvelocity(0,k)=hvel(0,k)		; par vel x component!
  hvelocity(1,k)=sqrt( hvel(0,k)^2+hvel(1,k)^2+hvel(2,k)^2 ) ; perp velocity
endfor

; Velocity_O CDF_REAL4
;ovel=fltarr(3)
   cdf_varget,cdfid,'Velocity_O',ovel, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Velocity_O  array call/',Result,'/', status

for k=0,max_records-1 do begin
 ovelocity(0,k)=ovel(0,k)			; par vel x component!
 ovelocity(1,k)=sqrt( ovel(0,k)^2+ovel(1,k)^2+ovel(2,k)^2 ) ; perp velocity
endfor

;print Format='("Vel High:   ",6f12.3)',hvel,ovel

;>>>>>line of low temperatures
zero=0.0    ; place holder in output array without a format!!!!

; Temp_H_Low CDF_REAL4
;htlow=fltarr(2)
   cdf_varget,cdfid,'Temp_H_Low',htlow, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Temp_H_Low array call/',Result,'/', status

print, 'low range h/o temperatures not plotted either'

; Temp_O_Low CDF_REAL4
;otlow=fltarr(2)
   cdf_varget,cdfid,'Temp_O_Low',otlow, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Temp_O_Low array call/',Result,'/', status

;print Format='("Temp Low:   ",2f12.3,12x,2f12.3)',htlow,otlow	

;>>>>>> line of full temperatures....

;htemp=fltarr(2)
; Temperature_H CDF_REAL4
   cdf_varget,cdfid,'Temperature_H',htemp, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Temperature_H array call/',Result,'/', status

for k=0, max_records-1 do begin
 htemperature(0,k)=htemp(1,k)		;the cdf is perp and par!!!
 htemperature(1,k)=htemp(0,k)
endfor	
;htemperature=fltarr(2,1440); par and perp

;otemp=fltarr(2)
; Temperature_O CDF_REAL4
   cdf_varget,cdfid,'Temperature_O',otemp, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Temperature_O array call/',Result,'/', status

for k=0, max_records-1 do begin
 otemperature(0,k)=otemp(1,k)		;the cdf is perp and par!!!
 otemperature(1,k)=otemp(0,k)
endfor	

;otemperature=fltarr(2,1440); par and perp

;print Format='("Temp High:  ",2f12.3,12x,2f12.3)',htemp,otemp 	

;>>>>>>>>>>>  line of qualities
;qh=fltarr(3)
; Quality_H CDF_REAL4
   cdf_varget,cdfid,'Quality_H',qh, rec_count=max_records,/zvariable
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Quality_H array call/',Result,'/', status

for k=0, max_records-1 do begin 
 quality(0,k)= (qh(0,k)+qh(1,k)+qh(2,k))/3.0	; why not?
endfor

;qo=fltarr(3)
; Quality_O CDF_REAL4
   cdf_varget,cdfid,'Quality_O',qo, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Quality_O array call/',Result,'/', status

for k=0, max_records-1 do begin 
 quality(1,k)= (qo(0,k)+qo(1,k)+qo(2,k))/3.0	; why not ?
endfor

;qhe1=fltarr(1440)
; Quality_HE_1 CDF_REAL4
  cdf_varget,cdfid,'Quality_HE_1',dum, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Quality_HE_1 call/',Result,'/', status
quality(2,i)=dum

;qhe2=fltarr(1440)
; Quality_HE_2 CDF_REAL4
  cdf_varget,cdfid,'Quality_HE_2',dum, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Quality_HE_2 call/',Result,'/', status
quality(3,i)=dum

;print Format='("Quality:    ",8f12.3)',qh,qo,quality(2,i),quality(3,i)

;>>>>>>>>>>>  timas b position line 
;timasb=fltarr(3)
; TIMAS_B CDF_REAL4
   cdf_varget,cdfid,'TIMAS_B',bb, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for TIMAS_B array call/',Result,'/', status


;BB=fltarr(3,1440)
;BB(0:2,i)=timasb(0:2)

;print Format='("Mag Field:  ",3f12.3)',timasb

;>>>>>>>>>>> line of geo and geomag positions.....
; Geographic_Position CDF_REAL4
;	Geographic_position
   cdf_varget,cdfid,'Geographic_Position',geo_pos,rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Geographic_Position array call/',Result,'/', status

;geo_pos=fltarr(3)		; geographic position
;altitude=fltarr(1440)		;
;lat=fltarr(1440)			;
;longitude=fltarr(1440)		;
for k=0,max_records-1 do begin
 altitude(k)=geo_pos(2,k)
 lat(k)=geo_pos(0,k)
 longitude(k)=geo_pos(1,k)
endfor

; Geomagnetic_Position CDF_REAL4
;	Geomagnetic_position
   cdf_varget,cdfid,'Geomagnetic_Position',mag_pos, rec_count=max_records,/zvariable
   Result=CDF_ERROR(status)
   if result ne 'CDF_OK: Function completed successfully.' then $
   print, 'Status after cdf_varget for Geomagnetic_Position array call/',Result,'/', status

;mag_pos=fltarr(3)		; geomagnetic position
;mlt=fltarr(1440)			;
;invl=fltarr(1440)		;
;mag_lat=fltarr(1440)		;
for k=0,max_records-1 do begin
 invl(k)=mag_pos(0,k)
 mlt(k)=mag_pos(1,k)
 mag_lat(k)=mag_pos(2,k)
endfor 

;print Format='("lat/long(deg) R/re invl mlt mag lat",/,6f12.3)',geo_pos,mag_pos



;>>>>>>>>>>>>>>start PLOTS   plots <<<<<<<<<<<<<<<<<<<<<<<<<<
; new first page 5 lines
!P.multi=[0,1,5,0,0]
; hdensity for three energy ranges

plot,time(0:max_records-1),hydrogen(0,0:max_records-1),linestyle=3, $
 title='Hydrogen density 3 energy ranges for '+string(yrday)+'      (erid = 1(full),2, or 3)', $
	charsize=2, $
	/ylog,yrange=[0.0001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='cm^-3'
oplot,time(0:max_records-1),hydrogen(1,0:max_records-1),linestyle=0
oplot,time(0:max_records-1),hydrogen(2,0:max_records-1),linestyle=1
oplot,time(0:max_records-1),(erid(0:max_records-1)+1),linestyle=2

; he++/h total ratio

ratio=fltarr(max_records)
for k=0, max_records-1 do begin
 ratio(k)=he2den(k)/hydrogen(3,k)
endfor
plot,time(0:max_records-1),ratio(0:max_records-1),linestyle=3, $
	title='He++/H+ ratio for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[0.0001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)

; o+/h+ ratio
for k=0, max_records-1 do begin
 ratio(k)=oxygen(3,k)/hydrogen(3,k)
endfor

plot,time(0:max_records-1),ratio(0:max_records-1),linestyle=3, $
	title='O+/H+ ratio for '+string(yrday), $ 
	charsize=2, $
	/ylog,yrange=[0.0001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)

; he+/h ratio

for k=0, max_records-1 do begin
 ratio(k)=he1den(k)/hydrogen(3,k)
endfor

plot,time(0:max_records-1),ratio(0:max_records-1),linestyle=3, $
	title='He+/H+ ratio for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[0.0001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)

; h average quality

plot,time(0:max_records-1),quality(0,0:max_records-1),linestyle=3, $
	title='H+ average quality for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[1.0 ,1000.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)

xyouts, 0.7, 0.01,file_name+systime(),size=0.5,/normal

dummy=''
if ps_or_x eq 'x' then begin
if gif_or_no eq 'y' then write_gif,cdfname+'_0.gif', tvrd()
  print , 'Hit Return to continue to next xplot'
  read, dummy
endif 

!P.multi=[0,1,4,0,0]
!P.PSYM=3		; dot's galore 0=lines, 1= +'s etc.

plot,time(0:max_records-1),hydrogen(0,0:max_records-1),linestyle=3, $
 title='Hydrogen density 3 energy ranges for '+string(yrday)+'      (erid = 1(full),2, or 3)', $
	charsize=2, $
	/ylog,yrange=[0.0001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='cm^-3'
oplot,time(0:max_records-1),hydrogen(1,0:max_records-1),linestyle=0
oplot,time(0:max_records-1),hydrogen(2,0:max_records-1),linestyle=1
oplot,time(0:max_records-1),(erid(0:max_records-1)+1),linestyle=2

plot,time(0:max_records-1),oxygen(0,0:max_records-1),linestyle=3, $
 title='Oxygen density 3 energy ranges for '+string(yrday)+'     (ICP#+1 solid line)', $
	charsize=2, $
	/ylog,yrange=[0.0001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='cm^-3'

oplot,time(0:max_records-1),oxygen(1,0:max_records-1),linestyle=0
oplot,time(0:max_records-1),oxygen(2,0:max_records-1),linestyle=1
oplot,time(0:max_records-1),(mode(0:max_records-1)+1)/100.,linestyle=2

plot,time(0:max_records-1),hydrogen(3,0:max_records-1),linestyle=3, $
	title='Sum H+ density for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[0.001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='cm^-3'


plot,time(0:max_records-1),oxygen(3,0:max_records-1),linestyle=3, $
	title='Sum O+ density for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[0.001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='cm^-3'

xyouts, 0.7, 0.01,file_name+systime(),size=0.5,/normal

dummy=''
if ps_or_x eq 'x' then begin
if gif_or_no eq 'y' then write_gif,cdfname+'_1.gif', tvrd()
  print , 'Hit Return to continue to next xplot'
  read, dummy
endif 

plot,time(0:max_records-1),he1den(0:max_records-1),linestyle=3, $
	title='Helium + density for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[0.001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='cm^-3'


plot,time(0:max_records-1),he2den(0:max_records-1),linestyle=3, $
	title='Helium ++ density for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[0.001,10.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='cm^-3'


plot,time(0:max_records-1),hvelocity(0,0:max_records-1),linestyle=3, $
	title='H+ Parallel velocity  for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[1.0 ,1000.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='km/s'


plot,time(0:max_records-1),hvelocity(1,0:max_records-1),linestyle=3, $
	title='H+ perpendicular velocity for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[1.0 ,1000.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='km/s'

xyouts, 0.7, 0.01,file_name+systime(),size=0.5,/normal


dummy=''
if ps_or_x eq 'x' then begin
if gif_or_no eq 'y' then write_gif,cdfname+'_2.gif', tvrd()
  print , 'Hit Return to continue to next xplot'
  read, dummy
endif 

plot,time(0:max_records-1),ovelocity(0,0:max_records-1),linestyle=3, $
	title='O+ parallel velocity  for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[1.0 ,1000.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='km/s'


plot,time(0:max_records-1),ovelocity(0,0:max_records-1),linestyle=3, $
	title='O+ perpendicular velocity for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[1.0 ,1000.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='km/s'



plot,time(0:max_records-1),otemperature(0,0:max_records-1),linestyle=3, $
	title='O+ parallel temperature for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[.01,100.], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='keV'



plot,time(0:max_records-1),otemperature(1,0:max_records-1),linestyle=3, $
	title='O+ perpendicular temperature for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[.01,100.], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='keV'

xyouts, 0.7, 0.01,file_name+systime(),size=0.5,/normal


dummy=''
if ps_or_x eq 'x' then begin
if gif_or_no eq 'y' then write_gif,cdfname+'_3.gif', tvrd()
  print , 'Hit Return to continue to next xplot'
  read, dummy
endif 

plot,time(0:max_records-1),htemperature(0,0:max_records-1),linestyle=3, $
	title='H+ parallel temperature for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[.01,100.], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='keV'

plot,time(0:max_records-1),htemperature(1,0:max_records-1),linestyle=3, $
	title='H+ perpendicular temperature for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[.01,100.], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday), $
	ytitle='keV'

plot,time(0:max_records-1),quality(0,0:max_records-1),linestyle=3, $
	title='H+ average quality for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[1.0 ,1000.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)

plot,time(0:max_records-1),quality(1,0:max_records-1),linestyle=3, $
	title='O+ average quality for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[1.0 ,1000.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)

xyouts, 0.7, 0.01,file_name+systime(),size=0.5,/normal


dummy=''
if ps_or_x eq 'x' then begin
if gif_or_no eq 'y' then write_gif,cdfname+'_4.gif', tvrd()
  print , 'Hit Return to continue to next xplot'
  read, dummy
endif 

plot,time(0:max_records-1),quality(2,0:max_records-1),linestyle=3, $
	title='He+ quality for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[1.0 ,1000.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)

plot,time(0:max_records-1),quality(3,0:max_records-1),linestyle=3, $
	title='He++ quality for '+string(yrday), $
	charsize=2, $
	/ylog,yrange=[1.0 ,1000.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)

;BB=fltarr(3,1440)
;BB(0:2,i)=timasb(0:2)
plot,time(0:max_records-1),BB(0,0:max_records-1), linestyle=0, $
	title='X(solid), Y(dotted) and Z(dashed) component of magnetic field used for timas kps', $
	charsize=2, $
	yrange=[-10000,+10000], $
	xrange=[0,24],xstyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)
oplot,time(0:max_records-1),BB(1,0:max_records-1), linestyle=1
oplot,time(0:max_records-1),BB(2,0:max_records-1), linestyle=2

plot,time(0:max_records-1),BB(0,0:max_records-1), linestyle=0, $
	title='X(solid), Y(dotted) and Z(dashed) component of magnetic field used for timas kps', $
	charsize=2, $
	yrange=[-200,+200], $
	xrange=[0,24],xstyle=1, $
	xtitle='Decimal Hours of Day'+string(yrday)
oplot,time(0:max_records-1),BB(1,0:max_records-1), linestyle=1
oplot,time(0:max_records-1),BB(2,0:max_records-1), linestyle=2

xyouts, 0.7, 0.01,file_name+systime(),size=0.5,/normal


dummy=''
if ps_or_x eq 'x' then begin
if gif_or_no eq 'y' then write_gif,cdfname+'_5.gif', tvrd()
  print , 'Hit Return to continue to next xplot'
  read, dummy
endif 

!P.multi=[0,1,4,0,0] ; last three plots on separage sheet

plot,time(0:max_records-1),altitude(0:max_records-1),linestyle=3, $
	title='Alitude R/Re for  '+string(yrday), $
	yrange=[1.0,10.0], $
	charsize=2, $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day' 

plot,time(0:max_records-1),invl(0:max_records-1),linestyle=3, $
	title='Invariant Latitude in degrees for  '+string(yrday), $
	charsize=2, $
	yrange=[40.0,90.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day' 

plot,time(0:max_records-1),mlt(0:max_records-1),linestyle=3, $
	title='Magnetic Local Time (decimal hours) for  '+string(yrday), $
	charsize=2, $
	yrange=[0.0,25.0], $
	xrange=[0,24],xstyle=1,ystyle=1, $
	xtitle='Decimal Hours of Day' 
xyouts, 0.7, 0.02,file_name+systime(),size=0.7,/normal
if gif_or_no eq 'y' then write_gif,cdfname+'_6.gif', tvrd()


if ps_or_x eq 'ps' then begin
	device,/close_file
	set_plot,'x'		; reset the retain
	device,retain=1
	loadct,0		; back to b/w sdt display
	print, 'ENTER '
	print, '          $lp -d lps17 ',cdfname+'.ps  '
	print, 'TO PRINT on the internal Lockheed Martin network'
endif else begin
	print, 'loadct,13 for a colorful display'
	print, 'loadct,0 for normal display'
	print, 'wb_tbl, or bw_tbl are also possible'
	device,retain=1	; reset the retain
endelse

!P.Multi=[0,0,0,1,0]
!P.PSYM=0

end
;