NCEPLIBS-bufr  12.3.0
s013vals.F90
Go to the documentation of this file.
1 
5 
47 recursive subroutine gets1loc(s1mnem,iben,isbyt,iwid,iret)
48 
49  use modv_vars, only: im8b
50 
51  implicit none
52 
53  character*(*), intent(in) :: s1mnem
54 
55  integer, intent(in) :: iben
56  integer, intent(out) :: isbyt, iwid, iret
57  integer my_iben
58 
59  ! Check for I8 integers.
60 
61  if(im8b) then
62  im8b=.false.
63  call x84(iben,my_iben,1)
64  call gets1loc(s1mnem,my_iben,isbyt,iwid,iret)
65  call x48(isbyt,isbyt,1)
66  call x48(iwid,iwid,1)
67  call x48(iret,iret,1)
68  im8b=.true.
69  return
70  endif
71 
72  iret = 0
73  iwid = 8
74 
75  if(s1mnem=='LEN1') then
76  isbyt = 1
77  iwid = 24
78  else if(s1mnem=='BMT') then
79  isbyt = 4
80  else if(s1mnem=='OGCE') then
81  if(iben==3) then
82  isbyt = 6
83  else
84  ! Note that this location is actually the same for both edition 2 and edition 4 of BUFR
85  isbyt = 5
86  iwid = 16
87  endif
88  else if(s1mnem=='GSES') then
89  if(iben==3) then
90  isbyt = 5
91  else if(iben==4) then
92  isbyt = 7
93  iwid = 16
94  else
95  iret = -1
96  endif
97  else if(s1mnem=='USN') then
98  if(iben==4) then
99  isbyt = 9
100  else
101  isbyt = 7
102  endif
103  else if(s1mnem=='ISC2') then
104  iwid = 1
105  if(iben==4) then
106  isbyt = 10
107  else
108  isbyt = 8
109  endif
110  else if(s1mnem=='MTYP') then
111  if(iben==4) then
112  isbyt = 11
113  else
114  isbyt = 9
115  endif
116  else if(s1mnem=='MSBTI') then
117  if(iben==4) then
118  isbyt = 12
119  else
120  iret = -1
121  endif
122  else if(s1mnem=='MSBT') then
123  if(iben==4) then
124  isbyt = 13
125  else
126  isbyt = 10
127  endif
128  else if(s1mnem=='MTV') then
129  if(iben==4) then
130  isbyt = 14
131  else
132  isbyt = 11
133  endif
134  else if(s1mnem=='MTVL') then
135  if(iben==4) then
136  isbyt = 15
137  else
138  isbyt = 12
139  endif
140  else if(s1mnem=='YEAR') then
141  if(iben==4) then
142  isbyt = 16
143  iwid = 16
144  else
145  iret = -1
146  endif
147  else if(s1mnem=='YCEN') then
148  if(iben<4) then
149  isbyt = 13
150  else
151  iret = -1
152  endif
153  else if(s1mnem=='CENT') then
154  if(iben<4) then
155  isbyt = 18
156  else
157  iret = -1
158  endif
159  else if(s1mnem=='MNTH') then
160  if(iben==4) then
161  isbyt = 18
162  else
163  isbyt = 14
164  endif
165  else if(s1mnem=='DAYS') then
166  if(iben==4) then
167  isbyt = 19
168  else
169  isbyt = 15
170  endif
171  else if(s1mnem=='HOUR') then
172  if(iben==4) then
173  isbyt = 20
174  else
175  isbyt = 16
176  endif
177  else if(s1mnem=='MINU') then
178  if(iben==4) then
179  isbyt = 21
180  else
181  isbyt = 17
182  endif
183  else if(s1mnem=='SECO') then
184  if(iben==4) then
185  isbyt = 22
186  else
187  iret = -1
188  endif
189  else
190  iret = -1
191  endif
192 
193  return
194 end subroutine gets1loc
195 
244 recursive integer function iupbs01(mbay,s01mnem) result(iret)
245 
246  use modv_vars, only: im8b, nby0
247 
248  implicit none
249 
250  character*(*), intent(in) :: s01mnem
251 
252  integer, intent(in) :: mbay(*)
253  integer ival, iupb, i4dy, iben, isbyt, iwid, iretgs, iyoc, icen
254 
255  logical ok4cent
256 
257  ! This statement function checks whether its input value contains a valid century value.
258  ok4cent(ival) = ((ival>=19).and.(ival<=21))
259 
260  ! Check for I8 integers.
261 
262  if(im8b) then
263  im8b=.false.
264  iret = iupbs01(mbay,s01mnem)
265  im8b=.true.
266  return
267  endif
268 
269  ! Handle some simple requests that do not depend on the BUFR edition number.
270 
271  if(s01mnem=='LENM') then
272  iret = iupb(mbay,5,24)
273  return
274  endif
275 
276  if(s01mnem=='LEN0') then
277  iret = nby0
278  return
279  endif
280 
281  ! Get the BUFR edition number.
282 
283  iben = iupb(mbay,8,8)
284  if(s01mnem=='BEN') then
285  iret = iben
286  return
287  endif
288 
289  ! Use the BUFR edition number to handle any other requests.
290 
291  call gets1loc(s01mnem,iben,isbyt,iwid,iretgs)
292  if(iretgs==0) then
293  iret = iupb(mbay,nby0+isbyt,iwid)
294  if(s01mnem=='CENT') then
295 
296  ! Test whether the returned value was a valid century value.
297 
298  if(.not.ok4cent(iret)) iret = -1
299  endif
300  else if( (s01mnem=='YEAR') .and. (iben<4) ) then
301 
302  ! Calculate the 4-digit year.
303 
304  iyoc = iupb(mbay,21,8)
305  icen = iupb(mbay,26,8)
306 
307  ! Does icen contain a valid century value?
308 
309  if(ok4cent(icen)) then
310  ! YES, so use it to calculate the 4-digit year. Note that, by international convention, the year 2000 was the 100th
311  ! year of the 20th century, and the year 2001 was the 1st year of the 21st century
312  iret = (icen-1)*100 + iyoc
313  else
314  ! NO, so use a windowing technique to determine the 4-digit year from the year of the century.
315  iret = i4dy(mod(iyoc,100)*1000000)/10**6
316  endif
317  else
318  iret = -1
319  endif
320 
321  return
322 end function iupbs01
323 
343 recursive integer function iupbs3(mbay,s3mnem) result(iret)
344 
345  use modv_vars, only: im8b
346 
347  implicit none
348 
349  character*(*), intent(in) :: s3mnem
350 
351  integer, intent(in) :: mbay(*)
352  integer len0, len1, len2, len3, l4, l5, ipt, ival, imask, iupb
353 
354  ! Check for I8 integers.
355 
356  if(im8b) then
357  im8b=.false.
358  iret = iupbs3(mbay,s3mnem)
359  im8b=.true.
360  return
361  endif
362 
363  ! Skip to the beginning of Section 3.
364 
365  call getlens(mbay,3,len0,len1,len2,len3,l4,l5)
366  ipt = len0 + len1 + len2
367 
368  ! Unpack the requested value.
369 
370  if(s3mnem=='NSUB') then
371  iret = iupb(mbay,ipt+5,16)
372  else if( (s3mnem=='IOBS') .or. (s3mnem=='ICMP') ) then
373  ival = iupb(mbay,ipt+7,8)
374  if(s3mnem=='IOBS') then
375  imask = 128
376  else
377  imask = 64
378  endif
379  iret = min(1,iand(ival,imask))
380  else
381  iret = -1
382  endif
383 
384  return
385 end function iupbs3
386 
435 recursive integer function iupvs01(lunit,s01mnem) result(iret)
436 
437  use bufrlib
438 
439  use modv_vars, only: im8b
440 
441  use moda_bitbuf
442 
443  implicit none
444 
445  character*(*), intent(in) :: s01mnem
446  character*12 cs01mnem
447 
448  integer, intent(in) :: lunit
449  integer my_lunit, lun, ilst, imst, iupbs01, bort_target_set, lcs
450 
451  ! Check for I8 integers
452 
453  if(im8b) then
454  im8b=.false.
455  call x84(lunit,my_lunit,1)
456  iret=iupvs01(my_lunit,s01mnem)
457  im8b=.true.
458  return
459  endif
460 
461  ! If we're catching bort errors, set a target return location if one doesn't already exist.
462 
463  if (bort_target_set() == 1) then
464  call strsuc(s01mnem,cs01mnem,lcs)
465  call catch_bort_iupvs01_c(lunit,cs01mnem,lcs,iret)
466  call bort_target_unset
467  return
468  endif
469 
470  iret = -1
471 
472  ! Check the file status
473 
474  call status(lunit,lun,ilst,imst)
475  if(ilst==0) call bort('BUFRLIB: IUPVS01 - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
476  if(ilst>0) call bort('BUFRLIB: IUPVS01 - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
477  if(imst==0) call bort('BUFRLIB: IUPVS01 - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
478 
479  ! Unpack the requested value
480 
481  iret = iupbs01(mbay(1,lun),s01mnem)
482 
483  return
484 end function iupvs01
485 
523 recursive subroutine pkbs1(ival,mbay,s1mnem)
524 
525  use bufrlib
526 
527  use modv_vars, only: im8b
528 
529  implicit none
530 
531  character*(*), intent(in) :: s1mnem
532 
533  integer, intent(in) :: ival
534  integer, intent(inout) :: mbay(*)
535  integer my_ival, iben, isbyt, iwid, iret, iupbs01, ibit, bort_target_set, lcs
536 
537  character*128 bort_str
538  character*12 cs1mnem
539 
540  ! Check for I8 integers.
541 
542  if (im8b) then
543  im8b = .false.
544  call x84(ival,my_ival,1)
545  call pkbs1(my_ival,mbay,s1mnem)
546  im8b = .true.
547  return
548  endif
549 
550  ! If we're catching bort errors, set a target return location if one doesn't already exist.
551 
552  if (bort_target_set() == 1) then
553  call strsuc(s1mnem,cs1mnem,lcs)
554  call catch_bort_pkbs1_c(ival,mbay,cs1mnem,lcs)
555  call bort_target_unset
556  return
557  endif
558 
559  iben = iupbs01(mbay,'BEN')
560 
561  ! Determine where to store the value.
562 
563  call gets1loc(s1mnem,iben,isbyt,iwid,iret)
564  if ( (iret==0) .and. &
565  ( (s1mnem=='USN') .or. (s1mnem=='BMT') .or. (s1mnem=='OGCE') .or. (s1mnem=='GSES') .or. (s1mnem=='MTYP') .or. &
566  (s1mnem=='MSBTI') .or. (s1mnem=='MSBT') .or. (s1mnem=='MTV') .or. (s1mnem=='MTVL') .or. (s1mnem=='YCEN') .or.&
567  (s1mnem=='CENT') .or. (s1mnem=='YEAR') .or. (s1mnem=='MNTH') .or. (s1mnem=='DAYS') .or. (s1mnem=='HOUR') .or.&
568  (s1mnem=='MINU') .or. (s1mnem=='SECO') ) ) then
569  ! Store the value.
570  ibit = (iupbs01(mbay,'LEN0')+isbyt-1)*8
571  call pkb(ival,iwid,mbay,ibit)
572  else
573  write(bort_str,'("BUFRLIB: PKBS1 - CANNOT OVERWRITE LOCATION CORRESPONDING TO MNEMONIC (",A,") WITHIN BUFR EDITION '// &
574  '(",I1,")")') s1mnem, iben
575  call bort(bort_str)
576  endif
577 
578  return
579 end subroutine pkbs1
580 
631 recursive subroutine pkvs01(s01mnem,ival)
632 
633  use bufrlib
634 
635  use modv_vars, only: im8b, mxs01v
636 
637  use moda_s01cm
638 
639  implicit none
640 
641  character*(*), intent(in) :: s01mnem
642 
643  integer, intent(in) :: ival
644  integer my_ival, i, bort_target_set, lcs
645 
646  character*128 bort_str
647  character*12 cs01mnem
648 
649  ! check for i8 integers
650 
651  if(im8b) then
652  im8b=.false.
653  call x84(ival,my_ival,1)
654  call pkvs01(s01mnem,my_ival)
655  im8b=.true.
656  return
657  endif
658 
659  ! If we're catching bort errors, set a target return location if one doesn't already exist.
660 
661  if (bort_target_set() == 1) then
662  call strsuc(s01mnem,cs01mnem,lcs)
663  call catch_bort_pkvs01_c(cs01mnem,lcs,ival)
664  call bort_target_unset
665  return
666  endif
667 
668  ! Confirm that the arrays needed by this subroutine have already been allocated (and if not, go ahead and allocate them now),
669  ! since it's possible for this subroutine to be called before the first call to subroutine openbf().
670 
671  if ( ( .not. allocated(cmnem) ) .or. ( .not. allocated(ivmnem) ) ) then
672  call openbf(0,'FIRST',0)
673  endif
674 
675  ! If an ival has already been assigned for this particular s01mnem, then overwrite that entry in module @ref moda_s01cm
676  ! using the new ival.
677 
678  if(ns01v>0) then
679  do i=1,ns01v
680  if(s01mnem==cmnem(i)) then
681  ivmnem(i) = ival
682  return
683  endif
684  enddo
685  endif
686 
687  ! Otherwise, use the next available unused entry in module @ref moda_s01cm.
688 
689  if(ns01v>=mxs01v) then
690  write(bort_str,'("BUFRLIB: PKVS01 - CANNOT OVERWRITE MORE THAN ",I2," DIFFERENT LOCATIONS WITHIN SECTION 0 '// &
691  'OR SECTION 1")') mxs01v
692  call bort(bort_str)
693  endif
694 
695  ns01v = ns01v + 1
696  cmnem(ns01v) = s01mnem
697  ivmnem(ns01v) = ival
698 
699  return
700 end subroutine pkvs01
701 
708 subroutine reads3 ( lun )
709 
710  use bufrlib
711 
712  use modv_vars, only: maxnc, mxcnem, iprt
713 
714  use moda_sc3bfr
715  use moda_bitbuf
716  use moda_dscach
717  use moda_s3list
718 
719  implicit none
720 
721  integer, intent(in) :: lun
722  integer irepct, ireadmt, igettdi, itmp, ncds3, ii, jj, ifxy, igetntbi, n, idn
723 
724  character*6 numb, adn30
725  character*55 cseq
726  character*128 errstr
727 
728  logical incach
729 
730  save irepct
731 
732  ! Check whether the appropriate BUFR master table information has already been read into internal memory for this message.
733 
734  if ( ireadmt( lun ) == 1 ) then
735  ! NO (i.e. we just had to read in new master table information for this message), so reset some corresponding values in
736  ! other parts of the library.
737  call dxinit ( lun, 0 )
738  itmp = igettdi( 0 )
739  irepct = 0
740  ncnem = 0
741  endif
742 
743  ! Unpack the list of Section 3 descriptors from the message.
744 
745  call upds3 ( mbay(1,lun), maxnc, cds3, ncds3 )
746  do ii = 1, ncds3
747  ids3(ii) = ifxy( cds3(ii) )
748  enddo
749 
750  ! Is the list of Section 3 descriptors already in the cache?
751 
752  ! The cache is a performance-enhancing device which saves time when the same descriptor sequences are encountered over and
753  ! over within the calling program. Time is saved because the below calls to subroutines stseq_c() and makestab() are
754  ! bypassed whenever a list is already in the cache.
755 
756  incach = .false.
757  if ( ncnem > 0 ) then
758  ii = 1
759  do while ( (.not.incach) .and. (ii<=ncnem) )
760  if ( ncds3 == ndc(ii) ) then
761  jj = 1
762  incach = .true.
763  do while ( (incach) .and. (jj<=ncds3) )
764  if ( ids3(jj) == idcach(ii,jj) ) then
765  jj = jj + 1
766  else
767  incach = .false.
768  endif
769  enddo
770  if (incach) then
771 
772  ! The list is already in the cache, so store the corresponding Table A mnemonic into module @ref moda_sc3bfr and return.
773 
774  if ( iprt >= 2 ) then
775  call errwrt('+++++++++++++++++++++++++++++++++++++++++++++++++')
776  errstr = 'BUFRLIB: READS3 - RE-USED CACHE LIST FOR ' // cnem(ii)
777  call errwrt(errstr)
778  call errwrt('+++++++++++++++++++++++++++++++++++++++++++++++++')
779  call errwrt(' ')
780  endif
781  tamnem(lun) = cnem(ii)
782  return
783  endif
784  endif
785  ii = ii + 1
786  enddo
787  endif
788 
789  ! Get the next available index within the internal Table A.
790 
791  n = igetntbi( lun, 'A' )
792 
793  ! Generate a Table A mnemonic and sequence description.
794 
795  write ( tamnem(lun), '(A5,I3.3)') 'MSTTB', n
796  cseq = 'TABLE A MNEMONIC ' // tamnem(lun)
797 
798  ! Store the Table A mnemonic and sequence into the cache.
799 
800  ncnem = ncnem + 1
801  if ( ncnem > mxcnem ) call bort('BUFRLIB: READS3 - MXCNEM OVERFLOW')
802  cnem(ncnem) = tamnem(lun)
803  ndc(ncnem) = ncds3
804  do jj = 1, ncds3
805  idcach(ncnem,jj) = ids3(jj)
806  enddo
807  if ( iprt >= 2 ) then
808  call errwrt('+++++++++++++++++++++++++++++++++++++++++++++++++')
809  errstr = 'BUFRLIB: READS3 - STORED CACHE LIST FOR ' // cnem(ncnem)
810  call errwrt(errstr)
811  call errwrt('+++++++++++++++++++++++++++++++++++++++++++++++++')
812  call errwrt(' ')
813  endif
814 
815  ! Get an FXY value to use with this Table A mnemonic.
816 
817  idn = igettdi( lun )
818  numb = adn30( idn, 6 )
819 
820  ! Store all of the information for this mnemonic within the internal Table A.
821 
822  call stntbia ( n, lun, numb, tamnem(lun), cseq )
823 
824  ! Store all of the information for this sequence within the internal Tables B and D.
825 
826  call stseq_c ( lun, irepct, idn, tamnem(lun), cseq, ids3, ncds3 )
827 
828  ! Update the jump/link table.
829 
830  call makestab
831 
832  return
833 end subroutine reads3
834 
849 recursive subroutine upds3(mbay,lcds3,cds3,nds3)
850 
851  use bufrlib
852 
853  use modv_vars, only: im8b
854 
855  implicit none
856 
857  integer, intent(in) :: mbay(*), lcds3
858  integer, intent(out) :: nds3
859  integer my_lcds3, len0, len1, len2, len3, l4, l5, ipt, ii, jj, iupb, bort_target_set
860 
861  character*6, intent(out) :: cds3(*)
862  character*6 adn30
863  character, allocatable :: ccds3(:,:)
864 
865  ! Check for I8 integers.
866 
867  if(im8b) then
868  im8b=.false.
869  call x84(lcds3,my_lcds3,1)
870  call upds3(mbay,my_lcds3,cds3,nds3)
871  call x48(nds3,nds3,1)
872  im8b=.true.
873  return
874  endif
875 
876  ! If we're catching bort errors, set a target return location if one doesn't already exist.
877 
878  if (bort_target_set() == 1) then
879  allocate(ccds3(6,lcds3))
880  call catch_bort_upds3_c(mbay,lcds3,ccds3,nds3)
881  do ii = 1, nds3
882  do jj = 1, 6
883  cds3(ii)(jj:jj) = ccds3(jj,ii)
884  enddo
885  enddo
886  deallocate(ccds3)
887  call bort_target_unset
888  return
889  endif
890 
891  ! Skip to the beginning of Section 3.
892 
893  call getlens(mbay,3,len0,len1,len2,len3,l4,l5)
894  ipt = len0 + len1 + len2
895 
896  ! Unpack the Section 3 descriptors.
897 
898  nds3 = 0
899  do jj = 8,(len3-1),2
900  nds3 = nds3 + 1
901  if(nds3>lcds3) call bort('BUFRLIB: UPDS3 - OVERFLOW OF OUTPUT DESCRIPTOR ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
902  cds3(nds3) = adn30(iupb(mbay,ipt+jj,16),6)
903  enddo
904 
905  return
906 end subroutine upds3
907 
924 recursive subroutine datelen(len)
925 
926  use bufrlib
927 
928  use modv_vars, only: im8b, lendat
929 
930  implicit none
931 
932  integer, intent(in) :: len
933  integer my_len, bort_target_set
934 
935  character*128 bort_str
936 
937  ! Check for I8 integers
938 
939  if(im8b) then
940  im8b=.false.
941  call x84(len,my_len,1)
942  call datelen(my_len)
943  im8b=.true.
944  return
945  endif
946 
947  ! If we're catching bort errors, set a target return location if one doesn't already exist.
948 
949  if (bort_target_set() == 1) then
950  call catch_bort_datelen_c(len)
951  call bort_target_unset
952  return
953  endif
954 
955  if(len/=8 .and. len/=10) then
956  write(bort_str,'("BUFRLIB: DATELEN - INPUT ARGUMENT IS",I4," - IT MUST BE EITHER 8 OR 10")') len
957  call bort(bort_str)
958  endif
959  lendat = len
960 
961  return
962 end subroutine datelen
963 
980 recursive subroutine datebf(lunit,mear,mmon,mday,mour,idate)
981 
982  use bufrlib
983 
984  use modv_vars, only: im8b, iprt
985 
986  use moda_mgwa
987 
988  implicit none
989 
990  integer, intent(in) :: lunit
991  integer, intent(out) :: mear, mmon, mday, mour, idate
992  integer my_lunit, lun, jl, jm, ier, idx, idxmsg, igetdate, bort_target_set
993 
994  character*128 errstr
995 
996  ! Check for I8 integers
997 
998  if(im8b) then
999  im8b=.false.
1000  call x84(lunit,my_lunit,1)
1001  call datebf(my_lunit,mear,mmon,mday,mour,idate)
1002  call x48(mear,mear,1)
1003  call x48(mmon,mmon,1)
1004  call x48(mday,mday,1)
1005  call x48(mour,mour,1)
1006  call x48(idate,idate,1)
1007  im8b=.true.
1008  return
1009  endif
1010 
1011  ! If we're catching bort errors, set a target return location if one doesn't already exist.
1012 
1013  if (bort_target_set() == 1) then
1014  call catch_bort_datebf_c(lunit,mear,mmon,mday,mour,idate)
1015  call bort_target_unset
1016  return
1017  endif
1018 
1019  ! Initialization, in case openbf() hasn't been called yet.
1020 
1021  if ( .not. allocated(mgwa) ) call openbf(lunit,'FIRST',lunit)
1022 
1023  ! See if the file is already open to the library (a no-no!).
1024 
1025  call status(lunit,lun,jl,jm)
1026  if(jl/=0) call bort ('BUFRLIB: DATEBF - INPUT BUFR FILE IS OPEN, IT MUST BE CLOSED')
1027 
1028  ! Read to the first data message and pick out the date.
1029 
1030  call openbf(lunit,'INX',lunit)
1031  idx = 1
1032  do while (idx==1)
1033  call rdmsgw(lunit,mgwa,ier)
1034  if(ier<0) then
1035  if (iprt>=1) then
1036  call errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1037  errstr = 'BUFRLIB: DATEBF - SECTION 1 DATE COULD NOT BE LOCATED - RETURN WITH IDATE = -1'
1038  call errwrt(errstr)
1039  call errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1040  call errwrt(' ')
1041  endif
1042  idate = -1
1043  call closbf(lunit)
1044  return
1045  endif
1046  idx = idxmsg(mgwa)
1047  end do
1048  idate = igetdate(mgwa,mear,mmon,mday,mour)
1049  call closbf(lunit)
1050 
1051  return
1052 end subroutine datebf
1053 
1071 recursive integer function igetdate(mbay,iyr,imo,idy,ihr) result(iret)
1072 
1073  use modv_vars, only: im8b, lendat
1074 
1075  implicit none
1076 
1077  integer, intent(in) :: mbay(*)
1078  integer, intent(out) :: iyr, imo, idy, ihr
1079  integer iupbs01
1080 
1081  ! Check for I8 integers.
1082 
1083  if(im8b) then
1084  im8b=.false.
1085  iret=igetdate(mbay,iyr,imo,idy,ihr)
1086  call x48(iyr,iyr,1)
1087  call x48(imo,imo,1)
1088  call x48(idy,idy,1)
1089  call x48(ihr,ihr,1)
1090  im8b=.true.
1091  return
1092  endif
1093 
1094  iyr = iupbs01(mbay,'YEAR')
1095  imo = iupbs01(mbay,'MNTH')
1096  idy = iupbs01(mbay,'DAYS')
1097  ihr = iupbs01(mbay,'HOUR')
1098  if(lendat/=10) iyr = mod(iyr,100)
1099  iret = (iyr*1000000) + (imo*10000) + (idy*100) + ihr
1100 
1101  return
1102 end function igetdate
1103 
1117 recursive integer function i4dy(idate) result(iret)
1118 
1119  use modv_vars, only: im8b
1120 
1121  implicit none
1122 
1123  integer, intent(in) :: idate
1124  integer my_idate, iy
1125 
1126  ! Check for I8 integers.
1127 
1128  if(im8b) then
1129  im8b=.false.
1130  call x84(idate,my_idate,1)
1131  iret=i4dy(my_idate)
1132  im8b=.true.
1133  return
1134  endif
1135 
1136  if(idate<10**8) then
1137  iy = idate/10**6
1138  if(iy>40) then
1139  iret = idate + 19*100000000
1140  else
1141  iret = idate + 20*100000000
1142  endif
1143  else
1144  iret = idate
1145  endif
1146 
1147  return
1148 end function i4dy
1149 
1181 recursive subroutine dumpbf(lunit,jdate,jdump)
1182 
1183  use bufrlib
1184 
1185  use modv_vars, only: im8b, iprt
1186 
1187  use moda_mgwa
1188 
1189  implicit none
1190 
1191  integer, intent(in) :: lunit
1192  integer, intent(out) :: jdate(*), jdump(*)
1193  integer my_lunit, lun, jl, jm, ier, ii, igetdate, idxmsg, iupbs3, iupbs01, bort_target_set
1194 
1195  character*128 errstr
1196 
1197  ! Check for I8 integers
1198 
1199  if(im8b) then
1200  im8b=.false.
1201  call x84(lunit,my_lunit,1)
1202  call dumpbf(my_lunit,jdate,jdump)
1203  call x48(jdate(1),jdate(1),5)
1204  call x48(jdump(1),jdump(1),5)
1205  im8b=.true.
1206  return
1207  endif
1208 
1209  ! If we're catching bort errors, set a target return location if one doesn't already exist.
1210 
1211  if (bort_target_set() == 1) then
1212  call catch_bort_dumpbf_c(lunit,jdate,jdump)
1213  call bort_target_unset
1214  return
1215  endif
1216 
1217  do ii=1,5
1218  jdate(ii) = -1
1219  jdump(ii) = -1
1220  enddo
1221 
1222  ! See if the file is already open to the library (a no-no!).
1223 
1224  call status(lunit,lun,jl,jm)
1225  if(jl/=0) call bort('BUFRLIB: DUMPBF - INPUT BUFR FILE IS OPEN, IT MUST BE CLOSED')
1226  call openbf(lunit,'INX',lunit)
1227 
1228  do while (.true.)
1229  call rdmsgw(lunit,mgwa,ier)
1230  if(ier/=0) exit
1231  if(idxmsg(mgwa)==1) cycle ! Skip past any dictionary messages
1232 
1233  ! The dump center YY,MM,DD,HH,MM should be in this message, which is the first message containing zero subsets
1234  if(iupbs3(mgwa,'NSUB')/=0) exit
1235  ii = igetdate(mgwa,jdate(1),jdate(2),jdate(3),jdate(4))
1236  jdate(5) = iupbs01(mgwa,'MINU')
1237 
1238  ! The dump clock YY,MM,DD,HH,MM should be in the next message, which is the second message containing zero subsets
1239  call rdmsgw(lunit,mgwa,ier)
1240  if(ier/=0) exit
1241  if(iupbs3(mgwa,'NSUB')/=0) exit
1242  ii = igetdate(mgwa,jdump(1),jdump(2),jdump(3),jdump(4))
1243  jdump(5) = iupbs01(mgwa,'MINU')
1244 
1245  call closbf(lunit)
1246  return
1247  enddo
1248 
1249  if (iprt>=1 .and. (jdate(1)==-1.or.jdump(1)==-1)) then
1250  call errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1251  if(jdate(1)==-1) then
1252  errstr = 'BUFRLIB: DUMPBF - FIRST EMPTY BUFR MESSAGE SECTION 1 DATE COULD NOT BE LOCATED - RETURN WITH JDATE = 5*-1'
1253  call errwrt(errstr)
1254  endif
1255  if(jdump(1)==-1) then
1256  errstr = 'BUFRLIB: DUMPBF - SECOND EMPTY BUFR MESSAGE SECTION 1 DATE COULD NOT BE LOCATED - RETURN WITH JDUMP = 5*-1'
1257  call errwrt(errstr)
1258  endif
1259  call errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1260  call errwrt(' ')
1261  endif
1262 
1263  return
1264 end subroutine dumpbf
1265 
1275 recursive subroutine minimg(lunit,mini)
1276 
1277  use bufrlib
1278 
1279  use modv_vars, only: im8b
1280 
1281  use moda_bitbuf
1282 
1283  implicit none
1284 
1285  integer, intent(in) :: lunit, mini
1286  integer my_lunit, my_mini, lun, il, im, bort_target_set
1287 
1288  ! Check for I8 integers.
1289 
1290  if(im8b) then
1291  im8b=.false.
1292  call x84(lunit,my_lunit,1)
1293  call x84(mini,my_mini,1)
1294  call minimg(my_lunit,my_mini)
1295  im8b=.true.
1296  return
1297  endif
1298 
1299  ! If we're catching bort errors, set a target return location if one doesn't already exist.
1300 
1301  if (bort_target_set() == 1) then
1302  call catch_bort_minimg_c(lunit,mini)
1303  call bort_target_unset
1304  return
1305  endif
1306 
1307  call status(lunit,lun,il,im)
1308  if(il==0) call bort('BUFRLIB: MINIMG - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
1309  if(il<0) call bort('BUFRLIB: MINIMG - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
1310  if(im==0) call bort('BUFRLIB: MINIMG - A MESSAGE MUST BE OPEN IN OUTPUT BUFR FILE, NONE ARE')
1311 
1312  call pkbs1(mini,mbay(1,lun),'MINU')
1313 
1314  return
1315 end subroutine minimg
1316 
1331 subroutine cktaba(lun,subset,jdate,iret)
1332 
1333  use modv_vars, only: iprt, fxy_sbyct
1334 
1335  use moda_msgcwd
1336  use moda_sc3bfr
1337  use moda_unptyp
1338  use moda_bitbuf
1339 
1340  implicit none
1341 
1342  integer, intent(in) :: lun
1343  integer, intent(out) :: jdate, iret
1344  integer, parameter :: ncpfx = 3
1345  integer mtyp, msbt, mty1, msb1, isub, ksub, len0, len1, len2, len3, l4, l5, lundx, ii, &
1346  itab, inod, iad3, iad4, iyr, imo, idy, ihr, iupb, ifxy, iupbs01, iupbs3, i4dy, igetdate
1347 
1348  character*128 bort_str, errstr
1349  character*8, intent(out) :: subset
1350  character*2, parameter :: cpfx(ncpfx) = (/'NC','FR','FN'/)
1351  character tab
1352 
1353  logical trybt
1354 
1355  iret = 0
1356 
1357  trybt = .true.
1358 
1359  ! Get the message type, subtype, and date from Section 1
1360 
1361  mtyp = iupbs01(mbay(1,lun),'MTYP')
1362  msbt = iupbs01(mbay(1,lun),'MSBT')
1363  jdate = igetdate(mbay(1,lun),iyr,imo,idy,ihr)
1364 
1365  if(mtyp==11) then
1366  ! This is a BUFR table (dictionary) message
1367  iret = 11
1368  ! There's no need to proceed any further unless Section 3 is being used for decoding
1369  if(isc3(lun)==0) then
1370  subset = " "
1371  return
1372  endif
1373  endif
1374 
1375  ! Get the first and second descriptors from Section 3
1376 
1377  call getlens(mbay(1,lun),3,len0,len1,len2,len3,l4,l5)
1378  iad3 = len0+len1+len2
1379  ksub = iupb(mbay(1,lun),iad3+8,16)
1380  isub = iupb(mbay(1,lun),iad3+10,16)
1381 
1382  ! Locate Section 4
1383 
1384  iad4 = iad3+len3
1385 
1386  ! Now, try to get the Table A mnemonic
1387 
1388  outer: do while (.true.)
1389 
1390  if(isc3(lun)/=0) then
1391  ! Section 3 is being used for decoding
1392  subset = tamnem(lun)
1393  call nemtbax(lun,subset,mty1,msb1,inod)
1394  if(inod>0) then
1395  mbyt(lun) = 8*(iad4+4)
1396  msgunp(lun) = 1
1397  exit outer
1398  endif
1399  endif
1400 
1401  inner: do while (.true.)
1402 
1403  call numtab(lun,isub,subset,tab,itab)
1404  call nemtbax(lun,subset,mty1,msb1,inod)
1405  if(inod>0) then
1406  ! The second descriptor in Section 3 corresponds to the Table A mnemonic, so the message contains non-standard
1407  ! NCEP extensions
1408  mbyt(lun) = (iad4+4)
1409  msgunp(lun) = 0
1410  exit outer
1411  endif
1412 
1413  call numtab(lun,ksub,subset,tab,itab)
1414  call nemtbax(lun,subset,mty1,msb1,inod)
1415  if(inod>0) then
1416  ! The first descriptor in Section 3 corresponds to the Table A mnemonic, so the message is WMO-standard
1417  mbyt(lun) = 8*(iad4+4)
1418  msgunp(lun) = 1
1419  exit outer
1420  endif
1421 
1422  ! OK, still no luck, so try "NCtttsss" (where ttt=mtyp and sss=msbt) as the Table A mnemonic, and if that doesn't work
1423  ! then also try "FRtttsss" AND "FNtttsss"
1424  ii=1
1425  do while(ii<=ncpfx)
1426  write(subset,'(A2,2I3.3)') cpfx(ii),mtyp,msbt
1427  call nemtbax(lun,subset,mty1,msb1,inod)
1428  if(inod>0) then
1429  if(ksub==ifxy(fxy_sbyct)) then
1430  mbyt(lun) = (iad4+4)
1431  msgunp(lun) = 0
1432  else
1433  mbyt(lun) = 8*(iad4+4)
1434  msgunp(lun) = 1
1435  endif
1436  exit outer
1437  endif
1438  ii=ii+1
1439  enddo
1440 
1441  if(trybt) then
1442  ! Make one last desperate attempt by checking whether the application program contains an in-line version of
1443  ! subroutine openbt() to override the default version in the library
1444  trybt = .false.
1445  if(iprt>=1) then
1446  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
1447  errstr = 'BUFRLIB: CKTABA - LAST RESORT, CHECK FOR EXTERNAL BUFR TABLE VIA CALL TO IN-LINE OPENBT'
1448  call errwrt(errstr)
1449  call errwrt('++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
1450  call errwrt(' ')
1451  endif
1452  call openbt(lundx,mtyp)
1453  if(lundx>0) then
1454  ! There was an in-line replacement for the default library version of openbt(), so read DX table information from
1455  ! the specified logical unit and look for the Table A mnemonic there
1456  call rdusdx(lundx,lun)
1457  cycle inner
1458  endif
1459  endif
1460 
1461  ! Give up and report the bad news
1462  if(iprt>=0) then
1463  call errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1464  errstr = 'BUFRLIB: CKTABA - UNRECOGNIZED TABLE A MESSAGE TYPE (' // subset // ') - RETURN WITH IRET = -1'
1465  call errwrt(errstr)
1466  call errwrt('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1467  call errwrt(' ')
1468  endif
1469  iret = -1
1470  return
1471 
1472  enddo inner
1473 
1474  enddo outer
1475 
1476  ! Confirm the validity of the message type and subtype, and also check for compression
1477 
1478  if(isc3(lun)==0) then
1479  if(mtyp/=mty1) then
1480  write(bort_str,'("BUFRLIB: CKTABA - MESSAGE TYPE MISMATCH (SUBSET=",A8,", MTYP=",I3,", MTY1=",I3)') subset,mtyp,mty1
1481  call bort(bort_str)
1482  endif
1483  if( msbt/=msb1 .and. ( verify(subset(3:8),'1234567890') == 0 ) ) then
1484  write(bort_str,'("BUFRLIB: CKTABA - MESSAGE SUBTYPE MISMATCH (SUBSET=",A8,", MSBT=",I3,", MSB1=",I3)') subset,msbt,msb1
1485  call bort(bort_str)
1486  endif
1487  endif
1488  if(iupbs3(mbay(1,lun),'ICMP')>0) msgunp(lun) = 2
1489 
1490  ! Update values in @ref moda_msgcwd
1491 
1492  idate(lun) = i4dy(jdate)
1493  inode(lun) = inod
1494  msub(lun) = iupbs3(mbay(1,lun),'NSUB')
1495  nsub(lun) = 0
1496  if(iret/=11) nmsg(lun) = nmsg(lun)+1
1497 
1498  return
1499 end subroutine cktaba
1500 
1540 recursive subroutine mesgbc(lunin,mesgtyp,icomp)
1541 
1542  use bufrlib
1543 
1544  use modv_vars, only: im8b
1545 
1546  use moda_bitbuf
1547  use moda_mgwa
1548 
1549  implicit none
1550 
1551  integer, intent(in) :: lunin
1552  integer, intent(out) :: mesgtyp, icomp
1553  integer my_lunin, lunit, irec, ier, i, lun, il, im, iupbs01, iupbs3, idxmsg, bort_target_set
1554 
1555  ! Check for I8 integers
1556 
1557  if(im8b) then
1558  im8b=.false.
1559  call x84(lunin,my_lunin,1)
1560  call mesgbc(my_lunin,mesgtyp,icomp)
1561  call x48(mesgtyp,mesgtyp,1)
1562  call x48(icomp,icomp,1)
1563  im8b=.true.
1564  return
1565  endif
1566 
1567  ! If we're catching bort errors, set a target return location if one doesn't already exist.
1568 
1569  if (bort_target_set() == 1) then
1570  call catch_bort_mesgbc_c(lunin,mesgtyp,icomp)
1571  call bort_target_unset
1572  return
1573  endif
1574 
1575  mesgtyp = -256
1576 
1577  lunit = abs(lunin)
1578 
1579  if(lunit==lunin) then
1580  ! Open the file, read past any DX BUFR tables and "dummy" messages, and return the first message type found
1581  irec = 0
1582  call openbf(lunit,'INX',lunit)
1583  do while (.true.)
1584  call rdmsgw(lunit,mgwa,ier)
1585  if(ier==-1) then
1586  if(irec==0) then
1587  mesgtyp = -256
1588  icomp = -3
1589  else
1590  if(mesgtyp>=0) mesgtyp = -mesgtyp
1591  icomp = -2
1592  endif
1593  call closbf(lunit)
1594  return
1595  endif
1596  irec = irec + 1
1597  mesgtyp = iupbs01(mgwa,'MTYP')
1598  if( (idxmsg(mgwa)/=1) .and. (iupbs3(mgwa,'NSUB')/=0) ) exit
1599  enddo
1600  call closbf(lunit)
1601  else
1602  ! Return message type for message currently stored in memory
1603  call status(lunit,lun,il,im)
1604  do i=1,12
1605  mgwa(i) = mbay(i,lun)
1606  enddo
1607  mesgtyp = iupbs01(mgwa,'MTYP')
1608  end if
1609 
1610  ! Set the compression switch
1611  icomp = iupbs3(mgwa,'ICMP')
1612 
1613  return
1614 end subroutine mesgbc
1615 
1639 recursive subroutine mesgbf(lunit,mesgtyp)
1640 
1641  use bufrlib
1642 
1643  use modv_vars, only: im8b
1644 
1645  use moda_mgwa
1646 
1647  implicit none
1648 
1649  integer, intent(in) :: lunit
1650  integer, intent(out) :: mesgtyp
1651  integer my_lunit, ier, iupbs01, idxmsg, bort_target_set
1652 
1653  ! Check for I8 integers
1654 
1655  if(im8b) then
1656  im8b=.false.
1657  call x84(lunit,my_lunit,1)
1658  call mesgbf(my_lunit,mesgtyp)
1659  call x48(mesgtyp,mesgtyp,1)
1660  im8b=.true.
1661  return
1662  endif
1663 
1664  ! If we're catching bort errors, set a target return location if one doesn't already exist.
1665 
1666  if (bort_target_set() == 1) then
1667  call catch_bort_mesgbf_c(lunit,mesgtyp)
1668  call bort_target_unset
1669  return
1670  endif
1671 
1672  mesgtyp = -1
1673 
1674  call openbf(lunit,'INX',lunit)
1675 
1676  do while (.true.)
1677  call rdmsgw(lunit,mgwa,ier)
1678  if(ier==0) then
1679  mesgtyp = iupbs01(mgwa,'MTYP')
1680  if(idxmsg(mgwa)/=1) exit
1681  endif
1682  enddo
1683 
1684  call closbf(lunit)
1685 
1686  return
1687 end subroutine mesgbf
recursive subroutine bort(str)
Log an error message, then either return to or abort the application program.
Definition: borts.F90:15
subroutine bort_target_unset
Clear any existing bort target.
Definition: borts.F90:180
integer function bort_target_set()
Sets a new bort target, if bort catching is enabled and such a target doesn't already exist.
Definition: borts.F90:160
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 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 rdusdx(lundx, lun)
Read and parse a file containing a user-supplied DX BUFR table in character format,...
Definition: dxtable.F90:197
subroutine nemtbax(lun, nemo, mtyp, msbt, inod)
Get information about a Table A descriptor from the internal DX BUFR tables.
Definition: dxtable.F90:1194
subroutine stntbia(n, lun, numb, nemo, celsq)
Store a new entry within internal BUFR Table A.
Definition: dxtable.F90:1575
subroutine dxinit(lun, ioi)
Clear out the internal arrays (in module moda_tababd) holding the DX BUFR table, then optionally init...
Definition: dxtable.F90:604
integer function idxmsg(mesg)
Check whether a BUFR message contains DX BUFR tables information that was generated by the NCEPLIBS-b...
Definition: dxtable.F90:1120
subroutine errwrt(str)
Specify a custom location for the logging of error and diagnostic messages generated by the NCEPLIBS-...
Definition: errwrt.F90:32
subroutine numtab(lun, idn, nemo, tab, iret)
Get information about a descriptor, based on the WMO bit-wise representation of an FXY value.
Definition: fxy.F90:359
character *(*) function adn30(idn, ldn)
Convert an FXY value from its WMO bit-wise representation to a character string of length 5 or 6.
Definition: fxy.F90:18
subroutine strsuc(str1, str2, lens)
Remove leading and trailing blanks from a character string.
Definition: misc.F90:199
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.
Declare arrays and variables for the internal Table A mnemonic cache that is used for Section 3 decod...
character *8, dimension(:), allocatable cnem
Table A mnemonics.
integer ncnem
Number of entries in the internal Table A mnemonic cache (up to a maximum of mxcnem).
integer, dimension(:,:), allocatable idcach
WMO bit-wise representations of the child descriptors for the corresponding Table A mnemonic in cnem.
integer, dimension(:), allocatable ndc
Number of child descriptors for the corresponding Table A mnemonic in cnem.
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 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 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 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.
character *6, dimension(:), allocatable cds3
Temporary working copy of Section 3 descriptor list in character form.
Declare an array used to store a switch for each file ID, indicating whether BUFR messages read from ...
character *8, dimension(:), allocatable tamnem
Table A mnemonic most recently read from each file ID, if isc3 = 1 for that stream.
integer, dimension(:), allocatable isc3
Section 3 switch for each file ID:
Declare an array used to store, for each file ID from which a BUFR message is currently being read as...
integer, dimension(:), allocatable msgunp
Flag indicating how to unpack data subsets from BUFR message:
recursive subroutine openbt(lundx, mtyp)
Specify a DX BUFR table of last resort, in case subroutine cktaba() is unable to locate a DX BUFR tab...
Definition: openbt.F90:31
recursive subroutine closbf(lunit)
Close the connection between logical unit lunit and the NCEPLIBS-bufr software.
recursive subroutine openbf(lunit, io, lundx)
Connect a new file to the NCEPLIBS-bufr software for input or output operations, or initialize the li...
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.
subroutine rdmsgw(lunit, mesg, iret)
Read the next BUFR message from logical unit lunit as an array of integer words.
subroutine cktaba(lun, subset, jdate, iret)
Get the Table A mnemonic from Sections 1 and 3 of a BUFR message.
Definition: s013vals.F90:1332
recursive integer function iupbs01(mbay, s01mnem)
Read a specified value from within Section 0 or Section 1 of a BUFR message.
Definition: s013vals.F90:245
recursive subroutine datebf(lunit, mear, mmon, mday, mour, idate)
Get the Section 1 date-time from the first data message of a BUFR file, bypassing any messages at the...
Definition: s013vals.F90:981
recursive integer function iupvs01(lunit, s01mnem)
Read a specified value from within Section 0 or 1 of a BUFR message.
Definition: s013vals.F90:436
recursive subroutine pkbs1(ival, mbay, s1mnem)
Write a specified value into a specified location within Section 1 of a BUFR message,...
Definition: s013vals.F90:524
recursive integer function iupbs3(mbay, s3mnem)
Read a specified value from within Section 3 of a BUFR message.
Definition: s013vals.F90:344
recursive subroutine minimg(lunit, mini)
Write a minutes value into Section 1 of the BUFR message that was most recently opened for writing vi...
Definition: s013vals.F90:1276
recursive subroutine upds3(mbay, lcds3, cds3, nds3)
Read the sequence of data descriptors contained within Section 3 of a BUFR message.
Definition: s013vals.F90:850
recursive subroutine mesgbf(lunit, mesgtyp)
Read through a BUFR file (starting from the beginning of the file) and return the message type (from ...
Definition: s013vals.F90:1640
recursive subroutine gets1loc(s1mnem, iben, isbyt, iwid, iret)
Get the location of a specified value within Section 1 of a BUFR message.
Definition: s013vals.F90:48
recursive subroutine datelen(len)
Specify the format of Section 1 date-time values that will be output by future calls to any of the NC...
Definition: s013vals.F90:925
recursive subroutine dumpbf(lunit, jdate, jdump)
Read the Section 1 date-time from the first two "dummy" messages of an NCEP dump file.
Definition: s013vals.F90:1182
recursive subroutine mesgbc(lunin, mesgtyp, icomp)
Return the message type (from Section 1) and message compression indicator (from Section 3) of a BUFR...
Definition: s013vals.F90:1541
recursive subroutine pkvs01(s01mnem, ival)
Specify a value to be written into a specified location within Section 0 or Section 1 of all BUFR mes...
Definition: s013vals.F90:632
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:709
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:1118
recursive integer function igetdate(mbay, iyr, imo, idy, ihr)
Get the date-time from within Section 1 of a BUFR message.
Definition: s013vals.F90:1072
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