C$$$ MAIN PROGRAM DOCUMENTATION BLOCK C C MAIN PROGRAM: DUPELIM_SYNOPTIC C PRGMMR: GEORGE FULWOOD ORG: NP53 DATE: 02-06-05 C C ABSTRACT: REMOVES DUPLICATE SYNOPTIC RECORDS FROM CPC FORMATTED C SYNOPTIC OBSERVATIONS FILE. C C PROGRAM HISTORY LOG: C 02-06-05 GEORGE FULWOOD ORIGINAL IMPLEMENTATION C C USAGE: C INPUT FILES: C FT11F001 - CPC.SORTED.SYNOPTIC.DAT.IN C PARM - UNIT 5 (STANDARD READ) C C OUTPUT FILES: (INCLUDING SCRATCH FILES) C FT06F001 - UNIT 6 (STANDARD PRINTFILE) C FT51F001 - CPC.SORTED.SYNOPTIC.DAT.OUT C C SUBPROGRAMS CALLED: NONE C C EXIT STATES: C COND = 0 - SUCCESSFUL RUN C =NNNN - TROUBLE OR SPECIAL FLAG - SPECIFY NATURE C C REMARKS: LIST CAVEATS, OTHER HELPFUL HINTS OR INFORMATION C C ATTRIBUTES: C LANGUAGE: FORTRAN-77 COMPILED UNDER FORTRAN-90 C MACHINE: IBM SP C C$$$ C Character * 255 inline,outlne,lines(105000), + hold(105000) C character * 40 pline character * 2 nblk,oblk c CALL W3TAGB('DUPELIM_SYNOPTIC ',2003,0007,0050,'NPxx') C nblk = ' ' oblk = '00' C icnt = 0 ncnt = 1 ioncnt = 1 lines(1) = '0' C C read the sorted synoptic observation file C 10 read(11,25,end=30) inline 25 format(a251) C icnt = icnt + 1 hold(icnt) = inline goto 10 C C eof on observation file C 30 print 300,icnt 300 format(i10,' obs read from input file') C C now search for duplicates and write non-duplicate records to C output array C do 305 n = 1 , icnt inline = hold(n) C C print station if it begins a new block number C nblk = inline(24:25) if ( nblk .ne. oblk ) then print 250, nblk 250 format(' eliminating duplicates from block ',a3) oblk = nblk end if C C determine if this is a duplicate report C ncnt = ioncnt do 35 j = 1 , ncnt if( inline .eq. lines(j) ) goto 305 35 continue C C add this record to output array C ncnt = ncnt + 1 lines(ncnt) = inline ioncnt = ncnt pline = inline(1:40) C print 27,pline,icnt,ncnt 27 format(a40,' icnt=',i12,' ncnt=',i12) C C extract next record from array C 305 continue C C write out the synoptic file with duplicates having been C eliminated. C do 45 k = 2, ncnt write(51,25) lines(k) 45 continue C ifcnt = ncnt - 1 idups = icnt - ifcnt C C how many duplicate records were found C write(6,32) idups 32 format(2x,i10,' duplicate records were found') C write(6,33) ifcnt 33 format(2x,i10,' records were written to the output file') C stop C CALL W3TAGE('DUPELIM_SYNOPTIC ') C end