/[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.19 by edhill, Thu Oct 7 01:48:08 2004 UTC revision 1.35 by edhill, Fri Feb 24 20:39:10 2006 UTC
# Line 23  C     !USES: Line 23  C     !USES:
23        implicit none        implicit none
24    
25  C     !INPUT PARAMETERS:  C     !INPUT PARAMETERS:
26        integer myThid, bi,bj, indu        integer myThid, bi,bj
27        character*(*) stype, fbname, vtype        character*(*) stype, fbname, vtype
28        __V var        __V var
29        __V var_arr(1)        __V var_arr(1)
# Line 48  C !INTERFACE: Line 48  C !INTERFACE:
48       I     myThid )       I     myThid )
49    
50  C     !DESCRIPTION:  C     !DESCRIPTION:
51    C     A scalar version of MNC_CW_RX_W() for compilers that cannot
52    C     gracefully handle the conversion on their own.
53          
54    C     !USES:
55          implicit none
56    
57    C     !INPUT PARAMETERS:
58          integer myThid, bi,bj
59          character*(*) stype, fbname, vtype
60          __V var(*)
61          INTEGER offsets(9)
62    CEOP
63          INTEGER i
64    
65          DO i = 1,9
66            offsets(i) = 0
67          ENDDO
68          CALL MNC_CW_RX_W_OFFSET(stype,fbname,bi,bj,vtype, var,
69         &     offsets, myThid)
70    
71          RETURN
72          END
73    
74    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
75    CBOP 0
76    C !ROUTINE: MNC_CW_RX_W_OFFSET
77    
78    C !INTERFACE:
79          SUBROUTINE MNC_CW_RX_W_OFFSET(
80         I     stype,
81         I     fbname, bi,bj,
82         I     vtype,
83         I     var,
84         I     offsets,
85         I     myThid )
86    
87    C     !DESCRIPTION:
88  C     This subroutine writes one variable to a file or a file group,  C     This subroutine writes one variable to a file or a file group,
89  C     depending upon the tile indicies.  C     depending upon the tile indicies.
90                
# Line 56  C     !USES: Line 93  C     !USES:
93  #include "netcdf.inc"  #include "netcdf.inc"
94  #include "mnc_common.h"  #include "mnc_common.h"
95  #include "SIZE.h"  #include "SIZE.h"
96    #include "MNC_BUFF.h"
97  #include "EEPARAMS.h"  #include "EEPARAMS.h"
98  #include "PARAMS.h"  #include "PARAMS.h"
99  #include "MNC_PARAMS.h"  #include "MNC_PARAMS.h"
100    
101  C     !INPUT PARAMETERS:  C     !INPUT PARAMETERS:
102        integer myThid, bi,bj, indu        integer myThid, bi,bj
103        character*(*) stype, fbname, vtype        character*(*) stype, fbname, vtype
104        __V var(*)        __V var(*)
105          INTEGER offsets(*)
106  CEOP  CEOP
107    
108  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
109        integer i,j,k, indv,nvf,nvl, n1,n2, igrid, ntot        integer i,j,k, indv,nvf,nvl, n1,n2, igrid, ntot, indu
110        integer bis,bie, bjs,bje, uniq_tnum, nfname        integer bis,bie, bjs,bje, uniq_tnum, uniq_fnum, nfname, iseq
111        integer fid, idv, indvids, ndim, indf, err        integer fid, idv, indvids, ndim, indf, err
112        integer lbi,lbj, bidim,bjdim, unlim_sz, kr        integer lbi,lbj, bidim,bjdim, unlim_sz, kr
113        integer p(9),s(9),e(9), dimnc(9)        integer p(9),s(9),e(9), dimnc(9)
# Line 78  C     !LOCAL VARIABLES: Line 117  C     !LOCAL VARIABLES:
117        character*(MAX_LEN_MBUF) msgbuf        character*(MAX_LEN_MBUF) msgbuf
118        character*(MNC_MAX_CHAR) fname        character*(MNC_MAX_CHAR) fname
119        character*(MNC_MAX_CHAR) path_fname        character*(MNC_MAX_CHAR) path_fname
120        REAL*8  resh_d( sNx + 2*OLx + sNy + 2*OLy )        character*(MNC_MAX_CHAR) tmpnm
121        REAL*4  resh_r( sNx + 2*OLx + sNy + 2*OLy )        REAL*8  dval, dvm(2)
122        INTEGER resh_i( sNx + 2*OLx + sNy + 2*OLy )        REAL*4  rval, rvm(2)
123          INTEGER ival, ivm(2), irv
124          REAL*8  resh_d( MNC_MAX_BUFF )
125          REAL*4  resh_r( MNC_MAX_BUFF )
126          INTEGER resh_i( MNC_MAX_BUFF )
127          LOGICAL write_attributes, use_missing
128    #ifdef HAVE_STAT
129          integer ntotenc, ncenc, nbytes, fs_isdone
130          character*(200) cenc
131          integer ienc(200)
132          REAL*8  fsnu
133    #endif
134    
135  C     Functions  C     Functions
136        integer IFNBLNK, ILNBLNK        integer IFNBLNK, ILNBLNK
# Line 101  C     group (or base) name Line 151  C     group (or base) name
151          STOP 'ABNORMAL END: S/R MNC_CW_RX_W'          STOP 'ABNORMAL END: S/R MNC_CW_RX_W'
152        ENDIF        ENDIF
153        indu = mnc_cw_fgud(indfg)        indu = mnc_cw_fgud(indfg)
154          iseq = mnc_cw_fgis(indfg)
155    C     write(*,*) 'indu,iseq = ', indu, iseq
156    
157  C     Check that the Variable Type exists  C     Check that the Variable Type exists
158        nvf = IFNBLNK(vtype)        nvf = IFNBLNK(vtype)
# Line 131  C     Set the bi,bj indicies Line 183  C     Set the bi,bj indicies
183        DO lbj = bjs,bje        DO lbj = bjs,bje
184          DO lbi = bis,bie          DO lbi = bis,bie
185    
186    #ifdef HAVE_STAT
187              fs_isdone = 0
188    #endif
189     10       CONTINUE
190    
191  C         Create the file name  C         Create the file name
192            CALL MNC_CW_GET_TILE_NUM(lbi,lbj, uniq_tnum, myThid)            CALL MNC_CW_GET_TILE_NUM(lbi,lbj, uniq_tnum, myThid)
193            fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)            fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)
194            n1 = IFNBLNK(fbname)            n1 = IFNBLNK(fbname)
195            n2 = ILNBLNK(fbname)            n2 = ILNBLNK(fbname)
196    
197    #ifdef MNC_WRITE_OLDNAMES
198    
199            ntot = n2 - n1 + 1            ntot = n2 - n1 + 1
200            fname(1:ntot) = fbname(n1:n2)            fname(1:ntot) = fbname(n1:n2)
201            ntot = ntot + 1            ntot = ntot + 1
202            fname(ntot:ntot) = '.'            fname(ntot:ntot) = '.'
203            write(fname((ntot+1):(ntot+9)),'(i6.6,a3)') uniq_tnum, '.nc'            IF ( mnc_use_name_ni0 ) THEN
204            nfname = ntot+9              write(fname((ntot+1):(ntot+17)),'(i10.10,a1,i6.6)')
205         &           nIter0,'.',uniq_tnum
206                write(fname((ntot+18):(ntot+25)),'(a1,i4.4,a3)')
207         &           '.', iseq, '.nc'
208                nfname = ntot + 25
209              ELSE
210                write(fname((ntot+1):(ntot+14)),'(i4.4,a1,i6.6,a3)')
211         &           iseq,'.',uniq_tnum, '.nc'
212                nfname = ntot + 14
213              ENDIF
214    
215    #else
216    
217              CALL MNC_PSNCM(tmpnm, uniq_tnum, MNC_DEF_TMNC)
218              k = ILNBLNK(tmpnm)
219              IF ( mnc_cw_cit(1,mnc_cw_fgci(indfg)) .GT. -1 ) THEN
220                j = mnc_cw_cit(2,mnc_cw_fgci(indfg))
221                IF ( mnc_cw_fgis(indfg) .GT. j )
222         &           j = mnc_cw_fgis(indfg)
223                write(fname,'(a,a1,i10.10,a2,a,a3)') fbname(n1:n2),
224         &           '.', j, '.t', tmpnm(1:k), '.nc'
225              ELSEIF ( mnc_cw_cit(1,mnc_cw_fgci(indfg)) .EQ. -1 ) THEN
226    C           Leave off the myIter value entirely
227                write(fname,'(a,a2,a,a3)') fbname(n1:n2), '.t',
228         &           tmpnm(1:k),'.nc'
229              ELSE
230    C           We have an error--bad flag value
231                write(msgbuf,'(4a)')
232         &           'MNC_CW_RX_W ERROR: bad mnc_cw_cit(1,...) ',
233         &           'flag value for base name ''', fbname(fg1:fg2),
234         &           ''''
235                CALL print_error(msgbuf, mythid)
236                STOP 'ABNORMAL END: S/R MNC_CW_RX_W'
237              ENDIF
238              nfname = ILNBLNK(fname)
239    
240    #endif
241    
242  C         Add the path to the file name  C         Add the path to the file name
243            IF (mnc_use_outdir) THEN            IF (mnc_use_outdir) THEN
# Line 154  C         Add the path to the file name Line 250  C         Add the path to the file name
250            ENDIF            ENDIF
251    
252  C         Append to an existing or create a new file  C         Append to an existing or create a new file
253            CALL MNC_CW_FILE_AORC(fname, indf, myThid)            CALL MNC_CW_FILE_AORC(fname,indf, lbi,lbj,uniq_tnum, myThid)
254            fid = mnc_f_info(indf,2)            fid = mnc_f_info(indf,2)
255    
256    #ifdef HAVE_STAT
257              IF ((mnc_cw_fgig(indfg) .EQ. 1)
258         &         .AND. (fs_isdone .EQ. 0)) THEN
259    C           Decide whether to append to the existing or create a new
260    C           file based on the byte count per unlimited dimension
261                ncenc = 70
262                cenc(1:26)  = 'abcdefghijklmnopqrstuvwxyz'
263                cenc(27:52) = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
264                cenc(53:70) = '0123456789_.,+-=/~'
265                k = nfname
266                IF (k .GT. 200)  k = 200
267                ntotenc = 0
268                DO i = 1,k
269                  DO j = 1,ncenc
270                    IF (fname(i:i) .EQ. cenc(j:j)) THEN
271                      ntotenc = ntotenc + 1
272                      ienc(ntotenc) = j
273                      GOTO 20
274                    ENDIF
275                  ENDDO
276     20           CONTINUE
277                ENDDO
278                CALL mncfsize(ntotenc, ienc, nbytes)
279                IF (nbytes .GT. 0) THEN
280                  CALL MNC_DIM_UNLIM_SIZE(fname, unlim_sz, myThid)
281                  fsnu = (1.0 _d 0 + 1.0 _d 0 / DBLE(unlim_sz))
282         &             * DBLE(nbytes)
283                  IF (fsnu .GT. mnc_max_fsize) THEN
284    C               Delete the now-full fname from the lookup tables since
285    C               we are all done writing to it.
286                    CALL MNC_FILE_CLOSE(fname, myThid)
287                    indu = 1
288                    mnc_cw_fgud(indfg) = 1
289    
290    #ifdef MNC_WRITE_OLDNAMES
291                    iseq = iseq + 1
292                    mnc_cw_fgis(indfg) = iseq
293    #else
294                    IF (mnc_cw_cit(1,mnc_cw_fgci(indfg)) .LT. 0) THEN
295                      write(msgbuf,'(5a)')
296         &            'MNC_CW_RX_W ERROR: output file for base name ''',
297         &            fbname(fg1:fg2), ''' is about to exceed the max ',
298         &            'file size and is NOT ALLOWED an iteration value ',
299         &            'within its file name'
300                      CALL print_error(msgbuf, mythid)
301                      STOP 'ABNORMAL END: S/R MNC_CW_RX_W'
302                    ELSEIF (mnc_cw_cit(3,mnc_cw_fgci(indfg)) .LT. 0) THEN
303                      write(msgbuf,'(5a)')
304         &            'MNC_CW_RX_W ERROR: output file for base name ''',
305         &            fbname(fg1:fg2), ''' is about to exceed the max ',
306         &            'file size and no next-iter has been specified--',
307         &            'please see the MNC CITER functions'
308                      CALL print_error(msgbuf, mythid)
309                      STOP 'ABNORMAL END: S/R MNC_CW_RX_W'
310                    ENDIF
311                    mnc_cw_fgis(indfg) = mnc_cw_cit(3,mnc_cw_fgci(indfg))
312    C               DO NOT BUMP THE CURRENT ITER FOR ALL FILES IN THIS CITER
313    C               GROUP SINCE THIS IS ONLY GROWTH TO AVOID FILE SIZE
314    C               LIMITS FOR THIS ONE BASENAME GROUP, NOT GROWTH OF THE
315    C               ENTIRE CITER GROUP !!!
316    C               mnc_cw_cit(2,mnc_cw_fgci(indfg))
317    C               &   = mnc_cw_cit(3,mnc_cw_fgci(indfg))
318    C               mnc_cw_cit(3,mnc_cw_fgci(indfg)) = -1
319    #endif
320                    fs_isdone = 1
321                    GOTO 10
322    
323                  ENDIF
324                ENDIF
325              ENDIF
326    #endif  /*  HAVE_STAT  */
327    
328  C         Ensure that all the NetCDF dimensions are defined and create a  C         Ensure that all the NetCDF dimensions are defined and create a
329  C         local copy of them  C         local copy of them
330            DO i = 1,9            DO i = 1,9
# Line 168  C         local copy of them Line 336  C         local copy of them
336              ELSE              ELSE
337                dimnc(i) = mnc_cw_ie(i,igrid) - mnc_cw_is(i,igrid) + 1                dimnc(i) = mnc_cw_ie(i,igrid) - mnc_cw_is(i,igrid) + 1
338              ENDIF              ENDIF
339              CALL MNC_DIM_INIT(fname,  
340       &           mnc_cw_dn(i,igrid), dimnc(i), myThid)  C           Add the coordinate variables
341                CALL MNC_DIM_INIT_ALL_CV(fname,
342         &           mnc_cw_dn(i,igrid), dimnc(i), 'Y', lbi,lbj, myThid)
343    
344            ENDDO            ENDDO
345    
346  C         Ensure that the "grid" is defined  C         Ensure that the "grid" is defined
# Line 177  C         Ensure that the "grid" is defi Line 348  C         Ensure that the "grid" is defi
348       &        mnc_cw_ndim(igrid), mnc_cw_dn(1,igrid), myThid)       &        mnc_cw_ndim(igrid), mnc_cw_dn(1,igrid), myThid)
349    
350  C         Ensure that the variable is defined  C         Ensure that the variable is defined
351              irv = 0
352            IF (stype(1:1) .EQ. 'D')            IF (stype(1:1) .EQ. 'D')
353       &         CALL MNC_VAR_INIT_DBL(       &         CALL MNC_VAR_INIT_DBL(
354       &         fname, mnc_cw_gname(igrid), vtype, myThid)       &         fname, mnc_cw_gname(igrid), vtype, irv, myThid)
355            IF (stype(1:1) .EQ. 'R')            IF (stype(1:1) .EQ. 'R')
356       &         CALL MNC_VAR_INIT_REAL(       &         CALL MNC_VAR_INIT_REAL(
357       &         fname, mnc_cw_gname(igrid), vtype, myThid)       &         fname, mnc_cw_gname(igrid), vtype, irv, myThid)
358            IF (stype(1:1) .EQ. 'I')            IF (stype(1:1) .EQ. 'I')
359       &         CALL MNC_VAR_INIT_INT(       &         CALL MNC_VAR_INIT_INT(
360       &         fname, mnc_cw_gname(igrid), vtype, myThid)       &         fname, mnc_cw_gname(igrid), vtype, irv, myThid)
361    
362              IF (irv .GT. 0) THEN
363    C           Return value indicates that the variable did not previously
364    C           exist in this file, so we need to write all the attributes
365                write_attributes = .TRUE.
366              ELSE
367                write_attributes = .FALSE.
368              ENDIF
369    
370            DO i = 1,mnc_fv_ids(indf,1)            DO i = 1,mnc_fv_ids(indf,1)
371              j = 2 + 3*(i - 1)              j = 2 + 3*(i - 1)
# Line 193  C         Ensure that the variable is de Line 373  C         Ensure that the variable is de
373                idv = mnc_fv_ids(indf,j+1)                idv = mnc_fv_ids(indf,j+1)
374                indvids = mnc_fd_ind(indf, mnc_f_info(indf,                indvids = mnc_fd_ind(indf, mnc_f_info(indf,
375       &             (mnc_fv_ids(indf,j+2) + 1)) )       &             (mnc_fv_ids(indf,j+2) + 1)) )
376                GOTO 10                GOTO 30
377              ENDIF              ENDIF
378            ENDDO            ENDDO
379            write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W ERROR: ',            write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W ERROR: ',
380       &         'cannot reference variable ''', vtype, ''''       &         'cannot reference variable ''', vtype, ''''
381            CALL print_error(msgbuf, mythid)            CALL print_error(msgbuf, mythid)
382            STOP 'ABNORMAL END: package MNC'            STOP 'ABNORMAL END: package MNC'
383   10       CONTINUE   30       CONTINUE
384    
385  C         Check for bi,bj indicies  C         Check for bi,bj indicies
386            bidim = mnc_cw_vbij(1,indv)            bidim = mnc_cw_vbij(1,indv)
# Line 227  C         Set the dimensions for the in- Line 407  C         Set the dimensions for the in-
407              ELSE              ELSE
408                p(i) = k * p(i-1)                p(i) = k * p(i-1)
409              ENDIF              ENDIF
410                IF (offsets(i) .GT. 0) THEN
411                  k = 1
412                  p(i) = k * p(i-1)
413                ENDIF
414            ENDDO            ENDDO
415    
416  C         Set starting and ending indicies for the in-memory array and  C         Set starting and ending indicies for the in-memory array and
# Line 264  C               Use the current unlimite Line 448  C               Use the current unlimite
448              s(bjdim) = lbj              s(bjdim) = lbj
449              e(bjdim) = lbj              e(bjdim) = lbj
450            ENDIF            ENDIF
451  CEH3      DO i = 1,9            
452  CEH3        write(*,*) 'i,p(i),s(i),e(i) = ', i,p(i),s(i),e(i)  C         Check the offsets
453  CEH3      ENDDO            DO i = 1,9
454                IF (offsets(i) .GT. 0) THEN
455  C         Add the global attributes                udo(i) = udo(i) + offsets(i) - 1
456            CALL MNC_CW_SET_GATTR( fname, lbi,lbj, uniq_tnum, myThid)                s(i) = 1
457                  e(i) = 1
458  C         Add the per-variable attributes              ENDIF
           DO i = 1,mnc_cw_vnat(1,indv)  
             CALL MNC_VAR_ADD_ATTR_STR( fname, vtype,  
      &           mnc_cw_vtnm(i,indv), mnc_cw_vtat(i,indv), myThid)  
           ENDDO  
           DO i = 1,mnc_cw_vnat(2,indv)  
             CALL MNC_VAR_ADD_ATTR_INT( fname, vtype,  
      &           mnc_cw_vinm(i,indv), 1, mnc_cw_viat(i,indv), myThid)  
           ENDDO  
           DO i = 1,mnc_cw_vnat(3,indv)  
             CALL MNC_VAR_ADD_ATTR_DBL( fname, vtype,  
      &           mnc_cw_vdnm(i,indv), 1, mnc_cw_vdat(i,indv), myThid)  
459            ENDDO            ENDDO
460    
461              IF (write_attributes) THEN
462    C           Add the per-variable attributes
463                DO i = 1,mnc_cw_vnat(1,indv)
464                  CALL MNC_VAR_ADD_ATTR_STR( fname, vtype,
465         &             mnc_cw_vtnm(i,indv), mnc_cw_vtat(i,indv), myThid)
466                ENDDO
467                DO i = 1,mnc_cw_vnat(2,indv)
468                  CALL MNC_VAR_ADD_ATTR_INT( fname, vtype,
469         &             mnc_cw_vinm(i,indv), 1, mnc_cw_viat(i,indv), myThid)
470                ENDDO
471                DO i = 1,mnc_cw_vnat(3,indv)
472                  CALL MNC_VAR_ADD_ATTR_DBL( fname, vtype,
473         &             mnc_cw_vdnm(i,indv), 1, mnc_cw_vdat(i,indv), myThid)
474                ENDDO
475              ENDIF
476    
477    C         Handle missing values
478              use_missing = .FALSE.
479              IF (mnc_cw_vfmv(indv) .EQ. 0) THEN
480                use_missing = .FALSE.
481              ELSE
482                IF (mnc_cw_vfmv(indv) .EQ. 1) THEN
483                  use_missing = .TRUE.
484                  dvm(1)  = mnc_def_dmv(1)
485                  dvm(2)  = mnc_def_dmv(2)
486                  rvm(1)  = mnc_def_rmv(1)
487                  rvm(2)  = mnc_def_rmv(2)
488                  ivm(1)  = mnc_def_imv(1)
489                  ivm(2)  = mnc_def_imv(2)
490                ELSEIF (mnc_cw_vfmv(indv) .EQ. 2) THEN
491                  use_missing = .TRUE.
492                  dvm(1)  = mnc_cw_vmvd(1,indv)
493                  dvm(2)  = mnc_cw_vmvd(2,indv)
494                  rvm(1)  = mnc_cw_vmvr(1,indv)
495                  rvm(2)  = mnc_cw_vmvr(2,indv)
496                  ivm(1)  = mnc_cw_vmvi(1,indv)
497                  ivm(2)  = mnc_cw_vmvi(2,indv)
498                ENDIF
499              ENDIF
500              IF (write_attributes .AND. use_missing) THEN
501                write(msgbuf,'(4a)') 'writing attribute ''missing_value''',
502         &           ' within file ''', fname(1:nfname), ''''
503                IF (stype(1:1) .EQ. 'D') THEN
504                  err = NF_PUT_ATT_DOUBLE(fid, idv, 'missing_value',
505         &             NF_DOUBLE, 1, dvm(2))
506                ELSEIF (stype(1:1) .EQ. 'R') THEN
507                  err = NF_PUT_ATT_REAL(fid, idv, 'missing_value',
508         &             NF_FLOAT, 1, dvm(2))
509                ELSEIF (stype(1:1) .EQ. 'I') THEN
510                  err = NF_PUT_ATT_INT(fid, idv, 'missing_value',
511         &             NF_INT, 1, ivm(2))
512                ENDIF
513                CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
514              ENDIF
515    
516            CALL MNC_FILE_ENDDEF(fname, myThid)            CALL MNC_FILE_ENDDEF(fname, myThid)
517    
518            write(msgbuf,'(5a)') 'writing variable type ''',            write(msgbuf,'(5a)') 'writing variable type ''',
519       &         vtype(nvf:nvl), ''' within file ''',       &         vtype(nvf:nvl), ''' within file ''',
520       &         fname(1:nfname), ''''       &         fname(1:nfname), ''''
521    
522    C         DO i = 1,9
523    C         write(*,*) 'i,p(i),s(i),e(i),udo(i),offsets(i) = ',
524    C         &        i,p(i),s(i),e(i),udo(i),offsets(i)
525    C         ENDDO
526    
527  C         Write the variable one vector at a time  C         Write the variable one vector at a time
528            DO j7 = s(7),e(7)            DO j7 = s(7),e(7)
529              k7 = (j7 - 1)*p(6)              k7 = (j7 - 1)*p(6)
# Line 321  C         Write the variable one vector Line 554  C         Write the variable one vector
554        vstart(1) = udo(1) + 1        vstart(1) = udo(1) + 1
555        vcount(1) = e(1) - s(1) + 1        vcount(1) = e(1) - s(1) + 1
556    
557        IF (stype(1:1) .EQ. 'D') THEN        IF (vcount(1) .GT. MNC_MAX_BUFF) THEN
558          DO j1 = s(1),e(1)          write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small',
559            k1 = k2 + j1       &       '--please increase to at least ',
560            kr = kr + 1       &       vcount(1), ' in ''MNC_BUFF.h'''
561            resh_d(kr) = var(k1)          CALL PRINT_ERROR(msgBuf , 1)
562          ENDDO          STOP 'ABNORMAL END: S/R MNC_CW_RX_W_OFFSET'
         err = NF_PUT_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d)  
       ENDIF  
       IF (stype(1:1) .EQ. 'R') THEN  
         DO j1 = s(1),e(1)  
           k1 = k2 + j1  
           kr = kr + 1  
           resh_r(kr) = var(k1)  
         ENDDO  
         err = NF_PUT_VARA_REAL(fid, idv, vstart, vcount, resh_r)  
       ENDIF  
       IF (stype(1:1) .EQ. 'I') THEN  
         DO j1 = s(1),e(1)  
           k1 = k2 + j1  
           kr = kr + 1  
           resh_i(kr) = var(k1)  
         ENDDO  
         err = NF_PUT_VARA_INT(fid, idv, vstart, vcount, resh_i)  
