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" |
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) |
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 resh_d( MNC_MAX_BUFF ) |
REAL*8 resh_d( MNC_MAX_BUFF ) |
122 |
REAL*4 resh_r( MNC_MAX_BUFF ) |
REAL*4 resh_r( MNC_MAX_BUFF ) |
123 |
INTEGER resh_i( MNC_MAX_BUFF ) |
INTEGER resh_i( MNC_MAX_BUFF ) |
189 |
fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR) |
fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR) |
190 |
n1 = IFNBLNK(fbname) |
n1 = IFNBLNK(fbname) |
191 |
n2 = ILNBLNK(fbname) |
n2 = ILNBLNK(fbname) |
192 |
|
|
193 |
|
#ifdef MNC_WRITE_OLDNAMES |
194 |
|
|
195 |
ntot = n2 - n1 + 1 |
ntot = n2 - n1 + 1 |
196 |
fname(1:ntot) = fbname(n1:n2) |
fname(1:ntot) = fbname(n1:n2) |
197 |
ntot = ntot + 1 |
ntot = ntot + 1 |
198 |
fname(ntot:ntot) = '.' |
fname(ntot:ntot) = '.' |
199 |
write(fname((ntot+1):(ntot+14)),'(i4.4,a1,i6.6,a3)') |
IF ( mnc_use_name_ni0 ) THEN |
200 |
& iseq,'.',uniq_tnum, '.nc' |
write(fname((ntot+1):(ntot+17)),'(i10.10,a1,i6.6)') |
201 |
nfname = ntot + 14 |
& nIter0,'.',uniq_tnum |
202 |
|
write(fname((ntot+18):(ntot+25)),'(a1,i4.4,a3)') |
203 |
|
& '.', iseq, '.nc' |
204 |
|
nfname = ntot + 25 |
205 |
|
ELSE |
206 |
|
write(fname((ntot+1):(ntot+14)),'(i4.4,a1,i6.6,a3)') |
207 |
|
& iseq,'.',uniq_tnum, '.nc' |
208 |
|
nfname = ntot + 14 |
209 |
|
ENDIF |
210 |
|
|
211 |
|
#else |
212 |
|
|
213 |
|
CALL MNC_PSNCM(tmpnm, uniq_tnum, MNC_DEF_TMNC) |
214 |
|
k = ILNBLNK(tmpnm) |
215 |
|
IF ( mnc_cw_cit(1,mnc_cw_fgci(indfg)) .GT. -1 ) THEN |
216 |
|
write(fname,'(a,a1,i10.10,a2,a,a3)') fbname(n1:n2), |
217 |
|
& '.', mnc_cw_cit(2,mnc_cw_fgci(indfg)), |
218 |
|
& '.t',tmpnm(1:k),'.nc' |
219 |
|
ELSEIF ( mnc_cw_cit(1,mnc_cw_fgci(indfg)) .EQ. -1 ) THEN |
220 |
|
C Leave off the myIter value entirely |
221 |
|
write(fname,'(a,a2,a,a3)') fbname(n1:n2), '.t', |
222 |
|
& tmpnm(1:k),'.nc' |
223 |
|
ELSE |
224 |
|
C We have an error--bad flag value |
225 |
|
write(msgbuf,'(4a)') |
226 |
|
& 'MNC_CW_RX_W ERROR: bad mnc_cw_cit(1,...) ', |
227 |
|
& 'flag value for base name ''', fbname(fg1:fg2), |
228 |
|
& '''' |
229 |
|
CALL print_error(msgbuf, mythid) |
230 |
|
STOP 'ABNORMAL END: S/R MNC_CW_RX_W' |
231 |
|
ENDIF |
232 |
|
nfname = ILNBLNK(fname) |
233 |
|
|
234 |
|
#endif |
235 |
|
|
236 |
C Add the path to the file name |
C Add the path to the file name |
237 |
IF (mnc_use_outdir) THEN |
IF (mnc_use_outdir) THEN |
278 |
C Delete the now-full fname from the lookup tables since |
C Delete the now-full fname from the lookup tables since |
279 |
C we are all done writing to it. |
C we are all done writing to it. |
280 |
CALL MNC_FILE_CLOSE(fname, myThid) |
CALL MNC_FILE_CLOSE(fname, myThid) |
|
iseq = iseq + 1 |
|
281 |
indu = 1 |
indu = 1 |
282 |
mnc_cw_fgud(indfg) = 1 |
mnc_cw_fgud(indfg) = 1 |
283 |
|
|
284 |
|
#ifdef MNC_WRITE_OLDNAMES |
285 |
|
iseq = iseq + 1 |
286 |
mnc_cw_fgis(indfg) = iseq |
mnc_cw_fgis(indfg) = iseq |
287 |
|
#else |
288 |
|
IF (mnc_cw_cit(1,mnc_cw_fgci(indfg)) .LT. 0) THEN |
289 |
|
write(msgbuf,'(5a)') |
290 |
|
& 'MNC_CW_RX_W ERROR: output file for base name ''', |
291 |
|
& fbname(fg1:fg2), ''' is about to exceed the max ', |
292 |
|
& 'file size and is NOT ALLOWED an iteration value ', |
293 |
|
& 'within its file name' |
294 |
|
CALL print_error(msgbuf, mythid) |
295 |
|
STOP 'ABNORMAL END: S/R MNC_CW_RX_W' |
296 |
|
ELSEIF (mnc_cw_cit(3,mnc_cw_fgci(indfg)) .LT. 0) THEN |
297 |
|
write(msgbuf,'(5a)') |
298 |
|
& 'MNC_CW_RX_W ERROR: output file for base name ''', |
299 |
|
& fbname(fg1:fg2), ''' is about to exceed the max ', |
300 |
|
& 'file size and no next-iter has been specified--', |
301 |
|
& 'please see the MNC CITER functions' |
302 |
|
CALL print_error(msgbuf, mythid) |
303 |
|
STOP 'ABNORMAL END: S/R MNC_CW_RX_W' |
304 |
|
ENDIF |
305 |
|
mnc_cw_cit(2,mnc_cw_fgci(indfg)) |
306 |
|
& = mnc_cw_cit(3,mnc_cw_fgci(indfg)) |
307 |
|
mnc_cw_cit(3,mnc_cw_fgci(indfg)) = -1 |
308 |
|
#endif |
309 |
fs_isdone = 1 |
fs_isdone = 1 |
310 |
GOTO 10 |
GOTO 10 |
311 |
|
|
312 |
ENDIF |
ENDIF |
313 |
ENDIF |
ENDIF |
314 |
ENDIF |
ENDIF |
325 |
ELSE |
ELSE |
326 |
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 |
327 |
ENDIF |
ENDIF |
|
C CALL MNC_DIM_INIT(fname, |
|
|
C & mnc_cw_dn(i,igrid), dimnc(i), myThid) |
|
328 |
|
|
329 |
C Add the coordinate variables |
C Add the coordinate variables |
330 |
CALL MNC_DIM_INIT_ALL_CV(fname, |
CALL MNC_DIM_INIT_ALL_CV(fname, |
496 |
IF (vcount(1) .GT. MNC_MAX_BUFF) THEN |
IF (vcount(1) .GT. MNC_MAX_BUFF) THEN |
497 |
write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small', |
write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small', |
498 |
& '--please increase to at least ', |
& '--please increase to at least ', |
499 |
& vcount(1), ' in ''MNC_SIZE.h''' |
& vcount(1), ' in ''MNC_BUFF.h''' |
500 |
CALL PRINT_ERROR(msgBuf , 1) |
CALL PRINT_ERROR(msgBuf , 1) |
501 |
STOP 'ABNORMAL END: S/R MNC_CW_RX_W_OFFSET' |
STOP 'ABNORMAL END: S/R MNC_CW_RX_W_OFFSET' |
502 |
ENDIF |
ENDIF |
521 |
DO j1 = s(1),e(1) |
DO j1 = s(1),e(1) |
522 |
k1 = k2 + j1 |
k1 = k2 + j1 |
523 |
kr = kr + 1 |
kr = kr + 1 |
524 |
resh_i(kr) = var(k1) |
resh_i(kr) = MNC2I( var(k1) ) |
525 |
ENDDO |
ENDDO |
526 |
err = NF_PUT_VARA_INT(fid, idv, vstart, vcount, resh_i) |
err = NF_PUT_VARA_INT(fid, idv, vstart, vcount, resh_i) |
527 |
ENDIF |
ENDIF |
604 |
#include "netcdf.inc" |
#include "netcdf.inc" |
605 |
#include "mnc_common.h" |
#include "mnc_common.h" |
606 |
#include "SIZE.h" |
#include "SIZE.h" |
607 |
#include "MNC_SIZE.h" |
#include "MNC_BUFF.h" |
608 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
609 |
#include "PARAMS.h" |
#include "PARAMS.h" |
610 |
#include "MNC_PARAMS.h" |
#include "MNC_PARAMS.h" |
617 |
|
|
618 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
619 |
integer i,k, nvf,nvl, n1,n2, igrid, ntot, indu |
integer i,k, nvf,nvl, n1,n2, igrid, ntot, indu |
620 |
integer bis,bie, bjs,bje, uniq_tnum, nfname, fid, idv |
integer bis,bie, bjs,bje, uniq_tnum,uniq_fnum, nfname, fid, idv |
621 |
integer ndim, indf, err, lbi,lbj, bidim,bjdim, unlim_sz, kr |
integer ndim, err, lbi,lbj, bidim,bjdim, unlim_sz, kr |
622 |
integer ind_fv_ids, ind_vt, ierr, atype, alen |
integer ind_vt, npath, unlid, f_or_t, ixoff,iyoff |
623 |
integer f_sNx,f_sNy, npath |
C integer f_sNx,f_sNy, alen, atype, ind_fv_ids, ierr, indf |
624 |
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) |
625 |
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 |
626 |
character*(MAX_LEN_MBUF) msgbuf |
character*(MAX_LEN_MBUF) msgbuf |
627 |
character*(MNC_MAX_CHAR) fname |
character*(MNC_MAX_CHAR) fname |
628 |
|
character*(MNC_MAX_CHAR) fname_zs |
629 |
|
character*(MNC_MAX_CHAR) tmpnm |
630 |
character*(MNC_MAX_CHAR) path_fname |
character*(MNC_MAX_CHAR) path_fname |
631 |
integer indfg, fg1,fg2 |
integer indfg, fg1,fg2 |
632 |
REAL*8 resh_d( MNC_MAX_BUFF ) |
REAL*8 resh_d( MNC_MAX_BUFF ) |
689 |
C Create the file name |
C Create the file name |
690 |
CALL MNC_CW_GET_TILE_NUM( lbi,lbj, uniq_tnum, myThid) |
CALL MNC_CW_GET_TILE_NUM( lbi,lbj, uniq_tnum, myThid) |
691 |
fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR) |
fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR) |
692 |
|
|
693 |
|
#ifdef MNC_READ_OLDNAMES |
694 |
|
|
695 |
n1 = IFNBLNK(fbname) |
n1 = IFNBLNK(fbname) |
696 |
n2 = ILNBLNK(fbname) |
n2 = ILNBLNK(fbname) |
697 |
ntot = n2 - n1 + 1 |
ntot = n2 - n1 + 1 |
711 |
nfname = npath + nfname |
nfname = npath + nfname |
712 |
ENDIF |
ENDIF |
713 |
|
|
714 |
C Open the existing file |
WRITE(fname_zs,'(2a,i4.4,a1,i6.6,a3)') |
715 |
CALL MNC_FILE_TRY_READ( fname, ierr, indf, myThid) |
& mnc_indir_str(1:npath), fbname(n1:n2), |
716 |
|
& 0, '.', uniq_tnum, '.nc' |
717 |
|
|
718 |
|
C The steps are: |
719 |
|
C (1) open the file in a READ-ONLY mode, |
720 |
|
C (2) get the var id for the current variable, |
721 |
|
C (3) read the data, and then |
722 |
|
C (4) close the file--theres no need to keep it open! |
723 |
|
|
724 |
|
write(msgbuf,'(4a)') 'MNC_CW_RX_R: cannot open', |
725 |
|
& ' file ''', fname(1:nfname), ''' in read-only mode' |
726 |
|
err = NF_OPEN(fname, NF_NOWRITE, fid) |
727 |
|
IF ( err .NE. NF_NOERR ) THEN |
728 |
|
C If the initial open fails, try again using a name with a |
729 |
|
C zero sequence number inserted |
730 |
|
err = NF_OPEN(fname_zs, NF_NOWRITE, fid) |
731 |
|
ENDIF |
732 |
|
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
733 |
|
|
734 |
|
write(msgbuf,'(5a)') |
735 |
|
& 'MNC_CW_RX_R: cannot get id for variable ''', |
736 |
|
& vtype(nvf:nvl), '''in file ''', fname(1:nfname), '''' |
737 |
|
err = NF_INQ_VARID(fid, vtype, idv) |
738 |
|
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
739 |
|
f_or_t = 0 |
740 |
|
|
741 |
|
#else |
742 |
|
|
743 |
|
C The sequence for PER-FACE and PER-TILE is: |
744 |
|
C (1) check whether a PER-FACE file exists |
745 |
|
C . (a) if only one face is used for the entire domain, |
746 |
|
C . then omit the face index from the file name |
747 |
|
C . (b) if the PER-FACE file exists and is somehow faulty, |
748 |
|
C . then we die with an error message |
749 |
|
C (2) if no PER-FACE file exists, then use a PER-TILE file |
750 |
|
|
751 |
|
C Create the PER-FACE file name |
752 |
|
n1 = IFNBLNK(fbname) |
753 |
|
n2 = ILNBLNK(fbname) |
754 |
|
C Add an iteraton count to the file name if its requested |
755 |
|
IF (mnc_cw_cit(1,mnc_cw_fgci(indfg)) .LT. 0) THEN |
756 |
|
WRITE(fname,'(a,a1)') fbname(n1:n2), '.' |
757 |
|
ELSE |
758 |
|
WRITE(fname,'(a,a1,i10.10,a1)') fbname(n1:n2), '.', |
759 |
|
& mnc_cw_cit(2,mnc_cw_fgci(indfg)), '.' |
760 |
|
ENDIF |
761 |
|
ntot = ILNBLNK(fname) |
762 |
|
path_fname(1:MNC_MAX_CHAR) = mnc_blank_name(1:MNC_MAX_CHAR) |
763 |
|
npath = ILNBLNK(mnc_indir_str) |
764 |
|
C Add the face index |
765 |
|
CALL MNC_CW_GET_FACE_NUM( lbi,lbj, uniq_fnum, myThid) |
766 |
|
IF ( uniq_fnum .EQ. -1 ) THEN |
767 |
|
C There is only one face |
768 |
|
WRITE(path_fname,'(2a,a2)') |
769 |
|
& mnc_indir_str(1:npath), fname(1:ntot), 'nc' |
770 |
|
ELSE |
771 |
|
CALL MNC_PSNCM(tmpnm, uniq_fnum, MNC_DEF_FMNC) |
772 |
|
k = ILNBLNK(tmpnm) |
773 |
|
WRITE(path_fname,'(2a,a1,a,a3)') |
774 |
|
& mnc_indir_str(1:npath), fname(1:ntot), 'f', |
775 |
|
& tmpnm(1:k), '.nc' |
776 |
|
ENDIF |
777 |
|
|
778 |
|
C Try to open the PER-FACE file |
779 |
|
err = NF_OPEN(path_fname, NF_NOWRITE, fid) |
780 |
|
IF ( err .EQ. NF_NOERR ) THEN |
781 |
|
f_or_t = 0 |
782 |
|
ELSE |
783 |
|
|
784 |
|
C Create the PER-TILE file name |
785 |
|
CALL MNC_PSNCM(tmpnm, uniq_tnum, MNC_DEF_TMNC) |
786 |
|
k = ILNBLNK(tmpnm) |
787 |
|
path_fname(1:MNC_MAX_CHAR)=mnc_blank_name(1:MNC_MAX_CHAR) |
788 |
|
WRITE(path_fname,'(2a,a1,a,a3)') |
789 |
|
& mnc_indir_str(1:npath), fname(1:ntot), 't', |
790 |
|
& tmpnm(1:k), '.nc' |
791 |
|
err = NF_OPEN(path_fname, NF_NOWRITE, fid) |
792 |
|
IF ( err .EQ. NF_NOERR ) THEN |
793 |
|
f_or_t = 1 |
794 |
|
ELSE |
795 |
|
k = ILNBLNK(path_fname) |
796 |
|
write(msgbuf,'(4a)') |
797 |
|
& 'MNC_CW_RX_R: cannot open either a per-face or a ', |
798 |
|
& 'per-tile file: last try was ''', path_fname(1:k), |
799 |
|
& '''' |
800 |
|
CALL print_error(msgbuf, mythid) |
801 |
|
STOP 'ABNORMAL END: S/R MNC_CW_RX_W' |
802 |
|
ENDIF |
803 |
|
|
804 |
C Check that the variable (VType) is defined within the file |
ENDIF |
805 |
CALL MNC_GET_FVINDS( fname, vtype, indf, ind_fv_ids, myThid) |
|
806 |
IF ((indf .LT. 1) .OR. (ind_fv_ids .LT. 1)) THEN |
ntot = ILNBLNK(path_fname) |
807 |
write(msgbuf,'(4a)') 'MNC_CW_RX_R ERROR: vtype ''', |
write(msgbuf,'(5a)') |
808 |
& vtype(nvf:nvl), ''' is not defined within file ''', |
& 'MNC_CW_RX_R: cannot get netCDF id for variable ''', |
809 |
& fname(1:nfname) |
& vtype(nvf:nvl), ''' in file ''', path_fname(1:ntot), |
810 |
|
& '''' |
811 |
|
err = NF_INQ_VARID(fid, vtype, idv) |
812 |
|
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
813 |
|
|
814 |
|
#endif |
815 |
|
|
816 |
|
IF ( f_or_t .EQ. 1 ) THEN |
817 |
|
write(msgbuf,'(4a)') |
818 |
|
& 'MNC_CW_RX_R: per-face reads are not yet ', |
819 |
|
& 'implemented -- so pester Ed to finish them' |
820 |
CALL print_error(msgbuf, mythid) |
CALL print_error(msgbuf, mythid) |
821 |
STOP 'ABNORMAL END: S/R MNC_CW_RX_R' |
STOP 'ABNORMAL END: S/R MNC_CW_RX_W' |
822 |
|
|
823 |
|
C Get the X,Y PER-FACE offsets |
824 |
|
CALL MNC_CW_GET_XYFO(lbi,lbj, ixoff,iyoff, myThid) |
825 |
|
|
826 |
ENDIF |
ENDIF |
|
fid = mnc_f_info(indf,2) |
|
|
idv = mnc_fv_ids(indf,ind_fv_ids+1) |
|
827 |
|
|
828 |
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 |
829 |
C are compatible and WARN (only warn) if not |
C are compatible and WARN (only warn) if not |
830 |
f_sNx = -1 |
C f_sNx = -1 |
831 |
f_sNy = -1 |
C f_sNy = -1 |
832 |
err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNx',atype,alen) |
C err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNx',atype,alen) |
833 |
IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN |
C IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN |
834 |
err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNx', f_sNx) |
C err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNx', f_sNx) |
835 |
CALL MNC_HANDLE_ERR(err, |
C CALL MNC_HANDLE_ERR(err, |
836 |
& 'reading attribute ''sNx'' in S/R MNC_CW_RX_R', |
C & 'reading attribute ''sNx'' in S/R MNC_CW_RX_R', |
837 |
& myThid) |
C & myThid) |
838 |
ENDIF |
C ENDIF |
839 |
err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNy',atype,alen) |
C err = NF_INQ_ATT(fid,NF_GLOBAL, 'sNy',atype,alen) |
840 |
IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN |
C IF ((err .EQ. NF_NOERR) .AND. (alen .EQ. 1)) THEN |
841 |
err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNy', f_sNy) |
C err = NF_GET_ATT_INT(fid, NF_GLOBAL, 'sNy', f_sNy) |
842 |
CALL MNC_HANDLE_ERR(err, |
C CALL MNC_HANDLE_ERR(err, |
843 |
& 'reading attribute ''sNy'' in S/R MNC_CW_RX_R', |
C & 'reading attribute ''sNy'' in S/R MNC_CW_RX_R', |
844 |
& myThid) |
C & myThid) |
845 |
ENDIF |
C ENDIF |
846 |
IF ((f_sNx .NE. sNx) .OR. (f_sNy .NE. sNy)) THEN |
C IF ((f_sNx .NE. sNx) .OR. (f_sNy .NE. sNy)) THEN |
847 |
write(msgbuf,'(5a)') 'MNC_CW_RX_R WARNING: the ', |
C write(msgbuf,'(5a)') 'MNC_CW_RX_R WARNING: the ', |
848 |
& 'attributes ''sNx'' and ''sNy'' within the file ''', |
C & 'attributes ''sNx'' and ''sNy'' within the file ''', |
849 |
& fname(1:nfname), ''' do not exist or do not match ', |
C & fname(1:nfname), ''' do not exist or do not match ', |
850 |
& 'the current sizes within the model' |
C & 'the current sizes within the model' |
851 |
CALL print_error(msgbuf, mythid) |
C CALL print_error(msgbuf, mythid) |
852 |
ENDIF |
C ENDIF |
853 |
|
|
854 |
C Check that the in-memory variable and the in-file variables |
C Check that the in-memory variable and the in-file variables |
855 |
C are of compatible sizes |
C are of compatible sizes |
901 |
IF (i .LE. ndim) THEN |
IF (i .LE. ndim) THEN |
902 |
s(i) = mnc_cw_is(i,igrid) |
s(i) = mnc_cw_is(i,igrid) |
903 |
e(i) = mnc_cw_ie(i,igrid) |
e(i) = mnc_cw_ie(i,igrid) |
904 |
|
|
905 |
|
IF ( f_or_t .EQ. 1 ) THEN |
906 |
|
C Add the per-face X,Y offsets to the udo offset vector |
907 |
|
C since they accomplish the same thing |
908 |
|
IF ( mnc_cw_dn(i,igrid)(1:1) .EQ. 'X' ) THEN |
909 |
|
udo(i) = ixoff - 1 |
910 |
|
ELSEIF ( mnc_cw_dn(i,igrid)(1:1) .EQ. 'Y' ) THEN |
911 |
|
udo(i) = iyoff - 1 |
912 |
|
ENDIF |
913 |
|
ENDIF |
914 |
|
|
915 |
ENDIF |
ENDIF |
916 |
C Check for the unlimited dimension |
C Check for the unlimited dimension |
917 |
IF ((i .EQ. ndim) |
IF ((i .EQ. ndim) |
919 |
IF (indu .GT. 0) THEN |
IF (indu .GT. 0) THEN |
920 |
C Use the indu value |
C Use the indu value |
921 |
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 |
|
922 |
ELSE |
ELSE |
923 |
C Use the current unlimited dim size |
C We need the current unlim dim size |
924 |
CALL MNC_DIM_UNLIM_SIZE( fname, unlim_sz, myThid) |
write(msgbuf,'(5a)') 'MNC_CW_RX_R: getting the ', |
925 |
udo(i) = unlim_sz - 1 |
& 'unlim dim id within file ''', |
926 |
|
& fname(1:nfname), '''' |
927 |
|
err = NF_INQ_UNLIMDIM(fid, unlid) |
928 |
|
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
929 |
|
write(msgbuf,'(5a)') 'MNC_CW_RX_R: getting the ', |
930 |
|
& 'unlim dim size within file ''', |
931 |
|
& fname(1:nfname), '''' |
932 |
|
err = NF_INQ_DIMLEN(fid, unlid, unlim_sz) |
933 |
|
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
934 |
|
udo(i) = unlim_sz |
935 |
ENDIF |
ENDIF |
936 |
ENDIF |
ENDIF |
937 |
ENDDO |
ENDDO |
948 |
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) |
949 |
C ENDDO |
C ENDDO |
950 |
|
|
|
CALL MNC_FILE_ENDDEF(fname, myThid) |
|
|
|
|
951 |
write(msgbuf,'(5a)') 'reading variable type ''', |
write(msgbuf,'(5a)') 'reading variable type ''', |
952 |
& vtype(nvf:nvl), ''' within file ''', |
& vtype(nvf:nvl), ''' within file ''', |
953 |
& fname(1:nfname), '''' |
& fname(1:nfname), '''' |
985 |
IF (vcount(1) .GT. MNC_MAX_BUFF) THEN |
IF (vcount(1) .GT. MNC_MAX_BUFF) THEN |
986 |
write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small', |
write(msgbuf,'(2a,I7,a)') 'MNC_MAX_BUFF is too small', |
987 |
& '--please increase to at least ', |
& '--please increase to at least ', |
988 |
& vcount(1), ' in ''MNC_SIZE.h''' |
& vcount(1), ' in ''MNC_BUFF.h''' |
989 |
CALL PRINT_ERROR(msgBuf , 1) |
CALL PRINT_ERROR(msgBuf , 1) |
990 |
STOP 'ABNORMAL END: S/R MNC_CW_RX_R_OFFSET' |
STOP 'ABNORMAL END: S/R MNC_CW_RX_R_OFFSET' |
991 |
ENDIF |
ENDIF |
996 |
DO j1 = s(1),e(1) |
DO j1 = s(1),e(1) |
997 |
k1 = k2 + j1 |
k1 = k2 + j1 |
998 |
kr = kr + 1 |
kr = kr + 1 |
999 |
var(k1) = resh_d(kr) |
var(k1) = MNCI2( resh_d(kr) ) |
1000 |
ENDDO |
ENDDO |
1001 |
ENDIF |
ENDIF |
1002 |
IF (stype(1:1) .EQ. 'R') THEN |
IF (stype(1:1) .EQ. 'R') THEN |
1005 |
DO j1 = s(1),e(1) |
DO j1 = s(1),e(1) |
1006 |
k1 = k2 + j1 |
k1 = k2 + j1 |
1007 |
kr = kr + 1 |
kr = kr + 1 |
1008 |
var(k1) = resh_r(kr) |
var(k1) = MNCI2( resh_r(kr) ) |
1009 |
ENDDO |
ENDDO |
1010 |
ENDIF |
ENDIF |
1011 |
IF (stype(1:1) .EQ. 'I') THEN |
IF (stype(1:1) .EQ. 'I') THEN |
1018 |
ENDDO |
ENDDO |
1019 |
ENDIF |
ENDIF |
1020 |
|
|
|
|
|
1021 |
|
|
1022 |
ENDDO |
ENDDO |
1023 |
ENDDO |
ENDDO |
1027 |
ENDDO |
ENDDO |
1028 |
|
|
1029 |
C Close the file |
C Close the file |
1030 |
CALL MNC_FILE_CLOSE(fname, myThid) |
C CALL MNC_FILE_CLOSE(fname, myThid) |
1031 |
|
err = NF_CLOSE(fid) |
1032 |
|
write(msgbuf,'(3a)') 'MNC_CW_RX_R: cannot close file ''', |
1033 |
|
& fname(1:nfname), '''' |
1034 |
|
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
1035 |
|
|
1036 |
|
|
1037 |
C End the lbj,lbi loops |
C End the lbj,lbi loops |
1038 |
ENDDO |
ENDDO |