NCEPLIBS-g2c  1.6.4
reduce.c File Reference

Determines whether the number of groups should be increased in order to reduce the size of the large groups, and to make that adjustment. More...

#include <stdlib.h>
#include "grib2.h"

Go to the source code of this file.

Typedefs

typedef g2int integer
 Integer type. More...
 
typedef g2float real
 Float type. More...
 

Functions

int reduce (integer *kfildo, integer *jmin, integer *jmax, integer *lbit, integer *nov, integer *lx, integer *ndg, integer *ibit, integer *jbit, integer *kbit, integer *novref, integer *ibxx2, integer *ier)
 Determines whether the number of groups should be increased in order to reduce the size of the large groups, and to make that adjustment. More...
 

Detailed Description

Determines whether the number of groups should be increased in order to reduce the size of the large groups, and to make that adjustment.

Author
Harry Glahn, The Meteorological Development Lab (MDL)
Date
November 2001

Definition in file reduce.c.

Typedef Documentation

◆ integer

typedef g2int integer

Integer type.

Definition at line 14 of file reduce.c.

◆ real

typedef g2float real

Float type.

Definition at line 15 of file reduce.c.

Function Documentation

◆ reduce()

int reduce ( integer kfildo,
integer jmin,
integer jmax,
integer lbit,
integer nov,
integer lx,
integer ndg,
integer ibit,
integer jbit,
integer kbit,
integer novref,
integer ibxx2,
integer ier 
)

Determines whether the number of groups should be increased in order to reduce the size of the large groups, and to make that adjustment.

By reducing the size of the large groups, less bits may be necessary for packing the group sizes and all the information about the groups.

The reference for nov was removed in the calling routine so that kbit could be determined. This furnishes a starting point for the iterations in reduce. However, the reference must be considered.

PROGRAM HISTORY LOG

  • November 2001 Harry Glahn, The Meteorological Development Lab (MDL) tdl grib2
  • March 2002 Harry Glahn, The Meteorological Development Lab (MDL) comment ier = 715
  • March 2002 Harry Glahn, The Meteorological Development Lab (MDL) modified to accommodate lx=1 on entry

DATA SET USE

  • kfildo - unit number for output (print) file. (output)
Parameters
kfildounit number for output (print) file. (input)
jminthe minimum of each group (j=1,lx). it is possible after splitting the groups, jmin( ) will not be the minimum of the new group. this doesn't matter; jmin( ) is really the group reference and doesn't have to be the smallest value. (input/output)
jmaxthe maximum of each group (j=1,lx). (input/output)
lbitthe number of bits necessary to pack each group (j=1,lx). (input/output)
novthe number of values in each group (j=1,lx). (input/output)
lxthe number of groups. this will be increased if groups are split. (input/output)
ndgthe dimension of jmin( ), jmax( ), lbit( ), and nov( ). (input)
ibitthe number of bits necessary to pack the jmin(j) values, j=1,lx. (input)
jbitthe number of bits necessary to pack the lbit(j) values, j=1,lx. (input)
kbitthe number of bits necessary to pack the nov(j) values, j=1,lx. if the groups are split, kbit is reduced. (input/output)
novrefreference value for nov( ). (input)
ibxx22**j (j=0,30). (input)
iererror return. (output)
  • 0 = good return.
  • 714 = problem in algorithm. reduce aborted.
  • 715 = ngp not large enough. reduce aborted.
Returns
always returns 0, see parameter ier for error code.
ntotbt(j) = the total bits used for the packing bits j
                      (j=1,30). (internal)
 nboxj(j) = new boxes needed for the packing bits j
                      (j=1,30). (internal)
          newbox(l) = number of new boxes (groups) for each original
                      group (l=1,lx) for the current j. (automatic)
                      (internal)
         newboxp(l) = same as newbox( ) but for the previous j.
                      this eliminates recomputation. (automatic)
                      (internal)
              cfeed = contains the character representation
                      of a printer form feed. (character) (internal)
              ifeed = contains the integer value of a printer
                      form feed. (internal)
             iorigb = the original number of bits necessary
                      for the group values. (internal)
Author
Harry Glahn, The Meteorological Development Lab (MDL)
Date
November 2001

Definition at line 91 of file reduce.c.

Referenced by pack_gp().