>  Docs Center  >  Libraries  >  Mankoff  >  KDM_RANGE






  This function converts a variable or array from one scale to
  another. The input data is assumed to be on the scale
  [min(data),max(data)] although this can be customized. It is
  converted to a new scale of the range
  [rangemin,rangemax]. Overflow and underflow can be customized.


Data massaging

Calling Sequence

result = KDM_RANGE( data, from, to )


DATA This is your input data set, either a single number or
multi-dimensional array
  FROM: A 2 element array specifying the [min,max] input range of DATA
  TO: A 2 element array specifying the desired output range of DATA

Keyword Parameters

  UNDERFLOW: This is value to set data points that convert to less
              than RANGEMIN
  OVERFLOW: This is value to set data points that convert to more
            than RANGEMAX


  This function returns the input array (data) scaled from FROM to TO


  Output is always float.


  Scale the input data to [0,1], then multiply by the desired


  data = [-1, 0, 0.1, 1]
  ; scale data to [0,100]
  print, kdm_range( data, from=minmax(data), to=[0,100] )
  ; -1 goes to 0, 1 goes to 100, and everything else betwixt...
  ; scale data to [-1,0] output, but force the data input range to
  ; [0,1]. Underflow (the -1 input value) should be set to -999
  print, kdm_range( data,from=[-1,1],to=[-1, 0], datamin=0, underflow=-999 )

Modification History

  Written by: Ken Mankoff, 2007-05.
2007-07-17: KDM. Re-wrote to use from and to arrays

© 2022 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us