pro iug_load_radiosonde_sgk_snd, downloadonly=downloadonly, $
trange=trange, $
verbose=verbose
if (not keyword_set(verbose)) then verbose=2
height = fltarr(1400)
height[0]=0.0
for i=0L, n_elements(height)-2 do begin
height[i+1] = height[i]+30.0
endfor
if ~size(fns,/type) then begin
hour_res = 1
file_names = file_dailynames( $
file_format='YYYY/'+$
'YYYYMMDDhh',trange=trange,hour_res=hour_res,times=times,/unique)+'*.snd'
source = file_retrieve(/struct)
source.verbose=verbose
source.local_data_dir = root_data_dir() + 'iugonet/rish/misc/sgk/radiosonde/snd/'
source.remote_data_dir = 'http://www.rish.kyoto-u.ac.jp/radar-group/mu/sondedb/'
local_paths=file_retrieve(file_names,_extra=source, /last_version)
local_paths_all = ~(~size(local_paths_all,/type)) ? $
[local_paths_all, local_paths] : local_paths
if ~(~size(local_paths_all,/type)) then local_paths=local_paths_all
endif else file_names=fns
if (not keyword_set(downloadonly)) then downloadonly=0
if (downloadonly eq 0) then begin
s=''
sonde_time = 0
sonde_press = 0
sonde_temp = 0
sonde_rh = 0
sonde_dewp = 0
sonde_vertical_velocity = 0
sonde_vertical_height = 0
for j=0L,n_elements(local_paths)-1 do begin
file= local_paths[j]
if file_test(/regular,file) then dprint,'Loading Shigaraki sonde data file: ',file $
else begin
dprint,'Shigaraki sonde data file',file,'not found. Skipping'
continue
endelse
openr,lun,file,/get_lun
readf,lun,s
temp_name = strsplit(s,' ', /extract)
year = fix(temp_name[1])
month = fix(temp_name[2])
day = fix(temp_name[3])
hh = temp_name[4]
mm = temp_name[5]
ss = temp_name[6]
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
data_comp = strsplit(s,' ', /extract)
append_array,height_data, float(data_comp[0])
append_array,press, float(data_comp[1])
append_array,temp, float(data_comp[2])
append_array,rh, float(data_comp[3])
append_array,vertical_velocity, float(data_comp[4])
append_array,vertical_height, float(data_comp[5])
continue
endif
endwhile
free_lun,lun
h_num= 0
press2 = fltarr(1,n_elements(height))+!values.f_nan
temp2 = fltarr(1,n_elements(height))+!values.f_nan
rh2 = fltarr(1,n_elements(height))+!values.f_nan
vertical_velocity2 = fltarr(1,n_elements(height))+!values.f_nan
vertical_height2 = fltarr(1,n_elements(height))+!values.f_nan
for i=0L, n_elements(height_data)-1 do begin
a = press[i]
wbad = where(a eq -999.0,nbad)
if nbad gt 0 then a[wbad] = !values.f_nan
press[i] =a
b = temp[i]
wbad = where(b eq -999.0,nbad)
if nbad gt 0 then b[wbad] = !values.f_nan
temp[i] =b
c = rh[i]
wbad = where(c eq -999.0,nbad)
if nbad gt 0 then c[wbad] = !values.f_nan
rh[i] =c
d = vertical_velocity[i]
wbad = where(d eq -999.0,nbad)
if nbad gt 0 then d[wbad] = !values.f_nan
vertical_velocity[i] =d
e = vertical_height[i]
wbad = where(e eq -999.0,nbad)
if nbad gt 0 then e[wbad] = !values.f_nan
vertical_height[i] =e
endfor
time = time_double(string(year)+'-'+string(month)+'-'+string(day)+'/'+string(hh)+':'+string(mm)+':'+string(ss)) $
-time_double(string(1970)+'-'+string(1)+'-'+string(1)+'/09:00:00')
stop
k=0L
for i=0L, n_elements(height)-1 do begin
idx = where((height_data*1000 ge height[i]-15) and (height_data*1000 lt height[i]+15),cnt)
if idx[0] ne -1 then begin
press2[0,i]=mean(press[idx],/NAN)
temp2[0,i]=mean(temp[idx],/NAN)
rh2[0,i]=mean(rh[idx],/NAN)
vertical_velocity2[0,i]=mean(vertical_velocity[idx],/NAN)
vertical_height2[0,i]=mean(vertical_height[idx],/NAN)
endif
endfor
append_array, sonde_time, time
append_array, sonde_press, press2
append_array, sonde_temp, temp2
append_array, sonde_rh, rh2
append_array, sonde_vertical_velocity, vertical_velocity2
append_array, sonde_vertical_height, vertical_height2
time=0
height_data=0
press=0
temp=0
rh=0
vertical_velocity=0
vertical_height=0
endfor
acknowledgstring = 'If you acquire radiosonde data, we ask that you acknowledge us in your use of the data. ' $
+ 'This may be done by including text such as radiosonde data provided by Research Institute ' $
+ 'for Sustainable Humanosphere of Kyoto University. We would also appreciate receiving a copy ' $
+ 'of the relevant publications. The distribution of dawin sonde data' $
+ 'has been partly supported by the IUGONET (Inter-university Upper atmosphere Global' $
+ 'Observation NETwork) project (http://www.iugonet.org/) funded by the' $
+ 'Ministry of Education, Culture, Sports, Science and Technology (MEXT), Japan.'
if size(sonde_press,/type) eq 4 then begin
dlimit=create_struct('data_att',create_struct('acknowledgment',acknowledgstring,'PI_NAME', 'H. Hashiguchi'))
store_data,'iug_radiosonde_sgk_press',data={x:sonde_time, y:sonde_press, v:height/1000.0},dlimit=dlimit
options,'iug_radiosonde_sgk_press',ytitle='RSND-sgk!CHeight!C[km]',ztitle='Press.!C[hPa]'
store_data,'iug_radiosonde_sgk_temp',data={x:sonde_time, y:sonde_temp, v:height/1000.0},dlimit=dlimit
options,'iug_radiosonde_sgk_temp',ytitle='RSND-sgk!CHeight!C[km]',ztitle='Temp.!C[deg.]'
store_data,'iug_radiosonde_sgk_rh',data={x:sonde_time, y:sonde_rh, v:height/1000.0},dlimit=dlimit
options,'iug_radiosonde_sgk_rh',ytitle='RSND-sgk!CHeight!C[km]',ztitle='RH!C[%]'
store_data,'iug_radiosonde_sgk_vertical_velocity',data={x:sonde_time, y:sonde_vertical_velocity, v:height/1000.0},dlimit=dlimit
options,'iug_radiosonde_sgk_vertical_velocity',ytitle='RSND-sgk!CHeight!C[km]',ztitle='Ascending speed!C[m/s]'
store_data,'iug_radiosonde_sgk_vertical_height',data={x:sonde_time, y:sonde_vertical_height, v:height/1000.0},dlimit=dlimit
options,'iug_radiosonde_sgk_vertical_height',ytitle='RSND-sgk!CHeight!C[km]',ztitle='Height!C[km]'
options, ['iug_radiosonde_sgk_press','iug_radiosonde_sgk_temp',$
'iug_radiosonde_sgk_rh',$
'iug_radiosonde_sgk_vertical_velocity','iug_radiosonde_sgk_vertical_height'], 'spec', 1
endif
sonde_time = 0
sonde_press = 0
sonde_temp = 0
sonde_rh = 0
sonde_vertical_velocity = 0
sonde_vertical_height = 0
new_vars=tnames('iug_radiosonde_*')
if new_vars[0] ne '' then begin
tdegap, 'iug_radiosonde_sgk_press',/overwrite
tdegap, 'iug_radiosonde_sgk_temp',/overwrite
tdegap, 'iug_radiosonde_sgk_rh',/overwrite
tdegap, 'iug_radiosonde_sgk_vertical_velocity',/overwrite
tdegap, 'iug_radiosonde_sgk_vertical_height',/overwrite
endif
endif
new_vars=tnames('iug_radiosonde_*')
if new_vars[0] ne '' then begin
print,'*****************************
print,'Data loading is successful!!'
print,'*****************************
endif
print, '****************************************************************
print, 'Acknowledgement'
print, '****************************************************************
print, 'If you acquire radiosonde data, we ask that you acknowledge us in '
print, 'your use of the data.This may be done by including text such as '
print, 'radiosonde data provided by Research Institute for Sustainable '
print, 'Humanosphere of Kyoto University. We would also appreciate '
print, 'receiving a copy of the relevant publications. The distribution '
print, 'of dawin sonde datahas been partly supported by the IUGONET '
print, '(Inter-university Upper atmosphere Global Observation NETwork) '
print, 'project (http://www.iugonet.org/) funded by theMinistry of Education, '
print, 'Culture, Sports, Science and Technology (MEXT), Japan.'
end