37 recursive subroutine setvalnb ( lunit, tagpv, ntagpv, tagnb, ntagnb, r8val, iret )
39 use modv_vars,
only: im8b
47 integer,
intent(in) :: lunit, ntagpv, ntagnb
48 integer,
intent(out) :: iret
49 integer my_lunit, my_ntagpv, my_ntagnb, lun, il, im, npv, nnb, ierft
51 character*(*),
intent(in) :: tagpv, tagnb
53 real*8,
intent(in) :: r8val
58 call x84 ( lunit, my_lunit, 1 )
59 call x84 ( ntagpv, my_ntagpv, 1 )
60 call x84 ( ntagnb, my_ntagnb, 1 )
61 call setvalnb ( my_lunit, tagpv, my_ntagpv, tagnb, my_ntagnb, r8val, iret )
62 call x48 ( iret, iret, 1 )
70 call status (lunit, lun, il, im )
72 if (
inode(lun) /=
inv(1,lun) )
return
75 call fstag( lun, tagpv, ntagpv, 1, npv, ierft )
76 if ( ierft /= 0 )
return
79 call fstag( lun, tagnb, ntagnb, npv, nnb, ierft )
80 if ( ierft /= 0 )
return
121 recursive real*8 function getvalnb ( lunit, tagpv, ntagpv, tagnb, ntagnb )
result ( r8val )
123 use modv_vars,
only: im8b, bmiss
131 integer,
intent(in) :: lunit, ntagpv, ntagnb
132 integer my_lunit, my_ntagpv, my_ntagnb, lun, il, im, npv, nnb, ierft
134 character*(*),
intent(in) :: tagpv, tagnb
139 call x84(lunit,my_lunit,1)
140 call x84(ntagpv,my_ntagpv,1)
141 call x84(ntagnb,my_ntagnb,1)
142 r8val=
getvalnb(my_lunit,tagpv,my_ntagpv,tagnb,my_ntagnb)
150 call status (lunit, lun, il, im )
151 if ( il >= 0 )
return
152 if (
inode(lun) /=
inv(1,lun) )
return
155 call fstag( lun, tagpv, ntagpv, 1, npv, ierft )
156 if ( ierft /= 0 )
return
159 call fstag( lun, tagnb, ntagnb, npv, nnb, ierft )
160 if ( ierft /= 0 )
return
199 recursive subroutine writlc(lunit,chr,str)
201 use modv_vars,
only: im8b, mxlcc
211 integer,
intent(in) :: lunit
212 integer my_lunit, maxtg, iprt, lun, il, im, ntg, nnod, kon, ii, n, node, ioid, ival, mbit, nbit, nbmp, nchr, nbyt, nsubs, &
213 itagct, len0, len1, len2, len3, l4, l5, mbyte,
iupbs3
215 character*(*),
intent(in) :: chr, str
216 character*128 bort_str, errstr
229 call x84(lunit,my_lunit,1)
230 call writlc(my_lunit,chr,str)
236 call status(lunit,lun,il,im)
237 if(il==0)
call bort(
'BUFRLIB: WRITLC - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
238 if(il<0)
call bort(
'BUFRLIB: WRITLC - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
239 if(im==0)
call bort(
'BUFRLIB: WRITLC - A MESSAGE MUST BE OPEN IN OUTPUT BUFR FILE, NONE ARE')
242 call parstr(str,tgs,maxtg,ntg,
' ',.true.)
244 write(bort_str,
'("BUFRLIB: WRITLC - THERE CANNOT BE MORE THAN '// &
245 ' ONE MNEMONIC IN THE INPUT STRING (",A,") (HERE THERE ARE",I4,")")') str,ntg
250 call parutg(lun,1,tgs(1),nnod,kon,roid)
256 do while((ii<=10).and.(tgs(1)(ii:ii)/=
'#'))
257 ctag(ii:ii)=tgs(1)(ii:ii)
270 do while (n+1<=
nval(lun))
273 if(
itp(node)==1)
then
276 elseif(ctag==
tag(node))
then
278 if(itagct==ioid)
then
279 if(
itp(node)/=3)
then
280 write(bort_str,
'("BUFRLIB: WRITLC - MNEMONIC ",A," DOES NOT REPRESENT A CHARACTER ELEMENT (TYP=",A,")")') &
287 nchr=min(mxlcc,
ibt(node)/8)
296 call getlens(
mbay(1,lun),3,len0,len1,len2,len3,l4,l5)
297 mbyte = len0 + len1 + len2 + len3 + 4
300 do while(nsubs<
nsub(lun))
306 if(nsubs/=
nsub(lun))
then
308 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
309 errstr =
'BUFRLIB: WRITLC - COULDN''T WRITE VALUE FOR ' // ctag // &
310 ' INTO SUBSET, BECAUSE NO SUBSET WAS OPEN FOR WRITING'
312 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
323 do while (n+1<=
nval(lun))
328 if(
itp(node)==1)
then
329 call upbb(ival,nbit,mbit,
mbay(1,lun))
331 elseif(ctag==
tag(node))
then
333 if(itagct==ioid)
then
334 if(
itp(node)/=3)
then
335 write(bort_str,
'("BUFRLIB: WRITLC - MNEMONIC ",A," DOES NOT REPRESENT A CHARACTER ELEMENT (TYP=",A,")")') &
344 call pkc(chr,nchr,
mbay(1,lun),mbit)
354 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
355 errstr =
'BUFRLIB: WRITLC - COULDN''T WRITE VALUE FOR ' // ctag //
' INTO SUBSET, BECAUSE IT WASN''T FOUND IN THE ' // &
358 errstr =
'(' // ctag //
' MAY NOT BE IN THE BUFR TABLE(?))'
360 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
406 recursive subroutine readlc(lunit,chr,str)
408 use modv_vars,
only: im8b
419 integer,
intent(in) :: lunit
420 integer my_lunit, maxtg, iprt, lchr, lun, il, im, ntg, nnod, kon, ii, n, nod, ioid, itagct, nchr, kbit
422 character*(*),
intent(in) :: str
423 character*(*),
intent(out) :: chr
425 character*128 bort_str, errstr
438 call x84(lunit,my_lunit,1)
439 call readlc(my_lunit,chr,str)
448 call status(lunit,lun,il,im)
449 if(il==0)
call bort(
'BUFRLIB: READLC - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
450 if(il>0)
call bort(
'BUFRLIB: READLC - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
451 if(im==0)
call bort(
'BUFRLIB: READLC - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
454 call parstr(str,tgs,maxtg,ntg,
' ',.true.)
456 write(bort_str,
'("BUFRLIB: READLC - THERE CANNOT BE MORE THAN '// &
457 'ONE MNEMONIC IN THE INPUT STRING (",A,") (HERE THERE ARE ",I3,")")') str,ntg
463 call parutg(lun,0,tgs(1),nnod,kon,roid)
469 do while((ii<=10).and.(tgs(1)(ii:ii)/=
'#'))
470 ctag(ii:ii)=tgs(1)(ii:ii)
484 if(ctag==
tag(nod))
then
486 if(itagct==ioid)
then
488 write(bort_str,
'("BUFRLIB: READLC - MNEMONIC ",A," DOES NOT '// &
489 'REPRESENT A CHARACTER ELEMENT (ITP=",I2,")")') tgs(1),
itp(nod)
494 write(bort_str,
'("BUFRLIB: READLC - MNEMONIC ",A," IS A '// &
495 'CHARACTER STRING OF LENGTH",I4," BUT SPACE WAS PROVIDED FOR ONLY",I4, " CHARACTERS")') tgs(1),nchr,lchr
499 call upc(chr,nchr,
mbay(1,lun),kbit,.true.)
509 if(ctag==
crtag(ii))
then
511 if(itagct==ioid)
then
514 write(bort_str,
'("BUFRLIB: READLC - MNEMONIC ",A," IS A '// &
515 'CHARACTER STRING OF LENGTH",I4," BUT SPACE WAS PROVIDED FOR ONLY",I4, " CHARACTERS")') tgs(1),nchr,lchr
519 call upc(chr,nchr,
mbay(1,lun),kbit,.true.)
529 call errwrt(
'++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
530 errstr =
'BUFRLIB: READLC - MNEMONIC ' // tgs(1) // &
531 ' NOT LOCATED IN REPORT SUBSET - RETURN WITH MISSING STRING FOR CHARACTER DATA ELEMENT'
533 call errwrt(
'++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
537 call ipkm(chr(ii:ii),1,255)
645 recursive subroutine ufbint(lunin,usr,i1,i2,iret,str)
647 use modv_vars,
only: im8b, bmiss
654 character*(*),
intent(in) :: str
655 character*128 bort_str1, bort_str2, errstr
657 real*8,
intent(inout) :: usr(i1,i2)
659 integer,
intent(in) :: lunin, i1, i2
660 integer,
intent(out) :: iret
661 integer iprt, nnod, ncon, nods, nodc, ivls, kons, ifirst1, ifirst2, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, i, j
663 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
666 data ifirst1 /0/, ifirst2 /0/
668 save ifirst1, ifirst2
673 call x84(lunin,my_lunin,1)
676 call ufbint(my_lunin,usr,my_i1,my_i2,iret,str)
677 call x48(iret,iret,1)
686 call status(lunit,lun,il,im)
687 if(il==0)
call bort(
'BUFRLIB: UFBINT - BUFR FILE IS CLOSED, IT MUST BE OPEN')
688 if(im==0)
call bort(
'BUFRLIB: UFBINT - A MESSAGE MUST BE OPEN IN BUFR FILE, NONE ARE')
689 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBINT - LOCATION OF INTERNAL TABLE FOR BUFR FILE DOES NOT AGREE ' // &
690 'WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
692 io = min(max(0,il),1)
693 if(lunit/=lunin) io = 0
697 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
698 errstr = .LE.
'BUFRLIB: UFBINT - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
701 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
706 if(iprt==-1) ifirst1 = 1
707 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
708 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
709 errstr = .LE.
'BUFRLIB: UFBINT - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
712 if(iprt==0 .and. io==1)
then
713 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
716 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
720 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
728 call string(str,lun,i1,io)
740 call ufbrw(lun,usr,i1,i2,io,iret)
743 if(io==1 .and. iret/=i2 .and. iret>=0)
then
744 call trybump(lun,usr,i1,i2,io,iret)
746 write(bort_str1,
'("BUFRLIB: UFBINT - MNEMONIC STRING READ IN IS: ",A)') str
747 write(bort_str2,
'(18X,"THE NUMBER OF ''LEVELS'' ACTUALLY '// &
748 'WRITTEN (",I3,") DOES NOT EQUAL THE NUMBER REQUESTED (",I3,") - INCOMPLETE WRITE")') iret,i2
749 call bort2(bort_str1,bort_str2)
751 elseif(iret==-1)
then
758 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
759 errstr =
'BUFRLIB: UFBINT - NO SPECIFIED VALUES READ IN, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
762 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
766 if(iprt==-1) ifirst2 = 1
767 if(ifirst2==0 .or. iprt>=1)
then
768 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
769 errstr =
'BUFRLIB: UFBINT - NO SPECIFIED VALUES WRITTEN OUT, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
772 call errwrt(
'MAY NOT BE IN THE BUFR TABLE(?)')
774 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
777 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call ' // &
778 'to a BUFRLIB routine.'
781 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
885 recursive subroutine ufbrep(lunin,usr,i1,i2,iret,str)
887 use modv_vars,
only: im8b, bmiss, iac
894 character*(*),
intent(in) :: str
895 character*128 bort_str1, bort_str2, errstr
897 real*8,
intent(inout) :: usr(i1,i2)
899 integer,
intent(in) :: lunin, i1, i2
900 integer,
intent(out) :: iret
901 integer iprt, ifirst1, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, iac_prev, i, j
912 call x84(lunin,my_lunin,1)
915 call ufbrep(my_lunin,usr,my_i1,my_i2,iret,str)
916 call x48(iret,iret,1)
925 call status(lunit,lun,il,im)
926 if(il==0)
call bort(
'BUFRLIB: UFBREP - BUFR FILE IS CLOSED, IT MUST BE OPEN')
927 if(im==0)
call bort(
'BUFRLIB: UFBREP - A MESSAGE MUST BE OPEN IN BUFR FILE, NONE ARE')
928 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBREP - LOCATION OF INTERNAL TABLE FOR BUFR FILE DOES NOT AGREE ' // &
929 'WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
931 io = min(max(0,il),1)
932 if(lunit/=lunin) io = 0
936 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
937 errstr = .LE.
'BUFRLIB: UFBREP - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
940 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
945 if(iprt==-1) ifirst1 = 1
946 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
947 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
948 errstr = .LE.
'BUFRLIB: UFBREP - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
951 if(iprt==0 .and. io==1)
then
952 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
955 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
959 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
978 call string(str,lun,i1,io)
982 call ufbrp(lun,usr,i1,i2,io,iret)
984 if(io==1 .and. iret<i2)
then
985 write(bort_str1,
'("BUFRLIB: UFBREP - MNEMONIC STRING READ IN IS: ",A)') str
986 write(bort_str2,
'(18X,"THE NUMBER OF ''LEVELS'' ACTUALLY '// &
987 'WRITTEN (",I3,") LESS THAN THE NUMBER REQUESTED (",I3,") - INCOMPLETE WRITE")') iret,i2
988 call bort2(bort_str1,bort_str2)
991 if(iret==0 .and. io==0 .and. iprt>=1)
then
992 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
993 errstr =
'BUFRLIB: UFBREP - NO SPECIFIED VALUES READ IN, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
996 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1098 recursive subroutine ufbstp(lunin,usr,i1,i2,iret,str)
1100 use modv_vars,
only: im8b, bmiss
1107 character*(*),
intent(in) :: str
1108 character*128 bort_str1, bort_str2, errstr
1110 real*8,
intent(inout) :: usr(i1,i2)
1112 integer,
intent(in) :: lunin, i1, i2
1113 integer,
intent(out) :: iret
1114 integer iprt, ifirst1, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, i, j
1125 call x84(lunin,my_lunin,1)
1126 call x84(i1,my_i1,1)
1127 call x84(i2,my_i2,1)
1128 call ufbstp(my_lunin,usr,my_i1,my_i2,iret,str)
1129 call x48(iret,iret,1)
1138 call status(lunit,lun,il,im)
1139 if(il==0)
call bort(
'BUFRLIB: UFBSTP - BUFR FILE IS CLOSED, IT MUST BE OPEN')
1140 if(im==0)
call bort(
'BUFRLIB: UFBSTP - A MESSAGE MUST BE OPEN IN BUFR FILE, NONE ARE')
1141 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBSTP - LOCATION OF INTERNAL TABLE FOR BUFR FILE DOES NOT AGREE ' // &
1142 'WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
1144 io = min(max(0,il),1)
1145 if(lunit/=lunin) io = 0
1149 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1150 errstr = .LE.
'BUFRLIB: UFBSTP - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1153 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1158 if(iprt==-1) ifirst1 = 1
1159 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
1160 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1161 errstr = .LE.
'BUFRLIB: UFBSTP - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1164 if(iprt==0 .and. io==1)
then
1165 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
1166 'all such messages,'
1168 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
1172 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1189 call string(str,lun,i1,io)
1192 call ufbsp(lun,usr,i1,i2,io,iret)
1194 if(io==1 .and. iret/=i2)
then
1195 write(bort_str1,
'("BUFRLIB: UFBSTP - MNEMONIC STRING READ IN IS: ",A)') str
1196 write(bort_str2,
'(18X,"THE NUMBER OF ''LEVELS'' ACTUALLY '// &
1197 'WRITTEN (",I3,") DOES NOT EQUAL THE NUMBER REQUESTED (",I3,") - INCOMPLETE WRITE")') iret,i2
1198 call bort2(bort_str1,bort_str2)
1201 if(iret==0 .and. io==0 .and. iprt>=1)
then
1202 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1203 errstr =
'BUFRLIB: UFBSTP - NO SPECIFIED VALUES READ IN, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1206 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1319 recursive subroutine ufbseq(lunin,usr,i1,i2,iret,str)
1321 use modv_vars,
only: im8b, bmiss
1329 integer,
intent(in) :: lunin, i1, i2
1330 integer,
intent(out) :: iret
1331 integer,
parameter :: mtag = 10
1332 integer iprt, ifirst1, ifirst2, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, i, j, ntag, node, nods, ins1, ins2, insx, &
1335 real*8,
intent(inout) :: usr(i1,i2)
1337 character*(*),
intent(in) :: str
1338 character*156 bort_str
1339 character*128 errstr
1340 character*10 tags(mtag)
1344 data ifirst1 /0/, ifirst2 /0/
1346 save ifirst1, ifirst2
1351 call x84(lunin,my_lunin,1)
1352 call x84(i1,my_i1,1)
1353 call x84(i2,my_i2,1)
1354 call ufbseq(my_lunin,usr,my_i1,my_i2,iret,str)
1355 call x48(iret,iret,1)
1364 call status(lunit,lun,il,im)
1365 if(il==0)
call bort(
'BUFRLIB: UFBSEQ - BUFR FILE IS CLOSED, IT MUST BE OPEN')
1366 if(im==0)
call bort(
'BUFRLIB: UFBSEQ - A MESSAGE MUST BE OPEN IN BUFR FILE, NONE ARE')
1368 io = min(max(0,il),1)
1369 if(lunit/=lunin) io = 0
1373 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1374 errstr = .LE.
'BUFRLIB: UFBSEQ - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1377 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1382 if(iprt==-1) ifirst1 = 1
1383 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
1384 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1385 errstr = .LE.
'BUFRLIB: UFBSEQ - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1388 if(iprt==0 .and. io==1)
then
1389 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
1390 'all such messages,'
1392 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
1396 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1404 call parstr(str,tags,mtag,ntag,
' ',.true.)
1406 write(bort_str,
'("BUFRLIB: UFBSEQ - THE INPUT STRING (",A,") DOES NOT CONTAIN ANY MNEMONICS!!")') str
1410 write(bort_str,
'("BUFRLIB: UFBSEQ - THERE CANNOT BE MORE THAN '// &
1411 'ONE MNEMONIC IN THE INPUT STRING (",A,") (HERE THERE ARE ",I3,")")') str,ntag
1414 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBSEQ - LOCATION OF INTERNAL TABLE FOR '// &
1415 'BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
1428 if(str==
tag(node))
then
1429 if(
typ(node)==
'SEQ' .or.
typ(node)==
'RPC')
then
1433 if(ins1==0)
exit outer
1434 if(
typ(node)/=
'RPC' .or.
val(ins1,lun)/=0.)
exit
1438 if(ins2==0) ins2 = 10e5
1440 do while(
link(nods)==0 .and.
jmpb(nods)>0)
1443 if(
link(nods)==0)
then
1445 elseif(
link(nods)>0)
then
1448 ins2 = min(ins2,insx)
1449 elseif(
typ(node)==
'SUB')
then
1453 write(bort_str,
'("BUFRLIB: UFBSEQ - INPUT MNEMONIC ",A," MUST '// &
1454 'BE A SEQUENCE (HERE IT IS TYPE """,A,""")")') tags(1),
typ(node)
1460 if(ityp>1) nseq = nseq+1
1463 write(bort_str,.GT.
'("BUFRLIB: UFBSEQ - INPUT SEQ. MNEM. ",A," CONSISTS OF",I4," TABLE B MNEM., THE MAX. '// &
1464 'SPECIFIED IN (INPUT) ARGUMENT 3 (",I3,")")') tags(1),nseq,i1
1468 inner:
do while (.true.)
1470 if(ins1>
nval(lun))
exit outer
1472 if(
typ(node)==
'RPC' .and.
val(ins1,lun)==0.)
then
1475 elseif(io==0 .and. iret+1>i2)
then
1477 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
1478 write ( unit=errstr, fmt=
'(A,I5,A,A,A)' )
'BUFRLIB: UFBSEQ - INCOMPLETE READ; ONLY THE FIRST ', i2, &
1479 ' (=4TH INPUT ARG.) ''LEVELS'' OF INPUT MNEMONIC ', tags(1),
' WERE READ'
1481 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
1486 elseif(ins1==0)
then
1487 if(io==1 .and. iret<i2)
then
1488 write(bort_str,
'("BUFRLIB: UFBSEQ - NO. OF ''LEVELS'.LT.
' WRITTEN (",I5,") NO. REQUESTED (",I5,") - '// &
1489 'INCOMPLETE WRITE (INPUT MNEMONIC IS ",A,")")') iret,i2,tags(1)
1493 write(bort_str,.GE.
'("BUFRLIB: UFBSEQ - VARIABLE INS1 MUST BE ZERO, HERE IT IS",I4," - INPUT MNEMONIC '// &
1494 'IS ",A)') ins1,tags(1)
1497 if(ins1==0 .or. iret==i2)
exit outer
1503 do while(
itp(
inv(j,lun))<2)
1506 if(io==0) usr(i,iret) =
val(j,lun)
1507 if(io==1)
val(j,lun) = usr(i,iret)
1517 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1518 errstr =
'BUFRLIB: UFBSEQ - NO SPECIFIED VALUES READ IN, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1521 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1525 if(iprt==-1) ifirst2 = 1
1526 if(ifirst2==0 .or. iprt>=1)
then
1527 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1528 errstr =
'BUFRLIB: UFBSEQ - NO SPECIFIED VALUES WRITTEN OUT, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1531 call errwrt(
'MAY NOT BE IN THE BUFR TABLE(?)')
1533 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
1534 'all such messages,'
1536 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
1540 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1587 recursive subroutine drfini(lunit,mdrf,ndrf,drftag)
1589 use modv_vars,
only: im8b
1596 character*(*),
intent(in) :: drftag
1598 integer,
intent(in) :: mdrf(*), lunit, ndrf
1599 integer,
parameter :: mxdrf = 2000
1600 integer my_mdrf(mxdrf), my_lunit, my_ndrf, mdrf4, ii, lun, il, im, m, n, node
1605 call x84(lunit,my_lunit,1)
1607 call x84(mdrf(ii),mdrf4,1)
1610 call x84(ndrf,my_ndrf,1)
1611 call drfini(my_lunit,my_mdrf,my_ndrf,drftag)
1616 call status(lunit,lun,il,im)
1620 do n = n+1,
nval(lun)
1622 if(
itp(node)==1 .and.
tag(node)==drftag)
then
1624 call usrtpl(lun,n,mdrf(m))
1656 use modv_vars,
only: bmiss
1664 integer,
intent(in) :: lun, i1, i2, io
1665 integer,
intent(out) :: iret
1666 integer iprt, nnod, ncon, nods, nodc, ivls, kons, inc1, inc2, ins1, ins2, invn, i, j, invwin, ibfms, lstjpb
1668 real*8,
intent(inout) :: usr(i1,i2)
1670 character*128 errstr
1671 character*10 tagstr, subset
1673 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
1682 outer:
do while (.true.)
1683 call conwin(lun,inc1,inc2)
1687 elseif(inc1==0)
then
1693 call getwin(nods(j),lun,ins1,ins2)
1699 call errwrt(
'++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
1700 call errwrt(
'UFBRW LEV TAG IO INS1 INVN INS2 '//subset)
1701 call errwrt(
'++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
1703 if(io==0) tagstr=
tag(nods(i))(1:8)//
' R'
1704 if(io==1) tagstr=
tag(nods(i))(1:8)//
' W'
1705 invn = invwin(nods(i),lun,ins1,ins2)
1706 if(invn==0.and.io==1)
call drstpl(nods(i),lun,ins1,ins2,invn)
1707 write(errstr,
'("LEV=",I5,1X,A,3I7)') iret,tagstr,ins1,invn,ins2
1712 if(io==1 .and. iret<=i2)
then
1715 if(ibfms(usr(i,iret))==0)
then
1716 invn = invwin(nods(i),lun,ins1,ins2)
1718 call drstpl(nods(i),lun,ins1,ins2,invn)
1723 call newwin(lun,inc1,inc2)
1724 val(invn,lun) = usr(i,iret)
1725 elseif(lstjpb(nods(i),lun,
'RPS')==0)
then
1726 val(invn,lun) = usr(i,iret)
1727 elseif(ibfms(
val(invn,lun))/=0)
then
1728 val(invn,lun) = usr(i,iret)
1730 call drstpl(nods(i),lun,ins1,ins2,invn)
1735 call newwin(lun,inc1,inc2)
1736 val(invn,lun) = usr(i,iret)
1743 if(io==0 .and. iret<=i2)
then
1747 invn = invwin(nods(i),lun,ins1,ins2)
1748 if(invn>0) usr(i,iret) =
val(invn,lun)
1753 if(io==1.and.iret==i2)
return
1754 call nxtwin(lun,ins1,ins2)
1755 if(ins1>0 .and. ins1<inc2) cycle
1756 if(ncon>0) cycle outer
1767 end subroutine ufbrw
1798 integer,
intent(in) :: lun, i1, i2, io
1799 integer,
intent(out) :: iret
1800 integer nnod, ncon, nods, nodc, ivls, kons, ins1, ins2, invn, i, nz, invtag
1802 real*8,
intent(inout) :: usr(i1,i2)
1804 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
1815 if(ins1+1>
nval(lun))
return
1816 if(io==1 .and. iret==i2)
return
1817 ins1 = invtag(nods(nz),lun,ins1+1,
nval(lun))
1819 ins2 = invtag(nods(nz),lun,ins1+1,
nval(lun))
1820 if(ins2==0) ins2 =
nval(lun)
1823 if(io==0 .and. iret<=i2)
then
1826 invn = invtag(nods(i),lun,ins1,ins2)
1827 if(invn>0) usr(i,iret) =
val(invn,lun)
1832 if(io==1 .and. iret<=i2)
then
1835 invn = invtag(nods(i),lun,ins1,ins2)
1836 if(invn>0)
val(invn,lun) = usr(i,iret)
1845 end subroutine ufbrp
1882 integer,
intent(in) :: lun, i1, i2, io
1883 integer,
intent(out) :: iret
1884 integer nnod, ncon, nods, nodc, ivls, kons, ins1, ins2, invn, invm, i, invtag
1886 real*8,
intent(inout) :: usr(i1,i2)
1888 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
1896 if(ins1+1>
nval(lun))
return
1897 ins1 = invtag(nods(1),lun,ins1+1,
nval(lun))
1899 ins2 = invtag(nods(1),lun,ins1+1,
nval(lun))
1900 if(ins2==0) ins2 =
nval(lun)
1903 if(io==0 .and. iret<=i2)
then
1907 invn = invtag(nods(i),lun,invm,ins2)
1908 if(invn>0) usr(i,iret) =
val(invn,lun)
1909 invm = max(invn,invm)
1914 if(io==1 .and. iret<=i2)
then
1918 invn = invtag(nods(i),lun,invm,ins2)
1919 if(invn>0)
val(invn,lun) = usr(i,iret)
1920 invm = max(invn,invm)
1927 end subroutine ufbsp
1979 use modv_vars,
only: im8b, mxh4wlc
1985 integer,
intent(in) :: lunit
1986 integer my_lunit, iprt, lens, lenc, i
1988 character*(*),
intent(in) :: chr, str
1990 character*128 errstr
1998 call x84(lunit,my_lunit,1)
2004 call strsuc( str, mystr, lens )
2005 if ( lens == -1 )
return
2007 lenc = min( len( chr ), 120 )
2013 if ( ( lunit ==
luh4wlc(i) ) .and. ( mystr(1:lens) ==
sth4wlc(i)(1:lens) ) )
then
2015 chh4wlc(i)(1:lenc) = chr(1:lenc)
2022 if (
nh4wlc >= mxh4wlc )
then
2024 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2025 write ( unit=errstr, fmt=
'(A,A,I3)' )
'BUFRLIB: HOLD4WLC - THE MAXIMUM NUMBER OF LONG CHARACTER ', &
2026 'STRINGS THAT CAN BE HELD INTERNALLY IS ', mxh4wlc
2028 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2074 integer,
intent(in) :: lun, i1, i2, io
2075 integer,
intent(out) :: iret
2076 integer nnod, ncon, nods, nodc, ivls, kons, ndrp, invn, jnvn, knvn, invwin, lstjpb
2078 real*8,
intent(inout) :: usr(i1,i2)
2080 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
2084 ndrp = lstjpb(nods(1),lun,
'DRP')
2089 invn = invwin(ndrp,lun,1,
nval(lun))
2092 do while(nint(
val(jnvn,lun))>0)
2093 jnvn = jnvn+nint(
val(jnvn,lun))
2095 do knvn=1,
nval(lun)-jnvn+1
2096 inv(invn+knvn,lun) =
inv(jnvn+knvn-1,lun)
2097 val(invn+knvn,lun) =
val(jnvn+knvn-1,lun)
2099 nval(lun) =
nval(lun)-(jnvn-invn-1)
2104 call ufbrw(lun,usr,i1,i2,io,iret)
2128 recursive subroutine ufbovr(lunit,usr,i1,i2,iret,str)
2130 use modv_vars,
only: im8b
2137 integer,
intent(in) :: lunit, i1, i2
2138 integer,
intent(out) :: iret
2139 integer iprt, ifirst1, my_lunit, my_i1, my_i2, lun, il, im, io
2141 character*(*),
intent(in) :: str
2142 character*128 bort_str1, bort_str2, errstr
2144 real*8,
intent(inout) :: usr(i1,i2)
2156 call x84(lunit,my_lunit,1)
2157 call x84(i1,my_i1,1)
2158 call x84(i2,my_i2,1)
2159 call ufbovr(my_lunit,usr,my_i1,my_i2,iret,str)
2160 call x48(iret,iret,1)
2169 call status(lunit,lun,il,im)
2170 if(il==0)
call bort(
'BUFRLIB: UFBOVR - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
2171 if(il<0)
call bort(
'BUFRLIB: UFBOVR - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
2172 if(im==0)
call bort(
'BUFRLIB: UFBOVR - A MESSAGE MUST BE OPEN IN OUTPUT BUFR FILE, NONE ARE')
2173 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBOVR - LOCATION OF INTERNAL TABLE FOR '// &
2174 'OUTPUT BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
2176 io = min(max(0,il),1)
2180 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2181 errstr = .LE.
'BUFRLIB: UFBOVR - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
2184 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2189 if(iprt==-1) ifirst1 = 1
2190 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
2191 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2192 errstr = .LE.
'BUFRLIB: UFBOVR - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
2195 if(iprt==0 .and. io==1)
then
2196 errstr =
'Note: Only the first occurrence of this WARNING ' // &
2197 'message is printed, there may be more. To output all such messages,'
2199 errstr =
'modify your application program to add ' // &
2200 '"CALL OPENBF(0,''QUIET'',1)" prior to the first call to a BUFRLIB routine.'
2203 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2212 call string(str,lun,i1,io)
2213 call trybump(lun,usr,i1,i2,io,iret)
2215 if(io==1 .and. iret/=i2)
then
2216 write(bort_str1,
'("BUFRLIB: UFBOVR - MNEMONIC STRING READ IN IS: ",A)') str
2217 write(bort_str2,
'(18X,"THE NUMBER OF ''LEVELS'' ACTUALLY '// &
2218 'WRITTEN (",I3,") DOES NOT EQUAL THE NUMBER REQUESTED (",I3,") - INCOMPLETE WRITE")') iret, i2
2219 call bort2(bort_str1,bort_str2)
2267 recursive subroutine ufbevn(lunit,usr,i1,i2,i3,iret,str)
2269 use modv_vars,
only: im8b, bmiss
2276 character*(*),
intent(in) :: str
2277 character*128 errstr
2279 integer,
intent(in) :: lunit, i1, i2, i3
2280 integer,
intent(out) :: iret
2281 integer invn(255), nnod, ncon, nods, nodc, ivls, kons, maxevn, iprt, my_lunit, my_i1, my_i2, my_i3, i, j, k, lun, il, im, &
2282 ins1, ins2, inc1, inc2, nnvn,
nvnwin
2284 real*8,
intent(out) :: usr(i1,i2,i3)
2288 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
2289 common /ufbn3c/ maxevn
2296 call x84(lunit,my_lunit,1)
2297 call x84(i1,my_i1,1)
2298 call x84(i2,my_i2,1)
2299 call x84(i3,my_i3,1)
2300 call ufbevn(my_lunit,usr,my_i1,my_i2,my_i3,iret,str)
2301 call x48(iret,iret,1)
2311 call status(lunit,lun,il,im)
2312 if(il==0)
call bort(
'BUFRLIB: UFBEVN - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
2313 if(il>0)
call bort(
'BUFRLIB: UFBEVN - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
2314 if(im==0)
call bort(
'BUFRLIB: UFBEVN - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
2315 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBEVN - LOCATION OF INTERNAL TABLE FOR '// &
2316 'INPUT BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
2320 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2321 errstr = .LE.
'BUFRLIB: UFBEVN - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
2324 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2330 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2331 errstr = .LE.
'BUFRLIB: UFBEVN - 4th ARG. (INPUT) IS 0, SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
2334 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2340 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2341 errstr = .LE.
'BUFRLIB: UFBEVN - 5th ARG. (INPUT) IS 0, SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
2344 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2352 call string(str,lun,i1,0)
2368 outer:
do while (.true.)
2369 call conwin(lun,inc1,inc2)
2373 elseif(inc1==0)
then
2380 call getwin(nods(i),lun,ins1,ins2)
2386 if(.not.nodgt0)
then
2391 inner:
do while (.true.)
2396 nnvn =
nvnwin(nods(j),lun,ins1,ins2,invn,i3)
2397 maxevn = max(nnvn,maxevn)
2399 usr(j,iret,k) =
val(invn(k),lun)
2405 call nxtwin(lun,ins1,ins2)
2406 if(ins1<=0 .or. ins1>=inc2)
exit inner
2408 if(ncon<=0)
exit outer
2414 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2415 errstr =
'BUFRLIB: UFBEVN - NO SPECIFIED VALUES READ IN, SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
2418 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2471 recursive subroutine ufbin3(lunit,usr,i1,i2,i3,iret,jret,str)
2473 use modv_vars,
only: im8b, bmiss
2480 character*(*),
intent(in) :: str
2481 character*128 errstr
2483 integer,
intent(in) :: lunit, i1, i2, i3
2484 integer,
intent(out) :: iret, jret
2485 integer nnod, ncon, nods, nodc, ivls, kons, iprt, my_lunit, my_i1, my_i2, my_i3, i, j, k, lun, il, im, &
2486 ins1, ins2, inc1, inc2, nnvn,
nevn
2488 real*8,
intent(out) :: usr(i1,i2,i3)
2492 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
2499 call x84(lunit,my_lunit,1)
2500 call x84(i1,my_i1,1)
2501 call x84(i2,my_i2,1)
2502 call x84(i3,my_i3,1)
2503 call ufbin3(my_lunit,usr,my_i1,my_i2,my_i3,iret,jret,str)
2504 call x48(iret,iret,1)
2505 call x48(jret,jret,1)
2515 call status(lunit,lun,il,im)
2516 if(il==0)
call bort(
'BUFRLIB: UFBIN3 - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
2517 if(il>0)
call bort(
'BUFRLIB: UFBIN3 - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
2518 if(im==0)
call bort(
'BUFRLIB: UFBIN3 - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
2519 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBIN3 - LOCATION OF INTERNAL TABLE FOR '// &
2520 'INPUT BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
2524 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2525 errstr = .LE.
'BUFRLIB: UFBIN3 - 3rd ARG. (INPUT) IS 0, ' // &
2526 'SO RETURN WITH 6th AND 7th ARGS. (IRET, JRET) = 0; 8th ARG. (STR) ='
2529 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2535 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2536 errstr = .LE.
'BUFRLIB: UFBIN3 - 4th ARG. (INPUT) IS 0, ' // &
2537 'SO RETURN WITH 6th AND 7th ARGS. (IRET, JRET) = 0; 8th ARG. (STR) ='
2540 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2546 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2547 errstr = .LE.
'BUFRLIB: UFBIN3 - 5th ARG. (INPUT) IS 0, ' // &
2548 'SO RETURN WITH 6th AND 7th ARGS. (IRET, JRET) = 0; 8th ARG. (STR) ='
2551 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2559 call string(str,lun,i1,0)
2575 outer:
do while (.true.)
2576 call conwin(lun,inc1,inc2)
2580 elseif(inc1==0)
then
2587 call getwin(nods(i),lun,ins1,ins2)
2593 if(.not.nodgt0)
then
2598 inner:
do while (.true.)
2602 nnvn =
nevn(nods(j),lun,ins1,ins2,i1,i2,i3,usr(j,iret,1))
2603 jret = max(jret,nnvn)
2607 call nxtwin(lun,ins1,ins2)
2608 if(ins1<=0 .or. ins1>=inc2)
exit inner
2610 if(ncon<=0)
exit outer
2614 if(iret==0 .or. jret==0)
then
2616 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2617 errstr =
'BUFRLIB: UFBIN3 - NO SPECIFIED VALUES READ IN, ' // &
2618 'SO RETURN WITH 6th AND/OR 7th ARGS. (IRET, JRET) = 0; 8th ARG. (STR) ='
2621 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2662 recursive subroutine ufbinx(lunit,imsg,isub,usr,i1,i2,iret,str)
2664 use modv_vars,
only: im8b
2671 integer,
intent(in) :: lunit, imsg, isub, i1, i2
2672 integer,
intent(out) :: iret
2673 integer my_lunit, my_imsg, my_isub, my_i1, my_i2, lun, il, im, jdate, jret, i
2675 character*(*),
intent(in) :: str
2676 character*128 bort_str
2679 real*8,
intent(out) :: usr(i1,i2)
2686 call x84(lunit,my_lunit,1)
2687 call x84(imsg,my_imsg,1)
2688 call x84(isub,my_isub,1)
2689 call x84(i1,my_i1,1)
2690 call x84(i2,my_i2,1)
2691 call ufbinx(my_lunit,my_imsg,my_isub,usr,my_i1,my_i2,iret,str)
2692 call x48(iret,iret,1)
2697 call status(lunit,lun,il,im)
2702 call openbf(lunit,
'INX',lunit)
2710 call readmg(lunit,subset,jdate,jret)
2712 write(bort_str,
'("BUFRLIB: UFBINX - HIT END OF FILE BEFORE '// &
2713 'READING REQUESTED MESSAGE NO.",I5," IN BUFR FILE CONNECTED TO UNIT",I4)') imsg, lunit
2722 write(bort_str,
'("BUFRLIB: UFBINX - ALL SUBSETS READ BEFORE '// &
2723 'READING REQ. SUBSET NO.",I3," IN REQ. MSG NO.",I5," IN BUFR FILE CONNECTED TO UNIT",I4)') isub, imsg, lunit
2729 call ufbint(lunit,usr,i1,i2,iret,str)
2756 recursive subroutine ufbget(lunit,tab,i1,iret,str)
2758 use modv_vars,
only: im8b, bmiss
2769 integer,
intent(in) :: lunit, i1
2770 integer,
intent(out) :: iret
2771 integer nnod, ncon, nods, nodc, ivls, kons, my_lunit, my_i1, lun, il, im, i, n, node, nbmp, kbit, invn,
invwin
2773 character*(*),
intent(in) :: str
2776 real*8,
intent(out) :: tab(i1)
2779 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
2781 equivalence(cval,rval)
2787 call x84(lunit,my_lunit,1)
2788 call x84(i1,my_i1,1)
2789 call ufbget(my_lunit,tab,my_i1,iret,str)
2790 call x48(iret,iret,1)
2803 call status(lunit,lun,il,im)
2804 if(il==0)
call bort(
'BUFRLIB: UFBGET - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
2805 if(il>0)
call bort(
'BUFRLIB: UFBGET - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
2806 if(im==0)
call bort(
'BUFRLIB: UFBGET - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
2817 call string(str,lun,i1,0)
2829 if(node==nods(nnod))
then
2832 elseif(
itp(node)==1)
then
2846 if(
itp(node)==1)
then
2848 elseif(
itp(node)==2)
then
2849 if(ival<2_8**(
ibt(node))-1) tab(i) =
ups(ival,node)
2850 elseif(
itp(node)==3)
then
2853 call upc(cval,
nbit(invn)/8,
mbay(1,lun),kbit,.true.)
2888 integer function nevn(node,lun,inv1,inv2,i1,i2,i3,usr)
result(iret)
2894 integer,
intent(in) :: node, lun, inv1, inv2, i1, i2, i3
2897 character*128 bort_str
2899 real*8,
intent(out) :: usr(i1,i2,i3)
2905 ndrs =
lstjpb(node,lun,
'DRS')
2908 invn =
invwin(ndrs,lun,inv1,inv2)
2909 if(invn==0)
call bort(
'BUFRLIB: iret - CAN''T FIND THE EVENT STACK!!!!!!')
2911 iret = nint(
val(invn,lun))
2913 write(bort_str,
'("BUFRLIB: NEVN - THE NO. OF EVENTS FOR THE '// &
2914 'REQUESTED STACK (",I3,") EXCEEDS THE VALUE OF THE 3RD DIM. OF THE USR ARRAY (",I3,")")') iret, i3
2924 n2 = n2 + nint(
val(n1,lun))
2926 if(
inv(n,lun)==node) usr(1,1,l) =
val(n,lun)
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 upb(nval, nbits, ibay, ibit)
Decode an integer value from within a specified number of bits of an integer array,...
subroutine upbb(nval, nbits, ibit, ibay)
Decode an integer value from within a specified number of bits of an integer array,...
subroutine upb8(nval, nbits, ibit, ibay)
Decode an 8-byte integer value from within a specified number of bits of an integer array,...
real *8 function ups(ival, node)
Unpack a real*8 value from an integer by applying the proper scale and reference values.
subroutine upc(chr, nchr, ibay, ibit, cnvnull)
Decode a character string from within a specified number of bytes of an integer array,...
subroutine pkc(chr, nchr, ibay, ibit)
Encode a character string within a specified number of bytes of an integer array, starting at the bit...
recursive subroutine ipkm(cbay, nbyt, n)
Encode an integer value within a specified number of bytes of a character string, up to a maximum of ...
subroutine errwrt(str)
Specify a custom location for the logging of error and diagnostic messages generated by the NCEPLIBS-...
subroutine fstag(lun, utag, nutag, nin, nout, iret)
Search for a specified occurrence of a specified mnemonic within a data subset definition,...
subroutine drstpl(inod, lun, inv1, inv2, invn)
Search for a specified mnemonic within unexpanded sequences of the internal jump/link table.
integer function nvnwin(node, lun, inv1, inv2, invn, nmax)
Search for all occurrences of a specified node within a specified portion of the current data subset.
integer function lstjpb(node, lun, jbtyp)
Search backwards, beginning from a given node within the jump/link table, until finding the most rece...
integer function invtag(node, lun, inv1, inv2)
Search for a specified mnemonic within a specified portion of the current data subset.
subroutine nxtwin(lun, iwin, jwin)
Compute the start and end indices of the next window.
subroutine newwin(lun, iwin, jwin)
Compute the ending index of the window.
integer function invwin(node, lun, inv1, inv2)
Search for a specified node within a specified portion of the current data subset.
subroutine conwin(lun, inc1, inc2)
Search consecutive subset buffer segments for a conditional node.
subroutine getwin(node, lun, iwin, jwin)
Look for a window containing a specified node within the internal jump/link table.
subroutine strsuc(str1, str2, lens)
Remove leading and trailing blanks from a character string.
Declare arrays and variables used to store BUFR messages internally for multiple file IDs.
integer ibit
Bit pointer within ibay.
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 needed for the storage of data values needed when writing compressed dat...
integer ncol
Number of data subsets in message.
character *(:), dimension(:,:), allocatable catx
Character data values for all data subsets in message.
integer *8, dimension(:,:), allocatable matx
Non-character data values for all data subsets in message.
Declare arrays and variables needed to store long character strings (greater than 8 bytes) via subrou...
integer nh4wlc
Number of long character strings being stored.
character *14, dimension(:), allocatable sth4wlc
Table B mnemonics associated with long character strings.
integer, dimension(:), allocatable luh4wlc
File ID for associated output file.
character *120, dimension(:), allocatable chh4wlc
Long character strings.
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 msub
Total number of data subsets in message.
integer, dimension(:), allocatable nsub
Current subset pointer within message.
Declare arrays and variables needed to store information about long character strings (greater than 8...
integer nrst
Number of long character strings in data subset.
integer, dimension(:), allocatable irnch
Lengths (in bytes) of long character strings.
integer, dimension(:), allocatable irbit
Pointers in data subset to first bits of long character strings.
character *10, dimension(:), allocatable crtag
Table B mnemonics associated with long character strings.
Declare arrays and variables used to store the internal jump/link table.
integer, dimension(:), allocatable isc
Scale factors corresponding to tag and typ:
integer, dimension(:), allocatable ibt
Bit widths corresponding to tag and typ:
character *3, dimension(:), allocatable typ
Type indicators corresponding to tag:
integer, dimension(:), allocatable jmpb
Jump backward indices corresponding to tag and typ:
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
integer, dimension(:), allocatable itp
Integer type values corresponding to typ:
integer, dimension(:), allocatable link
Link indices corresponding to tag, typ and jmpb:
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:
Declare arrays for internal storage of pointers to BUFR data subset values.
integer, dimension(:), allocatable nbit
Length (in bits) of each packed data value in data subset.
integer, dimension(:), allocatable mbit
Pointer in data subset to first bit of each packed data value.
Declare arrays used to store data values and associated metadata for the current BUFR data subset in ...
integer, dimension(:), allocatable nval
Number of data values in BUFR data subset.
real *8, dimension(:,:), allocatable, target val
Data values.
integer, dimension(:,:), allocatable, target inv
Inventory pointer which links each data value to its corresponding node in the internal jump/link tab...
recursive subroutine closbf(lunit)
Close the connection between logical unit lunit and the NCEPLIBS-bufr software.
subroutine rewnbf(lunit, isr)
Store or restore parameters associated with a BUFR file.
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 readmg(lunxx, subset, jdate, iret)
Read the next BUFR message from logical unit abs(lunxx) into internal arrays.
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 usrtpl(lun, invn, nbmp)
Expand a subset template within internal arrays.
recursive subroutine readsb(lunit, iret)
Read the next data subset from a BUFR message.
recursive real *8 function getvalnb(lunit, tagpv, ntagpv, tagnb, ntagnb)
Read a data value corresponding to a specific occurrence of a mnemonic within a data subset,...
recursive subroutine ufbin3(lunit, usr, i1, i2, i3, iret, jret, str)
Read one or more data values from an NCEP prepfits file.
recursive subroutine ufbinx(lunit, imsg, isub, usr, i1, i2, iret, str)
Read one or more data values from a specified data subset.
integer function nevn(node, lun, inv1, inv2, i1, i2, i3, usr)
Read one or more data values from a stacked data event within a specified portion of the current data...
subroutine ufbrp(lun, usr, i1, i2, io, iret)
Write or read specified data values to or from the current BUFR data subset within internal arrays,...
recursive subroutine ufbseq(lunin, usr, i1, i2, iret, str)
Read or write an entire sequence of data values from or to a data subset.
subroutine ufbrw(lun, usr, i1, i2, io, iret)
Write or read specified values to or from the current BUFR data subset within internal arrays,...
recursive subroutine hold4wlc(lunit, chr, str)
Write a long character string (greater than 8 bytes) to a data subset.
recursive subroutine ufbovr(lunit, usr, i1, i2, iret, str)
Overwrite one or more data values within a data subset.
recursive subroutine ufbint(lunin, usr, i1, i2, iret, str)
Read or write one or more data values from or to a data subset.
subroutine ufbsp(lun, usr, i1, i2, io, iret)
Write or read specified values to or from the current BUFR data subset within internal arrays,...
subroutine trybump(lun, usr, i1, i2, io, iret)
Try to expand a delayed replication sequence.
recursive subroutine drfini(lunit, mdrf, ndrf, drftag)
Explicitly initialize delayed replication factors and allocate a corresponding amount of space within...
recursive subroutine ufbstp(lunin, usr, i1, i2, iret, str)
Read or write one or more data values from or to a data subset.
recursive subroutine readlc(lunit, chr, str)
Read a long character string (greater than 8 bytes) from a data subset.
recursive subroutine setvalnb(lunit, tagpv, ntagpv, tagnb, ntagnb, r8val, iret)
Write a data value corresponding to a specific occurrence of a mnemonic within a data subset,...
recursive subroutine ufbevn(lunit, usr, i1, i2, i3, iret, str)
Read one or more data values from an NCEP prepbufr file.
recursive subroutine writlc(lunit, chr, str)
Write a long character string (greater than 8 bytes) to a data subset.
recursive subroutine ufbget(lunit, tab, i1, iret, str)
Read one or more data values from a data subset without advancing the subset pointer.
recursive subroutine ufbrep(lunin, usr, i1, i2, iret, str)
Read or write one or more data values from or to a data subset.
recursive integer function iupbs3(mbay, s3mnem)
Read a specified value from within Section 3 of a BUFR message.
subroutine parstr(str, tags, mtag, ntag, sep, limit80)
Parse a string containing one or more substrings into an array of substrings.
subroutine parutg(lun, io, utg, nod, kon, val)
Parse a mnemonic from a character string.
subroutine string(str, lun, i1, io)
Check whether a string is in the internal mnemonic string cache.
subroutine x48(iin4, iout8, nval)
Encode one or more 4-byte integer values as 8-byte integer values.
subroutine x84(iin8, iout4, nval)
Encode one or more 8-byte integer values as 4-byte integer values.