NCEPLIBS-bufr 11.7.1
dxmini.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS SUBROUTINE INITIALIZES A BUFR TABLE (DICTIONARY)
5C> MESSAGE, WRITING ALL THE PRELIMINARY INFORMATION INTO SECTIONS 0,
6C> 1, 3, 4. BUFR ARCHIVE LIBRARY SUBROUTINE WRDXTB WILL WRITE THE
7C> ACTUAL TABLE INFORMATION INTO THE MESSAGE.
8C>
9C> PROGRAM HISTORY LOG:
10C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
11C> 1997-07-29 J. WOOLLEN -- MODIFIED TO UPDATE THE CURRENT BUFR VERSION
12C> WRITTEN IN SECTION 0 FROM 2 TO 3
13C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
14C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
15C> ROUTINE "BORT"
16C> 2000-09-19 J. WOOLLEN -- MAXIMUM MESSAGE LENGTH INCREASED FROM
17C> 10,000 TO 20,000 BYTES
18C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
19C> INTERDEPENDENCIES
20C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
21C> DOCUMENTATION (INCLUDING HISTORY); OUTPUTS
22C> MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
23C> TERMINATES ABNORMALLY
24C> 2004-08-09 J. ATOR -- MAXIMUM MESSAGE LENGTH INCREASED FROM
25C> 20,000 TO 50,000 BYTES
26C> 2005-11-29 J. ATOR -- CHANGED DEFAULT MASTER TABLE VERSION TO 12
27C> 2009-05-07 J. ATOR -- CHANGED DEFAULT MASTER TABLE VERSION TO 13
28C> 2019-05-21 J. ATOR -- CHANGED DEFAULT MASTER TABLE VERSION TO 29
29C> 2021-05-14 J. ATOR -- CHANGED DEFAULT MASTER TABLE VERSION TO 36
30C>
31C> USAGE: CALL DXMINI (LUN, MBAY, MBYT, MB4, MBA, MBB, MBD)
32C> INPUT ARGUMENT LIST:
33C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
34C>
35C> OUTPUT ARGUMENT LIST:
36C> MBAY - INTEGER: (MXMSGLD4)-WORD PACKED BINARY ARRAY
37C> CONTAINING BUFR MESSAGE
38C> MBYT - INTEGER: LENGTH OF BUFR MESSAGE (BYTES)
39C> MB4 - INTEGER: BYTE NUMBER IN MESSAGE OF FIRST BYTE IN
40C> SECTION 4
41C> MBA - INTEGER: BYTE NUMBER IN MESSAGE OF FOURTH BYTE IN
42C> SECTION 4
43C> MBB - INTEGER: BYTE NUMBER IN MESSAGE OF FIFTH BYTE IN
44C> SECTION 4
45C> MBD - INTEGER: BYTE NUMBER IN MESSAGE OF SIXTH BYTE IN
46C> SECTION 4
47C>
48C> REMARKS:
49C> ARGUMENT LUN IS NOT REFERENCED IN THIS SUBROUTINE. IT IS LEFT
50C> HERE IN CASE AN APPLICATION PROGRAM CALLS THIS SUBROUTINE.
51C>
52C> THIS ROUTINE CALLS: BORT IUPM PKB PKC
53C> THIS ROUTINE IS CALLED BY: WRDXTB
54C> Normally not called by any application
55C> programs.
56C>
57 SUBROUTINE dxmini(LUN,MBAY,MBYT,MB4,MBA,MBB,MBD)
58
59 USE modv_mxmsgl
60
61 COMMON /dxtab / maxdx,idxv,nxstr(10),ldxa(10),ldxb(10),ldxd(10),
62 . ld30(10),dxstr(10)
63
64 CHARACTER*128 BORT_STR
65 CHARACTER*56 DXSTR
66 dimension mbay(*)
67
68C-----------------------------------------------------------------------
69C-----------------------------------------------------------------------
70
71c .... The local message subtype is set to the version number of the
72c local tables (here = 1)
73 msbt = idxv
74
75C INITIALIZE THE MESSAGE
76C ----------------------
77
78 mbit = 0
79 DO i=1,mxmsgld4
80 mbay(i) = 0
81 ENDDO
82
83C For dictionary messages, the Section 1 date is simply zeroed out.
84C (Note that there is logic in function IDXMSG which relies on this!)
85
86 ih = 0
87 id = 0
88 im = 0
89 iy = 0
90
91c Dictionary messages get type 11 (see WMO Table A)
92 mtyp = 11
93 nsub = 1
94
95 idxs = idxv+1
96 ldxs = nxstr(idxs)
97
98 nby0 = 8
99 nby1 = 18
100 nby2 = 0
101 nby3 = 7 + nxstr(idxs) + 1
102 nby4 = 7
103 nby5 = 4
104 mbyt = nby0+nby1+nby2+nby3+nby4+nby5
105
106 IF(mod(nby3,2).NE.0) GOTO 900
107
108C SECTION 0
109C ---------
110
111 CALL pkc('BUFR' , 4 , mbay,mbit)
112 CALL pkb( mbyt , 24 , mbay,mbit)
113 CALL pkb( 3 , 8 , mbay,mbit)
114
115C SECTION 1
116C ---------
117
118 CALL pkb( nby1 , 24 , mbay,mbit)
119 CALL pkb( 0 , 8 , mbay,mbit)
120 CALL pkb( 3 , 8 , mbay,mbit)
121 CALL pkb( 7 , 8 , mbay,mbit)
122 CALL pkb( 0 , 8 , mbay,mbit)
123 CALL pkb( 0 , 8 , mbay,mbit)
124 CALL pkb( mtyp , 8 , mbay,mbit)
125 CALL pkb( msbt , 8 , mbay,mbit)
126 CALL pkb( 36 , 8 , mbay,mbit)
127 CALL pkb( idxv , 8 , mbay,mbit)
128 CALL pkb( iy , 8 , mbay,mbit)
129 CALL pkb( im , 8 , mbay,mbit)
130 CALL pkb( id , 8 , mbay,mbit)
131 CALL pkb( ih , 8 , mbay,mbit)
132 CALL pkb( 0 , 8 , mbay,mbit)
133 CALL pkb( 0 , 8 , mbay,mbit)
134
135C SECTION 3
136C ---------
137
138 CALL pkb( nby3 , 24 , mbay,mbit)
139 CALL pkb( 0 , 8 , mbay,mbit)
140 CALL pkb( 1 , 16 , mbay,mbit)
141 CALL pkb( 2**7 , 8 , mbay,mbit)
142 DO i=1,ldxs
143 CALL pkb(iupm(dxstr(idxs)(i:i),8),8,mbay,mbit)
144 ENDDO
145 CALL pkb( 0 , 8 , mbay,mbit)
146
147C SECTION 4
148C ---------
149
150 mb4 = mbit/8+1
151 CALL pkb(nby4 , 24 , mbay,mbit)
152 CALL pkb( 0 , 8 , mbay,mbit)
153 mba = mbit/8+1
154 CALL pkb( 0 , 8 , mbay,mbit)
155 mbb = mbit/8+1
156 CALL pkb( 0 , 8 , mbay,mbit)
157 mbd = mbit/8+1
158 CALL pkb( 0 , 8 , mbay,mbit)
159
160 IF(mbit/8+nby5.NE.mbyt) GOTO 901
161
162C EXITS
163C -----
164
165 RETURN
166900 CALL bort
167 . ('BUFRLIB: DXMINI - LENGTH OF SECTION 3 IS NOT A MULTIPLE OF 2')
168901 WRITE(bort_str,'("BUFRLIB: DXMINI - NUMBER OF BYTES STORED FOR '//
169 . 'A MESSAGE (",I6,") IS NOT THE SAME AS FIRST CALCULATED, MBYT '//
170 . '(",I6)') mbit/8+nby5,mbyt
171 CALL bort(bort_str)
172 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine dxmini(LUN, MBAY, MBYT, MB4, MBA, MBB, MBD)
THIS SUBROUTINE INITIALIZES A BUFR TABLE (DICTIONARY) MESSAGE, WRITING ALL THE PRELIMINARY INFORMATIO...
Definition: dxmini.f:58
function iupm(CBAY, NBITS)
THIS FUNCTION UNPACKS AND RETURNS A BINARY INTEGER WORD CONTAINED WITHIN NBITS BITS OF A CHARACTER ST...
Definition: iupm.f:41
This module declares and initializes the MXMSGL variable.
Definition: modv_MXMSGL.f:13
integer mxmsgld4
The value of mxmsgl divided by 4.
Definition: modv_MXMSGL.f:23
subroutine pkb(NVAL, NBITS, IBAY, IBIT)
This subroutine encodes an integer value within a specified number of bits of an integer array,...
Definition: pkb.f:39
subroutine pkc(CHR, NCHR, IBAY, IBIT)
This subroutine encodes a character string within a specified number of bits of an integer array,...
Definition: pkc.f:41