
get_r2d
Return a constant that converts radians to degrees.
Available in version 6.4.0 and later.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" ; This library is automatically loaded ; from NCL V6.2.0 onward. ; No need for user to explicitly load. function get_r2d ( val : numeric or string ) return_val [scalar] : float or double
Arguments
valIf val is type numeric, and val is type "double", the returned constant will be type double; otherwise it will be type float.
If val is type string, and val="double" or val="d", the returned constant will be type double; otherwise it will be type float.
It is recommended that the value returned be the same numeric type as the variable(s) with which it will be used.
Return value
The returned scalar will be type double or float.
Description
A constant that is used to convert radians to degrees:
r2d = 180/PI
It is recommended that the value returned by get_r2d (get_d2r and get_pi) be the same numeric type as the variable(s) with which it will be used.
See Also
Examples
Example 1: In these examples, the 'r2d' to the left of the assignment can be any name (eg, 'radians_to_degrees', 'rad_to_deg', 'rad2deg', etc.'). 'r2d' is used for convenience.
r2d = get_r2d("double") ; type double; 57.29577951308232 r2d = get_r2d("float" ) ; type float ; 57.29578 r2d = get_r2d("d") ; type double; 57.29577951308232 r2d = get_r2d("f") ; type float ; 57.29578 r2d = get_r2d(1d0) ; type double r2d = get_r2d(1.0) ; type float r2d = get_r2d( 1 ) ; type float xf = 2.412 xd = 2.412d0 xi = 100 r2d = get_r2d(xd) ; type double; same type as 'xd' r2d = get_r2d(xf) ; type float ; same type as 'xf' r2d = get_r2d(xi) ; type float