34 recursive subroutine mtinfo ( cmtdir, lunmt1, lunmt2 )
36 use modv_vars,
only: im8b, lun1, lun2, mtdir, lmtd
40 integer,
intent(in) :: lunmt1, lunmt2
41 integer my_lunmt1, my_lunmt2
43 character*(*),
intent(in) :: cmtdir
48 call x84 ( lunmt1, my_lunmt1, 1 )
49 call x84 ( lunmt2, my_lunmt2, 1 )
50 call mtinfo ( cmtdir, my_lunmt1, my_lunmt2 )
55 call strsuc ( cmtdir, mtdir, lmtd )
81 subroutine mtfnam ( imt, imtv, iogce, imtvl, tbltyp, stdfil, locfil )
83 use modv_vars,
only: iprt, mtdir, lmtd
87 integer,
intent(in) :: imt, imtv, iogce, imtvl
90 character*(*),
intent(in) :: tbltyp
91 character*(*),
intent(out) :: stdfil, locfil
95 character*128 bort_str
99 call strsuc ( tbltyp, tbltyp2, ltbt )
103 if ( ( imt == 0 ) .and. ( imtv <= 13 ) )
then
105 stdfil = mtdir(1:lmtd) //
'/bufrtab.' // tbltyp2(1:ltbt) //
'_STD_0_13'
107 write ( fmtf,
'(A,I1,A,I1,A)' )
'(4A,I', isize(imt),
',A,I', isize(imtv),
')'
108 write ( stdfil, fmtf ) mtdir(1:lmtd),
'/bufrtab.', tbltyp2(1:ltbt),
'_STD_', imt,
'_', imtv
110 if ( iprt >= 2 )
then
111 call errwrt(
'Standard ' // tbltyp2(1:ltbt) //
':')
114 inquire ( file = stdfil, exist = found )
115 if ( .not. found )
then
116 bort_str =
'BUFRLIB: MTFNAM - COULD NOT FIND STANDARD FILE:'
117 call bort2(bort_str, stdfil)
125 write ( fmtf,
'(A,I1,A,I1,A,I1,A)' )
'(4A,I', isize(imt),
',A,I', isize(iogce),
',A,I', isize(imtvl),
')'
126 write ( locfil, fmtf ) mtdir(1:lmtd),
'/bufrtab.', tbltyp2(1:ltbt),
'_LOC_', imt,
'_', iogce,
'_', imtvl
127 if ( iprt >= 2 )
then
128 call errwrt(
'Local ' // tbltyp2(1:ltbt) //
':')
131 inquire ( file = locfil, exist = found )
132 if ( .not. found )
then
134 locfil = mtdir(1:lmtd) //
'/bufrtab.' // tbltyp2(1:ltbt) //
'_LOC_0_7_1'
135 if ( iprt >= 2 )
then
136 call errwrt(
'Local ' // tbltyp2(1:ltbt) //
' not found, so using:')
139 inquire ( file = locfil, exist = found )
140 if ( .not. found )
then
141 bort_str =
'BUFRLIB: MTFNAM - COULD NOT FIND LOCAL FILE:'
142 call bort2(bort_str, locfil)
168 integer function ireadmt ( lun )
result ( iret )
172 use modv_vars,
only: maxnc, maxcd, mxmtbb, mxmtbd, iprt, lun1, lun2, lmt, lmtv, logce, lmtvl
183 integer,
intent(in) :: lun
184 integer imt, imtv, iogce, imtvl, ii, jj, idx, ncds3, ier, ibmt, ibmtv, ibogce, ibltv, idmt, idmtv, idogce, idltv, &
187 character*(*),
parameter :: bort_str1 =
'BUFRLIB: IREADMT - COULD NOT OPEN STANDARD FILE:'
188 character*(*),
parameter :: bort_str2 =
'BUFRLIB: IREADMT - COULD NOT OPEN LOCAL FILE:'
189 character*275 stdfil,locfil
207 if ( ( imt /= lmt ) .or. ( ( imt /= 0 ) .and. ( imtv /= lmtv ) ) .or. &
208 ( ( imt == 0 ) .and. ( imtv /= lmtv ) .and. ( ( imtv > 13 ) .or. ( lmtv > 13 ) ) ) )
then
226 do while ( (allstd) .and. (ii<=ncds3) )
237 if ( ( .not. allstd ) .and. ( ( iogce /= logce ) .or. ( imtvl /= lmtvl ) ) ) iret = 1
241 if ( iret == 0 )
return
248 if ( iprt >= 2 )
then
250 call errwrt(
'+++++++++++++++++++++++++++++++++++++++++++++++++')
251 call errwrt(
'BUFRLIB: IREADMT - OPENING/READING MASTER TABLES')
254 if (
isc3(lun) /= 0 )
then
258 call mtfnam ( imt, imtv, iogce, imtvl,
'TableB', stdfil, locfil )
259 open ( unit = lun1, file = stdfil, iostat = ier )
260 if ( ier /= 0 )
call bort2(bort_str1, stdfil)
261 open ( unit = lun2, file = locfil, iostat = ier )
262 if ( ier /= 0 )
call bort2(bort_str2, locfil)
265 call rdmtbb ( lun1, lun2, mxmtbb, ibmt, ibmtv, ibogce, ibltv,
nmtb,
ibfxyn,
cbscl,
cbsref,
cbbw, &
269 close ( unit = lun1 )
270 close ( unit = lun2 )
274 call mtfnam ( imt, imtv, iogce, imtvl,
'TableD', stdfil, locfil )
275 open ( unit = lun1, file = stdfil, iostat = ier )
276 if ( ier /= 0 )
call bort2(bort_str1, stdfil)
277 open ( unit = lun2, file = locfil, iostat = ier )
278 if ( ier /= 0 )
call bort2(bort_str2, locfil)
281 call rdmtbd ( lun1, lun2, mxmtbd, maxcd, idmt, idmtv, idogce, idltv,
nmtd,
idfxyn,
cdmnem,
cmdscd,
cdseq, &
285 idx =
icvidx_c( ii-1, jj-1, maxcd ) + 1
291 close ( unit = lun1 )
292 close ( unit = lun2 )
295 call cpmstabs_c (
nmtb,
ibfxyn,
cbscl,
cbsref,
cbbw,
cbunit,
cbmnem,
cbelem,
nmtd,
idfxyn,
cdseq,
cdmnem, &
299 if (
cdmf ==
'Y' )
then
303 call mtfnam ( imt, imtv, iogce, imtvl,
'CodeFlag', stdfil, locfil )
304 open ( unit = lun1, file = stdfil, iostat = ier )
305 if ( ier /= 0 )
call bort2(bort_str1, stdfil)
306 open ( unit = lun2, file = locfil, iostat = ier )
307 if ( ier /= 0 )
call bort2(bort_str2, locfil)
310 call rdmtbf ( lun1, lun2 )
313 close ( unit = lun1 )
314 close ( unit = lun2 )
317 if ( iprt >= 2 )
then
318 call errwrt(
'+++++++++++++++++++++++++++++++++++++++++++++++++')
353 subroutine rdmtbb ( lunstb, lunltb, mxmtbb, imt, imtv, iogce, iltv, nmtbb, imfxyn, cmscl, cmsref, cmbw, &
354 cmunit, cmmnem, cmdsc, cmelem )
358 integer,
intent(in) :: lunstb, lunltb, mxmtbb
359 integer,
intent(out) :: imt, imtv, iogce, iltv, nmtbb, imfxyn(*)
360 integer isfxyn, ilfxyn, iers, ierl
362 character,
intent(out) :: cmelem(120,*), cmunit(24,*), cmsref(12,*), cmmnem(8,*), cmscl(4,*), cmbw(4,*), cmdsc(*)*4
363 character*200 stline, ltline
364 character*128 bort_str
365 character*6 cmatch, adn30
369 call gettbh ( lunstb, lunltb,
'B', imt, imtv, iogce, iltv )
374 call getntbe ( lunstb, isfxyn, stline, iers )
375 call getntbe ( lunltb, ilfxyn, ltline, ierl )
376 do while ( ( iers == 0 ) .or. ( ierl == 0 ) )
377 if ( ( iers == 0 ) .and. ( ierl == 0 ) )
then
378 if ( isfxyn == ilfxyn )
then
379 cmatch = adn30( isfxyn, 6 )
380 write(bort_str,
'("BUFRLIB: RDMTBB - STANDARD AND LOCAL '// &
381 'TABLE B FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)') cmatch(1:1),
'-', cmatch(2:3),
'-', cmatch(4:6)
383 else if ( isfxyn < ilfxyn )
then
384 call sntbbe ( isfxyn, stline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
385 call getntbe ( lunstb, isfxyn, stline, iers )
387 call sntbbe ( ilfxyn, ltline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
388 call getntbe ( lunltb, ilfxyn, ltline, ierl )
390 else if ( iers == 0 )
then
391 call sntbbe ( isfxyn, stline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
392 call getntbe ( lunstb, isfxyn, stline, iers )
394 call sntbbe ( ilfxyn, ltline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
395 call getntbe ( lunltb, ilfxyn, ltline, ierl )
431 subroutine rdmtbd ( lunstd, lunltd, mxmtbd, mxelem, imt, imtv, iogce, iltv, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, &
432 nmelem, iefxyn, ceelem )
436 integer,
intent(in) :: lunstd, lunltd, mxmtbd, mxelem
437 integer,
intent(out) :: imt, imtv, iogce, iltv, nmtbd, imfxyn(*), nmelem(*), iefxyn(mxmtbd,mxelem)
438 integer isfxyn, ilfxyn, iers, ierl
440 character,
intent(out) :: cmseq(120,*), cmmnem(8,*), cmdsc(*)*4, ceelem(mxmtbd,mxelem)*120
442 character*200 stline, ltline
443 character*128 bort_str
444 character*6 cmatch, adn30
448 call gettbh ( lunstd, lunltd,
'D', imt, imtv, iogce, iltv )
453 call getntbe ( lunstd, isfxyn, stline, iers )
454 call getntbe ( lunltd, ilfxyn, ltline, ierl )
455 do while ( ( iers == 0 ) .or. ( ierl == 0 ) )
456 if ( ( iers == 0 ) .and. ( ierl == 0 ) )
then
457 if ( isfxyn == ilfxyn )
then
458 cmatch = adn30( isfxyn, 6 )
459 write(bort_str,
'("BUFRLIB: RDMTBD - STANDARD AND LOCAL '// &
460 'TABLE D FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)') cmatch(1:1),
'-', cmatch(2:3),
'-', cmatch(4:6)
462 else if ( isfxyn < ilfxyn )
then
463 call sntbde ( lunstd, isfxyn, stline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
464 call getntbe ( lunstd, isfxyn, stline, iers )
466 call sntbde ( lunltd, ilfxyn, ltline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
467 call getntbe ( lunltd, ilfxyn, ltline, ierl )
469 else if ( iers == 0 )
then
470 call sntbde ( lunstd, isfxyn, stline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
471 call getntbe ( lunstd, isfxyn, stline, iers )
473 call sntbde ( lunltd, ilfxyn, ltline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
474 call getntbe ( lunltd, ilfxyn, ltline, ierl )
496 integer,
intent(in) :: lunstf, lunltf
497 integer imt, imtv, iogce, iltv, isfxyn, ilfxyn, iers, ierl
499 character*160 stline, ltline
500 character*128 bort_str
501 character*6 cmatch, adn30
509 call gettbh ( lunstf, lunltf,
'F', imt, imtv, iogce, iltv )
513 call getntbe ( lunstf, isfxyn, stline, iers )
514 call getntbe ( lunltf, ilfxyn, ltline, ierl )
515 do while ( ( iers == 0 ) .or. ( ierl == 0 ) )
516 if ( ( iers == 0 ) .and. ( ierl == 0 ) )
then
517 if ( isfxyn == ilfxyn )
then
518 cmatch = adn30( isfxyn, 6 )
519 write(bort_str,
'("BUFRLIB: RDMTBF - STANDARD AND LOCAL '// &
520 'CODE/FLAG TABLE FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)') cmatch(1:1),
'-', cmatch(2:3),
'-', cmatch(4:6)
522 else if ( isfxyn < ilfxyn )
then
523 call sntbfe ( lunstf, isfxyn )
524 call getntbe ( lunstf, isfxyn, stline, iers )
526 call sntbfe ( lunltf, ilfxyn )
527 call getntbe ( lunltf, ilfxyn, ltline, ierl )
529 else if ( iers == 0 )
then
530 call sntbfe ( lunstf, isfxyn )
531 call getntbe ( lunstf, isfxyn, stline, iers )
533 call sntbfe ( lunltf, ilfxyn )
534 call getntbe ( lunltf, ilfxyn, ltline, ierl )
562 subroutine sntbbe ( ifxyn, line, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
566 integer,
intent(in) :: ifxyn, mxmtbb
567 integer,
intent(inout) :: nmtbb
568 integer,
intent(out) :: imfxyn(*)
569 integer ntag, ii, nemock
571 character,
intent(out) :: cmelem(120,*), cmunit(24,*), cmsref(12,*), cmmnem(8,*), cmscl(4,*), cmbw(4,*), cmdsc(*)*4
572 character*(*),
intent(in) :: line
573 character*(*),
parameter :: bort_str1_head =
'BUFRLIB: SNTBBE - TABLE B ENTRY FOR ELEMENT DESCRIPTOR: '
574 character*200 tags(10), wktag
575 character*128 bort_str1, bort_str2
577 if ( nmtbb >= mxmtbb )
call bort(
'BUFRLIB: SNTBBE - OVERFLOW OF MERGED ARRAYS')
582 imfxyn( nmtbb ) = ifxyn
586 call parstr ( line, tags, 10, ntag,
'|', .false. )
588 call sntbestr(bort_str1_head, ifxyn, bort_str1)
589 bort_str2 =
' HAS TOO FEW FIELDS'
590 call bort2(bort_str1, bort_str2)
595 tags(2) = adjustl( tags(2) )
596 if ( tags(2) ==
' ' )
then
597 call sntbestr(bort_str1_head, ifxyn, bort_str1)
598 bort_str2 =
' HAS MISSING SCALE FACTOR'
599 call bort2(bort_str1, bort_str2)
601 tags(2)(1:4) = adjustr( tags(2)(1:4) )
603 cmscl( ii, nmtbb ) = tags(2)(ii:ii)
608 tags(3) = adjustl( tags(3) )
609 if ( tags(3) ==
' ' )
then
610 call sntbestr(bort_str1_head, ifxyn, bort_str1)
611 bort_str2 =
' HAS MISSING REFERENCE VALUE'
612 call bort2(bort_str1, bort_str2)
614 tags(3)(1:12) = adjustr( tags(3)(1:12) )
616 cmsref( ii, nmtbb ) = tags(3)(ii:ii)
621 tags(4) = adjustl( tags(4) )
622 if ( tags(4) ==
' ' )
then
623 call sntbestr(bort_str1_head, ifxyn, bort_str1)
624 bort_str2 =
' HAS MISSING BIT WIDTH'
625 call bort2(bort_str1, bort_str2)
627 tags(4)(1:4) = adjustr( tags(4)(1:4) )
629 cmbw( ii, nmtbb ) = tags(4)(ii:ii)
635 tags(5) = adjustl( tags(5) )
637 cmunit( ii, nmtbb ) = tags(5)(ii:ii)
641 cmunit( ii, nmtbb ) =
' '
649 cmmnem( ii, nmtbb ) =
' '
652 cmelem( ii, nmtbb ) =
' '
656 call parstr ( wktag, tags, 10, ntag,
';', .false. )
659 tags(1) = adjustl( tags(1) )
661 if ( ( tags(1) /=
' ' ) .and. ( nemock( tags(1) ) /= 0 ) )
then
662 call sntbestr(bort_str1_head, ifxyn, bort_str1)
663 bort_str2 =
' HAS ILLEGAL MNEMONIC'
664 call bort2(bort_str1, bort_str2)
667 cmmnem( ii, nmtbb ) = tags(1)(ii:ii)
672 tags(2) = adjustl( tags(2) )
673 cmdsc( nmtbb ) = tags(2)(1:4)
677 tags(3) = adjustl( tags(3) )
679 cmelem( ii, nmtbb ) = tags(3)(ii:ii)
707 subroutine sntbde ( lunt, ifxyn, line, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
711 integer,
intent(in) :: lunt, ifxyn, mxmtbd, mxelem
712 integer,
intent(inout) :: nmtbd
713 integer,
intent(out) :: imfxyn(*), nmelem(*), iefxyn(mxmtbd,mxelem)
714 integer ii, ipt, ntag, nelem, nemock, ifxy, igetfxy, igetntbl
716 character*(*),
intent(in) :: line
717 character*(*),
parameter :: bort_str1_head =
'BUFRLIB: SNTBDE - TABLE D ENTRY FOR SEQUENCE DESCRIPTOR: '
718 character,
intent(out) :: cmseq(120,*), cmmnem(8,*), cmdsc(*)*4, ceelem(mxmtbd,mxelem)*120
719 character*200 tags(10), cline
720 character*128 bort_str1, bort_str2
725 if ( nmtbd >= mxmtbd )
call bort(
'BUFRLIB: SNTBDE - OVERFLOW OF MERGED ARRAYS')
730 imfxyn( nmtbd ) = ifxyn
735 cmmnem( ii, nmtbd ) =
' '
739 cmseq( ii, nmtbd ) =
' '
741 ipt = index( line,
'|' )
744 call parstr ( line(ipt+1:), tags, 10, ntag,
';', .false. )
747 tags(1) = adjustl( tags(1) )
749 if ( ( tags(1) /=
' ' ) .and. ( nemock( tags(1) ) /= 0 ) )
then
750 call sntbestr(bort_str1_head, ifxyn, bort_str1)
751 bort_str2 =
' HAS ILLEGAL MNEMONIC'
752 call bort2(bort_str1, bort_str2)
755 cmmnem( ii, nmtbd ) = tags(1)(ii:ii)
760 tags(2) = adjustl( tags(2) )
761 cmdsc( nmtbd ) = tags(2)(1:4)
765 tags(3) = adjustl( tags(3) )
767 cmseq( ii, nmtbd ) = tags(3)(ii:ii)
777 do while ( .not. done )
778 if ( igetntbl( lunt, cline ) /= 0 )
then
779 call sntbestr(bort_str1_head, ifxyn, bort_str1)
780 bort_str2 =
' IS INCOMPLETE'
781 call bort2(bort_str1, bort_str2)
783 call parstr ( cline, tags, 10, ntag,
'|', .false. )
785 call sntbestr(bort_str1_head, ifxyn, bort_str1)
786 bort_str2 =
' HAS BAD ELEMENT CARD'
787 call bort2(bort_str1, bort_str2)
790 if ( igetfxy( tags(2), adsc ) /= 0 )
then
791 call sntbestr(bort_str1_head, ifxyn, bort_str1)
792 bort_str2 =
' HAS BAD OR MISSING ELEMENT FXY NUMBER'
793 call bort2(bort_str1, bort_str2)
795 if ( nelem >= mxelem )
CALL bort(
'BUFRLIB: SNTBDE - OVERFLOW OF MERGED ARRAYS')
797 iefxyn( nmtbd, nelem ) = ifxy( adsc )
800 tags(3) = adjustl( tags(3) )
801 ceelem( nmtbd, nelem ) = tags(3)(1:120)
803 ceelem( nmtbd, nelem ) =
' '
806 if ( index( tags(2),
' >' ) == 0 ) done = .true.
808 nmelem( nmtbd ) = nelem
826 integer,
intent(in) :: lunt, ifxyn
827 integer idfxy(10), idval(25), nidfxy, nidval, ntag, ii, jj, ival, ier, ipt, lt3, ifxy, igetfxy, igetntbl
829 character*160 cline, tags(4), cdstr(2), adsc(10), cval(25)
830 character*(*),
parameter :: bort_str1_head =
'BUFRLIB: SNTBFE - TABLE F ENTRY FOR ELEMENT DESCRIPTOR: '
831 character*128 bort_str1, bort_str2
834 logical done, lstnblk
844 do while ( .not. done )
846 if ( igetntbl( lunt, cline ) /= 0 )
then
847 call sntbestr(bort_str1_head, ifxyn, bort_str1)
848 bort_str2 =
' IS INCOMPLETE'
849 call bort2(bort_str1, bort_str2)
852 call parstr ( cline, tags, 4, ntag,
'|', .false. )
853 if ( ( ntag < 2 ) .or. ( ntag > 3 ) )
then
854 call sntbestr(bort_str1_head, ifxyn, bort_str1)
855 bort_str2 =
' HAS BAD CARD'
856 call bort2(bort_str1, bort_str2)
859 if ( ntag == 2 )
then
863 call parstr ( tags(2), cdstr, 2, ntag,
'=', .false. )
864 if ( ntag /= 2 )
then
865 call sntbestr(bort_str1_head, ifxyn, bort_str1)
866 bort_str2 =
' HAS BAD DEPENDENCY CARD'
867 call bort2(bort_str1, bort_str2)
870 call parstr ( cdstr(1), adsc, 10, nidfxy,
',', .false. )
871 if ( ( nidfxy == 0 ) .or. ( ( nidfxy == 1 ) .and. ( adsc(1) ==
' ' ) ) )
then
872 call sntbestr(bort_str1_head, ifxyn, bort_str1)
873 bort_str2 =
' HAS BAD DEPENDENCY LIST (FXY)'
874 call bort2(bort_str1, bort_str2)
877 if ( igetfxy( adsc(ii), cdsc ) /= 0 )
then
878 call sntbestr(bort_str1_head, ifxyn, bort_str1)
879 bort_str2 =
' HAS BAD DEPENDENCY (FXY)'
880 call bort2(bort_str1, bort_str2)
882 idfxy(ii) = ifxy( cdsc )
885 call parstr ( cdstr(2), cval, 25, nidval,
',', .false. )
886 if ( ( nidval == 0 ) .or. ( ( nidval == 1 ) .and. ( cval(1) ==
' ' ) ) )
then
887 call sntbestr(bort_str1_head, ifxyn, bort_str1)
888 bort_str2 =
' HAS BAD DEPENDENCY LIST (VAL)'
889 call bort2(bort_str1, bort_str2)
892 cval(ii) = adjustl( cval(ii) )
893 call strnum ( cval(ii), ival, ier )
895 call sntbestr(bort_str1_head, ifxyn, bort_str1)
896 bort_str2 =
' HAS BAD DEPENDENCY (VAL)'
897 call bort2(bort_str1, bort_str2)
906 ipt = index( tags(2),
' >' )
911 tags(2)(ipt+1:ipt+1) =
' '
913 tags(2) = adjustl( tags(2) )
914 call strnum ( tags(2), ival, ier )
916 tags(3) = adjustl( tags(3) )
919 do while ( ( lt3 > 0 ) .and. ( .not. lstnblk ) )
920 if ( tags(3)(lt3:lt3) /=
' ' )
then
927 if ( ( nidfxy == 0 ) .and. ( nidval == 0 ) )
then
928 call strtbfe_c ( ifxyn, ival, tags(3), lt3, -1, -1 )
932 call strtbfe_c ( ifxyn, ival, tags(3), lt3, idfxy(ii), idval(jj) )
955 character*(*),
intent(in) :: hestr
956 character*(*),
intent(out) :: estr
957 character*6 adn30, clemon
959 integer,
intent(in) :: ifxyn
961 clemon = adn30( ifxyn, 6 )
962 estr = hestr // clemon(1:1) //
'-' // clemon(2:3) //
'-' // clemon(4:6)
977 integer function igetntbl ( lunt, line )
result ( iret )
981 integer,
intent(in) :: lunt
984 character*(*),
intent(out) :: line
987 read ( lunt,
'(A)', iostat = ier ) line
988 if ( ( ier /= 0 ) .or. ( line(1:3) ==
'END' ) )
then
992 if ( ( line /=
' ' ) .and. ( line(1:1) /=
'#' ) )
then
1012 integer function igettdi ( iflag )
result ( iret )
1016 integer,
intent(in) :: iflag
1017 integer,
parameter :: idxmin = 62976
1018 integer,
parameter :: idxmax = 63231
1023 if ( iflag == 0 )
then
1030 if ( idx > idxmax )
call bort(
'BUFRLIB: IGETTDI - IDXMAX OVERFLOW')
1056 subroutine gettbh ( luns, lunl, tab, imt, imtv, iogce, iltv )
1060 integer,
intent(in) :: luns, lunl
1061 integer,
intent(out) :: imt, imtv, iogce, iltv
1062 integer ntag, imt2, iersn, igetntbl
1064 character,
intent(in) :: tab
1066 character*128 bort_str
1067 character*(*),
parameter :: bort_str_head =
'BUFRLIB: GETTBH - BAD OR MISSING HEADER WITHIN '
1069 character*30 tags(5), label
1076 badlabel( label ) = ( ( index( label, cttyp ) == 0 ) .or. ( index( label, cftyp ) == 0 ) )
1083 if ( igetntbl( luns, header ) /= 0 )
then
1084 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1087 call parstr ( header, tags, 5, ntag,
'|', .false. )
1088 if ( ( ntag < 3 ) .or. ( badlabel( tags(1) ) ) )
then
1089 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1092 call strnum ( tags(2), imt, iersn )
1093 call strnum ( tags(3), imtv, iersn )
1098 if ( igetntbl( lunl, header ) /= 0 )
then
1099 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1102 call parstr ( header, tags, 5, ntag,
'|', .false. )
1103 if ( ( ntag < 4 ) .or. ( badlabel( tags(1) ) ) )
then
1104 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1107 call strnum ( tags(2), imt2, iersn )
1108 call strnum ( tags(3), iogce, iersn )
1109 call strnum ( tags(4), iltv, iersn )
1113 if ( imt /= imt2 )
then
1114 write(bort_str,
'("BUFRLIB: GETTBH - MASTER TABLE NUMBER MISMATCH BETWEEN STD AND LOC TABLE ",A)') tab
1136 integer,
intent(in) :: lunt
1137 integer,
intent(out) :: ifxyn, iret
1138 integer ntag, igetfxy, ifxy, igetntbl
1140 character*(*),
intent(out) :: line
1141 character*128 bort_str1, bort_str2
1142 character*20 tags(4)
1147 iret = igetntbl( lunt, line )
1148 if ( iret == 0 )
then
1150 call parstr ( line(1:20), tags, 4, ntag,
'|', .false. )
1151 if ( igetfxy( tags(1), adsc ) /= 0 )
then
1152 bort_str1 =
'BUFRLIB: GETNTBE - CARD BEGINNING WITH: ' // line(1:20)
1153 bort_str2 =
' HAS BAD OR MISSING FXY NUMBER'
1154 call bort2(bort_str1, bort_str2)
1157 ifxyn = ifxy( adsc )
1203 character,
intent(in) :: cf
1205 character*128 bort_str
1218 if(my_cf /=
'Y' .and. my_cf /=
'N')
then
1219 write(bort_str,
'("BUFRLIB: CODFLG - INPUT ARGUMENT IS ",A1,", IT MUST BE EITHER Y, y, N OR n")') cf
1245 character*(*),
intent(in) :: nemo
1251 if(nemo(i:i)/=
' ')
then
1256 if(lnemo<1 .or. lnemo>8)
then
1263 if ( verify(nemo(1:lnemo),
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.') == 0 )
then
recursive subroutine bort(str)
Log an error message, then either return to or abort the application program.
subroutine bort_target_unset
Clear any existing bort target.
recursive subroutine bort2(str1, str2)
Log two error messages, then either return to or abort the application program.
integer function bort_target_set()
Sets a new bort target, if bort catching is enabled and such a target doesn't already exist.
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...
recursive subroutine codflg(cf)
Specify whether or not code and flag table information should be included during all future reads of ...
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...
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.