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