NCEPLIBS-bufr  12.0.0
nevn.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Search for stacked data events within a specified portion
3 C> of the current data subset.
4 C>
5 C> @author J. Woollen @date 2003-11-04
6 
7 C> This function looks for all stacked data events for a
8 C> specified data value and level within the portion of the current
9 C> subset buffer bounded by the indices INV1 and INV2. All such
10 C> events are accumulated and returned to the calling program within
11 C> array USR. The value of the function itself is the total number
12 C> of events found.
13 C>
14 C> @param[in] NODE - integer: jump/link table index of node for which
15 C> to return stacked values
16 C> @param[in] LUN - integer: I/O stream index into internal memory arrays
17 C> @param[in] INV1 - integer: Starting index of the portion of the subset
18 C> buffer in which to look for stack values
19 C> @param[in] INV2 - integer: ending index of the portion of the subset
20 C> buffer in which to look for stack values
21 C> @param[in] I1 - integer: Length of first dimension of USR
22 C> @param[in] I2 - integer: Length of second dimension of USR
23 C> @param[in] I3 - integer: Length of third dimension of USR
24 C> @param[out] USR - real*8(*,*,*): Starting address of data values read
25 C> from data subset; events are returned in the third
26 C> dimension for a particular data value and level in the
27 C> first and second dimensions
28 C> @returns NEVN - integer: Number of events in stack (must be less than
29 C> or equal to I3)
30 C>
31 C> @note: This routine should only be called by routine ufbin3(),
32 C> which itself is called only by verification
33 C> application program gridtobs, where it was previously
34 C> an in-line subroutine. In general, nevn() does not work
35 C> properly in other application programs at this time.
36 C>
37 C> @author J. Woollen @date 2003-11-04
38  FUNCTION nevn(NODE,LUN,INV1,INV2,I1,I2,I3,USR)
39 
40  USE moda_usrint
41 
42  CHARACTER*128 bort_str
43  dimension usr(i1,i2,i3)
44  real*8 usr
45 
46 C----------------------------------------------------------------------
47 C----------------------------------------------------------------------
48 
49  nevn = 0
50 
51 C FIND THE ENCLOSING EVENT STACK DESCRIPTOR
52 C -----------------------------------------
53 
54  ndrs = lstjpb(node,lun,'DRS')
55  IF(ndrs.LE.0) GOTO 100
56 
57  invn = invwin(ndrs,lun,inv1,inv2)
58  IF(invn.EQ.0) GOTO 900
59 
60  nevn = nint(val(invn,lun))
61  IF(nevn.GT.i3) GOTO 901
62 
63 C SEARCH EACH STACK LEVEL FOR THE REQUESTED NODE AND COPY THE VALUE
64 C -----------------------------------------------------------------
65 
66  n2 = invn + 1
67 
68  DO l=1,nevn
69  n1 = n2
70  n2 = n2 + nint(val(n1,lun))
71  DO n=n1,n2
72  IF(inv(n,lun).EQ.node) usr(1,1,l) = val(n,lun)
73  ENDDO
74  ENDDO
75 
76 C EXITS
77 C -----
78 
79 100 RETURN
80 900 CALL bort('BUFRLIB: NEVN - CAN''T FIND THE EVENT STACK!!!!!!')
81 901 WRITE(bort_str,'("BUFRLIB: NEVN - THE NO. OF EVENTS FOR THE '//
82  . 'REQUESTED STACK (",I3,") EXCEEDS THE VALUE OF THE 3RD DIM. OF'//
83  . ' THE USR ARRAY (",I3,")")') nevn,i3
84  CALL bort(bort_str)
85  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
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...
real *8, dimension(:,:), allocatable, target val
Data values.
integer, dimension(:,:), allocatable, target inv
Inventory pointer which links each data value to its corresponding node in the internal jump/link tab...
function nevn(NODE, LUN, INV1, INV2, I1, I2, I3, USR)
This function looks for all stacked data events for a specified data value and level within the porti...
Definition: nevn.f:39