UPP (develop)
|
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. | |
subroutine | get_bits (ibm, sgds, len, mg, g, iscale, ground, gmin, gmax, nbit) |
get_bits() computes number of bits and round field. | |
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.
[in] | IBM | Integer bitmap flag (=0 for no bitmap). |
[in] | SGDS | Maximum 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] | LEN | Integer length of the field and bitmap. |
[in] | MG | Integet (LEN) bitmap if IBM=1 (0 to skip, 1 tp keep). |
[in] | G | Real (LEN) field. |
[out] | ISCALE | Integer decimal scaling. |
[out] | GROUND | Real (LEN) field rounded to decimal scaling. |
[out] | GMIN | Real minimum valid rounded field value. |
[out] | GMAX | Real maximum valid rounded field value. |
[out] | NBIT | Integer number of bits to pack. |
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 |
Definition in file GET_BITS.f.
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.
[in] | RMIN | Real Minimum value. |
[in] | RMAX | Real Maximum value. |
[in] | RDB | Real Maximum # of significant digits OR binary precision if < 0. |
[out] | NMBTS | Integer Number of bits for packing. |
[out] | ISCALE | Integer Power of 10 scaling to use. |
[out] | IRET | Integer Return code. 0 = normal return. |
Date | Programmer | Comments |
---|---|---|
1992-06-?? | K Brill | Initial |
1995-12-?? | K Brill | Added binary precision |
1996-10-?? | M Baldwin | Added fix for negative nmbts |
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.
[in] | IBM | integer bitmap flag (=0 for no bitmap). |
[in] | SGDS | real Maximum significant digits to keep. |
[in] | LEN | integer Length of the field and bitmap. |
[in] | MG | integer (LEN) Bitmap if IBM=1 (0 to skip, 1 tp keep). |
[in] | G | real (LEN) Field. |
[in,out] | ISCALE | integer Decimal scaling. |
[in,out] | GROUND | real (LEN) Field rounded to decimal scaling. |
[out] | GMIN | real Minimum valid rounded field value. |
[out] | GMAX | real Maximum valid rounded field value. |
[in,out] | NBIT | integer Number of bits to pack. |
Definition at line 49 of file GET_BITS.f.
References fndbit().