Would you prefer that I implement this in utils.py?

On 4/24/2013 6:55 AM, Luke Campbell wrote:
> In ion_functions/data/adcp_functions.py:
>
>> @@ -282,8 +282,14 @@ def adcp_magvar(theta, uu, vv):
>>          [np.cos(theta_rad), np.sin(theta_rad)],
>>          [-np.sin(theta_rad), np.cos(theta_rad)]
>>      ])
>> -
>> -    nbins = len(uu)
>> +
>> +    if np.size(uu) is 1 and isinstance(uu,float):
>> +        uu = np.array([uu])
>> +    if np.size(vv) is 1 and isinstance(vv,float):
>
> identifying floats in this manner is also dangerous and with the
> intermixing of |numpy| types and python types it's really challenging.
> What I have been using to check if something is a float type:
>
> import  numpy  as  np
>
> def  is_float(val):
>      if  isinstance(val,float):  return  True
>      if  isinstance(val,  np.number)  and  val.dtype.char  in  'efdg':  return  True
>      return  False
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/ooici/ion-functions/pull/18/files#r3936971>.
>