ProjError:x、y、z 和时间必须相同

问题描述

如何修复 *ProjError: x,y,z,and time must be same size+ 错误

我正在加载一个 .nc 文件并查看数据集。

latlon 属于数据交换 Basemap 类型。

但是错误信息调用了三个估值。 xyz

XU_OCEAN_uv = uv.variables['XU_OCEAN'][:]
YU_OCEAN_uv = uv.variables['YU_OCEAN'][:]

lon_0 = XU_OCEAN_uv.mean()
lat_0 = YU_OCEAN_uv.mean()

fig = plt.figure(figsize=[12,15])

plt.rc("font",size=20)
plt.rcParams['font.family'] = 'New Century Schoolbook'

from datetime import datetime
fig = plt.figure(figsize=[12,15])

m = Basemap(width=5000000,height=3500000,resolution='l',projection='stere',\
               lat_ts=40,lat_0=lat_0,lon_0=lon_0)



m.drawcoastlines()
m.drawcountries()
m.drawmapboundary(fill_color='white')
m.drawparallels(np.arange(-90,91,30),labels=[1,0],dashes=[2,2])
m.drawmeridians(np.arange(0,361,60),labels=[0,1],2]) 



VO_uv_firsttimestep = VO_uv[0,:,:]
cs = m.pcolor(LON,LAT,VO_uv_firsttimestep)

cbar = m.colorbar(cs,location='bottom',pad="10%")
cbar.set_label(VO_uv_units)

# Add Title
plt.title('sea level height')

plt.show()

数据集如下所示:

enter image description here

错误代码是:

---------------------------------------------------------------------------
ProjError                                 Traceback (most recent call last)
<ipython-input-59-abf5ef221078> in <module>
     26 
     27 #m.scatter(X,Y,c=VAL,s=1.0,marker="s",zorder=1,vmin=0,vmax=1200,cmap=plt.cm.get_cmap('jet'),alpha=1.0)
---> 28 LON,LAT = m(XU_OCEAN_uv,YU_OCEAN_uv)
     29 
     30 VO_uv_firsttimestep = VO_uv[0,:]

/opt/anaconda3/envs/py37/lib/python3.7/site-packages/mpl_toolkits/basemap/__init__.py in         __call__(self,x,inverse)
   1186             except TypeError:
   1187                 y = [_dg2rad*yy for yy in y]
-> 1188         xout,yout = self.projtran(x,inverse=inverse)
   1189         if self.celestial and inverse:
   1190             try:

/opt/anaconda3/envs/py37/lib/python3.7/site-packages/mpl_toolkits/basemap/proj.py in     __call__(self,*args,**kw)
    291             outxy = self._proj4(xy,inverse=inverse)
    292         else:
--> 293             outx,outy = self._proj4(x,inverse=inverse)
    294         if inverse:
    295             if self.projection in ['merc','mill','gall']:

/opt/anaconda3/envs/py37/lib/python3.7/site-packages/pyproj/proj.py in __call__(self,longitude,latitude,inverse,errcheck,radians)
    185             direction=direction,186             errcheck=errcheck,--> 187             radians=radians,188         )
    189 

/opt/anaconda3/envs/py37/lib/python3.7/site-packages/pyproj/transformer.py in     transform(self,xx,yy,zz,tt,radians,direction)
    493             direction=direction,494             radians=radians,--> 495             errcheck=errcheck,496         )
    497         # if inputs were lists,tuples or floats,convert back.

pyproj/_transformer.pyx in pyproj._transformer._Transformer._transform()

ProjError: x,and time must be same size

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...