NCEPLIBS-bufr  12.0.0
trybump.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Try to expand a delayed replication sequence.
3 C>
4 C> @author Woollen @date 1994-01-06
5 
6 C> This subroutine checks the first node associated with a
7 C> character string (parsed into arrays in common block /usrstr/) in
8 C> order to determine if it represents a delayed replication sequence.
9 C> If so, then the delayed replication sequence is initialized and
10 C> expanded (i.e. "bumped") to the value of input argument I2.
11 C> A call is then made to subroutine ufbrw() in order to write user data
12 C> into the newly expanded replication sequence.
13 C>
14 C> trybump() is usually called from ufbint() after ufbint() receives a
15 C> non-zero return code from ufbrw(). The cause of a bad return from
16 C> ufbrw() is usually a delayed replication sequence which isn't
17 C> expanded enough to hold the array of data the user is trying to
18 C> write. So trybump() is one last chance to resolve that situation.
19 C>
20 C> @note Argument IO is always passed in with a value of 1 at the present
21 C> time. In the future the subroutine may be expanded to allow it
22 C> to operate on input files.
23 C>
24 C> @param[in] LUN - integer: file ID of open BUFR file
25 C> @param[in] USR - real*8: (i1,i2) starting address of data values to be
26 C> written to data subset.
27 C> @param[in] I1 - integer: length of first dimension of USR.
28 C> @param[in] I2 - integer: number of "levels" of data values to be
29 C> written to data subset.
30 C> @param[in] IO - integer: status indicator for BUFR file
31 C> - 0 Input file (possible future use)
32 C> - 1 Output file
33 C> @param[out] IRET - integer: number of "levels" of data values
34 C> written to data subset.
35 C>
36 C> @author Woollen @date 1994-01-06
37  SUBROUTINE trybump(LUN,USR,I1,I2,IO,IRET)
38 
39  USE moda_usrint
40 
41  COMMON /usrstr/ nnod,ncon,nods(20),nodc(10),ivls(10),kons(10)
42 
43  real*8 usr(i1,i2)
44 
45 C-----------------------------------------------------------------------
46 C-----------------------------------------------------------------------
47 
48 C SEE IF THERE IS A DELAYED REPLICATION GROUP INVOLVED
49 C ----------------------------------------------------
50 
51  ndrp = lstjpb(nods(1),lun,'DRP')
52  IF(ndrp.LE.0) GOTO 100
53 
54 C IF SO, CLEAN IT OUT AND BUMP IT TO I2
55 C -------------------------------------
56 
57  invn = invwin(ndrp,lun,1,nval(lun))
58  val(invn,lun) = 0
59  jnvn = invn+1
60  DO WHILE(nint(val(jnvn,lun)).GT.0)
61  jnvn = jnvn+nint(val(jnvn,lun))
62  ENDDO
63  DO knvn=1,nval(lun)-jnvn+1
64  inv(invn+knvn,lun) = inv(jnvn+knvn-1,lun)
65  val(invn+knvn,lun) = val(jnvn+knvn-1,lun)
66  ENDDO
67  nval(lun) = nval(lun)-(jnvn-invn-1)
68  CALL usrtpl(lun,invn,i2)
69 
70 C FINALLY, CALL THE MNEMONIC WRITER
71 C ----------------------------------------
72 
73  CALL ufbrw(lun,usr,i1,i2,io,iret)
74 
75 C EXIT
76 C ----
77 
78 100 RETURN
79  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: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...
integer, dimension(:), allocatable nval
Number of data values in BUFR data subset.
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...
subroutine trybump(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:38
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:32
subroutine usrtpl(LUN, INVN, NBMP)
Store the subset template into internal arrays.
Definition: usrtpl.f:22