; pro ccope_reader_acp, dat_path_filename, jd, UHSAS_count, UHSAS_accps, UHSAS_acc_sec, CPC_N ; ;..pindex is for the combined UHSAS/CPC data created by Matt Burkhart's Labview data acquisition program running on the CCOPE laptop ;..UHSAS Initialization: UHSAS Tab=Map setup is "Log" and 99 channels, 55 to 1000 nm diameter ; pindex = 20L ; ;..read the labview data file with UHSAS and CPC data ; ntot = FILE_LINES(dat_path_filename) lu1 = 1 openr, lu1, dat_path_filename input_string_1 = strarr(ntot) readf, lu1, input_string_1 close, lu1 ; bad_record_0 = 0L j = 0L input_string_2 = strarr(n_elements(input_string_1)) for i = 0L, ntot - 1L do begin result = strsplit(input_string_1[i],',',/extract) if n_elements(result) eq 119 then begin input_string_2[j] = input_string_1[i] j = j + 1L endif else begin bad_record_0 = bad_record_0 + 1L endelse endfor ; index = where(input_string_2 ne '', index_count) if index_count eq 0 then stop input_string = input_string_2[index] print, ntot, index_count ; ;..parse the uhsas data ; bad_record_1 = 0L nl = n_elements(input_string) jd = dblarr(nl) hhmmss = 0L ; long cpc_N_index = 3 cpc_N = findgen(nl) uhsas_acc_sec = fltarr(nl) uhsas_count = fltarr(nl, !nchan) findex = 10 Tindex = 15 kPaindex = 17 sccm = fltarr(nl) TK = fltarr(nl) kPa = fltarr(nl) scat_volt_index = 8 current_volt_index = 9 reference_volt_index = 11 sheath_sccm_index = 13 scat_volt = findgen(nl) current_volt = findgen(nl) reference_volt = findgen(nl) sheath_sccm = findgen(nl) acc_sec_index = 7 for i = 0L, nl - 1L do begin result = strsplit(input_string[i],',',/extract) yyyy = long((strsplit(result[1],'/',/extract))[0]) mo = long((strsplit(result[1],'/',/extract))[1]) dy = long((strsplit(result[1],'/',/extract))[2]) ; hr = long((strsplit(result[2],':',/extract))[0]) mn = long((strsplit(result[2],':',/extract))[1]) sc = long((strsplit(result[2],':',/extract))[2]) ; truncating fractional second hhmmss = hr*10000L + mn*100L + sc ; jd[i] = julday(mo,dy,yyyy,hr,mn,sc) ; cpc_N[i] = result[cpc_N_index] * 1000. if cpc_N[i] gt !cpc_upper_limit then jd[i] = !VALUES.D_NAN uhsas_acc_sec[i] = result[acc_sec_index] uhsas_count[i,*] = result[pindex:*] sccm[i] = result[findex] TK[i] = result[Tindex] kPa[i] = result[kPaindex] scat_volt[i] = result[scat_volt_index] current_volt[i] = result[current_volt_index] reference_volt[i] = result[reference_volt_index] sheath_sccm[i] = result[sheath_sccm_index] ; if hhmmss eq 235959 then begin ; print, 'HERE in ccope_processor_1:' caldat, jd[i], mo1, dy1, yr1, hr1, mn1, sc1 ; print, mo1, dy1, yr1, hr1, mn1, sc1 jd[i] = !VALUES.D_NAN bad_record_1 = bad_record_1 + 1L endif ; endfor ; index = where(finite(jd), index_count) if index_count gt 0 then begin cpc_N = cpc_N[index] jd = jd[index] uhsas_acc_sec = uhsas_acc_sec[index] uhsas_count = uhsas_count[index,*] sccm = sccm[index] TK = TK[index] kPa = kPa[index] scat_volt = scat_volt[index] current_volt = current_volt[index] reference_volt = reference_volt[index] sheath_sccm = sheath_sccm[index] endif else begin stop endelse ; sccps = sccm * !minute_by_second uhsas_accps = sccps * (TK / kPa) / (!TK_o / !p_kPa_o) sheath_sccps = sheath_sccm * !minute_by_second ; end