NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3fi32.f
Go to the documentation of this file.
1C> @file
2C> @brief Pack id's into office note 84 format.
3C> @author Alan Nierow @date 1986-02-07
4
5C> Converts an array of the 27 data field identifiers into
6C> an array of the first 8 identification words of the format de-
7C> scribed in NMC office note 84 (89-06-15, page-35). On a cray
8C> they will fit into four 64 bit integer words.
9C>
10C> Program history log:
11C> - Alan Nierow 1986-02-07
12C> - Ralph Jones 1989-10-24 Convert to cray cft77 fortran.
13C> - Ralph Jones 1991-03-19 Changes for big records.
14C> - Boi Vuong 1998-03-10 Remove the cdir$ integer=64 directive.
15C> - Stephen Gilbert 1999-03-15 Specified 8-byte integer array explicitly.
16C>
17C> @param[in] LARRAY Integer array containing 27 data field
18C> identifiers (see o.n. 84)
19C> @param[out] KIDNT Integer array of 6 words, 12 office note 84 32 bit
20C> words, first 4 words are made by w3fi32(), if you are
21C> using packer w3ai00(), it will compute word 5 and 6.
22C> (office note 84 words 9,10, 11 and 12). If J the
23C> word count in word 27 of LARRAY is greater than
24C> 32743 then bits 15-0 of the 4th ID word are set to
25C> zero, J is stored in bits 31-0 of the 6th ID word.
26C> ID word 5 is set zero, bit 63-32 of the 6th ID
27C> word are set zero.
28C> @note bis are number left to right on the cray as 63-0.
29C>
30C> @note Exit states printed messages:
31C> If any number n in (LARRAY(i),i=1,27) is erroneously large:
32C> 'value in LARRAY(i)=n is too large to pack'
33C> if any number n in (LARRAY(i),i=1,27) is erroneously negative:
34C> 'value in LARRAY(i)=n should not be negative'
35C> in either of the above situations, that portion of the packed
36C> word corresponding to LARRAY(i) will be set to binary ones.
37C>
38C> @author Alan Nierow @date 1986-02-07
39 SUBROUTINE w3fi32(LARRAY,KIDNT)
40C
41 INTEGER(8) LARRAY(27)
42 INTEGER(8) ITABLE(27)
43 INTEGER(8) KIDNT(*)
44 INTEGER(8) KX,MASK,MASK16,ISC,ITEMP8
45C
46 SAVE
47C
48 DATA itable/z'0000000000340C01',z'0000000000280C01',
49 & z'0000000000200801',z'00000000001C0401',
50 & z'0000000001081401',z'0000000001000801',
51 & z'00000000003C0402',z'0000000000340802',
52 & z'0000000000280C02',z'0000000000200802',
53 & z'00000000001C0402',z'0000000001081402',
54 & z'0000000001000802',z'0000000000380803',
55 & z'0000000000300803',z'0000000000280803',
56 & z'0000000000200803',z'00000000001C0403',
57 & z'0000000000100C03',z'0000000000001003',
58 & z'0000000000380804',z'0000000000300804',
59 & z'0000000000280804',z'0000000000200804',
60 & z'0000000000180804',z'0000000000100804',
61 & z'0000000000001004'/
62 DATA kx /z'00000000FFFFFFFF'/
63 DATA mask /z'00000000000000FF'/
64 DATA mask16/z'FFFFFFFFFFFF0000'/
65C
66C MAKE KIDNT = 0
67C
68 DO 10 i = 1,4
69 kidnt(i) = 0
70 10 CONTINUE
71C
72 isign = 0
73C
74 DO 90 i = 1,27
75 isc = itable(i)
76 i1 = iand(isc,mask)
77 i2 = iand(ishft(isc,-8_8), mask)
78 i3 = iand(ishft(isc,-16_8),mask)
79 i4 = iand(ishft(isc,-24_8),mask)
80C
81C SIGN TEST
82C
83 iv = larray(i)
84 IF (iv.GE.0) GO TO 50
85 IF (i4.NE.0) GO TO 30
86 WRITE (6,20) i, iv
87 20 FORMAT(/,1x,' W3FI32 - VALUE IN LARRAY(',i2,') =',i11,
88 & ' SHOULD NOT BE NEGATIVE',/)
89 GO TO 70
90C
91 30 CONTINUE
92 iv = iabs(iv)
93 msign = 1
94 isign = msign
95 k = i2 / 4
96C
97 DO 40 m = 1,k
98 isign = ishft(isign,4)
99 40 CONTINUE
100C
101 isign = ishft(isign,-1)
102 iv = ior(iv,isign)
103C
104 50 CONTINUE
105C
106C MAG TEST
107C
108 IF (ishft(iv,-i2).EQ.0) GO TO 80
109 IF (larray(27).GT.32743) GO TO 70
110 print 60, i , iv
111 60 FORMAT(/,1x,' W3FI32 - VALUE IN LARRAY(',i2,') =',i11,
112 & ' IS TOO LARGE TO PACK',/)
113C
114 70 CONTINUE
115 iv = kx
116 ia = 32 - i2
117 iv = ishft(iv,-ia)
118C
119C SHIFT
120C
121 80 CONTINUE
122 itemp=ishft(iv,i3)
123 itemp8=itemp
124 kidnt(i1) = ior(kidnt(i1),itemp8)
125C
126 90 CONTINUE
127C
128C TEST FOR BIG RECORDS, STORE J THE WORD COUNT IN THE 6TH
129C ID WORD IF GREATER THAN 32743.
130C
131 IF (larray(27).EQ.0) THEN
132 print *,' W3FI32 - ERROR, WORD COUNT J = 0'
133 ELSE IF (larray(27).GT.32743) THEN
134 kidnt(4) = iand(kidnt(4),mask16)
135 kidnt(5) = 0
136 kidnt(6) = larray(27)
137 END IF
138C
139 RETURN
140 END
subroutine w3fi32(larray, kidnt)
Converts an array of the 27 data field identifiers into an array of the first 8 identification words ...
Definition w3fi32.f:40