81 SUBROUTINE ufbtab(LUNIN,TAB,I1,I2,IRET,STR)
90 COMMON /usrstr/ nnod,ncon,nods(20),nodc(10),ivls(10),kons(10)
95 CHARACTER*128 BORT_STR,ERRSTR
98 CHARACTER*8 SUBSET,CVAL
99 equivalence(cval,rval)
100 integer*8 ival,lref,ninc,mps,lps
101 LOGICAL OPENIT,JUST_COUNT
102 real*8 tab(i1,i2),rval,
ups
107 mps(node) = 2_8**(
ibt(node))-1
108 lps(lbit) = max(2_8**(lbit)-1,1)
124 just_count = lunin.LT.lunit
131 CALL status(lunit,lun,il,im)
139 CALL openbf(lunit,
'INX',lunit)
165 DO WHILE(
ireadmg(-lunit,subset,idate).GE.0)
166 iret = iret+
nmsub(lunit)
174 CALL parstr(str,tgs,maxtg,ntg,
' ',.true.)
176 IF(tgs(i).EQ.
'IREC') irec = i
177 IF(tgs(i).EQ.
'ISUB') isub = i
18310
IF(
ireadmg(-lunit,subset,jdate).LT.0)
GOTO 25
185 IF(irec.GT.0) nods(irec) = 0
186 IF(isub.GT.0) nods(isub) = 0
191 if(msgunp(lun)==2)
goto 115
19915
IF(nsub(lun).EQ.msub(lun))
GOTO 10
200 IF(iret+1.GT.i2)
GOTO 99
204 nods(i) = abs(nods(i))
210 if(msgunp(lun)==0) mbit =
mbyt(lun)*8 + 16
211 if(msgunp(lun)==1) mbit =
mbyt(lun)
21620
IF(n+1.LE.nval(lun))
THEN
221 IF(
itp(node).EQ.1)
THEN
222 CALL upb8(ival,nbit,mbit,
mbay(1,lun))
223 nbmp=ival;
CALL usrtpl(lun,n,nbmp)
226 IF(nods(i).EQ.node)
THEN
227 IF(
itp(node).EQ.1)
THEN
228 CALL upb8(ival,nbit,mbit,
mbay(1,lun))
230 ELSEIF(
itp(node).EQ.2)
THEN
231 CALL upb8(ival,nbit,mbit,
mbay(1,lun))
232 IF(ival.LT.mps(node)) tab(i,iret) =
ups(ival,node)
233 ELSEIF(
itp(node).EQ.3)
THEN
236 CALL upc(cval,nbit/8,
mbay(1,lun),kbit,.true.)
244 IF(nods(i).GT.0)
GOTO 20
251 if(msgunp(lun)==0)
then
253 CALL upb(nbyt,16,
mbay(1,lun),ibit)
255 elseif(msgunp(lun)==1)
then
259 nsub(lun) = nsub(lun) + 1
260 IF(irec.GT.0) tab(irec,iret) = nmsg(lun)
261 IF(isub.GT.0) tab(isub,iret) = nsub(lun)
273115
IF(iret+msub(lun).GT.i2)
GOTO 99
278 IF(irec.GT.0.OR.isub.GT.0)
THEN
280 IF(irec.GT.0) tab(irec,iret+nsb) = nmsg(lun)
281 IF(isub.GT.0) tab(isub,iret+nsb) = nsb
298120
DO n=n+1,nval(lun)
308 nods(i) = abs(nods(i))
312 IF(nods(i).GT.0)
GOTO 125
320125
IF(ityp.EQ.1.OR.ityp.EQ.2)
THEN
321 CALL up8(lref,nbit,
mbay(1,lun),ibit)
322 CALL upb(linc, 6,
mbay(1,lun),ibit)
323 nibit = ibit + linc*msub(lun)
324 ELSEIF(ityp.EQ.3)
THEN
326 CALL upc(cref,nbit/8,
mbay(1,lun),ibit,.true.)
327 CALL upb(linc, 6,
mbay(1,lun),ibit)
328 nibit = ibit + 8*linc*msub(lun)
338 CALL up8(ninc,linc,
mbay(1,lun),jbit)
340 CALL usrtpl(lun,n,int(ival))
352 IF(node.NE.nods(i))
GOTO 130
359 IF(ityp.EQ.1.OR.ityp.EQ.2)
THEN
361 jbit = ibit + linc*(nsb-1)
362 CALL up8(ninc,linc,
mbay(1,lun),jbit)
365 IF(ninc.LT.lps(linc)) tab(i,lret) =
ups(ival,node)
367 ELSEIF(ityp.EQ.3)
THEN
372 jbit = ibit + linc*(nsb-1)*8
374 CALL upc(cval,linc,
mbay(1,lun),jbit,.true.)
380 CALL bort(
'UFBTAB - INVALID ELEMENT TYPE SPECIFIED')
394135 iret = iret+msub(lun)
411 DO WHILE(
ireadmg(-lunit,subset,jdate).GE.0)
412 nrep = nrep+
nmsub(lunit)
415 CALL errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
416 WRITE ( unit=errstr, fmt=
'(A,A,I8,A,A)' )
417 .
'BUFRLIB: UFBTAB - THE NO. OF DATA SUBSETS IN THE BUFR FILE ',
418 . .GT.
'IS LIMIT OF ', i2,
' IN THE 4TH ARG. (INPUT) - ',
421 WRITE ( unit=errstr, fmt=
'(A,I8,A,I8,A)' )
422 .
'>>>UFBTAB STORED ', iret,
' REPORTS OUT OF ', nrep,
'<<<'
424 CALL errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
subroutine closbf(LUNIT)
This subroutine closes the connection between logical unit LUNIT and the BUFRLIB software.
subroutine errwrt(STR)
This subroutine allows the user to specify a custom location for the logging of error and diagnostic ...
function ireadmg(LUNIT, SUBSET, IDATE)
This function calls BUFRLIB subroutine readmg() and passes back its return code as the function value...
function ireadsb(LUNIT)
This function calls BUFRLIB subroutine readsb() and passes back its return code as the function value...
This module contains array and variable declarations used to store BUFR messages internally for multi...
integer, dimension(:), allocatable mbyt
Length (in bytes) of current BUFR message for each internal I/O stream.
integer, dimension(:,:), allocatable mbay
Current BUFR message for each internal I/O stream.
This module contains array and variable declarations used to store the internal jump/link table.
integer, dimension(:), allocatable itp
Integer type values corresponding to typ:
integer, dimension(:), allocatable ibt
Bit widths corresponding to tag and typ:
This module declares and initializes the BMISS variable.
real *8, public bmiss
Current placeholder value to represent "missing" data when reading from or writing to BUFR files; thi...
function nmsub(LUNIT)
This function returns the total number of data subsets available within the BUFR message that was mos...
subroutine openbf(LUNIT, IO, LUNDX)
This subroutine connects a new file to the BUFRLIB software for input or output operations.
subroutine parstr(STR, TAGS, MTAG, NTAG, SEP, LIMIT80)
THIS SUBROUTINE PARSES A STRING CONTAINING ONE OR MORE SUBSTRINGS INTO AN ARRAY OF SUBSTRINGS.
subroutine rewnbf(LUNIT, ISR)
THIS SUBROUTINE, DEPENDING ON THE VALUE OF ISR, WILL EITHER: 1) STORE THE CURRENT PARAMETERS ASSOCIAT...
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
subroutine string(STR, LUN, I1, IO)
THIS SUBROUTINE CHECKS TO SEE IF A USER-SPECIFIED CHARACTER STRING IS IN THE STRING CACHE (ARRAYS IN ...
subroutine ufbtab(LUNIN, TAB, I1, I2, IRET, STR)
This subroutine reads through every data subset in a BUFR file and returns one or more specified data...
subroutine up8(nval, nbits, ibay, ibit)
THIS SUBROUTINE UNPACKS AND RETURNS AN 8-BYTE INTEGER CONTAINED WITHIN NBITS BITS OF IBAY,...
subroutine upb8(nval, nbits, ibit, ibay)
THIS SUBROUTINE UNPACKS AND RETURNS AN 8-BYTE INTEGER CONTAINED WITHIN NBITS BITS OF IBAY,...
subroutine upb(NVAL, NBITS, IBAY, IBIT)
THIS SUBROUTINE UNPACKS AND RETURNS A BINARY INTEGER CONTAINED WITHIN NBITS BITS OF IBAY,...
subroutine upc(CHR, NCHR, IBAY, IBIT, CNVNULL)
THIS SUBROUTINE UNPACKS AND RETURNS A CHARACTER STRING OF LENGTH NCHR CONTAINED WITHIN NCHR BYTES OF ...
real *8 function ups(IVAL, NODE)
THIS FUNCTION UNPACKS A REAL*8 USER VALUE FROM A PACKED BUFR INTEGER BY APPLYING THE PROPER SCALE AND...
subroutine usrtpl(LUN, INVN, NBMP)
THIS SUBROUTINE STORES THE SUBSET TEMPLATE INTO INTERNAL SUBSET ARRAYS IN MODULE USRINT FOR CASES OF ...