/[MITgcm]/MITgcm/pkg/diagnostics/diag_vegtile_fill.F
ViewVC logotype

Diff of /MITgcm/pkg/diagnostics/diag_vegtile_fill.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.6 by jmc, Sun Jun 26 16:51:49 2005 UTC revision 1.7 by jmc, Wed Sep 21 19:35:29 2005 UTC
# Line 66  C =============== Line 66  C ===============
66        CHARACTER*(MAX_LEN_MBUF) msgBuf        CHARACTER*(MAX_LEN_MBUF) msgBuf
67        integer i,offset,Lena,newindx,jindx        integer i,offset,Lena,newindx,jindx
68        _RL undef,getcon        _RL undef,getcon
69          INTEGER iSp, ndId, j,l
70          INTEGER region2fill(0:nRegions)
71          _RL     scaleFact
72          _RL     gridField(sNx*sNy,nlevs), gridFrac(sNx*sNy)
73    
74  C Run through list of active diagnostics to make sure  C Run through list of active diagnostics to make sure
75  C we are trying to fill a valid diagnostic  C we are trying to fill a valid diagnostic
# Line 165  C--   do the filling: ends here. Line 169  C--   do the filling: ends here.
169           ENDIF           ENDIF
170          ENDIF          ENDIF
171         ENDDO         ENDDO
172          ENDDO
173    
174    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
175    C--   Global/Regional Statistics :
176          scaleFact = 1. _d 0
177    
178    C Run through list of active statistics-diagnostics to make sure
179    C we are trying to compute & fill a valid diagnostic
180    
181          DO n=1,diagSt_nbLists
182           DO m=1,diagSt_nbActv(n)
183            IF ( chardiag.EQ.diagSt_Flds(m,n) .AND. iSdiag(m,n).GT.0 ) THEN
184             iSp = iSdiag(m,n)
185             IF ( qSdiag(0,0,iSp,bi,bj).GE.0. ) THEN
186               ndId = jSdiag(m,n)
187    C-    Find list of regions to fill:
188               DO j=0,nRegions
189                region2fill(j) = diagSt_region(j,n)
190               ENDDO
191    C-    if this diagnostics appears in several lists (with same freq)
192    C     then add regions from other lists
193               DO l=1,diagSt_nbLists
194                DO k=1,diagSt_nbActv(l)
195                 IF ( iSdiag(k,l).EQ.-iSp ) THEN
196                  DO j=0,nRegions
197                   region2fill(j) = MAX(region2fill(j),diagSt_region(j,l))
198                  ENDDO
199                 ENDIF
200                ENDDO
201               ENDDO
202    
203    C-      Which part of field to add : k = 3rd index,
204    C         and do the loop >> do k=kFirst,kLast <<
205           IF (kLev.LE.0) THEN
206            kFirst = 1
207            kLast  = nLevs
208           ELSE
209            kFirst = 1
210            kLast  = 1
211           ENDIF
212    
213    C-    Fill local array with grid-space field after conversion.
214           offset = ib*(npeice-1)
215           Lena    = min(ib,numpts-offset)
216           offset = offset+1
217    
218           DO i=1,sNx*sNy
219             gridFrac(i)= 0.
220           ENDDO
221           DO i=1,Lena
222             newindx = indx(i+offset-1)
223             gridFrac(newindx)=gridFrac(newindx)+chfr(i)
224           ENDDO
225    
226           DO k = kFirst,kLast
227            DO i=1,sNx*sNy
228             gridField(i,k)= 0.
229            ENDDO
230            if( check ) then
231             undef = getcon('UNDEF')
232             do i= 1,Lena
233              newindx = indx(i+offset-1)
234              if(gridField(newindx,k).eq.undef
235         .                           .or.field(i,k).eq.undef)then
236               gridField(newindx,k)= undef
237              else
238               gridField(newindx,k)=gridField(newindx,k)
239         &                         +field(i,k)*chfr(i)/gridFrac(newindx)
240              endif
241             enddo
242            else
243             do i= 1,Lena
244              newindx = indx(i+offset-1)
245              gridField(newindx,k)=gridField(newindx,k)
246         &                        +field(i,k)*chfr(i)/gridFrac(newindx)
247             enddo
248            endif
249           ENDDO
250    
251    C-    diagnostics is valid and Active: Now do the filling
252               CALL DIAGSTATS_FILL(
253         I              gridField, gridFrac, scaleFact, 1, 1,
254         I              ndId, iSp, region2fill, kLev, nLevs,
255         I              3, bi, bj, myThid )
256             ENDIF
257            ENDIF
258           ENDDO
259        ENDDO        ENDDO
260    
261   1000 format(' ',' Warning: Trying to write to diagnostic ',a8,   1000 format(' ',' Warning: Trying to write to diagnostic ',a8,

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22