1 SUBROUTINE GETS1LOC
(S1MNEM
,IBEN
,ISBYT
,IWID
,IRET
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: ATOR ORG: NP12 DATE: 2005-11-29
8 C ABSTRACT: THIS SUBROUTINE RETURNS THE LOCATION (I.E. STARTING BYTE
9 C AND BIT WIDTH) OF A SPECIFIED VALUE WITHIN SECTION 1 OF A BUFR
10 C MESSAGE ENCODED ACCORDING TO A SPECIFIED BUFR EDITION. IT WILL
11 C WORK ON ANY MESSAGE ENCODED USING BUFR EDITION 2, 3 OR 4. THE
12 C VALUE FOR WHICH THE LOCATION IS TO BE DETERMINED IS SPECIFIED VIA
13 C THE MNEMONIC S1MNEM, AS EXPLAINED IN FURTHER DETAIL BELOW.
15 C PROGRAM HISTORY LOG:
16 C 2005-11-29 J. ATOR -- ORIGINAL AUTHOR
17 C 2006-04-14 D. KEYSER -- ADDED OPTIONS FOR 'YCEN' AND 'CENT'
19 C USAGE: GETS1LOC ( S1MNEM, IBEN, ISBYT, IWID, IRET )
20 C INPUT ARGUMENT LIST:
21 C S1MNEM - CHARACTER*(*): MNEMONIC SPECIFYING VALUE WHOSE
22 C LOCATION WITHIN SECTION 1 IS TO BE DETERMINED:
23 C 'LEN1' = LENGTH (IN BYTES) OF SECTION 1
24 C 'BMT' = BUFR MASTER TABLE
25 C 'OGCE' = ORIGINATING CENTER
26 C 'GSES' = ORIGINATING SUBCENTER
27 C (NOTE: THIS VALUE IS PRESENT ONLY IN
28 C BUFR EDITION 3 OR 4 MESSAGES!)
29 C 'USN' = UPDATE SEQUENCE NUMBER
30 C 'ISC2' = FLAG INDICATING ABSENCE/PRESENCE OF
31 C (OPTIONAL) SECTION 2 IN BUFR MESSAGE:
32 C 0 = SECTION 2 ABSENT
33 C 1 = SECTION 2 PRESENT
34 C 'MTYP' = DATA CATEGORY
35 C 'MSBTI' = DATA SUBCATEGORY (INTERNATIONAL)
36 C (NOTE: THIS VALUE IS PRESENT ONLY IN
37 C BUFR EDITION 4 MESSAGES!)
38 C 'MSBT' = DATA SUBCATEGORY (LOCAL)
39 C 'MTV' = VERSION NUMBER OF MASTER TABLE
40 C 'MTVL' = VERSION NUMBER OF LOCAL TABLES
41 C 'YCEN' = YEAR OF CENTURY (1-100)
42 C (NOTE: THIS VALUE IS PRESENT ONLY IN
43 C BUFR EDITION 2 AND 3 MESSAGES!)
44 C 'CENT' = CENTURY (I.E., 20 FOR YEARS 1901-2000,
45 C 21 FOR YEARS 2001-2100)
46 C (NOTE: THIS VALUE *MAY* BE PRESENT IN
47 C BUFR EDITION 2 AND 3 MESSAGES,
48 C BUT IT IS NEVER PRESENT IN ANY
49 C BUFR EDITION 4 MESSAGES!)
50 C 'YEAR' = YEAR (4-DIGIT)
51 C (NOTE: THIS VALUE IS PRESENT ONLY IN
52 C BUFR EDITION 4 MESSAGES!)
58 C (NOTE: THIS VALUE IS PRESENT ONLY IN
59 C BUFR EDITION 4 MESSAGES!)
60 C IBEN - INTEGER: BUFR EDITION NUMBER
63 C OUTPUT ARGUMENT LIST:
64 C ISBYT - INTEGER: NUMBER OF STARTING BYTE WITHIN SECTION 1
65 C WHICH CONTAINS VALUE CORRESPONDING TO S1MNEM
66 C (NOTE: ISBYT IS ALWAYS RETURNED AS 18 WHENEVER
67 C S1MNEM = 'CENT' AND IBEN = 2 OR 3; IN SUCH
68 C CASES IT IS THEN UP TO THE CALLING ROUTINE
69 C TO DETERMINE WHETHER THIS LOCATION ACTUALLY
70 C CONTAINS A VALID CENTURY VALUE!)
71 C IWID - INTEGER: WIDTH (IN BITS) OF VALUE CORRESPONDING
73 C IRET - INTEGER: RETURN CODE
75 C -1 = THE INPUT S1MNEM MNEMONIC IS INVALID FOR
79 C THIS ROUTINE CALLS: None
80 C THIS ROUTINE IS CALLED BY: CRBMG IUPBS01 PKBS1
81 C Normally not called by any application
85 C LANGUAGE: FORTRAN 77
86 C MACHINE: PORTABLE TO ALL PLATFORMS
92 C-----------------------------------------------------------------------
93 C-----------------------------------------------------------------------
98 IF(S1MNEM
.EQ
.'LEN1') THEN
101 ELSE IF(S1MNEM
.EQ
.'BMT') THEN
103 ELSE IF(S1MNEM
.EQ
.'OGCE') THEN
108 C Note that this location is actually the same for both
109 C Edition 2 *and* Edition 4 of BUFR!
114 ELSE IF(S1MNEM
.EQ
.'GSES') THEN
117 ELSE IF(IBEN
.EQ
.4) THEN
123 ELSE IF(S1MNEM
.EQ
.'USN') THEN
129 ELSE IF(S1MNEM
.EQ
.'ISC2') THEN
136 ELSE IF(S1MNEM
.EQ
.'MTYP') THEN
142 ELSE IF(S1MNEM
.EQ
.'MSBTI') THEN
148 ELSE IF(S1MNEM
.EQ
.'MSBT') THEN
154 ELSE IF(S1MNEM
.EQ
.'MTV') THEN
160 ELSE IF(S1MNEM
.EQ
.'MTVL') THEN
166 ELSE IF(S1MNEM
.EQ
.'YEAR') THEN
173 ELSE IF(S1MNEM
.EQ
.'YCEN') THEN
179 ELSE IF(S1MNEM
.EQ
.'CENT') THEN
185 ELSE IF(S1MNEM
.EQ
.'MNTH') THEN
191 ELSE IF(S1MNEM
.EQ
.'DAYS') THEN
197 ELSE IF(S1MNEM
.EQ
.'HOUR') THEN
203 ELSE IF(S1MNEM
.EQ
.'MINU') THEN
209 ELSE IF(S1MNEM
.EQ
.'SECO') THEN