MetPy
MetPy copied to clipboard
storm_relative_helicity,The example code for this function cannot run
What went wrong?
I copied the example code of this function, but when it runs, an error occurs. What is the problem
Operating System
Windows
Version
1.6.2
Python Version
3.9
Code to Reproduce
from metpy.calc import storm_relative_helicity, wind_components
from metpy.units import units
# set needed values of pressure, height, wind direction/speed
p = [1000, 925, 850, 700, 500, 400] * units.hPa
h = [250, 700, 1500, 3100, 5720, 7120] * units.meters
wdir = [165, 180, 190, 210, 220, 250] * units.degree
sped = [5, 15, 20, 30, 50, 60] * units.knots
# compute wind components
u, v = wind_components(sped, wdir)
# compute SRH with a storm vector
storm_relative_helicity(h, u, v, depth=1 * units.km,
storm_u=7 * units('m/s'), storm_v=7 * units('m/s'))
Errors, Traceback, and Logs
Traceback (most recent call last):
File "D:\python\3.10 fog\5.py", line 11, in <module>
storm_relative_helicity(h, u, v, depth=1 * units.km,
File "E:\anaconda\envs\python\lib\site-packages\metpy\xarray.py", line 1330, in wrapper
result = func(*bound_args.args, **bound_args.kwargs)
File "E:\anaconda\envs\python\lib\site-packages\metpy\units.py", line 333, in wrapper
return func(*args, **kwargs)
File "E:\anaconda\envs\python\lib\site-packages\metpy\calc\kinematics.py", line 848, in storm_relative_helicity
_, u, v = get_layer_heights(height, depth, u, v, with_agl=True, bottom=bottom)
File "E:\anaconda\envs\python\lib\site-packages\metpy\xarray.py", line 1330, in wrapper
result = func(*bound_args.args, **bound_args.kwargs)
File "E:\anaconda\envs\python\lib\site-packages\metpy\units.py", line 333, in wrapper
return func(*args, **kwargs)
File "E:\anaconda\envs\python\lib\site-packages\metpy\calc\tools.py", line 476, in get_layer_heights
sfc_height = np.min(height)
TypeError: no implementation found for 'numpy.min' on types that implement __array_function__: [<class 'pint.util.Quantity'>]