属性错误:crs 属性不可用

问题描述 投票:0回答:1

所有, 我正在使用 metpy 0.10.0,我尝试使用 mpcalc.laplacian 函数计算字段的 laplacina,但出现以下错误: 属性错误:crs 属性不可用。

这是我的最小代码:

import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
import metpy.calc as mpcalc

myfile   = xr.open_dataset(diri+"vor_geo_era5_2023_jan.nc")
var_z    = myfile['z']   # geopotential m**2 S**-2
   
timeP     = myfile['time']
lonP      = myfile['longitude'].data
latPP     = myfile['latitude'].data
lap       = mpcalc.laplacian(var_z[:,:,:],axes=('latitude','longitude'))

我尝试使用

var_z.metpy.assign_latitudde_longitude(force=False)
,如图所示text,但出现以下错误 AttributeError:“MetPyAccessor”对象没有属性“assign_latitudde_longitude” 谢谢

python python-3.x metpy
1个回答
0
投票

上面的注释是正确的,错误表明你有一个拼写错误,正确的方法名称是

assign_latitude_longitude()

也就是说,此方法是在 MetPy 1.0 中添加的,因此您需要升级到更新版本的 MetPy 才能使其工作。

© www.soinside.com 2019 - 2024. All rights reserved.