SUBROUTINE RUNSPEC( FNAME, USEENV, SDATE, STIME, TSTEP, NRECS ) CHARACTER(LEN=*), INTENT(IN ) :: FNAME !! input file LOGICAL, INTENT(IN ) :: USEENV !! input file INTEGER, INTENT( OUT) :: SDATE !! starting date YYYYDDD INTEGER, INTENT( OUT) :: STIME !! starting time H*MMSS INTEGER, INTENT( OUT) :: TSTEP !! time step H*MMSS INTEGER, INTENT( OUT) :: NRECS !! Number of records
Return time step sequenceSDATE:STIME:TSTEP:NRECS
consistent with (and with default values from) fileFNAME
.If
FNAME
is blank, defaults are from the current wall-clock date&time.
IfFNAME
is time independent,SDATE=STIME=TSTEP=0; NRECS=1
IfUSEENV
, get values from environment variablesSDATE, STIME, TSTEP, EDATE, ETIME
and use them to determine the results; else prompt the user for those values.NOTE: does not assume that
FNAME
is already completed (it would be an error to do so within some modeling workflows).I/O API-3.2 or later, only.
For Fortran-90 declarations and interface checking:
USE M3UTILIOSee also CURREC(), GETDATE(), GETDTTIME(), ENVINT(), GETNUM(), JSTEP3().
IfUSEENV
:setenv SDATE <starting date (YYYYDDD)> setenv STIME <starting time (HHMMSS)> setenv TSTEP <time step (H*MMSS)> setenv EDATE <ending date (YYYYDDD)> setenv ETIME <ending date (HHMMSS)>
The following example will prompt the user forSDATE, STIME, TSTEP, EDATE, ETIME
(since argumentUSEENV=.FALSE.
), and then run accordingly:
... USE M3UTILIO ... CHARACTER, PARAMETER :: FNAME = 'METCRO2D' ... INTEGER SDATE, STIME, TSTEP, NRECS INTEGER JDATE, JTIME, N ... IF ( OPEN3( FNAME... ... CALL RUNSPEC( FNAME, .FALSE., SDATE, STIME, TSTEP, NRECS ) ... JDATE = SDATE JTIME = STIME DO N = 1, NRECS !! main loop on time steps ... CALL NEXTIME( JDATE, JTIME, TSTEP ) END DO !! end loop on timesteps ...
Don't, unless you're already very comfortable with mixed-language programming.
Up: Date-Time Manipulation Routines
To: Models-3/EDSS I/O API: The Help Pages