登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
参考NCL的例子(http://www.ncl.ucar.edu/Applications/bar.shtml),用MeteoInfoLab脚本绘制了Darwin Southern Oscillation Index。数据文件里date变量是年和月的整数,比如199001,将此数据转换为日期列表作为x轴绘图。还有颜色的处理也很简单。
- fn = 'D:/Temp/nc/soi.nc'
- f = addfile(fn)
- yms = f['date'][::8] #Year and month
- dsoik = f['DSOI_KET'][::8] #Darwin SOI Index via KET 11pt Smth
- dsoid = f['DSOI_DEC'][::8] #Darwin Decadal SOI Index
- #Set dates and colors
- dates = []
- cols = []
- for ym,d in zip(yms,dsoik):
- dates.append(datetime.datetime(ym / 100, ym % 100, 1))
- if d >= 0:
- cols.append('r')
- else:
- cols.append('b')
- #Bar plot
- bar(dates, dsoik, color=cols, edgecolor=None)
- xlim(dates[0], dates[-1])
- ylim(-3, 3)
- xaxis(axistype='time', minortick=True, tickin=False)
- yaxis(minortick=True, tickin=False)
- ylabel('Anomalias')
- title('Darwin Southern Oscillation Index')
|