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