0
Eddy Kinetic Energy를 플롯하기위한 Python 코드를 작성 중입니다. 나는 Python에 상당히 익숙하지 않으며 내가 얻은 오류에 대해 혼란 스럽다. 지도에 내 데이터를 플로팅하는 것에 대해 걱정하지 않아도 단지 음모를 낼 수 있는지 알고 싶습니다.왜이 오류가 발생합니까? TypeError : 입력은 2D 배열이어야합니다.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from pylab import *
from netCDF4 import Dataset
from mpl_toolkits.basemap import Basemap
import matplotlib.cm as cm
from mpl_toolkits.basemap import shiftgrid
test = Dataset('p.34331101.atmos_daily.nc', 'r')
lat = test.variables['lat'][:]
lon = test.variables['lon'][:]
level = test.variables['level'][5]
time = test.variables['time'][:]
u = test.variables['ucomp'][:]
v = test.variables['vcomp'][:]
temp = test.variables['temp'][:]
print(lat.shape)
print(u.shape)
#uz = np.reshape(u, (30, 26, 90))
uzm = np.nanmean(u, axis=3)
#vz = np.reshape(v, (30, 26, 90))
vzm = np.nanmean(v, axis=3)
print(uzm.shape)
ustar = u-uzm[:,:,:,np.newaxis]
vstar = v-vzm[:,:,:,np.newaxis]
EKE = np.nanmean(.5*(ustar**2 + vstar**2), axis=3)
EKE1 = np.asarray(EKE)
%matplotlib inline
print(EKE.shape)
levels=[-10, -5, 0, 5, 10]
plt.contour(EKE[1,1,:])
#EKE is time, level, lat and the shape is (30, 26, 90)
형식 오류 : 입력이 2 차원 배열해야합니다 여기에 내 코드 및 오류입니다.