SDS_BIN_SUM(3)



NAME

     sds_bin_average, sds_bin_sum, SDS_bin_average, SDS_bin_sum -
     rebin an sds


SYNOPSIS

     #include <soi_fun.h>

     int sds_bin_average  (sds, bins);
     int sds_bin_sum  (sds, bins);
     SDS *SDS_bin_average  (sds, bins);
     SDS *SDS_bin_sum  (sds, bins);
     SDS *sds;
     int *bins;


DESCRIPTION

     These functions rebin the data in a SDS according to the bin
     sizes  specified  in  the array bins.  The data structure is
     modified in place.  If the binsize along an axis  is  not  a
     factor of the original axis length, an extra element will be
     added representing an incomplete bin.

     sds_bin_average() averages all valid values  within  a  bin,
     while sds_bin_sum() simply sums them.

     SDS_bin_average() and SDS_bin_sum() are similar, but instead
     of  modifying  the argument SDS in place they return a newly
     created SDS appropriately binned from the original, but oth-
     erwise  identical; they may thus be used repeatedly from the
     same original SDS.


EXAMPLES

     With  bins[0]   =   2,   bins[1]   =   3,   bins[2]   =   1,
     sds_bin_average() will average a 1024*512*256 data cube to a
     512*171*256 cube.  The last  row  in  each  resulting  image
     plane  will  combine data from two rather than three rows of
     the original cube.


DIAGNOSTICS

     none


SEE ALSO

     sds_extract(3), sds_slice(3)


AUTHOR

     Rick Bogart


BUGS

     The data are internally converted  to  double-precision  for
     binning,  then  converted back to the original format; there
     may  be  problems  with  the  fill  value  not   propagating
     correctly.

     The bins array must be sized to the  rank  of  the  sds  and
     properly  set;  there  is  no  validity checking and strange
     things may result from improper  values.   Non-positive  bin
     sizes should certainly be avoided.


HISTORY

     1996-12-12                      SOI Version 2.1