NCEPLIBS-bufr  12.0.0
ufbqcd.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Get the event program code associated with a Table D mnemonic
3 C> from an NCEP prepbufr file
4 C>
5 C> @author J. Woollen @date 1994-01-06
6 
7 C> Given a mnemonic associated with a category 63 Table D
8 C> descriptor from an NCEP prepbufr file, this subroutine returns the
9 C> corresponding event program code.
10 C>
11 C> The event program code is equivalent to the Y value of the
12 C> category 63 (i.e. X=63) Table D descriptor. Knowledge of this value
13 C> is especially useful for application programs which are writing data
14 C> events to NCEP prepbufr files.
15 C>
16 C> Logical unit LUNIT should have already been opened via a previous
17 C> call to subroutine openbf().
18 C>
19 C> This subroutine is the logical inverse of subroutine ufbqcp().
20 C>
21 C> @param[in] LUNIT -- integer: Fortran logical unit number for
22 C> NCEP prepbufr file
23 C> @param[in] NEMO -- character*(*): Mnemonic associated with a
24 C> category 63 (i.e. X=63) Table D descriptor
25 C> @param[out] IQCD -- integer: Y value of descriptor associated
26 C> with NEMO
27 C>
28 C> @author J. Woollen @date 1994-01-06
29  RECURSIVE SUBROUTINE ufbqcd(LUNIT,NEMO,IQCD)
30 
31  USE modv_im8b
32 
33  CHARACTER*(*) nemo
34  CHARACTER*128 bort_str
35  CHARACTER*6 fxy,adn30
36  CHARACTER*1 tab
37 
38 C-----------------------------------------------------------------------
39 C-----------------------------------------------------------------------
40 
41 C CHECK FOR I8 INTEGERS
42 C ---------------------
43 
44  IF(im8b) THEN
45  im8b=.false.
46 
47  CALL x84(lunit,my_lunit,1)
48  CALL ufbqcd(my_lunit,nemo,iqcd)
49  CALL x48(iqcd,iqcd,1)
50 
51  im8b=.true.
52  RETURN
53  ENDIF
54 
55  CALL status(lunit,lun,il,im)
56  IF(il.EQ.0) GOTO 900
57 
58  CALL nemtab(lun,nemo,idn,tab,iret)
59  IF(tab.NE.'D') GOTO 901
60 
61  fxy = adn30(idn,6)
62  IF(fxy(2:3).NE.'63') GOTO 902
63  READ(fxy(4:6),'(I3)',err=903) iqcd
64 
65 C EXITS
66 C -----
67 
68  RETURN
69 900 CALL bort('BUFRLIB: UFBQCD - BUFR FILE IS CLOSED, IT MUST BE'//
70  . ' OPEN')
71 901 WRITE(bort_str,'("BUFRLIB: UFBQCD - INPUT MNEMONIC ",A," NOT '//
72  . 'DEFINED AS A SEQUENCE DESCRIPTOR IN BUFR TABLE")') nemo
73  CALL bort(bort_str)
74 902 WRITE(bort_str,'("BUFRLIB: UFBQCD - BUFR TABLE SEQ. DESCRIPTOR '//
75  . 'ASSOC. WITH INPUT MNEMONIC ",A," HAS INVALID CATEGORY ",A," -'//
76  . ' CATEGORY MUST BE 63")') nemo,fxy(2:3)
77  CALL bort(bort_str)
78 903 WRITE(bort_str,'("BUFRLIB: UFBQCD - ERROR READING ENTRY '//
79  . '(PROGRAM CODE) FROM BUFR TBL SEQ. DESCRIPTOR ",A," ASSOC. '//
80  . 'WITH INPUT MNEM. ",A)') fxy,nemo
81  CALL bort(bort_str)
82  END
character *(*) function adn30(IDN, L30)
Convert a WMO bit-wise representation of an FXY value to a character string of length 5 or 6.
Definition: adn30.f:23
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
This module declares and initializes the IM8B variable.
logical, public im8b
Status indicator to keep track of whether all future calls to BUFRLIB subroutines and functions from ...
subroutine nemtab(LUN, NEMO, IDN, TAB, IRET)
Get information about a descriptor, based on the mnemonic.
Definition: nemtab.f:29
recursive subroutine status(LUNIT, LUN, IL, IM)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
Definition: status.f:36
recursive subroutine ufbqcd(LUNIT, NEMO, IQCD)
Given a mnemonic associated with a category 63 Table D descriptor from an NCEP prepbufr file,...
Definition: ufbqcd.f:30
subroutine x48(IIN4, IOUT8, NVAL)
Encode one or more 4-byte integer values as 8-byte integer values.
Definition: x48.F:19
subroutine x84(IIN8, IOUT4, NVAL)
Encode one or more 8-byte integer values as 4-byte integer values.
Definition: x84.F:19