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 |
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 |
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" |
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) |
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 |
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) |
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) |
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 |
207 |
ENDIF |
ENDIF |
208 |
|
|
209 |
C Append to an existing or create a new file |
C Append to an existing or create a new file |
210 |
CALL MNC_CW_FILE_AORC(fname, indf, myThid) |
CALL MNC_CW_FILE_AORC(fname,indf, lbi,lbj,uniq_tnum, 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 |
217 |
|
C file 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 |
265 |
ENDIF |
ENDIF |
266 |
CALL MNC_DIM_INIT(fname, |
CALL MNC_DIM_INIT(fname, |
267 |
& mnc_cw_dn(i,igrid), dimnc(i), myThid) |
& mnc_cw_dn(i,igrid), dimnc(i), myThid) |
268 |
|
|
269 |
|
C Add the coordinate variables |
270 |
|
C CALL MNC_CW_ADD_CVAR(fname, mnc_cw_dn(i,igrid), |
271 |
|
C dimnc(i), myThid) |
272 |
|
|
273 |
ENDDO |
ENDDO |
274 |
|
|
275 |
C Ensure that the "grid" is defined |
C Ensure that the "grid" is defined |
293 |
idv = mnc_fv_ids(indf,j+1) |
idv = mnc_fv_ids(indf,j+1) |
294 |
indvids = mnc_fd_ind(indf, mnc_f_info(indf, |
indvids = mnc_fd_ind(indf, mnc_f_info(indf, |
295 |
& (mnc_fv_ids(indf,j+2) + 1)) ) |
& (mnc_fv_ids(indf,j+2) + 1)) ) |
296 |
GOTO 10 |
GOTO 30 |
297 |
ENDIF |
ENDIF |
298 |
ENDDO |
ENDDO |
299 |
write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W ERROR: ', |
write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W ERROR: ', |
300 |
& 'cannot reference variable ''', vtype, '''' |
& 'cannot reference variable ''', vtype, '''' |
301 |
CALL print_error(msgbuf, mythid) |
CALL print_error(msgbuf, mythid) |
302 |
STOP 'ABNORMAL END: package MNC' |
STOP 'ABNORMAL END: package MNC' |
303 |
10 CONTINUE |
30 CONTINUE |
304 |
|
|
305 |
C Check for bi,bj indicies |
C Check for bi,bj indicies |
306 |
bidim = mnc_cw_vbij(1,indv) |
bidim = mnc_cw_vbij(1,indv) |
378 |
ENDIF |
ENDIF |
379 |
ENDDO |
ENDDO |
380 |
|
|
|
C Add the global attributes |
|
|
CALL MNC_CW_SET_GATTR( fname, lbi,lbj, uniq_tnum, myThid) |
|
|
|
|
381 |
C Add the per-variable attributes |
C Add the per-variable attributes |
382 |
DO i = 1,mnc_cw_vnat(1,indv) |
DO i = 1,mnc_cw_vnat(1,indv) |
383 |
CALL MNC_VAR_ADD_ATTR_STR( fname, vtype, |
CALL MNC_VAR_ADD_ATTR_STR( fname, vtype, |
433 |
vstart(1) = udo(1) + 1 |
vstart(1) = udo(1) + 1 |
434 |
vcount(1) = e(1) - s(1) + 1 |
vcount(1) = e(1) - s(1) + 1 |
435 |
|
|
436 |
|
IF (vcount(1) .GT. MNC_MAX_BUFF) THEN |
437 |
|
write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small', |
438 |
|
& '--please increase to at least ', |
439 |
|
& vcount(1), ' in ''MNC_SIZE.h''' |
440 |
|
CALL PRINT_ERROR(msgBuf , 1) |
441 |
|
STOP 'ABNORMAL END: S/R MNC_CW_RX_W_OFFSET' |
442 |
|
ENDIF |
443 |
|
|
444 |
IF (stype(1:1) .EQ. 'D') THEN |
IF (stype(1:1) .EQ. 'D') THEN |
445 |
DO j1 = s(1),e(1) |
DO j1 = s(1),e(1) |
446 |
k1 = k2 + j1 |
k1 = k2 + j1 |
544 |
#include "netcdf.inc" |
#include "netcdf.inc" |
545 |
#include "mnc_common.h" |
#include "mnc_common.h" |
546 |
#include "SIZE.h" |
#include "SIZE.h" |
547 |
|
#include "MNC_SIZE.h" |
548 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
549 |
#include "PARAMS.h" |
#include "PARAMS.h" |
550 |
#include "MNC_PARAMS.h" |
#include "MNC_PARAMS.h" |
567 |
character*(MNC_MAX_CHAR) fname |
character*(MNC_MAX_CHAR) fname |
568 |
character*(MNC_MAX_CHAR) path_fname |
character*(MNC_MAX_CHAR) path_fname |
569 |
integer indfg, fg1,fg2 |
integer indfg, fg1,fg2 |
570 |
REAL*8 resh_d( sNx + 2*OLx + sNy + 2*OLy ) |
REAL*8 resh_d( MNC_MAX_BUFF ) |
571 |
REAL*4 resh_r( sNx + 2*OLx + sNy + 2*OLy ) |
REAL*4 resh_r( MNC_MAX_BUFF ) |
572 |
INTEGER resh_i( sNx + 2*OLx + sNy + 2*OLy ) |
INTEGER resh_i( MNC_MAX_BUFF ) |
573 |
|
|
574 |
C Functions |
C Functions |
575 |
integer IFNBLNK, ILNBLNK |
integer IFNBLNK, ILNBLNK |
803 |
kr = 0 |
kr = 0 |
804 |
vstart(1) = udo(1) + 1 |
vstart(1) = udo(1) + 1 |
805 |
vcount(1) = e(1) - s(1) + 1 |
vcount(1) = e(1) - s(1) + 1 |
806 |
|
|
807 |
|
IF (vcount(1) .GT. MNC_MAX_BUFF) THEN |
808 |
|
write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small', |
809 |
|
& '--please increase to at least ', |
810 |
|
& vcount(1), ' in ''MNC_SIZE.h''' |
811 |
|
CALL PRINT_ERROR(msgBuf , 1) |
812 |
|
STOP 'ABNORMAL END: S/R MNC_CW_RX_R_OFFSET' |
813 |
|
ENDIF |
814 |
|
|
815 |
IF (stype(1:1) .EQ. 'D') THEN |
IF (stype(1:1) .EQ. 'D') THEN |
816 |
err = NF_GET_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d) |
err = NF_GET_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d) |
817 |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |