;+ ; Batch File: THM_CRIB_SCM ; ; Purpose: Demonstrate the loading, calibration, and plotting ; of THEMIS SCM (Search Coil Magnetometer) data. ; ; Calling Sequence: ; .run thm_crib_scm, or using cut-and-paste. ; ; Arguements: ; None. ; ; Notes: ; None. ; ;Written by Patrick Robert ; $LastChangedBy: kenb-win2000 $ ; $LastChangedDate: 2007-02-12 21:01:54 -0800 (Mon, 12 Feb 2007) $ ; $LastChangedRevision: 392 $ ; $URL $ ;- ; define time span and get auxiliary data: ; --------------------------------------- date = '2006-11-30/00:00:00' timespan,date,1,/day ; for each probe, extract arrays spin_phase, spin_period, spin_direction, time resolution = 30 sec ;;;;;;;; SELECT SATNAME (a,b,c,d or e) satname = 'a' thm_load_state,probe=satname thscs_spinphase = 'th'+satname+'_spinphase' thscs_spinper = 'th'+satname+'_spinper' thscs_spinras = 'th'+satname+'_spinras' thscs_spindec = 'th'+satname+'_spindec' get_data, thscs_spinphase, time_thscs_state, val_thscs_spinpha get_data, thscs_spinper , time_thscs_state, val_thscs_spinper get_data, thscs_spinras , time_thscs_state, val_thscs_spinras get_data, thscs_spindec , time_thscs_state, val_thscs_spindec ; extract arrays SCM modes and sample frequency, time resolution 512/sfreq thm_load_scm, probe=satname, /get_support_data ;;;;;;;;;;;;;;;; SELECT MODE (scf, scp, scw) mode = 'scf' scm_cal_sample_rate,satname, mode, time_thscs_mode_hed,val_thscs_sfreq, apid_str ; get SCM data and calibration ; ---------------------------- thm_load_scm,probe=satname thscs_mode = 'th'+satname+'_'+mode get_data, thscs_mode, time_thscs_mode, val_thscs_mode, values tplot,thscs_mode ctime,trange index = where((time_thscs_mode ge trange(0)) and $ (time_thscs_mode le trange(1))) time_thscs_mode = time_thscs_mode(index) val_thscs_mode = val_thscs_mode[index,0:2] ; create Level 1 data file (SCM procedure to be updated, documentation to be updated) thscs_scmwf_L1_rff = 'th'+satname+'_scmwf_L1.rff' scmwf_create_rff,thscs_scmwf_L1_rff,$ time_thscs_mode,val_thscs_mode,satname,apid_str,$ time_thscs_state,val_thscs_spinpha,$ val_thscs_spinper,$ val_thscs_spinras,$ val_thscs_spindec,time_thscs_mode_hed,val_thscs_sfreq stop ; location of the 'cal' directory within the distribution scmdir = routine_info('scmwf_create_rff',/source) scmdir = file_dirname(scmdir.path) dircal= filepath(root_dir=scmdir,'cal') ;define calibration parameters, and create cowave.in file ; Nbp = 256 Fdet = 0.5 Fcut = 0.1 Fmin = 0. Fmax = 0. step = 4 ; dircal = path to thscs_scmwf_L1_rff ;dircal = 'F:\analyse_donnees\idl\cal' Nbp = 256 Fdet = 0.5 Fcut = 0.1 Fmin =0. Fmax = 0. step = 4 scmwf_define_calparam, thscs_scmwf_L1_rff,$ dircal,trange(0),trange(1), $ Nbp,Fdet,Fcut,Fmin,Fmax,step stop ; ; create cowave.resu file containing calibrated waveforms ;name of the execuatable in the distribution. if !version.os_family eq 'Windows' then $ cowave_exe = 'PCW_' $ else if !version.os eq 'linux' then $ cowave_exe = 'LIN_' cowave_exe = filepath(root_dir=scmdir, cowave_exe + 'V1p1_cowave_THEscmwf.exe') print, 'spawning "'+cowave_exe+'"' spawn, '"'+cowave_exe+'"' + ' < cowave.in > cowave.out' ; get SCM calibrated waveform in nT scmwf_read_cowave, times, Bx,By,Bz, Nbwin,SCname,SCnum,Nbp, $ Fsamp,Fspin,Fdet,Fcut, Fmin,Fmax, Step,mode, $ title,subtitle,anomaly ;;temporary Correction of the wrong window number given by the .exe Nbwin = Nbwin-1 times = times[0:Nbwin-1,0:Nbp-1] Bx = Bx[0:Nbwin-1,0:Nbp-1] By = By[0:Nbwin-1,0:Nbp-1] Bz = Bz[0:Nbwin-1,0:Nbp-1] time_1D = dblarr(Nbwin*Nbp) Bxyz = fltarr(Nbwin*Nbp,3) time_1D(*) = transpose(times(*,*)) Bxyz(*,0) = transpose(Bx(*,*)) Bxyz(*,1) = transpose(By(*,*)) Bxyz(*,2) = transpose(Bz(*,*)) thscs_cal_mode_ssl = 'th'+satname+'_cal_'+mode+'_ssl' store_data,thscs_cal_mode_ssl,data={x:time_1D,y:Bxyz} tplot,[thscs_mode,thscs_cal_mode_ssl] tlimit, trange