NCEPLIBS-bufr  11.7.0
 All Data Structures Files Functions Variables Pages
pkftbv.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Determine the numerical data value equivalent to the
3 C> setting of a specified bit within a flag table.
4 
5 C> This function computes the numerical value equivalent to the
6 C> setting of bit #IBIT within a flag table of NBITS bits.
7 C>
8 C> <p>If the computation fails for any reason, then the function
9 C> returns the current placeholder value for "missing" data.
10 C>
11 C> @author J. Ator
12 C> @date 2005-11-29
13 C>
14 C> @param[in] NBITS -- integer: Total number of bits in flag table
15 C> @param[in] IBIT -- integer: Number of bit to be set
16 C>
17 C> @returns pkftbv -- real*8: Value equivalent to the setting of
18 C> bit #IBIT within a flag table of NBITS bits
19 C>
20 C> @remarks
21 C> - This function is the logical inverse of subroutine upftbv().
22 C> - According to the WMO standard, bits within a bit field are
23 C> numbered from left to right, so bit #1 is always the high-order
24 C> (i.e. most significant) bit in any bit field.
25 C>
26 C> <b>Program history log:</b>
27 C> | Date | Programmer | Comments |
28 C> | -----|------------|----------|
29 C> | 2005-11-29 | J. Ator | Original version |
30 C>
31  REAL*8 FUNCTION pkftbv(NBITS,IBIT)
32 
33  USE modv_bmiss
34 
35 C----------------------------------------------------------------------
36 C----------------------------------------------------------------------
37 
38  IF((nbits.LE.0).OR.(ibit.LE.0).OR.(ibit.GT.nbits)) THEN
39  pkftbv = bmiss
40  ELSE
41  pkftbv = (2.)**(nbits-ibit)
42  ENDIF
43 
44  RETURN
45  END
REAL *8 function pkftbv(NBITS, IBIT)
This function computes the numerical value equivalent to the setting of bit #IBIT within a flag table...
Definition: pkftbv.f:31
This module declares and initializes the BMISS variable.
Definition: modv_BMISS.f90:9