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