/[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.38 by edhill, Fri Aug 4 14:57:36 2006 UTC revision 1.42 by mlosch, Thu May 22 12:21:19 2008 UTC
# Line 91  C     depending upon the tile indicies. Line 91  C     depending upon the tile indicies.
91  C     !USES:  C     !USES:
92        implicit none        implicit none
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_BUFF.h"  #include "MNC_BUFF.h"
97  #include "EEPARAMS.h"  #include "EEPARAMS.h"
# Line 174  C     Check that the Variable Type exist Line 174  C     Check that the Variable Type exist
174  C     Set the bi,bj indicies  C     Set the bi,bj indicies
175        bis = bi        bis = bi
176        bie = bi        bie = bi
177        IF (bi .EQ. 0) THEN        IF (bi .LT. 1) THEN
178          bis = 1          bis = 1
179          bie = nSx          bie = nSx
       ELSEIF (bi .LT. 0) THEN  
         bis = -bi  
         bie = -bi  
180        ENDIF        ENDIF
181        bjs = bj        bjs = bj
182        bje = bj        bje = bj
183        IF (bj .EQ. 0) THEN        IF (bj .LT. 1) THEN
184          bjs = 1          bjs = 1
185          bje = nSy          bje = nSy
       ELSEIF (bj .LT. 0) THEN  
         bjs = -bj  
         bje = -bj  
186        ENDIF        ENDIF
187    
188        DO lbj = bjs,bje        DO lbj = bjs,bje
# Line 516  C         Handle missing values Line 510  C         Handle missing values
510       &             NF_DOUBLE, 1, dvm(2))       &             NF_DOUBLE, 1, dvm(2))
511              ELSEIF (stype(1:1) .EQ. 'R') THEN              ELSEIF (stype(1:1) .EQ. 'R') THEN
512                err = NF_PUT_ATT_REAL(fid, idv, 'missing_value',                err = NF_PUT_ATT_REAL(fid, idv, 'missing_value',
513       &             NF_FLOAT, 1, dvm(2))       &             NF_FLOAT, 1, rvm(2))
514              ELSEIF (stype(1:1) .EQ. 'I') THEN              ELSEIF (stype(1:1) .EQ. 'I') THEN
515                err = NF_PUT_ATT_INT(fid, idv, 'missing_value',                err = NF_PUT_ATT_INT(fid, idv, 'missing_value',
516       &             NF_INT, 1, ivm(2))       &             NF_INT, 1, ivm(2))
517              ENDIF              ENDIF
518              CALL MNC_HANDLE_ERR(err, msgbuf, myThid)              CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
519    CMLC     it may be better to use the attribute _FillValue, or both
520    CML            write(msgbuf,'(4a)') 'writing attribute ''_FillValue''',
521    CML     &           ' within file ''', fname(1:nfname), ''''
522    CML            IF (stype(1:1) .EQ. 'D') THEN
523    CML              err = NF_PUT_ATT_DOUBLE(fid, idv, '_FillValue',
524    CML     &             NF_DOUBLE, 1, dvm(2))
525    CML            ELSEIF (stype(1:1) .EQ. 'R') THEN
526    CML              err = NF_PUT_ATT_REAL(fid, idv, '_FillValue',
527    CML     &             NF_FLOAT, 1, rvm(2))
528    CML            ELSEIF (stype(1:1) .EQ. 'I') THEN
529    CML              err = NF_PUT_ATT_INT(fid, idv, '_FillValue',
530    CML     &             NF_INT, 1, ivm(2))
531    CML            ENDIF
532    CML            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
533            ENDIF            ENDIF
534    
535            CALL MNC_FILE_ENDDEF(fname, myThid)            CALL MNC_FILE_ENDDEF(fname, myThid)
# Line 709  C !INTERFACE: Line 717  C !INTERFACE:
717       I     var,       I     var,
718       I     myThid )       I     myThid )
719    
720    C     !DESCRIPTION:
721    C     A simple wrapper for the old version of this routine.  The new
722    C     version includes the isvar argument which, for backwards
723    C     compatibility, is set to false here.
724          
725    C     !USES:
726          implicit none
727    
728    C     !INPUT PARAMETERS:
729          integer myThid, bi,bj
730          character*(*) stype, fbname, vtype
731          __V var(*)
732    CEOP
733    
734    C     !LOCAL VARIABLES:
735          LOGICAL isvar
736    
737          isvar = .FALSE.
738    
739          CALL MNC_CW_RX_R_TF(stype,fbname,bi,bj,vtype,var,isvar,myThid)
740    
741          RETURN
742          END
743    
744    
745    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
746    CBOP 0
747    C !ROUTINE: MNC_CW_RX_R
748    
749    C !INTERFACE:
750          SUBROUTINE MNC_CW_RX_R_TF(
751         I     stype,
752         I     fbname, bi,bj,
753         I     vtype,
754         I     var,
755         B     isvar,
756         I     myThid )
757    
758  C     !DESCRIPTION:  C     !DESCRIPTION:
759  C     This subroutine reads one variable from a file or a file group,  C     This subroutine reads one variable from a file or a file group,
760  C     depending upon the tile indicies.  C     depending upon the tile indicies.  If isvar is true and the
761    C     variable does not exist, then isvar is set to false and the
762    C     program continues normally.  This allows one to gracefully handle
763    C     the case of reading variables that might or might not exist.
764                
765  C     !USES:  C     !USES:
766        implicit none        implicit none
767  #include "netcdf.inc"  #include "netcdf.inc"
768  #include "mnc_common.h"  #include "MNC_COMMON.h"
769  #include "SIZE.h"  #include "SIZE.h"
770  #include "MNC_BUFF.h"  #include "MNC_BUFF.h"
771  #include "EEPARAMS.h"  #include "EEPARAMS.h"
# Line 727  C     !INPUT PARAMETERS: Line 776  C     !INPUT PARAMETERS:
776        integer myThid, bi,bj        integer myThid, bi,bj
777        character*(*) stype, fbname, vtype        character*(*) stype, fbname, vtype
778        __V var(*)        __V var(*)
779          LOGICAL isvar
780  CEOP  CEOP
781    
782  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
# Line 854  C           zero sequence number inserte Line 904  C           zero sequence number inserte
904       &         'MNC_CW_RX_R: cannot get id for variable ''',       &         'MNC_CW_RX_R: cannot get id for variable ''',
905       &         vtype(nvf:nvl), '''in file ''', fname(1:nfname), ''''       &         vtype(nvf:nvl), '''in file ''', fname(1:nfname), ''''
906            err = NF_INQ_VARID(fid, vtype, idv)            err = NF_INQ_VARID(fid, vtype, idv)
907              IF ( isvar .AND. ( err .NE. NF_NOERR ) ) THEN
908                isvar = .FALSE.
909                RETURN
910              ENDIF
911              isvar = .TRUE.
912            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
913            f_or_t = 0            f_or_t = 0
914    
# Line 930  C           WRITE(*,*) 'trying: "', path Line 985  C           WRITE(*,*) 'trying: "', path
985       &         vtype(nvf:nvl), ''' in file ''', path_fname(1:ntot),       &         vtype(nvf:nvl), ''' in file ''', path_fname(1:ntot),
986       &         ''''       &         ''''
987            err = NF_INQ_VARID(fid, vtype, idv)            err = NF_INQ_VARID(fid, vtype, idv)
988              IF ( isvar .AND. ( err .NE. NF_NOERR ) ) THEN
989                isvar = .FALSE.
990                RETURN
991              ENDIF
992              isvar = .TRUE.
993            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)            CALL MNC_HANDLE_ERR(err, msgbuf, myThid)
994    
995            k = ILNBLNK(path_fname)            k = ILNBLNK(path_fname)

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.42

  ViewVC Help
Powered by ViewVC 1.1.22