34 recursive subroutine mtinfo ( cmtdir, lunmt1, lunmt2 )
36 use modv_vars,
only: im8b
40 integer,
intent(in) :: lunmt1, lunmt2
41 integer my_lunmt1, my_lunmt2, lun1, lun2, lmtd
43 character*(*),
intent(in) :: cmtdir
46 common /mstinf/ lun1, lun2, lmtd, mtdir
52 call x84 ( lunmt1, my_lunmt1, 1 )
53 call x84 ( lunmt2, my_lunmt2, 1 )
54 call mtinfo ( cmtdir, my_lunmt1, my_lunmt2 )
60 call strsuc ( cmtdir, mtdir, lmtd )
86 subroutine mtfnam ( imt, imtv, iogce, imtvl, tbltyp, stdfil, locfil )
90 integer,
intent(in) :: imt, imtv, iogce, imtvl
91 integer iprt, lun1, lun2, lmtd, ltbt, isize
93 character*(*),
intent(in) :: tbltyp
94 character*(*),
intent(out) :: stdfil, locfil
99 character*128 bort_str
104 common /mstinf/ lun1, lun2, lmtd, mtdir
106 call strsuc ( tbltyp, tbltyp2, ltbt )
110 if ( ( imt == 0 ) .and. ( imtv <= 13 ) )
then
112 stdfil = mtdir(1:lmtd) //
'/bufrtab.' // tbltyp2(1:ltbt) //
'_STD_0_13'
114 write ( fmtf,
'(A,I1,A,I1,A)' )
'(4A,I', isize(imt),
',A,I', isize(imtv),
')'
115 write ( stdfil, fmtf ) mtdir(1:lmtd),
'/bufrtab.', tbltyp2(1:ltbt),
'_STD_', imt,
'_', imtv
117 if ( iprt >= 2 )
then
118 call errwrt(
'Standard ' // tbltyp2(1:ltbt) //
':')
121 inquire ( file = stdfil, exist = found )
122 if ( .not. found )
then
123 bort_str =
'BUFRLIB: MTFNAM - COULD NOT FIND STANDARD FILE:'
124 call bort2(bort_str, stdfil)
132 write ( fmtf,
'(A,I1,A,I1,A,I1,A)' )
'(4A,I', isize(imt),
',A,I', isize(iogce),
',A,I', isize(imtvl),
')'
133 write ( locfil, fmtf ) mtdir(1:lmtd),
'/bufrtab.', tbltyp2(1:ltbt),
'_LOC_', imt,
'_', iogce,
'_', imtvl
134 if ( iprt >= 2 )
then
135 call errwrt(
'Local ' // tbltyp2(1:ltbt) //
':')
138 inquire ( file = locfil, exist = found )
139 if ( .not. found )
then
141 locfil = mtdir(1:lmtd) //
'/bufrtab.' // tbltyp2(1:ltbt) //
'_LOC_0_7_1'
142 if ( iprt >= 2 )
then
143 call errwrt(
'Local ' // tbltyp2(1:ltbt) //
' not found, so using:')
146 inquire ( file = locfil, exist = found )
147 if ( .not. found )
then
148 bort_str =
'BUFRLIB: MTFNAM - COULD NOT FIND LOCAL FILE:'
149 call bort2(bort_str, locfil)
177 integer function ireadmt ( lun )
result ( iret )
181 use modv_vars,
only: maxnc, maxcd, mxmtbb, mxmtbd
192 integer,
intent(in) :: lun
193 integer iprt, lun1, lun2, lmtd, lmt, lmtv, logce, lmtvl, imt, imtv, iogce, imtvl, ii, jj, idx, ncds3, ier, &
194 ibmt, ibmtv, ibogce, ibltv, idmt, idmtv, idogce, idltv,
iupbs01,
ifxy,
istdesc
196 character*(*),
parameter :: bort_str1 =
'BUFRLIB: IREADMT - COULD NOT OPEN STANDARD FILE:'
197 character*(*),
parameter :: bort_str2 =
'BUFRLIB: IREADMT - COULD NOT OPEN LOCAL FILE:'
198 character*275 stdfil,locfil
204 common /mstinf/ lun1, lun2, lmtd, mtdir
210 save lmt, lmtv, logce, lmtvl
224 if ( ( imt /= lmt ) .or. ( ( imt /= 0 ) .and. ( imtv /= lmtv ) ) .or. &
225 ( ( imt == 0 ) .and. ( imtv /= lmtv ) .and. ( ( imtv > 13 ) .or. ( lmtv > 13 ) ) ) )
then
243 do while ( (allstd) .and. (ii<=ncds3) )
254 if ( ( .not. allstd ) .and. ( ( iogce /= logce ) .or. ( imtvl /= lmtvl ) ) ) iret = 1
258 if ( iret == 0 )
return
265 if ( iprt >= 2 )
then
267 call errwrt(
'+++++++++++++++++++++++++++++++++++++++++++++++++')
268 call errwrt(
'BUFRLIB: IREADMT - OPENING/READING MASTER TABLES')
271 if (
isc3(lun) /= 0 )
then
275 call mtfnam ( imt, imtv, iogce, imtvl,
'TableB', stdfil, locfil )
276 open ( unit = lun1, file = stdfil, iostat = ier )
277 if ( ier /= 0 )
call bort2(bort_str1, stdfil)
278 open ( unit = lun2, file = locfil, iostat = ier )
279 if ( ier /= 0 )
call bort2(bort_str2, locfil)
282 call rdmtbb ( lun1, lun2, mxmtbb, ibmt, ibmtv, ibogce, ibltv,
nmtb,
ibfxyn,
cbscl,
cbsref,
cbbw, &
286 close ( unit = lun1 )
287 close ( unit = lun2 )
291 call mtfnam ( imt, imtv, iogce, imtvl,
'TableD', stdfil, locfil )
292 open ( unit = lun1, file = stdfil, iostat = ier )
293 if ( ier /= 0 )
call bort2(bort_str1, stdfil)
294 open ( unit = lun2, file = locfil, iostat = ier )
295 if ( ier /= 0 )
call bort2(bort_str2, locfil)
298 call rdmtbd ( lun1, lun2, mxmtbd, maxcd, idmt, idmtv, idogce, idltv,
nmtd,
idfxyn,
cdmnem,
cmdscd,
cdseq, &
302 idx =
icvidx_c( ii-1, jj-1, maxcd ) + 1
308 close ( unit = lun1 )
309 close ( unit = lun2 )
312 call cpmstabs_c (
nmtb,
ibfxyn,
cbscl,
cbsref,
cbbw,
cbunit,
cbmnem,
cbelem,
nmtd,
idfxyn,
cdseq,
cdmnem, &
316 if (
cdmf ==
'Y' )
then
320 call mtfnam ( imt, imtv, iogce, imtvl,
'CodeFlag', stdfil, locfil )
321 open ( unit = lun1, file = stdfil, iostat = ier )
322 if ( ier /= 0 )
call bort2(bort_str1, stdfil)
323 open ( unit = lun2, file = locfil, iostat = ier )
324 if ( ier /= 0 )
call bort2(bort_str2, locfil)
327 call rdmtbf ( lun1, lun2 )
330 close ( unit = lun1 )
331 close ( unit = lun2 )
334 if ( iprt >= 2 )
then
335 call errwrt(
'+++++++++++++++++++++++++++++++++++++++++++++++++')
370 subroutine rdmtbb ( lunstb, lunltb, mxmtbb, imt, imtv, iogce, iltv, nmtbb, imfxyn, cmscl, cmsref, cmbw, &
371 cmunit, cmmnem, cmdsc, cmelem )
375 integer,
intent(in) :: lunstb, lunltb, mxmtbb
376 integer,
intent(out) :: imt, imtv, iogce, iltv, nmtbb, imfxyn(*)
377 integer isfxyn, ilfxyn, iers, ierl
379 character,
intent(out) :: cmelem(120,*), cmunit(24,*), cmsref(12,*), cmmnem(8,*), cmscl(4,*), cmbw(4,*), cmdsc(*)*4
380 character*200 stline, ltline
381 character*128 bort_str
382 character*6 cmatch, adn30
386 call gettbh ( lunstb, lunltb,
'B', imt, imtv, iogce, iltv )
391 call getntbe ( lunstb, isfxyn, stline, iers )
392 call getntbe ( lunltb, ilfxyn, ltline, ierl )
393 do while ( ( iers == 0 ) .or. ( ierl == 0 ) )
394 if ( ( iers == 0 ) .and. ( ierl == 0 ) )
then
395 if ( isfxyn == ilfxyn )
then
396 cmatch = adn30( isfxyn, 6 )
397 write(bort_str,
'("BUFRLIB: RDMTBB - STANDARD AND LOCAL '// &
398 'TABLE B FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)') cmatch(1:1),
'-', cmatch(2:3),
'-', cmatch(4:6)
400 else if ( isfxyn < ilfxyn )
then
401 call sntbbe ( isfxyn, stline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
402 call getntbe ( lunstb, isfxyn, stline, iers )
404 call sntbbe ( ilfxyn, ltline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
405 call getntbe ( lunltb, ilfxyn, ltline, ierl )
407 else if ( iers == 0 )
then
408 call sntbbe ( isfxyn, stline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
409 call getntbe ( lunstb, isfxyn, stline, iers )
411 call sntbbe ( ilfxyn, ltline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
412 call getntbe ( lunltb, ilfxyn, ltline, ierl )
448 subroutine rdmtbd ( lunstd, lunltd, mxmtbd, mxelem, imt, imtv, iogce, iltv, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, &
449 nmelem, iefxyn, ceelem )
453 integer,
intent(in) :: lunstd, lunltd, mxmtbd, mxelem
454 integer,
intent(out) :: imt, imtv, iogce, iltv, nmtbd, imfxyn(*), nmelem(*), iefxyn(mxmtbd,mxelem)
455 integer isfxyn, ilfxyn, iers, ierl
457 character,
intent(out) :: cmseq(120,*), cmmnem(8,*), cmdsc(*)*4, ceelem(mxmtbd,mxelem)*120
459 character*200 stline, ltline
460 character*128 bort_str
461 character*6 cmatch, adn30
465 call gettbh ( lunstd, lunltd,
'D', imt, imtv, iogce, iltv )
470 call getntbe ( lunstd, isfxyn, stline, iers )
471 call getntbe ( lunltd, ilfxyn, ltline, ierl )
472 do while ( ( iers == 0 ) .or. ( ierl == 0 ) )
473 if ( ( iers == 0 ) .and. ( ierl == 0 ) )
then
474 if ( isfxyn == ilfxyn )
then
475 cmatch = adn30( isfxyn, 6 )
476 write(bort_str,
'("BUFRLIB: RDMTBD - STANDARD AND LOCAL '// &
477 'TABLE D FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)') cmatch(1:1),
'-', cmatch(2:3),
'-', cmatch(4:6)
479 else if ( isfxyn < ilfxyn )
then
480 call sntbde ( lunstd, isfxyn, stline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
481 call getntbe ( lunstd, isfxyn, stline, iers )
483 call sntbde ( lunltd, ilfxyn, ltline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
484 call getntbe ( lunltd, ilfxyn, ltline, ierl )
486 else if ( iers == 0 )
then
487 call sntbde ( lunstd, isfxyn, stline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
488 call getntbe ( lunstd, isfxyn, stline, iers )
490 call sntbde ( lunltd, ilfxyn, ltline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
491 call getntbe ( lunltd, ilfxyn, ltline, ierl )
513 integer,
intent(in) :: lunstf, lunltf
514 integer imt, imtv, iogce, iltv, isfxyn, ilfxyn, iers, ierl
516 character*160 stline, ltline
517 character*128 bort_str
518 character*6 cmatch, adn30
526 call gettbh ( lunstf, lunltf,
'F', imt, imtv, iogce, iltv )
530 call getntbe ( lunstf, isfxyn, stline, iers )
531 call getntbe ( lunltf, ilfxyn, ltline, ierl )
532 do while ( ( iers == 0 ) .or. ( ierl == 0 ) )
533 if ( ( iers == 0 ) .and. ( ierl == 0 ) )
then
534 if ( isfxyn == ilfxyn )
then
535 cmatch = adn30( isfxyn, 6 )
536 write(bort_str,
'("BUFRLIB: RDMTBF - STANDARD AND LOCAL '// &
537 'CODE/FLAG TABLE FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)') cmatch(1:1),
'-', cmatch(2:3),
'-', cmatch(4:6)
539 else if ( isfxyn < ilfxyn )
then
540 call sntbfe ( lunstf, isfxyn )
541 call getntbe ( lunstf, isfxyn, stline, iers )
543 call sntbfe ( lunltf, ilfxyn )
544 call getntbe ( lunltf, ilfxyn, ltline, ierl )
546 else if ( iers == 0 )
then
547 call sntbfe ( lunstf, isfxyn )
548 call getntbe ( lunstf, isfxyn, stline, iers )
550 call sntbfe ( lunltf, ilfxyn )
551 call getntbe ( lunltf, ilfxyn, ltline, ierl )
579 subroutine sntbbe ( ifxyn, line, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
583 integer,
intent(in) :: ifxyn, mxmtbb
584 integer,
intent(out) :: nmtbb, imfxyn(*)
585 integer ntag, ii, nemock
587 character,
intent(out) :: cmelem(120,*), cmunit(24,*), cmsref(12,*), cmmnem(8,*), cmscl(4,*), cmbw(4,*), cmdsc(*)*4
588 character*(*),
intent(in) :: line
589 character*(*),
parameter :: bort_str1_head =
'BUFRLIB: SNTBBE - TABLE B ENTRY FOR ELEMENT DESCRIPTOR: '
590 character*200 tags(10), wktag
591 character*128 bort_str1, bort_str2
593 if ( nmtbb >= mxmtbb )
call bort(
'BUFRLIB: SNTBBE - OVERFLOW OF MERGED ARRAYS')
598 imfxyn( nmtbb ) = ifxyn
602 call parstr ( line, tags, 10, ntag,
'|', .false. )
604 call sntbestr(bort_str1_head, ifxyn, bort_str1)
605 bort_str2 =
' HAS TOO FEW FIELDS'
606 call bort2(bort_str1, bort_str2)
611 tags(2) = adjustl( tags(2) )
612 if ( tags(2) ==
' ' )
then
613 call sntbestr(bort_str1_head, ifxyn, bort_str1)
614 bort_str2 =
' HAS MISSING SCALE FACTOR'
615 call bort2(bort_str1, bort_str2)
617 tags(2)(1:4) = adjustr( tags(2)(1:4) )
619 cmscl( ii, nmtbb ) = tags(2)(ii:ii)
624 tags(3) = adjustl( tags(3) )
625 if ( tags(3) ==
' ' )
then
626 call sntbestr(bort_str1_head, ifxyn, bort_str1)
627 bort_str2 =
' HAS MISSING REFERENCE VALUE'
628 call bort2(bort_str1, bort_str2)
630 tags(3)(1:12) = adjustr( tags(3)(1:12) )
632 cmsref( ii, nmtbb ) = tags(3)(ii:ii)
637 tags(4) = adjustl( tags(4) )
638 if ( tags(4) ==
' ' )
then
639 call sntbestr(bort_str1_head, ifxyn, bort_str1)
640 bort_str2 =
' HAS MISSING BIT WIDTH'
641 call bort2(bort_str1, bort_str2)
643 tags(4)(1:4) = adjustr( tags(4)(1:4) )
645 cmbw( ii, nmtbb ) = tags(4)(ii:ii)
651 tags(5) = adjustl( tags(5) )
653 cmunit( ii, nmtbb ) = tags(5)(ii:ii)
657 cmunit( ii, nmtbb ) =
' '
665 cmmnem( ii, nmtbb ) =
' '
668 cmelem( ii, nmtbb ) =
' '
672 call parstr ( wktag, tags, 10, ntag,
';', .false. )
675 tags(1) = adjustl( tags(1) )
677 if ( ( tags(1) /=
' ' ) .and. ( nemock( tags(1) ) /= 0 ) )
then
678 call sntbestr(bort_str1_head, ifxyn, bort_str1)
679 bort_str2 =
' HAS ILLEGAL MNEMONIC'
680 call bort2(bort_str1, bort_str2)
683 cmmnem( ii, nmtbb ) = tags(1)(ii:ii)
688 tags(2) = adjustl( tags(2) )
689 cmdsc( nmtbb ) = tags(2)(1:4)
693 tags(3) = adjustl( tags(3) )
695 cmelem( ii, nmtbb ) = tags(3)(ii:ii)
723 subroutine sntbde ( lunt, ifxyn, line, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
727 integer,
intent(in) :: lunt, ifxyn, mxmtbd, mxelem
728 integer,
intent(out) :: nmtbd, imfxyn(*), nmelem(*), iefxyn(mxmtbd,mxelem)
729 integer ii, ipt, ntag, nelem, nemock, ifxy, igetfxy, igetntbl
731 character*(*),
intent(in) :: line
732 character*(*),
parameter :: bort_str1_head =
'BUFRLIB: SNTBDE - TABLE D ENTRY FOR SEQUENCE DESCRIPTOR: '
733 character,
intent(out) :: cmseq(120,*), cmmnem(8,*), cmdsc(*)*4, ceelem(mxmtbd,mxelem)*120
734 character*200 tags(10), cline
735 character*128 bort_str1, bort_str2
740 if ( nmtbd >= mxmtbd )
call bort(
'BUFRLIB: SNTBDE - OVERFLOW OF MERGED ARRAYS')
745 imfxyn( nmtbd ) = ifxyn
750 cmmnem( ii, nmtbd ) =
' '
754 cmseq( ii, nmtbd ) =
' '
756 ipt = index( line,
'|' )
759 call parstr ( line(ipt+1:), tags, 10, ntag,
';', .false. )
762 tags(1) = adjustl( tags(1) )
764 if ( ( tags(1) /=
' ' ) .and. ( nemock( tags(1) ) /= 0 ) )
then
765 call sntbestr(bort_str1_head, ifxyn, bort_str1)
766 bort_str2 =
' HAS ILLEGAL MNEMONIC'
767 call bort2(bort_str1, bort_str2)
770 cmmnem( ii, nmtbd ) = tags(1)(ii:ii)
775 tags(2) = adjustl( tags(2) )
776 cmdsc( nmtbd ) = tags(2)(1:4)
780 tags(3) = adjustl( tags(3) )
782 cmseq( ii, nmtbd ) = tags(3)(ii:ii)
792 do while ( .not. done )
793 if ( igetntbl( lunt, cline ) /= 0 )
then
794 call sntbestr(bort_str1_head, ifxyn, bort_str1)
795 bort_str2 =
' IS INCOMPLETE'
796 call bort2(bort_str1, bort_str2)
798 call parstr ( cline, tags, 10, ntag,
'|', .false. )
800 call sntbestr(bort_str1_head, ifxyn, bort_str1)
801 bort_str2 =
' HAS BAD ELEMENT CARD'
802 call bort2(bort_str1, bort_str2)
805 if ( igetfxy( tags(2), adsc ) /= 0 )
then
806 call sntbestr(bort_str1_head, ifxyn, bort_str1)
807 bort_str2 =
' HAS BAD OR MISSING ELEMENT FXY NUMBER'
808 call bort2(bort_str1, bort_str2)
810 if ( nelem >= mxelem )
CALL bort(
'BUFRLIB: SNTBDE - OVERFLOW OF MERGED ARRAYS')
812 iefxyn( nmtbd, nelem ) = ifxy( adsc )
815 tags(3) = adjustl( tags(3) )
816 ceelem( nmtbd, nelem ) = tags(3)(1:120)
818 ceelem( nmtbd, nelem ) =
' '
821 if ( index( tags(2),
' >' ) == 0 ) done = .true.
823 nmelem( nmtbd ) = nelem
841 integer,
intent(in) :: lunt, ifxyn
842 integer idfxy(10), idval(25), nidfxy, nidval, ntag, ii, jj, ival, ier, ipt, lt3, ifxy, igetfxy, igetntbl
844 character*160 cline, tags(4), cdstr(2), adsc(10), cval(25)
845 character*(*),
parameter :: bort_str1_head =
'BUFRLIB: SNTBFE - TABLE F ENTRY FOR ELEMENT DESCRIPTOR: '
846 character*128 bort_str1, bort_str2
849 logical done, lstnblk
859 do while ( .not. done )
861 if ( igetntbl( lunt, cline ) /= 0 )
then
862 call sntbestr(bort_str1_head, ifxyn, bort_str1)
863 bort_str2 =
' IS INCOMPLETE'
864 call bort2(bort_str1, bort_str2)
867 call parstr ( cline, tags, 4, ntag,
'|', .false. )
868 if ( ( ntag < 2 ) .or. ( ntag > 3 ) )
then
869 call sntbestr(bort_str1_head, ifxyn, bort_str1)
870 bort_str2 =
' HAS BAD CARD'
871 call bort2(bort_str1, bort_str2)
874 if ( ntag == 2 )
then
878 call parstr ( tags(2), cdstr, 2, ntag,
'=', .false. )
879 if ( ntag /= 2 )
then
880 call sntbestr(bort_str1_head, ifxyn, bort_str1)
881 bort_str2 =
' HAS BAD DEPENDENCY CARD'
882 call bort2(bort_str1, bort_str2)
885 call parstr ( cdstr(1), adsc, 10, nidfxy,
',', .false. )
886 if ( ( nidfxy == 0 ) .or. ( ( nidfxy == 1 ) .and. ( adsc(1) ==
' ' ) ) )
then
887 call sntbestr(bort_str1_head, ifxyn, bort_str1)
888 bort_str2 =
' HAS BAD DEPENDENCY LIST (FXY)'
889 call bort2(bort_str1, bort_str2)
892 if ( igetfxy( adsc(ii), cdsc ) /= 0 )
then
893 call sntbestr(bort_str1_head, ifxyn, bort_str1)
894 bort_str2 =
' HAS BAD DEPENDENCY (FXY)'
895 call bort2(bort_str1, bort_str2)
897 idfxy(ii) = ifxy( cdsc )
900 call parstr ( cdstr(2), cval, 25, nidval,
',', .false. )
901 if ( ( nidval == 0 ) .or. ( ( nidval == 1 ) .and. ( cval(1) ==
' ' ) ) )
then
902 call sntbestr(bort_str1_head, ifxyn, bort_str1)
903 bort_str2 =
' HAS BAD DEPENDENCY LIST (VAL)'
904 call bort2(bort_str1, bort_str2)
907 cval(ii) = adjustl( cval(ii) )
908 call strnum ( cval(ii), ival, ier )
910 call sntbestr(bort_str1_head, ifxyn, bort_str1)
911 bort_str2 =
' HAS BAD DEPENDENCY (VAL)'
912 call bort2(bort_str1, bort_str2)
921 ipt = index( tags(2),
' >' )
926 tags(2)(ipt+1:ipt+1) =
' '
928 tags(2) = adjustl( tags(2) )
929 call strnum ( tags(2), ival, ier )
931 tags(3) = adjustl( tags(3) )
934 do while ( ( lt3 > 0 ) .and. ( .not. lstnblk ) )
935 if ( tags(3)(lt3:lt3) /=
' ' )
then
942 if ( ( nidfxy == 0 ) .and. ( nidval == 0 ) )
then
943 call strtbfe_c ( ifxyn, ival, tags(3), lt3, -1, -1 )
947 call strtbfe_c ( ifxyn, ival, tags(3), lt3, idfxy(ii), idval(jj) )
970 character*(*),
intent(in) :: hestr
971 character*(*),
intent(out) :: estr
972 character*6 adn30, clemon
974 integer,
intent(in) :: ifxyn
976 clemon = adn30( ifxyn, 6 )
977 estr = hestr // clemon(1:1) //
'-' // clemon(2:3) //
'-' // clemon(4:6)
992 integer function igetntbl ( lunt, line )
result ( iret )
996 integer,
intent(in) :: lunt
999 character*(*),
intent(out) :: line
1002 read ( lunt,
'(A)', iostat = ier ) line
1003 if ( ( ier /= 0 ) .or. ( line(1:3) ==
'END' ) )
then
1007 if ( ( line /=
' ' ) .and. ( line(1:1) /=
'#' ) )
then
1027 integer function igettdi ( iflag )
result ( iret )
1031 integer,
intent(in) :: iflag
1032 integer,
parameter :: idxmin = 62976
1033 integer,
parameter :: idxmax = 63231
1038 if ( iflag == 0 )
then
1045 if ( idx > idxmax )
call bort(
'BUFRLIB: IGETTDI - IDXMAX OVERFLOW')
1071 subroutine gettbh ( luns, lunl, tab, imt, imtv, iogce, iltv )
1075 integer,
intent(in) :: luns, lunl
1076 integer,
intent(out) :: imt, imtv, iogce, iltv
1077 integer ntag, imt2, iersn, igetntbl
1079 character,
intent(in) :: tab
1081 character*128 bort_str
1082 character*(*),
parameter :: bort_str_head =
'BUFRLIB: GETTBH - BAD OR MISSING HEADER WITHIN '
1084 character*30 tags(5), label
1091 badlabel( label ) = ( ( index( label, cttyp ) == 0 ) .or. ( index( label, cftyp ) == 0 ) )
1098 if ( igetntbl( luns, header ) /= 0 )
then
1099 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1102 call parstr ( header, tags, 5, ntag,
'|', .false. )
1103 if ( ( ntag < 3 ) .or. ( badlabel( tags(1) ) ) )
then
1104 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1107 call strnum ( tags(2), imt, iersn )
1108 call strnum ( tags(3), imtv, iersn )
1113 if ( igetntbl( lunl, header ) /= 0 )
then
1114 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1117 call parstr ( header, tags, 5, ntag,
'|', .false. )
1118 if ( ( ntag < 4 ) .or. ( badlabel( tags(1) ) ) )
then
1119 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1122 call strnum ( tags(2), imt2, iersn )
1123 call strnum ( tags(3), iogce, iersn )
1124 call strnum ( tags(4), iltv, iersn )
1128 if ( imt /= imt2 )
then
1129 write(bort_str,
'("BUFRLIB: GETTBH - MASTER TABLE NUMBER MISMATCH BETWEEN STD AND LOC TABLE ",A)') tab
1151 integer,
intent(in) :: lunt
1152 integer,
intent(out) :: ifxyn, iret
1153 integer ntag, igetfxy, ifxy, igetntbl
1155 character*(*),
intent(out) :: line
1156 character*128 bort_str1, bort_str2
1157 character*20 tags(4)
1162 iret = igetntbl( lunt, line )
1163 if ( iret == 0 )
then
1165 call parstr ( line(1:20), tags, 4, ntag,
'|', .false. )
1166 if ( igetfxy( tags(1), adsc ) /= 0 )
then
1167 bort_str1 =
'BUFRLIB: GETNTBE - CARD BEGINNING WITH: ' // line(1:20)
1168 bort_str2 =
' HAS BAD OR MISSING FXY NUMBER'
1169 call bort2(bort_str1, bort_str2)
1172 ifxyn = ifxy( adsc )
1214 character,
intent(in) :: cf
1216 character*128 bort_str
1219 if(cf/=
'Y'.and. cf/=
'N')
then
1220 write(bort_str,
'("BUFRLIB: CODFLG - INPUT ARGUMENT IS ",A1,", IT MUST BE EITHER Y OR N")') cf
1246 character*(*),
intent(in) :: nemo
1252 if(nemo(i:i)/=
' ')
then
1257 if(lnemo<1 .or. lnemo>8)
then
1264 if ( verify(nemo(1:lnemo),
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.') == 0 )
then
subroutine bort(str)
Log an error message, then abort the application program.
subroutine bort2(str1, str2)
Log two error messages, then abort the application program.
subroutine errwrt(str)
Specify a custom location for the logging of error and diagnostic messages generated by the NCEPLIBS-...
integer function ifxy(adsc)
Convert an FXY value from its 6 character representation to its WMO bit-wise representation.
subroutine sntbde(lunt, ifxyn, line, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem)
Store the first line of an entry that was previously read from an ASCII master Table D file into a se...
subroutine sntbfe(lunt, ifxyn)
Read an entire entry from a previously-opened ASCII master Code/Flag table file, then store the infor...
subroutine sntbestr(hestr, ifxyn, estr)
Generate an error-reporting string containing an FXY number.
subroutine rdmtbd(lunstd, lunltd, mxmtbd, mxelem, imt, imtv, iogce, iltv, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem)
Read master Table D information from two separate ASCII files (one standard and one local) and then m...
subroutine mtfnam(imt, imtv, iogce, imtvl, tbltyp, stdfil, locfil)
Based on the input arguments, determine the names of the corresponding standard and local master tabl...
subroutine codflg(cf)
Specify whether or not code and flag table information should be included during all future reads of ...
integer function nemock(nemo)
Check a mnemonic for validity.
subroutine sntbbe(ifxyn, line, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem)
Store an entry that was previously read from an ASCII master Table B file into a set of merged Fortra...
subroutine getntbe(lunt, ifxyn, line, iret)
Read the first line of the next entry from the specified ASCII master table B, table D or table F (Co...
integer function igettdi(iflag)
Depending on the value of the input flag, either return the next usable scratch Table D index for the...
subroutine rdmtbb(lunstb, lunltb, mxmtbb, imt, imtv, iogce, iltv, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem)
Read master Table B information from two separate ASCII files (one standard and one local) and then m...
integer function igetntbl(lunt, line)
Read the next line from an ASCII master table B, table D or Code/Flag table file, ignoring any blank ...
subroutine gettbh(luns, lunl, tab, imt, imtv, iogce, iltv)
Read the header lines from two separate ASCII files (one standard and one local) containing master ta...
recursive subroutine mtinfo(cmtdir, lunmt1, lunmt2)
Specify the directory location and Fortran logical unit numbers to be used when reading master BUFR t...
subroutine rdmtbf(lunstf, lunltf)
Read master Code/Flag table information from two separate ASCII files (one standard and one local) an...
integer function ireadmt(lun)
Check the most recent BUFR message that was read via a call to one of the message-reading subroutines...
recursive subroutine strnum(str, num, iret)
Decode an integer from a character string.
subroutine strsuc(str1, str2, lens)
Remove leading and trailing blanks from a character string.
subroutine capit(str)
Capitalize all of the alphabetic characters in a string.
Wrap C NCEPLIBS-bufr functions so they can be called from within the Fortran part of the library.
Declare arrays and variables used to store BUFR messages internally for multiple file IDs.
integer, dimension(:,:), allocatable mbay
Current BUFR message for each file ID.
Declare arrays and variables used to store master Table B and Table D entries within internal memory.
integer, dimension(:), allocatable idfxyn
WMO bit-wise representations of FXY numbers for master Table D.
character, dimension(:,:), allocatable cbunit
Units corresponding to ibfxyn.
integer nmtb
Number of master Table B entries (up to a maximum of mxmtbb).
character, dimension(:,:), allocatable cbbw
Bit widths corresponding to ibfxyn.
character, dimension(:,:), allocatable cdseq
Sequence names corresponding to idfxyn.
character, dimension(:,:), allocatable cbmnem
Mnemonics corresponding to ibfxyn.
integer, dimension(:), allocatable ndelem
Numbers of child descriptors corresponding to idfxyn.
character, dimension(:,:), allocatable cbelem
Element names corresponding to ibfxyn.
character, dimension(:,:), allocatable cbscl
Scale factors corresponding to ibfxyn.
character, dimension(:,:), allocatable cdmnem
Mnemonics corresponding to idfxyn.
character, dimension(:,:), allocatable cbsref
Reference values corresponding to ibfxyn.
integer nmtd
Number of master Table D entries (up to a maximum of mxmtbd).
integer, dimension(:), allocatable idefxy
WMO bit-wise representations of child descriptors corresponding to idfxyn.
integer, dimension(:), allocatable ibfxyn
WMO bit-wise representations of FXY numbers for master Table B.
Declare arrays and variables used to store master Table B and Table D entries within internal memory.
character *120, dimension(:,:), allocatable ceelem
Element names corresponding to iefxyn.
character *4, dimension(:), allocatable cmdscb
Descriptor codes for Table B elements.
integer, dimension(:,:), allocatable iefxyn
WMO bit-wise representations of child descriptors of Table D sequences.
character *4, dimension(:), allocatable cmdscd
Descriptor codes for Table D sequences.
Declare arrays used by various subroutines and functions to hold a temporary working copy of a Sectio...
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 ...
integer, dimension(:), allocatable isc3
Section 3 switch for each file ID:
Declare a variable used to indicate whether master code and flag tables should be read.
character cdmf
Flag indicating whether to include code and flag table information during reads of master BUFR tables...
recursive integer function iupbs01(mbay, s01mnem)
Read a specified value from within Section 0 or Section 1 of a BUFR message.
recursive subroutine upds3(mbay, lcds3, cds3, nds3)
Read the sequence of data descriptors contained within Section 3 of a BUFR message.
integer function istdesc(idn)
Given the WMO bit-wise representation of an FXY value for a descriptor, check whether the descriptor ...
subroutine parstr(str, tags, mtag, ntag, sep, limit80)
Parse a string containing one or more substrings into an array of substrings.
subroutine x84(iin8, iout4, nval)
Encode one or more 8-byte integer values as 4-byte integer values.