;+ ; NAME: ; THM_GMAG_STATIONS_fromfile.PRO ; ; PURPOSE: ; Modified version of Harald Frey's thm_gmag_stations. Loads gmag station information ; from a specified file. Intended for use with plot_gmag to create the gmag location ; maps on the THEMIS website. ; ; CATEGORY: ; None ; ; CALLING SEQUENCE: ; thm_gmag_stations,labels,location ; ; INPUTS: ; files: the filename for the file containing the gmag list ; ; OPTIONAL INPUTS: ; None ; ; KEYWORD PARAMETERS: ; conjugate conjugate locations ; magnetic geomagnetic coordinates ; midnight local magnetic midnight ; names full names of sites ; verbose some debug printing ; ; OUTPUTS: ; labels Names of GBO stations ; location Geographic location of stations ; ; OPTIONAL OUTPUTS: ; None ; ; COMMON BLOCKS: ; None ; ; SIDE EFFECTS: ; None ; ; RESTRICTIONS: ; None ; ; EXAMPLE: ; ; ; MODIFICATION HISTORY: ; Written by: Harald Frey ; Version 1.0 August, 16, 2011 ; ; VERSION: ; $LastChangedBy: hfrey $ ; $LastChangedDate: 2011-08-19 09:41:48 -0700 (Fri, 19 Aug 2011) $ ; $LastChangedRevision: 8920 $ ; $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/trunk/idl/themis/ground/thm_gmag_stations.pro $ ; ;- pro thm_gmag_stations_fromfile,files, labels,location,conjugate=conjugate,magnetic=magnetic,$ midnight=midnight,names=names,verbose=verbose ; ; find and read file ;relpath = 'themis/ground/' ;;ending = '-Russia.txt';eg if you are using a subset of stations ;ending = '-Antarctic.txt' ;prefix = 'GMAG-Station-Code-' ; ;relpathnames = file_dailynames(relpath,prefix,ending,$ ; trange=['1970-01-01/00:00:00','1970-01-01/00:00:00']) ; ;;files = '$IDL_BASE_DIR'+'/' + relpathnames ;files = 'C:\Users\lphilpott\themis_svn_thmsoc\trunk\idl\' + relpathnames if keyword_set(verbose) then print,files dummy=' ' labels=strarr(150) location=fltarr(2,150) mag=fltarr(2,150) mid=strarr(150) con=fltarr(2,150) nam=strarr(150) openr,unit,files[0],/get_lun readf,unit,dummy,format='(a0)' ; header i=0 while not eof(unit) do begin readf,unit,dummy,format='(a0)' res=strsplit(strcompress(dummy),' ',/extract) labels[i]=res[0] location[*,i]=float([res[1],res[2]]) parts=n_elements(res) case 1 of (parts eq 10): begin nam[i]=res[3]+' '+res[4] mag[*,i]=float([res[5],res[6]]) mid[i]=res[7] con[*,i]=float([res[8],res[9]]) endcase (parts eq 11): begin nam[i]=res[3]+' '+res[4]+' '+res[5] mag[*,i]=float([res[6],res[7]]) mid[i]=res[8] con[*,i]=float([res[9],res[10]]) endcase endcase i=i+1 endwhile ; return values labels=labels[0:i-1] location=location[*,0:i-1] if keyword_set(magnetic) then magnetic =mag[*,0:i-1] if keyword_set(midnight) then midnight =mid[0:i-1] if keyword_set(conjugate) then conjugate=con[*,0:i-1] if keyword_set(names) then names =nam[0:i-1] free_lun, unit end