function load_sounding,year,month,day,s,STATION=station,ZTIME=ztime,VERBOSE=verbose !QUIET=1 TRUE=1 & FALSE=0 ; ; *** Program to construct a curl command to download a ; *** Wallops area soundings from the Univ. of Wyoming. ; if(NOT KEYWORD_SET(STATION)) then station='72402' ; Default Wallops if(NOT KEYWORD_SET(ZTIME)) then ztime='00' ; Sounding launch time if(NOT KEYWORD_SET(VERBOSE)) then verbose=FALSE ; Print messages ; ; *** Convert dates to strings ; year = string(year,format='(I4.4)') month = string(month,format='(i2.2)') day = string(day,format='(i2.2)') ; ; *** Get the sounding file ; in_dir = '/data/Soundings/' + year + '/' + month + '/' wc = in_dir + '???_' + station + '_' + year + '_' + month + day + $ '_' + ztime + 'Z.txt' files = file_search(wc,COUNT=nf) if(nf eq 0) then begin flag = 'No files found in ' + wc return,flag endif file = files[0] print,'<-- ' + file ; ; *** Read the data into arrays ; nr = get_numrecords(file,header=2) p = fltarr(nr) & h = p & t = p & td = p rh = p & mixr = p & theta=p & theta_e=p & theta_v=p wdir = intarr(nr) & wspd=wdir rec = '' openr,unit,file,/get_lun readf,unit,rec readf,unit,rec for i=0,nr-1 do begin readf,unit,rec a = strsplit(rec,' ',/extract) p[i] = a[0]*1.0 h[i] = a[1]*1.0 t[i] = a[2]*1.0 td[i] = a[3]*1.0 rh[i] = a[4]*1.0 mixr[i] = a[5]*1.0 wdir[i] = a[6]*1 wspd[i] = a[7]*1 theta[i] = a[8]*1.0 theta_e[i] = a[9]*1.0 theta_v[i] = a[10]*1.0 endfor close,unit free_lun,unit s = {year: year, month: month, day: day, station: station, ztime: ztime, $ t: t, p: p, h: h, td: td, rh: rh, mixr: mixr, wdir: wdir, $ wspd: wspd, theta: theta, theta_e: theta_e, theta_v: theta_v} flag = 'OK' return,flag end