All,
To support some generic data processing, I would like to find a
numeric type converter that takes a numeric (or double) input, and
converts to a numeric type specified by a string "type" argument such
as argument 2 of the "new" function. For example:
y = type_convert (x, "float")
Or more generically, what I am really trying to do:
y = type_convert (x, data_type)
Where "data_type" is a string containing the name of any legal NCL data type.
The following does not work for some output types, because NCL checks
for loss of precision in assignments, a valuable feature.
y = new (1, data_type)
y = x
Does anyone know a nice way to do this without a stack of if
statements? I did not find anything like this on the type converters
page. Thank you.
--Dave
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu May 17 16:26:15 2012
This archive was generated by hypermail 2.1.8 : Fri May 25 2012 - 08:35:50 MDT