Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | target | :: | x(:) | ||
real, | intent(inout), | target | :: | xr(:) | ||
integer, | intent(in) | :: | nbits_to_keep | |||
real, | intent(in), | optional | :: | undef | ||
logical, | intent(in), | optional | :: | flops | ||
integer, | intent(in), | optional | :: | mpi_comm | ||
integer, | intent(out), | optional | :: | rc |
This routine returns a lower precision version of the input array
x
which retains nbits_to_keep
of precision. Two algorithms are
implemented: 1) a fast one writen in C which downgrades precision
by shifting xbits = 24 - nbits_to_keep
bits of the mantissa, and 2) a slower
float point based algorithm which is the same algorithm as GRIB
with fixed number of bits packing. Notice that as in GRIB the scaling
factor is forced to be a power of 2 rather than a generic float.
Using this power of 2 binary scaling has the advantage of improving
the GZIP compression rates.
This routine returns an array of the same type and kind as the input array, so no data compression has taken place. The goal here is to reduce the entropy in the input array, thereby improving compression rates by the lossless algorithms implemented internally by HDF-4/5 when writing these data to a file. In fact, these GZIP’ed and pre-conditioned files have sizes comparable to the equivalent GRIB file, while being a bonafide self-describing HDF/NetCDF file.
@note Todo Perhaps implement GRIB decimal scaling (variable number of bits).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | x(:,:) |
input array |
||
real, | intent(out) | :: | xr(:,:) |
precision reduced array; can share storage with input array if it has same kind |
||
integer, | intent(in) | :: | nbits_to_keep |
number of bits per word to retain |
||
real, | intent(in), | optional | :: | undef |
missing value |
|
logical, | intent(in), | optional | :: | flops |
if true, uses slower float point based algorithm |
|
integer, | intent(in), | optional | :: | mpi_comm | ||
integer, | intent(out), | optional | :: | rc |
error code = 0 - all is well /= 0 - something went wrong |
The routine DownBit3D
returns a lower precision version of the input array
x
which retains nbits_to_keep
of precision.
See routine ESMF_CFIODownBit2D
or additional details. This version for
rank 3 arrays, calls ESMF_CFIODownBit2D()
for each vertical level.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | x(:,:,:) |
input array |
||
real, | intent(out) | :: | xr(:,:,:) |
precision reduced array; can share storage with input array if it has same kind |
||
integer, | intent(in) | :: | nbits_to_keep |
number of bits per word to retain - no action if nbits_to_keep<1 |
||
real, | intent(in), | optional | :: | undef |
missing value |
|
logical, | intent(in), | optional | :: | flops |
if true, uses slower float point based algorithm |
|
integer, | intent(in), | optional | :: | mpi_comm | ||
integer, | intent(out), | optional | :: | rc |
error code = 0 - all is well /= 0 - something went wrong |