NCEPLIBS-bufr 11.7.1
iok2cpy.f
Go to the documentation of this file.
1C> @file
2C> @brief Check whether a BUFR message or data subset can be copied
3C> from one BUFR file to another.
4
5C> This function determines whether a BUFR message, or a data subset
6C> from within a BUFR message, can be copied from one Fortran logical
7C> unit to another.
8C>
9C> <p>The decision is based on whether both logical units contain
10C> identical definitions for the BUFR message type in question within
11C> their associated [DX BUFR Table information](@ref dfbftab).
12C> Note that it's possible for a BUFR message type to be identically
13C> defined for two different logical units even if the full set of
14C> associated DX BUFR table information isn't identical between both
15C> units.
16C>
17C> @author J. Ator
18C> @date 2009-06-26
19C>
20C> @param[in] LUI -- integer: Internal I/O stream index associated
21C> with source BUFR file
22C> @param[in] LUO -- integer: Internal I/O stream index associated
23C> with target BUFR file
24C> @returns iok2cpy -- integer: Flag indicating whether a BUFR
25C> message or data subset can be copied from the
26C> BUFR file associated with LUI to the BUFR file
27C> associated with LUO
28C> - 0 = No
29C> - 1 = Yes
30C>
31C> <b>Program history log:</b>
32C> | Date | Programmer | Comments |
33C> | -----|------------|----------|
34C> | 2009-06-26 | J. Ator | Original author |
35C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
36C>
37 INTEGER FUNCTION iok2cpy(LUI,LUO)
38
39 USE moda_msgcwd
40 USE moda_tables
41
42 CHARACTER*8 subset
43
44C-----------------------------------------------------------------------
45C-----------------------------------------------------------------------
46
47 iok2cpy = 0
48
49C Do both logical units have the same internal table information?
50
51 IF ( icmpdx(lui,luo) .EQ. 1 ) THEN
52 iok2cpy = 1
53 RETURN
54 ENDIF
55
56C No, so get the Table A mnemonic from the message to be copied,
57C then check whether that mnemonic is defined within the dictionary
58C tables for the logical unit to be copied to.
59
60 subset = tag(inode(lui))
61 CALL nemtbax(luo,subset,mtyp,msbt,inod)
62 IF ( inod .EQ. 0 ) RETURN
63
64C The Table A mnemonic is defined within the dictionary tables for
65C both units, so now make sure the definitions are identical.
66
67 ntei = isc(inode(lui))-inode(lui)
68 nteo = isc(inod)-inod
69 IF ( ntei .NE. nteo ) RETURN
70
71 DO i = 1, ntei
72 IF ( tag(inode(lui)+i) .NE. tag(inod+i) ) RETURN
73 IF ( typ(inode(lui)+i) .NE. typ(inod+i) ) RETURN
74 IF ( isc(inode(lui)+i) .NE. isc(inod+i) ) RETURN
75 IF ( irf(inode(lui)+i) .NE. irf(inod+i) ) RETURN
76 IF ( ibt(inode(lui)+i) .NE. ibt(inod+i) ) RETURN
77 ENDDO
78
79 iok2cpy = 1
80
81 RETURN
82 END
integer function icmpdx(LUD, LUN)
This function determines whether the full set of associated DX BUFR Table information is identical be...
Definition: icmpdx.f:34
integer function iok2cpy(LUI, LUO)
This function determines whether a BUFR message, or a data subset from within a BUFR message,...
Definition: iok2cpy.f:38
This module contains array and variable declarations used to store the internal jump/link table.
Definition: moda_tables.F:13
integer, dimension(:), allocatable isc
Scale factors corresponding to tag and typ:
Definition: moda_tables.F:140
character *3, dimension(:), allocatable typ
Type indicators corresponding to tag:
Definition: moda_tables.F:133
integer, dimension(:), allocatable ibt
Bit widths corresponding to tag and typ:
Definition: moda_tables.F:138
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
Definition: moda_tables.F:132
integer, dimension(:), allocatable irf
Reference values corresponding to tag and typ:
Definition: moda_tables.F:139
subroutine nemtbax(LUN, NEMO, MTYP, MSBT, INOD)
This subroutine searches for a descriptor within Table A of the internal DX BUFR tables.
Definition: nemtbax.f:34