Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / external / bufr / invwin.f
blob48f5217255c19ccc90b7af56e00ef6c521a0ff7d
1 FUNCTION INVWIN(NODE,LUN,INV1,INV2)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 C SUBPROGRAM: INVWIN
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS FUNCTION LOOKS FOR A SPECIFIED NODE WITHIN THE PORTION
9 C OF THE CURRENT SUBSET BUFFER BOUNDED BY THE INDICES INV1 AND INV2.
10 C IT IS SIMILAR TO BUFR ARCHIVE LIBRARY FUNCTION INVTAG, EXCEPT THAT
11 C INVTAG SEARCHES BASED ON THE MNEMONIC CORRESPONDING TO THE NODE.
13 C PROGRAM HISTORY LOG:
14 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
15 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
16 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
17 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
18 C BUFR FILES UNDER THE MPI)
19 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
20 C INTERDEPENDENCIES
21 C 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
22 C INCREASED FROM 15000 TO 16000 (WAS IN
23 C VERIFICATION VERSION); UNIFIED/PORTABLE FOR
24 C WRF; ADDED DOCUMENTATION (INCLUDING
25 C HISTORY); OUTPUTS MORE COMPLETE DIAGNOSTIC
26 C INFO WHEN UNUSUAL THINGS HAPPEN
27 C 2009-03-31 J. WOOLLEN -- ADDED DOCUMENTATION
28 C 2009-04-21 J. ATOR -- USE ERRWRT
30 C USAGE: INVWIN (NODE, LUN, INV1, INV2)
31 C INPUT ARGUMENT LIST:
32 C NODE - INTEGER: JUMP/LINK TABLE INDEX TO LOOK FOR
33 C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
34 C INV1 - INTEGER: STARTING INDEX OF THE PORTION OF THE SUBSET
35 C BUFFER IN WHICH TO LOOK
36 C INV2 - INTEGER: ENDING INDEX OF THE PORTION OF THE SUBSET
37 C BUFFER IN WHICH TO LOOK
39 C OUTPUT ARGUMENT LIST:
40 C INVWIN - INTEGER: LOCATION INDEX OF NODE WITHIN SPECIFIED
41 C PORTION OF SUBSET BUFFER
42 C 0 = NOT FOUND
44 C REMARKS:
45 C THIS ROUTINE CALLS: ERRWRT
46 C THIS ROUTINE IS CALLED BY: DRSTPL GETWIN NEVN TRYBUMP
47 C UFBGET UFBRW UFBSEQ
48 C Normally not called by any application
49 C programs.
51 C ATTRIBUTES:
52 C LANGUAGE: FORTRAN 77
53 C MACHINE: PORTABLE TO ALL PLATFORMS
55 C$$$
57 INCLUDE 'bufrlib.prm'
59 COMMON /USRINT/ NVAL(NFILES),INV(MAXSS,NFILES),VAL(MAXSS,NFILES)
60 COMMON /QUIET/ IPRT
62 REAL*8 VAL
64 C----------------------------------------------------------------------
65 C----------------------------------------------------------------------
67 INVWIN = 0
68 IF(NODE.EQ.0) GOTO 200
70 C SEARCH BETWEEN INV1 AND INV2
71 C ----------------------------
73 10 DO INVWIN=INV1,INV2
74 IF(INV(INVWIN,LUN).EQ.NODE) GOTO 100
75 ENDDO
77 INVWIN = 0
79 200 IF(IPRT.GE.2) THEN
80 CALL ERRWRT('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
81 CALL ERRWRT('BUFRLIB: INVWIN - RETURNING WITH A VALUE OF 0')
82 CALL ERRWRT('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
83 CALL ERRWRT(' ')
84 ENDIF
86 C EXIT
87 C ----
89 100 RETURN
90 END