NCEPLIBS-bufr  12.0.1
adn30.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Convert a WMO bit-wise representation of an FXY value
3 C> to a character string of length 5 or 6.
4 C>
5 C> @author J. Woollen @date 1994-01-06
6 
7 C> Convert a WMO bit-wise representation of an FXY value
8 C> to a character string of length 5 or 6.
9 C>
10 C> For an description of the WMO bit-wise representation of the FXY
11 C> value, see ifxy().
12 C>
13 C> This function is the logical inverse of function idn30().
14 C>
15 C> @param[in] IDN - integer: WMO bit-wise representation of FXY value.
16 C> @param[in] L30 - integer: Length of string to be returned; can be
17 C> either 5 or 6 characters.
18 C> @returns adn30 - character*(*): FXY character string.
19 C>
20 C> @author J. Woollen @date 1994-01-06
21 
22  FUNCTION adn30(IDN,L30)
23 
24  COMMON /hrdwrd/ nbytw,nbitw,iord(8)
25 
26  CHARACTER*(*) adn30
27  CHARACTER*128 bort_str
28 
29 C----------------------------------------------------------------------
30 C----------------------------------------------------------------------
31  IF(len(adn30).LT.l30 ) GOTO 900
32  IF(idn.LT.0 .OR. idn.GT.65535) GOTO 901
33  IF(l30.EQ.5) THEN
34  WRITE(adn30,'(I5)') idn
35  ELSEIF(l30.EQ.6) THEN
36  idf = ishft(idn,-14)
37  idx = ishft(ishft(idn,nbitw-14),-(nbitw-6))
38  idy = ishft(ishft(idn,nbitw- 8),-(nbitw-8))
39  WRITE(adn30,'(I1,I2,I3)') idf,idx,idy
40  ELSE
41  GOTO 902
42  ENDIF
43 
44  DO i=1,l30
45  IF(adn30(i:i).EQ.' ') adn30(i:i) = '0'
46  ENDDO
47 
48 C EXITS
49 C -----
50 
51  RETURN
52 900 CALL bort('BUFRLIB: ADN30 - FUNCTION RETURN STRING TOO SHORT')
53 901 CALL bort('BUFRLIB: ADN30 - INTEGER REPRESENTATION OF '//
54  . 'DESCRIPTOR OUT OF 16-BIT RANGE')
55 902 WRITE(bort_str,'("BUFRLIB: ADN30 - CHARACTER LENGTH (",I4,") '//
56  . 'MUST BE EITHER 5 OR 6")') l30
57  CALL bort(bort_str)
58  END
character *(*) function adn30(IDN, L30)
Convert a WMO bit-wise representation of an FXY value to a character string of length 5 or 6.
Definition: adn30.f:23
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18