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