PRO SWEA213_TO_CDF, SCIDATA, DATESTRING, SCID ;+ ; Project : STEREO - IMPACT/SWEA ; ; Name : SWEA213_TO_CDF ; ; Purpose : Write SWEA 213 data to CDF ; ; Category : STEREO, IMPACT, SWEA ; ; Explanation : ; ; Syntax : SWEA213_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 = 'swea213a.cdf' SCSTRING = 'STA' endif else begin SOURCE_FILE = 'swea213b.cdf' SCSTRING = 'STB' endelse filename = SCSTRING+'_L1_SWEA_MOM_'+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 for i=0,8 do begin utcsec = utc2sec(SCIDATA.STARTTIME) utcpkttim = sec2utc(utcsec + double(SCIDATA.SWEAMOMINT)*(double(i)+0.5d)) utc = anytim2utc(utcpkttim,/external) cdf_epoch, pktepoch, utc.year, utc.month, utc.day, utc.hour, utc.minute, $ utc.second, utc.millisecond,/compute_epoch if n_elements(pktepochs) eq 0 then $ pktepochs = [pktepoch] else $ pktepochs = [pktepochs, pktepoch] endfor Ve = dblarr(3,9) Ve[0,*] = SCIDATA.MOMENTS.NVx Ve[1,*] = SCIDATA.MOMENTS.NVy Ve[2,*] = SCIDATA.MOMENTS.NVz Pe = dblarr(6,9) Pe[0,*] = SCIDATA.MOMENTS.NPxx Pe[1,*] = SCIDATA.MOMENTS.NPyy Pe[2,*] = SCIDATA.MOMENTS.NPzz Pe[3,*] = SCIDATA.MOMENTS.NPxy Pe[4,*] = SCIDATA.MOMENTS.NPxz Pe[5,*] = SCIDATA.MOMENTS.NPyz He = dblarr(3,9) He[0,*] = SCIDATA.MOMENTS.NHx He[1,*] = SCIDATA.MOMENTS.NHy He[2,*] = SCIDATA.MOMENTS.NHz cdf_varput, cdfid, 'Epoch', pktepochs, rec_start = recstart cdf_varput, cdfid, 'SWEAMomInt', replicate(SCIDATA.SWEAMOMINT,9), rec_start = recstart cdf_varput, cdfid, 'SWEAModeID', replicate(SCIDATA.SWEAMODEID,9), rec_start = recstart cdf_varput, cdfid, 'SWEASweepMax', replicate(SCIDATA.SWEASWEEPMAX,9), rec_start = recstart cdf_varput, cdfid, 'SWEASweepRate', replicate(SCIDATA.SWEASWEEPRATE,9), rec_start = recstart cdf_varput, cdfid, 'SWEASweepDeflStep', replicate(SCIDATA.SWEASWEEPDEFLSTEP,9), rec_start = recstart cdf_varput, cdfid, 'EDensity', SCIDATA.MOMENTS.N, rec_start = recstart cdf_varput, cdfid, 'Ve', Ve, rec_start = recstart cdf_varput, cdfid, 'Pe', Pe, rec_start = recstart cdf_varput, cdfid, 'He', He, rec_start = recstart cdf_varput, cdfid, 'V0', SCIDATA.MOMENTS.V0, rec_start = recstart cdf_varput, cdfid, 'SWEADHKP', SCIDATA.MOMENTS.SWEADHKP, rec_start = recstart cdf_close, cdfid return end