我正在尝试将基本单位添加到我的数组中以使用 Metpy 进行计算。使用函数调用metpy.units.meters(或.knots 或.degrees)不起作用。
这是我的代码片段:
import metpy.units as mpunits
...
wind_speed = webSKNT.values * mpunits.knots
wind_dir = webDRCT .values * mpunits.degrees
webu, webv = mpcalc.wind_components(wind_speed, wind_dir)
其中 webSKNT 和 webDRCT 是 pandas 数据帧。
这是我不断收到的错误: AttributeError: module 'metpy.units' has no attribute 'knots'
如果我尝试,我会收到类似的错误:mpunits.meters