WRAP
Purpose
This function wraps one or more values into the range [0,
range). If the values are positive, this function is identical to
the mod operator. Any negative values compute to (value mod range)
+ range.
Category
Utilities
Calling Sequence
result = wrap(value, range)
Inputs
value: One or more values
range: A positive scalar which sets the top of the wrapped
coordinate system.
Outputs
Multiples of range are added to value to bring it in the range [0,
range)
Example
Wrap 420 degrees into the range 0 - 360 degrees:
IDL> result = wrap(720, 360)
IDL> print, result
60
IDL> print, wrap(-1, 360)
359
Modification History
March 2009: Written by Chris Beaumont