import numpy as np
def wind_speed(u,v):
""" calculate wind speed from u and v
Input paramters:
u and v components of wind
as NumPy arrays fo any rank
u and v should be the same size
Returns:
a Numpy array of the wind speed
with the same shape as u and v
"""
return np.sqrt(u**2+v**2)
# create random wind components
# with gaussian distribution
# and dummy unit!
u=np.random.normal(0,1,(18,36))
v=np.random.normal(0,1,(18,36))
wspeed=wind_speed(u,v)
print u[0:5,0:5]
print v[0:5,0:5]
print wspeed[0:5,0:5]
print wspeed.mean()