pro get_wav_lt,trange,index=index,name=name ;+ ;NAME: get_wav_lt ;PURPOSE: get 1/2 hour averages of WAVES data ; ;CALLING SEQUENCE: get_wav_lt ;INPUTS: trange: dblarr(2), start and stop time in seconds from ; 1970-01-01 ;KEYWORD PARAMETERS: index: lonarr(2), indices of first and last time sample ; an index of 0 refers to the first file record ;OUTPUTS: stores 'wi_wav_lt' and 'wi_wav_Ne_lt' ;LAST MODIFICATION: @(#)get_wav_lt.pro 1.1 96/08/12 ;CREATED BY: Frank V. Marcoline, from Davin's get_*_lt procedures. ;FUTURE MODS NEEDED: Check input index for proper range. Optimize search ; through file. ; (Something like point_lun,lun,index(0)*rec_len) ;- on_ioerror,error dir = '/disks/aeolus/home/wind/scratch/long_term/' openr,fp,dir+'wav_accums',/get_lun dat = {time:0.d, dens:0b, data:fltarr(76)} filedata = assoc(fp,dat) if not keyword_set(index) then begin file_status = fstat(fp) rec_len = 313 ;8*1 + 1*1 + 4*76 (double, byte, fltarr(76) ;help,dat,file_status,/st ;stop num_records = file_status.size / rec_len index = [0l,num_records -1] print,' Records:',index endif np =index(1)-index(0)+1 dens_scale = 0.0866433 dens_offset = 0.281246 time = dblarr(np) dens = fltarr(np) data = fltarr(np,76) v = [ 268.000, 308.000, 354.000, 406.000, 467.000, 536.000, 616.000, 707.000, $ 812.000, 933.000, 1072.00, 1231.00, 1414.00, 1625.00, 1866.00, 2144.00, $ 2462.00, 2828.00, 3249.00, 4287.00, 4925.00, 5657.00, 6498.00, 7464.00, $ 8574.00, 9849.00, 11314.0, 12996.0, 14929.0, 17148.0, 19698.0, 22627.0, $ 25992.0, 29857.0, 34297.0, 39397.0, 45255.0, 51984.0, 59714.0, 68594.0, $ 78793.0, 90510.0, 103968., 119428., 137187., 157587., 181019., 207937., $ 238857., 274374., 315173., 362039., 415873., 477713., 548748., 630346., $ 724078., 831747., 955426., 1.097497e+06, 1.260693e+06, 1.448155e+06, $ 1.663493e+06, 1.910852e+06, 2.194993e+06, 2.521385e+06, 2.896311e+06, $ 3.326988e+06, 3.821705e+06, 4.389986e+06, 5.042771e+06, 5.792623e+06, $ 6.653975e+06, 7.643409e+06, 8.779973e+06, 1.0085542e+07 ] n = 0l for i=0l,np-1 do begin ;foo = filedata(i+index(0)) readu,fp,dat if dat.time > 7.5738240e+08 then begin time(n) = dat.time ;if density gt 1050/cc, ... ;somewhat arbitrary cutoff if dat.dens gt 80 then dens(n) = !values.f_nan $ else dens(n) = exp((dat.dens+dens_offset)*dens_scale) data(n,*) = dat.data n=n+1 endif endfor error: time = time(0:n-1) dens = dens(0:n-1) data = data(0:n-1,*) if data_type(name) ne 7 then name = 'wi_wav' if data_type(trange) EQ 5 THEN BEGIN IF n_elements(trange) EQ 2 THEN BEGIN a = where((time GE trange(0)) AND (time LE trange(1)),ac) IF ac GT 0 THEN BEGIN time = time(a) dens = dens(a) data = data(a,*) ENDIF ELSE BEGIN print,'No data in specified time range: ',time_to_str(trange(0)),$ ' to ',time_to_str(trange(1)) return ENDELSE ENDIF ELSE $ print,'trange must be a two element double array of seconds from 1970-01-01' ENDIF dat = {x:time, y:dens} store_data,name+'_Ne_lt',data=dat dat = {ytitle:name+'_lt', x:time, y:data, v:v, spec:1, ylog:1, panel_size:2.0} store_data,name+'_lt', data=dat free_lun,fp end