SDS_REGRID(3)



NAME

     sds_regrid - regrid a sds to different  spacings  along  the
     independent axes


SYNOPSIS

     #include <soi_sds.h>
     #include <soi_fun.h>

     int sds_regrid (SDS *sds, int *lengths)


DESCRIPTION

     sds_regrid() resamples the data in a SDS so that the lengths
     of  each  of  the  independent  axes are as specified in the
     array lengths.  The data are interpolated to  the  new  grid
     with a two-dimensional cubic convolution algorithm.

     Currently sds_regrid() will only work  with  two-dimensional
     SDS's.  All others are returned unchanged.  This restriction
     may be removed in future releases.


EXAMPLES

     With length[0] = 768 and length[1] = 768, sds_regrid()  will
     interpolate  a  1024*512 data rectangle to a 768*768 square,
     stretching in one direction and compressing in the other.


DIAGNOSTICS

     The function returns the value (-1) if the SDS is  not  two-
     dimensional,  in  which case the data are unchanged.  Other-
     wise the function returns (0).


FILES

     ~CM/lib/_($MACH)/libsds.a
     ~CM/lib/_($MACH)/libfun.a


SEE ALSO

     sds_bin(3)


AUTHOR

     Rick Bogart


BUGS

     There is a discrepancy between the way the grid  is  indexed
     in  this  function and in the underlying interpolation func-
     tion, causing the regridded data to be slightly stretched or
     compacted.   Edge  effects are not properly handled, and the
     interpolator places zeroes around the edges.

     The data are internally converted to single-precision float-
     ing  point numbers for interpolation, then converted back to
     the original format; there may be  problems  with  the  fill
     value  not propagating correctly, and also with loss of sig-
     nificance.
     The length 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  axis
     length values should certainly be avoided.


HISTORY

     1996-12-16                      SOI Version 2.1