/[MITgcm]/MITgcm/pkg/mnc/mnc_cw_readwrite.template
ViewVC logotype

Diff of /MITgcm/pkg/mnc/mnc_cw_readwrite.template

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

revision 1.22 by edhill, Wed Oct 20 21:26:14 2004 UTC revision 1.23 by edhill, Thu Oct 21 13:38:45 2004 UTC
# Line 119  C     !LOCAL VARIABLES: Line 119  C     !LOCAL VARIABLES:
119        REAL*8  resh_d( sNx + 2*OLx + sNy + 2*OLy )        REAL*8  resh_d( sNx + 2*OLx + sNy + 2*OLy )
120        REAL*4  resh_r( sNx + 2*OLx + sNy + 2*OLy )        REAL*4  resh_r( sNx + 2*OLx + sNy + 2*OLy )
121        INTEGER resh_i( sNx + 2*OLx + sNy + 2*OLy )        INTEGER resh_i( sNx + 2*OLx + sNy + 2*OLy )
122    #ifdef HAVE_STAT
123          integer ntotenc, ncenc, nbytes, fs_isdone
124          character*(200) cenc
125          integer ienc(200)
126          REAL*8  fsnu
127    #endif
128    
129  C     Functions  C     Functions
130        integer IFNBLNK, ILNBLNK        integer IFNBLNK, ILNBLNK
# Line 140  C     group (or base) name Line 146  C     group (or base) name
146        ENDIF        ENDIF
147        indu = mnc_cw_fgud(indfg)        indu = mnc_cw_fgud(indfg)
148        iseq = mnc_cw_fgis(indfg)        iseq = mnc_cw_fgis(indfg)
149    C     write(*,*) 'indu,iseq = ', indu, iseq
150    
151  C     Check that the Variable Type exists  C     Check that the Variable Type exists
152        nvf = IFNBLNK(vtype)        nvf = IFNBLNK(vtype)
# Line 170  C     Set the bi,bj indicies Line 177  C     Set the bi,bj indicies
177        DO lbj = bjs,bje        DO lbj = bjs,bje
178          DO lbi = bis,bie          DO lbi = bis,bie
179    
180    #ifdef HAVE_STAT
181              fs_isdone = 0
182    #endif
183     10       CONTINUE
184    
185  C         Create the file name  C         Create the file name
186            CALL MNC_CW_GET_TILE_NUM(lbi,lbj, uniq_tnum, myThid)            CALL MNC_CW_GET_TILE_NUM(lbi,lbj, uniq_tnum, myThid)
187            fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)            fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)
# Line 197  C         Append to an existing or creat Line 209  C         Append to an existing or creat
209            CALL MNC_CW_FILE_AORC(fname, indf, myThid)            CALL MNC_CW_FILE_AORC(fname, indf, myThid)
210            fid = mnc_f_info(indf,2)            fid = mnc_f_info(indf,2)
211    
212    #ifdef HAVE_STAT
213              IF ((mnc_cw_fgig(indfg) .EQ. 1)
214         &         .AND. (fs_isdone .EQ. 0)) THEN
215    C           Decide whether to append to the existing or create a new file
216    C           based on the byte count per unlimited dimension
217                ncenc = 70
218                cenc(1:26)  = 'abcdefghijklmnopqrstuvwxyz'
219                cenc(27:52) = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
220                cenc(53:70) = '0123456789_.,+-=/~'
221                k = nfname
222                IF (k .GT. 200)  k = 200
223                ntotenc = 0
224                DO i = 1,k
225                  DO j = 1,ncenc
226                    IF (fname(i:i) .EQ. cenc(j:j)) THEN
227                      ntotenc = ntotenc + 1
228                      ienc(ntotenc) = j
229                      GOTO 20
230                    ENDIF
231                  ENDDO
232     20           CONTINUE
233                ENDDO
234                CALL mncfsize(ntotenc, ienc, nbytes)
235                IF (nbytes .GT. 0) THEN
236                  CALL MNC_DIM_UNLIM_SIZE(fname, unlim_sz, myThid)
237                  fsnu = (1.0 _d 0 + 1.0 _d 0 / DBLE(unlim_sz))
238         &             * DBLE(nbytes)
239                  IF (fsnu .GT. mnc_max_fsize) THEN
240                    iseq = iseq + 1
241                    indu = 1
242                    mnc_cw_fgud(indfg) = 1
243                    mnc_cw_fgis(indfg) = iseq
244                    fs_isdone = 1
245                    GOTO 10
246                  ENDIF
247                ENDIF
248              ENDIF
249    #endif  /*  HAVE_STAT  */
250    
251  C         Ensure that all the NetCDF dimensions are defined and create a  C         Ensure that all the NetCDF dimensions are defined and create a
252  C         local copy of them  C         local copy of them
253            DO i = 1,9            DO i = 1,9
# Line 233  C         Ensure that the variable is de Line 284  C         Ensure that the variable is de
284                idv = mnc_fv_ids(indf,j+1)                idv = mnc_fv_ids(indf,j+1)
285                indvids = mnc_fd_ind(indf, mnc_f_info(indf,                indvids = mnc_fd_ind(indf, mnc_f_info(indf,
286       &             (mnc_fv_ids(indf,j+2) + 1)) )       &             (mnc_fv_ids(indf,j+2) + 1)) )
287                GOTO 10                GOTO 30
288              ENDIF              ENDIF
289            ENDDO            ENDDO
290            write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W ERROR: ',            write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W ERROR: ',
291       &         'cannot reference variable ''', vtype, ''''       &         'cannot reference variable ''', vtype, ''''
292            CALL print_error(msgbuf, mythid)            CALL print_error(msgbuf, mythid)
293            STOP 'ABNORMAL END: package MNC'            STOP 'ABNORMAL END: package MNC'
294   10       CONTINUE   30       CONTINUE
295    
296  C         Check for bi,bj indicies  C         Check for bi,bj indicies
297            bidim = mnc_cw_vbij(1,indv)            bidim = mnc_cw_vbij(1,indv)

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.22