NCEPLIBS-bufr  12.0.0
invcon.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Search a specified window for a conditional node.
3 C>
4 C> @author Woollen @date 1994-01-06
5 
6 C> This function searches a "window" (see below remarks) for an
7 C> element identified in the user string as a conditional node.
8 C> A conditional node is an element which must meet a condition in order to be
9 C> read from or written to a data subset.
10 C> If a conditional element is found and it conforms to the
11 C> condition, then the index of the element within the window is returned;
12 C> otherwise a value of zero is returned.
13 C>
14 C> @note: See getwin() for an explanation of "windows" within the context
15 C> of a bufr data subset.
16 C>
17 C> @param[in] NC - integer: condition code:
18 C> - 1 '=' (equal)
19 C> - 2 '!' (not equal)
20 C> - 3 '<' (less than)
21 C> - 4 '>' (greater than)
22 C> @param[in] LUN - integer: i/o stream index into internal memory arrays
23 C> @param[in] INV1 - integer: first index of window to search
24 C> @param[in] INV2 - integer: last index of window to search
25 C>
26 C> @return integer: index within window of conditional node
27 C> conforming to specified condition.
28 C> - 0 none found.
29 C>
30 C> @author Woollen @date 1994-01-06
31  FUNCTION invcon(NC,LUN,INV1,INV2)
32 
33  USE moda_usrint
34 
35  COMMON /usrstr/ nnod,ncon,nods(20),nodc(10),ivls(10),kons(10)
36  COMMON /quiet / iprt
37 
38 C----------------------------------------------------------------------
39 C----------------------------------------------------------------------
40 
41 C CHECK THE INVENTORY INTERVAL
42 C ----------------------------
43 
44  IF(inv1.LE.0 .OR. inv1.GT.nval(lun)) GOTO 99
45  IF(inv2.LE.0 .OR. inv2.GT.nval(lun)) GOTO 99
46 
47 C FIND AN OCCURANCE OF NODE IN THE WINDOW MEETING THIS CONDITION
48 C --------------------------------------------------------------
49 
50  DO invcon=inv1,inv2
51  IF(inv(invcon,lun).EQ.nodc(nc)) THEN
52  IF(kons(nc).EQ.1 .AND. val(invcon,lun).EQ.ivls(nc)) GOTO 100
53  IF(kons(nc).EQ.2 .AND. val(invcon,lun).NE.ivls(nc)) GOTO 100
54  IF(kons(nc).EQ.3 .AND. val(invcon,lun).LT.ivls(nc)) GOTO 100
55  IF(kons(nc).EQ.4 .AND. val(invcon,lun).GT.ivls(nc)) GOTO 100
56  ENDIF
57  ENDDO
58 
59 99 invcon = 0
60  IF(iprt.GE.2) THEN
61  CALL errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
62  CALL errwrt('BUFRLIB: INVCON - RETURNING WITH A VALUE OF 0')
63  CALL errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
64  CALL errwrt(' ')
65  ENDIF
66 
67 C EXIT
68 C ----
69 
70 100 RETURN
71  END
subroutine errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
Definition: errwrt.f:36
function invcon(NC, LUN, INV1, INV2)
This function searches a "window" (see below remarks) for an element identified in the user string as...
Definition: invcon.f:32
This module contains declarations for arrays used to store data values and associated metadata for th...
integer, dimension(:), allocatable nval
Number of data values in BUFR data subset.
real *8, dimension(:,:), allocatable, target val
Data values.
integer, dimension(:,:), allocatable, target inv
Inventory pointer which links each data value to its corresponding node in the internal jump/link tab...