NCEPLIBS-bufr  12.0.1
rtrcptb.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read the tank receipt time from Section 1 of a BUFR message.
3 C>
4 C> @author J. Ator @date 2013-10-07
5 
6 C> This subroutine reads the tank receipt time (if one exists) from
7 C> Section 1 of a BUFR message. It is similar to subroutine rtrcpt(),
8 C> except that it operates on a BUFR message passed in via a memory
9 C> array, whereas rtrcpt() operates on the BUFR message that was read
10 C> into internal arrays via the most recent call to any of the other
11 C> [message-reading subroutines](@ref hierarchy) for a specified
12 C> Fortran logical unit.
13 C>
14 C> @param[in] MBAY -- integer(*): BUFR message.
15 C> @param[out] IYR -- integer: Tank receipt year.
16 C> @param[out] IMO -- integer: Tank receipt month.
17 C> @param[out] IDY -- integer: Tank receipt day.
18 C> @param[out] IHR -- integer: Tank receipt hour.
19 C> @param[out] IMI -- integer: Tank receipt minute.
20 C> @param[out] IRET -- integer: return code:
21 C> - 0 = normal return.
22 C> - -1 = no tank receipt time exists within MBAY.
23 C>
24 C> @author J. Ator @date 2013-10-07
25  RECURSIVE SUBROUTINE rtrcptb(MBAY,IYR,IMO,IDY,IHR,IMI,IRET)
26 
27  USE modv_im8b
28 
29  dimension mbay(*)
30 
31 C-----------------------------------------------------------------------
32 C-----------------------------------------------------------------------
33 
34 C Check for I8 integers.
35 
36  IF(im8b) THEN
37  im8b=.false.
38 
39  CALL rtrcptb(mbay,iyr,imo,idy,ihr,imi,iret)
40  CALL x48(iyr,iyr,1)
41  CALL x48(imo,imo,1)
42  CALL x48(idy,idy,1)
43  CALL x48(ihr,ihr,1)
44  CALL x48(imi,imi,1)
45  CALL x48(iret,iret,1)
46 
47  im8b=.true.
48  RETURN
49  ENDIF
50 
51  iret = -1
52 
53 C Check whether the message contains a tank receipt time.
54 
55  IF(iupbs01(mbay,'BEN').EQ.4) THEN
56  is1byt = 23
57  ELSE
58  is1byt = 19
59  ENDIF
60  IF( (is1byt+5) .GT. iupbs01(mbay,'LEN1') ) RETURN
61 
62 C Unpack the tank receipt time.
63 
64 C Note that IS1BYT is a starting byte number relative to the
65 C beginning of Section 1, so we still need to account for
66 C Section 0 when specifying the actual byte numbers to unpack
67 C within the overall message.
68 
69  imgbyt = is1byt + iupbs01(mbay,'LEN0')
70 
71  iyr = iupb(mbay,imgbyt,16)
72  imo = iupb(mbay,imgbyt+2,8)
73  idy = iupb(mbay,imgbyt+3,8)
74  ihr = iupb(mbay,imgbyt+4,8)
75  imi = iupb(mbay,imgbyt+5,8)
76 
77  iret = 0
78 
79  RETURN
80  END
recursive function iupb(MBAY, NBYT, NBIT)
Decode an integer value from an integer array.
Definition: iupb.f:21
recursive function iupbs01(MBAY, S01MNEM)
Read a data value from Section 0 or Section 1 of a BUFR message.
Definition: iupbs01.f:69
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 ...
recursive subroutine rtrcptb(MBAY, IYR, IMO, IDY, IHR, IMI, IRET)
This subroutine reads the tank receipt time (if one exists) from Section 1 of a BUFR message.
Definition: rtrcptb.f:26
subroutine x48(IIN4, IOUT8, NVAL)
Encode one or more 4-byte integer values as 8-byte integer values.
Definition: x48.F:19