NCEPLIBS-bufr 11.7.1
readdx.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS SUBROUTINE GENERATES INTERNAL ARRAYS CONTAINING BUFR
5C> DICTIONARY TABLES WHICH ARE NEEDED TO READ, WRITE, INITIALIZE OR
6C> APPEND A BUFR FILE. THE INFORMATION USED TO CREATE THE INTERNAL
7C> DICTIONARY TABLE ARRAYS (IN MODULE TABABD) AND THE DICTIONARY
8C> MESSAGE CONTROL WORD PARTITION ARRAYS (IN MODULE MSGCWD)
9C> (WHICH ARE ALWAYS THEN ASSOCIATED WITH THE BUFR FILE IN LUNIT)
10C> MAY COME FROM AN EXTERNAL, USER-SUPPLIED, BUFR DICTIONARY
11C> TABLE FILE IN CHARACTER FORMAT (I.E., A BUFR MNEMONIC TABLE), FROM
12C> THE BUFR FILE BEING ACTED UPON (IN WHICH CASE THE FILE MUST BE
13C> OPENED FOR INPUT PROCESSING AND POSITIONED AT A DICTIONARY TABLE
14C> MESSAGE SOMEWHERE IN THE FILE), OR FROM ANOTHER CURRENTLY OPENED
15C> AND DEFINED BUFR FILE. IN THIS LATTER CASE, THE BUFR FILE WOULD
16C> MOST LIKELY BE OPENED FOR INPUT, HOWEVER THERE IS NOTHING
17C> PREVENTING THE USE OF A FILE OPEN FOR OUTPUT AS LONG AS IT IS
18C> ASSOCIATED WITH INTERNAL DICTIONARY ARRAYS THAT CAN BE USED.
19C>
20C> PROGRAM HISTORY LOG:
21C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
22C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
23C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
24C> ROUTINE "BORT"
25C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
26C> INTERDEPENDENCIES
27C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
28C> DOCUMENTATION (INCLUDING HISTORY); OUTPUTS
29C> MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
30C> TERMINATES ABNORMALLY OR FOR INFORMATIONAL
31C> PURPOSES
32C> 2009-04-21 J. ATOR -- USE ERRWRT
33C>
34C> USAGE: CALL READDX (LUNIT, LUN, LUNDX)
35C> INPUT ARGUMENT LIST:
36C> LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
37C> BEING READ, WRITTEN, INITIALIZED OR APPENDED
38C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
39C> (ASSOCIATED WITH FILE CONNECTED TO LOGICAL UNIT LUNIT)
40C> LUNDX - INTEGER: FORTRAN LOGICAL UNIT NUMBER CONTAINING
41C> DICTIONARY TABLE INFORMATION TO BE USED IN READING/
42C> WRITING FROM/TO LUNIT (DEPENDING ON THE CASE); MAY BE
43C> SET EQUAL TO LUNIT IF DICTIONARY TABLE INFORMATION IS
44C> ALREADY EMBEDDED IN LUNIT (BUT ONLY IF LUNIT IS BEING
45C> READ)
46C>
47C> REMARKS:
48C> THIS ROUTINE CALLS: BORT CPBFDX ERRWRT MAKESTAB
49C> RDBFDX RDUSDX STATUS
50C> THIS ROUTINE IS CALLED BY: OPENBF WRITDX
51C> Normally not called by any application
52C> programs.
53C>
54 SUBROUTINE readdx(LUNIT,LUN,LUNDX)
55
56
57
58 COMMON /quiet/ iprt
59
60 CHARACTER*128 ERRSTR
61
62C-----------------------------------------------------------------------
63C-----------------------------------------------------------------------
64
65C GET THE BUFR STATUS OF UNIT LUNDX
66C ---------------------------------
67
68 CALL status(lundx,lud,ildx,imdx)
69
70C READ A DICTIONARY TABLE FROM THE INDICATED SOURCE
71C -------------------------------------------------
72
73 IF (lunit.EQ.lundx) THEN
74c .... Source is input BUFR file in LUNIT
75 IF(iprt.GE.2) THEN
76 CALL errwrt('++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
77 WRITE ( unit=errstr, fmt='(A,A,I3,A)' )
78 . 'BUFRLIB: READDX - READING BUFR DICTIONARY TABLE FROM ',
79 . 'INPUT BUFR FILE IN UNIT ', lundx, ' INTO INTERNAL ARRAYS'
80 CALL errwrt(errstr)
81 CALL errwrt('++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
82 CALL errwrt(' ')
83 ENDIF
84 rewind lunit
85 CALL rdbfdx(lunit,lun)
86 ELSEIF(ildx.EQ.-1) THEN
87c .... Source is input BUFR file in LUNDX
88c .... BUFR file in LUNIT may be input or output
89 IF(iprt.GE.2) THEN
90 CALL errwrt('++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
91 WRITE ( unit=errstr, fmt='(A,A,I3,A,A,I3)' )
92 . 'BUFRLIB: READDX - COPYING BUFR DCTY TBL FROM INTERNAL ',
93 . 'ARRAYS ASSOC. W/ INPUT UNIT ', lundx, ' TO THOSE ASSOC. ',
94 . 'W/ UNIT ', lunit
95 CALL errwrt(errstr)
96 CALL errwrt('++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
97 CALL errwrt(' ')
98 ENDIF
99 CALL cpbfdx(lud,lun)
100 CALL makestab
101 ELSEIF(ildx.EQ.1) THEN
102c .... Source is output BUFR file in LUNDX
103c .... BUFR file in LUNIT may be input or output
104 IF(iprt.GE.2) THEN
105 CALL errwrt('++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
106 WRITE ( unit=errstr, fmt='(A,A,I3,A,A,I3)' )
107 . 'BUFRLIB: READDX - COPYING BUFR DCTY TBL FROM INTERNAL ',
108 . 'ARRAYS ASSOC. W/ OUTPUT UNIT ', lundx, ' TO THOSE ASSOC. ',
109 . 'W/ UNIT ', lunit
110 CALL errwrt(errstr)
111 CALL errwrt('++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
112 CALL errwrt(' ')
113 ENDIF
114 CALL cpbfdx(lud,lun)
115 CALL makestab
116 ELSEIF(ildx.EQ.0) THEN
117c .... Source is user-supplied character table in LUNDX
118c .... BUFR file in LUNIT may be input or output
119 IF(iprt.GE.2) THEN
120 CALL errwrt('++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
121 WRITE ( unit=errstr, fmt='(A,A,I3,A)' )
122 . 'BUFRLIB: READDX - READING BUFR DICTIONARY TABLE FROM ',
123 . 'USER-SUPPLIED TEXT FILE IN UNIT ', lundx,
124 . ' INTO INTERNAL ARRAYS'
125 CALL errwrt(errstr)
126 CALL errwrt('++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
127 CALL errwrt(' ')
128 ENDIF
129 rewind lundx
130 CALL rdusdx(lundx,lun)
131 ELSE
132 GOTO 900
133 ENDIF
134
135C EXITS
136C -----
137
138 RETURN
139900 CALL bort('BUFRLIB: READDX - CANNOT DETERMINE SOURCE OF '//
140 . 'INPUT DICTIONARY TABLE')
141 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine cpbfdx(LUD, LUN)
THIS SUBROUTINE COPIES BUFR TABLE (DICTIONARY) MESSAGES FROM ONE LOCATION TO ANOTHER WITHIN INTERNAL ...
Definition: cpbfdx.f:36
subroutine errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
Definition: errwrt.f:42
subroutine makestab
THIS SUBROUTINE CONSTRUCTS AN INTERNAL JUMP/LINK TABLE WITHIN MODULE TABLES, USING THE INFORMATION WI...
Definition: makestab.f:75
subroutine rdbfdx(LUNIT, LUN)
BEGINNING AT THE CURRENT FILE POINTER LOCATION WITHIN LUNIT, THIS SUBROUTINE READS A COMPLETE DICTION...
Definition: rdbfdx.f:71
subroutine rdusdx(LUNDX, LUN)
THIS SUBROUTINE READS AND PARSES A FILE CONTAINING A USER- SUPPLIED BUFR DICTIONARY TABLE IN CHARACTE...
Definition: rdusdx.f:65
subroutine readdx(LUNIT, LUN, LUNDX)
THIS SUBROUTINE GENERATES INTERNAL ARRAYS CONTAINING BUFR DICTIONARY TABLES WHICH ARE NEEDED TO READ,...
Definition: readdx.f:55
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