PRO SWEA210_TO_CDF, SCIDATA, DATESTRING, SCID ;+ ; Project : STEREO - IMPACT/SWEA ; ; Name : SWEA210_TO_CDF ; ; Purpose : Write SWEA 210 data to CDF ; ; Category : STEREO, IMPACT, SWEA ; ; Explanation : ; ; Syntax : SWEA210_TO_CDF, SCIDATA, DATESTRING, SCID ; ; Examples : ; ; Inputs : SCIDATA - a structure including SWEA 210 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 = 'swea210a.cdf' SCSTRING = 'STA' endif else begin SOURCE_FILE = 'swea210b.cdf' SCSTRING = 'STB' endelse filename = SCSTRING+'_L1_SWEA_DIST_'+DATESTRING+'_V02.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 utcsec = utc2sec(SCIDATA.TIME) utcpkttim = sec2utc(utcsec + double(SCIDATA.SWEADISTINT)/2d) utc = anytim2utc(utcpkttim,/external) cdf_epoch, pktepoch, utc.year, utc.month, utc.day, utc.hour, utc.minute, $ utc.second, utc.millisecond,/compute_epoch 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 cdf_varput, cdfid, 'Epoch', pktepoch, rec_start = recstart cdf_varput, cdfid, 'SWEADistInterval', SCIDATA.SWEADISTINT, rec_start = recstart cdf_varput, cdfid, 'SWEAModeID', SCIDATA.SWEAMODEID, rec_start = recstart cdf_varput, cdfid, 'V0', SCIDATA.V0, rec_start=recstart if recstart eq 0 then $ cdf_varput, cdfid, 'Energy', SCIDATA.ENERGY cdf_varput, cdfid, 'Distribution', transpose(SCIDATA.DISTRIBUTION), rec_start = recstart cdf_close, cdfid return end