function get_uwy_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 = 'WAL' if(NOT KEYWORD_SET(ZTIME)) then ztime='00' ; Sounding launch time if(NOT KEYWORD_SET(VERBOSE)) then verbose=FALSE ; Print messages ; ; *** Match station to station_id ; CASE station of 'WAL': Begin station_id = '72402' ; Wallops Island, VA END 'DVN': Begin station_id = '74455' ; Davenport, IA END 'OUN': Begin station_id = '72357' ; Norman, OK END 'GSO': Begin station_id = '72317' ; Greenville, NC END ELSE: BEGIN print,'Sounding ' + station + ' not supported.' stop END 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/Soundings/UWY_Soundings/' + 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 nr = get_numrecords(sounding_file) print,' contains ',nr,' records.' if(nr lt 50) then begin flag = 'Incomplete sounding!' return,flag endif return,'OK' end