NCEPLIBS-bufr  12.1.0
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
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 iprt, my_lunxx, lunit, lun, il, im, ier, idxmsg
58 
59  character*8, intent(out) :: subset
60  character*128 errstr
61 
62  common /quiet/ iprt
63 
64  ! Check for I8 integers
65 
66  if(im8b) then
67  im8b=.false.
68 
69  call x84(lunxx,my_lunxx,1)
70  call readmg(my_lunxx,subset,jdate,iret)
71  call x48(jdate,jdate,1)
72  call x48(iret,iret,1)
73 
74  im8b=.true.
75  return
76  endif
77 
78  iret = 0
79  lunit = abs(lunxx)
80 
81  ! Check the file status
82 
83  call status(lunit,lun,il,im)
84  if(il==0) call bort('BUFRLIB: READMG - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
85  if(il>0) call bort('BUFRLIB: READMG - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
86  call wtstat(lunit,lun,il,1)
87 
88  ! Read a message into the internal message buffer
89 
90  do while (.true.)
91  call rdmsgw(lunit,mbay(1,lun),ier)
92  if(ier==-1) then
93  ! EOF on attempted read
94  call wtstat(lunit,lun,il,0)
95  inode(lun) = 0
96  idate(lun) = 0
97  subset = ' '
98  jdate = 0
99  iret = -1
100  return
101  endif
102 
103  ! Parse the message section contents
104  if(isc3(lun)/=0) call reads3(lun)
105  call cktaba(lun,subset,jdate,iret)
106 
107  ! Check for a dictionary message
108  if(idxmsg(mbay(1,lun))/=1) return
109 
110  ! This is an internal dictionary message that was generated by the NCEPLIBS-bufr software.
111  if(isc3(lun)/=0) return
112 
113  ! Section 3 decoding isn't being used, so backspace the file pointer and then use subroutine rdbfdx() to read in
114  ! all such dictionary messages (they should be stored consecutively!) and reset the internal tables.
115  call backbufr_c(lun)
116  call rdbfdx(lunit,lun)
117  if(iprt>=1) then
118  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
119  errstr = 'BUFRLIB: READMG - INTERNAL DICTIONARY MESSAGE READ; ACCOUNT FOR IT THEN READ IN NEXT MESSAGE WITHOUT RETURNING'
120  call errwrt(errstr)
121  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
122  call errwrt(' ')
123  endif
124  enddo
125 
126 end subroutine readmg
127 
143 recursive integer function ireadmg(lunit,subset,idate) result(iret)
144 
145  use modv_vars, only: im8b
146 
147  implicit none
148 
149  integer, intent(in) :: lunit
150  integer, intent(out) :: idate
151  integer my_lunit
152 
153  character*8, intent(out) :: subset
154 
155  ! Check for I8 integers
156 
157  if(im8b) then
158  im8b=.false.
159 
160  call x84(lunit,my_lunit,1)
161  iret=ireadmg(my_lunit,subset,idate)
162  call x48(idate,idate,1)
163 
164  im8b=.true.
165  return
166  endif
167 
168  call readmg(lunit,subset,idate,iret)
169 
170  return
171 end function ireadmg
172 
216 recursive subroutine readerme(mesg,lunit,subset,jdate,iret)
217 
218  use modv_vars, only: mxmsgl, im8b, nbytw
219 
220  use moda_sc3bfr
221  use moda_idrdm
222  use moda_bitbuf
223 
224  implicit none
225 
226  integer, intent(in) :: lunit, mesg(*)
227  integer, intent(out) :: jdate, iret
228  integer iprt, my_lunit, iec0(2), lun, il, im, ii, lnmsg, lmsg, idxmsg, iupbs3
229 
230  character*8, intent(out) :: subset
231  character*8 sec0
232  character*128 errstr, bort_str
233 
234  logical endtbl
235 
236  equivalence(sec0,iec0)
237 
238  common /quiet/ iprt
239 
240  ! Check for I8 integers
241 
242  if(im8b) then
243  im8b=.false.
244 
245  call x84(lunit,my_lunit,1)
246  call readerme(mesg,my_lunit,subset,jdate,iret)
247  call x48(jdate,jdate,1)
248  call x48(iret,iret,1)
249 
250  im8b=.true.
251  return
252  endif
253 
254  iret = 0
255 
256  ! Check the file status
257 
258  call status(lunit,lun,il,im)
259  if(il==0) call bort('BUFRLIB: READERME - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
260  if(il>0) call bort('BUFRLIB: READERME - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
261  call wtstat(lunit,lun,il, 1)
262 
263  ! Copy the input message into the internal message buffer
264 
265  iec0(1) = mesg(1)
266  iec0(2) = mesg(2)
267  lnmsg = lmsg(sec0)
268  if(lnmsg*nbytw>mxmsgl) then
269  write(bort_str,'("BUFRLIB: READERME - INPUT BUFR MESSAGE LENGTH",1X,I6," BYTES) IS LARGER THAN '// &
270  'LIMIT OF ",I6," BYTES")') lnmsg*nbytw, mxmsgl
271  call bort(bort_str)
272  endif
273  do ii=1,lnmsg
274  mbay(ii,lun) = mesg(ii)
275  enddo
276 
277  ! Confirm that the first 4 bytes of SEC0 contain 'BUFR'.
278 
279  if(sec0(1:4)/='BUFR') &
280  call bort('BUFRLIB: READERME - FIRST 4 BYTES READ FROM RECORD NOT "BUFR", DOES NOT CONTAIN BUFR DATA')
281 
282  ! Parse the message section contents
283 
284  if(isc3(lun)/=0) call reads3(lun)
285  call cktaba(lun,subset,jdate,iret)
286  if(isc3(lun)/=0) return
287 
288  ! Check for a DX dictionary message
289 
290  ! A new DX dictionary table can be passed in as a consecutive set of DX dictionary messages. Each message should be passed
291  ! in one at a time, via input argument mesg during consecutive calls to this subroutine, and all such messages will be
292  ! treated as a single dictionary table up until the next message is passed in which either contains no data subsets or
293  ! else is a non-DX dictionary message.
294 
295  endtbl = .false.
296  if(idxmsg(mbay(1,lun))==1) then
297  ! This is a DX dictionary message that was generated by the NCEPLIBS-bufr software.
298  if(iupbs3(mbay(1,lun),'NSUB')==0) then
299  ! But it doesn't contain any actual dictionary information, so assume we've reached the end of the dictionary table.
300  if(idrdm(lun)>0) then
301  endtbl = .true.
302  endif
303  else
304  if(idrdm(lun)==0) then
305  ! This is the first DX dictionary message that is part of a new dictionary table.
306  call dxinit(lun,0)
307  endif
308  idrdm(lun) = idrdm(lun) + 1
309  call stbfdx(lun,mbay(1,lun))
310  endif
311  else if(idrdm(lun)>0) then
312  ! This is the first non-DX dictionary message received following a string of DX dictionary messages, so assume we've
313  ! reached the end of the dictionary table.
314  endtbl = .true.
315  endif
316 
317  if(endtbl) then
318  if ( iprt >= 2 ) then
319  call errwrt('+++++++++++++++++++++++++++++++++++++++++++++++++')
320  write ( unit=errstr, fmt='(A,I3,A)' ) &
321  'BUFRLIB: READERME - STORED NEW DX TABLE CONSISTING OF (', idrdm(lun), ') MESSAGES;'
322  call errwrt(errstr)
323  errstr = 'WILL APPLY THIS TABLE TO ALL SUBSEQUENT DATA MESSAGES UNTIL NEXT DX TABLE IS PASSED IN'
324  call errwrt(errstr)
325  call errwrt('+++++++++++++++++++++++++++++++++++++++++++++++++')
326  call errwrt(' ')
327  endif
328  idrdm(lun) = 0
329  call makestab
330  endif
331 
332  return
333 end subroutine readerme
334 
344 subroutine rdmsgw(lunit,mesg,iret)
345 
346  use bufrlib
347 
348  use modv_vars, only: mxmsgld4
349 
350  implicit none
351 
352  integer, intent(in) :: lunit
353  integer, intent(out) :: mesg(*), iret
354  integer lun, il, im
355 
356  call status(lunit,lun,il,im)
357  iret = -2
358  do while (iret<=-2)
359  iret = crdbufr_c(lun,mesg,mxmsgld4)
360  if(iret==-3) call errwrt('BUFRLIB: RDMSGW - SKIPPING OVERLARGE MESSAGE')
361  if(iret==-2) call errwrt('BUFRLIB: RDMSGW - SKIPPING CORRUPTED MESSAGE')
362  end do
363 
364  return
365 end subroutine rdmsgw
366 
396 recursive subroutine openmb(lunit,subset,jdate)
397 
398  use modv_vars, only: im8b
399 
400  use moda_msgcwd
401 
402  implicit none
403 
404  integer, intent(in) :: lunit, jdate
405  integer my_lunit, my_jdate, lun, il, im, mtyp, mstb, inod, i4dy
406 
407  character*(*), intent(in) :: subset
408 
409  logical open
410 
411  ! Check for I8 integers
412 
413  if(im8b) then
414  im8b=.false.
415 
416  call x84(lunit,my_lunit,1)
417  call x84(jdate,my_jdate,1)
418  call openmb(my_lunit,subset,my_jdate)
419 
420  im8b=.true.
421  return
422  endif
423 
424  ! Check the file status
425 
426  call status(lunit,lun,il,im)
427  if(il==0) call bort('BUFRLIB: OPENMB - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
428  if(il<0) call bort('BUFRLIB: OPENMB - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
429 
430  ! Get some subset particulars
431 
432  call nemtba(lun,subset,mtyp,mstb,inod)
433  open = im==0 .or. inod/=inode(lun) .or. i4dy(jdate)/=idate(lun)
434 
435  ! Maybe(?) open a new or different type of message
436 
437  if(open) then
438  call closmg(lunit)
439  call wtstat(lunit,lun,il, 1)
440  inode(lun) = inod
441  idate(lun) = i4dy(jdate)
442  ! Initialize the open message
443  call msgini(lun)
444  call usrtpl(lun,1,1)
445  endif
446 
447  return
448 end subroutine openmb
449 
468 recursive subroutine openmg(lunit,subset,jdate)
469 
470  use modv_vars, only: im8b
471 
472  use moda_msgcwd
473 
474  implicit none
475 
476  integer, intent(in) :: lunit, jdate
477  integer my_lunit, my_jdate, lun, il, im, mtyp, mstb, inod, i4dy
478 
479  character*(*), intent(in) :: subset
480 
481  ! Check for I8 integers
482 
483  if(im8b) then
484  im8b=.false.
485 
486  call x84(lunit,my_lunit,1)
487  call x84(jdate,my_jdate,1)
488  call openmg(my_lunit,subset,my_jdate)
489 
490  im8b=.true.
491  return
492  endif
493 
494  ! Check the file status
495 
496  call status(lunit,lun,il,im)
497  if(il==0) call bort('BUFRLIB: OPENMG - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
498  if(il<0) call bort('BUFRLIB: OPENMG - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
499  if(im/=0) call closmg(lunit)
500  call wtstat(lunit,lun,il, 1)
501 
502  ! Get some subset particulars
503 
504  call nemtba(lun,subset,mtyp,mstb,inod)
505  inode(lun) = inod
506  idate(lun) = i4dy(jdate)
507 
508  ! Initialize the open message
509 
510  call msgini(lun)
511  call usrtpl(lun,1,1)
512 
513  return
514 end subroutine openmg
515 
532 recursive subroutine closmg(lunin)
533 
534  use modv_vars, only: im8b
535 
536  use moda_msgcwd
537  use moda_msglim
538  use moda_bitbuf
539 
540  implicit none
541 
542  integer, intent(in) :: lunin
543  integer my_lunin, lunit, lun, il, im
544 
545  ! Check for I8 integers
546 
547  if(im8b) then
548  im8b=.false.
549 
550  call x84(lunin,my_lunin,1)
551  call closmg(my_lunin)
552 
553  im8b=.true.
554  return
555  endif
556 
557  ! Check the file status
558 
559  lunit = abs(lunin)
560  call status(lunit,lun,il,im)
561  if(lunit/=lunin) msglim(lun) = 0
562  if(il==0) call bort('BUFRLIB: CLOSMG - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
563  if(il<0) call bort('BUFRLIB: CLOSMG - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
564  if(im/=0) then
565  if(nsub(lun)>0) then
566  call msgwrt(lunit,mbay(1,lun),mbyt(lun))
567  else if(nsub(lun)==0.and.nmsg(lun)<msglim(lun)) then
568  call msgwrt(lunit,mbay(1,lun),mbyt(lun))
569  else if(nsub(lun)<0) then
570  call wrcmps(-lunit)
571  endif
572  endif
573  call wtstat(lunit,lun,il,0)
574 
575  return
576 end subroutine closmg
577 
597 subroutine msgwrt(lunit,mesg,mgbyt)
598 
599  use bufrlib
600 
601  use modv_vars, only: mxmsgld4
602 
603  use moda_nulbfr
604  use moda_bufrmg
605  use moda_mgwa
606  use moda_mgwb
607  use moda_s01cm
608  use moda_tnkrcp
609  use moda_msgstd
610 
611  implicit none
612 
613  integer, intent(in) :: lunit, mgbyt, mesg(*)
614  integer iprt, iec0(2), mbyt, ibit, kbit, ii, jj, len0, len1, len2, len3, len4, l5, iad4, iad5, lun, il, im, npbyt, mwrd, &
615  nmwrd, iupbs01, idxmsg
616 
617  character*128 errstr
618  character*4 bufr, sevn
619 
620  common /quiet/ iprt
621 
622  data bufr /'BUFR'/
623  data sevn /'7777'/
624 
625  ! Make a local copy of the input message for use within this subroutine, since internal calls to any or all of the
626  ! subroutines stndrd(), cnved4(), pkbs1(), atrcpt(), etc. may end up modifying the message before it finally gets
627  ! written out to lunit.
628 
629  mbyt = mgbyt
630 
631  iec0(1) = mesg(1)
632  iec0(2) = mesg(2)
633  ibit = 32
634  call pkb(mbyt,24,iec0,ibit)
635 
636  do ii = 1, nmwrd(iec0)
637  mgwa(ii) = mesg(ii)
638  enddo
639 
640  ! Overwrite any values within Section 0 or Section 1 that were requested via previous calls to pkvs01(). If a request
641  ! was made to change the BUFR edition number to 4, then actually convert the message as well.
642 
643  if(ns01v>0) then
644  do jj=1,ns01v
645  if(cmnem(jj)=='BEN') then
646  if(ivmnem(jj)==4) then
647  ! Install Section 0 byte count for use by cnved4()
648  ibit = 32
649  call pkb(mbyt,24,mgwa,ibit)
650  call cnved4(mgwa,mxmsgld4,mgwb)
651  ! Compute mbyt for the new edition 4 message
652  mbyt = iupbs01(mgwb,'LENM')
653  ! Copy the mgwb array back into mgwa
654  do ii = 1, nmwrd(mgwb)
655  mgwa(ii) = mgwb(ii)
656  enddo
657  endif
658  else
659  ! Overwrite the requested value
660  call pkbs1(ivmnem(jj),mgwa,cmnem(jj))
661  endif
662  enddo
663  endif
664 
665  ! Standardize the message if requested via module @ref moda_msgstd. However, we don't want to do this if the message
666  ! contains DX BUFR table information, because in that case it's already standard.
667 
668  if ( ( csmf=='Y' ) .and. ( idxmsg(mgwa)/=1 ) ) then
669  ! Install Section 0 byte count and Section 5 '7777' into the original message. This is necessary because
670  ! subroutine stndrd() requires a complete and well-formed BUFR message as its input.
671  ibit = 32
672  call pkb(mbyt,24,mgwa,ibit)
673  ibit = (mbyt-4)*8
674  call pkc(sevn,4,mgwa,ibit)
675  call stndrd(lunit,mgwa,mxmsgld4,mgwb)
676  ! Compute mbyt for the new standardized message
677  mbyt = iupbs01(mgwb,'LENM')
678  ! Copy the mgwb array back into mgwa
679  do ii = 1, nmwrd(mgwb)
680  mgwa(ii) = mgwb(ii)
681  enddo
682  endif
683 
684  ! Append the tank receipt time to Section 1 if requested via module @ref moda_tnkrcp, unless the message contains
685  ! DX BUFR table information.
686 
687  if ( ( ctrt=='Y' ) .and. ( idxmsg(mgwa)/=1 ) ) then
688  ! Install Section 0 byte count for use by subroutine atrcpt()
689  ibit = 32
690  call pkb(mbyt,24,mgwa,ibit)
691  call atrcpt(mgwa,mxmsgld4,mgwb)
692  ! Compute mbyt for the revised message
693  mbyt = iupbs01(mgwb,'LENM')
694  ! Copy the mgwb array back into mgwa
695  do ii = 1, nmwrd(mgwb)
696  mgwa(ii) = mgwb(ii)
697  enddo
698  endif
699 
700  ! Get the section lengths.
701 
702  call getlens(mgwa,4,len0,len1,len2,len3,len4,l5)
703 
704  ! Depending on the edition number of the message, we need to ensure that each section within the message has an even
705  ! number of bytes.
706 
707  if(iupbs01(mgwa,'BEN')<4) then
708  if(mod(len1,2)/=0) call bort ('BUFRLIB: MSGWRT - LENGTH OF SECTION 1 IS NOT A MULTIPLE OF 2')
709  if(mod(len2,2)/=0) call bort ('BUFRLIB: MSGWRT - LENGTH OF SECTION 2 IS NOT A MULTIPLE OF 2')
710  if(mod(len3,2)/=0) call bort ('BUFRLIB: MSGWRT - LENGTH OF SECTION 3 IS NOT A MULTIPLE OF 2')
711  if(mod(len4,2)/=0) then
712  ! Pad Section 4 with an additional byte that is zeroed out
713  iad4 = len0+len1+len2+len3
714  iad5 = iad4+len4
715  ibit = iad4*8
716  len4 = len4+1
717  call pkb(len4,24,mgwa,ibit)
718  ibit = iad5*8
719  call pkb(0,8,mgwa,ibit)
720  mbyt = mbyt+1
721  endif
722  endif
723 
724  ! Write Section 0 byte count and Section 5
725 
726  ibit = 0
727  call pkc(bufr, 4,mgwa,ibit)
728  call pkb(mbyt,24,mgwa,ibit)
729 
730  kbit = (mbyt-4)*8
731  call pkc(sevn, 4,mgwa,kbit)
732 
733  ! Zero out the extra bytes which will be written. Note that the BUFR message is stored within the integer array mgwa(*),
734  ! (rather than within a character array), so we need to make sure that the "7777" Is followed by zeroed-out bytes up to
735  ! the boundary of the last machine word that will be written out.
736 
737  call padmsg(mgwa,mxmsgld4,npbyt)
738 
739  ! Write the message plus padding to a word boundary if null(lun) = 0
740 
741  mwrd = nmwrd(mgwa)
742  call status(lunit,lun,il,im)
743  if(null(lun)==0) then
744  call blocks(mgwa,mwrd)
745  call cwrbufr_c(lun,mgwa,mwrd)
746  endif
747 
748  if(iprt>=2) then
749  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
750  write ( unit=errstr, fmt='(A,I4,A,I7)') 'BUFRLIB: MSGWRT: LUNIT =', lunit, ', BYTES =', mbyt+npbyt
751  call errwrt(errstr)
752  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
753  call errwrt(' ')
754  endif
755 
756  ! Save a memory copy of this message, unless it's a DX message.
757 
758  if(idxmsg(mgwa)/=1) then
759  ! Store a copy of this message within module @ref moda_bufrmg, for possible later retrieval during a future call to
760  ! subroutine writsa()
761  msglen(lun) = mwrd
762  do ii=1,msglen(lun)
763  msgtxt(ii,lun) = mgwa(ii)
764  enddo
765  endif
766 
767  return
768 end subroutine msgwrt
769 
777 subroutine msgini(lun)
778 
779  use moda_msgcwd
780  use moda_ufbcpl
781  use moda_bitbuf
782  use moda_tables
783 
784  implicit none
785 
786  integer, intent(in) :: lun
787  integer ibct, ipd1, ipd2, ipd3, ipd4, nby0, nby1, nby2, nby3, nby4, nby5, nbyt, mtyp, msbt, inod, isub, iret, &
788  mcen, mear, mmon, mday, mour, mmin, mbit
789 
790  character*128 bort_str
791  character*8 subtag
792  character*4 bufr, sevn
793  character tab
794 
795  data bufr /'BUFR'/
796  data sevn /'7777'/
797 
798  common /padesc/ ibct,ipd1,ipd2,ipd3,ipd4
799  common /msgptr/ nby0,nby1,nby2,nby3,nby4,nby5
800 
801  ! Get the message tag and type, and break up the date
802 
803  subtag = tag(inode(lun))(1:8)
804  call nemtba(lun,subtag,mtyp,msbt,inod)
805  if(inode(lun)/=inod) then
806  write(bort_str,'("BUFRLIB: MSGINI - MISMATCH BETWEEN INODE (=",I7,") & POSITIONAL INDEX, INOD (",I7,") '// &
807  'OF SUBTAG (",A,") IN DICTIONARY")') inode(lun), inod, subtag
808  call bort(bort_str)
809  endif
810  call nemtab(lun,subtag,isub,tab,iret)
811  if(iret==0) then
812  write(bort_str,'("BUFRLIB: MSGINI - TABLE A MESSAGE TYPE MNEMONIC ",A," NOT FOUND IN INTERNAL TABLE D ARRAYS")') subtag
813  call bort(bort_str)
814  endif
815 
816  ! Date can be YYMMDDHH or YYYYMMDDHH
817 
818  mcen = mod(idate(lun)/10**8,100)+1
819  mear = mod(idate(lun)/10**6,100)
820  mmon = mod(idate(lun)/10**4,100)
821  mday = mod(idate(lun)/10**2,100)
822  mour = mod(idate(lun) ,100)
823  mmin = 0
824 
825  if(mcen==1) call bort ('BUFRLIB: MSGINI - BUFR MESSAGE DATE (IDATE) is 0000000000')
826 
827  if(mear==0) mcen = mcen-1
828  if(mear==0) mear = 100
829 
830  ! Initialize the message
831 
832  mbit = 0
833  nby0 = 8
834  nby1 = 18
835  nby2 = 0
836  nby3 = 20
837  nby4 = 4
838  nby5 = 4
839  nbyt = nby0+nby1+nby2+nby3+nby4+nby5
840 
841  ! Section 0
842 
843  call pkc(bufr , 4 , mbay(1,lun),mbit)
844  call pkb(nbyt , 24 , mbay(1,lun),mbit)
845  call pkb( 3 , 8 , mbay(1,lun),mbit)
846 
847  ! Section 1
848 
849  call pkb(nby1 , 24 , mbay(1,lun),mbit)
850  call pkb( 0 , 8 , mbay(1,lun),mbit)
851  call pkb( 3 , 8 , mbay(1,lun),mbit)
852  call pkb( 7 , 8 , mbay(1,lun),mbit)
853  call pkb( 0 , 8 , mbay(1,lun),mbit)
854  call pkb( 0 , 8 , mbay(1,lun),mbit)
855  call pkb(mtyp , 8 , mbay(1,lun),mbit)
856  call pkb(msbt , 8 , mbay(1,lun),mbit)
857  call pkb( 36 , 8 , mbay(1,lun),mbit)
858  call pkb( 0 , 8 , mbay(1,lun),mbit)
859  call pkb(mear , 8 , mbay(1,lun),mbit)
860  call pkb(mmon , 8 , mbay(1,lun),mbit)
861  call pkb(mday , 8 , mbay(1,lun),mbit)
862  call pkb(mour , 8 , mbay(1,lun),mbit)
863  call pkb(mmin , 8 , mbay(1,lun),mbit)
864  call pkb(mcen , 8 , mbay(1,lun),mbit)
865 
866  ! Section 3
867 
868  call pkb(nby3 , 24 , mbay(1,lun),mbit)
869  call pkb( 0 , 8 , mbay(1,lun),mbit)
870  call pkb( 0 , 16 , mbay(1,lun),mbit)
871  call pkb(2**7 , 8 , mbay(1,lun),mbit)
872  call pkb(ibct , 16 , mbay(1,lun),mbit)
873  call pkb(isub , 16 , mbay(1,lun),mbit)
874  call pkb(ipd1 , 16 , mbay(1,lun),mbit)
875  call pkb(ipd2 , 16 , mbay(1,lun),mbit)
876  call pkb(ipd3 , 16 , mbay(1,lun),mbit)
877  call pkb(ipd4 , 16 , mbay(1,lun),mbit)
878  call pkb( 0 , 8 , mbay(1,lun),mbit)
879 
880  ! Section 4
881 
882  call pkb(nby4 , 24 , mbay(1,lun),mbit)
883  call pkb( 0 , 8 , mbay(1,lun),mbit)
884 
885  ! Section 5
886 
887  call pkc(sevn , 4 , mbay(1,lun),mbit)
888 
889  ! Double check initial message length
890 
891  if(mod(mbit,8)/=0) call bort('BUFRLIB: MSGINI - INITIALIZED MESSAGE DOES NOT END ON A BYTE BOUNDARY')
892  if(mbit/8/=nbyt) then
893  write(bort_str,'("BUFRLIB: MSGINI - NUMBER OF BYTES STORED FOR INITIALIZED MESSAGE (",I6,") IS NOT THE SAME AS FIRST '// &
894  'CALCULATED, NBYT (",I6)') mbit/8, nbyt
895  call bort(bort_str)
896  endif
897 
898  nmsg(lun) = nmsg(lun)+1
899  nsub(lun) = 0
900  mbyt(lun) = nbyt
901 
902  luncpy(lun)=0
903 
904  return
905 end subroutine msgini
906 
917 logical function msgfull(msiz,itoadd,mxsiz) result(bool)
918 
919  use modv_vars, only: maxnc
920 
921  use moda_tnkrcp
922  use moda_msgstd
923 
924  implicit none
925 
926  integer, intent(in) :: msiz, itoadd, mxsiz
927  integer iwgbyt
928 
929  ! Allow for at least 11 additional bytes of "wiggle room" in the message, because subroutine msgwrt() may do any or all
930  ! of the following:
931  ! 3 bytes may be added by a call to subroutine cnved4()
932  ! + 1 byte (at most) of padding may be added to Section 4
933  ! + 7 bytes (at most) of padding may be added up to the next word boundary after Section 5
934  ! ----
935  ! 11
936  iwgbyt = 11
937 
938  ! But subroutine msgwrt() may also do any of all of the following:
939 
940  ! 6 bytes may be added by a call to subroutine atrcpt()
941  if(ctrt=='Y') iwgbyt = iwgbyt + 6
942 
943  ! (maxnc*2) bytes (at most) may be added by a call to subroutine stndrd()
944  if(csmf=='Y') iwgbyt = iwgbyt + (maxnc*2)
945 
946  ! Determine whether the subset will fit.
947 
948  if ( ( msiz + itoadd + iwgbyt ) > mxsiz ) then
949  bool = .true.
950  else
951  bool = .false.
952  endif
953 
954  return
955 end function msgfull
956 
974 recursive subroutine maxout(maxo)
975 
976  use modv_vars, only: mxmsgl, im8b
977 
978  use moda_bitbuf
979 
980  implicit none
981 
982  integer, intent(in) :: maxo
983  integer my_maxo, iprt, newsiz, maxdx, idxv, nxstr, ldxa, ldxb, ldxd, ld30
984 
985  character*128 errstr
986  character*56 dxstr
987 
988  common /dxtab/ maxdx,idxv,nxstr(10),ldxa(10),ldxb(10),ldxd(10),ld30(10),dxstr(10)
989  common /quiet/ iprt
990 
991  ! Check for I8 integers
992 
993  if(im8b) then
994  im8b=.false.
995 
996  call x84(maxo,my_maxo,1)
997  call maxout(my_maxo)
998 
999  im8b=.true.
1000  return
1001  endif
1002 
1003  if((maxo==0).or.(maxo>mxmsgl)) then
1004  newsiz = mxmsgl
1005  else
1006  newsiz = maxo
1007  endif
1008 
1009  if(iprt>=0) then
1010  if(maxbyt/=newsiz) then
1011  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
1012  write ( unit=errstr, fmt='(A,A,I7,A,I7)' ) 'BUFRLIB: MAXOUT - THE RECORD LENGTH OF ALL BUFR MESSAGES ',&
1013  'CREATED FROM THIS POINT ON IS BEING CHANGED FROM ', maxbyt, ' TO ', newsiz
1014  call errwrt(errstr)
1015  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
1016  call errwrt(' ')
1017  endif
1018  endif
1019 
1020  maxbyt = newsiz
1021  maxdx = newsiz
1022 
1023  return
1024 end subroutine maxout
1025 
1034 integer function igetmxby() result(iret)
1035 
1036  use moda_bitbuf
1037 
1038  implicit none
1039 
1040  iret = maxbyt
1041 
1042  return
1043 end function igetmxby
1044 
1055 subroutine padmsg(mesg,lmesg,npbyt)
1056 
1057  use modv_vars, only: nbytw
1058 
1059  implicit none
1060 
1061  integer, intent(in) :: lmesg
1062  integer, intent(inout) :: mesg(*)
1063  integer, intent(out) :: npbyt
1064  integer nmw, nmb, ibit, i, nmwrd, iupbs01
1065 
1066  ! Make sure that the array is big enough to hold the additional byte padding that will be appended to the
1067  ! end of the message.
1068 
1069  nmw = nmwrd(mesg)
1070  if(nmw>lmesg) call bort('BUFRLIB: PADMSG - CANNOT ADD PADDING TO MESSAGE ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
1071 
1072  ! Pad from the end of the message up to the next 8-byte boundary.
1073 
1074  nmb = iupbs01(mesg,'LENM')
1075  ibit = nmb*8
1076  npbyt = ( nmw * nbytw ) - nmb
1077  do i = 1, npbyt
1078  call pkb(0,8,mesg,ibit)
1079  enddo
1080 
1081  return
1082 end subroutine padmsg
1083 
1094 recursive integer function nmsub(lunit) result(iret)
1095 
1096  use modv_vars, only: im8b
1097 
1098  use moda_msgcwd
1099 
1100  implicit none
1101 
1102  integer, intent(in) :: lunit
1103  integer my_lunit, lun, il, im
1104 
1105  ! Check for I8 integers
1106 
1107  if(im8b) then
1108  im8b=.false.
1109 
1110  call x84(lunit,my_lunit,1)
1111  iret=nmsub(my_lunit)
1112 
1113  im8b=.true.
1114  return
1115  endif
1116 
1117  iret = 0
1118 
1119  ! Check the file status
1120 
1121  call status(lunit,lun,il,im)
1122  if(il==0) call bort('BUFRLIB: NMSUB - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
1123  if(il>0) call bort('BUFRLIB: NMSUB - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
1124  if(im==0) call bort('BUFRLIB: NMSUB - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
1125 
1126  iret = msub(lun)
1127 
1128  return
1129 end function nmsub
1130 
1144 integer function nmwrd(mbay) result(iret)
1145 
1146  use modv_vars, only: nbytw
1147 
1148  implicit none
1149 
1150  integer, intent(in) :: mbay(*)
1151  integer lenm, iupbs01
1152 
1153  lenm = iupbs01(mbay,'LENM')
1154  if(lenm==0) then
1155  iret = 0
1156  else
1157  iret = ((lenm/8)+1)*(8/nbytw)
1158  endif
1159 
1160  return
1161 end function nmwrd
1162 
1176 integer function lmsg(sec0) result(iret)
1177 
1178  implicit none
1179 
1180  integer msec0(2), nmwrd
1181 
1182  character*8, intent(in) :: sec0
1183  character*8 csec0
1184 
1185  equivalence(msec0,csec0)
1186 
1187  csec0 = sec0
1188  iret = nmwrd(msec0)
1189 
1190  return
1191 end function lmsg
1192 
1212 recursive subroutine getlens (mbay,ll,len0,len1,len2,len3,len4,len5)
1213 
1214  use modv_vars, only: im8b
1215 
1216  implicit none
1217 
1218  integer, intent(in) :: mbay(*), ll
1219  integer, intent(out) :: len0, len1, len2, len3, len4, len5
1220  integer my_ll, iad2, iad3, iad4, iupbs01, iupb
1221 
1222  ! Check for I8 integers.
1223  if(im8b) then
1224  im8b=.false.
1225  call x84(ll,my_ll,1)
1226  call getlens(mbay,my_ll,len0,len1,len2,len3,len4,len5)
1227  call x48(len0,len0,1)
1228  call x48(len1,len1,1)
1229  call x48(len2,len2,1)
1230  call x48(len3,len3,1)
1231  call x48(len4,len4,1)
1232  call x48(len5,len5,1)
1233  im8b=.true.
1234  return
1235  endif
1236 
1237  len0 = -1
1238  len1 = -1
1239  len2 = -1
1240  len3 = -1
1241  len4 = -1
1242  len5 = -1
1243 
1244  if(ll<0) return
1245  len0 = iupbs01(mbay,'LEN0')
1246 
1247  if(ll<1) return
1248  len1 = iupbs01(mbay,'LEN1')
1249 
1250  if(ll<2) return
1251  iad2 = len0 + len1
1252  len2 = iupb(mbay,iad2+1,24) * iupbs01(mbay,'ISC2')
1253 
1254  if(ll<3) return
1255  iad3 = iad2 + len2
1256  len3 = iupb(mbay,iad3+1,24)
1257 
1258  if(ll<4) return
1259  iad4 = iad3 + len3
1260  len4 = iupb(mbay,iad4+1,24)
1261 
1262  if(ll<5) return
1263  len5 = 4
1264 
1265  return
1266 end subroutine getlens
1267 
1292 recursive subroutine cnved4(msgin,lmsgot,msgot)
1293 
1294  use modv_vars, only: im8b, nbytw
1295 
1296  implicit none
1297 
1298  integer, intent(in) :: msgin(*), lmsgot
1299  integer, intent(out) :: msgot(*)
1300  integer my_lmsgot, i, nmw, len0, len1, len2, len3, l4, l5, iad2, iad4, lenm, lenmot, len1ot, len3ot, ibit, iupbs01, nmwrd
1301 
1302  ! Check for I8 integers.
1303 
1304  if(im8b) then
1305  im8b=.false.
1306  call x84 ( lmsgot, my_lmsgot, 1 )
1307  call cnved4 ( msgin, my_lmsgot*2, msgot )
1308  im8b=.true.
1309  return
1310  endif
1311 
1312  if(iupbs01(msgin,'BEN')==4) then
1313 
1314  ! The input message is already encoded using edition 4, so just copy it from msgin to msgot and then return.
1315 
1316  nmw = nmwrd(msgin)
1317  if(nmw>lmsgot) &
1318  call bort('BUFRLIB: CNVED4 - OVERFLOW OF OUTPUT (EDITION 4) MESSAGE ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
1319  do i = 1, nmw
1320  msgot(i) = msgin(i)
1321  enddo
1322  return
1323  endif
1324 
1325  ! Get some section lengths and addresses from the input message.
1326 
1327  call getlens(msgin,3,len0,len1,len2,len3,l4,l5)
1328 
1329  iad2 = len0 + len1
1330  iad4 = iad2 + len2 + len3
1331 
1332  lenm = iupbs01(msgin,'LENM')
1333 
1334  ! Check for overflow of the output array. Note that the new edition 4 message will be a total of 3 bytes longer than the
1335  ! input message (i.e. 4 more bytes in Section 1, but 1 fewer byte in Section 3).
1336 
1337  lenmot = lenm + 3
1338  if(lenmot>(lmsgot*nbytw)) &
1339  call bort('BUFRLIB: CNVED4 - OVERFLOW OF OUTPUT (EDITION 4) MESSAGE ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
1340 
1341  len1ot = len1 + 4
1342  len3ot = len3 - 1
1343 
1344  ! Write Section 0 of the new message into the output array.
1345 
1346  call mvb ( msgin, 1, msgot, 1, 4 )
1347  ibit = 32
1348  call pkb ( lenmot, 24, msgot, ibit )
1349  call pkb ( 4, 8, msgot, ibit )
1350 
1351  ! Write Section 1 of the new message into the output array.
1352 
1353  call pkb ( len1ot, 24, msgot, ibit )
1354  call pkb ( iupbs01(msgin,'BMT'), 8, msgot, ibit )
1355  call pkb ( iupbs01(msgin,'OGCE'), 16, msgot, ibit )
1356  call pkb ( iupbs01(msgin,'GSES'), 16, msgot, ibit )
1357  call pkb ( iupbs01(msgin,'USN'), 8, msgot, ibit )
1358  call pkb ( iupbs01(msgin,'ISC2')*128, 8, msgot, ibit )
1359  call pkb ( iupbs01(msgin,'MTYP'), 8, msgot, ibit )
1360  ! Set a default of 255 for the international subcategory.
1361  call pkb ( 255, 8, msgot, ibit )
1362  call pkb ( iupbs01(msgin,'MSBT'), 8, msgot, ibit )
1363  call pkb ( iupbs01(msgin,'MTV'), 8, msgot, ibit )
1364  call pkb ( iupbs01(msgin,'MTVL'), 8, msgot, ibit )
1365  call pkb ( iupbs01(msgin,'YEAR'), 16, msgot, ibit )
1366  call pkb ( iupbs01(msgin,'MNTH'), 8, msgot, ibit )
1367  call pkb ( iupbs01(msgin,'DAYS'), 8, msgot, ibit )
1368  call pkb ( iupbs01(msgin,'HOUR'), 8, msgot, ibit )
1369  call pkb ( iupbs01(msgin,'MINU'), 8, msgot, ibit )
1370  ! Set a default of 0 for the second.
1371  call pkb ( 0, 8, msgot, ibit )
1372 
1373  ! Copy Section 2 (if it exists) through the next-to-last byte of Section 3 from the input array to the output array.
1374 
1375  call mvb ( msgin, iad2+1, msgot, (ibit/8)+1, len2+len3-1 )
1376 
1377  ! Store the length of the new Section 3.
1378 
1379  ibit = ( len0 + len1ot + len2 ) * 8
1380  call pkb ( len3ot, 24, msgot, ibit )
1381 
1382  ! Copy Section 4 and Section 5 from the input array to the output array.
1383 
1384  ibit = ibit + ( len3ot * 8 ) - 24
1385  call mvb ( msgin, iad4+1, msgot, (ibit/8)+1, lenm-iad4 )
1386 
1387  return
1388 end subroutine cnved4
1389 
1401 recursive integer function ifbget(lunit) result(iret)
1402 
1403  use modv_vars, only: im8b
1404 
1405  use moda_msgcwd
1406 
1407  implicit none
1408 
1409  integer, intent(in) :: lunit
1410  integer my_lunit, lun, il, im
1411 
1412  ! Check for I8 integers
1413 
1414  if(im8b) then
1415  im8b=.false.
1416  call x84(lunit,my_lunit,1)
1417  iret=ifbget(my_lunit)
1418  im8b=.true.
1419  return
1420  endif
1421 
1422  iret = -1
1423 
1424  ! Make sure a file/message is open for input
1425 
1426  call status(lunit,lun,il,im)
1427  if(il==0) call bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
1428  if(il>0) call bort('BUFRLIB: IFBGET - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
1429  if(im==0) call bort('BUFRLIB: IFBGET - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
1430 
1431  ! Check if there's another subset in the message
1432 
1433  if(nsub(lun)<msub(lun)) iret = 0
1434 
1435  return
1436 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:387
subroutine mvb(ib1, nb1, ib2, nb2, nbm)
Copy a specified number of bytes from one packed binary array to another.
Definition: copydata.F90:731
subroutine nemtba(lun, nemo, mtyp, msbt, inod)
Get information about a Table A descriptor from the internal DX BUFR tables.
Definition: dxtable.F90:1247
subroutine stbfdx(lun, mesg)
Copy a DX BUFR tables message into the internal memory arrays in module moda_tababd.
Definition: dxtable.F90:990
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:1123
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:432
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:1272
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:521
recursive integer function iupbs3(mbay, s3mnem)
Read a specified value from within Section 3 of a BUFR message.
Definition: s013vals.F90:349
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:686
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:1070
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