def apply(self):
sc = self.scene
org = self.original
factor = self.factor
sx, sy = sc.displacement.shape
gx, gy = num.ogrid[0:sx, 0:sy]
regions = sy/factor * (gx/factor) + gy/factor
indices = num.arange(regions.max() + 1)
def block_downsample(arr):
res = ndimage.mean(
arr,
labels=regions,
index=indices)
res.shape = (sx/factor, sy/factor)
return res
sc.displacement = block_downsample(sc.displacement)
sc.theta = block_downsample(sc.theta)
sc.phi = block_downsample(sc.phi)
sc.frame.dLat = org['frame.dLat'] * self.factor
sc.frame.dLon = org['frame.dLat'] * self.factor
评论列表
文章目录