NCEPLIBS-bufr  12.0.1
ufbmms.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read a specified data subset from internal arrays.
3 C>
4 C> @author J. Woollen @date 1994-01-06
5 
6 C> Read a specified data subset from internal arrays.
7 C>
8 C> This subroutine provides a handy way to combine the functionality
9 C> of subroutines rdmemm() and rdmems() within a single subroutine
10 C> call.
11 C>
12 C> Whenever this subroutine returns successfully, the requested data
13 C> subset can now be easily manipulated or further parsed via calls to
14 C> any of the [values-reading subroutines](@ref hierarchy) using the
15 C> Fortran logical unit number IUNIT that was returned from the most
16 C> recent call to subroutine ufbmem().
17 C>
18 C> @param[in] IMSG - integer: Number of BUFR message to be
19 C> read into scope for further processing, counting from the beginning of the
20 C> internal arrays in memory.
21 C> @param[in] ISUB - integer: Number of data subset to be
22 C> read from the (IMSG)th BUFR message, counting from the beginning of the message.
23 C> @param[out] SUBSET - character*8: Table A mnemonic for type of
24 C> (IMSG)th BUFR message (see [DX BUFR Tables](@ref dfbftab) for
25 C> further information about Table A mnemonics).
26 C> @param[out] JDATE - integer: Date-time stored within Section 1 of
27 C> (IMSG)th BUFR message, in format of either YYMMDDHH or YYYYMMDDHH, depending
28 C> on the most recent call to subroutine datelen().
29 C>
30 C> @author J. Woollen @date 1994-01-06
31  RECURSIVE SUBROUTINE ufbmms(IMSG,ISUB,SUBSET,JDATE)
32 
33  USE modv_im8b
34 
35  USE moda_msgcwd
36  USE moda_msgmem
37 
38  CHARACTER*128 bort_str
39  CHARACTER*8 subset
40 
41 C-----------------------------------------------------------------------
42 C-----------------------------------------------------------------------
43 
44 C CHECK FOR I8 INTEGERS
45 C ---------------------
46 
47  IF(im8b) THEN
48  im8b=.false.
49 
50  CALL x84(imsg,my_imsg,1)
51  CALL x84(isub,my_isub,1)
52  CALL ufbmms(my_imsg,my_isub,subset,jdate)
53  CALL x48(jdate,jdate,1)
54 
55  im8b=.true.
56  RETURN
57  ENDIF
58 
59 C READ SUBSET #ISUB FROM MEMORY MESSAGE #IMSG
60 C -------------------------------------------
61 
62  CALL rdmemm(imsg,subset,jdate,iret)
63  IF(iret.LT.0) GOTO 900
64  CALL rdmems(isub,iret)
65  IF(iret.NE.0) GOTO 901
66 
67 C EXITS
68 C -----
69 
70  RETURN
71 900 IF(imsg.GT.0) THEN
72  WRITE(bort_str,'("BUFRLIB: UFBMMS - REQUESTED MEMORY MESSAGE '//
73  . 'NUMBER TO READ IN (",I5,") EXCEEDS THE NUMBER OF MESSAGES IN '//
74  . 'MEMORY (",I5,")")') imsg,msgp(0)
75  ELSE
76  WRITE(bort_str,'("BUFRLIB: UFBMMS - REQUESTED MEMORY MESSAGE '//
77  . 'NUMBER TO READ IN IS ZERO - THIS IS NOT VALID")')
78  ENDIF
79  CALL bort(bort_str)
80 901 CALL status(munit,lun,il,im)
81  WRITE(bort_str,'("BUFRLIB: UFBMMS - REQ. SUBSET NUMBER TO READ '//
82  . 'IN (",I3,") EXCEEDS THE NUMBER OF SUBSETS (",I3,") IN THE '//
83  . 'REG. MEMORY MESSAGE (",I5,")")') isub,msub(lun),imsg
84  CALL bort(bort_str)
85  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
This module contains declarations for arrays used to store information about the current BUFR message...
integer, dimension(:), allocatable msub
Total number of data subsets in message.
This module contains array and variable declarations used to store the contents of one or more BUFR f...
integer, dimension(:), allocatable msgp
Pointers to the beginning of each message within msgs (up to a maximum of MAXMSG, and where array ele...
integer munit
Fortran logical unit number for use in accessing contents of BUFR files within internal memory.
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 rdmemm(IMSG, SUBSET, JDATE, IRET)
This subroutine reads a specified BUFR message from internal arrays in memory, so that it is now in s...
Definition: rdmemm.f:40
recursive subroutine rdmems(ISUB, IRET)
This subroutine reads a specified data subset from the BUFR message that was most recently read via a...
Definition: rdmems.f:26
recursive subroutine status(LUNIT, LUN, IL, IM)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
Definition: status.f:36
recursive subroutine ufbmms(IMSG, ISUB, SUBSET, JDATE)
Read a specified data subset from internal arrays.
Definition: ufbmms.f:32
subroutine x48(IIN4, IOUT8, NVAL)
Encode one or more 4-byte integer values as 8-byte integer values.
Definition: x48.F:19
subroutine x84(IIN8, IOUT4, NVAL)
Encode one or more 8-byte integer values as 4-byte integer values.
Definition: x84.F:19