NCEPLIBS-bufr  11.7.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> | Date | Programmer | Comments |
29 C> | -----|------------|----------|
30 C> | 2009-06-18 | J. Ator | Original author |
31 C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
32 C>
33  INTEGER FUNCTION icmpdx(LUD,LUN)
34 
35  USE moda_tababd
36 
37 C-----------------------------------------------------------------------
38 C-----------------------------------------------------------------------
39 
40 C First, check whether the two units are actually sharing tables.
41 C If so, then they obviously have the same table information.
42 
43  icmpdx = ishrdx(lud,lun)
44  IF ( icmpdx .EQ. 1 ) RETURN
45 
46 C Otherwise, check whether the internal Table A, B and D entries are
47 C all identical between the two units.
48 
49  IF ( ( ntba(lud) .EQ. 0 ) .OR.
50  . ( ntba(lun) .NE. ntba(lud) ) ) RETURN
51  DO i = 1, ntba(lud)
52  IF ( idna(i,lun,1) .NE. idna(i,lud,1) ) RETURN
53  IF ( idna(i,lun,2) .NE. idna(i,lud,2) ) RETURN
54  IF ( taba(i,lun) .NE. taba(i,lud) ) RETURN
55  ENDDO
56 
57  IF ( ( ntbb(lud) .EQ. 0 ) .OR.
58  . ( ntbb(lun) .NE. ntbb(lud) ) ) RETURN
59  DO i = 1, ntbb(lud)
60  IF ( idnb(i,lun) .NE. idnb(i,lud) ) RETURN
61  IF ( tabb(i,lun) .NE. tabb(i,lud) ) RETURN
62  ENDDO
63 
64  IF ( ( ntbd(lud) .EQ. 0 ) .OR.
65  . ( ntbd(lun) .NE. ntbd(lud) ) ) RETURN
66  DO i = 1, ntbd(lud)
67  IF ( idnd(i,lun) .NE. idnd(i,lud) ) RETURN
68  IF ( tabd(i,lun) .NE. tabd(i,lud) ) RETURN
69  ENDDO
70 
71  icmpdx = 1
72 
73  RETURN
74  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:29
INTEGER function icmpdx(LUD, LUN)
This function determines whether the full set of associated DX BUFR Table information is identical be...
Definition: icmpdx.f:33