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