PROGRAM TINHVUNG PARAMETER (N=41, M=12, NS=8, NV=7) REAL X(N,M,NS), Y(N,M,NV) INTEGER NAM(N) CHARACTER *10 TENVUNG(NV) CHARACTER *70 DIR,FNAME DIR='C:\Master\DBKH_2002\ENSO_SST\to_home\' LENDIR=INDEX(DIR,' ')-1 FNAME='TEMPERATURE.DAT' LENFNAME=INDEX(FNAME,' ')-1 FNAME=DIR(1:LENDIR)//FNAME(1:LENFNAME) OPEN (1, FILE=FNAME ,STATUS='OLD') DO L=1,NV READ (1,'(I2,A10)') NTRAM, TENVUNG(L) DO K=1, NTRAM READ (1,*) DO I=1,N READ (1,*) NAM(I),(X(I,J,K),J=1,M) ENDDO ENDDO READ (1,*) C DO I=1,N DO J=1,M TMP=0.0 NDEM=0 DO K=1,NTRAM IF (X(I,J,K).NE.-99.0) THEN NDEM=NDEM+1 TMP=TMP+X(I,J,K) ENDIF ENDDO IF (NDEM.GT.0) THEN Y(I,J,L)=TMP/REAL(NDEM) ELSE Y(I,J,L)=-99.0 ENDIF ENDDO ENDDO ENDDO C DO L=1,NV DO J=1,M TMP=0.0 NDEM=0 DO I=1,N IF (Y(I,J,L).NE.-99.0) THEN NDEM=NDEM+1 TMP=TMP+Y(I,J,L) ENDIF ENDDO IF (NDEM.GT.0) THEN TMP=TMP/REAL(NDEM) ELSE TMP=-99.0 ENDIF DO I=1,N IF (Y(I,J,L).EQ.-99.0) Y(I,J,L)=TMP ENDDO ENDDO ENDDO C C...WRITE TO FILE C DIR='C:\Master\DBKH_2002\TEMP\' LENDIR=INDEX(DIR,' ')-1 DO L=1,NV FNAME=TENVUNG(L) LENFNAME=INDEX(FNAME,' ')-1 FNAME=DIR(1:LENDIR)//FNAME(1:LENFNAME)//'.TXT' OPEN (3, FILE=FNAME ,STATUS='UNKNOWN') WRITE (3,'("NHIET DO K/V: ",A10)') TENVUNG(L) WRITE (3,'(3I5)') N,NAM(1),NAM(N) WRITE (3,'(" ",12I7)') (J,J=1,M) DO I=1,N WRITE (3,'(I4,12F7.1)') NAM(I),(Y(I,J,L),J=1,M) ENDDO ENDDO END