21 recursive real*8 function pkftbv(nbits,ibit)
result(r8val)
23 use modv_vars,
only: im8b, bmiss
27 integer,
intent(in) :: nbits, ibit
28 integer my_nbits, my_ibit
34 call x84(nbits,my_nbits,1)
35 call x84(ibit,my_ibit,1)
36 r8val=
pkftbv(my_nbits,my_ibit)
41 if((nbits<=0).or.(ibit<=0).or.(ibit>nbits))
then
44 r8val = (2.)**(nbits-ibit)
67 recursive subroutine upftbv(lunit,nemo,val,mxib,ibit,nib)
71 use modv_vars,
only: im8b
77 integer,
intent(in) :: lunit, mxib
78 integer,
intent(out) :: ibit(*), nib
79 integer my_lunit, my_mxib, lun, il, im, idn, i, n, nbits, iersn, lcn,
bort_target_set
81 character*(*),
intent(in) :: nemo
82 character*128 bort_str
86 real*8,
intent(in) :: val
93 call x84(lunit,my_lunit,1)
94 call x84(mxib,my_mxib,1)
95 call upftbv(my_lunit,nemo,val,my_mxib*2,ibit,nib)
96 if (nib>0 .and. nib<=my_mxib*2)
call x48(ibit(1),ibit(1),nib)
105 call strsuc(nemo,cnemo,lcn)
115 call status(lunit,lun,il,im)
116 if(il==0)
call bort(
'BUFRLIB: UPFTBV - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
118 call nemtab(lun,nemo,idn,tab,n)
120 write(bort_str,
'("BUFRLIB: UPFTBV - MNEMONIC ",A," NOT FOUND IN TABLE B")') nemo
123 if(
tabb(n,lun)(71:74)/=
'FLAG')
then
124 write(bort_str,
'("BUFRLIB: UPFTBV - MNEMONIC ",A," IS NOT A FLAG TABLE")') nemo
134 if(abs(r8val-r82i)<(0.005))
then
136 if(nib>mxib)
call bort(
'BUFRLIB: UPFTBV - IBIT ARRAY OVERFLOW')
139 elseif(r82i<r8val)
then
141 if(nib>mxib)
call bort(
'BUFRLIB: UPFTBV - IBIT ARRAY OVERFLOW')
228 recursive subroutine getcfmng ( lunit, nemoi, ivali, nemod, ivald, cmeang, lnmng, iret )
232 use modv_vars,
only: im8b
239 integer,
intent(in) :: lunit, ivali, ivald
240 integer,
intent(out) :: lnmng, iret
241 integer ifxyd(10), my_lunit, my_ivali, my_ivald, lun, il, im, itmp, ii, ifxyi, lcmg, n, ntg, iret2, ierbd,
ifxy,
ireadmt, &
244 character*(*),
intent(in) :: nemoi, nemod
245 character*(*),
intent(out) :: cmeang
246 character*128 bort_str
247 character*9 cnemoi, cnemod
248 character*8 nemo, my_nemoi, my_nemod
250 character*(:),
allocatable :: cmeang_c
256 call x84(lunit,my_lunit,1)
257 call x84(ivali,my_ivali,1)
258 call x84(ivald,my_ivald,1)
259 call getcfmng(my_lunit,nemoi,my_ivali,nemod,my_ivald,cmeang,lnmng,iret)
260 call x48(lnmng,lnmng,1)
261 call x48(iret,iret,1)
272 call strsuc(nemoi,cnemoi,lcni)
273 call strsuc(nemod,cnemod,lcnd)
275 allocate(
character*(lcmgc) :: cmeang_c)
276 call catch_bort_getcfmng_c(lunit,cnemoi,lcni,ivali,cnemod,lcnd,ivald,cmeang_c,lcmgc,lnmng,iret)
277 cmeang(1:lnmng) = cmeang_c(1:lnmng)
283 call status ( lunit, lun, il, im )
284 if ( il == 0 )
call bort(
'BUFRLIB: GETCFMNG - INPUT BUFR FILE IS CLOSED, IT MUST BE OPEN FOR INPUT')
285 if ( il > 0 )
call bort(
'BUFRLIB: GETCFMNG - INPUT BUFR FILE IS OPEN FOR OUTPUT, IT MUST BE OPEN FOR INPUT')
286 if ( im == 0 )
call bort(
'BUFRLIB: GETCFMNG - A MESSAGE MUST BE OPEN IN INPUT BUFR FILE, NONE ARE')
290 if (
cdmf /=
'Y' )
call bort(
'BUFRLIB: GETCFMNG - TO USE THIS SUBROUTINE, MUST '// &
291 'FIRST CALL SUBROUTINE CODFLG WITH INPUT ARGUMENT SET TO Y')
300 do ii = 1, min( 8, len( nemoi ) )
301 my_nemoi(ii:ii) = nemoi(ii:ii)
304 do ii = 1, min( 8, len( nemod ) )
305 my_nemod(ii:ii) = nemod(ii:ii)
307 if ( my_nemoi(1:4) ==
'GSES' )
then
308 if ( ( my_nemod(1:6) ==
'GCLONG' ) .or. ( my_nemod(1:4) ==
'OGCE' ) .or. ( my_nemod(1:5) ==
'ORIGC' ) )
then
309 ifxyi =
ifxy(
'001034' )
310 ifxyd(1) =
ifxy(
'001035' )
312 lnmng = min( 24, lcmg )
313 if ( lnmng == 24 )
then
315 cmeang(1:24) =
'GCLONG OGCE ORIGC '
321 else if ( my_nemoi(1:6) ==
'GCLONG' )
then
322 ifxyi =
ifxy(
'001031' )
324 else if ( my_nemoi(1:4) ==
'OGCE' )
then
325 ifxyi =
ifxy(
'001033' )
327 else if ( my_nemoi(1:5) ==
'ORIGC' )
then
328 ifxyi =
ifxy(
'001035' )
330 else if ( ( my_nemoi(1:7) ==
'TABLASS' ) .or. ( my_nemoi(1:7) ==
'TABLASL' ) )
then
331 if ( ( my_nemod(1:6) ==
'TABLAT' ) )
then
332 if ( my_nemoi(1:7) ==
'TABLASS' )
then
333 ifxyi =
ifxy(
'055021' )
335 ifxyi =
ifxy(
'055022' )
337 ifxyd(1) =
ifxy(
'055020' )
339 lnmng = min( 8, lcmg )
340 if ( lnmng == 8 )
then
342 cmeang(1:8) =
'TABLAT '
348 else if ( my_nemoi(1:6) ==
'TABLAT' )
then
349 ifxyi =
ifxy(
'055020' )
352 call parstr ( my_nemoi, nemo, 1, ntg,
' ', .true. )
353 call nemtab ( lun, nemo, ifxyi, tab, n )
354 if ( ( n == 0 ) .or. ( tab /=
'B' ) )
then
355 write(bort_str,
'("BUFRLIB: GETCFMNG - MNEMONIC ",A," NOT FOUND IN TABLE B")') nemo
358 if ( (
tabb( n, lun )(71:74) /=
'CODE' ) .and. (
tabb( n, lun )(71:74) /=
'FLAG' ) )
then
359 write(bort_str,
'("BUFRLIB: GETCFMNG - MNEMONIC ",A," IS NOT A CODE OR FLAG TABLE")') nemo
362 if ( my_nemod(1:1) /=
' ' )
then
363 call parstr ( my_nemod, nemo, 1, ntg,
' ', .true. )
364 call nemtab ( lun, nemo, ifxyd(1), tab, n )
365 if ( ( n == 0 ) .or. ( tab /=
'B' ) )
then
366 write(bort_str,
'("BUFRLIB: GETCFMNG - MNEMONIC ",A," NOT FOUND IN TABLE B")') nemo
369 if ( (
tabb( n, lun )(71:74) /=
'CODE' ) .and. (
tabb( n, lun )(71:74) /=
'FLAG' ) )
then
370 write(bort_str,
'("BUFRLIB: GETCFMNG - MNEMONIC ",A," IS NOT A CODE OR FLAG TABLE")') nemo
380 call srchtbf_c ( ifxyi, ivali, ifxyd(1), 10, ivald, cmeang, lcmg, lnmng, iret )
381 if ( iret <= 0 )
return
389 call numtbd ( lun, ifxyd(ii), nemo, tab, ierbd )
390 if ( ( ierbd > 0 ) .and. ( tab ==
'B' ) .and. ( lcmg >= ( lnmng + 8 ) ) )
then
392 cmeang(lnmng+1:lnmng+8) = nemo
396 if ( iret == 0 ) iret = -1
420 recursive subroutine ufbqcd(lunit,nemo,iqcd)
424 use modv_vars,
only: im8b
428 integer,
intent(in) :: lunit
429 integer,
intent(out) :: iqcd
432 character*(*),
intent(in) :: nemo
433 character*128 bort_str
435 character*6 fxy,
adn30
442 call x84(lunit,my_lunit,1)
443 call ufbqcd(my_lunit,nemo,iqcd)
444 call x48(iqcd,iqcd,1)
452 call strsuc(nemo,cnemo,lcn)
458 call status(lunit,lun,il,im)
459 if(il==0)
call bort(
'BUFRLIB: UFBQCD - BUFR FILE IS CLOSED, IT MUST BE OPEN')
461 call nemtab(lun,nemo,idn,tab,iret)
463 write(bort_str,
'("BUFRLIB: UFBQCD - INPUT MNEMONIC ",A," NOT DEFINED AS A SEQUENCE DESCRIPTOR IN BUFR TABLE")') nemo
468 if(fxy(2:3)/=
'63')
then
469 write(bort_str,
'("BUFRLIB: UFBQCD - BUFR TABLE SEQ. DESCRIPTOR '// &
470 'ASSOC. WITH INPUT MNEMONIC ",A," HAS INVALID CATEGORY ",A," - CATEGORY MUST BE 63")') nemo, fxy(2:3)
473 read(fxy(4:6),
'(I3)') iqcd
492 recursive subroutine ufbqcp(lunit,iqcp,nemo)
496 use modv_vars,
only: im8b
500 integer,
intent(in) :: lunit, iqcp
501 integer my_lunit, my_iqcp, lun, il, im, idn, iret,
ifxy, lnm, ncn,
bort_target_set
503 character*(*),
intent(out) :: nemo
511 call x84(lunit,my_lunit,1)
512 call x84(iqcp,my_iqcp,1)
513 call ufbqcp(my_lunit,my_iqcp,nemo)
523 lnm = min(len(nemo),ncn)
524 nemo(1:lnm) = cnemo(1:lnm)
529 call status(lunit,lun,il,im)
530 if(il==0)
call bort(
'BUFRLIB: UFBQCP - BUFR FILE IS CLOSED, IT MUST BE OPEN')
532 idn =
ifxy(
'363000')+iqcp
533 call numtab(lun,idn,nemo,tab,iret)
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.
integer function bort_target_set()
Sets a new bort target, if bort catching is enabled and such a target doesn't already exist.
recursive real *8 function pkftbv(nbits, ibit)
Compute the numerical value equivalent to the setting of bit #(ibit) within a flag table of nbits bit...
recursive subroutine ufbqcd(lunit, nemo, iqcd)
Given a mnemonic associated with a category 63 Table D descriptor from an NCEP prepbufr file,...
recursive subroutine ufbqcp(lunit, iqcp, nemo)
Given an event program code, which is equivalent to the Y value of a category 63 Table D descriptor f...
recursive subroutine upftbv(lunit, nemo, val, mxib, ibit, nib)
Given a Table B mnemonic with flag table units and a corresponding numerical data value,...
recursive subroutine getcfmng(lunit, nemoi, ivali, nemod, ivald, cmeang, lnmng, iret)
Decode the meaning of a numerical value from a code or flag table.
subroutine nemtab(lun, nemo, idn, tab, iret)
Get information about a descriptor, based on a mnemonic.
subroutine numtab(lun, idn, nemo, tab, iret)
Get information about a descriptor, based on the WMO bit-wise representation of an FXY value.
subroutine numtbd(lun, idn, nemo, tab, iret)
Get information about a Table B or Table D descriptor, based on the WMO bit-wise representation of an...
integer function ifxy(adsc)
Convert an FXY value from its 6 character representation to its WMO bit-wise representation.
character *(*) function adn30(idn, ldn)
Convert an FXY value from its WMO bit-wise representation to a character string of length 5 or 6.
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.
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 DX BUFR tables internally for multiple file IDs.
character *128, dimension(:,:), allocatable tabb
Table B entries 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 subroutine status(lunit, lun, il, im)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
subroutine parstr(str, tags, mtag, ntag, sep, limit80)
Parse a string containing one or more substrings into an array of substrings.
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.