- 积分
- 1626
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-1-5
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
利用160站降水,绘制单站的月降水量时间变化特征:
#Get file names
fn = 'E:/data/temp160/t16{:0>2d}.txt'
stfn = 'E:/data/temp160/st_160.csv'
#Get years
years = [
for y in range(1951, 2020):
years.append(y)
yearn = len(years)
stn = 160
monn=12
data = zeros([yearn,monn)
#Read station name and lon/lat
table = readtable(stfn, delimiter=',', format='%i%2s%2f')
stnames = table['Name'
#Get 1951-2016 Jan. temperature data of 北京
stname = u'北京'
stidx = stnames.index(stname)
#Read temperature data of 160 stations from data file
for i in range(monn):
datafn = fn.format(i+1)
temp = asciiread(datafn, shape=(yearn,stn))
temp = temp * 0.1
data[:,i = temp[:,stidx
xdata = mean(data,axis=0)
ydata = mean(data,axis=1)
xpos = 0.1
ypos = 0.2
width = 0.5
height = 0.5
fig = figure(figsize=[800,800)
ax1= fig.add_axes([xpos,ypos,width,height)
ax2= fig.add_axes([xpos,ypos+height,0.5,0.2)
ax3= fig.add_axes([xpos+width,ypos,0.2,0.5)
x = range(1,monn+1)
y = range(1951,2021)
ax1.contourf(data)
ax1.set_xticks(range(12))
ax1.set_xticklabels(x)
ax1.set_yticks(range(yearn))
ax1.set_yticklabels(years)
ax1.colorbar(orientation='horizontal')
ax1.set_xlabel(u'月', fontname=u'黑体')
ax1.set_ylabel(u'年', fontname=u'黑体')
ax2.bar(x,xdata,color='r')
ax2.set_axis_off()
ax3.barh(y,ydata,color='r',orientation='vertical')
ax3.set_axis_off()
|
-
评分
-
查看全部评分
|