CMAQ module developers should use the logical function WRITE3 to write data to files. For gridded, boundary, and custom files, the code may write either one time step of one variable at a time, or one entire time step of data at a time (in which case, use the "magic value" ALLVAR3 as the variable-name). For ID-referenced, profile, and grid-nest files, the code must write an entire time step at a time.
| LOGICAL FUNCTION WRITE3( FNAME, VNAME, JDATE, JTIME, BUFFER) | ||
| where: | CHARACTER*(*) FNAME | file name for query |
| CHARACTER*(*) VNAME | variable name (or ALLVAR3 (='ALL')) | |
| INTEGER JDATE | date, formatted YYYYDDD | |
| INTEGER JTIME | time, formatted HHMMSS | |
| BUFFER(*) | array holding output data | |
WRITE3 writes data for the variable with name VNAME, for the date and time (i.e., JDATE and JTIME) to an I/O API-formatted data file with logical name FNAME. For time independent files, JDATE and JTIME are ignored. If VNAME is the "magic name" ALLVAR3, WRITE3 writes all variables. If FNAME is a dictionary file, WRITE3 treats VNAME as a dictionary index (and ignores JDATE and JTIME). A typical WRITE3 call to write data for a given date and time might look like this:
REAL*4 ARRAY( NCOLS, NROWS, NLAYS, NVARS )
...
IF ( .NOT. WRITE3( 'myfile', 'HNO3', JDATE, JTIME, ARRAY ) ) THEN
...(some kind of error happened--deal with it here)
END IF
IF ( .NOT. WRITE3( 'afile', 'ALL', JDATE, JTIME, ARRAYB ) ) THEN
...(some kind of error happened--deal with it here)
END IF