等值线分析需要二维数组。
- fn = 'C:/Temp/11.txt'
- ncol = numasciicol(fn)
- nrow = numasciirow(fn)
- a = asciiread(fn,shape=(nrow,ncol))
- time = a[:,0]
- height = a[:,1]
- aod = a[:,2]
- tn = 144
- hn = len(aod) / tn
- tt = time[:144]
- h = height[::144]
- aod = aod.reshape((hn, tn))
- layer = contourf(tt, h, aod)
- colorbar(layer)
readtable也可以:
- fn = 'C:/Temp/11.txt'
- table = readtable(fn, format='%i%i%f', headerlines=-1, \
- colnames=['Time','Height','WindSpeed'])
- tt = table['Time']
- h = table['Height']
- ws = table['WindSpeed']
- tn = 144
- hn = len(ws) / tn
- tt = tt[:144]
- h = h[::144]
- ws = ws.reshape((hn, tn))
- layer = contourf(tt, h, ws)
- colorbar(layer)
|