;+ ;PROCEDURE: get_sum ;PURPOSE: to read in summary data stored in cdf format. ;INPUTS: none, but will prompt for type of data desired if all keyword ; is not set. ;KEYWORDS: ; all: load all the data ; ;SEE ALSO: "store_sum", the procedure that creates ; the files this procedure reads. ; ;CREATED BY: Jasper Halekas ;LAST MODIFICATION: @(#)get_sum.pro 1.5 95/10/06 ; ;- pro get_sum, all = all @wind_com.pro init_wind_lib fname = data_directory + 'wi_l1_sum_files' get_file_names, filenames, TIME_RANGE=range, MASTERFILE=fname ndays = n_elements(filenames) specs = ['ehspec', 'elspec', 'phspec', 'sospec', 'sfspec'] snum = dimen1(specs) swanted = replicate(1, snum) moms = ['e', 'p'] momnum = dimen1(moms) mwanted = replicate(1, momnum) ans = ' ' if not keyword_set(all) then begin for i = 0, snum -1 do begin prompt = 'Do you want '+specs(i)+' data? (y/n) >' read, ans, prompt = prompt if ans ne 'y' and ans ne 'Y' then swanted(i) = 0 endfor for i = 0, momnum - 1 do begin prompt = 'Do you want '+moms(i)+'mom data? (y/n) >' read, ans, prompt = prompt if ans ne 'y' and ans ne 'Y' then mwanted(i) = 0 endfor endif swanted = where(swanted) mwanted = where(mwanted) if dimen1(swanted) eq 1 and swanted(0) eq -1 then snum = 0 else begin specs = specs(swanted) snum = dimen1(specs) endelse if dimen1(mwanted) eq 1 and mwanted(0) eq -1 then momnum = 0 else begin moms = moms(mwanted) momnum = dimen1(moms) endelse if ndays eq 0 then begin print,"No summary data available from ",time_to_str(range(0)), ' to ', $ time_to_str(range(1)) return endif for var = 0, snum - 1 do begin print, 'Extracting data for ',specs(var) for d=0, ndays-1 do begin file = cdf_open(filenames(d)) loadcdf,filenames(d),specs(var),y,/zvar loadcdf,filenames(d),specs(var)+'_esteps', v, /zvar loadcdf,filenames(d),specs(var)+'_time', x, /zvar cdf_attget,file,'Valid_Max',specs(var),max,/zvariable cdf_close,file v = transpose(v) y = transpose(y) if d eq 0 then begin x_tot = x y_tot = y v_tot = v endif else begin x_tot = [x_tot,x] y_tot = [y_tot,y] v_tot = [v_tot,v] endelse endfor if dimen1(v_tot) eq ndays then v_tot = v_tot(0,*) store_data,data={ytitle:specs(var),x:x_tot,y:y_tot,v:v_tot, $ ytype:1, max_value:max} endfor for var = 0, momnum - 1 do begin print, 'Extracting data for ', moms(var),'mom' for d=0, ndays -1 do begin loadcdf,filenames(d),'N'+moms(var),N,/zvar loadcdf,filenames(d),'V'+moms(var),V,/zvar loadcdf,filenames(d),'T'+moms(var),T,/zvar loadcdf,filenames(d),moms(var)+'mom_time',x,/zvar file = cdf_open(filenames(d)) cdf_attget,file,'Valid_Max','N'+moms(var),maxn,/zvariable cdf_attget,file,'Valid_Max','V'+moms(var),maxv,/zvariable cdf_attget,file,'Valid_Max','T'+moms(var),maxt,/zvariable cdf_close,file V = transpose(V) if d eq 0 then begin N_tot = N V_tot = V T_tot = T x_tot = x endif else begin N_tot = [N_tot, N] V_tot = [V_tot, V] T_tot = [T_tot, T] x_tot = [x_tot, x] endelse endfor max = 1e20 store_data, data={ytitle:'N'+moms(var), x:x_tot, y:N_tot,max_value:maxn} store_data, data={ytitle:'V'+moms(var), x:x_tot, y:V_tot,max_value:maxv} store_data, data={ytitle:'T'+moms(var), x:x_tot, y:T_tot,max_value:maxt} endfor return end