SUBROuTINt SMOOTH (FUHSTi ITfMS) 



C SUeROUlINf SMnuTH T*KfS A HECORO OF PF4KS *NU VALLEYS AND 



C ELI'^INATES TMCONSEiJUeNTlAL PFAKS AND VaLLFYS. TMt. ELIMINATION 



C CRITtoiA AkE A MINIMUM OIFFFRFNCE BETWEEN PEAK and VALUEY 



C ELEVATIONS (H«IN) ANO A MINIMUM HOfiWONTAL SPACINfi (BE IT 



C TImEi POSITION. ETC) PETwEEn PEAK AND VA(.LfcY (CHP), 



C INPUT PaKaMETF«S are DiFINEO AS FOLLOl«S» 



C FUt^T s STaktING time 



C ITEMS = TOTAL NUMBER OF EXTREME VALUES CINCLUoeS TlMg aNO 



C ELEVATION VALUES) 



C CMP a CRITICAL maL^ PERIOD 



C Mt'lN s MINIMUM HEICMT TO BE CON3IOE*'E0 



C EXTIM(ODD) s TIME 



C EXTIM(EVEN) z EXTHEME ELEVATION ASSOCIATED "ITH EXTIMtpvEN.J) VALUE 



C OF TIME 



COMMON /SMOT/ EXTIM(IOO) 

 C SET VALUES OF CHP AUD HMIN TO BE IJSEO 



DATA CHP« HMIN / O.OOi J.O / 

 C INITIALIZE VARIABLES AND FIND STARTING POINT FOR PROCESSING 

 1503 1ITEMS=IT£M8 



J=l 



ITEM7sITEMS-7 



DO Ibo? lei.IITEMSiZ 



ISKJPal 



IF(EXTIM(n,GE.FURST) GO TO 150a 



ITEMSsITEmSp? 

 1502 CONTINUE 

 15oa ISTARTsISKlP 



C«««*«*««*«»*»«*»*«*««»*«*«*f**««****»*t»****«*«********«**4i*»**«*?«««*»»f« 



C BEGIN MAIN PROCtSSlNt LOOP 



DO 1520 ISISTART.ITEM7.2 



L=I 



1F(ISTA(<T.GT.ITEM7)G0 TO 1520 



IFCtXTlMfn + CHP.GT.fcXTTMf I*?))GO TO 1511 



IF(AbSCtXTlM(i+j)»fcxTlM(i*3)).LT.H"l'")G0 TO 1511 

 C IF NO TRANSFER. THIS EKTHEMt ACCEPTED 



EXTiMtJ)zExTIM(I) 



ExTIM(j*j)=£xTlM(I*l) 



J=J+2 



GO TO 1520 

 C KHE'-i TmE NEXT INSTRUCTION IS RE*CHEf>i ONE HIGH AND ONE LO" wJLU 

 C BE DELETED 



1511 IFtEXTlM(I + n.GT.EXTIM(i + 3))G0 TO 15U 



C IF NEXT INSTRUCTION IS USED. ThIS 19 » LO" 

 IFrEXTlM{I + !5),GT.fcXTI»'(l*l))G0 TO 1512 

 IF(EXTlMCI*3).GT.EXTI^{I-i))G0 TO 1513 

 GO TO lbl7 



1512 lF(EXTlM(I*j),GT,EXTIMf I*7))G0 TO l519 

 GO TO 1S16 



C WME.N NEXT IKSTRUCTION Is USED. TMls IS A HJOH 

 15ia IF(EXTl"(I + 5),GT.txTIM(Un)60 TO 1515 

 IF(EXTlMCI*7),GT.tXTlM(UJ))Gn TO 1519 

 GO TO 1516 



1515 IF (ExTIM(it3),GT.EXTlM(i,n)G0 TO »517 

 GO TO 1518 



C SET THE VALUE OF XC*SE 



1516 ICASEel 



GO TO 1521 



1517 1CASE»2 

 GO TO 152J 



Figure D-2. List of subroutine SMOOTH. 



147 



