NCEPLIBS-bufr  11.6.0
 All Data Structures Files Functions Variables Pages
ufbqcd.f
Go to the documentation of this file.
1 C> @file
2 C> @author WOOLLEN @date 1994-01-06
3 
4 C> THIS SUBROUTINE READS IN A MNEMONIC KNOWN TO BE IN THE BUFR
5 C> TABLE ASSOCIATED WITH THE BUFR FILE IN LOGICAL UNIT LUNIT, AND
6 C> RETURNS THE DESCRIPTOR ENTRY (Y) ASSOCIATED WITH IT WHEN THE FXY
7 C> DESCRIPTOR IS A SEQUENCE DESCRIPTOR (F=3) WITH TABLE D CATEGORY 63
8 C> (X=63). THIS ROUTINE WILL NOT WORK FOR ANY OTHER TYPE OF
9 C> DESCRIPTOR OR ANY OTHER SEQUENCE DESCRIPTOR TABLE D CATEGORY.
10 C> LUNIT MUST ALREADY BE OPENED FOR INPUT OR OUTPUT VIA A CALL TO
11 C> OPENBF. THIS ROUTINE IS ESPECIALLY USEFUL WHEN THE CALLING PROGRAM
12 C> IS WRITING "EVENTS" TO AN OUTPUT BUFR FILE (USUALLY THE "PREPBUFR"
13 C> FILE) USING THE SAME BUFR TABLE SINCE THE DESCRIPTOR ENTRY (Y) HERE
14 C> DEFINES THE EVENT PROGRAM CODE. THUS, THE CALLING PROGRAM CAN PASS
15 C> THE PROGRAM CODE INTO VARIOUS EVENTS WITHOUT ACTUALLY KNOWING ITS
16 C> VALUE AS LONG AS IT KNOWS THE MNEMONIC NAME ASSOCIATED WITH IT.
17 C>
18 C> PROGRAM HISTORY LOG:
19 C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
20 C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
21 C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
22 C> ROUTINE "BORT"
23 C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
24 C> INTERDEPENDENCIES
25 C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
26 C> DOCUMENTATION (INCLUDING HISTORY); OUTPUTS
27 C> MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
28 C> TERMINATES ABNORMALLY
29 C>
30 C> USAGE: CALL UFBQCD (LUNIT, NEMO, QCD)
31 C> INPUT ARGUMENT LIST:
32 C> LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
33 C> (ASSOCIATED BUFR TABLE MAY BE INTERNAL OR EXTERNAL)
34 C> NEMO - CHARACTER*(*): MNEMONIC
35 C>
36 C> OUTPUT ARGUMENT LIST:
37 C> QCD - REAL: SEQUENCE DESCRIPTOR ENTRY (I.E., EVENT PROGRAM
38 C> CODE) IN BUFR TABLE ASSOCIATED WITH NEMO (Y IN FXY
39 C> DESCRIPTOR, WHERE F=3 AND X=63)
40 C>
41 C> REMARKS:
42 C> THIS SUBROUTINE IS THE INVERSE OF BUFR ARCHIVE LIBRARY ROUTINE
43 C> UFBQCP.
44 C>
45 C> THIS ROUTINE CALLS: ADN30 BORT NEMTAB STATUS
46 C> THIS ROUTINE IS CALLED BY: None
47 C> Normally called only by application
48 C> programs.
49 C>
50  SUBROUTINE ufbqcd(LUNIT,NEMO,QCD)
51 
52 
53 
54  CHARACTER*(*) nemo
55  CHARACTER*128 bort_str
56  CHARACTER*6 fxy,adn30
57  CHARACTER*1 tab
58 
59 C-----------------------------------------------------------------------
60 C-----------------------------------------------------------------------
61 
62  CALL status(lunit,lun,il,im)
63  IF(il.EQ.0) goto 900
64 
65  CALL nemtab(lun,nemo,idn,tab,iret)
66  IF(tab.NE.'D') goto 901
67 
68  fxy = adn30(idn,6)
69  IF(fxy(2:3).NE.'63') goto 902
70  READ(fxy(4:6),'(F3.0)',err=903) qcd
71 
72 C EXITS
73 C -----
74 
75  RETURN
76 900 CALL bort('BUFRLIB: UFBQCD - BUFR FILE IS CLOSED, IT MUST BE'//
77  . ' OPEN')
78 901 WRITE(bort_str,'("BUFRLIB: UFBQCD - INPUT MNEMONIC ",A," NOT '//
79  . 'DEFINED AS A SEQUENCE DESCRIPTOR IN BUFR TABLE")') nemo
80  CALL bort(bort_str)
81 902 WRITE(bort_str,'("BUFRLIB: UFBQCD - BUFR TABLE SEQ. DESCRIPTOR '//
82  . 'ASSOC. WITH INPUT MNEMONIC ",A," HAS INVALID CATEGORY ",A," -'//
83  . ' CATEGORY MUST BE 63")') nemo,fxy(2:3)
84  CALL bort(bort_str)
85 903 WRITE(bort_str,'("BUFRLIB: UFBQCD - ERROR READING ENTRY '//
86  . '(PROGRAM CODE) FROM BUFR TBL SEQ. DESCRIPTOR ",A," ASSOC. '//
87  . 'WITH INPUT MNEM. ",A)') fxy,nemo
88  CALL bort(bort_str)
89  END
character *(*) function adn30(IDN, L30)
This function converts an FXY value from its bit-wise (integer) representation to its 5 or 6 characte...
Definition: adn30.f:28
subroutine ufbqcd(LUNIT, NEMO, QCD)
THIS SUBROUTINE READS IN A MNEMONIC KNOWN TO BE IN THE BUFR TABLE ASSOCIATED WITH THE BUFR FILE IN LO...
Definition: ufbqcd.f:50
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
Definition: status.f:55
subroutine nemtab(LUN, NEMO, IDN, TAB, IRET)
This subroutine returns information about a descriptor from the internal DX BUFR tables, based on the mnemonic associated with that descriptor.
Definition: nemtab.f:44
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:22