/[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.31 by edhill, Mon Jun 27 20:19:52 2005 UTC revision 1.35 by edhill, Fri Feb 24 20:39:10 2006 UTC
# Line 93  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_SIZE.h"  #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"
# Line 107  CEOP Line 107  CEOP
107    
108  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
109        integer i,j,k, indv,nvf,nvl, n1,n2, igrid, ntot, indu        integer i,j,k, indv,nvf,nvl, n1,n2, igrid, ntot, indu
110        integer bis,bie, bjs,bje, uniq_tnum, nfname, iseq        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 117  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          character*(MNC_MAX_CHAR) tmpnm
121          REAL*8  dval, dvm(2)
122          REAL*4  rval, rvm(2)
123          INTEGER ival, ivm(2), irv
124        REAL*8  resh_d( MNC_MAX_BUFF )        REAL*8  resh_d( MNC_MAX_BUFF )
125        REAL*4  resh_r( MNC_MAX_BUFF )        REAL*4  resh_r( MNC_MAX_BUFF )
126        INTEGER resh_i( MNC_MAX_BUFF )        INTEGER resh_i( MNC_MAX_BUFF )
127          LOGICAL write_attributes, use_missing
128  #ifdef HAVE_STAT  #ifdef HAVE_STAT
129        integer ntotenc, ncenc, nbytes, fs_isdone        integer ntotenc, ncenc, nbytes, fs_isdone
130        character*(200) cenc        character*(200) cenc
# Line 188  C         Create the file name Line 193  C         Create the file name
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
# Line 204  C         Create the file name Line 212  C         Create the file name
212              nfname = ntot + 14              nfname = ntot + 14
213            ENDIF            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
244              path_fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)              path_fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR)
# Line 249  C           file based on the byte count Line 284  C           file based on the byte count
284  C               Delete the now-full fname from the lookup tables since  C               Delete the now-full fname from the lookup tables since
285  C               we are all done writing to it.  C               we are all done writing to it.
286                  CALL MNC_FILE_CLOSE(fname, myThid)                  CALL MNC_FILE_CLOSE(fname, myThid)
                 iseq = iseq + 1  
