我正在尝试将基本单元添加到我的数组中,以便使用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数据帧。
下面是我一直收到的错误:模块'metpy.units‘没有’AttributeError‘属性
如果我尝试一下,我会得到一个类似的错误: mpunits.meters
发布于 2021-01-10 07:00:32
如果您像这样进行导入,则需要执行以下操作:
mpunits.units.knots我们通常建议的获取单元注册表的规范方法是:
from metpy.units import units这样你就可以写下:
units.knotshttps://stackoverflow.com/questions/65638216
复制相似问题