; IDL program to ingest MASS and DIMM data into an IDL data structure ; The night-by-night data are "exported" by ; expdimm.awk and expmass.awk, respectively ; List of nights "2004_mm_dd" is in the LISTMD file ; Also saves data structure into an IDL save file. ; Nov 29, 2004 ; date = '2004_11_27' ;--------------------------------------------------------- function readmassdimm, date, prof ; ; Reads MASS and DIMM file into a structure ; prof = { UTyear: 0, UTmonth: 0, UTday: 0, UTmass:0.0, $ ; fsee:0.0, Intcn2:FLTARR(6), UTdimm:0.0, see:0.0 ) close, /all openr, 1, date+'.T3mass' openr, 2, date+'.T3dimm' ; No more than 1000 profiles per night! out = REPLICATE(prof, 1000) nprof = -1 aline = '' utdimm = -99 ; --- loop over the mass file while not eof(1) do begin READF, 1, aline tmp = strsplit(aline, count=nitems, /extract) nprof = nprof+1 prof.UTyear = fix(strmid(tmp[0],0,4)) prof.UTmonth = fix(strmid(tmp[0],5,2)) prof.UTday = fix(strmid(tmp[0],8,2)) UTmass = float(tmp[1]) prof.UTmass = UTmass prof.fsee = float(tmp[2]) for j=0,5 do begin prof.intcn2[j] = float(tmp[3+j]) endfor while ( (UTmass - UTdimm gt 1/60.) and (not eof(2) ) ) do begin READF, 2, aline tmp = strsplit(aline, count=nitems, /extract) UTdimm = float(tmp[1]) endwhile if (abs(UTmass - UTdimm) lt 0.1) then begin prof.UTdimm = UTdimm prof.see = float(tmp[2]) endif else begin prof.UTdimm = 0 prof.see = 0 endelse out[nprof] = prof endwhile close, 1 close, 2 out[nprof] = prof nprof = nprof+1 print, 'Total profiles found: ', nprof out = out[0:nprof-1] return, out END ;--------------------------------------------------------- pro readall, list ; reads data from a list of dates and saves in a structure prof = { UTyear: 0, UTmonth: 0, UTday: 0, UTmass:0.0, $ fsee:0.0, Intcn2:FLTARR(6), UTdimm:0.0, see:0.0 } openr, 11, list files = strarr(100) PRINT, '% Counting the number of files ' aline = '' n = 0 while (not eof(11)) do begin READF, 11, aline files[n] = aline n = n+1 endwhile close, 11 print, 'Number of files found: ',n cnt = intarr(n) nprof=0 if (nprof eq 0) then begin FOR i=0,n-1 DO BEGIN PRINT, 'Counting profiles from '+files[i] tmp = readmassdimm(files[i],prof) k = n_elements(tmp) cnt[i]=k nprof = nprof+k print, k, ' profiles found' ; stop ENDFOR endif mddat = REPLICATE(prof, nprof) k = 0 FOR i=0,n-1 DO BEGIN PRINT, '%Reading profiles from '+files[i] mddat(k:k+cnt[i]-1) = readmassdimm(files[i],prof) k = k+ cnt[i] ENDFOR save, filename='massdimm.idl', mddat end