INTEGER FUNCTION KFWRITE( FNAME, COL, ROW, SDATE, STIME, KFLEN, VBLES ) CHARACTER*(*), INTENT(IN ) :: FNAME ! logical file name INTEGER , INTENT(IN ) :: COL ! column number for this event INTEGER , INTENT(IN ) :: ROW ! row number for this event INTEGER , INTENT(IN ) :: SDATE ! starting date, formatted YYYYDDD INTEGER , INTENT(IN ) :: STIME ! starting time, formatted HHMMSS INTEGER , INTENT(IN ) :: KFLEN ! event duration, formatted HHMMSS REAL , INTENT(IN ) :: VBLES(*) ! output buffer array
FNAME
,
along with writing the event's description:
COL
is the grid-column for this event.
ROW
is the grid-row.
SDATE
is the
event starting date, formatted YYYYDDD
STIME
is the
event starting time, formatted HHMMSS
KFLEN
is the
event event duration, formatted HHMMSS
VBLES(NLAYS3D,NVARS3D)
is the event's output data.
KFWRITE() is OpenMP thread-safe.
Returns the record number at which the event is written (e.g., for further use with KFREAD()), or -1 if it fails. For failure, writes a log message indicating the nature of the failure.
INCLUDE 'IODECL3.EXT'
and
INCLUDE 'FDESC3.EXT'
for Fortran.
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 KFOPEN().
Dimensionality of the VBLES
argument should be VBLES(NLAYS3D,NVARS3D)
.
... INCLUDE 'IODECL3.EXT' INCLUDE 'PARMS3.EXT' ... INTEGER NCOLS, NROWS, NLAYS, NTHIK PARAMETER ( NCOLS = ??, NROWS = ??, NLAYS = ??, NTHIK = ?? ) ... INTEGER ECOUNT ! # of events for this col-row INTEGER SDATES(NTHIK) ! starting date, formatted YYYYDDD INTEGER STIMES(NTHIK) ! starting time, formatted HHMMSS INTEGER KFLENS(NTHIK) ! event duration, formatted HHMMSS INTEGER EVENTS(NTHIK) ! event numbers REAL TA(NLAYS) ! buffer for variable 'TA' REAL QV(NLAYS) ! buffer for variable 'QV' REAL PR(NLAYS) ! buffer for variable 'PR' REAL VBLES(NLAYS,3) EQUIVALENCE ( VBLES(1,1), TA(1) ) EQUIVALENCE ( VBLES(1,2), QV(1) ) EQUIVALENCE ( VBLES(1,3), PR(1) ) INTEGER C, R, IEVENT INTEGER JDATE, JTIME, KFLEN ... !! suppose MYFILE is opened, and has 3 vbles TA, QV, PR, etc. ... DO R = 1, NROWS DO C = 1, NCOLS ... !! suppose we want to write a KF event at !! C,R,JDATE;JTIME with duration KFLEN IEVENT = KFWRITE( 'MYFILE', C, R, JDATE, JTIME, KFLEN, VBLES ) IF ( IEVENT .LT. 0 ) THEN !! Error: see program log for further info. ... END IF ! if KFWRITE() succeeded ... END DO END DO ...
To: Models-3/EDSS I/O API: The Help Pages