Meshgrid 2-D阵列

时间:2016-01-04 04:44:06

标签: python numpy matplotlib matplotlib-basemap

我想知道是否有办法为2D数组做Numpy.meshgrid 在我的代码中,我目前有

fig=plt.figure(i+3001)

m=Basemap(projection='merc',llcrnrlat=38.8908,urcrnrlat=39.1908,llcrnrlon=275.1911,urcrnrlon=275.4911,resolution='h')
px,py=Numpy.meshgrid(x1+360,y1)
X,Y=m(lon+360,lat)


m.drawcoastlines()
m.drawcountries()
m.drawstates()
m.fillcontinents(color='grey',alpha=0.1,lake_color='aqua')
m.drawcounties()


#plotting contours

cs=m.contourf(lon+360,lat,bprime1[i],levels=levels,cmap='jet',latlon=True,extend='both')
cs2=m.contour(lon+360,lat,bprime1[i],levels=levels,latlon=True,colors='k',linestyles='solid')

cbar=plt.colorbar(cs)
cbar.add_lines(cs2)
cbar.ax.set_ylabel('Cloud coverage')

plt.suptitle("CVG 12Z Cloud January 31,2017")
plt.show()

但我想使用我的lat和lon数组,它们都有尺寸((428),(614))。每当我尝试插入它们时,我都会收到此错误:

MemoryError                               Traceback (most recent call last)
C:\Users\jpkal\Documents\JP Kalb-NWA\Experiment4a.py in <module>()
    278 
    279    

M =底图(投影=&#39; MERC&#39;,llcrnrlat = 38.8908,urcrnrlat = 39.1908,llcrnrlon = 275.1911,urcrnrlon = 275.4911,分辨率=&#39; H&#39;) - &GT; 280 px,py = N.meshgrid(lon + 360,lat)     281 X,Y = m(lon + 360,lat)     282

在meshgrid中的

C:\ Users \ jpkal \ AppData \ Local \ Enthought \ Canopy \ User \ lib \ site-packages \ numpy \ lib \ function_base.pyc(* xi,** kwargs)    4113#返回完整的N-D矩阵(不仅是1-D矢量)    4114如果copy_: - &GT; 4115 mult_fact = np.ones(shape,dtype = int)    4116返回[x * mult_fact for x in output]    4117否则:

C:\ Users \ jpkal \ AppData \ Local \ Enthought \ Canopy \ User \ lib \ site-packages \ numpy \ core \ numeric.pyc in(shape,dtype,order)     188     189&#34;&#34;&#34; - &GT; 190 a =空(形状,dtype,顺序)     191 multiarray.copyto(a,1,cast =&#39;不安全&#39;)     192返回一个

MemoryError:

任何帮助都会很棒。

0 个答案:

没有答案