我有一个包含200x200x38三维空间中的值的数据集。数据以[100100,z]为中心,其中z是高度,前两个值是水平x和y坐标。我试图创建一个横截面的可视化,该横截面沿半径和每个高度平均数据集中的值(使高度-半径平均)。你知道吗
Most efficient way to calculate radial profile 这篇文章描述了如何对2D数据集进行径向平均,中国̶̶b̶b̶̶b̶b̶b̶̶b̶b̶u̶u̶̶̶̶̶中国̶h̶h̶̶h̶h̶h该地区的t̶o̶o̶o̶̶o̶o̶o̶o̶o̶o̶o̶̶I̶f̶f 2.“I”̶v̶e̶d̶e̶f̶I̶n̶e̶d̶̶f̶f̶f̶f̶f̶u̶u̶n̶f̶f̶f̶f̶o̶u̶n̶c̶c̶c̶c̶c̶c̶c̶c̶c̶c̶c̶c̶c̶t̶t̶t m̶c̶e̶n̶t̶e̶r̶,中国̶̶̶̶̶̶̶̶̶̶̶̶̶̶̶̶̶̶̶c̶c̶c̶a̶c̶a̶c̶a̶a̶a̶r̶r̶t̶e̶e̶s̶s̶s̶e̶e̶s̶s̶s̶s̶c̶o̶o̶r̶d̶i̶n̶a̶t̶e̶s̶h̶a̶p̶e̶
def radial_profile(data, center):
y, x = np.indices((data.shape))
r = np.sqrt((x - center[0])**2 + (y - center[1])**2)
r = r.astype(np.int)
tbin = np.bincount(r.ravel(), data.ravel())
nr = np.bincount(r.ravel())
radialprofile = tbin / nr
return radialprofile
Cent=[100,100]
Rav=[]
for i in range(37):
B=ref[:,:,i,0]
if B == -999.9:
B=np.nan
RRR=radial_profile(B,Cent)
Rav.append(RRR)
plt.imshow(Rav, vmin=-15, vmax=70)
plt.colorbar();
plt.show()
使用这个我已经能够绘制它,但必须找出一种方法,从平均值中删除-999.9的值。我试图将其赋值为空,但没有成功。否则,这个阴谋就成功了。你知道吗
很抱歉,我应该更认真地去理解我在提问中提到的那个帖子。你知道吗
如果有人有任何更干净或有效的解决方案,我将不胜感激
相关问题 更多 >
编程相关推荐