pro read_EDT_hdr1001,dd=dd,mm=mm,yy=yy,hh=hh ; +---------------------------+ ; | | ; | AUTHOR: Henry Selkirk | ; | DATE: 25 Aug 2005 | ; | | ; +---------------------------+ ; This program reads in sounding data formatted in the Hipskind-Gaines format #1001. ; First create input filename from arguments passed from calling program cdd = string(dd) if dd lt 10 then cdd = '0' + cdd cmm = string(mm) if mm lt 10 then cmm = '0' + cmm cyy = string(yy) if yy lt 10 then cyy = '0' + cyy chh = string(hh) if hh lt 10 then chh = '0' + chh cyyyy = '20'+ cyy EDTfile = strcompress('RS78762_' + cyyyy + '-' + cmm + '-' + cdd + 'T' + chh + '.EDT',/remove_all) HDRfile = strcompress('RS78762_' + cyyyy + '-' + cmm + '-' + cdd + 'T' + chh + '.HDR',/remove_all) ; Next assemble the path - Here we assume that you are running from a directory in which the ; subdirectory 'EDT_archive' resides yyyyPathmm = strcompress('20' + cyy + '-' + cmm,/remove_all) ; print,yyyyPathmm hhZ = strcompress( chh + 'Z',/remove_all) inPath = 'EDT_archive' + '/' + yyyyPathmm + '/' + hhZ + '/' + EDTfile hdrPath = 'EDT_archive' + '/' + yyyyPathmm + '/' + hhZ + '/' + HDRfile print,inPath ; print hdrPath openr,11,inPath openw,22, hdrPath ; First read the first X lines of the header ; -------------------------------------------------------------------------------------------------- ; ; READ IN HEADER VARIABLES ; ; -------------------------------------------------------------------------------------------------- NHEADL = 0 ; Initialize header variables to typical/expected values ONAME = 'SELKIRK, HENRY' ORG = 'BAER INSTITUTE, M/S 245-5, NASA-AMES RES. CTR, MOFFETT FIELD, CA 94035-1000, (650) 604-6489, SNAME = 'VAISALA RADIOSONDE DATA - DigiCORA MW11 at Station MROC/78762, Alajuela, COSTA RICA; upgraded for RS92-SGP' MNAME = 'TICOSONDE-AURA/TCSP 2005' IVOL = 1 NVOL = 1 DATE = intarr(3) RDATE = intarr(3) DT = 2 XNAME = 'Elapsed time in secs from release' NV = 25 NSCOML = 0 SCOML = strarr(100) NNCOML = 0 readf,11, NHEADL readf,11, ONAME ; ONAME = Name of originator readf,11, ORG ; ORG = Name of originator's organization readf,11, SNAME ; SNAME = Source data and measurement system details readf,11, MNAME ; MNAME = Mission or campaign name readf,11, IVOL, NVOL ; IVOL,NVOL = Number of this volume and total number of volumes readf,11, DATE, RDATE ; DATE, RDATE = Measurement date and processing date readf,11, DT ; DT = Time base interval readf,11, XNAME ; XNAME = Description of time base/independent variable readf,11, NV ; NV = Number of original and derived variables/columns ]' VSCAL = fltarr(NV) VMISS = fltarr(NV) VNAME = strarr(NV) readf,11, VSCAL readf,11, VMISS inline = '' for i = 0, NV-1 do begin readf,11, inline VNAME(i) = inline end readf,11, NSCOML ; NSCOML = Number of special comment lines SCOML = strarr(NSCOML) ; SCOML = Special comment lines; here, WMO message text for i = 0, NSCOML-1 do begin readf,11,inline SCOML(i) = inline end readf,11, NNCOML ; NNCOML = Number of normal comment lines NCOML = strarr(NNCOML) ; NCOML = Regular comment lines; here, number of times plus DigiCORA header lines for i = 0, NNCOML-1 do begin readf,11,inline NCOML(i) = inline end ; Print out the data just read in ; print,format='(2I6,T50,a)', NHEADL, 1001, '[ NHEADL = No. of header lines; FFI = Hipskind-Gaines format index ]' ; print,format='(a,T50,a)', ONAME, '[ ONAME = Name of originator ]' ; print,format='(a)', ORG ; print,format='(a)', SNAME ; print,format='(a,T50,a)', MNAME, '[ MISSION NAME ]' ; print,format='(2I6,T50,a)', IVOL, NVOL, '[ IVOL NVOL ]' ; print,format='(6I6,T50,a)', DATE,RDATE, '[ DATE, RDATE = Measurement date and processing date ]' ; print,format='(f7.0,T50,a)', DT, '[ Dt (sec) = time base interval]' ; print,format='(a,T50,a)', XNAME ; print,format='(i6,T50,a)', NV, '[ NV = no. of original and derived variables/columns ]' ; print, VSCAL ; print, VMISS for i = 0, NV-1 do begin ; print, VNAME(i) end ;print,format='(i6,T50,a)', NSCOML, '[ NSCOML = no. of special comment lines => WMO messages ]' for i = 0, NSCOML-1 do begin ;print,SCOML(i) end ;print,format='(i6,T50,a)', NNCOML, '[ NNCOML = no. of normal comment lines => DigiCORA header data ]' for i = NNCOML-5, NNCOML-1 do begin print,NCOML(i) end ; Print out the same stuff to a disk file ; printf,22,format='(2I6,T50,a)', NHEADL, 1001, '[ NHEADL = No. of header lines; FFI = Hipskind-Gaines format index ]' ; printf,22,format='(a,T50,a)', ONAME, '[ ONAME = Name of originator ]' ; printf,22,format='(a)', ORG ; printf,22,format='(a)', SNAME ; printf,22,format='(a,T50,a)', MNAME, '[ MISSION NAME ]' ; printf,22,format='(2I6,T50,a)', IVOL, NVOL, '[ IVOL NVOL ]' ; printf,22,format='(6I6,T50,a)', DATE,RDATE, '[ DATE, RDATE = Measurement date and processing date ]' ; printf,22,format='(f7.0,T50,a)', DT, '[ Dt (sec) = time base interval]' ; printf,22,format='(a,T50,a)', XNAME ; printf,22,format='(i6,T50,a)', NV, '[ NV = no. of original and derived variables/columns ]' ; printf,22, VSCAL ; printf,22, VMISS for i = 0, NV-1 do begin ; printf,22,VNAME(i) end printf,22,format='(i6,T50,a)', NSCOML, '[ NSCOML = no. of special comment lines => WMO messages ]' for i = 0, NSCOML-1 do begin printf,22,SCOML(i) end printf,22,format='(i6,T50,a)', NNCOML, '[ NNCOML = no. of normal comment lines => DigiCORA header data ]' for i = 0, NNCOML-1 do begin printf,22,NCOML(i) end ; Extract the number of data records from NCOML(3) n = fix(strmid(NCOML(3),25,8)) nTrop = fix(strmid(NCOML(4),25,8)) ; print, n, ntrop ; ; -------------------------------------------------------------------------------------------------- ; ; INITIALIZE THE DATA ARRAYS ; ; -------------------------------------------------------------------------------------------------- ; Initialize the sounding variables to missing values TimeSec = lonarr(N) AscRate = fltarr(N) + VMISS(0) HgtMSL = lonarr(N) + VMISS(1) Press = fltarr(N) + VMISS(2) Temp = fltarr(N) + VMISS(3) RelHum = intarr(N) + VMISS(4) DewPt = fltarr(N) + VMISS(5) Wdir = intarr(N) + VMISS(6) Wspd = fltarr(N) + VMISS(7) Theta = fltarr(N) + VMISS(11) U = fltarr(N) + VMISS(12) V = fltarr(N) + VMISS(13) Lat = fltarr(N) + VMISS(14) Lon = fltarr(N) + VMISS(15) ; Initilize the special level data trop88 = intarr(N) + 0 wMax77 = intarr(N) + 0 coldPt = intarr(N) + 0 iTrop = 0 ilast = 0 ; Initialize the quality flags qAscRate = bytarr(N) + 0 qHgtMSL = bytarr(N) + 0 qPress = bytarr(N) + 0 qTemp = bytarr(N) + 0 qRelHum = bytarr(N) + 0 qDewPt = bytarr(N) + 0 qWdir = bytarr(N) + 0 qWspd = bytarr(N) + 0 ; -------------------------------------------------------------------------------------------------- ; ; READ THROUGH INPUT FILE ; ; -------------------------------------------------------------------------------------------------- i = 0 itrop = 0 readData: while not eof(11) do begin readf,11, format='(i7,f8.1,i8,f9.1,f7.1,i4,f7.1,i5,f6.1,2x,3i3,2x,3f9.2,2x,2f10.3,2x,8i1 )' $ , iTimeSec, fAscRate, iHgtMSL, fPress, fTemp, iRelHum, fDewPt, iWdir, fWspd $ , iTrop88, iColdPt, iWmax77, fTheta, fU, fV, fLat, fLon $ , bAscRate, bHgtMSL, bPress, bTemp, bRelHum, bDewPt, bWdir, bWspd TimeSec(i) = iTimeSec AscRate(i) = fAscRate HgtMSL(i) = iHgtMSL Press(i) = fPress Temp(i) = fTemp RelHum(i) = iRelHum DewPt(i) = fDewPt Wdir(i) = iWdir Wspd(i) = fWspd Theta(i) = fTheta U(i) = fU V(i) = fV Lat(i) = fLat Lon(i) = fLon Trop88(i) = iTrop88 Wmax77(i) = iWmax77 ColdPt(i) = iColdPt qAscRate(i) = bAscRate qHgtMSL(i) = bHgtMSL qPress(i) = bPress qTemp(i) = bTemp qRelHum(i) = bRelHum qDewPt(i) = bDewPt qWdir(i) = bWdir qWspd(i) = bWspd if Trop88(i) gt 0 then begin ; print,'Coded tropopause #', Trop88(i) itrop = itrop + 1 print, format='(i7,f8.1,i8,f9.1,f7.1,i4,f7.1,i5,f6.1,2x,3i3,2x,3f9.2,2x,2f10.3,2x,8i1,5h Trop,i2 )' $ , TimeSec(i), AscRate(i), HgtMSL(i), Press(i), Temp(i), RelHum(i), DewPt(i), Wdir(i), Wspd(i) $ , Trop88(i), ColdPt(i), Wmax77(i), Theta(i), U(i), V(i), Lat(i), Lon(i) $ , qAscRate(i), qHgtMSL(i), qPress(i), qTemp(i), qRelHum(i), qDewPt(i), qWdir(i), qWspd(i),itrop endif if Wmax77(i) eq 1 then begin ; print,'Coded wind max:' print, format='(i7,f8.1,i8,f9.1,f7.1,i4,f7.1,i5,f6.1,2x,3i3,2x,3f9.2,2x,2f10.3,2x,8i1,5h Wmax )' $ , TimeSec(i), AscRate(i), HgtMSL(i), Press(i), Temp(i), RelHum(i), DewPt(i), Wdir(i), Wspd(i) $ , Trop88(i), ColdPt(i), Wmax77(i), Theta(i), U(i), V(i), Lat(i), Lon(i) $ , qAscRate(i), qHgtMSL(i), qPress(i), qTemp(i), qRelHum(i), qDewPt(i), qWdir(i), qWspd(i) endif if ColdPt(i) eq 1 then begin ; print,'Temperature minimum:' print, format='(i7,f8.1,i8,f9.1,f7.1,i4,f7.1,i5,f6.1,2x,3i3,2x,3f9.2,2x,2f10.3,2x,8i1,6h Cldpt )' $ , TimeSec(i), AscRate(i), HgtMSL(i), Press(i), Temp(i), RelHum(i), DewPt(i), Wdir(i), Wspd(i) $ , Trop88(i), ColdPt(i), Wmax77(i), Theta(i), U(i), V(i), Lat(i), Lon(i) $ , qAscRate(i), qHgtMSL(i), qPress(i), qTemp(i), qRelHum(i), qDewPt(i), qWdir(i), qWspd(i) endif if Trop88(i) gt 0 then begin ; printf,22,'Coded tropopause #', Trop88(i) printf,22, format='(i7,f8.1,i8,f9.1,f7.1,i4,f7.1,i5,f6.1,2x,3i3,2x,3f9.2,2x,2f10.3,2x,8i1,5h Trop,i2)' $ , TimeSec(i), AscRate(i), HgtMSL(i), Press(i), Temp(i), RelHum(i), DewPt(i), Wdir(i), Wspd(i) $ , Trop88(i), ColdPt(i), Wmax77(i), Theta(i), U(i), V(i), Lat(i), Lon(i) $ , qAscRate(i), qHgtMSL(i), qPress(i), qTemp(i), qRelHum(i), qDewPt(i), qWdir(i), qWspd(i),itrop endif if Wmax77(i) eq 1 then begin ; printf,22,'Coded wind max:' printf,22, format='(i7,f8.1,i8,f9.1,f7.1,i4,f7.1,i5,f6.1,2x,3i3,2x,3f9.2,2x,2f10.3,2x,8i1,5h Wmax)' $ , TimeSec(i), AscRate(i), HgtMSL(i), Press(i), Temp(i), RelHum(i), DewPt(i), Wdir(i), Wspd(i) $ , Trop88(i), ColdPt(i), Wmax77(i), Theta(i), U(i), V(i), Lat(i), Lon(i) $ , qAscRate(i), qHgtMSL(i), qPress(i), qTemp(i), qRelHum(i), qDewPt(i), qWdir(i), qWspd(i) endif if ColdPt(i) eq 1 then begin ; printf,22,'Temperature minimum:' printf,22, format='(i7,f8.1,i8,f9.1,f7.1,i4,f7.1,i5,f6.1,2x,3i3,2x,3f9.2,2x,2f10.3,2x,8i1,6h Cldpt)' $ , TimeSec(i), AscRate(i), HgtMSL(i), Press(i), Temp(i), RelHum(i), DewPt(i), Wdir(i), Wspd(i) $ , Trop88(i), ColdPt(i), Wmax77(i), Theta(i), U(i), V(i), Lat(i), Lon(i) $ , qAscRate(i), qHgtMSL(i), qPress(i), qTemp(i), qRelHum(i), qDewPt(i), qWdir(i), qWspd(i) endif i = i + 1 goto, readData end ; print,'Top of the sounding:' print, format='(i7,f8.1,i8,f9.1,f7.1,i4,f7.1,i5,f6.1,2x,3i3,2x,3f9.2,2x,2f10.3,2x,8i1,4h Top )' $ , TimeSec(i-1), AscRate(i-1), HgtMSL(i-1), Press(i-1), Temp(i-1), RelHum(i-1), DewPt(i-1), Wdir(i-1), Wspd(i-1) $ , Trop88(i-1), ColdPt(i-1), Wmax77(i-1), Theta(i-1), U(i-1), V(i-1), Lat(i-1), Lon(i-1) $ , qAscRate(i-1), qHgtMSL(i-1), qPress(i-1), qTemp(i-1), qRelHum(i-1), qDewPt(i-1), qWdir(i-1), qWspd(i-1) ; printf,22,'Top of the sounding:' printf,22, format='(i7,f8.1,i8,f9.1,f7.1,i4,f7.1,i5,f6.1,2x,3i3,2x,3f9.2,2x,2f10.3,2x,8i1,4h Top )' $ , TimeSec(i-1), AscRate(i-1), HgtMSL(i-1), Press(i-1), Temp(i-1), RelHum(i-1), DewPt(i-1), Wdir(i-1), Wspd(i-1) $ , Trop88(i-1), ColdPt(i-1), Wmax77(i-1), Theta(i-1), U(i-1), V(i-1), Lat(i-1), Lon(i-1) $ , qAscRate(i-1), qHgtMSL(i-1), qPress(i-1), qTemp(i-1), qRelHum(i-1), qDewPt(i-1), qWdir(i-1), qWspd(i-1) close,11 close,22 end