def ds2uv(d, s): ''' Calculate U/V from wind direction and wind speed. :param d: (*array_like*) Wind direction. :param s: (*array_like*) Wind speed. :returns: Wind U/V. ''' if isinstance(d, (MIArray, DimArray)): r = ArrayMath.ds2uv(d.asarray(), s.asarray()) return MIArray(r[0]), MIArray(r[1]) else: r = ArrayMath.ds2uv(d, s) return r[0], r[1]
def ds2uv(d, s): ''' Calculate U/V from wind direction and wind speed. :param d: (*array_like*) Wind direction. :param s: (*array_like*) Wind speed. :returns: Wind U/V. ''' if isinstance(d, MIArray): r = ArrayMath.ds2uv(d.asarray(), s.asarray()) u = MIArray(r[0]) v = MIArray(r[1]) if isinstance(d, DimArray) and isinstance(s, DimArray): u = DimArray(u, d.dims, d.fill_value, d.proj) v = DimArray(v, d.dims, d.fill_value, d.proj) return u, v else: r = ArrayMath.ds2uv(d, s) return r[0], r[1]