NCEPLIBS-bufr  12.0.1
getwin.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Look for a window containing a specified node within
3 C> the internal jump/link table.
4 C> @author Woollen @date 1994-01-06
5 
6 C> Given a node index within the internal jump/link table, this
7 C> subroutine looks within the current subset buffer for a "window"
8 C> (see below remarks) which contains this node. If found, it returns
9 C> the starting and ending indices of this window within the current
10 C> subset buffer. For example, if the node is found within the subset
11 C> but is not part of a delayed replication sequence, then the returned
12 C> indices define the start and end of the entire subset buffer.
13 C> Otherwise, the returned indices define the start and end of the next
14 C> available delayed replication sequence iteration which contains the
15 C> node. If no further iterations of the sequence can be found, then
16 C> the starting index is returned with a value of zero.
17 C>
18 C> @note
19 C> This is one of a number of subroutines which operate on "windows"
20 C> (i.e. contiguous portions) of the internal subset buffer. The
21 C> subset buffer is an array of values arranged according to the
22 C> overall template definition for a subset. A window can be any
23 C> contiguous portion of the subset buffer up to and including the
24 C> entire subset buffer itself. For the purposes of these "window
25 C> operator" subroutines, a window essentially consists of all of the
26 C> elements within a particular delayed replication group, since such
27 C> groups effectively define the dimensions within a bufr subset for
28 C> the BUFR archive library subroutines such as ufbint(), ufbin3(), etc.
29 C> which read/write individual data values. A bufr subset with no
30 C> delayed replication groups is considered to have only one
31 C> dimension, and therefore only one "window" which spans the entire
32 C> subset. On the other hand, each delayed replication sequence
33 C> within a bufr subset consists of some number of "windows", which
34 C> are a de-facto second dimension of the subset and where the number
35 C> of windows is the delayed descriptor replication factor (i.e. the
36 C> number of iterations) of the sequence. If nested delayed
37 C> replication is used, then there may be three or more dimensions
38 C> within the subset.
39 C>
40 C> @param[in] NODE - integer: jump/link table index of mnemonic to look for.
41 C> @param[in] LUN - integer: i/o stream index into internal memory arrays.
42 C> @param[out] IWIN - integer: starting index of the current window iteration which contains node
43 C> - 0 = not found or no more iterations available.
44 C> @param[out] JWIN - integer: ending index of the current window iteration which contains node.
45 C>
46 C> @author Woollen @date 1994-01-06
47  SUBROUTINE getwin(NODE,LUN,IWIN,JWIN)
48 
49  USE moda_usrint
50 
51  CHARACTER*128 BORT_STR
52 
53 C----------------------------------------------------------------------
54 C----------------------------------------------------------------------
55 
56  irpc = lstjpb(node,lun,'RPC')
57 
58  IF(irpc.EQ.0) THEN
59  iwin = invwin(node,lun,jwin,nval(lun))
60  IF(iwin.EQ.0 .and. jwin.GT.1) GOTO 100
61  iwin = 1
62  jwin = nval(lun)
63  GOTO 100
64  ELSE
65  iwin = invwin(irpc,lun,jwin,nval(lun))
66  IF(iwin.EQ.0) THEN
67  GOTO 100
68  ELSEIF(val(iwin,lun).EQ.0.) THEN
69  iwin = 0
70  GOTO 100
71  ENDIF
72  ENDIF
73 
74  jwin = invwin(irpc,lun,iwin+1,nval(lun))
75  IF(jwin.EQ.0) GOTO 900
76 
77 C EXITS
78 C -----
79 
80 100 RETURN
81 900 WRITE(bort_str,'("BUFRLIB: GETWIN - SEARCHED BETWEEN",I5," AND"'//
82  . ',I5,", MISSING BRACKET")') iwin+1,nval(lun)
83  CALL bort(bort_str)
84  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
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:48
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:22
function lstjpb(NODE, LUN, JBTYP)
This function searches backwards, beginning from a given node within the jump/link table,...
Definition: lstjpb.f:30
This module contains declarations for arrays used to store data values and associated metadata for th...
integer, dimension(:), allocatable nval
Number of data values in BUFR data subset.
real *8, dimension(:,:), allocatable, target val
Data values.