NCEPLIBS-bufr  12.0.0
dxmini.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Initialize a DX BUFR tables message.
3 C> @author Woollen @date 1994-01-06
4 
5 C> This subroutine initializes a DX BUFR tables (dictionary)
6 C> message, writing all the preliminary information into Sections 0,
7 C> 1, 3, 4. Subroutine wrdxtb() will write the
8 C> actual table information into the message.
9 C>
10 C> @param[out] MBAY - integer: BUFR message.
11 C> @param[out] MBYT - integer: length (in bytes) of BUFR message.
12 C> @param[out] MB4 - integer: byte number in message of first byte in Section 4.
13 C> @param[out] MBA - integer: byte number in message of fourth byte in Section 4.
14 C> @param[out] MBB - integer: byte number in message of fifth byte in Section 4.
15 C> @param[out] MBD - integer: byte number in message of sixth byte in Section 4.
16 C>
17 C> @author Woollen @date 1994-01-06
18  SUBROUTINE dxmini(MBAY,MBYT,MB4,MBA,MBB,MBD)
19 
20  USE modv_mxmsgl
21 
22  COMMON /dxtab / maxdx,idxv,nxstr(10),ldxa(10),ldxb(10),ldxd(10),
23  . ld30(10),dxstr(10)
24 
25  CHARACTER*128 BORT_STR
26  CHARACTER*56 DXSTR
27  dimension mbay(*)
28 
29 C-----------------------------------------------------------------------
30 C-----------------------------------------------------------------------
31 
32 c .... The local message subtype is set to the version number of the
33 c local tables (here = 1)
34  msbt = idxv
35 
36 C INITIALIZE THE MESSAGE
37 C ----------------------
38 
39  mbit = 0
40  DO i=1,mxmsgld4
41  mbay(i) = 0
42  ENDDO
43 
44 C For dictionary messages, the Section 1 date is simply zeroed out.
45 C (Note that there is logic in function IDXMSG which relies on this!)
46 
47  ih = 0
48  id = 0
49  im = 0
50  iy = 0
51 
52 c Dictionary messages get type 11 (see WMO Table A)
53  mtyp = 11
54  nsub = 1
55 
56  idxs = idxv+1
57  ldxs = nxstr(idxs)
58 
59  nby0 = 8
60  nby1 = 18
61  nby2 = 0
62  nby3 = 7 + nxstr(idxs) + 1
63  nby4 = 7
64  nby5 = 4
65  mbyt = nby0+nby1+nby2+nby3+nby4+nby5
66 
67  IF(mod(nby3,2).NE.0) GOTO 900
68 
69 C SECTION 0
70 C ---------
71 
72  CALL pkc('BUFR' , 4 , mbay,mbit)
73  CALL pkb( mbyt , 24 , mbay,mbit)
74  CALL pkb( 3 , 8 , mbay,mbit)
75 
76 C SECTION 1
77 C ---------
78 
79  CALL pkb( nby1 , 24 , mbay,mbit)
80  CALL pkb( 0 , 8 , mbay,mbit)
81  CALL pkb( 3 , 8 , mbay,mbit)
82  CALL pkb( 7 , 8 , mbay,mbit)
83  CALL pkb( 0 , 8 , mbay,mbit)
84  CALL pkb( 0 , 8 , mbay,mbit)
85  CALL pkb( mtyp , 8 , mbay,mbit)
86  CALL pkb( msbt , 8 , mbay,mbit)
87  CALL pkb( 36 , 8 , mbay,mbit)
88  CALL pkb( idxv , 8 , mbay,mbit)
89  CALL pkb( iy , 8 , mbay,mbit)
90  CALL pkb( im , 8 , mbay,mbit)
91  CALL pkb( id , 8 , mbay,mbit)
92  CALL pkb( ih , 8 , mbay,mbit)
93  CALL pkb( 0 , 8 , mbay,mbit)
94  CALL pkb( 0 , 8 , mbay,mbit)
95 
96 C SECTION 3
97 C ---------
98 
99  CALL pkb( nby3 , 24 , mbay,mbit)
100  CALL pkb( 0 , 8 , mbay,mbit)
101  CALL pkb( 1 , 16 , mbay,mbit)
102  CALL pkb( 2**7 , 8 , mbay,mbit)
103  DO i=1,ldxs
104  CALL pkb(iupm(dxstr(idxs)(i:i),8),8,mbay,mbit)
105  ENDDO
106  CALL pkb( 0 , 8 , mbay,mbit)
107 
108 C SECTION 4
109 C ---------
110 
111  mb4 = mbit/8+1
112  CALL pkb(nby4 , 24 , mbay,mbit)
113  CALL pkb( 0 , 8 , mbay,mbit)
114  mba = mbit/8+1
115  CALL pkb( 0 , 8 , mbay,mbit)
116  mbb = mbit/8+1
117  CALL pkb( 0 , 8 , mbay,mbit)
118  mbd = mbit/8+1
119  CALL pkb( 0 , 8 , mbay,mbit)
120 
121  IF(mbit/8+nby5.NE.mbyt) GOTO 901
122 
123 C EXITS
124 C -----
125 
126  RETURN
127 900 CALL bort
128  . ('BUFRLIB: DXMINI - LENGTH OF SECTION 3 IS NOT A MULTIPLE OF 2')
129 901 WRITE(bort_str,'("BUFRLIB: DXMINI - NUMBER OF BYTES STORED FOR '//
130  . 'A MESSAGE (",I6,") IS NOT THE SAME AS FIRST CALCULATED, MBYT '//
131  . '(",I6)') mbit/8+nby5,mbyt
132  CALL bort(bort_str)
133  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
subroutine dxmini(MBAY, MBYT, MB4, MBA, MBB, MBD)
This subroutine initializes a DX BUFR tables (dictionary) message, writing all the preliminary inform...
Definition: dxmini.f:19
recursive function iupm(CBAY, NBITS)
Decode an integer value from a character string.
Definition: iupm.f:20
This module declares and initializes the MXMSGL variable.
integer mxmsgld4
The value of mxmsgl divided by 4.
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:28
subroutine pkc(CHR, NCHR, IBAY, IBIT)
Encode a character string within an integer array.
Definition: pkc.f:31