negativePiToPi

sargeom.coordinates.negativePiToPi(angle, degrees=True)[source]

Converts angles to the range from -180 to 180 degrees.

Parameters:
anglefloat or array_like

The input angle or a list/array of angles.

degreesbool, optional

If True (default), takes input angles in degrees and returns the angle in degrees. If False, takes input radians and returns the angle in radians.

Returns:
float or numpy.ndarray

The converted angle or an array of converted angles (in degrees or radians).

Examples

>>> negativePiToPi(190)
-170.0
>>> negativePiToPi([-190, 190])
array([ 170., -170.])