NCEPLIBS-bufr  12.0.1
bfrini.f90
Go to the documentation of this file.
1 
4 
15 subroutine bfrini
16 
17 USE modv_maxjl
18 USE modv_maxtba
19 USE modv_maxtbb
20 USE modv_maxtbd
21 USE modv_mxmsgl
22 USE modv_nfiles
23 
24 USE moda_stbfr
25 USE moda_idrdm
26 USE moda_msglim
27 USE moda_bitbuf
28 USE moda_bufrmg
29 USE moda_bufrsr
30 USE moda_tababd
31 USE moda_usrint
32 USE moda_tables
33 USE moda_h4wlc
34 USE moda_dscach
35 
36 COMMON /maxcmp/ maxcmb,maxrow,maxcol,ncmsgs,ncsubs,ncbyts
37 COMMON /padesc/ ibct,ipd1,ipd2,ipd3,ipd4
38 COMMON /reptab/ idnr(5,2),typs(5,2),reps(5,2),lens(5)
39 COMMON /dxtab / maxdx,idxv,nxstr(10),ldxa(10),ldxb(10),ldxd(10), &
40  ld30(10),dxstr(10)
41 COMMON /mrgcom/ nrpl,nmrg,namb,ntot
42 COMMON /dateln/ lendat
43 COMMON /acmode/ iac
44 COMMON /msgstd/ csmf
45 COMMON /msgcmp/ ccmf
46 COMMON /tablef/ cdmf
47 COMMON /tnkrcp/ itryr,itrmo,itrdy,itrhr,itrmi,ctrt
48 COMMON /endord/ iblock,iordbe(4),iordle(4)
49 
50 character*240 CMTDIR
51 character*56 DXSTR
52 character*6 ADSN(5,2),DNDX(25,10)
53 character*3 TYPX(5,2),TYPS
54 character*1 REPX(5,2),REPS
55 character*1 CSMF
56 character*1 CCMF
57 character*1 CDMF
58 character*1 CTRT
59 dimension ndndx(10),nldxa(10),nldxb(10),nldxd(10),nld30(10)
60 dimension lenx(5)
61 
62 data adsn / '101000','360001','360002','360003','360004' , &
63  '101255','031002','031001','031001','031000' /
64 data typx / 'REP', 'DRP', 'DRP', 'DRS' , 'DRB' , &
65  'SEQ', 'RPC', 'RPC', 'RPS' , 'SEQ' /
66 data repx / '"', '(', '{', '[' , '<' , &
67  '"', ')', '}', ']' , '>' /
68 data lenx / 0 , 16 , 8 , 8 , 1 /
69 
70 data (dndx(i,1),i=1,25)/ &
71 '102000','031001','000001','000002', &
72 '110000','031001','000010','000011','000012','000013','000015', &
73  '000016','000017','000018','000019','000020', &
74 '107000','031001','000010','000011','000012','000013','101000', &
75  '031001','000030'/
76 
77 data (dndx(i,2),i=1,15)/ &
78 '103000','031001','000001','000002','000003', &
79 '101000','031001','300004', &
80 '105000','031001','300003','205064','101000','031001','000030'/
81 
82 data ndndx / 25 , 15 , 8*0 /
83 data nldxa / 35 , 67 , 8*0 /
84 data nldxb / 80 , 112 , 8*0 /
85 data nldxd / 38 , 70 , 8*0 /
86 data nld30 / 5 , 6 , 8*0 /
87 
88 !-----------------------------------------------------------------------
89 !-----------------------------------------------------------------------
90 
91 ! Initialize /ENDORD/ to control output blocking -1=LE 0=NONE +1=BE
92 ! -----------------------------------------------------------------
93 
94 iblock = 0
95 
96 ! Initialize module BITBUF
97 ! ------------------------
98 
99 maxbyt = min(10000,mxmsgl)
100 
101 ! Initialize module H4WLC
102 ! -----------------------
103 
104 nh4wlc = 0
105 
106 ! Initialize /MAXCMP/
107 ! -------------------
108 
109 maxcmb = maxbyt
110 maxrow = 0
111 maxcol = 0
112 ncmsgs = 0
113 ncsubs = 0
114 ncbyts = 0
115 
116 ! Initialize /PADESC/
117 ! -------------------
118 
119 ibct = ifxy('063000')
120 ipd1 = ifxy('102000')
121 ipd2 = ifxy('031001')
122 ipd3 = ifxy('206001')
123 ipd4 = ifxy('063255')
124 
125 ! Initialize module STBFR
126 ! -----------------------
127 
128 do i=1,nfiles
129  iolun(i) = 0
130  iomsg(i) = 0
131 enddo
132 
133 ! Initialize module IDRDM
134 ! -----------------------
135 
136 do i=1,nfiles
137  idrdm(i) = 0
138 enddo
139 
140 ! Initialize module MSGLIM
141 ! ------------------------
142 
143 do i=1,nfiles
144  msglim(i) = 3
145 enddo
146 
147 ! Initialize module USRINT
148 ! ------------------------
149 
150 do i=1,nfiles
151  nval(i) = 0
152 enddo
153 
154 ! Initialize /REPTAB/
155 ! -------------------
156 
157 do i=1,5
158  lens(i) = lenx(i)
159  do j=1,2
160  idnr(i,j) = ifxy(adsn(i,j))
161  typs(i,j) = typx(i,j)
162  reps(i,j) = repx(i,j)
163  enddo
164 enddo
165 
166 ! Initialize TABABD (internal arrays holding dictionary table)
167 ! ------------------------------------------------------------
168 
169 ! NTBA(0) is the maximum number of entries w/i internal BUFR table A
170 
171 ntba(0) = maxtba
172 
173 ! NTBB(0) is the maximum number of entries w/i internal BUFR Table B
174 
175 ntbb(0) = maxtbb
176 
177 ! NTBD(0) is the maximum number of entries w/i internal BUFR Table D
178 
179 ntbd(0) = maxtbd
180 
181 ! Initialize /DXTAB/
182 ! ------------------
183 
184 maxdx = maxbyt
185 ! .... IDXV is the version number of the local tables
186 idxv = 1
187 
188 do j=1,10
189  ldxa(j) = nldxa(j)
190  ldxb(j) = nldxb(j)
191  ldxd(j) = nldxd(j)
192  ld30(j) = nld30(j)
193  dxstr(j) = ' '
194  nxstr(j) = ndndx(j)*2
195  do i=1,ndndx(j)
196  i1 = i*2-1
197  call ipkm(dxstr(j)(i1:i1),2,ifxy(dndx(i,j)))
198  enddo
199 enddo
200 
201 ! Initialize module TABLES
202 ! ------------------------
203 
204 maxtab = maxjl
205 
206 ! Initialize module BUFRMG
207 ! ------------------------
208 
209 do i=1,nfiles
210  msglen(i) = 0
211 enddo
212 
213 ! Initialize /MRGCOM/
214 ! -------------------
215 
216 nrpl = 0
217 nmrg = 0
218 namb = 0
219 ntot = 0
220 
221 ! Initialize /DATELN/
222 ! -------------------
223 
224 if(lendat.ne.10) lendat = 8
225 
226 ! Initialize /ACMODE/
227 ! -------------------
228 
229 iac = 0
230 
231 ! Initialize module BUFRSR
232 ! ------------------------
233 
234 do i=1,nfiles
235  jsr(i) = 0
236 enddo
237 
238 ! Initialize /DSCACH/
239 ! -------------------
240 
241 ncnem = 0
242 
243 ! Initialize /MSGSTD/
244 ! -------------------
245 
246 csmf = 'N'
247 
248 ! Initialize /MSGCMP/
249 ! -------------------
250 
251 ccmf = 'N'
252 
253 ! Initialize /TABLEF/
254 ! -------------------
255 
256 cdmf = 'N'
257 
258 ! Initialize /TNKRCP/
259 ! -------------------
260 
261 ctrt = 'N'
262 
263 ! Initialize /MSTINF/
264 ! -------------------
265 
266 cmtdir = &
267 '/home/runner/work/NCEPLIBS-bufr/NCEPLIBS-bufr/bufr/build/ins' // &
268 'tall/tables'
269 call mtinfo(cmtdir,98,99)
270 
271 return
272 end
subroutine bfrini
This subroutine initializes numerous global variables and arrays within internal modules and COMMON b...
Definition: bfrini.f90:16
function ifxy(ADSC)
Convert an FXY value from its 6 character representation to its WMO bit-wise representation.
Definition: ifxy.f:34
recursive subroutine ipkm(CBAY, NBYT, N)
Encode an integer value within a character string.
Definition: ipkm.f:22
recursive subroutine mtinfo(CMTDIR, LUNMT1, LUNMT2)
Specify the directory location and Fortran logical unit numbers to be used when reading master BUFR t...
Definition: mtinfo.f:39
This module contains array and variable declarations used to store BUFR messages internally for multi...
integer maxbyt
Maximum length of an output BUFR message.
This module contains arrays used to store, for each output I/O stream, a copy of the BUFR message tha...
integer, dimension(:), allocatable msglen
Length (in integers) of BUFR message most recently written to each output I/O stream.
This module contains arrays and variables needed to store the current position within a BUFR file.
integer, dimension(:), allocatable jsr
Indicator of stack status when entering subroutine rewnbf().
This module contains array and variable declarations for the internal Table A mnemonic cache that is ...
integer ncnem
Number of entries in the internal Table A mnemonic cache (up to a maximum of MXCNEM).
This module contains array and variable declarations needed to store long character strings (greater ...
integer nh4wlc
Number of long character strings being stored.
This module contains a declaration for an array used by subroutine readerme() to read in a new DX dic...
integer, dimension(:), allocatable idrdm
DX BUFR tables message count for each I/O internal stream index.
This module contains a declaration for an array used to keep track of which logical units should not ...
integer, dimension(:), allocatable msglim
Tracking index for each I/O stream index.
This module contains array declarations used to store file and message status indicators for all logi...
integer, dimension(:), allocatable iolun
File status indicators.
integer, dimension(:), allocatable iomsg
Message status indicator corresponding to iolun, denoting whether a BUFR message is currently open wi...
This module contains array and variable declarations used to store DX BUFR tables internally for mult...
integer, dimension(:), allocatable ntba
Number of Table A entries for each internal I/O stream (up to a maximum of MAXTBA,...
integer, dimension(:), allocatable ntbd
Number of Table D entries for each internal I/O stream (up to a maximum of MAXTBD,...
integer, dimension(:), allocatable ntbb
Number of Table B entries for each internal I/O stream (up to a maximum of MAXTBB,...
This module contains array and variable declarations used to store the internal jump/link table.
integer maxtab
Maximum number of entries in the jump/link table; equivalent to MAXJL.
This module contains declarations for arrays used to store data values and associated metadata for th...
integer, dimension(:), allocatable nval
Number of data values in BUFR data subset.
This module declares and initializes the MAXJL variable.
integer maxjl
Maximum number of entries in the internal jump/link table.
This module declares and initializes the MAXTBA variable.
integer maxtba
Maximum number of entries in the internal BUFR Table A for each BUFR file that is connected to the BU...
This module declares and initializes the MAXTBB variable.
integer maxtbb
Maximum number of entries in the internal BUFR Table B for each BUFR file that is connected to the BU...
This module declares and initializes the MAXTBD variable.
integer maxtbd
Maximum number of entries in the internal BUFR Table D for each BUFR file that is connected to the BU...
This module declares and initializes the MXMSGL variable.
integer mxmsgl
Maximum length (in bytes) of a BUFR message that can be read or written by the BUFRLIB software.
This module declares and initializes the NFILES variable.
integer, public nfiles
Maximum number of BUFR files that can be connected to the BUFRLIB software (for reading or writing) a...