NCEPLIBS-bufr  12.0.1
ufbrms.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read one or more data values from a data subset in
3 C> internal arrays.
4 C>
5 C> @author J. Woollen @date 1994-01-06
6 
7 C> Read one or more data values from a data subset in
8 C> internal arrays.
9 C>
10 C> This subroutine provides a handy way to combine the functionality
11 C> of subroutines rdmemm(), rdmems() and ufbint() within a single
12 C> subroutine call.
13 C>
14 C> @param[in] IMSG -- integer: Number of BUFR message to be
15 C> read into scope for further processing,
16 C> counting from the beginning of the
17 C> internal arrays in memory
18 C> @param[in] ISUB -- integer: Number of data subset to be
19 C> read from the (IMSG)th BUFR message,
20 C> counting from the beginning of the message
21 C> @param[out] USR -- real*8(*,*): Data values
22 C> @param[in] I1 -- integer: First dimension of USR as
23 C> allocated within the calling program
24 C> @param[in] I2 -- integer: Second dimension of USR as
25 C> allocated within the calling program
26 C> @param[out] IRET -- integer: Number of replications of STR that were
27 C> read from the data subset
28 C> @param[in] STR -- character*(*): String of blank-separated
29 C> Table B mnemonics in one-to-one
30 C> correspondence with the number of data
31 C> values that will be read from the data
32 C> subset within the first dimension of USR (see
33 C> [DX BUFR Tables](@ref dfbftab) for further
34 C> information about Table B mnemonics)
35 C>
36 C> @author J. Woollen @date 1994-01-06
37  RECURSIVE SUBROUTINE ufbrms(IMSG,ISUB,USR,I1,I2,IRET,STR)
38 
39  USE modv_im8b
40 
41  USE moda_msgcwd
42  USE moda_msgmem
43 
44  COMMON /quiet / iprt
45 
46  CHARACTER*(*) str
47  CHARACTER*128 bort_str,errstr
48  CHARACTER*8 subset
49  real*8 usr(i1,i2)
50 
51 C-----------------------------------------------------------------------
52 C-----------------------------------------------------------------------
53 
54 C CHECK FOR I8 INTEGERS
55 C ---------------------
56 
57  IF(im8b) THEN
58  im8b=.false.
59 
60  CALL x84(imsg,my_imsg,1)
61  CALL x84(isub,my_isub,1)
62  CALL x84(i1,my_i1,1)
63  CALL x84(i2,my_i2,1)
64  CALL ufbrms(my_imsg,my_isub,usr,my_i1,my_i2,iret,str)
65  CALL x48(iret,iret,1)
66 
67  im8b=.true.
68  RETURN
69  ENDIF
70 
71  iret = 0
72  IF(i1.LE.0) THEN
73  IF(iprt.GE.0) THEN
74  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
75  errstr = .LE.'BUFRLIB: UFBRMS - 4th ARG. (INPUT) IS 0, ' //
76  . 'SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
77  CALL errwrt(errstr)
78  CALL errwrt(str)
79  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
80  CALL errwrt(' ')
81  ENDIF
82  GOTO 100
83  ELSEIF(i2.LE.0) THEN
84  IF(iprt.GE.0) THEN
85  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
86  errstr = .LE.'BUFRLIB: UFBRMS - 5th ARG. (INPUT) IS 0, ' //
87  . 'SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
88  CALL errwrt(errstr)
89  CALL errwrt(str)
90  CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
91  CALL errwrt(' ')
92  ENDIF
93  GOTO 100
94  ENDIF
95 
96 C UFBINT SUBSET #ISUB FROM MEMORY MESSAGE #IMSG
97 C ---------------------------------------------
98 
99  CALL rdmemm(imsg,subset,jdate,iret)
100  IF(iret.LT.0) GOTO 900
101  CALL rdmems(isub,iret)
102  IF(iret.NE.0) GOTO 901
103 
104  CALL ufbint(munit,usr,i1,i2,iret,str)
105 
106 C EXITS
107 C -----
108 
109 100 RETURN
110 900 IF(imsg.GT.0) THEN
111  WRITE(bort_str,'("BUFRLIB: UFBRMS - REQUESTED MEMORY MESSAGE '//
112  . 'NUMBER TO READ IN (",I5,") EXCEEDS THE NUMBER OF MESSAGES IN '//
113  . 'MEMORY (",I5,")")') imsg,msgp(0)
114  ELSE
115  WRITE(bort_str,'("BUFRLIB: UFBRMS - REQUESTED MEMORY MESSAGE '//
116  . 'NUMBER TO READ IN IS ZERO - THIS IS NOT VALID")')
117  ENDIF
118  CALL bort(bort_str)
119 901 CALL status(munit,lun,il,im)
120  WRITE(bort_str,'("BUFRLIB: UFBRMS - REQ. SUBSET NUMBER TO READ '//
121  . 'IN (",I3,") EXCEEDS THE NUMBER OF SUBSETS (",I3,") IN THE '//
122  . 'REQ. MEMORY MESSAGE (",I5,")")') isub,msub(lun),imsg
123  CALL bort(bort_str)
124  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
subroutine errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
Definition: errwrt.f:36
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 ufbint(LUNIN, USR, I1, I2, IRET, STR)
Read/write one or more data values from/to a data subset.
Definition: ufbint.f:121
recursive subroutine ufbrms(IMSG, ISUB, USR, I1, I2, IRET, STR)
Read one or more data values from a data subset in internal arrays.
Definition: ufbrms.f:38
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