NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
icmpdx.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Check whether two BUFR files have the same DX BUFR table
3 C> information.
4 
5 C> This function determines whether the full set of associated
6 C> [DX BUFR Table information](@ref dfbftab) is identical between
7 C> two Fortran logical units.
8 C>
9 C> Note that two different logical units can have identical DX BUFR
10 C> Table information associated with them even if they aren't actually
11 C> sharing the same DX BUFR table.
12 C>
13 C> @author J. Ator
14 C> @date 2009-06-18
15 C>
16 C> @param[in] LUD - integer: Internal I/O stream index associated
17 C> with first BUFR file
18 C> @param[in] LUN - integer: Internal I/O stream index associated
19 C> with second BUFR file
20 C> @returns icmpdx - integer: Flag indicating whether the
21 C> BUFR file associated with LUD and the BUFR
22 C> file associated with LUN have the same DX
23 C> BUFR table information
24 C> - 0 = No
25 C> - 1 = Yes
26 C>
27 C> <b>Program history log:</b>
28 C> - 2009-06-18 J. Ator -- Original author
29 C> - 2014-12-10 J. Ator -- Use modules instead of COMMON blocks
30 C>
31  INTEGER FUNCTION icmpdx(LUD,LUN)
32 
33  USE moda_tababd
34 
35 C-----------------------------------------------------------------------
36 C-----------------------------------------------------------------------
37 
38 C First, check whether the two units are actually sharing tables.
39 C If so, then they obviously have the same table information.
40 
41  icmpdx = ishrdx(lud,lun)
42  IF ( icmpdx .EQ. 1 ) RETURN
43 
44 C Otherwise, check whether the internal Table A, B and D entries are
45 C all identical between the two units.
46 
47  IF ( ( ntba(lud) .EQ. 0 ) .OR.
48  . ( ntba(lun) .NE. ntba(lud) ) ) RETURN
49  DO i = 1, ntba(lud)
50  IF ( idna(i,lun,1) .NE. idna(i,lud,1) ) RETURN
51  IF ( idna(i,lun,2) .NE. idna(i,lud,2) ) RETURN
52  IF ( taba(i,lun) .NE. taba(i,lud) ) RETURN
53  ENDDO
54 
55  IF ( ( ntbb(lud) .EQ. 0 ) .OR.
56  . ( ntbb(lun) .NE. ntbb(lud) ) ) RETURN
57  DO i = 1, ntbb(lud)
58  IF ( idnb(i,lun) .NE. idnb(i,lud) ) RETURN
59  IF ( tabb(i,lun) .NE. tabb(i,lud) ) RETURN
60  ENDDO
61 
62  IF ( ( ntbd(lud) .EQ. 0 ) .OR.
63  . ( ntbd(lun) .NE. ntbd(lud) ) ) RETURN
64  DO i = 1, ntbd(lud)
65  IF ( idnd(i,lun) .NE. idnd(i,lud) ) RETURN
66  IF ( tabd(i,lun) .NE. tabd(i,lud) ) RETURN
67  ENDDO
68 
69  icmpdx = 1
70 
71  RETURN
72  END
This module contains array and variable declarations used to store DX BUFR tables internally for mult...
Definition: moda_tababd.F:10
INTEGER function ishrdx(LUD, LUN)
This function determines whether the same DX BUFR Table is being shared between two Fortran logical u...
Definition: ishrdx.f:27
INTEGER function icmpdx(LUD, LUN)
This function determines whether the full set of associated DX BUFR Table information is identical be...
Definition: icmpdx.f:31