UPP  11.0.0
 All Data Structures Files Functions Variables Pages
GET_BITS.f File Reference

get_bits() computes number of bits and round field. More...

Go to the source code of this file.

Functions/Subroutines

subroutine fndbit (rmin, rmax, rdb, nmbts, iscale, iret)
 fndbit() computes the number of packing bits given the maximum number of significant digits to preserve or the binary precision to store the data. More...
 
subroutine get_bits (IBM, SGDS, LEN, MG, G, ISCALE, GROUND, GMIN, GMAX, NBIT)
 get_bits() computes number of bits and round field. More...
 

Detailed Description

get_bits() computes number of bits and round field.

The number of bits requited to pack a given field at a particular decimal scaling is computed using the field range. The field is rounded off to the decimal scaling for packing. The minimum and maximum rounded field values are also returned. Grib bitmap masking for valid data is optionally used.

Parameters
[in]IBMInteger bitmap flag (=0 for no bitmap).
[in]SGDSMaximum significant digits to keep.
 (E.G. SGDS=3.0 keeps 3 significant digits)
  or binary precision if <0
 (E.G. SGDS=-2.0 keeps field to nearest 1/4
            -3.0 keeps field to nearest 1/8
            2**SGDS precision)
[in]LENInteger length of the field and bitmap.
[in]MGInteget (LEN) bitmap if IBM=1 (0 to skip, 1 tp keep).
[in]GReal (LEN) field.
[out]ISCALEInteger decimal scaling.
[out]GROUNDReal (LEN) field rounded to decimal scaling.
[out]GMINReal minimum valid rounded field value.
[out]GMAXReal maximum valid rounded field value.
[out]NBITInteger number of bits to pack.

Program History Log

Date Programmer Comments
1992-10-31 Iredell Initial
1995-04-14 Baldwin Modify following Keith Brill's code to use sig digits to compute DEC scale
Author
Iredell W/NP23
Date
1992-10-31

Definition in file GET_BITS.f.

Function/Subroutine Documentation

subroutine fndbit ( real, intent(inout)  rmin,
real, intent(inout)  rmax,
real, intent(inout)  rdb,
integer, intent(inout)  nmbts,
integer, intent(inout)  iscale,
integer  iret 
)

fndbit() computes the number of packing bits given the maximum number of significant digits to preserve or the binary precision to store the data.

The binary precision is given as a negative integer, ISCALE will always be zero in this case.

The binary precision translates as follows:

     -1  =>  store data to nearest 1/2
     -2  =>  store data to nearest 1/4
     -3  =>  store data to nearest 1/8
 

Note that a fractional number of significant digits is allowed.

Parameters
[in]RMINReal Minimum value.
[in]RMAXReal Maximum value.
[in]RDBReal Maximum # of significant digits OR binary precision if < 0.
[out]NMBTSInteger Number of bits for packing.
[out]ISCALEInteger Power of 10 scaling to use.
[out]IRETInteger Return code. 0 = normal return.

Program History Log

Date Programmer Comments
1992-06-?? K Brill Initial
1995-12-?? K Brill Added binary precision
1996-10-?? M Baldwin Added fix for negative nmbts
Author
K. Brill NMC
Date
1992-06-??

Definition at line 128 of file GET_BITS.f.

Referenced by get_bits().

subroutine get_bits ( integer, intent(in)  IBM,
real  SGDS,
integer, intent(in)  LEN,
integer, dimension(len), intent(in)  MG,
real, dimension(len), intent(in)  G,
integer, intent(inout)  ISCALE,
real, dimension(len), intent(inout)  GROUND,
real, intent(out)  GMIN,
real, intent(out)  GMAX,
integer, intent(inout)  NBIT 
)

get_bits() computes number of bits and round field.

Parameters
[in]IBMinteger bitmap flag (=0 for no bitmap).
[in]SGDSreal Maximum significant digits to keep.
[in]LENinteger Length of the field and bitmap.
[in]MGinteger (LEN) Bitmap if IBM=1 (0 to skip, 1 tp keep).
[in]Greal (LEN) Field.
[in,out]ISCALEinteger Decimal scaling.
[in,out]GROUNDreal (LEN) Field rounded to decimal scaling.
[out]GMINreal Minimum valid rounded field value.
[out]GMAXreal Maximum valid rounded field value.
[in,out]NBITinteger Number of bits to pack.

Definition at line 49 of file GET_BITS.f.

References fndbit().