c mw.f Calculates average and frequency of soundings. c c Place this program in the corresponding directory. c Place this program in the corresponding directory. c Give correct name c Choose am or pm c Modify input (Check extension too) and output files. c Be sure that the file 'fechas.s' exists in this directory c Consider that the file 3 starts with 011, and c increases twice daily up to 31 days. If you want to make c changes modify fechas.f, or Modify parameter lim. character*3 date character*4 time character*5 name parameter (n=70, lim=62) ! n = rows in file unit 1 dimension u(n),v(n),hm(n) !lim = rows in file unit 3 integer j(n),tmax c name = 'P1103' !Ecuador, c do 1 i=1,n j(i)=0 hm(i)=0 u(i)=0. v(i)=0. 1 continue izero = 0 tmax = 0 ie = 0 num = 0 c open(2,file=name//'to.s') !output file open(3,file='fechas.d',status='old') !reading file open(4,file='comments') c write(2,*)' file No.obs MaxH(m)' c do 5 ii=1,lim read(3,7)date c c read(date,'(i3)')idate c if(mod(idate,2).ne.0)goto 25 !afternoon c if(mod(idate,2).eq.0)goto 25 !morning c open(1,file=name//date//'.WIN',status='old',iostat .=ierr) !input file c if(ierr.ne.0)goto 33 read(1,*,end=30) read(1,*,end=30) do 10 k=1,n read(1,11,end=20)time,zm,u0,v0 if(zm.eq.0)goto 10 c if(zm.ne.hm(k).and.j(k).gt.1)then ie=ie+1 write(4,*)'error in Height ',name//date//'.WIN' write(4,*)'previous=',hm(k),'read=',zm c goto 5 endif if(hm(k).eq.0)hm(k)=zm u(k)=u(k)+u0 v(k)=v(k)+v0 j(k)=j(k)+1 c maxz=zm count=k 10 continue c 20 tmax=tmax+maxz write(2,6)name//date//'.WIN',count,maxz goto 5 25 num=num+1 goto 5 30 write(4,*)'No data found in file ',name//date goto 5 33 write(2,*)' ',name//date//'.WIN 0' write(4,*)'file ',name//date//'.WIN',' not found' izero = izero+1 5 continue c 35 write(2,13)(lim-num)-izero,izero,(lim-num) write(2,*) write(2,*)'files with error in H = ',ie write(2,14)tmax/float((lim-num)-izero) write(2,*) write(2,*)' height mag dir u v freq ' do 40 k=1,n if(j(k).ne.0)then umean=u(k)/float(j(k)) vmean=v(k)/float(j(k)) xmag=sqrt(umean**2+vmean**2) dir=asin(-umean/xmag)*180/3.1416 if(vmean.gt.0)dir=180-dir if(umean.gt.0.and.vmean.lt.0)dir=360+dir write(2,12)hm(k),xmag,dir,umean,vmean,j(k) endif 40 continue c 7 format(1x,A3) 6 format(4x,A12,4x,f4.0,5x,i5) 11 format(x,A4,2x,f7.1,3x,f6.2,3x,f6.2) 12 format(x,f6.0,2x,f5.2,2x,f5.1,2x,f6.2,2x,f6.2,4x,i2) 13 format(/,10hobserved= ,i2,3x,9hmissing= ,i2,3x,7htotal= ,i2) 14 format(/,47hAveraged height (excluding files with 0 obs.)= ,f6.0) stop end