LOGICAL FUNCTION DDTVAR3( FNAME, VNAME, CALLER,
& JDATE, JTIME, BSIZE, BUFFER )
CHARACTER*(*) FNAME ! file name for query
CHARACTER*(*) VNAME ! vble name (or ALLVAR3 (='ALL'))
CHARACTER*(*) CALLER ! name of caller for logging
INTEGER JDATE ! date, formatted YYYYDDD
INTEGER JTIME ! time, formatted HHMMSS
INTEGER BSIZE ! data volume (words) being read
<type> BUFFER( BSIZE ) ! array to hold input
ddtvar3c() is a C wrapper calling the Fortran DDTVAR3()
int ddtvar3c( const char * fname ,
const char * vname ,
const char * caller,
int jdate ,
int jtime ,
int bsize ,
void * buffer )
For time independent files,
JDATE:JTIME are ignored and the derivative is of
course identically zero, so the routine doesn't need to
do any work, and can be lazy. If VNAME is
ALLVAR3 (= 'ALL', defined in INCLUDE-file
PARMS3.EXT ),,
calculates derivatives of all variables in the file.
At timestep-boundaries, calculates the FORWARD-differencing approximate derivative
Returns .TRUE. (or 1) if the operation succeeds,
.FALSE. (or 0) if it fails. For failure, writes a log
message indicating the nature of the failure.
Calls INIT3() and also OPEN3() if necessary (opening the file for read-only if it does so).
See also
INTERP3 and INTERPX,
READ3,
WRITE3,
XTRACT3,
INCLUDE 'IODECL3.EXT'
for Fortran, or
#include "iodecl3.h" for C.
FNAME and VNAME must have length at most
16, exclusive of trailng blanks.
Valid BSIZE for INTERP3() or COL0,
COL1, ROW0, ROW1, LAY0, LAY1 for INTERPX().
INTERPX() not supported yet for virtual files (netCDF only).
JDATE and JTIME must be expressed in
terms of Models-3 date and time conventions.
basic data type
VTYPE3D
for the variable must be M3REAL for releases prior to
the May 3, 2002 Version 2.2-beta, or M3REAL
or M3DBLE for subsequent releases.
DATEs are YYYYDDD = YEAR*1000 + DAY
TIMEs are HHMMSS = HOUR*10000 + MINS*100 + SECS
...
INCLUDE 'IODECL3.EXT'
INCLUDE 'PARMS3.EXT'
...
INTEGER NCOLS, NROWS, NLAYS
PARAMETER ( NCOLS = ??, NROWS = ??, NLAYS = ?? )
...
REAL DSO4DT( NCOLS, NROWS, NLAYS )
...
IF ( DDTVAR3( 'MYFILE', 'HNO3', 1988021, 123730,
& NCOLS*NROWS*NLAYS, DSO4DT ) ) THEN
C Derivative of variable calculated for 12:37:30 Jan 21, 1988
C from MYFILE and put into array DSO4DT.
...
ELSE
C Error: see program log for further info.
...
END IF
...
...
#include "iodecl3.h"
...
float dhno3dt[ NLAYS ][ NROWS ][ NCOLS ] ;
...
if ( ddtvar3c( "MYFILE", "HNO3", 1988021, 123000,
NCOLS*NROWS*NLAYS, dhno3dt ) )
{
/* Derivative of variable 'HNO3' calculated for date
and time 12:37:30 Jan 21, 1988 from MYFILE and
put into array dhno3dt
*/
...
}
else
{
/* Error: see program log for further info. */
...
}
...
To: Models-3/EDSS I/O API: The Help Pages