>  Docs Center  >  Libraries  >  Motley  >  MGH_DIFF

MGH_DIFF

MGH_DIFF

Name


  MGH_DIFF

Purpose


  This function calculates differences between adjacent elements of
  an array. Currently it works only for 1D arrays and differences
  them only once. I am thinking about ways to generalise it.
  MGH_DIFF is similar to the standard IDL function, TS_DIFF, except
  that:
    - Differences are opposite in sign, ie. for an increasing
      sequence of numbers MGH_DIFF returns positive differences,
      whereas TS_DIFF returns negative differences.
    - MGH_DIFF does not pad the result with trailing zeroes.
    - MGH_DIFF does not support second and higher order differences
      via recursion (because I do not know if this would generalise
      well to higher dimensions).

Category


  Finite-difference grids.

Calling Sequence


  Result = MGH_DIFF(a)

Positional Parameters


  a (input, numeric array)
    An array representing values on the grid.
  d (input, integer scalar, optional)
    Dimension (1-based) along which differencing is to be done.

Return Value


  The function returns an array of the same type as the input,
  contracted by 1 along the specified dimension.
###########################################################################
  This software is provided subject to the following conditions:
  1. NIWA makes no representations or warranties regarding the
    accuracy of the software, the use to which the software may
    be put or the results to be obtained from the use of the
    software. Accordingly NIWA accepts no liability for any loss
    or damage (whether direct of indirect) incurred by any person
    through the use of or reliance on the software.
  2. NIWA is to be acknowledged as the original author of the
    software where the software is used or presented in any form.
###########################################################################

Modification History


  Mark Hadfield, 2003-07:
    Written for 1-dimensional input arrays only.
  Mark Hadfield, 2003-09:
    Generalised for n-dimensional input arrays.



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