NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3trnarg.f
Go to the documentation of this file.
1C> @file
2C> @brief Translates arg line from standard input
3C> @author Dennis Keyser @date 2002-02-11
4
5C> Reads argument lines from standard input and obtains subdirectory, bufr
6C> tankname, characters to append for adding an orbit, and options for limiting
7C> the time window.
8C>
9C> ### Program History Log:
10C> Date | Programmer | Comment
11C> -----|------------|--------
12C> 1996-09-03 | B. KATZ | Original author
13C> 1998-11-27 | B. KATZ | Changes for y2k and fortran 90 compliance
14C> 2002-02-11 | D. KEYSER | If "tlflag" is not specified, it defaults to
15C> "notimlim" rather than "timlim" and gross time limits will not be
16C> calculated and returned in "iymdhb" and "iymdhe"
17C>
18C> @param[in] SUBDIR Name of sub-directory including bufr data type where
19C> bufr data tank is located.
20C> @param[in] LSUBDR Number of characters in 'subdir'.
21C> @param[in] TANKID Name of file including bufr data sub-type containing
22C> bufr data tank.
23C> @param[in] LTNKID Number of characters in 'tankid'.
24C> @param[in] APPCHR Characters to be appended to 'tankid' giving a
25C> uniquely named file to contain the original tank
26C> with one orbit appended to it.
27C> @param[in] LAPCHR Number of characters in 'appchr'.
28C> @param[in] TLFLAG 8 character flag indicating whether time acceptance
29C> checks atre to be performed.
30C> = 'timlim ' : perform time acceptance checks.
31C> = 'notimlim' : do not perform time acceptance checks.
32C> jdate and kdate are disregarded.
33C> @param[in] IYMDHB Start of time acceptance window, in form yyyymmddhh.
34C> @param[in] IYMDHE End of time acceptance window, in form yyyymmddhh.
35C> @param IERR
36C>
37C> Input files :
38C> unit 05 - standard input for passing in arguments. arguments
39C> (for list-directed i/o) are as follows :
40C> record 1 - (1) subdirectory. contains bufr data type
41C> (2) tankfile. contains bufr data sub-type
42C> (3) append characters. appended to tankfile
43C> to give unique output file name.
44C> (4) date in yyyymmddhh format.
45C> next three records are optional :
46C> record 2 - (1) time limit flag. may be either
47C> 'timlim ' or 'notimlim'. see
48C> description of 'tlflag' above.
49C> (default is 'notimlim')
50C> record 3 - (1) hours before current time.
51C> record 4 - (1) hours after current time.
52C> if 'timlim ' is specified in record 2, the
53C> quantities in records 3 and 4 are used to
54C> compute the limits of the time acceptance window.
55C> if records 3 and 4 are omitted, the values
56C> default to -48 (48 hours before current time)
57C> and +12 (12 hours after current time).
58C> if 'notimlim ' is specified in record 2, then
59C> these quantities are not used regardless of whether
60C> or not they were specified.
61C>
62C> @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
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
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