LOGICAL FUNCTION FILCHK3( FNAME, & FTYPE, NCOLS, NROWS, NLAYS, NTHIK ) CHARACTER*(*), INTENT(IN ) :: FNAME ! file name for query INTEGER , INTENT(IN ) :: FTYPE ! INTEGER , INTENT(IN ) :: NCOLS ! INTEGER , INTENT(IN ) :: NROWS ! INTEGER , INTENT(IN ) :: NLAYS ! (or ALLAYS3 (=-1)) INTEGER , INTENT(IN ) :: NTHIK !
int filchk3c( const char * fname , const int ftype , const int ncols , const int nrows , const int nlays , const int nthik ) ;
FNAME
has the indicated type
FTYPE
and appropriate dimensions NCOLS, NROWS, NLAYS,
NTHIK
(with checking of just those that are appropriate for each
FTYPE
). Layer-checking may be suppressed by setting
NLAYS=ALLAYS3
. Reports details of what was wrong
(if anything) to the program log.
Returns .TRUE. (or 1) iff the file is already open, and has the user-supplied indicated file type and grid/array dimensions.
For Fortran-90 declarations and interface checking:
USE M3UTILIO
USE M3UTILIO
or
INCLUDE 'IODECL3.EXT'
for Fortran, or
#include "iodecl3.h"
for C.
I/O API must already be initialized by a call to INIT3() .
FNAME must have length at most 16.
Call
prior to call. Don't tamper withOPEN3( FNAME... )
DESC3( FNAME )
FDESC3
variables
between DESC3( FNAME )
and GRDCHK3( FNAME... )
... USE M3UTILIO ... INTEGER NCOLS, NROWS, NLAYS, NTHIK ... ... IF ( .NOT.OPEN3( 'MYFILE', ... ) ) THEN !! MYFILE could not be opened ... ELSE IF ( .NOT. DESC3( 'MYFILE' ) ) THEN !! ...DESC3() failed for MYFILE ... ELSE IF ( .NOT. FILCHK3( 'MYFILE', GRDDED3, NCOLS, NROWS, NLAYS, NTHIK ) ) THEN !! Either the file type for 'MYFILE' was not GRIDDED, or !! it had unexpected dimensions (see log for more details). ... END IF ... ...
... #include "iodecl3.h" ... int ncols, nrows, nlays, nthik ; ... if ( open3c( "MYFILE", IOAPI_Bdesc3 0, IOAPI_Cdesc3 cdesc 0, FSREAD3, "Myprogram" ) ) { /* MYFILE successfully opened for read-only */ ... } if ( ! filchk3c( "MYFILE", GRDDED3, ncols, nrows, nlays, nthik ) ) { /* Either the file type for "MYFILE" was not GRIDDED, or it had unexpected dimensions. */ ... } ...
To: Models-3/EDSS I/O API: The Help Pages