updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / external / bufr / conwin.f
blob791acff92865cac6c2ad6913056ac88b2fcb01ed
1 SUBROUTINE CONWIN(LUN,INC1,INC2)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 C SUBPROGRAM: CONWIN
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS SUBROUTINE SEARCHES CONSECUTIVE SUBSET BUFFER SEGMENTS
9 C FOR AN ELEMENT IDENTIFIED IN THE USER STRING AS A CONDITIONAL NODE
10 C (I.E. AN ELEMENT WHICH MUST MEET A CONDITION IN ORDER TO BE READ
11 C FROM OR WRITTEN TO A DATA SUBSET). IF A CONDITIONAL ELEMENT IS
12 C FOUND AND IT CONFORMS TO THE CONDITION, THEN THE INTERNAL SUBSET
13 C BUFFER INDICES OF THE "WINDOW" (SEE BELOW REMARKS) ARE RETURNED TO
14 C THE CALLER FOR PROCESSING.
16 C THE FOUR CONDITIONS WHICH CAN BE EXERCISED ARE:
17 C '<' - LESS THAN
18 C '>' - GREATER THAN
19 C '=' - EQUAL
20 C '!' - NOT EQUAL
22 C EACH CONDITION IN A STRING IS APPLIED TO ONE ELEMENT, AND ALL
23 C CONDITIONS ARE 'AND'ED TO EVALUATE AN OUTCOME. FOR EXAMPLE, IF THE
24 C CONDITION STRING IS: "POB<500 TOB>30 TQM<4" THEN THE ONLY LEVELS OF
25 C DATA READ OR WRITTEN ARE THOSE WITH PRESSURE LT 500 MB, TEMPERATURE
26 C GT 30 DEG, AND TEMPERATURE QUALITY MARK < 4.
28 C PROGRAM HISTORY LOG:
29 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
30 C 1998-07-08 J. WOOLLEN -- IMPROVED MACHINE PORTABILITY
31 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
32 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
33 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
34 C BUFR FILES UNDER THE MPI)
35 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
36 C INTERDEPENDENCIES
37 C 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
38 C INCREASED FROM 15000 TO 16000 (WAS IN
39 C VERIFICATION VERSION); UNIFIED/PORTABLE FOR
40 C WRF; ADDED DOCUMENTATION (INCLUDING
41 C HISTORY)
42 C 2010-04-27 J. WOOLLEN -- CORRECT LOGICAL FLAW AND ADD DOCUMENTATION
44 C USAGE: CALL CONWIN (LUN, INC1, INC2)
45 C INPUT ARGUMENT LIST:
46 C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
47 C INC1 - INTEGER: SUBSET BUFFER START INDEX
48 C INC2 - INTEGER: SUBSET BUFFER ENDING INDEX
50 C OUTPUT ARGUMENT LIST:
51 C INC1 - INTEGER: SUBSET BUFFER START INDEX
52 C INC2 - INTEGER: SUBSET BUFFER ENDING INDEX
54 C REMARKS:
56 C SEE THE DOCBLOCK IN BUFR ARCHIVE LIBRARY SUBROUTINE GETWIN FOR AN
57 C EXPLANATION OF "WINDOWS" WITHIN THE CONTEXT OF A BUFR DATA SUBSET.
59 C FUNCTION CONWIN WORKS WITH FUNCTION INVCON TO IDENTIFY SUBSET
60 C BUFFER SEGMENTS WHICH CONFORM TO THE SET OF CONDITIONS.
62 C THIS ROUTINE CALLS: GETWIN INVCON
63 C THIS ROUTINE IS CALLED BY: UFBEVN UFBIN3 UFBRW
64 C Normally not called by any application
65 C programs.
67 C ATTRIBUTES:
68 C LANGUAGE: FORTRAN 77
69 C MACHINE: PORTABLE TO ALL PLATFORMS
71 C$$$
73 INCLUDE 'bufrlib.prm'
75 COMMON /USRINT/ NVAL(NFILES),INV(MAXSS,NFILES),VAL(MAXSS,NFILES)
76 COMMON /USRSTR/ NNOD,NCON,NODS(20),NODC(10),IVLS(10),KONS(10)
78 REAL*8 VAL
80 C----------------------------------------------------------------------
81 C----------------------------------------------------------------------
83 C SPECIAL CASE
84 C ------------
86 IF(NCON.EQ.0) THEN
87 c .... There are no condition nodes in the string
88 INC1 = 1
89 INC2 = NVAL(LUN)
90 GOTO 100
91 ENDIF
93 C EVALUATE CONDITIONS TO SEE IF ANY MORE CASES
94 C --------------------------------------------
96 15 CALL GETWIN(NODC(1),LUN,INC1,INC2)
97 IF(INC1.GT.0) THEN
98 DO NC=1,NCON
99 ICON = INVCON(NC,LUN,INC1,INC2)
100 IF(ICON.EQ.0) GOTO 15
101 ENDDO
102 ENDIF
104 C EXIT
105 C ----
107 100 RETURN