DownBit Interface

public interface DownBit

Called by

interface~~downbit~~CalledByGraph interface~downbit DownBit none~stagedata MAPL_GriddedIO%stageData none~stagedata->interface~downbit none~bundlepost MAPL_GriddedIO%bundlePost none~bundlepost->none~stagedata none~write_to_file FieldBundleWriter%write_to_file none~write_to_file->none~bundlepost proc~main main proc~main->none~write_to_file program~time_ave time_ave program~time_ave->none~write_to_file program~ut_regridding ut_ReGridding program~ut_regridding->none~write_to_file

Module Procedures

private subroutine DownBit1D(x, xr, nbits_to_keep, undef, flops, mpi_comm, rc)

Arguments

Type IntentOptional 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

private subroutine DownBit2D(x, xr, nbits_to_keep, undef, flops, mpi_comm, 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).

History

  • 06Dec2006 da Silva Initial version.

Arguments

Type IntentOptional 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

private subroutine DownBit3D(x, xr, nbits_to_keep, undef, flops, mpi_comm, rc)

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.

History

  • 06Dec2006 da Silva Initial version.

Arguments

Type IntentOptional 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