NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3ai01.f
Go to the documentation of this file.
1C> @file
2C> @brief Unpack record into IEEE F.P.
3C> @author Ralph Jones @date 1989-10-17
4
5C> Unpacks a record in office note 84 format and convert the
6C> packed data to ieee real floating point numbers. The
7C> office note 84 data is bit for bit the same on the nas-9050 and
8C> the cray.
9C>
10C> Program history log:
11C> - Ralph Jones 1989-10-20
12C> - Ralph Jones 1990-02-02 Change to cray function for integer*2, f.p.
13C> - Ralph Jones 1990-10-11 Special version of w3ai01 to unpack records
14c> packed by big version of w3ai00. Will do old and new version.
15C> - Ralph Jones 1991-03-19 Make special version of w3ai01 to unpack
16c> big records the operational version.
17C> - Ralph Jones 1993-06-10 Increace array size to 262144 words.
18C> - Boi Vuong 1998-03-10 Remove the cdir$ integer=64 directive.
19C> - Stephen Gilbert 1998-11-17 Changed to unpack into IEEE reals for the IBM SP.
20C>
21C> @param[in] PACK Integer array with data in office note 84 format to be unpacked.
22C> @param[out] REAL8 Real array of n words. where n is given in word 6 of pack.
23c> Word 6 of pack must contain center and scaling values.
24C> @param[out] LABEL Six word integer label copied from pack,
25c> 12 office note 84 32 bit id's that are stored into six 64-bit words.
26C>
27C> @note Label and pack may be equivalenced.
28C>
29C> @author Ralph Jones @date 1989-10-17
30
31 SUBROUTINE w3ai01(PACK,REAL8,LABEL)
32C
33 REAL REAL8(*)
34C
35 INTEGER(2) ITEMP(262144)
36 INTEGER(8) LABEL(6)
37 INTEGER(8) PACK(*)
38 INTEGER(8) MASK16
39 INTEGER(8) MASK32
40 integer(2) i2(4)
41 real(4) rtemp(2)
42 integer(8) ktemp,jtemp(65536)
43 equivalence(ktemp,rtemp(1),i2(1))
44 equivalence(itemp(1),jtemp(1))
45C
46 SAVE
47C
48 DATA mask16/z'000000000000FFFF'/
49 DATA mask32/z'00000000FFFFFFFF'/
50C
51C MOVE OFFICE NOTE 84 12 32 BIT ID'S INTO LABEL
52C
53 DO 10 i = 1,6
54 label(i) = pack(i)
55 10 CONTINUE
56C
57C GET WORD COUNT, AVERAGE VALUE, SCALING FACTOR, J, A , N.
58C
59 j = iand(label(4),mask16)
60 IF (j.EQ.0) THEN
61 j = iand(label(6),mask32)
62 IF (j.EQ.0) THEN
63 print *,' W3AI01 ERROR, NUMBER OF WORDS IN GRID IS 0'
64 RETURN
65 ENDIF
66 IF (j.GT.262144) THEN
67 print *,' W3AI01 ERROR, NUMBER OF WORDS IN GRID IS ',j
68 print *,' THERE IS A LIMIT OF 262144'
69 RETURN
70 ENDIF
71 ENDIF
72C
73C CONVERT IBM 32 BIT MEAN VALUE TO IEEE F.P. NUMBER
74C
75C CALL USSCTC(LABEL(5),5,A,1)
76 ktemp=label(5)
77 call q9ie32(rtemp(2),rtemp(1),1,istat)
78 a=rtemp(1)
79C
80C GET SCALING VALUE N, CAN BE NEGATIVE (INTEGER*2 TWO'S COMPL.)
81C
82C CALL USICTC(LABEL(6),3,N,1,2)
83 ktemp=label(6)
84 n=i2(2)
85C
86 twon = 2.0 ** (n - 15)
87C
88C UNPACK, CONVERT TO REAL 64 BIT FLOATING POINT DATA
89C
90C CALL USICTC(PACK(7),1,ITEMP,J,2)
91 jtemp(1:65536)=pack(7:65542)
92C
93 DO 20 i = 1,j
94 real8(i) = float(itemp(i)) * twon + a
95 20 CONTINUE
96C
97 RETURN
98 END
subroutine q9ie32(a, b, n, istat)
Convert ibm370 32 bit floating point numbers to ieee 32 bit task 754 floating point numbers.
Definition q9ie32.f:28
subroutine w3ai01(pack, real8, label)
Unpacks a record in office note 84 format and convert the packed data to ieee real floating point num...
Definition w3ai01.f:32