NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
elemdx.f
Go to the documentation of this file.
1 C> @file
2 C> @author WOOLLEN @date 1994-01-06
3 
4 C> THIS SUBROUTINE DECODES THE SCALE FACTOR, REFERENCE VALUE,
5 C> BIT WIDTH AND UNITS (I.E., THE "ELEMENTS") FROM A TABLE B MNEMONIC
6 C> DEFINITION CARD THAT WAS PREVIOUSLY READ FROM A USER-SUPPLIED BUFR
7 C> DICTIONARY TABLE FILE IN CHARACTER FORMAT BY BUFR ARCHIVE LIBRARY
8 C> SUBROUTINE RDUSDX. THESE DECODED VALUES ARE THEN ADDED TO THE
9 C> ALREADY-EXISTING ENTRY FOR THAT MNEMONIC WITHIN THE INTERNAL BUFR
10 C> TABLE B ARRAY TABB(*,LUN) IN MODULE TABABD.
11 C>
12 C> PROGRAM HISTORY LOG:
13 C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
14 C> 1995-06-28 J. WOOLLEN -- INCREASED THE SIZE OF INTERNAL BUFR TABLE
15 C> ARRAYS IN ORDER TO HANDLE BIGGER FILES
16 C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
17 C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
18 C> ROUTINE "BORT"
19 C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
20 C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
21 C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
22 C> BUFR FILES UNDER THE MPI)
23 C> 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
24 C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
25 C> INTERDEPENDENCIES
26 C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED HISTORY
27 C> DOCUMENTATION; OUTPUTS MORE COMPLETE
28 C> DIAGNOSTIC INFO WHEN ROUTINE TERMINATES
29 C> ABNORMALLY; CHANGED CALL FROM BORT TO BORT2
30 C> 2007-01-19 J. ATOR -- ADDED EXTRA ARGUMENT FOR CALL TO JSTCHR
31 C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
32 C>
33 C> USAGE: CALL ELEMDX (CARD, LUN)
34 C> INPUT ARGUMENT LIST:
35 C> CARD - CHARACTER*80: MNEMONIC DEFINITION CARD THAT WAS READ
36 C> FROM A USER-SUPPLIED BUFR DICTIONARY TABLE
37 C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
38 C>
39 C> REMARKS:
40 C> THIS ROUTINE CALLS: BORT2 CAPIT JSTCHR JSTNUM
41 C> NEMTAB
42 C> THIS ROUTINE IS CALLED BY: RDUSDX STSEQ
43 C> Normally not called by any application
44 C> programs.
45 C>
46  SUBROUTINE elemdx(CARD,LUN)
47 
48  USE moda_tababd
49 
50  CHARACTER*128 bort_str1,bort_str2
51  CHARACTER*80 card
52  CHARACTER*24 unit
53  CHARACTER*11 refr,refr_orig
54  CHARACTER*8 nemo
55  CHARACTER*4 scal,scal_orig
56  CHARACTER*3 bitw,bitw_orig
57  CHARACTER*1 sign,tab
58 
59 C-----------------------------------------------------------------------
60 C-----------------------------------------------------------------------
61 
62 C CAPTURE THE VARIOUS ELEMENTS CHARACTERISTICS
63 C --------------------------------------------
64 
65  nemo = card( 3:10)
66  scal = card(14:17)
67  refr = card(21:31)
68  bitw = card(35:37)
69  unit = card(41:64)
70 c .... Make sure the units are all capitalized
71  CALL capit(unit)
72 
73 C FIND THE ELEMENT TAG IN TABLE B
74 C -------------------------------
75 
76 C Note that an entry for this mnemonic should already exist within
77 C the internal BUFR Table B array TABB(*,LUN). We now need to
78 C retrieve the positional index for that entry within TABB(*,LUN)
79 C so that we can access the entry and then add the scale factor,
80 C reference value, bit width, and units to it.
81 
82  CALL nemtab(lun,nemo,idsn,tab,iele)
83  IF(tab.NE.'B') goto 900
84 
85 C LEFT JUSTIFY AND STORE CHARACTERISTICS
86 C --------------------------------------
87 
88  CALL jstchr(unit,iret)
89  IF(iret.NE.0) goto 904
90  tabb(iele,lun)(71:94) = unit
91 
92  scal_orig=scal
93  CALL jstnum(scal,sign,iret)
94  IF(iret.NE.0) goto 901
95  tabb(iele,lun)(95:95) = sign
96  tabb(iele,lun)(96:98) = scal
97 
98  refr_orig=refr
99  CALL jstnum(refr,sign,iret)
100  IF(iret.NE.0) goto 902
101  tabb(iele,lun)( 99: 99) = sign
102  tabb(iele,lun)(100:109) = refr
103 
104  bitw_orig=bitw
105  CALL jstnum(bitw,sign,iret)
106  IF(iret.NE.0 ) goto 903
107  IF(sign.EQ.'-') goto 903
108  tabb(iele,lun)(110:112) = bitw
109 
110 C EXITS
111 C -----
112 
113  RETURN
114 900 WRITE(bort_str1,'("BUFRLIB: ELEMDX - CARD READ IN IS: ",A)') card
115  WRITE(bort_str2,'(18X,"MNEMONIC ",A," IS NOT A TABLE B ENTRY '//
116  . '(UNDEFINED, TAB=",A,")")') nemo,tab
117  CALL bort2(bort_str1,bort_str2)
118 901 WRITE(bort_str1,'("BUFRLIB: ELEMDX - CARD READ IN IS: ",A)') card
119  WRITE(bort_str2,'(18X,"PARSED SCALE VALUE (=",A,") IS NOT '//
120  . 'NUMERIC")') scal_orig
121  CALL bort2(bort_str1,bort_str2)
122 902 WRITE(bort_str1,'("BUFRLIB: ELEMDX - CARD READ IN IS: ",A)') card
123  WRITE(bort_str2,'(18X,"PARSED REFERENCE VALUE (=",A,") IS NOT '//
124  . 'NUMERIC")') refr_orig
125  CALL bort2(bort_str1,bort_str2)
126 903 WRITE(bort_str1,'("BUFRLIB: ELEMDX - CARD READ IN IS: ",A)') card
127  WRITE(bort_str2,'(18X,"PARSED BIT WIDTH VALUE (=",A,") IS NOT '//
128  . 'NUMERIC")') bitw_orig
129  CALL bort2(bort_str1,bort_str2)
130 904 WRITE(bort_str1,'("BUFRLIB: ELEMDX - CARD READ IN IS: ",A)') card
131  WRITE(bort_str2,'(18X,"UNITS FIELD IS EMPTY")')
132  CALL bort2(bort_str1,bort_str2)
133  END
subroutine jstnum(STR, SIGN, IRET)
THIS SUBROUTINE REMOVES ALL LEADING BLANKS FROM A CHARACTER STRING CONTAINING AN ENCODED INTEGER VALU...
Definition: jstnum.f:49
subroutine bort2(STR1, STR2)
This subroutine calls subroutine errwrt() to log two error messages, then calls subroutine bort_exit(...
Definition: bort2.f:20
This module contains array and variable declarations used to store DX BUFR tables internally for mult...
Definition: moda_tababd.F:10
subroutine jstchr(STR, IRET)
THIS SUBROUTINE LEFT-JUSTIFIES (I.E.
Definition: jstchr.f:43
subroutine nemtab(LUN, NEMO, IDN, TAB, IRET)
THIS SUBROUTINE SEARCHES FOR MNEMONIC NEMO WITHIN THE INTERNAL TABLE B AND D ARRAYS HOLDING THE DICTI...
Definition: nemtab.f:66
subroutine elemdx(CARD, LUN)
THIS SUBROUTINE DECODES THE SCALE FACTOR, REFERENCE VALUE, BIT WIDTH AND UNITS (I.E., THE "ELEMENTS") FROM A TABLE B MNEMONIC DEFINITION CARD THAT WAS PREVIOUSLY READ FROM A USER-SUPPLIED BUFR DICTIONARY TABLE FILE IN CHARACTER FORMAT BY BUFR ARCHIVE LIBRARY SUBROUTINE RDUSDX.
Definition: elemdx.f:46
subroutine capit(STR)
THIS SUBROUTINE CAPITALIZES A STRING OF CHARACTERS.
Definition: capit.f:39