NCL Home > Documentation > Functions > Type converters


Converts values of type byte to values of type float.


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 byte2flt (
		x  : byte   

	return_val [dimsizes(x)] :  float



An array of any dimensionality. Must be of type byte.

Return value

An array of the same size as x. Type float.


This function converts byte data to float using the "scale" and "offset" attributes (if present), and preserves metadata.

Other attributes similar to "scale" and "offset" will be recognized:

"add_offset", "OFFSET", "Offset", "_offset", "Intercept", "intercept"
"SCALE", "Scale", "_scale", "scale_factor", "Scale_factor", "Slope" , "slope"
Note: this function is slightly different than the built-in set of conversion functions (like floattointeger and shorttobyte), because it requires loading the "contributed.ncl" script and it preserves metadata. It has a slightly different naming style than the built-in functions, just to set it apart from these other functions.

See Also

short2flt, dble2flt, flt2dble