NCEPLIBS-bufr  12.2.0
All Data Structures Namespaces Files Functions Variables Macros Pages
readwritemg.F90
Go to the documentation of this file.
1 
5 
43 recursive subroutine readmg(lunxx,subset,jdate,iret)
44 
45  use bufrlib
46 
47  use modv_vars, only: im8b, iprt
48 
49  use moda_msgcwd
50  use moda_sc3bfr
51  use moda_bitbuf
52 
53  implicit none
54 
55  integer, intent(in) :: lunxx
56  integer, intent(out) :: jdate, iret
57  integer my_lunxx, lunit, lun, il, im, ier, idxmsg
58 
59  character*8, intent(out) :: subset
60  character*128 errstr
61 
62  ! Check for I8 integers
63 
64  if(im8b) then
65  im8b=.false.
66 
67  call x84(lunxx,my_lunxx,1)
68  call readmg(my_lunxx,subset,jdate,iret)
69  call x48(jdate,jdate,1)
70  call x48(iret,iret,1)
71 
72  im8b=.true.
73  return
74  endif
75 
76  iret = 0
77  lunit = abs(lunxx)
78 
79  ! Check the file status
80 
81  call status(lunit,lun,il,im)
82  if(il==0) call bort('BUFRLIB: READMG - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
83  if(il>0) call bort('BUFRLIB: READMG - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
84  call wtstat(lunit,lun,il,1)
85 
86  ! Read a message into the internal message buffer
87 
88  do while (.true.)
89  call rdmsgw(lunit,mbay(1,lun),ier)
90  if(ier==-1) then
91  ! EOF on attempted read
92  call wtstat(lunit,lun,il,0)
93  inode(lun) = 0
94  idate(lun) = 0
95  subset = ' '
96  jdate = 0
97  iret = -1
98  return
99  endif
100 
101  ! Parse the message section contents
102  if(isc3(lun)/=0) call reads3(lun)
103  call cktaba(lun,subset,jdate,iret)
104 
105  ! Check for a dictionary message
106  if(idxmsg(mbay(1,lun))/=1) return
107 
108  ! This is an internal dictionary message that was generated by the NCEPLIBS-bufr software.
109  if(isc3(lun)/=0) return
110 
111  ! Section 3 decoding isn't being used, so backspace the file pointer and then use subroutine rdbfdx() to read in
112  ! all such dictionary messages (they should be stored consecutively!) and reset the internal tables.
113  call backbufr_c(lun)
114  call rdbfdx(lunit,lun)
115  if(iprt>=1) then
116  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
117  errstr = 'BUFRLIB: READMG - INTERNAL DICTIONARY MESSAGE READ; ACCOUNT FOR IT THEN READ IN NEXT MESSAGE WITHOUT RETURNING'
118  call errwrt(errstr)
119  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
120  call errwrt(' ')
121  endif
122  enddo
123 
124 end subroutine readmg
125 
141 recursive integer function ireadmg(lunit,subset,idate) result(iret)
142 
143  use modv_vars, only: im8b
144 
145  implicit none
146 
147  integer, intent(in) :: lunit
148  integer, intent(out) :: idate
149  integer my_lunit
150 
151  character*8, intent(out) :: subset
152 
153  ! Check for I8 integers
154 
155  if(im8b) then
156  im8b=.false.
157 
158  call x84(lunit,my_lunit,1)
159  iret=ireadmg(my_lunit,subset,idate)
160  call x48(idate,idate,1)
161 
162  im8b=.true.
163  return
164  endif
165 
166  call readmg(lunit,subset,idate,iret)
167 
168  return
169 end function ireadmg
170 
214 recursive subroutine readerme(mesg,lunit,subset,jdate,iret)
215 
216  use modv_vars, only: mxmsgl, im8b, nbytw, iprt, bmostr
217 
218  use moda_sc3bfr
219  use moda_idrdm
220  use moda_bitbuf
221 
222  implicit none
223 
224  integer, intent(in) :: lunit, mesg(*)
225  integer, intent(out) :: jdate, iret
226  integer my_lunit, iec0(2), lun, il, im, ii, lnmsg, lmsg, idxmsg, iupbs3
227 
228  character*8, intent(out) :: subset
229  character*8 sec0
230  character*128 errstr, bort_str
231 
232  logical endtbl
233 
234  equivalence(sec0,iec0)
235 
236  ! Check for I8 integers
237 
238  if(im8b) then
239  im8b=.false.
240 
241  call x84(lunit,my_lunit,1)
242  call readerme(mesg,my_lunit,subset,jdate,iret)
243  call x48(jdate,jdate,1)
244  call x48(iret,iret,1)
245 
246  im8b=.true.
247  return
248  endif
249 
250  iret = 0
251 
252  ! Check the file status
253 
254  call status(lunit,lun,il,im)
255  if(il==0) call bort('BUFRLIB: READERME - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
256  if(il>0) call bort('BUFRLIB: READERME - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
257  call wtstat(lunit,lun,il, 1)
258 
259  ! Copy the input message into the internal message buffer
260 
261  iec0(1) = mesg(1)
262  iec0(2) = mesg(2)
263  lnmsg = lmsg(sec0)
264  if(lnmsg*nbytw>mxmsgl) then
265  write(bort_str,'("BUFRLIB: READERME - INPUT BUFR MESSAGE LENGTH",1X,I6," BYTES) IS LARGER THAN '// &
266  'LIMIT OF ",I6," BYTES")') lnmsg*nbytw, mxmsgl
267  call bort(bort_str)
268  endif
269  do ii=1,lnmsg
270  mbay(ii,lun) = mesg(ii)
271  enddo
272 
273  ! Confirm that the first 4 bytes of SEC0 contain 'BUFR'.
274 
275  if(sec0(1:4)/=bmostr) &
276  call bort('BUFRLIB: READERME - FIRST 4 BYTES READ FROM RECORD NOT "BUFR", DOES NOT CONTAIN BUFR DATA')
277 
278  ! Parse the message section contents
279 
280  if(isc3(lun)/=0) call reads3(lun)
281  call cktaba(lun,subset,jdate,iret)
282  if(isc3(lun)/=0) return
283 
284  ! Check for a DX dictionary message
285 
286  ! A new DX dictionary table can be passed in as a consecutive set of DX dictionary messages. Each message should be passed
287  ! in one at a time, via input argument mesg during consecutive calls to this subroutine, and all such messages will be
288  ! treated as a single dictionary table up until the next message is passed in which either contains no data subsets or
289  ! else is a non-DX dictionary message.
290 
291  endtbl = .false.
292  if(idxmsg(mbay(1,lun))==1) then
293  ! This is a DX dictionary message that was generated by the NCEPLIBS-bufr software.
294  if(iupbs3(mbay(1,lun),'NSUB')==0) then
295  ! But it doesn't contain any actual dictionary information, so assume we've reached the end of the dictionary table.
296  if(idrdm(lun)>0) then
297  endtbl = .true.
298  endif
299  else
300  if(idrdm(lun)==0) then
301  ! This is the first DX dictionary message that is part of a new dictionary table.
302  call dxinit(lun,0)
303  endif
304  idrdm(lun) = idrdm(lun) + 1
305  call stbfdx(lun,mbay(1,lun))
306  endif
307  else if(idrdm(lun)>0) then
308  ! This is the first non-DX dictionary message received following a string of DX dictionary messages, so assume we've
309  ! reached the end of the dictionary table.
310  endtbl = .true.
311  endif
312 
313  if(endtbl) then
314  if ( iprt >= 2 ) then
315  call errwrt('+++++++++++++++++++++++++++++++++++++++++++++++++')
316  write ( unit=errstr, fmt='(A,I3,A)' ) &
317  'BUFRLIB: READERME - STORED NEW DX TABLE CONSISTING OF (', idrdm(lun), ') MESSAGES;'
318  call errwrt(errstr)
319  errstr = 'WILL APPLY THIS TABLE TO ALL SUBSEQUENT DATA MESSAGES UNTIL NEXT DX TABLE IS PASSED IN'
320  call errwrt(errstr)
321  call errwrt('+++++++++++++++++++++++++++++++++++++++++++++++++')
322  call errwrt(' ')
323  endif
324  idrdm(lun) = 0
325  call makestab
326  endif
327 
328  return
329 end subroutine readerme
330 
340 subroutine rdmsgw(lunit,mesg,iret)
341 
342  use bufrlib
343 
344  use modv_vars, only: mxmsgld4
345 
346  implicit none
347 
348  integer, intent(in) :: lunit
349  integer, intent(out) :: mesg(*), iret
350  integer lun, il, im
351 
352  call status(lunit,lun,il,im)
353  iret = -2
354  do while (iret<=-2)
355  iret = crdbufr_c(lun,mesg,mxmsgld4)
356  if(iret==-3) call errwrt('BUFRLIB: RDMSGW - SKIPPING OVERLARGE MESSAGE')
357  if(iret==-2) call errwrt('BUFRLIB: RDMSGW - SKIPPING CORRUPTED MESSAGE')
358  end do
359 
360  return
361 end subroutine rdmsgw
362 
392 recursive subroutine openmb(lunit,subset,jdate)
393 
394  use modv_vars, only: im8b
395 
396  use moda_msgcwd
397 
398  implicit none
399 
400  integer, intent(in) :: lunit, jdate
401  integer my_lunit, my_jdate, lun, il, im, mtyp, mstb, inod, i4dy
402 
403  character*(*), intent(in) :: subset
404 
405  logical open
406 
407  ! Check for I8 integers
408 
409  if(im8b) then
410  im8b=.false.
411 
412  call x84(lunit,my_lunit,1)
413  call x84(jdate,my_jdate,1)
414  call openmb(my_lunit,subset,my_jdate)
415 
416  im8b=.true.
417  return
418  endif
419 
420  ! Check the file status
421 
422  call status(lunit,lun,il,im)
423  if(il==0) call bort('BUFRLIB: OPENMB - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
424  if(il<0) call bort('BUFRLIB: OPENMB - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
425 
426  ! Get some subset particulars
427 
428  call nemtba(lun,subset,mtyp,mstb,inod)
429  open = im==0 .or. inod/=inode(lun) .or. i4dy(jdate)/=idate(lun)
430 
431  ! Maybe(?) open a new or different type of message
432 
433  if(open) then
434  call closmg(lunit)
435  call wtstat(lunit,lun,il, 1)
436  inode(lun) = inod
437  idate(lun) = i4dy(jdate)
438  ! Initialize the open message
439  call msgini(lun)
440  call usrtpl(lun,1,1)
441  endif
442 
443  return
444 end subroutine openmb
445 
464 recursive subroutine openmg(lunit,subset,jdate)
465 
466  use modv_vars, only: im8b
467 
468  use moda_msgcwd
469 
470  implicit none
471 
472  integer, intent(in) :: lunit, jdate
473  integer my_lunit, my_jdate, lun, il, im, mtyp, mstb, inod, i4dy
474 
475  character*(*), intent(in) :: subset
476 
477  ! Check for I8 integers
478 
479  if(im8b) then
480  im8b=.false.
481 
482  call x84(lunit,my_lunit,1)
483  call x84(jdate,my_jdate,1)
484  call openmg(my_lunit,subset,my_jdate)
485 
486  im8b=.true.
487  return
488  endif
489 
490  ! Check the file status
491 
492  call status(lunit,lun,il,im)
493  if(il==0) call bort('BUFRLIB: OPENMG - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
494  if(il<0) call bort('BUFRLIB: OPENMG - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
495  if(im/=0) call closmg(lunit)
496  call wtstat(lunit,lun,il, 1)
497 
498  ! Get some subset particulars
499 
500  call nemtba(lun,subset,mtyp,mstb,inod)
501  inode(lun) = inod
502  idate(lun) = i4dy(jdate)
503 
504  ! Initialize the open message
505 
506  call msgini(lun)
507  call usrtpl(lun,1,1)
508 
509  return
510 end subroutine openmg
511 
528 recursive subroutine closmg(lunin)
529 
530  use modv_vars, only: im8b
531 
532  use moda_msgcwd
533  use moda_msglim
534  use moda_bitbuf
535 
536  implicit none
537 
538  integer, intent(in) :: lunin
539  integer my_lunin, lunit, lun, il, im
540 
541  ! Check for I8 integers
542 
543  if(im8b) then
544  im8b=.false.
545 
546  call x84(lunin,my_lunin,1)
547  call closmg(my_lunin)
548 
549  im8b=.true.
550  return
551  endif
552 
553  ! Check the file status
554 
555  lunit = abs(lunin)
556  call status(lunit,lun,il,im)
557  if(lunit/=lunin) msglim(lun) = 0
558  if(il==0) call bort('BUFRLIB: CLOSMG - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
559  if(il<0) call bort('BUFRLIB: CLOSMG - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
560  if(im/=0) then
561  if(nsub(lun)>0) then
562  call msgwrt(lunit,mbay(1,lun),mbyt(lun))
563  else if(nsub(lun)==0.and.nmsg(lun)<msglim(lun)) then
564  call msgwrt(lunit,mbay(1,lun),mbyt(lun))
565  else if(nsub(lun)<0) then
566  call wrcmps(-lunit)
567  endif
568  endif
569  call wtstat(lunit,lun,il,0)
570 
571  return
572 end subroutine closmg
573 
593 subroutine msgwrt(lunit,mesg,mgbyt)
594 
595  use bufrlib
596 
597  use modv_vars, only: mxmsgld4, iprt, nby5, bmostr, bmcstr
598 
599  use moda_nulbfr
600  use moda_bufrmg
601  use moda_mgwa
602  use moda_mgwb
603  use moda_s01cm
604  use moda_tnkrcp
605  use moda_msgstd
606 
607  implicit none
608 
609  integer, intent(in) :: lunit, mgbyt, mesg(*)
610  integer iec0(2), mbyt, ibit, kbit, ii, jj, len0, len1, len2, len3, len4, l5, iad4, iad5, lun, il, im, npbyt, mwrd, &
611  nmwrd, iupbs01, idxmsg
612 
613  character*128 errstr
614 
615  ! Make a local copy of the input message for use within this subroutine, since internal calls to any or all of the
616  ! subroutines stndrd(), cnved4(), pkbs1(), atrcpt(), etc. may end up modifying the message before it finally gets
617  ! written out to lunit.
618 
619  mbyt = mgbyt
620 
621  iec0(1) = mesg(1)
622  iec0(2) = mesg(2)
623  ibit = 32
624  call pkb(mbyt,24,iec0,ibit)
625 
626  do ii = 1, nmwrd(iec0)
627  mgwa(ii) = mesg(ii)
628  enddo
629 
630  ! Overwrite any values within Section 0 or Section 1 that were requested via previous calls to pkvs01(). If a request
631  ! was made to change the BUFR edition number to 4, then actually convert the message as well.
632 
633  if(ns01v>0) then
634  do jj=1,ns01v
635  if(cmnem(jj)=='BEN') then
636  if(ivmnem(jj)==4) then
637  ! Install Section 0 byte count for use by cnved4()
638  ibit = 32
639  call pkb(mbyt,24,mgwa,ibit)
640  call cnved4(mgwa,mxmsgld4,mgwb)
641  ! Compute mbyt for the new edition 4 message
642  mbyt = iupbs01(mgwb,'LENM')
643  ! Copy the mgwb array back into mgwa
644  do ii = 1, nmwrd(mgwb)
645  mgwa(ii) = mgwb(ii)
646  enddo
647  endif
648  else
649  ! Overwrite the requested value
650  call pkbs1(ivmnem(jj),mgwa,cmnem(jj))
651  endif
652  enddo
653  endif
654 
655  ! Standardize the message if requested via module @ref moda_msgstd. However, we don't want to do this if the message
656  ! contains DX BUFR table information, because in that case it's already standard.
657 
658  if ( ( csmf=='Y' ) .and. ( idxmsg(mgwa)/=1 ) ) then
659  ! Install Section 0 byte count and Section 5 '7777' into the original message. This is necessary because
660  ! subroutine stndrd() requires a complete and well-formed BUFR message as its input.
661  ibit = 32
662  call pkb(mbyt,24,mgwa,ibit)
663  ibit = (mbyt-4)*8
664  call pkc(bmcstr,nby5,mgwa,ibit)
665  call stndrd(lunit,mgwa,mxmsgld4,mgwb)
666  ! Compute mbyt for the new standardized message
667  mbyt = iupbs01(mgwb,'LENM')
668  ! Copy the mgwb array back into mgwa
669  do ii = 1, nmwrd(mgwb)
670  mgwa(ii) = mgwb(ii)
671  enddo
672  endif
673 
674  ! Append the tank receipt time to Section 1 if requested via module @ref moda_tnkrcp, unless the message contains
675  ! DX BUFR table information.
676 
677  if ( ( ctrt=='Y' ) .and. ( idxmsg(mgwa)/=1 ) ) then
678  ! Install Section 0 byte count for use by subroutine atrcpt()
679  ibit = 32
680  call pkb(mbyt,24,mgwa,ibit)
681  call atrcpt(mgwa,mxmsgld4,mgwb)
682  ! Compute mbyt for the revised message
683  mbyt = iupbs01(mgwb,'LENM')
684  ! Copy the mgwb array back into mgwa
685  do ii = 1, nmwrd(mgwb)
686  mgwa(ii) = mgwb(ii)
687  enddo
688  endif
689 
690  ! Get the section lengths.
691 
692  call getlens(mgwa,4,len0,len1,len2,len3,len4,l5)
693 
694  ! Depending on the edition number of the message, we need to ensure that each section within the message has an even
695  ! number of bytes.
696 
697  if(iupbs01(mgwa,'BEN')<4) then
698  if(mod(len1,2)/=0) call bort ('BUFRLIB: MSGWRT - LENGTH OF SECTION 1 IS NOT A MULTIPLE OF 2')
699  if(mod(len2,2)/=0) call bort ('BUFRLIB: MSGWRT - LENGTH OF SECTION 2 IS NOT A MULTIPLE OF 2')
700  if(mod(len3,2)/=0) call bort ('BUFRLIB: MSGWRT - LENGTH OF SECTION 3 IS NOT A MULTIPLE OF 2')
701  if(mod(len4,2)/=0) then
702  ! Pad Section 4 with an additional byte that is zeroed out
703  iad4 = len0+len1+len2+len3
704  iad5 = iad4+len4
705  ibit = iad4*8
706  len4 = len4+1
707  call pkb(len4,24,mgwa,ibit)
708  ibit = iad5*8
709  call pkb(0,8,mgwa,ibit)
710  mbyt = mbyt+1
711  endif
712  endif
713 
714  ! Write Section 0 byte count and Section 5
715 
716  ibit = 0
717  call pkc(bmostr, 4,mgwa,ibit)
718  call pkb(mbyt,24,mgwa,ibit)
719 
720  kbit = (mbyt-4)*8
721  call pkc(bmcstr,nby5,mgwa,kbit)
722 
723  ! Zero out the extra bytes which will be written. Note that the BUFR message is stored within the integer array mgwa(*),
724  ! (rather than within a character array), so we need to make sure that the "7777" Is followed by zeroed-out bytes up to
725  ! the boundary of the last machine word that will be written out.
726 
727  call padmsg(mgwa,mxmsgld4,npbyt)
728 
729  ! Write the message plus padding to a word boundary if null(lun) = 0
730 
731  mwrd = nmwrd(mgwa)
732  call status(lunit,lun,il,im)
733  if(null(lun)==0) then
734  call blocks(mgwa,mwrd)
735  call cwrbufr_c(lun,mgwa,mwrd)
736  endif
737 
738  if(iprt>=2) then
739  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
740  write ( unit=errstr, fmt='(A,I4,A,I7)') 'BUFRLIB: MSGWRT: LUNIT =', lunit, ', BYTES =', mbyt+npbyt
741  call errwrt(errstr)
742  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
743  call errwrt(' ')
744  endif
745 
746  ! Save a memory copy of this message, unless it's a DX message.
747 
748  if(idxmsg(mgwa)/=1) then
749  ! Store a copy of this message within module @ref moda_bufrmg, for possible later retrieval during a future call to
750  ! subroutine writsa()
751  msglen(lun) = mwrd
752  do ii=1,msglen(lun)
753  msgtxt(ii,lun) = mgwa(ii)
754  enddo
755  endif
756 
757  return
758 end subroutine msgwrt
759 
767 subroutine msgini(lun)
768 
769  use modv_vars, only: mtv, nby0, nby1, nby2, nby3, nby5, bmostr, bmcstr, fxy_fbit, fxy_sbyct, fxy_drf8
770 
771  use moda_msgcwd
772  use moda_ufbcpl
773  use moda_bitbuf
774  use moda_tables
775 
776  implicit none
777 
778  integer, intent(in) :: lun
779  integer nby4, nbyt, mtyp, msbt, inod, isub, iret, mcen, mear, mmon, mday, mour, mmin, mbit, ifxy
780 
781  character*128 bort_str
782  character*8 subtag
783  character tab
784 
785  ! Get the message tag and type, and break up the date
786 
787  subtag = tag(inode(lun))(1:8)
788  call nemtba(lun,subtag,mtyp,msbt,inod)
789  if(inode(lun)/=inod) then
790  write(bort_str,'("BUFRLIB: MSGINI - MISMATCH BETWEEN INODE (=",I7,") & POSITIONAL INDEX, INOD (",I7,") '// &
791  'OF SUBTAG (",A,") IN DICTIONARY")') inode(lun), inod, subtag
792  call bort(bort_str)
793  endif
794  call nemtab(lun,subtag,isub,tab,iret)
795  if(iret==0) then
796  write(bort_str,'("BUFRLIB: MSGINI - TABLE A MESSAGE TYPE MNEMONIC ",A," NOT FOUND IN INTERNAL TABLE D ARRAYS")') subtag
797  call bort(bort_str)
798  endif
799 
800  ! Date can be YYMMDDHH or YYYYMMDDHH
801 
802  mcen = mod(idate(lun)/10**8,100)+1
803  mear = mod(idate(lun)/10**6,100)
804  mmon = mod(idate(lun)/10**4,100)
805  mday = mod(idate(lun)/10**2,100)
806  mour = mod(idate(lun) ,100)
807  mmin = 0
808 
809  if(mcen==1) call bort ('BUFRLIB: MSGINI - BUFR MESSAGE DATE (IDATE) is 0000000000')
810 
811  if(mear==0) mcen = mcen-1
812  if(mear==0) mear = 100
813 
814  ! Initialize the message
815 
816  mbit = 0
817  nby4 = 4
818  nbyt = nby0+nby1+nby2+nby3+nby4+nby5
819 
820  ! Section 0
821 
822  call pkc(bmostr, 4 , mbay(1,lun),mbit)
823  call pkb(nbyt , 24 , mbay(1,lun),mbit)
824  call pkb( 3 , 8 , mbay(1,lun),mbit)
825 
826  ! Section 1
827 
828  call pkb(nby1 , 24 , mbay(1,lun),mbit)
829  call pkb( 0 , 8 , mbay(1,lun),mbit)
830  call pkb( 3 , 8 , mbay(1,lun),mbit)
831  call pkb( 7 , 8 , mbay(1,lun),mbit)
832  call pkb( 0 , 8 , mbay(1,lun),mbit)
833  call pkb( 0 , 8 , mbay(1,lun),mbit)
834  call pkb(mtyp , 8 , mbay(1,lun),mbit)
835  call pkb(msbt , 8 , mbay(1,lun),mbit)
836  call pkb( mtv , 8 , mbay(1,lun),mbit)
837  call pkb( 0 , 8 , mbay(1,lun),mbit)
838  call pkb(mear , 8 , mbay(1,lun),mbit)
839  call pkb(mmon , 8 , mbay(1,lun),mbit)
840  call pkb(mday , 8 , mbay(1,lun),mbit)
841  call pkb(mour , 8 , mbay(1,lun),mbit)
842  call pkb(mmin , 8 , mbay(1,lun),mbit)
843  call pkb(mcen , 8 , mbay(1,lun),mbit)
844 
845  ! Section 3
846 
847  call pkb(nby3 , 24 , mbay(1,lun),mbit)
848  call pkb( 0 , 8 , mbay(1,lun),mbit)
849  call pkb( 0 , 16 , mbay(1,lun),mbit)
850  call pkb(2**7 , 8 , mbay(1,lun),mbit)
851  call pkb(ifxy(fxy_sbyct), 16, mbay(1,lun),mbit)
852  call pkb(isub , 16 , mbay(1,lun),mbit)
853  call pkb(ifxy('102000') , 16, mbay(1,lun),mbit)
854  call pkb(ifxy(fxy_drf8) , 16, mbay(1,lun),mbit)
855  call pkb(ifxy('206001') , 16, mbay(1,lun),mbit)
856  call pkb(ifxy(fxy_fbit), 16, mbay(1,lun),mbit)
857  call pkb( 0 , 8 , mbay(1,lun),mbit)
858 
859  ! Section 4
860 
861  call pkb(nby4 , 24 , mbay(1,lun),mbit)
862  call pkb( 0 , 8 , mbay(1,lun),mbit)
863 
864  ! Section 5
865 
866  call pkc(bmcstr,nby5, mbay(1,lun),mbit)
867 
868  ! Double check initial message length
869 
870  if(mod(mbit,8)/=0) call bort('BUFRLIB: MSGINI - INITIALIZED MESSAGE DOES NOT END ON A BYTE BOUNDARY')
871  if(mbit/8/=nbyt) then
872  write(bort_str,'("BUFRLIB: MSGINI - NUMBER OF BYTES STORED FOR INITIALIZED MESSAGE (",I6,") IS NOT THE SAME AS FIRST '// &
873  'CALCULATED, NBYT (",I6)') mbit/8, nbyt
874  call bort(bort_str)
875  endif
876 
877  nmsg(lun) = nmsg(lun)+1
878  nsub(lun) = 0
879  mbyt(lun) = nbyt
880 
881  luncpy(lun)=0
882 
883  return
884 end subroutine msgini
885 
896 logical function msgfull(msiz,itoadd,mxsiz) result(bool)
897 
898  use modv_vars, only: maxnc
899 
900  use moda_tnkrcp
901  use moda_msgstd
902 
903  implicit none
904 
905  integer, intent(in) :: msiz, itoadd, mxsiz
906  integer iwgbyt
907 
908  ! Allow for at least 11 additional bytes of "wiggle room" in the message, because subroutine msgwrt() may do any or all
909  ! of the following:
910  ! 3 bytes may be added by a call to subroutine cnved4()
911  ! + 1 byte (at most) of padding may be added to Section 4
912  ! + 7 bytes (at most) of padding may be added up to the next word boundary after Section 5
913  ! ----
914  ! 11
915  iwgbyt = 11
916 
917  ! But subroutine msgwrt() may also do any of all of the following:
918 
919  ! 6 bytes may be added by a call to subroutine atrcpt()
920  if(ctrt=='Y') iwgbyt = iwgbyt + 6
921 
922  ! (maxnc*2) bytes (at most) may be added by a call to subroutine stndrd()
923  if(csmf=='Y') iwgbyt = iwgbyt + (maxnc*2)
924 
925  ! Determine whether the subset will fit.
926 
927  if ( ( msiz + itoadd + iwgbyt ) > mxsiz ) then
928  bool = .true.
929  else
930  bool = .false.
931  endif
932 
933  return
934 end function msgfull
935 
953 recursive subroutine maxout(maxo)
954 
955  use modv_vars, only: mxmsgl, im8b, iprt
956 
957  use moda_bitbuf
958 
959  implicit none
960 
961  integer, intent(in) :: maxo
962  integer my_maxo, newsiz, nxstr, ldxa, ldxb, ldxd, ld30
963 
964  character*128 errstr
965  character*56 dxstr
966 
967  common /dxtab/ nxstr(10), ldxa(10), ldxb(10), ldxd(10), ld30(10), dxstr(10)
968 
969  ! Check for I8 integers
970 
971  if(im8b) then
972  im8b=.false.
973 
974  call x84(maxo,my_maxo,1)
975  call maxout(my_maxo)
976 
977  im8b=.true.
978  return
979  endif
980 
981  if((maxo==0).or.(maxo>mxmsgl)) then
982  newsiz = mxmsgl
983  else
984  newsiz = maxo
985  endif
986 
987  if(iprt>=0) then
988  if(maxbyt/=newsiz) then
989  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
990  write ( unit=errstr, fmt='(A,A,I7,A,I7)' ) 'BUFRLIB: MAXOUT - THE RECORD LENGTH OF ALL BUFR MESSAGES ',&
991  'CREATED FROM THIS POINT ON IS BEING CHANGED FROM ', maxbyt, ' TO ', newsiz
992  call errwrt(errstr)
993  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
994  call errwrt(' ')
995  endif
996  endif
997 
998  maxbyt = newsiz
999 
1000  return
1001 end subroutine maxout
1002 
1011 integer function igetmxby() result(iret)
1012 
1013  use moda_bitbuf
1014 
1015  implicit none
1016 
1017  iret = maxbyt
1018 
1019  return
1020 end function igetmxby
1021 
1032 subroutine padmsg(mesg,lmesg,npbyt)
1033 
1034  use modv_vars, only: nbytw
1035 
1036  implicit none
1037 
1038  integer, intent(in) :: lmesg
1039  integer, intent(inout) :: mesg(*)
1040  integer, intent(out) :: npbyt
1041  integer nmw, nmb, ibit, i, nmwrd, iupbs01
1042 
1043  ! Make sure that the array is big enough to hold the additional byte padding that will be appended to the
1044  ! end of the message.
1045 
1046  nmw = nmwrd(mesg)
1047  if(nmw>lmesg) call bort('BUFRLIB: PADMSG - CANNOT ADD PADDING TO MESSAGE ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
1048 
1049  ! Pad from the end of the message up to the next 8-byte boundary.
1050 
1051  nmb = iupbs01(mesg,'LENM')
1052  ibit = nmb*8
1053  npbyt = ( nmw * nbytw ) - nmb
1054  do i = 1, npbyt
1055  call pkb(0,8,mesg,ibit)
1056  enddo
1057 
1058  return
1059 end subroutine padmsg
1060 
1071 recursive integer function nmsub(lunit) result(iret)
1072 
1073  use modv_vars, only: im8b
1074 
1075  use moda_msgcwd
1076 
1077  implicit none
1078 
1079  integer, intent(in) :: lunit
1080  integer my_lunit, lun, il, im
1081 
1082  ! Check for I8 integers
1083 
1084  if(im8b) then
1085  im8b=.false.
1086 
1087  call x84(lunit,my_lunit,1)
1088  iret=nmsub(my_lunit)
1089 
1090  im8b=.true.
1091  return
1092  endif
1093 
1094  iret = 0
1095 
1096  ! Check the file status
1097 
1098  call status(lunit,lun,il,im)
1099  if(il==0) call bort('BUFRLIB: NMSUB - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
1100  if(il>0) call bort('BUFRLIB: NMSUB - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
1101  if(im==0) call bort('BUFRLIB: NMSUB - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
1102 
1103  iret = msub(lun)
1104 
1105  return
1106 end function nmsub
1107 
1121 integer function nmwrd(mbay) result(iret)
1122 
1123  use modv_vars, only: nbytw
1124 
1125  implicit none
1126 
1127  integer, intent(in) :: mbay(*)
1128  integer lenm, iupbs01
1129 
1130  lenm = iupbs01(mbay,'LENM')
1131  if(lenm==0) then
1132  iret = 0
1133  else
1134  iret = ((lenm/8)+1)*(8/nbytw)
1135  endif
1136 
1137  return
1138 end function nmwrd
1139 
1153 integer function lmsg(sec0) result(iret)
1154 
1155  implicit none
1156 
1157  integer msec0(2), nmwrd
1158 
1159  character*8, intent(in) :: sec0
1160  character*8 csec0
1161 
1162  equivalence(msec0,csec0)
1163 
1164  csec0 = sec0
1165  iret = nmwrd(msec0)
1166 
1167  return
1168 end function lmsg
1169 
1189 recursive subroutine getlens (mbay,ll,len0,len1,len2,len3,len4,len5)
1190 
1191  use modv_vars, only: im8b, nby5
1192 
1193  implicit none
1194 
1195  integer, intent(in) :: mbay(*), ll
1196  integer, intent(out) :: len0, len1, len2, len3, len4, len5
1197  integer my_ll, iad2, iad3, iad4, iupbs01, iupb
1198 
1199  ! Check for I8 integers.
1200  if(im8b) then
1201  im8b=.false.
1202  call x84(ll,my_ll,1)
1203  call getlens(mbay,my_ll,len0,len1,len2,len3,len4,len5)
1204  call x48(len0,len0,1)
1205  call x48(len1,len1,1)
1206  call x48(len2,len2,1)
1207  call x48(len3,len3,1)
1208  call x48(len4,len4,1)
1209  call x48(len5,len5,1)
1210  im8b=.true.
1211  return
1212  endif
1213 
1214  len0 = -1
1215  len1 = -1
1216  len2 = -1
1217  len3 = -1
1218  len4 = -1
1219  len5 = -1
1220 
1221  if(ll<0) return
1222  len0 = iupbs01(mbay,'LEN0')
1223 
1224  if(ll<1) return
1225  len1 = iupbs01(mbay,'LEN1')
1226 
1227  if(ll<2) return
1228  iad2 = len0 + len1
1229  len2 = iupb(mbay,iad2+1,24) * iupbs01(mbay,'ISC2')
1230 
1231  if(ll<3) return
1232  iad3 = iad2 + len2
1233  len3 = iupb(mbay,iad3+1,24)
1234 
1235  if(ll<4) return
1236  iad4 = iad3 + len3
1237  len4 = iupb(mbay,iad4+1,24)
1238 
1239  if(ll<5) return
1240  len5 = nby5
1241 
1242  return
1243 end subroutine getlens
1244 
1269 recursive subroutine cnved4(msgin,lmsgot,msgot)
1270 
1271  use modv_vars, only: im8b, nbytw
1272 
1273  implicit none
1274 
1275  integer, intent(in) :: msgin(*), lmsgot
1276  integer, intent(out) :: msgot(*)
1277  integer my_lmsgot, i, nmw, len0, len1, len2, len3, l4, l5, iad2, iad4, lenm, lenmot, len1ot, len3ot, ibit, iupbs01, nmwrd
1278 
1279  ! Check for I8 integers.
1280 
1281  if(im8b) then
1282  im8b=.false.
1283  call x84 ( lmsgot, my_lmsgot, 1 )
1284  call cnved4 ( msgin, my_lmsgot*2, msgot )
1285  im8b=.true.
1286  return
1287  endif
1288 
1289  if(iupbs01(msgin,'BEN')==4) then
1290 
1291  ! The input message is already encoded using edition 4, so just copy it from msgin to msgot and then return.
1292 
1293  nmw = nmwrd(msgin)
1294  if(nmw>lmsgot) &
1295  call bort('BUFRLIB: CNVED4 - OVERFLOW OF OUTPUT (EDITION 4) MESSAGE ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
1296  do i = 1, nmw
1297  msgot(i) = msgin(i)
1298  enddo
1299  return
1300  endif
1301 
1302  ! Get some section lengths and addresses from the input message.
1303 
1304  call getlens(msgin,3,len0,len1,len2,len3,l4,l5)
1305 
1306  iad2 = len0 + len1
1307  iad4 = iad2 + len2 + len3
1308 
1309  lenm = iupbs01(msgin,'LENM')
1310 
1311  ! Check for overflow of the output array. Note that the new edition 4 message will be a total of 3 bytes longer than the
1312  ! input message (i.e. 4 more bytes in Section 1, but 1 fewer byte in Section 3).
1313 
1314  lenmot = lenm + 3
1315  if(lenmot>(lmsgot*nbytw)) &
1316  call bort('BUFRLIB: CNVED4 - OVERFLOW OF OUTPUT (EDITION 4) MESSAGE ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
1317 
1318  len1ot = len1 + 4
1319  len3ot = len3 - 1
1320 
1321  ! Write Section 0 of the new message into the output array.
1322 
1323  call mvb ( msgin, 1, msgot, 1, 4 )
1324  ibit = 32
1325  call pkb ( lenmot, 24, msgot, ibit )
1326  call pkb ( 4, 8, msgot, ibit )
1327 
1328  ! Write Section 1 of the new message into the output array.
1329 
1330  call pkb ( len1ot, 24, msgot, ibit )
1331  call pkb ( iupbs01(msgin,'BMT'), 8, msgot, ibit )
1332  call pkb ( iupbs01(msgin,'OGCE'), 16, msgot, ibit )
1333  call pkb ( iupbs01(msgin,'GSES'), 16, msgot, ibit )
1334  call pkb ( iupbs01(msgin,'USN'), 8, msgot, ibit )
1335  call pkb ( iupbs01(msgin,'ISC2')*128, 8, msgot, ibit )
1336  call pkb ( iupbs01(msgin,'MTYP'), 8, msgot, ibit )
1337  ! Set a default of 255 for the international subcategory.
1338  call pkb ( 255, 8, msgot, ibit )
1339  call pkb ( iupbs01(msgin,'MSBT'), 8, msgot, ibit )
1340  call pkb ( iupbs01(msgin,'MTV'), 8, msgot, ibit )
1341  call pkb ( iupbs01(msgin,'MTVL'), 8, msgot, ibit )
1342  call pkb ( iupbs01(msgin,'YEAR'), 16, msgot, ibit )
1343  call pkb ( iupbs01(msgin,'MNTH'), 8, msgot, ibit )
1344  call pkb ( iupbs01(msgin,'DAYS'), 8, msgot, ibit )
1345  call pkb ( iupbs01(msgin,'HOUR'), 8, msgot, ibit )
1346  call pkb ( iupbs01(msgin,'MINU'), 8, msgot, ibit )
1347  ! Set a default of 0 for the second.
1348  call pkb ( 0, 8, msgot, ibit )
1349 
1350  ! Copy Section 2 (if it exists) through the next-to-last byte of Section 3 from the input array to the output array.
1351 
1352  call mvb ( msgin, iad2+1, msgot, (ibit/8)+1, len2+len3-1 )
1353 
1354  ! Store the length of the new Section 3.
1355 
1356  ibit = ( len0 + len1ot + len2 ) * 8
1357  call pkb ( len3ot, 24, msgot, ibit )
1358 
1359  ! Copy Section 4 and Section 5 from the input array to the output array.
1360 
1361  ibit = ibit + ( len3ot * 8 ) - 24
1362  call mvb ( msgin, iad4+1, msgot, (ibit/8)+1, lenm-iad4 )
1363 
1364  return
1365 end subroutine cnved4
1366 
1378 recursive integer function ifbget(lunit) result(iret)
1379 
1380  use modv_vars, only: im8b
1381 
1382  use moda_msgcwd
1383 
1384  implicit none
1385 
1386  integer, intent(in) :: lunit
1387  integer my_lunit, lun, il, im
1388 
1389  ! Check for I8 integers
1390 
1391  if(im8b) then
1392  im8b=.false.
1393  call x84(lunit,my_lunit,1)
1394  iret=ifbget(my_lunit)
1395  im8b=.true.
1396  return
1397  endif
1398 
1399  iret = -1
1400 
1401  ! Make sure a file/message is open for input
1402 
1403  call status(lunit,lun,il,im)
1404  if(il==0) call bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
1405  if(il>0) call bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
1406  if(im==0) call bort('BUFRLIB: IFBGET - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
1407 
1408  ! Check if there's another subset in the message
1409 
1410  if(nsub(lun)<msub(lun)) iret = 0
1411 
1412  return
1413 end function ifbget
subroutine blocks(mbay, mwrd)
Encapsulate a BUFR message with IEEE Fortran control words as specified via the most recent call to s...
Definition: blocks.F90:37
subroutine bort(str)
Log an error message, then abort the application program.
Definition: borts.F90:15
recursive integer function iupb(mbay, nbyt, nbit)
Decode an integer value from within a specified number of bits of an integer array,...
Definition: cidecode.F90:226
subroutine pkc(chr, nchr, ibay, ibit)
Encode a character string within a specified number of bytes of an integer array, starting at the bit...
Definition: ciencode.F90:25
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...
Definition: ciencode.F90:140
subroutine wrcmps(lunix)
Write a compressed BUFR data subset.
Definition: compress.F90:384
subroutine mvb(ib1, nb1, ib2, nb2, nbm)
Copy a specified number of bytes from one packed binary array to another.
Definition: copydata.F90:729
subroutine nemtba(lun, nemo, mtyp, msbt, inod)
Get information about a Table A descriptor from the internal DX BUFR tables.
Definition: dxtable.F90:1238
subroutine stbfdx(lun, mesg)
Copy a DX BUFR tables message into the internal memory arrays in module moda_tababd.
Definition: dxtable.F90:981
subroutine dxinit(lun, ioi)
Clear out the internal arrays (in module moda_tababd) holding the DX BUFR table, then optionally init...
Definition: dxtable.F90:606
integer function idxmsg(mesg)
Check whether a BUFR message contains DX BUFR tables information that was generated by the NCEPLIBS-b...
Definition: dxtable.F90:1114
subroutine rdbfdx(lunit, lun)
Beginning at the current file pointer location within lunit, read a complete DX BUFR table into inter...
Definition: dxtable.F90:121
subroutine errwrt(str)
Specify a custom location for the logging of error and diagnostic messages generated by the NCEPLIBS-...
Definition: errwrt.F90:32
subroutine nemtab(lun, nemo, idn, tab, iret)
Get information about a descriptor, based on a mnemonic.
Definition: fxy.F90:434
Wrap C NCEPLIBS-bufr functions so they can be called from within the Fortran part of the library.
Definition: bufrlib.F90:11
Declare arrays and variables used to store BUFR messages internally for multiple file IDs.
integer, dimension(:,:), allocatable mbay
Current BUFR message for each file ID.
integer, dimension(:), allocatable mbyt
Length (in bytes) of current BUFR message for each file ID.
integer maxbyt
Maximum length of an output BUFR message.
Declare arrays used to store, for each output file ID, a copy of the BUFR message that was most recen...
integer, dimension(:), allocatable msglen
Length (in integers) of BUFR message most recently written to each output file ID.
integer, dimension(:,:), allocatable msgtxt
BUFR message most recently written to each output file ID.
Declare an array used by subroutine readerme() to read in a new DX dictionary table as a consecutive ...
integer, dimension(:), allocatable idrdm
DX BUFR tables message count for each file ID.
Declare an array used by various subroutines and functions to hold a temporary working copy of a BUFR...
integer, dimension(:), allocatable mgwa
Temporary working copy of BUFR message.
Declare an array used by various subroutines and functions to hold a temporary working copy of a BUFR...
integer, dimension(:), allocatable mgwb
Temporary working copy of BUFR message.
Declare arrays used to store information about the current BUFR message that is in the process of bei...
integer, dimension(:), allocatable inode
Table A mnemonic for type of BUFR message.
integer, dimension(:), allocatable idate
Section 1 date-time of message.
integer, dimension(:), allocatable nmsg
Current message pointer within logical unit.
integer, dimension(:), allocatable msub
Total number of data subsets in message.
integer, dimension(:), allocatable nsub
Current subset pointer within message.
Declare an array used to keep track of which logical units should not have any empty (zero data subse...
integer, dimension(:), allocatable msglim
Tracking index for each file ID.
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 an array used to store a switch for each file ID, indicating whether any BUFR messages should...
integer, dimension(:), allocatable null
Output switch for each file ID:
Declare arrays and variables used to store custom values for certain mnemonics within Sections 0 and ...
integer, dimension(:), allocatable ivmnem
Custom values for use within Sections 0 and 1 of all future output BUFR messages written to all Fortr...
integer ns01v
Number of custom values stored.
character *8, dimension(:), allocatable cmnem
Section 0 and 1 mnemonics corresponding to ivmnem.
Declare an array used to store a switch for each file ID, indicating whether BUFR messages read from ...
integer, dimension(:), allocatable isc3
Section 3 switch for each file ID:
Declare arrays and variables used to store the internal jump/link table.
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
Declare variables used to store tank receipt time information within Section 1 of BUFR messages.
character *1 ctrt
Flag indicating whether tank receipt times are to be included within output BUFR messages; this varia...
Declare an array used to store, for each file ID, the logical unit number corresponding to a separate...
integer, dimension(:), allocatable luncpy
Logical unit numbers used to copy long character strings between BUFR data subsets.
recursive subroutine status(lunit, lun, il, im)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
subroutine wtstat(lunit, lun, il, im)
Update file status in library internals.
subroutine padmsg(mesg, lmesg, npbyt)
Pad a BUFR message with zeroed-out bytes from the end of the message up to the next 8-byte boundary.
recursive subroutine maxout(maxo)
Specify the maximum length of a BUFR message that can be written to any output file by the NCEPLIBS-b...
integer function lmsg(sec0)
Given a character string containing Section 0 from a BUFR message, determine the array size (in integ...
logical function msgfull(msiz, itoadd, mxsiz)
Check whether the current data subset in the internal arrays will fit within the current BUFR message...
recursive subroutine openmg(lunit, subset, jdate)
Open and initialize a new BUFR message within internal arrays, for eventual output to logical unit lu...
recursive subroutine openmb(lunit, subset, jdate)
Open and initialize a new BUFR message within internal arrays, for eventual output to logical unit lu...
recursive subroutine closmg(lunin)
Close the BUFR message that is currently open for writing within internal arrays associated with logi...
recursive integer function nmsub(lunit)
Get the total number of data subsets available within the BUFR message that was most recently opened ...
integer function nmwrd(mbay)
Given an integer array containing Section 0 from a BUFR message, determine the array size (in integer...
integer function igetmxby()
Get the maximum length of a BUFR message that can be written to an output file by the NCEPLIBS-bufr s...
recursive subroutine readerme(mesg, lunit, subset, jdate, iret)
Read a BUFR message from a memory array.
recursive subroutine readmg(lunxx, subset, jdate, iret)
Read the next BUFR message from logical unit abs(lunxx) into internal arrays.
Definition: readwritemg.F90:44
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 ifbget(lunit)
Check whether there are any more data subsets available to be read from a BUFR message.
subroutine rdmsgw(lunit, mesg, iret)
Read the next BUFR message from logical unit lunit as an array of integer words.
recursive subroutine cnved4(msgin, lmsgot, msgot)
Convert a BUFR edition 3 message to BUFR edition 4.
recursive integer function ireadmg(lunit, subset, idate)
Call subroutine readmg() and pass back its return code as the function value.
subroutine msgini(lun)
Initialize, within the internal arrays, a new uncompressed BUFR message for output.
subroutine msgwrt(lunit, mesg, mgbyt)
Perform final checks and updates on a BUFR message before writing it to a specified Fortran logical u...
subroutine usrtpl(lun, invn, nbmp)
Expand a subset template within internal arrays.
subroutine cktaba(lun, subset, jdate, iret)
Get the Table A mnemonic from Sections 1 and 3 of a BUFR message.
Definition: s013vals.F90:1265
recursive integer function iupbs01(mbay, s01mnem)
Read a specified value from within Section 0 or Section 1 of a BUFR message.
Definition: s013vals.F90:247
recursive subroutine pkbs1(ival, mbay, s1mnem)
Write a specified value into a specified location within Section 1 of a BUFR message,...
Definition: s013vals.F90:520
recursive integer function iupbs3(mbay, s3mnem)
Read a specified value from within Section 3 of a BUFR message.
Definition: s013vals.F90:348
subroutine reads3(lun)
Read the Section 3 descriptors from the BUFR message in mbay(1,lun), then use the BUFR master tables ...
Definition: s013vals.F90:685
recursive integer function i4dy(idate)
Convert a date-time with a 2-digit year (YYMMDDHH) to a date-time with a 4-digit year (YYYYMMDDHH) us...
Definition: s013vals.F90:1065
recursive subroutine stndrd(lunit, msgin, lmsgot, msgot)
Standardize a BUFR message.
Definition: standard.F90:73
recursive subroutine atrcpt(msgin, lmsgot, msgot)
Read an input message and output an equivalent BUFR message with a tank receipt time added to Section...
Definition: tankrcpt.F90:24
subroutine x48(iin4, iout8, nval)
Encode one or more 4-byte integer values as 8-byte integer values.
Definition: x4884.F90:18
subroutine x84(iin8, iout4, nval)
Encode one or more 8-byte integer values as 4-byte integer values.
Definition: x4884.F90:65