Ngl.normalize_angle
Normalizes any angle in degrees to be in the interval [0.,360.) or [-180.,180.).
Prototype
nangle = Ngl.normalize_angle(angle, option)
Arguments
angleAn angle in degrees.
optionAn option flag that is either zero or non-zero.
Return value
nangleIf the option argument is zero, then an angle equivalent to angle is returned in the half-open interval [0.,360.); if the option argument is non-zero, then an angle equivalent to angle is returned in the half-open interval [-180.,180.).
Description
For any angle an eqivalent angle is returned in either the interval [0.,360.) (option is zero) or the interval [-180.,180.) (option is non-zero).
Examples
The following Python script:
import Ngl print Ngl.normalize_angle(-400.,0) print Ngl.normalize_angle( -5.,0) print Ngl.normalize_angle( 10.,0) print Ngl.normalize_angle( 370.,0) print Ngl.normalize_angle(-400.,1) print Ngl.normalize_angle( -5.,1) print Ngl.normalize_angle( 10.,1) print Ngl.normalize_angle( 190.,1) Ngl.end()returns:
320.0 355.0 10.0 10.0 -40.0 -5.0 10.0 -170.0