pro readodyaccprofiles ; Paul Withers, 2006.08.29 ; Center for Space Physics, Boston University ; Read in the ODY profiles of data products ; Stuff into a common block common plum, all_ody_profiles spawn, 'date', startdate outputdir = 'output/' spawn, 'ls -1 ' + outputdir + '*prof*dat', filearr nfiles = n_elements(filearr) nperidetails = 11 orbperiarray = dblarr(nfiles,nperidetails) ; orb, r, z, lat, lon, lst, sza, ls, mass, nlines, ncols orbscetarray = strarr(nfiles) maxlines = 1700 ; found manually ; plot, all_ody_profiles(*).profdata(0,1650) maxcols = 61 ; found manually ; up to 61?59?47 blank_prof = {ody_prof, periscet:'', peridetails:dblarr(nperidetails), $ profscet:strarr(maxlines), profdata:dblarr(maxcols-1,maxlines)} all_ody_profiles = replicate({ody_prof}, nfiles) j=0 while j lt nfiles do begin print, filearr(j) ;scetarr = strarr(maxlines) ;tfromperiarray = dblarr(maxlines) ;rarray = tfromperiarray ;zarray = tfromperiarray ;latarray = tfromperiarray ;lonarray = tfromperiarray ;lstarray = tfromperiarray ;szaarray = tfromperiarray ;lsarray = tfromperiarray ;vrelxarray = tfromperiarray ;vrelyarray = tfromperiarray ;vrelzarray = tfromperiarray ;vrelmagarray = tfromperiarray ;wxarray = tfromperiarray ;wyarray = tfromperiarray ;wzarray = tfromperiarray ;dwxdtarray = tfromperiarray ;dwydtarray = tfromperiarray ;dwzdtarray = tfromperiarray ;a1xarray = tfromperiarray ;a1yarray = tfromperiarray ;a1zarray = tfromperiarray ;a2xarray = tfromperiarray ;a2yarray = tfromperiarray ;a2zarray = tfromperiarray ;alphadeg = tfromperiarray ;ax = tfromperiarray ;ay = tfromperiarray ;az = tfromperiarray ;ay1 = tfromperiarray ;say1 = tfromperiarray ;ay7 = tfromperiarray ;say7 = tfromperiarray ;ay39 = tfromperiarray ;say39 = tfromperiarray ;cyarray1 = tfromperiarray ;sigmacyarray1 = tfromperiarray ;cyarray7 = tfromperiarray ;sigmacyarray7 = tfromperiarray ;cyarray39 = tfromperiarray ;sigmacyarray39 = tfromperiarray ;rhoarray1 = tfromperiarray ;sigmarhoarray1 = tfromperiarray ;rhoarray7 = tfromperiarray ;sigmarhoarray7 = tfromperiarray ;rhoarray39 = tfromperiarray ;sigmarhoarray39 = tfromperiarray line1='' line2='' line3='' line4='' openr, lun1, filearr(j), /get_lun readf, lun1, line1 readf, lun1, line2 readf, lun1, line3 readf, lun1, line4 free_lun, lun1 junk = str_sep(line2, ' ') nheader = double(junk(0)) junk = str_sep(line3, ' ') nlines = double(junk(0)) junk = str_sep(line4, ' ') ncols = double(junk(0)) scetarray = strarr(nlines) dataarray = dblarr(ncols-1,nlines) orbperiarray(j,9) = nlines orbperiarray(j,10) = ncols openr, lun1, filearr(j), /get_lun junk='' i=0 while i lt 5 do begin readf, lun1, junk i=i+1 endwhile readf, lun1, junk junk1 = strmid(junk, 81, 80) orbperiarray(j,0) = double(junk1) readf, lun1, junk junk1 = strmid(junk, 81, 80) orbscetarray(j) = strcompress(junk1, /remove_all) k=1 while k lt 9 do begin readf, lun1, junk junk1 = strmid(junk, 81, 80) orbperiarray(j,k) = double(junk1) k=k+1 endwhile free_lun, lun1 openr, lun1, filearr(j), /get_lun junk='' i=0 while i lt nheader do begin readf, lun1, junk i=i+1 endwhile i=0 while i lt nlines do begin readf, lun1, junk junk1 = str_sep(junk, ',') scetarray(i) = strcompress(junk1(0), /remove_all) dataarray(*,i) = double(junk1(1:*)) ; can't have the string time in dblarr i=i+1 endwhile free_lun, lun1 this_ody_prof = blank_prof this_ody_prof.periscet = orbscetarray(j) this_ody_prof.peridetails = orbperiarray(j,*) this_ody_prof.profscet(0:n_elements(scetarray)-1) = scetarray(*) this_ody_prof.profdata(*,0:n_elements(scetarray)-1) = dataarray(*,*) all_ody_profiles(j) = this_ody_prof ; sct mass doesn't get read in, nothing breaks ; 2007.08.16 ; fixing so that mass does get read in j=j+1 endwhile save, all_ody_profiles, filename = outputdir + 'all_ody_profiles.sav' save, all_ody_profiles, filename = 'toplevelpdsdir/EXTRAS/IDLSAV/' + 'all_ody_profiles.sav' print, startdate spawn, 'date' ; when did this slow code end? stop end