287                  indu = 1                  indu = 1
288                  mnc_cw_fgud(indfg) = 1                  mnc_cw_fgud(indfg) = 1
289    
290    #ifdef MNC_WRITE_OLDNAMES
291                    iseq = iseq + 1
292                  mnc_cw_fgis(indfg) = iseq                  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                  fs_isdone = 1
321                  GOTO 10                  GOTO 10
322    
323                ENDIF                ENDIF
324              ENDIF              ENDIF
325            ENDIF            ENDIF
# Line 283  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 384  C         Check the offsets Line 458  C         Check the offsets
458              ENDIF              ENDIF
459            ENDDO            ENDDO
460    
461  C         Add the per-variable attributes            IF (write_attributes) THEN
462            DO i = 1,mnc_cw_vnat(1,indv)  C           Add the per-variable attributes
463              CALL MNC_VAR_ADD_ATTR_STR( fname, vtype,              DO i = 1,mnc_cw_vnat(1,indv)
464       &           mnc_cw_vtnm(i,indv), mnc_cw_vtat(i,indv), myThid)                CALL MNC_VAR_ADD_ATTR_STR( fname, vtype,
465            ENDDO       &             mnc_cw_vtnm(i,indv), mnc_cw_vtat(i,indv), myThid)
466            DO i = 1,mnc_cw_vnat(2,indv)              ENDDO
467              CALL MNC_VAR_ADD_ATTR_INT( fname, vtype,              DO i = 1,mnc_cw_vnat(2,indv)
468       &           mnc_cw_vinm(i,indv), 1, mnc_cw_viat(i,indv), myThid)                CALL MNC_VAR_ADD_ATTR_INT( fname, vtype,
469            ENDDO       &             mnc_cw_vinm(i,indv), 1, mnc_cw_viat(i,indv), myThid)
470            DO i = 1,mnc_cw_vnat(3,indv)              ENDDO
471              CALL MNC_VAR_ADD_ATTR_DBL( fname, vtype,              DO i = 1,mnc_cw_vnat(3,indv)
472       &           mnc_cw_vdnm(i,indv), 1, mnc_cw_vdat(i,indv), myThid)                CALL MNC_VAR_ADD_ATTR_DBL( fname, vtype,
473            ENDDO       &             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    
# Line 442  C         Write the variable one vector Line 557  C         Write the variable one vector
557        IF (vcount(1) .GT. MNC_MAX_BUFF) THEN        IF (vcount(1) .GT. MNC_MAX_BUFF) THEN
558          write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small',          write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small',
559       &       '--please increase to at least ',       &       '--please increase to at least ',
560       &       vcount(1), ' in ''MNC_SIZE.h'''       &       vcount(1), ' in ''MNC_BUFF.h'''
561          CALL PRINT_ERROR(msgBuf , 1)          CALL PRINT_ERROR(msgBuf , 1)
562          STOP 'ABNORMAL END: S/R MNC_CW_RX_W_OFFSET'          STOP 'ABNORMAL END: S/R MNC_CW_RX_W_OFFSET'
563        ENDIF        ENDIF
564    
565        IF (stype(1:1) .EQ. 'D') THEN        IF (use_missing) THEN
566          DO j1 = s(1),e(1)  
567            k1 = k2 + j1          IF (stype(1:1) .EQ. 'D') THEN
568            kr = kr + 1            DO j1 = s(1),e(1)
569            resh_d(kr) = var(k1)              k1 = k2 + j1
570          ENDDO              kr = kr + 1
571          err = NF_PUT_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d)              dval = var(k1)
572        ENDIF              IF (dval .EQ. dvm(1)) THEN
573        IF (stype(1:1) .EQ. 'R') THEN                resh_d(kr) = dvm(2)
574          DO j1 = s(1),e(1)              ELSE
575            k1 = k2 + j1                resh_d(kr) = dval
576            kr = kr + 1              ENDIF
577            resh_r(kr) = var(k1)            ENDDO
578          ENDDO            err = NF_PUT_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d)
579          err = NF_PUT_VARA_REAL(fid, idv, vstart, vcount, resh_r)          ELSEIF (stype(1:1) .EQ. 'R') THEN
580        ENDIF            DO j1 = s(1),e(1)
581        IF (stype(1:1) .EQ. 'I') THEN              k1 = k2 + j1
582          DO j1 = s(1),e(1)              kr = kr + 1
583            k1 = k2 + j1              rval = var(k1)
584            kr = kr + 1              IF (rval .EQ. rvm(1)) THEN
585            resh_i(kr) = MNC2I( var(k1) )                resh_r(kr) = rvm(2)
586          ENDDO              ELSE
587          err = NF_PUT_VARA_INT(fid, idv, vstart, vcount, resh_i)                resh_r(kr) = rval
588        ENDIF              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 550  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_SIZE.h"  #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"
# Line 563  CEOP Line 719  CEOP
719    
720  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
721        integer i,k, nvf,nvl, n1,n2, igrid, ntot, indu        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, err, lbi,lbj, bidim,bjdim, unlim_sz, kr        integer ndim, err, lbi,lbj, bidim,bjdim, unlim_sz, kr
724        integer ind_vt, npath, unlid        integer ind_vt, npath, unlid, f_or_t, ixoff,iyoff
725  C     integer f_sNx,f_sNy, alen, atype, ind_fv_ids, ierr, indf  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        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( MNC_MAX_BUFF )        REAL*8  resh_d( MNC_MAX_BUFF )
# Line 634  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 673  C           zero sequence number inserte Line 833  C           zero sequence number inserte
833            ENDIF            ENDIF
834            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
835    
836            write(msgbuf,'(6a)')            write(msgbuf,'(5a)')
837       &         'MNC_CW_RX_R: cannot get id for variable ''',       &         'MNC_CW_RX_R: cannot get id for variable ''',
838       &         vtype(nvf:nvl), '''in file ''', fname(1:nfname), ''''       &         vtype(nvf:nvl), '''in file ''', fname(1:nfname), ''''
839            err = NF_INQ_VARID(fid, vtype, idv)            err = NF_INQ_VARID(fid, vtype, idv)
840            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
841              f_or_t = 0
842    
843    #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
879    
880    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
# Line 755  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 828  C         Read the variable one vector a Line 1096  C         Read the variable one vector a
1096        IF (vcount(1) .GT. MNC_MAX_BUFF) THEN        IF (vcount(1) .GT. MNC_MAX_BUFF) THEN
1097          write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small',          write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small',
1098       &       '--please increase to at least ',       &       '--please increase to at least ',
1099       &       vcount(1), ' in ''MNC_SIZE.h'''       &       vcount(1), ' in ''MNC_BUFF.h'''
1100          CALL PRINT_ERROR(msgBuf , 1)          CALL PRINT_ERROR(msgBuf , 1)
1101          STOP 'ABNORMAL END: S/R MNC_CW_RX_R_OFFSET'          STOP 'ABNORMAL END: S/R MNC_CW_RX_R_OFFSET'
1102        ENDIF        ENDIF

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

  ViewVC Help
Powered by ViewVC 1.1.22