【发布时间】:2017-10-23 13:18:46
【问题描述】:
我编写了以下脚本来使用 SkillMetrics 创建一个 taylor diagram,这是一个开源 Python 库,用于根据观察计算模型预测。
我写的脚本是:
import skill_metrics as sm
# Arrange datasets in array
stats1 = np.array([ref,m1])
stats2 = np.array([ref,m2])
stats3 = np.array([ref,m3])
# calculating statistics
taylor_stats1 = sm.taylor_statistics(stats1[0],stats1[1])
taylor_stats2 = sm.taylor_statistics(stats2[0],stats2[1])
taylor_stats3 = sm.taylor_statistics(stats3[0],stats3[1])
# Store statistics in arrays
sdev = np.array([taylor_stats1['sdev'][0], taylor_stats1['sdev'][1],
taylor_stats2['sdev'][1], taylor_stats3['sdev'][1]])
crmsd = np.array([taylor_stats1['crmsd'][0], taylor_stats1['crmsd'][1],
taylor_stats2['crmsd'][1], taylor_stats3['crmsd'][1]])
ccoef = np.array([taylor_stats1['ccoef'][0], taylor_stats1['ccoef'][1],
taylor_stats2['ccoef'][1], taylor_stats3['ccoef'][1]])
产生:
sdev = array([ 0.02556107, 0.06264893, 0.06264893, 0.06264893])
crmsd = array([ 0. , 0.04918169, 0.04824091, 0.05082715])
ccoef = array([ 1. , 0.67423927, 0.68388202, 0.64162831])
然后我运行以下命令来创建泰勒图:
sm.taylor_diagram(sdev,crmsd,ccoef)
但是,我随后收到此错误:
shape mismatch: value array of shape (2,) could not be broadcast to indexing result of shape (1,)
【问题讨论】:
标签: python numpy matplotlib