Pro thm_plot_gmag_by_source, date, duration, no_data_load = no_data_load, $
source_in = source_in, winsize = winsize, $
_extra = _extra
if not keyword_set(date) then begin
dprint, 'You must specify a date. (Format : YYYY-MM-DD/HH:MM:SS)'
return
endif
if not keyword_set(duration) then duration = 1.
vsource = ['epo/ucla', 'gbo/ucalgary', 'gbo/ualberta', 'ualaska', 'maccs', 'misc']
If(is_string(source_in)) Then Begin
If(n_elements(source_in) Eq 1) Then Begin
sources = strlowcase(strsplit(source_in, ' ', /extract))
Endif Else sources = strlowcase(strcompress(source_in, /remove_all))
sources = thm_check_valid_name(sources, vsource, /include_all)
If(is_string(sources) Eq 0) Then Begin
dprint, 'No valid sources input'
Return
Endif
Endif Else sources = vsource
start_time = time_double(date)
end_time = start_time+86400.*duration
timespan, date, duration
nsource = n_elements(sources)
if not keyword_set(no_data_load) then begin
del_data, 'thg_mag_*'
endif
osf = strupcase(!version.os_family)
If(osf Eq 'WINDOWS') Then set_plot, 'win' Else set_plot, 'x'
If(n_elements(winsize) Eq 2) Then Begin
window, 0, xsize = winsize[0], ysize = winsize[1]
Endif Else Begin
screen_size = get_screen_size()
xss = screen_size/3.0
xss = 100.0*fix(xss[0]/100)
window, 0, xsize = xss, ysize = screen_size(1)*0.9
Endelse
!p.color = 0
!p.background = 255
!p.charsize = 1.0
date_compress = strcompress(strmid(date, 0, 4)+strmid(date, 5, 2)+strmid(date, 8, 2), /remove_all)
For j = 0, nsource-1 Do Begin
thetitle = 'SOURCE: '+sources[j]
dprint, 'PROCESSING '+strupcase(thetitle)
Case sources[j] Of
'epo/ucla':sitesj = ['bmls', 'ccnv', 'drby', 'fyts', 'hots', $
'loys', 'ptrs', 'pine', 'rmus', 'swno', 'ukia']
'gbo/ucalgary':sitesj = ['chbg', 'ekat', 'gbay', 'inuv', 'kapu', $
'kian', 'kuuj', 'mcgr', 'pgeo', 'snap', $
'tpas', 'whit', 'yknf']
'gbo/ualberta':sitesj = ['fsim', 'fsmi', 'gill', 'pina', 'rank', 'snkq']
'ualaska':sitesj = ['arct', 'bett', 'cigo', 'eagl', 'fykn', 'gako', $
'hlms', 'homr', 'kako', 'pokr', 'trap']
'maccs':sitesj = ['cdrt', 'crvr', 'gjoa', 'iglo', 'nain', 'pang', 'rbay']
'misc':sitesj = ['atha', 'nrsq']
Endcase
if not keyword_set(no_data_load) then begin
thm_load_gmag, site = sitesj, /subtract_median
endif
nj = n_elements(sitesj)
test_vars = 'thg_mag_'+sitesj
tplotvars = tnames(test_vars)
If(is_string(tplotvars) Eq 0) Then Begin
dprint, 'Ok sites:'
dprint, 'None'
dprint, 'Missing sites:'
for k = 0, nj-1 do dprint, sitesj[k]
ss_ok = -1
Endif Else Begin
ss_ok = sswhere_arr(test_vars, tplotvars)
dprint, 'Ok sites:'
for k = 0, n_elements(ss_ok)-1 do dprint, sitesj[ss_ok[k]]
ss_miss = sswhere_arr(test_vars, tplotvars, /notequal)
dprint, 'Missing sites:'
If(ss_miss[0] Ne -1) Then Begin
for k = 0, n_elements(ss_miss)-1 do dprint, sitesj[ss_miss[k]]
Endif Else dprint, 'None'
Endelse
If(ss_ok[0] Ne -1) Then Begin
stations = tplotvars
lats = fltarr(n_elements(stations))
lons = fltarr(n_elements(stations))
nstations = n_elements(stations)
for i = 0, nstations-1 do begin
get_data, stations[i], dlimits = dl
lats[i] = float(dl.cdf.vatt.station_latitude)
lons[i] = float(dl.cdf.vatt.station_longitude)
endfor
lat_index = reverse(sort(lats))
stations = stations[lat_index]
tplot_options, 'region', [0.00, 0.00, 0.95, 1.]
time_stamp, /off
timespan, date, duration
thetitle = 'SOURCE: '+sources[j]
tplot, stations, window = 0, title = thetitle
wshow, 0
dprint, 'Hit Enter to Continue:'
xxx = strarr(1)
read, xxx
Endif
Endfor
end