PRO SWEA215_TO_CDF, SCIDATA, DATESTRING, SCID ;+ ; Project : STEREO - IMPACT/SWEA ; ; Name : SWEA215_TO_CDF ; ; Purpose : Write SWEA 215 data to CDF ; ; Category : STEREO, IMPACT, SWEA ; ; Explanation : ; ; Syntax : SWEA215_TO_CDF, SCIDATA, DATESTRING, SCID ; ; Examples : ; ; Inputs : SCIDATA - a structure including SWEA 213 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 = 'swea215a.cdf' SCSTRING = 'STA' endif else begin SOURCE_FILE = 'swea215b.cdf' SCSTRING = 'STB' endelse filename = SCSTRING+'_L1_SWEA_SPEC_'+DATESTRING+'_V01.cdf' SOURCE_FILE = concat_dir('$SWEA_CALIB_DATA', SOURCE_FILE) filematch = file_search(filename, count = filecount) if filecount eq 0 then file_copy, SOURCE_FILE, filename 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 utcpkttim = SCIDATA.TIME utcsec = utc2sec(utcpkttim) utc = anytim2utc(utcpkttim,/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, 'SWEAMCPDACSet', SCIDATA.SWEAMode.SWEAMCPDACSET, rec_start = recstart cdf_varput, cdfid, 'SWEAMCPHeater', SCIDATA.SWEAMode.SWEAMCPHEATER, rec_start = recstart cdf_varput, cdfid, 'SWEADistInterval', SCIDATA.SWEAMode.SWEADistInterval, rec_start = recstart cdf_varput, cdfid, 'SWEABurstInterval', SCIDATA.SWEAMode.SWEABurstInterval, rec_start = recstart cdf_varput, cdfid, 'SWEAPADInterval', SCIDATA.SWEAMode.SWEAPADInterval, rec_start = recstart cdf_varput, cdfid, 'SWEARot', SCIDATA.SWEAMode.SWEARot, rec_start = recstart cdf_varput, cdfid, 'SWEAModeID', SCIDATA.SWEAMode.SWEAModeID, rec_start = recstart cdf_varput, cdfid, 'SWEAManualV0', SCIDATA.SWEAMode.SWEAManualV0, rec_start = recstart cdf_varput, cdfid, 'SWEASweepMax', SCIDATA.SWEAMode.SWEASweepMax, rec_start = recstart cdf_varput, cdfid, 'SWEASweepRate', SCIDATA.SWEAMode.SWEASweepRate, rec_start = recstart cdf_varput, cdfid, 'SWEASweepOffset', SCIDATA.SWEAMode.SWEASweepOffset, rec_start = recstart cdf_varput, cdfid, 'SWEASweepDeflStep', SCIDATA.SWEAMode.SWEASweepDeflStep, rec_start = recstart cdf_varput, cdfid, 'SWEAMomInterval', SCIDATA.SWEAMode.SWEAMomInterval, rec_start = recstart cdf_varput, cdfid, 'SWEASpecInterval', SCIDATA.SWEAMode.SWEASpecInterval, rec_start = recstart cdf_varput, cdfid, 'IAutoLUT', SCIDATA.SWEAMode.IAutoLUT, rec_start = recstart if recstart eq 0 then $ cdf_varput, cdfid, 'SWEAEnergies', SCIDATA.Energy, rec_start = recstart recstart = recstart*5 for i=0,4 do begin utcpkttim = sec2utc(utcsec + double(SCIDATA.SWEAMode.SWEASpecInterval)* double(i)) utc = anytim2utc(utcpkttim,/external) cdf_epoch, pktepoch, utc.year, utc.month, utc.day, utc.hour, utc.minute, $ utc.second, utc.millisecond,/compute_epoch cdf_varput, cdfid, 'Epoch_Spectra', pktepoch, rec_start = recstart cdf_varput, cdfid, 'SWEASpectra', reform(SCIDATA.SWEASpectra[*,i]), rec_start = recstart recstart = recstart + 1 endfor cdf_close, cdfid return end