function get_sounding,year,month,day,STATION=station,ZTIME=ztime,$ SOUNDING_FILE=sounding_file,VERBOSE=verbose !QUIET=1 TRUE=1 & FALSE=0 base_url = 'http://weather.uwyo.edu/cgi-bin/sounding?region=naconf&TYPE=TEXT%3ALIST&' ; ; *** 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' ; Wallops if(NOT KEYWORD_SET(ZTIME)) then ztime='00' ; Sounding launch time if(NOT KEYWORD_SET(VERBOSE)) then verbose=FALSE ; Print messages CASE station of '72402': station_id='WAL' ENDCASE ; ; *** Convert dates to strings ; year = string(year,format='(I4.4)') month = string(month,format='(i2.2)') day = string(day,format='(i2.2)') ztime = string(ztime,format='(I2.2)') url = base_url + 'YEAR=' + year + '&MONTH=' + month + $ '&FROM=' + day + ztime + '&TO=' + day + ztime + $ '&STNM=' + station ; ; *** Set up directories to hold the soundings for later use. ; out_dir = '/data/Radar/NPOL/Newark/Soundings/' + station_id + '/' + $ year + '/' + month + '/' spawn,'mkdir -p ' + out_dir if(verbose) then print,'Soundings to ' + out_dir ; ; *** Get the sounding ; tmp_file = station_id + '_' + station + '_' + year + '_' + $ month + day + '_' + ztime + 'UTC.tmp' sounding_file = out_dir + station_id + '_' + station + '_' + year + '_' + $ month + day + '_' + ztime + 'UTC.txt' c = 'curl -s ' + "'" + url + "'" + ' > ' + tmp_file spawn,c,result; ,,/null ; ; *** Now parse the file to remove HTML code ; parse_sounding,tmp_file,sounding_file,VERBOSE=verbose print,'Sounding: ' + sounding_file ; ; *** Now, make a copy of the sounding, sans the first two lines. ; nr = get_numrecords(sounding_file) print,file_basename(sounding_file),' contains ',nr,' records.' if(nr lt 50) then begin flag = 'Incomplete sounding!' print,flag return,flag endif else begin rt_sounding = '/data/Radar/NPOL/Newark/Soundings/WAL/WAL_Sounding.txt' c = 'sed 1,2d ' + sounding_file + ' > ' + rt_sounding spawn,c print,'RealTime sounding updated: ' + rt_sounding endelse return,'OK' end