PRO SWEA212_TO_CDF, SCIDATA, DATESTRING, SCID ;+ ; Project : STEREO - IMPACT/SWEA ; ; Name : SWEA212_TO_CDF ; ; Purpose : Write SWEA 212 data to CDF ; ; Category : STEREO, IMPACT, SWEA ; ; Explanation : ; ; Syntax : SWEA212_TO_CDF, SCIDATA, DATESTRING, SCID ; ; Examples : ; ; Inputs : SCIDATA - a structure including SWEA 212 science data ; DATESTRING - the date string for the filename ; SCID - the spacecraft ID ; ; Opt. Inputs : None. ; ; Outputs : None. ; ; Opt. Outputs: None. ; ; Keywords : None ; ; Calls : None ; ; Common : None ; ; Restrictions: ; ; Side effects: None. ; ; Prev. Hist. : None. ; ; History : Version 1 (preliminary), 05-Mar-2006, Peter Schroeder, ; UC-Berkeley. ; ; Contact : peters@ssl.berkeley.edu ;- ; if (SCID eq 'EA'XU) then begin SOURCE_FILE = 'swea212a.cdf' SCSTRING = 'STA' endif else begin SOURCE_FILE = 'swea212b.cdf' SCSTRING = 'STB' endelse filename = SCSTRING+'_L1_SWEA_PAD_'+DATESTRING+'_V01.cdf' SOURCE_FILE = concat_dir('$SWEA_CALIB_DATA', SOURCE_FILE) filematch = file_search(filename, count = filecount) if filecount eq 0 then begin file_copy, SOURCE_FILE, filename cdfid = cdf_open(filename) cdf_varput, cdfid, 'Energy', SCIDATA.ENERGY endif else cdfid = cdf_open(filename) if filecount eq 0 then recstart = 0 else begin quiet=!quiet & !quiet=1 cdf_control, cdfid, get_var_info=info, variable='Epoch' !quiet=quiet recstart = info.maxrec+1 endelse utc = anytim2utc(SCIDATA.PAD1.TIME,/external) cdf_epoch, pktepoch, utc.year, utc.month, utc.day, utc.hour, utc.minute, $ utc.second, utc.millisecond,/compute_epoch cdf_varput, cdfid, 'Epoch', pktepoch, rec_start = recstart cdf_varput, cdfid, 'MagAz', SCIDATA.PAD1.MAGAZ, rec_start = recstart cdf_varput, cdfid, 'MagEl', SCIDATA.PAD1.MAGEL, rec_start = recstart cdf_varput, cdfid, 'PAD', transpose(SCIDATA.PAD1.PAD), rec_start = recstart utc = anytim2utc(SCIDATA.PAD2.TIME,/external) cdf_epoch, pktepoch, utc.year, utc.month, utc.day, utc.hour, utc.minute, $ utc.second, utc.millisecond,/compute_epoch cdf_varput, cdfid, 'Epoch', pktepoch, rec_start = recstart+1 cdf_varput, cdfid, 'MagAz', SCIDATA.PAD2.MAGAZ, rec_start = recstart+1 cdf_varput, cdfid, 'MagEl', SCIDATA.PAD2.MAGEL, rec_start = recstart+1 cdf_varput, cdfid, 'PAD', transpose(SCIDATA.PAD2.PAD), rec_start = recstart+1 utc = anytim2utc(SCIDATA.PAD2.TIME,/external) cdf_epoch, pktepoch, utc.year, utc.month, utc.day, utc.hour, utc.minute, $ utc.second, utc.millisecond,/compute_epoch cdf_varput, cdfid, 'Epoch', pktepoch, rec_start = recstart+2 cdf_varput, cdfid, 'MagAz', SCIDATA.PAD2.MAGAZ, rec_start = recstart+2 cdf_varput, cdfid, 'MagEl', SCIDATA.PAD2.MAGEL, rec_start = recstart+2 cdf_varput, cdfid, 'PAD', transpose(SCIDATA.PAD2.PAD), rec_start = recstart+2 cdf_close, cdfid return end