563        ENDIF        ENDIF
564    
565          IF (use_missing) THEN
566    
567            IF (stype(1:1) .EQ. 'D') THEN
568              DO j1 = s(1),e(1)
569                k1 = k2 + j1
570                kr = kr + 1
571                dval = var(k1)
572                IF (dval .EQ. dvm(1)) THEN
573                  resh_d(kr) = dvm(2)
574                ELSE
575                  resh_d(kr) = dval
576                ENDIF
577              ENDDO
578              err = NF_PUT_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d)
579            ELSEIF (stype(1:1) .EQ. 'R') THEN
580              DO j1 = s(1),e(1)
581                k1 = k2 + j1
582                kr = kr + 1
583                rval = var(k1)
584                IF (rval .EQ. rvm(1)) THEN
585                  resh_r(kr) = rvm(2)
586                ELSE
587                  resh_r(kr) = rval
588                ENDIF
589              ENDDO
590              err = NF_PUT_VARA_REAL(fid, idv, vstart, vcount, resh_r)
591            ELSEIF (stype(1:1) .EQ. 'I') THEN
592              DO j1 = s(1),e(1)
593                k1 = k2 + j1
594                kr = kr + 1
595                ival = MNC2I( var(k1) )
596                IF (ival .EQ. ivm(1)) THEN
597                  resh_i(kr) = ivm(2)
598                ELSE
599                  resh_i(kr) = ival
600                ENDIF
601              ENDDO
602              err = NF_PUT_VARA_INT(fid, idv, vstart, vcount, resh_i)
603            ENDIF
604    
605          ELSE
606            
607            IF (stype(1:1) .EQ. 'D') THEN
608              DO j1 = s(1),e(1)
609                k1 = k2 + j1
610                kr = kr + 1
611                resh_d(kr) = var(k1)
612              ENDDO
613              err = NF_PUT_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d)
614            ELSEIF (stype(1:1) .EQ. 'R') THEN
615              DO j1 = s(1),e(1)
616                k1 = k2 + j1
617                kr = kr + 1
618                resh_r(kr) = var(k1)
619              ENDDO
620              err = NF_PUT_VARA_REAL(fid, idv, vstart, vcount, resh_r)
621            ELSEIF (stype(1:1) .EQ. 'I') THEN
622              DO j1 = s(1),e(1)
623                k1 = k2 + j1
624                kr = kr + 1
625                resh_i(kr) = MNC2I( var(k1) )
626              ENDDO
627              err = NF_PUT_VARA_INT(fid, idv, vstart, vcount, resh_i)
628            ENDIF
629    
630          ENDIF
631        CALL MNC_HANDLE_ERR(err, msgbuf, myThid)        CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
632    
633                      ENDDO                      ENDDO
# Line 390  C     !USES: Line 672  C     !USES:
672        implicit none        implicit none
673    
674  C     !INPUT PARAMETERS:  C     !INPUT PARAMETERS:
675        integer myThid, bi,bj, indu        integer myThid, bi,bj
676        character*(*) stype, fbname, vtype        character*(*) stype, fbname, vtype
677        __V var        __V var
678        __V var_arr(1)        __V var_arr(1)
# Line 424  C     !USES: Line 706  C     !USES:
706  #include "netcdf.inc"  #include "netcdf.inc"
707  #include "mnc_common.h"  #include "mnc_common.h"
708  #include "SIZE.h"  #include "SIZE.h"
709    #include "MNC_BUFF.h"
710  #include "EEPARAMS.h"  #include "EEPARAMS.h"
711  #include "PARAMS.h"  #include "PARAMS.h"
712  #include "MNC_PARAMS.h"  #include "MNC_PARAMS.h"
713    
714  C     !INPUT PARAMETERS:  C     !INPUT PARAMETERS:
715        integer myThid, bi,bj, indu        integer myThid, bi,bj
716        character*(*) stype, fbname, vtype        character*(*) stype, fbname, vtype
717        __V var(*)        __V var(*)
718  CEOP  CEOP
719    
720  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
721        integer i,k, nvf,nvl, n1,n2, igrid, ntot        integer i,k, nvf,nvl, n1,n2, igrid, ntot, indu
722        integer bis,bie, bjs,bje, uniq_tnum, nfname, fid, idv        integer bis,bie, bjs,bje, uniq_tnum,uniq_fnum, nfname, fid, idv
723        integer ndim, indf, err, lbi,lbj, bidim,bjdim, unlim_sz, kr        integer ndim, err, lbi,lbj, bidim,bjdim, unlim_sz, kr
724        integer ind_fv_ids, ind_vt, ierr, atype, alen        integer ind_vt, npath, unlid, f_or_t, ixoff,iyoff
725        integer f_sNx,f_sNy, npath  C     integer f_sNx,f_sNy, alen, atype, ind_fv_ids, ierr, indf
726        integer p(9),s(9),e(9), vstart(9),vcount(9), udo(9)        integer p(9),s(9),e(9), vstart(9),vcount(9), udo(9)
727        integer j1,j2,j3,j4,j5,j6,j7, k1,k2,k3,k4,k5,k6,k7        integer j1,j2,j3,j4,j5,j6,j7, k1,k2,k3,k4,k5,k6,k7
728        character*(MAX_LEN_MBUF) msgbuf        character*(MAX_LEN_MBUF) msgbuf
729        character*(MNC_MAX_CHAR) fname        character*(MNC_MAX_CHAR) fname
730          character*(MNC_MAX_CHAR) fname_zs
731          character*(MNC_MAX_CHAR) tmpnm
732        character*(MNC_MAX_CHAR) path_fname        character*(MNC_MAX_CHAR) path_fname
733        integer indfg, fg1,fg2        integer indfg, fg1,fg2
734        REAL*8  resh_d( sNx + 2*OLx + sNy + 2*OLy )        REAL*8  resh_d( MNC_MAX_BUFF )
735        REAL*4  resh_r( sNx + 2*OLx + sNy + 2*OLy )        REAL*4  resh_r( MNC_MAX_BUFF )
736        INTEGER resh_i( sNx + 2*OLx + sNy + 2*OLy )        INTEGER resh_i( MNC_MAX_BUFF )
737    
738  C     Functions  C     Functions
739        integer IFNBLNK, ILNBLNK        integer IFNBLNK, ILNBLNK
# Line 506  C     Set the bi,bj indicies Line 791  C     Set the bi,bj indicies
791  C         Create the file name  C         Create the file name
792            CALL MNC_CW_GET_TILE_NUM( lbi,lbj, uniq_tnum, myThid)            CALL MNC_CW_GET_TILE_NUM( lbi,lbj, uniq_tnum, myThid)
793            fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)            fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)
794    
795    #ifdef MNC_READ_OLDNAMES
796    
797            n1 = IFNBLNK(fbname)            n1 = IFNBLNK(fbname)
798            n2 = ILNBLNK(fbname)            n2 = ILNBLNK(fbname)
799            ntot = n2 - n1 + 1            ntot = n2 - n1 + 1
# Line 525  C         Add the path to the file name Line 813  C         Add the path to the file name
813              nfname = npath + nfname              nfname = npath + nfname
814            ENDIF            ENDIF
815    
816  C         Open the existing file            WRITE(fname_zs,'(2a,i4.4,a1,i6.6,a3)')
817            CALL MNC_FILE_TRY_READ( fname, ierr, indf, myThid)       &         mnc_indir_str(1:npath), fbname(n1:n2),
818         &         0, '.', uniq_tnum, '.nc'
819    
820    C         The steps are:
821    C         (1) open the file in a READ-ONLY mode,
822    C         (2) get the var id for the current variable,
823    C         (3) read the data, and then
824    C         (4) close the file--theres no need to keep it open!
825    
826              write(msgbuf,'(4a)') 'MNC_CW_RX_R: cannot open',
827         &         ' file ''', fname(1:nfname), ''' in read-only mode'
828              err = NF_OPEN(fname, NF_NOWRITE, fid)
829              IF ( err .NE. NF_NOERR ) THEN
830    C           If the initial open fails, try again using a name with a
831    C           zero sequence number inserted
832                err = NF_OPEN(fname_zs, NF_NOWRITE, fid)
833              ENDIF
834              CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
835    
836  C         Check that the variable (VType) is defined within the file            write(msgbuf,'(5a)')
837            CALL MNC_GET_FVINDS( fname, vtype, indf, ind_fv_ids, myThid)       &         'MNC_CW_RX_R: cannot get id for variable ''',
838            IF ((indf .LT. 1) .OR. (ind_fv_ids .LT. 1)) THEN       &         vtype(nvf:nvl), '''in file ''', fname(1:nfname), ''''
839              write(msgbuf,'(4a)') 'MNC_CW_RX_R ERROR: vtype ''',            err = NF_INQ_VARID(fid, vtype, idv)
840       &           vtype(nvf:nvl), ''' is not defined within file ''',            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
841       &           fname(1:nfname)            f_or_t = 0
842              CALL print_error(msgbuf, mythid)  
843              STOP 'ABNORMAL END: S/R MNC_CW_RX_R'  #else
844    
845    C         The sequence for PER-FACE and PER-TILE is:
846    C         (1) check whether a PER-FACE file exists
847    C         .   (a) if only one face is used for the entire domain,
848    C         .       then omit the face index from the file name
849    C         .   (b) if the PER-FACE file exists and is somehow faulty,
850    C         .       then we die with an error message
851    C         (2) if no PER-FACE file exists, then use a PER-TILE file
852    
853    C         Create the PER-FACE file name
854              n1 = IFNBLNK(fbname)
855              n2 = ILNBLNK(fbname)
856    C         Add an iteraton count to the file name if its requested
857              IF (mnc_cw_cit(1,mnc_cw_fgci(indfg)) .LT. 0) THEN
858                WRITE(fname,'(a,a1)') fbname(n1:n2), '.'
859              ELSE
860                WRITE(fname,'(a,a1,i10.10,a1)') fbname(n1:n2), '.',
861         &            mnc_cw_cit(2,mnc_cw_fgci(indfg)), '.'
862              ENDIF
863              ntot = ILNBLNK(fname)
864              path_fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)
865              npath = ILNBLNK(mnc_indir_str)
866    C         Add the face index
867              CALL MNC_CW_GET_FACE_NUM( lbi,lbj, uniq_fnum, myThid)
868              IF ( uniq_fnum .EQ. -1 ) THEN
869    C           There is only one face
870                WRITE(path_fname,'(2a,a2)')
871         &           mnc_indir_str(1:npath), fname(1:ntot), 'nc'
872              ELSE
873                CALL MNC_PSNCM(tmpnm, uniq_fnum, MNC_DEF_FMNC)
874                k = ILNBLNK(tmpnm)
875                WRITE(path_fname,'(2a,a1,a,a3)')
876         &           mnc_indir_str(1:npath), fname(1:ntot), 'f',
877         &           tmpnm(1:k), '.nc'
878            ENDIF            ENDIF
879            fid = mnc_f_info(indf,2)  
880            idv = mnc_fv_ids(indf,ind_fv_ids+1)  C         Try to open the PER-FACE file
881    C         WRITE(*,*) 'trying: "', path_fname, '"'
882              err = NF_OPEN(path_fname, NF_NOWRITE, fid)
883              IF ( err .EQ. NF_NOERR ) THEN
884                f_or_t = 1
885              ELSE
886    
887    C           Create the PER-TILE file name
888                CALL MNC_PSNCM(tmpnm, uniq_tnum, MNC_DEF_TMNC)
889                k = ILNBLNK(tmpnm)
890                path_fname(1:MNC_MAX_CHAR)=mnc_blank_name(1:MNC_MAX_CHAR)
891                WRITE(path_fname,'(2a,a1,a,a3)')
892         &           mnc_indir_str(1:npath), fname(1:ntot), 't',
893         &           tmpnm(1:k), '.nc'
894    C           WRITE(*,*) 'trying: "', path_fname, '"'
895                err = NF_OPEN(path_fname, NF_NOWRITE, fid)
896                IF ( err .EQ. NF_NOERR ) THEN
897                  f_or_t = 0
898                ELSE
899                  k = ILNBLNK(path_fname)
900                  write(msgbuf,'(4a)')
901         &             'MNC_CW_RX_R: cannot open either a per-face or a ',
902         &             'per-tile file: last try was ''', path_fname(1:k),
903         &             ''''
904                  CALL print_error(msgbuf, mythid)
905                  STOP 'ABNORMAL END: S/R MNC_CW_RX_W'
906                ENDIF
907    
908              ENDIF
909    
910              ntot = ILNBLNK(path_fname)
911              write(msgbuf,'(5a)')
912         &         'MNC_CW_RX_R: cannot get netCDF id for variable ''',
913         &         vtype(nvf:nvl), ''' in file ''', path_fname(1:ntot),
914         &         ''''
915              err = NF_INQ_VARID(fid, vtype, idv)
916              CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
917    
918              k = ILNBLNK(path_fname)
919              fname(1:k) = path_fname(1:k)
920              nfname = k
921    
922    #endif
923    
924              IF ( f_or_t .EQ. 1 ) THEN
925    
926    C           write(msgbuf,'(2a)')
927    C           &           'MNC_CW_RX_R: per-face reads are not yet ',
928    C           &           'implemented -- so pester Ed to finish them'
929    C           CALL print_error(msgbuf, mythid)
930    C           STOP 'ABNORMAL END: S/R MNC_CW_RX_W'
931                
932    C           Get the X,Y PER-FACE offsets
933                CALL MNC_CW_GET_XYFO(lbi,lbj, ixoff,iyoff, myThid)
934    
935              ENDIF
936    
937    C         WRITE(*,*) 'f_or_t = ',f_or_t
938    
939  C         Check that the current sNy,sNy values and the in-file values  C         Check that the current sNy,sNy values and the in-file values
940  C         are compatible and WARN (only warn) if not  C         are compatible and WARN (only warn) if not
941            f_sNx = -1  C           f_sNx = -1
942            f_sNy = -1  C           f_sNy = -1
943            err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNx',atype,alen)  C           err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNx',atype,alen)
944            IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN  C           IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN
945              err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNx', f_sNx)  C             err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNx', f_sNx)
946              CALL MNC_HANDLE_ERR(err,  C             CALL MNC_HANDLE_ERR(err,
947       &           'reading attribute ''sNx'' in S/R MNC_CW_RX_R',  C      &           'reading attribute ''sNx'' in S/R MNC_CW_RX_R',
948       &           myThid)  C      &           myThid)
949            ENDIF  C           ENDIF
950            err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNy',atype,alen)  C           err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNy',atype,alen)
951            IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN  C           IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN
952              err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNy', f_sNy)  C             err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNy', f_sNy)
953              CALL MNC_HANDLE_ERR(err,  C             CALL MNC_HANDLE_ERR(err,
954       &           'reading attribute ''sNy'' in S/R MNC_CW_RX_R',  C      &           'reading attribute ''sNy'' in S/R MNC_CW_RX_R',
955       &           myThid)  C      &           myThid)
956            ENDIF  C           ENDIF
957            IF ((f_sNx .NE. sNx) .OR. (f_sNy .NE. sNy)) THEN  C           IF ((f_sNx .NE. sNx) .OR. (f_sNy .NE. sNy)) THEN
958              write(msgbuf,'(5a)') 'MNC_CW_RX_R WARNING: the ',  C             write(msgbuf,'(5a)') 'MNC_CW_RX_R WARNING: the ',
959       &           'attributes ''sNx'' and ''sNy'' within the file ''',  C      &           'attributes ''sNx'' and ''sNy'' within the file ''',
960       &           fname(1:nfname), ''' do not exist or do not match ',  C      &           fname(1:nfname), ''' do not exist or do not match ',
961       &           'the current sizes within the model'  C      &           'the current sizes within the model'
962              CALL print_error(msgbuf, mythid)  C             CALL print_error(msgbuf, mythid)
963            ENDIF  C           ENDIF
964    
965  C         Check that the in-memory variable and the in-file variables  C         Check that the in-memory variable and the in-file variables
966  C         are of compatible sizes  C         are of compatible sizes
# Line 616  C         the unlimited dimension offset Line 1012  C         the unlimited dimension offset
1012              IF (i .LE. ndim) THEN              IF (i .LE. ndim) THEN
1013                s(i) = mnc_cw_is(i,igrid)                s(i) = mnc_cw_is(i,igrid)
1014                e(i) = mnc_cw_ie(i,igrid)                e(i) = mnc_cw_ie(i,igrid)
1015    
1016                  IF ( f_or_t .EQ. 1 ) THEN
1017    C               Add the per-face X,Y offsets to the udo offset vector
1018    C               since they accomplish the same thing
1019                    IF ( mnc_cw_dn(i,igrid)(1:1) .EQ. 'X' ) THEN
1020                      udo(i) = ixoff - 1
1021                    ELSEIF ( mnc_cw_dn(i,igrid)(1:1) .EQ. 'Y' ) THEN
1022                      udo(i) = iyoff - 1
1023                    ENDIF
1024                  ENDIF
1025    
1026              ENDIF              ENDIF
1027  C           Check for the unlimited dimension  C           Check for the unlimited dimension
1028              IF ((i .EQ. ndim)              IF ((i .EQ. ndim)
# Line 623  C           Check for the unlimited dime Line 1030  C           Check for the unlimited dime
1030                IF (indu .GT. 0) THEN                IF (indu .GT. 0) THEN
1031  C               Use the indu value  C               Use the indu value
1032                  udo(i) = indu - 1                  udo(i) = indu - 1
               ELSEIF (indu .EQ. -1) THEN  
 C               Append one to the current unlimited dim size  
                 CALL MNC_DIM_UNLIM_SIZE( fname, unlim_sz, myThid)  
                 udo(i) = unlim_sz  
1033                ELSE                ELSE
1034  C               Use the current unlimited dim size  C               We need the current unlim dim size
1035                  CALL MNC_DIM_UNLIM_SIZE( fname, unlim_sz, myThid)                  write(msgbuf,'(5a)') 'MNC_CW_RX_R: getting the ',
1036                  udo(i) = unlim_sz - 1       &               'unlim dim id within file ''',
1037         &               fname(1:nfname), ''''
1038                    err = NF_INQ_UNLIMDIM(fid, unlid)
1039                    CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
1040                    write(msgbuf,'(5a)') 'MNC_CW_RX_R: getting the ',
1041         &               'unlim dim size within file ''',
1042         &               fname(1:nfname), ''''
1043                    err = NF_INQ_DIMLEN(fid, unlid, unlim_sz)
1044                    CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
1045                    udo(i) = unlim_sz
1046                ENDIF                ENDIF
1047              ENDIF              ENDIF
1048            ENDDO            ENDDO
# Line 647  C     DO i = 9,1,-1 Line 1059  C     DO i = 9,1,-1
1059  C     write(*,*) 'i,p(i),s(i),e(i) = ', i,': ',p(i),s(i),e(i)  C     write(*,*) 'i,p(i),s(i),e(i) = ', i,': ',p(i),s(i),e(i)
1060  C     ENDDO  C     ENDDO
1061                        
           CALL MNC_FILE_ENDDEF(fname, myThid)  
   
1062            write(msgbuf,'(5a)') 'reading variable type ''',            write(msgbuf,'(5a)') 'reading variable type ''',
1063       &         vtype(nvf:nvl), ''' within file ''',       &         vtype(nvf:nvl), ''' within file ''',
1064       &         fname(1:nfname), ''''       &         fname(1:nfname), ''''
# Line 682  C         Read the variable one vector a Line 1092  C         Read the variable one vector a
1092        kr = 0        kr = 0
1093        vstart(1) = udo(1) + 1        vstart(1) = udo(1) + 1
1094        vcount(1) = e(1) - s(1) + 1        vcount(1) = e(1) - s(1) + 1
1095          
1096          IF (vcount(1) .GT. MNC_MAX_BUFF) THEN
1097            write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small',
1098         &       '--please increase to at least ',
1099         &       vcount(1), ' in ''MNC_BUFF.h'''
1100            CALL PRINT_ERROR(msgBuf , 1)
1101            STOP 'ABNORMAL END: S/R MNC_CW_RX_R_OFFSET'
1102          ENDIF
1103    
1104        IF (stype(1:1) .EQ. 'D') THEN        IF (stype(1:1) .EQ. 'D') THEN
1105          err = NF_GET_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d)          err = NF_GET_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d)
1106          CALL MNC_HANDLE_ERR(err, msgbuf, myThid)          CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
1107          DO j1 = s(1),e(1)          DO j1 = s(1),e(1)
1108            k1 = k2 + j1            k1 = k2 + j1
1109            kr = kr + 1            kr = kr + 1
1110            var(k1) = resh_d(kr)            var(k1) = MNCI2( resh_d(kr) )
1111          ENDDO          ENDDO
1112        ENDIF        ENDIF
1113        IF (stype(1:1) .EQ. 'R') THEN        IF (stype(1:1) .EQ. 'R') THEN
# Line 698  C         Read the variable one vector a Line 1116  C         Read the variable one vector a
1116          DO j1 = s(1),e(1)          DO j1 = s(1),e(1)
1117            k1 = k2 + j1            k1 = k2 + j1
1118            kr = kr + 1            kr = kr + 1
1119            var(k1) = resh_r(kr)            var(k1) = MNCI2( resh_r(kr) )
1120          ENDDO          ENDDO
1121        ENDIF        ENDIF
1122        IF (stype(1:1) .EQ. 'I') THEN        IF (stype(1:1) .EQ. 'I') THEN
# Line 711  C         Read the variable one vector a Line 1129  C         Read the variable one vector a
1129          ENDDO          ENDDO
1130        ENDIF        ENDIF
1131    
         
1132    
1133                      ENDDO                      ENDDO
1134                    ENDDO                    ENDDO
# Line 721  C         Read the variable one vector a Line 1138  C         Read the variable one vector a
1138            ENDDO            ENDDO
1139    
1140  C         Close the file  C         Close the file
1141            CALL MNC_FILE_CLOSE(fname, myThid)  C         CALL MNC_FILE_CLOSE(fname, myThid)
1142              err = NF_CLOSE(fid)
1143              write(msgbuf,'(3a)') 'MNC_CW_RX_R:  cannot close file ''',
1144         &         fname(1:nfname), ''''
1145              CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
1146    
1147    
1148  C         End the lbj,lbi loops  C         End the lbj,lbi loops
1149          ENDDO          ENDDO

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.35

  ViewVC Help
Powered by ViewVC 1.1.22