FUNCTION SAMBA,source_in$,date$,ts,INFO$=info$ ;Hello Nathaniel, ; ;My name is Thanasis and I got your data request from Eftyhia Zesta. ;I made a tarred and gzipped file that contains the data we have for Feb. 22, 2008. ; ;http://samba.atmos.ucla.edu/downloads/frissell/SAMBA_022208.tar.gz ; ;We have data from only 5 stations for that day, Putre (PUT), La Serena (SER), ;Los Cerrillos (CER), Escudero (ESC), and O'Higgins (OHI). The data files ;have 5 columns, second of the day, Bx, By, Bz (all multiplied by 1000), and ;an accuracy flag (which you can ignore). Missing data flag is 99999. (or 99999000) ;and also at those points the accuracy flag is 9. The filenames are SYYDOYSID1s.asc, ;where YY is the year (08 in your case), DOY is the day of the year (053 in your case), ;and SID is the station IDs I gave above. I'm including a SAMBA map and station table ;in case you don't have them. ; ;Let me know if you have any problem downloading the file. Good luck! ; ;Thanasis ; source$ = source_in$ source$ = STRSPLIT(source$,':',/EXTRACT) CASE source$[0] OF 'query': retData = '^samba' ELSE : BEGIN startdate = TIME_DOUBLE(date$) enddate = startdate + (ts * 60.) ;Load data in from file. 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.' year = STRMID(fileName$,1,2) doy = STRMID(fileName$,3,3) DOY_TO_MONTH_DATE,year,doy,month,day hour = 0 min = 0 second = 0 IF year LE 90 THEN year = year + 2000 ELSE year = year + 1900 OPENR, unit, fileName$, /GET_LUN 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$) ;Remove bad data, goodData = WHERE(retData[*,1] LT 99999000) retData = retData[goodData,*] retData[*,1] = retData[*,1] / 1000. retData = DATAPROC(retData,DETREND=0) ;Create Information Vector type$ = 'mag' name$ = STRUPCASE(source$[1]) + ' SAMBA Mag (' + source$[2] + ')' unit$ = 'nT' shortID$ = STRUPCASE(source$[1]) + ':' + source$[2] info$ = [source_in$, type$, name$, unit$, shortID$] END ENDCASE RETURN, retData END