4.4. Reading Data Files in IO/API

There are four routines with varying kinds of selectivity used to read or otherwise retrieve data from files: READ3 , XTRACT3, INTERP3, and DDTVAR3. All four are logical functions that return TRUE when they succeed, FALSE when they fail. The descriptions of the routines are listed in Table 4.4.

Table 4.4. IOAPI data retrieval routines

Routine Description
READ3 reads one or all variables and layers from a file for a particular date and time.
XTRACT3 reads a windowed subgrid for one or all variables from a file for a particular
INTERP3 interpolates the requested variable from the requested file to the date/time
DDTVAR3 computes the time-derivative of the requested variable at the specified date/time

Because it optimizes the interpolation problem for the user, INTERP3 is probably the most useful of these routines. An INTERP3 call to read/interpolate the variable HNO3 to 1230 GMT on February 4, 1995 is outlined below.


CHARACTER*16  FNAME, VNAME

REAL*4  ARRAY( NCOLS, NROWS, NLAYS )

...

IF ( .NOT. INTERP3('myfile','HNO3',1995035,123000,NCOLS*NROWS*NLAYS,ARRAY)) THEN

... (some kind of error happened--deal with it here)

END IF

With READ3 and XTRACT3, the user can use the "magic values" ALLVAR3' (= 'ALL', as defined in PARMS3.EXT ) or ALLAYS3 (= -1, as also defined in PARMS3.EXT) as the variable name and/or layer number to read all variables or all layers from the file, respectively. For time independent files, the date and time arguments are ignored.