function ace_swepam_stea_filenames,tr if n_elements(tr) ne 2 then get_timespan,tr pathname = '/home/davin/dat/ac/swepam/stea/????/swepam-stea-????-???.v1-02.hdf fnames = findfile(pathname) pos = strpos(/reverse_search,fnames,'/') fn2 = strmid(fnames,transpose(pos+1)) t = replicate(time_struct(0.),n_elements(fnames)) t.year = fix(strmid(fn2,12,4)) t.date = fix(strmid(fn2,17,3)) t=time_double(t) s = sort(t) fnames = fnames[s] t = t[s] i = where(t+86400. ge tr[0] and t lt tr[1],c) if c eq 0 then return,'' fn = fnames[i] return,fn end pro load_ace_stea,trange=trange,data=data,vdnames=vdnames fns = ace_swepam_stea_filenames(trange) if not keyword_set(fns) then begin print,'No ACE SWEPAM STEA files during the time range: ',time_string(trange) return endif vdataname = 'swepam_e_stea' sdname = 'swepam_e_stea_dist_fun_by_pitchang' nfiles = n_elements(fns) vdnames=['year','yday','mon','mday','hour','min','sec'] for i=0,nfiles-1 do begin fn = fns[i] hdf_fp = hdf_open(fn,/read) if (hdf_fp eq -1) then begin print, 'HDF_OPEN: could not open file ', fn return endif else print,'Loading ',fn vdata_ref = hdf_vd_find(hdf_fp,vdataname) if (vdata_ref eq 0) then begin print, 'HDF_VD_FIND: could not find Vdata ', vdataname return endif vdata_id = hdf_vd_attach(hdf_fp, vdata_ref, /read) if (vdata_id eq 0) then begin print, 'HDF_VD_ATTACH: could not attach Vdata ', vdataname return endif hdf_vd_get,vdata_id,class=class,count=count,fields=fields,$ interlace=interlace,name=name,nfields=nfields,ref=ref,$ size=size,tag=tag if count eq 0 then begin print, 'No records found in file ',filename[fileindex] return endif if n_elements(vdnames) eq 0 then begin vdnames = strsplit(fields,',',/extract) endif nvdnames = n_elements(vdnames) if i eq 0 then begin ptr = ptrarr(nvdnames) endif for j=0,nvdnames-1 do begin n = hdf_vd_read(vdata_id,x,field= vdnames[j]) if n ne count then print,'Incorrect count for ',vdnames[j] ndim = size(/n_dimen,x) if ndim ge 2 then x = transpose(x,shift(indgen(ndim),1)) if ptr_valid(ptr[j]) then *ptr[j] = [*ptr[j],x] $ else ptr[j] = ptr_new(x,/no_copy) endfor hdf_close,hdf_fp sd_id = hdf_sd_start(fn, /read) sds_index = hdf_sd_nametoindex(sd_id,sdname) sds_id = hdf_sd_select(sd_id, sds_index) hdf_sd_getdata, sds_id, dfpa ndim = size(/n_dimen,dfpa) if ndim ge 2 then dfpa = transpose(dfpa,shift(indgen(ndim),1)) hdf_sd_endaccess, sds_id hdf_sd_end, sd_id if keyword_set(alldfpa) then alldfpa = [alldfpa,dfpa] $ else alldfpa=dfpa endfor t = replicate(time_struct(0.),n_elements(*ptr[0])) t.year = *ptr[(array_union('year',vdnames))[0]] t.month = *ptr[(array_union('mon',vdnames))[0]] t.date = *ptr[(array_union('mday',vdnames))[0]] t.hour = *ptr[(array_union('hour',vdnames))[0]] t.min = *ptr[(array_union('min',vdnames))[0]] t.sec = *ptr[(array_union('sec',vdnames))[0]] t = time_double(t) pa = findgen(20)*9+4.5 energy = [73.328571,102.00000, $ 142.14286,196.57143,272.00000,372.71429, $ 519.00000,712.57143,987.14286,1370.0000] mass = 511000./(299792.^2) df2flux = energy*2/mass^2*1e5*1e15 w = where(dfpa eq 0,c) if c ne 0 then dfpa[w]=!values.f_nan ename = 'acst_'+strtrim(round(energy),2)+'eV' dlim = {spec:1,yrange:[0,180],ystyle:1,panel_size:.75} for e = 0,10-1 do $ store_data,ename[e],data={x:t,y:alldfpa[*,*,e]*df2flux[e],v:pa},dlim=dlim ylims = [$ 9.25620e-28, 2.67096e-28, 8.18296e-29, 2.43987e-29, 6.82405e-30, $ 1.73582e-30, 3.52716e-31 , 6.53483e-32 , 1.11163e-32 , 2.41798e-33] ylims = ylims*df2flux ylims = [420000., 170000., 72000., 30000., 11000., 4000., 1100., 300., 70., 20.] for e=0,10-1 do zlim,ename[e],ylims[e]/5,ylims[e]*5,1 data = alldfpa ptr_free,ptr end