FUNCTION STEP210,source_in$,date$,ts,INFO$=info$ source$ = source_in$ source$ = STRSPLIT(source$,':',/EXTRACT) CASE source$[0] OF 'query': retData = '^step210' ELSE : BEGIN startdate = TIME_DOUBLE(date$) enddate = startdate + (ts * 60.) fileName$ = source$[1] savFName$ = fileName$ + '.sav' files = FINDFILE(savFName$, count=numFiles) IF numFiles EQ 0 THEN BEGIN PRINT,'No previous saveset file found; creating saveset file from ASCII file.' ;Load data in from file. OPENR, unit, fileName$, /GET_LUN header$ = '' READF,unit,header$ READF,unit,year,month,day,hour,min,second IF year LE 90 THEN year = year + 2000 ELSE year = year + 1900 READF,unit,header$ READF,unit,header$ c = 0LL sec = 0D bx = 0D by = 0D bz = 0D REPEAT BEGIN READF,unit,sec,bx,by,bz,pulse dataVec = [[sec], [bx], [by], [bz]] IF (c NE 0 ) THEN retData = [retData, dataVec] ELSE retData = dataVec ++c ENDREP UNTIL EOF(unit) FREE_LUN,unit ;Transform time vector into epoch time. ;time0 = TIMEYMDHMSTOEPOCH(LONG(year),LONG(month),LONG(day),LONG(hour),LONG(min),LONG(second)) time$ = $ NUMSTR(year) + '-' + $ NUMSTR(month) + '-' + $ NUMSTR(day) + '/' + $ NUMSTR(hour) + ':' + $ NUMSTR(min) + ':' + $ NUMSTR(second) HELP,time$ time0 = TIME_DOUBLE(time$) ;Create a 4 column array containing: ; [TimeVector Bx By Bz] retData[*,0] = retData[*,0] + time0 SAVE,file=savFName$,retData ENDIF ELSE BEGIN RESTORE,file=savFName$ ENDELSE ;Ensure that the array only contains data within the specified time range. upper = WHERE(retData[*,0] GE startdate) retData = retData[upper,*] lower = WHERE(retData[*,0] LE enddate) retData = retData[lower,*] ;Select Magnetometer Component comp$ = STRMID(source$[2],0,1,/REVERSE_OFFSET) retData = comp(retData,comp$) ;Create Information Vector type$ = 'mag' name$ = STRUPCASE(source$[1]) + ' STEP210 Mag (' + source$[2] + ')' unit$ = 'nT' shortID$ = STRUPCASE(source$[1]) + ':' + source$[2] info$ = [source_in$, type$, name$, unit$, shortID$ ] END ENDCASE RETURN, retData END