1 SUBROUTINE GETWIN
(NODE
,LUN
,IWIN
,JWIN
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: GIVEN A NODE INDEX WITHIN THE INTERNAL JUMP/LINK TABLE, THIS
9 C SUBROUTINE LOOKS WITHIN THE CURRENT SUBSET BUFFER FOR A "WINDOW"
10 C (SEE BELOW REMARKS) WHICH CONTAINS THIS NODE. IF FOUND, IT RETURNS
11 C THE STARTING AND ENDING INDICES OF THIS WINDOW WITHIN THE CURRENT
12 C SUBSET BUFFER. FOR EXAMPLE, IF THE NODE IS FOUND WITHIN THE SUBSET
13 C BUT IS NOT PART OF A DELAYED REPLICATION SEQUENCE, THEN THE RETURNED
14 C INDICES DEFINE THE START AND END OF THE ENTIRE SUBSET BUFFER.
15 C OTHERWISE, THE RETURNED INDICES DEFINE THE START AND END OF THE NEXT
16 C AVAILABLE DELAYED REPLICATION SEQUENCE ITERATION WHICH CONTAINS THE
17 C NODE. IF NO FURTHER ITERATIONS OF THE SEQUENCE CAN BE FOUND, THEN
18 C THE STARTING INDEX IS RETURNED WITH A VALUE OF ZERO.
20 C PROGRAM HISTORY LOG:
21 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
22 C 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
23 C "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
25 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
26 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
27 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
28 C BUFR FILES UNDER THE MPI)
29 C 2002-05-14 J. WOOLLEN -- REMOVED OLD CRAY COMPILER DIRECTIVES
30 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
32 C 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
33 C INCREASED FROM 15000 TO 16000 (WAS IN
34 C VERIFICATION VERSION); UNIFIED/PORTABLE FOR
35 C WRF; ADDED DOCUMENTATION (INCLUDING
36 C HISTORY) (INCOMPLETE); OUTPUTS MORE
37 C COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
38 C TERMINATES ABNORMALLY
39 C 2009-03-31 J. WOOLLEN -- ADDED ADDITIONAL DOCUMENTATION
40 C 2009-05-07 J. ATOR -- USE LSTJPB INSTEAD OF LSTRPC
42 C USAGE: CALL GETWIN (NODE, LUN, IWIN, JWIN)
43 C INPUT ARGUMENT LIST:
44 C NODE - INTEGER: JUMP/LINK TABLE INDEX OF MNEMONIC TO LOOK FOR
45 C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
46 C JWIN - INTEGER: ENDING INDEX OF THE PREVIOUS WINDOW ITERATION
47 C WHICH CONTAINED NODE
49 C OUTPUT ARGUMENT LIST:
50 C IWIN - INTEGER: STARTING INDEX OF THE CURRENT WINDOW ITERATION
52 C 0 = NOT FOUND OR NO MORE ITERATIONS AVAILABLE
53 C JWIN - INTEGER: ENDING INDEX OF THE CURRENT WINDOW ITERATION
58 C THIS IS ONE OF A NUMBER OF SUBROUTINES WHICH OPERATE ON "WINDOWS"
59 C (I.E. CONTIGUOUS PORTIONS) OF THE INTERNAL SUBSET BUFFER. THE
60 C SUBSET BUFFER IS AN ARRAY OF VALUES ARRANGED ACCORDING TO THE
61 C OVERALL TEMPLATE DEFINITION FOR A SUBSET. A WINDOW CAN BE ANY
62 C CONTIGUOUS PORTION OF THE SUBSET BUFFER UP TO AND INCLUDING THE
63 C ENTIRE SUBSET BUFFER ITSELF. FOR THE PURPOSES OF THESE "WINDOW
64 C OPERATOR" SUBROUTINES, A WINDOW ESSENTIALLY CONSISTS OF ALL OF THE
65 C ELEMENTS WITHIN A PARTICULAR DELAYED REPLICATION GROUP, SINCE SUCH
66 C GROUPS EFFECTIVELY DEFINE THE DIMENSIONS WITHIN A BUFR SUBSET FOR
67 C THE BUFR ARCHIVE LIBRARY SUBROUTINES SUCH AS UFBINT, UFBIN3, ETC.
68 C WHICH READ/WRITE INDIVIDUAL DATA VALUES. A BUFR SUBSET WITH NO
69 C DELAYED REPLICATION GROUPS IS CONSIDERED TO HAVE ONLY ONE
70 C DIMENSION, AND THEREFORE ONLY ONE "WINDOW" WHICH SPANS THE ENTIRE
71 C SUBSET. ON THE OTHER HAND, EACH DELAYED REPLICATION SEQUENCE
72 C WITHIN A BUFR SUBSET CONSISTS OF SOME NUMBER OF "WINDOWS", WHICH
73 C ARE A DE-FACTO SECOND DIMENSION OF THE SUBSET AND WHERE THE NUMBER
74 C OF WINDOWS IS THE DELAYED DESCRIPTOR REPLICATION FACTOR (I.E. THE
75 C NUMBER OF ITERATIONS) OF THE SEQUENCE. IF NESTED DELAYED
76 C REPLICATION IS USED, THEN THERE MAY BE THREE OR MORE DIMENSIONS
79 C THIS ROUTINE CALLS: BORT INVWIN LSTJPB
80 C THIS ROUTINE IS CALLED BY: CONWIN UFBEVN UFBIN3 UFBRW
81 C Normally not called by any application
85 C LANGUAGE: FORTRAN 77
86 C MACHINE: PORTABLE TO ALL PLATFORMS
92 COMMON /USRINT
/ NVAL
(NFILES
),INV
(MAXSS
,NFILES
),VAL
(MAXSS
,NFILES
)
94 CHARACTER*128 BORT_STR
97 C----------------------------------------------------------------------
98 C----------------------------------------------------------------------
100 IRPC
= LSTJPB
(NODE
,LUN
,'RPC')
103 IWIN
= INVWIN
(NODE
,LUN
,JWIN
,NVAL
(LUN
))
104 IF(IWIN
.EQ
.0 .and
. JWIN
.GT
.1) GOTO 100
109 IWIN
= INVWIN
(IRPC
,LUN
,JWIN
,NVAL
(LUN
))
112 ELSEIF
(VAL
(IWIN
,LUN
).EQ
.0.) THEN
118 JWIN
= INVWIN
(IRPC
,LUN
,IWIN
+1,NVAL
(LUN
))
119 IF(JWIN
.EQ
.0) GOTO 900
125 900 WRITE(BORT_STR
,'("BUFRLIB: GETWIN - SEARCHED BETWEEN",I5," AND"'//
126 . ',I5,", MISSING BRACKET")') IWIN
+1,NVAL
(LUN
)