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
49 call x84 ( lunmt1, my_lunmt1, 1 )
50 call x84 ( lunmt2, my_lunmt2, 1 )
51 call mtinfo ( cmtdir, my_lunmt1, my_lunmt2 )
57 call strsuc ( cmtdir, mtdir, lmtd )
83 subroutine mtfnam ( imt, imtv, iogce, imtvl, tbltyp, stdfil, locfil )
85 use modv_vars,
only: iprt, mtdir, lmtd
89 integer,
intent(in) :: imt, imtv, iogce, imtvl
92 character*(*),
intent(in) :: tbltyp
93 character*(*),
intent(out) :: stdfil, locfil
97 character*128 bort_str
101 call strsuc ( tbltyp, tbltyp2, ltbt )
105 if ( ( imt == 0 ) .and. ( imtv <= 13 ) )
then
107 stdfil = mtdir(1:lmtd) //
'/bufrtab.' // tbltyp2(1:ltbt) //
'_STD_0_13'
109 write ( fmtf,
'(A,I1,A,I1,A)' )
'(4A,I', isize(imt),
',A,I', isize(imtv),
')'
110 write ( stdfil, fmtf ) mtdir(1:lmtd),
'/bufrtab.', tbltyp2(1:ltbt),
'_STD_', imt,
'_', imtv
112 if ( iprt >= 2 )
then
113 call errwrt(
'Standard ' // tbltyp2(1:ltbt) //
':')
116 inquire ( file = stdfil, exist = found )
117 if ( .not. found )
then
118 bort_str =
'BUFRLIB: MTFNAM - COULD NOT FIND STANDARD FILE:'
119 call bort2(bort_str, stdfil)
127 write ( fmtf,
'(A,I1,A,I1,A,I1,A)' )
'(4A,I', isize(imt),
',A,I', isize(iogce),
',A,I', isize(imtvl),
')'
128 write ( locfil, fmtf ) mtdir(1:lmtd),
'/bufrtab.', tbltyp2(1:ltbt),
'_LOC_', imt,
'_', iogce,
'_', imtvl
129 if ( iprt >= 2 )
then
130 call errwrt(
'Local ' // tbltyp2(1:ltbt) //
':')
133 inquire ( file = locfil, exist = found )
134 if ( .not. found )
then
136 locfil = mtdir(1:lmtd) //
'/bufrtab.' // tbltyp2(1:ltbt) //
'_LOC_0_7_1'
137 if ( iprt >= 2 )
then
138 call errwrt(
'Local ' // tbltyp2(1:ltbt) //
' not found, so using:')
141 inquire ( file = locfil, exist = found )
142 if ( .not. found )
then
143 bort_str =
'BUFRLIB: MTFNAM - COULD NOT FIND LOCAL FILE:'
144 call bort2(bort_str, locfil)
170 integer function ireadmt ( lun )
result ( iret )
174 use modv_vars,
only: maxnc, maxcd, mxmtbb, mxmtbd, iprt, lun1, lun2, lmt, lmtv, logce, lmtvl
185 integer,
intent(in) :: lun
186 integer imt, imtv, iogce, imtvl, ii, jj, idx, ncds3, ier, ibmt, ibmtv, ibogce, ibltv, idmt, idmtv, idogce, idltv, &
189 character*(*),
parameter :: bort_str1 =
'BUFRLIB: IREADMT - COULD NOT OPEN STANDARD FILE:'
190 character*(*),
parameter :: bort_str2 =
'BUFRLIB: IREADMT - COULD NOT OPEN LOCAL FILE:'
191 character*275 stdfil,locfil
209 if ( ( imt /= lmt ) .or. ( ( imt /= 0 ) .and. ( imtv /= lmtv ) ) .or. &
210 ( ( imt == 0 ) .and. ( imtv /= lmtv ) .and. ( ( imtv > 13 ) .or. ( lmtv > 13 ) ) ) )
then
228 do while ( (allstd) .and. (ii<=ncds3) )
239 if ( ( .not. allstd ) .and. ( ( iogce /= logce ) .or. ( imtvl /= lmtvl ) ) ) iret = 1
243 if ( iret == 0 )
return
250 if ( iprt >= 2 )
then
252 call errwrt(
'+++++++++++++++++++++++++++++++++++++++++++++++++')
253 call errwrt(
'BUFRLIB: IREADMT - OPENING/READING MASTER TABLES')
256 if (
isc3(lun) /= 0 )
then
260 call mtfnam ( imt, imtv, iogce, imtvl,
'TableB', stdfil, locfil )
261 open ( unit = lun1, file = stdfil, iostat = ier )
262 if ( ier /= 0 )
call bort2(bort_str1, stdfil)
263 open ( unit = lun2, file = locfil, iostat = ier )
264 if ( ier /= 0 )
call bort2(bort_str2, locfil)
267 call rdmtbb ( lun1, lun2, mxmtbb, ibmt, ibmtv, ibogce, ibltv,
nmtb,
ibfxyn,
cbscl,
cbsref,
cbbw, &
271 close ( unit = lun1 )
272 close ( unit = lun2 )
276 call mtfnam ( imt, imtv, iogce, imtvl,
'TableD', stdfil, locfil )
277 open ( unit = lun1, file = stdfil, iostat = ier )
278 if ( ier /= 0 )
call bort2(bort_str1, stdfil)
279 open ( unit = lun2, file = locfil, iostat = ier )
280 if ( ier /= 0 )
call bort2(bort_str2, locfil)
283 call rdmtbd ( lun1, lun2, mxmtbd, maxcd, idmt, idmtv, idogce, idltv,
nmtd,
idfxyn,
cdmnem,
cmdscd,
cdseq, &
287 idx =
icvidx_c( ii-1, jj-1, maxcd ) + 1
293 close ( unit = lun1 )
294 close ( unit = lun2 )
297 call cpmstabs_c (
nmtb,
ibfxyn,
cbscl,
cbsref,
cbbw,
cbunit,
cbmnem,
cbelem,
nmtd,
idfxyn,
cdseq,
cdmnem, &
301 if (
cdmf ==
'Y' )
then
305 call mtfnam ( imt, imtv, iogce, imtvl,
'CodeFlag', stdfil, locfil )
306 open ( unit = lun1, file = stdfil, iostat = ier )
307 if ( ier /= 0 )
call bort2(bort_str1, stdfil)
308 open ( unit = lun2, file = locfil, iostat = ier )
309 if ( ier /= 0 )
call bort2(bort_str2, locfil)
312 call rdmtbf ( lun1, lun2 )
315 close ( unit = lun1 )
316 close ( unit = lun2 )
319 if ( iprt >= 2 )
then
320 call errwrt(
'+++++++++++++++++++++++++++++++++++++++++++++++++')
355 subroutine rdmtbb ( lunstb, lunltb, mxmtbb, imt, imtv, iogce, iltv, nmtbb, imfxyn, cmscl, cmsref, cmbw, &
356 cmunit, cmmnem, cmdsc, cmelem )
360 integer,
intent(in) :: lunstb, lunltb, mxmtbb
361 integer,
intent(out) :: imt, imtv, iogce, iltv, nmtbb, imfxyn(*)
362 integer isfxyn, ilfxyn, iers, ierl
364 character,
intent(out) :: cmelem(120,*), cmunit(24,*), cmsref(12,*), cmmnem(8,*), cmscl(4,*), cmbw(4,*), cmdsc(*)*4
365 character*200 stline, ltline
366 character*128 bort_str
367 character*6 cmatch, adn30
371 call gettbh ( lunstb, lunltb,
'B', imt, imtv, iogce, iltv )
376 call getntbe ( lunstb, isfxyn, stline, iers )
377 call getntbe ( lunltb, ilfxyn, ltline, ierl )
378 do while ( ( iers == 0 ) .or. ( ierl == 0 ) )
379 if ( ( iers == 0 ) .and. ( ierl == 0 ) )
then
380 if ( isfxyn == ilfxyn )
then
381 cmatch = adn30( isfxyn, 6 )
382 write(bort_str,
'("BUFRLIB: RDMTBB - STANDARD AND LOCAL '// &
383 'TABLE B FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)') cmatch(1:1),
'-', cmatch(2:3),
'-', cmatch(4:6)
385 else if ( isfxyn < ilfxyn )
then
386 call sntbbe ( isfxyn, stline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
387 call getntbe ( lunstb, isfxyn, stline, iers )
389 call sntbbe ( ilfxyn, ltline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
390 call getntbe ( lunltb, ilfxyn, ltline, ierl )
392 else if ( iers == 0 )
then
393 call sntbbe ( isfxyn, stline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
394 call getntbe ( lunstb, isfxyn, stline, iers )
396 call sntbbe ( ilfxyn, ltline, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
397 call getntbe ( lunltb, ilfxyn, ltline, ierl )
433 subroutine rdmtbd ( lunstd, lunltd, mxmtbd, mxelem, imt, imtv, iogce, iltv, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, &
434 nmelem, iefxyn, ceelem )
438 integer,
intent(in) :: lunstd, lunltd, mxmtbd, mxelem
439 integer,
intent(out) :: imt, imtv, iogce, iltv, nmtbd, imfxyn(*), nmelem(*), iefxyn(mxmtbd,mxelem)
440 integer isfxyn, ilfxyn, iers, ierl
442 character,
intent(out) :: cmseq(120,*), cmmnem(8,*), cmdsc(*)*4, ceelem(mxmtbd,mxelem)*120
444 character*200 stline, ltline
445 character*128 bort_str
446 character*6 cmatch, adn30
450 call gettbh ( lunstd, lunltd,
'D', imt, imtv, iogce, iltv )
455 call getntbe ( lunstd, isfxyn, stline, iers )
456 call getntbe ( lunltd, ilfxyn, ltline, ierl )
457 do while ( ( iers == 0 ) .or. ( ierl == 0 ) )
458 if ( ( iers == 0 ) .and. ( ierl == 0 ) )
then
459 if ( isfxyn == ilfxyn )
then
460 cmatch = adn30( isfxyn, 6 )
461 write(bort_str,
'("BUFRLIB: RDMTBD - STANDARD AND LOCAL '// &
462 'TABLE D FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)') cmatch(1:1),
'-', cmatch(2:3),
'-', cmatch(4:6)
464 else if ( isfxyn < ilfxyn )
then
465 call sntbde ( lunstd, isfxyn, stline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
466 call getntbe ( lunstd, isfxyn, stline, iers )
468 call sntbde ( lunltd, ilfxyn, ltline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
469 call getntbe ( lunltd, ilfxyn, ltline, ierl )
471 else if ( iers == 0 )
then
472 call sntbde ( lunstd, isfxyn, stline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
473 call getntbe ( lunstd, isfxyn, stline, iers )
475 call sntbde ( lunltd, ilfxyn, ltline, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
476 call getntbe ( lunltd, ilfxyn, ltline, ierl )
498 integer,
intent(in) :: lunstf, lunltf
499 integer imt, imtv, iogce, iltv, isfxyn, ilfxyn, iers, ierl
501 character*160 stline, ltline
502 character*128 bort_str
503 character*6 cmatch, adn30
511 call gettbh ( lunstf, lunltf,
'F', imt, imtv, iogce, iltv )
515 call getntbe ( lunstf, isfxyn, stline, iers )
516 call getntbe ( lunltf, ilfxyn, ltline, ierl )
517 do while ( ( iers == 0 ) .or. ( ierl == 0 ) )
518 if ( ( iers == 0 ) .and. ( ierl == 0 ) )
then
519 if ( isfxyn == ilfxyn )
then
520 cmatch = adn30( isfxyn, 6 )
521 write(bort_str,
'("BUFRLIB: RDMTBF - STANDARD AND LOCAL '// &
522 'CODE/FLAG TABLE FILES BOTH CONTAIN SAME FXY NUMBER: ",5A)') cmatch(1:1),
'-', cmatch(2:3),
'-', cmatch(4:6)
524 else if ( isfxyn < ilfxyn )
then
525 call sntbfe ( lunstf, isfxyn )
526 call getntbe ( lunstf, isfxyn, stline, iers )
528 call sntbfe ( lunltf, ilfxyn )
529 call getntbe ( lunltf, ilfxyn, ltline, ierl )
531 else if ( iers == 0 )
then
532 call sntbfe ( lunstf, isfxyn )
533 call getntbe ( lunstf, isfxyn, stline, iers )
535 call sntbfe ( lunltf, ilfxyn )
536 call getntbe ( lunltf, ilfxyn, ltline, ierl )
564 subroutine sntbbe ( ifxyn, line, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem )
568 integer,
intent(in) :: ifxyn, mxmtbb
569 integer,
intent(inout) :: nmtbb
570 integer,
intent(out) :: imfxyn(*)
571 integer ntag, ii, nemock
573 character,
intent(out) :: cmelem(120,*), cmunit(24,*), cmsref(12,*), cmmnem(8,*), cmscl(4,*), cmbw(4,*), cmdsc(*)*4
574 character*(*),
intent(in) :: line
575 character*(*),
parameter :: bort_str1_head =
'BUFRLIB: SNTBBE - TABLE B ENTRY FOR ELEMENT DESCRIPTOR: '
576 character*200 tags(10), wktag
577 character*128 bort_str1, bort_str2
579 if ( nmtbb >= mxmtbb )
call bort(
'BUFRLIB: SNTBBE - OVERFLOW OF MERGED ARRAYS')
584 imfxyn( nmtbb ) = ifxyn
588 call parstr ( line, tags, 10, ntag,
'|', .false. )
590 call sntbestr(bort_str1_head, ifxyn, bort_str1)
591 bort_str2 =
' HAS TOO FEW FIELDS'
592 call bort2(bort_str1, bort_str2)
597 tags(2) = adjustl( tags(2) )
598 if ( tags(2) ==
' ' )
then
599 call sntbestr(bort_str1_head, ifxyn, bort_str1)
600 bort_str2 =
' HAS MISSING SCALE FACTOR'
601 call bort2(bort_str1, bort_str2)
603 tags(2)(1:4) = adjustr( tags(2)(1:4) )
605 cmscl( ii, nmtbb ) = tags(2)(ii:ii)
610 tags(3) = adjustl( tags(3) )
611 if ( tags(3) ==
' ' )
then
612 call sntbestr(bort_str1_head, ifxyn, bort_str1)
613 bort_str2 =
' HAS MISSING REFERENCE VALUE'
614 call bort2(bort_str1, bort_str2)
616 tags(3)(1:12) = adjustr( tags(3)(1:12) )
618 cmsref( ii, nmtbb ) = tags(3)(ii:ii)
623 tags(4) = adjustl( tags(4) )
624 if ( tags(4) ==
' ' )
then
625 call sntbestr(bort_str1_head, ifxyn, bort_str1)
626 bort_str2 =
' HAS MISSING BIT WIDTH'
627 call bort2(bort_str1, bort_str2)
629 tags(4)(1:4) = adjustr( tags(4)(1:4) )
631 cmbw( ii, nmtbb ) = tags(4)(ii:ii)
637 tags(5) = adjustl( tags(5) )
639 cmunit( ii, nmtbb ) = tags(5)(ii:ii)
643 cmunit( ii, nmtbb ) =
' '
651 cmmnem( ii, nmtbb ) =
' '
654 cmelem( ii, nmtbb ) =
' '
658 call parstr ( wktag, tags, 10, ntag,
';', .false. )
661 tags(1) = adjustl( tags(1) )
663 if ( ( tags(1) /=
' ' ) .and. ( nemock( tags(1) ) /= 0 ) )
then
664 call sntbestr(bort_str1_head, ifxyn, bort_str1)
665 bort_str2 =
' HAS ILLEGAL MNEMONIC'
666 call bort2(bort_str1, bort_str2)
669 cmmnem( ii, nmtbb ) = tags(1)(ii:ii)
674 tags(2) = adjustl( tags(2) )
675 cmdsc( nmtbb ) = tags(2)(1:4)
679 tags(3) = adjustl( tags(3) )
681 cmelem( ii, nmtbb ) = tags(3)(ii:ii)
709 subroutine sntbde ( lunt, ifxyn, line, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem )
713 integer,
intent(in) :: lunt, ifxyn, mxmtbd, mxelem
714 integer,
intent(inout) :: nmtbd
715 integer,
intent(out) :: imfxyn(*), nmelem(*), iefxyn(mxmtbd,mxelem)
716 integer ii, ipt, ntag, nelem, nemock, ifxy, igetfxy, igetntbl
718 character*(*),
intent(in) :: line
719 character*(*),
parameter :: bort_str1_head =
'BUFRLIB: SNTBDE - TABLE D ENTRY FOR SEQUENCE DESCRIPTOR: '
720 character,
intent(out) :: cmseq(120,*), cmmnem(8,*), cmdsc(*)*4, ceelem(mxmtbd,mxelem)*120
721 character*200 tags(10), cline
722 character*128 bort_str1, bort_str2
727 if ( nmtbd >= mxmtbd )
call bort(
'BUFRLIB: SNTBDE - OVERFLOW OF MERGED ARRAYS')
732 imfxyn( nmtbd ) = ifxyn
737 cmmnem( ii, nmtbd ) =
' '
741 cmseq( ii, nmtbd ) =
' '
743 ipt = index( line,
'|' )
746 call parstr ( line(ipt+1:), tags, 10, ntag,
';', .false. )
749 tags(1) = adjustl( tags(1) )
751 if ( ( tags(1) /=
' ' ) .and. ( nemock( tags(1) ) /= 0 ) )
then
752 call sntbestr(bort_str1_head, ifxyn, bort_str1)
753 bort_str2 =
' HAS ILLEGAL MNEMONIC'
754 call bort2(bort_str1, bort_str2)
757 cmmnem( ii, nmtbd ) = tags(1)(ii:ii)
762 tags(2) = adjustl( tags(2) )
763 cmdsc( nmtbd ) = tags(2)(1:4)
767 tags(3) = adjustl( tags(3) )
769 cmseq( ii, nmtbd ) = tags(3)(ii:ii)
779 do while ( .not. done )
780 if ( igetntbl( lunt, cline ) /= 0 )
then
781 call sntbestr(bort_str1_head, ifxyn, bort_str1)
782 bort_str2 =
' IS INCOMPLETE'
783 call bort2(bort_str1, bort_str2)
785 call parstr ( cline, tags, 10, ntag,
'|', .false. )
787 call sntbestr(bort_str1_head, ifxyn, bort_str1)
788 bort_str2 =
' HAS BAD ELEMENT CARD'
789 call bort2(bort_str1, bort_str2)
792 if ( igetfxy( tags(2), adsc ) /= 0 )
then
793 call sntbestr(bort_str1_head, ifxyn, bort_str1)
794 bort_str2 =
' HAS BAD OR MISSING ELEMENT FXY NUMBER'
795 call bort2(bort_str1, bort_str2)
797 if ( nelem >= mxelem )
CALL bort(
'BUFRLIB: SNTBDE - OVERFLOW OF MERGED ARRAYS')
799 iefxyn( nmtbd, nelem ) = ifxy( adsc )
802 tags(3) = adjustl( tags(3) )
803 ceelem( nmtbd, nelem ) = tags(3)(1:120)
805 ceelem( nmtbd, nelem ) =
' '
808 if ( index( tags(2),
' >' ) == 0 ) done = .true.
810 nmelem( nmtbd ) = nelem
828 integer,
intent(in) :: lunt, ifxyn
829 integer idfxy(10), idval(25), nidfxy, nidval, ntag, ii, jj, ival, ier, ipt, lt3, ifxy, igetfxy, igetntbl
831 character*160 cline, tags(4), cdstr(2), adsc(10), cval(25)
832 character*(*),
parameter :: bort_str1_head =
'BUFRLIB: SNTBFE - TABLE F ENTRY FOR ELEMENT DESCRIPTOR: '
833 character*128 bort_str1, bort_str2
836 logical done, lstnblk
846 do while ( .not. done )
848 if ( igetntbl( lunt, cline ) /= 0 )
then
849 call sntbestr(bort_str1_head, ifxyn, bort_str1)
850 bort_str2 =
' IS INCOMPLETE'
851 call bort2(bort_str1, bort_str2)
854 call parstr ( cline, tags, 4, ntag,
'|', .false. )
855 if ( ( ntag < 2 ) .or. ( ntag > 3 ) )
then
856 call sntbestr(bort_str1_head, ifxyn, bort_str1)
857 bort_str2 =
' HAS BAD CARD'
858 call bort2(bort_str1, bort_str2)
861 if ( ntag == 2 )
then
865 call parstr ( tags(2), cdstr, 2, ntag,
'=', .false. )
866 if ( ntag /= 2 )
then
867 call sntbestr(bort_str1_head, ifxyn, bort_str1)
868 bort_str2 =
' HAS BAD DEPENDENCY CARD'
869 call bort2(bort_str1, bort_str2)
872 call parstr ( cdstr(1), adsc, 10, nidfxy,
',', .false. )
873 if ( ( nidfxy == 0 ) .or. ( ( nidfxy == 1 ) .and. ( adsc(1) ==
' ' ) ) )
then
874 call sntbestr(bort_str1_head, ifxyn, bort_str1)
875 bort_str2 =
' HAS BAD DEPENDENCY LIST (FXY)'
876 call bort2(bort_str1, bort_str2)
879 if ( igetfxy( adsc(ii), cdsc ) /= 0 )
then
880 call sntbestr(bort_str1_head, ifxyn, bort_str1)
881 bort_str2 =
' HAS BAD DEPENDENCY (FXY)'
882 call bort2(bort_str1, bort_str2)
884 idfxy(ii) = ifxy( cdsc )
887 call parstr ( cdstr(2), cval, 25, nidval,
',', .false. )
888 if ( ( nidval == 0 ) .or. ( ( nidval == 1 ) .and. ( cval(1) ==
' ' ) ) )
then
889 call sntbestr(bort_str1_head, ifxyn, bort_str1)
890 bort_str2 =
' HAS BAD DEPENDENCY LIST (VAL)'
891 call bort2(bort_str1, bort_str2)
894 cval(ii) = adjustl( cval(ii) )
895 call strnum ( cval(ii), ival, ier )
897 call sntbestr(bort_str1_head, ifxyn, bort_str1)
898 bort_str2 =
' HAS BAD DEPENDENCY (VAL)'
899 call bort2(bort_str1, bort_str2)
908 ipt = index( tags(2),
' >' )
913 tags(2)(ipt+1:ipt+1) =
' '
915 tags(2) = adjustl( tags(2) )
916 call strnum ( tags(2), ival, ier )
918 tags(3) = adjustl( tags(3) )
921 do while ( ( lt3 > 0 ) .and. ( .not. lstnblk ) )
922 if ( tags(3)(lt3:lt3) /=
' ' )
then
929 if ( ( nidfxy == 0 ) .and. ( nidval == 0 ) )
then
930 call strtbfe_c ( ifxyn, ival, tags(3), lt3, -1, -1 )
934 call strtbfe_c ( ifxyn, ival, tags(3), lt3, idfxy(ii), idval(jj) )
957 character*(*),
intent(in) :: hestr
958 character*(*),
intent(out) :: estr
959 character*6 adn30, clemon
961 integer,
intent(in) :: ifxyn
963 clemon = adn30( ifxyn, 6 )
964 estr = hestr // clemon(1:1) //
'-' // clemon(2:3) //
'-' // clemon(4:6)
979 integer function igetntbl ( lunt, line )
result ( iret )
983 integer,
intent(in) :: lunt
986 character*(*),
intent(out) :: line
989 read ( lunt,
'(A)', iostat = ier ) line
990 if ( ( ier /= 0 ) .or. ( line(1:3) ==
'END' ) )
then
994 if ( ( line /=
' ' ) .and. ( line(1:1) /=
'#' ) )
then
1014 integer function igettdi ( iflag )
result ( iret )
1018 integer,
intent(in) :: iflag
1019 integer,
parameter :: idxmin = 62976
1020 integer,
parameter :: idxmax = 63231
1025 if ( iflag == 0 )
then
1032 if ( idx > idxmax )
call bort(
'BUFRLIB: IGETTDI - IDXMAX OVERFLOW')
1058 subroutine gettbh ( luns, lunl, tab, imt, imtv, iogce, iltv )
1062 integer,
intent(in) :: luns, lunl
1063 integer,
intent(out) :: imt, imtv, iogce, iltv
1064 integer ntag, imt2, iersn, igetntbl
1066 character,
intent(in) :: tab
1068 character*128 bort_str
1069 character*(*),
parameter :: bort_str_head =
'BUFRLIB: GETTBH - BAD OR MISSING HEADER WITHIN '
1071 character*30 tags(5), label
1078 badlabel( label ) = ( ( index( label, cttyp ) == 0 ) .or. ( index( label, cftyp ) == 0 ) )
1085 if ( igetntbl( luns, header ) /= 0 )
then
1086 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1089 call parstr ( header, tags, 5, ntag,
'|', .false. )
1090 if ( ( ntag < 3 ) .or. ( badlabel( tags(1) ) ) )
then
1091 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1094 call strnum ( tags(2), imt, iersn )
1095 call strnum ( tags(3), imtv, iersn )
1100 if ( igetntbl( lunl, header ) /= 0 )
then
1101 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1104 call parstr ( header, tags, 5, ntag,
'|', .false. )
1105 if ( ( ntag < 4 ) .or. ( badlabel( tags(1) ) ) )
then
1106 bort_str = bort_str_head // cftyp //
' TABLE ' // tab
1109 call strnum ( tags(2), imt2, iersn )
1110 call strnum ( tags(3), iogce, iersn )
1111 call strnum ( tags(4), iltv, iersn )
1115 if ( imt /= imt2 )
then
1116 write(bort_str,
'("BUFRLIB: GETTBH - MASTER TABLE NUMBER MISMATCH BETWEEN STD AND LOC TABLE ",A)') tab
1138 integer,
intent(in) :: lunt
1139 integer,
intent(out) :: ifxyn, iret
1140 integer ntag, igetfxy, ifxy, igetntbl
1142 character*(*),
intent(out) :: line
1143 character*128 bort_str1, bort_str2
1144 character*20 tags(4)
1149 iret = igetntbl( lunt, line )
1150 if ( iret == 0 )
then
1152 call parstr ( line(1:20), tags, 4, ntag,
'|', .false. )
1153 if ( igetfxy( tags(1), adsc ) /= 0 )
then
1154 bort_str1 =
'BUFRLIB: GETNTBE - CARD BEGINNING WITH: ' // line(1:20)
1155 bort_str2 =
' HAS BAD OR MISSING FXY NUMBER'
1156 call bort2(bort_str1, bort_str2)
1159 ifxyn = ifxy( adsc )
1201 character,
intent(in) :: cf
1203 character*128 bort_str
1206 if(cf/=
'Y'.and. cf/=
'N')
then
1207 write(bort_str,
'("BUFRLIB: CODFLG - INPUT ARGUMENT IS ",A1,", IT MUST BE EITHER Y OR N")') cf
1233 character*(*),
intent(in) :: nemo
1239 if(nemo(i:i)/=
' ')
then
1244 if(lnemo<1 .or. lnemo>8)
then
1251 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.