NCEPLIBS-bufr 11.7.1
ufbrms.f
Go to the documentation of this file.
1C> @file
2C> @brief Read one or more data values from a data subset in
3C> internal arrays.
4
5C> This subroutine provides a handy way to combine the functionality
6C> of subroutines rdmemm(), rdmems() and ufbint() within a single
7C> subroutine call.
8C>
9C> @author J. Woollen
10C> @date 1994-01-06
11C>
12C> @param[in] IMSG -- integer: Number of BUFR message to be
13C> read into scope for further processing,
14C> counting from the beginning of the
15C> internal arrays in memory
16C> @param[in] ISUB -- integer: Number of data subset to be
17C> read from the (IMSG)th BUFR message,
18C> counting from the beginning of the message
19C> @param[out] USR -- real*8(*,*): Data values
20C> @param[in] I1 -- integer: Actual first dimension of USR as
21C> allocated within the calling program
22C> @param[in] I2 -- integer: Actual second dimension of USR as
23C> allocated within the calling program
24C> @param[out] IRET -- integer: Number of replications of STR that were
25C> actually read from the data subset
26C> @param[in] STR -- character*(*): String of blank-separated
27C> Table B mnemonics in one-to-one
28C> correspondence with the number of data
29C> values that will be read from the data
30C> subset within the first dimension of USR (see
31C> [DX BUFR Tables](@ref dfbftab) for further
32C> information about Table B mnemonics)
33C>
34C> <b>Program history log:</b>
35C> | Date | Programmer | Comments |
36C> | -----|------------|----------|
37C> | 1994-01-06 | J. Woollen | Original author |
38C> | 1998-07-08 | J. Woollen | Replaced call to Cray library routine "ABORT" with call to new internal routine bort() |
39C> | 1999-11-18 | J. Woollen | Increased MAXMEM from 4 Mb to 8 Mb |
40C> | 2001-08-15 | D. Keyser | Increased MAXMEM from 8 Mb to 16 Mb |
41C> | 2004-11-15 | D. Keyser | Increased MAXMEM from 16 Mb to 50 Mb |
42C> | 2009-04-21 | J. Ator | Use errwrt() |
43C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
44C>
45 SUBROUTINE ufbrms(IMSG,ISUB,USR,I1,I2,IRET,STR)
46
47 USE moda_msgcwd
48 USE moda_msgmem
49
50 COMMON /quiet / iprt
51
52 CHARACTER*(*) STR
53 CHARACTER*128 BORT_STR,ERRSTR
54 CHARACTER*8 SUBSET
55 real*8 usr(i1,i2)
56
57C-----------------------------------------------------------------------
58C-----------------------------------------------------------------------
59
60 iret = 0
61 IF(i1.LE.0) THEN
62 IF(iprt.GE.0) THEN
63 CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
64 errstr = .LE.'BUFRLIB: UFBRMS - 4th ARG. (INPUT) IS 0, ' //
65 . 'SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
66 CALL errwrt(errstr)
67 CALL errwrt(str)
68 CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
69 CALL errwrt(' ')
70 ENDIF
71 GOTO 100
72 ELSEIF(i2.LE.0) THEN
73 IF(iprt.GE.0) THEN
74 CALL errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
75 errstr = .LE.'BUFRLIB: UFBRMS - 5th 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 ENDIF
84
85C UFBINT SUBSET #ISUB FROM MEMORY MESSAGE #IMSG
86C ---------------------------------------------
87
88 CALL rdmemm(imsg,subset,jdate,iret)
89 IF(iret.LT.0) GOTO 900
90 CALL rdmems(isub,iret)
91 IF(iret.NE.0) GOTO 901
92
93 CALL ufbint(munit,usr,i1,i2,iret,str)
94
95C EXITS
96C -----
97
98100 RETURN
99900 IF(imsg.GT.0) THEN
100 WRITE(bort_str,'("BUFRLIB: UFBRMS - REQUESTED MEMORY MESSAGE '//
101 . 'NUMBER TO READ IN (",I5,") EXCEEDS THE NUMBER OF MESSAGES IN '//
102 . 'MEMORY (",I5,")")') imsg,msgp(0)
103 ELSE
104 WRITE(bort_str,'("BUFRLIB: UFBRMS - REQUESTED MEMORY MESSAGE '//
105 . 'NUMBER TO READ IN IS ZERO - THIS IS NOT VALID")')
106 ENDIF
107 CALL bort(bort_str)
108901 CALL status(munit,lun,il,im)
109 WRITE(bort_str,'("BUFRLIB: UFBRMS - REQ. SUBSET NUMBER TO READ '//
110 . 'IN (",I3,") EXCEEDS THE NUMBER OF SUBSETS (",I3,") IN THE '//
111 . 'REQ. MEMORY MESSAGE (",I5,")")') isub,msub(lun),imsg
112 CALL bort(bort_str)
113 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
Definition: errwrt.f:42
This module contains array and variable declarations used to store the contents of one or more BUFR f...
Definition: moda_msgmem.F:14
integer munit
Fortran logical unit number for use in accessing contents of BUFR files within internal memory.
Definition: moda_msgmem.F:71
integer, dimension(:), allocatable msgp
Pointers to the beginning of each message within msgs (up to a maximum of MAXMSG, and where array ele...
Definition: moda_msgmem.F:79
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:50
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:43
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
Definition: status.f:56
subroutine ufbint(LUNIN, USR, I1, I2, IRET, STR)
This subroutine reads or writes one or more data values from or to the BUFR data subset that is curre...
Definition: ufbint.f:153
subroutine ufbrms(IMSG, ISUB, USR, I1, I2, IRET, STR)
This subroutine provides a handy way to combine the functionality of subroutines rdmemm(),...
Definition: ufbrms.f:46