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