NCEPLIBS-bufr  11.7.0
 All Data Structures Files Functions Variables Pages
adn30.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Convert an FXY value from its bit-wise (integer)
3 C> representation to its five or six character representation
4 
5 C> This function converts an FXY value from its bit-wise
6 C> (integer) representation to its 5 or 6 character
7 C> representation.
8 C>
9 C> @author J. Woollen
10 C> @date 1994-01-06
11 C>
12 C> @param[in] IDN -- integer: Bit-wise representation of FXY value
13 C> @param[in] L30 -- integer: Length of string to be returned; can be
14 C> either 5 or 6 characters
15 C> @returns adn30 -- character*(*): FXY value
16 C>
17 C> @remarks
18 C> - This function is the logical inverse of function idn30().
19 C>
20 C> <b>Program History Log:</b>
21 C> | Date | Programmer | Comments |
22 C> | -----|------------|----------|
23 C> | 1994-01-06 | J. Woollen | Original author |
24 C> | 1998-07-08 | J. Woollen | Replaced call to CRAY library routine "ABORT" with call to new internal BUFRLIB routine bort() |
25 C> | 2003-11-04 | S. Bender | Added remarks and routine interdependencies |
26 C> | 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 
35 C----------------------------------------------------------------------
36 C----------------------------------------------------------------------
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 
55 C EXITS
56 C -----
57 
58  RETURN
59 900 CALL bort('BUFRLIB: ADN30 - FUNCTION RETURN STRING TOO SHORT')
60 901 CALL bort('BUFRLIB: ADN30 - INTEGER REPRESENTATION OF '//
61  . 'DESCRIPTOR OUT OF 16-BIT RANGE')
62 902 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:28
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:22