program read_upaL1_gls c c program to process hires sounding data in GLS format c c gfortran read_upaL1_gls.f -o read_upaL1_gls.x c real xmis, zmis, ixmis parameter (ip=205, xmis=-999., zmis=-999., ixmis=-999.) real p(ip), z(ip), tc(ip), td(ip), uc(ip), vc(ip) real fuc(ip), fvc(ip), xlni(ip), xlti(ip) integer qp(ip), qh(ip), qt(ip), qd(ip), qu(ip) integer istnid, nf parameter (m=10000) real xlon, xlat, alt integer iyr, mon, idy, ihr, min integer imm, idd, ihh common /header/ xlon, xlat, alt, iyr, mon, idy, ihr, min common /info/ project_id, stn_id, sonde_type, sonde_id common /data/ time(m), p0(m), z0(m), t0(m), rh(m), wspd(m), 2 wdir(m), dz(m), xln(m), xlt(m) character fname*35 character project_id*7, stn_id*5 character sonde_type*10, sonde_id*8 c ************************************************************ c contains list of files to be read in open(2, file='file.list', form='formatted', status='old') nf = 0 c read in file do read(2,'(a)',iostat=ier0) fname if(ier0 .ne. 0) exit nf = nf + 1 c open gls hi-res data file open(8, file=fname, form='formatted', status='old') c c read in one data for one time from file 8 c data is return in common blocks call readgls(8, nl) print *, 'read data for ', nf, fname, nl c print *, 'project ID:', project_id c print *, 'stn ID:', stn_id c print *, 'sonde type:',sonde_type c print *, 'sonde ID:', sonde_id c print *, 'lon./lat./alt ', xlon, xlat, alt c print *, 'date/time ', iyr, mon, idy, ihr, min c print *, 'number of data lines ', nl c do l=1,nl c print *, time(l), p0(l), z0(l), t0(l), rh(l), wspd(l), c 2 wdir(l), dz(l), xln(l), xlt(l) c enddo enddo end subroutine readgls(iun, lvl) c c read in data for one sounding in NCAR GLS format c c time - time from launch (s) c p0 - pressure (hPa) c z0 - alt (m) c t0 - temperature (C) c rh - relative humidity (% wrt to water) c wspd - wind speed (m/s) c wdir - wind direction c dz - ascent rate (m/s) c xln - longitude c xlt - latitude c missing value flag = -999.0 parameter (m=10000, pmis=9999.) real time, rh, wc, wspd, wdir, dz, rng, xlnt, xltt integer iyr, mon, idy, ihr, min common /header/ xlon, xlat, alt, iyr, mon, idy, ihr, min common /info/ project_id, stn_id, sonde_type, sonde_id common /data/ time(m), p0(m), z0(m), t0(m), rh(m), wspd(m), 2 wdir(m), dz(m), xln(m), xlt(m) character hline*100, dline*100, project_id*7, stn_id*5 character sonde_type*10, sonde_id*8 c ************************************************************* c c routine to read in gls formatted data c iflag = 0 c skip top line read (iun,'(a100)') hline c read in project ID read (iun,'(a100)') hline read (hline(13:19), '(a)') project_id c read in Station ID read (iun,'(a100)') hline read (hline(43:47), '(a)') stn_id c read in lon, lat, alt info read(iun, '(a100)') hline read (hline(36:55),*) xlat, xlon, alt c read in date / time information read (iun,'(a100)') hline read (hline(36:47),*) iyr, mon, idy read (hline(50:51),*) ihr read (hline(53:54),*) min c read in sonde type and serial number read (iun,'(a100)') hline read (hline(36:44), '(a)') sonde_type read (hline(48:55), '(a)') sonde_id c skip remainding header lines do i=1,9 read (iun,'(a82)') hline enddo C------- read in data --------------------------------------------------- lvl = 0 do read (iun,'(a100)',iostat=ier2) dline if(ier2 .ne. 0) exit lvl = lvl + 1 if(lvl .gt. m) then print *, 'size of array too small in read_gls' stop endif read (dline,*) time(lvl), p0(lvl), t0(lvl), rh(lvl), 2 wdir(lvl), wspd(lvl), dz(lvl), xln(lvl), xlt(lvl), z0(lvl) enddo return end