563 |
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 |
564 |
character*(MAX_LEN_MBUF) msgbuf |
character*(MAX_LEN_MBUF) msgbuf |
565 |
character*(MNC_MAX_CHAR) fname |
character*(MNC_MAX_CHAR) fname |
566 |
|
character*(MNC_MAX_CHAR) fname_zs |
567 |
character*(MNC_MAX_CHAR) path_fname |
character*(MNC_MAX_CHAR) path_fname |
568 |
integer indfg, fg1,fg2 |
integer indfg, fg1,fg2 |
569 |
REAL*8 resh_d( MNC_MAX_BUFF ) |
REAL*8 resh_d( MNC_MAX_BUFF ) |
645 |
nfname = npath + nfname |
nfname = npath + nfname |
646 |
ENDIF |
ENDIF |
647 |
|
|
648 |
C Open the existing file |
WRITE(fname_zs,'(2a,i4.4,a1,i6.6,a3)') |
649 |
C CALL MNC_FILE_TRY_READ( fname, ierr, indf, myThid) |
& mnc_indir_str(1:npath), fbname(n1:n2), |
650 |
|
& 0, '.', uniq_tnum, '.nc' |
651 |
|
|
652 |
|
C The steps are: |
653 |
|
C (1) open the file in a READ-ONLY mode, |
654 |
|
C (2) get the var id for the current variable, |
655 |
|
C (3) read the data, and then |
656 |
|
C (4) close the file--theres no need to keep it open! |
657 |
|
|
|
C Check that the variable (VType) is defined within the file |
|
|
C CALL MNC_GET_FVINDS( fname, vtype, indf, ind_fv_ids, myThid) |
|
|
C IF ((indf .LT. 1) .OR. (ind_fv_ids .LT. 1)) THEN |
|
|
C write(msgbuf,'(4a)') 'MNC_CW_RX_R ERROR: vtype ''', |
|
|
C & vtype(nvf:nvl), ''' is not defined within file ''', |
|
|
C & fname(1:nfname) |
|
|
C CALL print_error(msgbuf, mythid) |
|
|
C STOP 'ABNORMAL END: S/R MNC_CW_RX_R' |
|
|
C ENDIF |
|
|
|
|
|
C The previous old junk is completely unnecessary. All we |
|
|
C should do is (1) open the file in a READ-ONLY mode, (2) get |
|
|
C the var id for the current variable, (3) read the data, and |
|
|
C then (4) quickly close the file since theres no need to keep |
|
|
C it open. |
|
658 |
write(msgbuf,'(4a)') 'MNC_CW_RX_R: cannot open', |
write(msgbuf,'(4a)') 'MNC_CW_RX_R: cannot open', |
659 |
& ' file ''', fname(1:nfname), ''' in read-only mode' |
& ' file ''', fname(1:nfname), ''' in read-only mode' |
660 |
err = NF_OPEN(fname, NF_NOWRITE, fid) |
err = NF_OPEN(fname, NF_NOWRITE, fid) |
661 |
|
IF ( err .NE. NF_NOERR ) THEN |
662 |
|
C If the initial open fails, try again using a name with a |
663 |
|
C zero sequence number inserted |
664 |
|
err = NF_OPEN(fname_zs, NF_NOWRITE, fid) |
665 |
|
ENDIF |
666 |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
CALL MNC_HANDLE_ERR(err, msgbuf, myThid) |
667 |
|
|
668 |
write(msgbuf,'(6a)') |
write(msgbuf,'(6a)') |