NCEPLIBS-bufr 11.7.1
rtrcptb.f
Go to the documentation of this file.
1C> @file
2C> @brief Read the tank receipt time from Section 1 of a BUFR message.
3
4C> This subroutine reads the tank receipt time (if one exists) from
5C> Section 1 of a BUFR message. It is similar to subroutine rtrcpt(),
6C> except that it operates on a BUFR message passed in via a memory
7C> array, whereas rtrcpt() operates on the BUFR message that was read
8C> into internal arrays via the most recent call to any of the other
9C> [message-reading subroutines](@ref hierarchy) for a specified
10C> Fortran logical unit.
11C>
12C> @author J. Ator
13C> @date 2013-10-07
14C>
15C> @param[in] MBAY -- integer(*): BUFR message
16C> @param[out] IYR -- integer: Tank receipt year
17C> @param[out] IMO -- integer: Tank receipt month
18C> @param[out] IDY -- integer: Tank receipt day
19C> @param[out] IHR -- integer: Tank receipt hour
20C> @param[out] IMI -- integer: Tank receipt minute
21C> @param[out] IRET -- integer: return code
22C> - 0 = normal return
23C> - -1 = no tank receipt time exists within
24C> MBAY
25C>
26C> <b>Program history log:</b>
27C> | Date | Programmer | Comments |
28C> | -----|------------|----------|
29C> | 2013-10-07 | J. Ator | Original author; adapted from rtrcpt() |
30C>
31 SUBROUTINE rtrcptb(MBAY,IYR,IMO,IDY,IHR,IMI,IRET)
32
33 dimension mbay(*)
34
35C-----------------------------------------------------------------------
36C-----------------------------------------------------------------------
37
38 iret = -1
39
40C Check whether the message contains a tank receipt time.
41
42 IF(iupbs01(mbay,'BEN').EQ.4) THEN
43 is1byt = 23
44 ELSE
45 is1byt = 19
46 ENDIF
47 IF( (is1byt+5) .GT. iupbs01(mbay,'LEN1') ) RETURN
48
49C Unpack the tank receipt time.
50
51C Note that IS1BYT is a starting byte number relative to the
52C beginning of Section 1, so we still need to account for
53C Section 0 when specifying the actual byte numbers to unpack
54C within the overall message.
55
56 imgbyt = is1byt + iupbs01(mbay,'LEN0')
57
58 iyr = iupb(mbay,imgbyt,16)
59 imo = iupb(mbay,imgbyt+2,8)
60 idy = iupb(mbay,imgbyt+3,8)
61 ihr = iupb(mbay,imgbyt+4,8)
62 imi = iupb(mbay,imgbyt+5,8)
63
64 iret = 0
65
66 RETURN
67 END
function iupb(MBAY, NBYT, NBIT)
THIS FUNCTION UNPACKS AND RETURNS A BINARY INTEGER WORD CONTAINED WITHIN NBIT BITS OF A BUFR MESSAGE ...
Definition: iupb.f:37
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message.
Definition: iupbs01.f:74
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:32