Chris Beaumont's IDL Library

Download source code

single page | use frames     summary     class     fields     routine details     file attributes




result = wrap(value, range)

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.

Return value

Multiples of range are added to value to bring it in the range [0, range)


value in required

One or more values

range in required

A positive scalar which sets the top of the wrapped coordinate system.


Wrap 420 degrees into the range 0 - 360 degrees: IDL> result = wrap(720, 360) IDL> print, result 60 IDL> print, wrap(-1, 360) 359

File attributes

Modifcation date: Mon Mar 22 16:17:13 2010
Lines: 52