Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / external / bufr / isize.f
blobfe4b44b27cfd99c60cbbafd5f6fa59fc7911ae18
1 INTEGER FUNCTION ISIZE (NUM)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 C SUBPROGRAM: ISIZE
6 C PRGMMR: ATOR ORG: NP12 DATE: 2009-03-23
8 C ABSTRACT: THIS FUNCTION COMPUTES AND RETURNS THE NUMBER OF CHARACTERS
9 C NEEDED TO ENCODE THE INPUT INTEGER NUM AS A STRING. IT DOES NOT
10 C ACTUALLY ENCODE THE STRING BUT RATHER ONLY FIGURES OUT THE REQUIRED
11 C SIZE. NUM MUST BE AN INTEGER IN THE RANGE OF 0 TO 99999.
13 C PROGRAM HISTORY LOG:
14 C 2009-03-23 J. ATOR -- ORIGINAL AUTHOR
16 C USAGE: CALL ISIZE ( NUM )
17 C INPUT ARGUMENT LIST:
18 C NUM - INTEGER: NUMBER TO BE ENCODED
20 C OUTPUT ARGUMENT LIST:
21 C ISIZE - INTEGER: NUMBER OF CHARACTERS NECESSARY TO ENCODE NUM
22 C AS A STRING
24 C REMARKS:
25 C THIS ROUTINE CALLS: BORT
26 C THIS ROUTINE IS CALLED BY: READMT UFBDMP UFDUMP
27 C Normally not called by any application
28 C programs but it could be.
30 C ATTRIBUTES:
31 C LANGUAGE: FORTRAN 77
32 C MACHINE: PORTABLE TO ALL PLATFORMS
34 C$$$
36 CHARACTER*128 BORT_STR
38 C-----------------------------------------------------------------------
39 C-----------------------------------------------------------------------
41 IF ( NUM .LT. 0 ) GOTO 900
42 DO ISIZE = 1, 5
43 IF ( NUM .LT. 10**ISIZE ) RETURN
44 ENDDO
45 GOTO 900
47 RETURN
48 900 WRITE(BORT_STR,'("BUFRLIB: ISIZE - INPUT NUMBER (",I7,'//
49 . '") IS OUT OF RANGE")') NUM
50 CALL BORT(BORT_STR)
51 END