pro iug_load_radiosonde_sgk_tsv, downloadonly=downloadonly, $
trange=trange, $
verbose=verbose
if (not keyword_set(verbose)) then verbose=2
max_height = 40000
dh=30.0
num_h= fix(max_height/dh)
height = fltarr(num_h)
for i=0, n_elements(height)-2 do begin
if height[i] le 40000 then height[i+1] = height[i]+dh
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)+'*.tsv'
source = file_retrieve(/struct)
source.verbose=verbose
source.local_data_dir = root_data_dir() + 'iugonet/rish/misc/sgk/radiosonde/tsv/'
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_uwind = 0
sonde_vwind = 0
for j=0,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
head_data = strsplit(s,' ', /extract)
year = strmid(file,50,4)
month = strmid(file,54,2)
day = strmid(file,56,2)
hour = strmid(file,58,2)
minute = strmid(file,60,2)
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(strcompress(s),' ', /extract)
if data_comp[0] eq 'RS-Number' then Sonde_Serial_No = data_comp[2]
if n_elements(data_comp) eq 19 then begin
append_array,time_data, float(data_comp[0])
append_array,height_data, float(data_comp[6])
if float(data_comp[7]) ne -32768.00 then append_array,press, float(data_comp[7])
if float(data_comp[7]) eq -32768.00 then append_array,press, -999.00
if float(data_comp[2]) ne -32768.00 then append_array,temp, float(data_comp[2])-273.15
if float(data_comp[2]) eq -32768.00 then append_array,temp, -999.00
if float(data_comp[3]) ne -32768.00 then append_array,rh, float(data_comp[3])
if float(data_comp[3]) eq -32768.00 then append_array,rh, -999.00
if float(data_comp[5]) ne -32768.00 then append_array,uwind, float(data_comp[5])
if float(data_comp[5]) eq -32768.00 then append_array,uwind, -999.00
if float(data_comp[4]) ne -32768.00 then append_array,vwind, float(data_comp[4])
if float(data_comp[4]) eq -32768.00 then append_array,vwind, -999.00
append_array,lon_data, float(data_comp[14])
append_array,lat_data, float(data_comp[15])
endif
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
uwind2 = fltarr(1,n_elements(height))+!values.f_nan
vwind2 = fltarr(1,n_elements(height))+!values.f_nan
for i=0, n_elements(height_data)-1 do begin
a = press[i]
wbad = where(a eq -32768.00,nbad)
if nbad gt 0 then a[wbad] = !values.f_nan
press[i] =a
b = temp[i]
wbad = where(b eq -32768.00,nbad)
if nbad gt 0 then b[wbad] = !values.f_nan
temp[i] =b
c = rh[i]
wbad = where(c eq -32768.00,nbad)
if nbad gt 0 then c[wbad] = !values.f_nan
rh[i] =c
d = uwind[i]
wbad = where(d eq -32768.00,nbad)
if nbad gt 0 then d[wbad] = !values.f_nan
uwind[i] =d
e = vwind[i]
wbad = where(e eq -32768.00,nbad)
if nbad gt 0 then e[wbad] = !values.f_nan
vwind[i] =e
endfor
time = time_double(string(year)+'-'+string(month)+'-'+string(day)+'/'+string(hour)+':'+string(minute)) $
-time_double(string(1970)+'-'+string(1)+'-'+string(1)+'/09:00:00')
k=0
for i=0, n_elements(height)-1 do begin
idx = where((height_data ge height[i]-dh/2.0) and (height_data lt height[i]+dh/2.0),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)
uwind2[0,i]=mean(uwind[idx],/NAN)
vwind2[0,i]=mean(vwind[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_uwind, uwind2
append_array, sonde_vwind, vwind2
time=0
time_data=0
height_data=0
press=0
temp=0
rh=0
uwind=0
vwind=0
lat_data=0
lon_data=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_uwnd',data={x:sonde_time, y:sonde_uwind, v:height/1000.0},dlimit=dlimit
options,'iug_radiosonde_sgk_uwnd',ytitle='RSND-sgk!CHeight!C[km]',ztitle='uwnd!C[m/s]'
store_data,'iug_radiosonde_sgk_vwnd',data={x:sonde_time, y:sonde_vwind, v:height/1000.0},dlimit=dlimit
options,'iug_radiosonde_sgk_vwnd',ytitle='RSND-sgk!CHeight!C[km]',ztitle='vwnd!C[m/s]'
options, ['iug_radiosonde_sgk_press','iug_radiosonde_sgk_temp',$
'iug_radiosonde_sgk_rh',$
'iug_radiosonde_sgk_uwnd','iug_radiosonde_sgk_vwnd'], 'spec', 1
endif
sonde_time = 0
sonde_press = 0
sonde_temp = 0
sonde_rh = 0
sonde_uwind = 0
sonde_vwind = 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_uwnd',/overwrite
tdegap, 'iug_radiosonde_sgk_vwnd',/overwrite
zlim, 'iug_radiosonde_sgk_uwnd', -40,40
zlim, 'iug_radiosonde_sgk_vwnd', -40,40
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