NCEPLIBS-bufr 11.7.1
drfini.f
Go to the documentation of this file.
1C> @file
2C> @brief Initialize replication factors for delayed replication
3C> sequences.
4
5C> This subroutine explicitly initializes delayed replication factors
6C> and allocates a corresponding amount of space within internal arrays,
7C> thereby allowing the subsequent use of subroutine ufbseq() to write
8C> data into delayed replication sequences.
9C>
10C> @author J. Woollen
11C> @date 2002-05-14
12C>
13C> @param[in] LUNIT -- integer: Fortran logical unit number for BUFR
14C> file
15C> @param[in] MDRF -- integer(*): Array of delayed replication factors,
16C> in one-to-one correspondence with the number
17C> of occurrences of DRFTAG within the overall
18C> subset definition, and explicitly defining
19C> how much space (i.e. how many replications)
20C> to allocate within each successive occurrence
21C> @param[in] NDRF -- integer: Number of delayed replication factors
22C> within MDRF
23C> @param[in] DRFTAG -- character*(*): Table D sequence mnemonic,
24C> bracketed by appropriate delayed replication
25C> notation (e.g. {}, () OR <>)
26C>
27C> <p>Logical unit LUNIT should have already been opened for output
28C> operations (i.e. writing/encoding BUFR) via a previous call to
29C> subroutine openbf(), and a message for output should have already
30C> been opened via a previous call to one of the
31C> [message-writing subroutines].
32C>
33C> <p>The use of this subroutine is only required when writing data
34C> into delayed replication sequences using ufbseq(), or for cases
35C> where ufbint() or ufbrep() are being used to write data into
36C> delayed replication sequences which occur more than once within
37C> an overall subset definition. In such cases, the use of this
38C> subroutine allows the application code to explicitly specify how
39C> many replications of the sequence are to be allocated to each
40C> occurrence of the delayed replication sequence within the overall
41C> subset definition, prior to storing all of the actual data values
42C> themselves via a single subsequent call to ufbint() or ufbrep().
43C> In contrast, the use of this subroutine is not required when
44C> ufbint() or ufbrep() are to be called to store data values
45C> for a delayed replication sequence which only occurs one time
46C> within an overall subset definition, because in that case the
47C> same type of initialization and space allocation functionality
48C> will be automatically handled internally within subroutine
49C> ufbint() or ufbrep().
50C>
51C> <b>Program history log:</b>
52C> | Date | Programmer | Comments |
53C> | -----|------------|----------|
54C> | 2002-05-14 | J. Woollen | Original author |
55C> | 2003-11-04 | S. Bender | Added remarks and routine interdependencies
56C> | 2003-11-04 | D. Keyser | Unified/portable for WRF; added history documentation; outputs more complete diagnostic info when routine terminates abnormally |
57C> | 2005-03-04 | J. Ator | Updated documentation |
58C> | 2014-09-08 | J. Ator | Increase NDRF limit from 100 to 200 |
59C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
60C> | 2018-06-07 | J. Ator | Increase NDRF limit from 200 to 2000 |
61C>
62 SUBROUTINE drfini(LUNIT,MDRF,NDRF,DRFTAG)
63
64 USE moda_usrint
65 USE moda_tables
66
67 CHARACTER*(*) DRFTAG
68 CHARACTER*128 BORT_STR
69 dimension mdrf(ndrf)
70
71C-----------------------------------------------------------------------
72C-----------------------------------------------------------------------
73
74 IF(ndrf.GT.2000) GOTO 900
75
76 CALL status(lunit,lun,il,im)
77
78C COMFORM THE TEMPLATES TO THE DELAYED REPLICATION FACTORS
79C --------------------------------------------------------
80
81 m = 0
82 n = 0
83
8410 DO n=n+1,nval(lun)
85 node = inv(n,lun)
86 IF(itp(node).EQ.1 .AND. tag(node).EQ.drftag) THEN
87 m = m+1
88 CALL usrtpl(lun,n,mdrf(m))
89 GOTO 10
90 ENDIF
91 ENDDO
92
93C EXITS
94C -----
95
96 RETURN
97 900 WRITE(bort_str,'("BUFRLIB: DRFINI - THE NUMBER OF DELAYED '//
98 . 'REPLICATION FACTORS (",I5,") EXCEEDS THE LIMIT (2000)")') ndrf
99 CALL bort(bort_str)
100 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine drfini(LUNIT, MDRF, NDRF, DRFTAG)
This subroutine explicitly initializes delayed replication factors and allocates a corresponding amou...
Definition: drfini.f:63
This module contains array and variable declarations used to store the internal jump/link table.
Definition: moda_tables.F:13
integer, dimension(:), allocatable itp
Integer type values corresponding to typ:
Definition: moda_tables.F:141
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
Definition: moda_tables.F:132
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
Definition: status.f:56
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