JSTEP3()

Fortran version:

    INTEGER FUNCTION  JSTEP3( JDATE, JTIME, SDATE, STIME, TSTEP )
        INTEGER, INTENT(IN   ) :: JDATE   !  requested date YYYYDDD
        INTEGER, INTENT(IN   ) :: JTIME   !  requested time HHMMSS
        INTEGER, INTENT(IN   ) :: SDATE   !  starting date  YYYYDDD
        INTEGER, INTENT(IN   ) :: STIME   !  starting time  HHMMSS
        INTEGER, INTENT(IN   ) :: TSTEP   !  time step      H*MMSS

C version:

    int  JSTEP3( int * jdate, 
                 int * jtime, 
                 int * sdate, 
                 int * stime, 
                 int * tstep ) ;

Summary:

JSTEP3() returns the timestep-record number corresponding to JDATE:JTIME for the timestep sequence starting at SDATE:STIME, with time step increment TSTEP, if JDATE:JTIME is exactly on the timestep sequence, or -1 otherwise.

See also subroutines CURRSTEP(), LASTTIME(), and NEXTIME().

Preconditions:

#include "iodecl3.h" if called from C.

Fortran Usage:

For Fortran-90 declarations and interface checking:
    USE M3UTILIO
    

Code example:

    ...
    USE M3UTILIO    ! or: INTEGER, EXTERNAL :: JSTEP3
    ...
    INTEGER   JDATE, JTIME, TSTEP       !  current simulation time
    INTEGER   SDATE, STIME, OUTSTEP     !  define output time step sequence
    ...
    !!  set SDATE:STIME:OUTSTEP for output-file timestep sequence
    !!  and JDATE:JTIME to the model simulation-clock
    ...
    DO  STEP = 1, NSTEPS
        ....
        IF ( JSTEP3( JDATE, JTIME, SDATE, STIME, OUTSTEP ) .GT. 0 ) THEN
            !!  this is a valid time step for the output sequence:
            ...
        END IF
        CALL NEXTIME( JDATE, JTIME, TSTEP )
    END DO
    ...

C Usage:

#include "iodecl3.h"
    ... 
    int      jdate, jtime, sdate, stime, tstep ;
    int      irec ;
    <type>   foo[ MAXRECS ] ;
    ... 
    irec = JSTEP3( &jdate, &jtime, &sdate, &stime, &tstep ) ;
    if ( irec > 0 )
        {   /*  jdate:jtime IS a valid element of the sequence  */
        foo[ irec-1 ] = ...
        ...
        }
    else{   /*  jdate:jtime IS NOT a valid element of the sequence  */
        ...
        } ;
    ...


Previous: ISDSTIME

Next: JULIAN

Up: Date-Time Manipulation Routines

To: Models-3/EDSS I/O API: The Help Pages