NCEPLIBS-bufr 11.7.1
trybump.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS SUBROUTINE CHECKS THE FIRST NODE ASSOCIATED WITH A
5C> CHARACTER STRING (PARSED INTO ARRAYS IN COMMON BLOCK /USRSTR/) IN
6C> ORDER TO DETERMINE IF IT REPRESENTS A DELAYED REPLICATION SEQUENCE.
7C> IF SO, THEN THE DELAYED REPLICATION SEQUENCE IS INITIALIZED AND
8C> EXPANDED (I.E. "BUMPED") TO THE VALUE OF INPUT ARGUMENT I2.
9C> A CALL IS THEN MADE TO SUBROUTINE UFBRW IN ORDER TO WRITE USER DATA
10C> INTO THE NEWLY EXPANDED REPLICATION SEQUENCE.
11C>
12C> TRYBUMP IS USUALLY CALLED FROM UFBINT AFTER UFBINT RECEIVES A
13C> NON-ZERO RETURN CODE FROM UFBRW. THE CAUSE OF A BAD RETURN FROM
14C> UFBRW IS USUALLY A DELAYED REPLICATION SEQUENCE WHICH ISN'T
15C> EXPANDED ENOUGH TO HOLD THE ARRAY OF DATA THE USER IS TRYING TO
16C> WRITE. SO TRYBUMP IS ONE LAST CHANCE TO RESOLVE THAT SITUATION.
17C>
18C> PROGRAM HISTORY LOG:
19C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
20C> 1998-07-08 J. WOOLLEN -- IMPROVED MACHINE PORTABILITY
21C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
22C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
23C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
24C> BUFR FILES UNDER THE MPI)
25C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
26C> INTERDEPENDENCIES
27C> 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
28C> INCREASED FROM 15000 TO 16000 (WAS IN
29C> VERIFICATION VERSION); UNIFIED/PORTABLE FOR
30C> WRF; ADDED DOCUMENTATION (INCLUDING
31C> HISTORY) (INCOMPLETE); OUTPUTS MORE
32C> COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
33C> TERMINATES ABNORMALLY
34C> 2009-03-31 J. WOOLLEN -- ADDED DOCUMENTATION
35C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
36C>
37C> USAGE: CALL TRYBUMP (LUNIT, LUN, USR, I1, I2, IO, IRET)
38C> INPUT ARGUMENT LIST:
39C> LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
40C> (SEE REMARKS)
41C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
42C> (ASSOCIATED WITH FILE CONNECTED TO LOGICAL UNIT LUNIT)
43C> USR - REAL*8: (I1,I2) STARTING ADDRESS OF DATA VALUES TO BE
44C> WRITTEN TO DATA SUBSET
45C> I1 - INTEGER: LENGTH OF FIRST DIMENSION OF USR
46C> I2 - INTEGER: NUMBER OF "LEVELS" OF DATA VALUES TO BE
47C> WRITTEN TO DATA SUBSET
48C> IO - INTEGER: STATUS INDICATOR FOR BUFR FILE ASSOCIATED
49C> WITH LUNIT (SEE REMARKS):
50C> 0 = INPUT FILE (POSSIBLE FUTURE USE)
51C> 1 = OUTPUT FILE
52C>
53C> OUTPUT ARGUMENT LIST:
54C> IRET - INTEGER: RETURN CODE FROM CALL TO SUBROUTINE UFBRW
55C>
56C> REMARKS:
57C> ARGUMENT LUNIT IS NOT REFERENCED IN THIS SUBROUTINE. IT WAS
58C> INCLUDED ONLY FOR POTENTIAL FUTURE EXPANSION OF THE SUBROUTINE.
59C>
60C> ARGUMENT IO IS ALWAYS PASSED IN WITH A VALUE OF 1 AT THE PRESENT
61C> TIME. IN THE FUTURE THE SUBROUTINE MAY BE EXPANDED TO ALLOW IT
62C> TO OPERATE ON INPUT FILES.
63C>
64C> THIS ROUTINE CALLS: BORT INVWIN LSTJPB UFBRW
65C> USRTPL
66C> THIS ROUTINE IS CALLED BY: UFBINT UFBOVR
67C> Normally not called by any application
68C> programs.
69C>
70 SUBROUTINE trybump(LUNIT,LUN,USR,I1,I2,IO,IRET)
71
72 USE moda_usrint
73
74 COMMON /usrstr/ nnod,ncon,nods(20),nodc(10),ivls(10),kons(10)
75
76 real*8 usr(i1,i2)
77
78C-----------------------------------------------------------------------
79C-----------------------------------------------------------------------
80
81C SEE IF THERE IS A DELAYED REPLICATION GROUP INVOLVED
82C ----------------------------------------------------
83
84 ndrp = lstjpb(nods(1),lun,'DRP')
85 IF(ndrp.LE.0) GOTO 100
86
87C IF SO, CLEAN IT OUT AND BUMP IT TO I2
88C -------------------------------------
89
90 invn = invwin(ndrp,lun,1,nval(lun))
91 val(invn,lun) = 0
92 jnvn = invn+1
93 DO WHILE(nint(val(jnvn,lun)).GT.0)
94 jnvn = jnvn+nint(val(jnvn,lun))
95 ENDDO
96 DO knvn=1,nval(lun)-jnvn+1
97 inv(invn+knvn,lun) = inv(jnvn+knvn-1,lun)
98 val(invn+knvn,lun) = val(jnvn+knvn-1,lun)
99 ENDDO
100 nval(lun) = nval(lun)-(jnvn-invn-1)
101 CALL usrtpl(lun,invn,i2)
102
103C FINALLY, CALL THE MNEMONIC WRITER
104C ----------------------------------------
105
106 CALL ufbrw(lun,usr,i1,i2,io,iret)
107
108C EXIT
109C ----
110
111100 RETURN
112 END
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
subroutine trybump(LUNIT, LUN, USR, I1, I2, IO, IRET)
THIS SUBROUTINE CHECKS THE FIRST NODE ASSOCIATED WITH A CHARACTER STRING (PARSED INTO ARRAYS IN COMMO...
Definition: trybump.f:71
subroutine ufbrw(LUN, USR, I1, I2, IO, IRET)
THIS SUBROUTINE WRITES OR READS SPECIFIED VALUES TO OR FROM THE CURRENT BUFR DATA SUBSET WITHIN INTER...
Definition: ufbrw.f:80
subroutine usrtpl(LUN, INVN, NBMP)
THIS SUBROUTINE STORES THE SUBSET TEMPLATE INTO INTERNAL SUBSET ARRAYS IN MODULE USRINT FOR CASES OF ...
Definition: usrtpl.f:52