37 recursive subroutine setvalnb ( lunit, tagpv, ntagpv, tagnb, ntagnb, r8val, iret )
41 use modv_vars,
only: im8b
49 integer,
intent(in) :: lunit, ntagpv, ntagnb
50 integer,
intent(out) :: iret
51 integer my_lunit, my_ntagpv, my_ntagnb, lun, il, im, npv, nnb, ierft, lpv, lnb,
bort_target_set
53 character*(*),
intent(in) :: tagpv, tagnb
54 character*9 ctagpv, ctagnb
56 real*8,
intent(in) :: r8val
61 call x84 ( lunit, my_lunit, 1 )
62 call x84 ( ntagpv, my_ntagpv, 1 )
63 call x84 ( ntagnb, my_ntagnb, 1 )
64 call setvalnb ( my_lunit, tagpv, my_ntagpv, tagnb, my_ntagnb, r8val, iret )
65 call x48 ( iret, iret, 1 )
73 call strsuc( tagpv, ctagpv, lpv )
74 call strsuc( tagnb, ctagnb, lnb )
83 call status (lunit, lun, il, im )
85 if (
inode(lun) /=
inv(1,lun) )
return
88 call fstag( lun, tagpv, ntagpv, 1, npv, ierft )
89 if ( ierft /= 0 )
return
92 call fstag( lun, tagnb, ntagnb, npv, nnb, ierft )
93 if ( ierft /= 0 )
return
134 recursive real*8 function getvalnb ( lunit, tagpv, ntagpv, tagnb, ntagnb )
result ( r8val )
138 use modv_vars,
only: im8b, bmiss
146 integer,
intent(in) :: lunit, ntagpv, ntagnb
147 integer my_lunit, my_ntagpv, my_ntagnb, lun, il, im, npv, nnb, ierft, lpv, lnb,
bort_target_set
149 character*(*),
intent(in) :: tagpv, tagnb
150 character*9 ctagpv, ctagnb
155 call x84(lunit,my_lunit,1)
156 call x84(ntagpv,my_ntagpv,1)
157 call x84(ntagnb,my_ntagnb,1)
158 r8val=
getvalnb(my_lunit,tagpv,my_ntagpv,tagnb,my_ntagnb)
164 call strsuc( tagpv, ctagpv, lpv )
165 call strsuc( tagnb, ctagnb, lnb )
174 call status (lunit, lun, il, im )
175 if ( il >= 0 )
return
176 if (
inode(lun) /=
inv(1,lun) )
return
179 call fstag( lun, tagpv, ntagpv, 1, npv, ierft )
180 if ( ierft /= 0 )
return
183 call fstag( lun, tagnb, ntagnb, npv, nnb, ierft )
184 if ( ierft /= 0 )
return
229 recursive subroutine writlc(lunit,chr,str)
233 use modv_vars,
only: im8b, mxlcc, iprt
243 integer,
intent(in) :: lunit
244 integer my_lunit, maxtg, lun, il, im, ntg, nnod, kon, ii, n, node, ioid, ival, mbit, nbit, nbmp, nchr, nbyt, nsubs, &
245 itagct, len0, len1, len2, len3, l4, l5, mbyte,
iupbs3, lcstr, lcchr,
bort_target_set
247 character*(*),
intent(in) :: chr, str
248 character*128 bort_str, errstr
261 call x84(lunit,my_lunit,1)
262 call writlc(my_lunit,chr,str)
269 call strsuc(str,cstr,lcstr)
270 call strsuc(chr,cchr,lcchr)
277 call status(lunit,lun,il,im)
278 if(il==0)
call bort(
'BUFRLIB: WRITLC - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
279 if(il<0)
call bort(
'BUFRLIB: WRITLC - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
280 if(im==0)
call bort(
'BUFRLIB: WRITLC - A MESSAGE MUST BE OPEN IN OUTPUT BUFR FILE, NONE ARE')
283 call parstr(str,tgs,maxtg,ntg,
' ',.true.)
285 write(bort_str,
'("BUFRLIB: WRITLC - THERE CANNOT BE MORE THAN '// &
286 ' ONE MNEMONIC IN THE INPUT STRING (",A,") (HERE THERE ARE",I4,")")') str,ntg
291 call parutg(lun,1,tgs(1),nnod,kon,roid)
297 do while((ii<=10).and.(tgs(1)(ii:ii)/=
'#'))
298 ctag(ii:ii)=tgs(1)(ii:ii)
311 do while (n+1<=
nval(lun))
314 if(
itp(node)==1)
then
317 elseif(ctag==
tag(node))
then
319 if(itagct==ioid)
then
320 if(
itp(node)/=3)
then
321 write(bort_str,
'("BUFRLIB: WRITLC - MNEMONIC ",A," DOES NOT REPRESENT A CHARACTER ELEMENT (TYP=",A,")")') &
328 nchr=min(mxlcc,len(chr),
ibt(node)/8)
337 call getlens(
mbay(1,lun),3,len0,len1,len2,len3,l4,l5)
338 mbyte = len0 + len1 + len2 + len3 + 4
341 do while(nsubs<
nsub(lun))
347 if(nsubs/=
nsub(lun))
then
349 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
350 errstr =
'BUFRLIB: WRITLC - COULDN''T WRITE VALUE FOR ' // ctag // &
351 ' INTO SUBSET, BECAUSE NO SUBSET WAS OPEN FOR WRITING'
353 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
364 do while (n+1<=
nval(lun))
369 if(
itp(node)==1)
then
370 call upbb(ival,nbit,mbit,
mbay(1,lun))
372 elseif(ctag==
tag(node))
then
374 if(itagct==ioid)
then
375 if(
itp(node)/=3)
then
376 write(bort_str,
'("BUFRLIB: WRITLC - MNEMONIC ",A," DOES NOT REPRESENT A CHARACTER ELEMENT (TYP=",A,")")') &
385 call pkc(chr,nchr,
mbay(1,lun),mbit)
395 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
396 errstr =
'BUFRLIB: WRITLC - COULDN''T WRITE VALUE FOR ' // ctag //
' INTO SUBSET, BECAUSE IT WASN''T FOUND IN THE ' // &
399 errstr =
'(' // ctag //
' MAY NOT BE IN THE BUFR TABLE(?))'
401 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
447 recursive subroutine readlc(lunit,chr,str)
451 use modv_vars,
only: im8b, iprt
462 integer,
intent(in) :: lunit
463 integer my_lunit, maxtg, lchr, lun, il, im, ntg, nnod, kon, ii, n, nod, ioid, itagct, nchr, kbit, lcstr, lcchr, ncchr, &
466 character*(*),
intent(in) :: str
467 character*(*),
intent(out) :: chr
469 character*128 bort_str, errstr
473 character*(:),
allocatable :: cchr
482 call x84(lunit,my_lunit,1)
483 call readlc(my_lunit,chr,str)
493 call strsuc(str,cstr,lcstr)
495 allocate(
character*(lcchr) :: cchr)
497 chr(1:ncchr) = cchr(1:ncchr)
504 call status(lunit,lun,il,im)
505 if(il==0)
call bort(
'BUFRLIB: READLC - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
506 if(il>0)
call bort(
'BUFRLIB: READLC - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
507 if(im==0)
call bort(
'BUFRLIB: READLC - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
510 call parstr(str,tgs,maxtg,ntg,
' ',.true.)
512 write(bort_str,
'("BUFRLIB: READLC - THERE CANNOT BE MORE THAN '// &
513 'ONE MNEMONIC IN THE INPUT STRING (",A,") (HERE THERE ARE ",I3,")")') str,ntg
519 call parutg(lun,0,tgs(1),nnod,kon,roid)
525 do while((ii<=10).and.(tgs(1)(ii:ii)/=
'#'))
526 ctag(ii:ii)=tgs(1)(ii:ii)
540 if(ctag==
tag(nod))
then
542 if(itagct==ioid)
then
544 write(bort_str,
'("BUFRLIB: READLC - MNEMONIC ",A," DOES NOT '// &
545 'REPRESENT A CHARACTER ELEMENT (ITP=",I2,")")') tgs(1),
itp(nod)
550 write(bort_str,
'("BUFRLIB: READLC - MNEMONIC ",A," IS A '// &
551 'CHARACTER STRING OF LENGTH",I4," BUT SPACE WAS PROVIDED FOR ONLY",I4, " CHARACTERS")') tgs(1),nchr,lchr
555 call upc(chr,nchr,
mbay(1,lun),kbit,.true.)
565 if(ctag==
crtag(ii))
then
567 if(itagct==ioid)
then
570 write(bort_str,
'("BUFRLIB: READLC - MNEMONIC ",A," IS A '// &
571 'CHARACTER STRING OF LENGTH",I4," BUT SPACE WAS PROVIDED FOR ONLY",I4, " CHARACTERS")') tgs(1),nchr,lchr
575 call upc(chr,nchr,
mbay(1,lun),kbit,.true.)
585 call errwrt(
'++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
586 errstr =
'BUFRLIB: READLC - MNEMONIC ' // tgs(1) // &
587 ' NOT LOCATED IN REPORT SUBSET - RETURN WITH MISSING STRING FOR CHARACTER DATA ELEMENT'
589 call errwrt(
'++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
593 call ipkm(chr(ii:ii),1,255)
701 recursive subroutine ufbint(lunin,usr,i1,i2,iret,str)
705 use modv_vars,
only: im8b, bmiss, iprt
712 character*(*),
intent(in) :: str
713 character*128 bort_str1, bort_str2, errstr
716 integer,
intent(in) :: lunin, i1, i2
717 integer,
intent(out) :: iret
718 integer nnod, ncon, nods, nodc, ivls, kons, ifirst1, ifirst2, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, lcstr, &
721 real*8,
intent(inout) :: usr(i1,i2)
723 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
725 data ifirst1 /0/, ifirst2 /0/
727 save ifirst1, ifirst2
732 call x84(lunin,my_lunin,1)
735 call ufbint(my_lunin,usr,my_i1,my_i2,iret,str)
736 call x48(iret,iret,1)
743 call strsuc(str,cstr,lcstr)
753 call status(lunit,lun,il,im)
754 if(il==0)
call bort(
'BUFRLIB: UFBINT - BUFR FILE IS CLOSED, IT MUST BE OPEN')
755 if(im==0)
call bort(
'BUFRLIB: UFBINT - A MESSAGE MUST BE OPEN IN BUFR FILE, NONE ARE')
756 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBINT - LOCATION OF INTERNAL TABLE FOR BUFR FILE DOES NOT AGREE ' // &
757 'WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
759 io = min(max(0,il),1)
760 if(lunit/=lunin) io = 0
764 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
765 errstr = .LE.
'BUFRLIB: UFBINT - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
768 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
773 if(iprt==-1) ifirst1 = 1
774 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
775 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
776 errstr = .LE.
'BUFRLIB: UFBINT - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
779 if(iprt==0 .and. io==1)
then
780 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
783 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
787 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
795 call string(str,lun,i1,io)
798 if(io==0) usr(1:i1,1:i2) = bmiss
801 call ufbrw(lun,usr,i1,i2,io,iret)
804 if(io==0 .and. iret>i2)
then
806 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
807 errstr =
'BUFRLIB: UFBINT - MNEMONIC STRING READ IN IS: ' // str
809 write (errstr,
'("THE NUMBER OF ''LEVELS'' AVAILABLE IN THE SUBSET '// &
810 '(",I5,") IS GREATER THAN THE NUMBER REQUESTED (",I5,") - INCOMPLETE READ")') iret,i2
812 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
819 if(io==1 .and. iret/=i2 .and. iret>=0)
then
820 call trybump(lun,usr,i1,i2,io,iret)
822 write(bort_str1,
'("BUFRLIB: UFBINT - MNEMONIC STRING READ IN IS: ",A)') str
823 write(bort_str2,
'(18X,"THE NUMBER OF ''LEVELS'' ACTUALLY '// &
824 'WRITTEN (",I3,") DOES NOT EQUAL THE NUMBER REQUESTED (",I3,") - INCOMPLETE WRITE")') iret,i2
825 call bort2(bort_str1,bort_str2)
827 elseif(iret==-1)
then
834 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
835 errstr =
'BUFRLIB: UFBINT - NO SPECIFIED VALUES READ IN, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
838 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
842 if(iprt==-1) ifirst2 = 1
843 if(ifirst2==0 .or. iprt>=1)
then
844 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
845 errstr =
'BUFRLIB: UFBINT - NO SPECIFIED VALUES WRITTEN OUT, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
848 call errwrt(
'MAY NOT BE IN THE BUFR TABLE(?)')
850 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
853 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call ' // &
854 'to a BUFRLIB routine.'
857 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
961 recursive subroutine ufbrep(lunin,usr,i1,i2,iret,str)
965 use modv_vars,
only: im8b, bmiss, iac, iprt
972 character*(*),
intent(in) :: str
973 character*128 bort_str1, bort_str2, errstr
976 integer,
intent(in) :: lunin, i1, i2
977 integer,
intent(out) :: iret
978 integer ifirst1, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, iac_prev, lcstr,
bort_target_set
980 real*8,
intent(inout) :: usr(i1,i2)
989 call x84(lunin,my_lunin,1)
992 call ufbrep(my_lunin,usr,my_i1,my_i2,iret,str)
993 call x48(iret,iret,1)
1000 call strsuc(str,cstr,lcstr)
1010 call status(lunit,lun,il,im)
1011 if(il==0)
call bort(
'BUFRLIB: UFBREP - BUFR FILE IS CLOSED, IT MUST BE OPEN')
1012 if(im==0)
call bort(
'BUFRLIB: UFBREP - A MESSAGE MUST BE OPEN IN BUFR FILE, NONE ARE')
1013 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBREP - LOCATION OF INTERNAL TABLE FOR BUFR FILE DOES NOT AGREE ' // &
1014 'WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
1016 io = min(max(0,il),1)
1017 if(lunit/=lunin) io = 0
1021 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1022 errstr = .LE.
'BUFRLIB: UFBREP - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1025 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1030 if(iprt==-1) ifirst1 = 1
1031 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
1032 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1033 errstr = .LE.
'BUFRLIB: UFBREP - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1036 if(iprt==0 .and. io==1)
then
1037 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
1038 'all such messages,'
1040 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
1044 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1052 if(io==0) usr(1:i1,1:i2) = bmiss
1057 call string(str,lun,i1,io)
1061 call ufbrp(lun,usr,i1,i2,io,iret)
1064 if(io==0 .and. iret>i2)
then
1066 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
1067 errstr =
'BUFRLIB: UFBREP - MNEMONIC STRING READ IN IS: ' // str
1069 write (errstr,
'("THE NUMBER OF ''LEVELS'' AVAILABLE IN THE SUBSET '// &
1070 '(",I5,") IS GREATER THAN THE NUMBER REQUESTED (",I5,") - INCOMPLETE READ")') iret,i2
1072 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
1078 if(io==1 .and. iret<i2)
then
1079 write(bort_str1,
'("BUFRLIB: UFBREP - MNEMONIC STRING READ IN IS: ",A)') str
1080 write(bort_str2,
'(18X,"THE NUMBER OF ''LEVELS'' ACTUALLY '// &
1081 'WRITTEN (",I3,") LESS THAN THE NUMBER REQUESTED (",I3,") - INCOMPLETE WRITE")') iret,i2
1082 call bort2(bort_str1,bort_str2)
1085 if(iret==0 .and. io==0 .and. iprt>=1)
then
1086 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1087 errstr =
'BUFRLIB: UFBREP - NO SPECIFIED VALUES READ IN, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1090 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1192 recursive subroutine ufbstp(lunin,usr,i1,i2,iret,str)
1196 use modv_vars,
only: im8b, bmiss, iprt
1203 character*(*),
intent(in) :: str
1204 character*128 bort_str1, bort_str2, errstr
1207 integer,
intent(in) :: lunin, i1, i2
1208 integer,
intent(out) :: iret
1209 integer ifirst1, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, lcstr,
bort_target_set
1211 real*8,
intent(inout) :: usr(i1,i2)
1220 call x84(lunin,my_lunin,1)
1221 call x84(i1,my_i1,1)
1222 call x84(i2,my_i2,1)
1223 call ufbstp(my_lunin,usr,my_i1,my_i2,iret,str)
1224 call x48(iret,iret,1)
1231 call strsuc(str,cstr,lcstr)
1241 call status(lunit,lun,il,im)
1242 if(il==0)
call bort(
'BUFRLIB: UFBSTP - BUFR FILE IS CLOSED, IT MUST BE OPEN')
1243 if(im==0)
call bort(
'BUFRLIB: UFBSTP - A MESSAGE MUST BE OPEN IN BUFR FILE, NONE ARE')
1244 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBSTP - LOCATION OF INTERNAL TABLE FOR BUFR FILE DOES NOT AGREE ' // &
1245 'WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
1247 io = min(max(0,il),1)
1248 if(lunit/=lunin) io = 0
1252 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1253 errstr = .LE.
'BUFRLIB: UFBSTP - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1256 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1261 if(iprt==-1) ifirst1 = 1
1262 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
1263 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1264 errstr = .LE.
'BUFRLIB: UFBSTP - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1267 if(iprt==0 .and. io==1)
then
1268 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
1269 'all such messages,'
1271 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
1275 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1283 if(io==0) usr(1:i1,1:i2) = bmiss
1286 call string(str,lun,i1,io)
1289 call ufbsp(lun,usr,i1,i2,io,iret)
1292 if(io==0 .and. iret>i2)
then
1294 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
1295 errstr =
'BUFRLIB: UFBSTP - MNEMONIC STRING READ IN IS: ' // str
1297 write (errstr,
'("THE NUMBER OF ''LEVELS'' AVAILABLE IN THE SUBSET '// &
1298 '(",I5,") IS GREATER THAN THE NUMBER REQUESTED (",I5,") - INCOMPLETE READ")') iret,i2
1300 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
1306 if(io==1 .and. iret/=i2)
then
1307 write(bort_str1,
'("BUFRLIB: UFBSTP - MNEMONIC STRING READ IN IS: ",A)') str
1308 write(bort_str2,
'(18X,"THE NUMBER OF ''LEVELS'' ACTUALLY '// &
1309 'WRITTEN (",I3,") DOES NOT EQUAL THE NUMBER REQUESTED (",I3,") - INCOMPLETE WRITE")') iret,i2
1310 call bort2(bort_str1,bort_str2)
1313 if(iret==0 .and. io==0 .and. iprt>=1)
then
1314 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1315 errstr =
'BUFRLIB: UFBSTP - NO SPECIFIED VALUES READ IN, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1318 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1431 recursive subroutine ufbseq(lunin,usr,i1,i2,iret,str)
1435 use modv_vars,
only: im8b, bmiss, iprt
1443 integer,
intent(in) :: lunin, i1, i2
1444 integer,
intent(out) :: iret
1445 integer,
parameter :: mtag = 10
1446 integer ifirst1, ifirst2, my_lunin, my_i1, my_i2, lunit, lun, il, im, io, i, j, ntag, node, nods, ins1, ins2, insx, &
1449 real*8,
intent(inout) :: usr(i1,i2)
1451 character*(*),
intent(in) :: str
1452 character*156 bort_str
1453 character*128 errstr
1455 character*10 tags(mtag)
1457 data ifirst1 /0/, ifirst2 /0/
1459 save ifirst1, ifirst2
1464 call x84(lunin,my_lunin,1)
1465 call x84(i1,my_i1,1)
1466 call x84(i2,my_i2,1)
1467 call ufbseq(my_lunin,usr,my_i1,my_i2,iret,str)
1468 call x48(iret,iret,1)
1475 call strsuc(str,cstr,lcstr)
1485 call status(lunit,lun,il,im)
1486 if(il==0)
call bort(
'BUFRLIB: UFBSEQ - BUFR FILE IS CLOSED, IT MUST BE OPEN')
1487 if(im==0)
call bort(
'BUFRLIB: UFBSEQ - A MESSAGE MUST BE OPEN IN BUFR FILE, NONE ARE')
1489 io = min(max(0,il),1)
1490 if(lunit/=lunin) io = 0
1494 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1495 errstr = .LE.
'BUFRLIB: UFBSEQ - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1498 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1503 if(iprt==-1) ifirst1 = 1
1504 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
1505 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1506 errstr = .LE.
'BUFRLIB: UFBSEQ - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1509 if(iprt==0 .and. io==1)
then
1510 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
1511 'all such messages,'
1513 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
1517 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1525 call parstr(str,tags,mtag,ntag,
' ',.true.)
1527 write(bort_str,
'("BUFRLIB: UFBSEQ - THE INPUT STRING (",A,") DOES NOT CONTAIN ANY MNEMONICS!!")') str
1531 write(bort_str,
'("BUFRLIB: UFBSEQ - THERE CANNOT BE MORE THAN '// &
1532 'ONE MNEMONIC IN THE INPUT STRING (",A,") (HERE THERE ARE ",I3,")")') str,ntag
1535 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBSEQ - LOCATION OF INTERNAL TABLE FOR '// &
1536 'BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
1539 if(io==0) usr(1:i1,1:i2) = bmiss
1543 if(str==
tag(node))
then
1544 if(
typ(node)==
'SEQ' .or.
typ(node)==
'RPC')
then
1548 if(ins1==0)
exit outer
1549 if(
typ(node)/=
'RPC' .or.
val(ins1,lun)/=0.)
exit
1553 if(ins2==0) ins2 = 10e5
1555 do while(
link(nods)==0 .and.
jmpb(nods)>0)
1558 if(
link(nods)==0)
then
1560 elseif(
link(nods)>0)
then
1563 ins2 = min(ins2,insx)
1564 elseif(
typ(node)==
'SUB')
then
1568 write(bort_str,
'("BUFRLIB: UFBSEQ - INPUT MNEMONIC ",A," MUST '// &
1569 'BE A SEQUENCE (HERE IT IS TYPE """,A,""")")') tags(1),
typ(node)
1575 if(ityp>1) nseq = nseq+1
1578 write(bort_str,.GT.
'("BUFRLIB: UFBSEQ - INPUT SEQ. MNEM. ",A," CONSISTS OF",I4," TABLE B MNEM., THE MAX. '// &
1579 'SPECIFIED IN (INPUT) ARGUMENT 3 (",I3,")")') tags(1),nseq,i1
1583 inner:
do while (.true.)
1585 if(ins1>
nval(lun))
exit outer
1587 if(
typ(node)==
'RPC' .and.
val(ins1,lun)==0.)
then
1590 elseif(io==0 .and. iret+1>i2)
then
1592 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
1593 write ( unit=errstr, fmt=
'(A,I5,A,A,A)' )
'BUFRLIB: UFBSEQ - INCOMPLETE READ; ONLY THE FIRST ', i2, &
1594 ' (=4TH INPUT ARG.) ''LEVELS'' OF INPUT MNEMONIC ', tags(1),
' WERE READ'
1596 call errwrt(
'++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++')
1601 elseif(ins1==0)
then
1602 if(io==1 .and. iret<i2)
then
1603 write(bort_str,
'("BUFRLIB: UFBSEQ - NO. OF ''LEVELS'.LT.
' WRITTEN (",I5,") NO. REQUESTED (",I5,") - '// &
1604 'INCOMPLETE WRITE (INPUT MNEMONIC IS ",A,")")') iret,i2,tags(1)
1608 write(bort_str,.GE.
'("BUFRLIB: UFBSEQ - VARIABLE INS1 MUST BE ZERO, HERE IT IS",I4," - INPUT MNEMONIC '// &
1609 'IS ",A)') ins1,tags(1)
1612 if(ins1==0 .or. iret==i2)
exit outer
1618 do while(
itp(
inv(j,lun))<2)
1621 if(io==0) usr(i,iret) =
val(j,lun)
1622 if(io==1)
val(j,lun) = usr(i,iret)
1632 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1633 errstr =
'BUFRLIB: UFBSEQ - NO SPECIFIED VALUES READ IN, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1636 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1640 if(iprt==-1) ifirst2 = 1
1641 if(ifirst2==0 .or. iprt>=1)
then
1642 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1643 errstr =
'BUFRLIB: UFBSEQ - NO SPECIFIED VALUES WRITTEN OUT, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
1646 call errwrt(
'MAY NOT BE IN THE BUFR TABLE(?)')
1648 errstr =
'Note: Only the first occurrence of this WARNING message is printed, there may be more. To output ' // &
1649 'all such messages,'
1651 errstr =
'modify your application program to add "CALL OPENBF(0,''QUIET'',1)" prior to the first call to a ' // &
1655 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
1702 recursive subroutine drfini(lunit,mdrf,ndrf,drftag)
1706 use modv_vars,
only: im8b
1713 character*(*),
intent(in) :: drftag
1714 character*12 cdrftag
1716 integer,
intent(in) :: mdrf(*), lunit, ndrf
1717 integer,
parameter :: mxdrf = 2000
1718 integer my_mdrf(mxdrf), my_lunit, my_ndrf, lun, il, im, m, n, node, lcdrftag,
bort_target_set
1723 call x84(lunit,my_lunit,1)
1724 call x84(ndrf,my_ndrf,1)
1725 call x84(mdrf(1),my_mdrf(1),my_ndrf)
1726 call drfini(my_lunit,my_mdrf,my_ndrf,drftag)
1733 call strsuc(drftag,cdrftag,lcdrftag)
1739 call status(lunit,lun,il,im)
1743 do while ( n <=
nval(lun) )
1745 if(
itp(node)==1 .and.
tag(node)==drftag)
then
1747 call usrtpl(lun,n,mdrf(m))
1780 use modv_vars,
only: bmiss, iprt
1788 integer,
intent(in) :: lun, i1, i2, io
1789 integer,
intent(out) :: iret
1790 integer nnod, ncon, nods, nodc, ivls, kons, inc1, inc2, ins1, ins2, invn, i, j, invwin, ibfms, lstjpb
1792 real*8,
intent(inout) :: usr(i1,i2)
1794 character*128 errstr
1795 character*10 tagstr, subset
1797 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
1805 outer:
do while (.true.)
1806 call conwin(lun,inc1,inc2)
1810 elseif(inc1==0)
then
1816 call getwin(nods(j),lun,ins1,ins2)
1822 call errwrt(
'++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
1823 call errwrt(
'UFBRW LEV TAG IO INS1 INVN INS2 '//subset)
1824 call errwrt(
'++++++++++++++BUFR ARCHIVE LIBRARY+++++++++++++++++')
1826 if(io==0) tagstr=
tag(nods(i))(1:8)//
' R'
1827 if(io==1) tagstr=
tag(nods(i))(1:8)//
' W'
1828 invn = invwin(nods(i),lun,ins1,ins2)
1829 if(invn==0.and.io==1)
call drstpl(nods(i),lun,ins1,ins2,invn)
1830 write(errstr,
'("LEV=",I5,1X,A,3I7)') iret,tagstr,ins1,invn,ins2
1835 if(io==1 .and. iret<=i2)
then
1838 if(ibfms(usr(i,iret))==0)
then
1839 invn = invwin(nods(i),lun,ins1,ins2)
1841 call drstpl(nods(i),lun,ins1,ins2,invn)
1846 call newwin(lun,inc1,inc2)
1847 val(invn,lun) = usr(i,iret)
1848 elseif(lstjpb(nods(i),lun,
'RPS')==0)
then
1849 val(invn,lun) = usr(i,iret)
1850 elseif(ibfms(
val(invn,lun))/=0)
then
1851 val(invn,lun) = usr(i,iret)
1853 call drstpl(nods(i),lun,ins1,ins2,invn)
1858 call newwin(lun,inc1,inc2)
1859 val(invn,lun) = usr(i,iret)
1866 if(io==0 .and. iret<=i2)
then
1870 invn = invwin(nods(i),lun,ins1,ins2)
1871 if(invn>0) usr(i,iret) =
val(invn,lun)
1876 if(io==1 .and. iret==i2)
return
1877 call nxtwin(lun,ins1,ins2)
1878 if(ins1>0 .and. ins1<inc2) cycle
1879 if(ncon>0) cycle outer
1890 end subroutine ufbrw
1921 integer,
intent(in) :: lun, i1, i2, io
1922 integer,
intent(out) :: iret
1923 integer nnod, ncon, nods, nodc, ivls, kons, ins1, ins2, invn, i, nz, invtag
1925 real*8,
intent(inout) :: usr(i1,i2)
1927 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
1938 if(ins1+1>
nval(lun))
return
1939 if(io==1 .and. iret==i2)
return
1940 ins1 = invtag(nods(nz),lun,ins1+1,
nval(lun))
1942 ins2 = invtag(nods(nz),lun,ins1+1,
nval(lun))
1943 if(ins2==0) ins2 =
nval(lun)
1946 if(io==0 .and. iret<=i2)
then
1949 invn = invtag(nods(i),lun,ins1,ins2)
1950 if(invn>0) usr(i,iret) =
val(invn,lun)
1955 if(io==1 .and. iret<=i2)
then
1958 invn = invtag(nods(i),lun,ins1,ins2)
1959 if(invn>0)
val(invn,lun) = usr(i,iret)
1968 end subroutine ufbrp
2005 integer,
intent(in) :: lun, i1, i2, io
2006 integer,
intent(out) :: iret
2007 integer nnod, ncon, nods, nodc, ivls, kons, ins1, ins2, invn, invm, i, invtag
2009 real*8,
intent(inout) :: usr(i1,i2)
2011 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
2019 if(ins1+1>
nval(lun))
return
2020 ins1 = invtag(nods(1),lun,ins1+1,
nval(lun))
2022 ins2 = invtag(nods(1),lun,ins1+1,
nval(lun))
2023 if(ins2==0) ins2 =
nval(lun)
2026 if(io==0 .and. iret<=i2)
then
2030 invn = invtag(nods(i),lun,invm,ins2)
2031 if(invn>0) usr(i,iret) =
val(invn,lun)
2032 invm = max(invn,invm)
2037 if(io==1 .and. iret<=i2)
then
2041 invn = invtag(nods(i),lun,invm,ins2)
2042 if(invn>0)
val(invn,lun) = usr(i,iret)
2043 invm = max(invn,invm)
2050 end subroutine ufbsp
2102 use modv_vars,
only: im8b, mxh4wlc, iprt
2108 integer,
intent(in) :: lunit
2109 integer my_lunit, lens, lenc, i
2111 character*(*),
intent(in) :: chr, str
2113 character*128 errstr
2119 call x84(lunit,my_lunit,1)
2125 call strsuc( str, mystr, lens )
2126 if ( lens == -1 )
return
2128 lenc = min( len( chr ), 120 )
2134 if ( ( lunit ==
luh4wlc(i) ) .and. ( mystr(1:lens) ==
sth4wlc(i)(1:lens) ) )
then
2136 chh4wlc(i)(1:lenc) = chr(1:lenc)
2143 if (
nh4wlc >= mxh4wlc )
then
2145 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2146 write ( unit=errstr, fmt=
'(A,A,I3)' )
'BUFRLIB: HOLD4WLC - THE MAXIMUM NUMBER OF LONG CHARACTER ', &
2147 'STRINGS THAT CAN BE HELD INTERNALLY IS ', mxh4wlc
2149 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2195 integer,
intent(in) :: lun, i1, i2, io
2196 integer,
intent(out) :: iret
2197 integer nnod, ncon, nods, nodc, ivls, kons, ndrp, invn, jnvn, knvn, invwin, lstjpb
2199 real*8,
intent(inout) :: usr(i1,i2)
2201 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
2205 ndrp = lstjpb(nods(1),lun,
'DRP')
2210 invn = invwin(ndrp,lun,1,
nval(lun))
2213 do while(nint(
val(jnvn,lun))>0)
2214 jnvn = jnvn+nint(
val(jnvn,lun))
2216 do knvn=1,
nval(lun)-jnvn+1
2217 inv(invn+knvn,lun) =
inv(jnvn+knvn-1,lun)
2218 val(invn+knvn,lun) =
val(jnvn+knvn-1,lun)
2220 nval(lun) =
nval(lun)-(jnvn-invn-1)
2225 call ufbrw(lun,usr,i1,i2,io,iret)
2249 recursive subroutine ufbovr(lunit,usr,i1,i2,iret,str)
2253 use modv_vars,
only: im8b, iprt
2260 integer,
intent(in) :: lunit, i1, i2
2261 integer,
intent(out) :: iret
2262 integer ifirst1, my_lunit, my_i1, my_i2, lun, il, im, io, lcstr,
bort_target_set
2264 character*(*),
intent(in) :: str
2265 character*128 bort_str1, bort_str2, errstr
2268 real*8,
intent(inout) :: usr(i1,i2)
2278 call x84(lunit,my_lunit,1)
2279 call x84(i1,my_i1,1)
2280 call x84(i2,my_i2,1)
2281 call ufbovr(my_lunit,usr,my_i1,my_i2,iret,str)
2282 call x48(iret,iret,1)
2289 call strsuc(str,cstr,lcstr)
2299 call status(lunit,lun,il,im)
2300 if(il==0)
call bort(
'BUFRLIB: UFBOVR - OUTPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR OUTPUT')
2301 if(il<0)
call bort(
'BUFRLIB: UFBOVR - OUTPUT BUFR FILE IS OPEN FOR INPUT, IT MUST BE OPEN FOR OUTPUT')
2302 if(im==0)
call bort(
'BUFRLIB: UFBOVR - A MESSAGE MUST BE OPEN IN OUTPUT BUFR FILE, NONE ARE')
2303 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBOVR - LOCATION OF INTERNAL TABLE FOR '// &
2304 'OUTPUT BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
2306 io = min(max(0,il),1)
2310 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2311 errstr = .LE.
'BUFRLIB: UFBOVR - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
2314 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2319 if(iprt==-1) ifirst1 = 1
2320 if(io==0 .or. ifirst1==0 .or. iprt>=1)
then
2321 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2322 errstr = .LE.
'BUFRLIB: UFBOVR - 4th ARG. (INPUT) IS 0, SO RETURN WITH 5th ARG. (IRET) = 0; 6th ARG. (STR) ='
2325 if(iprt==0 .and. io==1)
then
2326 errstr =
'Note: Only the first occurrence of this WARNING ' // &
2327 'message is printed, there may be more. To output all such messages,'
2329 errstr =
'modify your application program to add ' // &
2330 '"CALL OPENBF(0,''QUIET'',1)" prior to the first call to a BUFRLIB routine.'
2333 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2342 call string(str,lun,i1,io)
2343 call trybump(lun,usr,i1,i2,io,iret)
2345 if(io==1 .and. iret/=i2)
then
2346 write(bort_str1,
'("BUFRLIB: UFBOVR - MNEMONIC STRING READ IN IS: ",A)') str
2347 write(bort_str2,
'(18X,"THE NUMBER OF ''LEVELS'' ACTUALLY '// &
2348 'WRITTEN (",I3,") DOES NOT EQUAL THE NUMBER REQUESTED (",I3,") - INCOMPLETE WRITE")') iret, i2
2349 call bort2(bort_str1,bort_str2)
2392 recursive subroutine ufbevn(lunit,usr,i1,i2,i3,iret,str)
2396 use modv_vars,
only: im8b, bmiss, iprt
2403 character*(*),
intent(in) :: str
2404 character*128 errstr
2407 integer,
intent(in) :: lunit, i1, i2, i3
2408 integer,
intent(out) :: iret
2409 integer invn(255), nnod, ncon, nods, nodc, ivls, kons, maxevn, my_lunit, my_i1, my_i2, my_i3, i, j, k, lun, il, im, &
2412 real*8,
intent(out) :: usr(i1,i2,i3)
2416 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
2422 call x84(lunit,my_lunit,1)
2423 call x84(i1,my_i1,1)
2424 call x84(i2,my_i2,1)
2425 call x84(i3,my_i3,1)
2426 call ufbevn(my_lunit,usr,my_i1,my_i2,my_i3,iret,str)
2427 call x48(iret,iret,1)
2435 call strsuc(str,cstr,lcstr)
2446 call status(lunit,lun,il,im)
2447 if(il==0)
call bort(
'BUFRLIB: UFBEVN - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
2448 if(il>0)
call bort(
'BUFRLIB: UFBEVN - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
2449 if(im==0)
call bort(
'BUFRLIB: UFBEVN - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
2450 if(
inode(lun)/=
inv(1,lun))
call bort(
'BUFRLIB: UFBEVN - LOCATION OF INTERNAL TABLE FOR '// &
2451 'INPUT BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN INTERNAL SUBSET ARRAY')
2455 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2456 errstr = .LE.
'BUFRLIB: UFBEVN - 3rd ARG. (INPUT) IS 0, SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
2459 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2465 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2466 errstr = .LE.
'BUFRLIB: UFBEVN - 4th ARG. (INPUT) IS 0, SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
2469 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2475 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2476 errstr = .LE.
'BUFRLIB: UFBEVN - 5th ARG. (INPUT) IS 0, SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
2479 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2487 call string(str,lun,i1,0)
2490 usr(1:i1,1:i2,1:i3) = bmiss
2496 outer:
do while (.true.)
2497 call conwin(lun,inc1,inc2)
2501 elseif(inc1==0)
then
2508 call getwin(nods(i),lun,ins1,ins2)
2514 if(.not.nodgt0)
then
2519 inner:
do while (.true.)
2524 nnvn =
nvnwin(nods(j),lun,ins1,ins2,invn,i3)
2525 maxevn = max(nnvn,maxevn)
2527 usr(j,iret,k) =
val(invn(k),lun)
2533 call nxtwin(lun,ins1,ins2)
2534 if(ins1<=0 .or. ins1>=inc2)
exit inner
2536 if(ncon<=0)
exit outer
2542 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2543 errstr =
'BUFRLIB: UFBEVN - NO SPECIFIED VALUES READ IN, SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
2546 call errwrt(
'+++++++++++++++++++++WARNING+++++++++++++++++++++++')
2587 recursive subroutine ufbinx(lunit,imsg,isub,usr,i1,i2,iret,str)
2591 use modv_vars,
only: im8b
2598 integer,
intent(in) :: lunit, imsg, isub, i1, i2
2599 integer,
intent(out) :: iret
2600 integer my_lunit, my_imsg, my_isub, my_i1, my_i2, lun, il, im, jdate, jret, i, lcstr,
bort_target_set
2602 character*(*),
intent(in) :: str
2603 character*128 bort_str
2607 real*8,
intent(out) :: usr(i1,i2)
2614 call x84(lunit,my_lunit,1)
2615 call x84(imsg,my_imsg,1)
2616 call x84(isub,my_isub,1)
2617 call x84(i1,my_i1,1)
2618 call x84(i2,my_i2,1)
2619 call ufbinx(my_lunit,my_imsg,my_isub,usr,my_i1,my_i2,iret,str)
2620 call x48(iret,iret,1)
2627 call strsuc(str,cstr,lcstr)
2633 call status(lunit,lun,il,im)
2638 call openbf(lunit,
'INX',lunit)
2646 call readmg(lunit,subset,jdate,jret)
2648 write(bort_str,
'("BUFRLIB: UFBINX - HIT END OF FILE BEFORE '// &
2649 'READING REQUESTED MESSAGE NO.",I5," IN BUFR FILE CONNECTED TO UNIT",I4)') imsg, lunit
2658 write(bort_str,
'("BUFRLIB: UFBINX - ALL SUBSETS READ BEFORE '// &
2659 'READING REQ. SUBSET NO.",I3," IN REQ. MSG NO.",I5," IN BUFR FILE CONNECTED TO UNIT",I4)') isub, imsg, lunit
2665 call ufbint(lunit,usr,i1,i2,iret,str)
2692 recursive subroutine ufbget(lunit,tab,i1,iret,str)
2696 use modv_vars,
only: im8b, bmiss
2707 integer,
intent(in) :: lunit, i1
2708 integer,
intent(out) :: iret
2709 integer nnod, ncon, nods, nodc, ivls, kons, my_lunit, my_i1, lun, il, im, i, n, node, nbmp, kbit, invn,
invwin, &
2712 character*(*),
intent(in) :: str
2716 real*8,
intent(out) :: tab(i1)
2719 common /usrstr/ nnod, ncon, nods(20), nodc(10), ivls(10), kons(10)
2721 equivalence(cval,rval)
2727 call x84(lunit,my_lunit,1)
2728 call x84(i1,my_i1,1)
2729 call ufbget(my_lunit,tab,my_i1,iret,str)
2730 call x48(iret,iret,1)
2737 call strsuc(str,cstr,lcstr)
2748 call status(lunit,lun,il,im)
2749 if(il==0)
call bort(
'BUFRLIB: UFBGET - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
2750 if(il>0)
call bort(
'BUFRLIB: UFBGET - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
2751 if(im==0)
call bort(
'BUFRLIB: UFBGET - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
2762 call string(str,lun,i1,0)
2774 if(node==nods(nnod))
then
2777 elseif(
itp(node)==1)
then
2791 if(
itp(node)==1)
then
2793 elseif(
itp(node)==2)
then
2794 if(ival<2_8**(
ibt(node))-1) tab(i) =
ups(ival,node)
2795 elseif(
itp(node)==3)
then
2798 call upc(cval,
nbit(invn)/8,
mbay(1,lun),kbit,.true.)
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 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 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.
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 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 ufbinx(lunit, imsg, isub, usr, i1, i2, iret, str)
Read one or more data values from a specified data subset.
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.