updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / external / bufr / invtag.f
blob6e5619f639430d3a3eb31d3d899979f450e886fc
1 FUNCTION INVTAG(NODE,LUN,INV1,INV2)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 C SUBPROGRAM: INVTAG
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS FUNCTION LOOKS FOR A SPECIFIED MNEMONIC WITHIN THE
9 C PORTION OF THE CURRENT SUBSET BUFFER BOUNDED BY THE INDICES INV1
10 C AND INV2. IT IS SIMILAR TO BUFR ARCHIVE LIBRARY FUNCTION INVWIN,
11 C EXCEPT THAT INVWIN SEARCHES BASED ON THE ACTUAL NODE WITHIN THE
12 C INTERNAL JUMP/LINK TABLE, RATHER THAN ON THE MNEMONIC CORRESPONDING
13 C TO THAT NODE.
15 C PROGRAM HISTORY LOG:
16 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
17 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
18 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
19 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
20 C BUFR FILES UNDER THE MPI)
21 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
22 C INTERDEPENDENCIES
23 C 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
24 C INCREASED FROM 15000 TO 16000 (WAS IN
25 C VERIFICATION VERSION); UNIFIED/PORTABLE FOR
26 C WRF; ADDED DOCUMENTATION (INCLUDING
27 C HISTORY); OUTPUTS MORE COMPLETE DIAGNOSTIC
28 C INFO WHEN UNUSUAL THINGS HAPPEN
29 C 2009-03-31 J. WOOLLEN -- ADDED DOCUMENTATION
30 C 2009-04-21 J. ATOR -- USE ERRWRT
32 C USAGE: INVTAG (NODE, LUN, INV1, INV2)
33 C INPUT ARGUMENT LIST:
34 C NODE - INTEGER: JUMP/LINK TABLE INDEX OF MNEMONIC TO LOOK FOR
35 C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
36 C INV1 - INTEGER: STARTING INDEX OF THE PORTION OF THE SUBSET
37 C BUFFER IN WHICH TO LOOK
38 C INV2 - INTEGER: ENDING INDEX OF THE PORTION OF THE SUBSET
39 C BUFFER IN WHICH TO LOOK
41 C OUTPUT ARGUMENT LIST:
42 C INVTAG - INTEGER: LOCATION INDEX OF NODE WITHIN SPECIFIED
43 C PORTION OF SUBSET BUFFER
44 C 0 = NOT FOUND
46 C REMARKS:
47 C THIS ROUTINE CALLS: ERRWRT
48 C THIS ROUTINE IS CALLED BY: UFBRP UFBSEQ UFBSP
49 C Normally not called by any application
50 C programs.
52 C ATTRIBUTES:
53 C LANGUAGE: FORTRAN 77
54 C MACHINE: PORTABLE TO ALL PLATFORMS
56 C$$$
58 INCLUDE 'bufrlib.prm'
60 COMMON /BTABLES/ MAXTAB,NTAB,TAG(MAXJL),TYP(MAXJL),KNT(MAXJL),
61 . JUMP(MAXJL),LINK(MAXJL),JMPB(MAXJL),
62 . IBT(MAXJL),IRF(MAXJL),ISC(MAXJL),
63 . ITP(MAXJL),VALI(MAXJL),KNTI(MAXJL),
64 . ISEQ(MAXJL,2),JSEQ(MAXJL)
65 COMMON /USRINT/ NVAL(NFILES),INV(MAXSS,NFILES),VAL(MAXSS,NFILES)
66 COMMON /QUIET/ IPRT
68 CHARACTER*10 TAG,TAGN
69 CHARACTER*3 TYP
70 REAL*8 VAL
72 C----------------------------------------------------------------------
73 C----------------------------------------------------------------------
75 INVTAG = 0
76 IF(NODE.EQ.0) GOTO 200
77 TAGN = TAG(NODE)
79 C SEARCH BETWEEN INV1 AND INV2
80 C ----------------------------
82 10 DO INVTAG=INV1,INV2
83 IF(TAG(INV(INVTAG,LUN)).EQ.TAGN) GOTO 100
84 ENDDO
86 INVTAG = 0
88 200 IF(IPRT.GE.2) THEN
89 CALL ERRWRT('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
90 CALL ERRWRT('BUFRLIB: INVTAG - RETURNING WITH A VALUE OF 0')
91 CALL ERRWRT('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
92 CALL ERRWRT(' ')
93 ENDIF
95 C EXIT
96 C ----
98 100 RETURN
99 END