NCEPLIBS-bufr 11.7.1
invcon.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS FUNCTION SEARCHES A "WINDOW" (SEE BELOW REMARKS) FOR AN
5C> ELEMENT IDENTIFIED IN THE USER STRING AS A CONDITIONAL NODE (I.E. AN
6C> ELEMENT WHICH MUST MEET A CONDITION IN ORDER TO BE READ FROM OR WRITTEN TO
7C> A DATA SUBSET). IF A CONDITIONAL ELEMENT IS FOUND AND IT CONFORMS TO THE
8C> CONDITION, THEN THE INDEX OF THE ELEMENT WITHIN THE WINDOW IS RETURNED.
9C> OTHERWISE A VALUE OF ZERO IS RETURNED.
10C>
11C> PROGRAM HISTORY LOG:
12C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
13C> 1998-07-08 J. WOOLLEN -- IMPROVED MACHINE PORTABILITY
14C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
15C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
16C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
17C> BUFR FILES UNDER THE MPI)
18C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
19C> INTERDEPENDENCIES
20C> 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
21C> INCREASED FROM 15000 TO 16000 (WAS IN
22C> VERIFICATION VERSION); UNIFIED/PORTABLE FOR
23C> WRF; ADDED DOCUMENTATION (INCLUDING
24C> HISTORY) (INCOMPLETE); OUTPUTS MORE
25C> COMPLETE DIAGNOSTIC INFO WHEN UNUSUAL
26C> THINGS HAPPEN
27C> 2009-04-21 J. ATOR -- USE ERRWRT
28C> 2010-04-27 J. WOOLLEN -- ADD DOCUMENTATION
29C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
30C>
31C> USAGE: INVCON (NC, LUN, INV1, INV2)
32C> INPUT ARGUMENT LIST:
33C> NC - INTEGER: CONDITION CODE:
34C> 1 = '=' (EQUAL)
35C> 2 = '!' (NOT EQUAL)
36C> 3 = '<' (LESS THAN)
37C> 4 = '>' (GREATER THAN)
38C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
39C> INV1 - INTEGER: FIRST INDEX OF WINDOW TO SEARCH
40C> INV2 - INTEGER: LAST INDEX OF WINDOW TO SEARCH
41C>
42C> OUTPUT ARGUMENT LIST:
43C> INVCON - INTEGER: INDEX WITHIN WINDOW OF CONDITIONAL NODE CONFORMING
44C> TO SPECIFIED CONDITION
45C> 0 = NONE FOUND
46C>
47C> REMARKS:
48C>
49C> SEE THE DOCBLOCK IN BUFR ARCHIVE LIBRARY SUBROUTINE GETWIN FOR AN
50C> EXPLANATION OF "WINDOWS" WITHIN THE CONTEXT OF A BUFR DATA SUBSET.
51C>
52C> THIS ROUTINE CALLS: ERRWRT
53C> THIS ROUTINE IS CALLED BY: CONWIN
54C> Normally not called by any application
55C> programs.
56C>
57 FUNCTION invcon(NC,LUN,INV1,INV2)
58
59 USE moda_usrint
60
61 COMMON /usrstr/ nnod,ncon,nods(20),nodc(10),ivls(10),kons(10)
62 COMMON /quiet / iprt
63
64C----------------------------------------------------------------------
65C----------------------------------------------------------------------
66
67C CHECK THE INVENTORY INTERVAL
68C ----------------------------
69
70 IF(inv1.LE.0 .OR. inv1.GT.nval(lun)) GOTO 99
71 IF(inv2.LE.0 .OR. inv2.GT.nval(lun)) GOTO 99
72
73C FIND AN OCCURANCE OF NODE IN THE WINDOW MEETING THIS CONDITION
74C --------------------------------------------------------------
75
76 DO invcon=inv1,inv2
77 IF(inv(invcon,lun).EQ.nodc(nc)) THEN
78 IF(kons(nc).EQ.1 .AND. val(invcon,lun).EQ.ivls(nc)) GOTO 100
79 IF(kons(nc).EQ.2 .AND. val(invcon,lun).NE.ivls(nc)) GOTO 100
80 IF(kons(nc).EQ.3 .AND. val(invcon,lun).LT.ivls(nc)) GOTO 100
81 IF(kons(nc).EQ.4 .AND. val(invcon,lun).GT.ivls(nc)) GOTO 100
82 ENDIF
83 ENDDO
84
8599 invcon = 0
86 IF(iprt.GE.2) THEN
87 CALL errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
88 CALL errwrt('BUFRLIB: INVCON - RETURNING WITH A VALUE OF 0')
89 CALL errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
90 CALL errwrt(' ')
91 ENDIF
92
93C EXIT
94C ----
95
96100 RETURN
97 END
subroutine errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
Definition: errwrt.f:42
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:58