LOGICAL FUNCTION WRITE3( FNAME, VNAME, JDATE, JTIME, TSTEP, NRECS, BUFFER) CHARACTER*(*), INTENT(IN ) :: FNAME ! file name for query CHARACTER*(*), INTENT(IN ) :: VNAME ! vble name (or ALLVAR3 (='ALL')) INTEGER , INTENT(IN ) :: JDATE ! starting date, formatted YYYYDDD INTEGER , INTENT(IN ) :: JTIME ! starting time, formatted HHMMSS INTEGER , INTENT(IN ) :: TSTEP ! time step, formatted HHMMSS INTEGER , INTENT(IN ) :: NRECS ! number of time step records to write <type> , INTENT(IN ) :: BUFFER(*) ! array holding output data
write3c() is a C wrapper calling the Fortran WRITE3()
int write4dc( const char * fname , const char * vname , int jdate , int jtime , int tstep , int nrecs , void * buffer )
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.
FNAME must have one of the file types CUSTOM , GRIDDED , or BOUNDARY .
INCLUDE
'IODECL3.EXT'
for Fortran, or
#include "iodecl3.h"
for C.
I/O API must already be initialized by a call to INIT3() .
FNAME and VNAME must have length at most 16.
FNAME must already have been opened by OPEN3() or open3c() .
FNAME must have one of the file types CUSTOM , GRIDDED , or BOUNDARY .
JDATE, JTIME, and TSTEP must be expressed in terms of Models-3 date and time conventions. JDATE:JTIME must be an exact positive integer multiple of the file's time step from the file's starting date and time. TSTEP must be an exact positive integer multiple of the file's time step.
Dimensionality of the BUFFER argument should agree with I/O API
conventions for the dimensionality of the data being written. In
particular,he time step record subscript is the "slowest"
subscript in the buffer. (I.e., Fortran subscripting for
BUFFER
should be
BUFFER( ..., [LAYER,], TIMESTEP-RECORD )
.)
INCLUDE 'PARMS3.EXT' PARAMETER ( NCOLS = ??, NROWS = ??, NLAYS = ??, NSTEPS = 10 ) ... REAL TGD( NCOLS, NROWS, NSTEPS ) REAL TA ( NCOLS, NROWS, NLAYS, NSTEPS ) C NOTE: It isn't required that the name of the Fortran C variable match the name of the file-variable, but it C can often help the maintainability of the code if it does. ... IF ( WRITE4D( 'AFILE', 'TGD', 1988021, 123000, 10000, NSTEPS, SO4 ) ) THEN C TGD time step sequence starting 12:30:00 Jan 21, 1988 C and having 10 steps at hourly intervals written to AFILE ... ELSE C Error: see program log for further info. ... END IF ... IF ( WRITE3( 'BFILE', 'TA', 1988021, 123000, 10000, NSTEPS, METS ) ) THEN C TA time step sequence starting 12:30:00 Jan 21, 1988 C and having 10 steps at hourly intervals written to BFILE ... ELSE C Error: see program log for further info. ... END IF ...
... #include "iodecl3.h" ... float ta[ NSTEPS ][ NLAYS ][ NROWS ][ NCOLS ] ; ... if ( write4dc( "BFILE", "ALL", ALLAYS3, 1988021, 123000, 10000, NSTEPS, ta ) ) { /* TA time step sequence starting 12:30:00 Jan 21, 1988 and having 10 steps at hourly intervals written to BFILE */ */ ... } else { /* Error: see program log for further info. */ ... } ...
To: Models-3/EDSS I/O API: The Help Pages