/[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.20 by edhill, Fri Oct 8 17:03:21 2004 UTC revision 1.25 by edhill, Sun Nov 14 03:34:35 2004 UTC
# Line 57  C     !USES: Line 57  C     !USES:
57  C     !INPUT PARAMETERS:  C     !INPUT PARAMETERS:
58        integer myThid, bi,bj        integer myThid, bi,bj
59        character*(*) stype, fbname, vtype        character*(*) stype, fbname, vtype
60        __V var        __V var(*)
       __V var_arr(1)  
61        INTEGER offsets(9)        INTEGER offsets(9)
62  CEOP  CEOP
63        INTEGER i        INTEGER i
# Line 66  CEOP Line 65  CEOP
65        DO i = 1,9        DO i = 1,9
66          offsets(i) = 0          offsets(i) = 0
67        ENDDO        ENDDO
68        var_arr(1) = var        CALL MNC_CW_RX_W_OFFSET(stype,fbname,bi,bj,vtype, var,
       CALL MNC_CW_RX_W_OFFSET(stype,fbname,bi,bj,vtype, var_arr,  
69       &     offsets, myThid)       &     offsets, myThid)
70    
71        RETURN        RETURN
# Line 95  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"
97  #include "EEPARAMS.h"  #include "EEPARAMS.h"
98  #include "PARAMS.h"  #include "PARAMS.h"
99  #include "MNC_PARAMS.h"  #include "MNC_PARAMS.h"
# Line 108  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        integer bis,bie, bjs,bje, uniq_tnum, 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 118  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 )        REAL*8  resh_d( MNC_MAX_BUFF )
121        REAL*4  resh_r( sNx + 2*OLx + sNy + 2*OLy )        REAL*4  resh_r( MNC_MAX_BUFF )
122        INTEGER resh_i( sNx + 2*OLx + sNy + 2*OLy )        INTEGER resh_i( MNC_MAX_BUFF )
123    #ifdef HAVE_STAT
124          integer ntotenc, ncenc, nbytes, fs_isdone
125          character*(200) cenc
126          integer ienc(200)
127          REAL*8  fsnu
128    #endif
129    
130  C     Functions  C     Functions
131        integer IFNBLNK, ILNBLNK        integer IFNBLNK, ILNBLNK
# Line 141  C     group (or base) name Line 146  C     group (or base) name
146          STOP 'ABNORMAL END: S/R MNC_CW_RX_W'          STOP 'ABNORMAL END: S/R MNC_CW_RX_W'
147        ENDIF        ENDIF
148        indu = mnc_cw_fgud(indfg)        indu = mnc_cw_fgud(indfg)
149          iseq = mnc_cw_fgis(indfg)
150    C     write(*,*) 'indu,iseq = ', indu, iseq
151    
152  C     Check that the Variable Type exists  C     Check that the Variable Type exists
153        nvf = IFNBLNK(vtype)        nvf = IFNBLNK(vtype)
# Line 171  C     Set the bi,bj indicies Line 178  C     Set the bi,bj indicies
178        DO lbj = bjs,bje        DO lbj = bjs,bje
179          DO lbi = bis,bie          DO lbi = bis,bie
180    
181    #ifdef HAVE_STAT
182              fs_isdone = 0
183    #endif
184     10       CONTINUE
185    
186  C         Create the file name  C         Create the file name
187            CALL MNC_CW_GET_TILE_NUM(lbi,lbj, uniq_tnum, myThid)            CALL MNC_CW_GET_TILE_NUM(lbi,lbj, uniq_tnum, myThid)
188            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 180  C         Create the file name Line 192  C         Create the file name
192            fname(1:ntot) = fbname(n1:n2)            fname(1:ntot) = fbname(n1:n2)
193            ntot = ntot + 1            ntot = ntot + 1
194            fname(ntot:ntot) = '.'            fname(ntot:ntot) = '.'
195            write(fname((ntot+1):(ntot+9)),'(i6.6,a3)') uniq_tnum, '.nc'            write(fname((ntot+1):(ntot+14)),'(i4.4,a1,i6.6,a3)')
196            nfname = ntot+9       &         iseq,'.',uniq_tnum, '.nc'
197              nfname = ntot + 14
198    
199  C         Add the path to the file name  C         Add the path to the file name
200            IF (mnc_use_outdir) THEN            IF (mnc_use_outdir) THEN
# Line 197  C         Append to an existing or creat Line 210  C         Append to an existing or creat
210            CALL MNC_CW_FILE_AORC(fname, indf, myThid)            CALL MNC_CW_FILE_AORC(fname, indf, myThid)
211            fid = mnc_f_info(indf,2)            fid = mnc_f_info(indf,2)
212    
213    #ifdef HAVE_STAT
214              IF ((mnc_cw_fgig(indfg) .EQ. 1)
215         &         .AND. (fs_isdone .EQ. 0)) THEN
216    C           Decide whether to append to the existing or create a new file
217    C           based on the byte count per unlimited dimension
218                ncenc = 70
219                cenc(1:26)  = 'abcdefghijklmnopqrstuvwxyz'
220                cenc(27:52) = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
221                cenc(53:70) = '0123456789_.,+-=/~'
222                k = nfname
223                IF (k .GT. 200)  k = 200
224                ntotenc = 0
225                DO i = 1,k
226                  DO j = 1,ncenc
227                    IF (fname(i:i) .EQ. cenc(j:j)) THEN
228                      ntotenc = ntotenc + 1
229                      ienc(ntotenc) = j
230                      GOTO 20
231                    ENDIF
232                  ENDDO
233     20           CONTINUE
234                ENDDO
235                CALL mncfsize(ntotenc, ienc, nbytes)
236                IF (nbytes .GT. 0) THEN
237                  CALL MNC_DIM_UNLIM_SIZE(fname, unlim_sz, myThid)
238                  fsnu = (1.0 _d 0 + 1.0 _d 0 / DBLE(unlim_sz))
239         &             * DBLE(nbytes)
240                  IF (fsnu .GT. mnc_max_fsize) THEN
241    C               Delete the now-full fname from the lookup tables since
242    C               we are all done writing to it.
243                    CALL MNC_FILE_CLOSE(fname, myThid)
244                    iseq = iseq + 1
245                    indu = 1
246                    mnc_cw_fgud(indfg) = 1
247                    mnc_cw_fgis(indfg) = iseq
248                    fs_isdone = 1
249                    GOTO 10
250                  ENDIF
251                ENDIF
252              ENDIF
253    #endif  /*  HAVE_STAT  */
254    
255  C         Ensure that all the NetCDF dimensions are defined and create a  C         Ensure that all the NetCDF dimensions are defined and create a
256  C         local copy of them  C         local copy of them
257            DO i = 1,9            DO i = 1,9
# Line 233  C         Ensure that the variable is de Line 288  C         Ensure that the variable is de
288                idv = mnc_fv_ids(indf,j+1)                idv = mnc_fv_ids(indf,j+1)
289                indvids = mnc_fd_ind(indf, mnc_f_info(indf,                indvids = mnc_fd_ind(indf, mnc_f_info(indf,
290       &             (mnc_fv_ids(indf,j+2) + 1)) )       &             (mnc_fv_ids(indf,j+2) + 1)) )
291                GOTO 10                GOTO 30
292              ENDIF              ENDIF
293            ENDDO            ENDDO
294            write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W ERROR: ',            write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W ERROR: ',
295       &         'cannot reference variable ''', vtype, ''''       &         'cannot reference variable ''', vtype, ''''
296            CALL print_error(msgbuf, mythid)            CALL print_error(msgbuf, mythid)
297            STOP 'ABNORMAL END: package MNC'            STOP 'ABNORMAL END: package MNC'
298   10       CONTINUE   30       CONTINUE
299    
300  C         Check for bi,bj indicies  C         Check for bi,bj indicies
301            bidim = mnc_cw_vbij(1,indv)            bidim = mnc_cw_vbij(1,indv)
# Line 376  C         Write the variable one vector Line 431  C         Write the variable one vector
431        vstart(1) = udo(1) + 1        vstart(1) = udo(1) + 1
432        vcount(1) = e(1) - s(1) + 1        vcount(1) = e(1) - s(1) + 1
433    
434          IF (vcount(1) .GT. MNC_MAX_BUFF) THEN
435            write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small',
436         &       '--please increase to at least ',
437         &       vcount(1), ' in ''MNC_SIZE.h'''
438            CALL PRINT_ERROR(msgBuf , 1)
439            STOP 'ABNORMAL END: S/R MNC_CW_RX_W_OFFSET'
440          ENDIF
441    
442        IF (stype(1:1) .EQ. 'D') THEN        IF (stype(1:1) .EQ. 'D') THEN
443          DO j1 = s(1),e(1)          DO j1 = s(1),e(1)
444            k1 = k2 + j1            k1 = k2 + j1
# Line 479  C     !USES: Line 542  C     !USES:
542  #include "netcdf.inc"  #include "netcdf.inc"
543  #include "mnc_common.h"  #include "mnc_common.h"
544  #include "SIZE.h"  #include "SIZE.h"
545    #include "MNC_SIZE.h"
546  #include "EEPARAMS.h"  #include "EEPARAMS.h"
547  #include "PARAMS.h"  #include "PARAMS.h"
548  #include "MNC_PARAMS.h"  #include "MNC_PARAMS.h"
# Line 501  C     !LOCAL VARIABLES: Line 565  C     !LOCAL VARIABLES:
565        character*(MNC_MAX_CHAR) fname        character*(MNC_MAX_CHAR) fname
566        character*(MNC_MAX_CHAR) path_fname        character*(MNC_MAX_CHAR) path_fname
567        integer indfg, fg1,fg2        integer indfg, fg1,fg2
568        REAL*8  resh_d( sNx + 2*OLx + sNy + 2*OLy )        REAL*8  resh_d( MNC_MAX_BUFF )
569        REAL*4  resh_r( sNx + 2*OLx + sNy + 2*OLy )        REAL*4  resh_r( MNC_MAX_BUFF )
570        INTEGER resh_i( sNx + 2*OLx + sNy + 2*OLy )        INTEGER resh_i( MNC_MAX_BUFF )
571    
572  C     Functions  C     Functions
573        integer IFNBLNK, ILNBLNK        integer IFNBLNK, ILNBLNK
# Line 737  C         Read the variable one vector a Line 801  C         Read the variable one vector a
801        kr = 0        kr = 0
802        vstart(1) = udo(1) + 1        vstart(1) = udo(1) + 1
803        vcount(1) = e(1) - s(1) + 1        vcount(1) = e(1) - s(1) + 1
804          
805          IF (vcount(1) .GT. MNC_MAX_BUFF) THEN
806            write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small',
807         &       '--please increase to at least ',
808         &       vcount(1), ' in ''MNC_SIZE.h'''
809            CALL PRINT_ERROR(msgBuf , 1)
810            STOP 'ABNORMAL END: S/R MNC_CW_RX_R_OFFSET'
811          ENDIF
812    
813        IF (stype(1:1) .EQ. 'D') THEN        IF (stype(1:1) .EQ. 'D') THEN
814          err = NF_GET_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d)          err = NF_GET_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d)
815          CALL MNC_HANDLE_ERR(err, msgbuf, myThid)          CALL MNC_HANDLE_ERR(err, msgbuf, myThid)

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.22