LOGICAL FUNCTION INTERP3( FNAME, VNAME, CALLER, & JDATE, JTIME, BSIZE, BUFFER ) LOGICAL FUNCTION INTERPX( FNAME, VNAME, CALLER, & COL0, COL1, ROW0, ROW1, LAY0, LAY1, & JDATE, JTIME, BUFFER ) CHARACTER*(*), INTENT(IN ) :: FNAME ! file name for query CHARACTER*(*), INTENT(IN ) :: VNAME ! vble name CHARACTER*(*), INTENT(IN ) :: CALLER ! name of caller for logging INTEGER , INTENT(IN ) :: COL0 ! lower col bound for INTERPX INTEGER , INTENT(IN ) :: COL1 ! upper col bound for INTERPX INTEGER , INTENT(IN ) :: ROW0 ! lower row bound for INTERPX INTEGER , INTENT(IN ) :: ROW1 ! upper row bound for INTERPX INTEGER , INTENT(IN ) :: LAY0 ! lower layer bound for INTERPX INTEGER , INTENT(IN ) :: LAY1 ! upper layer bound for INTERPX INTEGER , INTENT(IN ) :: JDATE ! date, formatted YYYYDDD INTEGER , INTENT(IN ) :: JTIME ! time, formatted HHMMSS INTEGER , INTENT(IN ) :: BSIZE ! data volume (words) being read <type>, INTENT( OUT) :: BUFFER( BSIZE ) ! array to hold input
interp3c()
andinterpxc()
are C wrappers calling the FortranINTERP3()
andINTERPX()
.
int interp3c( const char * fname , const char * vname , const char * caller, int jdate , int jtime , int bsize , void * buffer ) int interpxc( const char * fname , const char * vname , const char * caller, int col0 , int col1 , int row0 , int row1 , int lay0 , int lay1 , int jdate , int jtime , void * buffer )
INTERPX
: INTERPX()
is new with
I/O API Version 2.2
Do linear-time interpolation of REAL
or
DOUBLE PRECISION
(REAL*8
)
data from Models-3 data file with
logical name FNAME
for variable with name
VNAME
, for the date and
time JDATE
(coded YYYYDDD
),
JTIME (HHMMSS)
, with optimized memory allocation,
reading, etc., handled behind the scenes.
INTERP3()
checks size BSIZE
of the buffer
to hold the data against the size calculated from values in the
file header (and insists that they match); returns a full-grid
result.
INTERPX()
checks window bounds COL0, COL1, ROW0,
ROW1, LAY0, LAY1
against the dimension values in the file header
(and insists that they fit); returns a partial-grid result:
BUFFER(:,:,:)
with the values
BUFFER( C, R, L )
defined by the inequalities:
<= COL0 <= C <= COL1 <= NCOLS3D
<= ROW0 <= R <= ROW1 <= NROWS3D
<= LAY0 <= L <= LAY1 <= NLAYS3D
BUFFER( P, L )
defined by the inequality:
<= LAY0 <= L <= LAY1 <= NLAYS3D
BUFFER( I, L )
defined by the inequalities:
<= COL0 <= I <= COL1 <= NCOLS3D
<= LAY0 <= L <= LAY1 <= NLAYS3D
For time independent
files, JDATE:JTIME
are ignored.
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.
For I/O API 3.2 or later: If
snoop mode is configured
in the Makefile when you build libioapi.a,
then environment variables SNOOPTRY3, SNOOPSECS3
control the
number of re-tries and the delay between re-tries (secs) for
reading data under end-of-file conditions.
Calls INIT3() and also OPEN3() if necessary (opening the file for read-only if it does so).
For Fortran-90 declarations and interface checking:
USE M3UTILIO
See also
DDTVAR3,
READ3,
WRITE3,
XTRACT3,
USE M3UTILIO
or
INCLUDE 'IODECL3.EXT'
#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.
... USE M3UTILIO ... INTEGER, PARAMETER :: NCOLS = ?? INTEGER, PARAMETER :: NROWS = ?? INTEGER, PARAMETER :: NLAYS = ?? INTEGER, PARAMETER :: NGRID = NCOLS*NROWS*NLAYS ... REAL SO4( NCOLS, NROWS, NLAYS ) REAL SFCNOX( NCOLS, NROWS ) REAL BOXNOX( 11:33, 22:55, 3 ) !! NOTE: It isn't required that the name of the Fortran !! variable match the name of the file-variable, but it !! can often help the maintainability of the code if it does. ... IF ( INTERP3( 'MYFILE', 'SO4', 1988021, 123730, NGRID, SO4 ) ) THEN !! Variable 'SO4' interpolated to 12:37:30 Jan 21, 1988 !! from MYFILE and put into array SO4. ... ELSE !! Error: see program log for further info. ... END IF ... IF ( INTERPX( 'MYFILE', 'NOX', 1988021, 123730, & 1, NCOLS, 1, NROWS, 1, 1, SFCNOX ) ) THEN !! Layer 1 of variable 'NOX' interpolated to !! 12:37:30 Jan 21, 1988 !! from MYFILE and put into array SFCNOX. ... ELSE !! Error: see program log for further info. ... END IF ... IF ( INTERPX( 'MYFILE', 'NOX', 1988021, 123730, & 11, 33, 22, 55, 1, 3, BOXNOX ) ) THEN !! Window of Layer 1-3 'NOX' interpolated to !! 12:37:30 Jan 21, 1988 !! from MYFILE and put into array BOXNOX. ... ELSE !! Error: see program log for further info. ... END IF ...
... #include "iodecl3.h" ... float hno3[ NLAYS ][ NROWS ][ NCOLS ] ; ... if ( interp3c( "MYFILE", "HNO3", 1988021, 123000, NCOLS*NROWS*NLAYS, hno3 ) ) { /* Variable 'HNO3' interpolated to date and time 12:37:30 Jan 21, 1988 from MYFILE and put into array hno3 */ ... } else { /* Error: see program log for further info. */ ... } ...
To: Models-3/EDSS I/O API: The Help Pages