NCEPLIBS-bufr 11.7.1
nevn.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 2003-11-04
3
4C> THIS FUNCTION LOOKS FOR ALL STACKED DATA EVENTS FOR A
5C> SPECIFIED DATA VALUE AND LEVEL WITHIN THE PORTION OF THE CURRENT
6C> SUBSET BUFFER BOUNDED BY THE INDICES INV1 AND INV2. ALL SUCH
7C> EVENTS ARE ACCUMULATED AND RETURNED TO THE CALLING PROGRAM WITHIN
8C> ARRAY USR. THE VALUE OF THE FUNCTION ITSELF IS THE TOTAL NUMBER
9C> OF EVENTS FOUND.
10C>
11C> PROGRAM HISTORY LOG:
12C> 2003-11-04 J. WOOLLEN -- ORIGINAL AUTHOR (WAS IN VERIFICATION
13C> VERSION)
14C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
15C> DOCUMENTATION (INCLUDING HISTORY); OUTPUTS
16C> MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
17C> TERMINATES ABNORMALLY
18C> 2009-03-31 J. WOOLLEN -- ADDED ADDITIONAL DOCUMENTATION
19C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
20C>
21C> USAGE: NEVN (NODE, LUN, INV1, INV2, I1, I2, I3, USR)
22C> INPUT ARGUMENT LIST:
23C> NODE - INTEGER: JUMP/LINK TABLE INDEX OF NODE TO RETURN
24C> STACKED VALUES FOR
25C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
26C> INV1 - INTEGER: STARTING INDEX OF THE PORTION OF THE SUBSET
27C> BUFFER IN WHICH TO LOOK FOR STACK VALUES
28C> INV2 - INTEGER: ENDING INDEX OF THE PORTION OF THE SUBSET
29C> BUFFER IN WHICH TO LOOK FOR STACK VALUES
30C> I1 - INTEGER: LENGTH OF FIRST DIMENSION OF USR
31C> I2 - INTEGER: LENGTH OF SECOND DIMENSION OF USR
32C> I3 - INTEGER: LENGTH OF THIRD DIMENSION OF USR
33C>
34C> OUTPUT ARGUMENT LIST:
35C> USR - REAL*8:(I1,I2,I3) STARTING ADDRESS OF DATA VALUES READ
36C> FROM DATA SUBSET, EVENTS ARE RETURNED IN THE THIRD
37C> DIMENSION FOR A PARTICULAR DATA VALUE AND LEVEL IN THE
38C> FIRST AND SECOND DIMENSIONS
39C> NEVN - INTEGER: NUMBER OF EVENTS IN STACK (MUST BE LESS THAN
40C> OR EQUAL TO I3)
41C>
42C> REMARKS:
43C> IMPORTANT: THIS ROUTINE SHOULD ONLY BE CALLED BY ROUTINE UFBIN3,
44C> WHICH, ITSELF, IS CALLED ONLY BY VERIFICATION
45C> APPLICATION PROGRAM GRIDTOBS, WHERE IT WAS PREVIOUSLY
46C> AN IN-LINE SUBROUTINE. IN GENERAL, NEVN DOES NOT WORK
47C> PROPERLY IN OTHER APPLICATION PROGRAMS AT THIS TIME.
48C>
49C> THIS ROUTINE CALLS: BORT INVWIN LSTJPB
50C> THIS ROUTINE IS CALLED BY: UFBIN3
51C> Should NOT be called by any
52C> application programs!!!
53C>
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
62C----------------------------------------------------------------------
63C----------------------------------------------------------------------
64
65 nevn = 0
66
67C FIND THE ENCLOSING EVENT STACK DESCRIPTOR
68C -----------------------------------------
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
79C SEARCH EACH STACK LEVEL FOR THE REQUESTED NODE AND COPY THE VALUE
80C -----------------------------------------------------------------
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
92C EXITS
93C -----
94
95100 RETURN
96900 CALL bort('BUFRLIB: NEVN - CAN''T FIND THE EVENT STACK!!!!!!')
97901 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
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
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
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:55