NCEPLIBS-bufr
12.0.1
numbck.f
Go to the documentation of this file.
1
C> @file
2
C> @brief Check the validity of an FXY value
3
C>
4
C> @author Woollen @date 1994-01-06
5
6
C> This function checks the input character string to determine
7
C> whether it contains a valid FXY (descriptor) value.
8
C>
9
C> @param[in] NUMB - character*6: FXY value to be checked.
10
C>
11
C> @return indicator as to whether numb is valid:.
12
C> - 0 yes
13
C> - -1 no, the first character ("F" value) is not '0', '1', '2', or '3'
14
C> - -2 no, characters 2-6 ("X" and "Y" values) are not all numeric
15
C> - -3 no, characters 2-3 ("X" value) are not between '00' and '63'
16
C> - -4 no, characters 4-6 ("Y" value) are not between '000' and '255'
17
C>
18
C> @author Woollen @date 1994-01-06
19
FUNCTION
numbck
(NUMB)
20
21
CHARACTER*6
numb
22
LOGICAL
digit
23
24
C-----------------------------------------------------------------------
25
C-----------------------------------------------------------------------
26
27
C CHECK THE FIRST CHARACTER OF NUMB
28
C ---------------------------------
29
30
IF
( llt(numb(1:1),
'0'
) .OR. lgt(numb(1:1),
'3'
) )
THEN
31
numbck
= -1
32
RETURN
33
ENDIF
34
35
C CHECK FOR A VALID DESCRIPTOR
36
C ----------------------------
37
38
IF
(
digit
(numb(2:6)))
THEN
39
READ
(numb,
'(1X,I2,I3)'
) ix,iy
40
ELSE
41
numbck
= -2
42
RETURN
43
ENDIF
44
45
IF
(ix.LT.0 .OR. ix.GT. 63)
THEN
46
numbck
= -3
47
RETURN
48
ELSE
IF
(iy.LT.0 .OR. iy.GT.255)
THEN
49
numbck
= -4
50
RETURN
51
ENDIF
52
53
numbck
= 0
54
55
RETURN
56
END
digit
logical function digit(STR)
This logical function checks whether the characters in a string are all numeric.
Definition:
digit.f:15
numbck
function numbck(NUMB)
This function checks the input character string to determine whether it contains a valid FXY (descrip...
Definition:
numbck.f:20
src
numbck.f
Generated by
1.9.1