NCEPLIBS-bufr 11.7.1
adn30.f
Go to the documentation of this file.
1C> @file
2C> @brief Convert an FXY value from its bit-wise (integer)
3C> representation to its five or six character representation
4
5C> This function converts an FXY value from its bit-wise
6C> (integer) representation to its 5 or 6 character
7C> representation.
8C>
9C> @author J. Woollen
10C> @date 1994-01-06
11C>
12C> @param[in] IDN -- integer: Bit-wise representation of FXY value
13C> @param[in] L30 -- integer: Length of string to be returned; can be
14C> either 5 or 6 characters
15C> @returns adn30 -- character*(*): FXY value
16C>
17C> @remarks
18C> - This function is the logical inverse of function idn30().
19C>
20C> <b>Program History Log:</b>
21C> | Date | Programmer | Comments |
22C> | -----|------------|----------|
23C> | 1994-01-06 | J. Woollen | Original author |
24C> | 1998-07-08 | J. Woollen | Replaced call to CRAY library routine "ABORT" with call to new internal BUFRLIB routine bort() |
25C> | 2003-11-04 | S. Bender | Added remarks and routine interdependencies |
26C> | 2003-11-04 | D. Keyser | Unified/portable for WRF; added history documentation |
27
28 FUNCTION adn30(IDN,L30)
29
30 COMMON /hrdwrd/ nbytw,nbitw,iord(8)
31
32 CHARACTER*(*) adn30
33 CHARACTER*128 bort_str
34
35C----------------------------------------------------------------------
36C----------------------------------------------------------------------
37
38 IF(len(adn30).LT.l30 ) GOTO 900
39 IF(idn.LT.0 .OR. idn.GT.65535) GOTO 901
40 IF(l30.EQ.5) THEN
41 WRITE(adn30,'(I5)') idn
42 ELSEIF(l30.EQ.6) THEN
43 idf = ishft(idn,-14)
44 idx = ishft(ishft(idn,nbitw-14),-(nbitw-6))
45 idy = ishft(ishft(idn,nbitw- 8),-(nbitw-8))
46 WRITE(adn30,'(I1,I2,I3)') idf,idx,idy
47 ELSE
48 GOTO 902
49 ENDIF
50
51 DO i=1,l30
52 IF(adn30(i:i).EQ.' ') adn30(i:i) = '0'
53 ENDDO
54
55C EXITS
56C -----
57
58 RETURN
59900 CALL bort('BUFRLIB: ADN30 - FUNCTION RETURN STRING TOO SHORT')
60901 CALL bort('BUFRLIB: ADN30 - INTEGER REPRESENTATION OF '//
61 . 'DESCRIPTOR OUT OF 16-BIT RANGE')
62902 WRITE(bort_str,'("BUFRLIB: ADN30 - CHARACTER LENGTH (",I4,") '//
63 . 'MUST BE EITHER 5 OR 6")') l30
64 CALL bort(bort_str)
65 END
character *(*) function adn30(IDN, L30)
This function converts an FXY value from its bit-wise (integer) representation to its 5 or 6 characte...
Definition: adn30.f:29
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23