>  Docs Center  >  Libraries  >  Motley  >  MGH_DIFF

MGH_DIFF

MGH_DIFF

Name


  MGH_DIFF

Purpose


  This function calculates differences between adjacent elements of
  an array. It handles inputs with any number for dimensions and
  differences them once. 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).

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.
###########################################################################
  Copyright (c) 2005-2012 NIWA:
  http://www.niwa.co.nz/
  Licensed under the MIT open source license:
  http://www.opensource.org/licenses/mit-license.php
###########################################################################

Modification History


  Mark Hadfield, 2003-07:
    Written for 1-dimensional input arrays only.
  Mark Hadfield, 2003-09:
    Generalised for n-dimensional input arrays.
  Mark Hadfield, 2015-01:
    - Documentation updated.
    - Source format updated.



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