implicit none character*240 buf real mnet,slat,slon,selv,tmpf,sknt,drct,gust,pmsl,vpsr,dwpc,stvp,rh,dwpt real alti,dwpf,relh,p24i character*6 wthr character*3 station,unit,stn character*6 yymmdd character*4 hhmm character*80 outfile integer i c ***input fields *** c station = SNH; c WBB- university; SNH sandy; SLC Salt Lake; c unit = MKS; c MKS =m/s, etc. anything else will give english c outfile - any 80 character or less string, eg temp.dat call getarg(1,station) call getarg(2,unit) call getarg(3,outfile) write(6,*)"input values are" write(6,*)station write(6,*)unit write(6,*)outfile c *** open output file *** open(unit=2,name="outfile",status='unknown') c *** open input file and get data *** open(unit=1,name="/web/ftp/pub/mesonet/data/sflist_all.utah",status='old', &readonly) do i=1,10000 read(1,1,err=98)buf 1 format(a) if(buf(12:13).eq."01")read(buf,2)stn,yymmdd,hhmm,mnet,slat &,slon,selv,tmpf,sknt,drct,gust,pmsl,alti,dwpf,relh write(6,*)buf c *** success very sensitive to following format statement *** 2 format(4x,a3,4x,a6,1x,a4,1x,6f9.2,26x,6f9.2) if(stn.eq.station)then c *** convert to MKS or use english units *** if(unit.eq."MKS")then if (tmpf.ne.-9999.)tmpf = (tmpf-32.) * 5. / 9. if (tmpf.ne.-9999.)dwpc = (dwpf-32.) * 5. / 9. if (sknt.ne.-9999.)sknt = sknt * .51444 if (gust.ne.-9999.)gust = gust * .51444 if (tmpf.ne.-9999.)vpsr = 6.112 * exp (((dwpc * 17.67) / &(dwpc + 243.5))) if (tmpf.ne.-9999.)stvp = 6.112 * exp(((tmpf * 17.67) / &(tmpf + 243.5))) if (tmpf.ne.-9999.)rh = (vpsr / stvp) * 100 if (tmpf.ne.-9999.)dwpt = (-243.5 * log (vpsr / 6.112)) / &(log (vpsr / 6.112) -17.67) else endif c *** write to output file *** write(2,10)stn,hhmm,tmpf,sknt,drct,gust,rh 10 format(1x,a3,1x,a4,1x,7f9.2) endif enddo close(unit=1) close(unit=2) stop 98 stop 98 99 stop 99 end