NCEPLIBS-bufr 11.7.1
getwin.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> GIVEN A NODE INDEX WITHIN THE INTERNAL JUMP/LINK TABLE, THIS
5C> SUBROUTINE LOOKS WITHIN THE CURRENT SUBSET BUFFER FOR A "WINDOW"
6C> (SEE BELOW REMARKS) WHICH CONTAINS THIS NODE. IF FOUND, IT RETURNS
7C> THE STARTING AND ENDING INDICES OF THIS WINDOW WITHIN THE CURRENT
8C> SUBSET BUFFER. FOR EXAMPLE, IF THE NODE IS FOUND WITHIN THE SUBSET
9C> BUT IS NOT PART OF A DELAYED REPLICATION SEQUENCE, THEN THE RETURNED
10C> INDICES DEFINE THE START AND END OF THE ENTIRE SUBSET BUFFER.
11C> OTHERWISE, THE RETURNED INDICES DEFINE THE START AND END OF THE NEXT
12C> AVAILABLE DELAYED REPLICATION SEQUENCE ITERATION WHICH CONTAINS THE
13C> NODE. IF NO FURTHER ITERATIONS OF THE SEQUENCE CAN BE FOUND, THEN
14C> THE STARTING INDEX IS RETURNED WITH A VALUE OF ZERO.
15C>
16C> PROGRAM HISTORY LOG:
17C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
18C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
19C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
20C> ROUTINE "BORT"
21C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
22C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
23C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
24C> BUFR FILES UNDER THE MPI)
25C> 2002-05-14 J. WOOLLEN -- REMOVED OLD CRAY COMPILER DIRECTIVES
26C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
27C> INTERDEPENDENCIES
28C> 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
29C> INCREASED FROM 15000 TO 16000 (WAS IN
30C> VERIFICATION VERSION); UNIFIED/PORTABLE FOR
31C> WRF; ADDED DOCUMENTATION (INCLUDING
32C> HISTORY) (INCOMPLETE); OUTPUTS MORE
33C> COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
34C> TERMINATES ABNORMALLY
35C> 2009-03-31 J. WOOLLEN -- ADDED ADDITIONAL DOCUMENTATION
36C> 2009-05-07 J. ATOR -- USE LSTJPB INSTEAD OF LSTRPC
37C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
38C>
39C> USAGE: CALL GETWIN (NODE, LUN, IWIN, JWIN)
40C> INPUT ARGUMENT LIST:
41C> NODE - INTEGER: JUMP/LINK TABLE INDEX OF MNEMONIC TO LOOK FOR
42C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
43C> JWIN - INTEGER: ENDING INDEX OF THE PREVIOUS WINDOW ITERATION
44C> WHICH CONTAINED NODE
45C>
46C> OUTPUT ARGUMENT LIST:
47C> IWIN - INTEGER: STARTING INDEX OF THE CURRENT WINDOW ITERATION
48C> WHICH CONTAINS NODE
49C> 0 = NOT FOUND OR NO MORE ITERATIONS AVAILABLE
50C> JWIN - INTEGER: ENDING INDEX OF THE CURRENT WINDOW ITERATION
51C> WHICH CONTAINS NODE
52C>
53C> REMARKS:
54C>
55C> THIS IS ONE OF A NUMBER OF SUBROUTINES WHICH OPERATE ON "WINDOWS"
56C> (I.E. CONTIGUOUS PORTIONS) OF THE INTERNAL SUBSET BUFFER. THE
57C> SUBSET BUFFER IS AN ARRAY OF VALUES ARRANGED ACCORDING TO THE
58C> OVERALL TEMPLATE DEFINITION FOR A SUBSET. A WINDOW CAN BE ANY
59C> CONTIGUOUS PORTION OF THE SUBSET BUFFER UP TO AND INCLUDING THE
60C> ENTIRE SUBSET BUFFER ITSELF. FOR THE PURPOSES OF THESE "WINDOW
61C> OPERATOR" SUBROUTINES, A WINDOW ESSENTIALLY CONSISTS OF ALL OF THE
62C> ELEMENTS WITHIN A PARTICULAR DELAYED REPLICATION GROUP, SINCE SUCH
63C> GROUPS EFFECTIVELY DEFINE THE DIMENSIONS WITHIN A BUFR SUBSET FOR
64C> THE BUFR ARCHIVE LIBRARY SUBROUTINES SUCH AS UFBINT, UFBIN3, ETC.
65C> WHICH READ/WRITE INDIVIDUAL DATA VALUES. A BUFR SUBSET WITH NO
66C> DELAYED REPLICATION GROUPS IS CONSIDERED TO HAVE ONLY ONE
67C> DIMENSION, AND THEREFORE ONLY ONE "WINDOW" WHICH SPANS THE ENTIRE
68C> SUBSET. ON THE OTHER HAND, EACH DELAYED REPLICATION SEQUENCE
69C> WITHIN A BUFR SUBSET CONSISTS OF SOME NUMBER OF "WINDOWS", WHICH
70C> ARE A DE-FACTO SECOND DIMENSION OF THE SUBSET AND WHERE THE NUMBER
71C> OF WINDOWS IS THE DELAYED DESCRIPTOR REPLICATION FACTOR (I.E. THE
72C> NUMBER OF ITERATIONS) OF THE SEQUENCE. IF NESTED DELAYED
73C> REPLICATION IS USED, THEN THERE MAY BE THREE OR MORE DIMENSIONS
74C> WITHIN THE SUBSET.
75C>
76C> THIS ROUTINE CALLS: BORT INVWIN LSTJPB
77C> THIS ROUTINE IS CALLED BY: CONWIN UFBEVN UFBIN3 UFBRW
78C> Normally not called by any application
79C> programs.
80C>
81 SUBROUTINE getwin(NODE,LUN,IWIN,JWIN)
82
83 USE moda_usrint
84
85 CHARACTER*128 BORT_STR
86
87C----------------------------------------------------------------------
88C----------------------------------------------------------------------
89
90 irpc = lstjpb(node,lun,'RPC')
91
92 IF(irpc.EQ.0) THEN
93 iwin = invwin(node,lun,jwin,nval(lun))
94 IF(iwin.EQ.0 .and. jwin.GT.1) GOTO 100
95 iwin = 1
96 jwin = nval(lun)
97 GOTO 100
98 ELSE
99 iwin = invwin(irpc,lun,jwin,nval(lun))
100 IF(iwin.EQ.0) THEN
101 GOTO 100
102 ELSEIF(val(iwin,lun).EQ.0.) THEN
103 iwin = 0
104 GOTO 100
105 ENDIF
106 ENDIF
107
108 jwin = invwin(irpc,lun,iwin+1,nval(lun))
109 IF(jwin.EQ.0) GOTO 900
110
111C EXITS
112C -----
113
114100 RETURN
115900 WRITE(bort_str,'("BUFRLIB: GETWIN - SEARCHED BETWEEN",I5," AND"'//
116 . ',I5,", MISSING BRACKET")') iwin+1,nval(lun)
117 CALL bort(bort_str)
118 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine getwin(NODE, LUN, IWIN, JWIN)
GIVEN A NODE INDEX WITHIN THE INTERNAL JUMP/LINK TABLE, THIS SUBROUTINE LOOKS WITHIN THE CURRENT SUBS...
Definition: getwin.f:82
function invwin(NODE, LUN, INV1, INV2)
THIS FUNCTION LOOKS FOR A SPECIFIED NODE WITHIN THE PORTION OF THE CURRENT SUBSET BUFFER BOUNDED BY T...
Definition: invwin.f:49
function lstjpb(NODE, LUN, JBTYP)
THIS FUNCTION SEARCHES BACKWARDS, BEGINNING FROM A GIVEN NODE WITHIN THE JUMP/LINK TABLE,...
Definition: lstjpb.f:58