42 |
INTEGER ioUnit |
INTEGER ioUnit |
43 |
INTEGER k, nbReg |
INTEGER k, nbReg |
44 |
_RS tmpVar(1-OLx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy) |
_RS tmpVar(1-OLx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy) |
45 |
|
COMMON / SET_REGIONS_LOCAL / tmpVar |
46 |
#else |
#else |
47 |
LOGICAL flag |
LOGICAL flag |
48 |
#endif |
#endif |
63 |
ENDDO |
ENDDO |
64 |
ENDDO |
ENDDO |
65 |
ENDDO |
ENDDO |
66 |
|
ioUnit = -1 |
67 |
|
|
68 |
_BEGIN_MASTER( myThid ) |
_BEGIN_MASTER( myThid ) |
69 |
|
ioUnit = standardMessageUnit |
70 |
C-- Check size & parameter first: |
C-- Check size & parameter first: |
71 |
IF ( (diagSt_regMaskFile.NE.' ' .AND. nLevRegMskFile.EQ.0) |
IF ( (diagSt_regMaskFile.NE.' ' .AND. nSetRegMskFile.EQ.0) |
72 |
& .OR.(diagSt_regMaskFile.EQ.' ' .AND. nLevRegMskFile.GT.0) ) THEN |
& .OR.(diagSt_regMaskFile.EQ.' ' .AND. nSetRegMskFile.GT.0) ) THEN |
73 |
WRITE(msgBuf,'(2A)') 'DIAGSTATS_SET_REGIONS:', |
WRITE(msgBuf,'(2A)') 'DIAGSTATS_SET_REGIONS:', |
74 |
& ' regMaskFile and nLevRegMskFile Not consistent' |
& ' regMaskFile and nSetRegMskFile Not consistent' |
75 |
CALL PRINT_ERROR( msgBuf , myThid ) |
CALL PRINT_ERROR( msgBuf , myThid ) |
76 |
STOP 'ABNORMAL END: S/R DIAGSTATS_SET_REGIONS' |
STOP 'ABNORMAL END: S/R DIAGSTATS_SET_REGIONS' |
77 |
ENDIF |
ENDIF |
78 |
IF ( nLevRegMskFile.GT.sizRegMsk ) THEN |
IF ( nSetRegMskFile.GT.sizRegMsk ) THEN |
79 |
WRITE(msgBuf,'(2A,I4,A,I4)') 'DIAGSTATS_SET_REGIONS:', |
WRITE(msgBuf,'(2A,I4,A,I4)') 'DIAGSTATS_SET_REGIONS:', |
80 |
& ' regMaskFile level number=', nLevRegMskFile, |
& ' regMaskFile set-index number=', nSetRegMskFile, |
81 |
& ' exceeds sizRegMsk=', sizRegMsk |
& ' exceeds sizRegMsk=', sizRegMsk |
82 |
CALL PRINT_ERROR( msgBuf , myThid ) |
CALL PRINT_ERROR( msgBuf , myThid ) |
83 |
STOP 'ABNORMAL END: S/R DIAGSTATS_SET_REGIONS' |
STOP 'ABNORMAL END: S/R DIAGSTATS_SET_REGIONS' |
86 |
|
|
87 |
C-- Read region-mask from file |
C-- Read region-mask from file |
88 |
IF ( diagSt_regMaskFile .NE. ' ' ) THEN |
IF ( diagSt_regMaskFile .NE. ' ' ) THEN |
89 |
|
_BARRIER |
90 |
iLen = ILNBLNK(diagSt_regMaskFile) |
iLen = ILNBLNK(diagSt_regMaskFile) |
91 |
ioUnit = standardMessageUnit |
IF (ioUnit.GE.0 ) WRITE(ioUnit,'(2A)') |
|
IF (debugLevel.GE.debLevB) WRITE(ioUnit,'(2A)') |
|
92 |
& ' DIAGSTATS_SET_REGIONS: start reading region-mask file: ', |
& ' DIAGSTATS_SET_REGIONS: start reading region-mask file: ', |
93 |
& diagSt_regMaskFile(1:iLen) |
& diagSt_regMaskFile(1:iLen) |
94 |
DO k=1,nLevRegMskFile |
DO k=1,nSetRegMskFile |
95 |
C _BEGIN_MASTER( myThid ) |
C _BEGIN_MASTER( myThid ) |
96 |
IF (debugLevel.GE.debLevB) WRITE(ioUnit,'(A,I3)') |
IF (ioUnit.GE.0 ) WRITE(ioUnit,'(A,I3)') |
97 |
& ' DIAGSTATS_SET_REGIONS: reading lev k=',k |
& ' DIAGSTATS_SET_REGIONS: reading set k=',k |
98 |
CALL READ_REC_XY_RS( diagSt_regMaskFile, tmpVar, k, |
CALL READ_REC_XY_RS( diagSt_regMaskFile, tmpVar, k, |
99 |
& nIter0, myThid ) |
& nIter0, myThid ) |
100 |
IF (debugLevel.GE.debLevB) WRITE(ioUnit,'(A,I3,A)') |
IF (ioUnit.GE.0 ) WRITE(ioUnit,'(A,I3,A)') |
101 |
& ' DIAGSTATS_SET_REGIONS: lev k=',k,' <= done' |
& ' DIAGSTATS_SET_REGIONS: set k=',k,' <= done' |
102 |
C _END_MASTER( myThid ) |
C _END_MASTER( myThid ) |
103 |
_EXCH_XY_RS( tmpVar, myThid ) |
_EXCH_XY_RS( tmpVar, myThid ) |
104 |
DO bj = myByLo(myThid), myByHi(myThid) |
DO bj = myByLo(myThid), myByHi(myThid) |
113 |
C- end of k loop |
C- end of k loop |
114 |
ENDDO |
ENDDO |
115 |
ENDIF |
ENDIF |
116 |
nLevRegMask = nLevRegMskFile |
nSetRegMask = nSetRegMskFile |
117 |
|
|
118 |
C-- Other way to define regions (e.g., latitude bands): |
C-- Other way to define regions (e.g., latitude bands): |
119 |
C set corresponding levels of the region-mask array, |
C set corresponding set-index of the region-mask array, |
120 |
C starting from nLevRegMskFile+1 up to nLevRegMask |
C starting from nSetRegMskFile+1 up to nSetRegMask |
121 |
C note: for now, empty ! |
C note: for now, empty ! |
122 |
|
|
123 |
C-- Region Identificator arrays |
C-- Region Identificator arrays |
135 |
CALL PRINT_ERROR( msgBuf , myThid ) |
CALL PRINT_ERROR( msgBuf , myThid ) |
136 |
STOP 'ABNORMAL END: S/R DIAGSTATS_SET_REGIONS' |
STOP 'ABNORMAL END: S/R DIAGSTATS_SET_REGIONS' |
137 |
C- check for unset region-mask: |
C- check for unset region-mask: |
138 |
ELSEIF ( diagSt_kRegMsk(j).GT.nLevRegMask ) THEN |
ELSEIF ( diagSt_kRegMsk(j).GT.nSetRegMask ) THEN |
139 |
WRITE(msgBuf,'(2A,I3,A,I3,A)') 'DIAGSTATS_SET_REGIONS: ', |
WRITE(msgBuf,'(2A,I3,A,I3,A)') 'DIAGSTATS_SET_REGIONS: ', |
140 |
& 'region',j,' , kRegMsk=', diagSt_kRegMsk(j), |
& 'region',j,' , kRegMsk=', diagSt_kRegMsk(j), |
141 |
& ' <- has not been set !' |
& ' <- has not been set !' |
207 |
& .OR. diagSt_vRegMsk(j).NE.0. |
& .OR. diagSt_vRegMsk(j).NE.0. |
208 |
ENDDO |
ENDDO |
209 |
iLen = ILNBLNK(diagSt_regMaskFile) |
iLen = ILNBLNK(diagSt_regMaskFile) |
210 |
IF ( flag .OR. iLen.GE.1 .OR. nLevRegMskFile.NE.0 ) THEN |
IF ( flag .OR. iLen.GE.1 .OR. nSetRegMskFile.NE.0 ) THEN |
211 |
WRITE(msgBuf,'(2A)') 'DIAGSTATS_SET_REGIONS:', |
WRITE(msgBuf,'(2A)') 'DIAGSTATS_SET_REGIONS:', |
212 |
& ' #define DIAGSTATS_REGION_MASK missing in DIAG_OPTIONS.h' |
& ' #define DIAGSTATS_REGION_MASK missing in DIAG_OPTIONS.h' |
213 |
CALL PRINT_ERROR( msgBuf , myThid ) |
CALL PRINT_ERROR( msgBuf , myThid ) |