NCEPLIBS-w3emc  2.9.3
w3trnarg.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Translates arg line from standard input
3 C> @author Dennis Keyser @date 2002-02-11
4 
5 C> Reads argument lines from standard input and obtains subdirectory, bufr
6 C> tankname, characters to append for adding an orbit, and options for limiting
7 C> the time window.
8 C>
9 C> ### Program History Log:
10 C> Date | Programmer | Comment
11 C> -----|------------|--------
12 C> 1996-09-03 | B. KATZ | Original author
13 C> 1998-11-27 | B. KATZ | Changes for y2k and fortran 90 compliance
14 C> 2002-02-11 | D. KEYSER | If "tlflag" is not specified, it defaults to
15 C> "notimlim" rather than "timlim" and gross time limits will not be
16 C> calculated and returned in "iymdhb" and "iymdhe"
17 C>
18 C> @param[in] SUBDIR Name of sub-directory including bufr data type where
19 C> bufr data tank is located.
20 C> @param[in] LSUBDR Number of characters in 'subdir'.
21 C> @param[in] TANKID Name of file including bufr data sub-type containing
22 C> bufr data tank.
23 C> @param[in] LTNKID Number of characters in 'tankid'.
24 C> @param[in] APPCHR Characters to be appended to 'tankid' giving a
25 C> uniquely named file to contain the original tank
26 C> with one orbit appended to it.
27 C> @param[in] LAPCHR Number of characters in 'appchr'.
28 C> @param[in] TLFLAG 8 character flag indicating whether time acceptance
29 C> checks atre to be performed.
30 C> = 'timlim ' : perform time acceptance checks.
31 C> = 'notimlim' : do not perform time acceptance checks.
32 C> jdate and kdate are disregarded.
33 C> @param[in] IYMDHB Start of time acceptance window, in form yyyymmddhh.
34 C> @param[in] IYMDHE End of time acceptance window, in form yyyymmddhh.
35 C> @param IERR
36 C>
37 C> Input files :
38 C> unit 05 - standard input for passing in arguments. arguments
39 C> (for list-directed i/o) are as follows :
40 C> record 1 - (1) subdirectory. contains bufr data type
41 C> (2) tankfile. contains bufr data sub-type
42 C> (3) append characters. appended to tankfile
43 C> to give unique output file name.
44 C> (4) date in yyyymmddhh format.
45 C> next three records are optional :
46 C> record 2 - (1) time limit flag. may be either
47 C> 'timlim ' or 'notimlim'. see
48 C> description of 'tlflag' above.
49 C> (default is 'notimlim')
50 C> record 3 - (1) hours before current time.
51 C> record 4 - (1) hours after current time.
52 C> if 'timlim ' is specified in record 2, the
53 C> quantities in records 3 and 4 are used to
54 C> compute the limits of the time acceptance window.
55 C> if records 3 and 4 are omitted, the values
56 C> default to -48 (48 hours before current time)
57 C> and +12 (12 hours after current time).
58 C> if 'notimlim ' is specified in record 2, then
59 C> these quantities are not used regardless of whether
60 C> or not they were specified.
61 C>
62 C> @author Dennis Keyser @date 2002-02-11
63  SUBROUTINE w3trnarg(SUBDIR,LSUBDR,TANKID,LTNKID,APPCHR,LAPCHR,
64  1 TLFLAG,IYMDHB,IYMDHE,IERR)
65  CHARACTER*(*) SUBDIR,TANKID,APPCHR,TLFLAG
66  INTEGER IDATIN(8),IDTOUT(8)
67  REAL TIMINC(5)
68  READ(5,*,END=9999) SUBDIR,TANKID,APPCHR,iymdh
69  msubdr = len(subdir)
70  DO lsubdr=0,msubdr-1
71  IF(subdir(lsubdr+1:lsubdr+1).EQ.' ') GO TO 10
72  ENDDO
73  lsubdr = msubdr
74  10 CONTINUE
75  IF(lsubdr.LT.4) THEN
76  WRITE(6,'(1X,I2,'' CHARACTERS IN SUBDIRECTORY ARGUMENT'',
77  1 '' AT LEAST 4 CHARACTERS ARE REQUIRED'')') lsubdr
78  ierr = 2
79  RETURN
80  ENDIF
81  mtnkid = len(tankid)
82  DO ltnkid=0,mtnkid-1
83  IF(tankid(ltnkid+1:ltnkid+1).EQ.' ') GO TO 20
84  ENDDO
85  ltnkid = mtnkid
86  20 CONTINUE
87  IF(ltnkid.LT.4) THEN
88  WRITE(6,'(1X,I2,'' CHARACTERS IN TANKFILE ARGUMENT'',
89  1 '' AT LEAST 4 CHARACTERS ARE REQUIRED'')') ltnkid
90  ierr = 2
91  RETURN
92  ENDIF
93  mapchr = len(appchr)
94  DO lapchr=0,mapchr-1
95  IF(appchr(lapchr+1:lapchr+1).EQ.' ') GO TO 30
96  ENDDO
97  lapchr = mapchr
98  30 CONTINUE
99  tlflag = 'NOTIMLIM' ! The default is to NOT perform time checks
100  READ(5,*,END=40) tlflag
101  40 CONTINUE
102  IF(tlflag(1:6).NE.'TIMLIM') THEN
103  tlflag = 'NOTIMLIM'
104  print 123, iymdh,subdir(1:lsubdr),tankid(1:ltnkid)
105  123 FORMAT(/'RUN ON ',i10/'WRITE TO ',a,'/',a/'GROSS TIME LIMIT ',
106  1 'CHECKS ARE NOT PERFORMED HERE - SUBSEQUENT PROGRAM ',
107  1 'BUFR_TRANJB WILL TAKE CARE OF THIS'/)
108  iymdhb = 0000000000
109  iymdhe = 2100000000
110  ierr = 0
111  RETURN
112  ENDIF
113  tlflag(7:8) = ' '
114  READ(5,*,END=60) ihrbef
115  GO TO 70
116  60 CONTINUE
117  ihrbef = -48
118  ihraft = 12
119  GO TO 100
120  70 CONTINUE
121  READ(5,*,END=80) ihraft
122  GO TO 90
123  80 CONTINUE
124  ihraft = 12
125  GO TO 100
126  90 CONTINUE
127  IF(ihrbef.GT.0 .AND. ihraft.LT.0) THEN
128  itemp = ihrbef
129  ihrbef = ihraft
130  ihraft = itemp
131  ELSE IF(ihrbef.GT.0) THEN
132  ihrbef = -1 * ihrbef
133  ENDIF
134  100 CONTINUE
135  idatin(1) = iymdh / 1000000
136  idatin(2) = mod(iymdh,1000000) / 10000
137  idatin(3) = mod(iymdh,10000) / 100
138  idatin(4) = 0
139  idatin(5) = mod(iymdh,100)
140  idatin(6:8) = 0
141  timinc(1) = 0.0
142  timinc(2) = float(ihrbef)
143  timinc(3:5) = 0.0
144  CALL w3movdat(timinc,idatin,idtout)
145  iymdhb = ((idtout(1) * 100 + idtout(2)) * 100 + idtout(3)) *
146  1 100 + idtout(5)
147  timinc(2) = float(ihraft)
148  CALL w3movdat(timinc,idatin,idtout)
149  iymdhe = ((idtout(1) * 100 + idtout(2)) * 100 + idtout(3)) *
150  1 100 + idtout(5)
151  print 124, iymdh,subdir(1:lsubdr),tankid(1:ltnkid),iymdhb,iymdhe
152  124 FORMAT(/'RUN ON ',i10/'WRITE TO ',a,'/',a/'ACCEPT BETWEEN ',i10,
153  1 ' AND ',i10/)
154  ierr = 0
155  RETURN
156  9999 CONTINUE
157  WRITE(6,'('' INSUFFICIENT NO. OF ARGUMENTS TO BUFR '',
158  1 ''TRANSLATION PROCEDURE - AT LEAST 4 ARE NEEDED'')')
159  ierr = 1
160  RETURN
161  END
w3trnarg
subroutine w3trnarg(SUBDIR, LSUBDR, TANKID, LTNKID, APPCHR, LAPCHR, TLFLAG, IYMDHB, IYMDHE, IERR)
Reads argument lines from standard input and obtains subdirectory, bufr tankname, characters to appen...
Definition: w3trnarg.f:65
w3movdat
subroutine w3movdat(rinc, idat, jdat)
This subprogram returns the date and time that is a given NCEP relative time interval from an NCEP ab...
Definition: w3movdat.f:24