LOGICAL FUNCTION FILCHK3( FNAME, & FTYPE, NCOLS, NROWS, NLAYS, NTHIK ) CHARACTER*(*) FNAME ! file name for query INTEGER FTYPE ! INTEGER NCOLS ! INTEGER NROWS ! INTEGER NLAYS ! (or ALLAYS3 (=-1)) INTEGER 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 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
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.
FNAME must already have been opened by OPEN3() or open3c() .
... INCLUDE 'IODECL3.EXT' INCLUDE 'PARMS3.EXT' ... INTEGER NCOLS, NROWS, NLAYS, NTHIK ... ... IF ( .NOT.OPEN3( 'MYFILE', FSREAD3, 'Myprogram' ) ) THEN C MYFILE could not be opened for read-only ... ELSE IF ( .NOT. FILCHK3( 'MYFILE', & GRDDED3, NCOLS, NROWS, NLAYS, NTHIK ) ) THEN C Either the file type for 'MYFILE' was not GRIDDED, or C 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( "BFILE", 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