compile_opt idl2
pro kyoto_dst2tplot ,trange=trange, $
real_time=real_time, $
dstdata=alldst, $
dsttime=alldsttime
if ~keyword_set(datatype) then datatype='dst'
get_timespan,t
if ~size(fns,/type) then begin
file_names = file_dailynames( $
file_format='YYYYMM/dst'+ $
'yyMM',trange=t,times=times,/unique)+'.for.request
source = file_retrieve(/struct)
source.downloadonly=1
source.min_age_limit= 900
source.local_data_dir = root_data_dir() + 'geom_indices/kyoto/dst/'
case 1 of
~keyword_set(real_time): source.remote_data_dir = $
'http://wdc.kugi.kyoto-u.ac.jp/dst_provisional/'
else: source.remote_data_dir = $
'http://wdc.kugi.kyoto-u.ac.jp/dst_realtime/'
endcase
local_paths=file_retrieve(file_names,_extra=source)
endif else file_names=fns
s=''
alldsttime=0
allaltime=0
allaotime=0
allautime=0
allaxtime=0
alldst= 0
allal= 0
allao= 0
allau= 0
allax= 0
for i=0,n_elements(local_paths)-1 do begin
file= local_paths[i]
if file_test(/regular,file) then dprint,'Loading DST file: ',file $
else begin
dprint,'DST file ',file,' not found. Skipping'
continue
endelse
openr,lun,file,/get_lun
while(not eof(lun)) do begin
readf,lun,s
ok=1
if strmid(s,0,1) eq '[' then ok=0
if ok && keyword_set(s) then begin
dprint,s ,dlevel=5
year = (strmid(s,12,2))
month = (strmid(s,14,2))
day = (strmid(s,16,2))
hour = (strmid(s,19,2))
type = strmid(s,21,2)
basetime = time_double('20'+year+'-'+month+'-'+day+'/'+hour)
kdata = fix ( strmid(s, indgen(60)*6 +34 ,6) )
case type of
'DST': begin
append_array,alldst,kdata
append_array,alldsttime, basetime + dindgen(60)*60d
dprint,' ',s,dlevel=5
end
'AL': begin
append_array,allal,kdata
append_array,allaltime, basetime + dindgen(60)*60d
dprint,' ',s,dlevel=5
end
'AO': begin
append_array,allao,kdata
append_array,allaotime, basetime + dindgen(60)*60d
dprint,' ',s,dlevel=5
end
'AU': begin
append_array,allau,kdata
append_array,allautime, basetime + dindgen(60)*60d
dprint,' ',s,dlevel=5
end
'AX': begin
append_array,allax,kdata
append_array,allaxtime, basetime + dindgen(60)*60d
dprint,' ',s,dlevel=5
end
endcase
continue
endif
endwhile
free_lun,lun
endfor
if keyword_set(alldst) then begin
alldst= float(alldst)
wbad = where(alldst eq 99999,nbad)
if nbad gt 0 then alldst[wbad] = !values.f_nan
store_data,'kyoto_dst',data={x:alldsttime, y:alldst},dlimit={constant:0.}
endif
if keyword_set(allal) then begin
allal= float(allal)
wbad = where(allal eq 99999,nbad)
if nbad gt 0 then allal[wbad] = !values.f_nan
store_data,'kyoto_al',data={x:allaltime, y:allal},dlimit={constant:0.}
endif
if keyword_set(allao) then begin
allao= float(allao)
wbad = where(allao eq 99999,nbad)
if nbad gt 0 then allao[wbad] = !values.f_nan
store_data,'kyoto_ao',data={x:allaotime, y:allao},dlimit={constant:0.}
endif
if keyword_set(allau) then begin
allau= float(allau)
wbad = where(allau eq 99999,nbad)
if nbad gt 0 then allau[wbad] = !values.f_nan
store_data,'kyoto_au',data={x:allautime, y:allau},dlimit={constant:0.}
endif
if keyword_set(allax) then begin
allax= float(allax)
wbad = where(allax eq 99999,nbad)
if nbad gt 0 then allax[wbad] = !values.f_nan
store_data,'kyoto_ax',data={x:allaxtime, y:allax},dlimit={constant:0.}
endif
print,'**********************************************************************************
print,'Kyoto Provisional DST data. Not for redistribution.'
print,'We thank DST stations (Abisko [SGU, Sweden], Cape Chelyuskin [AARI, Russia],
print,'Tixi [IKFIA and AARI, Russia], Pebek [AARI, Russia], Barrow, College [USGS,
print,'USA], Yellowknife, Fort Churchill, Sanikiluaq (Poste-de-la-Baleine) [CGS,
print,'Canada], Narsarsuaq [DMI, Denmark], and Leirvogur [U. Iceland, Iceland]) as
print,'well as the RapidMAG team for their cooperations and efforts to operate
print,'these stations and to supply data with us for the provisional DST index.
print,'(Pebek is a new station at geographic latitude of 70.09N and longitude of 170.93E,
print,'replacing the closed station Cape Wellen.)
print,'**********************************************************************************
end