4 |
#include "MNC_OPTIONS.h" |
#include "MNC_OPTIONS.h" |
5 |
|
|
6 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
7 |
|
CBOP 0 |
8 |
|
C !ROUTINE: MNC_CW_RX_W_S |
9 |
|
|
10 |
SUBROUTINE MNC_CW_RX_W_YY( |
C !INTERFACE: |
11 |
|
SUBROUTINE MNC_CW_RX_W_S( |
12 |
|
I stype, |
13 |
I fbname, bi,bj, |
I fbname, bi,bj, |
14 |
I vtype, |
I vtype, |
|
I indu, |
|
15 |
I var, |
I var, |
16 |
I myThid ) |
I myThid ) |
17 |
|
|
18 |
|
C !DESCRIPTION: |
19 |
|
C A scalar version of MNC_CW_RX_W() for compilers that cannot |
20 |
|
C gracefully handle the conversion on their own. |
21 |
|
|
22 |
|
C !USES: |
23 |
implicit none |
implicit none |
24 |
|
|
25 |
|
C !INPUT PARAMETERS: |
26 |
|
integer myThid, bi,bj, indu |
27 |
|
character*(*) stype, fbname, vtype |
28 |
|
__V var |
29 |
|
__V var_arr(1) |
30 |
|
CEOP |
31 |
|
|
32 |
|
var_arr(1) = var |
33 |
|
CALL MNC_CW_RX_W(stype,fbname,bi,bj,vtype, var_arr, myThid) |
34 |
|
|
35 |
|
RETURN |
36 |
|
END |
37 |
|
|
38 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
39 |
|
CBOP 0 |
40 |
|
C !ROUTINE: MNC_CW_RX_W |
41 |
|
|
42 |
|
C !INTERFACE: |
43 |
|
SUBROUTINE MNC_CW_RX_W( |
44 |
|
I stype, |
45 |
|
I fbname, bi,bj, |
46 |
|
I vtype, |
47 |
|
I var, |
48 |
|
I myThid ) |
49 |
|
|
50 |
|
C !DESCRIPTION: |
51 |
|
C This subroutine writes one variable to a file or a file group, |
52 |
|
C depending upon the tile indicies. |
53 |
|
|
54 |
|
C !USES: |
55 |
|
implicit none |
56 |
#include "netcdf.inc" |
#include "netcdf.inc" |
57 |
#include "mnc_common.h" |
#include "mnc_common.h" |
|
#include "EEPARAMS.h" |
|
58 |
#include "SIZE.h" |
#include "SIZE.h" |
59 |
|
#include "EEPARAMS.h" |
60 |
|
#include "PARAMS.h" |
61 |
|
#include "MNC_PARAMS.h" |
62 |
|
|
63 |
#define mnc_rtype_YY |
C !INPUT PARAMETERS: |
|
|
|
|
C Arguments |
|
64 |
integer myThid, bi,bj, indu |
integer myThid, bi,bj, indu |
65 |
character*(*) fbname, vtype |
character*(*) stype, fbname, vtype |
66 |
__V var(*) |
__V var(*) |
67 |
|
CEOP |
68 |
|
|
69 |
C Functions |
C !LOCAL VARIABLES: |
|
integer IFNBLNK, ILNBLNK |
|
|
|
|
|
C Local Variables |
|
70 |
integer i,j,k, indv,nvf,nvl, n1,n2, igrid, ntot |
integer i,j,k, indv,nvf,nvl, n1,n2, igrid, ntot |
71 |
integer bis,bie, bjs,bje, uniq_tnum, nfname, fid, idv, indvids |
integer bis,bie, bjs,bje, uniq_tnum, nfname |
72 |
integer ndim, indf, err, lbi,lbj, bidim,bjdim, unlim_sz, kr |
integer fid, idv, indvids, ndim, indf, err |
73 |
integer p(9),s(9),e(9), dimnc(9), vstart(9),vcount(9), udo(9) |
integer lbi,lbj, bidim,bjdim, unlim_sz, kr |
74 |
|
integer p(9),s(9),e(9), dimnc(9) |
75 |
|
integer vstart(9),vcount(9), udo(9) |
76 |
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 |
77 |
|
integer indfg, fg1,fg2, npath |
78 |
character*(MAX_LEN_MBUF) msgbuf |
character*(MAX_LEN_MBUF) msgbuf |
79 |
character*(MNC_MAX_CHAR) fname |
character*(MNC_MAX_CHAR) fname |
80 |
|
character*(MNC_MAX_CHAR) path_fname |
81 |
|
REAL*8 resh_d( sNx + 2*OLx + sNy + 2*OLy ) |
82 |
|
REAL*4 resh_r( sNx + 2*OLx + sNy + 2*OLy ) |
83 |
|
INTEGER resh_i( sNx + 2*OLx + sNy + 2*OLy ) |
84 |
|
|
85 |
C Temporary storage for the simultaneous type conversion and |
C Functions |
86 |
C re-shaping before passing to NetCDF |
integer IFNBLNK, ILNBLNK |
|
#ifdef mnc_rtype_D |
|
|
REAL*8 resh( sNx + 2*OLx + sNy + 2*OLy ) |
|
|
#endif |
|
|
#ifdef mnc_rtype_R |
|
|
REAL*4 resh( sNx + 2*OLx + sNy + 2*OLy ) |
|
|
#endif |
|
|
#ifdef mnc_rtype_I |
|
|
INTEGER resh( sNx + 2*OLx + sNy + 2*OLy ) |
|
|
#endif |
|
87 |
|
|
88 |
C Only do I/O if I am the master thread |
C Only do I/O if I am the master thread |
89 |
_BEGIN_MASTER( myThid ) |
_BEGIN_MASTER( myThid ) |
90 |
|
|
91 |
|
C Get the current index for the unlimited dimension from the file |
92 |
|
C group (or base) name |
93 |
|
fg1 = IFNBLNK(fbname) |
94 |
|
fg2 = ILNBLNK(fbname) |
95 |
|
CALL MNC_GET_IND(MNC_MAX_ID, fbname, mnc_cw_fgnm, indfg, myThid) |
96 |
|
IF (indfg .LT. 1) THEN |
97 |
|
write(msgbuf,'(3a)') |
98 |
|
& 'MNC_CW_RX_W ERROR: file group name ''', |
99 |
|
& fbname(fg1:fg2), ''' is not defined' |
100 |
|
CALL print_error(msgbuf, mythid) |
101 |
|
STOP 'ABNORMAL END: S/R MNC_CW_RX_W' |
102 |
|
ENDIF |
103 |
|
indu = mnc_cw_fgud(indfg) |
104 |
|
|
105 |
C Check that the Variable Type exists |
C Check that the Variable Type exists |
106 |
nvf = IFNBLNK(vtype) |
nvf = IFNBLNK(vtype) |
107 |
nvl = ILNBLNK(vtype) |
nvl = ILNBLNK(vtype) |
108 |
CALL MNC_GET_IND(MNC_MAX_ID, vtype, mnc_cw_vname, indv, myThid) |
CALL MNC_GET_IND(MNC_MAX_ID, vtype, mnc_cw_vname, indv, myThid) |
109 |
IF (indv .LT. 1) THEN |
IF (indv .LT. 1) THEN |
110 |
write(msgbuf,'(3a)') 'MNC_CW_RX_W_YY ERROR: vtype ''', |
write(msgbuf,'(3a)') 'MNC_CW_RX_W ERROR: vtype ''', |
111 |
& vtype(nvf:nvl), ''' is not defined' |
& vtype(nvf:nvl), ''' is not defined' |
112 |
CALL print_error(msgbuf, mythid) |
CALL print_error(msgbuf, mythid) |
113 |
STOP 'ABNORMAL END: S/R MNC_CW_RX_W_YY' |
STOP 'ABNORMAL END: S/R MNC_CW_RX_W' |
114 |
ENDIF |
ENDIF |
115 |
igrid = mnc_cw_vgind(indv) |
igrid = mnc_cw_vgind(indv) |
116 |
|
|
143 |
write(fname((ntot+1):(ntot+9)),'(i6.6,a3)') uniq_tnum, '.nc' |
write(fname((ntot+1):(ntot+9)),'(i6.6,a3)') uniq_tnum, '.nc' |
144 |
nfname = ntot+9 |
nfname = ntot+9 |
145 |
|
|
146 |
|
C Add the path to the file name |
147 |
|
IF (mnc_use_outdir) THEN |
148 |
|
path_fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR) |
149 |
|
npath = ILNBLNK(mnc_out_path) |
150 |
|
path_fname(1:npath) = mnc_out_path(1:npath) |
151 |
|
path_fname((npath+1):(npath+nfname)) = fname(1:nfname) |
152 |
|
fname(1:MNC_MAX_CHAR) = path_fname(1:MNC_MAX_CHAR) |
153 |
|
nfname = npath + nfname |
154 |
|
ENDIF |
155 |
|
|
156 |
C Append to an existing or create a new file |
C Append to an existing or create a new file |
157 |
CALL MNC_CW_FILE_AORC(fname, indf, myThid) |
CALL MNC_CW_FILE_AORC(fname, indf, myThid) |
158 |
fid = mnc_f_info(indf,2) |
fid = mnc_f_info(indf,2) |
177 |
& mnc_cw_ndim(igrid), mnc_cw_dn(1,igrid), myThid) |
& mnc_cw_ndim(igrid), mnc_cw_dn(1,igrid), myThid) |
178 |
|
|
179 |
C Ensure that the variable is defined |
C Ensure that the variable is defined |
180 |
#ifdef mnc_rtype_D |
IF (stype(1:1) .EQ. 'D') |
181 |
CALL MNC_VAR_INIT_DBL(fname,mnc_cw_gname(igrid),vtype, myThid) |
& CALL MNC_VAR_INIT_DBL( |
182 |
#endif |
& fname, mnc_cw_gname(igrid), vtype, myThid) |
183 |
#ifdef mnc_rtype_R |
IF (stype(1:1) .EQ. 'R') |
184 |
CALL MNC_VAR_INIT_REAL(fname,mnc_cw_gname(igrid),vtype, myThid) |
& CALL MNC_VAR_INIT_REAL( |
185 |
#endif |
& fname, mnc_cw_gname(igrid), vtype, myThid) |
186 |
#ifdef mnc_rtype_I |
IF (stype(1:1) .EQ. 'I') |
187 |
CALL MNC_VAR_INIT_INT(fname,mnc_cw_gname(igrid),vtype, myThid) |
& CALL MNC_VAR_INIT_INT( |
188 |
#endif |
& fname, mnc_cw_gname(igrid), vtype, myThid) |
189 |
|
|
190 |
DO i = 1,mnc_fv_ids(indf,1) |
DO i = 1,mnc_fv_ids(indf,1) |
191 |
j = 2 + 3*(i - 1) |
j = 2 + 3*(i - 1) |
192 |
IF (mnc_v_names(mnc_fv_ids(indf,j)) .EQ. vtype) THEN |
IF (mnc_v_names(mnc_fv_ids(indf,j)) .EQ. vtype) THEN |
196 |
GOTO 10 |
GOTO 10 |
197 |
ENDIF |
ENDIF |
198 |
ENDDO |
ENDDO |
199 |
write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W_YY ERROR: ', |
write(msgbuf,'(4a)') 'MNC_MNC_CW_RX_W ERROR: ', |
200 |
& 'cannot reference variable ''', vtype, '''' |
& 'cannot reference variable ''', vtype, '''' |
201 |
CALL print_error(msgbuf, mythid) |
CALL print_error(msgbuf, mythid) |
202 |
STOP 'ABNORMAL END: package MNC' |
STOP 'ABNORMAL END: package MNC' |
318 |
vcount(2) = 1 |
vcount(2) = 1 |
319 |
|
|
320 |
kr = 0 |
kr = 0 |
|
DO j1 = s(1),e(1) |
|
|
k1 = k2 + j1 |
|
|
kr = kr + 1 |
|
|
resh(kr) = var(k1) |
|
|
ENDDO |
|
|
|
|
321 |
vstart(1) = udo(1) + 1 |
vstart(1) = udo(1) + 1 |
322 |
vcount(1) = e(1) - s(1) + 1 |
vcount(1) = e(1) - s(1) + 1 |
323 |
|
|
324 |
#ifdef mnc_rtype_D |
IF (stype(1:1) .EQ. 'D') THEN |
325 |
err = NF_PUT_VARA_DOUBLE(fid, idv, vstart, vcount, resh) |
DO j1 = s(1),e(1) |
326 |
#endif |
k1 = k2 + j1 |
327 |
#ifdef mnc_rtype_R |
kr = kr + 1 |
328 |
err = NF_PUT_VARA_REAL(fid, idv, vstart, vcount, resh) |
resh_d(kr) = var(k1) |
329 |
#endif |
ENDDO |
330 |
#ifdef mnc_rtype_I |
err = NF_PUT_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d) |
331 |
err = NF_PUT_VARA_INT(fid, idv, vstart, vcount, resh) |
ENDIF |
332 |
#endif |
IF (stype(1:1) .EQ. 'R') THEN |
333 |
|
DO j1 = s(1),e(1) |
334 |
|
k1 = k2 + j1 |
335 |
|
kr = kr + 1 |
336 |
|
resh_r(kr) = var(k1) |
337 |
|
ENDDO |
338 |
|
err = NF_PUT_VARA_REAL(fid, idv, vstart, vcount, resh_r) |
339 |
|
ENDIF |
340 |
|
IF (stype(1:1) .EQ. 'I') THEN |
341 |
|
DO j1 = s(1),e(1) |
342 |
|
k1 = k2 + j1 |
343 |
|
kr = kr + 1 |
344 |
|
resh_i(kr) = var(k1) |
345 |
|
ENDDO |
346 |
|
err = NF_PUT_VARA_INT(fid, idv, vstart, vcount, resh_i) |
347 |
|
ENDIF |
348 |
|
|
349 |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
350 |
|
|
358 |
C Sync the file |
C Sync the file |
359 |
err = NF_SYNC(fid) |
err = NF_SYNC(fid) |
360 |
write(msgbuf,'(3a)') 'sync for file ''', fname, |
write(msgbuf,'(3a)') 'sync for file ''', fname, |
361 |
& ''' in S/R MNC_CW_RX_W_YY' |
& ''' in S/R MNC_CW_RX_W' |
362 |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
363 |
|
|
364 |
ENDDO |
ENDDO |
371 |
|
|
372 |
|
|
373 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
374 |
|
CBOP 0 |
375 |
|
C !ROUTINE: MNC_CW_RX_R_S |
376 |
|
|
377 |
|
C !INTERFACE: |
378 |
SUBROUTINE MNC_CW_RX_R_YY( |
SUBROUTINE MNC_CW_RX_R_S( |
379 |
|
I stype, |
380 |
I fbname, bi,bj, |
I fbname, bi,bj, |
381 |
I vtype, |
I vtype, |
|
I indu, |
|
382 |
I var, |
I var, |
383 |
I myThid ) |
I myThid ) |
384 |
|
|
385 |
|
C !DESCRIPTION: |
386 |
|
C A scalar version of MNC_CW_RX_R() for compilers that cannot |
387 |
|
C gracefully handle the conversion on their own. |
388 |
|
|
389 |
|
C !USES: |
390 |
implicit none |
implicit none |
391 |
|
|
392 |
|
C !INPUT PARAMETERS: |
393 |
|
integer myThid, bi,bj, indu |
394 |
|
character*(*) stype, fbname, vtype |
395 |
|
__V var |
396 |
|
__V var_arr(1) |
397 |
|
CEOP |
398 |
|
var_arr(1) = var |
399 |
|
|
400 |
|
CALL MNC_CW_RX_R(stype,fbname,bi,bj,vtype, var_arr, myThid) |
401 |
|
|
402 |
|
RETURN |
403 |
|
END |
404 |
|
|
405 |
|
|
406 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
407 |
|
CBOP 0 |
408 |
|
C !ROUTINE: MNC_CW_RX_R |
409 |
|
|
410 |
|
C !INTERFACE: |
411 |
|
SUBROUTINE MNC_CW_RX_R( |
412 |
|
I stype, |
413 |
|
I fbname, bi,bj, |
414 |
|
I vtype, |
415 |
|
I var, |
416 |
|
I myThid ) |
417 |
|
|
418 |
|
C !DESCRIPTION: |
419 |
|
C This subroutine reads one variable from a file or a file group, |
420 |
|
C depending upon the tile indicies. |
421 |
|
|
422 |
|
C !USES: |
423 |
|
implicit none |
424 |
#include "netcdf.inc" |
#include "netcdf.inc" |
425 |
#include "mnc_common.h" |
#include "mnc_common.h" |
|
#include "EEPARAMS.h" |
|
426 |
#include "SIZE.h" |
#include "SIZE.h" |
427 |
|
#include "EEPARAMS.h" |
428 |
|
#include "PARAMS.h" |
429 |
|
#include "MNC_PARAMS.h" |
430 |
|
|
431 |
#define mnc_rtype_YY |
C !INPUT PARAMETERS: |
|
|
|
|
C Arguments |
|
432 |
integer myThid, bi,bj, indu |
integer myThid, bi,bj, indu |
433 |
character*(*) fbname, vtype |
character*(*) stype, fbname, vtype |
434 |
__V var(*) |
__V var(*) |
435 |
|
CEOP |
436 |
|
|
437 |
C Functions |
C !LOCAL VARIABLES: |
|
integer IFNBLNK, ILNBLNK |
|
|
|
|
|
C Local Variables |
|
438 |
integer i,k, nvf,nvl, n1,n2, igrid, ntot |
integer i,k, nvf,nvl, n1,n2, igrid, ntot |
439 |
integer bis,bie, bjs,bje, uniq_tnum, nfname, fid, idv |
integer bis,bie, bjs,bje, uniq_tnum, nfname, fid, idv |
440 |
integer ndim, indf, err, lbi,lbj, bidim,bjdim, unlim_sz, kr |
integer ndim, indf, err, lbi,lbj, bidim,bjdim, unlim_sz, kr |
441 |
integer ind_fv_ids, ind_vt, ierr, atype, alen |
integer ind_fv_ids, ind_vt, ierr, atype, alen |
442 |
integer f_sNx,f_sNy, ires |
integer f_sNx,f_sNy, npath |
443 |
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) |
444 |
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 |
445 |
character*(MAX_LEN_MBUF) msgbuf |
character*(MAX_LEN_MBUF) msgbuf |
446 |
character*(MNC_MAX_CHAR) fname |
character*(MNC_MAX_CHAR) fname |
447 |
|
character*(MNC_MAX_CHAR) path_fname |
448 |
|
integer indfg, fg1,fg2 |
449 |
|
REAL*8 resh_d( sNx + 2*OLx + sNy + 2*OLy ) |
450 |
|
REAL*4 resh_r( sNx + 2*OLx + sNy + 2*OLy ) |
451 |
|
INTEGER resh_i( sNx + 2*OLx + sNy + 2*OLy ) |
452 |
|
|
453 |
C Temporary storage for the simultaneous type conversion and |
C Functions |
454 |
C re-shaping before passing to NetCDF |
integer IFNBLNK, ILNBLNK |
|
#ifdef mnc_rtype_D |
|
|
REAL*8 resh( sNx + 2*OLx + sNy + 2*OLy ) |
|
|
#endif |
|
|
#ifdef mnc_rtype_R |
|
|
REAL*4 resh( sNx + 2*OLx + sNy + 2*OLy ) |
|
|
#endif |
|
|
#ifdef mnc_rtype_I |
|
|
INTEGER resh( sNx + 2*OLx + sNy + 2*OLy ) |
|
|
#endif |
|
455 |
|
|
456 |
C Only do I/O if I am the master thread |
C Only do I/O if I am the master thread |
457 |
_BEGIN_MASTER( myThid ) |
_BEGIN_MASTER( myThid ) |
458 |
|
|
459 |
|
C Get the current index for the unlimited dimension from the file |
460 |
|
C group (or base) name |
461 |
|
fg1 = IFNBLNK(fbname) |
462 |
|
fg2 = ILNBLNK(fbname) |
463 |
|
CALL MNC_GET_IND(MNC_MAX_ID, fbname, mnc_cw_fgnm, indfg, myThid) |
464 |
|
IF (indfg .LT. 1) THEN |
465 |
|
write(msgbuf,'(3a)') |
466 |
|
& 'MNC_CW_RX_W ERROR: file group name ''', |
467 |
|
& fbname(fg1:fg2), ''' is not defined' |
468 |
|
CALL print_error(msgbuf, mythid) |
469 |
|
STOP 'ABNORMAL END: S/R MNC_CW_RX_W' |
470 |
|
ENDIF |
471 |
|
indu = mnc_cw_fgud(indfg) |
472 |
|
|
473 |
C Check that the Variable Type exists |
C Check that the Variable Type exists |
474 |
nvf = IFNBLNK(vtype) |
nvf = IFNBLNK(vtype) |
475 |
nvl = ILNBLNK(vtype) |
nvl = ILNBLNK(vtype) |
476 |
CALL MNC_GET_IND( MNC_MAX_ID, vtype, mnc_cw_vname, ind_vt, myThid) |
CALL MNC_GET_IND( MNC_MAX_ID, vtype, mnc_cw_vname, ind_vt, myThid) |
477 |
IF (ind_vt .LT. 1) THEN |
IF (ind_vt .LT. 1) THEN |
478 |
write(msgbuf,'(3a)') 'MNC_CW_RX_R_YY ERROR: vtype ''', |
write(msgbuf,'(3a)') 'MNC_CW_RX_R ERROR: vtype ''', |
479 |
& vtype(nvf:nvl), ''' is not defined' |
& vtype(nvf:nvl), ''' is not defined' |
480 |
CALL print_error(msgbuf, mythid) |
CALL print_error(msgbuf, mythid) |
481 |
STOP 'ABNORMAL END: S/R MNC_CW_RX_R_YY' |
STOP 'ABNORMAL END: S/R MNC_CW_RX_R' |
482 |
ENDIF |
ENDIF |
483 |
igrid = mnc_cw_vgind(ind_vt) |
igrid = mnc_cw_vgind(ind_vt) |
484 |
|
|
515 |
write(fname((ntot+1):(ntot+9)),'(i6.6,a3)') uniq_tnum, '.nc' |
write(fname((ntot+1):(ntot+9)),'(i6.6,a3)') uniq_tnum, '.nc' |
516 |
nfname = ntot+9 |
nfname = ntot+9 |
517 |
|
|
518 |
|
C Add the path to the file name |
519 |
|
IF (mnc_use_indir) THEN |
520 |
|
path_fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR) |
521 |
|
npath = ILNBLNK(mnc_indir_str) |
522 |
|
path_fname(1:npath) = mnc_indir_str(1:npath) |
523 |
|
path_fname((npath+1):(npath+nfname)) = fname(1:nfname) |
524 |
|
fname(1:MNC_MAX_CHAR) = path_fname(1:MNC_MAX_CHAR) |
525 |
|
nfname = npath + nfname |
526 |
|
ENDIF |
527 |
|
|
528 |
C Open the existing file |
C Open the existing file |
529 |
CALL MNC_FILE_TRY_READ( fname, ierr, indf, myThid) |
CALL MNC_FILE_TRY_READ( fname, ierr, indf, myThid) |
530 |
|
|
531 |
C Check that the variable (VType) is defined within the file |
C Check that the variable (VType) is defined within the file |
532 |
CALL MNC_GET_FVINDS( fname, vtype, indf, ind_fv_ids, myThid) |
CALL MNC_GET_FVINDS( fname, vtype, indf, ind_fv_ids, myThid) |
533 |
IF ((indf .LT. 1) .OR. (ind_fv_ids .LT. 1)) THEN |
IF ((indf .LT. 1) .OR. (ind_fv_ids .LT. 1)) THEN |
534 |
write(msgbuf,'(4a)') 'MNC_CW_RX_R_YY ERROR: vtype ''', |
write(msgbuf,'(4a)') 'MNC_CW_RX_R ERROR: vtype ''', |
535 |
& vtype(nvf:nvl), ''' is not defined within file ''', |
& vtype(nvf:nvl), ''' is not defined within file ''', |
536 |
& fname(1:nfname) |
& fname(1:nfname) |
537 |
CALL print_error(msgbuf, mythid) |
CALL print_error(msgbuf, mythid) |
538 |
STOP 'ABNORMAL END: S/R MNC_CW_RX_R_YY' |
STOP 'ABNORMAL END: S/R MNC_CW_RX_R' |
539 |
ENDIF |
ENDIF |
540 |
fid = mnc_f_info(indf,2) |
fid = mnc_f_info(indf,2) |
541 |
idv = mnc_fv_ids(indf,ind_fv_ids+1) |
idv = mnc_fv_ids(indf,ind_fv_ids+1) |
548 |
IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN |
IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN |
549 |
err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNx', f_sNx) |
err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNx', f_sNx) |
550 |
CALL MNC_HANDLE_ERR(err, |
CALL MNC_HANDLE_ERR(err, |
551 |
& 'reading attribute ''sNx'' in S/R MNC_CW_RX_R_YY', |
& 'reading attribute ''sNx'' in S/R MNC_CW_RX_R', |
552 |
& myThid) |
& myThid) |
553 |
ENDIF |
ENDIF |
554 |
err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNy',atype,alen) |
err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNy',atype,alen) |
555 |
IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN |
IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN |
556 |
err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNy', f_sNy) |
err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNy', f_sNy) |
557 |
CALL MNC_HANDLE_ERR(err, |
CALL MNC_HANDLE_ERR(err, |
558 |
& 'reading attribute ''sNy'' in S/R MNC_CW_RX_R_YY', |
& 'reading attribute ''sNy'' in S/R MNC_CW_RX_R', |
559 |
& myThid) |
& myThid) |
560 |
ENDIF |
ENDIF |
561 |
IF ((f_sNx .NE. sNx) .OR. (f_sNy .NE. sNy)) THEN |
IF ((f_sNx .NE. sNx) .OR. (f_sNy .NE. sNy)) THEN |
562 |
write(msgbuf,'(5a)') 'MNC_CW_RX_R_YY WARNING: the ', |
write(msgbuf,'(5a)') 'MNC_CW_RX_R WARNING: the ', |
563 |
& 'attributes ''sNx'' and ''sNy'' within the file ''', |
& 'attributes ''sNx'' and ''sNy'' within the file ''', |
564 |
& fname(1:nfname), ''' do not exist or do not match ', |
& fname(1:nfname), ''' do not exist or do not match ', |
565 |
& 'the current sizes within the model' |
& 'the current sizes within the model' |
572 |
C CALL MNC_CHK_VTYP_R_NCVAR( ind_vt, |
C CALL MNC_CHK_VTYP_R_NCVAR( ind_vt, |
573 |
C & indf, ind_fv_ids, indu, ires) |
C & indf, ind_fv_ids, indu, ires) |
574 |
C IF (ires .LT. 0) THEN |
C IF (ires .LT. 0) THEN |
575 |
C write(msgbuf,'(7a)') 'MNC_CW_RX_R_YY WARNING: the sizes ', |
C write(msgbuf,'(7a)') 'MNC_CW_RX_R WARNING: the sizes ', |
576 |
C & 'of the in-program variable ''', vtype(nvf:nvl), |
C & 'of the in-program variable ''', vtype(nvf:nvl), |
577 |
C & ''' and the corresponding variable within file ''', |
C & ''' and the corresponding variable within file ''', |
578 |
C & fname(1:nfname), ''' are not compatible -- please ', |
C & fname(1:nfname), ''' are not compatible -- please ', |
579 |
C & 'check the sizes' |
C & 'check the sizes' |
580 |
C CALL print_error(msgbuf, mythid) |
C CALL print_error(msgbuf, mythid) |
581 |
C STOP 'ABNORMAL END: S/R MNC_CW_RX_R_YY' |
C STOP 'ABNORMAL END: S/R MNC_CW_RX_R' |
582 |
C ENDIF |
C ENDIF |
583 |
|
|
584 |
C Check for bi,bj indicies |
C Check for bi,bj indicies |
679 |
vstart(2) = udo(2) + j2 - s(2) + 1 |
vstart(2) = udo(2) + j2 - s(2) + 1 |
680 |
vcount(2) = 1 |
vcount(2) = 1 |
681 |
|
|
682 |
|
kr = 0 |
683 |
vstart(1) = udo(1) + 1 |
vstart(1) = udo(1) + 1 |
684 |
vcount(1) = e(1) - s(1) + 1 |
vcount(1) = e(1) - s(1) + 1 |
685 |
|
|
686 |
#ifdef mnc_rtype_D |
IF (stype(1:1) .EQ. 'D') THEN |
687 |
err = NF_GET_VARA_DOUBLE(fid, idv, vstart, vcount, resh) |
err = NF_GET_VARA_DOUBLE(fid, idv, vstart, vcount, resh_d) |
688 |
#endif |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
689 |
#ifdef mnc_rtype_R |
DO j1 = s(1),e(1) |
690 |
err = NF_GET_VARA_REAL(fid, idv, vstart, vcount, resh) |
k1 = k2 + j1 |
691 |
#endif |
kr = kr + 1 |
692 |
#ifdef mnc_rtype_I |
var(k1) = resh_d(kr) |
693 |
err = NF_GET_VARA_INT(fid, idv, vstart, vcount, resh) |
ENDDO |
694 |
#endif |
ENDIF |
695 |
|
IF (stype(1:1) .EQ. 'R') THEN |
696 |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
err = NF_GET_VARA_REAL(fid, idv, vstart, vcount, resh_r) |
697 |
|
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
698 |
|
DO j1 = s(1),e(1) |
699 |
|
k1 = k2 + j1 |
700 |
|
kr = kr + 1 |
701 |
|
var(k1) = resh_r(kr) |
702 |
|
ENDDO |
703 |
|
ENDIF |
704 |
|
IF (stype(1:1) .EQ. 'I') THEN |
705 |
|
err = NF_GET_VARA_INT(fid, idv, vstart, vcount, resh_i) |
706 |
|
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
707 |
|
DO j1 = s(1),e(1) |
708 |
|
k1 = k2 + j1 |
709 |
|
kr = kr + 1 |
710 |
|
var(k1) = resh_i(kr) |
711 |
|
ENDDO |
712 |
|
ENDIF |
713 |
|
|
|
kr = 0 |
|
|
DO j1 = s(1),e(1) |
|
|
k1 = k2 + j1 |
|
|
kr = kr + 1 |
|
|
var(k1) = resh(kr) |
|
|
ENDDO |
|
714 |
|
|
715 |
|
|
716 |
ENDDO |
ENDDO |