NCEPLIBS-bufr  11.6.0
 All Data Structures Files Functions Variables Pages
nevn.f
Go to the documentation of this file.
1 C> @file
2 C> @author WOOLLEN @date 2003-11-04
3 
4 C> THIS FUNCTION LOOKS FOR ALL STACKED DATA EVENTS FOR A
5 C> SPECIFIED DATA VALUE AND LEVEL WITHIN THE PORTION OF THE CURRENT
6 C> SUBSET BUFFER BOUNDED BY THE INDICES INV1 AND INV2. ALL SUCH
7 C> EVENTS ARE ACCUMULATED AND RETURNED TO THE CALLING PROGRAM WITHIN
8 C> ARRAY USR. THE VALUE OF THE FUNCTION ITSELF IS THE TOTAL NUMBER
9 C> OF EVENTS FOUND.
10 C>
11 C> PROGRAM HISTORY LOG:
12 C> 2003-11-04 J. WOOLLEN -- ORIGINAL AUTHOR (WAS IN VERIFICATION
13 C> VERSION)
14 C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
15 C> DOCUMENTATION (INCLUDING HISTORY); OUTPUTS
16 C> MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
17 C> TERMINATES ABNORMALLY
18 C> 2009-03-31 J. WOOLLEN -- ADDED ADDITIONAL DOCUMENTATION
19 C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
20 C>
21 C> USAGE: NEVN (NODE, LUN, INV1, INV2, I1, I2, I3, USR)
22 C> INPUT ARGUMENT LIST:
23 C> NODE - INTEGER: JUMP/LINK TABLE INDEX OF NODE TO RETURN
24 C> STACKED VALUES FOR
25 C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
26 C> INV1 - INTEGER: STARTING INDEX OF THE PORTION OF THE SUBSET
27 C> BUFFER IN WHICH TO LOOK FOR STACK VALUES
28 C> INV2 - INTEGER: ENDING INDEX OF THE PORTION OF THE SUBSET
29 C> BUFFER IN WHICH TO LOOK FOR STACK VALUES
30 C> I1 - INTEGER: LENGTH OF FIRST DIMENSION OF USR
31 C> I2 - INTEGER: LENGTH OF SECOND DIMENSION OF USR
32 C> I3 - INTEGER: LENGTH OF THIRD DIMENSION OF USR
33 C>
34 C> OUTPUT ARGUMENT LIST:
35 C> USR - REAL*8:(I1,I2,I3) STARTING ADDRESS OF DATA VALUES READ
36 C> FROM DATA SUBSET, EVENTS ARE RETURNED IN THE THIRD
37 C> DIMENSION FOR A PARTICULAR DATA VALUE AND LEVEL IN THE
38 C> FIRST AND SECOND DIMENSIONS
39 C> NEVN - INTEGER: NUMBER OF EVENTS IN STACK (MUST BE LESS THAN
40 C> OR EQUAL TO I3)
41 C>
42 C> REMARKS:
43 C> IMPORTANT: THIS ROUTINE SHOULD ONLY BE CALLED BY ROUTINE UFBIN3,
44 C> WHICH, ITSELF, IS CALLED ONLY BY VERIFICATION
45 C> APPLICATION PROGRAM GRIDTOBS, WHERE IT WAS PREVIOUSLY
46 C> AN IN-LINE SUBROUTINE. IN GENERAL, NEVN DOES NOT WORK
47 C> PROPERLY IN OTHER APPLICATION PROGRAMS AT THIS TIME.
48 C>
49 C> THIS ROUTINE CALLS: BORT INVWIN LSTJPB
50 C> THIS ROUTINE IS CALLED BY: UFBIN3
51 C> Should NOT be called by any
52 C> application programs!!!
53 C>
54  FUNCTION nevn(NODE,LUN,INV1,INV2,I1,I2,I3,USR)
55 
56  USE moda_usrint
57 
58  CHARACTER*128 bort_str
59  dimension usr(i1,i2,i3)
60  REAL*8 usr
61 
62 C----------------------------------------------------------------------
63 C----------------------------------------------------------------------
64 
65  nevn = 0
66 
67 C FIND THE ENCLOSING EVENT STACK DESCRIPTOR
68 C -----------------------------------------
69 
70  ndrs = lstjpb(node,lun,'DRS')
71  IF(ndrs.LE.0) goto 100
72 
73  invn = invwin(ndrs,lun,inv1,inv2)
74  IF(invn.EQ.0) goto 900
75 
76  nevn = val(invn,lun)
77  IF(nevn.GT.i3) goto 901
78 
79 C SEARCH EACH STACK LEVEL FOR THE REQUESTED NODE AND COPY THE VALUE
80 C -----------------------------------------------------------------
81 
82  n2 = invn + 1
83 
84  DO l=1,nevn
85  n1 = n2
86  n2 = n2 + val(n1,lun)
87  DO n=n1,n2
88  IF(inv(n,lun).EQ.node) usr(1,1,l) = val(n,lun)
89  ENDDO
90  ENDDO
91 
92 C EXITS
93 C -----
94 
95 100 RETURN
96 900 CALL bort('BUFRLIB: NEVN - CAN''T FIND THE EVENT STACK!!!!!!')
97 901 WRITE(bort_str,'("BUFRLIB: NEVN - THE NO. OF EVENTS FOR THE '//
98  . 'REQUESTED STACK (",I3,") EXCEEDS THE VALUE OF THE 3RD DIM. OF'//
99  . ' THE USR ARRAY (",I3,")")') nevn,i3
100  CALL bort(bort_str)
101  END
function lstjpb(NODE, LUN, JBTYP)
THIS FUNCTION SEARCHES BACKWARDS, BEGINNING FROM A GIVEN NODE WITHIN THE JUMP/LINK TABLE...
Definition: lstjpb.f:57
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:54
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