NCEPLIBS-bufr  11.6.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> | Date | Programmer | Comments |
28 C> | -----|------------|----------|
29 C> | 2013-10-07 | J. Ator | Original author; adapted from rtrcpt() |
30 C>
31  SUBROUTINE rtrcptb(MBAY,IYR,IMO,IDY,IHR,IMI,IRET)
32 
33  dimension mbay(*)
34 
35 C-----------------------------------------------------------------------
36 C-----------------------------------------------------------------------
37 
38  iret = -1
39 
40 C 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 
49 C Unpack the tank receipt time.
50 
51 C Note that IS1BYT is a starting byte number relative to the
52 C beginning of Section 1, so we still need to account for
53 C Section 0 when specifying the actual byte numbers to unpack
54 C 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: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:31
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message...
Definition: iupbs01.f:73