45 character,
intent(in) :: cf
46 character*128 bort_str
59 if(my_cf /=
'Y' .and. my_cf /=
'N')
then
60 write(bort_str,
'("BUFRLIB: STDMSG - INPUT ARGUMENT IS ",A1,", IT MUST BE EITHER Y, y, N OR n")') cf
86 recursive subroutine stndrd(lunit,msgin,lmsgot,msgot)
90 use modv_vars,
only: im8b, nbytw, nby5, bmcstr
96 integer,
intent(in) :: msgin(*), lunit, lmsgot
97 integer,
intent(out) :: msgot(*)
98 integer my_lunit, my_lmsgot, lun, il, im, len0, len1, len2, len3, len4, len5
99 integer iad3, iad4, lenn, lenm,
iupbs01,
iupbs3,
iupb, mxbyto, lbyto, ii, isub, itab, mtyp, msbt, inod
100 integer istdesc, ncd, iben, ibit, jbit, kbit, mbit, nad4, lsub, nsub, islen, kval, nval, i, k, l, n,
bort_target_set
102 character*128 bort_str
106 character*(*),
parameter :: bort_arrayoverflow = &
107 'BUFRLIB: STNDRD - OVERFLOW OF OUTPUT (STANDARD) MESSAGE ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY'
115 call x84(lunit,my_lunit,1)
116 call x84(lmsgot,my_lmsgot,1)
117 call stndrd(my_lunit,msgin,my_lmsgot*2,msgot)
132 call status(lunit,lun,il,im)
133 if(il==0)
call bort(
'BUFRLIB: STNDRD - BUFR FILE IS CLOSED, IT MUST BE OPEN')
137 call getlens(msgin,5,len0,len1,len2,len3,len4,len5)
139 iad3 = len0+len1+len2
142 lenn = len0+len1+len2+len3+len4+len5
147 write(bort_str,
'("BUFRLIB: STNDRD - INPUT MESSAGE LENGTH FROM SECTION 0",I6," DOES NOT EQUAL SUM OF ALL INDIVIDUAL '// &
148 'SECTION LENGTHS (",I6,")")') lenm,lenn
153 call upc(s5str,nby5,msgin,mbit,.true.)
154 if(s5str/=bmcstr)
then
155 write(bort_str,
'("BUFRLIB: STNDRD - INPUT MESSAGE DOES NOT END WITH ""7777"" (ENDS WITH ",A)') s5str
161 mxbyto = (lmsgot*nbytw) - 8
164 if(lbyto>mxbyto)
call bort(bort_arrayoverflow)
165 call mvb(msgin,1,msgot,1,lbyto)
171 do while ((.not.found).and.(ii>=8))
172 isub =
iupb(msgin,iad3+ii,16)
173 call numtab(lun,isub,subset,tab,itab)
174 if((itab/=0).and.(tab==
'D'))
then
175 call nemtbax(lun,subset,mtyp,msbt,inod)
176 if(inod/=0) found = .true.
180 if(.not.found)
call bort(
'BUFRLIB: STNDRD - TABLE A SUBSET DESCRIPTOR NOT FOUND')
198 lbyto = lbyto + len3 - 7
199 if(lbyto>mxbyto)
call bort(bort_arrayoverflow)
205 call pkb(
ids3(n),16,msgot,ibit)
211 call pkb(0,8,msgot,ibit)
217 call pkb(len3,24,msgot,ibit)
221 if(
iupbs3(msgin,
'ICMP')==1)
then
225 if((lbyto+len4+4)>mxbyto)
call bort(bort_arrayoverflow)
227 call mvb(msgin,iad4+1,msgot,lbyto+1,len4)
228 jbit = (lbyto+len4)*8
241 nsub =
iupbs3(msgin,
'NSUB')
243 subset_copy:
do i=1,nsub
244 call upb(lsub,16,msgin,ibit)
251 islen = iad4+len4-(ibit/8)
254 call upb(nval,8,msgin,ibit)
256 if(lbyto>mxbyto)
call bort(bort_arrayoverflow)
257 call pkb(nval,8,msgot,jbit)
261 call upb(kval,8,msgin,kbit)
267 call bort(
'BUFRLIB: STNDRD - BIT MISMATCH COPYING SECTION 4 FROM INPUT TO OUTPUT (STANDARD) MESSAGE')
274 if(lbyto+6>mxbyto)
call bort(bort_arrayoverflow)
278 do while(.not.(mod(jbit,8)==0))
279 call pkb(0,1,msgot,jbit)
285 if( (iben<4) .and. (mod(jbit/8,2)/=0) )
then
286 call pkb(0,8,msgot,jbit)
291 call pkb(len4,24,msgot,ibit)
292 call pkb(0,8,msgot,ibit)
298 lenn = len0+len1+len2+len3+len4+len5
299 call pkb(lenn,24,msgot,ibit)
301 call pkc(bmcstr,nby5,msgot,jbit)
316 integer function istdesc( idn )
result( iret )
320 integer,
intent(in) :: idn
323 character*6 adsc,
adn30
325 adsc =
adn30( idn, 6 )
327 read(adsc,
'(I1,I2,I3)')
if,ix,iy
331 else if (
if == 2 )
then
334 else if ( ( ix < 48 ) .and. ( iy < 192 ) )
then
recursive subroutine bort(str)
Log an error message, then either return to or abort the application program.
subroutine bort_target_unset
Clear any existing bort target.
integer function bort_target_set()
Sets a new bort target, if bort catching is enabled and such a target doesn't already exist.
subroutine upb(nval, nbits, ibay, ibit)
Decode an integer value from within a specified number of bits of an integer array,...
recursive integer function iupb(mbay, nbyt, nbit)
Decode an integer value from within a specified number of bits of an integer array,...
subroutine upc(chr, nchr, ibay, ibit, cnvnull)
Decode a character string from within a specified number of bytes of an integer array,...
subroutine pkc(chr, nchr, ibay, ibit)
Encode a character string within a specified number of bytes of an integer array, starting at the bit...
subroutine pkb(nval, nbits, ibay, ibit)
Encode an integer value within a specified number of bits of an integer array, starting at the bit im...
subroutine mvb(ib1, nb1, ib2, nb2, nbm)
Copy a specified number of bytes from one packed binary array to another.
subroutine nemtbax(lun, nemo, mtyp, msbt, inod)
Get information about a Table A descriptor from the internal DX BUFR tables.
subroutine numtab(lun, idn, nemo, tab, iret)
Get information about a descriptor, based on the WMO bit-wise representation of an FXY value.
character *(*) function adn30(idn, ldn)
Convert an FXY value from its WMO bit-wise representation to a character string of length 5 or 6.
integer function iokoper(nemo)
Check whether a specified mnemonic is a Table C operator supported by the NCEPLIBS-bufr software.
subroutine capit(str)
Capitalize all of the alphabetic characters in a string.
Wrap C NCEPLIBS-bufr functions so they can be called from within the Fortran part of the library.
Declare a variable used to indicate whether output BUFR messages should be standardized.
character csmf
Flag indicating whether BUFR output messages are to be standardized; this variable is initialized to ...
Declare arrays used by various subroutines and functions to hold a temporary working copy of a Sectio...
integer, dimension(:), allocatable ids3
Temporary working copy of Section 3 descriptor list in integer form.
recursive subroutine status(lunit, lun, il, im)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
recursive subroutine getlens(mbay, ll, len0, len1, len2, len3, len4, len5)
Read the section lengths of a BUFR message, up to a specified point in the message.
recursive integer function iupbs01(mbay, s01mnem)
Read a specified value from within Section 0 or Section 1 of a BUFR message.
recursive integer function iupbs3(mbay, s3mnem)
Read a specified value from within Section 3 of a BUFR message.
recursive subroutine stndrd(lunit, msgin, lmsgot, msgot)
Standardize a BUFR message.
recursive subroutine stdmsg(cf)
Specify whether BUFR messages output by future calls to message-writing subroutines and subset-writin...
integer function istdesc(idn)
Given the WMO bit-wise representation of an FXY value for a descriptor, check whether the descriptor ...
subroutine x84(iin8, iout4, nval)
Encode one or more 8-byte integer values as 4-byte integer values.