-3
我从来没有使用Python,我从手册中看到一段代码,我很想知道它是什么意思。-Python剧情代码
这是从手动代码:
import h5py
h5file = h5py.File('Output/ScottCreek250b/simulation.results.DY.hdf5')
channel_flows = h5file['Channel/Qc_out'][...]
plt.plot(channel_flows[:, 0])
plt.ylim((-0.01,0.01))
plt.title('Streamflow at outlet', fontweight='bold')
plt.ylabel('Flow ($\mathbf{m^3/s}$)')
plt.xlabel('Model time-steps (24 hours)')
我想知道这是什么二线的意思,尤其是[...]
,什么是[:, 0]
和[:, :10]
代表。
channel_flows = h5file['Channel/Qc_out'][...]
plt.plot(channel_flows[:, 0])
soil_stores = h5file['Soil/V_s'][...]
plt.plot(soil_stores[:, :10])
这就是'numpy'索引 - 请参阅http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html – jonrsharpe
我可以假设数据结构与列表目标类似于R或像3D阵列? [...]将表示x,y,z值。 –
我不知道R - 阅读我已经链接到的文档,这解释了它是如何工作的。 – jonrsharpe