NCL Website header
NCL Home > Documentation > Functions > Type converters


Converts values of type integer to values of type float and preserves metadata.


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 int2dble (
		x  : integer   

	return_val [dimsizes(x)] :  double



An array of any dimensionality and of type integer.

Return value

An array of the same size as x and of type double. The return variable will have all the original metadata.


This function converts values of type integer to values of type float and preserves metadata.

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, flt2dble


Example 1

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
   i = ispan(1,10,1)

   i@long_name = "sample"      ; attribute
   i!0         = "foo"         ; name dimension
   i&foo       = ispan (35,350,35) ; create bogus coordinate array

   iDble       = int2dble( i )
   print( iDble )
The returned variable will be of type double and will retain all metadata.

Variable: iDble
Type: double
Total Size: 40 bytes
            10 values
Number of Dimensions: 1
Dimensions and sizes:   [foo | 10]       <== retains dimension name
            foo: [35..350]               <== retains coordinate information
Number Of Attributes: 1
  long_name :   sample
(0)      1
(1)      2
(2)      3
(3)      4
(4)      5
(5)      6
(6)      7
(7)      8
(8)      9
(9)     10